| /** |
| * 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.ecore.EClass; |
| import org.eclipse.emf.ecore.InternalEObject; |
| |
| import org.eclipse.emf.ecore.impl.ENotificationImpl; |
| |
| import org.eclipse.emf.ecore.util.EcoreUtil; |
| |
| import org.eclipse.papyrus.umldi.ElementWithPortsShape; |
| import org.eclipse.papyrus.umldi.PortShape; |
| import org.eclipse.papyrus.umldi.UMLDIPackage; |
| import org.eclipse.papyrus.umldi.UmlDiagramElement; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Port Shape</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link org.eclipse.papyrus.umldi.impl.PortShapeImpl#getOwningUmlDiagramElement <em>Owning Uml Diagram Element</em>}</li> |
| * <li>{@link org.eclipse.papyrus.umldi.impl.PortShapeImpl#getElementWithPortsShape <em>Element With Ports Shape</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public class PortShapeImpl extends ElementShapeImpl implements PortShape { |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| protected PortShapeImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return UMLDIPackage.Literals.PORT_SHAPE; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public UmlDiagramElement getOwningUmlDiagramElement() { |
| UmlDiagramElement owningUmlDiagramElement = basicGetOwningUmlDiagramElement(); |
| return owningUmlDiagramElement != null && owningUmlDiagramElement.eIsProxy() ? (UmlDiagramElement)eResolveProxy((InternalEObject)owningUmlDiagramElement) : owningUmlDiagramElement; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public UmlDiagramElement basicGetOwningUmlDiagramElement() { |
| ElementWithPortsShape elementWithPortsShape = getElementWithPortsShape(); |
| if(elementWithPortsShape != null) { |
| return elementWithPortsShape; |
| } |
| return super.basicGetOwningUmlDiagramElement(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public ElementWithPortsShape getElementWithPortsShape() { |
| if(eContainerFeatureID() != UMLDIPackage.PORT_SHAPE__ELEMENT_WITH_PORTS_SHAPE) |
| return null; |
| return (ElementWithPortsShape)eInternalContainer(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public NotificationChain basicSetElementWithPortsShape(ElementWithPortsShape newElementWithPortsShape, NotificationChain msgs) { |
| msgs = eBasicSetContainer((InternalEObject)newElementWithPortsShape, UMLDIPackage.PORT_SHAPE__ELEMENT_WITH_PORTS_SHAPE, msgs); |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public void setElementWithPortsShape(ElementWithPortsShape newElementWithPortsShape) { |
| if(newElementWithPortsShape != eInternalContainer() || (eContainerFeatureID() != UMLDIPackage.PORT_SHAPE__ELEMENT_WITH_PORTS_SHAPE && newElementWithPortsShape != null)) { |
| if(EcoreUtil.isAncestor(this, newElementWithPortsShape)) |
| throw new IllegalArgumentException("Recursive containment not allowed for " + toString()); |
| NotificationChain msgs = null; |
| if(eInternalContainer() != null) |
| msgs = eBasicRemoveFromContainer(msgs); |
| if(newElementWithPortsShape != null) |
| msgs = ((InternalEObject)newElementWithPortsShape).eInverseAdd(this, UMLDIPackage.ELEMENT_WITH_PORTS_SHAPE__PORT_SHAPE, ElementWithPortsShape.class, msgs); |
| msgs = basicSetElementWithPortsShape(newElementWithPortsShape, msgs); |
| if(msgs != null) |
| msgs.dispatch(); |
| } else if(eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, UMLDIPackage.PORT_SHAPE__ELEMENT_WITH_PORTS_SHAPE, newElementWithPortsShape, newElementWithPortsShape)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| switch(featureID) { |
| case UMLDIPackage.PORT_SHAPE__ELEMENT_WITH_PORTS_SHAPE: |
| if(eInternalContainer() != null) |
| msgs = eBasicRemoveFromContainer(msgs); |
| return basicSetElementWithPortsShape((ElementWithPortsShape)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.PORT_SHAPE__ELEMENT_WITH_PORTS_SHAPE: |
| return basicSetElementWithPortsShape(null, msgs); |
| } |
| return super.eInverseRemove(otherEnd, featureID, msgs); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) { |
| switch(eContainerFeatureID()) { |
| case UMLDIPackage.PORT_SHAPE__ELEMENT_WITH_PORTS_SHAPE: |
| return eInternalContainer().eInverseRemove(this, UMLDIPackage.ELEMENT_WITH_PORTS_SHAPE__PORT_SHAPE, ElementWithPortsShape.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 UMLDIPackage.PORT_SHAPE__ELEMENT_WITH_PORTS_SHAPE: |
| return getElementWithPortsShape(); |
| } |
| 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.PORT_SHAPE__ELEMENT_WITH_PORTS_SHAPE: |
| setElementWithPortsShape((ElementWithPortsShape)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch(featureID) { |
| case UMLDIPackage.PORT_SHAPE__ELEMENT_WITH_PORTS_SHAPE: |
| setElementWithPortsShape((ElementWithPortsShape)null); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch(featureID) { |
| case UMLDIPackage.PORT_SHAPE__OWNING_UML_DIAGRAM_ELEMENT: |
| return isSetOwningUmlDiagramElement(); |
| case UMLDIPackage.PORT_SHAPE__ELEMENT_WITH_PORTS_SHAPE: |
| return getElementWithPortsShape() != null; |
| } |
| return super.eIsSet(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public boolean isSetOwningUmlDiagramElement() { |
| return super.isSetOwningUmlDiagramElement() || eIsSet(UMLDIPackage.PORT_SHAPE__ELEMENT_WITH_PORTS_SHAPE); |
| } |
| } //PortShapeImpl |