blob: 57e2842736bac5b5535695b473daefb9914eff02 [file] [log] [blame]
/**
* <copyright>
*
* Copyright (c) 2005, 2010 SAP AG.
* 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:
* SAP AG - initial API, implementation and documentation
*
* </copyright>
*/
package org.eclipse.graphiti.mm.pictograms.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.graphiti.mm.algorithms.styles.Point;
import org.eclipse.graphiti.mm.pictograms.FixPointAnchor;
import org.eclipse.graphiti.mm.pictograms.PictogramsPackage;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Fix Point Anchor</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.eclipse.graphiti.mm.pictograms.impl.FixPointAnchorImpl#getLocation <em>Location</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class FixPointAnchorImpl extends AdvancedAnchorImpl implements FixPointAnchor {
/**
* The cached value of the '{@link #getLocation() <em>Location</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getLocation()
* @generated
* @ordered
*/
protected Point location;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected FixPointAnchorImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return PictogramsPackage.Literals.FIX_POINT_ANCHOR;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Point getLocation() {
if (location != null && location.eIsProxy()) {
InternalEObject oldLocation = (InternalEObject)location;
location = (Point)eResolveProxy(oldLocation);
if (location != oldLocation) {
InternalEObject newLocation = (InternalEObject)location;
NotificationChain msgs = oldLocation.eInverseRemove(this, EOPPOSITE_FEATURE_BASE - PictogramsPackage.FIX_POINT_ANCHOR__LOCATION, null, null);
if (newLocation.eInternalContainer() == null) {
msgs = newLocation.eInverseAdd(this, EOPPOSITE_FEATURE_BASE - PictogramsPackage.FIX_POINT_ANCHOR__LOCATION, null, msgs);
}
if (msgs != null) msgs.dispatch();
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, PictogramsPackage.FIX_POINT_ANCHOR__LOCATION, oldLocation, location));
}
}
return location;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Point basicGetLocation() {
return location;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetLocation(Point newLocation, NotificationChain msgs) {
Point oldLocation = location;
location = newLocation;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, PictogramsPackage.FIX_POINT_ANCHOR__LOCATION, oldLocation, newLocation);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setLocation(Point newLocation) {
if (newLocation != location) {
NotificationChain msgs = null;
if (location != null)
msgs = ((InternalEObject)location).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - PictogramsPackage.FIX_POINT_ANCHOR__LOCATION, null, msgs);
if (newLocation != null)
msgs = ((InternalEObject)newLocation).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - PictogramsPackage.FIX_POINT_ANCHOR__LOCATION, null, msgs);
msgs = basicSetLocation(newLocation, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, PictogramsPackage.FIX_POINT_ANCHOR__LOCATION, newLocation, newLocation));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case PictogramsPackage.FIX_POINT_ANCHOR__LOCATION:
return basicSetLocation(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 PictogramsPackage.FIX_POINT_ANCHOR__LOCATION:
if (resolve) return getLocation();
return basicGetLocation();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case PictogramsPackage.FIX_POINT_ANCHOR__LOCATION:
setLocation((Point)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case PictogramsPackage.FIX_POINT_ANCHOR__LOCATION:
setLocation((Point)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case PictogramsPackage.FIX_POINT_ANCHOR__LOCATION:
return location != null;
}
return super.eIsSet(featureID);
}
} //FixPointAnchorImpl