blob: 95ac8a027362708761b6097b0331e70ef6de6fb1 [file] [log] [blame]
/**
* Copyright (c) 2014,2016 Loetz GmbH&Co.KG (Heidelberg)
* 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:
* Loetz GmbH&Co.KG - Initial implementation
*
*/
package org.eclipse.osbp.xtext.menu.impl;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;
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.osbp.xtext.menu.MenuDslPackage;
import org.eclipse.osbp.xtext.menu.MenuModel;
import org.eclipse.osbp.xtext.menu.MenuPackage;
import org.eclipse.xtext.xtype.XImportSection;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Menu Model</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.osbp.xtext.menu.impl.MenuModelImpl#getImportSection <em>Import Section</em>}</li>
* <li>{@link org.eclipse.osbp.xtext.menu.impl.MenuModelImpl#getMenupackage <em>Menupackage</em>}</li>
* </ul>
*
* @generated
*/
public class MenuModelImpl extends MinimalEObjectImpl.Container implements MenuModel {
/**
* 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;
/**
* The cached value of the '{@link #getMenupackage() <em>Menupackage</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getMenupackage()
* @generated
* @ordered
*/
protected MenuPackage menupackage;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected MenuModelImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return MenuDslPackage.Literals.MENU_MODEL;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public XImportSection getImportSection() {
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, MenuDslPackage.MENU_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 - MenuDslPackage.MENU_MODEL__IMPORT_SECTION, null, msgs);
if (newImportSection != null)
msgs = ((InternalEObject)newImportSection).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - MenuDslPackage.MENU_MODEL__IMPORT_SECTION, null, msgs);
msgs = basicSetImportSection(newImportSection, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, MenuDslPackage.MENU_MODEL__IMPORT_SECTION, newImportSection, newImportSection));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public MenuPackage getMenupackage() {
return menupackage;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetMenupackage(MenuPackage newMenupackage, NotificationChain msgs) {
MenuPackage oldMenupackage = menupackage;
menupackage = newMenupackage;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, MenuDslPackage.MENU_MODEL__MENUPACKAGE, oldMenupackage, newMenupackage);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setMenupackage(MenuPackage newMenupackage) {
if (newMenupackage != menupackage) {
NotificationChain msgs = null;
if (menupackage != null)
msgs = ((InternalEObject)menupackage).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - MenuDslPackage.MENU_MODEL__MENUPACKAGE, null, msgs);
if (newMenupackage != null)
msgs = ((InternalEObject)newMenupackage).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - MenuDslPackage.MENU_MODEL__MENUPACKAGE, null, msgs);
msgs = basicSetMenupackage(newMenupackage, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, MenuDslPackage.MENU_MODEL__MENUPACKAGE, newMenupackage, newMenupackage));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case MenuDslPackage.MENU_MODEL__IMPORT_SECTION:
return basicSetImportSection(null, msgs);
case MenuDslPackage.MENU_MODEL__MENUPACKAGE:
return basicSetMenupackage(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 MenuDslPackage.MENU_MODEL__IMPORT_SECTION:
return getImportSection();
case MenuDslPackage.MENU_MODEL__MENUPACKAGE:
return getMenupackage();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case MenuDslPackage.MENU_MODEL__IMPORT_SECTION:
setImportSection((XImportSection)newValue);
return;
case MenuDslPackage.MENU_MODEL__MENUPACKAGE:
setMenupackage((MenuPackage)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case MenuDslPackage.MENU_MODEL__IMPORT_SECTION:
setImportSection((XImportSection)null);
return;
case MenuDslPackage.MENU_MODEL__MENUPACKAGE:
setMenupackage((MenuPackage)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case MenuDslPackage.MENU_MODEL__IMPORT_SECTION:
return importSection != null;
case MenuDslPackage.MENU_MODEL__MENUPACKAGE:
return menupackage != null;
}
return super.eIsSet(featureID);
}
} //MenuModelImpl