blob: b78b90c9923cd666e8019415f46cefd0728879b1 [file] [log] [blame]
/**
* 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.ConnectionPointReferenceShape;
import org.eclipse.papyrus.umldi.StateShape;
import org.eclipse.papyrus.umldi.UMLDIPackage;
import org.eclipse.papyrus.umldi.UmlDiagramElement;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Connection Point Reference Shape</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.papyrus.umldi.impl.ConnectionPointReferenceShapeImpl#getOwningUmlDiagramElement <em>Owning Uml Diagram Element</em>}</li>
* <li>{@link org.eclipse.papyrus.umldi.impl.ConnectionPointReferenceShapeImpl#getStateShape <em>State Shape</em>}</li>
* </ul>
*
* @generated
*/
public class ConnectionPointReferenceShapeImpl extends ElementShapeImpl implements ConnectionPointReferenceShape {
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
protected ConnectionPointReferenceShapeImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
protected EClass eStaticClass() {
return UMLDIPackage.Literals.CONNECTION_POINT_REFERENCE_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() {
StateShape stateShape = getStateShape();
if(stateShape != null) {
return stateShape;
}
return super.basicGetOwningUmlDiagramElement();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
public StateShape getStateShape() {
if(eContainerFeatureID() != UMLDIPackage.CONNECTION_POINT_REFERENCE_SHAPE__STATE_SHAPE)
return null;
return (StateShape)eInternalContainer();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
public NotificationChain basicSetStateShape(StateShape newStateShape, NotificationChain msgs) {
msgs = eBasicSetContainer((InternalEObject)newStateShape, UMLDIPackage.CONNECTION_POINT_REFERENCE_SHAPE__STATE_SHAPE, msgs);
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
public void setStateShape(StateShape newStateShape) {
if(newStateShape != eInternalContainer() || (eContainerFeatureID() != UMLDIPackage.CONNECTION_POINT_REFERENCE_SHAPE__STATE_SHAPE && newStateShape != null)) {
if(EcoreUtil.isAncestor(this, newStateShape))
throw new IllegalArgumentException("Recursive containment not allowed for " + toString());
NotificationChain msgs = null;
if(eInternalContainer() != null)
msgs = eBasicRemoveFromContainer(msgs);
if(newStateShape != null)
msgs = ((InternalEObject)newStateShape).eInverseAdd(this, UMLDIPackage.STATE_SHAPE__CONNECTION_POINT_REFERENCE_SHAPE, StateShape.class, msgs);
msgs = basicSetStateShape(newStateShape, msgs);
if(msgs != null)
msgs.dispatch();
} else if(eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, UMLDIPackage.CONNECTION_POINT_REFERENCE_SHAPE__STATE_SHAPE, newStateShape, newStateShape));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch(featureID) {
case UMLDIPackage.CONNECTION_POINT_REFERENCE_SHAPE__STATE_SHAPE:
if(eInternalContainer() != null)
msgs = eBasicRemoveFromContainer(msgs);
return basicSetStateShape((StateShape)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.CONNECTION_POINT_REFERENCE_SHAPE__STATE_SHAPE:
return basicSetStateShape(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.CONNECTION_POINT_REFERENCE_SHAPE__STATE_SHAPE:
return eInternalContainer().eInverseRemove(this, UMLDIPackage.STATE_SHAPE__CONNECTION_POINT_REFERENCE_SHAPE, StateShape.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.CONNECTION_POINT_REFERENCE_SHAPE__STATE_SHAPE:
return getStateShape();
}
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.CONNECTION_POINT_REFERENCE_SHAPE__STATE_SHAPE:
setStateShape((StateShape)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public void eUnset(int featureID) {
switch(featureID) {
case UMLDIPackage.CONNECTION_POINT_REFERENCE_SHAPE__STATE_SHAPE:
setStateShape((StateShape)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch(featureID) {
case UMLDIPackage.CONNECTION_POINT_REFERENCE_SHAPE__OWNING_UML_DIAGRAM_ELEMENT:
return isSetOwningUmlDiagramElement();
case UMLDIPackage.CONNECTION_POINT_REFERENCE_SHAPE__STATE_SHAPE:
return getStateShape() != null;
}
return super.eIsSet(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public boolean isSetOwningUmlDiagramElement() {
return super.isSetOwningUmlDiagramElement() || eIsSet(UMLDIPackage.CONNECTION_POINT_REFERENCE_SHAPE__STATE_SHAPE);
}
} //ConnectionPointReferenceShapeImpl