| /** |
| * Copyright (c) 2014 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: |
| * CEA LIST - Initial API and implementation |
| */ |
| package org.eclipse.papyrus.umldi.impl; |
| |
| 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.papyrus.umldi.DependencyEdge; |
| import org.eclipse.papyrus.umldi.RoleLabel; |
| import org.eclipse.papyrus.umldi.UMLDIPackage; |
| import org.eclipse.papyrus.umldi.UmlDiagramElement; |
| |
| import org.eclipse.uml2.common.util.DerivedUnionEObjectEList; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Dependency Edge</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link org.eclipse.papyrus.umldi.impl.DependencyEdgeImpl#getOwnedUmlDiagramElement <em>Owned Uml Diagram Element</em>}</li> |
| * <li>{@link org.eclipse.papyrus.umldi.impl.DependencyEdgeImpl#getRoleLabel <em>Role Label</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public class DependencyEdgeImpl extends ElementEdgeImpl implements DependencyEdge { |
| |
| /** |
| * The cached value of the '{@link #getRoleLabel() <em>Role Label</em>}' containment reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @see #getRoleLabel() |
| * @generated |
| * @ordered |
| */ |
| protected RoleLabel roleLabel; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| protected DependencyEdgeImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return UMLDIPackage.Literals.DEPENDENCY_EDGE; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public EList<UmlDiagramElement> getOwnedUmlDiagramElement() { |
| return new DerivedUnionEObjectEList<UmlDiagramElement>(UmlDiagramElement.class, this, UMLDIPackage.DEPENDENCY_EDGE__OWNED_UML_DIAGRAM_ELEMENT, OWNED_UML_DIAGRAM_ELEMENT_ESUBSETS); |
| } |
| |
| /** |
| * The array of subset feature identifiers for the '{@link #getOwnedUmlDiagramElement() <em>Owned Uml Diagram Element</em>}' reference list. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @see #getOwnedUmlDiagramElement() |
| * @generated |
| * @ordered |
| */ |
| protected static final int[] OWNED_UML_DIAGRAM_ELEMENT_ESUBSETS = new int[]{ UMLDIPackage.DEPENDENCY_EDGE__STEREOTYPE_LABEL, UMLDIPackage.DEPENDENCY_EDGE__MAIN_LABEL, UMLDIPackage.DEPENDENCY_EDGE__ROLE_LABEL }; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public RoleLabel getRoleLabel() { |
| return roleLabel; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public NotificationChain basicSetRoleLabel(RoleLabel newRoleLabel, NotificationChain msgs) { |
| RoleLabel oldRoleLabel = roleLabel; |
| roleLabel = newRoleLabel; |
| if(eNotificationRequired()) { |
| ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, UMLDIPackage.DEPENDENCY_EDGE__ROLE_LABEL, oldRoleLabel, newRoleLabel); |
| if(msgs == null) |
| msgs = notification; |
| else |
| msgs.add(notification); |
| } |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public void setRoleLabel(RoleLabel newRoleLabel) { |
| if(newRoleLabel != roleLabel) { |
| NotificationChain msgs = null; |
| if(roleLabel != null) |
| msgs = ((InternalEObject)roleLabel).eInverseRemove(this, UMLDIPackage.ROLE_LABEL__ROLE_BINDING_EDGE, RoleLabel.class, msgs); |
| if(newRoleLabel != null) |
| msgs = ((InternalEObject)newRoleLabel).eInverseAdd(this, UMLDIPackage.ROLE_LABEL__ROLE_BINDING_EDGE, RoleLabel.class, msgs); |
| msgs = basicSetRoleLabel(newRoleLabel, msgs); |
| if(msgs != null) |
| msgs.dispatch(); |
| } else if(eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, UMLDIPackage.DEPENDENCY_EDGE__ROLE_LABEL, newRoleLabel, newRoleLabel)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| switch(featureID) { |
| case UMLDIPackage.DEPENDENCY_EDGE__ROLE_LABEL: |
| if(roleLabel != null) |
| msgs = ((InternalEObject)roleLabel).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - UMLDIPackage.DEPENDENCY_EDGE__ROLE_LABEL, null, msgs); |
| return basicSetRoleLabel((RoleLabel)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 UMLDIPackage.DEPENDENCY_EDGE__ROLE_LABEL: |
| return basicSetRoleLabel(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 UMLDIPackage.DEPENDENCY_EDGE__ROLE_LABEL: |
| return getRoleLabel(); |
| } |
| return super.eGet(featureID, resolve, coreType); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public void eSet(int featureID, Object newValue) { |
| switch(featureID) { |
| case UMLDIPackage.DEPENDENCY_EDGE__ROLE_LABEL: |
| setRoleLabel((RoleLabel)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch(featureID) { |
| case UMLDIPackage.DEPENDENCY_EDGE__ROLE_LABEL: |
| setRoleLabel((RoleLabel)null); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch(featureID) { |
| case UMLDIPackage.DEPENDENCY_EDGE__OWNED_UML_DIAGRAM_ELEMENT: |
| return isSetOwnedUmlDiagramElement(); |
| case UMLDIPackage.DEPENDENCY_EDGE__ROLE_LABEL: |
| return roleLabel != null; |
| } |
| return super.eIsSet(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public boolean isSetOwnedUmlDiagramElement() { |
| return super.isSetOwnedUmlDiagramElement() || eIsSet(UMLDIPackage.DEPENDENCY_EDGE__ROLE_LABEL); |
| } |
| } //DependencyEdgeImpl |