[510126] Consider extra mappings for Node&ContainerCreation Tools
Bug: 510126
Change-Id: I1018876eb046a4ea28b8adb87e45a3088d08d09e
Signed-off-by: Cedric Brun <cedric.brun@obeo.fr>
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 1729c30..4b39759 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
@@ -254,6 +254,12 @@
mappings.addAll(((ContainerCreationDescription) target).getContainerMappings());
}
collectPotentialContainerTypes(possibleContainerTypes, possibleContainerViewTypes, mappings);
+ if (target instanceof ContainerCreationDescription) {
+ addExtraMappings(possibleContainerTypes, ((ContainerCreationDescription) target).getExtraMappings());
+ }
+ if (target instanceof NodeCreationDescription) {
+ addExtraMappings(possibleContainerTypes, ((NodeCreationDescription) target).getExtraMappings());
+ }
availableVariables.put(IInterpreterSiriusVariables.CONTAINER, VariableType.fromStrings(possibleContainerTypes));
availableVariables.put(IInterpreterSiriusVariables.CONTAINER_VIEW, VariableType.fromStrings(possibleContainerViewTypes));
}
@@ -276,6 +282,15 @@
}
+ private void addExtraMappings(Collection<String> possibleContainerTypes, Collection<AbstractNodeMapping> extra) {
+ for (AbstractNodeMapping np : extra) {
+ String domainClass = np.getDomainClass();
+ if (!StringUtil.isEmpty(domainClass)) {
+ possibleContainerTypes.add(domainClass);
+ }
+ }
+ }
+
private void typeVariablesForDiagramCreationRepresentation(RepresentationCreationDescription desc, Map<String, VariableType> availableVariables) {
Collection<String> possibleSemanticTypes = Sets.newLinkedHashSet();
Collection<String> possibleViewTypes = Sets.newLinkedHashSet();