Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjmallet2017-07-19 09:22:17 +0000
committerLaurent Fasani2017-07-24 12:24:50 +0000
commit7d83ced3b2347d2e888e3a4898e15aab66cd7d3f (patch)
tree1281be6bcd797192f168c6ab277f08583212f76e
parent758147ad8d5b123304b7e90fc2295c79fde165f6 (diff)
downloadorg.eclipse.sirius-7d83ced3b2347d2e888e3a4898e15aab66cd7d3f.tar.gz
org.eclipse.sirius-7d83ced3b2347d2e888e3a4898e15aab66cd7d3f.tar.xz
org.eclipse.sirius-7d83ced3b2347d2e888e3a4898e15aab66cd7d3f.zip
[508556] Type source/target/xxView variables in
ReconnectEdgeDescription.precondition Add the code and supporting test case so that the source/target/xxView variables which is available in ReconnectEdgeDescription have a more specific type based on the mappings which are referenced by the tool. Bug : 508556 Change-Id: Ibb0e30a6595e9a19a8a2ad11aed11de07664421c Signed-off-by: jmallet <jessy.mallet@obeo.fr>
-rw-r--r--plugins/org.eclipse.sirius.diagram/src-core/org/eclipse/sirius/diagram/business/internal/dialect/description/DiagramInterpretedExpressionQuery.java30
-rw-r--r--plugins/org.eclipse.sirius.tests.junit/data/unit/vsm/validateVariableTypes.odesign2
2 files changed, 28 insertions, 4 deletions
diff --git a/plugins/org.eclipse.sirius.diagram/src-core/org/eclipse/sirius/diagram/business/internal/dialect/description/DiagramInterpretedExpressionQuery.java b/plugins/org.eclipse.sirius.diagram/src-core/org/eclipse/sirius/diagram/business/internal/dialect/description/DiagramInterpretedExpressionQuery.java
index 31554b4c0b..615344ea06 100644
--- a/plugins/org.eclipse.sirius.diagram/src-core/org/eclipse/sirius/diagram/business/internal/dialect/description/DiagramInterpretedExpressionQuery.java
+++ b/plugins/org.eclipse.sirius.diagram/src-core/org/eclipse/sirius/diagram/business/internal/dialect/description/DiagramInterpretedExpressionQuery.java
@@ -16,6 +16,7 @@ import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
+import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.EStructuralFeature;
@@ -265,9 +266,7 @@ public class DiagramInterpretedExpressionQuery extends AbstractInterpretedExpres
refineVariableType(availableVariables, SELF, possibleSemanticTypes);
}
if (target instanceof ReconnectEdgeDescription && this.feature == ToolPackage.Literals.ABSTRACT_TOOL_DESCRIPTION__PRECONDITION) {
- Collection<String> possibleContainerTypes = Sets.newLinkedHashSet();
- collectPotentialContainerTypes(possibleContainerTypes, Sets.<String> newLinkedHashSet(), ((ReconnectEdgeDescription) target).getMappings());
- availableVariables.put(IInterpreterSiriusVariables.CONTAINER, VariableType.fromStrings(possibleContainerTypes));
+ collectReconnectEdgeDescriptionVariableTypes(availableVariables);
}
if (target instanceof RepresentationCreationDescription) {
typeVariablesForDiagramCreationRepresentation((RepresentationCreationDescription) target, availableVariables);
@@ -631,6 +630,31 @@ public class DiagramInterpretedExpressionQuery extends AbstractInterpretedExpres
}
}
+ private void collectReconnectEdgeDescriptionVariableTypes(Map<String, VariableType> availableVariables) {
+ Collection<String> possibleContainerTypes = Sets.newLinkedHashSet();
+ EList<EdgeMapping> mappings = ((ReconnectEdgeDescription) target).getMappings();
+ collectPotentialContainerTypes(possibleContainerTypes, Sets.<String> newLinkedHashSet(), mappings);
+ availableVariables.put(IInterpreterSiriusVariables.CONTAINER, VariableType.fromStrings(possibleContainerTypes));
+
+ Set<String> sourceSemanticType = Sets.newLinkedHashSet();
+ Set<String> sourceViewType = Sets.newLinkedHashSet();
+ Set<String> targetSemanticType = Sets.newLinkedHashSet();
+ Set<String> targetViewType = Sets.newLinkedHashSet();
+ for (EdgeMapping edgeMapping : mappings) {
+ for (DiagramElementMapping m : edgeMapping.getSourceMapping()) {
+ collectTypes(sourceSemanticType, sourceViewType, m);
+ }
+ for (DiagramElementMapping m : edgeMapping.getTargetMapping()) {
+ collectTypes(targetSemanticType, targetViewType, m);
+ }
+ }
+ availableVariables.put(IInterpreterSiriusVariables.SOURCE, VariableType.fromStrings(sourceSemanticType));
+ availableVariables.put(IInterpreterSiriusVariables.SOURCE_VIEW, VariableType.fromStrings(sourceViewType));
+ availableVariables.put(IInterpreterSiriusVariables.TARGET, VariableType.fromStrings(targetSemanticType));
+ availableVariables.put(IInterpreterSiriusVariables.TARGET_VIEW, VariableType.fromStrings(targetViewType));
+ availableVariables.put(IInterpreterSiriusVariables.DIAGRAM, VariableType.fromString(DIAGRAM_D_SEMANTIC_DIAGRAM));
+ }
+
/**
* An {@link IInterpretedExpressionTargetSwitch} that delegates to the defaultSwitch or the diagram specific switch,
* according to the package of the considered element.
diff --git a/plugins/org.eclipse.sirius.tests.junit/data/unit/vsm/validateVariableTypes.odesign b/plugins/org.eclipse.sirius.tests.junit/data/unit/vsm/validateVariableTypes.odesign
index eff50a7d74..68d70541ad 100644
--- a/plugins/org.eclipse.sirius.tests.junit/data/unit/vsm/validateVariableTypes.odesign
+++ b/plugins/org.eclipse.sirius.tests.junit/data/unit/vsm/validateVariableTypes.odesign
@@ -519,7 +519,7 @@
</firstModelOperations>
</initialOperation>
</ownedTools>
- <ownedTools xsi:type="tool_1:ReconnectEdgeDescription" name="Reconnect participantnode to interaction node" precondition="aql:container.ownedInteractions->size() > 0" reconnectionKind="RECONNECT_BOTH">
+ <ownedTools xsi:type="tool_1:ReconnectEdgeDescription" name="Reconnect participantnode to interaction node" precondition="aql:container.ownedInteractions->size() > 0 and source.type &lt;> null and target.messages->size() > 0 and diagram&lt;>null and sourceView &lt;>null and targetView&lt;>null " reconnectionKind="RECONNECT_BOTH">
<source name="source"/>
<target name="target"/>
<sourceView name="sourceView"/>

Back to the top