Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Grouhan2015-03-24 15:17:11 +0000
committerMaxime Porhel2015-03-30 15:22:04 +0000
commit079f60ad2e10c90e2adf5b630e447bdd2305ebeb (patch)
treefef9c5b9ae6436731e8061711231a2bf2e6f0313
parentd318a159d06e2bef7ad8b9ddbc2982bbb722a1bf (diff)
downloadorg.eclipse.sirius-079f60ad2e10c90e2adf5b630e447bdd2305ebeb.tar.gz
org.eclipse.sirius-079f60ad2e10c90e2adf5b630e447bdd2305ebeb.tar.xz
org.eclipse.sirius-079f60ad2e10c90e2adf5b630e447bdd2305ebeb.zip
[462867] Mandatory VSM elements are created by default
Automatically create as a child : - A concern when creating concerns (ConcernSet) in a diagram, imported diagram and diagram extension. - A style when creating a conditional style of a tree item. - A background/foreground style when creating a conditional background/foreground in a line, element column, intersection and feature column of a table. - An EdgeStyle when creating a conditional edge style (or a BracketEdgeStyle if the edge maping uses a BracketEdgeStyle) of a diagram. Automatic creation of the default layer was done in a previous commit. Bug: 462867 Change-Id: I8856a1aa301b648ca200e26ec65337a8a15d9491 Signed-off-by: Benjamin Grouhan <benjamin.grouhan@obeo.fr>
-rw-r--r--plugins/org.eclipse.sirius.diagram.ui/src-gen/org/eclipse/sirius/diagram/description/provider/DiagramDescriptionItemProvider.java63
-rw-r--r--plugins/org.eclipse.sirius.diagram.ui/src-gen/org/eclipse/sirius/diagram/description/provider/DiagramExtensionDescriptionItemProvider.java24
-rw-r--r--plugins/org.eclipse.sirius.diagram.ui/src-gen/org/eclipse/sirius/diagram/description/provider/DiagramImportDescriptionItemProvider.java5
-rw-r--r--plugins/org.eclipse.sirius.diagram.ui/src-gen/org/eclipse/sirius/diagram/description/provider/EdgeMappingItemProvider.java51
-rw-r--r--plugins/org.eclipse.sirius.table.ui/src-gen/org/eclipse/sirius/table/metamodel/table/description/provider/ElementColumnMappingItemProvider.java33
-rw-r--r--plugins/org.eclipse.sirius.table.ui/src-gen/org/eclipse/sirius/table/metamodel/table/description/provider/FeatureColumnMappingItemProvider.java10
-rw-r--r--plugins/org.eclipse.sirius.table.ui/src-gen/org/eclipse/sirius/table/metamodel/table/description/provider/IntersectionMappingItemProvider.java10
-rw-r--r--plugins/org.eclipse.sirius.table.ui/src-gen/org/eclipse/sirius/table/metamodel/table/description/provider/LineMappingItemProvider.java35
-rw-r--r--plugins/org.eclipse.sirius.tests.swtbot/data/unit/editor/vsm/autoCreateMandatoryElements.odesign43
-rw-r--r--plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/editor/vsm/CreateMandatoryElementsTest.java100
-rw-r--r--plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/suite/AllTestSuite.java2
-rw-r--r--plugins/org.eclipse.sirius.tree.ui/src-gen/org/eclipse/sirius/tree/description/provider/TreeItemMappingItemProvider.java5
12 files changed, 365 insertions, 16 deletions
diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-gen/org/eclipse/sirius/diagram/description/provider/DiagramDescriptionItemProvider.java b/plugins/org.eclipse.sirius.diagram.ui/src-gen/org/eclipse/sirius/diagram/description/provider/DiagramDescriptionItemProvider.java
index f332f2f461..46600e721e 100644
--- a/plugins/org.eclipse.sirius.diagram.ui/src-gen/org/eclipse/sirius/diagram/description/provider/DiagramDescriptionItemProvider.java
+++ b/plugins/org.eclipse.sirius.diagram.ui/src-gen/org/eclipse/sirius/diagram/description/provider/DiagramDescriptionItemProvider.java
@@ -28,6 +28,7 @@ import org.eclipse.sirius.diagram.description.DiagramDescription;
import org.eclipse.sirius.diagram.description.EdgeMapping;
import org.eclipse.sirius.diagram.description.Layer;
import org.eclipse.sirius.diagram.description.concern.ConcernFactory;
+import org.eclipse.sirius.diagram.description.concern.ConcernSet;
import org.eclipse.sirius.diagram.description.filter.FilterFactory;
import org.eclipse.sirius.viewpoint.description.DescriptionPackage;
import org.eclipse.sirius.viewpoint.description.tool.ToolFactory;
@@ -510,7 +511,9 @@ public class DiagramDescriptionItemProvider extends DragAndDropTargetDescription
newChildDescriptors.add(createChildParameter(org.eclipse.sirius.diagram.description.DescriptionPackage.Literals.DIAGRAM_DESCRIPTION__VALIDATION_SET,
ValidationFactory.eINSTANCE.createValidationSet()));
- newChildDescriptors.add(createChildParameter(org.eclipse.sirius.diagram.description.DescriptionPackage.Literals.DIAGRAM_DESCRIPTION__CONCERNS, ConcernFactory.eINSTANCE.createConcernSet()));
+ ConcernSet concernSet = ConcernFactory.eINSTANCE.createConcernSet();
+ concernSet.getOwnedConcernDescriptions().add(ConcernFactory.eINSTANCE.createConcernDescription());
+ newChildDescriptors.add(createChildParameter(org.eclipse.sirius.diagram.description.DescriptionPackage.Literals.DIAGRAM_DESCRIPTION__CONCERNS, concernSet));
newChildDescriptors.add(createChildParameter(org.eclipse.sirius.diagram.description.DescriptionPackage.Literals.DIAGRAM_DESCRIPTION__LAYOUT,
DescriptionFactory.eINSTANCE.createOrderedTreeLayout()));
@@ -558,6 +561,64 @@ public class DiagramDescriptionItemProvider extends DragAndDropTargetDescription
}
/**
+ * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s
+ * describing the children that can be created under this object. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected void collectNewChildDescriptorsGen(Collection<Object> newChildDescriptors, Object object) {
+ super.collectNewChildDescriptors(newChildDescriptors, object);
+
+ newChildDescriptors.add(createChildParameter(org.eclipse.sirius.diagram.description.DescriptionPackage.Literals.DIAGRAM_DESCRIPTION__FILTERS,
+ FilterFactory.eINSTANCE.createCompositeFilterDescription()));
+
+ newChildDescriptors.add(createChildParameter(org.eclipse.sirius.diagram.description.DescriptionPackage.Literals.DIAGRAM_DESCRIPTION__VALIDATION_SET,
+ ValidationFactory.eINSTANCE.createValidationSet()));
+
+ newChildDescriptors.add(createChildParameter(org.eclipse.sirius.diagram.description.DescriptionPackage.Literals.DIAGRAM_DESCRIPTION__CONCERNS, ConcernFactory.eINSTANCE.createConcernSet()));
+
+ newChildDescriptors.add(createChildParameter(org.eclipse.sirius.diagram.description.DescriptionPackage.Literals.DIAGRAM_DESCRIPTION__LAYOUT,
+ DescriptionFactory.eINSTANCE.createOrderedTreeLayout()));
+
+ newChildDescriptors.add(createChildParameter(org.eclipse.sirius.diagram.description.DescriptionPackage.Literals.DIAGRAM_DESCRIPTION__LAYOUT,
+ DescriptionFactory.eINSTANCE.createCompositeLayout()));
+
+ newChildDescriptors.add(createChildParameter(org.eclipse.sirius.diagram.description.DescriptionPackage.Literals.DIAGRAM_DESCRIPTION__DIAGRAM_INITIALISATION,
+ ToolFactory.eINSTANCE.createInitialOperation()));
+
+ newChildDescriptors
+ .add(createChildParameter(org.eclipse.sirius.diagram.description.DescriptionPackage.Literals.DIAGRAM_DESCRIPTION__DEFAULT_LAYER, DescriptionFactory.eINSTANCE.createLayer()));
+
+ newChildDescriptors.add(createChildParameter(org.eclipse.sirius.diagram.description.DescriptionPackage.Literals.DIAGRAM_DESCRIPTION__DEFAULT_LAYER,
+ DescriptionFactory.eINSTANCE.createAdditionalLayer()));
+
+ newChildDescriptors.add(createChildParameter(org.eclipse.sirius.diagram.description.DescriptionPackage.Literals.DIAGRAM_DESCRIPTION__ADDITIONAL_LAYERS,
+ DescriptionFactory.eINSTANCE.createAdditionalLayer()));
+
+ newChildDescriptors.add(createChildParameter(org.eclipse.sirius.diagram.description.DescriptionPackage.Literals.DIAGRAM_DESCRIPTION__NODE_MAPPINGS,
+ DescriptionFactory.eINSTANCE.createNodeMapping()));
+
+ newChildDescriptors.add(createChildParameter(org.eclipse.sirius.diagram.description.DescriptionPackage.Literals.DIAGRAM_DESCRIPTION__NODE_MAPPINGS,
+ DescriptionFactory.eINSTANCE.createNodeMappingImport()));
+
+ newChildDescriptors.add(createChildParameter(org.eclipse.sirius.diagram.description.DescriptionPackage.Literals.DIAGRAM_DESCRIPTION__EDGE_MAPPINGS,
+ DescriptionFactory.eINSTANCE.createEdgeMapping()));
+
+ newChildDescriptors.add(createChildParameter(org.eclipse.sirius.diagram.description.DescriptionPackage.Literals.DIAGRAM_DESCRIPTION__EDGE_MAPPING_IMPORTS,
+ DescriptionFactory.eINSTANCE.createEdgeMappingImport()));
+
+ newChildDescriptors.add(createChildParameter(org.eclipse.sirius.diagram.description.DescriptionPackage.Literals.DIAGRAM_DESCRIPTION__CONTAINER_MAPPINGS,
+ DescriptionFactory.eINSTANCE.createContainerMapping()));
+
+ newChildDescriptors.add(createChildParameter(org.eclipse.sirius.diagram.description.DescriptionPackage.Literals.DIAGRAM_DESCRIPTION__CONTAINER_MAPPINGS,
+ DescriptionFactory.eINSTANCE.createContainerMappingImport()));
+
+ newChildDescriptors.add(createChildParameter(org.eclipse.sirius.diagram.description.DescriptionPackage.Literals.DIAGRAM_DESCRIPTION__TOOL_SECTION,
+ org.eclipse.sirius.diagram.description.tool.ToolFactory.eINSTANCE.createToolSection()));
+ }
+
+ /**
* This returns the label text for
* {@link org.eclipse.emf.edit.command.CreateChildCommand}. <!--
* begin-user-doc --> <!-- end-user-doc -->
diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-gen/org/eclipse/sirius/diagram/description/provider/DiagramExtensionDescriptionItemProvider.java b/plugins/org.eclipse.sirius.diagram.ui/src-gen/org/eclipse/sirius/diagram/description/provider/DiagramExtensionDescriptionItemProvider.java
index a318483a25..f88a9f0668 100644
--- a/plugins/org.eclipse.sirius.diagram.ui/src-gen/org/eclipse/sirius/diagram/description/provider/DiagramExtensionDescriptionItemProvider.java
+++ b/plugins/org.eclipse.sirius.diagram.ui/src-gen/org/eclipse/sirius/diagram/description/provider/DiagramExtensionDescriptionItemProvider.java
@@ -31,6 +31,7 @@ import org.eclipse.emf.edit.provider.ViewerNotification;
import org.eclipse.sirius.diagram.description.DescriptionFactory;
import org.eclipse.sirius.diagram.description.DiagramExtensionDescription;
import org.eclipse.sirius.diagram.description.concern.ConcernFactory;
+import org.eclipse.sirius.diagram.description.concern.ConcernSet;
import org.eclipse.sirius.diagram.ui.provider.DiagramUIPlugin;
import org.eclipse.sirius.viewpoint.description.DescriptionPackage;
import org.eclipse.sirius.viewpoint.description.validation.ValidationFactory;
@@ -216,7 +217,7 @@ public class DiagramExtensionDescriptionItemProvider extends ItemProviderAdapter
* describing the children that can be created under this object. <!--
* begin-user-doc --> <!-- end-user-doc -->
*
- * @generated
+ * @not-generated
*/
@Override
protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
@@ -228,6 +229,27 @@ public class DiagramExtensionDescriptionItemProvider extends ItemProviderAdapter
newChildDescriptors.add(createChildParameter(org.eclipse.sirius.diagram.description.DescriptionPackage.Literals.DIAGRAM_EXTENSION_DESCRIPTION__VALIDATION_SET,
ValidationFactory.eINSTANCE.createValidationSet()));
+ ConcernSet concernSet = ConcernFactory.eINSTANCE.createConcernSet();
+ concernSet.getOwnedConcernDescriptions().add(ConcernFactory.eINSTANCE.createConcernDescription());
+ newChildDescriptors.add(createChildParameter(org.eclipse.sirius.diagram.description.DescriptionPackage.Literals.DIAGRAM_EXTENSION_DESCRIPTION__CONCERNS, concernSet));
+ }
+
+ /**
+ * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s
+ * describing the children that can be created under this object. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected void collectNewChildDescriptorsGen(Collection<Object> newChildDescriptors, Object object) {
+ super.collectNewChildDescriptors(newChildDescriptors, object);
+
+ newChildDescriptors.add(createChildParameter(org.eclipse.sirius.diagram.description.DescriptionPackage.Literals.DIAGRAM_EXTENSION_DESCRIPTION__LAYERS,
+ DescriptionFactory.eINSTANCE.createAdditionalLayer()));
+
+ newChildDescriptors.add(createChildParameter(org.eclipse.sirius.diagram.description.DescriptionPackage.Literals.DIAGRAM_EXTENSION_DESCRIPTION__VALIDATION_SET,
+ ValidationFactory.eINSTANCE.createValidationSet()));
+
newChildDescriptors.add(createChildParameter(org.eclipse.sirius.diagram.description.DescriptionPackage.Literals.DIAGRAM_EXTENSION_DESCRIPTION__CONCERNS,
ConcernFactory.eINSTANCE.createConcernSet()));
}
diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-gen/org/eclipse/sirius/diagram/description/provider/DiagramImportDescriptionItemProvider.java b/plugins/org.eclipse.sirius.diagram.ui/src-gen/org/eclipse/sirius/diagram/description/provider/DiagramImportDescriptionItemProvider.java
index c64c00a734..d1d7bdd3c3 100644
--- a/plugins/org.eclipse.sirius.diagram.ui/src-gen/org/eclipse/sirius/diagram/description/provider/DiagramImportDescriptionItemProvider.java
+++ b/plugins/org.eclipse.sirius.diagram.ui/src-gen/org/eclipse/sirius/diagram/description/provider/DiagramImportDescriptionItemProvider.java
@@ -28,6 +28,7 @@ import org.eclipse.sirius.diagram.description.DescriptionFactory;
import org.eclipse.sirius.diagram.description.DiagramImportDescription;
import org.eclipse.sirius.diagram.description.EdgeMapping;
import org.eclipse.sirius.diagram.description.concern.ConcernFactory;
+import org.eclipse.sirius.diagram.description.concern.ConcernSet;
import org.eclipse.sirius.diagram.description.filter.FilterFactory;
import org.eclipse.sirius.diagram.description.tool.ToolFactory;
import org.eclipse.sirius.diagram.ui.provider.DiagramUIPlugin;
@@ -526,7 +527,9 @@ public class DiagramImportDescriptionItemProvider extends DocumentedElementItemP
newChildDescriptors.add(createChildParameter(org.eclipse.sirius.diagram.description.DescriptionPackage.Literals.DIAGRAM_DESCRIPTION__VALIDATION_SET,
ValidationFactory.eINSTANCE.createValidationSet()));
- newChildDescriptors.add(createChildParameter(org.eclipse.sirius.diagram.description.DescriptionPackage.Literals.DIAGRAM_DESCRIPTION__CONCERNS, ConcernFactory.eINSTANCE.createConcernSet()));
+ ConcernSet concernSet = ConcernFactory.eINSTANCE.createConcernSet();
+ concernSet.getOwnedConcernDescriptions().add(ConcernFactory.eINSTANCE.createConcernDescription());
+ newChildDescriptors.add(createChildParameter(org.eclipse.sirius.diagram.description.DescriptionPackage.Literals.DIAGRAM_DESCRIPTION__CONCERNS, concernSet));
newChildDescriptors.add(createChildParameter(org.eclipse.sirius.diagram.description.DescriptionPackage.Literals.DIAGRAM_DESCRIPTION__LAYOUT,
DescriptionFactory.eINSTANCE.createOrderedTreeLayout()));
diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-gen/org/eclipse/sirius/diagram/description/provider/EdgeMappingItemProvider.java b/plugins/org.eclipse.sirius.diagram.ui/src-gen/org/eclipse/sirius/diagram/description/provider/EdgeMappingItemProvider.java
index a48fc8f946..6631153887 100644
--- a/plugins/org.eclipse.sirius.diagram.ui/src-gen/org/eclipse/sirius/diagram/description/provider/EdgeMappingItemProvider.java
+++ b/plugins/org.eclipse.sirius.diagram.ui/src-gen/org/eclipse/sirius/diagram/description/provider/EdgeMappingItemProvider.java
@@ -22,11 +22,13 @@ import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
import org.eclipse.emf.edit.provider.ViewerNotification;
import org.eclipse.sirius.business.api.query.IdentifiedElementQuery;
+import org.eclipse.sirius.diagram.description.ConditionalEdgeStyleDescription;
import org.eclipse.sirius.diagram.description.DescriptionFactory;
import org.eclipse.sirius.diagram.description.EdgeMapping;
import org.eclipse.sirius.diagram.description.style.BracketEdgeStyleDescription;
import org.eclipse.sirius.diagram.description.style.EdgeStyleDescription;
import org.eclipse.sirius.diagram.description.style.StyleFactory;
+import org.eclipse.sirius.diagram.description.style.StylePackage;
import org.eclipse.sirius.viewpoint.description.DescriptionPackage;
/**
@@ -316,17 +318,58 @@ public class EdgeMappingItemProvider extends DiagramElementMappingItemProvider {
super.collectNewChildDescriptors(newChildDescriptors, object);
EdgeStyleDescription esd = StyleFactory.eINSTANCE.createEdgeStyleDescription();
- esd.setSizeComputationExpression("2");
- esd.setCenterLabelStyleDescription(StyleFactory.eINSTANCE.createCenterLabelStyleDescription());
+ edgeStyleInit(esd);
newChildDescriptors.add(createChildParameter(org.eclipse.sirius.diagram.description.DescriptionPackage.Literals.EDGE_MAPPING__STYLE, esd));
BracketEdgeStyleDescription bsd = StyleFactory.eINSTANCE.createBracketEdgeStyleDescription();
- bsd.setSizeComputationExpression("2");
- bsd.setCenterLabelStyleDescription(StyleFactory.eINSTANCE.createCenterLabelStyleDescription());
+ edgeStyleInit(bsd);
newChildDescriptors.add(createChildParameter(org.eclipse.sirius.diagram.description.DescriptionPackage.Literals.EDGE_MAPPING__STYLE, bsd));
+ ConditionalEdgeStyleDescription conditionalEdgeStyle = DescriptionFactory.eINSTANCE.createConditionalEdgeStyleDescription();
+ EdgeStyleDescription edgeStyle = ((EdgeMapping) object).getStyle();
+ EdgeStyleDescription newStyle;
+ // if the style of the EdgeMapping is a BracketEdgeStyle, then the style
+ // for the conditional style will be a BracketEdgeStyle, otherwise it
+ // will be a EdgeStyle
+ if (edgeStyle != null && edgeStyle.eClass() == StylePackage.eINSTANCE.getBracketEdgeStyleDescription()) {
+ newStyle = StyleFactory.eINSTANCE.createBracketEdgeStyleDescription();
+ } else {
+ newStyle = StyleFactory.eINSTANCE.createEdgeStyleDescription();
+ }
+ edgeStyleInit(newStyle);
+ conditionalEdgeStyle.setStyle(newStyle);
+ newChildDescriptors.add(createChildParameter(org.eclipse.sirius.diagram.description.DescriptionPackage.Literals.EDGE_MAPPING__CONDITIONNAL_STYLES, conditionalEdgeStyle));
+ }
+
+ /**
+ * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s
+ * describing the children that can be created under this object. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected void collectNewChildDescriptorsGen(Collection<Object> newChildDescriptors, Object object) {
+ super.collectNewChildDescriptors(newChildDescriptors, object);
+
+ newChildDescriptors.add(createChildParameter(org.eclipse.sirius.diagram.description.DescriptionPackage.Literals.EDGE_MAPPING__STYLE, StyleFactory.eINSTANCE.createEdgeStyleDescription()));
+
+ newChildDescriptors
+ .add(createChildParameter(org.eclipse.sirius.diagram.description.DescriptionPackage.Literals.EDGE_MAPPING__STYLE, StyleFactory.eINSTANCE.createBracketEdgeStyleDescription()));
+
newChildDescriptors.add(createChildParameter(org.eclipse.sirius.diagram.description.DescriptionPackage.Literals.EDGE_MAPPING__CONDITIONNAL_STYLES,
DescriptionFactory.eINSTANCE.createConditionalEdgeStyleDescription()));
}
+ /**
+ * Add a center label style and set the size computation expression of the
+ * given edge style.
+ *
+ * @param edgeStyle
+ * the edge style.
+ */
+ private void edgeStyleInit(EdgeStyleDescription edgeStyle) {
+ edgeStyle.setSizeComputationExpression("2");
+ edgeStyle.setCenterLabelStyleDescription(StyleFactory.eINSTANCE.createCenterLabelStyleDescription());
+ }
+
}
diff --git a/plugins/org.eclipse.sirius.table.ui/src-gen/org/eclipse/sirius/table/metamodel/table/description/provider/ElementColumnMappingItemProvider.java b/plugins/org.eclipse.sirius.table.ui/src-gen/org/eclipse/sirius/table/metamodel/table/description/provider/ElementColumnMappingItemProvider.java
index 6cdb5921ab..25b4f9be45 100644
--- a/plugins/org.eclipse.sirius.table.ui/src-gen/org/eclipse/sirius/table/metamodel/table/description/provider/ElementColumnMappingItemProvider.java
+++ b/plugins/org.eclipse.sirius.table.ui/src-gen/org/eclipse/sirius/table/metamodel/table/description/provider/ElementColumnMappingItemProvider.java
@@ -22,11 +22,13 @@ import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
import org.eclipse.emf.edit.provider.ViewerNotification;
import org.eclipse.sirius.business.api.query.IdentifiedElementQuery;
import org.eclipse.sirius.table.business.internal.metamodel.TableToolVariables;
+import org.eclipse.sirius.table.metamodel.table.description.BackgroundConditionalStyle;
import org.eclipse.sirius.table.metamodel.table.description.CreateColumnTool;
import org.eclipse.sirius.table.metamodel.table.description.DeleteColumnTool;
import org.eclipse.sirius.table.metamodel.table.description.DescriptionFactory;
import org.eclipse.sirius.table.metamodel.table.description.DescriptionPackage;
import org.eclipse.sirius.table.metamodel.table.description.ElementColumnMapping;
+import org.eclipse.sirius.table.metamodel.table.description.ForegroundConditionalStyle;
/**
* This is the item provider adapter for a
@@ -191,17 +193,44 @@ public class ElementColumnMappingItemProvider extends ColumnMappingItemProvider
newChildDescriptors.add(createChildParameter(DescriptionPackage.Literals.STYLE_UPDATER__DEFAULT_FOREGROUND, DescriptionFactory.eINSTANCE.createForegroundStyleDescription()));
- newChildDescriptors.add(createChildParameter(DescriptionPackage.Literals.STYLE_UPDATER__FOREGROUND_CONDITIONAL_STYLE, DescriptionFactory.eINSTANCE.createForegroundConditionalStyle()));
+ ForegroundConditionalStyle foregroundConditionalStyle = DescriptionFactory.eINSTANCE.createForegroundConditionalStyle();
+ foregroundConditionalStyle.setStyle(DescriptionFactory.eINSTANCE.createForegroundStyleDescription());
+ newChildDescriptors.add(createChildParameter(DescriptionPackage.Literals.STYLE_UPDATER__FOREGROUND_CONDITIONAL_STYLE, foregroundConditionalStyle));
newChildDescriptors.add(createChildParameter(DescriptionPackage.Literals.STYLE_UPDATER__DEFAULT_BACKGROUND, DescriptionFactory.eINSTANCE.createBackgroundStyleDescription()));
- newChildDescriptors.add(createChildParameter(DescriptionPackage.Literals.STYLE_UPDATER__BACKGROUND_CONDITIONAL_STYLE, DescriptionFactory.eINSTANCE.createBackgroundConditionalStyle()));
+ BackgroundConditionalStyle backgroundConditionalStyle = DescriptionFactory.eINSTANCE.createBackgroundConditionalStyle();
+ backgroundConditionalStyle.setStyle(DescriptionFactory.eINSTANCE.createBackgroundStyleDescription());
+ newChildDescriptors.add(createChildParameter(DescriptionPackage.Literals.STYLE_UPDATER__BACKGROUND_CONDITIONAL_STYLE, backgroundConditionalStyle));
collectCreateColumnTool(newChildDescriptors);
collectCreateDeleteColumnTool(newChildDescriptors);
}
+ /**
+ * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s
+ * describing the children that can be created under this object. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected void collectNewChildDescriptorsGen(Collection<Object> newChildDescriptors, Object object) {
+ super.collectNewChildDescriptors(newChildDescriptors, object);
+
+ newChildDescriptors.add(createChildParameter(DescriptionPackage.Literals.STYLE_UPDATER__DEFAULT_FOREGROUND, DescriptionFactory.eINSTANCE.createForegroundStyleDescription()));
+
+ newChildDescriptors.add(createChildParameter(DescriptionPackage.Literals.STYLE_UPDATER__FOREGROUND_CONDITIONAL_STYLE, DescriptionFactory.eINSTANCE.createForegroundConditionalStyle()));
+
+ newChildDescriptors.add(createChildParameter(DescriptionPackage.Literals.STYLE_UPDATER__DEFAULT_BACKGROUND, DescriptionFactory.eINSTANCE.createBackgroundStyleDescription()));
+
+ newChildDescriptors.add(createChildParameter(DescriptionPackage.Literals.STYLE_UPDATER__BACKGROUND_CONDITIONAL_STYLE, DescriptionFactory.eINSTANCE.createBackgroundConditionalStyle()));
+
+ newChildDescriptors.add(createChildParameter(DescriptionPackage.Literals.ELEMENT_COLUMN_MAPPING__CREATE, DescriptionFactory.eINSTANCE.createCreateColumnTool()));
+
+ newChildDescriptors.add(createChildParameter(DescriptionPackage.Literals.ELEMENT_COLUMN_MAPPING__DELETE, DescriptionFactory.eINSTANCE.createDeleteColumnTool()));
+ }
+
private void collectCreateColumnTool(Collection<Object> newChildDescriptors) {
CreateColumnTool createColumnTool = DescriptionFactory.eINSTANCE.createCreateColumnTool();
new TableToolVariables().doSwitch(createColumnTool);
diff --git a/plugins/org.eclipse.sirius.table.ui/src-gen/org/eclipse/sirius/table/metamodel/table/description/provider/FeatureColumnMappingItemProvider.java b/plugins/org.eclipse.sirius.table.ui/src-gen/org/eclipse/sirius/table/metamodel/table/description/provider/FeatureColumnMappingItemProvider.java
index 090db66654..2a3fc9135a 100644
--- a/plugins/org.eclipse.sirius.table.ui/src-gen/org/eclipse/sirius/table/metamodel/table/description/provider/FeatureColumnMappingItemProvider.java
+++ b/plugins/org.eclipse.sirius.table.ui/src-gen/org/eclipse/sirius/table/metamodel/table/description/provider/FeatureColumnMappingItemProvider.java
@@ -23,9 +23,11 @@ import org.eclipse.emf.edit.provider.ViewerNotification;
import org.eclipse.sirius.business.api.query.IdentifiedElementQuery;
import org.eclipse.sirius.common.tools.api.interpreter.IInterpreterSiriusVariables;
import org.eclipse.sirius.table.business.api.helper.TableHelper;
+import org.eclipse.sirius.table.metamodel.table.description.BackgroundConditionalStyle;
import org.eclipse.sirius.table.metamodel.table.description.DescriptionFactory;
import org.eclipse.sirius.table.metamodel.table.description.DescriptionPackage;
import org.eclipse.sirius.table.metamodel.table.description.FeatureColumnMapping;
+import org.eclipse.sirius.table.metamodel.table.description.ForegroundConditionalStyle;
import org.eclipse.sirius.table.metamodel.table.description.LabelEditTool;
import org.eclipse.sirius.table.metamodel.table.description.TableTool;
import org.eclipse.sirius.table.metamodel.table.description.TableVariable;
@@ -252,11 +254,15 @@ public class FeatureColumnMappingItemProvider extends ColumnMappingItemProvider
newChildDescriptors.add(createChildParameter(DescriptionPackage.Literals.STYLE_UPDATER__DEFAULT_FOREGROUND, DescriptionFactory.eINSTANCE.createForegroundStyleDescription()));
- newChildDescriptors.add(createChildParameter(DescriptionPackage.Literals.STYLE_UPDATER__FOREGROUND_CONDITIONAL_STYLE, DescriptionFactory.eINSTANCE.createForegroundConditionalStyle()));
+ ForegroundConditionalStyle foregroundConditionalStyle = DescriptionFactory.eINSTANCE.createForegroundConditionalStyle();
+ foregroundConditionalStyle.setStyle(DescriptionFactory.eINSTANCE.createForegroundStyleDescription());
+ newChildDescriptors.add(createChildParameter(DescriptionPackage.Literals.STYLE_UPDATER__FOREGROUND_CONDITIONAL_STYLE, foregroundConditionalStyle));
newChildDescriptors.add(createChildParameter(DescriptionPackage.Literals.STYLE_UPDATER__DEFAULT_BACKGROUND, DescriptionFactory.eINSTANCE.createBackgroundStyleDescription()));
- newChildDescriptors.add(createChildParameter(DescriptionPackage.Literals.STYLE_UPDATER__BACKGROUND_CONDITIONAL_STYLE, DescriptionFactory.eINSTANCE.createBackgroundConditionalStyle()));
+ BackgroundConditionalStyle backgroundConditionalStyle = DescriptionFactory.eINSTANCE.createBackgroundConditionalStyle();
+ backgroundConditionalStyle.setStyle(DescriptionFactory.eINSTANCE.createBackgroundStyleDescription());
+ newChildDescriptors.add(createChildParameter(DescriptionPackage.Literals.STYLE_UPDATER__BACKGROUND_CONDITIONAL_STYLE, backgroundConditionalStyle));
}
private void addVariableDescriptor(final TableTool tool, final String name, final String documentation) {
diff --git a/plugins/org.eclipse.sirius.table.ui/src-gen/org/eclipse/sirius/table/metamodel/table/description/provider/IntersectionMappingItemProvider.java b/plugins/org.eclipse.sirius.table.ui/src-gen/org/eclipse/sirius/table/metamodel/table/description/provider/IntersectionMappingItemProvider.java
index c0e536cb21..adb478415a 100644
--- a/plugins/org.eclipse.sirius.table.ui/src-gen/org/eclipse/sirius/table/metamodel/table/description/provider/IntersectionMappingItemProvider.java
+++ b/plugins/org.eclipse.sirius.table.ui/src-gen/org/eclipse/sirius/table/metamodel/table/description/provider/IntersectionMappingItemProvider.java
@@ -24,9 +24,11 @@ import org.eclipse.sirius.business.api.query.IdentifiedElementQuery;
import org.eclipse.sirius.common.tools.api.interpreter.IInterpreterSiriusVariables;
import org.eclipse.sirius.table.business.api.helper.TableHelper;
import org.eclipse.sirius.table.business.internal.metamodel.TableToolVariables;
+import org.eclipse.sirius.table.metamodel.table.description.BackgroundConditionalStyle;
import org.eclipse.sirius.table.metamodel.table.description.CreateCellTool;
import org.eclipse.sirius.table.metamodel.table.description.DescriptionFactory;
import org.eclipse.sirius.table.metamodel.table.description.DescriptionPackage;
+import org.eclipse.sirius.table.metamodel.table.description.ForegroundConditionalStyle;
import org.eclipse.sirius.table.metamodel.table.description.IntersectionMapping;
import org.eclipse.sirius.table.metamodel.table.description.LabelEditTool;
import org.eclipse.sirius.table.metamodel.table.description.TableTool;
@@ -362,11 +364,15 @@ public class IntersectionMappingItemProvider extends TableMappingItemProvider {
newChildDescriptors.add(createChildParameter(DescriptionPackage.Literals.STYLE_UPDATER__DEFAULT_FOREGROUND, DescriptionFactory.eINSTANCE.createForegroundStyleDescription()));
- newChildDescriptors.add(createChildParameter(DescriptionPackage.Literals.STYLE_UPDATER__FOREGROUND_CONDITIONAL_STYLE, DescriptionFactory.eINSTANCE.createForegroundConditionalStyle()));
+ ForegroundConditionalStyle foregroundConditionalStyle = DescriptionFactory.eINSTANCE.createForegroundConditionalStyle();
+ foregroundConditionalStyle.setStyle(DescriptionFactory.eINSTANCE.createForegroundStyleDescription());
+ newChildDescriptors.add(createChildParameter(DescriptionPackage.Literals.STYLE_UPDATER__FOREGROUND_CONDITIONAL_STYLE, foregroundConditionalStyle));
newChildDescriptors.add(createChildParameter(DescriptionPackage.Literals.STYLE_UPDATER__DEFAULT_BACKGROUND, DescriptionFactory.eINSTANCE.createBackgroundStyleDescription()));
- newChildDescriptors.add(createChildParameter(DescriptionPackage.Literals.STYLE_UPDATER__BACKGROUND_CONDITIONAL_STYLE, DescriptionFactory.eINSTANCE.createBackgroundConditionalStyle()));
+ BackgroundConditionalStyle backgroundConditionalStyle = DescriptionFactory.eINSTANCE.createBackgroundConditionalStyle();
+ backgroundConditionalStyle.setStyle(DescriptionFactory.eINSTANCE.createBackgroundStyleDescription());
+ newChildDescriptors.add(createChildParameter(DescriptionPackage.Literals.STYLE_UPDATER__BACKGROUND_CONDITIONAL_STYLE, backgroundConditionalStyle));
collectCreateCellTool(newChildDescriptors);
diff --git a/plugins/org.eclipse.sirius.table.ui/src-gen/org/eclipse/sirius/table/metamodel/table/description/provider/LineMappingItemProvider.java b/plugins/org.eclipse.sirius.table.ui/src-gen/org/eclipse/sirius/table/metamodel/table/description/provider/LineMappingItemProvider.java
index 1f5d413e39..5c260ccebd 100644
--- a/plugins/org.eclipse.sirius.table.ui/src-gen/org/eclipse/sirius/table/metamodel/table/description/provider/LineMappingItemProvider.java
+++ b/plugins/org.eclipse.sirius.table.ui/src-gen/org/eclipse/sirius/table/metamodel/table/description/provider/LineMappingItemProvider.java
@@ -22,10 +22,12 @@ import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
import org.eclipse.emf.edit.provider.ViewerNotification;
import org.eclipse.sirius.business.api.query.IdentifiedElementQuery;
import org.eclipse.sirius.table.business.internal.metamodel.TableToolVariables;
+import org.eclipse.sirius.table.metamodel.table.description.BackgroundConditionalStyle;
import org.eclipse.sirius.table.metamodel.table.description.CreateLineTool;
import org.eclipse.sirius.table.metamodel.table.description.DeleteLineTool;
import org.eclipse.sirius.table.metamodel.table.description.DescriptionFactory;
import org.eclipse.sirius.table.metamodel.table.description.DescriptionPackage;
+import org.eclipse.sirius.table.metamodel.table.description.ForegroundConditionalStyle;
import org.eclipse.sirius.table.metamodel.table.description.LineMapping;
/**
@@ -233,11 +235,15 @@ public class LineMappingItemProvider extends TableMappingItemProvider {
newChildDescriptors.add(createChildParameter(DescriptionPackage.Literals.STYLE_UPDATER__DEFAULT_FOREGROUND, DescriptionFactory.eINSTANCE.createForegroundStyleDescription()));
- newChildDescriptors.add(createChildParameter(DescriptionPackage.Literals.STYLE_UPDATER__FOREGROUND_CONDITIONAL_STYLE, DescriptionFactory.eINSTANCE.createForegroundConditionalStyle()));
+ ForegroundConditionalStyle foregroundConditionalStyle = DescriptionFactory.eINSTANCE.createForegroundConditionalStyle();
+ foregroundConditionalStyle.setStyle(DescriptionFactory.eINSTANCE.createForegroundStyleDescription());
+ newChildDescriptors.add(createChildParameter(DescriptionPackage.Literals.STYLE_UPDATER__FOREGROUND_CONDITIONAL_STYLE, foregroundConditionalStyle));
newChildDescriptors.add(createChildParameter(DescriptionPackage.Literals.STYLE_UPDATER__DEFAULT_BACKGROUND, DescriptionFactory.eINSTANCE.createBackgroundStyleDescription()));
- newChildDescriptors.add(createChildParameter(DescriptionPackage.Literals.STYLE_UPDATER__BACKGROUND_CONDITIONAL_STYLE, DescriptionFactory.eINSTANCE.createBackgroundConditionalStyle()));
+ BackgroundConditionalStyle backgroundConditionalStyle = DescriptionFactory.eINSTANCE.createBackgroundConditionalStyle();
+ backgroundConditionalStyle.setStyle(DescriptionFactory.eINSTANCE.createBackgroundStyleDescription());
+ newChildDescriptors.add(createChildParameter(DescriptionPackage.Literals.STYLE_UPDATER__BACKGROUND_CONDITIONAL_STYLE, backgroundConditionalStyle));
newChildDescriptors.add(createChildParameter(DescriptionPackage.Literals.LINE_MAPPING__OWNED_SUB_LINES, DescriptionFactory.eINSTANCE.createLineMapping()));
@@ -246,6 +252,31 @@ public class LineMappingItemProvider extends TableMappingItemProvider {
collectCreateDeleteLineTool(newChildDescriptors);
}
+ /**
+ * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s
+ * describing the children that can be created under this object. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected void collectNewChildDescriptorsGen(Collection<Object> newChildDescriptors, Object object) {
+ super.collectNewChildDescriptors(newChildDescriptors, object);
+
+ newChildDescriptors.add(createChildParameter(DescriptionPackage.Literals.STYLE_UPDATER__DEFAULT_FOREGROUND, DescriptionFactory.eINSTANCE.createForegroundStyleDescription()));
+
+ newChildDescriptors.add(createChildParameter(DescriptionPackage.Literals.STYLE_UPDATER__FOREGROUND_CONDITIONAL_STYLE, DescriptionFactory.eINSTANCE.createForegroundConditionalStyle()));
+
+ newChildDescriptors.add(createChildParameter(DescriptionPackage.Literals.STYLE_UPDATER__DEFAULT_BACKGROUND, DescriptionFactory.eINSTANCE.createBackgroundStyleDescription()));
+
+ newChildDescriptors.add(createChildParameter(DescriptionPackage.Literals.STYLE_UPDATER__BACKGROUND_CONDITIONAL_STYLE, DescriptionFactory.eINSTANCE.createBackgroundConditionalStyle()));
+
+ newChildDescriptors.add(createChildParameter(DescriptionPackage.Literals.LINE_MAPPING__OWNED_SUB_LINES, DescriptionFactory.eINSTANCE.createLineMapping()));
+
+ newChildDescriptors.add(createChildParameter(DescriptionPackage.Literals.LINE_MAPPING__CREATE, DescriptionFactory.eINSTANCE.createCreateLineTool()));
+
+ newChildDescriptors.add(createChildParameter(DescriptionPackage.Literals.LINE_MAPPING__DELETE, DescriptionFactory.eINSTANCE.createDeleteLineTool()));
+ }
+
private void collectCreateLineTool(Collection<Object> newChildDescriptors) {
CreateLineTool createLineTool = DescriptionFactory.eINSTANCE.createCreateLineTool();
new TableToolVariables().doSwitch(createLineTool);
diff --git a/plugins/org.eclipse.sirius.tests.swtbot/data/unit/editor/vsm/autoCreateMandatoryElements.odesign b/plugins/org.eclipse.sirius.tests.swtbot/data/unit/editor/vsm/autoCreateMandatoryElements.odesign
new file mode 100644
index 0000000000..8228c3e6e7
--- /dev/null
+++ b/plugins/org.eclipse.sirius.tests.swtbot/data/unit/editor/vsm/autoCreateMandatoryElements.odesign
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<description:Group xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:description="http://www.eclipse.org/sirius/description/1.1.0" xmlns:description_1="http://www.eclipse.org/sirius/diagram/description/1.1.0" xmlns:description_2="http://www.eclipse.org/sirius/tree/description/1.0.0" xmlns:description_3="http://www.eclipse.org/sirius/table/description/1.1.0" xmlns:style="http://www.eclipse.org/sirius/diagram/description/style/1.1.0" name="My" version="10.0.0.201411061000">
+ <ownedViewpoints name="V">
+ <ownedRepresentations xsi:type="description_1:DiagramDescription" name="Diagram">
+ <defaultLayer name="Default">
+ <edgeMappings name="ElementEdge" useDomainElement="true">
+ <style sizeComputationExpression="2">
+ <strokeColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='gray']"/>
+ <centerLabelStyleDescription>
+ <labelColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/>
+ </centerLabelStyleDescription>
+ </style>
+ </edgeMappings>
+ <edgeMappings name="RelationEdge">
+ <style xsi:type="style:BracketEdgeStyleDescription" sizeComputationExpression="2">
+ <strokeColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='gray']"/>
+ <centerLabelStyleDescription>
+ <labelColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/>
+ </centerLabelStyleDescription>
+ </style>
+ </edgeMappings>
+ </defaultLayer>
+ </ownedRepresentations>
+ <ownedRepresentations xsi:type="description_1:DiagramImportDescription" name="DiagramImport"/>
+ <ownedRepresentations xsi:type="description_2:TreeDescription" name="Tree">
+ <subItemMappings name="TreeItem" semanticCandidatesExpression="feature:eAllContents">
+ <defaultStyle>
+ <labelColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/>
+ <backgroundColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='white']"/>
+ </defaultStyle>
+ </subItemMappings>
+ </ownedRepresentations>
+ <ownedRepresentations xsi:type="description_3:EditionTableDescription" name="EditionTable">
+ <ownedLineMappings name="Line"/>
+ <ownedColumnMappings name="FeatureColumn"/>
+ </ownedRepresentations>
+ <ownedRepresentations xsi:type="description_3:CrossTableDescription" name="CrossTable">
+ <ownedColumnMappings name="ElementColumn"/>
+ <intersection name="Intersection" labelExpression="X"/>
+ </ownedRepresentations>
+ <ownedRepresentationExtensions xsi:type="description_1:DiagramExtensionDescription" name="DiagramExtension"/>
+ </ownedViewpoints>
+</description:Group>
diff --git a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/editor/vsm/CreateMandatoryElementsTest.java b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/editor/vsm/CreateMandatoryElementsTest.java
new file mode 100644
index 0000000000..57b385b56a
--- /dev/null
+++ b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/editor/vsm/CreateMandatoryElementsTest.java
@@ -0,0 +1,100 @@
+/*******************************************************************************
+ * Copyright (c) 2015 Obeo.
+ * 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:
+ * Obeo - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.sirius.tests.swtbot.editor.vsm;
+
+import org.eclipse.sirius.tests.swtbot.Activator;
+import org.eclipse.sirius.tests.swtbot.support.api.AbstractSiriusSwtBotGefTestCase;
+import org.eclipse.sirius.tests.swtbot.support.api.editor.SWTBotVSMEditor;
+import org.eclipse.sirius.tests.swtbot.support.utils.SWTBotUtils;
+import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
+
+/**
+ * Test the automatic creation of mandatory elements when creation their parent.
+ *
+ * @author bgrouhan
+ */
+public class CreateMandatoryElementsTest extends AbstractSiriusSwtBotGefTestCase {
+
+ private static final String VSM = "autoCreateMandatoryElements.odesign";
+
+ private static final String VIEWPOINT = "V";
+
+ private static final String ODESIGN = "platform:/resource/DesignerTestProject/" + VSM;
+
+ private static final String DATA_UNIT_DIR = "data/unit/editor/vsm/";
+
+ @Override
+ protected void onSetUpBeforeClosingWelcomePage() throws Exception {
+ copyFileToTestProject(Activator.PLUGIN_ID, DATA_UNIT_DIR, VSM);
+ }
+
+ /**
+ * Test that Mandatory elements are directly created as children when the
+ * parent is created.
+ */
+ public void testCreationMandatoryElements() {
+ // open VSM
+ SWTBotVSMEditor odesignEditor = openViewpointSpecificationModel(VSM);
+ // expands the tree
+ SWTBotTreeItem tree = odesignEditor.bot().tree().expandNode(ODESIGN).expandNode("My").expandNode(VIEWPOINT);
+
+ // test creation of a default layer
+ createElement(tree.select(), "Diagram Description", "Default");
+ createElement(tree.select(), "Sequence Diagram Description", "Default");
+
+ // test creation of a concern
+ createElement(tree.expandNode("Diagram").select(), "Concerns", "Concern");
+ createElement(tree.expandNode("Diagram Import DiagramImport").select(), "Concerns", "Concern");
+ createElement(tree.expandNode("Diagram Extension DiagramExtension").select(), "Concerns", "Concern");
+
+ // test creation of a tree item style
+ createElement(tree.expandNode("Tree").expandNode("TreeItem").select(), "Conditional Style", "feature:name");
+
+ // test creation of a foreground style
+ createElement(tree.expandNode("EditionTable").expandNode("Line").select(), "Conditional Foreground", "Foreground 12");
+ createElement(tree.expandNode("EditionTable").expandNode("FeatureColumn").select(), "Conditional Foreground", "Foreground 12");
+ createElement(tree.expandNode("CrossTable").expandNode("ElementColumn").select(), "Conditional Foreground", "Foreground 12");
+ createElement(tree.expandNode("CrossTable").expandNode("Intersection").select(), "Conditional Foreground", "Foreground 12");
+
+ // test creation of a background style
+ createElement(tree.expandNode("EditionTable").expandNode("Line").select(), "Conditional Background", "Background");
+ createElement(tree.expandNode("EditionTable").expandNode("FeatureColumn").select(), "Conditional Background", "Background");
+ createElement(tree.expandNode("CrossTable").expandNode("ElementColumn").select(), "Conditional Background", "Background");
+ createElement(tree.expandNode("CrossTable").expandNode("Intersection").select(), "Conditional Background", "Background");
+
+ // test creation of an edge style (not bracket)
+ createElement(tree.expandNode("Diagram").expandNode("Default").expandNode("ElementEdge").select(), "Conditional Style", "Edge Style solid");
+ // test creation of a bracket edge style
+ createElement(tree.expandNode("Diagram").expandNode("Default").expandNode("RelationEdge").select(), "Conditional Style", "Bracket Edge Style solid");
+
+ }
+
+ /**
+ * Method to create a sub-element of a selected SWTBotTreeItem given the
+ * element name and test if the created element has the expected child.
+ *
+ * @param treeItem
+ * the starting SWTBotTreeItem.
+ * @param elementName
+ * the name of the element to create.
+ * @param childName
+ * the name of the child element that must have been created.
+ */
+ private void createElement(SWTBotTreeItem treeItem, String elementName, String childName) {
+ SWTBotUtils.clickContextMenu(treeItem, elementName);
+ try {
+ treeItem.expandNode(elementName).expandNode(childName);
+ } catch (WidgetNotFoundException e) {
+ assertTrue("The element '" + childName + "' (or its parent, '" + elementName + "') has not been created", false);
+ }
+ }
+}
diff --git a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/suite/AllTestSuite.java b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/suite/AllTestSuite.java
index ff64c4ecab..8d4004c00b 100644
--- a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/suite/AllTestSuite.java
+++ b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/suite/AllTestSuite.java
@@ -30,6 +30,7 @@ import org.eclipse.sirius.tests.swtbot.crossTable.CrossTableIntersectionTest;
import org.eclipse.sirius.tests.swtbot.editor.vsm.BorderSizeComputationExpressionTest;
import org.eclipse.sirius.tests.swtbot.editor.vsm.CompletionProposalInVSMTest;
import org.eclipse.sirius.tests.swtbot.editor.vsm.ContentAssistTest;
+import org.eclipse.sirius.tests.swtbot.editor.vsm.CreateMandatoryElementsTest;
import org.eclipse.sirius.tests.swtbot.editor.vsm.CustomizationPropertySectionsTests;
import org.eclipse.sirius.tests.swtbot.editor.vsm.MetamodelPropertyTabTests;
import org.eclipse.sirius.tests.swtbot.editor.vsm.MigrationOnVsmEditorReloadTest;
@@ -176,6 +177,7 @@ public class AllTestSuite extends TestCase {
suite.addTestSuite(GenericClipboardSupportTest.class);
suite.addTestSuite(MultiSessionCopyPasteTest.class);
suite.addTestSuite(CloseWithoutSavingTest.class);
+ suite.addTestSuite(CreateMandatoryElementsTest.class);
}
/**
diff --git a/plugins/org.eclipse.sirius.tree.ui/src-gen/org/eclipse/sirius/tree/description/provider/TreeItemMappingItemProvider.java b/plugins/org.eclipse.sirius.tree.ui/src-gen/org/eclipse/sirius/tree/description/provider/TreeItemMappingItemProvider.java
index 68e560ee45..0dbeb330ee 100644
--- a/plugins/org.eclipse.sirius.tree.ui/src-gen/org/eclipse/sirius/tree/description/provider/TreeItemMappingItemProvider.java
+++ b/plugins/org.eclipse.sirius.tree.ui/src-gen/org/eclipse/sirius/tree/description/provider/TreeItemMappingItemProvider.java
@@ -22,6 +22,7 @@ import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
import org.eclipse.emf.edit.provider.ViewerNotification;
import org.eclipse.sirius.business.api.query.IdentifiedElementQuery;
import org.eclipse.sirius.tree.business.internal.metamodel.TreeToolVariables;
+import org.eclipse.sirius.tree.description.ConditionalTreeItemStyleDescription;
import org.eclipse.sirius.tree.description.DescriptionFactory;
import org.eclipse.sirius.tree.description.DescriptionPackage;
import org.eclipse.sirius.tree.description.TreeItemContainerDropTool;
@@ -244,7 +245,9 @@ public class TreeItemMappingItemProvider extends TreeMappingItemProvider {
newChildDescriptors.add(createChildParameter(DescriptionPackage.Literals.STYLE_UPDATER__DEFAULT_STYLE, DescriptionFactory.eINSTANCE.createTreeItemStyleDescription()));
- newChildDescriptors.add(createChildParameter(DescriptionPackage.Literals.STYLE_UPDATER__CONDITIONAL_STYLES, DescriptionFactory.eINSTANCE.createConditionalTreeItemStyleDescription()));
+ ConditionalTreeItemStyleDescription conditionalTreeItemStyle = DescriptionFactory.eINSTANCE.createConditionalTreeItemStyleDescription();
+ conditionalTreeItemStyle.setStyle(DescriptionFactory.eINSTANCE.createTreeItemStyleDescription());
+ newChildDescriptors.add(createChildParameter(DescriptionPackage.Literals.STYLE_UPDATER__CONDITIONAL_STYLES, conditionalTreeItemStyle));
TreeItemMapping newItemMapping = DescriptionFactory.eINSTANCE.createTreeItemMapping();
newItemMapping.setDefaultStyle(DescriptionFactory.eINSTANCE.createTreeItemStyleDescription());

Back to the top