Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCedric Dumoulin2013-12-14 16:55:37 +0000
committerCedric Dumoulin2014-01-27 13:56:41 +0000
commit88e03a4d73d0c4056455ccdd9b6513fc0b4471be (patch)
tree5344d00023f94dde3984cccafe1f94c723f64f1f /extraplugins/layers/org.eclipse.papyrus.layers.stackmodel
parente3baca5dae40809804a179eb7d432214ae23b70e (diff)
downloadorg.eclipse.papyrus-88e03a4d73d0c4056455ccdd9b6513fc0b4471be.tar.gz
org.eclipse.papyrus-88e03a4d73d0c4056455ccdd9b6513fc0b4471be.tar.xz
org.eclipse.papyrus-88e03a4d73d0c4056455ccdd9b6513fc0b4471be.zip
Bug 330199 - Add test for layers tree initialization.
The tests fails because init is not yet implemented.
Diffstat (limited to 'extraplugins/layers/org.eclipse.papyrus.layers.stackmodel')
-rw-r--r--extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/src/org/eclipse/papyrus/layers/stackmodel/layers/LayerExpression.java67
-rw-r--r--extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/src/org/eclipse/papyrus/layers/stackmodel/layers/LayersPackage.java303
-rw-r--r--extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/src/org/eclipse/papyrus/layers/stackmodel/layers/impl/AbstractLayerImpl.java7
-rw-r--r--extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/src/org/eclipse/papyrus/layers/stackmodel/layers/impl/LayerExpressionImpl.java190
-rw-r--r--extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/src/org/eclipse/papyrus/layers/stackmodel/layers/impl/LayerOperatorImpl.java34
-rw-r--r--extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/src/org/eclipse/papyrus/layers/stackmodel/layers/impl/LayersPackageImpl.java35
-rw-r--r--extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/src/org/eclipse/papyrus/layers/stackmodel/layers/impl/RegExpLayerImpl.java60
-rw-r--r--extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/test/org/eclipse/papyrus/layers/stackmodel/layers/impl/LayerExpressionInitWithApplicationImplTest.java162
-rw-r--r--extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/test/org/eclipse/papyrus/layers/stackmodel/layers/util/LayerFactoryTestUtilsTest.java98
-rw-r--r--extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/test/org/eclipse/papyrus/layers/stackmodel/layers/util/LayersFactoryTestUtils.java136
10 files changed, 923 insertions, 169 deletions
diff --git a/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/src/org/eclipse/papyrus/layers/stackmodel/layers/LayerExpression.java b/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/src/org/eclipse/papyrus/layers/stackmodel/layers/LayerExpression.java
index 1ea4929e78a..610f109efdc 100644
--- a/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/src/org/eclipse/papyrus/layers/stackmodel/layers/LayerExpression.java
+++ b/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/src/org/eclipse/papyrus/layers/stackmodel/layers/LayerExpression.java
@@ -13,11 +13,9 @@
package org.eclipse.papyrus.layers.stackmodel.layers;
import java.util.List;
-
import org.eclipse.emf.common.util.EList;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.papyrus.layers.stackmodel.LayersException;
-import org.eclipse.papyrus.layers.stackmodel.NotFoundException;
import org.eclipse.papyrus.layers.stackmodel.command.ComputePropertyValueCommand;
@@ -33,6 +31,8 @@ import org.eclipse.papyrus.layers.stackmodel.command.ComputePropertyValueCommand
* <li>{@link org.eclipse.papyrus.layers.stackmodel.layers.LayerExpression#getDescription <em>Description</em>}</li>
* <li>{@link org.eclipse.papyrus.layers.stackmodel.layers.LayerExpression#isLayerEnabledInternal <em>Is Layer Enabled Internal</em>}</li>
* <li>{@link org.eclipse.papyrus.layers.stackmodel.layers.LayerExpression#isLayerEnabled <em>Is Layer Enabled</em>}</li>
+ * <li>{@link org.eclipse.papyrus.layers.stackmodel.layers.LayerExpression#isBranchEnabled <em>Is Branch Enabled</em>}</li>
+ * <li>{@link org.eclipse.papyrus.layers.stackmodel.layers.LayerExpression#getOwningLayersStack <em>Owning Layers Stack</em>}</li>
* </ul>
* </p>
*
@@ -137,36 +137,83 @@ public interface LayerExpression extends ApplicationDependantElement {
void setIsLayerEnabled(boolean value);
/**
+ * Returns the value of the '<em><b>Is Branch Enabled</b></em>' attribute.
+ * The default value is <code>"true"</code>.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- * @model dataType="org.eclipse.papyrus.layers.stackmodel.layers.ComputePropertyValueCommand" required="true" ordered="false" exceptions="org.eclipse.papyrus.layers.stackmodel.layers.LayersException" viewRequired="true" viewOrdered="false" propertyRequired="true" propertyOrdered="false"
+ * <!-- begin-model-doc -->
+ * Is the branch from this node to the root enabled ?
+ * A branch is enabled if all node of the branch are enabled.
+ * In other world, if an ancestor node is disable, the branch is disabled.
+ * Setting the value of this node set the value of the subnodes.
+ * <!-- end-model-doc -->
+ * @return the value of the '<em>Is Branch Enabled</em>' attribute.
+ * @see #setIsBranchEnabled(boolean)
+ * @see org.eclipse.papyrus.layers.stackmodel.layers.LayersPackage#getLayerExpression_IsBranchEnabled()
+ * @model default="true" dataType="org.eclipse.papyrus.layers.stackmodel.layers.boolean" required="true" transient="true" ordered="false"
* @generated
*/
- ComputePropertyValueCommand getComputePropertyValueCommand(View view, Property property) throws LayersException;
+ boolean isBranchEnabled();
/**
+ * Sets the value of the '{@link org.eclipse.papyrus.layers.stackmodel.layers.LayerExpression#isBranchEnabled <em>Is Branch Enabled</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- * @model dataType="org.eclipse.papyrus.layers.stackmodel.layers.ComputePropertyValueCommand" exceptions="org.eclipse.papyrus.layers.stackmodel.layers.LayersException" viewMany="true" propertyRequired="true" propertyOrdered="false"
+ * @param value the new value of the '<em>Is Branch Enabled</em>' attribute.
+ * @see #isBranchEnabled()
* @generated
*/
- EList<ComputePropertyValueCommand> getViewsComputePropertyValueCommand(EList<View> view, Property property) throws LayersException;
+ void setIsBranchEnabled(boolean value);
+
+ /**
+ * Returns the value of the '<em><b>Owning Layers Stack</b></em>' reference.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Owning Layers Stack</em>' reference isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Owning Layers Stack</em>' reference.
+ * @see #setOwningLayersStack(LayersStack)
+ * @see org.eclipse.papyrus.layers.stackmodel.layers.LayersPackage#getLayerExpression_OwningLayersStack()
+ * @model ordered="false"
+ * @generated
+ */
+ LayersStack getOwningLayersStack();
/**
+ * Sets the value of the '{@link org.eclipse.papyrus.layers.stackmodel.layers.LayerExpression#getOwningLayersStack <em>Owning Layers Stack</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- * @model dataType="org.eclipse.papyrus.layers.stackmodel.layers.ComputePropertyValueCommand" exceptions="org.eclipse.papyrus.layers.stackmodel.layers.LayersException" viewRequired="true" viewOrdered="false" propertyRequired="true" propertyMany="true"
+ * @param value the new value of the '<em>Owning Layers Stack</em>' reference.
+ * @see #getOwningLayersStack()
* @generated
*/
- EList<ComputePropertyValueCommand> getPropertiesComputePropertyValueCommand(View view, EList<Property> property) throws LayersException;
+ void setOwningLayersStack(LayersStack value);
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- * @model kind="operation" required="true" ordered="false" exceptions="org.eclipse.papyrus.layers.stackmodel.layers.NotFoundException"
+ * @model dataType="org.eclipse.papyrus.layers.stackmodel.layers.ComputePropertyValueCommand" required="true" ordered="false" exceptions="org.eclipse.papyrus.layers.stackmodel.layers.LayersException" viewRequired="true" viewOrdered="false" propertyRequired="true" propertyOrdered="false"
* @generated
*/
- LayersStack getLayersStack() throws NotFoundException;
+ ComputePropertyValueCommand getComputePropertyValueCommand(View view, Property property) throws LayersException;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @model dataType="org.eclipse.papyrus.layers.stackmodel.layers.ComputePropertyValueCommand" exceptions="org.eclipse.papyrus.layers.stackmodel.layers.LayersException" viewMany="true" propertyRequired="true" propertyOrdered="false"
+ * @generated
+ */
+ EList<ComputePropertyValueCommand> getViewsComputePropertyValueCommand(EList<View> view, Property property) throws LayersException;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @model dataType="org.eclipse.papyrus.layers.stackmodel.layers.ComputePropertyValueCommand" exceptions="org.eclipse.papyrus.layers.stackmodel.layers.LayersException" viewRequired="true" viewOrdered="false" propertyRequired="true" propertyMany="true"
+ * @generated
+ */
+ EList<ComputePropertyValueCommand> getPropertiesComputePropertyValueCommand(View view, EList<Property> property) throws LayersException;
/**
* <!-- begin-user-doc -->
diff --git a/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/src/org/eclipse/papyrus/layers/stackmodel/layers/LayersPackage.java b/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/src/org/eclipse/papyrus/layers/stackmodel/layers/LayersPackage.java
index 654274457e1..4b9f13a548b 100644
--- a/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/src/org/eclipse/papyrus/layers/stackmodel/layers/LayersPackage.java
+++ b/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/src/org/eclipse/papyrus/layers/stackmodel/layers/LayersPackage.java
@@ -351,49 +351,58 @@ public interface LayersPackage extends EPackage {
int LAYER_EXPRESSION__IS_LAYER_ENABLED = APPLICATION_DEPENDANT_ELEMENT_FEATURE_COUNT + 3;
/**
- * The number of structural features of the '<em>Layer Expression</em>' class.
+ * The feature id for the '<em><b>Is Branch Enabled</b></em>' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
- int LAYER_EXPRESSION_FEATURE_COUNT = APPLICATION_DEPENDANT_ELEMENT_FEATURE_COUNT + 4;
+ int LAYER_EXPRESSION__IS_BRANCH_ENABLED = APPLICATION_DEPENDANT_ELEMENT_FEATURE_COUNT + 4;
/**
- * The operation id for the '<em>Get Compute Property Value Command</em>' operation.
+ * The feature id for the '<em><b>Owning Layers Stack</b></em>' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
- int LAYER_EXPRESSION___GET_COMPUTE_PROPERTY_VALUE_COMMAND__VIEW_PROPERTY = APPLICATION_DEPENDANT_ELEMENT_OPERATION_COUNT + 0;
+ int LAYER_EXPRESSION__OWNING_LAYERS_STACK = APPLICATION_DEPENDANT_ELEMENT_FEATURE_COUNT + 5;
/**
- * The operation id for the '<em>Get Views Compute Property Value Command</em>' operation.
+ * The number of structural features of the '<em>Layer Expression</em>' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
- int LAYER_EXPRESSION___GET_VIEWS_COMPUTE_PROPERTY_VALUE_COMMAND__ELIST_PROPERTY = APPLICATION_DEPENDANT_ELEMENT_OPERATION_COUNT + 1;
+ int LAYER_EXPRESSION_FEATURE_COUNT = APPLICATION_DEPENDANT_ELEMENT_FEATURE_COUNT + 6;
/**
- * The operation id for the '<em>Get Properties Compute Property Value Command</em>' operation.
+ * The operation id for the '<em>Get Compute Property Value Command</em>' operation.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
- int LAYER_EXPRESSION___GET_PROPERTIES_COMPUTE_PROPERTY_VALUE_COMMAND__VIEW_ELIST = APPLICATION_DEPENDANT_ELEMENT_OPERATION_COUNT + 2;
+ int LAYER_EXPRESSION___GET_COMPUTE_PROPERTY_VALUE_COMMAND__VIEW_PROPERTY = APPLICATION_DEPENDANT_ELEMENT_OPERATION_COUNT + 0;
/**
- * The operation id for the '<em>Get Layers Stack</em>' operation.
+ * The operation id for the '<em>Get Views Compute Property Value Command</em>' operation.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
- int LAYER_EXPRESSION___GET_LAYERS_STACK = APPLICATION_DEPENDANT_ELEMENT_OPERATION_COUNT + 3;
+ int LAYER_EXPRESSION___GET_VIEWS_COMPUTE_PROPERTY_VALUE_COMMAND__ELIST_PROPERTY = APPLICATION_DEPENDANT_ELEMENT_OPERATION_COUNT + 1;
+
+ /**
+ * The operation id for the '<em>Get Properties Compute Property Value Command</em>' operation.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int LAYER_EXPRESSION___GET_PROPERTIES_COMPUTE_PROPERTY_VALUE_COMMAND__VIEW_ELIST = APPLICATION_DEPENDANT_ELEMENT_OPERATION_COUNT + 2;
/**
* The number of operations of the '<em>Layer Expression</em>' class.
@@ -402,7 +411,7 @@ public interface LayersPackage extends EPackage {
* @generated
* @ordered
*/
- int LAYER_EXPRESSION_OPERATION_COUNT = APPLICATION_DEPENDANT_ELEMENT_OPERATION_COUNT + 4;
+ int LAYER_EXPRESSION_OPERATION_COUNT = APPLICATION_DEPENDANT_ELEMENT_OPERATION_COUNT + 3;
/**
* The meta object id for the '{@link org.eclipse.papyrus.layers.stackmodel.layers.impl.LayerApplicationFactoryImpl <em>Layer Application Factory</em>}' class.
@@ -1996,6 +2005,24 @@ public interface LayersPackage extends EPackage {
int LAYER_OPERATOR__IS_LAYER_ENABLED = LAYER_EXPRESSION__IS_LAYER_ENABLED;
/**
+ * The feature id for the '<em><b>Is Branch Enabled</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int LAYER_OPERATOR__IS_BRANCH_ENABLED = LAYER_EXPRESSION__IS_BRANCH_ENABLED;
+
+ /**
+ * The feature id for the '<em><b>Owning Layers Stack</b></em>' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int LAYER_OPERATOR__OWNING_LAYERS_STACK = LAYER_EXPRESSION__OWNING_LAYERS_STACK;
+
+ /**
* The feature id for the '<em><b>Layers</b></em>' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@@ -2041,15 +2068,6 @@ public interface LayersPackage extends EPackage {
int LAYER_OPERATOR___GET_PROPERTIES_COMPUTE_PROPERTY_VALUE_COMMAND__VIEW_ELIST = LAYER_EXPRESSION___GET_PROPERTIES_COMPUTE_PROPERTY_VALUE_COMMAND__VIEW_ELIST;
/**
- * The operation id for the '<em>Get Layers Stack</em>' operation.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- int LAYER_OPERATOR___GET_LAYERS_STACK = LAYER_EXPRESSION___GET_LAYERS_STACK;
-
- /**
* The number of operations of the '<em>Layer Operator</em>' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@@ -2104,6 +2122,24 @@ public interface LayersPackage extends EPackage {
int ABSTRACT_LAYER_OPERATOR__IS_LAYER_ENABLED = LAYER_OPERATOR__IS_LAYER_ENABLED;
/**
+ * The feature id for the '<em><b>Is Branch Enabled</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int ABSTRACT_LAYER_OPERATOR__IS_BRANCH_ENABLED = LAYER_OPERATOR__IS_BRANCH_ENABLED;
+
+ /**
+ * The feature id for the '<em><b>Owning Layers Stack</b></em>' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int ABSTRACT_LAYER_OPERATOR__OWNING_LAYERS_STACK = LAYER_OPERATOR__OWNING_LAYERS_STACK;
+
+ /**
* The feature id for the '<em><b>Layers</b></em>' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@@ -2167,15 +2203,6 @@ public interface LayersPackage extends EPackage {
int ABSTRACT_LAYER_OPERATOR___GET_PROPERTIES_COMPUTE_PROPERTY_VALUE_COMMAND__VIEW_ELIST = LAYER_OPERATOR___GET_PROPERTIES_COMPUTE_PROPERTY_VALUE_COMMAND__VIEW_ELIST;
/**
- * The operation id for the '<em>Get Layers Stack</em>' operation.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- int ABSTRACT_LAYER_OPERATOR___GET_LAYERS_STACK = LAYER_OPERATOR___GET_LAYERS_STACK;
-
- /**
* The operation id for the '<em>Is Descriptor Set</em>' operation.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@@ -2284,6 +2311,24 @@ public interface LayersPackage extends EPackage {
int ABSTRACT_LAYER__IS_LAYER_ENABLED = LAYER_EXPRESSION__IS_LAYER_ENABLED;
/**
+ * The feature id for the '<em><b>Is Branch Enabled</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int ABSTRACT_LAYER__IS_BRANCH_ENABLED = LAYER_EXPRESSION__IS_BRANCH_ENABLED;
+
+ /**
+ * The feature id for the '<em><b>Owning Layers Stack</b></em>' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int ABSTRACT_LAYER__OWNING_LAYERS_STACK = LAYER_EXPRESSION__OWNING_LAYERS_STACK;
+
+ /**
* The feature id for the '<em><b>Property Values</b></em>' reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@@ -2365,15 +2410,6 @@ public interface LayersPackage extends EPackage {
int ABSTRACT_LAYER___GET_PROPERTIES_COMPUTE_PROPERTY_VALUE_COMMAND__VIEW_ELIST = LAYER_EXPRESSION___GET_PROPERTIES_COMPUTE_PROPERTY_VALUE_COMMAND__VIEW_ELIST;
/**
- * The operation id for the '<em>Get Layers Stack</em>' operation.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- int ABSTRACT_LAYER___GET_LAYERS_STACK = LAYER_EXPRESSION___GET_LAYERS_STACK;
-
- /**
* The operation id for the '<em>Add Property Instance</em>' operation.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@@ -2923,6 +2959,24 @@ public interface LayersPackage extends EPackage {
int TOP_LAYER_OPERATOR__IS_LAYER_ENABLED = ABSTRACT_LAYER_OPERATOR__IS_LAYER_ENABLED;
/**
+ * The feature id for the '<em><b>Is Branch Enabled</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int TOP_LAYER_OPERATOR__IS_BRANCH_ENABLED = ABSTRACT_LAYER_OPERATOR__IS_BRANCH_ENABLED;
+
+ /**
+ * The feature id for the '<em><b>Owning Layers Stack</b></em>' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int TOP_LAYER_OPERATOR__OWNING_LAYERS_STACK = ABSTRACT_LAYER_OPERATOR__OWNING_LAYERS_STACK;
+
+ /**
* The feature id for the '<em><b>Layers</b></em>' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@@ -2986,15 +3040,6 @@ public interface LayersPackage extends EPackage {
int TOP_LAYER_OPERATOR___GET_PROPERTIES_COMPUTE_PROPERTY_VALUE_COMMAND__VIEW_ELIST = ABSTRACT_LAYER_OPERATOR___GET_PROPERTIES_COMPUTE_PROPERTY_VALUE_COMMAND__VIEW_ELIST;
/**
- * The operation id for the '<em>Get Layers Stack</em>' operation.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- int TOP_LAYER_OPERATOR___GET_LAYERS_STACK = ABSTRACT_LAYER_OPERATOR___GET_LAYERS_STACK;
-
- /**
* The operation id for the '<em>Is Descriptor Set</em>' operation.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@@ -3067,6 +3112,24 @@ public interface LayersPackage extends EPackage {
int STACKED_LAYER_OPERATOR__IS_LAYER_ENABLED = ABSTRACT_LAYER_OPERATOR__IS_LAYER_ENABLED;
/**
+ * The feature id for the '<em><b>Is Branch Enabled</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int STACKED_LAYER_OPERATOR__IS_BRANCH_ENABLED = ABSTRACT_LAYER_OPERATOR__IS_BRANCH_ENABLED;
+
+ /**
+ * The feature id for the '<em><b>Owning Layers Stack</b></em>' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int STACKED_LAYER_OPERATOR__OWNING_LAYERS_STACK = ABSTRACT_LAYER_OPERATOR__OWNING_LAYERS_STACK;
+
+ /**
* The feature id for the '<em><b>Layers</b></em>' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@@ -3130,15 +3193,6 @@ public interface LayersPackage extends EPackage {
int STACKED_LAYER_OPERATOR___GET_PROPERTIES_COMPUTE_PROPERTY_VALUE_COMMAND__VIEW_ELIST = ABSTRACT_LAYER_OPERATOR___GET_PROPERTIES_COMPUTE_PROPERTY_VALUE_COMMAND__VIEW_ELIST;
/**
- * The operation id for the '<em>Get Layers Stack</em>' operation.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- int STACKED_LAYER_OPERATOR___GET_LAYERS_STACK = ABSTRACT_LAYER_OPERATOR___GET_LAYERS_STACK;
-
- /**
* The operation id for the '<em>Is Descriptor Set</em>' operation.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@@ -3211,6 +3265,24 @@ public interface LayersPackage extends EPackage {
int CUSTOM_LAYER_OPERATOR__IS_LAYER_ENABLED = LAYER_OPERATOR__IS_LAYER_ENABLED;
/**
+ * The feature id for the '<em><b>Is Branch Enabled</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int CUSTOM_LAYER_OPERATOR__IS_BRANCH_ENABLED = LAYER_OPERATOR__IS_BRANCH_ENABLED;
+
+ /**
+ * The feature id for the '<em><b>Owning Layers Stack</b></em>' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int CUSTOM_LAYER_OPERATOR__OWNING_LAYERS_STACK = LAYER_OPERATOR__OWNING_LAYERS_STACK;
+
+ /**
* The feature id for the '<em><b>Layers</b></em>' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@@ -3256,15 +3328,6 @@ public interface LayersPackage extends EPackage {
int CUSTOM_LAYER_OPERATOR___GET_PROPERTIES_COMPUTE_PROPERTY_VALUE_COMMAND__VIEW_ELIST = LAYER_OPERATOR___GET_PROPERTIES_COMPUTE_PROPERTY_VALUE_COMMAND__VIEW_ELIST;
/**
- * The operation id for the '<em>Get Layers Stack</em>' operation.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- int CUSTOM_LAYER_OPERATOR___GET_LAYERS_STACK = LAYER_OPERATOR___GET_LAYERS_STACK;
-
- /**
* The number of operations of the '<em>Custom Layer Operator</em>' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@@ -3499,6 +3562,24 @@ public interface LayersPackage extends EPackage {
int REG_EXP_LAYER__IS_LAYER_ENABLED = ABSTRACT_LAYER__IS_LAYER_ENABLED;
/**
+ * The feature id for the '<em><b>Is Branch Enabled</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int REG_EXP_LAYER__IS_BRANCH_ENABLED = ABSTRACT_LAYER__IS_BRANCH_ENABLED;
+
+ /**
+ * The feature id for the '<em><b>Owning Layers Stack</b></em>' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int REG_EXP_LAYER__OWNING_LAYERS_STACK = ABSTRACT_LAYER__OWNING_LAYERS_STACK;
+
+ /**
* The feature id for the '<em><b>Property Values</b></em>' reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@@ -3643,15 +3724,6 @@ public interface LayersPackage extends EPackage {
int REG_EXP_LAYER___GET_PROPERTIES_COMPUTE_PROPERTY_VALUE_COMMAND__VIEW_ELIST = ABSTRACT_LAYER___GET_PROPERTIES_COMPUTE_PROPERTY_VALUE_COMMAND__VIEW_ELIST;
/**
- * The operation id for the '<em>Get Layers Stack</em>' operation.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- int REG_EXP_LAYER___GET_LAYERS_STACK = ABSTRACT_LAYER___GET_LAYERS_STACK;
-
- /**
* The operation id for the '<em>Add Property Instance</em>' operation.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@@ -3805,6 +3877,24 @@ public interface LayersPackage extends EPackage {
int LAYER__IS_LAYER_ENABLED = ABSTRACT_LAYER__IS_LAYER_ENABLED;
/**
+ * The feature id for the '<em><b>Is Branch Enabled</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int LAYER__IS_BRANCH_ENABLED = ABSTRACT_LAYER__IS_BRANCH_ENABLED;
+
+ /**
+ * The feature id for the '<em><b>Owning Layers Stack</b></em>' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int LAYER__OWNING_LAYERS_STACK = ABSTRACT_LAYER__OWNING_LAYERS_STACK;
+
+ /**
* The feature id for the '<em><b>Property Values</b></em>' reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@@ -3886,15 +3976,6 @@ public interface LayersPackage extends EPackage {
int LAYER___GET_PROPERTIES_COMPUTE_PROPERTY_VALUE_COMMAND__VIEW_ELIST = ABSTRACT_LAYER___GET_PROPERTIES_COMPUTE_PROPERTY_VALUE_COMMAND__VIEW_ELIST;
/**
- * The operation id for the '<em>Get Layers Stack</em>' operation.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- int LAYER___GET_LAYERS_STACK = ABSTRACT_LAYER___GET_LAYERS_STACK;
-
- /**
* The operation id for the '<em>Add Property Instance</em>' operation.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@@ -6364,6 +6445,28 @@ public interface LayersPackage extends EPackage {
EAttribute getLayerExpression_IsLayerEnabled();
/**
+ * Returns the meta object for the attribute '{@link org.eclipse.papyrus.layers.stackmodel.layers.LayerExpression#isBranchEnabled <em>Is Branch Enabled</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Is Branch Enabled</em>'.
+ * @see org.eclipse.papyrus.layers.stackmodel.layers.LayerExpression#isBranchEnabled()
+ * @see #getLayerExpression()
+ * @generated
+ */
+ EAttribute getLayerExpression_IsBranchEnabled();
+
+ /**
+ * Returns the meta object for the reference '{@link org.eclipse.papyrus.layers.stackmodel.layers.LayerExpression#getOwningLayersStack <em>Owning Layers Stack</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the reference '<em>Owning Layers Stack</em>'.
+ * @see org.eclipse.papyrus.layers.stackmodel.layers.LayerExpression#getOwningLayersStack()
+ * @see #getLayerExpression()
+ * @generated
+ */
+ EReference getLayerExpression_OwningLayersStack();
+
+ /**
* Returns the meta object for the '{@link org.eclipse.papyrus.layers.stackmodel.layers.LayerExpression#getComputePropertyValueCommand(org.eclipse.gmf.runtime.notation.View, org.eclipse.papyrus.layers.stackmodel.layers.Property) <em>Get Compute Property Value Command</em>}' operation.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@@ -6394,16 +6497,6 @@ public interface LayersPackage extends EPackage {
EOperation getLayerExpression__GetPropertiesComputePropertyValueCommand__View_EList();
/**
- * Returns the meta object for the '{@link org.eclipse.papyrus.layers.stackmodel.layers.LayerExpression#getLayersStack() <em>Get Layers Stack</em>}' operation.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the '<em>Get Layers Stack</em>' operation.
- * @see org.eclipse.papyrus.layers.stackmodel.layers.LayerExpression#getLayersStack()
- * @generated
- */
- EOperation getLayerExpression__GetLayersStack();
-
- /**
* Returns the meta object for class '{@link org.eclipse.papyrus.layers.stackmodel.layers.ApplicationDependantElement <em>Application Dependant Element</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@@ -8534,36 +8627,44 @@ public interface LayersPackage extends EPackage {
EAttribute LAYER_EXPRESSION__IS_LAYER_ENABLED = eINSTANCE.getLayerExpression_IsLayerEnabled();
/**
- * The meta object literal for the '<em><b>Get Compute Property Value Command</b></em>' operation.
+ * The meta object literal for the '<em><b>Is Branch Enabled</b></em>' attribute feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
- EOperation LAYER_EXPRESSION___GET_COMPUTE_PROPERTY_VALUE_COMMAND__VIEW_PROPERTY = eINSTANCE.getLayerExpression__GetComputePropertyValueCommand__View_Property();
+ EAttribute LAYER_EXPRESSION__IS_BRANCH_ENABLED = eINSTANCE.getLayerExpression_IsBranchEnabled();
/**
- * The meta object literal for the '<em><b>Get Views Compute Property Value Command</b></em>' operation.
+ * The meta object literal for the '<em><b>Owning Layers Stack</b></em>' reference feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
- EOperation LAYER_EXPRESSION___GET_VIEWS_COMPUTE_PROPERTY_VALUE_COMMAND__ELIST_PROPERTY = eINSTANCE.getLayerExpression__GetViewsComputePropertyValueCommand__EList_Property();
+ EReference LAYER_EXPRESSION__OWNING_LAYERS_STACK = eINSTANCE.getLayerExpression_OwningLayersStack();
/**
- * The meta object literal for the '<em><b>Get Properties Compute Property Value Command</b></em>' operation.
+ * The meta object literal for the '<em><b>Get Compute Property Value Command</b></em>' operation.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
- EOperation LAYER_EXPRESSION___GET_PROPERTIES_COMPUTE_PROPERTY_VALUE_COMMAND__VIEW_ELIST = eINSTANCE.getLayerExpression__GetPropertiesComputePropertyValueCommand__View_EList();
+ EOperation LAYER_EXPRESSION___GET_COMPUTE_PROPERTY_VALUE_COMMAND__VIEW_PROPERTY = eINSTANCE.getLayerExpression__GetComputePropertyValueCommand__View_Property();
+
+ /**
+ * The meta object literal for the '<em><b>Get Views Compute Property Value Command</b></em>' operation.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EOperation LAYER_EXPRESSION___GET_VIEWS_COMPUTE_PROPERTY_VALUE_COMMAND__ELIST_PROPERTY = eINSTANCE.getLayerExpression__GetViewsComputePropertyValueCommand__EList_Property();
/**
- * The meta object literal for the '<em><b>Get Layers Stack</b></em>' operation.
+ * The meta object literal for the '<em><b>Get Properties Compute Property Value Command</b></em>' operation.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
- EOperation LAYER_EXPRESSION___GET_LAYERS_STACK = eINSTANCE.getLayerExpression__GetLayersStack();
+ EOperation LAYER_EXPRESSION___GET_PROPERTIES_COMPUTE_PROPERTY_VALUE_COMMAND__VIEW_ELIST = eINSTANCE.getLayerExpression__GetPropertiesComputePropertyValueCommand__View_EList();
/**
* The meta object literal for the '{@link org.eclipse.papyrus.layers.stackmodel.layers.impl.ApplicationDependantElementImpl <em>Application Dependant Element</em>}' class.
diff --git a/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/src/org/eclipse/papyrus/layers/stackmodel/layers/impl/AbstractLayerImpl.java b/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/src/org/eclipse/papyrus/layers/stackmodel/layers/impl/AbstractLayerImpl.java
index 4dcfc9e22f8..e293f1d5efc 100644
--- a/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/src/org/eclipse/papyrus/layers/stackmodel/layers/impl/AbstractLayerImpl.java
+++ b/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/src/org/eclipse/papyrus/layers/stackmodel/layers/impl/AbstractLayerImpl.java
@@ -26,6 +26,7 @@ import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.common.util.EMap;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.EcorePackage;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.util.EObjectResolvingEList;
@@ -38,11 +39,14 @@ import org.eclipse.papyrus.layers.stackmodel.NotFoundException;
import org.eclipse.papyrus.layers.stackmodel.command.ComputePropertyValueCommand;
import org.eclipse.papyrus.layers.stackmodel.layers.AbstractLayer;
import org.eclipse.papyrus.layers.stackmodel.layers.LayerDescriptor;
+import org.eclipse.papyrus.layers.stackmodel.layers.LayerExpression;
+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.LayersStackApplication;
import org.eclipse.papyrus.layers.stackmodel.layers.NullInstance;
import org.eclipse.papyrus.layers.stackmodel.layers.Property;
+import org.eclipse.papyrus.layers.stackmodel.layers.RegExpLayer;
import org.eclipse.papyrus.layers.stackmodel.layers.TypeInstance;
import org.eclipse.papyrus.layers.stackmodel.layers.util.ECoreUtils;
@@ -115,6 +119,7 @@ public abstract class AbstractLayerImpl extends LayerExpressionImpl implements A
// Add an observer
Adapter adapter = new PropertyValuesSynchronizer();
this.eAdapters().add(adapter);
+
}
/**
@@ -782,4 +787,6 @@ public abstract class AbstractLayerImpl extends LayerExpressionImpl implements A
// in the model
return (LayersStack)ECoreUtils.lookupAncestorOfType(this, LayersPackage.eINSTANCE.getLayersStack());
}
+
+
} //AbstractLayerImpl
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 518fff72141..ad9cd1159ef 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
@@ -15,18 +15,24 @@ 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;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.papyrus.layers.stackmodel.LayersException;
import org.eclipse.papyrus.layers.stackmodel.NotFoundException;
import org.eclipse.papyrus.layers.stackmodel.command.ComputePropertyValueCommand;
import org.eclipse.papyrus.layers.stackmodel.layers.LayerExpression;
+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 -->
@@ -39,6 +45,8 @@ import org.eclipse.papyrus.layers.stackmodel.layers.Property;
* <li>{@link org.eclipse.papyrus.layers.stackmodel.layers.impl.LayerExpressionImpl#getDescription <em>Description</em>}</li>
* <li>{@link org.eclipse.papyrus.layers.stackmodel.layers.impl.LayerExpressionImpl#isLayerEnabledInternal <em>Is Layer Enabled Internal</em>}</li>
* <li>{@link org.eclipse.papyrus.layers.stackmodel.layers.impl.LayerExpressionImpl#isLayerEnabled <em>Is Layer Enabled</em>}</li>
+ * <li>{@link org.eclipse.papyrus.layers.stackmodel.layers.impl.LayerExpressionImpl#isBranchEnabled <em>Is Branch Enabled</em>}</li>
+ * <li>{@link org.eclipse.papyrus.layers.stackmodel.layers.impl.LayerExpressionImpl#getOwningLayersStack <em>Owning Layers Stack</em>}</li>
* </ul>
* </p>
*
@@ -111,12 +119,74 @@ ApplicationDependantElementImpl implements LayerExpression {
*/
protected boolean isLayerEnabled = IS_LAYER_ENABLED_EDEFAULT;
/**
+ * The default value of the '{@link #isBranchEnabled() <em>Is Branch Enabled</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #isBranchEnabled()
+ * @generated
+ * @ordered
+ */
+ protected static final boolean IS_BRANCH_ENABLED_EDEFAULT = true;
+ /**
+ * The cached value of the '{@link #isBranchEnabled() <em>Is Branch Enabled</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #isBranchEnabled()
+ * @generated
+ * @ordered
+ */
+ protected boolean isBranchEnabled = IS_BRANCH_ENABLED_EDEFAULT;
+ /**
+ * The cached value of the '{@link #getOwningLayersStack() <em>Owning Layers Stack</em>}' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getOwningLayersStack()
+ * @generated
+ * @ordered
+ */
+ protected LayersStack owningLayersStack;
+
+ /**
+ * Listener on this object container (i.e owner) attached/detached events
+ */
+ protected Adapter containerListener = new AdapterImpl() {
+ public void notifyChanged(Notification msg) {
+
+ switch(msg.getFeatureID(LayerExpression.class)) {
+ case EcorePackage.EOBJECT___ECONTAINER :
+ switch(msg.getEventType()) {
+ case Notification.SET:
+ //
+ owningLayerChanged((LayerOperator)msg.getNewValue(), (LayerOperator)msg.getOldValue());
+ break;
+
+ case Notification.UNSET:
+ owningLayerChanged((LayerOperator)msg.getNewValue(), (LayerOperator)msg.getOldValue());
+ break;
+
+ default:
+ break;
+ }
+ break;
+ };
+ }
+
+ };
+
+
+ /**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
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);
+
}
/**
@@ -192,13 +262,16 @@ ApplicationDependantElementImpl implements LayerExpression {
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- * @generated
+ * @generated NOT
*/
public void setIsLayerEnabled(boolean newIsLayerEnabled) {
boolean oldIsLayerEnabled = isLayerEnabled;
isLayerEnabled = newIsLayerEnabled;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, LayersPackage.LAYER_EXPRESSION__IS_LAYER_ENABLED, oldIsLayerEnabled, isLayerEnabled));
+
+ // Disable the branch
+ setIsBranchEnabled(isLayerEnabled);
}
/**
@@ -206,10 +279,71 @@ ApplicationDependantElementImpl implements LayerExpression {
* <!-- end-user-doc -->
* @generated
*/
- public ComputePropertyValueCommand getComputePropertyValueCommand(View view, Property property) throws LayersException {
+ public boolean isBranchEnabled() {
+ return isBranchEnabled;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated NOT
+ */
+ public void setIsBranchEnabled(boolean newIsBranchEnabled) {
+ boolean oldIsBranchEnabled = isBranchEnabled;
+ isBranchEnabled = newIsBranchEnabled;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, LayersPackage.LAYER_EXPRESSION__IS_BRANCH_ENABLED, oldIsBranchEnabled, isBranchEnabled));
+
+ // Propagate to children.
+ // This is done in LayerOperation.
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public LayersStack getOwningLayersStack() {
+ if (owningLayersStack != null && owningLayersStack.eIsProxy()) {
+ InternalEObject oldOwningLayersStack = (InternalEObject)owningLayersStack;
+ owningLayersStack = (LayersStack)eResolveProxy(oldOwningLayersStack);
+ if (owningLayersStack != oldOwningLayersStack) {
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.RESOLVE, LayersPackage.LAYER_EXPRESSION__OWNING_LAYERS_STACK, oldOwningLayersStack, owningLayersStack));
+ }
+ }
+ return owningLayersStack;
+ }
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public LayersStack basicGetOwningLayersStack() {
+ return owningLayersStack;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setOwningLayersStack(LayersStack newOwningLayersStack) {
+ LayersStack oldOwningLayersStack = owningLayersStack;
+ owningLayersStack = newOwningLayersStack;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, LayersPackage.LAYER_EXPRESSION__OWNING_LAYERS_STACK, oldOwningLayersStack, owningLayersStack));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated NOT
+ */
+ public LayersStack getLayersStack() throws NotFoundException {
// TODO: implement this method
// Ensure that you remove @generated or mark it @generated NOT
- throw new UnsupportedOperationException();
+ throw new UnsupportedOperationException();
}
/**
@@ -217,7 +351,7 @@ ApplicationDependantElementImpl implements LayerExpression {
* <!-- end-user-doc -->
* @generated
*/
- public EList<ComputePropertyValueCommand> getViewsComputePropertyValueCommand(EList<View> view, Property property) throws LayersException {
+ public ComputePropertyValueCommand getComputePropertyValueCommand(View view, Property property) throws LayersException {
// TODO: implement this method
// Ensure that you remove @generated or mark it @generated NOT
throw new UnsupportedOperationException();
@@ -228,7 +362,7 @@ ApplicationDependantElementImpl implements LayerExpression {
* <!-- end-user-doc -->
* @generated
*/
- public EList<ComputePropertyValueCommand> getPropertiesComputePropertyValueCommand(View view, EList<Property> property) throws LayersException {
+ public EList<ComputePropertyValueCommand> getViewsComputePropertyValueCommand(EList<View> view, Property property) throws LayersException {
// TODO: implement this method
// Ensure that you remove @generated or mark it @generated NOT
throw new UnsupportedOperationException();
@@ -239,7 +373,7 @@ ApplicationDependantElementImpl implements LayerExpression {
* <!-- end-user-doc -->
* @generated
*/
- public LayersStack getLayersStack() throws NotFoundException {
+ public EList<ComputePropertyValueCommand> getPropertiesComputePropertyValueCommand(View view, EList<Property> property) throws LayersException {
// TODO: implement this method
// Ensure that you remove @generated or mark it @generated NOT
throw new UnsupportedOperationException();
@@ -283,6 +417,11 @@ ApplicationDependantElementImpl implements LayerExpression {
return isLayerEnabledInternal();
case LayersPackage.LAYER_EXPRESSION__IS_LAYER_ENABLED:
return isLayerEnabled();
+ case LayersPackage.LAYER_EXPRESSION__IS_BRANCH_ENABLED:
+ return isBranchEnabled();
+ case LayersPackage.LAYER_EXPRESSION__OWNING_LAYERS_STACK:
+ if (resolve) return getOwningLayersStack();
+ return basicGetOwningLayersStack();
}
return super.eGet(featureID, resolve, coreType);
}
@@ -304,6 +443,12 @@ ApplicationDependantElementImpl implements LayerExpression {
case LayersPackage.LAYER_EXPRESSION__IS_LAYER_ENABLED:
setIsLayerEnabled((Boolean)newValue);
return;
+ case LayersPackage.LAYER_EXPRESSION__IS_BRANCH_ENABLED:
+ setIsBranchEnabled((Boolean)newValue);
+ return;
+ case LayersPackage.LAYER_EXPRESSION__OWNING_LAYERS_STACK:
+ setOwningLayersStack((LayersStack)newValue);
+ return;
}
super.eSet(featureID, newValue);
}
@@ -325,6 +470,12 @@ ApplicationDependantElementImpl implements LayerExpression {
case LayersPackage.LAYER_EXPRESSION__IS_LAYER_ENABLED:
setIsLayerEnabled(IS_LAYER_ENABLED_EDEFAULT);
return;
+ case LayersPackage.LAYER_EXPRESSION__IS_BRANCH_ENABLED:
+ setIsBranchEnabled(IS_BRANCH_ENABLED_EDEFAULT);
+ return;
+ case LayersPackage.LAYER_EXPRESSION__OWNING_LAYERS_STACK:
+ setOwningLayersStack((LayersStack)null);
+ return;
}
super.eUnset(featureID);
}
@@ -345,6 +496,10 @@ ApplicationDependantElementImpl implements LayerExpression {
return isLayerEnabledInternal() != IS_LAYER_ENABLED_INTERNAL_EDEFAULT;
case LayersPackage.LAYER_EXPRESSION__IS_LAYER_ENABLED:
return isLayerEnabled != IS_LAYER_ENABLED_EDEFAULT;
+ case LayersPackage.LAYER_EXPRESSION__IS_BRANCH_ENABLED:
+ return isBranchEnabled != IS_BRANCH_ENABLED_EDEFAULT;
+ case LayersPackage.LAYER_EXPRESSION__OWNING_LAYERS_STACK:
+ return owningLayersStack != null;
}
return super.eIsSet(featureID);
}
@@ -379,13 +534,6 @@ ApplicationDependantElementImpl implements LayerExpression {
catch (Throwable throwable) {
throw new InvocationTargetException(throwable);
}
- case LayersPackage.LAYER_EXPRESSION___GET_LAYERS_STACK:
- try {
- return getLayersStack();
- }
- catch (Throwable throwable) {
- throw new InvocationTargetException(throwable);
- }
}
return super.eInvoke(operationID, arguments);
}
@@ -406,8 +554,24 @@ ApplicationDependantElementImpl implements LayerExpression {
result.append(description);
result.append(", isLayerEnabled: ");
result.append(isLayerEnabled);
+ result.append(", isBranchEnabled: ");
+ result.append(isBranchEnabled);
result.append(')');
return result.toString();
}
+ /**
+ * This method is called when the container of this parent has changed.
+ * Set the #owningLayerStack property and the {@link #isBranchEnabled()} property
+ * @param newValue
+ * @param oldValue
+ */
+ private void owningLayerChanged(LayerOperator newParent, LayerOperator oldParent) {
+ // propagate values
+ if (newParent != null ) {
+ setOwningLayersStack(newParent.getOwningLayersStack());
+ setIsBranchEnabled(newParent.isBranchEnabled());
+ }
+ };
+
} //LayerExpressionImpl
diff --git a/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/src/org/eclipse/papyrus/layers/stackmodel/layers/impl/LayerOperatorImpl.java b/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/src/org/eclipse/papyrus/layers/stackmodel/layers/impl/LayerOperatorImpl.java
index 168f3c0ee33..fed5b7c13d5 100644
--- a/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/src/org/eclipse/papyrus/layers/stackmodel/layers/impl/LayerOperatorImpl.java
+++ b/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/src/org/eclipse/papyrus/layers/stackmodel/layers/impl/LayerOperatorImpl.java
@@ -175,4 +175,38 @@ public abstract class LayerOperatorImpl extends LayerExpressionImpl implements L
return (LayersStack)ECoreUtils.lookupAncestorOfType(this, LayersPackage.eINSTANCE.getLayersStack());
}
+ /**
+ * Propagate the change to children
+ * @see org.eclipse.papyrus.layers.stackmodel.layers.impl.LayerExpressionImpl#setIsBranchEnabled(boolean)
+ *
+ * @param newIsBranchEnabled
+ */
+ @Override
+ public void setIsBranchEnabled(boolean newIsBranchEnabled) {
+ // First, set the value.
+ super.setIsBranchEnabled(newIsBranchEnabled);
+ // Now, propagate
+ boolean value = isBranchEnabled();
+ for( LayerExpression layer : getLayers() ) {
+ layer.setIsBranchEnabled(value);
+ }
+ }
+
+ /**
+ * Set the value then propagate to children nodes.
+ *
+ * @see org.eclipse.papyrus.layers.stackmodel.layers.impl.LayerExpressionImpl#setOwningLayersStack(org.eclipse.papyrus.layers.stackmodel.layers.LayersStack)
+ *
+ * @param newOwningLayersStack
+ */
+ @Override
+ public void setOwningLayersStack(LayersStack newOwningLayersStack) {
+ // Set the value
+ super.setOwningLayersStack(newOwningLayersStack);
+ // Now propagate to children
+ LayersStack value = getOwningLayersStack();
+ for( LayerExpression layer : getLayers() ) {
+ layer.setOwningLayersStack(value);
+ }
+ }
} //LayerOperatorImpl
diff --git a/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/src/org/eclipse/papyrus/layers/stackmodel/layers/impl/LayersPackageImpl.java b/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/src/org/eclipse/papyrus/layers/stackmodel/layers/impl/LayersPackageImpl.java
index 9be752e4abf..4b97c4642a7 100644
--- a/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/src/org/eclipse/papyrus/layers/stackmodel/layers/impl/LayersPackageImpl.java
+++ b/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/src/org/eclipse/papyrus/layers/stackmodel/layers/impl/LayersPackageImpl.java
@@ -850,8 +850,8 @@ public class LayersPackageImpl extends EPackageImpl implements LayersPackage {
* <!-- end-user-doc -->
* @generated
*/
- public EOperation getLayerExpression__GetComputePropertyValueCommand__View_Property() {
- return layerExpressionEClass.getEOperations().get(0);
+ public EAttribute getLayerExpression_IsBranchEnabled() {
+ return (EAttribute)layerExpressionEClass.getEStructuralFeatures().get(4);
}
/**
@@ -859,8 +859,8 @@ public class LayersPackageImpl extends EPackageImpl implements LayersPackage {
* <!-- end-user-doc -->
* @generated
*/
- public EOperation getLayerExpression__GetViewsComputePropertyValueCommand__EList_Property() {
- return layerExpressionEClass.getEOperations().get(1);
+ public EReference getLayerExpression_OwningLayersStack() {
+ return (EReference)layerExpressionEClass.getEStructuralFeatures().get(5);
}
/**
@@ -868,8 +868,8 @@ public class LayersPackageImpl extends EPackageImpl implements LayersPackage {
* <!-- end-user-doc -->
* @generated
*/
- public EOperation getLayerExpression__GetPropertiesComputePropertyValueCommand__View_EList() {
- return layerExpressionEClass.getEOperations().get(2);
+ public EOperation getLayerExpression__GetComputePropertyValueCommand__View_Property() {
+ return layerExpressionEClass.getEOperations().get(0);
}
/**
@@ -877,8 +877,17 @@ public class LayersPackageImpl extends EPackageImpl implements LayersPackage {
* <!-- end-user-doc -->
* @generated
*/
- public EOperation getLayerExpression__GetLayersStack() {
- return layerExpressionEClass.getEOperations().get(3);
+ public EOperation getLayerExpression__GetViewsComputePropertyValueCommand__EList_Property() {
+ return layerExpressionEClass.getEOperations().get(1);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EOperation getLayerExpression__GetPropertiesComputePropertyValueCommand__View_EList() {
+ return layerExpressionEClass.getEOperations().get(2);
}
/**
@@ -2753,10 +2762,11 @@ public class LayersPackageImpl extends EPackageImpl implements LayersPackage {
createEAttribute(layerExpressionEClass, LAYER_EXPRESSION__DESCRIPTION);
createEAttribute(layerExpressionEClass, LAYER_EXPRESSION__IS_LAYER_ENABLED_INTERNAL);
createEAttribute(layerExpressionEClass, LAYER_EXPRESSION__IS_LAYER_ENABLED);
+ createEAttribute(layerExpressionEClass, LAYER_EXPRESSION__IS_BRANCH_ENABLED);
+ createEReference(layerExpressionEClass, LAYER_EXPRESSION__OWNING_LAYERS_STACK);
createEOperation(layerExpressionEClass, LAYER_EXPRESSION___GET_COMPUTE_PROPERTY_VALUE_COMMAND__VIEW_PROPERTY);
createEOperation(layerExpressionEClass, LAYER_EXPRESSION___GET_VIEWS_COMPUTE_PROPERTY_VALUE_COMMAND__ELIST_PROPERTY);
createEOperation(layerExpressionEClass, LAYER_EXPRESSION___GET_PROPERTIES_COMPUTE_PROPERTY_VALUE_COMMAND__VIEW_ELIST);
- createEOperation(layerExpressionEClass, LAYER_EXPRESSION___GET_LAYERS_STACK);
applicationDependantElementEClass = createEClass(APPLICATION_DEPENDANT_ELEMENT);
createEReference(applicationDependantElementEClass, APPLICATION_DEPENDANT_ELEMENT__APPLICATION);
@@ -3139,6 +3149,8 @@ public class LayersPackageImpl extends EPackageImpl implements LayersPackage {
initEAttribute(getLayerExpression_Description(), this.getString(), "description", null, 1, 1, LayerExpression.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED);
initEAttribute(getLayerExpression_IsLayerEnabledInternal(), this.getboolean(), "isLayerEnabledInternal", null, 1, 1, LayerExpression.class, IS_TRANSIENT, IS_VOLATILE, !IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, IS_DERIVED, !IS_ORDERED);
initEAttribute(getLayerExpression_IsLayerEnabled(), this.getboolean(), "isLayerEnabled", "true", 1, 1, LayerExpression.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED);
+ initEAttribute(getLayerExpression_IsBranchEnabled(), this.getboolean(), "isBranchEnabled", "true", 1, 1, LayerExpression.class, IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED);
+ initEReference(getLayerExpression_OwningLayersStack(), this.getLayersStack(), null, "owningLayersStack", null, 0, 1, LayerExpression.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED);
op = initEOperation(getLayerExpression__GetComputePropertyValueCommand__View_Property(), this.getComputePropertyValueCommand(), "getComputePropertyValueCommand", 1, 1, IS_UNIQUE, !IS_ORDERED);
addEParameter(op, theNotationPackage.getView(), "view", 1, 1, IS_UNIQUE, !IS_ORDERED);
@@ -3155,9 +3167,6 @@ public class LayersPackageImpl extends EPackageImpl implements LayersPackage {
addEParameter(op, this.getProperty(), "property", 1, -1, IS_UNIQUE, IS_ORDERED);
addEException(op, this.getLayersException());
- op = initEOperation(getLayerExpression__GetLayersStack(), this.getLayersStack(), "getLayersStack", 1, 1, IS_UNIQUE, !IS_ORDERED);
- addEException(op, this.getNotFoundException());
-
initEClass(applicationDependantElementEClass, ApplicationDependantElement.class, "ApplicationDependantElement", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEReference(getApplicationDependantElement_Application(), this.getLayersStackApplication(), null, "application", null, 0, 1, ApplicationDependantElement.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED);
@@ -3551,7 +3560,7 @@ public class LayersPackageImpl extends EPackageImpl implements LayersPackage {
* @generated
*/
protected void createExtendedMetaDataAnnotations() {
- String source = "http:///org/eclipse/emf/ecore/util/ExtendedMetaData";
+ String source = "http:///org/eclipse/emf/ecore/util/ExtendedMetaData";
addAnnotation
(badStateExceptionEDataType,
source,
diff --git a/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/src/org/eclipse/papyrus/layers/stackmodel/layers/impl/RegExpLayerImpl.java b/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/src/org/eclipse/papyrus/layers/stackmodel/layers/impl/RegExpLayerImpl.java
index 24ad2517609..35072775d98 100644
--- a/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/src/org/eclipse/papyrus/layers/stackmodel/layers/impl/RegExpLayerImpl.java
+++ b/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/src/org/eclipse/papyrus/layers/stackmodel/layers/impl/RegExpLayerImpl.java
@@ -16,26 +16,21 @@ import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
-
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.emf.common.notify.Adapter;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.impl.AdapterImpl;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EClassifier;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EcorePackage;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.query.conditions.eobjects.EObjectCondition;
-import org.eclipse.emf.query.ocl.conditions.BooleanOCLCondition;
import org.eclipse.emf.query.statements.FROM;
import org.eclipse.emf.query.statements.IQueryResult;
import org.eclipse.emf.query.statements.SELECT;
import org.eclipse.emf.query.statements.WHERE;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.ocl.ParserException;
import org.eclipse.ocl.ecore.OCL;
import org.eclipse.papyrus.layers.stackmodel.LayersException;
import org.eclipse.papyrus.layers.stackmodel.NotFoundException;
@@ -48,7 +43,6 @@ import org.eclipse.papyrus.layers.stackmodel.layers.RegExpLayer;
import org.eclipse.papyrus.layers.stackmodel.notifier.DiagramViewEventNotifier;
import org.eclipse.papyrus.layers.stackmodel.notifier.IDiagramViewEventListener;
import org.eclipse.papyrus.layers.stackmodel.util.NotyfyingList;
-
import com.google.common.eventbus.Subscribe;
/**
@@ -480,22 +474,23 @@ public class RegExpLayerImpl extends AbstractLayerImpl implements RegExpLayer {
* <!-- end-user-doc -->
* @param newLayerParent
* @generated NOT
+ * @deprecated not used
*/
public void activate(AbstractLayerOperator newLayerParent) {
- LayersStack layersStack;
- try {
- layersStack = newLayerParent.getLayersStack();
- } catch (NotFoundException e) {
- // silently fails
- return;
- }
-
- // Listen on view events
- if(diagramViewEventNotifier == null) {
- diagramViewEventNotifier = new DiagramViewEventNotifier(layersStack.getDiagram());
- return;
- }
+// LayersStack layersStack;
+// try {
+// layersStack = newLayerParent.getLayersStack();
+// } catch (NotFoundException e) {
+// // silently fails
+// return;
+// }
+//
+// // Listen on view events
+// if(diagramViewEventNotifier == null) {
+// diagramViewEventNotifier = new DiagramViewEventNotifier(layersStack.getDiagram());
+// return;
+// }
// diagramViewEventNotifier.
@@ -506,22 +501,23 @@ public class RegExpLayerImpl extends AbstractLayerImpl implements RegExpLayer {
* <!-- end-user-doc -->
* @param oldParentLayer
* @generated NOT
+ * @deprecated
*/
public void deactivate(AbstractLayerOperator oldParentLayer) {
- if( oldParentLayer == null) {
- return;
- }
-
- LayersStack layersStack;
- try {
- layersStack = oldParentLayer.getLayersStack();
- } catch (NotFoundException e) {
- // silently fails
- return;
- }
-
- layersStack.getDiagram();
+// if( oldParentLayer == null) {
+// return;
+// }
+//
+// LayersStack layersStack;
+// try {
+// layersStack = oldParentLayer.getLayersStack();
+// } catch (NotFoundException e) {
+// // silently fails
+// return;
+// }
+//
+// layersStack.getDiagram();
}
/**
diff --git a/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/test/org/eclipse/papyrus/layers/stackmodel/layers/impl/LayerExpressionInitWithApplicationImplTest.java b/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/test/org/eclipse/papyrus/layers/stackmodel/layers/impl/LayerExpressionInitWithApplicationImplTest.java
new file mode 100644
index 00000000000..50794167b73
--- /dev/null
+++ b/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/test/org/eclipse/papyrus/layers/stackmodel/layers/impl/LayerExpressionInitWithApplicationImplTest.java
@@ -0,0 +1,162 @@
+/*****************************************************************************
+ * Copyright (c) 2013 Cedric Dumoulin.
+ *
+ *
+ * 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:
+ * Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.layers.stackmodel.layers.impl;
+
+import static org.junit.Assert.fail;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertEquals;
+
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.layers.stackmodel.layers.Layer;
+import org.eclipse.papyrus.layers.stackmodel.layers.LayersFactory;
+import org.eclipse.papyrus.layers.stackmodel.layers.LayersStack;
+import org.eclipse.papyrus.layers.stackmodel.layers.LayersStackApplication;
+import org.eclipse.papyrus.layers.stackmodel.layers.PropertyRegistry;
+import org.eclipse.papyrus.layers.stackmodel.layers.TopLayerOperator;
+import org.eclipse.papyrus.layers.stackmodel.layers.util.LayersFactoryTestUtils;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Test initilaization of Layers when inserted in a tree of layers.
+ * Use the LayerStack as container.
+ *
+ * @author cedric dumoulin
+ *
+ */
+public class LayerExpressionInitWithApplicationImplTest {
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @Before
+ public void setUp() throws Exception {
+ }
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ /**
+ * Test method for {@link org.eclipse.papyrus.layers.stackmodel.layers.impl.LayerExpressionImpl#LayerExpressionImpl()}.
+ */
+ @Test
+ public void testLayerExpressionImpl() {
+ // Create requested objects
+ LayersStackApplication application = LayersFactory.eINSTANCE.createLayersStackApplication();
+ Diagram diagram = NotationFactory.eINSTANCE.createDiagram();
+ // Create stack
+ LayersStack stack = application.getLayersStackFor(diagram);
+
+ // Create layers
+ LayersFactoryTestUtils factory = new LayersFactoryTestUtils(application);
+ factory.newTopLayer("top",
+ factory.newLayer("layer1"),
+ factory.newLayer("layer2"),
+ factory.newTopLayer("container1",
+ factory.newLayer("layer3") )
+ );
+
+ TopLayerOperator top = (TopLayerOperator)factory.getLayer("top");
+ TopLayerOperator container1 = (TopLayerOperator)factory.getLayer("top");
+ Layer layer1 = (Layer)factory.getLayer("layer1");
+ Layer layer2 = (Layer)factory.getLayer("layer1");
+ Layer layer3 = (Layer)factory.getLayer("layer1");
+
+
+ // Assert
+ assertNotNull("object created", top);
+ assertEquals("application initialized", application, top.getApplication() );
+
+ assertNotNull("object created", container1);
+ assertEquals("application initialized", application, container1.getApplication() );
+
+ assertNotNull("object created", layer1);
+ assertEquals("application initialized", application, layer1.getApplication() );
+
+ assertNotNull("object created", layer2);
+ assertEquals("application initialized", application, layer2.getApplication() );
+
+ assertNotNull("object created", layer3);
+ assertEquals("application initialized", application, layer3.getApplication() );
+ }
+
+ /**
+ * Test method for {@link org.eclipse.papyrus.layers.stackmodel.layers.impl.LayerExpressionImpl#isLayerEnabled()}.
+ */
+ @Test
+ public void testIsLayerEnabled() {
+ fail("Not yet implemented");
+ }
+
+ /**
+ * Test method for {@link org.eclipse.papyrus.layers.stackmodel.layers.impl.LayerExpressionImpl#isBranchEnabled()}.
+ */
+ @Test
+ public void testIsBranchEnabled() {
+ fail("Not yet implemented");
+ }
+
+ /**
+ * Test method for {@link org.eclipse.papyrus.layers.stackmodel.layers.impl.LayerExpressionImpl#getOwningLayersStack()}.
+ */
+ @Test
+ public void testGetOwningLayersStack() {
+ // Create requested objects
+ LayersStackApplication application = LayersFactory.eINSTANCE.createLayersStackApplication();
+ Diagram diagram = NotationFactory.eINSTANCE.createDiagram();
+ // Create stack
+ LayersStack stack = application.getLayersStackFor(diagram);
+
+ // Create layers
+ LayersFactoryTestUtils factory = new LayersFactoryTestUtils(application);
+ factory.newTopLayer("top",
+ factory.newLayer("layer1"),
+ factory.newLayer("layer2"),
+ factory.newTopLayer("container1",
+ factory.newLayer("layer3") )
+ );
+
+ TopLayerOperator top = (TopLayerOperator)factory.getLayer("top");
+ TopLayerOperator container1 = (TopLayerOperator)factory.getLayer("top");
+ Layer layer1 = (Layer)factory.getLayer("layer1");
+ Layer layer2 = (Layer)factory.getLayer("layer1");
+ Layer layer3 = (Layer)factory.getLayer("layer1");
+
+
+ // Assert
+ assertNotNull("object created", top);
+ assertEquals("container (stack) initialized", stack, top.getOwningLayersStack() );
+
+ assertNotNull("object created", container1);
+ assertEquals("container (stack) initialized", stack, container1.getOwningLayersStack() );
+
+ assertNotNull("object created", layer1);
+ assertEquals("container (stack) initialized", stack, layer1.getOwningLayersStack() );
+
+ assertNotNull("object created", layer2);
+ assertEquals("container (stack) initialized", stack, layer2.getOwningLayersStack() );
+
+ assertNotNull("object created", layer3);
+ assertEquals("container (stack) initialized", stack, layer3.getOwningLayersStack() );
+ }
+
+}
diff --git a/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/test/org/eclipse/papyrus/layers/stackmodel/layers/util/LayerFactoryTestUtilsTest.java b/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/test/org/eclipse/papyrus/layers/stackmodel/layers/util/LayerFactoryTestUtilsTest.java
new file mode 100644
index 00000000000..3e87090dbed
--- /dev/null
+++ b/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/test/org/eclipse/papyrus/layers/stackmodel/layers/util/LayerFactoryTestUtilsTest.java
@@ -0,0 +1,98 @@
+/*****************************************************************************
+ * Copyright (c) 2013 Cedric Dumoulin.
+ *
+ *
+ * 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:
+ * Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.layers.stackmodel.layers.util;
+
+import static org.junit.Assert.fail;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertEquals;
+
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.layers.stackmodel.layers.Layer;
+import org.eclipse.papyrus.layers.stackmodel.layers.LayersFactory;
+import org.eclipse.papyrus.layers.stackmodel.layers.LayersStack;
+import org.eclipse.papyrus.layers.stackmodel.layers.LayersStackApplication;
+import org.eclipse.papyrus.layers.stackmodel.layers.PropertyRegistry;
+import org.eclipse.papyrus.layers.stackmodel.layers.TopLayerOperator;
+import org.eclipse.papyrus.layers.stackmodel.layers.util.LayersFactoryTestUtils;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Test utility to create tree of layers..
+ *
+ * @author cedric dumoulin
+ *
+ */
+public class LayerFactoryTestUtilsTest {
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @Before
+ public void setUp() throws Exception {
+ }
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ /**
+ * Test creation of a tree of layers.
+ */
+ @Test
+ public void testCreateTreeImpl() {
+ // Create requested objects
+ LayersStackApplication application = LayersFactory.eINSTANCE.createLayersStackApplication();
+ PropertyRegistry propertyRegistry = application.getPropertyRegistry();
+ Diagram diagram = NotationFactory.eINSTANCE.createDiagram();
+
+ // Create stack
+ LayersStack stack = application.getLayersStackFor(diagram);
+
+ // Create layers
+ LayersFactoryTestUtils factory = new LayersFactoryTestUtils(application);
+ factory.newTopLayer("top",
+ factory.newLayer("layer1"),
+ factory.newLayer("layer2"),
+ factory.newTopLayer("container1",
+ factory.newLayer("layer3") )
+ );
+
+ TopLayerOperator top = (TopLayerOperator)factory.getLayer("top");
+ TopLayerOperator container1 = (TopLayerOperator)factory.getLayer("top");
+ Layer layer1 = (Layer)factory.getLayer("layer1");
+ Layer layer2 = (Layer)factory.getLayer("layer1");
+ Layer layer3 = (Layer)factory.getLayer("layer1");
+
+
+ // Assert
+ assertNotNull("object created", top);
+
+ assertNotNull("object created", container1);
+
+ assertNotNull("object created", layer1);
+
+ assertNotNull("object created", layer2);
+
+ assertNotNull("object created", layer3);
+ }
+
+}
diff --git a/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/test/org/eclipse/papyrus/layers/stackmodel/layers/util/LayersFactoryTestUtils.java b/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/test/org/eclipse/papyrus/layers/stackmodel/layers/util/LayersFactoryTestUtils.java
new file mode 100644
index 00000000000..319ef88f59b
--- /dev/null
+++ b/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel/test/org/eclipse/papyrus/layers/stackmodel/layers/util/LayersFactoryTestUtils.java
@@ -0,0 +1,136 @@
+/*****************************************************************************
+ * Copyright (c) 2013 Cedric Dumoulin.
+ *
+ *
+ * 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:
+ * Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.layers.stackmodel.layers.util;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.papyrus.layers.stackmodel.layers.LayerExpression;
+import org.eclipse.papyrus.layers.stackmodel.layers.LayersFactory;
+import org.eclipse.papyrus.layers.stackmodel.layers.LayersStackApplication;
+import org.eclipse.papyrus.layers.stackmodel.layers.TopLayerOperator;
+
+/**
+ * Utilities to create Layers for tests
+ *
+ * @author cedric dumoulin
+ *
+ */
+public class LayersFactoryTestUtils {
+
+ /**
+ * Application object.
+ */
+ protected LayersStackApplication application;
+
+ protected Map<String, LayerExpression> createdLayers = new HashMap<String, LayerExpression>();
+
+ /**
+ * Constructor.
+ *
+ * @param application
+ */
+ public LayersFactoryTestUtils(LayersStackApplication application) {
+ this.application = application;
+ }
+
+ /**
+ * @return the createdLayers
+ */
+ public Map<String, LayerExpression> getCreatedLayers() {
+ return createdLayers;
+ }
+
+ /**
+ * @return the createdLayers
+ */
+ public LayerExpression getLayer(String name) {
+ return createdLayers.get(name);
+ }
+
+ /**
+ * Create a TopLayer
+ * @return
+ */
+ public TopLayerOperator newTopLayer() {
+ // Create a TopLayer
+ TopLayerOperator layer = LayersFactory.eINSTANCE.createTopLayerOperator();
+ layer.setApplication(application);
+
+ return layer;
+ }
+
+ /**
+ * Create a TopLayer
+ * @return
+ */
+ public TopLayerOperator newTopLayer(String name) {
+ TopLayerOperator layer = newTopLayer();
+ createdLayers.put(name, layer);
+ return layer;
+
+ }
+
+ /**
+ * Create a TopLayer
+ * @return
+ */
+ public TopLayerOperator newTopLayer(String name, LayerExpression ...exprs) {
+
+ TopLayerOperator layer = newTopLayer(exprs);
+ createdLayers.put(name, layer);
+ return layer;
+ }
+
+ /**
+ * Create a TopLayer
+ * @return
+ */
+ public TopLayerOperator newTopLayer(LayerExpression ...exprs) {
+ // Create a TopLayer
+ TopLayerOperator layer = newTopLayer();
+
+ for( LayerExpression l : exprs) {
+ layer.getLayers().add(l);
+ }
+
+ return layer;
+ }
+
+ /**
+ * Create a Layer
+ * @return
+ */
+ public LayerExpression newLayer() {
+ // Create a TopLayer
+ LayerExpression layer = LayersFactory.eINSTANCE.createLayer();
+ layer.setApplication(application);
+
+ return layer;
+ }
+
+ /**
+ * Create a TopLayer
+ * @return
+ */
+ public LayerExpression newLayer(String name) {
+ LayerExpression layer = newLayer();
+ createdLayers.put(name, layer);
+ return layer;
+
+ }
+
+
+}

Back to the top