blob: 67507440d7e40c358a806424fe629766ccfaf00f [file] [log] [blame]
/**
* Copyright (c) 2011, 2015 - Lunifera GmbH (Gross Enzersdorf, Austria), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Florian Pirchner - Initial implementation
*/
package org.eclipse.osbp.ecview.semantic.uimodel.impl;
import java.util.Collection;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.MinimalEObjectImpl;
import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;
import org.eclipse.osbp.ecview.semantic.uimodel.UiModel;
import org.eclipse.osbp.ecview.semantic.uimodel.UiModelPackage;
import org.eclipse.osbp.ecview.semantic.uimodel.UiRootElements;
import org.eclipse.xtext.xtype.XImportSection;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Ui Model</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.osbp.ecview.semantic.uimodel.impl.UiModelImpl#getId <em>Id</em>}</li>
* <li>{@link org.eclipse.osbp.ecview.semantic.uimodel.impl.UiModelImpl#getName <em>Name</em>}</li>
* <li>{@link org.eclipse.osbp.ecview.semantic.uimodel.impl.UiModelImpl#getPackageName <em>Package Name</em>}</li>
* <li>{@link org.eclipse.osbp.ecview.semantic.uimodel.impl.UiModelImpl#getRoots <em>Roots</em>}</li>
* <li>{@link org.eclipse.osbp.ecview.semantic.uimodel.impl.UiModelImpl#getImportSection <em>Import Section</em>}</li>
* </ul>
*
* @generated
*/
public class UiModelImpl extends MinimalEObjectImpl.Container implements UiModel {
/**
* The default value of the '{@link #getId() <em>Id</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getId()
* @generated
* @ordered
*/
protected static final String ID_EDEFAULT = null;
/**
* The cached value of the '{@link #getId() <em>Id</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getId()
* @generated
* @ordered
*/
protected String id = ID_EDEFAULT;
/**
* The default value of the '{@link #getName() <em>Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getName()
* @generated
* @ordered
*/
protected static final String NAME_EDEFAULT = null;
/**
* The cached value of the '{@link #getName() <em>Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getName()
* @generated
* @ordered
*/
protected String name = NAME_EDEFAULT;
/**
* The default value of the '{@link #getPackageName() <em>Package Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getPackageName()
* @generated
* @ordered
*/
protected static final String PACKAGE_NAME_EDEFAULT = null;
/**
* The cached value of the '{@link #getPackageName() <em>Package Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getPackageName()
* @generated
* @ordered
*/
protected String packageName = PACKAGE_NAME_EDEFAULT;
/**
* The cached value of the '{@link #getRoots() <em>Roots</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getRoots()
* @generated
* @ordered
*/
protected EList<UiRootElements> roots;
/**
* The cached value of the '{@link #getImportSection() <em>Import Section</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getImportSection()
* @generated
* @ordered
*/
protected XImportSection importSection;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected UiModelImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return UiModelPackage.Literals.UI_MODEL;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getId() {
return id;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setId(String newId) {
String oldId = id;
id = newId;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, UiModelPackage.UI_MODEL__ID, oldId, id));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*/
public String getName() {
return getPackageName();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*/
public void setName(String newName) {
String oldName = name;
name = newName;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, UiModelPackage.UI_MODEL__NAME, oldName, name));
setPackageName(newName);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getPackageName() {
return packageName;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setPackageName(String newPackageName) {
String oldPackageName = packageName;
packageName = newPackageName;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, UiModelPackage.UI_MODEL__PACKAGE_NAME, oldPackageName, packageName));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<UiRootElements> getRoots() {
if (roots == null) {
roots = new EObjectContainmentEList.Resolving<UiRootElements>(UiRootElements.class, this, UiModelPackage.UI_MODEL__ROOTS);
}
return roots;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public XImportSection getImportSection() {
if (importSection != null && importSection.eIsProxy()) {
InternalEObject oldImportSection = (InternalEObject)importSection;
importSection = (XImportSection)eResolveProxy(oldImportSection);
if (importSection != oldImportSection) {
InternalEObject newImportSection = (InternalEObject)importSection;
NotificationChain msgs = oldImportSection.eInverseRemove(this, EOPPOSITE_FEATURE_BASE - UiModelPackage.UI_MODEL__IMPORT_SECTION, null, null);
if (newImportSection.eInternalContainer() == null) {
msgs = newImportSection.eInverseAdd(this, EOPPOSITE_FEATURE_BASE - UiModelPackage.UI_MODEL__IMPORT_SECTION, null, msgs);
}
if (msgs != null) msgs.dispatch();
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, UiModelPackage.UI_MODEL__IMPORT_SECTION, oldImportSection, importSection));
}
}
return importSection;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public XImportSection basicGetImportSection() {
return importSection;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetImportSection(XImportSection newImportSection, NotificationChain msgs) {
XImportSection oldImportSection = importSection;
importSection = newImportSection;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, UiModelPackage.UI_MODEL__IMPORT_SECTION, oldImportSection, newImportSection);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setImportSection(XImportSection newImportSection) {
if (newImportSection != importSection) {
NotificationChain msgs = null;
if (importSection != null)
msgs = ((InternalEObject)importSection).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - UiModelPackage.UI_MODEL__IMPORT_SECTION, null, msgs);
if (newImportSection != null)
msgs = ((InternalEObject)newImportSection).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - UiModelPackage.UI_MODEL__IMPORT_SECTION, null, msgs);
msgs = basicSetImportSection(newImportSection, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, UiModelPackage.UI_MODEL__IMPORT_SECTION, newImportSection, newImportSection));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case UiModelPackage.UI_MODEL__ROOTS:
return ((InternalEList<?>)getRoots()).basicRemove(otherEnd, msgs);
case UiModelPackage.UI_MODEL__IMPORT_SECTION:
return basicSetImportSection(null, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case UiModelPackage.UI_MODEL__ID:
return getId();
case UiModelPackage.UI_MODEL__NAME:
return getName();
case UiModelPackage.UI_MODEL__PACKAGE_NAME:
return getPackageName();
case UiModelPackage.UI_MODEL__ROOTS:
return getRoots();
case UiModelPackage.UI_MODEL__IMPORT_SECTION:
if (resolve) return getImportSection();
return basicGetImportSection();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case UiModelPackage.UI_MODEL__ID:
setId((String)newValue);
return;
case UiModelPackage.UI_MODEL__NAME:
setName((String)newValue);
return;
case UiModelPackage.UI_MODEL__PACKAGE_NAME:
setPackageName((String)newValue);
return;
case UiModelPackage.UI_MODEL__ROOTS:
getRoots().clear();
getRoots().addAll((Collection<? extends UiRootElements>)newValue);
return;
case UiModelPackage.UI_MODEL__IMPORT_SECTION:
setImportSection((XImportSection)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case UiModelPackage.UI_MODEL__ID:
setId(ID_EDEFAULT);
return;
case UiModelPackage.UI_MODEL__NAME:
setName(NAME_EDEFAULT);
return;
case UiModelPackage.UI_MODEL__PACKAGE_NAME:
setPackageName(PACKAGE_NAME_EDEFAULT);
return;
case UiModelPackage.UI_MODEL__ROOTS:
getRoots().clear();
return;
case UiModelPackage.UI_MODEL__IMPORT_SECTION:
setImportSection((XImportSection)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case UiModelPackage.UI_MODEL__ID:
return ID_EDEFAULT == null ? id != null : !ID_EDEFAULT.equals(id);
case UiModelPackage.UI_MODEL__NAME:
return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
case UiModelPackage.UI_MODEL__PACKAGE_NAME:
return PACKAGE_NAME_EDEFAULT == null ? packageName != null : !PACKAGE_NAME_EDEFAULT.equals(packageName);
case UiModelPackage.UI_MODEL__ROOTS:
return roots != null && !roots.isEmpty();
case UiModelPackage.UI_MODEL__IMPORT_SECTION:
return importSection != null;
}
return super.eIsSet(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String toString() {
if (eIsProxy()) return super.toString();
StringBuffer result = new StringBuffer(super.toString());
result.append(" (id: ");
result.append(id);
result.append(", name: ");
result.append(name);
result.append(", packageName: ");
result.append(packageName);
result.append(')');
return result.toString();
}
} //UiModelImpl