diff options
Diffstat (limited to 'extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/src/org/eclipse/papyrus/layers/stackmodel/layers/impl/LayerExpressionImpl.java')
-rw-r--r-- | extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/src/org/eclipse/papyrus/layers/stackmodel/layers/impl/LayerExpressionImpl.java | 43 |
1 files changed, 32 insertions, 11 deletions
diff --git a/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/src/org/eclipse/papyrus/layers/stackmodel/layers/impl/LayerExpressionImpl.java b/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/src/org/eclipse/papyrus/layers/stackmodel/layers/impl/LayerExpressionImpl.java index ad9cd1159ef..428ae846db4 100644 --- a/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/src/org/eclipse/papyrus/layers/stackmodel/layers/impl/LayerExpressionImpl.java +++ b/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/src/org/eclipse/papyrus/layers/stackmodel/layers/impl/LayerExpressionImpl.java @@ -14,7 +14,6 @@ package org.eclipse.papyrus.layers.stackmodel.layers.impl; import java.lang.reflect.InvocationTargetException; import java.util.List; - import org.eclipse.emf.common.notify.Adapter; import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.common.notify.impl.AdapterImpl; @@ -32,7 +31,6 @@ import org.eclipse.papyrus.layers.stackmodel.layers.LayerOperator; import org.eclipse.papyrus.layers.stackmodel.layers.LayersPackage; import org.eclipse.papyrus.layers.stackmodel.layers.LayersStack; import org.eclipse.papyrus.layers.stackmodel.layers.Property; -import org.eclipse.papyrus.layers.stackmodel.layers.RegExpLayer; /** * <!-- begin-user-doc --> @@ -181,12 +179,6 @@ ApplicationDependantElementImpl implements LayerExpression { */ protected LayerExpressionImpl() { super(); - - // Listen on this object attachment / detachment from its container. - // When this node is atttached to a parent, the owningLayerStack property is set. - // This is done in owningLayerChanged. - eAdapters().add(containerListener); - } /** @@ -341,9 +333,13 @@ ApplicationDependantElementImpl implements LayerExpression { * @generated NOT */ public LayersStack getLayersStack() throws NotFoundException { - // TODO: implement this method - // Ensure that you remove @generated or mark it @generated NOT - throw new UnsupportedOperationException(); + + LayersStack res = getOwningLayersStack(); + if( res != null) { + return res; + } + + throw new NotFoundException("LayersStack is not set in the Layer '" + getName() +"'"); } /** @@ -380,6 +376,21 @@ ApplicationDependantElementImpl implements LayerExpression { } /** + * Init this Layer. + * Called by the LayerStack as soon as the layer is added in the tree of layers. + * This method can be subclassed to init a particular layer. + * + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated NOT + */ + public void initLayer(LayersStack owningLayersStack) { + + // the owning stack + setOwningLayersStack(owningLayersStack); + } + + /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated NOT @@ -534,6 +545,16 @@ ApplicationDependantElementImpl implements LayerExpression { catch (Throwable throwable) { throw new InvocationTargetException(throwable); } + case LayersPackage.LAYER_EXPRESSION___INIT_LAYER__LAYERSSTACK: + initLayer((LayersStack)arguments.get(0)); + return null; + case LayersPackage.LAYER_EXPRESSION___GET_LAYERS_STACK: + try { + return getLayersStack(); + } + catch (Throwable throwable) { + throw new InvocationTargetException(throwable); + } } return super.eInvoke(operationID, arguments); } |