Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/editor/VisualIDRegistry.xtend')
-rw-r--r--plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/editor/VisualIDRegistry.xtend332
1 files changed, 176 insertions, 156 deletions
diff --git a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/editor/VisualIDRegistry.xtend b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/editor/VisualIDRegistry.xtend
index 73991678caf..0ac117d246d 100644
--- a/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/editor/VisualIDRegistry.xtend
+++ b/plugins/toolsmiths/gmf-tooling/org.eclipse.papyrus.gmf.codegen.xtend/xtend/xpt/editor/VisualIDRegistry.xtend
@@ -1,17 +1,18 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2020 Borland Software Corporation, CEA LIST, Artal and others
+/*****************************************************************************
+ * Copyright (c) 2007, 2010, 2013, 2021 Borland Software Corporation, CEA LIST, Artal and others
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
* SPDX-License-Identifier: EPL-2.0
*
- * Contributors:
- * Alexander Shatalin (Borland) - initial API and implementation
- * Michael Golubev (Montages) - #372479, #386838
- * Aurelien Didier (ARTAL) - aurelien.didier51@gmail.com - Bug 569174
+ * Contributors:
+ * Alexander Shatalin (Borland) - initial API and implementation
+ * Michael Golubev (Montages) - #372479, #386838
+ * Etienne Allogo (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : 1.4 Merge papyrus extension templates into codegen.xtend
+ * Etienne Allogo (ARTAL) - etienne.allogo@artal.fr - Bug 569174 : L1.2 clean up
*****************************************************************************/
package xpt.editor
@@ -36,7 +37,6 @@ import org.eclipse.papyrus.gmf.codegen.gmfgen.GenExpressionInterpreter
import xpt.diagram.updater.Utils_qvto
import xpt.CodeStyle
import xpt.diagram.editpolicies.LinkUtils_qvto
-import plugin.Activator
//XXX: [MG] decide what to do with @MetaDef methods
@com.google.inject.Singleton class VisualIDRegistry {
@@ -44,12 +44,12 @@ import plugin.Activator
@Inject extension Common_qvto;
@Inject extension Utils_qvto;
@Inject extension LinkUtils_qvto;
-
- @Inject Activator xptActivator
+ @Inject extension MetaModel;
+
@Inject CodeStyle xptCodeStyle;
@Inject MetaModel xptMetaModel;
@Inject xpt.expressions.getExpression xptGetExpression;
-
+
@MetaDef def getVisualIdMethodName(GenDiagram xptSelf) '''getVisualID'''
@MetaDef def getModelIDMethodName(GenDiagram xptSelf) '''getModelID'''
@@ -82,59 +82,58 @@ import plugin.Activator
@MetaDef def runtimeTypedInstanceName(GenDiagram it) '''TYPED_INSTANCE'''
@MetaDef def runtimeTypedInstanceCall(GenDiagram it) '''«qualifiedClassName(it)».«runtimeTypedInstanceName(it)»'''
-
+
@MetaDef def getDiagramVisualIDMethodName(GenDiagram it) '''getDiagramVisualID'''
-
+
@MetaDef def getDiagramVisualIDMethodCall(GenDiagram it) '''«qualifiedClassName(it)».«getDiagramVisualIDMethodName(it)»'''
-
+
@MetaDef def getNodeVisualIDMethodName(GenDiagram it) '''getNodeVisualID'''
@MetaDef def getNodeVisualIDMethodCall(GenDiagram it) '''«qualifiedClassName(it)».«getNodeVisualIDMethodName(it)»'''
-
+
@MetaDef def canCreateNodeMethodName(GenDiagram it) '''canCreateNode'''
-
+
@MetaDef def canCreateNodeMethodCall(GenDiagram it) '''«qualifiedClassName(it)».«canCreateNodeMethodName(it)»'''
@MetaDef def getLinkWithClassVisualIDMethodCall(GenDiagram it) '''«qualifiedClassName(it)».«getLinkWithClassVisualIDMethodName(it)»'''
-
+
@MetaDef def getLinkWithClassVisualIDMethodName(GenDiagram it) '''getLinkWithClassVisualID'''
-
- @MetaDef def domainElementConstraintMethodName(GenCommonBase it) '''is«getUniqueIdentifier()»'''
-
+
+ @MetaDef def domainElementConstraintMethodName(GenCommonBase it) '''is«stringUniqueIdentifier()»'''
+
@MetaDef def checkNodeVisualIDMethodName(GenDiagram it) '''checkNodeVisualID'''
-
+
@MetaDef def checkNodeVisualIDMethodCall(GenDiagram it) '''«qualifiedClassName(it)».«checkNodeVisualIDMethodName(it)»'''
-
+
@MetaDef def isCompartmentVisualIDMethodName(GenDiagram it) '''isCompartmentVisualID'''
@MetaDef def isCompartmentVisualIDMethodCall(GenDiagram it) '''«qualifiedClassName(it)».«isCompartmentVisualIDMethodName(it)»'''
-
+
@MetaDef def isSemanticLeafVisualIDMethodName(GenDiagram it) '''isSemanticLeafVisualID'''
-
+
@MetaDef def isSemanticLeafVisualIDMethodCall(GenDiagram it) '''«qualifiedClassName(it)».«isSemanticLeafVisualIDMethodName(it)»'''
-
/**
* [MG]: this set of def dispatch'es had been moved from xpt.editor.Utils.qvto as local for VisualIDRegistry
*/
def dispatch Iterable<GenCommonBase> getEssentialVisualChildren(GenCommonBase it) {
return <GenCommonBase>newLinkedList()
}
-
+
/**
* [MG]: this set of def dispatch'es had been moved from xpt.editor.Utils.qvto as local for VisualIDRegistry
*/
def dispatch Iterable<GenCommonBase> getEssentialVisualChildren(GenLink it) {
return it.labels.filter(typeof(GenCommonBase))
}
-
+
/**
* [MG]: this set of def dispatch'es had been moved from xpt.editor.Utils.qvto as local for VisualIDRegistry
*/
def dispatch Iterable<GenCommonBase> getEssentialVisualChildren(GenContainerBase it) {
return it.containedNodes.filter(typeof(GenCommonBase))
}
-
+
/**
* [MG]: this set of def dispatch'es had been moved from xpt.editor.Utils.qvto as local for VisualIDRegistry
*/
@@ -145,19 +144,19 @@ import plugin.Activator
result.addAll(it.containedNodes)
return result
}
-
+
def Iterable<GenNode> getContainedSemanticNodes(GenContainerBase container) {
- return container.containedNodes.filter[node | null != node.modelFacet]
+ return container.containedNodes.filter[node | null !== node.modelFacet]
}
-
+
def className(GenDiagram it) '''«visualIDRegistryClassName»'''
def packageName(GenDiagram it) '''«it.editorGen.editor.packageName»'''
def qualifiedClassName(GenDiagram it) '''«packageName(it)».«className(it)»'''
-
+
def fullPath(GenDiagram it) '''«qualifiedClassName(it)»'''
-
+
def VisualIDRegistry(GenDiagram it) '''
«copyright(getDiagram().editorGen)»
package «packageName(it)»;
@@ -165,52 +164,53 @@ import plugin.Activator
«generatedClassComment(
'This registry is used to determine which type of visual object should be\n' +
'created for the corresponding Diagram, Node, ChildNode or Link represented\n' +
- 'by a domain model object.\n'
+ 'by a domain model object.'
public class «className(it)» {
«attributes(it)»
-
+
«getViewVisualID(it)»
-
+
«getModelID(it)»
-
+
«getVisualID(it)»
-
+
«getType(it)»
-
+
«getDiagramVisualID(it)»
-
+
«getNodeVisualID(it)»
-
+
«canCreateNode(it)»
-
+
«getLinkWithClassVisualID(it)»
-
+
«isDiagram(it)»
-
+
«constraintMethods(it)»
-
+
«checkNodeVisualID(it)»
-
+
«isCompartmentVisualID(it)»
-
+
«isSemanticLeafVisualID(it)»
-
+
«runtimeTypedInstance(it)»
-
- «additions(it)»
}
'''
def attributes(GenDiagram it) '''
- «generatedMemberComment()»
- private static final String DEBUG_KEY = "«editorGen.plugin.ID»/debug/visualID"; «nonNLS(1)»
+ // Uncomment for debug purpose ?
+ // /**
+ // * @generated
+ // */
+ // private static final String DEBUG_KEY = "«editorGen.plugin.ID»/debug/visualID"; «nonNLS(1)»
'''
def getViewVisualID(GenDiagram it) '''
«generatedMemberComment()»
- public static int «getVisualIdMethodName(it)»(org.eclipse.gmf.runtime.notation.View view) {
+ public static String «getVisualIdMethodName(it)»(org.eclipse.gmf.runtime.notation.View view) {
if (view instanceof org.eclipse.gmf.runtime.notation.Diagram) {
if («modelID(it)».equals(view.getType())) {
return «visualID(it)»;
@@ -229,7 +229,7 @@ import plugin.Activator
while (view != diagram) {
org.eclipse.emf.ecore.EAnnotation annotation = view.getEAnnotation("Shortcut"); «nonNLS(1)»
if (annotation != null) {
- return (String) annotation.getDetails().get("modelID"); «nonNLS(1)»
+ return annotation.getDetails().get("modelID"); «nonNLS(1)»
}
view = (org.eclipse.gmf.runtime.notation.View) view.eContainer();
}
@@ -239,35 +239,25 @@ import plugin.Activator
def getVisualID(GenDiagram it) '''
«generatedMemberComment()»
- public static int «getVisualIdMethodName(it)»(String type) {
- try {
- return Integer.parseInt(type);
- } catch (NumberFormatException e) {
- if (Boolean.TRUE.toString().equalsIgnoreCase(org.eclipse.core.runtime.Platform.getDebugOption(DEBUG_KEY))) {
- «xptActivator.qualifiedClassName(editorGen.plugin)».getInstance().logError("Unable to parse view type as a visualID number: " + type);
- }
- }
- «unrecognizedVID(it)»
+ public static String «getVisualIdMethodName(it)»(String type) {
+ return type;
}
'''
def getType(GenDiagram it) '''
«generatedMemberComment()»
- public static String «getTypeMethodName(it)»(int visualID) {
- return Integer.toString(visualID);
+ public static String «getTypeMethodName(it)»(String visualID) {
+ return visualID;
}
'''
def getDiagramVisualID(GenDiagram it) '''
«generatedMemberComment()»
- public static int «getDiagramVisualIDMethodName(it)»(org.eclipse.emf.ecore.EObject domainElement) {
+ public static String «getDiagramVisualIDMethodName(it)»(org.eclipse.emf.ecore.EObject domainElement) {
if (domainElement == null) {
«unrecognizedVID(it)»
}
- «IF null != domainDiagramElement»
- «returnVisualID(it)»
- «ENDIF»
- «unrecognizedVID(it)»
+ return «visualID(it)»;
}
'''
@@ -280,23 +270,40 @@ import plugin.Activator
def dispatch checkSemanticElement(GenCommonBase it) '''
«ERROR('checkSemanticElement not supported for: ' + it)»
'''
-
+
def dispatch checkSemanticElement(GenDiagram it) '''«checkDomainElementMetaclass(domainDiagramElement)» && isDiagram(«xptMetaModel.CastEObject(domainDiagramElement, 'domainElement')»)'''
def dispatch checkSemanticElement(GenNode it) '''«checkDomainElementMetaclass(modelFacet.metaClass)»«checkDomainElementConstraints(it.modelFacet, it)»'''
def dispatch checkSemanticElement(GenLink it) '''«checkSemanticElement(it.modelFacet, it)»'''
def checkDomainElementMetaclass(GenClass it) '''«xptMetaModel.MetaClass(it)».isSuperTypeOf(domainElement.eClass())'''
- def checkDomainElementConstraints(TypeModelFacet it, GenCommonBase commonBase)
- '''«IF null != modelElementSelector» && «domainElementConstraintMethodName(commonBase)»(«xptMetaModel.CastEObject(metaClass, 'domainElement')»)«ENDIF»'''
+ def checkDomainElementConstraints(TypeModelFacet it, GenCommonBase commonBase)
+ /*
+ * ««« «IF null != modelElementSelector»
+ ««« //«it.eContainer»
+ ««« //->«modelElementSelector»
+ ««« «ENDIF»
+ ««« [ExtendedConstraint] START Testing the kind of ModelFacet (GenLink or Default case)
+ */
+ '''
+ «IF null !== modelElementSelector »
+ «IF commonBase instanceof GenLink || !(modelElementSelector.provider instanceof GenJavaExpressionProvider)»
+ ««« [ExtendedConstraint] END Testing the kind of ModelFacet (GenLink or Default case)
+ && «domainElementConstraintMethodName(commonBase)»(«CastEObject(metaClass,'domainElement')»)
+ ««« [ExtendedConstraint] START Testing the kind of ModelFacet (GenLink or Default case)
+ «ELSE»
+ && «domainElementConstraintMethodName(commonBase)»(containerView, «CastEObject(metaClass, 'domainElement')»)
+ «ENDIF»
+ «ENDIF»
+ ««« [ExtendedConstraint] END Testing the kind of ModelFacet (GenLink or Default case)
+ '''
def dispatch checkSemanticElement(LinkModelFacet it, GenLink genLink) '''«ERROR('checkSemanticElement is supported only for TypeLinkModelFacet: ' + it)»'''
def dispatch checkSemanticElement(TypeLinkModelFacet it, GenLink genLink) '''«checkDomainElementMetaclass(metaClass)»«checkDomainElementConstraints(it, genLink)»'''
-
def getNodeVisualID(GenDiagram it) '''
«generatedMemberComment()»
- public static int «getNodeVisualIDMethodName(it)»(org.eclipse.gmf.runtime.notation.View containerView, org.eclipse.emf.ecore.EObject domainElement) {
+ public static String «getNodeVisualIDMethodName(it)»(org.eclipse.gmf.runtime.notation.View containerView, org.eclipse.emf.ecore.EObject domainElement) {
if (domainElement == null) {
«unrecognizedVID(it)»
}
@@ -304,7 +311,7 @@ import plugin.Activator
if (!«modelID(it)».equals(containerModelID)«FOR spf : shortcutsProvidedFor»«checkContainerModelID(spf)»«ENDFOR») { «nonNLS_All(shortcutsProvidedFor)»
«unrecognizedVID(it)»
}
- int containerVisualID;
+ String containerVisualID;
if («modelID(it)».equals(containerModelID)) {
containerVisualID = «getVisualIDMethodCall(it)»(containerView);
} else {
@@ -314,10 +321,12 @@ import plugin.Activator
«unrecognizedVID(it)»
}
}
- switch (containerVisualID) {
- «FOR container : allContainers»
- «caseDomainContainerVisualID(container)»
- «ENDFOR»
+ if (containerVisualID != null) {
+ switch (containerVisualID) {
+ «FOR container : allContainers»
+ «caseDomainContainerVisualID(container)»
+ «ENDFOR»
+ }
}
«unrecognizedVID(it)»
}
@@ -333,12 +342,12 @@ import plugin.Activator
def canCreateNode(GenDiagram it) '''
«generatedMemberComment()»
- public static boolean «canCreateNodeMethodName(it)»(org.eclipse.gmf.runtime.notation.View containerView, int nodeVisualID) {
+ public static boolean «canCreateNodeMethodName(it)»(org.eclipse.gmf.runtime.notation.View containerView, String nodeVisualID) {
String containerModelID = «getModelIDMethodCall(it)»(containerView);
if (!«modelID(it)».equals(containerModelID)«FOR spf : shortcutsProvidedFor»«checkContainerModelID(spf)»«ENDFOR») { «nonNLS_All(shortcutsProvidedFor)»
return false;
}
- int containerVisualID;
+ String containerVisualID;
if («modelID(it)».equals(containerModelID)) {
containerVisualID = «getVisualIDMethodCall(it)»(containerView);
} else {
@@ -348,9 +357,11 @@ import plugin.Activator
return false;
}
}
- switch (containerVisualID) {
- «FOR container : allContainers.filter[e|getEssentialVisualChildren(e).notEmpty]»«checkEssentialChildren(container)»«ENDFOR»
- «FOR link : links.filter[l|getEssentialVisualChildren(l).notEmpty]»«checkEssentialChildren(link)»«ENDFOR»
+ if (containerVisualID != null) {
+ switch (containerVisualID) {
+ «FOR container : allContainers.filter[e|getEssentialVisualChildren(e).notEmpty]»«checkEssentialChildren(container)»«ENDFOR»
+ «FOR link : links.filter[l|getEssentialVisualChildren(l).notEmpty]»«checkEssentialChildren(link)»«ENDFOR»
+ }
}
return false;
}
@@ -365,14 +376,14 @@ import plugin.Activator
'''
def checkEssentialChild(GenCommonBase it) '''
- if («visualID(it)» == nodeVisualID) {
+ if («visualID(it)».equals(nodeVisualID)) {
return true;
}
'''
def getLinkWithClassVisualID(GenDiagram it) '''
«generatedMemberComment()»
- public static int «getLinkWithClassVisualIDMethodName(it)»(org.eclipse.emf.ecore.EObject domainElement) {
+ public static String «getLinkWithClassVisualIDMethodName(it)»(org.eclipse.emf.ecore.EObject domainElement) {
if (domainElement == null) {
«unrecognizedVID(it)»
}
@@ -382,15 +393,18 @@ import plugin.Activator
'''
def isDiagram(GenDiagram it) '''
- «IF null != domainDiagramElement»
- «generatedMemberComment(
- 'User can change implementation of this method to handle some specific\n' +
- 'situations not covered by default logic.\n'
- )»
- private static boolean isDiagram(«xptMetaModel.QualifiedClassName(domainDiagramElement)» element) {
- return true;
- }
- «ENDIF»
+ «IF null !== domainDiagramElement »
+ // Uncomment for debug purpose ?
+ // /**
+ // * User can change implementation of this method to handle some specific
+ // * situations not covered by default logic.
+ // *
+ // * @generated
+ // */
+ // private static boolean isDiagram(Package element) {
+ // return true;
+ // }
+ «ENDIF»
'''
/**
@@ -402,37 +416,47 @@ import plugin.Activator
* FIXME don't use static fields, replace with instance/separate cache (e.g. accessible from Activator)
*/
def constraintMethods(GenDiagram it) '''
- «IF null != editorGen.expressionProviders»
- «FOR topNode : topLevelNodes.filter[n | n.modelFacet.modelElementSelector != null]»«constraintMethod(topNode)»«ENDFOR»
- «FOR childNode : childNodes.filter[n | n.modelFacet.modelElementSelector != null]»«constraintMethod(childNode)»«ENDFOR»
- «FOR link : links»«constraintMethod(link.modelFacet, link)»«ENDFOR»
- «ENDIF»
- '''
+ «IF null !== editorGen.expressionProviders »
+ «FOR topNode : topLevelNodes.filter[n|!n.sansDomain].filter[n| n.modelFacet.modelElementSelector !== null ]»«constraintMethod(
+ topNode)»«ENDFOR»
+ «FOR childNode : childNodes.filter[n|!n.sansDomain].filter[n| n.modelFacet.modelElementSelector !== null ]»«constraintMethod(
+ childNode)»«ENDFOR»
+ «FOR link : links.filter[n|!n.sansDomain]»«constraintMethod(link.modelFacet, link)»«ENDFOR»
+ «ENDIF»
+ '''
def constraintMethod(GenNode it)
'''«domainElementConstraintMethod(modelFacet.modelElementSelector.provider, it, modelFacet.modelElementSelector, modelFacet.metaClass)»'''
def dispatch constraintMethod(LinkModelFacet it, GenLink l) '''''' // no-op
def dispatch constraintMethod(TypeLinkModelFacet it, GenLink l)
- '''«IF modelElementSelector != null»«domainElementConstraintMethod(modelElementSelector.provider, l, modelElementSelector, metaClass)»«ENDIF»'''
-
+ '''«IF modelElementSelector !== null »«domainElementConstraintMethod(modelElementSelector.provider, l, modelElementSelector, metaClass)»«ENDIF»'''
def dispatch domainElementConstraintMethod(GenExpressionProviderBase it, GenCommonBase diagramElement, ValueExpression expression, GenClass context)
'''«ERROR('Constraint method is not supported for ' + it)»'''
def dispatch domainElementConstraintMethod(GenJavaExpressionProvider it, GenCommonBase diagramElement, ValueExpression expression, GenClass context) '''
- «generatedMemberComment()»
- private static boolean «domainElementConstraintMethodName(diagramElement)»(«xptMetaModel.QualifiedClassName(context)» domainElement) {
- «IF injectExpressionBody && (expression.body != null && !expression.body.empty)»
+ «generatedMemberComment»
+ ««« [ExtendedConstraint] START Testing the kind of ModelFacet (GenLink or Default case)
+ «IF diagramElement instanceof GenLink»
+ ««« [ExtendedConstraint] END Testing the kind of ModelFacet (GenLink or Default case)
+ private static boolean «domainElementConstraintMethodName(diagramElement)»(«QualifiedClassName(context)» domainElement) {
+ ««« [ExtendedConstraint] START Testing the kind of ModelFacet (GenLink or Default case)
+ «ELSE»
+ private static boolean «domainElementConstraintMethodName(diagramElement)»(org.eclipse.gmf.runtime.notation.View containerView, «QualifiedClassName(
+ context)» domainElement) {
+ «ENDIF»
+ ««« [ExtendedConstraint] END Testing the kind of ModelFacet (GenLink or Default case)
+ «IF injectExpressionBody && ( expression.body !== null && expression.body.length() != 0)»
«expression.body»
- «ELSEIF throwException || (injectExpressionBody && (expression.body == null || expression.body.empty))»
+ «ELSEIF throwException || (injectExpressionBody && ( expression.body === null || expression.body.length() == 0))»
// FIXME: implement this method
// Ensure that you remove @generated or mark it @generated NOT
- throw new java.lang.UnsupportedOperationException("No java implementation provided in '«domainElementConstraintMethodName(diagramElement)»' operation");«nonNLS(1)»
+ throw new java.lang.UnsupportedOperationException("No java implementation provided in '« domainElementConstraintMethodName(diagramElement)»' operation");«nonNLS»
«ELSE»
return false;
«ENDIF»
- }
+ }
'''
// FIXME move these methods to ElementInitializers or any other more suitable place
@@ -445,33 +469,31 @@ import plugin.Activator
'''
// Constraints support end.
-
def unrecognizedVID(GenDiagram it) '''
- return -1;
+ return ""; «nonNLS»
'''
-
+
def checkNodeVisualID(GenDiagram it) '''
«generatedMemberComment()»
- public static boolean «checkNodeVisualIDMethodName(it)»(org.eclipse.gmf.runtime.notation.View containerView, org.eclipse.emf.ecore.EObject domainElement, int candidate) {
- if (candidate == -1){
- //unrecognized id is always bad
+ public static boolean «checkNodeVisualIDMethodName(it)»(org.eclipse.gmf.runtime.notation.View containerView, org.eclipse.emf.ecore.EObject domainElement, String candidate) {
+ if (candidate == null){
+ // unrecognized id is always bad
return false;
}
- int basic = «getNodeVisualIDMethodName(it)»(containerView, domainElement);
- return basic == candidate;
+ String basic = «getNodeVisualIDMethodName(it)»(containerView, domainElement);
+ return candidate.equals(basic);
}
'''
-
def isCompartmentVisualID(GenDiagram it) '''
«generatedMemberComment()»
- public static boolean «isCompartmentVisualIDMethodName(it)»(int visualID) {
+ public static boolean «isCompartmentVisualIDMethodName(it)»(String visualID) {
«IF compartments.notEmpty»
- switch (visualID) {
- «FOR compartment : compartments»«caseVisualID(compartment)»«ENDFOR»
- return true;
- default:
- break;
+ if (visualID != null) {
+ switch (visualID) {
+ «FOR compartment : compartments»«caseVisualID(compartment)»«ENDFOR»
+ return true;
+ }
}
«ENDIF»
return false;
@@ -482,17 +504,17 @@ import plugin.Activator
var leafs = it.allNodes.filter[n | getSemanticChildren(n).empty && n.compartments.forall[c | getSemanticChildren(c).empty]].sortBy[n|n.visualID]
return '''
«generatedMemberComment()»
- public static boolean «isSemanticLeafVisualIDMethodName(it)»(int visualID) {
- switch (visualID) {
- «/*We need to ensure at last one case, this is legitimate way*/
- caseVisualID(it)»
- return false;
- «IF leafs.notEmpty»
- «FOR leaf : leafs»«caseVisualID(leaf)»«ENDFOR»
- return true;
- «ENDIF»
- default:
- break;
+ public static boolean «isSemanticLeafVisualIDMethodName(it)»(String visualID) {
+ if (visualID != null) {
+ switch (visualID) {
+ «/*We need to ensure at last one case, this is legitimate way*/
+ caseVisualID(it)»
+ return false;
+ «IF leafs.notEmpty»
+ «FOR leaf : leafs»«caseVisualID(leaf)»«ENDFOR»
+ return true;
+ «ENDIF»
+ }
}
return false;
}
@@ -501,46 +523,44 @@ import plugin.Activator
def runtimeTypedInstance(GenDiagram it) '''
«generatedClassComment()»
- public static final org.eclipse.gmf.tooling.runtime.structure.DiagramStructure «runtimeTypedInstanceName(it)» = new org.eclipse.gmf.tooling.runtime.structure.DiagramStructure() {
+ public static final org.eclipse.papyrus.infra.gmfdiag.common.structure.DiagramStructure «runtimeTypedInstanceName(it)» = new org.eclipse.papyrus.infra.gmfdiag.common.structure.DiagramStructure() {
«generatedMemberComment()»
- «xptCodeStyle.overrideI(it)»
- public int «getVisualIdMethodName(it)»(org.eclipse.gmf.runtime.notation.View view) {
+ «xptCodeStyle.overrideC(it)»
+ public String «getVisualIdMethodName(it)»(org.eclipse.gmf.runtime.notation.View view) {
return «getVisualIDMethodCall(it)»(view);
}
-
+
«generatedMemberComment()»
- «xptCodeStyle.overrideI(it)»
+ «xptCodeStyle.overrideC(it)»
public String «getModelIDMethodName(it)»(org.eclipse.gmf.runtime.notation.View view) {
return «getModelIDMethodCall(it)»(view);
}
-
+
«generatedMemberComment()»
- «xptCodeStyle.overrideI(it)»
- public int «getNodeVisualIDMethodName(it)»(org.eclipse.gmf.runtime.notation.View containerView, org.eclipse.emf.ecore.EObject domainElement) {
+ «xptCodeStyle.overrideC(it)»
+ public String «getNodeVisualIDMethodName(it)»(org.eclipse.gmf.runtime.notation.View containerView, org.eclipse.emf.ecore.EObject domainElement) {
return «getNodeVisualIDMethodCall(it)»(containerView, domainElement);
}
-
+
«generatedMemberComment()»
- «xptCodeStyle.overrideI(it)»
- public boolean «checkNodeVisualIDMethodName(it)»(org.eclipse.gmf.runtime.notation.View containerView, org.eclipse.emf.ecore.EObject domainElement, int candidate) {
+ «xptCodeStyle.overrideC(it)»
+ public boolean «checkNodeVisualIDMethodName(it)»(org.eclipse.gmf.runtime.notation.View containerView, org.eclipse.emf.ecore.EObject domainElement, String candidate) {
return «checkNodeVisualIDMethodCall(it)»(containerView, domainElement, candidate);
}
-
+
«generatedMemberComment()»
- «xptCodeStyle.overrideI(it)»
- public boolean «isCompartmentVisualIDMethodName(it)»(int visualID) {
+ «xptCodeStyle.overrideC(it)»
+ public boolean «isCompartmentVisualIDMethodName(it)»(String visualID) {
return «isCompartmentVisualIDMethodCall(it)»(visualID);
}
-
+
«generatedMemberComment()»
- «xptCodeStyle.overrideI(it)»
- public boolean «isSemanticLeafVisualIDMethodName(it)»(int visualID) {
+ «xptCodeStyle.overrideC(it)»
+ public boolean «isSemanticLeafVisualIDMethodName(it)»(String visualID) {
return «isSemanticLeafVisualIDMethodCall(it)»(visualID);
}
};
'''
def caseVisualID(GenCommonBase xptSelf) '''case «VisualIDRegistry::visualID(xptSelf)»:'''
-
- def additions(GenDiagram it) ''''''
}

Back to the top