/* * Copyright (c) 2014 Eike Stepper (Berlin, Germany) and others. * 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: * Eike Stepper - initial API and implementation */ package org.eclipse.oomph.setup.impl; import org.eclipse.oomph.setup.Product; import org.eclipse.oomph.setup.ProductVersion; import org.eclipse.oomph.setup.Scope; import org.eclipse.oomph.setup.ScopeType; import org.eclipse.oomph.setup.SetupPackage; 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.util.EcoreUtil; /** * * An implementation of the model object 'Eclipse Version'. * *

* The following features are implemented: *

*

* * @generated */ public class ProductVersionImpl extends ScopeImpl implements ProductVersion { /** * * * @generated */ protected ProductVersionImpl() { super(); } /** * * * @generated */ @Override protected EClass eStaticClass() { return SetupPackage.Literals.PRODUCT_VERSION; } /** * * * @generated */ public Product getProduct() { if (eContainerFeatureID() != SetupPackage.PRODUCT_VERSION__PRODUCT) { return null; } return (Product)eContainer(); } /** * * * @generated */ public Product basicGetProduct() { if (eContainerFeatureID() != SetupPackage.PRODUCT_VERSION__PRODUCT) { return null; } return (Product)eInternalContainer(); } /** * * * @generated */ public NotificationChain basicSetProduct(Product newProduct, NotificationChain msgs) { msgs = eBasicSetContainer((InternalEObject)newProduct, SetupPackage.PRODUCT_VERSION__PRODUCT, msgs); return msgs; } /** * * * @generated */ public void setProduct(Product newProduct) { if (newProduct != eInternalContainer() || eContainerFeatureID() != SetupPackage.PRODUCT_VERSION__PRODUCT && newProduct != null) { if (EcoreUtil.isAncestor(this, newProduct)) { throw new IllegalArgumentException("Recursive containment not allowed for " + toString()); } NotificationChain msgs = null; if (eInternalContainer() != null) { msgs = eBasicRemoveFromContainer(msgs); } if (newProduct != null) { msgs = ((InternalEObject)newProduct).eInverseAdd(this, SetupPackage.PRODUCT__VERSIONS, Product.class, msgs); } msgs = basicSetProduct(newProduct, msgs); if (msgs != null) { msgs.dispatch(); } } else if (eNotificationRequired()) { eNotify(new ENotificationImpl(this, Notification.SET, SetupPackage.PRODUCT_VERSION__PRODUCT, newProduct, newProduct)); } } /** * * * @generated */ @Override public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case SetupPackage.PRODUCT_VERSION__PRODUCT: if (eInternalContainer() != null) { msgs = eBasicRemoveFromContainer(msgs); } return basicSetProduct((Product)otherEnd, msgs); } return super.eInverseAdd(otherEnd, featureID, msgs); } /** * * * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case SetupPackage.PRODUCT_VERSION__PRODUCT: return basicSetProduct(null, msgs); } return super.eInverseRemove(otherEnd, featureID, msgs); } /** * * * @generated */ @Override public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) { switch (eContainerFeatureID()) { case SetupPackage.PRODUCT_VERSION__PRODUCT: return eInternalContainer().eInverseRemove(this, SetupPackage.PRODUCT__VERSIONS, Product.class, msgs); } return super.eBasicRemoveFromContainerFeature(msgs); } /** * * * @generated */ @Override public Object eGet(int featureID, boolean resolve, boolean coreType) { switch (featureID) { case SetupPackage.PRODUCT_VERSION__PRODUCT: if (resolve) { return getProduct(); } return basicGetProduct(); } return super.eGet(featureID, resolve, coreType); } /** * * * @generated */ @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case SetupPackage.PRODUCT_VERSION__PRODUCT: setProduct((Product)newValue); return; } super.eSet(featureID, newValue); } /** * * * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case SetupPackage.PRODUCT_VERSION__PRODUCT: setProduct((Product)null); return; } super.eUnset(featureID); } /** * * * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case SetupPackage.PRODUCT_VERSION__PRODUCT: return basicGetProduct() != null; } return super.eIsSet(featureID); } @Override public ScopeType getType() { return ScopeType.PRODUCT_VERSION; } @Override public Scope getParentScope() { return getProduct(); } } // EclipseImpl