blob: 3f474d11b9027dfce4548605ad9fefa5152ed5e1 [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.ConveyedLabel;
import org.eclipse.papyrus.umldi.InformationFlowEdge;
import org.eclipse.papyrus.umldi.UMLDIPackage;
import org.eclipse.papyrus.umldi.UmlDiagramElement;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Conveyed Label</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.papyrus.umldi.impl.ConveyedLabelImpl#getOwningUmlDiagramElement <em>Owning Uml Diagram Element</em>}</li>
* <li>{@link org.eclipse.papyrus.umldi.impl.ConveyedLabelImpl#getInformationFlowEdge <em>Information Flow Edge</em>}</li>
* </ul>
*
* @generated
*/
public class ConveyedLabelImpl extends UmlLabelImpl implements ConveyedLabel {
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
protected ConveyedLabelImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
protected EClass eStaticClass() {
return UMLDIPackage.Literals.CONVEYED_LABEL;
}
/**
* <!-- 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() {
InformationFlowEdge informationFlowEdge = getInformationFlowEdge();
if(informationFlowEdge != null) {
return informationFlowEdge;
}
return super.basicGetOwningUmlDiagramElement();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
public InformationFlowEdge getInformationFlowEdge() {
if(eContainerFeatureID() != UMLDIPackage.CONVEYED_LABEL__INFORMATION_FLOW_EDGE)
return null;
return (InformationFlowEdge)eInternalContainer();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
public NotificationChain basicSetInformationFlowEdge(InformationFlowEdge newInformationFlowEdge, NotificationChain msgs) {
msgs = eBasicSetContainer((InternalEObject)newInformationFlowEdge, UMLDIPackage.CONVEYED_LABEL__INFORMATION_FLOW_EDGE, msgs);
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
public void setInformationFlowEdge(InformationFlowEdge newInformationFlowEdge) {
if(newInformationFlowEdge != eInternalContainer() || (eContainerFeatureID() != UMLDIPackage.CONVEYED_LABEL__INFORMATION_FLOW_EDGE && newInformationFlowEdge != null)) {
if(EcoreUtil.isAncestor(this, newInformationFlowEdge))
throw new IllegalArgumentException("Recursive containment not allowed for " + toString());
NotificationChain msgs = null;
if(eInternalContainer() != null)
msgs = eBasicRemoveFromContainer(msgs);
if(newInformationFlowEdge != null)
msgs = ((InternalEObject)newInformationFlowEdge).eInverseAdd(this, UMLDIPackage.INFORMATION_FLOW_EDGE__CONVEYED_LABEL, InformationFlowEdge.class, msgs);
msgs = basicSetInformationFlowEdge(newInformationFlowEdge, msgs);
if(msgs != null)
msgs.dispatch();
} else if(eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, UMLDIPackage.CONVEYED_LABEL__INFORMATION_FLOW_EDGE, newInformationFlowEdge, newInformationFlowEdge));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch(featureID) {
case UMLDIPackage.CONVEYED_LABEL__INFORMATION_FLOW_EDGE:
if(eInternalContainer() != null)
msgs = eBasicRemoveFromContainer(msgs);
return basicSetInformationFlowEdge((InformationFlowEdge)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.CONVEYED_LABEL__INFORMATION_FLOW_EDGE:
return basicSetInformationFlowEdge(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.CONVEYED_LABEL__INFORMATION_FLOW_EDGE:
return eInternalContainer().eInverseRemove(this, UMLDIPackage.INFORMATION_FLOW_EDGE__CONVEYED_LABEL, InformationFlowEdge.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.CONVEYED_LABEL__INFORMATION_FLOW_EDGE:
return getInformationFlowEdge();
}
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.CONVEYED_LABEL__INFORMATION_FLOW_EDGE:
setInformationFlowEdge((InformationFlowEdge)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public void eUnset(int featureID) {
switch(featureID) {
case UMLDIPackage.CONVEYED_LABEL__INFORMATION_FLOW_EDGE:
setInformationFlowEdge((InformationFlowEdge)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch(featureID) {
case UMLDIPackage.CONVEYED_LABEL__OWNING_UML_DIAGRAM_ELEMENT:
return isSetOwningUmlDiagramElement();
case UMLDIPackage.CONVEYED_LABEL__INFORMATION_FLOW_EDGE:
return getInformationFlowEdge() != null;
}
return super.eIsSet(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public boolean isSetOwningUmlDiagramElement() {
return super.isSetOwningUmlDiagramElement() || eIsSet(UMLDIPackage.CONVEYED_LABEL__INFORMATION_FLOW_EDGE);
}
} //ConveyedLabelImpl