| /* |
| * Copyright (c) 2014, 2015 Eike Stepper (Loehne, Germany) and others. |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License v2.0 |
| * which accompanies this distribution, and is available at |
| * http://www.eclipse.org/legal/epl-v20.html |
| * |
| * Contributors: |
| * Eike Stepper - initial API and implementation |
| */ |
| package org.eclipse.oomph.setup.impl; |
| |
| import org.eclipse.oomph.setup.Project; |
| import org.eclipse.oomph.setup.Scope; |
| import org.eclipse.oomph.setup.ScopeType; |
| import org.eclipse.oomph.setup.SetupPackage; |
| import org.eclipse.oomph.setup.Stream; |
| |
| 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; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Branch</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link org.eclipse.oomph.setup.impl.StreamImpl#getProject <em>Project</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public class StreamImpl extends ScopeImpl implements Stream |
| { |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected StreamImpl() |
| { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() |
| { |
| return SetupPackage.Literals.STREAM; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Project getProject() |
| { |
| if (eContainerFeatureID() != SetupPackage.STREAM__PROJECT) |
| { |
| return null; |
| } |
| return (Project)eContainer(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Project basicGetProject() |
| { |
| if (eContainerFeatureID() != SetupPackage.STREAM__PROJECT) |
| { |
| return null; |
| } |
| return (Project)eInternalContainer(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain basicSetProject(Project newProject, NotificationChain msgs) |
| { |
| msgs = eBasicSetContainer((InternalEObject)newProject, SetupPackage.STREAM__PROJECT, msgs); |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setProject(Project newProject) |
| { |
| if (newProject != eInternalContainer() || eContainerFeatureID() != SetupPackage.STREAM__PROJECT && newProject != null) |
| { |
| if (EcoreUtil.isAncestor(this, newProject)) |
| { |
| throw new IllegalArgumentException("Recursive containment not allowed for " + toString()); |
| } |
| NotificationChain msgs = null; |
| if (eInternalContainer() != null) |
| { |
| msgs = eBasicRemoveFromContainer(msgs); |
| } |
| if (newProject != null) |
| { |
| msgs = ((InternalEObject)newProject).eInverseAdd(this, SetupPackage.PROJECT__STREAMS, Project.class, msgs); |
| } |
| msgs = basicSetProject(newProject, msgs); |
| if (msgs != null) |
| { |
| msgs.dispatch(); |
| } |
| } |
| else if (eNotificationRequired()) |
| { |
| eNotify(new ENotificationImpl(this, Notification.SET, SetupPackage.STREAM__PROJECT, newProject, newProject)); |
| } |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) |
| { |
| switch (featureID) |
| { |
| case SetupPackage.STREAM__PROJECT: |
| if (eInternalContainer() != null) |
| { |
| msgs = eBasicRemoveFromContainer(msgs); |
| } |
| return basicSetProject((Project)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 SetupPackage.STREAM__PROJECT: |
| return basicSetProject(null, msgs); |
| } |
| return super.eInverseRemove(otherEnd, featureID, msgs); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) |
| { |
| switch (eContainerFeatureID()) |
| { |
| case SetupPackage.STREAM__PROJECT: |
| return eInternalContainer().eInverseRemove(this, SetupPackage.PROJECT__STREAMS, Project.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 SetupPackage.STREAM__PROJECT: |
| if (resolve) |
| { |
| return getProject(); |
| } |
| return basicGetProject(); |
| } |
| return super.eGet(featureID, resolve, coreType); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eSet(int featureID, Object newValue) |
| { |
| switch (featureID) |
| { |
| case SetupPackage.STREAM__PROJECT: |
| setProject((Project)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) |
| { |
| switch (featureID) |
| { |
| case SetupPackage.STREAM__PROJECT: |
| setProject((Project)null); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) |
| { |
| switch (featureID) |
| { |
| case SetupPackage.STREAM__PROJECT: |
| return basicGetProject() != null; |
| } |
| return super.eIsSet(featureID); |
| } |
| |
| @Override |
| public ScopeType getType() |
| { |
| return ScopeType.STREAM; |
| } |
| |
| @Override |
| public Scope getParentScope() |
| { |
| return getProject(); |
| } |
| |
| } // BranchImpl |