| /******************************************************************************* |
| * Copyright (c) 2013 CEA LIST. |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License v1.0 |
| * which accompanies this distribution, and is available at |
| * http://www.eclipse.org/legal/epl-v10.html |
| * |
| * Contributors: |
| * Cedric Dumoulin - cedric.dumoulin@lifl.fr |
| ******************************************************************************/ |
| /** |
| */ |
| package org.eclipse.papyrus.layers.stackmodel.layers.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.emf.ecore.util.EcoreUtil; |
| import org.eclipse.papyrus.layers.stackmodel.layers.LayerApplicationFactory; |
| import org.eclipse.papyrus.layers.stackmodel.layers.LayersPackage; |
| import org.eclipse.papyrus.layers.stackmodel.layers.LayersStackApplication; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Layer Application Factory</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * <ul> |
| * <li>{@link org.eclipse.papyrus.layers.stackmodel.layers.impl.LayerApplicationFactoryImpl#getApplication <em>Application</em>}</li> |
| * </ul> |
| * </p> |
| * |
| * @generated |
| */ |
| public class LayerApplicationFactoryImpl extends MinimalEObjectImpl.Container implements LayerApplicationFactory { |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| protected LayerApplicationFactoryImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return LayersPackage.Literals.LAYER_APPLICATION_FACTORY; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public LayersStackApplication getApplication() { |
| if (eContainerFeatureID() != LayersPackage.LAYER_APPLICATION_FACTORY__APPLICATION) { |
| return null; |
| } |
| return (LayersStackApplication) eInternalContainer(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public NotificationChain basicSetApplication(LayersStackApplication newApplication, NotificationChain msgs) { |
| msgs = eBasicSetContainer((InternalEObject) newApplication, LayersPackage.LAYER_APPLICATION_FACTORY__APPLICATION, msgs); |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public void setApplication(LayersStackApplication newApplication) { |
| if (newApplication != eInternalContainer() || (eContainerFeatureID() != LayersPackage.LAYER_APPLICATION_FACTORY__APPLICATION && newApplication != null)) { |
| if (EcoreUtil.isAncestor(this, newApplication)) { |
| throw new IllegalArgumentException("Recursive containment not allowed for " + toString()); |
| } |
| NotificationChain msgs = null; |
| if (eInternalContainer() != null) { |
| msgs = eBasicRemoveFromContainer(msgs); |
| } |
| if (newApplication != null) { |
| msgs = ((InternalEObject) newApplication).eInverseAdd(this, LayersPackage.LAYERS_STACK_APPLICATION__FACTORY, LayersStackApplication.class, msgs); |
| } |
| msgs = basicSetApplication(newApplication, msgs); |
| if (msgs != null) { |
| msgs.dispatch(); |
| } |
| } |
| else if (eNotificationRequired()) { |
| eNotify(new ENotificationImpl(this, Notification.SET, LayersPackage.LAYER_APPLICATION_FACTORY__APPLICATION, newApplication, newApplication)); |
| } |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| switch (featureID) { |
| case LayersPackage.LAYER_APPLICATION_FACTORY__APPLICATION: |
| if (eInternalContainer() != null) { |
| msgs = eBasicRemoveFromContainer(msgs); |
| } |
| return basicSetApplication((LayersStackApplication) otherEnd, msgs); |
| } |
| return super.eInverseAdd(otherEnd, featureID, msgs); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| switch (featureID) { |
| case LayersPackage.LAYER_APPLICATION_FACTORY__APPLICATION: |
| return basicSetApplication(null, msgs); |
| } |
| return super.eInverseRemove(otherEnd, featureID, msgs); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) { |
| switch (eContainerFeatureID()) { |
| case LayersPackage.LAYER_APPLICATION_FACTORY__APPLICATION: |
| return eInternalContainer().eInverseRemove(this, LayersPackage.LAYERS_STACK_APPLICATION__FACTORY, LayersStackApplication.class, msgs); |
| } |
| return super.eBasicRemoveFromContainerFeature(msgs); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public Object eGet(int featureID, boolean resolve, boolean coreType) { |
| switch (featureID) { |
| case LayersPackage.LAYER_APPLICATION_FACTORY__APPLICATION: |
| return getApplication(); |
| } |
| return super.eGet(featureID, resolve, coreType); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public void eSet(int featureID, Object newValue) { |
| switch (featureID) { |
| case LayersPackage.LAYER_APPLICATION_FACTORY__APPLICATION: |
| setApplication((LayersStackApplication) newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case LayersPackage.LAYER_APPLICATION_FACTORY__APPLICATION: |
| setApplication((LayersStackApplication) null); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case LayersPackage.LAYER_APPLICATION_FACTORY__APPLICATION: |
| return getApplication() != null; |
| } |
| return super.eIsSet(featureID); |
| } |
| |
| } // LayerApplicationFactoryImpl |