diff options
84 files changed, 2922 insertions, 2922 deletions
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/.settings/org.eclipse.core.resources.prefs b/plugins/toolsmiths/org.eclipse.papyrus.def/.settings/org.eclipse.core.resources.prefs index e10e3165bba..25790d4daea 100644 --- a/plugins/toolsmiths/org.eclipse.papyrus.def/.settings/org.eclipse.core.resources.prefs +++ b/plugins/toolsmiths/org.eclipse.papyrus.def/.settings/org.eclipse.core.resources.prefs @@ -1,3 +1,3 @@ eclipse.preferences.version=1 -encoding/<project>=ISO-8859-1 -encoding/xtend=ISO-8859-1 +encoding/<project>=UTF-8 +encoding/xtend=UTF-8 diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/pom.xml b/plugins/toolsmiths/org.eclipse.papyrus.def/pom.xml index 32576501f4c..42a0672a030 100644 --- a/plugins/toolsmiths/org.eclipse.papyrus.def/pom.xml +++ b/plugins/toolsmiths/org.eclipse.papyrus.def/pom.xml @@ -12,7 +12,7 @@ <packaging>eclipse-plugin</packaging> <properties> - <project.build.sourceEncoding>ISO-8859-1</project.build.sourceEncoding> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties> <build> @@ -52,7 +52,7 @@ <configuration> <outputDirectory>xtend-gen</outputDirectory> <testOutputDirectory>${project.build.directory}/xtend-gen/test</testOutputDirectory> - <encoding>ISO-8859-1</encoding> + <encoding>${project.build.sourceEncoding}</encoding> </configuration> </plugin> </plugins> diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/diagram/editparts/ChildNodeLabelEditPart.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/diagram/editparts/ChildNodeLabelEditPart.xtend index e88602e9a60..ddf329ebb43 100644 --- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/diagram/editparts/ChildNodeLabelEditPart.xtend +++ b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/diagram/editparts/ChildNodeLabelEditPart.xtend @@ -25,21 +25,21 @@ import org.eclipse.papyrus.papyrusgmfgenextension.ExtendedGenView override extendsList(GenChildLabelNode it) ''' -«««BEGIN: PapyrusGenCode -«««Add own extension -«IF it.eResource.allContents.filter(typeof (ExtendedGenView)).filter[v |v.genView.contains(it) && v.superOwnedEditPart!=null].size != 0» -extends «FOR extendedObject : it.eResource.allContents.filter(typeof (ExtendedGenView)).filter[v |v.genView.contains(it) && v.superOwnedEditPart!=null].toIterable» -«specifyInheritance(extendedObject as ExtendedGenView)» -«ENDFOR» -«««END: PapyrusGenCode -«ELSE» +«««BEGIN: PapyrusGenCode +«««Add own extension +«IF it.eResource.allContents.filter(typeof (ExtendedGenView)).filter[v |v.genView.contains(it) && v.superOwnedEditPart!=null].size != 0» +extends «FOR extendedObject : it.eResource.allContents.filter(typeof (ExtendedGenView)).filter[v |v.genView.contains(it) && v.superOwnedEditPart!=null].toIterable» +«specifyInheritance(extendedObject as ExtendedGenView)» +«ENDFOR» +«««END: PapyrusGenCode +«ELSE» extends org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart -«ENDIF» +«ENDIF» ''' //BEGIN: PapyrusGenCode //definition of the inheritance -def specifyInheritance (ExtendedGenView it)'''«superOwnedEditPart»''' +def specifyInheritance (ExtendedGenView it)'''«superOwnedEditPart»''' //END: PapyrusGenCode override implementsList(GenChildLabelNode it) '''implements org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart, org.eclipse.gmf.runtime.diagram.ui.editparts.IPrimaryEditPart, org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirectEdit''' diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/diagram/editparts/CompartmentEditPart.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/diagram/editparts/CompartmentEditPart.xtend index 4c39b259df4..c1c7086fbdf 100644 --- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/diagram/editparts/CompartmentEditPart.xtend +++ b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/diagram/editparts/CompartmentEditPart.xtend @@ -27,31 +27,31 @@ import xpt.Common override extendsList(GenCompartment it) ''' -«««BEGIN: PapyrusGenCode -«««Add own extension -«IF it.eResource.allContents.filter(typeof(ExtendedGenView)).filter[v|v.genView.contains(it) && v.superOwnedEditPart != null].size != 0» - extends «FOR extendedObject : it.eResource.allContents.filter(typeof (ExtendedGenView)).filter[v|v.genView.contains(it) && v.superOwnedEditPart != null].toIterable» - «specifyInheritance(extendedObject as ExtendedGenView)» -«ENDFOR» -«««END: BEGIN: PapyrusGenCode -«ELSE» - extends «IF listLayout»org.eclipse.gmf.runtime.diagram.ui.editparts.ListCompartmentEditPart«ELSE»org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.linklf.LinkLFShapeCompartmentEditPart«ENDIF» -«ENDIF» +«««BEGIN: PapyrusGenCode +«««Add own extension +«IF it.eResource.allContents.filter(typeof(ExtendedGenView)).filter[v|v.genView.contains(it) && v.superOwnedEditPart != null].size != 0» + extends «FOR extendedObject : it.eResource.allContents.filter(typeof (ExtendedGenView)).filter[v|v.genView.contains(it) && v.superOwnedEditPart != null].toIterable» + «specifyInheritance(extendedObject as ExtendedGenView)» +«ENDFOR» +«««END: BEGIN: PapyrusGenCode +«ELSE» + extends «IF listLayout»org.eclipse.gmf.runtime.diagram.ui.editparts.ListCompartmentEditPart«ELSE»org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.linklf.LinkLFShapeCompartmentEditPart«ENDIF» +«ENDIF» ''' //BEGIN: PapyrusGenCode //definition of the inheritance - def specifyInheritance(ExtendedGenView it) '''«superOwnedEditPart»''' + def specifyInheritance(ExtendedGenView it) '''«superOwnedEditPart»''' //END: PapyrusGenCode override additions(GenCompartment it) ''' - «handleSize(it)» - «refreshbound(it)» - «refreshvisual(it)» + «handleSize(it)» + «refreshbound(it)» + «refreshvisual(it)» ''' def handleSize(GenCompartment it) ''' - «generatedMemberComment» + «generatedMemberComment» protected void handleNotificationEvent(org.eclipse.emf.common.notify.Notification notification) { Object feature = notification.getFeature(); if (org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getSize_Width().equals(feature) @@ -65,7 +65,7 @@ protected void handleNotificationEvent(org.eclipse.emf.common.notify.Notificatio ''' def refreshbound(GenCompartment it) ''' - «generatedMemberComment» + «generatedMemberComment» protected void refreshBounds() { int width = ((Integer) getStructuralFeatureValue(org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getSize_Width())).intValue(); int height = ((Integer) getStructuralFeatureValue(org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getSize_Height())).intValue(); @@ -81,7 +81,7 @@ protected void handleNotificationEvent(org.eclipse.emf.common.notify.Notificatio ''' def refreshvisual(GenCompartment it) ''' - «generatedMemberComment» + «generatedMemberComment» protected void refreshVisuals() { super.refreshVisuals(); refreshBounds(); diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/diagram/editparts/DiagramEditPart.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/diagram/editparts/DiagramEditPart.xtend index 740af4e315e..e24bb51d7a3 100644 --- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/diagram/editparts/DiagramEditPart.xtend +++ b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/diagram/editparts/DiagramEditPart.xtend @@ -26,6 +26,6 @@ import org.eclipse.gmf.codegen.gmfgen.GenDiagram //BEGIN: PapyrusGenCode //patches the super type of the diagram edit part in case the controlled object represents a UML element - override extendsList(GenDiagram it) '''extends «aspectDiagramEditPart.extendsListContents(it)»''' + override extendsList(GenDiagram it) '''extends «aspectDiagramEditPart.extendsListContents(it)»''' //END: PapyrusGenCode } diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/diagram/editparts/ExternalNodeLabelEditPart.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/diagram/editparts/ExternalNodeLabelEditPart.xtend index 036ac66d6b0..40c4ee999b1 100644 --- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/diagram/editparts/ExternalNodeLabelEditPart.xtend +++ b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/diagram/editparts/ExternalNodeLabelEditPart.xtend @@ -27,46 +27,46 @@ import xpt.Common @Inject extension Common; override extendsList(GenExternalNodeLabel it) ''' - «««BEGIN: PapyrusGenCode - «««specify a java super class for external nodes - «IF it.eResource.allContents.filter(typeof (ExtendedGenView)).filter[v | v.genView.contains(it) && v.superOwnedEditPart != null].size != 0» - extends «FOR extendedObject : it.eResource.allContents.filter(typeof (ExtendedGenView)).filter[v|v.genView.contains(it) && v.superOwnedEditPart != null].toIterable» - «specifyInheritance(extendedObject as ExtendedGenView)» - «ENDFOR» - «««END: PapyrusGenCode - «ELSE» + «««BEGIN: PapyrusGenCode + «««specify a java super class for external nodes + «IF it.eResource.allContents.filter(typeof (ExtendedGenView)).filter[v | v.genView.contains(it) && v.superOwnedEditPart != null].size != 0» + extends «FOR extendedObject : it.eResource.allContents.filter(typeof (ExtendedGenView)).filter[v|v.genView.contains(it) && v.superOwnedEditPart != null].toIterable» + «specifyInheritance(extendedObject as ExtendedGenView)» + «ENDFOR» + «««END: PapyrusGenCode + «ELSE» extends org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusLabelEditPart - «ENDIF» + «ENDIF» ''' //we add the interface ILabelRoleProvider override implementsList(GenExternalNodeLabel it) ''' implements org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart, org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart - ««« BEGIN: PapyrusGenCode - «IF it.eResource.allContents.filter(typeof (LabelVisibilityPreference)).filter[v|v.externalNodeLabels.contains(it)].size != 0» + ««« BEGIN: PapyrusGenCode + «IF it.eResource.allContents.filter(typeof (LabelVisibilityPreference)).filter[v|v.externalNodeLabels.contains(it)].size != 0» , org.eclipse.papyrus.uml.diagram.common.editparts.ILabelRoleProvider - «ENDIF» - ««« END: PapyrusGenCode + «ENDIF» + ««« END: PapyrusGenCode ''' override additions(GenExternalNodeLabel it) ''' - ««« BEGIN: PapyrusGenCode - «IF it.eResource.allContents.filter(typeof (LabelVisibilityPreference)).filter[v|v.externalNodeLabels.contains(it)].size != 0» - «generatedClassComment» + ««« BEGIN: PapyrusGenCode + «IF it.eResource.allContents.filter(typeof (LabelVisibilityPreference)).filter[v|v.externalNodeLabels.contains(it)].size != 0» + «generatedClassComment» public String getLabelRole(){ - return "«it.eResource.allContents.filter(typeof (LabelVisibilityPreference)).filter[v|v.externalNodeLabels.contains(it)].head.role»";//$NON-NLS-1$ + return "«it.eResource.allContents.filter(typeof (LabelVisibilityPreference)).filter[v|v.externalNodeLabels.contains(it)].head.role»";//$NON-NLS-1$ } - «generatedClassComment» + «generatedClassComment» public String getIconPathRole(){ - return "«it.eResource.allContents.filter(typeof (LabelVisibilityPreference)).filter[v|v.externalNodeLabels.contains(it)].head.iconPathRole»";//$NON-NLS-1$ + return "«it.eResource.allContents.filter(typeof (LabelVisibilityPreference)).filter[v|v.externalNodeLabels.contains(it)].head.iconPathRole»";//$NON-NLS-1$ } - «ENDIF» - ««« END: PapyrusGenCode + «ENDIF» + ««« END: PapyrusGenCode ''' def refreshBounds(GenExternalNodeLabel it) ''' - ««« BEGIN: PapyrusGenCode + ««« BEGIN: PapyrusGenCode public void refreshBounds() { int x = ((Integer) getStructuralFeatureValue(org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getLocation_X())).intValue(); int y = ((Integer) getStructuralFeatureValue(org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getLocation_Y())).intValue(); @@ -75,12 +75,12 @@ import xpt.Common getBorderItemLocator().setConstraint(new org.eclipse.draw2d.geometry.Rectangle(x, y, width, height)); getBorderItemLocator().relocate(getFigure()); } - ««« END: PapyrusGenCode + ««« END: PapyrusGenCode ''' //BEGIN: PapyrusGenCode //definition of the inheritance - def specifyInheritance(ExtendedGenView it) '''«superOwnedEditPart»''' + def specifyInheritance(ExtendedGenView it) '''«superOwnedEditPart»''' //END: PapyrusGenCode } diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/diagram/editparts/LinkEditPart.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/diagram/editparts/LinkEditPart.xtend index edc1bda6e33..dbcc1083103 100644 --- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/diagram/editparts/LinkEditPart.xtend +++ b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/diagram/editparts/LinkEditPart.xtend @@ -27,7 +27,7 @@ import org.eclipse.gmf.codegen.gmfgen.GenLink //BEGIN: PapyrusGenCode //patches the super type of the link edit part in case the controlled object represents a UML element -override extendsList(GenLink it) '''extends «aspectsLinkEditPart.extendsListContents(it)»''' +override extendsList(GenLink it) '''extends «aspectsLinkEditPart.extendsListContents(it)»''' //END: PapyrusGenCode } diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/diagram/editparts/LinkLabelEditPart.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/diagram/editparts/LinkLabelEditPart.xtend index bc77893926f..35496644541 100644 --- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/diagram/editparts/LinkLabelEditPart.xtend +++ b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/diagram/editparts/LinkLabelEditPart.xtend @@ -29,28 +29,28 @@ import xpt.Common override implementsList(GenLinkLabel it) ''' implements org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart, org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirectEdit - ««« BEGIN: PapyrusGenCode - «IF it.eResource.allContents.filter(typeof (LabelVisibilityPreference)).filter[v |v.linkLabels.contains(it)].size != 0» + ««« BEGIN: PapyrusGenCode + «IF it.eResource.allContents.filter(typeof (LabelVisibilityPreference)).filter[v |v.linkLabels.contains(it)].size != 0» , org.eclipse.papyrus.uml.diagram.common.editparts.ILabelRoleProvider - «ENDIF» - ««« END: PapyrusGenCode + «ENDIF» + ««« END: PapyrusGenCode ''' override additions(GenLinkLabel it) ''' - ««« BEGIN: PapyrusGenCode - «IF it.eResource.allContents.filter(typeof (LabelVisibilityPreference)).filter[v | v.linkLabels.contains(it)].size != 0» - «generatedClassComment» + ««« BEGIN: PapyrusGenCode + «IF it.eResource.allContents.filter(typeof (LabelVisibilityPreference)).filter[v | v.linkLabels.contains(it)].size != 0» + «generatedClassComment» public String getLabelRole(){ - return "«it.eResource.allContents.filter(typeof (LabelVisibilityPreference)).filter[v |v.linkLabels.contains(it)].head.role»";//$NON-NLS-1$ + return "«it.eResource.allContents.filter(typeof (LabelVisibilityPreference)).filter[v |v.linkLabels.contains(it)].head.role»";//$NON-NLS-1$ } - «generatedClassComment» + «generatedClassComment» public String getIconPathRole(){ - return "«it.eResource.allContents.filter(typeof (LabelVisibilityPreference)).filter[v |v.linkLabels.contains(it)].head.iconPathRole»";//$NON-NLS-1$ + return "«it.eResource.allContents.filter(typeof (LabelVisibilityPreference)).filter[v |v.linkLabels.contains(it)].head.iconPathRole»";//$NON-NLS-1$ } - «ENDIF» - ««« END: PapyrusGenCode + «ENDIF» + ««« END: PapyrusGenCode ''' override extendsList(GenLinkLabel it) '''extends org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusLabelEditPart''' @@ -63,14 +63,14 @@ import xpt.Common protected void createDefaultEditPolicies() { super.createDefaultEditPolicies(); installEditPolicy(org.eclipse.gef.EditPolicy.DIRECT_EDIT_ROLE, new org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy()); - installEditPolicy(org.eclipse.gef.EditPolicy.SELECTION_FEEDBACK_ROLE, new «diagram.getTextSelectionEditPolicyQualifiedClassName()»()); - ««« BEGIN: PapyrusGenCode + installEditPolicy(org.eclipse.gef.EditPolicy.SELECTION_FEEDBACK_ROLE, new «diagram.getTextSelectionEditPolicyQualifiedClassName()»()); + ««« BEGIN: PapyrusGenCode installEditPolicy(org.eclipse.gef.EditPolicy.PRIMARY_DRAG_ROLE, new org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.PapyrusLinkLabelDragPolicy()); - ««« END: PapyrusGenCode - ««« Get the added custom behavoir - «FOR CustomBehaviour:it.behaviour.filter(typeof (CustomBehaviour))» - installEditPolicy(«CustomBehaviour.key», new «CustomBehaviour.editPolicyQualifiedClassName»()); - «ENDFOR» + ««« END: PapyrusGenCode + ««« Get the added custom behavoir + «FOR CustomBehaviour:it.behaviour.filter(typeof (CustomBehaviour))» + installEditPolicy(«CustomBehaviour.key», new «CustomBehaviour.editPolicyQualifiedClassName»()); + «ENDFOR» } ''' } diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/diagram/editparts/NodeEditPart.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/diagram/editparts/NodeEditPart.xtend index c77ba4fd754..c9a5709bbf8 100644 --- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/diagram/editparts/NodeEditPart.xtend +++ b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/diagram/editparts/NodeEditPart.xtend @@ -35,81 +35,81 @@ import xpt.diagram.editparts.Utils_qvto override Main(GenNode it) ''' - «copyright(diagram.editorGen)» - package «xptNodeEditPartImpl.packageName(it)»; + «copyright(diagram.editorGen)» + package «xptNodeEditPartImpl.packageName(it)»; - «generatedClassComment» - public class «xptNodeEditPartImpl.className(it)» «extendsList(it)» «implementsList(it)» { + «generatedClassComment» + public class «xptNodeEditPartImpl.className(it)» «extendsList(it)» «implementsList(it)» { - «attributes(it)» + «attributes(it)» - «xptNodeEditPartImpl.constructor(it)» + «xptNodeEditPartImpl.constructor(it)» - «createDefaultEditPolicies(it)» + «createDefaultEditPolicies(it)» - «xptNodeEditPartImpl.createLayoutEditPolicy(it)» + «xptNodeEditPartImpl.createLayoutEditPolicy(it)» -««« BEGIN: PapyrusGenCode -««« call tamplate to paste code for refresh figure by taking account event - «aspectsNodeEditPartImpl.specificHandleNotificationEvent(it)» -««« END: PapyrusGenCode +««« BEGIN: PapyrusGenCode +««« call tamplate to paste code for refresh figure by taking account event + «aspectsNodeEditPartImpl.specificHandleNotificationEvent(it)» +««« END: PapyrusGenCode - «xptNodeEditPartImpl.createNodeShape(it.viewmap, it)» + «xptNodeEditPartImpl.createNodeShape(it.viewmap, it)» - «IF hasFixedChildren(it)» - «xptNodeEditPartImpl.addFixedChild(it)» + «IF hasFixedChildren(it)» + «xptNodeEditPartImpl.addFixedChild(it)» - «xptNodeEditPartImpl.removeFixedChild(it)» + «xptNodeEditPartImpl.removeFixedChild(it)» - «xptNodeEditPartImpl.addChildVisual(it)» + «xptNodeEditPartImpl.addChildVisual(it)» - «xptNodeEditPartImpl.removeChildVisual(it)» + «xptNodeEditPartImpl.removeChildVisual(it)» - «xptNodeEditPartImpl.getContentPaneFor(it)» - «ENDIF» + «xptNodeEditPartImpl.getContentPaneFor(it)» + «ENDIF» - «xptNodeEditPartImpl.addBorderItem(it)» + «xptNodeEditPartImpl.addBorderItem(it)» - «xptNodeEditPartImpl.createNodePlate(it)» + «xptNodeEditPartImpl.createNodePlate(it)» - «xptNodeEditPartImpl.getPrimaryDragEditPolicy(it)» + «xptNodeEditPartImpl.getPrimaryDragEditPolicy(it)» - «xptNodeEditPartImpl.createFigure(it)» + «xptNodeEditPartImpl.createFigure(it)» - «xptNodeEditPartImpl.setupContentPane(it)» + «xptNodeEditPartImpl.setupContentPane(it)» - «xptNodeEditPartImpl.getContentPane(it)» + «xptNodeEditPartImpl.getContentPane(it)» - «xptNodeEditPartImpl.setForegroundColor(it)» + «xptNodeEditPartImpl.setForegroundColor(it)» -««« «xptNodeEditPartImpl.setBackgroundColor(it)» +««« «xptNodeEditPartImpl.setBackgroundColor(it)» - «xptNodeEditPartImpl.setLineWidth(it)» + «xptNodeEditPartImpl.setLineWidth(it)» - «xptNodeEditPartImpl.setLineStyle(it)» + «xptNodeEditPartImpl.setLineStyle(it)» - «xptNodeEditPartImpl.getPrimaryChildEditPart(it)» + «xptNodeEditPartImpl.getPrimaryChildEditPart(it)» - «IF hasChildrenInListCompartments(it)» - «xptNodeEditPartImpl.getTargetEditPartMethod(it)» - «ENDIF» + «IF hasChildrenInListCompartments(it)» + «xptNodeEditPartImpl.getTargetEditPartMethod(it)» + «ENDIF» - «handleNotificationEvent(it)» + «handleNotificationEvent(it)» - «xptNodeEditPartImpl.innerClassDeclaration(viewmap)» + «xptNodeEditPartImpl.innerClassDeclaration(viewmap)» - «additions(it)» + «additions(it)» } ''' //BEGIN: PapyrusGenCode //patches the super type of the node edit part in case the controlled object represents a UML element - override extendsList (GenNode it)''' extends «aspectsNodeEditPartImpl.extendsListContents(it)»''' + override extendsList (GenNode it)''' extends «aspectsNodeEditPartImpl.extendsListContents(it)»''' //END: PapyrusGenCode // override additions(GenNode it) ''' - // «aspectsNodeEditPartImpl.genPreferredValue(it)» + // «aspectsNodeEditPartImpl.genPreferredValue(it)» // ''' }
\ No newline at end of file diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/diagram/editparts/NodeLabelEditPart.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/diagram/editparts/NodeLabelEditPart.xtend index e500917ff50..da919b3be98 100644 --- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/diagram/editparts/NodeLabelEditPart.xtend +++ b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/diagram/editparts/NodeLabelEditPart.xtend @@ -36,33 +36,33 @@ override extendsList (GenNodeLabel it) '''extends org.eclipse.papyrus.infra.gmfd //END: PapyrusGenCode override handleNotificationEvent(GenNodeLabel it) ''' - «generatedMemberComment» + «generatedMemberComment» protected void handleNotificationEvent(org.eclipse.emf.common.notify.Notification event) { refreshLabel(); - «xptNodeLabelEditPart.handleNotificationEventBody(it)» + «xptNodeLabelEditPart.handleNotificationEventBody(it)» } ''' override additions(GenNodeLabel it) ''' - ««« Code to refresh icon + ««« Code to refresh icon - «generatedMemberComment» + «generatedMemberComment» private static final String ADD_PARENT_MODEL = "AddParentModel"; - «generatedMemberComment» + «generatedMemberComment» public void activate() { super.activate(); addOwnerElementListeners(); } - «generatedMemberComment» + «generatedMemberComment» protected void addOwnerElementListeners() { addListenerFilter(ADD_PARENT_MODEL, this, ((org.eclipse.gmf.runtime.notation.View) getParent().getModel())); } - «generatedMemberComment» + «generatedMemberComment» public void deactivate() { removeOwnerElementListeners(); super.deactivate(); @@ -70,12 +70,12 @@ override extendsList (GenNodeLabel it) '''extends org.eclipse.papyrus.infra.gmfd } - «generatedMemberComment» + «generatedMemberComment» protected void removeOwnerElementListeners() { removeListenerFilter(ADD_PARENT_MODEL); } - «««END: PapyrusGenCode + «««END: PapyrusGenCode ''' } diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/editparts/ChildNodeLabelEditPart.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/editparts/ChildNodeLabelEditPart.xtend index 31b64f1ff53..f5434fac45c 100644 --- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/editparts/ChildNodeLabelEditPart.xtend +++ b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/editparts/ChildNodeLabelEditPart.xtend @@ -30,12 +30,12 @@ import xpt.diagram.editparts.Common override handleNotificationEventBody(GenChildLabelNode it) ''' Object feature = event.getFeature(); - «handleText(it)» - «IF labelElementIcon» + «handleText(it)» + «IF labelElementIcon» if(event.getNewValue() instanceof org.eclipse.emf.ecore.EAnnotation && org.eclipse.papyrus.infra.emf.appearance.helper.VisualInformationPapyrusConstants.DISPLAY_NAMELABELICON.equals(((org.eclipse.emf.ecore.EAnnotation)event.getNewValue()).getSource())){ refreshLabel(); } - «ENDIF» + «ENDIF» if (org.eclipse.uml2.uml.UMLPackage.eINSTANCE.getFeature_IsStatic().equals(feature)) { refreshUnderline(); } diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/editparts/CompartmentEditPart.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/editparts/CompartmentEditPart.xtend index 6eb87c8fde1..9051c52c823 100644 --- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/editparts/CompartmentEditPart.xtend +++ b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/editparts/CompartmentEditPart.xtend @@ -32,21 +32,21 @@ import org.eclipse.papyrus.papyrusgmfgenextension.ExtendedGenView override createDefaultEditPoliciesBody(GenCompartment it) ''' super.createDefaultEditPolicies(); - «IF canCollapse» + «IF canCollapse» installEditPolicy(org.eclipse.gef.EditPolicy.PRIMARY_DRAG_ROLE, new org.eclipse.gmf.runtime.diagram.ui.editpolicies.ResizableCompartmentEditPolicy()); - «ENDIF» - «xptEditpartsCommon.installSemanticEditPolicy(it)» - «IF ! childNodes.empty» + «ENDIF» + «xptEditpartsCommon.installSemanticEditPolicy(it)» + «IF ! childNodes.empty» installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CREATION_ROLE, new org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultCreationEditPolicy()); installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE, new org.eclipse.gmf.runtime.diagram.ui.editpolicies.DragDropEditPolicy()); installEditPolicy(org.eclipse.papyrus.uml.diagram.common.editpolicies.PasteEditPolicy.PASTE_ROLE, new org.eclipse.papyrus.uml.diagram.common.editpolicies.PasteEditPolicy()); - «ENDIF» - «xptEditpartsCommon.installCanonicalEditPolicy(it)» - «xptEditpartsCommon.behaviour(it)» + «ENDIF» + «xptEditpartsCommon.installCanonicalEditPolicy(it)» + «xptEditpartsCommon.behaviour(it)» ''' override getTargetEditPartMethod(GenCompartment it) ''' - «generatedMemberComment» + «generatedMemberComment» public org.eclipse.gef.EditPart getTargetEditPart(org.eclipse.gef.Request request) { return super.getTargetEditPart(request); diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/editparts/DiagramEditPart.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/editparts/DiagramEditPart.xtend index 9d2452da12b..eed4076ce2c 100644 --- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/editparts/DiagramEditPart.xtend +++ b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/editparts/DiagramEditPart.xtend @@ -50,10 +50,10 @@ override createDefaultEditPoliciesBody(GenDiagram it) ''' installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CREATION_ROLE, new org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultCreationEditPolicy()); installEditPolicy(org.eclipse.papyrus.uml.diagram.common.editpolicies.PasteEditPolicy.PASTE_ROLE, new org.eclipse.papyrus.uml.diagram.common.editpolicies.PasteEditPolicy()); - «xptEditpartsCommon.installSemanticEditPolicy(it)» - «xptEditpartsCommon.installCanonicalEditPolicy(it)» - ««« «xptEditpartsCommon.installCreationEditPolicy(it)» - «IF generateCreateShortcutAction() && null == editorGen.application» + «xptEditpartsCommon.installSemanticEditPolicy(it)» + «xptEditpartsCommon.installCanonicalEditPolicy(it)» + ««« «xptEditpartsCommon.installCreationEditPolicy(it)» + «IF generateCreateShortcutAction() && null == editorGen.application» installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE, new org.eclipse.gmf.runtime.diagram.ui.editpolicies.DiagramDragDropEditPolicy() { public org.eclipse.gef.commands.Command getDropObjectsCommand(org.eclipse.gmf.runtime.diagram.ui.requests.DropObjectsRequest dropRequest) { java.util.List<org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest.ViewDescriptor> viewDescriptors = new java.util.ArrayList<org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest.ViewDescriptor>(); @@ -70,13 +70,13 @@ override createDefaultEditPoliciesBody(GenDiagram it) ''' private org.eclipse.gef.commands.Command createShortcutsCommand(org.eclipse.gmf.runtime.diagram.ui.requests.DropObjectsRequest dropRequest, java.util.List<org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest.ViewDescriptor> viewDescriptors) { org.eclipse.gef.commands.Command command = createViewsAndArrangeCommand(dropRequest, viewDescriptors); if (command != null) { - return command.chain(new org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy(new «createShoutrtcutDecorationCommand.qualifiedClassName(it)»(getEditingDomain(), (org.eclipse.gmf.runtime.notation.View) getModel(), viewDescriptors))); + return command.chain(new org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy(new «createShoutrtcutDecorationCommand.qualifiedClassName(it)»(getEditingDomain(), (org.eclipse.gmf.runtime.notation.View) getModel(), viewDescriptors))); } return null; } }); - «ENDIF» - «IF shouldGenerateDiagramViewmap(it)» + «ENDIF» + «IF shouldGenerateDiagramViewmap(it)» // diagram figure does layout; need to install child editpolicy to show selection feedback installEditPolicy(org.eclipse.gef.EditPolicy.LAYOUT_ROLE, new org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy() { protected org.eclipse.gef.EditPolicy createChildEditPolicy(org.eclipse.gef.EditPart child) { @@ -91,14 +91,14 @@ override createDefaultEditPoliciesBody(GenDiagram it) ''' return null; } }); - «ENDIF» - «xptEditpartsCommon.behaviour(it)» + «ENDIF» + «xptEditpartsCommon.behaviour(it)» // removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.POPUPBAR_ROLE); ''' def featureForMetaclass (GenNode it)''' - if (« MetaClass(modelFacet.metaClass)».equals(class1)) { - return «MetaFeature(modelFacet.containmentMetaFeature)»; + if (« MetaClass(modelFacet.metaClass)».equals(class1)) { + return «MetaFeature(modelFacet.containmentMetaFeature)»; } ''' diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/editparts/LinkEditPart.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/editparts/LinkEditPart.xtend index 17a4c9a9ce1..061f6c97cc8 100644 --- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/editparts/LinkEditPart.xtend +++ b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/editparts/LinkEditPart.xtend @@ -34,85 +34,85 @@ import xpt.Common //BEGIN: PapyrusGenCode //computes super type of the link edit part in case the edit part manages a representation of a UML element def extendsListContents(GenLink it)''' - «IF it.eResource.allContents.filter(typeof (ExtendedGenView)).filter[v |(v.genView.contains(it) && v.superOwnedEditPart!=null)].size != 0» - «FOR extendedObject : it.eResource.allContents.filter(typeof (ExtendedGenView)).filter[v |(v.genView.contains(it) && v.superOwnedEditPart!=null)].toIterable» - «specifyInheritance(extendedObject)» - «ENDFOR» - «ELSE» + «IF it.eResource.allContents.filter(typeof (ExtendedGenView)).filter[v |(v.genView.contains(it) && v.superOwnedEditPart!=null)].size != 0» + «FOR extendedObject : it.eResource.allContents.filter(typeof (ExtendedGenView)).filter[v |(v.genView.contains(it) && v.superOwnedEditPart!=null)].toIterable» + «specifyInheritance(extendedObject)» + «ENDFOR» + «ELSE» org.eclipse.papyrus.infra.gmfdiag.common.editpart.ConnectionEditPart - «ENDIF» + «ENDIF» ''' //END: BEGIN: PapyrusGenCode //BEGIN: PapyrusGenCode //definition of the inheritance - def specifyInheritance (ExtendedGenView it)'''«superOwnedEditPart»''' + def specifyInheritance (ExtendedGenView it)'''«superOwnedEditPart»''' //END: PapyrusGenCode override addFixedChild (GenLink it)''' - «IF labels.size > 0» - «generatedMemberComment» + «IF labels.size > 0» + «generatedMemberComment» protected boolean addFixedChild(org.eclipse.gef.EditPart childEditPart) { - «FOR label : labels» - «addLabel(label.viewmap,label)» - «ENDFOR» + «FOR label : labels» + «addLabel(label.viewmap,label)» + «ENDFOR» return false; } - «ENDIF» + «ENDIF» ''' override removeFixedChild(GenLink it) ''' - «IF ! labels.empty» - «generatedMemberComment» + «IF ! labels.empty» + «generatedMemberComment» protected boolean removeFixedChild(org.eclipse.gef.EditPart childEditPart) { - «FOR label : labels» - «removeLabel(label.viewmap, label)» - «ENDFOR» + «FOR label : labels» + «removeLabel(label.viewmap, label)» + «ENDFOR» return false; } - «ENDIF» + «ENDIF» ''' override addChildVisual(GenLink it) ''' - «IF ! labels.empty» - «generatedMemberComment» + «IF ! labels.empty» + «generatedMemberComment» protected void addChildVisual(org.eclipse.gef.EditPart childEditPart, int index) { if (addFixedChild(childEditPart)) { return; } super.addChildVisual(childEditPart, -1); } - «ENDIF» + «ENDIF» ''' override removeChildVisual(GenLink it) ''' - «IF ! labels.empty» - «generatedMemberComment» + «IF ! labels.empty» + «generatedMemberComment» protected void removeChildVisual(org.eclipse.gef.EditPart childEditPart) { if (removeFixedChild(childEditPart)) { return; } super.removeChildVisual(childEditPart); } - «ENDIF» + «ENDIF» ''' override dispatch createLinkFigure(ModeledViewmap it, GenLink link) ''' -««« «generatedMemberComment» -««« protected org.eclipse.draw2d.Connection createConnectionFigure() { -««« return new «modeledViewmapFigureFQN(it)»(); -««« } -««« -««« «generatedMemberComment» -««« public «modeledViewmapFigureFQN(it)» getPrimaryShape() { -««« return («modeledViewmapFigureFQN(it)») getFigure(); -««« } -««« -««« «xptModeledViewmapProducer.viewmapClassBody(it)» +««« «generatedMemberComment» +««« protected org.eclipse.draw2d.Connection createConnectionFigure() { +««« return new «modeledViewmapFigureFQN(it)»(); +««« } +««« +««« «generatedMemberComment» +««« public «modeledViewmapFigureFQN(it)» getPrimaryShape() { +««« return («modeledViewmapFigureFQN(it)») getFigure(); +««« } +««« +««« «xptModeledViewmapProducer.viewmapClassBody(it)» ''' override modeledViewmapFigureFQN(ModeledViewmap it) ''' -««« «xptModeledViewmapProducer.viewmapFigureFQN(it)» +««« «xptModeledViewmapProducer.viewmapFigureFQN(it)» ''' } diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/editparts/LinkLabelEditPart.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/editparts/LinkLabelEditPart.xtend index 4e4b966bbc0..d83214935ce 100644 --- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/editparts/LinkLabelEditPart.xtend +++ b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/editparts/LinkLabelEditPart.xtend @@ -30,15 +30,15 @@ import xpt.diagram.editparts.Common override handleNotificationEventBody(GenLinkLabel it) ''' Object feature = event.getFeature(); - «handleText (it)» + «handleText (it)» - ««« START Papyrus Code - «IF elementIcon» + ««« START Papyrus Code + «IF elementIcon» if(event.getNewValue() instanceof org.eclipse.emf.ecore.EAnnotation && org.eclipse.papyrus.infra.emf.appearance.helper.VisualInformationPapyrusConstants.DISPLAY_NAMELABELICON.equals(((org.eclipse.emf.ecore.EAnnotation)event.getNewValue()).getSource())){ refreshLabel(); } - «ENDIF» - ««« End Papyrus Code + «ENDIF» + ««« End Papyrus Code super.handleNotificationEvent(event); ''' diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/editparts/NodeEditPart.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/editparts/NodeEditPart.xtend index ed3fccf1075..82286f403e1 100644 --- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/editparts/NodeEditPart.xtend +++ b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/editparts/NodeEditPart.xtend @@ -64,71 +64,71 @@ import xpt.providers.ElementTypes //--------- override dispatch extendsListContents (GenNode it)''' -«««BEGIN: PapyrusGenCode -«««Add own extension -«IF it.eResource.allContents.filter(typeof(ExtendedGenView)).filter[v |v.genView.contains(it) && v.superOwnedEditPart!=null].size != 0» -«FOR extendedObject : it.eResource.allContents.filter(typeof(ExtendedGenView)).filter[v |v.genView.contains(it) && v.superOwnedEditPart!=null].toIterable» -«specifyInheritance(extendedObject as ExtendedGenView)» -«ENDFOR» -«««END: BEGIN: PapyrusGenCode -«ELSE» +«««BEGIN: PapyrusGenCode +«««Add own extension +«IF it.eResource.allContents.filter(typeof(ExtendedGenView)).filter[v |v.genView.contains(it) && v.superOwnedEditPart!=null].size != 0» +«FOR extendedObject : it.eResource.allContents.filter(typeof(ExtendedGenView)).filter[v |v.genView.contains(it) && v.superOwnedEditPart!=null].toIterable» +«specifyInheritance(extendedObject as ExtendedGenView)» +«ENDFOR» +«««END: BEGIN: PapyrusGenCode +«ELSE» org.eclipse.papyrus.infra.gmfdiag.common.editpart.NodeEditPart -«ENDIF» +«ENDIF» ''' override dispatch extendsListContents (GenChildSideAffixedNode it)''' -«««BEGIN: PapyrusGenCode -«««Add own extension -«IF it.eResource.allContents.filter(typeof(ExtendedGenView)).filter[v |v.genView.contains(it) && v.superOwnedEditPart!=null].size != 0» -«FOR extendedObject : it.eResource.allContents.filter(typeof(ExtendedGenView)).filter[v |v.genView.contains(it) && v.superOwnedEditPart!=null].toIterable» -«specifyInheritance(extendedObject)» -«ENDFOR» -«««END: BEGIN: PapyrusGenCode -«ELSE» - «IF hasBorderItems(it)»org.eclipse.gmf.runtime.diagram.ui.editparts.BorderedBorderItemEditPart«ELSE»org.eclipse.gmf.runtime.diagram.ui.editparts.AbstractBorderItemEditPart«ENDIF» -«ENDIF» +«««BEGIN: PapyrusGenCode +«««Add own extension +«IF it.eResource.allContents.filter(typeof(ExtendedGenView)).filter[v |v.genView.contains(it) && v.superOwnedEditPart!=null].size != 0» +«FOR extendedObject : it.eResource.allContents.filter(typeof(ExtendedGenView)).filter[v |v.genView.contains(it) && v.superOwnedEditPart!=null].toIterable» +«specifyInheritance(extendedObject)» +«ENDFOR» +«««END: BEGIN: PapyrusGenCode +«ELSE» + «IF hasBorderItems(it)»org.eclipse.gmf.runtime.diagram.ui.editparts.BorderedBorderItemEditPart«ELSE»org.eclipse.gmf.runtime.diagram.ui.editparts.AbstractBorderItemEditPart«ENDIF» +«ENDIF» ''' override addFixedChild (GenNode it)''' - «generatedMemberComment» + «generatedMemberComment» protected boolean addFixedChild(org.eclipse.gef.EditPart childEditPart) { -«FOR label:getInnerFixedLabels(it)»«var childViewmap = label.viewmap as ParentAssignedViewmap» - if (childEditPart instanceof «xptEditPartFactory.getEditPartQualifiedClassName(label)») { - ((«xptEditPartFactory.getEditPartQualifiedClassName(label)») childEditPart).«xptTextAware.labelSetterName(childViewmap)»(getPrimaryShape().«childViewmap.getterName»()); +«FOR label:getInnerFixedLabels(it)»«var childViewmap = label.viewmap as ParentAssignedViewmap» + if (childEditPart instanceof «xptEditPartFactory.getEditPartQualifiedClassName(label)») { + ((«xptEditPartFactory.getEditPartQualifiedClassName(label)») childEditPart).«xptTextAware.labelSetterName(childViewmap)»(getPrimaryShape().«childViewmap.getterName»()); return true; } -«ENDFOR» +«ENDFOR» -«FOR compartment : getPinnedCompartments(it)»«var childViewmap = compartment.viewmap as ParentAssignedViewmap» +«FOR compartment : getPinnedCompartments(it)»«var childViewmap = compartment.viewmap as ParentAssignedViewmap» - if (childEditPart instanceof «compartment.getEditPartQualifiedClassName()») { - org.eclipse.draw2d.IFigure pane = getPrimaryShape().«childViewmap.getterName»(); + if (childEditPart instanceof «compartment.getEditPartQualifiedClassName()») { + org.eclipse.draw2d.IFigure pane = getPrimaryShape().«childViewmap.getterName»(); setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way - pane.add(((«compartment.getEditPartQualifiedClassName()») childEditPart).getFigure()); + pane.add(((«compartment.getEditPartQualifiedClassName()») childEditPart).getFigure()); return true; } -«ENDFOR» +«ENDFOR» -«FOR child:getSideAffixedChildren(it)» - ««« BEGIN PapyrusGencode - ««« adding IF else end in order to take in account the case where a specific locator is added +«FOR child:getSideAffixedChildren(it)» + ««« BEGIN PapyrusGencode + ««« adding IF else end in order to take in account the case where a specific locator is added - «IF it.eResource.allContents.filter(typeof (SpecificLocator)).filter[v | v.genChildSideAffixedNode.contains(child)].size !=0» - «FOR extendedObject : it.eResource.allContents.filter(typeof (SpecificLocator)).filter[v |v.genChildSideAffixedNode.contains(child)].toIterable» - «genSpecificLocator(extendedObject,child)» - «ENDFOR» + «IF it.eResource.allContents.filter(typeof (SpecificLocator)).filter[v | v.genChildSideAffixedNode.contains(child)].size !=0» + «FOR extendedObject : it.eResource.allContents.filter(typeof (SpecificLocator)).filter[v |v.genChildSideAffixedNode.contains(child)].toIterable» + «genSpecificLocator(extendedObject,child)» + «ENDFOR» - «ELSE» - «««END PapyrusGencode«ENDREM - if (childEditPart instanceof «child.getEditPartQualifiedClassName()») { - org.eclipse.gmf.runtime.diagram.ui.figures.BorderItemLocator locator = new org.eclipse.gmf.runtime.diagram.ui.figures.BorderItemLocator(getMainFigure(), org.eclipse.draw2d.PositionConstants.«child.preferredSideName»); - getBorderedFigure().getBorderItemContainer().add(((«child.getEditPartQualifiedClassName()») childEditPart).getFigure(), locator); + «ELSE» + «««END PapyrusGencode«ENDREM + if (childEditPart instanceof «child.getEditPartQualifiedClassName()») { + org.eclipse.gmf.runtime.diagram.ui.figures.BorderItemLocator locator = new org.eclipse.gmf.runtime.diagram.ui.figures.BorderItemLocator(getMainFigure(), org.eclipse.draw2d.PositionConstants.«child.preferredSideName»); + getBorderedFigure().getBorderItemContainer().add(((«child.getEditPartQualifiedClassName()») childEditPart).getFigure(), locator); return true; } - ««« BEGIN PapyrusGencode - «ENDIF» - «««END PapyrusGencode -«ENDFOR» + ««« BEGIN PapyrusGencode + «ENDIF» + «««END PapyrusGencode +«ENDFOR» return false; } ''' @@ -140,17 +140,17 @@ override addFixedChild (GenNode it)''' ''' override def setLineWidth(GenNode it) ''' - «generatedMemberComment» + «generatedMemberComment» protected void setLineWidth(int width) { -««« if (primaryShape instanceof org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure) { -««« ((org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure) primaryShape).setLineWidth(«IF getDiagram().isPixelMapMode()»width«ELSE»getMapMode().DPtoLP(width)«ENDIF»); -««« } +««« if (primaryShape instanceof org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure) { +««« ((org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure) primaryShape).setLineWidth(«IF getDiagram().isPixelMapMode()»width«ELSE»getMapMode().DPtoLP(width)«ENDIF»); +««« } super.setLineWidth(width); } ''' override def setLineStyle(GenNode it) ''' - «generatedMemberComment» + «generatedMemberComment» protected void setLineType(int style) { if (primaryShape instanceof org.eclipse.papyrus.infra.gmfdiag.common.figure.node.IPapyrusNodeFigure) { ((org.eclipse.papyrus.infra.gmfdiag.common.figure.node.IPapyrusNodeFigure) primaryShape).setLineStyle(style); @@ -159,110 +159,110 @@ override addFixedChild (GenNode it)''' ''' override createFigure(GenNode it) ''' - «generatedMemberComment( + «generatedMemberComment( 'Creates figure for this edit part.\n' + '\n' + 'Body of this method does not depend on settings in generation model\n' + 'so you may safely remove <i>generated</i> tag and modify it.\n' - )» - protected org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure create«IF hasBorderItems(it)»Main«ELSE»Node«ENDIF»Figure() { - «IF it instanceof GenChildSideAffixedNode» + )» + protected org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure create«IF hasBorderItems(it)»Main«ELSE»Node«ENDIF»Figure() { + «IF it instanceof GenChildSideAffixedNode» org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure figure = createNodePlate(); figure.setLayoutManager(new org.eclipse.draw2d.StackLayout()); org.eclipse.draw2d.IFigure shape = createNodeShape(); figure.add(shape); contentPane = setupContentPane(shape); return figure; - «ELSE» + «ELSE» return new org.eclipse.papyrus.infra.gmfdiag.common.figure.node.SelectableBorderedNodeFigure(createMainFigureWithSVG()); - «ENDIF» + «ENDIF» } ''' // override createNodePlate (GenNode it)''' -// «generatedMemberComment» +// «generatedMemberComment» // protected org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure createNodePlate() { -// String prefElementId="«elementType.displayName»"; -// org.eclipse.jface.preference.IPreferenceStore store =«getDiagram().editorGen.plugin.getActivatorQualifiedClassName()».getInstance().getPreferenceStore(); +// String prefElementId="«elementType.displayName»"; +// org.eclipse.jface.preference.IPreferenceStore store =«getDiagram().editorGen.plugin.getActivatorQualifiedClassName()».getInstance().getPreferenceStore(); // String preferenceConstantWitdh=org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId, org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper.WIDTH); // String preferenceConstantHeight=org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId, org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper.HEIGHT); // org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure result = new org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure(store.getInt(preferenceConstantWitdh), store.getInt(preferenceConstantHeight)); // -// «setupNodePlate(it)» +// «setupNodePlate(it)» // return result; // } // ''' override createNodePlate(GenNode it) ''' - «generatedMemberComment» - «IF it.eResource.allContents.filter(typeof(SpecificNodePlate)).filter[v |v.editParts.contains(it) && v.nodePlateQualifiedName!=null].size != 0» - «val editPart = it.eResource.allContents.filter(typeof(SpecificNodePlate)).filter[v |v.editParts.contains(it) && v.nodePlateQualifiedName!=null].head» + «generatedMemberComment» + «IF it.eResource.allContents.filter(typeof(SpecificNodePlate)).filter[v |v.editParts.contains(it) && v.nodePlateQualifiedName!=null].size != 0» + «val editPart = it.eResource.allContents.filter(typeof(SpecificNodePlate)).filter[v |v.editParts.contains(it) && v.nodePlateQualifiedName!=null].head» protected org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure createNodePlate() { - «editPart.nodePlateQualifiedName» result = new «editPart.nodePlateQualifiedName»(«IF getDiagram().isPixelMapMode()»«defaultSizeWidth(viewmap, 40)», «defaultSizeHeight(viewmap, 40)»«ELSE»getMapMode().DPtoLP(«defaultSizeWidth(viewmap, 40)»), getMapMode().DPtoLP(«defaultSizeHeight(viewmap, 40)»)«ENDIF»); - «setupNodePlate» + «editPart.nodePlateQualifiedName» result = new «editPart.nodePlateQualifiedName»(«IF getDiagram().isPixelMapMode()»«defaultSizeWidth(viewmap, 40)», «defaultSizeHeight(viewmap, 40)»«ELSE»getMapMode().DPtoLP(«defaultSizeWidth(viewmap, 40)»), getMapMode().DPtoLP(«defaultSizeHeight(viewmap, 40)»)«ENDIF»); + «setupNodePlate» return result; } - «««END: BEGIN: PapyrusGenCode - «ELSE» - ««« «super.createNodePlate(it)» - ««« By default node edit part are now RoundedRectangleNodePlateFigure + «««END: BEGIN: PapyrusGenCode + «ELSE» + ««« «super.createNodePlate(it)» + ««« By default node edit part are now RoundedRectangleNodePlateFigure protected org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure createNodePlate() { - org.eclipse.papyrus.infra.gmfdiag.common.figure.node.RoundedRectangleNodePlateFigure result = new org.eclipse.papyrus.infra.gmfdiag.common.figure.node.RoundedRectangleNodePlateFigure(«IF getDiagram().isPixelMapMode()»«defaultSizeWidth(viewmap, 40)», «defaultSizeHeight(viewmap, 40)»«ELSE»getMapMode().DPtoLP(«defaultSizeWidth(viewmap, 40)»), getMapMode().DPtoLP(«defaultSizeHeight(viewmap, 40)»)«ENDIF»); - «setupNodePlate» + org.eclipse.papyrus.infra.gmfdiag.common.figure.node.RoundedRectangleNodePlateFigure result = new org.eclipse.papyrus.infra.gmfdiag.common.figure.node.RoundedRectangleNodePlateFigure(«IF getDiagram().isPixelMapMode()»«defaultSizeWidth(viewmap, 40)», «defaultSizeHeight(viewmap, 40)»«ELSE»getMapMode().DPtoLP(«defaultSizeWidth(viewmap, 40)»), getMapMode().DPtoLP(«defaultSizeHeight(viewmap, 40)»)«ENDIF»); + «setupNodePlate» return result; } - «ENDIF» + «ENDIF» ''' override borderItemSelectionEditPolicy(GenNode it)''' - «IF hasBorderItems(it)» + «IF hasBorderItems(it)» org.eclipse.gmf.runtime.notation.View childView = (org.eclipse.gmf.runtime.notation.View) child.getModel(); - String vid = «getVisualIDMethodCall(getDiagram())»(childView); + String vid = «getVisualIDMethodCall(getDiagram())»(childView); if (vid != null) { switch (vid) { - «IF getExternalLabels(it).size > 0» - «FOR nextLabel : getExternalLabels(it) » - «caseVisualID(nextLabel)» - «ENDFOR» - return «borderItemSelectionEP(it)»; - «ENDIF» - «IF getSideAffixedChildren(it).size > 0» - «FOR nextBorderItem : getSideAffixedChildren(it)» - «caseVisualID(nextBorderItem)» - «ENDFOR» - ««« BEGIN PapyrusGenCode - ««« The purprose is to add replace GMF edit prolicy by an new editPolicy that allows to resize BorderItem + «IF getExternalLabels(it).size > 0» + «FOR nextLabel : getExternalLabels(it) » + «caseVisualID(nextLabel)» + «ENDFOR» + return «borderItemSelectionEP(it)»; + «ENDIF» + «IF getSideAffixedChildren(it).size > 0» + «FOR nextBorderItem : getSideAffixedChildren(it)» + «caseVisualID(nextBorderItem)» + «ENDFOR» + ««« BEGIN PapyrusGenCode + ««« The purprose is to add replace GMF edit prolicy by an new editPolicy that allows to resize BorderItem return new org.eclipse.papyrus.uml.diagram.common.editpolicies.BorderItemResizableEditPolicy(); - ««« END PapyrusGenCode - «ENDIF» + ««« END PapyrusGenCode + «ENDIF» } } -«ENDIF» +«ENDIF» ''' override createLayoutEditPolicyBody_FLOW_LAYOUT(GenNode it) ''' org.eclipse.gmf.runtime.diagram.ui.editpolicies.FlowLayoutEditPolicy lep = new org.eclipse.gmf.runtime.diagram.ui.editpolicies.FlowLayoutEditPolicy() { - «IF hasBorderItems(it)» - «extraLineBreak» - «overrideC» + «IF hasBorderItems(it)» + «extraLineBreak» + «overrideC» protected org.eclipse.gef.EditPolicy createChildEditPolicy(org.eclipse.gef.EditPart child) { - «borderItemSelectionEditPolicy()» + «borderItemSelectionEditPolicy()» return super.createChildEditPolicy(child); } - «ENDIF» + «ENDIF» - «overrideC» + «overrideC» protected org.eclipse.gef.commands.Command createAddCommand(org.eclipse.gef.EditPart child, org.eclipse.gef.EditPart after) { return null; } - «overrideC» + «overrideC» protected org.eclipse.gef.commands.Command createMoveChildCommand(org.eclipse.gef.EditPart child, org.eclipse.gef.EditPart after) { return null; } - «overrideC» + «overrideC» protected org.eclipse.gef.commands.Command getCreateCommand(org.eclipse.gef.requests.CreateRequest request) { return null; } @@ -273,9 +273,9 @@ override borderItemSelectionEditPolicy(GenNode it)''' override createLayoutEditPolicyBody_DEFAULT(GenNode it) ''' org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy lep = new org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy() { - «overrideC» + «overrideC» protected org.eclipse.gef.EditPolicy createChildEditPolicy(org.eclipse.gef.EditPart child) { - «borderItemSelectionEditPolicy(it)» + «borderItemSelectionEditPolicy(it)» org.eclipse.gef.EditPolicy result = child.getEditPolicy(org.eclipse.gef.EditPolicy.PRIMARY_DRAG_ROLE); if (result == null) { result = new org.eclipse.gef.editpolicies.NonResizableEditPolicy(); @@ -283,12 +283,12 @@ override borderItemSelectionEditPolicy(GenNode it)''' return result; } - «overrideC» + «overrideC» protected org.eclipse.gef.commands.Command getMoveChildrenCommand(org.eclipse.gef.Request request) { return null; } - «overrideC» + «overrideC» protected org.eclipse.gef.commands.Command getCreateCommand(org.eclipse.gef.requests.CreateRequest request) { return null; } @@ -302,7 +302,7 @@ override borderItemSelectionEditPolicy(GenNode it)''' //BEGIN: PapyrusGenCode //definition of the inheritance -def specifyInheritance (ExtendedGenView it)'''«superOwnedEditPart»''' +def specifyInheritance (ExtendedGenView it)'''«superOwnedEditPart»''' //END: PapyrusGenCode @@ -313,10 +313,10 @@ def genSpecificLocator(ToolEntry it, GenChildSideAffixedNode child) '''''' def genSpecificLocator(GenNavigatorChildReference it,GenChildSideAffixedNode child)'''''' def genSpecificLocator(SpecificLocator it, GenChildSideAffixedNode child)''' -//Papyrus Gencode :«it.comment» - if (childEditPart instanceof «child.getEditPartQualifiedClassName()») { - org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator locator = new «it.classpath»(getMainFigure(), org.eclipse.draw2d.PositionConstants.«child.preferredSideName»); - getBorderedFigure().getBorderItemContainer().add(((«child.getEditPartQualifiedClassName()») childEditPart).getFigure(), locator); +//Papyrus Gencode :«it.comment» + if (childEditPart instanceof «child.getEditPartQualifiedClassName()») { + org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator locator = new «it.classpath»(getMainFigure(), org.eclipse.draw2d.PositionConstants.«child.preferredSideName»); + getBorderedFigure().getBorderItemContainer().add(((«child.getEditPartQualifiedClassName()») childEditPart).getFigure(), locator); return true; } @@ -325,7 +325,7 @@ def genSpecificLocator(SpecificLocator it, GenChildSideAffixedNode child)''' override def borderItemSelectionEP(GenNode it) ''' new org.eclipse.gmf.runtime.diagram.ui.editpolicies.BorderItemSelectionEditPolicy() { - «overrideC» + «overrideC» protected java.util.List<?> createSelectionHandles() { org.eclipse.gef.handles.MoveHandle mh = new org.eclipse.gef.handles.MoveHandle((org.eclipse.gef.GraphicalEditPart) getHost()); mh.setBorder(null); @@ -338,7 +338,7 @@ def genSpecificLocator(SpecificLocator it, GenChildSideAffixedNode child)''' //Overwrite an existing method to set the preference value in the editpart //def genPreferredValue (GenNode it)''' // -// «generatedMemberComment» +// «generatedMemberComment» // @Override // public Object getPreferredValue(org.eclipse.emf.ecore.EStructuralFeature feature) { // org.eclipse.jface.preference.IPreferenceStore preferenceStore = (org.eclipse.jface.preference.IPreferenceStore) getDiagramPreferencesHint() @@ -350,13 +350,13 @@ def genSpecificLocator(SpecificLocator it, GenChildSideAffixedNode child)''' // .getFillStyle_FillColor()){ // String prefColor = null; // if (feature == org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getLineStyle_LineColor()) { -// prefColor = org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper.getElementConstant("«elementType.displayName»", org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper.COLOR_LINE); +// prefColor = org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper.getElementConstant("«elementType.displayName»", org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper.COLOR_LINE); // } else if (feature == org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE // .getFontStyle_FontColor()) { -// prefColor = org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper.getElementConstant("«elementType.displayName»", org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper.COLOR_FONT); +// prefColor = org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper.getElementConstant("«elementType.displayName»", org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper.COLOR_FONT); // } else if (feature == org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE // .getFillStyle_FillColor()) { -// prefColor = org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper.getElementConstant("«elementType.displayName»", org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper.COLOR_FILL); +// prefColor = org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper.getElementConstant("«elementType.displayName»", org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper.COLOR_FILL); // } // result = org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities // .RGBToInteger(org.eclipse.jface.preference.PreferenceConverter @@ -365,7 +365,7 @@ def genSpecificLocator(SpecificLocator it, GenChildSideAffixedNode child)''' // } else if (feature == org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE // .getFillStyle_Transparency() || feature == org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE // .getFillStyle_Gradient()) { -// String prefGradient = org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper.getElementConstant("«elementType.displayName»", org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper.COLOR_GRADIENT); +// String prefGradient = org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper.getElementConstant("«elementType.displayName»", org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper.COLOR_GRADIENT); // org.eclipse.papyrus.infra.gmfdiag.preferences.utils.GradientPreferenceConverter gradientPreferenceConverter = new org.eclipse.papyrus.infra.gmfdiag.preferences.utils.GradientPreferenceConverter( // preferenceStore.getString(prefGradient)); // if(feature == org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE @@ -390,13 +390,13 @@ def genSpecificLocator(SpecificLocator it, GenChildSideAffixedNode child)''' //CreateGenerator to refresh figure by taking account of event of UML element or graphical element def specificHandleNotificationEvent (GenNode it) ''' - «IF it.eResource.allContents.filter(typeof (ExtendedGenView)).filter[v |v.genView.contains(it)].size != 0» + «IF it.eResource.allContents.filter(typeof (ExtendedGenView)).filter[v |v.genView.contains(it)].size != 0» /** *Papyrus codeGen *@generated **/ protected void handleNotificationEvent(org.eclipse.emf.common.notify.Notification event) { - «IF it.labels.filter(typeof(GenExternalNodeLabel)).size != 0» + «IF it.labels.filter(typeof(GenExternalNodeLabel)).size != 0» /* * when a node have external node labels, the methods refreshChildren() remove the EditPart corresponding to the Label from the EditPart * Registry. After that, we can't reset the visibility to true (using the Show/Hide Label Action)! @@ -405,33 +405,33 @@ def specificHandleNotificationEvent (GenNode it) ''' Object notifier = event.getNotifier(); java.util.List<?> modelChildren = ((org.eclipse.gmf.runtime.notation.View)getModel()).getChildren(); if (false == notifier instanceof org.eclipse.gmf.runtime.notation.Edge - ««« see Bug 463769 + ««« see Bug 463769 && false == notifier instanceof org.eclipse.gmf.runtime.notation.BasicCompartment) { if(modelChildren.contains(event.getNotifier())) { return; } } } - «ENDIF» + «ENDIF» super.handleNotificationEvent(event); - «FOR extendedObject : it.eResource.allContents.filter(typeof (ExtendedGenView)).filter[v |v.genView.contains(it)].toIterable» - «IF extendedObject.propRefreshHook !=null» - «specificHandleNotificationEventBody(extendedObject.propRefreshHook)» - «ENDIF» - «ENDFOR» + «FOR extendedObject : it.eResource.allContents.filter(typeof (ExtendedGenView)).filter[v |v.genView.contains(it)].toIterable» + «IF extendedObject.propRefreshHook !=null» + «specificHandleNotificationEventBody(extendedObject.propRefreshHook)» + «ENDIF» + «ENDFOR» } - «ENDIF» + «ENDIF» ''' def specificHandleNotificationEventBody(PropertyRefreshHook it)''' -«IF (it.comment !=null)» -//«it.comment» -«ENDIF» +«IF (it.comment !=null)» +//«it.comment» +«ENDIF» if (resolveSemanticElement() != null) { -if(«it.triggeringCondition»){ - «it.action»; +if(«it.triggeringCondition»){ + «it.action»; refreshVisuals(); } } @@ -439,27 +439,27 @@ if(«it.triggeringCondition»){ //END: PapyrusGenCode override addBorderItem (GenNode it)''' - «IF getExternalLabels(it).size > 0» - «generatedMemberComment» + «IF getExternalLabels(it).size > 0» + «generatedMemberComment» protected void addBorderItem(org.eclipse.draw2d.IFigure borderItemContainer, org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart borderItemEditPart) { - «IF getExternalLabelsWithoutSpecificLocator(it).size > 0» - if («FOR label : getExternalLabelsWithoutSpecificLocator(it) SEPARATOR ' || '»borderItemEditPart instanceof «label.getEditPartQualifiedClassName()»«ENDFOR») { + «IF getExternalLabelsWithoutSpecificLocator(it).size > 0» + if («FOR label : getExternalLabelsWithoutSpecificLocator(it) SEPARATOR ' || '»borderItemEditPart instanceof «label.getEditPartQualifiedClassName()»«ENDFOR») { org.eclipse.gmf.runtime.diagram.ui.figures.BorderItemLocator locator = new org.eclipse.gmf.runtime.diagram.ui.figures.BorderItemLocator(getMainFigure(), org.eclipse.draw2d.PositionConstants.SOUTH); locator.setBorderItemOffset(new org.eclipse.draw2d.geometry.Dimension(-20, -20)); borderItemContainer.add(borderItemEditPart.getFigure(), locator); } else - «ENDIF» - «FOR label : getExternalLabelsWithSpecificLocator(it)» - if (borderItemEditPart instanceof «label.getEditPartQualifiedClassName()») { - org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator locator = new «getSpecificLocator(label)»(getMainFigure()); + «ENDIF» + «FOR label : getExternalLabelsWithSpecificLocator(it)» + if (borderItemEditPart instanceof «label.getEditPartQualifiedClassName()») { + org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator locator = new «getSpecificLocator(label)»(getMainFigure()); borderItemContainer.add(borderItemEditPart.getFigure(), locator); } else - «ENDFOR» + «ENDFOR» { super.addBorderItem(borderItemContainer, borderItemEditPart); } } - «ENDIF» + «ENDIF» ''' override setupNodePlate (GenNode it) '''''' @@ -470,20 +470,20 @@ def setupNodePlate (GenChildSideAffixedNode it)''' ''' override def getTargetEditPartMethod(GenNode it) ''' - «generatedMemberComment» + «generatedMemberComment» public org.eclipse.gef.EditPart getTargetEditPart(org.eclipse.gef.Request request) { if (request instanceof org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewAndElementRequest) { org.eclipse.gmf.runtime.diagram.core.edithelpers.CreateElementRequestAdapter adapter = ((org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewAndElementRequest) request).getViewAndElementDescriptor().getCreateElementRequestAdapter(); org.eclipse.gmf.runtime.emf.type.core.IElementType type = (org.eclipse.gmf.runtime.emf.type.core.IElementType) adapter.getAdapter(org.eclipse.gmf.runtime.emf.type.core.IElementType.class); - «FOR compartment : compartments» - «IF listCompartmentHasChildren(compartment)» - «FOR childNode : compartment.childNodes» - if («xptElementTypes.className(it.diagram)».isKindOf(type, «xptElementTypes.accessElementType(childNode)»)) { - return getChildBySemanticHint(«xptVisualIDRegistry.typeMethodCall(compartment)»); + «FOR compartment : compartments» + «IF listCompartmentHasChildren(compartment)» + «FOR childNode : compartment.childNodes» + if («xptElementTypes.className(it.diagram)».isKindOf(type, «xptElementTypes.accessElementType(childNode)»)) { + return getChildBySemanticHint(«xptVisualIDRegistry.typeMethodCall(compartment)»); } - «ENDFOR» - «ENDIF» - «ENDFOR» + «ENDFOR» + «ENDIF» + «ENDFOR» } return super.getTargetEditPart(request); } diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/editparts/NodeLabelEditPart.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/editparts/NodeLabelEditPart.xtend index 75abc3bdb1d..9ae6651e8f6 100644 --- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/editparts/NodeLabelEditPart.xtend +++ b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/editparts/NodeLabelEditPart.xtend @@ -35,17 +35,17 @@ import org.eclipse.gmf.codegen.gmfgen.GenDiagram override handleNotificationEventBody(GenNodeLabel it) ''' Object feature = event.getFeature(); - «IF isStoringChildPositions(node)» - «xptEditpartsCommon.handleBounds(it)» - «ENDIF» - «xptEditpartsCommon.handleText(it)» - ««« START Papyrus Code - «IF elementIcon» + «IF isStoringChildPositions(node)» + «xptEditpartsCommon.handleBounds(it)» + «ENDIF» + «xptEditpartsCommon.handleText(it)» + ««« START Papyrus Code + «IF elementIcon» if(event.getNewValue() instanceof org.eclipse.emf.ecore.EAnnotation && org.eclipse.papyrus.infra.emf.appearance.helper.VisualInformationPapyrusConstants.DISPLAY_NAMELABELICON.equals(((org.eclipse.emf.ecore.EAnnotation)event.getNewValue()).getSource())){ refreshLabel(); } - «ENDIF» - ««« End Papyrus Code + «ENDIF» + ««« End Papyrus Code super.handleNotificationEvent(event); ''' diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/editparts/TextAware.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/editparts/TextAware.xtend index 9319f3afdab..ed278f2f8cc 100644 --- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/editparts/TextAware.xtend +++ b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/editparts/TextAware.xtend @@ -47,126 +47,126 @@ import xpt.providers.ElementTypes @Inject ElementTypes xptElementTypes; override fields(GenCommonBase it)''' - «generatedMemberComment» + «generatedMemberComment» private org.eclipse.gef.tools.DirectEditManager manager; - «generatedMemberComment» + «generatedMemberComment» private org.eclipse.gmf.runtime.common.ui.services.parser.IParser parser; - «generatedMemberComment» + «generatedMemberComment» private java.util.List<?> parserElements; - «generatedMemberComment» + «generatedMemberComment» private String defaultText; - ««« BEGIN: PapyrusGenCode - ««« Add attributes to manage extended editors - «generatedMemberComment('direct edition mode (default, undefined, registered editor, etc.)')» + ««« BEGIN: PapyrusGenCode + ««« Add attributes to manage extended editors + «generatedMemberComment('direct edition mode (default, undefined, registered editor, etc.)')» protected int directEditionMode = org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition.UNDEFINED_DIRECT_EDITOR; - «generatedMemberComment('configuration from a registered edit dialog')» + «generatedMemberComment('configuration from a registered edit dialog')» protected org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration configuration; - ««« END: BEGIN: PapyrusGenCode + ««« END: BEGIN: PapyrusGenCode ''' override methods(GenCommonBase it, boolean needsRefreshBounds, boolean readOnly, boolean useElementIcon, Viewmap viewmap, LabelModelFacet modelFacet, GenCommonBase host, GenDiagram diagram) ''' - «getLabelTextHelper(it)» + «getLabelTextHelper(it)» - «setLabelTextHelper(it)» + «setLabelTextHelper(it)» - «getLabelIconHelper(it)» + «getLabelIconHelper(it)» - «setLabelIconHelper(it)» + «setLabelIconHelper(it)» - « labelSetter(it)» + « labelSetter(it)» - « getModelChildren(it)» + « getModelChildren(it)» - « getChildBySemanticHint(it)» -««« ITEMIS CHANGES - « setParser (it)» -««« ITEMIS CHANGES END - « getParserElement(it,modelFacet)» + « getChildBySemanticHint(it)» +««« ITEMIS CHANGES + « setParser (it)» +««« ITEMIS CHANGES END + « getParserElement(it,modelFacet)» - « getLabelIcon(it,useElementIcon, diagram)» + « getLabelIcon(it,useElementIcon, diagram)» - « getLabelText(it)» + « getLabelText(it)» - « setLabelText(it,diagram)» + « setLabelText(it,diagram)» - « getEditText(it)» + « getEditText(it)» - « isEditable(it,readOnly)» + « isEditable(it,readOnly)» - « getEditTextValidator(it)» + « getEditTextValidator(it)» - « getCompletionProcessor(it)» + « getCompletionProcessor(it)» - « getParserOptions(it)» + « getParserOptions(it)» - « getParser(it,modelFacet, diagram, host)» + « getParser(it,modelFacet, diagram, host)» - « getManager(it,diagram)» + « getManager(it,diagram)» - « setManager(it)» + « setManager(it)» - « performDirectEdit(it)» + « performDirectEdit(it)» - « performDirectEditAtPoint(it)» + « performDirectEditAtPoint(it)» - « performDirectEditWithInitialChar(it)» + « performDirectEditWithInitialChar(it)» - « performDirectEditRequest(it,diagram)» + « performDirectEditRequest(it,diagram)» - « initializeDirectEditManager(it)» + « initializeDirectEditManager(it)» - « refreshVisuals(it,needsRefreshBounds)» + « refreshVisuals(it,needsRefreshBounds)» - « refreshLabel(it,diagram)» + « refreshLabel(it,diagram)» - « refreshUnderline(it)» + « refreshUnderline(it)» - « refreshStrikeThrough(it)» + « refreshStrikeThrough(it)» - « refreshFont(it)» + « refreshFont(it)» - « setFontColor(it)» + « setFontColor(it)» - « addSemanticListeners(it)» + « addSemanticListeners(it)» - « removeSemanticListeners(it)» + « removeSemanticListeners(it)» - « getAccessibleEditPart(it)» + « getAccessibleEditPart(it)» - « getFontStyleOwnerView(it,viewmap)» + « getFontStyleOwnerView(it,viewmap)» - ««« BEGIN: PapyrusGenCode - ««« Add extended editors management for direct edit - « getDirectEditionType(it,readOnly)» + ««« BEGIN: PapyrusGenCode + ««« Add extended editors management for direct edit + « getDirectEditionType(it,readOnly)» - « checkExtendedEditor(it)» + « checkExtendedEditor(it)» - « checkDefaultEdition(it)» + « checkDefaultEdition(it)» - « initExtendedEditorConfiguration(it)» + « initExtendedEditorConfiguration(it)» - « updateExtendedEditorConfiguration(it)» + « updateExtendedEditorConfiguration(it)» - « performDefaultDirectEditorEdit(it)» + « performDefaultDirectEditorEdit(it)» - «««END: PapyrusGenCode + «««END: PapyrusGenCode ''' def labelSetterName(ParentAssignedViewmap it) ''' -«IF setterName != null»«setterName»«ELSE»setLabel«ENDIF» +«IF setterName != null»«setterName»«ELSE»setLabel«ENDIF» ''' override labelSetterName(Viewmap it)'''setLabel''' override getLabelTextHelper (GenCommonBase it)''' - « generatedMemberComment» + « generatedMemberComment» protected String getLabelTextHelper(org.eclipse.draw2d.IFigure figure) { if (figure instanceof org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) { return ((org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) figure).getText(); @@ -179,7 +179,7 @@ override getLabelTextHelper (GenCommonBase it)''' ''' override setLabelTextHelper (GenCommonBase it)''' - «generatedMemberComment» + «generatedMemberComment» protected void setLabelTextHelper(org.eclipse.draw2d.IFigure figure, String text) { if (figure instanceof org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) { ((org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) figure).setText(text); @@ -192,7 +192,7 @@ override setLabelTextHelper (GenCommonBase it)''' ''' override getLabelIconHelper (GenCommonBase it)''' - «generatedMemberComment» + «generatedMemberComment» protected org.eclipse.swt.graphics.Image getLabelIconHelper(org.eclipse.draw2d.IFigure figure) { if (figure instanceof org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) { return ((org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) figure).getIcon(); @@ -205,7 +205,7 @@ override getLabelIconHelper (GenCommonBase it)''' ''' override setLabelIconHelper (GenCommonBase it)''' - «generatedMemberComment» + «generatedMemberComment» protected void setLabelIconHelper(org.eclipse.draw2d.IFigure figure, org.eclipse.swt.graphics.Image icon) { if (figure instanceof org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) { ((org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) figure).setIcon(icon); @@ -218,8 +218,8 @@ override setLabelIconHelper (GenCommonBase it)''' ''' override labelSetter (GenCommonBase it)''' - «generatedMemberComment» - public void « labelSetterName (viewmap)»(« labelSetterFigureClassName(viewmap)» figure) { + «generatedMemberComment» + public void « labelSetterName (viewmap)»(« labelSetterFigureClassName(viewmap)» figure) { unregisterVisuals(); setFigure(figure); defaultText = getLabelTextHelper(figure); @@ -229,11 +229,11 @@ override labelSetter (GenCommonBase it)''' ''' def labelSetterFigureClassName (ParentAssignedViewmap it)''' - «IF figureQualifiedClassName != null» - «figureQualifiedClassName» - «ELSE» + «IF figureQualifiedClassName != null» + «figureQualifiedClassName» + «ELSE» org.eclipse.draw2d.IFigure - «ENDIF» + «ENDIF» ''' override labelSetterFigureClassName (Viewmap it)''' @@ -241,33 +241,33 @@ override labelSetterFigureClassName (Viewmap it)''' ''' override getModelChildren (GenCommonBase it)''' - «generatedMemberComment» + «generatedMemberComment» protected java.util.List<?> getModelChildren() { return java.util.Collections.EMPTY_LIST; } ''' override getChildBySemanticHint (GenCommonBase it)''' - «generatedMemberComment» + «generatedMemberComment» public org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart getChildBySemanticHint(String semanticHint) { return null; } ''' def setParser (GenCommonBase it)''' - «generatedMemberComment» + «generatedMemberComment» public void setParser(org.eclipse.gmf.runtime.common.ui.services.parser.IParser parser) { this.parser = parser; } ''' override getParserElement(GenCommonBase it, LabelModelFacet modelFacet) ''' - «generatedMemberComment» + «generatedMemberComment» protected org.eclipse.emf.ecore.EObject getParserElement() { - «IF modelFacet == null» + «IF modelFacet == null» org.eclipse.emf.ecore.EObject element = resolveSemanticElement(); return element != null ? element : (org.eclipse.gmf.runtime.notation.View) getModel(); - «ELSE»« getParserElement(modelFacet)»«ENDIF» + «ELSE»« getParserElement(modelFacet)»«ENDIF» } ''' @@ -280,20 +280,20 @@ def getParserElement (DesignLabelModelFacet it)''' ''' override getLabelIcon(GenCommonBase it,boolean useElementIcon, GenDiagram diagram ) ''' - «generatedMemberComment» + «generatedMemberComment» protected org.eclipse.swt.graphics.Image getLabelIcon() { - «IF useElementIcon» - ««« START: PapyrusGenCode + «IF useElementIcon» + ««« START: PapyrusGenCode return org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramEditPartsUtil.getIcon(getParserElement(), getViewer()); - ««« END: PapyrusGenCode - «ELSE» + ««« END: PapyrusGenCode + «ELSE» return null; - «ENDIF» + «ENDIF» } ''' override getLabelText (GenCommonBase it)''' - «generatedMemberComment» + «generatedMemberComment» protected String getLabelText() { String text = null; org.eclipse.emf.ecore.EObject parserElement = getParserElement(); @@ -310,25 +310,25 @@ override getLabelText (GenCommonBase it)''' ''' override setLabelText(GenCommonBase it, GenDiagram diagram) ''' - «generatedMemberComment» + «generatedMemberComment» public void setLabelText(String text) { setLabelTextHelper(getFigure(), text); Object pdEditPolicy = getEditPolicy(org.eclipse.gef.EditPolicy.PRIMARY_DRAG_ROLE); - if (pdEditPolicy instanceof «diagram.getTextSelectionEditPolicyQualifiedClassName()») { - ((«diagram.getTextSelectionEditPolicyQualifiedClassName()») pdEditPolicy).refreshFeedback(); + if (pdEditPolicy instanceof «diagram.getTextSelectionEditPolicyQualifiedClassName()») { + ((«diagram.getTextSelectionEditPolicyQualifiedClassName()») pdEditPolicy).refreshFeedback(); } Object sfEditPolicy = getEditPolicy(org.eclipse.gef.EditPolicy.SELECTION_FEEDBACK_ROLE); - if (sfEditPolicy instanceof «diagram.getTextSelectionEditPolicyQualifiedClassName()») { - ((«diagram.getTextSelectionEditPolicyQualifiedClassName()») sfEditPolicy).refreshFeedback(); + if (sfEditPolicy instanceof «diagram.getTextSelectionEditPolicyQualifiedClassName()») { + ((«diagram.getTextSelectionEditPolicyQualifiedClassName()») sfEditPolicy).refreshFeedback(); } } ''' override getEditText (GenCommonBase it)''' - «generatedMemberComment» + «generatedMemberComment» public String getEditText() { if (getParserElement() == null || getParser() == null) { - return ""; «nonNLS» + return ""; «nonNLS» } return getParser().getEditString( org.eclipse.papyrus.infra.gmfdiag.common.parsers.ParserUtil.getParserAdapter(getParserElement(), this), @@ -337,22 +337,22 @@ override getEditText (GenCommonBase it)''' ''' def isEditable(GenCommonBase it, boolean readOnly ) ''' - «generatedMemberComment» + «generatedMemberComment» protected boolean isEditable() { - «IF readOnly» + «IF readOnly» return false; - «ELSE» + «ELSE» return getParser() != null; - «ENDIF» + «ENDIF» } ''' override getEditTextValidator (GenCommonBase it)''' - «generatedMemberComment» + «generatedMemberComment» public org.eclipse.jface.viewers.ICellEditorValidator getEditTextValidator() { return new org.eclipse.jface.viewers.ICellEditorValidator() { - «overrideI» + «overrideI» public String isValid(final Object value) { if (value instanceof String) { final org.eclipse.emf.ecore.EObject element = getParserElement(); @@ -362,9 +362,9 @@ override getEditTextValidator (GenCommonBase it)''' (org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus) getEditingDomain().runExclusive( new org.eclipse.emf.transaction.RunnableWithResult.Impl<java.lang.Object>() { - «overrideI» + «overrideI» public void run() { - setResult(parser.isValidEditString(org.eclipse.papyrus.infra.gmfdiag.common.parsers.ParserUtil.getParserAdapter(getParserElement(), «editPartClassName».this), (String) value)); + setResult(parser.isValidEditString(org.eclipse.papyrus.infra.gmfdiag.common.parsers.ParserUtil.getParserAdapter(getParserElement(), «editPartClassName».this), (String) value)); } }); return valid.getCode() == org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus.EDITABLE ? null : valid.getMessage(); @@ -381,7 +381,7 @@ override getEditTextValidator (GenCommonBase it)''' ''' override getCompletionProcessor (GenCommonBase it)''' - «generatedMemberComment» + «generatedMemberComment» public org.eclipse.jface.text.contentassist.IContentAssistProcessor getCompletionProcessor() { if (getParserElement() == null || getParser() == null) { return null; @@ -391,47 +391,47 @@ override getCompletionProcessor (GenCommonBase it)''' ''' override getParserOptions (GenCommonBase it)''' - «generatedMemberComment» + «generatedMemberComment» public org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions getParserOptions() { return org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions.NONE; } ''' override getParser(GenCommonBase it, LabelModelFacet modelFacet, GenDiagram diagram , GenCommonBase host ) ''' - «generatedMemberComment» + «generatedMemberComment» public org.eclipse.gmf.runtime.common.ui.services.parser.IParser getParser() { if (parser == null) { - parser = org.eclipse.papyrus.infra.gmfdiag.common.parsers.ParserUtil.getParser(«xptElementTypes.accessElementType(host)», getParserElement(), this, VISUAL_ID); + parser = org.eclipse.papyrus.infra.gmfdiag.common.parsers.ParserUtil.getParser(«xptElementTypes.accessElementType(host)», getParserElement(), this, VISUAL_ID); } return parser; } ''' def getManager(GenCommonBase it,GenDiagram diagram) ''' - «generatedMemberComment» + «generatedMemberComment» protected org.eclipse.gef.tools.DirectEditManager getManager() { if (manager == null) { setManager(new org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager(this, org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager.getTextCellEditorClass(this), - «diagram.getEditPartFactoryQualifiedClassName()».getTextCellEditorLocator(this))); + «diagram.getEditPartFactoryQualifiedClassName()».getTextCellEditorLocator(this))); } return manager; } ''' override setManager (GenCommonBase it)''' - «generatedMemberComment» + «generatedMemberComment» protected void setManager(org.eclipse.gef.tools.DirectEditManager manager) { this.manager = manager; } ''' override performDirectEdit (GenCommonBase it)''' - «generatedMemberComment» + «generatedMemberComment» protected void performDirectEdit() { org.eclipse.swt.custom.BusyIndicator.showWhile(org.eclipse.swt.widgets.Display.getDefault(), new java.lang.Runnable() { - «overrideI» + «overrideI» public void run() { getManager().show(); } @@ -440,7 +440,7 @@ override performDirectEdit (GenCommonBase it)''' ''' def performDirectEditAtPoint (GenCommonBase it)''' - «generatedMemberComment» + «generatedMemberComment» protected void performDirectEdit(org.eclipse.draw2d.geometry.Point eventLocation) { if (getManager() instanceof org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager) { ((org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint()); @@ -449,7 +449,7 @@ def performDirectEditAtPoint (GenCommonBase it)''' ''' override performDirectEditWithInitialChar (GenCommonBase it)''' - «generatedMemberComment» + «generatedMemberComment» protected void performDirectEdit(char initialCharacter) { if (getManager() instanceof org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager) { ((org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager) getManager()).show(initialCharacter); @@ -460,7 +460,7 @@ override performDirectEditWithInitialChar (GenCommonBase it)''' ''' def performDirectEditRequest(GenCommonBase it, GenDiagram diagram ) ''' - «generatedMemberComment» + «generatedMemberComment» protected void performDirectEditRequest(org.eclipse.gef.Request request) { final org.eclipse.gef.Request theRequest = request; @@ -478,7 +478,7 @@ def performDirectEditRequest(GenCommonBase it, GenDiagram diagram ) ''' // Create default edit manager setManager(new org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager(this, org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager.getTextCellEditorClass(this), - «diagram.getEditPartFactoryQualifiedClassName()».getTextCellEditorLocator(this))); + «diagram.getEditPartFactoryQualifiedClassName()».getTextCellEditorLocator(this))); performDefaultDirectEditorEdit(theRequest); } else { configuration.preEditAction(resolveSemanticElement()); @@ -525,12 +525,12 @@ def performDirectEditRequest(GenCommonBase it, GenDiagram diagram ) ''' ''' def initializeDirectEditManager (GenCommonBase it)''' - «generatedMemberComment» + «generatedMemberComment» protected void initializeDirectEditManager(final org.eclipse.gef.Request request) { // initialize the direct edit manager try { getEditingDomain().runExclusive(new Runnable() { - «overrideI» + «overrideI» public void run() { if (isActive() && isEditable()) { if (request.getExtendedData().get( @@ -551,7 +551,7 @@ def initializeDirectEditManager (GenCommonBase it)''' ''' def refreshVisuals(GenCommonBase it, boolean needsRefreshBounds ) ''' - «generatedMemberComment» + «generatedMemberComment» protected void refreshVisuals() { super.refreshVisuals(); refreshLabel(); @@ -559,14 +559,14 @@ def refreshVisuals(GenCommonBase it, boolean needsRefreshBounds ) ''' refreshFontColor(); refreshUnderline(); refreshStrikeThrough(); - «IF needsRefreshBounds» + «IF needsRefreshBounds» refreshBounds(); - «ENDIF» + «ENDIF» } ''' override refreshLabel(GenCommonBase it , GenDiagram diagram )''' - «generatedMemberComment» + «generatedMemberComment» protected void refreshLabel() { org.eclipse.gef.EditPolicy maskLabelPolicy = getEditPolicy(org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY); if(maskLabelPolicy==null){ @@ -584,18 +584,18 @@ override refreshLabel(GenCommonBase it , GenDiagram diagram )''' } } Object pdEditPolicy = getEditPolicy(org.eclipse.gef.EditPolicy.PRIMARY_DRAG_ROLE); - if (pdEditPolicy instanceof «diagram.getTextSelectionEditPolicyQualifiedClassName()») { - ((«diagram.getTextSelectionEditPolicyQualifiedClassName()») pdEditPolicy).refreshFeedback(); + if (pdEditPolicy instanceof «diagram.getTextSelectionEditPolicyQualifiedClassName()») { + ((«diagram.getTextSelectionEditPolicyQualifiedClassName()») pdEditPolicy).refreshFeedback(); } Object sfEditPolicy = getEditPolicy(org.eclipse.gef.EditPolicy.SELECTION_FEEDBACK_ROLE); - if (sfEditPolicy instanceof «diagram.getTextSelectionEditPolicyQualifiedClassName()») { - ((«diagram.getTextSelectionEditPolicyQualifiedClassName()») sfEditPolicy).refreshFeedback(); + if (sfEditPolicy instanceof «diagram.getTextSelectionEditPolicyQualifiedClassName()») { + ((«diagram.getTextSelectionEditPolicyQualifiedClassName()») sfEditPolicy).refreshFeedback(); } } ''' override refreshUnderline (GenCommonBase it)''' - «generatedMemberComment» + «generatedMemberComment» protected void refreshUnderline() { org.eclipse.gmf.runtime.notation.FontStyle style = (org.eclipse.gmf.runtime.notation.FontStyle) getFontStyleOwnerView().getStyle( @@ -613,7 +613,7 @@ override refreshUnderline (GenCommonBase it)''' ''' override refreshStrikeThrough (GenCommonBase it)''' - «generatedMemberComment» + «generatedMemberComment» protected void refreshStrikeThrough() { org.eclipse.gmf.runtime.notation.FontStyle style = (org.eclipse.gmf.runtime.notation.FontStyle) getFontStyleOwnerView().getStyle( @@ -625,7 +625,7 @@ override refreshStrikeThrough (GenCommonBase it)''' ''' override refreshFont (GenCommonBase it)''' - «generatedMemberComment» + «generatedMemberComment» protected void refreshFont() { org.eclipse.gmf.runtime.notation.FontStyle style = (org.eclipse.gmf.runtime.notation.FontStyle) getFontStyleOwnerView().getStyle( @@ -641,20 +641,20 @@ override refreshFont (GenCommonBase it)''' ''' override setFontColor (GenCommonBase it)''' - «generatedMemberComment» + «generatedMemberComment» protected void setFontColor(org.eclipse.swt.graphics.Color color) { getFigure().setForegroundColor(color); } ''' override addSemanticListeners (GenCommonBase it)''' - «generatedMemberComment» + «generatedMemberComment» protected void addSemanticListeners() { if (getParser() instanceof org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser) { org.eclipse.emf.ecore.EObject element = resolveSemanticElement(); parserElements = ((org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser) getParser()).getSemanticElementsBeingParsed(element); for (int i = 0; i < parserElements.size(); i++) { - addListenerFilter("SemanticModel" + i, this, (org.eclipse.emf.ecore.EObject) parserElements.get(i)); «nonNLS» + addListenerFilter("SemanticModel" + i, this, (org.eclipse.emf.ecore.EObject) parserElements.get(i)); «nonNLS» } } else { super.addSemanticListeners(); @@ -663,11 +663,11 @@ override addSemanticListeners (GenCommonBase it)''' ''' override removeSemanticListeners (GenCommonBase it)''' - «generatedMemberComment» + «generatedMemberComment» protected void removeSemanticListeners() { if (parserElements != null) { for (int i = 0; i < parserElements.size(); i++) { - removeListenerFilter("SemanticModel" + i); «nonNLS» + removeListenerFilter("SemanticModel" + i); «nonNLS» } } else { super.removeSemanticListeners(); @@ -676,12 +676,12 @@ override removeSemanticListeners (GenCommonBase it)''' ''' override getAccessibleEditPart (GenCommonBase it)''' - «generatedMemberComment» + «generatedMemberComment» protected org.eclipse.gef.AccessibleEditPart getAccessibleEditPart() { if (accessibleEP == null) { accessibleEP = new AccessibleGraphicalEditPart() { - «overrideC» + «overrideC» public void getName(org.eclipse.swt.accessibility.AccessibleEvent e) { e.result = getLabelTextHelper(getFigure()); } @@ -692,13 +692,13 @@ override getAccessibleEditPart (GenCommonBase it)''' ''' override getFontStyleOwnerView(GenCommonBase it, Viewmap viewmap ) ''' - «generatedMemberComment» + «generatedMemberComment» private org.eclipse.gmf.runtime.notation.View getFontStyleOwnerView() { - «IF isFixedFont(viewmap)» + «IF isFixedFont(viewmap)» return (org.eclipse.gmf.runtime.notation.View) getModel(); - «ELSE» + «ELSE» return getPrimaryView(); - «ENDIF» + «ENDIF» } ''' @@ -714,10 +714,10 @@ def getDirectEditionType(GenCommonBase it, Boolean readOnly) ''' * @generated */ public int getDirectEditionType() { - «IF readOnly» + «IF readOnly» // The label is read-only (defined in GMFGen model) return org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition.NO_DIRECT_EDITION; - «ELSE» + «ELSE» if (checkExtendedEditor()) { initExtendedEditorConfiguration(); return org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition.EXTENDED_DIRECT_EDITOR; @@ -728,7 +728,7 @@ def getDirectEditionType(GenCommonBase it, Boolean readOnly) ''' // not a named element. no specific editor => do nothing return org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition.NO_DIRECT_EDITION; - «ENDIF» + «ENDIF» } ''' @@ -803,7 +803,7 @@ def performDefaultDirectEditorEdit (GenCommonBase it)''' try { getEditingDomain().runExclusive(new Runnable() { - «overrideI» + «overrideI» public void run() { if (isActive() && isEditable()) { if (theRequest.getExtendedData().get(org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/update/CanonicalUpdate.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/update/CanonicalUpdate.xtend index 7a8d7abc58b..c6048882313 100644 --- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/update/CanonicalUpdate.xtend +++ b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/update/CanonicalUpdate.xtend @@ -39,48 +39,48 @@ import xpt.editor.VisualIDRegistry @Inject VisualIDRegistry xptVisualIDRegistry; override def getFeaturesToSynchronizeMethod(GenContainerBase it) ''' - «IF getSemanticChildrenChildFeatures(it).size == 1» + «IF getSemanticChildrenChildFeatures(it).size == 1» - «generatedMemberComment» + «generatedMemberComment» protected org.eclipse.emf.ecore.EStructuralFeature getFeatureToSynchronize() { - return «xptMetaModel.MetaFeature(getSemanticChildrenContainmentFeatures(it).head)»; + return «xptMetaModel.MetaFeature(getSemanticChildrenContainmentFeatures(it).head)»; } - «ELSEIF getSemanticChildrenChildFeatures(it).size > 1» + «ELSEIF getSemanticChildrenChildFeatures(it).size > 1» - «generatedMemberComment» + «generatedMemberComment» protected java.util.Set<org.eclipse.emf.ecore.EStructuralFeature> getFeaturesToSynchronize() { if (myFeaturesToSynchronize == null) { myFeaturesToSynchronize = new java.util.HashSet<org.eclipse.emf.ecore.EStructuralFeature>(); - «FOR f : getSemanticChildrenContainmentFeatures(it)» - «addContainmentFeature(f)» - «ENDFOR» + «FOR f : getSemanticChildrenContainmentFeatures(it)» + «addContainmentFeature(f)» + «ENDFOR» } return myFeaturesToSynchronize; } - «ENDIF» + «ENDIF» ''' override def getSemanticChildrenListMethod(GenContainerBase it) ''' - «generatedMemberComment» + «generatedMemberComment» protected java.util.List<org.eclipse.emf.ecore.EObject> getSemanticChildrenList() { - «IF hasSemanticChildren(it)/*REVISIT: is there real need for this check - Generator seems to consult needsCanonicalEP, which in turns ensures there are semantic children?*/» + «IF hasSemanticChildren(it)/*REVISIT: is there real need for this check - Generator seems to consult needsCanonicalEP, which in turns ensures there are semantic children?*/» org.eclipse.gmf.runtime.notation.View viewObject = (org.eclipse.gmf.runtime.notation.View) getHost().getModel(); java.util.LinkedList<org.eclipse.emf.ecore.EObject> result = new java.util.LinkedList<org.eclipse.emf.ecore.EObject>(); - java.util.List<«nodeDescriptor.qualifiedClassName(it.diagram.editorGen.diagramUpdater)»> childDescriptors = «xptDiagramUpdater. - getSemanticChildrenMethodCall(it)»(viewObject); - for («nodeDescriptor.qualifiedClassName(it.diagram.editorGen.diagramUpdater)» d : childDescriptors) { + java.util.List<«nodeDescriptor.qualifiedClassName(it.diagram.editorGen.diagramUpdater)»> childDescriptors = «xptDiagramUpdater. + getSemanticChildrenMethodCall(it)»(viewObject); + for («nodeDescriptor.qualifiedClassName(it.diagram.editorGen.diagramUpdater)» d : childDescriptors) { result.add(d.getModelElement()); } return result; - «ELSE» + «ELSE» return java.util.Collections.EMPTY_LIST; - «ENDIF» + «ENDIF» } ''' override def refreshConnectionsBody(GenDiagram it) ''' - «Domain2Notation(it)» domain2NotationMap = new «Domain2Notation(it)»(); - java.util.Collection<«linkDescriptor.qualifiedClassName(editorGen.diagramUpdater)»> linkDescriptors = collectAllLinks(getDiagram(), domain2NotationMap); + «Domain2Notation(it)» domain2NotationMap = new «Domain2Notation(it)»(); + java.util.Collection<«linkDescriptor.qualifiedClassName(editorGen.diagramUpdater)»> linkDescriptors = collectAllLinks(getDiagram(), domain2NotationMap); java.util.List<org.eclipse.gmf.runtime.notation.View> edges = new java.util.ArrayList<org.eclipse.gmf.runtime.notation.View>(); for (Object edge : getDiagram().getEdges()) { @@ -92,8 +92,8 @@ import xpt.editor.VisualIDRegistry java.util.Collection<org.eclipse.gmf.runtime.notation.View> existingLinks = new java.util.LinkedList<org.eclipse.gmf.runtime.notation.View>(edges); for (java.util.Iterator<org.eclipse.gmf.runtime.notation.View> linksIterator = existingLinks.iterator(); linksIterator.hasNext();) { org.eclipse.gmf.runtime.notation.Edge nextDiagramLink = (org.eclipse.gmf.runtime.notation.Edge) linksIterator.next(); - int diagramLinkVisualID = «xptVisualIDRegistry.getVisualIDMethodCall(it)»(nextDiagramLink); - if (diagramLinkVisualID == -1«FOR link : links.filter[gl|gl.modelFacet == null]»«compareLinkVisualID(link)»«ENDFOR») { + int diagramLinkVisualID = «xptVisualIDRegistry.getVisualIDMethodCall(it)»(nextDiagramLink); + if (diagramLinkVisualID == -1«FOR link : links.filter[gl|gl.modelFacet == null]»«compareLinkVisualID(link)»«ENDFOR») { if (nextDiagramLink.getSource() != null && nextDiagramLink.getTarget() != null) { linksIterator.remove(); } @@ -102,8 +102,8 @@ import xpt.editor.VisualIDRegistry org.eclipse.emf.ecore.EObject diagramLinkObject = nextDiagramLink.getElement(); org.eclipse.emf.ecore.EObject diagramLinkSrc = nextDiagramLink.getSource().getElement(); org.eclipse.emf.ecore.EObject diagramLinkDst = nextDiagramLink.getTarget().getElement(); - for (java.util.Iterator<«it.editorGen.diagramUpdater.linkDescriptorQualifiedClassName»> linkDescriptorsIterator = linkDescriptors.iterator(); linkDescriptorsIterator.hasNext();) { - «linkDescriptor.qualifiedClassName(it.editorGen.diagramUpdater)» nextLinkDescriptor = linkDescriptorsIterator.next(); + for (java.util.Iterator<«it.editorGen.diagramUpdater.linkDescriptorQualifiedClassName»> linkDescriptorsIterator = linkDescriptors.iterator(); linkDescriptorsIterator.hasNext();) { + «linkDescriptor.qualifiedClassName(it.editorGen.diagramUpdater)» nextLinkDescriptor = linkDescriptorsIterator.next(); if (diagramLinkObject == nextLinkDescriptor.getModelElement() && diagramLinkSrc == nextLinkDescriptor.getSource() && diagramLinkDst == nextLinkDescriptor.getDestination() && diagramLinkVisualID == nextLinkDescriptor.getVisualID()) { linksIterator.remove(); linkDescriptorsIterator.remove(); @@ -116,20 +116,20 @@ import xpt.editor.VisualIDRegistry ''' override def collectAllLinksMethod(GenDiagram it) ''' - «generatedMemberComment» - private java.util.Collection<«linkDescriptor.qualifiedClassName(it.editorGen.diagramUpdater)»> collectAllLinks(org.eclipse.gmf.runtime.notation.View view, «Domain2Notation( - it)» domain2NotationMap) { - if (!«VisualIDRegistry::modelID(it)».equals(«xptVisualIDRegistry.getModelIDMethodCall(it)»(view))) { + «generatedMemberComment» + private java.util.Collection<«linkDescriptor.qualifiedClassName(it.editorGen.diagramUpdater)»> collectAllLinks(org.eclipse.gmf.runtime.notation.View view, «Domain2Notation( + it)» domain2NotationMap) { + if (!«VisualIDRegistry::modelID(it)».equals(«xptVisualIDRegistry.getModelIDMethodCall(it)»(view))) { return java.util.Collections.emptyList(); } - java.util.LinkedList<«linkDescriptor.qualifiedClassName(it.editorGen.diagramUpdater)»> result = new java.util.LinkedList<«linkDescriptor. - qualifiedClassName(it.editorGen.diagramUpdater)»>(); - String vid = «xptVisualIDRegistry.getVisualIDMethodCall(it)»(view); + java.util.LinkedList<«linkDescriptor.qualifiedClassName(it.editorGen.diagramUpdater)»> result = new java.util.LinkedList<«linkDescriptor. + qualifiedClassName(it.editorGen.diagramUpdater)»>(); + String vid = «xptVisualIDRegistry.getVisualIDMethodCall(it)»(view); if (vid != null) { switch (vid) { - «FOR se : it.allSemanticElements» - «caseSemanticElement(se)» - «ENDFOR» + «FOR se : it.allSemanticElements» + «caseSemanticElement(se)» + «ENDFOR» } } for (java.util.Iterator<?> children = view.getChildren().iterator(); children.hasNext();) { @@ -143,8 +143,8 @@ import xpt.editor.VisualIDRegistry ''' override getEditPartMethod(GenDiagram it) ''' - «generatedMemberComment» - private org.eclipse.gef.EditPart getEditPart(org.eclipse.emf.ecore.EObject domainModelElement, «Domain2Notation(it)» domain2NotationMap) { + «generatedMemberComment» + private org.eclipse.gef.EditPart getEditPart(org.eclipse.emf.ecore.EObject domainModelElement, «Domain2Notation(it)» domain2NotationMap) { org.eclipse.gmf.runtime.notation.View view = domain2NotationMap.get(domainModelElement); if (view != null) { return (org.eclipse.gef.EditPart) getHost().getViewer().getEditPartRegistry().get(view); @@ -154,9 +154,9 @@ import xpt.editor.VisualIDRegistry ''' override getHintedEditPartMethod(GenDiagram it) ''' - «generatedMemberComment» - protected final org.eclipse.gef.EditPart getHintedEditPart(org.eclipse.emf.ecore.EObject domainModelElement, «Domain2Notation(it)» domain2NotationMap, int hintVisualId) { - org.eclipse.gmf.runtime.notation.View view = domain2NotationMap.getHinted(domainModelElement, «xptVisualIDRegistry.typeMethodCall(it, 'hintVisualId')»); + «generatedMemberComment» + protected final org.eclipse.gef.EditPart getHintedEditPart(org.eclipse.emf.ecore.EObject domainModelElement, «Domain2Notation(it)» domain2NotationMap, int hintVisualId) { + org.eclipse.gmf.runtime.notation.View view = domain2NotationMap.getHinted(domainModelElement, «xptVisualIDRegistry.typeMethodCall(it, 'hintVisualId')»); if (view != null) { return (org.eclipse.gef.EditPart) getHost().getViewer().getEditPartRegistry().get(view); } diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/impl/parsers/ParserProvider.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/impl/parsers/ParserProvider.xtend index d455c0ebc62..fd75c2f994a 100644 --- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/impl/parsers/ParserProvider.xtend +++ b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/impl/parsers/ParserProvider.xtend @@ -56,21 +56,21 @@ import xpt.providers.ParserUtils_qvto @Inject Activator xptActivator; override def HintAdapterClass(GenParsers it) ''' - «generatedMemberComment()» + «generatedMemberComment()» private static class HintAdapter extends org.eclipse.gmf.runtime.emf.ui.services.parser.ParserHintAdapter { - «generatedMemberComment()» + «generatedMemberComment()» private final org.eclipse.gmf.runtime.emf.type.core.IElementType elementType; - «generatedMemberComment()» + «generatedMemberComment()» public HintAdapter(org.eclipse.gmf.runtime.emf.type.core.IElementType type, org.eclipse.emf.ecore.EObject object, String parserHint) { super(object, parserHint); - «_assert('type != null')» + «_assert('type != null')» elementType = type; } - «generatedMemberComment()» + «generatedMemberComment()» public Object getAdapter(@SuppressWarnings("rawtypes") Class adapter) { if (org.eclipse.gmf.runtime.emf.type.core.IElementType.class.equals(adapter)) { return elementType; @@ -81,61 +81,61 @@ import xpt.providers.ParserUtils_qvto ''' override dispatch dispatch_parsers(GenNode it) ''' - «FOR label : it.labels» - «IF label.modelFacet != null» - «dispatch_parser(label.modelFacet.parser, label.modelFacet, label)» - «ENDIF» - «ENDFOR» + «FOR label : it.labels» + «IF label.modelFacet != null» + «dispatch_parser(label.modelFacet.parser, label.modelFacet, label)» + «ENDIF» + «ENDFOR» ''' override dispatch dispatch_parsers(GenLink it) ''' - «FOR label : it.labels» - «IF label.modelFacet != null» - «dispatch_parser(label.modelFacet.parser, label.modelFacet, label)» - «ENDIF» - «ENDFOR» + «FOR label : it.labels» + «IF label.modelFacet != null» + «dispatch_parser(label.modelFacet.parser, label.modelFacet, label)» + «ENDIF» + «ENDFOR» ''' override dispatch dispatch_getParsers(GenNode it) // ''' - «FOR label : it.labels» - «IF label.modelFacet != null» - «doGetParser(label.modelFacet.parser, label)» - «ENDIF» - «ENDFOR» + «FOR label : it.labels» + «IF label.modelFacet != null» + «doGetParser(label.modelFacet.parser, label)» + «ENDIF» + «ENDFOR» ''' override dispatch dispatch_getParsers(GenLink it) // ''' - «FOR label : it.labels» - «IF label.modelFacet != null» - «doGetParser(label.modelFacet.parser, label)» - «ENDIF» - «ENDFOR» + «FOR label : it.labels» + «IF label.modelFacet != null» + «doGetParser(label.modelFacet.parser, label)» + «ENDIF» + «ENDFOR» ''' override dispatch dispatch_getParsers(GenChildLabelNode it) ''' - «IF it.modelFacet != null» - «doGetParser(it.labelModelFacet.parser, it)» - «ENDIF» + «IF it.modelFacet != null» + «doGetParser(it.labelModelFacet.parser, it)» + «ENDIF» ''' override def getParserByVisualIdMethod(GenParsers it) ''' - «generatedMemberComment()» + «generatedMemberComment()» protected org.eclipse.gmf.runtime.common.ui.services.parser.IParser getParser(String visualID) { if (visualID != null) { switch (visualID) { - «FOR node : editorGen.diagram.topLevelNodes» - «dispatch_getParsers(node)» - «ENDFOR» - «FOR node : editorGen.diagram.childNodes» - «dispatch_getParsers(node)» - «ENDFOR» - «FOR link : editorGen.diagram.links» - «dispatch_getParsers(link)» - «ENDFOR» + «FOR node : editorGen.diagram.topLevelNodes» + «dispatch_getParsers(node)» + «ENDFOR» + «FOR node : editorGen.diagram.childNodes» + «dispatch_getParsers(node)» + «ENDFOR» + «FOR link : editorGen.diagram.links» + «dispatch_getParsers(link)» + «ENDFOR» } } return null; @@ -143,12 +143,12 @@ import xpt.providers.ParserUtils_qvto ''' override def provider_providesMethod(GenParsers it) ''' - «generatedMemberComment()» + «generatedMemberComment()» public boolean provides(org.eclipse.gmf.runtime.common.core.service.IOperation operation) { if (operation instanceof org.eclipse.gmf.runtime.common.ui.services.parser.GetParserOperation) { org.eclipse.core.runtime.IAdaptable hint = ((org.eclipse.gmf.runtime.common.ui.services.parser.GetParserOperation) operation).getHint(); - if («xptElementTypes.qualifiedClassName(editorGen.diagram)».getElement(hint) == null) { + if («xptElementTypes.qualifiedClassName(editorGen.diagram)».getElement(hint) == null) { return false; } return getParser(hint) != null; diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/impl/preferences/StandardPage.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/impl/preferences/StandardPage.xtend index 1f3afac2938..e4c851bcaf3 100644 --- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/impl/preferences/StandardPage.xtend +++ b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/impl/preferences/StandardPage.xtend @@ -29,33 +29,33 @@ import xpt.Common override Main(GenStandardPreferencePage it) ''' - «copyright(it.diagram.editorGen)» - package «packageName(it)»; + «copyright(it.diagram.editorGen)» + package «packageName(it)»; - «generatedClassComment» - public class «className(it)» «extendsList(it)» «implementsList(it)» { + «generatedClassComment» + public class «className(it)» «extendsList(it)» «implementsList(it)» { - «generatedMemberComment» - public «className(it)»() { - setPreferenceStore(«getDiagram().editorGen.plugin.activatorQualifiedClassName».getInstance().getPreferenceStore()); - «IF StandardPreferencePages.GENERAL_LITERAL == kind» - setPreferenceKey(«getDiagram().editPartsPackageName».«getDiagram().editPartClassName».MODEL_ID); - «ENDIF» + «generatedMemberComment» + public «className(it)»() { + setPreferenceStore(«getDiagram().editorGen.plugin.activatorQualifiedClassName».getInstance().getPreferenceStore()); + «IF StandardPreferencePages.GENERAL_LITERAL == kind» + setPreferenceKey(«getDiagram().editPartsPackageName».«getDiagram().editPartClassName».MODEL_ID); + «ENDIF» } } ''' override extendsList(GenStandardPreferencePage it) ''' - «IF kind == StandardPreferencePages::GENERAL_LITERAL» - extends org.eclipse.papyrus.infra.gmfdiag.preferences.pages.DiagramPreferencePage«» - «ELSEIF kind == StandardPreferencePages::APPEARANCE_LITERAL» - extends org.eclipse.gmf.runtime.diagram.ui.preferences.AppearancePreferencePage«» - «ELSEIF kind == StandardPreferencePages::CONNECTIONS_LITERAL» - extends org.eclipse.gmf.runtime.diagram.ui.preferences.ConnectionsPreferencePage«» - «ELSEIF kind == StandardPreferencePages::PRINTING_LITERAL» - extends org.eclipse.gmf.runtime.diagram.ui.preferences.PrintingPreferencePage«» - «ELSEIF kind == StandardPreferencePages::RULERS_AND_GRID_LITERAL» - extends org.eclipse.gmf.runtime.diagram.ui.preferences.RulerGridPreferencePage«» - «ENDIF» + «IF kind == StandardPreferencePages::GENERAL_LITERAL» + extends org.eclipse.papyrus.infra.gmfdiag.preferences.pages.DiagramPreferencePage«» + «ELSEIF kind == StandardPreferencePages::APPEARANCE_LITERAL» + extends org.eclipse.gmf.runtime.diagram.ui.preferences.AppearancePreferencePage«» + «ELSEIF kind == StandardPreferencePages::CONNECTIONS_LITERAL» + extends org.eclipse.gmf.runtime.diagram.ui.preferences.ConnectionsPreferencePage«» + «ELSEIF kind == StandardPreferencePages::PRINTING_LITERAL» + extends org.eclipse.gmf.runtime.diagram.ui.preferences.PrintingPreferencePage«» + «ELSEIF kind == StandardPreferencePages::RULERS_AND_GRID_LITERAL» + extends org.eclipse.gmf.runtime.diagram.ui.preferences.RulerGridPreferencePage«» + «ENDIF» ''' } diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/metamodel/Facility.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/metamodel/Facility.xtend index 993f4801977..201ae85c16e 100644 --- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/metamodel/Facility.xtend +++ b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/metamodel/Facility.xtend @@ -29,17 +29,17 @@ import xpt.Common override getMethod(GenPackage it, DynamicModelAccess dma)''' - «generatedMemberComment('@throws IllegalStateException if no EPackage with given URI is registered.')» - public static «className(dma)» get«getNameToken(it)»() { - if («fieldName(it)» == null) { - org.eclipse.emf.ecore.EPackage pkg = getRegistry().getEPackage("«getEcorePackage().nsURI»"); + «generatedMemberComment('@throws IllegalStateException if no EPackage with given URI is registered.')» + public static «className(dma)» get«getNameToken(it)»() { + if («fieldName(it)» == null) { + org.eclipse.emf.ecore.EPackage pkg = getRegistry().getEPackage("«getEcorePackage().nsURI»"); if (pkg == null) { - throw new IllegalStateException("Package «getEcorePackage().name»(«getEcorePackage().nsURI») not found"); + throw new IllegalStateException("Package «getEcorePackage().name»(«getEcorePackage().nsURI») not found"); } - «fieldName(it)» = new «className(dma)»(pkg); - «fieldName(it)».init«getNameToken(it)»(); + «fieldName(it)» = new «className(dma)»(pkg); + «fieldName(it)».init«getNameToken(it)»(); } - return «fieldName(it)»; + return «fieldName(it)»; } ''' diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/metamodel/MetaModel.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/metamodel/MetaModel.xtend index 85202a54db5..ea237bda310 100644 --- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/metamodel/MetaModel.xtend +++ b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/metamodel/MetaModel.xtend @@ -25,6 +25,6 @@ import com.google.inject.Singleton @Inject extension MetaModel_qvto; override DeclareAndAssign2(GenClass it, String assignee, String src, GenClass srcMetaClass, GenFeature srcFeature, String srcExt, boolean needCast) // - '''«getQualifiedInterfaceName(it)» «assignee» = «getFeatureValue(srcFeature, src, srcMetaClass)».«srcExt»;''' + '''«getQualifiedInterfaceName(it)» «assignee» = «getFeatureValue(srcFeature, src, srcMetaClass)».«srcExt»;''' }
\ No newline at end of file diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/Common.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/Common.xtend index 77199747633..fb3d7914bd1 100644 --- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/Common.xtend +++ b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/Common.xtend @@ -23,11 +23,11 @@ import org.eclipse.papyrus.papyrusgmfgenextension.VisualIDOverride @Singleton class Common extends xpt.Common { override copyright(GenEditorGenerator it) ''' - «IF copyrightText != null» + «IF copyrightText != null» /** - * «copyrightText.replaceAll('\n', '\n * ')» + * «copyrightText.replaceAll('\n', '\n * ')» */ - «ENDIF» + «ENDIF» ''' def String stringVisualID(GenCommonBase it) { diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/commands/CreateLinkUtils.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/commands/CreateLinkUtils.xtend index 4b2a3c4b314..957d7c0cdd1 100644 --- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/commands/CreateLinkUtils.xtend +++ b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/commands/CreateLinkUtils.xtend @@ -34,51 +34,51 @@ import xpt.diagram.Utils_qvto * Fields of command that creates link. */ override dispatch fields(LinkModelFacet it) ''' - «extraLineBreak» - «generatedMemberComment()» + «extraLineBreak» + «generatedMemberComment()» protected final org.eclipse.emf.ecore.EObject source; - «generatedMemberComment()» + «generatedMemberComment()» protected final org.eclipse.emf.ecore.EObject target; ''' override dispatch fields(TypeLinkModelFacet it) ''' - «extraLineBreak» - «generatedMemberComment()» + «extraLineBreak» + «generatedMemberComment()» protected final org.eclipse.emf.ecore.EObject source; - «generatedMemberComment()» + «generatedMemberComment()» protected final org.eclipse.emf.ecore.EObject target; - «IF hasContainerOtherThanSource(it)» + «IF hasContainerOtherThanSource(it)» - «generatedMemberComment()» - protected «xptMetaModel.QualifiedClassName(it.containmentMetaFeature.genClass)» container; - «ENDIF» + «generatedMemberComment()» + protected «xptMetaModel.QualifiedClassName(it.containmentMetaFeature.genClass)» container; + «ENDIF» ''' override dispatch containerAccessor(TypeLinkModelFacet it) ''' - «IF hasContainerOtherThanSource(it)» + «IF hasContainerOtherThanSource(it)» - «generatedMemberComment()» - public «xptMetaModel.QualifiedClassName(it.containmentMetaFeature.genClass)» getContainer() { + «generatedMemberComment()» + public «xptMetaModel.QualifiedClassName(it.containmentMetaFeature.genClass)» getContainer() { return container; } - «generatedMemberComment( + «generatedMemberComment( 'Default approach is to traverse ancestors of the source to find instance of container.\n' + 'Modify with appropriate logic.' - )» - protected «xptMetaModel.QualifiedClassName(it.containmentMetaFeature.genClass)» deduceContainer(org.eclipse.emf.ecore.EObject source, org.eclipse.emf.ecore.EObject target) { + )» + protected «xptMetaModel.QualifiedClassName(it.containmentMetaFeature.genClass)» deduceContainer(org.eclipse.emf.ecore.EObject source, org.eclipse.emf.ecore.EObject target) { // Find container element for the new link. // Climb up by containment hierarchy starting from the source // and return the first element that is instance of the container class. for (org.eclipse.emf.ecore.EObject element = source; element != null; element = element.eContainer()) { - if («xptMetaModel.IsInstance(containmentMetaFeature.genClass, 'element')») { - return «xptMetaModel.CastEObject(it.containmentMetaFeature.genClass, 'element')»; + if («xptMetaModel.IsInstance(containmentMetaFeature.genClass, 'element')») { + return «xptMetaModel.CastEObject(it.containmentMetaFeature.genClass, 'element')»; } } return null; } - «ENDIF» + «ENDIF» ''' diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/commands/CreateNodeCommand.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/commands/CreateNodeCommand.xtend index 98231cd49a5..4069a9aeaf7 100644 --- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/commands/CreateNodeCommand.xtend +++ b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/commands/CreateNodeCommand.xtend @@ -35,71 +35,71 @@ import xpt.diagram.Utils_qvto @Inject MetaModel xptMetaModel; override CreateNodeCommand(GenNode it) ''' - «copyright(it.diagram.editorGen)» - package «packageName(it)»; + «copyright(it.diagram.editorGen)» + package «packageName(it)»; - «generatedClassComment()» - public class «className(it)» extends org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand { + «generatedClassComment()» + public class «className(it)» extends org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand { - «IF ! it.modelFacet.isPhantomElement()» - «generatedMemberComment()» + «IF ! it.modelFacet.isPhantomElement()» + «generatedMemberComment()» private org.eclipse.gmf.runtime.notation.Diagram diagram = null; - «ENDIF» + «ENDIF» - «_constructor(it)» + «_constructor(it)» - «getElementToEdit(it)» + «getElementToEdit(it)» - «canExecuteMethod(it)» + «canExecuteMethod(it)» - «doExecuteWithResultMethod(it)» + «doExecuteWithResultMethod(it)» - «doConfigureMethod(it)» + «doConfigureMethod(it)» - «additions(it)» + «additions(it)» } ''' override _constructor(GenNode it) ''' - «generatedMemberComment()» - public «className(it)»(org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest req, org.eclipse.gmf.runtime.notation.Diagram diagram) { + «generatedMemberComment()» + public «className(it)»(org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest req, org.eclipse.gmf.runtime.notation.Diagram diagram) { super(req.getLabel(), null, req); - «IF ! it.modelFacet.isPhantomElement()» + «IF ! it.modelFacet.isPhantomElement()» this.diagram = diagram; - «ENDIF» + «ENDIF» } ''' // override CreateNodeCommand(TypeModelFacet it) ''' -// «copyright(ownerGenNode(it).diagram.editorGen)» -// package «packageName(it)»; +// «copyright(ownerGenNode(it).diagram.editorGen)» +// package «packageName(it)»; // -// «generatedClassComment()» -// public class «className(it)» extends org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand { -//««« Mutating canvas auxiliary -// «generatedMemberComment» +// «generatedClassComment()» +// public class «className(it)» extends org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand { +//««« Mutating canvas auxiliary +// «generatedMemberComment» // private org.eclipse.emf.ecore.EClass eClass = null; -// «generatedMemberComment» +// «generatedMemberComment» // private org.eclipse.emf.ecore.EObject eObject = null; -// ««« Mutating canvas auxiliary constructor -// «generatedMemberComment» -// public «ownerGenNode(it).createCommandClassName»(org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest req, org.eclipse.emf.ecore.EObject eObject) { +// ««« Mutating canvas auxiliary constructor +// «generatedMemberComment» +// public «ownerGenNode(it).createCommandClassName»(org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest req, org.eclipse.emf.ecore.EObject eObject) { // super(req.getLabel(), null, req); // this.eObject = eObject; // this.eClass = eObject != null ? eObject.eClass() : null; // } -// ««« Mutating canvas auxiliary builder -// «generatedMemberComment» -// public static «ownerGenNode(it).createCommandClassName» create(org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest req, org.eclipse.emf.ecore.EObject eObject) { -// return new «ownerGenNode(it).createCommandClassName»(req, eObject); +// ««« Mutating canvas auxiliary builder +// «generatedMemberComment» +// public static «ownerGenNode(it).createCommandClassName» create(org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest req, org.eclipse.emf.ecore.EObject eObject) { +// return new «ownerGenNode(it).createCommandClassName»(req, eObject); // } -// « _constructor(it)» -// « getElementToEdit(it)» -// « canExecuteMethod(it)» -// « doExecuteWithResultMethod(it)» -// « doConfigureMethod(it)» +// « _constructor(it)» +// « getElementToEdit(it)» +// « canExecuteMethod(it)» +// « doExecuteWithResultMethod(it)» +// « doConfigureMethod(it)» // } // ''' // @@ -109,10 +109,10 @@ import xpt.diagram.Utils_qvto // * TODO: either use setElementToEdit, or generate downcasted version (which may be troublesome if containment and child features point to a different parent) // */ // override getElementToEdit(TypeModelFacet it) ''' -// «generatedMemberComment('FIXME: replace with setElementToEdit()')» +// «generatedMemberComment('FIXME: replace with setElementToEdit()')» // protected org.eclipse.emf.ecore.EObject getElementToEdit() { // -// ««« Mutating canvas helper +// ««« Mutating canvas helper // org.eclipse.emf.ecore.EObject container = // ((org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest) getRequest()).getContainer(); // if (container instanceof org.eclipse.gmf.runtime.notation.View) { @@ -128,101 +128,101 @@ import xpt.diagram.Utils_qvto // [AbstractElement] Modified for Abstract domain element override doExecuteWithResultMethod(GenNode it) ''' - «generatedMemberComment()» + «generatedMemberComment()» protected org.eclipse.gmf.runtime.common.core.command.CommandResult doExecuteWithResult(org.eclipse.core.runtime.IProgressMonitor monitor, org.eclipse.core.runtime.IAdaptable info) throws org.eclipse.core.commands.ExecutionException { - ««« [AbstractElement] START + ««« [AbstractElement] START - «IF it.modelFacet.metaClass.ecoreClass.abstract != true» - ««« [AbstractElement] END - «IF it.modelFacet.isPhantomElement()» - «phantomElementCreation(it.modelFacet, it, 'newElement')» - «ELSE» - «normalElementCreation(it.modelFacet, it, 'newElement')» - «ENDIF» - «extraLineBreak» - «initialize(it.modelFacet, it, 'newElement')» - «IF true/*FIXME boolean needsExternalConfiguration*/» - «extraLineBreak» + «IF it.modelFacet.metaClass.ecoreClass.abstract != true» + ««« [AbstractElement] END + «IF it.modelFacet.isPhantomElement()» + «phantomElementCreation(it.modelFacet, it, 'newElement')» + «ELSE» + «normalElementCreation(it.modelFacet, it, 'newElement')» + «ENDIF» + «extraLineBreak» + «initialize(it.modelFacet, it, 'newElement')» + «IF true/*FIXME boolean needsExternalConfiguration*/» + «extraLineBreak» doConfigure(newElement, monitor, info); - «extraLineBreak» - «ENDIF» - ((org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest) getRequest()).setNewElement(«xptMetaModel. - DowncastToEObject(it.modelFacet.metaClass, 'newElement')»); + «extraLineBreak» + «ENDIF» + ((org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest) getRequest()).setNewElement(«xptMetaModel. + DowncastToEObject(it.modelFacet.metaClass, 'newElement')»); return org.eclipse.gmf.runtime.common.core.command.CommandResult.newOKCommandResult(newElement); } - ««« [AbstractElement] START - «ELSE» + ««« [AbstractElement] START + «ELSE» throw new UnsupportedOperationException("Unimplemented operation (abstract domain element)."); } - «ENDIF» - ««« [AbstractElement] END + «ENDIF» + ««« [AbstractElement] END ''' override canExecute_Normal(TypeModelFacet it) ''' - «IF containmentMetaFeature != null» - «IF containmentMetaFeature.ecoreFeature != null» - «IF ! isUnbounded(containmentMetaFeature.ecoreFeature) || (childMetaFeature != containmentMetaFeature && ! isUnbounded(childMetaFeature.ecoreFeature))» - «IF ! isUnbounded(containmentMetaFeature.ecoreFeature)» - «DeclareAndAssign(containmentMetaFeature.genClass,'container', 'getElementToEdit()') » - «IF isSingleValued(containmentMetaFeature.ecoreFeature)» - if («getFeatureValue(containmentMetaFeature,'container', containmentMetaFeature.genClass) » != null) { - «ELSE» - if (« getFeatureValue(containmentMetaFeature,'container', containmentMetaFeature.genClass)».size() >= «containmentMetaFeature.ecoreFeature.upperBound») { - «ENDIF» + «IF containmentMetaFeature != null» + «IF containmentMetaFeature.ecoreFeature != null» + «IF ! isUnbounded(containmentMetaFeature.ecoreFeature) || (childMetaFeature != containmentMetaFeature && ! isUnbounded(childMetaFeature.ecoreFeature))» + «IF ! isUnbounded(containmentMetaFeature.ecoreFeature)» + «DeclareAndAssign(containmentMetaFeature.genClass,'container', 'getElementToEdit()') » + «IF isSingleValued(containmentMetaFeature.ecoreFeature)» + if («getFeatureValue(containmentMetaFeature,'container', containmentMetaFeature.genClass) » != null) { + «ELSE» + if (« getFeatureValue(containmentMetaFeature,'container', containmentMetaFeature.genClass)».size() >= «containmentMetaFeature.ecoreFeature.upperBound») { + «ENDIF» return false; } - «ENDIF» - «IF childMetaFeature != containmentMetaFeature && ! isUnbounded(childMetaFeature.ecoreFeature)» - «IF isSingleValued(childMetaFeature.ecoreFeature)» - if («getFeatureValue(childMetaFeature,'container', containmentMetaFeature.genClass) » != null) { - «ELSE» - if («getFeatureValue(childMetaFeature,'container', containmentMetaFeature.genClass) ».size() >= «childMetaFeature.ecoreFeature.upperBound») { - «ENDIF» + «ENDIF» + «IF childMetaFeature != containmentMetaFeature && ! isUnbounded(childMetaFeature.ecoreFeature)» + «IF isSingleValued(childMetaFeature.ecoreFeature)» + if («getFeatureValue(childMetaFeature,'container', containmentMetaFeature.genClass) » != null) { + «ELSE» + if («getFeatureValue(childMetaFeature,'container', containmentMetaFeature.genClass) ».size() >= «childMetaFeature.ecoreFeature.upperBound») { + «ENDIF» return false; } - «ENDIF» - «ENDIF» - «ENDIF» - «ENDIF» + «ENDIF» + «ENDIF» + «ENDIF» + «ENDIF» org.eclipse.emf.ecore.EObject target = getElementToEdit(); - org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData data = org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker.getFor(target).getChildAddData(diagram, target.eClass(), «MetaClass(metaClass)»); + org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData data = org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker.getFor(target).getChildAddData(diagram, target.eClass(), «MetaClass(metaClass)»); return data.isPermitted(); ''' override normalElementCreation(TypeModelFacet it, GenNode node, String varName) ''' - «xptMetaModel.NewInstance(it.metaClass, varName)» + «xptMetaModel.NewInstance(it.metaClass, varName)» org.eclipse.emf.ecore.EObject target = getElementToEdit(); - org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData data = org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker.getFor(target).getChildAddData(diagram, target, «varName»); + org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData data = org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker.getFor(target).getChildAddData(diagram, target, «varName»); if (data.isPermitted()) { if (data.isPathDefined()) { - if (!data.execute(target, «varName»)) { + if (!data.execute(target, «varName»)) { return org.eclipse.gmf.runtime.common.core.command.CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element"); } } else { - «extraLineBreak» - «IF containmentMetaFeature != null» - «xptMetaModel.DeclareAndAssign(it.containmentMetaFeature.genClass, 'qualifiedTarget', 'target')» - «xptMetaModel.modifyFeature(containmentMetaFeature, 'qualifiedTarget', containmentMetaFeature.genClass, varName)» - «ELSE» + «extraLineBreak» + «IF containmentMetaFeature != null» + «xptMetaModel.DeclareAndAssign(it.containmentMetaFeature.genClass, 'qualifiedTarget', 'target')» + «xptMetaModel.modifyFeature(containmentMetaFeature, 'qualifiedTarget', containmentMetaFeature.genClass, varName)» + «ELSE» // - // FIXME no containment feature found in the genmodel, toolsmith need to manually write code here to add «varName» to a parent + // FIXME no containment feature found in the genmodel, toolsmith need to manually write code here to add «varName» to a parent // - «ENDIF» + «ENDIF» } } else { return org.eclipse.gmf.runtime.common.core.command.CommandResult.newErrorCommandResult("The active policy restricts the addition of this element"); } - «IF hasExplicitChildFeature(it)» - «xptMetaModel.DeclareAndAssign(it.childMetaFeature.genClass, 'childHolder', 'getElementToEdit()')» - «xptMetaModel.modifyFeature(it.childMetaFeature, 'childHolder', childMetaFeature.genClass, varName)» - «ENDIF» + «IF hasExplicitChildFeature(it)» + «xptMetaModel.DeclareAndAssign(it.childMetaFeature.genClass, 'childHolder', 'getElementToEdit()')» + «xptMetaModel.modifyFeature(it.childMetaFeature, 'childHolder', childMetaFeature.genClass, varName)» + «ENDIF» ''' diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/commands/ReorientLinkUtils.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/commands/ReorientLinkUtils.xtend index 4d5b4f65f92..7d3f31863e6 100644 --- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/commands/ReorientLinkUtils.xtend +++ b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/commands/ReorientLinkUtils.xtend @@ -25,9 +25,9 @@ import com.google.inject.Singleton @Inject extension Common override canReorient(LinkModelFacet it, GenLink link) ''' - «generatedMemberComment()» + «generatedMemberComment()» public boolean canExecute() { - «checkLinkValidity(it)» + «checkLinkValidity(it)» if (reorientDirection == org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRequest.REORIENT_SOURCE) { return canReorientSource(); } @@ -37,25 +37,25 @@ import com.google.inject.Singleton return false; } - «generatedMemberComment()» + «generatedMemberComment()» protected boolean canReorientSource() { - «checkSourceRequestValidity(it, link)» + «checkSourceRequestValidity(it, link)» } - «generatedMemberComment()» + «generatedMemberComment()» protected boolean canReorientTarget() { - «checkTargetRequestValidity(it, link)» + «checkTargetRequestValidity(it, link)» } ''' override reorient(LinkModelFacet it) ''' - «generatedMemberComment()» + «generatedMemberComment()» protected org.eclipse.gmf.runtime.common.core.command.CommandResult doExecuteWithResult( org.eclipse.core.runtime.IProgressMonitor monitor, org.eclipse.core.runtime.IAdaptable info) throws org.eclipse.core.commands.ExecutionException { if (!canExecute()) { - throw new org.eclipse.core.commands.ExecutionException("Invalid arguments in reorient link command"); «nonNLS()» + throw new org.eclipse.core.commands.ExecutionException("Invalid arguments in reorient link command"); «nonNLS()» } if (reorientDirection == org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRequest.REORIENT_SOURCE) { return reorientSource(); @@ -66,14 +66,14 @@ import com.google.inject.Singleton throw new IllegalStateException(); } - «generatedMemberComment()» + «generatedMemberComment()» protected org.eclipse.gmf.runtime.common.core.command.CommandResult reorientSource() throws org.eclipse.core.commands.ExecutionException { - «reorientSource(it)» + «reorientSource(it)» } - «generatedMemberComment()» + «generatedMemberComment()» protected org.eclipse.gmf.runtime.common.core.command.CommandResult reorientTarget() throws org.eclipse.core.commands.ExecutionException { - «reorientTarget(it)» + «reorientTarget(it)» } ''' }
\ No newline at end of file diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/edithelpers/EditHelper.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/edithelpers/EditHelper.xtend index 9d27d72b6d3..86523fe704f 100644 --- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/edithelpers/EditHelper.xtend +++ b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/edithelpers/EditHelper.xtend @@ -28,12 +28,12 @@ public class EditHelper extends xpt.diagram.edithelpers.EditHelper { override EditHelper(MetamodelType it) ''' - «copyright(diagramElement.diagram.editorGen)» - package «packageName(it)»; + «copyright(diagramElement.diagram.editorGen)» + package «packageName(it)»; - «generatedClassComment» - public class «editHelperClassName» extends «getBaseEditHelperFullName(diagramElement.getDiagram())» { - «additions(it)» + «generatedClassComment» + public class «editHelperClassName» extends «getBaseEditHelperFullName(diagramElement.getDiagram())» { + «additions(it)» } ''' diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editparts/Common.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editparts/Common.xtend index fd0b97b6cc0..a5e2bfa33fb 100644 --- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editparts/Common.xtend +++ b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editparts/Common.xtend @@ -31,14 +31,14 @@ import org.eclipse.gmf.codegen.gmfgen.GenContainerBase @Inject QualifiedClassNameProvider qualifiedClassNameProvider; override installCanonicalEditPolicy(GenContainerBase it) ''' - «IF it.needsCanonicalEditPolicy» - ««« BEGIN: PapyrusGenCode - ««« Used to remove at each time canonical editpolicies + «IF it.needsCanonicalEditPolicy» + ««« BEGIN: PapyrusGenCode + ««« Used to remove at each time canonical editpolicies //in Papyrus diagrams are not strongly synchronised - //installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CANONICAL_ROLE, new «getCanonicalEditPolicyQualifiedClassName()»()); - ««« END: PapyrusGenCode + //installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CANONICAL_ROLE, new «getCanonicalEditPolicyQualifiedClassName()»()); + ««« END: PapyrusGenCode - «ENDIF» + «ENDIF» ''' override creationEditPolicyNewInstance(GenCommonBase it) @@ -46,16 +46,16 @@ import org.eclipse.gmf.codegen.gmfgen.GenContainerBase override installSemanticEditPolicy(GenCommonBase it) ''' - «IF sansDomain» + «IF sansDomain» removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.SEMANTIC_ROLE); - «ELSE» - installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.SEMANTIC_ROLE, new «qualifiedClassNameProvider.getItemSemanticEditPolicyQualifiedClassName(it)»()); - «ENDIF» + «ELSE» + installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.SEMANTIC_ROLE, new «qualifiedClassNameProvider.getItemSemanticEditPolicyQualifiedClassName(it)»()); + «ENDIF» ''' override def visualIDConstant(GenCommonBase it) ''' - «generatedMemberComment» - public static final String VISUAL_ID = "«stringVisualID»"; + «generatedMemberComment» + public static final String VISUAL_ID = "«stringVisualID»"; ''' }
\ No newline at end of file diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editparts/EditPartFactory.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editparts/EditPartFactory.xtend index 4c5504dad31..2fbcdd658f2 100644 --- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editparts/EditPartFactory.xtend +++ b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editparts/EditPartFactory.xtend @@ -27,7 +27,7 @@ import org.eclipse.gmf.codegen.gmfgen.GenDiagram override getTextCellEditorLocator(GenDiagram it) ''' - «generatedMemberComment» + «generatedMemberComment» public static org.eclipse.gef.tools.CellEditorLocator getTextCellEditorLocator( org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart source) { if (source.getFigure() instanceof org.eclipse.papyrus.uml.diagram.common.figure.node.IMultilineEditableFigure){ @@ -41,23 +41,23 @@ import org.eclipse.gmf.codegen.gmfgen.GenDiagram } - «generatedClassComment» + «generatedClassComment» static private class MultilineCellEditorLocator implements org.eclipse.gef.tools.CellEditorLocator { - «generatedClassComment» + «generatedClassComment» private org.eclipse.papyrus.uml.diagram.common.figure.node.IMultilineEditableFigure multilineEditableFigure; - «generatedClassComment» + «generatedClassComment» public MultilineCellEditorLocator(org.eclipse.papyrus.uml.diagram.common.figure.node.IMultilineEditableFigure figure) { this.multilineEditableFigure = figure; } - «generatedClassComment» + «generatedClassComment» public org.eclipse.papyrus.uml.diagram.common.figure.node.IMultilineEditableFigure getMultilineEditableFigure() { return multilineEditableFigure; } - «generatedClassComment» + «generatedClassComment» public void relocate(org.eclipse.jface.viewers.CellEditor celleditor) { org.eclipse.swt.widgets.Text text = (org.eclipse.swt.widgets.Text) celleditor.getControl(); org.eclipse.draw2d.geometry.Rectangle rect = getMultilineEditableFigure().getBounds().getCopy(); diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/BaseItemSemanticEditPolicy.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/BaseItemSemanticEditPolicy.xtend index c6be6f67770..97d30d6227a 100644 --- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/BaseItemSemanticEditPolicy.xtend +++ b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/BaseItemSemanticEditPolicy.xtend @@ -43,26 +43,26 @@ import xpt.providers.ElementTypes @Inject MetaModel xptMetaModel; override BaseItemSemanticEditPolicy(GenDiagram it) ''' -«copyright(editorGen)» -package «packageName(it)»; +«copyright(editorGen)» +package «packageName(it)»; -«generatedClassComment()» -public class «className(it)» extends org.eclipse.gmf.runtime.diagram.ui.editpolicies.SemanticEditPolicy { +«generatedClassComment()» +public class «className(it)» extends org.eclipse.gmf.runtime.diagram.ui.editpolicies.SemanticEditPolicy { - «attributes(it)» + «attributes(it)» - «constructor(it)» + «constructor(it)» - «generatedMemberComment( + «generatedMemberComment( 'Extended request data key to hold editpart visual id.\n' + 'Add visual id of edited editpart to extended data of the request\n' + 'so command switch can decide what kind of diagram element is being edited.\n' + 'It is done in those cases when it\'s not possible to deduce diagram\n' + 'element kind from domain element.\n' + 'Add the reoriented view to the request extended data so that the view\n ' + 'currently edited can be distinguished from other views of the same element\n ' + 'and these latter possibly removed if they become inconsistent after reconnect\n' - )» + )» @SuppressWarnings("unchecked") public org.eclipse.gef.commands.Command getCommand(org.eclipse.gef.Request request) { if (request instanceof org.eclipse.gef.requests.ReconnectRequest) { Object view = ((org.eclipse.gef.requests.ReconnectRequest) request).getConnectionEditPart().getModel(); if (view instanceof org.eclipse.gmf.runtime.notation.View) { - String id = «getVisualIDMethodCall(it)»((org.eclipse.gmf.runtime.notation.View) view); + String id = «getVisualIDMethodCall(it)»((org.eclipse.gmf.runtime.notation.View) view); request.getExtendedData().put(VISUAL_ID_KEY, id); request.getExtendedData().put(GRAPHICAL_RECONNECTED_EDGE, view); } @@ -70,35 +70,35 @@ public class «className(it)» extends org.eclipse.gmf.runtime.diagram.ui.editpoli return super.getCommand(request); } - «generatedMemberComment('Returns visual id from request parameters.')» + «generatedMemberComment('Returns visual id from request parameters.')» protected String getVisualID(org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest request) { return (String) request.getParameter(VISUAL_ID_KEY); } - «semanticPart(it)» + «semanticPart(it)» - «generatedMemberComment('Returns editing domain from the host edit part.')» + «generatedMemberComment('Returns editing domain from the host edit part.')» protected org.eclipse.emf.transaction.TransactionalEditingDomain getEditingDomain() { return ((org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart) getHost()).getEditingDomain(); } - «addDestroyShortcutsCommand(it)» + «addDestroyShortcutsCommand(it)» -«IF links.exists(link|!link.sansDomain)» - «linkConstraints(it)» -«ENDIF» +«IF links.exists(link|!link.sansDomain)» + «linkConstraints(it)» +«ENDIF» - «additions(it)» + «additions(it)» } ''' override def addDestroyShortcutsCommand(GenDiagram it) ''' - «generatedMemberComment('Clean all shortcuts to the host element from the same diagram')» + «generatedMemberComment('Clean all shortcuts to the host element from the same diagram')» protected void addDestroyShortcutsCommand(org.eclipse.gmf.runtime.common.core.command.ICompositeCommand cmd, org.eclipse.gmf.runtime.notation.View view) { - «_assert('view.getEAnnotation(\"Shortcut\") == null')» + «_assert('view.getEAnnotation(\"Shortcut\") == null')» for (java.util.Iterator<?> it = view.getDiagram().getChildren().iterator(); it.hasNext();) { org.eclipse.gmf.runtime.notation.View nextView = (org.eclipse.gmf.runtime.notation.View) it.next(); - if (nextView.getEAnnotation("Shortcut") == null || !nextView.isSetElement() || nextView.getElement() != view.getElement()) { «nonNLS()» + if (nextView.getEAnnotation("Shortcut") == null || !nextView.isSetElement() || nextView.getElement() != view.getElement()) { «nonNLS()» continue; } cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), nextView)); @@ -107,67 +107,67 @@ override def addDestroyShortcutsCommand(GenDiagram it) ''' ''' override attributes(GenDiagram it) ''' - «generatedMemberComment('Extended request data key to hold editpart visual id.')» - public static final String VISUAL_ID_KEY = "visual_id"; «nonNLS()» - «generatedMemberComment('Extended request data key to hold the edge view during a reconnect request.')» - public static final String GRAPHICAL_RECONNECTED_EDGE = "graphical_edge"; «nonNLS» - «generatedMemberComment()» + «generatedMemberComment('Extended request data key to hold editpart visual id.')» + public static final String VISUAL_ID_KEY = "visual_id"; «nonNLS()» + «generatedMemberComment('Extended request data key to hold the edge view during a reconnect request.')» + public static final String GRAPHICAL_RECONNECTED_EDGE = "graphical_edge"; «nonNLS» + «generatedMemberComment()» private final org.eclipse.gmf.runtime.emf.type.core.IElementType myElementType; ''' override semanticPart(GenDiagram it) ''' - «getSemanticCommand(it)» + «getSemanticCommand(it)» - «addDeleteViewCommand(it)» + «addDeleteViewCommand(it)» - «getEditHelperCommand(it)» + «getEditHelperCommand(it)» - «getContextElementType(it)» + «getContextElementType(it)» - «getSemanticCommandSwitch(it)» + «getSemanticCommandSwitch(it)» - «getConfigureCommand(it)» + «getConfigureCommand(it)» - «getCreateRelationshipCommand(it)» + «getCreateRelationshipCommand(it)» - «getCreateCommand(it)» + «getCreateCommand(it)» - «getCreateSemanticServiceEditCommand(it)» + «getCreateSemanticServiceEditCommand(it)» - «getSetCommand(it)» + «getSetCommand(it)» - «getEditContextCommand(it)» + «getEditContextCommand(it)» - «getDestroyElementCommand(it)» + «getDestroyElementCommand(it)» - «getDestroyReferenceCommand(it)» + «getDestroyReferenceCommand(it)» - «getDuplicateCommand(it)» + «getDuplicateCommand(it)» - «getMoveCommand(it)» + «getMoveCommand(it)» - «getReorientReferenceRelationshipCommand(it)» + «getReorientReferenceRelationshipCommand(it)» - «getReorientRelationshipCommand(it)» + «getReorientRelationshipCommand(it)» - «getGEFWrapper(it)» + «getGEFWrapper(it)» ''' override getContextElementType(GenDiagram it) ''' - «generatedMemberComment()» + «generatedMemberComment()» protected org.eclipse.gmf.runtime.emf.type.core.IElementType getContextElementType(org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest request) { - org.eclipse.gmf.runtime.emf.type.core.IElementType requestContextElementType = «xptElementTypes.qualifiedClassName(it)».getElementType(getVisualID(request)); + org.eclipse.gmf.runtime.emf.type.core.IElementType requestContextElementType = «xptElementTypes.qualifiedClassName(it)».getElementType(getVisualID(request)); return requestContextElementType != null ? requestContextElementType : myElementType; } ''' override getCreateRelationshipCommand(GenDiagram it) ''' -«generatedMemberComment()» +«generatedMemberComment()» protected org.eclipse.gef.commands.Command getCreateRelationshipCommand(org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest req) { - «IF it.eResource.allContents.filter(typeof(GenerateUsingElementTypeCreationCommand)).size < 1» + «IF it.eResource.allContents.filter(typeof(GenerateUsingElementTypeCreationCommand)).size < 1» return null; - «ENDIF» - «IF it.eResource.allContents.filter(typeof(GenerateUsingElementTypeCreationCommand)).size() > 0» + «ENDIF» + «IF it.eResource.allContents.filter(typeof(GenerateUsingElementTypeCreationCommand)).size() > 0» org.eclipse.papyrus.infra.services.edit.service.IElementEditService commandService = org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils.getCommandProvider(((org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart)getHost()).resolveSemanticElement()); if(req.getElementType() != null) { commandService = org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils.getCommandProvider(req.getElementType(), req.getClientContext()); @@ -183,12 +183,12 @@ protected org.eclipse.gef.commands.Command getCreateRelationshipCommand(org.ecli return getGEFWrapper(semanticCommand); } return org.eclipse.gef.commands.UnexecutableCommand.INSTANCE; - «ENDIF» + «ENDIF» } ''' override getCreateCommand(GenDiagram it) ''' -«generatedMemberComment()» +«generatedMemberComment()» protected org.eclipse.gef.commands.Command getCreateCommand(org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest req) { org.eclipse.gmf.runtime.emf.type.core.IElementType requestElementType = req.getElementType(); if (requestElementType instanceof org.eclipse.gmf.runtime.emf.type.core.IElementType) { @@ -206,10 +206,10 @@ protected org.eclipse.gef.commands.Command getCreateRelationshipCommand(org.ecli override getMoveCommand(GenDiagram it) ''' -«generatedMemberComment()» +«generatedMemberComment()» protected org.eclipse.gef.commands.Command getMoveCommand(org.eclipse.gmf.runtime.emf.type.core.requests.MoveRequest req) { - ««« BEGIN: PapyrusGenCode - ««« add move command + ««« BEGIN: PapyrusGenCode + ««« add move command org.eclipse.emf.ecore.EObject targetCEObject = req.getTargetContainer(); if(targetCEObject != null) { org.eclipse.papyrus.infra.services.edit.service.IElementEditService provider = org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils.getCommandProvider(targetCEObject); @@ -223,7 +223,7 @@ protected org.eclipse.gef.commands.Command getMoveCommand(org.eclipse.gmf.runtim } else { return getGEFWrapper(new org.eclipse.gmf.runtime.emf.type.core.commands.MoveElementsCommand(req)); } - ««« END: PapyrusGenCode + ««« END: PapyrusGenCode } ''' @@ -237,30 +237,30 @@ protected org.eclipse.gef.commands.Command getMoveCommand(org.eclipse.gmf.runtim */ override linkConstraints(GenDiagram it) ''' - «generatedMemberComment()» - public static «getLinkCreationConstraintsClassName()» getLinkConstraints() { - «getLinkCreationConstraintsClassName()» cached = «xptPluginActivator.instanceAccess(it.editorGen)».getLinkConstraints(); + «generatedMemberComment()» + public static «getLinkCreationConstraintsClassName()» getLinkConstraints() { + «getLinkCreationConstraintsClassName()» cached = «xptPluginActivator.instanceAccess(it.editorGen)».getLinkConstraints(); if (cached == null) { - «xptPluginActivator.instanceAccess(it.editorGen)».setLinkConstraints(cached = new «getLinkCreationConstraintsClassName()»()); + «xptPluginActivator.instanceAccess(it.editorGen)».setLinkConstraints(cached = new «getLinkCreationConstraintsClassName()»()); } return cached; } -«generatedClassComment()» -public static class «getLinkCreationConstraintsClassName()» { +«generatedClassComment()» +public static class «getLinkCreationConstraintsClassName()» { - «generatedMemberComment» - public «getLinkCreationConstraintsClassName()»() {«««package-local for the BaseItemSemanticEditPolicy to instantiate. Perhaps, protected is better (i.e. if someone subclasses it?) + «generatedMemberComment» + public «getLinkCreationConstraintsClassName()»() {«««package-local for the BaseItemSemanticEditPolicy to instantiate. Perhaps, protected is better (i.e. if someone subclasses it?) // use static method #getLinkConstraints() to access instance } - «FOR nextLink : it.links» - «canCreate(nextLink)» - «ENDFOR» + «FOR nextLink : it.links» + «canCreate(nextLink)» + «ENDFOR» - «FOR nextLink : it.links» - «canExist(nextLink)» - «ENDFOR» + «FOR nextLink : it.links» + «canExist(nextLink)» + «ENDFOR» } ''' @@ -272,70 +272,70 @@ public static class «getLinkCreationConstraintsClassName()» { } def checkEMFConstraints(TypeLinkModelFacet it) ''' -«IF containmentMetaFeature.ecoreFeature != null» - «IF ! isUnbounded(containmentMetaFeature.ecoreFeature) || checkChildFeatureBounds(it)» - if («getContainerVariable(it)» != null) { - «checkEMFConstraints(containmentMetaFeature, it)» - «IF checkChildFeatureBounds(it)» - «checkEMFConstraints(childMetaFeature, it)» - «ENDIF» +«IF containmentMetaFeature.ecoreFeature != null» + «IF ! isUnbounded(containmentMetaFeature.ecoreFeature) || checkChildFeatureBounds(it)» + if («getContainerVariable(it)» != null) { + «checkEMFConstraints(containmentMetaFeature, it)» + «IF checkChildFeatureBounds(it)» + «checkEMFConstraints(childMetaFeature, it)» + «ENDIF» } - «ENDIF» -«ENDIF» + «ENDIF» +«ENDIF» ''' override checkEMFConstraints(GenFeature it, TypeLinkModelFacet modelFacet) ''' -«IF modelFacet.containmentMetaFeature.ecoreFeature != null» -«IF ! isUnbounded(ecoreFeature)» -if («featureBoundComparator(it, getContainerVariable(modelFacet), modelFacet.getSourceType())») { +«IF modelFacet.containmentMetaFeature.ecoreFeature != null» +«IF ! isUnbounded(ecoreFeature)» +if («featureBoundComparator(it, getContainerVariable(modelFacet), modelFacet.getSourceType())») { return false; } -«ENDIF» -«ENDIF» +«ENDIF» +«ENDIF» ''' override canCreate(GenLink it) ''' -«generatedMemberComment()» -public boolean canCreate«stringUniqueIdentifier()»( -«IF !it.sansDomain» -«canCreateParameters(it.modelFacet)» -«ENDIF» +«generatedMemberComment()» +public boolean canCreate«stringUniqueIdentifier()»( +«IF !it.sansDomain» +«canCreateParameters(it.modelFacet)» +«ENDIF» ) { - «IF !it.sansDomain» - «checkEMFConstraints(it.modelFacet)» - «ENDIF» - return canExist«stringUniqueIdentifier()»( - «IF !it.sansDomain» - «canCreateValues(it.modelFacet)» - «ENDIF» + «IF !it.sansDomain» + «checkEMFConstraints(it.modelFacet)» + «ENDIF» + return canExist«stringUniqueIdentifier()»( + «IF !it.sansDomain» + «canCreateValues(it.modelFacet)» + «ENDIF» ); } ''' override featureBoundsConditionClause(GenFeature it, String targetVar, GenClass targetType) ''' -«««Checking upper bounds if was specified in MM -«IF ecoreFeature != null» - «IF ! isUnbounded(ecoreFeature)»«featureBoundComparator(it, targetVar, targetType)»«ENDIF» - ««« Checking uniqueness in addition if upper bounds != 1 - «IF ! isSingleValued(ecoreFeature) && ! isUnbounded(ecoreFeature)» || «ENDIF» - ««« Checking uniqueness in if upper bounds !- 1 - «IF ! isSingleValued(ecoreFeature)»«featureUniquenessComparator(it, targetVar, targetType)»«ENDIF» -«ENDIF» +«««Checking upper bounds if was specified in MM +«IF ecoreFeature != null» + «IF ! isUnbounded(ecoreFeature)»«featureBoundComparator(it, targetVar, targetType)»«ENDIF» + ««« Checking uniqueness in addition if upper bounds != 1 + «IF ! isSingleValued(ecoreFeature) && ! isUnbounded(ecoreFeature)» || «ENDIF» + ««« Checking uniqueness in if upper bounds !- 1 + «IF ! isSingleValued(ecoreFeature)»«featureUniquenessComparator(it, targetVar, targetType)»«ENDIF» +«ENDIF» ''' override featureBoundComparator(GenFeature it, String featureVar, GenClass featureVarGenClass) ''' - «xptMetaModel.getFeatureValue(it, featureVar, featureVarGenClass)» - «IF ecoreFeature.upperBound == 1» + «xptMetaModel.getFeatureValue(it, featureVar, featureVarGenClass)» + «IF ecoreFeature.upperBound == 1» != null - «ELSE» - .size() >= «ecoreFeature.upperBound» - «ENDIF» + «ELSE» + .size() >= «ecoreFeature.upperBound» + «ENDIF» ''' // Generate generic method if using semantic creation command based on element types framework. def getCreateSemanticServiceEditCommand(GenDiagram it) ''' -«IF it.eResource.allContents.filter(typeof(GenerateUsingElementTypeCreationCommand)).size > 0» - «generatedMemberComment» +«IF it.eResource.allContents.filter(typeof(GenerateUsingElementTypeCreationCommand)).size > 0» + «generatedMemberComment» protected org.eclipse.gmf.runtime.common.core.command.ICommand getSemanticCreationCommand(org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest req) { org.eclipse.papyrus.infra.services.edit.service.IElementEditService commandService = org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils.getCommandProvider(req.getContainer()); if(commandService == null) { @@ -343,7 +343,7 @@ public boolean canCreate«stringUniqueIdentifier()»( } return commandService.getEditCommand(req); } -«ENDIF» +«ENDIF» ''' /** @@ -355,33 +355,33 @@ public boolean canCreate«stringUniqueIdentifier()»( * to check source and target separately. Otherwize, do it inplace. */ override canExist(GenLink it) ''' - «generatedMemberComment()» - public boolean canExist«stringUniqueIdentifier()»( - «IF !it.sansDomain» - «canExistParameters(it.modelFacet)» - «ENDIF» + «generatedMemberComment()» + public boolean canExist«stringUniqueIdentifier()»( + «IF !it.sansDomain» + «canExistParameters(it.modelFacet)» + «ENDIF» ) { - «IF creationConstraints != null && creationConstraints.isValid() && it.diagram.editorGen.expressionProviders != null» + «IF creationConstraints != null && creationConstraints.isValid() && it.diagram.editorGen.expressionProviders != null» try { - «IF creationConstraints.sourceEnd != null» - «checkAdditionalConstraint(creationConstraints.sourceEnd.provider, creationConstraints.sourceEnd, 'source', 'target', creationConstraints.getSourceEndContextClass(), creationConstraints.getTargetEndContextClass())» - «ENDIF» - «IF creationConstraints.targetEnd != null» - «checkAdditionalConstraint(creationConstraints.targetEnd.provider, creationConstraints.targetEnd, 'target', 'source', creationConstraints.getTargetEndContextClass(), creationConstraints.getSourceEndContextClass())» - «ENDIF» + «IF creationConstraints.sourceEnd != null» + «checkAdditionalConstraint(creationConstraints.sourceEnd.provider, creationConstraints.sourceEnd, 'source', 'target', creationConstraints.getSourceEndContextClass(), creationConstraints.getTargetEndContextClass())» + «ENDIF» + «IF creationConstraints.targetEnd != null» + «checkAdditionalConstraint(creationConstraints.targetEnd.provider, creationConstraints.targetEnd, 'target', 'source', creationConstraints.getTargetEndContextClass(), creationConstraints.getSourceEndContextClass())» + «ENDIF» return true; } catch(Exception e) { - «xptPluginActivator.instanceAccess(it.diagram.editorGen)».logError("Link constraint evaluation error", e); «nonNLS()» + «xptPluginActivator.instanceAccess(it.diagram.editorGen)».logError("Link constraint evaluation error", e); «nonNLS()» return false; } - «ELSE» + «ELSE» return true; - «ENDIF» + «ENDIF» } ''' override def getGEFWrapper(GenDiagram it) ''' - «generatedMemberComment()» + «generatedMemberComment()» protected final org.eclipse.gef.commands.Command getGEFWrapper(org.eclipse.gmf.runtime.common.core.command.ICommand cmd) { return (cmd == null) ? org.eclipse.gef.commands.UnexecutableCommand.INSTANCE : new org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy(cmd); } diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/CompartmentItemSemanticEditPolicy.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/CompartmentItemSemanticEditPolicy.xtend index 855e87caa94..001e018afcf 100644 --- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/CompartmentItemSemanticEditPolicy.xtend +++ b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/CompartmentItemSemanticEditPolicy.xtend @@ -36,61 +36,61 @@ import xpt.diagram.editpolicies.childContainerCreateCommand override CompartmentItemSemanticEditPolicy(GenCompartment it) ''' - «copyright(getDiagram().editorGen)» - package «packageName(it)»; + «copyright(getDiagram().editorGen)» + package «packageName(it)»; - «generatedClassComment()» - public class «className(it)» extends «xptBaseItemSemanticEditPolicy.qualifiedClassName(getDiagram())» { + «generatedClassComment()» + public class «className(it)» extends «xptBaseItemSemanticEditPolicy.qualifiedClassName(getDiagram())» { - «_constructor(it)» + «_constructor(it)» - «xptChildContainerCreateCommand.childContainerCreateCommand( it.childNodes)» + «xptChildContainerCreateCommand.childContainerCreateCommand( it.childNodes)» - «additions(it)» + «additions(it)» - ««« Papyrus REM : - ««« Test if this compartment edit policy should used a referenced constraint for the move command. + ««« Papyrus REM : + ««« Test if this compartment edit policy should used a referenced constraint for the move command. - «IF it.eResource.allContents.filter(typeof (ConstrainedByReferenceCompartmentItemSemanticEditPolicy)).filter[v | v.genView.contains(it)].size != 0» - «getChildNodeReference(childNodes)» + «IF it.eResource.allContents.filter(typeof (ConstrainedByReferenceCompartmentItemSemanticEditPolicy)).filter[v | v.genView.contains(it)].size != 0» + «getChildNodeReference(childNodes)» - «isCorrectCompartment(it)» + «isCorrectCompartment(it)» - «constraintedMoveCommand(it)» + «constraintedMoveCommand(it)» - «ENDIF» + «ENDIF» } ''' def getChildNodeReference (EList<GenChildNode> it) ''' - «IF !(it.isEmpty)» - «generatedMemberComment» + «IF !(it.isEmpty)» + «generatedMemberComment» private static Set<EReference> compartmentReferences; - «generatedMemberComment» + «generatedMemberComment» static { - ««« compartmentReferences = new HashSet<EReference>(«it.modelFacet->size()»); + ««« compartmentReferences = new HashSet<EReference>(«it.modelFacet->size()»); compartmentReferences = new HashSet<EReference>(); - «FOR n : it» - «childRef(n.modelFacet,n)» - «ENDFOR» + «FOR n : it» + «childRef(n.modelFacet,n)» + «ENDFOR» } - «generatedMemberComment» + «generatedMemberComment» protected Iterable<EReference> getCompartmentReferences() { return compartmentReferences; } -«ENDIF» +«ENDIF» ''' def childRef(TypeModelFacet it ,GenNode node) ''' - compartmentReferences.add(«MetaFeature (node.modelFacet.containmentMetaFeature)»); + compartmentReferences.add(«MetaFeature (node.modelFacet.containmentMetaFeature)»); ''' def isCorrectCompartment (GenCompartment it)''' - «generatedMemberComment» + «generatedMemberComment» protected boolean isMovedIntoCorrectCompartment(MoveRequest req){ for(Object entry : req.getElementsToMove().entrySet()) { if(entry instanceof Map.Entry<?, ?>) { @@ -120,7 +120,7 @@ def isCorrectCompartment (GenCompartment it)''' ''' def constraintedMoveCommand (GenCompartment it)''' - «generatedMemberComment» + «generatedMemberComment» @Override protected Command getMoveCommand(MoveRequest req) { if (isMovedIntoCorrectCompartment(req)){ diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/LinkItemSemanticEditPolicy.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/LinkItemSemanticEditPolicy.xtend index 2253e866997..c42fa7b82e1 100644 --- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/LinkItemSemanticEditPolicy.xtend +++ b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/LinkItemSemanticEditPolicy.xtend @@ -32,14 +32,14 @@ import xpt.Common @Inject extension UtilsItemSemanticEditPolicy override dispatch getDestroySemanticCommand(TypeLinkModelFacet it, GenLink genLink) ''' - ««« Test to know which delete command should be used in the generated code : "Traditional Delete Command" or the Delete Service + ««« Test to know which delete command should be used in the generated code : "Traditional Delete Command" or the Delete Service - «IF it.eResource.allContents.filter(typeof (EditPartUsingDeleteService)).filter[v | v.genView.contains(genLink)].size !=0 » + «IF it.eResource.allContents.filter(typeof (EditPartUsingDeleteService)).filter[v | v.genView.contains(genLink)].size !=0 » - «generatedMemberComment» - «getDestroyElementCommandByService(it)» - «ELSE» - «generatedMemberComment» + «generatedMemberComment» + «getDestroyElementCommandByService(it)» + «ELSE» + «generatedMemberComment» protected org.eclipse.gef.commands.Command getDestroyElementCommand(org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest req) { org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand cmd = new org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand(getEditingDomain(), null); cmd.setTransactionNestingEnabled(true); @@ -48,9 +48,9 @@ import xpt.Common //cmd.add(new org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand(req)); cmd.add(new org.eclipse.papyrus.infra.emf.gmf.command.EMFtoGMFCommandWrapper(new org.eclipse.emf.edit.command.DeleteCommand(getEditingDomain(),todestroy ))); return getGEFWrapper(cmd.reduce()); - //return getGEFWrapper(«newDeleteLinkWithClassCommand(it,genLink, 'req')»); + //return getGEFWrapper(«newDeleteLinkWithClassCommand(it,genLink, 'req')»); } - «ENDIF» + «ENDIF» ''' diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/NodeItemSemanticEditPolicy.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/NodeItemSemanticEditPolicy.xtend index 35fa946e4ff..8df1ff2662f 100644 --- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/NodeItemSemanticEditPolicy.xtend +++ b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/NodeItemSemanticEditPolicy.xtend @@ -49,55 +49,55 @@ import xpt.editor.VisualIDRegistry override NodeItemSemanticEditPolicy(GenNode it) ''' - «copyright(getDiagram().editorGen)» - package «packageName(it)»; + «copyright(getDiagram().editorGen)» + package «packageName(it)»; - «generatedClassComment()» - public class «className(it)» extends «xptBaseItemSemanticEditPolicy.qualifiedClassName(getDiagram())» { + «generatedClassComment()» + public class «className(it)» extends «xptBaseItemSemanticEditPolicy.qualifiedClassName(getDiagram())» { - «xptBaseItemSemanticEditPolicy.defaultConstructor(it)» + «xptBaseItemSemanticEditPolicy.defaultConstructor(it)» - «xptChildContainerCreateCommand.childContainerCreateCommand(it.childNodes)» + «xptChildContainerCreateCommand.childContainerCreateCommand(it.childNodes)» - ««« Papyrus REM : - ««« Test to know how the delete of this EditPart is done : we used the DeleteService or the "Traditional method" + ««« Papyrus REM : + ««« Test to know how the delete of this EditPart is done : we used the DeleteService or the "Traditional method" - «IF it.eResource.allContents.filter(typeof (EditPartUsingDeleteService)).filter[v | v.genView.contains(it)].size != 0» - «generatedMemberComment» - «getDestroyElementCommandByService(it)» - «ELSE» - «getDestroyElementCommand(it)» - «IF hasChildrenOrCompartments(it)» - «addDestroyChildNodesCommand(it)» - «ENDIF» - «ENDIF» + «IF it.eResource.allContents.filter(typeof (EditPartUsingDeleteService)).filter[v | v.genView.contains(it)].size != 0» + «generatedMemberComment» + «getDestroyElementCommandByService(it)» + «ELSE» + «getDestroyElementCommand(it)» + «IF hasChildrenOrCompartments(it)» + «addDestroyChildNodesCommand(it)» + «ENDIF» + «ENDIF» - «xptLinkCommands.linkCommands(it)» + «xptLinkCommands.linkCommands(it)» - «additions(it)» + «additions(it)» } ''' override getDestroyElementCommand(GenNode it) ''' - «generatedMemberComment()» + «generatedMemberComment()» protected org.eclipse.gef.commands.Command getDestroyElementCommand(org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest req) { org.eclipse.gmf.runtime.notation.View view = (org.eclipse.gmf.runtime.notation.View) getHost().getModel(); org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand cmd = new org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand(getEditingDomain(), null); cmd.setTransactionNestingEnabled(true); - ««« «destroyEdges('view')» - org.eclipse.emf.ecore.EAnnotation annotation = view.getEAnnotation("Shortcut");«nonNLS» + ««« «destroyEdges('view')» + org.eclipse.emf.ecore.EAnnotation annotation = view.getEAnnotation("Shortcut");«nonNLS» if (annotation == null) { - // there are indirectly referenced children, need extra commands: «it.childNodes.union(compartments.map(c | c.childNodes).flatten).exists[GenChildNode gcn | !isDirectlyOwned(gcn, it)]» - «IF hasChildrenOrCompartments(it)» + // there are indirectly referenced children, need extra commands: «it.childNodes.union(compartments.map(c | c.childNodes).flatten).exists[GenChildNode gcn | !isDirectlyOwned(gcn, it)]» + «IF hasChildrenOrCompartments(it)» addDestroyChildNodesCommand(cmd); - «ENDIF» + «ENDIF» addDestroyShortcutsCommand(cmd, view); // delete host element java.util.List<org.eclipse.emf.ecore.EObject> todestroy=new java.util.ArrayList<org.eclipse.emf.ecore.EObject>(); todestroy.add(req.getElementToDestroy()); //cmd.add(new org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand(req)); cmd.add(new org.eclipse.papyrus.infra.emf.gmf.command.EMFtoGMFCommandWrapper(new org.eclipse.emf.edit.command.DeleteCommand(getEditingDomain(),todestroy ))); - } else {«««Here, we may play smart and don't generate else for non-toplevel nodes(which can't be shortcuts). Is it worth doing? + } else {«««Here, we may play smart and don't generate else for non-toplevel nodes(which can't be shortcuts). Is it worth doing? cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), view)); } return getGEFWrapper(cmd.reduce()); @@ -105,32 +105,32 @@ protected org.eclipse.gef.commands.Command getDestroyElementCommand(org.eclipse. ''' override addDestroyChildNodesCommand(GenNode it) ''' - «generatedMemberComment()» + «generatedMemberComment()» protected void addDestroyChildNodesCommand(org.eclipse.gmf.runtime.common.core.command.ICompositeCommand cmd) { org.eclipse.gmf.runtime.notation.View view = (org.eclipse.gmf.runtime.notation.View) getHost().getModel(); for (java.util.Iterator<?> nit = view.getChildren().iterator(); nit.hasNext();) { org.eclipse.gmf.runtime.notation.Node node = (org.eclipse.gmf.runtime.notation.Node) nit.next(); - String vid = «xptVisualIDRegistry.getVisualIDMethodCall(it.diagram)»(node); + String vid = «xptVisualIDRegistry.getVisualIDMethodCall(it.diagram)»(node); if (vid != null) { switch (vid) { - «FOR cn : it.childNodes» - «destroyChildNodes(cn, 'node', it)» - «ENDFOR» - «FOR compartment : it.compartments» - «xptVisualIDRegistry.caseVisualID(compartment)» + «FOR cn : it.childNodes» + «destroyChildNodes(cn, 'node', it)» + «ENDFOR» + «FOR compartment : it.compartments» + «xptVisualIDRegistry.caseVisualID(compartment)» for (java.util.Iterator<?> cit = node.getChildren().iterator(); cit.hasNext();) { org.eclipse.gmf.runtime.notation.Node cnode = (org.eclipse.gmf.runtime.notation.Node) cit.next(); - String cvid = «xptVisualIDRegistry.getVisualIDMethodCall(it.diagram)»(cnode); + String cvid = «xptVisualIDRegistry.getVisualIDMethodCall(it.diagram)»(cnode); if (cvid != null) { switch (cvid) { - «FOR cn : compartment.childNodes» - «destroyChildNodes(cn, 'cnode', it)» - «ENDFOR» + «FOR cn : compartment.childNodes» + «destroyChildNodes(cn, 'cnode', it)» + «ENDFOR» } } } break; - «ENDFOR» + «ENDFOR» } } } @@ -144,104 +144,104 @@ protected org.eclipse.gef.commands.Command getDestroyElementCommand(org.eclipse. */ override destroyEdges(GenNode it, String view) ''' -««« XXX: Though semantic editpolicy is supposed to create commands that operate with semantic elements only, -««« old code used to delegate child/link deletion to respective editparts, which in turn led to semantic commands -««« being combined with notational commands (BaseItemSemanticEditPolicy#addDeleteViewCommand()). -««« --- -««« Use DiagramUpdater.get[Incoming|Outgoing]View instead, to clean links that are not present on a diagram -««« (but don't forget to clean corresponding Edge, if any) +««« XXX: Though semantic editpolicy is supposed to create commands that operate with semantic elements only, +««« old code used to delegate child/link deletion to respective editparts, which in turn led to semantic commands +««« being combined with notational commands (BaseItemSemanticEditPolicy#addDeleteViewCommand()). +««« --- +««« Use DiagramUpdater.get[Incoming|Outgoing]View instead, to clean links that are not present on a diagram +««« (but don't forget to clean corresponding Edge, if any) -«««// This part is commented for Papyrus -«««// Some Papyrus diagrams with lots of elements are reaching the 65K Java limit for method size. -«««// The following change is not supposed to modify the method behavior, just propose a slight more -«««// compact code to avoid size limit. -««« -««««IF genIncomingLinks->notEmpty()-» -««« for («EXPAND CodeStyle::G('java.util.Iterator', '?' /*FIXME Refactor once Notation model is Java5*/)» it = «view».getTargetEdges().iterator(); it.hasNext();) { -««« org.eclipse.gmf.runtime.notation.Edge incomingLink = (org.eclipse.gmf.runtime.notation.Edge) it.next(); -««««FOREACH genIncomingLinks AS il-» -««« if («EXPAND xpt::editor::VisualIDRegistry::getVisualIDMethodCall FOR getDiagram()»(incomingLink) == «EXPAND xpt::editor::VisualIDRegistry::visualID FOR il») { -««« «EXPAND impl::diagram::commands::DeleteLinkCommand::newRequest('r', 'incomingLink') FOR il-» -««« cmd.add(«EXPAND impl::diagram::commands::DeleteLinkCommand::newInstance('r') FOR il»); -««« cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), incomingLink)); -««« continue; -««« } -««««ENDFOREACH-» -««« } -««««ENDIF-» -««««IF genOutgoingLinks->notEmpty()-» -««« for («EXPAND CodeStyle::G('java.util.Iterator', '?' /*FIXME Refactor once Notation model is Java5*/)» it = «view».getSourceEdges().iterator(); it.hasNext();) { -««« org.eclipse.gmf.runtime.notation.Edge outgoingLink = (org.eclipse.gmf.runtime.notation.Edge) it.next(); -««««FOREACH genOutgoingLinks AS ol-» -««« if («EXPAND xpt::editor::VisualIDRegistry::getVisualIDMethodCall FOR getDiagram()»(outgoingLink) == «EXPAND xpt::editor::VisualIDRegistry::visualID FOR ol») { -««« «EXPAND impl::diagram::commands::DeleteLinkCommand::newRequest('r', 'outgoingLink') FOR ol-» -««« cmd.add(«EXPAND impl::diagram::commands::DeleteLinkCommand::newInstance('r') FOR ol»); -««« cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), outgoingLink)); -««« continue; -««« } -««««ENDFOREACH-» -««« } -««««ENDIF-» +«««// This part is commented for Papyrus +«««// Some Papyrus diagrams with lots of elements are reaching the 65K Java limit for method size. +«««// The following change is not supposed to modify the method behavior, just propose a slight more +«««// compact code to avoid size limit. +««« +««««IF genIncomingLinks->notEmpty()-» +««« for («EXPAND CodeStyle::G('java.util.Iterator', '?' /*FIXME Refactor once Notation model is Java5*/)» it = «view».getTargetEdges().iterator(); it.hasNext();) { +««« org.eclipse.gmf.runtime.notation.Edge incomingLink = (org.eclipse.gmf.runtime.notation.Edge) it.next(); +««««FOREACH genIncomingLinks AS il-» +««« if («EXPAND xpt::editor::VisualIDRegistry::getVisualIDMethodCall FOR getDiagram()»(incomingLink) == «EXPAND xpt::editor::VisualIDRegistry::visualID FOR il») { +««« «EXPAND impl::diagram::commands::DeleteLinkCommand::newRequest('r', 'incomingLink') FOR il-» +««« cmd.add(«EXPAND impl::diagram::commands::DeleteLinkCommand::newInstance('r') FOR il»); +««« cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), incomingLink)); +««« continue; +««« } +««««ENDFOREACH-» +««« } +««««ENDIF-» +««««IF genOutgoingLinks->notEmpty()-» +««« for («EXPAND CodeStyle::G('java.util.Iterator', '?' /*FIXME Refactor once Notation model is Java5*/)» it = «view».getSourceEdges().iterator(); it.hasNext();) { +««« org.eclipse.gmf.runtime.notation.Edge outgoingLink = (org.eclipse.gmf.runtime.notation.Edge) it.next(); +««««FOREACH genOutgoingLinks AS ol-» +««« if («EXPAND xpt::editor::VisualIDRegistry::getVisualIDMethodCall FOR getDiagram()»(outgoingLink) == «EXPAND xpt::editor::VisualIDRegistry::visualID FOR ol») { +««« «EXPAND impl::diagram::commands::DeleteLinkCommand::newRequest('r', 'outgoingLink') FOR ol-» +««« cmd.add(«EXPAND impl::diagram::commands::DeleteLinkCommand::newInstance('r') FOR ol»); +««« cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), outgoingLink)); +««« continue; +««« } +««««ENDFOREACH-» +««« } +««««ENDIF-» -«IF !genIncomingLinks.isEmpty()» - for (java.util.Iterator<?> it = «view».getTargetEdges().iterator(); it.hasNext();) { +«IF !genIncomingLinks.isEmpty()» + for (java.util.Iterator<?> it = «view».getTargetEdges().iterator(); it.hasNext();) { org.eclipse.gmf.runtime.notation.Edge incomingLink = (org.eclipse.gmf.runtime.notation.Edge) it.next(); - String vid = «xptVisualIDRegistry.getVisualIDMethodCall(getDiagram())»(incomingLink); + String vid = «xptVisualIDRegistry.getVisualIDMethodCall(getDiagram())»(incomingLink); if (vid != null) { switch(vid) { -«IF !genIncomingLinks.filter[l | l.modelFacet instanceof FeatureLinkModelFacet].empty» -«FOR il : genIncomingLinks.filter[l | l.modelFacet instanceof FeatureLinkModelFacet]» - case «VisualIDRegistry.visualID(il)»: -«ENDFOR» +«IF !genIncomingLinks.filter[l | l.modelFacet instanceof FeatureLinkModelFacet].empty» +«FOR il : genIncomingLinks.filter[l | l.modelFacet instanceof FeatureLinkModelFacet]» + case «VisualIDRegistry.visualID(il)»: +«ENDFOR» org.eclipse.gmf.runtime.emf.type.core.requests.DestroyReferenceRequest destroyRefReq = new org.eclipse.gmf.runtime.emf.type.core.requests.DestroyReferenceRequest(incomingLink.getSource().getElement(), null, incomingLink.getTarget().getElement(), false); cmd.add(new org.eclipse.gmf.runtime.emf.type.core.commands.DestroyReferenceCommand(destroyRefReq)); cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), incomingLink)); break; -«ENDIF» -«IF !genIncomingLinks.filter[l | l.modelFacet instanceof TypeLinkModelFacet].empty» -«FOR il : genIncomingLinks.filter[l | l.modelFacet instanceof TypeLinkModelFacet]» - case «VisualIDRegistry.visualID(il)»: -«ENDFOR» +«ENDIF» +«IF !genIncomingLinks.filter[l | l.modelFacet instanceof TypeLinkModelFacet].empty» +«FOR il : genIncomingLinks.filter[l | l.modelFacet instanceof TypeLinkModelFacet]» + case «VisualIDRegistry.visualID(il)»: +«ENDFOR» org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest destroyEltReq = new org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest(incomingLink.getElement(), false); cmd.add(new org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand(destroyEltReq)); cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), incomingLink)); break; -«ENDIF» +«ENDIF» } } } -«ENDIF» +«ENDIF» -«IF genOutgoingLinks.isEmpty()» - for (java.util.Iterator<?> it = «view».getSourceEdges().iterator(); it.hasNext();) { +«IF genOutgoingLinks.isEmpty()» + for (java.util.Iterator<?> it = «view».getSourceEdges().iterator(); it.hasNext();) { org.eclipse.gmf.runtime.notation.Edge outgoingLink = (org.eclipse.gmf.runtime.notation.Edge) it.next(); - String vid = «xptVisualIDRegistry.getVisualIDMethodCall(getDiagram())»(outgoingLink); + String vid = «xptVisualIDRegistry.getVisualIDMethodCall(getDiagram())»(outgoingLink); if (vid != null) { switch(vid) { -«IF !genOutgoingLinks.filter[l | l.modelFacet instanceof FeatureLinkModelFacet].empty» -«FOR ol : genOutgoingLinks.filter[l | l.modelFacet instanceof FeatureLinkModelFacet]» - case «VisualIDRegistry.visualID(ol)»: -«ENDFOR» +«IF !genOutgoingLinks.filter[l | l.modelFacet instanceof FeatureLinkModelFacet].empty» +«FOR ol : genOutgoingLinks.filter[l | l.modelFacet instanceof FeatureLinkModelFacet]» + case «VisualIDRegistry.visualID(ol)»: +«ENDFOR» org.eclipse.gmf.runtime.emf.type.core.requests.DestroyReferenceRequest destroyRefReq = new org.eclipse.gmf.runtime.emf.type.core.requests.DestroyReferenceRequest(outgoingLink.getSource().getElement(), null, outgoingLink.getTarget().getElement(), false); cmd.add(new org.eclipse.gmf.runtime.emf.type.core.commands.DestroyReferenceCommand(destroyRefReq)); cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), outgoingLink)); break; -«ENDIF» -«IF !genOutgoingLinks.filter[l | l.modelFacet instanceof TypeLinkModelFacet].empty» -«FOR ol : genOutgoingLinks.filter[l | l.modelFacet instanceof TypeLinkModelFacet]» - case «VisualIDRegistry.visualID(ol)»: -«ENDFOR» +«ENDIF» +«IF !genOutgoingLinks.filter[l | l.modelFacet instanceof TypeLinkModelFacet].empty» +«FOR ol : genOutgoingLinks.filter[l | l.modelFacet instanceof TypeLinkModelFacet]» + case «VisualIDRegistry.visualID(ol)»: +«ENDFOR» org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest destroyEltReq = new org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest(outgoingLink.getElement(), false); cmd.add(new org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand(destroyEltReq)); cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), outgoingLink)); break; -«ENDIF» +«ENDIF» } } } -«ENDIF» +«ENDIF» ''' diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/OpenDiagram.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/OpenDiagram.xtend index d21c7db33cf..160a81e5f5d 100644 --- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/OpenDiagram.xtend +++ b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/OpenDiagram.xtend @@ -30,14 +30,14 @@ import xpt.editor.DiagramEditorUtil override openCommandClass_intializeNewDiagram(OpenDiagramBehaviour it) ''' - «generatedMemberComment» + «generatedMemberComment» protected org.eclipse.gmf.runtime.notation.Diagram intializeNewDiagram() throws org.eclipse.core.commands.ExecutionException { org.eclipse.gmf.runtime.notation.Diagram d = org.eclipse.gmf.runtime.diagram.core.services.ViewService.createDiagram(getDiagramDomainElement(), getDiagramKind(), getPreferencesHint()); if (d == null) { throw new org.eclipse.core.commands.ExecutionException("Can't create diagram of '" + getDiagramKind() + "' kind"); } diagramFacet.setDiagramLink(d); - «_assert('diagramFacet.eResource() != null')» + «_assert('diagramFacet.eResource() != null')» diagramFacet.eResource().getContents().add(d); org.eclipse.emf.ecore.EObject container = diagramFacet.eContainer(); while (container instanceof org.eclipse.gmf.runtime.notation.View) { @@ -45,18 +45,18 @@ import xpt.editor.DiagramEditorUtil container = container.eContainer(); } try { - «IF null == subject.diagram.editorGen.application» + «IF null == subject.diagram.editorGen.application» new org.eclipse.ui.actions.WorkspaceModifyOperation() { protected void execute(org.eclipse.core.runtime.IProgressMonitor monitor) throws org.eclipse.core.runtime.CoreException, java.lang.reflect.InvocationTargetException, InterruptedException { try { - «ENDIF» + «ENDIF» for (java.util.Iterator<?> it = diagramFacet.eResource().getResourceSet().getResources().iterator(); it.hasNext();) { org.eclipse.emf.ecore.resource.Resource nextResource = (org.eclipse.emf.ecore.resource.Resource) it.next(); if (nextResource.isLoaded() && !getEditingDomain().isReadOnly(nextResource)) { - nextResource.save(«xptDiagramEditorUtil.qualifiedClassName(subject.diagram)».getSaveOptions()); + nextResource.save(«xptDiagramEditorUtil.qualifiedClassName(subject.diagram)».getSaveOptions()); } } - «IF null == subject.diagram.editorGen.application» + «IF null == subject.diagram.editorGen.application» } catch (java.io.IOException ex) { throw new java.lang.reflect.InvocationTargetException(ex, "Save operation failed"); } @@ -67,11 +67,11 @@ import xpt.editor.DiagramEditorUtil } catch (InterruptedException e) { throw new org.eclipse.core.commands.ExecutionException("Can't create diagram of '" + getDiagramKind() + "' kind", e); } - «ELSE» + «ELSE» } catch (java.io.IOException ex) { throw new org.eclipse.core.commands.ExecutionException("Can't create diagram of '" + getDiagramKind() + "' kind", ex); } - «ENDIF» + «ENDIF» return d; } ''' diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/TextNonResizableEditPolicy.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/TextNonResizableEditPolicy.xtend index ca61b5e9ac7..4f1d271788c 100644 --- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/TextNonResizableEditPolicy.xtend +++ b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/TextNonResizableEditPolicy.xtend @@ -29,7 +29,7 @@ import xpt.Common override TextNonResizableEditPolicy_implementsClause(GenDiagram it) '''implements org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.edit.policies.labels.IRefreshableFeedbackEditPolicy''' override def TextNonResizableEditPolicy_createSelectionHandles(GenDiagram it) ''' - «generatedMemberComment» + «generatedMemberComment» protected java.util.List<?> createSelectionHandles() { org.eclipse.gef.handles.MoveHandle moveHandle = new org.eclipse.gef.handles.MoveHandle((org.eclipse.gef.GraphicalEditPart) getHost()); diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/TextSelectionEditPolicy.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/TextSelectionEditPolicy.xtend index 707fd1e40d0..674d7c7722b 100644 --- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/TextSelectionEditPolicy.xtend +++ b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/TextSelectionEditPolicy.xtend @@ -29,11 +29,11 @@ import xpt.CodeStyle override TextSelectionEditPolicy_implementsClause(GenDiagram it) '''implements org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.edit.policies.labels.IRefreshableFeedbackEditPolicy''' override textFeedback_createFocusFeedbackFigure(GenDiagram it) ''' - «generatedMemberComment» + «generatedMemberComment» protected org.eclipse.draw2d.IFigure createFocusFeedbackFigure() { return new org.eclipse.draw2d.Figure() { - «overrideC» + «overrideC» protected void paintFigure(org.eclipse.draw2d.Graphics graphics) { graphics.drawFocus(getBounds().getResized(-1, -1)); } @@ -42,11 +42,11 @@ import xpt.CodeStyle ''' override textFeedback_getHostPositionListener(GenDiagram it) ''' - «generatedMemberComment» + «generatedMemberComment» private org.eclipse.draw2d.FigureListener getHostPositionListener() { if (hostPositionListener == null) { hostPositionListener = new org.eclipse.draw2d.FigureListener() { - «overrideI» + «overrideI» public void figureMoved(org.eclipse.draw2d.IFigure source) { refreshFeedback(); } diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/childContainerCreateCommand.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/childContainerCreateCommand.xtend index e5e6783c4cf..7d45a6ab0bb 100644 --- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/childContainerCreateCommand.xtend +++ b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/childContainerCreateCommand.xtend @@ -34,9 +34,9 @@ import xpt.providers.ElementTypes override CharSequence childContainerCreateCommand(Iterable<? extends GenNode> nodes) ''' - «IF ! nodes.empty» + «IF ! nodes.empty» - «generatedMemberComment()» + «generatedMemberComment()» protected org.eclipse.gef.commands.Command getCreateCommand(org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest req) { org.eclipse.gmf.runtime.emf.type.core.IElementType requestElementType = req.getElementType(); if(requestElementType == null) { @@ -44,29 +44,29 @@ import xpt.providers.ElementTypes } - «FOR n : nodes» - «IF !n.sansDomain» - «childNodeCreateCommand(n.modelFacet, n)» - «ENDIF» - «ENDFOR» + «FOR n : nodes» + «IF !n.sansDomain» + «childNodeCreateCommand(n.modelFacet, n)» + «ENDIF» + «ENDFOR» return super.getCreateCommand(req); } - «ENDIF» + «ENDIF» ''' def childNodeCreateCommand(TypeModelFacet it,GenNode node)''' - if («accessElementType(node)» == requestElementType) { - «IF it.eResource.allContents.filter(typeof (GenerateUsingElementTypeCreationCommand)).size>0» + if («accessElementType(node)» == requestElementType) { + «IF it.eResource.allContents.filter(typeof (GenerateUsingElementTypeCreationCommand)).size>0» // adjust the containment feature - org.eclipse.emf.ecore.EReference containmentFeature = «MetaFeature(it.childMetaFeature)»; + org.eclipse.emf.ecore.EReference containmentFeature = «MetaFeature(it.childMetaFeature)»; req.setContainmentFeature(containmentFeature); - «ENDIF» + «ENDIF» - «IF it.eResource.allContents.filter(typeof (GenerateUsingElementTypeCreationCommand)).size>0» + «IF it.eResource.allContents.filter(typeof (GenerateUsingElementTypeCreationCommand)).size>0» return getGEFWrapper(getSemanticCreationCommand(req)); - «ELSE» - return getGEFWrapper(new «node.getCreateCommandQualifiedClassName()»(req, org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils.getDiagramFrom(getHost()))); - «ENDIF» + «ELSE» + return getGEFWrapper(new «node.getCreateCommandQualifiedClassName()»(req, org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils.getDiagramFrom(getHost()))); + «ENDIF» } ''' diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/linkCommands.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/linkCommands.xtend index b9ea848eedf..e9965711617 100644 --- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/linkCommands.xtend +++ b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/linkCommands.xtend @@ -62,18 +62,18 @@ import xpt.providers.ElementTypes override createLinkCommands(GenLinkEnd it) ''' - «IF it.eResource.allContents.filter(typeof (GenerateUsingElementTypeCreationCommand)).size <1» + «IF it.eResource.allContents.filter(typeof (GenerateUsingElementTypeCreationCommand)).size <1» - «generatedMemberComment()» + «generatedMemberComment()» protected org.eclipse.gef.commands.Command getCreateRelationshipCommand( org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest req) { org.eclipse.gef.commands.Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req); return command != null ? command : super.getCreateRelationshipCommand(req); } - «ENDIF» + «ENDIF» - «generatedMemberComment()» + «generatedMemberComment()» protected org.eclipse.gef.commands.Command getStartCreateRelationshipCommand( org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest req) { org.eclipse.gmf.runtime.emf.type.core.IElementType requestElementType = req.getElementType(); @@ -82,13 +82,13 @@ import xpt.providers.ElementTypes } org.eclipse.gmf.runtime.emf.type.core.IElementType baseElementType = requestElementType; - «FOR l : getAllPotentialLinks(it)» - «startLinkCommands(l, it)» - «ENDFOR» + «FOR l : getAllPotentialLinks(it)» + «startLinkCommands(l, it)» + «ENDFOR» return null; } - «generatedMemberComment()» + «generatedMemberComment()» protected org.eclipse.gef.commands.Command getCompleteCreateRelationshipCommand( org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest req) { org.eclipse.gmf.runtime.emf.type.core.IElementType requestElementType = req.getElementType(); @@ -97,63 +97,63 @@ import xpt.providers.ElementTypes } org.eclipse.gmf.runtime.emf.type.core.IElementType baseElementType = requestElementType; - «FOR l : getAllPotentialLinks(it)» - «completeLinkCommands(l, it)» - «ENDFOR» + «FOR l : getAllPotentialLinks(it)» + «completeLinkCommands(l, it)» + «ENDFOR» return null; } ''' override startLinkCommands(GenLink it, GenLinkEnd linkEnd) ''' - if («xptElementTypes.accessElementType(it)» == baseElementType) { - «IF createStartLinkCommand(it, linkEnd)» + if («xptElementTypes.accessElementType(it)» == baseElementType) { + «IF createStartLinkCommand(it, linkEnd)» - return getGEFWrapper(new «xptCreateLinkCommand.qualifiedClassName(it)»(req, - «IF createStartIncomingLinkCommand(it, linkEnd)» + return getGEFWrapper(new «xptCreateLinkCommand.qualifiedClassName(it)»(req, + «IF createStartIncomingLinkCommand(it, linkEnd)» req.getTarget(), req.getSource() - «ELSE» + «ELSE» req.getSource(), req.getTarget() - «ENDIF» + «ENDIF» )); - «ELSE» + «ELSE» return null; - «ENDIF» + «ENDIF» ''' override completeLinkCommands(GenLink it, GenLinkEnd linkEnd) ''' - if («xptElementTypes.accessElementType(it)» == baseElementType) { - «IF createCompleteLinkCommand(it, linkEnd)» + if («xptElementTypes.accessElementType(it)» == baseElementType) { + «IF createCompleteLinkCommand(it, linkEnd)» - return getGEFWrapper(new «xptCreateLinkCommand.qualifiedClassName(it)»(req, - «IF createCompleteOutgoingLinkCommand(it, linkEnd)» + return getGEFWrapper(new «xptCreateLinkCommand.qualifiedClassName(it)»(req, + «IF createCompleteOutgoingLinkCommand(it, linkEnd)» req.getTarget(), req.getSource() - «ELSE» + «ELSE» req.getSource(), req.getTarget() - «ENDIF» + «ENDIF» )); - «ELSE» + «ELSE» return null; - «ENDIF» + «ENDIF» ''' // We overwrite the reorientTypeLinkCommands to manages the links which use the ReorientCommand provided by the EditService override reorientTypeLinkCommands(GenLinkEnd it) ''' - «generatedMemberComment( + «generatedMemberComment( 'Returns command to reorient EClass based link. New link target or source\n' + 'should be the domain model element associated with this node.\n' - )» + )» protected org.eclipse.gef.commands.Command getReorientRelationshipCommand( org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest req) { String vid = getVisualID(req); if (vid != null) { switch (vid) { - «FOR link : getReroutableTypeLinks(it)» - «reorientLinkCommandWithService(link) » - «ENDFOR» - «callReorientCommand(it)» - «FOR link : getReroutableTypeLinks(it)» - «reorientLinkCommandWithoutService(link) » - «ENDFOR» + «FOR link : getReroutableTypeLinks(it)» + «reorientLinkCommandWithService(link) » + «ENDFOR» + «callReorientCommand(it)» + «FOR link : getReroutableTypeLinks(it)» + «reorientLinkCommandWithoutService(link) » + «ENDFOR» } } return super.getReorientRelationshipCommand(req); @@ -163,16 +163,16 @@ import xpt.providers.ElementTypes //This function writes only : "case myLinkEditPart.VISUAL_ID:" //for the link which uses the ReorientCommand provided by the EditService def reorientLinkCommandWithService(GenLink it) ''' - «IF it.eResource.allContents.filter(typeof(EditPartUsingReorientService)).filter[v| v.genView.contains(it)].size != 0» - «xptVisualIDRegistry.caseVisualID(it)» - «ENDIF» + «IF it.eResource.allContents.filter(typeof(EditPartUsingReorientService)).filter[v| v.genView.contains(it)].size != 0» + «xptVisualIDRegistry.caseVisualID(it)» + «ENDIF» ''' // This function writes the code to call the ReorientCommand provided by the ReorientService def callReorientCommand(GenLinkEnd it) ''' - «var rServiceNodes = it.eResource.allContents.filter(typeof (EditPartUsingReorientService))» - «IF !rServiceNodes.empty» - «IF !rServiceNodes.filter[rServiceNode|(!(rServiceNode.genView.filter[view|getReroutableTypeLinks(it).toList.contains(view)].empty))].empty» + «var rServiceNodes = it.eResource.allContents.filter(typeof (EditPartUsingReorientService))» + «IF !rServiceNodes.empty» + «IF !rServiceNodes.filter[rServiceNode|(!(rServiceNode.genView.filter[view|getReroutableTypeLinks(it).toList.contains(view)].empty))].empty» org.eclipse.papyrus.infra.services.edit.service.IElementEditService provider =org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils.getCommandProvider(req.getRelationship()); if(provider == null) { return org.eclipse.gef.commands.UnexecutableCommand.INSTANCE; @@ -183,15 +183,15 @@ import xpt.providers.ElementTypes return org.eclipse.gef.commands.UnexecutableCommand.INSTANCE; } return getGEFWrapper(reorientCommand.reduce()); - «ENDIF» - «ENDIF» + «ENDIF» + «ENDIF» ''' // This function writes the code for the Links which uses their own ReorientCommand (the initial code) def reorientLinkCommandWithoutService(GenLink it) ''' - «IF it.eResource.allContents.filter(EditPartUsingReorientService).filter[v|v.genView.contains(it)].size == 0» - «reorientLinkCommand(it)» - «ENDIF» + «IF it.eResource.allContents.filter(EditPartUsingReorientService).filter[v|v.genView.contains(it)].size == 0» + «reorientLinkCommand(it)» + «ENDIF» ''' } diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/preferences/extensions.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/preferences/extensions.xtend index 088978953ec..b4967d9cea6 100644 --- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/preferences/extensions.xtend +++ b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/preferences/extensions.xtend @@ -34,40 +34,40 @@ import xpt.diagram.Utils_qvto override extensions(GenDiagram it) ''' - «tripleSpace(1)»<extension point="org.eclipse.core.runtime.preferences" id="prefs"> - «tripleSpace(2)»«xmlGeneratedTag» - «tripleSpace(2)»<initializer class="«xptPreferenceInitializer.qualifiedClassName(it)»"/> - «tripleSpace(1)»</extension> + «tripleSpace(1)»<extension point="org.eclipse.core.runtime.preferences" id="prefs"> + «tripleSpace(2)»«xmlGeneratedTag» + «tripleSpace(2)»<initializer class="«xptPreferenceInitializer.qualifiedClassName(it)»"/> + «tripleSpace(1)»</extension> - «IF ! it.preferencePages.empty» - «tripleSpace(1)»<extension point="org.eclipse.ui.preferencePages" id="prefpages"> - «tripleSpace(2)»«xmlGeneratedTag» - «FOR pref : allPreferencePages(it)» - «IF pref instanceof GenStandardPreferencePage» - «papyrusPreferencePage(pref as GenStandardPreferencePage)» - «ENDIF» - «ENDFOR» - «tripleSpace(1)»</extension> - «ENDIF» + «IF ! it.preferencePages.empty» + «tripleSpace(1)»<extension point="org.eclipse.ui.preferencePages" id="prefpages"> + «tripleSpace(2)»«xmlGeneratedTag» + «FOR pref : allPreferencePages(it)» + «IF pref instanceof GenStandardPreferencePage» + «papyrusPreferencePage(pref as GenStandardPreferencePage)» + «ENDIF» + «ENDFOR» + «tripleSpace(1)»</extension> + «ENDIF» ''' def papyrusPreferencePage(GenStandardPreferencePage it) ''' - «IF StandardPreferencePages.GENERAL_LITERAL == kind» + «IF StandardPreferencePages.GENERAL_LITERAL == kind» <page - id="«getDiagramPreferencePageCategory()».«getDiagram().editorGen.modelID»" - name="«getDiagram().editorGen.modelID» Diagram" - category="«getDiagramPreferencePageCategory()»" - class="«getQualifiedClassName()»"> + id="«getDiagramPreferencePageCategory()».«getDiagram().editorGen.modelID»" + name="«getDiagram().editorGen.modelID» Diagram" + category="«getDiagramPreferencePageCategory()»" + class="«getQualifiedClassName()»"> </page> - «ELSEIF StandardPreferencePages.PRINTING_LITERAL == kind || - StandardPreferencePages.RULERS_AND_GRID_LITERAL == kind» + «ELSEIF StandardPreferencePages.PRINTING_LITERAL == kind || + StandardPreferencePages.RULERS_AND_GRID_LITERAL == kind» <page - id="«getQualifiedClassName()»" - name="%prefpage.«ID»" - category="«getDiagramPreferencePageCategory()».«getDiagram().editorGen.modelID»" - class="«getQualifiedClassName()»"> + id="«getQualifiedClassName()»" + name="%prefpage.«ID»" + category="«getDiagramPreferencePageCategory()».«getDiagram().editorGen.modelID»" + class="«getQualifiedClassName()»"> </page> - «ENDIF» + «ENDIF» ''' } diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/updater/DiagramUpdater.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/updater/DiagramUpdater.xtend index 675fefc704b..d28affc57cc 100644 --- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/updater/DiagramUpdater.xtend +++ b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/updater/DiagramUpdater.xtend @@ -53,280 +53,280 @@ import org.eclipse.emf.codegen.ecore.genmodel.GenFeature @Inject MetaModel xptMetaModel; def diagramUpdaterInstanceToUse(GenDiagramUpdater it) ''' - «IF it.eResource.allContents.filter(typeof(CustomDiagramUpdaterSingleton)).filter[v|v.singletonPath != null].size == - 1» - «it.eResource.allContents.filter(typeof(CustomDiagramUpdaterSingleton)).filter[v|v.singletonPath != null].head. - singletonPath» - «ELSE» - «diagramUpdaterQualifiedClassName».INSTANCE - «ENDIF» + «IF it.eResource.allContents.filter(typeof(CustomDiagramUpdaterSingleton)).filter[v|v.singletonPath != null].size == + 1» + «it.eResource.allContents.filter(typeof(CustomDiagramUpdaterSingleton)).filter[v|v.singletonPath != null].head. + singletonPath» + «ELSE» + «diagramUpdaterQualifiedClassName».INSTANCE + «ENDIF» ''' protected def typeOfCrossReferenceAdapter() '''org.eclipse.gmf.runtime.emf.core.util.CrossReferenceAdapter''' - override getSemanticChildrenMethodCall(GenContainerBase it) '''«diagramUpdaterInstanceToUse(it.diagramUpdater)».«getSemanticChildrenMethodName( - it)»''' + override getSemanticChildrenMethodCall(GenContainerBase it) '''«diagramUpdaterInstanceToUse(it.diagramUpdater)».«getSemanticChildrenMethodName( + it)»''' - override doGetSomeLinksMethodCall(GenCommonBase it, UpdaterLinkType linkType) '''«diagramUpdaterInstanceToUse( - it.getDiagram().diagramUpdater)».«linkGetterName(linkType)»''' + override doGetSomeLinksMethodCall(GenCommonBase it, UpdaterLinkType linkType) '''«diagramUpdaterInstanceToUse( + it.getDiagram().diagramUpdater)».«linkGetterName(linkType)»''' // override runtimeTypedInstanceName(GenDiagramUpdater it) '''INSTANCE''' // - // override runtimeTypedInstanceCall(GenDiagramUpdater it) '''«qualifiedClassName(it)».«runtimeTypedInstanceName(it)»''' + // override runtimeTypedInstanceCall(GenDiagramUpdater it) '''«qualifiedClassName(it)».«runtimeTypedInstanceName(it)»''' //protected constructor to allow overriding def _constructor(GenDiagramUpdater it) ''' - «generatedMemberComment()» - protected «diagramUpdaterClassName»(){ + «generatedMemberComment()» + protected «diagramUpdaterClassName»(){ //to prevent instantiation allowing the override } ''' //create the singleton using custom class defined in GMFGen public def classSingleton(GenDiagramUpdater it) ''' - «««we create the singleton only in the case where there is no custom diagram updater - «IF it.eResource.allContents.filter(typeof(CustomDiagramUpdaterSingleton)).filter[v|v.singletonPath != null].size != 1» - «generatedMemberComment()» - public static final «diagramUpdaterQualifiedClassName» INSTANCE = new «diagramUpdaterClassName»(); - «ENDIF» + «««we create the singleton only in the case where there is no custom diagram updater + «IF it.eResource.allContents.filter(typeof(CustomDiagramUpdaterSingleton)).filter[v|v.singletonPath != null].size != 1» + «generatedMemberComment()» + public static final «diagramUpdaterQualifiedClassName» INSTANCE = new «diagramUpdaterClassName»(); + «ENDIF» ''' override DiagramUpdater(GenDiagramUpdater it) ''' - «copyright(editorGen)» - package «packageName(it)»; + «copyright(editorGen)» + package «packageName(it)»; - «generatedClassComment» - public class «className(it)» implements org.eclipse.papyrus.infra.gmfdiag.common.updater.DiagramUpdater { - «classSingleton(it)» - «_constructor(it)» - «isShortcutOrphaned(it)» - «var semanticContainers = it.editorGen.diagram.allContainers.filter[container|hasSemanticChildren(container)]» - «getGenericSemanticChildrenOfView(it, semanticContainers)» - «FOR next : semanticContainers» - «getSemanticChildrenOfView(next)» - «ENDFOR» + «generatedClassComment» + public class «className(it)» implements org.eclipse.papyrus.infra.gmfdiag.common.updater.DiagramUpdater { + «classSingleton(it)» + «_constructor(it)» + «isShortcutOrphaned(it)» + «var semanticContainers = it.editorGen.diagram.allContainers.filter[container|hasSemanticChildren(container)]» + «getGenericSemanticChildrenOfView(it, semanticContainers)» + «FOR next : semanticContainers» + «getSemanticChildrenOfView(next)» + «ENDFOR» - «getPhantomNodesIterator(it)» + «getPhantomNodesIterator(it)» - «getGenericConnectedLinks(it, getAllSemanticElements(editorGen.diagram), UpdaterLinkType::CONTAINED)» + «getGenericConnectedLinks(it, getAllSemanticElements(editorGen.diagram), UpdaterLinkType::CONTAINED)» - «getGenericConnectedLinks(it, getAllSemanticDiagramElements(editorGen.diagram), UpdaterLinkType::INCOMING)» + «getGenericConnectedLinks(it, getAllSemanticDiagramElements(editorGen.diagram), UpdaterLinkType::INCOMING)» - «getGenericConnectedLinks(it, getAllSemanticDiagramElements(editorGen.diagram), UpdaterLinkType::OUTGOING)» - «FOR e : getAllSemanticElements(editorGen.diagram)» - «getContainedLinks(e)» - «ENDFOR» - «FOR e : getAllSemanticDiagramElements(editorGen.diagram)» - «getIncomingLinks(e)» - «ENDFOR» - «FOR e : getAllSemanticDiagramElements(editorGen.diagram)» - «getOutgoingLinks(e)» - «ENDFOR» - «FOR link : getAllContainedLinks(editorGen.diagram)» - «getContainedLinksByTypeMethod(link)» - «ENDFOR» - «FOR link : getAllIncomingLinks(editorGen.diagram)» - «getIncomingLinksByTypeMethod(link)» - «ENDFOR» - «FOR link : getAllOutgoingLinks(editorGen.diagram)» - «getOutgoingLinksByTypeMethod(link)» - «ENDFOR» + «getGenericConnectedLinks(it, getAllSemanticDiagramElements(editorGen.diagram), UpdaterLinkType::OUTGOING)» + «FOR e : getAllSemanticElements(editorGen.diagram)» + «getContainedLinks(e)» + «ENDFOR» + «FOR e : getAllSemanticDiagramElements(editorGen.diagram)» + «getIncomingLinks(e)» + «ENDFOR» + «FOR e : getAllSemanticDiagramElements(editorGen.diagram)» + «getOutgoingLinks(e)» + «ENDFOR» + «FOR link : getAllContainedLinks(editorGen.diagram)» + «getContainedLinksByTypeMethod(link)» + «ENDFOR» + «FOR link : getAllIncomingLinks(editorGen.diagram)» + «getIncomingLinksByTypeMethod(link)» + «ENDFOR» + «FOR link : getAllOutgoingLinks(editorGen.diagram)» + «getOutgoingLinksByTypeMethod(link)» + «ENDFOR» - «runtimeTypedInstance(it)» + «runtimeTypedInstance(it)» - «additions(it)» + «additions(it)» } ''' override def getConnectedLinks(GenCommonBase it, Iterable<GenLink> genLinks, UpdaterLinkType linkType, boolean needCrossReferencer) ''' - «generatedMemberComment» - «««remove static modifier - public «listOfLinkDescriptors(it)» «linkGetterName(it, linkType)»(org.eclipse.gmf.runtime.notation.View view) { - «IF genLinks.notEmpty» - «xptMetaModel.DeclareAndAssign(it.metaClass, 'modelElement', 'view.getElement()')» - «IF needCrossReferencer» - «typeOfCrossReferenceAdapter» crossReferencer = «typeOfCrossReferenceAdapter».getCrossReferenceAdapter(view.eResource().getResourceSet()); - «ENDIF» - «newLinkedListOfLinkDescriptors(it.diagramUpdater, 'result')»(); - «FOR link : genLinks» - «colectConnectedLinks(link, linkType, needCrossReferencer, isExternalInterface(it.metaClass))» - «ENDFOR» + «generatedMemberComment» + «««remove static modifier + public «listOfLinkDescriptors(it)» «linkGetterName(it, linkType)»(org.eclipse.gmf.runtime.notation.View view) { + «IF genLinks.notEmpty» + «xptMetaModel.DeclareAndAssign(it.metaClass, 'modelElement', 'view.getElement()')» + «IF needCrossReferencer» + «typeOfCrossReferenceAdapter» crossReferencer = «typeOfCrossReferenceAdapter».getCrossReferenceAdapter(view.eResource().getResourceSet()); + «ENDIF» + «newLinkedListOfLinkDescriptors(it.diagramUpdater, 'result')»(); + «FOR link : genLinks» + «colectConnectedLinks(link, linkType, needCrossReferencer, isExternalInterface(it.metaClass))» + «ENDFOR» return result; - «ELSE» - return «newEmptyList()»; - «ENDIF» + «ELSE» + return «newEmptyList()»; + «ENDIF» } ''' override def colectConnectedLinks(GenLink it, UpdaterLinkType linkType, boolean needCrossReferencer, boolean isExternalInterface) ''' - «IF it.modelFacet != null» - «IF isExternalInterface && !it.modelFacet.oclIsKindOf(typeof(FeatureLinkModelFacet))» - if («xptMetaModel.IsInstance(it.modelFacet.getLinkEndType(linkType), 'modelElement')») { - «ENDIF» - result.addAll(«chooseConnectedLinksByTypeMethodName(it.modelFacet, linkType, it)»(« // - IF isExternalInterface && !it.modelFacet.oclIsKindOf(typeof(FeatureLinkModelFacet))»«xptMetaModel. - CastEObject(it.modelFacet.getLinkEndType(linkType), 'modelElement')»«ELSE»modelElement«ENDIF»«IF needCrossReferencer», crossReferencer«ENDIF»)); - «IF isExternalInterface && !it.modelFacet.oclIsKindOf(typeof(FeatureLinkModelFacet))» + «IF it.modelFacet != null» + «IF isExternalInterface && !it.modelFacet.oclIsKindOf(typeof(FeatureLinkModelFacet))» + if («xptMetaModel.IsInstance(it.modelFacet.getLinkEndType(linkType), 'modelElement')») { + «ENDIF» + result.addAll(«chooseConnectedLinksByTypeMethodName(it.modelFacet, linkType, it)»(« // + IF isExternalInterface && !it.modelFacet.oclIsKindOf(typeof(FeatureLinkModelFacet))»«xptMetaModel. + CastEObject(it.modelFacet.getLinkEndType(linkType), 'modelElement')»«ELSE»modelElement«ENDIF»«IF needCrossReferencer», crossReferencer«ENDIF»)); + «IF isExternalInterface && !it.modelFacet.oclIsKindOf(typeof(FeatureLinkModelFacet))» } - «ENDIF» - «ENDIF» + «ENDIF» + «ENDIF» ''' override def getIncomingLinksByTypeMethod(GenLink it) ''' - «generatedMemberComment» - «««remove static modifier + private->protected - protected java.util.Collection<«linkDescriptor.qualifiedClassName(it.diagramUpdater)»> «getConnectedLinksByTypeMethodName( - UpdaterLinkType::INCOMING)»(«xptMetaModel.QualifiedClassName(it.modelFacet.targetType)» target, «typeOfCrossReferenceAdapter» crossReferencer) { - «newLinkedListOfLinkDescriptors(it.diagramUpdater, 'result')»(); + «generatedMemberComment» + «««remove static modifier + private->protected + protected java.util.Collection<«linkDescriptor.qualifiedClassName(it.diagramUpdater)»> «getConnectedLinksByTypeMethodName( + UpdaterLinkType::INCOMING)»(«xptMetaModel.QualifiedClassName(it.modelFacet.targetType)» target, «typeOfCrossReferenceAdapter» crossReferencer) { + «newLinkedListOfLinkDescriptors(it.diagramUpdater, 'result')»(); java.util.Collection<org.eclipse.emf.ecore.EStructuralFeature.Setting> settings = crossReferencer.getInverseReferences(target); for (org.eclipse.emf.ecore.EStructuralFeature.Setting setting : settings) { - «getIncomingLinksByTypeMethodBody(it.modelFacet, it)» + «getIncomingLinksByTypeMethodBody(it.modelFacet, it)» } return result; } ''' - def CharSequence getICustomDiagramUpdater(GenContainerBase it) '''org.eclipse.papyrus.uml.diagram.common.part.ICustomDiagramUpdater<«nodeDescriptor. - qualifiedClassName(it.diagramUpdater)»>''' + def CharSequence getICustomDiagramUpdater(GenContainerBase it) '''org.eclipse.papyrus.uml.diagram.common.part.ICustomDiagramUpdater<«nodeDescriptor. + qualifiedClassName(it.diagramUpdater)»>''' override getSemanticChildrenOfView(GenContainerBase it) ''' - «««remove static modifier - «IF it.eResource.allContents.filter(typeof(SpecificDiagramUpdater)).filter[v|v.genNode == it && v.classpath != null]. - size != 0» - «generatedMemberComment» - «FOR updater : it.eResource.allContents.filter(typeof(SpecificDiagramUpdater)).filter[v| - v.genNode == it && v.classpath != null].toIterable» - public «listOfNodeDescriptors» «getSemanticChildrenMethodName(it)»(org.eclipse.gmf.runtime.notation.View view) { - «getICustomDiagramUpdater(it)» customUpdater = new «updater.classpath»(); + «««remove static modifier + «IF it.eResource.allContents.filter(typeof(SpecificDiagramUpdater)).filter[v|v.genNode == it && v.classpath != null]. + size != 0» + «generatedMemberComment» + «FOR updater : it.eResource.allContents.filter(typeof(SpecificDiagramUpdater)).filter[v| + v.genNode == it && v.classpath != null].toIterable» + public «listOfNodeDescriptors» «getSemanticChildrenMethodName(it)»(org.eclipse.gmf.runtime.notation.View view) { + «getICustomDiagramUpdater(it)» customUpdater = new «updater.classpath»(); return customUpdater.getSemanticChildren(view); } - «ENDFOR» - «ELSE» - «generatedMemberComment» - public «listOfNodeDescriptors» «getSemanticChildrenMethodName(it)»(org.eclipse.gmf.runtime.notation.View view) { - «IF getSemanticChildrenChildFeatures(it).notEmpty || it.getPhantomNodes().notEmpty» - «defineModelElement(it)» - «newLinkedListOfNodeDescriptors(it.diagramUpdater, 'result')»(); - «/* childMetaFeature can be null here! */FOR childMetaFeature : getSemanticChildrenChildFeatures(it)» - «IF null == childMetaFeature» + «ENDFOR» + «ELSE» + «generatedMemberComment» + public «listOfNodeDescriptors» «getSemanticChildrenMethodName(it)»(org.eclipse.gmf.runtime.notation.View view) { + «IF getSemanticChildrenChildFeatures(it).notEmpty || it.getPhantomNodes().notEmpty» + «defineModelElement(it)» + «newLinkedListOfNodeDescriptors(it.diagramUpdater, 'result')»(); + «/* childMetaFeature can be null here! */FOR childMetaFeature : getSemanticChildrenChildFeatures(it)» + «IF null == childMetaFeature» { /*FIXME no containment/child feature found in the genmodel, toolsmith need to specify Class here manually*/ childElement = /*FIXME no containment/child feature found in the genmodel, toolsmith need to specify correct one here manually*/; - «ELSEIF childMetaFeature.listType» - for (java.util.Iterator<?> it = «xptMetaModel.getFeatureValue(childMetaFeature, 'modelElement', it.getModelElementType())».iterator(); it.hasNext();) { - «xptMetaModel.DeclareAndAssign(childMetaFeature.typeGenClass, 'childElement', 'it.next()', true)» - «ELSE» - { «xptMetaModel.DeclareAndAssign(childMetaFeature.typeGenClass, 'childElement', 'modelElement', - it.getModelElementType(), childMetaFeature)» - «ENDIF» - String visualID = «xptVisualIDRegistry.getNodeVisualIDMethodCall(it.diagram)»(view, «xptMetaModel. - DowncastToEObject(childMetaFeature.typeGenClass, 'childElement')»); - «FOR next : getSemanticChildren(it, childMetaFeature)» - «checkChildElementVisualID(next, null != childMetaFeature && childMetaFeature.listType)» - «ENDFOR» + «ELSEIF childMetaFeature.listType» + for (java.util.Iterator<?> it = «xptMetaModel.getFeatureValue(childMetaFeature, 'modelElement', it.getModelElementType())».iterator(); it.hasNext();) { + «xptMetaModel.DeclareAndAssign(childMetaFeature.typeGenClass, 'childElement', 'it.next()', true)» + «ELSE» + { «xptMetaModel.DeclareAndAssign(childMetaFeature.typeGenClass, 'childElement', 'modelElement', + it.getModelElementType(), childMetaFeature)» + «ENDIF» + String visualID = «xptVisualIDRegistry.getNodeVisualIDMethodCall(it.diagram)»(view, «xptMetaModel. + DowncastToEObject(childMetaFeature.typeGenClass, 'childElement')»); + «FOR next : getSemanticChildren(it, childMetaFeature)» + «checkChildElementVisualID(next, null != childMetaFeature && childMetaFeature.listType)» + «ENDFOR» } - «ENDFOR» - «IF it.getPhantomNodes.notEmpty» + «ENDFOR» + «IF it.getPhantomNodes.notEmpty» org.eclipse.emf.ecore.resource.Resource resource = modelElement.eResource(); for (java.util.Iterator<org.eclipse.emf.ecore.EObject> it = getPhantomNodesIterator(resource); it.hasNext();) { org.eclipse.emf.ecore.EObject childElement = it.next(); if (childElement == modelElement) { continue; } - «FOR phantom : it.phantomNodes» - «addNextIfPhantom(phantom)» - «ENDFOR» + «FOR phantom : it.phantomNodes» + «addNextIfPhantom(phantom)» + «ENDFOR» } - «ENDIF» + «ENDIF» return result; - «ELSE» - return «newEmptyList()»; - «ENDIF» + «ELSE» + return «newEmptyList()»; + «ENDIF» } - «ENDIF» + «ENDIF» ''' override defineLinkSource(TypeLinkModelFacet it, boolean inLoop) ''' - «IF sourceMetaFeature.listType» - java.util.List<?> sources = «xptMetaModel.getFeatureValue(sourceMetaFeature, 'link', metaClass)»; + «IF sourceMetaFeature.listType» + java.util.List<?> sources = «xptMetaModel.getFeatureValue(sourceMetaFeature, 'link', metaClass)»; Object theSource = sources.size() == 1 ? sources.get(0) : null; - if («xptMetaModel.NotInstance(it.sourceType, 'theSource')») { - «stopLinkProcessing(inLoop)» + if («xptMetaModel.NotInstance(it.sourceType, 'theSource')») { + «stopLinkProcessing(inLoop)» } - «xptMetaModel.DeclareAndAssign(it.sourceType, 'src', 'theSource', true)» - «ELSE» - «xptMetaModel.DeclareAndAssign(it.sourceType, 'src', 'link', metaClass, sourceMetaFeature)» - «ENDIF» + «xptMetaModel.DeclareAndAssign(it.sourceType, 'src', 'theSource', true)» + «ELSE» + «xptMetaModel.DeclareAndAssign(it.sourceType, 'src', 'link', metaClass, sourceMetaFeature)» + «ENDIF» ''' def isDiagram(GenDiagram it) '''''' override defineLinkDestination(TypeLinkModelFacet it, Boolean inLoop) ''' - «IF targetMetaFeature.listType» - java.util.List<?> targets = «xptMetaModel.getFeatureValue(it.targetMetaFeature, 'link', metaClass)»; + «IF targetMetaFeature.listType» + java.util.List<?> targets = «xptMetaModel.getFeatureValue(it.targetMetaFeature, 'link', metaClass)»; Object theTarget = targets.size() == 1 ? targets.get(0) : null; - if («xptMetaModel.NotInstance(it.targetType, 'theTarget')») { - «stopLinkProcessing(inLoop)» + if («xptMetaModel.NotInstance(it.targetType, 'theTarget')») { + «stopLinkProcessing(inLoop)» } - «xptMetaModel.DeclareAndAssign(it.targetType, 'dst', 'theTarget', true)» - «ELSE» - «xptMetaModel.DeclareAndAssign(it.targetType, 'dst', 'link', metaClass, targetMetaFeature)» - «ENDIF» + «xptMetaModel.DeclareAndAssign(it.targetType, 'dst', 'theTarget', true)» + «ELSE» + «xptMetaModel.DeclareAndAssign(it.targetType, 'dst', 'link', metaClass, targetMetaFeature)» + «ENDIF» ''' //remove static modifier + private->protected - override getOutgoingLinksByTypeMethodSignature(GenLink it) '''protected java.util.Collection<«linkDescriptor. - qualifiedClassName(it.diagramUpdater)»> «getConnectedLinksByTypeMethodName(UpdaterLinkType::OUTGOING)»(«xptMetaModel. - QualifiedClassName(it.modelFacet.sourceType)» source)''' + override getOutgoingLinksByTypeMethodSignature(GenLink it) '''protected java.util.Collection<«linkDescriptor. + qualifiedClassName(it.diagramUpdater)»> «getConnectedLinksByTypeMethodName(UpdaterLinkType::OUTGOING)»(«xptMetaModel. + QualifiedClassName(it.modelFacet.sourceType)» source)''' override getGenericSemanticChildrenOfView(GenDiagramUpdater it, Iterable<GenContainerBase> semanticContainers) ''' - «generatedMemberComment» - ««« remove static modifier - public «listOfNodeDescriptors» getSemanticChildren(org.eclipse.gmf.runtime.notation.View view) { - «IF semanticContainers.notEmpty» - String vid = «xptVisualIDRegistry.getVisualIDMethodCall(editorGen.diagram)»(view); + «generatedMemberComment» + ««« remove static modifier + public «listOfNodeDescriptors» getSemanticChildren(org.eclipse.gmf.runtime.notation.View view) { + «IF semanticContainers.notEmpty» + String vid = «xptVisualIDRegistry.getVisualIDMethodCall(editorGen.diagram)»(view); if (vid != null) { switch (vid) { - «FOR next : semanticContainers» - «getSemanticChildrenCase(next)» - «ENDFOR» + «FOR next : semanticContainers» + «getSemanticChildrenCase(next)» + «ENDFOR» } } - «ENDIF» - return «newEmptyList()»; + «ENDIF» + return «newEmptyList()»; } ''' override dispatch getContainedLinksByTypeMethod(TypeLinkModelFacet it, GenLink genLink) ''' - «generatedMemberComment» - ««« remove static modifier + private->protected - protected java.util.Collection<«linkDescriptor.qualifiedClassName(genLink.diagramUpdater)»> «getConnectedLinksByTypeMethodName( - genLink, UpdaterLinkType::CONTAINED)»(«xptMetaModel.QualifiedClassName(childMetaFeature.genClass)» container) { - «getContainedLinksByTypeMethodBody(it, genLink, false)» + «generatedMemberComment» + ««« remove static modifier + private->protected + protected java.util.Collection<«linkDescriptor.qualifiedClassName(genLink.diagramUpdater)»> «getConnectedLinksByTypeMethodName( + genLink, UpdaterLinkType::CONTAINED)»(«xptMetaModel.QualifiedClassName(childMetaFeature.genClass)» container) { + «getContainedLinksByTypeMethodBody(it, genLink, false)» } ''' override getGenericConnectedLinks(GenDiagramUpdater it, Iterable<? extends GenCommonBase> linkContainers, UpdaterLinkType linkType) ''' - «generatedMemberComment» - ««« remove static modifier - public «listOfLinkDescriptors» get«linkType.linkMethodSuffix»Links(org.eclipse.gmf.runtime.notation.View view) { - «IF linkContainers.notEmpty» - String vid = «xptVisualIDRegistry.getVisualIDMethodCall(it.editorGen.diagram)»(view); + «generatedMemberComment» + ««« remove static modifier + public «listOfLinkDescriptors» get«linkType.linkMethodSuffix»Links(org.eclipse.gmf.runtime.notation.View view) { + «IF linkContainers.notEmpty» + String vid = «xptVisualIDRegistry.getVisualIDMethodCall(it.editorGen.diagram)»(view); if (vid != null) { switch (vid) { - «FOR next : linkContainers» - «getContainedLinksCase(next, linkType)» - «ENDFOR» + «FOR next : linkContainers» + «getContainedLinksCase(next, linkType)» + «ENDFOR» } } - «ENDIF» - return «newEmptyList»; + «ENDIF» + return «newEmptyList»; } ''' @@ -338,25 +338,25 @@ import org.eclipse.emf.codegen.ecore.genmodel.GenFeature * Need to check with case when it.modelFacet.childMetaFeature == null */ override def checkChildElementVisualID(GenNode it, Boolean inLoop) ''' - if («VisualIDRegistry::visualID(it)».equals(visualID)) { - result.add(new «nodeDescriptor.qualifiedClassName(it.getDiagram().diagramUpdater)»(«IF null != modelFacet.childMetaFeature»«xptMetaModel.DowncastToEObject(modelFacet.childMetaFeature.typeGenClass, 'childElement')», «ENDIF»visualID)); - «IF inLoop» + if («VisualIDRegistry::visualID(it)».equals(visualID)) { + result.add(new «nodeDescriptor.qualifiedClassName(it.getDiagram().diagramUpdater)»(«IF null != modelFacet.childMetaFeature»«xptMetaModel.DowncastToEObject(modelFacet.childMetaFeature.typeGenClass, 'childElement')», «ENDIF»visualID)); + «IF inLoop» continue; - «ENDIF» + «ENDIF» } ''' override def checkLinkVisualID(TypeLinkModelFacet it, GenLink genLink, boolean inLoop) ''' - if (!«VisualIDRegistry::visualID(genLink)».equals(«xptVisualIDRegistry.getLinkWithClassVisualIDMethodCall(genLink.diagram)»(«xptMetaModel.DowncastToEObject(metaClass, 'link')»))) { - «stopLinkProcessing(inLoop)» + if (!«VisualIDRegistry::visualID(genLink)».equals(«xptVisualIDRegistry.getLinkWithClassVisualIDMethodCall(genLink.diagram)»(«xptMetaModel.DowncastToEObject(metaClass, 'link')»))) { + «stopLinkProcessing(inLoop)» } ''' - override def getSemanticChildrenMethodName(GenContainerBase it) '''get«stringUniqueIdentifier()»_SemanticChildren''' + override def getSemanticChildrenMethodName(GenContainerBase it) '''get«stringUniqueIdentifier()»_SemanticChildren''' - override protected def linkGetterName(GenCommonBase it, UpdaterLinkType linkType) '''get«stringUniqueIdentifier()»_«linkType.linkMethodSuffix»Links''' + override protected def linkGetterName(GenCommonBase it, UpdaterLinkType linkType) '''get«stringUniqueIdentifier()»_«linkType.linkMethodSuffix»Links''' - override def getConnectedLinksByTypeMethodName(GenLink it, UpdaterLinkType linkType) '''get«linkType.linkMethodSuffix»«getConnectedLinksByTypeMethodFragment(modelFacet)»_«stringVisualID»''' + override def getConnectedLinksByTypeMethodName(GenLink it, UpdaterLinkType linkType) '''get«linkType.linkMethodSuffix»«getConnectedLinksByTypeMethodFragment(modelFacet)»_«stringVisualID»''' override def dispatch getConnectedLinksByTypeMethodFragment(TypeLinkModelFacet it) '''TypeModelFacetLinks''' diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/updater/LinkDescriptor.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/updater/LinkDescriptor.xtend index 0f3dddb5d1b..9dd24784346 100644 --- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/updater/LinkDescriptor.xtend +++ b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/updater/LinkDescriptor.xtend @@ -28,15 +28,15 @@ import xpt.Common override def extendsList(GenDiagramUpdater it) '''extends org.eclipse.papyrus.infra.gmfdiag.common.updater.UpdaterLinkDescriptor''' override def refOnlyLinkConstructor(GenDiagramUpdater it) ''' - «generatedMemberComment» - public «className(it)»(org.eclipse.emf.ecore.EObject source, org.eclipse.emf.ecore.EObject destination, org.eclipse.gmf.runtime.emf.type.core.IElementType elementType, String linkVID) { + «generatedMemberComment» + public «className(it)»(org.eclipse.emf.ecore.EObject source, org.eclipse.emf.ecore.EObject destination, org.eclipse.gmf.runtime.emf.type.core.IElementType elementType, String linkVID) { super(source, destination, elementType, linkVID); } ''' override def typeLinkConstructor(GenDiagramUpdater it) ''' - «generatedMemberComment» - public «className(it)»(org.eclipse.emf.ecore.EObject source, org.eclipse.emf.ecore.EObject destination, org.eclipse.emf.ecore.EObject linkElement, org.eclipse.gmf.runtime.emf.type.core.IElementType elementType, String linkVID) { + «generatedMemberComment» + public «className(it)»(org.eclipse.emf.ecore.EObject source, org.eclipse.emf.ecore.EObject destination, org.eclipse.emf.ecore.EObject linkElement, org.eclipse.gmf.runtime.emf.type.core.IElementType elementType, String linkVID) { super(source, destination, linkElement, elementType, linkVID); } ''' diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/updater/NodeDescriptor.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/updater/NodeDescriptor.xtend index 58800a6d981..ddebc0d8bce 100644 --- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/updater/NodeDescriptor.xtend +++ b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/updater/NodeDescriptor.xtend @@ -28,8 +28,8 @@ import xpt.Common override def extendsList(GenDiagramUpdater it) '''extends org.eclipse.papyrus.infra.gmfdiag.common.updater.UpdaterNodeDescriptor''' override def constructor(GenDiagramUpdater it) ''' - «generatedMemberComment» - public «className(it)»(org.eclipse.emf.ecore.EObject modelElement, String visualID) { + «generatedMemberComment» + public «className(it)»(org.eclipse.emf.ecore.EObject modelElement, String visualID) { super(modelElement, visualID); } ''' diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/views/ViewStyles.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/views/ViewStyles.xtend index 928ccf14b7c..506090587b7 100644 --- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/views/ViewStyles.xtend +++ b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/views/ViewStyles.xtend @@ -36,22 +36,22 @@ import xpt.diagram.ViewmapAttributesUtils_qvto override dispatch offset(GenExternalNodeLabel it, String viewVar) ''' - «IF labelOffsetX(viewmap, 0) != 0 || labelOffsetY(viewmap, 0) != 0» - «offset(it,viewVar, labelOffsetX(viewmap, 0), labelOffsetY(viewmap, 0))» - «ELSE» - «offset(it,viewVar, 0, 15)» - «ENDIF» + «IF labelOffsetX(viewmap, 0) != 0 || labelOffsetY(viewmap, 0) != 0» + «offset(it,viewVar, labelOffsetX(viewmap, 0), labelOffsetY(viewmap, 0))» + «ELSE» + «offset(it,viewVar, 0, 15)» + «ENDIF» ''' override def offset(GenLabel it, String viewVar, int x, int y) ''' - «val location = stringUniqueIdentifier.toFirstLower+'_Location'» - org.eclipse.gmf.runtime.notation.Location «location» = (org.eclipse.gmf.runtime.notation.Location) «viewVar».getLayoutConstraint(); - «IF it.getDiagram().isPixelMapMode()» - «location».setX(«x»); - «location».setY(«y»); - «ELSE» - «location».setX(org.eclipse.gmf.runtime.diagram.ui.util.MeasurementUnitHelper.getMapMode(«viewVar».getDiagram().getMeasurementUnit()).DPtoLP(«x»)); - «location».setY(org.eclipse.gmf.runtime.diagram.ui.util.MeasurementUnitHelper.getMapMode(«viewVar».getDiagram().getMeasurementUnit()).DPtoLP(«y»)); - «ENDIF» + «val location = stringUniqueIdentifier.toFirstLower+'_Location'» + org.eclipse.gmf.runtime.notation.Location «location» = (org.eclipse.gmf.runtime.notation.Location) «viewVar».getLayoutConstraint(); + «IF it.getDiagram().isPixelMapMode()» + «location».setX(«x»); + «location».setY(«y»); + «ELSE» + «location».setX(org.eclipse.gmf.runtime.diagram.ui.util.MeasurementUnitHelper.getMapMode(«viewVar».getDiagram().getMeasurementUnit()).DPtoLP(«x»)); + «location».setY(org.eclipse.gmf.runtime.diagram.ui.util.MeasurementUnitHelper.getMapMode(«viewVar».getDiagram().getMeasurementUnit()).DPtoLP(«y»)); + «ENDIF» ''' } diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/ActionBarContributor.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/ActionBarContributor.xtend index 86477ce2f90..7a1ab08b036 100644 --- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/ActionBarContributor.xtend +++ b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/ActionBarContributor.xtend @@ -25,24 +25,24 @@ import xpt.Common @Inject Editor xptEditor; override def ActionBarContributor(GenEditorView it) ''' - «copyright(editorGen)» - package «packageName(it)»; + «copyright(editorGen)» + package «packageName(it)»; - «generatedClassComment» - public class «className(it)» «extendsList(it)» { + «generatedClassComment» + public class «className(it)» «extendsList(it)» { - «generatedMemberComment» + «generatedMemberComment» - protected Class<«xptEditor.qualifiedClassName(it)»> getEditorClass() { - return «xptEditor.qualifiedClassName(it)».class; + protected Class<«xptEditor.qualifiedClassName(it)»> getEditorClass() { + return «xptEditor.qualifiedClassName(it)».class; } - «generatedMemberComment» + «generatedMemberComment» protected String getEditorId() { - return «xptEditor.qualifiedClassName(it)».ID; + return «xptEditor.qualifiedClassName(it)».ID; } - «initMethod(it)» - «additions(it)» + «initMethod(it)» + «additions(it)» } ''' diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/CreationWizard.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/CreationWizard.xtend index c6154a8502d..69c71927cc4 100644 --- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/CreationWizard.xtend +++ b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/CreationWizard.xtend @@ -39,127 +39,127 @@ import com.google.inject.Singleton @Inject Externalizer xptExternalizer override CreationWizard(GenDiagram it) ''' - «copyright(editorGen)» - package «packageName(it)»; + «copyright(editorGen)» + package «packageName(it)»; - «generatedClassComment» - public class «className(it)» - «extendsList(it)» «implementsList(it)» { + «generatedClassComment» + public class «className(it)» + «extendsList(it)» «implementsList(it)» { - «generatedMemberComment» + «generatedMemberComment» private org.eclipse.ui.IWorkbench workbench; - «generatedMemberComment» + «generatedMemberComment» protected org.eclipse.jface.viewers.IStructuredSelection selection; - «generatedMemberComment» - protected «xptCreationWizardPage.qualifiedClassName(it)» diagramModelFilePage; + «generatedMemberComment» + protected «xptCreationWizardPage.qualifiedClassName(it)» diagramModelFilePage; - «IF standaloneDomainModel(it)» - «generatedMemberComment» - protected «xptCreationWizardPage.qualifiedClassName(it)» domainModelFilePage; - «ENDIF» + «IF standaloneDomainModel(it)» + «generatedMemberComment» + protected «xptCreationWizardPage.qualifiedClassName(it)» domainModelFilePage; + «ENDIF» - «generatedMemberComment» + «generatedMemberComment» protected org.eclipse.emf.ecore.resource.Resource diagram; - «generatedMemberComment» + «generatedMemberComment» private boolean openNewlyCreatedDiagramEditor = true; - «generatedMemberComment» + «generatedMemberComment» public org.eclipse.ui.IWorkbench getWorkbench() { return workbench; } - «generatedMemberComment» + «generatedMemberComment» public org.eclipse.jface.viewers.IStructuredSelection getSelection() { return selection; } - «generatedMemberComment» + «generatedMemberComment» public final org.eclipse.emf.ecore.resource.Resource getDiagram() { return diagram; } - «generatedMemberComment» + «generatedMemberComment» public final boolean isOpenNewlyCreatedDiagramEditor() { return openNewlyCreatedDiagramEditor; } - «generatedMemberComment» + «generatedMemberComment» public void setOpenNewlyCreatedDiagramEditor(boolean openNewlyCreatedDiagramEditor) { this.openNewlyCreatedDiagramEditor = openNewlyCreatedDiagramEditor; } - «generatedMemberComment» + «generatedMemberComment» public void init(org.eclipse.ui.IWorkbench workbench, org.eclipse.jface.viewers.IStructuredSelection selection) { this.workbench = workbench; this.selection = selection; - setWindowTitle(«xptExternalizer.accessorCall(editorGen, titleKey(i18nKeyForCreationWizard(it)))»); - setDefaultPageImageDescriptor(«xptActivator.qualifiedClassName(editorGen.plugin)».getBundledImageDescriptor( - "icons/wizban/New«IF domainDiagramElement != null»«domainDiagramElement.genPackage.prefix»«ENDIF»Wizard.gif")); //$NON-NLS-1$ + setWindowTitle(«xptExternalizer.accessorCall(editorGen, titleKey(i18nKeyForCreationWizard(it)))»); + setDefaultPageImageDescriptor(«xptActivator.qualifiedClassName(editorGen.plugin)».getBundledImageDescriptor( + "icons/wizban/New«IF domainDiagramElement != null»«domainDiagramElement.genPackage.prefix»«ENDIF»Wizard.gif")); //$NON-NLS-1$ setNeedsProgressMonitor(true); } - «generatedMemberComment» + «generatedMemberComment» public void addPages() { - diagramModelFilePage = new «xptCreationWizardPage.qualifiedClassName(it)»( - "DiagramModelFile", getSelection(), "«editorGen.diagramFileExtension»"); //$NON-NLS-1$ //$NON-NLS-2$ - diagramModelFilePage.setTitle(«xptExternalizer.accessorCall(editorGen, - titleKey(i18nKeyForCreationWizardDiagramPage(it)))»); - diagramModelFilePage.setDescription(«xptExternalizer.accessorCall(editorGen, - descriptionKey(i18nKeyForCreationWizardDiagramPage(it)))»); + diagramModelFilePage = new «xptCreationWizardPage.qualifiedClassName(it)»( + "DiagramModelFile", getSelection(), "«editorGen.diagramFileExtension»"); //$NON-NLS-1$ //$NON-NLS-2$ + diagramModelFilePage.setTitle(«xptExternalizer.accessorCall(editorGen, + titleKey(i18nKeyForCreationWizardDiagramPage(it)))»); + diagramModelFilePage.setDescription(«xptExternalizer.accessorCall(editorGen, + descriptionKey(i18nKeyForCreationWizardDiagramPage(it)))»); addPage(diagramModelFilePage); - «IF standaloneDomainModel(it)» + «IF standaloneDomainModel(it)» - domainModelFilePage = new «xptCreationWizardPage.qualifiedClassName(it)»( - "DomainModelFile", getSelection(), "«editorGen.domainFileExtension»") { //$NON-NLS-1$ //$NON-NLS-2$ + domainModelFilePage = new «xptCreationWizardPage.qualifiedClassName(it)»( + "DomainModelFile", getSelection(), "«editorGen.domainFileExtension»") { //$NON-NLS-1$ //$NON-NLS-2$ - «overrideC» + «overrideC» public void setVisible(boolean visible) { if (visible) { String fileName = diagramModelFilePage.getFileName(); - fileName = fileName.substring(0, fileName.length() - ".«editorGen.diagramFileExtension»".length()); //$NON-NLS-1$ - setFileName(«xptDiagramEditorUtil.qualifiedClassName(it)».getUniqueFileName( - getContainerFullPath(), fileName, "«editorGen.domainFileExtension»")); //$NON-NLS-1$ + fileName = fileName.substring(0, fileName.length() - ".«editorGen.diagramFileExtension»".length()); //$NON-NLS-1$ + setFileName(«xptDiagramEditorUtil.qualifiedClassName(it)».getUniqueFileName( + getContainerFullPath(), fileName, "«editorGen.domainFileExtension»")); //$NON-NLS-1$ } super.setVisible(visible); } }; - domainModelFilePage.setTitle(«xptExternalizer.accessorCall(editorGen, - titleKey(i18nKeyForCreationWizardDomainPage(it)))»); - domainModelFilePage.setDescription(«xptExternalizer.accessorCall(editorGen, - descriptionKey(i18nKeyForCreationWizardDomainPage(it)))»); + domainModelFilePage.setTitle(«xptExternalizer.accessorCall(editorGen, + titleKey(i18nKeyForCreationWizardDomainPage(it)))»); + domainModelFilePage.setDescription(«xptExternalizer.accessorCall(editorGen, + descriptionKey(i18nKeyForCreationWizardDomainPage(it)))»); addPage(domainModelFilePage); - «ENDIF» + «ENDIF» } - «generatedMemberComment» + «generatedMemberComment» public boolean performFinish() { org.eclipse.jface.operation.IRunnableWithProgress op = - «IF editorGen.application == null» + «IF editorGen.application == null» new org.eclipse.ui.actions.WorkspaceModifyOperation(null) { - «overrideC» + «overrideC» protected void execute(org.eclipse.core.runtime.IProgressMonitor monitor) throws org.eclipse.core.runtime.CoreException, InterruptedException { - «ELSE» + «ELSE» new org.eclipse.jface.operation.IRunnableWithProgress() { public void run(org.eclipse.core.runtime.IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { - «ENDIF» - diagram = «xptDiagramEditorUtil.qualifiedClassName(it)».createDiagram(diagramModelFilePage.getURI(), - «IF standaloneDomainModel(it)» + «ENDIF» + diagram = «xptDiagramEditorUtil.qualifiedClassName(it)».createDiagram(diagramModelFilePage.getURI(), + «IF standaloneDomainModel(it)» domainModelFilePage.getURI(), - «ENDIF» + «ENDIF» monitor); if (isOpenNewlyCreatedDiagramEditor() && diagram != null) { try { - «xptDiagramEditorUtil.qualifiedClassName(it)».openDiagram(diagram); + «xptDiagramEditorUtil.qualifiedClassName(it)».openDiagram(diagram); } catch (org.eclipse.ui.PartInitException e) { org.eclipse.jface.dialogs.ErrorDialog.openError(getContainer().getShell(), - «xptExternalizer.accessorCall(editorGen, i18nKeyForCreationWizardOpenEditorError(it))», null, e.getStatus()); + «xptExternalizer.accessorCall(editorGen, i18nKeyForCreationWizardOpenEditorError(it))», null, e.getStatus()); } } } @@ -171,17 +171,17 @@ import com.google.inject.Singleton } catch (java.lang.reflect.InvocationTargetException e) { if (e.getTargetException() instanceof org.eclipse.core.runtime.CoreException) { org.eclipse.jface.dialogs.ErrorDialog.openError(getContainer().getShell(), - «xptExternalizer.accessorCall(editorGen, i18nKeyForCreationWizardCreationError(it))», null, + «xptExternalizer.accessorCall(editorGen, i18nKeyForCreationWizardCreationError(it))», null, ((org.eclipse.core.runtime.CoreException) e.getTargetException()).getStatus()); } else { - «xptActivator.qualifiedClassName(editorGen.plugin)».getInstance().logError( + «xptActivator.qualifiedClassName(editorGen.plugin)».getInstance().logError( "Error creating diagram", e.getTargetException()); //$NON-NLS-1$ } return false; } return diagram != null; } - «additions(it)» + «additions(it)» } ''' diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/DiagramContentInitializer.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/DiagramContentInitializer.xtend index 0b9a811dcb1..8619060ffc7 100644 --- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/DiagramContentInitializer.xtend +++ b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/DiagramContentInitializer.xtend @@ -26,9 +26,9 @@ import org.eclipse.gmf.codegen.gmfgen.GenDiagram @Inject VisualIDRegistry xptVisualIDRegistry; override def getCompartment(GenDiagram it) ''' - «generatedMemberComment» + «generatedMemberComment» private org.eclipse.gmf.runtime.notation.Node getCompartment(org.eclipse.gmf.runtime.notation.View node, String visualID) { - String type = «xptVisualIDRegistry.typeMethodCall(it, 'visualID')»; + String type = «xptVisualIDRegistry.typeMethodCall(it, 'visualID')»; for (java.util.Iterator it = node.getChildren().iterator(); it.hasNext();) { org.eclipse.gmf.runtime.notation.View nextView = (org.eclipse.gmf.runtime.notation.View) it.next(); if (nextView instanceof org.eclipse.gmf.runtime.notation.Node && type.equals(nextView.getType())) { @@ -39,6 +39,6 @@ import org.eclipse.gmf.codegen.gmfgen.GenDiagram } ''' - override def createChildrenMethodName(GenContainerBase it) '''create«it.stringUniqueIdentifier»_Children''' + override def createChildrenMethodName(GenContainerBase it) '''create«it.stringUniqueIdentifier»_Children''' }
\ No newline at end of file diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/DiagramEditorContextMenuProvider.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/DiagramEditorContextMenuProvider.xtend index 2d847b7235e..55253a76243 100644 --- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/DiagramEditorContextMenuProvider.xtend +++ b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/DiagramEditorContextMenuProvider.xtend @@ -32,55 +32,55 @@ import xpt.Common
import xpt.CodeStyle override DiagramEditorContextMenuProvider(GenDiagram it) ''' - «copyright(editorGen)» - package «packageName(it)»; + «copyright(editorGen)» + package «packageName(it)»; - «generatedClassComment» - public class «className(it)» extends org.eclipse.gmf.runtime.diagram.ui.providers.DiagramContextMenuProvider { + «generatedClassComment» + public class «className(it)» extends org.eclipse.gmf.runtime.diagram.ui.providers.DiagramContextMenuProvider { - «generatedMemberComment» + «generatedMemberComment» private org.eclipse.ui.IWorkbenchPart part; - ««« «generatedMemberComment» - ««« private «xptDeleteElementAction.qualifiedClassName(it)» deleteAction; + ««« «generatedMemberComment» + ««« private «xptDeleteElementAction.qualifiedClassName(it)» deleteAction; - «generatedMemberComment» + «generatedMemberComment» public DiagramEditorContextMenuProvider(org.eclipse.ui.IWorkbenchPart part, org.eclipse.gef.EditPartViewer viewer) { super(part, viewer); this.part = part; - ««« deleteAction = new «xptDeleteElementAction.qualifiedClassName(it)»(part); - ««« deleteAction.init(); + ««« deleteAction = new «xptDeleteElementAction.qualifiedClassName(it)»(part); + ««« deleteAction.init(); } - ««« «generatedMemberComment» - ««« public void dispose() { - ««« if (deleteAction != null) { - ««« deleteAction.dispose(); - ««« deleteAction = null; - ««« } - ««« super.dispose(); - ««« } + ««« «generatedMemberComment» + ««« public void dispose() { + ««« if (deleteAction != null) { + ««« deleteAction.dispose(); + ««« deleteAction = null; + ««« } + ««« super.dispose(); + ««« } - «generatedMemberComment» + «generatedMemberComment» public void buildContextMenu(final org.eclipse.jface.action.IMenuManager menu) { getViewer().flush(); try { org.eclipse.emf.transaction.util.TransactionUtil.getEditingDomain( (org.eclipse.emf.ecore.EObject) getViewer().getContents().getModel()).runExclusive(new Runnable() { - «overrideI(it.editorGen.diagram)» + «overrideI(it.editorGen.diagram)» public void run() { org.eclipse.gmf.runtime.common.ui.services.action.contributionitem.ContributionItemService.getInstance().contributeToPopupMenu( DiagramEditorContextMenuProvider.this, part); menu.remove(org.eclipse.gmf.runtime.diagram.ui.actions.ActionIds.ACTION_DELETE_FROM_MODEL); - ««« menu.appendToGroup("editGroup", deleteAction); + ««« menu.appendToGroup("editGroup", deleteAction); } }); } catch (Exception e) { - «xptActivator.qualifiedClassName(editorGen.plugin)».getInstance().logError("Error building context menu", e); + «xptActivator.qualifiedClassName(editorGen.plugin)».getInstance().logError("Error building context menu", e); } } - «additions(it)» + «additions(it)» } ''' } diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/DiagramEditorUtil.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/DiagramEditorUtil.xtend index aa51e7c58d1..33f5d9ad788 100644 --- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/DiagramEditorUtil.xtend +++ b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/DiagramEditorUtil.xtend @@ -35,59 +35,59 @@ import com.google.inject.Singleton @Inject MetaModel xptMetaModel override def getUniqueFileNameMethod(GenDiagram it) ''' - «generatedMemberComment» + «generatedMemberComment» public static String getUniqueFileName(org.eclipse.core.runtime.IPath containerFullPath, String fileName, String extension) { - return org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.part.DefaultDiagramEditorUtil.getUniqueFileName(containerFullPath, fileName, extension, «» - org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.part.DefaultDiagramEditorUtil.«IF editorGen.application == null»EXISTS_IN_WORKSPACE«ELSE»EXISTS_AS_IO_FILE«ENDIF»); + return org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.part.DefaultDiagramEditorUtil.getUniqueFileName(containerFullPath, fileName, extension, «» + org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.part.DefaultDiagramEditorUtil.«IF editorGen.application == null»EXISTS_IN_WORKSPACE«ELSE»EXISTS_AS_IO_FILE«ENDIF»); } ''' override createDiagramMethod(GenDiagram it) ''' - «generatedMemberComment( - (if(editorGen.application == null) 'This method should be called within a workspace modify operation since it creates resources.' else ''))» - public static org.eclipse.emf.ecore.resource.Resource createDiagram(org.eclipse.emf.common.util.URI diagramURI,«IF standaloneDomainModel( - it)» org.eclipse.emf.common.util.URI modelURI,«ENDIF» org.eclipse.core.runtime.IProgressMonitor progressMonitor) { + «generatedMemberComment( + (if(editorGen.application == null) 'This method should be called within a workspace modify operation since it creates resources.' else ''))» + public static org.eclipse.emf.ecore.resource.Resource createDiagram(org.eclipse.emf.common.util.URI diagramURI,«IF standaloneDomainModel( + it)» org.eclipse.emf.common.util.URI modelURI,«ENDIF» org.eclipse.core.runtime.IProgressMonitor progressMonitor) { org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain = org.eclipse.emf.workspace.WorkspaceEditingDomainFactory.INSTANCE.createEditingDomain(); - progressMonitor.beginTask(«xptExternalizer.accessorCall(editorGen, i18nKeyForCreateDiagramProgressTask(it))», 3); + progressMonitor.beginTask(«xptExternalizer.accessorCall(editorGen, i18nKeyForCreateDiagramProgressTask(it))», 3); final org.eclipse.emf.ecore.resource.Resource diagramResource = editingDomain.getResourceSet().createResource(diagramURI); - «IF standaloneDomainModel(it)» + «IF standaloneDomainModel(it)» final org.eclipse.emf.ecore.resource.Resource modelResource = editingDomain.getResourceSet().createResource(modelURI); - «ELSEIF domainDiagramElement != null && hasDocumentRoot(it)/*for standalone models, we assume its resourcefactory would be able to set extendedMetaData option*/» + «ELSEIF domainDiagramElement != null && hasDocumentRoot(it)/*for standalone models, we assume its resourcefactory would be able to set extendedMetaData option*/» ((org.eclipse.emf.ecore.xmi.XMLResource) diagramResource).getDefaultSaveOptions().put(org.eclipse.emf.ecore.xmi.XMLResource.OPTION_EXTENDED_META_DATA, Boolean.TRUE); ((org.eclipse.emf.ecore.xmi.XMLResource) diagramResource).getDefaultLoadOptions().put(org.eclipse.emf.ecore.xmi.XMLResource.OPTION_EXTENDED_META_DATA, Boolean.TRUE); - «ENDIF» + «ENDIF» final String diagramName = diagramURI.lastSegment(); - org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand command = new org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand(editingDomain, «xptExternalizer. - accessorCall(editorGen, i18nKeyForCreateDiagramCommandLabel(it))», java.util.Collections.EMPTY_LIST) { - «overrideC» + org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand command = new org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand(editingDomain, «xptExternalizer. + accessorCall(editorGen, i18nKeyForCreateDiagramCommandLabel(it))», java.util.Collections.EMPTY_LIST) { + «overrideC» protected org.eclipse.gmf.runtime.common.core.command.CommandResult doExecuteWithResult(org.eclipse.core.runtime.IProgressMonitor monitor, org.eclipse.core.runtime.IAdaptable info) throws org.eclipse.core.commands.ExecutionException { - «IF domainDiagramElement != null» - «xptMetaModel.QualifiedClassName(domainDiagramElement)» model = createInitialModel(); - attachModelToResource(model, «IF standaloneDomainModel(it)»model«ELSE»diagram«ENDIF»Resource); - «ENDIF» - «extraLineBreak» + «IF domainDiagramElement != null» + «xptMetaModel.QualifiedClassName(domainDiagramElement)» model = createInitialModel(); + attachModelToResource(model, «IF standaloneDomainModel(it)»model«ELSE»diagram«ENDIF»Resource); + «ENDIF» + «extraLineBreak» org.eclipse.gmf.runtime.notation.Diagram diagram = org.eclipse.gmf.runtime.diagram.core.services.ViewService.createDiagram( - «IF domainDiagramElement != null» - «xptMetaModel.DowncastToEObject(domainDiagramElement, 'model')», - «ENDIF» - «VisualIDRegistry::modelID(it)», «xptActivator.preferenceHintAccess(editorGen)»); + «IF domainDiagramElement != null» + «xptMetaModel.DowncastToEObject(domainDiagramElement, 'model')», + «ENDIF» + «VisualIDRegistry::modelID(it)», «xptActivator.preferenceHintAccess(editorGen)»); if (diagram != null) { diagramResource.getContents().add(diagram); diagram.setName(diagramName); - «IF domainDiagramElement != null» - diagram.setElement(«xptMetaModel.DowncastToEObject(domainDiagramElement, 'model')»); - «ENDIF» + «IF domainDiagramElement != null» + diagram.setElement(«xptMetaModel.DowncastToEObject(domainDiagramElement, 'model')»); + «ENDIF» } try { - «IF standaloneDomainModel(it)»modelResource.save(«callGetSaveOptions(it)»);«ENDIF» - diagramResource.save(«callGetSaveOptions(it)»); + «IF standaloneDomainModel(it)»modelResource.save(«callGetSaveOptions(it)»);«ENDIF» + diagramResource.save(«callGetSaveOptions(it)»); } catch (java.io.IOException e) { - «/* + «/* * TODO CommandResult.newErrorCommandResult(e) would be better? Or even throw ExecutionEx? * */ - extraLineBreak» - «xptActivator.qualifiedClassName(editorGen.plugin)».getInstance().logError("Unable to store model and diagram resources", e); «nonNLS(1)» + extraLineBreak» + «xptActivator.qualifiedClassName(editorGen.plugin)».getInstance().logError("Unable to store model and diagram resources", e); «nonNLS(1)» } return org.eclipse.gmf.runtime.common.core.command.CommandResult.newOKCommandResult(); } @@ -95,13 +95,13 @@ import com.google.inject.Singleton try { org.eclipse.core.commands.operations.OperationHistoryFactory.getOperationHistory().execute(command, new org.eclipse.core.runtime.SubProgressMonitor(progressMonitor, 1), null); } catch (org.eclipse.core.commands.ExecutionException e) { - «xptActivator.qualifiedClassName(editorGen.plugin)».getInstance().logError("Unable to create model and diagram", e); «nonNLS( - 1)» + «xptActivator.qualifiedClassName(editorGen.plugin)».getInstance().logError("Unable to create model and diagram", e); «nonNLS( + 1)» } - «IF editorGen.application == null» - «IF standaloneDomainModel(it)»setCharset(org.eclipse.emf.workspace.util.WorkspaceSynchronizer.getFile(modelResource));«ENDIF» + «IF editorGen.application == null» + «IF standaloneDomainModel(it)»setCharset(org.eclipse.emf.workspace.util.WorkspaceSynchronizer.getFile(modelResource));«ENDIF» setCharset(org.eclipse.emf.workspace.util.WorkspaceSynchronizer.getFile(diagramResource)); - «ENDIF» + «ENDIF» return diagramResource; } ''' diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/DocumentProvider.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/DocumentProvider.xtend index dd6ae482b31..91f2499e14a 100644 --- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/DocumentProvider.xtend +++ b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/DocumentProvider.xtend @@ -35,16 +35,16 @@ import xpt.editor.DiagramEditorUtil override setDocumentContent(GenDiagram it) ''' - «generatedMemberComment» + «generatedMemberComment» protected void setDocumentContent(org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDocument document, org.eclipse.ui.IEditorInput element) throws org.eclipse.core.runtime.CoreException { org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocument diagramDocument = (org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocument) document; org.eclipse.emf.transaction.TransactionalEditingDomain domain = diagramDocument.getEditingDomain(); - «IF null == it.editorGen.application»if (element instanceof «fileEditorInputClassFQName(it)») { - org.eclipse.core.resources.IStorage storage = ((«fileEditorInputClassFQName(it)») element).getStorage(); + «IF null == it.editorGen.application»if (element instanceof «fileEditorInputClassFQName(it)») { + org.eclipse.core.resources.IStorage storage = ((«fileEditorInputClassFQName(it)») element).getStorage(); org.eclipse.gmf.runtime.notation.Diagram diagram = org.eclipse.gmf.runtime.diagram.ui.resources.editor.internal.util.DiagramIOUtil.load(domain, storage, true, getProgressMonitor()); document.setContent(diagram); - } else «ENDIF»if(element instanceof «uriEditorInputClassFQName(it)») { - org.eclipse.emf.common.util.URI uri = ((«uriEditorInputClassFQName(it)») element).getURI(); + } else «ENDIF»if(element instanceof «uriEditorInputClassFQName(it)») { + org.eclipse.emf.common.util.URI uri = ((«uriEditorInputClassFQName(it)») element).getURI(); org.eclipse.emf.ecore.resource.Resource resource = null; try { resource = domain.getResourceSet().getResource(uri.trimFragment(), false); @@ -78,45 +78,45 @@ import xpt.editor.DiagramEditorUtil } } } - throw new RuntimeException(«xptExternalizer.accessorCall(editorGen, i18nKeyForDocumentProviderNoDiagramInResourceError(it))»); + throw new RuntimeException(«xptExternalizer.accessorCall(editorGen, i18nKeyForDocumentProviderNoDiagramInResourceError(it))»); } catch (Exception e) { org.eclipse.core.runtime.CoreException thrownExcp = null; if (e instanceof org.eclipse.core.runtime.CoreException) { thrownExcp = (org.eclipse.core.runtime.CoreException) e; } else { String msg = e.getLocalizedMessage(); - thrownExcp = new org.eclipse.core.runtime.CoreException(new org.eclipse.core.runtime.Status(org.eclipse.core.runtime.IStatus.ERROR, «xptActivator.qualifiedClassName(it.editorGen.plugin)».ID, 0, - msg != null ? msg : «xptExternalizer.accessorCall(editorGen, i18nKeyForDocumentProviderDiagramLoadingError(it))», e)); + thrownExcp = new org.eclipse.core.runtime.CoreException(new org.eclipse.core.runtime.Status(org.eclipse.core.runtime.IStatus.ERROR, «xptActivator.qualifiedClassName(it.editorGen.plugin)».ID, 0, + msg != null ? msg : «xptExternalizer.accessorCall(editorGen, i18nKeyForDocumentProviderDiagramLoadingError(it))», e)); } throw thrownExcp; } } else { - «throwIncorrectInputException(it)» + «throwIncorrectInputException(it)» } } ''' override createEditingDomain(GenDiagram it) ''' - «generatedMemberComment» + «generatedMemberComment» private org.eclipse.emf.transaction.TransactionalEditingDomain createEditingDomain() { org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain = org.eclipse.gmf.runtime.diagram.core.DiagramEditingDomainFactory.getInstance().createEditingDomain(); - editingDomain.setID("«editingDomainID»"); «nonNLS(1)» + editingDomain.setID("«editingDomainID»"); «nonNLS(1)» final org.eclipse.emf.transaction.NotificationFilter diagramResourceModifiedFilter = org.eclipse.emf.transaction.NotificationFilter.createNotifierFilter(editingDomain.getResourceSet()).and(org.eclipse.emf.transaction.NotificationFilter.createEventTypeFilter(org.eclipse.emf.common.notify.Notification.ADD)).and(org.eclipse.emf.transaction.NotificationFilter.createFeatureFilter(org.eclipse.emf.ecore.resource.ResourceSet.class, org.eclipse.emf.ecore.resource.ResourceSet.RESOURCE_SET__RESOURCES)); editingDomain.getResourceSet().eAdapters().add(new org.eclipse.emf.common.notify.Adapter() { private org.eclipse.emf.common.notify.Notifier myTarger; - «overrideI» + «overrideI» public org.eclipse.emf.common.notify.Notifier getTarget() { return myTarger; } - «overrideI» + «overrideI» public boolean isAdapterForType(Object type) { return false; } - «overrideI» + «overrideI» public void notifyChanged(org.eclipse.emf.common.notify.Notification notification) { if (diagramResourceModifiedFilter.matches(notification)) { Object value = notification.getNewValue(); @@ -126,7 +126,7 @@ import xpt.editor.DiagramEditorUtil } } - «overrideI» + «overrideI» public void setTarget(org.eclipse.emf.common.notify.Notifier newTarget) { myTarger = newTarget; } @@ -138,33 +138,33 @@ import xpt.editor.DiagramEditorUtil ''' override doSaveDocument(GenDiagram it) ''' - «generatedMemberComment» + «generatedMemberComment» protected void doSaveDocument(org.eclipse.core.runtime.IProgressMonitor monitor, Object element, org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDocument document, boolean overwrite) throws org.eclipse.core.runtime.CoreException { ResourceSetInfo info = getResourceSetInfo(element); if (info != null) { if (!overwrite && !info.isSynchronized()) { - throw new org.eclipse.core.runtime.CoreException(new org.eclipse.core.runtime.Status(org.eclipse.core.runtime.IStatus.ERROR, «xptActivator.qualifiedClassName(editorGen.plugin)».ID, - «IF null == editorGen.application»org.eclipse.core.resources.IResourceStatus.OUT_OF_SYNC_LOCAL«ELSE»org.eclipse.core.runtime.IStatus.ERROR«ENDIF», - «xptExternalizer.accessorCall(editorGen, i18nKeyForDocumentUnsynchronizedFileSaveError(it))», + throw new org.eclipse.core.runtime.CoreException(new org.eclipse.core.runtime.Status(org.eclipse.core.runtime.IStatus.ERROR, «xptActivator.qualifiedClassName(editorGen.plugin)».ID, + «IF null == editorGen.application»org.eclipse.core.resources.IResourceStatus.OUT_OF_SYNC_LOCAL«ELSE»org.eclipse.core.runtime.IStatus.ERROR«ENDIF», + «xptExternalizer.accessorCall(editorGen, i18nKeyForDocumentUnsynchronizedFileSaveError(it))», null)); } - «IF null == editorGen.application» + «IF null == editorGen.application» info.stopResourceListening(); - «ENDIF» + «ENDIF» fireElementStateChanging(element); try { - monitor.beginTask(«xptExternalizer.accessorCall(editorGen, i18nKeyForDocumentSaveDiagramTask(it))», info.getResourceSet().getResources().size() + 1); //"Saving diagram" + monitor.beginTask(«xptExternalizer.accessorCall(editorGen, i18nKeyForDocumentSaveDiagramTask(it))», info.getResourceSet().getResources().size() + 1); //"Saving diagram" for (java.util.Iterator<org.eclipse.emf.ecore.resource.Resource> it = info.getLoadedResourcesIterator(); it.hasNext();) { org.eclipse.emf.ecore.resource.Resource nextResource = it.next(); monitor.setTaskName(org.eclipse.osgi.util.NLS.bind( - «xptExternalizer.accessorCall(editorGen, i18nKeyForDocumentSaveNextResourceTask(it))», + «xptExternalizer.accessorCall(editorGen, i18nKeyForDocumentSaveNextResourceTask(it))», nextResource.getURI())); if (nextResource.isLoaded() && !info.getEditingDomain().isReadOnly(nextResource)) { try { - nextResource.save(«xptDiagramEditorUtil.callGetSaveOptions(it)»); + nextResource.save(«xptDiagramEditorUtil.callGetSaveOptions(it)»); } catch (java.io.IOException e) { fireElementStateChangeFailed(element); - throw new org.eclipse.core.runtime.CoreException(new org.eclipse.core.runtime.Status(org.eclipse.core.runtime.IStatus.ERROR, «xptActivator.qualifiedClassName(editorGen.plugin)».ID, org.eclipse.gmf.runtime.diagram.ui.resources.editor.internal.EditorStatusCodes.RESOURCE_FAILURE, e.getLocalizedMessage(), null)); + throw new org.eclipse.core.runtime.CoreException(new org.eclipse.core.runtime.Status(org.eclipse.core.runtime.IStatus.ERROR, «xptActivator.qualifiedClassName(editorGen.plugin)».ID, org.eclipse.gmf.runtime.diagram.ui.resources.editor.internal.EditorStatusCodes.RESOURCE_FAILURE, e.getLocalizedMessage(), null)); } } monitor.worked(1); @@ -174,45 +174,45 @@ import xpt.editor.DiagramEditorUtil } catch (RuntimeException x) { fireElementStateChangeFailed(element); throw x; - } «IF null == editorGen.application» finally { + } «IF null == editorGen.application» finally { info.startResourceListening(); - } «ENDIF» + } «ENDIF» } else { org.eclipse.emf.common.util.URI newResoruceURI; java.util.List<org.eclipse.core.resources.IFile> affectedFiles = null; - «IF null == editorGen.application»if (element instanceof «fileEditorInputClassFQName(it)») { - org.eclipse.core.resources.IFile newFile = ((«fileEditorInputClassFQName(it)») element).getFile(); + «IF null == editorGen.application»if (element instanceof «fileEditorInputClassFQName(it)») { + org.eclipse.core.resources.IFile newFile = ((«fileEditorInputClassFQName(it)») element).getFile(); affectedFiles = java.util.Collections.singletonList(newFile); newResoruceURI = org.eclipse.emf.common.util.URI.createPlatformResourceURI(newFile.getFullPath().toString(), true); - } else «ENDIF»if(element instanceof «uriEditorInputClassFQName(it)») { - newResoruceURI = ((«uriEditorInputClassFQName(it)») element).getURI(); + } else «ENDIF»if(element instanceof «uriEditorInputClassFQName(it)») { + newResoruceURI = ((«uriEditorInputClassFQName(it)») element).getURI(); } else { fireElementStateChangeFailed(element); - «throwIncorrectInputException(it)» + «throwIncorrectInputException(it)» } if (false == document instanceof org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocument) { fireElementStateChangeFailed(element); - throw new org.eclipse.core.runtime.CoreException(new org.eclipse.core.runtime.Status(org.eclipse.core.runtime.IStatus.ERROR, «xptActivator.qualifiedClassName(editorGen.plugin)».ID, 0, - "Incorrect document used: " + document + " instead of org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocument", null)); «nonNLS(1)» «nonNLS(2)» + throw new org.eclipse.core.runtime.CoreException(new org.eclipse.core.runtime.Status(org.eclipse.core.runtime.IStatus.ERROR, «xptActivator.qualifiedClassName(editorGen.plugin)».ID, 0, + "Incorrect document used: " + document + " instead of org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocument", null)); «nonNLS(1)» «nonNLS(2)» } org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocument diagramDocument = (org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocument) document; final org.eclipse.emf.ecore.resource.Resource newResource = diagramDocument.getEditingDomain().getResourceSet().createResource(newResoruceURI); final org.eclipse.gmf.runtime.notation.Diagram diagramCopy = org.eclipse.emf.ecore.util.EcoreUtil.copy(diagramDocument.getDiagram()); try { - new org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand(diagramDocument.getEditingDomain(), org.eclipse.osgi.util.NLS.bind(«xptExternalizer.accessorCall(editorGen, i18nKeyForDocumentSaveAs(it))», diagramCopy.getName()), affectedFiles) { - «overrideC» + new org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand(diagramDocument.getEditingDomain(), org.eclipse.osgi.util.NLS.bind(«xptExternalizer.accessorCall(editorGen, i18nKeyForDocumentSaveAs(it))», diagramCopy.getName()), affectedFiles) { + «overrideC» protected org.eclipse.gmf.runtime.common.core.command.CommandResult doExecuteWithResult(org.eclipse.core.runtime.IProgressMonitor monitor, org.eclipse.core.runtime.IAdaptable info) throws org.eclipse.core.commands.ExecutionException { newResource.getContents().add(diagramCopy); return org.eclipse.gmf.runtime.common.core.command.CommandResult.newOKCommandResult(); } }.execute(monitor, null); - newResource.save(«xptDiagramEditorUtil.callGetSaveOptions(it)»); + newResource.save(«xptDiagramEditorUtil.callGetSaveOptions(it)»); } catch (org.eclipse.core.commands.ExecutionException e) { fireElementStateChangeFailed(element); - throw new org.eclipse.core.runtime.CoreException(new org.eclipse.core.runtime.Status(org.eclipse.core.runtime.IStatus.ERROR, «xptActivator.qualifiedClassName(editorGen.plugin)».ID, 0, e.getLocalizedMessage(), null)); + throw new org.eclipse.core.runtime.CoreException(new org.eclipse.core.runtime.Status(org.eclipse.core.runtime.IStatus.ERROR, «xptActivator.qualifiedClassName(editorGen.plugin)».ID, 0, e.getLocalizedMessage(), null)); } catch (java.io.IOException e) { fireElementStateChangeFailed(element); - throw new org.eclipse.core.runtime.CoreException(new org.eclipse.core.runtime.Status(org.eclipse.core.runtime.IStatus.ERROR, «xptActivator.qualifiedClassName(editorGen.plugin)».ID, 0, e.getLocalizedMessage(), null)); + throw new org.eclipse.core.runtime.CoreException(new org.eclipse.core.runtime.Status(org.eclipse.core.runtime.IStatus.ERROR, «xptActivator.qualifiedClassName(editorGen.plugin)».ID, 0, e.getLocalizedMessage(), null)); } newResource.unload(); } @@ -220,13 +220,13 @@ import xpt.editor.DiagramEditorUtil ''' override computeSchedulingRule(GenDiagram it) ''' - «generatedMemberComment» + «generatedMemberComment» private org.eclipse.core.runtime.jobs.ISchedulingRule computeSchedulingRule(org.eclipse.core.resources.IResource toCreateOrModify) { if (toCreateOrModify.exists()) { return org.eclipse.core.resources.ResourcesPlugin.getWorkspace().getRuleFactory().modifyRule(toCreateOrModify); } org.eclipse.core.resources.IResource parent = toCreateOrModify; - do {«/*FIXME [MG] the bug is closed long ago, still need? */» + do {«/*FIXME [MG] the bug is closed long ago, still need? */» /* * XXX This is a workaround for * https://bugs.eclipse.org/bugs/show_bug.cgi?id=67601 @@ -242,7 +242,7 @@ import xpt.editor.DiagramEditorUtil ''' override doValidateState(GenDiagram it) ''' - «generatedMemberComment» + «generatedMemberComment» protected void doValidateState(Object element, Object computationContext) throws org.eclipse.core.runtime.CoreException { ResourceSetInfo info = getResourceSetInfo(element); if (info != null) { @@ -262,7 +262,7 @@ import xpt.editor.DiagramEditorUtil ''' override getResetRule(GenDiagram it) ''' - «generatedMemberComment» + «generatedMemberComment» protected org.eclipse.core.runtime.jobs.ISchedulingRule getResetRule(Object element) { ResourceSetInfo info = getResourceSetInfo(element); if (info != null) { @@ -281,7 +281,7 @@ import xpt.editor.DiagramEditorUtil ''' override getSaveRule(GenDiagram it) ''' - «generatedMemberComment» + «generatedMemberComment» protected org.eclipse.core.runtime.jobs.ISchedulingRule getSaveRule(Object element) { ResourceSetInfo info = getResourceSetInfo(element); if (info != null) { @@ -300,7 +300,7 @@ import xpt.editor.DiagramEditorUtil ''' override getSynchronizeRule(GenDiagram it) ''' - «generatedMemberComment» + «generatedMemberComment» protected org.eclipse.core.runtime.jobs.ISchedulingRule getSynchronizeRule(Object element) { ResourceSetInfo info = getResourceSetInfo(element); if (info != null) { @@ -319,10 +319,10 @@ import xpt.editor.DiagramEditorUtil ''' override getValidateStateRule(GenDiagram it) ''' - «generatedMemberComment» + «generatedMemberComment» protected org.eclipse.core.runtime.jobs.ISchedulingRule getValidateStateRule(Object element) { ResourceSetInfo info = getResourceSetInfo(element); - if (info != null) {«/*FIXME: [MG] bad copy paste here, files should be <IFile>, its a miracle that it does not fail in runtime at toArray stage */» + if (info != null) {«/*FIXME: [MG] bad copy paste here, files should be <IFile>, its a miracle that it does not fail in runtime at toArray stage */» java.util.LinkedList<org.eclipse.core.runtime.jobs.ISchedulingRule> files = new java.util.LinkedList<org.eclipse.core.runtime.jobs.ISchedulingRule>(); for (java.util.Iterator<org.eclipse.emf.ecore.resource.Resource> it = info.getLoadedResourcesIterator(); it.hasNext();) { org.eclipse.emf.ecore.resource.Resource nextResource = it.next(); diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/Editor.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/Editor.xtend index 522953dbb20..c2882414e10 100644 --- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/Editor.xtend +++ b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/Editor.xtend @@ -14,7 +14,7 @@ * Emilien Perico (Atos Origin) - add code to refactor some classes * Christian W. Damus (CEA) - bug 430648 * Christian W. Damus (CEA) - bug 431023 - * Micka¿l ADAM (ALL4TEC) mickael.adam@all4tec.net - Bug 512343 + * Micka¿l ADAM (ALL4TEC) mickael.adam@all4tec.net - Bug 512343 * *****************************************************************************/ @@ -39,41 +39,41 @@ import xpt.CodeStyle override extendsList(GenEditorView it) '''extends org.eclipse.papyrus.uml.diagram.common.part.UmlGmfDiagramEditor''' override attributes(GenEditorView it) ''' - «generatedMemberComment» - public static final String ID = "«ID»"; «nonNLS» + «generatedMemberComment» + public static final String ID = "«ID»"; «nonNLS» - «generatedMemberComment» -public static final String CONTEXT_ID = "«contextID»"; «nonNLS» + «generatedMemberComment» +public static final String CONTEXT_ID = "«contextID»"; «nonNLS» - ««« Documentation. adds listener for papyrus editors - «generatedMemberComment» + ««« Documentation. adds listener for papyrus editors + «generatedMemberComment» private org.eclipse.gef.KeyHandler paletteKeyHandler = null; - «generatedMemberComment» + «generatedMemberComment» private org.eclipse.swt.events.MouseListener paletteMouseListener = null; - ««« Helps to handle correctly the dirty state - «generatedMemberComment» + ««« Helps to handle correctly the dirty state + «generatedMemberComment» private org.eclipse.papyrus.commands.util.OperationHistoryDirtyState dirtyState; - «generatedMemberComment» + «generatedMemberComment» private org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain; - «generatedMemberComment» + «generatedMemberComment» private org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDocumentProvider documentProvider; ''' override constructor(GenEditorView it) ''' - «generatedMemberComment» - public «className»(org.eclipse.papyrus.infra.core.services.ServicesRegistry servicesRegistry, org.eclipse.gmf.runtime.notation.Diagram diagram) throws org.eclipse.papyrus.infra.core.services.ServiceException{ + «generatedMemberComment» + public «className»(org.eclipse.papyrus.infra.core.services.ServicesRegistry servicesRegistry, org.eclipse.gmf.runtime.notation.Diagram diagram) throws org.eclipse.papyrus.infra.core.services.ServiceException{ super(servicesRegistry, diagram); - ««« Documentation. adds listener for papyrus palette service + ««« Documentation. adds listener for papyrus palette service // adds a listener to the palette service, which reacts to palette customizations org.eclipse.papyrus.infra.gmfdiag.common.service.palette.PapyrusPaletteService.getInstance().addProviderChangeListener(this); - «««Share the same editing domain + «««Share the same editing domain // Share the same editing provider editingDomain = servicesRegistry.getService(org.eclipse.emf.transaction.TransactionalEditingDomain.class); documentProvider = new org.eclipse.papyrus.infra.gmfdiag.common.GmfMultiDiagramDocumentProvider(editingDomain); @@ -81,23 +81,23 @@ public static final String CONTEXT_ID = "«contextID»"; «nonNLS» // overrides editing domain created by super constructor setDocumentProvider(documentProvider); - «««end of listeners addition + «««end of listeners addition } ''' override getNavigatorSelection(GenNavigator it) ''' - «generatedMemberComment» + «generatedMemberComment» private org.eclipse.jface.viewers.ISelection getNavigatorSelection() { - «IF getDiagramTopReference(it) !=null» + «IF getDiagramTopReference(it) !=null» org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocument document = getDiagramDocument(); - «ENDIF» - «xptNavigatorLinkHelper.findSelectionBody(it)» + «ENDIF» + «xptNavigatorLinkHelper.findSelectionBody(it)» } ''' override createPaletteRoot (Palette it)''' - «generatedMemberComment» + «generatedMemberComment» protected org.eclipse.gef.palette.PaletteRoot createPaletteRoot(org.eclipse.gef.palette.PaletteRoot existingPaletteRoot) { org.eclipse.gef.palette.PaletteRoot paletteRoot; if (existingPaletteRoot == null) { @@ -112,7 +112,7 @@ override createPaletteRoot (Palette it)''' ''' def createPaletteCustomizer (GenEditorView it)''' - «generatedMemberComment» + «generatedMemberComment» protected org.eclipse.gef.ui.palette.PaletteCustomizer createPaletteCustomizer() { return new org.eclipse.papyrus.infra.gmfdiag.common.service.palette.PapyrusPaletteCustomizer(getPreferenceStore()); } @@ -120,42 +120,42 @@ def createPaletteCustomizer (GenEditorView it)''' override additions (GenEditorView it)''' - «createEditingDomain(it)» + «createEditingDomain(it)» - « configureDiagramEditDomain(it)» + « configureDiagramEditDomain(it)» - « doSave(it)» + « doSave(it)» - « getDirtyState(it)» + « getDirtyState(it)» - « setUndoContext(it)» + « setUndoContext(it)» - « isDirty(it)» + « isDirty(it)» - «««Documentation. adds method to handle palette changes - « handlePaletteChange(it)» + «««Documentation. adds method to handle palette changes + « handlePaletteChange(it)» - « dispose(it)» + « dispose(it)» - « getPaletteViewer(it)» + « getPaletteViewer(it)» - ««« Documentation: (RS) advanced customization abilities - ««« « createPaletteCustomizer» + ««« Documentation: (RS) advanced customization abilities + ««« « createPaletteCustomizer» - « constructPaletteViewer(it)» + « constructPaletteViewer(it)» - « createPaletteviewerProvider(it)» + « createPaletteviewerProvider(it)» - «getGraphicalViewer(it)» + «getGraphicalViewer(it)» - «initializeGraphicalViewer(it)» + «initializeGraphicalViewer(it)» - «selectionChanged(it)» + «selectionChanged(it)» ''' def handlePaletteChange (GenEditorView it) ''' - «generatedMemberComment» + «generatedMemberComment» public void providerChanged(org.eclipse.gmf.runtime.common.core.service.ProviderChangeEvent event) { // update the palette if the palette service has changed if (org.eclipse.papyrus.infra.gmfdiag.common.service.palette.PapyrusPaletteService.getInstance().equals(event.getSource())) { @@ -166,14 +166,14 @@ def handlePaletteChange (GenEditorView it) ''' ''' def constructPaletteViewer (GenEditorView it) ''' - «generatedMemberComment» + «generatedMemberComment» protected org.eclipse.gef.ui.palette.PaletteViewer constructPaletteViewer() { return new org.eclipse.papyrus.infra.gmfdiag.common.service.palette.PapyrusPaletteViewer(); } ''' override dispose(GenEditorView it)''' - «generatedMemberComment» + «generatedMemberComment» public void dispose() { // remove palette service listener // remove preference listener @@ -189,7 +189,7 @@ override dispose(GenEditorView it)''' ''' def getPaletteViewer (GenEditorView it)''' - «generatedMemberComment» + «generatedMemberComment» protected org.eclipse.gef.ui.palette.PaletteViewer getPaletteViewer() { return getEditDomain().getPaletteViewer(); } @@ -197,17 +197,17 @@ def getPaletteViewer (GenEditorView it)''' override implementsList(Iterable<String> it)''' implements org.eclipse.gmf.runtime.common.core.service.IProviderChangeListener - «IF ! it.isEmpty», - «FOR string : it SEPARATOR ', '» - «implementsListEntry(string)» - «ENDFOR» - «ENDIF» + «IF ! it.isEmpty», + «FOR string : it SEPARATOR ', '» + «implementsListEntry(string)» + «ENDFOR» + «ENDIF» ''' -def implementsListEntry (String it)'''«it»''' +def implementsListEntry (String it)'''«it»''' def createPaletteviewerProvider (GenEditorView it)''' -«generatedMemberComment» +«generatedMemberComment» protected org.eclipse.gef.ui.palette.PaletteViewerProvider createPaletteViewerProvider() { getEditDomain().setPaletteRoot(createPaletteRoot(null)); return new org.eclipse.gef.ui.palette.PaletteViewerProvider(getEditDomain()) { @@ -219,7 +219,7 @@ protected org.eclipse.gef.ui.palette.PaletteViewerProvider createPaletteViewerPr * with a defaultTool that is the SelectToolEx that undestands how to handle the enter * key which will result in the creation of the shape also. */ - «overrideC(it.editorGen.diagram)» + «overrideC(it.editorGen.diagram)» protected void configurePaletteViewer(org.eclipse.gef.ui.palette.PaletteViewer viewer) { super.configurePaletteViewer(viewer); @@ -237,7 +237,7 @@ protected org.eclipse.gef.ui.palette.PaletteViewerProvider createPaletteViewerPr viewer.setCustomizer(createPaletteCustomizer()); } - «overrideC(it.editorGen.diagram)» + «overrideC(it.editorGen.diagram)» public org.eclipse.gef.ui.palette.PaletteViewer createPaletteViewer(org.eclipse.swt.widgets.Composite parent) { org.eclipse.gef.ui.palette.PaletteViewer pViewer = constructPaletteViewer(); pViewer.createControl(parent); @@ -265,7 +265,7 @@ protected org.eclipse.gef.ui.palette.PaletteViewerProvider createPaletteViewerPr * the KeyEvent * @return <code>true</code> if KeyEvent was handled in some way */ - «overrideC(it.editorGen.diagram)» + «overrideC(it.editorGen.diagram)» public boolean keyReleased(org.eclipse.swt.events.KeyEvent event) { if (event.keyCode == org.eclipse.swt.SWT.Selection) { @@ -313,7 +313,7 @@ protected org.eclipse.gef.ui.palette.PaletteViewerProvider createPaletteViewerPr * * @see org.eclipse.swt.events.MouseListener#mouseDoubleClick(org.eclipse.swt.events.MouseEvent) */ - «overrideI(it.editorGen.diagram)» + «overrideI(it.editorGen.diagram)» public void mouseDoubleClick(org.eclipse.swt.events.MouseEvent e) { org.eclipse.gef.Tool tool = getPaletteViewer().getActiveTool().createTool(); @@ -331,12 +331,12 @@ protected org.eclipse.gef.ui.palette.PaletteViewerProvider createPaletteViewerPr } } - «overrideI(it.editorGen.diagram)» + «overrideI(it.editorGen.diagram)» public void mouseDown(org.eclipse.swt.events.MouseEvent e) { // do nothing } - «overrideI(it.editorGen.diagram)» + «overrideI(it.editorGen.diagram)» public void mouseUp(org.eclipse.swt.events.MouseEvent e) { // Deactivate current active tool here if a // double-click was handled. @@ -358,7 +358,7 @@ protected org.eclipse.gef.ui.palette.PaletteViewerProvider createPaletteViewerPr //Not used override performSaveAs (GenEditorView it)''' - «generatedMemberComment» + «generatedMemberComment» protected void performSaveAs(org.eclipse.core.runtime.IProgressMonitor progressMonitor) { // Nothing } @@ -366,14 +366,14 @@ protected void performSaveAs(org.eclipse.core.runtime.IProgressMonitor progressM //Share the same editing domain override getEditingDomain (GenEditorView it)''' - «generatedMemberComment» + «generatedMemberComment» public org.eclipse.emf.transaction.TransactionalEditingDomain getEditingDomain() { return editingDomain; } ''' def createEditingDomain (GenEditorView it)''' -«generatedMemberComment» +«generatedMemberComment» protected org.eclipse.emf.transaction.TransactionalEditingDomain createEditingDomain() { // Already configured return editingDomain; @@ -382,12 +382,12 @@ def createEditingDomain (GenEditorView it)''' def configureDiagramEditDomain (GenEditorView it)''' -«generatedMemberComment» +«generatedMemberComment» protected void configureDiagramEditDomain() { super.configureDiagramEditDomain(); getDiagramEditDomain().getDiagramCommandStack().addCommandStackListener(new org.eclipse.gef.commands.CommandStackListener() { - «overrideI(it.editorGen.diagram)» + «overrideI(it.editorGen.diagram)» public void commandStackChanged(java.util.EventObject event) { if (org.eclipse.swt.widgets.Display.getCurrent() == null) { org.eclipse.swt.widgets.Display.getDefault().asyncExec(new Runnable() { @@ -406,7 +406,7 @@ def configureDiagramEditDomain (GenEditorView it)''' ''' def doSave (GenEditorView it)''' -«generatedMemberComment» +«generatedMemberComment» public void doSave(org.eclipse.core.runtime.IProgressMonitor progressMonitor) { // The saving of the resource is done by the CoreMultiDiagramEditor getDirtyState().saved(); @@ -414,7 +414,7 @@ def doSave (GenEditorView it)''' ''' def getDirtyState (GenEditorView it)''' -«generatedMemberComment» +«generatedMemberComment» protected org.eclipse.papyrus.commands.util.OperationHistoryDirtyState getDirtyState() { if(dirtyState == null) { dirtyState = org.eclipse.papyrus.commands.util.OperationHistoryDirtyState.newInstance(getUndoContext(), getOperationHistory()); @@ -424,7 +424,7 @@ def getDirtyState (GenEditorView it)''' ''' def setUndoContext (GenEditorView it)''' -«generatedMemberComment» +«generatedMemberComment» protected void setUndoContext(org.eclipse.core.commands.operations.IUndoContext context) { if(dirtyState != null) { dirtyState.dispose(); @@ -437,7 +437,7 @@ def setUndoContext (GenEditorView it)''' //Fix the dirty state def isDirty (GenEditorView it)''' -«generatedMemberComment» +«generatedMemberComment» public boolean isDirty() { return getDirtyState().isDirty(); } @@ -445,21 +445,21 @@ def isDirty (GenEditorView it)''' //Code refactoring moved in UMLDiagramEditor override getDocumentProvider (GenEditorView it)''' - «generatedMemberComment» + «generatedMemberComment» protected final org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDocumentProvider getDocumentProvider(org.eclipse.ui.IEditorInput input) { return documentProvider; } ''' override setDocumentProvider (GenEditorView it)''' - «generatedMemberComment» + «generatedMemberComment» protected final void setDocumentProvider(org.eclipse.ui.IEditorInput input) { // Already set in the constructor } ''' def getGraphicalViewer (GenEditorView it)''' -«generatedMemberComment» +«generatedMemberComment» @Override public org.eclipse.gef.GraphicalViewer getGraphicalViewer() { return super.getGraphicalViewer(); @@ -468,7 +468,7 @@ def getGraphicalViewer (GenEditorView it)''' override initializeGraphicalViewer (GenEditorView it)''' -«generatedMemberComment» +«generatedMemberComment» @Override protected void initializeGraphicalViewer() { super.initializeGraphicalViewer(); @@ -493,7 +493,7 @@ override initializeGraphicalViewer (GenEditorView it)''' ''' def selectionChanged (GenEditorView it)''' -«generatedMemberComment» +«generatedMemberComment» @Override public void selectionChanged(org.eclipse.ui.IWorkbenchPart part, org.eclipse.jface.viewers.ISelection selection) { if (getSite().getPage().getActiveEditor() instanceof org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor) { @@ -518,37 +518,37 @@ def selectionChanged (GenEditorView it)''' ''' override getContextID (GenEditorView it)''' - «generatedMemberComment» + «generatedMemberComment» protected String getContextID() { return CONTEXT_ID; } ''' override getAdapter(GenEditorView it) ''' - «IF !hasPropertySheet(it) || hasNavigator(it)» + «IF !hasPropertySheet(it) || hasNavigator(it)» - «generatedMemberComment» + «generatedMemberComment» @SuppressWarnings("rawtypes") public Object getAdapter(Class type) { - «IF !hasPropertySheet(it)» + «IF !hasPropertySheet(it)» if (type == org.eclipse.ui.views.properties.IPropertySheetPage.class) { return null; } - «ENDIF» - «IF hasNavigator(it)» + «ENDIF» + «IF hasNavigator(it)» if (type == org.eclipse.ui.part.IShowInTargetList.class) { return new org.eclipse.ui.part.IShowInTargetList() { - «overrideI(it.editorGen.diagram)» + «overrideI(it.editorGen.diagram)» public String[] getShowInTargetIds() { return new String[] { org.eclipse.ui.navigator.resources.ProjectExplorer.VIEW_ID }; } }; } - «ENDIF» + «ENDIF» return super.getAdapter(type); } - «ENDIF» + «ENDIF» ''' } diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/InitDiagramFileAction.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/InitDiagramFileAction.xtend index f29fcec8ce6..f09e6ec6542 100644 --- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/InitDiagramFileAction.xtend +++ b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/InitDiagramFileAction.xtend @@ -32,18 +32,18 @@ import com.google.inject.Singleton @Inject Externalizer xptExternalizer override classBody_PDE(GenDiagram it) ''' - «generatedMemberComment» + «generatedMemberComment» private org.eclipse.ui.IWorkbenchPart targetPart; - «generatedMemberComment» + «generatedMemberComment» private org.eclipse.emf.common.util.URI domainModelURI; - «generatedMemberComment» + «generatedMemberComment» public void setActivePart(org.eclipse.jface.action.IAction action, org.eclipse.ui.IWorkbenchPart targetPart) { this.targetPart = targetPart; } - «generatedMemberComment» + «generatedMemberComment» public void selectionChanged(org.eclipse.jface.action.IAction action, org.eclipse.jface.viewers.ISelection selection) { domainModelURI = null; action.setEnabled(false); @@ -56,40 +56,40 @@ import com.google.inject.Singleton action.setEnabled(true); } - «generatedMemberComment» + «generatedMemberComment» private org.eclipse.swt.widgets.Shell getShell() { return targetPart.getSite().getShell(); } - «generatedMemberComment» + «generatedMemberComment» public void run(org.eclipse.jface.action.IAction action) { org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain = org.eclipse.emf.workspace.WorkspaceEditingDomainFactory.INSTANCE.createEditingDomain(); - «IF editorGen.sameFileForDiagramAndModel» + «IF editorGen.sameFileForDiagramAndModel» org.eclipse.emf.ecore.resource.ResourceSet resourceSet = new org.eclipse.emf.ecore.resource.impl.ResourceSetImpl(); - «ELSE» + «ELSE» org.eclipse.emf.ecore.resource.ResourceSet resourceSet = editingDomain.getResourceSet(); - «ENDIF» + «ENDIF» org.eclipse.emf.ecore.EObject diagramRoot = null; try { org.eclipse.emf.ecore.resource.Resource resource = resourceSet.getResource(domainModelURI, true); diagramRoot = resource.getContents().get(0); } catch (org.eclipse.emf.common.util.WrappedException ex) { - «xptActivator.qualifiedClassName(editorGen.plugin)».getInstance().logError( - "Unable to load resource: " + domainModelURI, ex); «nonNLS(1)» + «xptActivator.qualifiedClassName(editorGen.plugin)».getInstance().logError( + "Unable to load resource: " + domainModelURI, ex); «nonNLS(1)» } if (diagramRoot == null) { org.eclipse.jface.dialogs.MessageDialog.openError(getShell(), - «xptExternalizer.accessorCall(editorGen, titleKey(i18nKeyForInitDiagramFileResourceErrorDialog()))», - «xptExternalizer.accessorCall(editorGen, messageKey(i18nKeyForInitDiagramFileResourceErrorDialog()))»); + «xptExternalizer.accessorCall(editorGen, titleKey(i18nKeyForInitDiagramFileResourceErrorDialog()))», + «xptExternalizer.accessorCall(editorGen, messageKey(i18nKeyForInitDiagramFileResourceErrorDialog()))»); return; } - org.eclipse.jface.wizard.Wizard wizard = new «editorGen.diagram.getNewDiagramFileWizardQualifiedClassName()»(domainModelURI, diagramRoot, editingDomain); + org.eclipse.jface.wizard.Wizard wizard = new «editorGen.diagram.getNewDiagramFileWizardQualifiedClassName()»(domainModelURI, diagramRoot, editingDomain); wizard.setWindowTitle(org.eclipse.osgi.util.NLS.bind( - «xptExternalizer.accessorCall(editorGen, i18nKeyForInitDiagramFileWizardTitle())», - «VisualIDRegistry::modelID(editorGen.diagram)»)); - «xptDiagramEditorUtil.qualifiedClassName(editorGen.diagram)».runWizard(getShell(), wizard, "InitDiagramFile"); «nonNLS( - 1)» + «xptExternalizer.accessorCall(editorGen, i18nKeyForInitDiagramFileWizardTitle())», + «VisualIDRegistry::modelID(editorGen.diagram)»)); + «xptDiagramEditorUtil.qualifiedClassName(editorGen.diagram)».runWizard(getShell(), wizard, "InitDiagramFile"); «nonNLS( + 1)» } ''' }
\ No newline at end of file diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/NewDiagramFileWizard.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/NewDiagramFileWizard.xtend index 5525f24ed56..1a15a9f1727 100644 --- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/NewDiagramFileWizard.xtend +++ b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/NewDiagramFileWizard.xtend @@ -40,57 +40,57 @@ import xpt.CodeStyle @Inject xpt.editor.VisualIDRegistry xptVisualIDRegistry override i18nValues(GenDiagram it) ''' - «xptExternalizer.messageEntry(nameKey(i18nKeyForNewDiagramFileWizardCreationPage(it)), 'Initialize new diagram file')» - «xptExternalizer.messageEntry(titleKey(i18nKeyForNewDiagramFileWizardCreationPage(it)), 'Diagram file')» - «xptExternalizer.messageEntry(descriptionKey(i18nKeyForNewDiagramFileWizardCreationPage(it)), - 'Create new diagram based on {0} model content')» - «xptExternalizer.messageEntry(nameKey(i18nKeyForNewDiagramFileWizardRootSelectionPage(it)), - 'Select diagram root element')» - «xptExternalizer.messageEntry(titleKey(i18nKeyForNewDiagramFileWizardRootSelectionPage(it)), 'Diagram root element')» - «xptExternalizer.messageEntry(descriptionKey(i18nKeyForNewDiagramFileWizardRootSelectionPage(it)), - 'Select semantic model element to be depicted on diagram')» - «xptExternalizer.messageEntry(i18nKeyForNewDiagramFileWizardRootSelectionPageSelectionTitle(it), - 'Select diagram root element:')» - «xptExternalizer.messageEntry(i18nKeyForNewDiagramFileWizardRootSelectionPageNoSelectionMessage(it), - 'Diagram root element is not selected')» - «xptExternalizer.messageEntry(i18nKeyForNewDiagramFileWizardRootSelectionPageInvalidSelectionMessage(it), - 'Invalid diagram root element is selected')» - «xptExternalizer.messageEntry(i18nKeyForNewDiagramFileWizardInitDiagramCommand(it), 'Initializing diagram contents')» - «xptExternalizer.messageEntry(i18nKeyForNewDiagramFileWizardIncorrectRootError(it), - 'Incorrect model object stored as a root resource object')» + «xptExternalizer.messageEntry(nameKey(i18nKeyForNewDiagramFileWizardCreationPage(it)), 'Initialize new diagram file')» + «xptExternalizer.messageEntry(titleKey(i18nKeyForNewDiagramFileWizardCreationPage(it)), 'Diagram file')» + «xptExternalizer.messageEntry(descriptionKey(i18nKeyForNewDiagramFileWizardCreationPage(it)), + 'Create new diagram based on {0} model content')» + «xptExternalizer.messageEntry(nameKey(i18nKeyForNewDiagramFileWizardRootSelectionPage(it)), + 'Select diagram root element')» + «xptExternalizer.messageEntry(titleKey(i18nKeyForNewDiagramFileWizardRootSelectionPage(it)), 'Diagram root element')» + «xptExternalizer.messageEntry(descriptionKey(i18nKeyForNewDiagramFileWizardRootSelectionPage(it)), + 'Select semantic model element to be depicted on diagram')» + «xptExternalizer.messageEntry(i18nKeyForNewDiagramFileWizardRootSelectionPageSelectionTitle(it), + 'Select diagram root element:')» + «xptExternalizer.messageEntry(i18nKeyForNewDiagramFileWizardRootSelectionPageNoSelectionMessage(it), + 'Diagram root element is not selected')» + «xptExternalizer.messageEntry(i18nKeyForNewDiagramFileWizardRootSelectionPageInvalidSelectionMessage(it), + 'Invalid diagram root element is selected')» + «xptExternalizer.messageEntry(i18nKeyForNewDiagramFileWizardInitDiagramCommand(it), 'Initializing diagram contents')» + «xptExternalizer.messageEntry(i18nKeyForNewDiagramFileWizardIncorrectRootError(it), + 'Incorrect model object stored as a root resource object')» ''' override NewDiagramFileWizard(GenDiagram it) ''' - «copyright(editorGen)» - package «packageName(it)»; + «copyright(editorGen)» + package «packageName(it)»; - «generatedClassComment» - public class «className(it)» extends org.eclipse.jface.wizard.Wizard { + «generatedClassComment» + public class «className(it)» extends org.eclipse.jface.wizard.Wizard { - «generatedMemberComment» - private «creationPage(it)» myFileCreationPage; + «generatedMemberComment» + private «creationPage(it)» myFileCreationPage; - «generatedMemberComment» - private «xptModelElementSelectionPage.qualifiedClassName(it)» diagramRootElementSelectionPage; + «generatedMemberComment» + private «xptModelElementSelectionPage.qualifiedClassName(it)» diagramRootElementSelectionPage; - «generatedMemberComment» + «generatedMemberComment» private org.eclipse.emf.transaction.TransactionalEditingDomain myEditingDomain; - «generatedMemberComment» - public «className(it)»(org.eclipse.emf.common.util.URI domainModelURI, + «generatedMemberComment» + public «className(it)»(org.eclipse.emf.common.util.URI domainModelURI, org.eclipse.emf.ecore.EObject diagramRoot, org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain) { - «_assert('domainModelURI != null : \"Domain model uri must be specified\"')» - «_assert('diagramRoot != null : \"Doagram root element must be specified\"')» - «_assert('editingDomain != null : \"Editing domain must be specified\"')» - - myFileCreationPage = new «creationPage(it)»(«xptExternalizer.accessorCall(editorGen, - nameKey(i18nKeyForNewDiagramFileWizardCreationPage(it)))», org.eclipse.jface.viewers.StructuredSelection.EMPTY); - myFileCreationPage.setTitle(«xptExternalizer.accessorCall(editorGen, - titleKey(i18nKeyForNewDiagramFileWizardCreationPage(it)))»); + «_assert('domainModelURI != null : \"Domain model uri must be specified\"')» + «_assert('diagramRoot != null : \"Doagram root element must be specified\"')» + «_assert('editingDomain != null : \"Editing domain must be specified\"')» + + myFileCreationPage = new «creationPage(it)»(«xptExternalizer.accessorCall(editorGen, + nameKey(i18nKeyForNewDiagramFileWizardCreationPage(it)))», org.eclipse.jface.viewers.StructuredSelection.EMPTY); + myFileCreationPage.setTitle(«xptExternalizer.accessorCall(editorGen, + titleKey(i18nKeyForNewDiagramFileWizardCreationPage(it)))»); myFileCreationPage.setDescription(org.eclipse.osgi.util.NLS.bind( - «xptExternalizer.accessorCall(editorGen, descriptionKey(i18nKeyForNewDiagramFileWizardCreationPage(it)))», - «VisualIDRegistry::modelID(it)»)); + «xptExternalizer.accessorCall(editorGen, descriptionKey(i18nKeyForNewDiagramFileWizardCreationPage(it)))», + «VisualIDRegistry::modelID(it)»)); org.eclipse.core.runtime.IPath filePath; String fileName = org.eclipse.emf.common.util.URI.decode(domainModelURI.trimFileExtension().lastSegment()); if (domainModelURI.isPlatformResource()) { @@ -99,114 +99,114 @@ import xpt.CodeStyle filePath = new org.eclipse.core.runtime.Path(domainModelURI.trimSegments(1).toFileString()); } else { // TODO : use some default path - throw new IllegalArgumentException("Unsupported URI: " + domainModelURI); «nonNLS(1)» + throw new IllegalArgumentException("Unsupported URI: " + domainModelURI); «nonNLS(1)» } myFileCreationPage.setContainerFullPath(filePath); - myFileCreationPage.setFileName(«xptDiagramEditorUtil.qualifiedClassName(it)».getUniqueFileName( - filePath, fileName, "«editorGen.diagramFileExtension»")); «nonNLS(1)» - - diagramRootElementSelectionPage = new DiagramRootElementSelectionPage(«xptExternalizer.accessorCall(editorGen, - nameKey(i18nKeyForNewDiagramFileWizardRootSelectionPage(it)))»); - diagramRootElementSelectionPage.setTitle(«xptExternalizer.accessorCall(editorGen, - titleKey(i18nKeyForNewDiagramFileWizardRootSelectionPage(it)))»); - diagramRootElementSelectionPage.setDescription(«xptExternalizer.accessorCall(editorGen, - descriptionKey(i18nKeyForNewDiagramFileWizardRootSelectionPage(it)))»); + myFileCreationPage.setFileName(«xptDiagramEditorUtil.qualifiedClassName(it)».getUniqueFileName( + filePath, fileName, "«editorGen.diagramFileExtension»")); «nonNLS(1)» + + diagramRootElementSelectionPage = new DiagramRootElementSelectionPage(«xptExternalizer.accessorCall(editorGen, + nameKey(i18nKeyForNewDiagramFileWizardRootSelectionPage(it)))»); + diagramRootElementSelectionPage.setTitle(«xptExternalizer.accessorCall(editorGen, + titleKey(i18nKeyForNewDiagramFileWizardRootSelectionPage(it)))»); + diagramRootElementSelectionPage.setDescription(«xptExternalizer.accessorCall(editorGen, + descriptionKey(i18nKeyForNewDiagramFileWizardRootSelectionPage(it)))»); diagramRootElementSelectionPage.setModelElement(diagramRoot); myEditingDomain = editingDomain; } - «generatedMemberComment» + «generatedMemberComment» public void addPages() { addPage(myFileCreationPage); addPage(diagramRootElementSelectionPage); } - «generatedMemberComment» + «generatedMemberComment» public boolean performFinish() { java.util.LinkedList<org.eclipse.core.resources.IFile> affectedFiles = new java.util.LinkedList<org.eclipse.core.resources.IFile>(); - «IF null == editorGen.application» + «IF null == editorGen.application» org.eclipse.core.resources.IFile diagramFile = myFileCreationPage.createNewFile(); - «xptDiagramEditorUtil.callSetCharset(it, 'diagramFile')» + «xptDiagramEditorUtil.callSetCharset(it, 'diagramFile')» affectedFiles.add(diagramFile); org.eclipse.emf.common.util.URI diagramModelURI = org.eclipse.emf.common.util.URI.createPlatformResourceURI(diagramFile.getFullPath().toString(), true); - «ELSE» + «ELSE» org.eclipse.core.runtime.IPath diagramModelPath = myFileCreationPage.getContainerFullPath().append(myFileCreationPage.getFileName()); org.eclipse.emf.common.util.URI diagramModelURI = org.eclipse.emf.common.util.URI.createFileURI(diagramModelPath.toString()); - «ENDIF» + «ENDIF» org.eclipse.emf.ecore.resource.ResourceSet resourceSet = myEditingDomain.getResourceSet(); final org.eclipse.emf.ecore.resource.Resource diagramResource = resourceSet.createResource(diagramModelURI); org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand command = new org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand( - myEditingDomain, «xptExternalizer.accessorCall(editorGen, i18nKeyForNewDiagramFileWizardInitDiagramCommand(it))», affectedFiles) { + myEditingDomain, «xptExternalizer.accessorCall(editorGen, i18nKeyForNewDiagramFileWizardInitDiagramCommand(it))», affectedFiles) { - «overrideC» + «overrideC» protected org.eclipse.gmf.runtime.common.core.command.CommandResult doExecuteWithResult( org.eclipse.core.runtime.IProgressMonitor monitor, org.eclipse.core.runtime.IAdaptable info) throws org.eclipse.core.commands.ExecutionException { - String diagramVID = «xptVisualIDRegistry.getDiagramVisualIDMethodCall(it)»(diagramRootElementSelectionPage.getModelElement()); - if (diagramVID.equals(«VisualIDRegistry::visualID(it)»)) { + String diagramVID = «xptVisualIDRegistry.getDiagramVisualIDMethodCall(it)»(diagramRootElementSelectionPage.getModelElement()); + if (diagramVID.equals(«VisualIDRegistry::visualID(it)»)) { return org.eclipse.gmf.runtime.common.core.command.CommandResult.newErrorCommandResult( - «xptExternalizer.accessorCall(editorGen, i18nKeyForNewDiagramFileWizardIncorrectRootError(it))»); + «xptExternalizer.accessorCall(editorGen, i18nKeyForNewDiagramFileWizardIncorrectRootError(it))»); } org.eclipse.gmf.runtime.notation.Diagram diagram = org.eclipse.gmf.runtime.diagram.core.services.ViewService.createDiagram( - diagramRootElementSelectionPage.getModelElement(), «VisualIDRegistry::modelID(it)», - «xptActivator.preferenceHintAccess(editorGen)»); + diagramRootElementSelectionPage.getModelElement(), «VisualIDRegistry::modelID(it)», + «xptActivator.preferenceHintAccess(editorGen)»); diagramResource.getContents().add(diagram); - «IF editorGen.sameFileForDiagramAndModel» + «IF editorGen.sameFileForDiagramAndModel» diagramResource.getContents().add(diagram.getElement()); - «ENDIF» - «IF !it.synchronized» - new «xptDiagramContentInitializer.qualifiedClassName(it)»().initDiagramContent(diagram); - «ENDIF» + «ENDIF» + «IF !it.synchronized» + new «xptDiagramContentInitializer.qualifiedClassName(it)»().initDiagramContent(diagram); + «ENDIF» return org.eclipse.gmf.runtime.common.core.command.CommandResult.newOKCommandResult(); } }; try { org.eclipse.core.commands.operations.OperationHistoryFactory.getOperationHistory().execute( command, new org.eclipse.core.runtime.NullProgressMonitor(), null); - diagramResource.save(«xptDiagramEditorUtil.callGetSaveOptions(it)»); - «xptDiagramEditorUtil.qualifiedClassName(it)».openDiagram(diagramResource); + diagramResource.save(«xptDiagramEditorUtil.callGetSaveOptions(it)»); + «xptDiagramEditorUtil.qualifiedClassName(it)».openDiagram(diagramResource); } catch (org.eclipse.core.commands.ExecutionException e) { - «xptActivator.qualifiedClassName(editorGen.plugin)».getInstance().logError( - "Unable to create model and diagram", e); «nonNLS(1)» + «xptActivator.qualifiedClassName(editorGen.plugin)».getInstance().logError( + "Unable to create model and diagram", e); «nonNLS(1)» } catch (java.io.IOException ex) { - «xptActivator.qualifiedClassName(editorGen.plugin)».getInstance().logError( - "Save operation failed for: " + diagramModelURI, ex); «nonNLS(1)» + «xptActivator.qualifiedClassName(editorGen.plugin)».getInstance().logError( + "Save operation failed for: " + diagramModelURI, ex); «nonNLS(1)» } catch (org.eclipse.ui.PartInitException ex) { - «xptActivator.qualifiedClassName(editorGen.plugin)».getInstance().logError( - "Unable to open editor", ex); «nonNLS(1)» + «xptActivator.qualifiedClassName(editorGen.plugin)».getInstance().logError( + "Unable to open editor", ex); «nonNLS(1)» } return true; } - «generatedClassComment» - private static class DiagramRootElementSelectionPage extends «xptModelElementSelectionPage.qualifiedClassName(it)» { + «generatedClassComment» + private static class DiagramRootElementSelectionPage extends «xptModelElementSelectionPage.qualifiedClassName(it)» { - «generatedMemberComment» + «generatedMemberComment» protected DiagramRootElementSelectionPage(String pageName) { super(pageName); } - «generatedMemberComment» + «generatedMemberComment» protected String getSelectionTitle() { - return «xptExternalizer.accessorCall(editorGen, i18nKeyForNewDiagramFileWizardRootSelectionPageSelectionTitle(it))»; + return «xptExternalizer.accessorCall(editorGen, i18nKeyForNewDiagramFileWizardRootSelectionPageSelectionTitle(it))»; } - «generatedMemberComment» + «generatedMemberComment» protected boolean validatePage() { if (getModelElement() == null) { - setErrorMessage(«xptExternalizer.accessorCall(editorGen, - i18nKeyForNewDiagramFileWizardRootSelectionPageNoSelectionMessage(it))»); + setErrorMessage(«xptExternalizer.accessorCall(editorGen, + i18nKeyForNewDiagramFileWizardRootSelectionPageNoSelectionMessage(it))»); return false; } boolean result = org.eclipse.gmf.runtime.diagram.core.services.ViewService.getInstance().provides( new org.eclipse.gmf.runtime.diagram.core.services.view.CreateDiagramViewOperation( new org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter(getModelElement()), - «VisualIDRegistry::modelID(it)», «xptActivator.preferenceHintAccess(editorGen)»)); - setErrorMessage(result ? null : «xptExternalizer.accessorCall(editorGen, - i18nKeyForNewDiagramFileWizardRootSelectionPageInvalidSelectionMessage(it))»); + «VisualIDRegistry::modelID(it)», «xptActivator.preferenceHintAccess(editorGen)»)); + setErrorMessage(result ? null : «xptExternalizer.accessorCall(editorGen, + i18nKeyForNewDiagramFileWizardRootSelectionPageInvalidSelectionMessage(it))»); return result; } } diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/ResourceSetInfo.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/ResourceSetInfo.xtend index 7eb32b3f8ca..35e491ee15e 100644 --- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/ResourceSetInfo.xtend +++ b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/ResourceSetInfo.xtend @@ -26,11 +26,11 @@ import com.google.inject.Singleton @Inject extension CodeStyle override handleResourceChangedSD(GenDiagram it) ''' - «generatedMemberComment» + «generatedMemberComment» public boolean handleResourceChanged(final org.eclipse.emf.ecore.resource.Resource resource) { - «updateSynchStateSD(it)» + «updateSynchStateSD(it)» org.eclipse.swt.widgets.Display.getDefault().asyncExec(new java.lang.Runnable() { - «overrideI» + «overrideI» public void run() { handleElementChanged(ResourceSetInfo.this, resource, null); } @@ -40,11 +40,11 @@ import com.google.inject.Singleton ''' override handleResourceDeletedSD(GenDiagram it) ''' - «generatedMemberComment» + «generatedMemberComment» public boolean handleResourceDeleted(org.eclipse.emf.ecore.resource.Resource resource) { - «updateSynchStateSD(it)» + «updateSynchStateSD(it)» org.eclipse.swt.widgets.Display.getDefault().asyncExec(new java.lang.Runnable() { - «overrideI» + «overrideI» public void run() { fireElementDeleted(ResourceSetInfo.this.getEditorInput()); } @@ -54,12 +54,12 @@ import com.google.inject.Singleton ''' override handleResourceMovedSD(GenDiagram it) ''' - «generatedMemberComment» + «generatedMemberComment» public boolean handleResourceMoved(org.eclipse.emf.ecore.resource.Resource resource, final org.eclipse.emf.common.util.URI newURI) { - «updateSynchStateSD(it)» + «updateSynchStateSD(it)» if (myDocument.getDiagram().eResource() == resource) { org.eclipse.swt.widgets.Display.getDefault().asyncExec(new java.lang.Runnable() { - «overrideI» + «overrideI» public void run() { handleElementMoved(ResourceSetInfo.this.getEditorInput(), newURI); } diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/ResourceSetModificationListener.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/ResourceSetModificationListener.xtend index 8a991e830cd..af57b1d02ac 100644 --- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/ResourceSetModificationListener.xtend +++ b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/ResourceSetModificationListener.xtend @@ -26,7 +26,7 @@ import xpt.Common override notifyChanged(GenDiagram it) ''' - «generatedMemberComment» + «generatedMemberComment» public void notifyChanged(org.eclipse.emf.common.notify.Notification notification) { if (notification.getNotifier() instanceof org.eclipse.emf.ecore.resource.ResourceSet) { super.notifyChanged(notification); @@ -48,11 +48,11 @@ import xpt.Common myInfo.fCanBeSaved = modified; dirtyStateChanged = true; } - «IF null == editorGen.application» + «IF null == editorGen.application» if (!resource.isModified()) { myInfo.setSynchronized(resource); } - «ENDIF» + «ENDIF» } if (dirtyStateChanged) { fireElementDirtyStateChanged(myInfo.getEditorInput(), modified); diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/ValidateAction.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/ValidateAction.xtend index 2a5f1032a2e..0ebfa7d2024 100644 --- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/ValidateAction.xtend +++ b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/ValidateAction.xtend @@ -34,7 +34,7 @@ import xpt.providers.ValidationProvider override runNonUIValidation(GenDiagram it) ''' - «generatedMemberComment» + «generatedMemberComment» public static void runNonUIValidation(org.eclipse.gmf.runtime.notation.View view) { org.eclipse.swt.widgets.Shell shell = org.eclipse.swt.widgets.Display.getCurrent().getActiveShell(); if (shell == null) { @@ -50,10 +50,10 @@ import xpt.providers.ValidationProvider override createMarkersForStatus(GenDiagram it) ''' - «generatedMemberComment» + «generatedMemberComment» private static void createMarkers( - «IF editorGen.application == null»org.eclipse.core.resources.IFile - «ELSE»org.eclipse.gmf.runtime.notation.View«ENDIF» target, + «IF editorGen.application == null»org.eclipse.core.resources.IFile + «ELSE»org.eclipse.gmf.runtime.notation.View«ENDIF» target, org.eclipse.core.runtime.IStatus validationStatus, org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart diagramEditPart) { if (validationStatus.isOK()) { @@ -61,14 +61,14 @@ import xpt.providers.ValidationProvider } final org.eclipse.core.runtime.IStatus rootStatus = validationStatus; java.util.List allStatuses = new java.util.ArrayList(); - «xptDiagramEditorUtil.qualifiedClassName(it)».LazyElement2ViewMap element2ViewMap = new «xptDiagramEditorUtil. - qualifiedClassName(it)».LazyElement2ViewMap( + «xptDiagramEditorUtil.qualifiedClassName(it)».LazyElement2ViewMap element2ViewMap = new «xptDiagramEditorUtil. + qualifiedClassName(it)».LazyElement2ViewMap( diagramEditPart.getDiagramView(), collectTargetElements(rootStatus, new java.util.HashSet<org.eclipse.emf.ecore.EObject>(), allStatuses)); for (java.util.Iterator it = allStatuses.iterator(); it.hasNext();) { org.eclipse.emf.validation.model.IConstraintStatus nextStatus = (org.eclipse.emf.validation.model.IConstraintStatus) it.next(); - org.eclipse.gmf.runtime.notation.View view = «xptDiagramEditorUtil.qualifiedClassName(it)».findView( + org.eclipse.gmf.runtime.notation.View view = «xptDiagramEditorUtil.qualifiedClassName(it)».findView( diagramEditPart, nextStatus.getTarget(), element2ViewMap); addMarker(diagramEditPart.getViewer(), target, view.eResource().getURIFragment(view), org.eclipse.gmf.runtime.emf.core.util.EMFCoreUtil.getQualifiedName(nextStatus.getTarget(), true), @@ -79,10 +79,10 @@ import xpt.providers.ValidationProvider override createMarkersForDiagnostic(GenDiagram it) ''' - «generatedMemberComment» + «generatedMemberComment» private static void createMarkers( - «IF editorGen.application == null»org.eclipse.core.resources.IFile - «ELSE»org.eclipse.gmf.runtime.notation.View«ENDIF» target, + «IF editorGen.application == null»org.eclipse.core.resources.IFile + «ELSE»org.eclipse.gmf.runtime.notation.View«ENDIF» target, org.eclipse.emf.common.util.Diagnostic emfValidationStatus, org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart diagramEditPart) { if (emfValidationStatus.getSeverity() == org.eclipse.emf.common.util.Diagnostic.OK) { @@ -90,8 +90,8 @@ import xpt.providers.ValidationProvider } final org.eclipse.emf.common.util.Diagnostic rootStatus = emfValidationStatus; java.util.List<org.eclipse.emf.common.util.Diagnostic> allDiagnostics = new java.util.ArrayList<org.eclipse.emf.common.util.Diagnostic>(); - «xptDiagramEditorUtil.qualifiedClassName(it)».LazyElement2ViewMap element2ViewMap = - new «xptDiagramEditorUtil.qualifiedClassName(it)».LazyElement2ViewMap( + «xptDiagramEditorUtil.qualifiedClassName(it)».LazyElement2ViewMap element2ViewMap = + new «xptDiagramEditorUtil.qualifiedClassName(it)».LazyElement2ViewMap( diagramEditPart.getDiagramView(), collectTargetElements(rootStatus, new java.util.HashSet<org.eclipse.emf.ecore.EObject>(), allDiagnostics)); for (java.util.Iterator<org.eclipse.emf.common.util.Diagnostic> it = emfValidationStatus.getChildren().iterator(); it.hasNext();) { @@ -99,7 +99,7 @@ import xpt.providers.ValidationProvider java.util.List<?> data = nextDiagnostic.getData(); if (data != null && !data.isEmpty() && data.get(0) instanceof org.eclipse.emf.ecore.EObject) { org.eclipse.emf.ecore.EObject element = (org.eclipse.emf.ecore.EObject) data.get(0); - org.eclipse.gmf.runtime.notation.View view = «xptDiagramEditorUtil.qualifiedClassName(it)».findView( + org.eclipse.gmf.runtime.notation.View view = «xptDiagramEditorUtil.qualifiedClassName(it)».findView( diagramEditPart, element, element2ViewMap); addMarker(diagramEditPart.getViewer(), target, view.eResource().getURIFragment(view), org.eclipse.gmf.runtime.emf.core.util.EMFCoreUtil.getQualifiedName(element, true), @@ -111,7 +111,7 @@ import xpt.providers.ValidationProvider override collectTargetElementsFromStatus(GenDiagram it) ''' - «generatedMemberComment» + «generatedMemberComment» private static java.util.Set<org.eclipse.emf.ecore.EObject> collectTargetElements(org.eclipse.core.runtime.IStatus status, java.util.Set<org.eclipse.emf.ecore.EObject> targetElementCollector, java.util.List<org.eclipse.emf.validation.model.IConstraintStatus> allConstraintStatuses) { if (status instanceof org.eclipse.emf.validation.model.IConstraintStatus) { @@ -130,7 +130,7 @@ import xpt.providers.ValidationProvider override collectTargetElementsFromDiagnostic(GenDiagram it) ''' - «generatedMemberComment» + «generatedMemberComment» private static java.util.Set<org.eclipse.emf.ecore.EObject> collectTargetElements(org.eclipse.emf.common.util.Diagnostic diagnostic, java.util.Set<org.eclipse.emf.ecore.EObject> targetElementCollector, java.util.List<org.eclipse.emf.common.util.Diagnostic> allDiagnostics) { java.util.List<?> data = diagnostic.getData(); @@ -151,29 +151,29 @@ import xpt.providers.ValidationProvider override run(GenDiagram it) ''' - «generatedMemberComment» + «generatedMemberComment» public void run() { org.eclipse.ui.IWorkbenchPart workbenchPart = page.getActivePart(); if (workbenchPart instanceof org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramWorkbenchPart) { final org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramWorkbenchPart part = (org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramWorkbenchPart) workbenchPart; try { - «IF editorGen.application == null» + «IF editorGen.application == null» new org.eclipse.ui.actions.WorkspaceModifyDelegatingOperation( - «ENDIF» + «ENDIF» new org.eclipse.jface.operation.IRunnableWithProgress() { - «overrideI» + «overrideI» public void run(org.eclipse.core.runtime.IProgressMonitor monitor) throws InterruptedException, java.lang.reflect.InvocationTargetException { runValidation(part.getDiagramEditPart(), part.getDiagram()); } } - «IF editorGen.application == null» + «IF editorGen.application == null» ) - «ENDIF» + «ENDIF» .run(new org.eclipse.core.runtime.NullProgressMonitor()); } catch (Exception e) { - «xptActivator.qualifiedClassName(editorGen.plugin)».getInstance().logError("Validation action failed", e); «nonNLS(1)» + «xptActivator.qualifiedClassName(editorGen.plugin)».getInstance().logError("Validation action failed", e); «nonNLS(1)» } } } @@ -181,14 +181,14 @@ import xpt.providers.ValidationProvider override runValidationWithEP(GenDiagram it) ''' - «generatedMemberComment» + «generatedMemberComment» public static void runValidation(org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart diagramEditPart, org.eclipse.gmf.runtime.notation.View view) { final org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart fpart = diagramEditPart; final org.eclipse.gmf.runtime.notation.View fview = view; org.eclipse.emf.transaction.TransactionalEditingDomain txDomain = org.eclipse.emf.transaction.util.TransactionUtil.getEditingDomain(view); - «xptValidationProvider.qualifiedClassName(it)».runWithConstraints(txDomain, new Runnable() { + «xptValidationProvider.qualifiedClassName(it)».runWithConstraints(txDomain, new Runnable() { - «overrideI» + «overrideI» public void run() { validate(fpart, fview); } @@ -198,13 +198,13 @@ import xpt.providers.ValidationProvider override runEMFValidator(GenDiagram it) ''' - «generatedMemberComment» + «generatedMemberComment» private static org.eclipse.emf.common.util.Diagnostic runEMFValidator( org.eclipse.gmf.runtime.notation.View target) { if (target.isSetElement() && target.getElement() != null) { return new org.eclipse.emf.ecore.util.Diagnostician() { - «overrideC» + «overrideC» public String getObjectLabel(org.eclipse.emf.ecore.EObject eObject) { return org.eclipse.gmf.runtime.emf.core.util.EMFCoreUtil.getQualifiedName(eObject, true); } diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/VisualIDRegistry.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/VisualIDRegistry.xtend index 3d1ae19124f..7dd217322c7 100644 --- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/VisualIDRegistry.xtend +++ b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/VisualIDRegistry.xtend @@ -42,12 +42,12 @@ import xpt.diagram.updater.Utils_qvto @Inject CodeStyle xptCodeStyle; override getDiagramVisualID(GenDiagram it) ''' - «generatedMemberComment()» - public static String «getDiagramVisualIDMethodName(it)»(org.eclipse.emf.ecore.EObject domainElement) { + «generatedMemberComment()» + public static String «getDiagramVisualIDMethodName(it)»(org.eclipse.emf.ecore.EObject domainElement) { if (domainElement == null) { - «unrecognizedVID(it)» + «unrecognizedVID(it)» } - return «visualID(it)»; + return «visualID(it)»; } ''' @@ -60,122 +60,122 @@ import xpt.diagram.updater.Utils_qvto * FIXME don't use static fields, replace with instance/separate cache (e.g. accessible from Activator) */ override constraintMethods(GenDiagram it) ''' - «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» + «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» ''' //[ExtendedConstraint] Model selector constraint override 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) +««« «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) ''' // override dispatch domainElementConstraintMethod(GenExpressionInterpreter it, GenCommonBase diagramElement, // ValueExpression expression, GenClass context) ''' -// «generatedMemberComment()» -// «IF diagramElement instanceof GenLink» +// «generatedMemberComment()» +// «IF diagramElement instanceof GenLink» // -// «ELSE» -// private static boolean «domainElementConstraintMethodName(diagramElement)»(«QualifiedClassName(context)» domainElement) { -// Object result = «xptGetExpression.getExpression(it, expression, context)».evaluate(domainElement); +// «ELSE» +// private static boolean «domainElementConstraintMethodName(diagramElement)»(«QualifiedClassName(context)» domainElement) { +// Object result = «xptGetExpression.getExpression(it, expression, context)».evaluate(domainElement); // return result instanceof Boolean && ((Boolean)result).booleanValue(); // } -// «ENDIF» +// «ENDIF» // // ''' // [ExtendedConstraint] Model selector constraint override dispatch domainElementConstraintMethod(GenJavaExpressionProvider it, GenCommonBase diagramElement, ValueExpression expression, GenClass context) ''' - «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.length() == 0))» + «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.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» - «ELSE» + throw new java.lang.UnsupportedOperationException("No java implementation provided in '« domainElementConstraintMethodName(diagramElement)»' operation");«nonNLS» + «ELSE» return false; - «ENDIF» + «ENDIF» } ''' override runtimeTypedInstance(GenDiagram it) ''' - «generatedClassComment()» - public static final org.eclipse.papyrus.infra.gmfdiag.common.structure.DiagramStructure «runtimeTypedInstanceName(it)» = new org.eclipse.papyrus.infra.gmfdiag.common.structure.DiagramStructure() { - «generatedMemberComment()» - «xptCodeStyle.overrideC(it)» - public String «getVisualIdMethodName(it)»(org.eclipse.gmf.runtime.notation.View view) { - return «getVisualIDMethodCall(it)»(view); + «generatedClassComment()» + public static final org.eclipse.papyrus.infra.gmfdiag.common.structure.DiagramStructure «runtimeTypedInstanceName(it)» = new org.eclipse.papyrus.infra.gmfdiag.common.structure.DiagramStructure() { + «generatedMemberComment()» + «xptCodeStyle.overrideC(it)» + public String «getVisualIdMethodName(it)»(org.eclipse.gmf.runtime.notation.View view) { + return «getVisualIDMethodCall(it)»(view); } - «generatedMemberComment()» - «xptCodeStyle.overrideC(it)» - public String «getModelIDMethodName(it)»(org.eclipse.gmf.runtime.notation.View view) { - return «getModelIDMethodCall(it)»(view); + «generatedMemberComment()» + «xptCodeStyle.overrideC(it)» + public String «getModelIDMethodName(it)»(org.eclipse.gmf.runtime.notation.View view) { + return «getModelIDMethodCall(it)»(view); } - «generatedMemberComment()» - «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.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.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.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.overrideC(it)» - public boolean «isCompartmentVisualIDMethodName(it)»(String visualID) { - return «isCompartmentVisualIDMethodCall(it)»(visualID); + «generatedMemberComment()» + «xptCodeStyle.overrideC(it)» + public boolean «isCompartmentVisualIDMethodName(it)»(String visualID) { + return «isCompartmentVisualIDMethodCall(it)»(visualID); } - «generatedMemberComment()» - «xptCodeStyle.overrideC(it)» - public boolean «isSemanticLeafVisualIDMethodName(it)»(String visualID) { - return «isSemanticLeafVisualIDMethodCall(it)»(visualID); + «generatedMemberComment()» + «xptCodeStyle.overrideC(it)» + public boolean «isSemanticLeafVisualIDMethodName(it)»(String visualID) { + return «isSemanticLeafVisualIDMethodCall(it)»(visualID); } }; ''' override getModelID(GenDiagram it) ''' - «generatedMemberComment()» - public static String «getModelIDMethodName(it)»(org.eclipse.gmf.runtime.notation.View view) { + «generatedMemberComment()» + public static String «getModelIDMethodName(it)»(org.eclipse.gmf.runtime.notation.View view) { org.eclipse.gmf.runtime.notation.View diagram = view.getDiagram(); while (view != diagram) { - org.eclipse.emf.ecore.EAnnotation annotation = view.getEAnnotation("Shortcut"); «nonNLS(1)» + org.eclipse.emf.ecore.EAnnotation annotation = view.getEAnnotation("Shortcut"); «nonNLS(1)» if (annotation != null) { - return annotation.getDetails().get("modelID"); «nonNLS(1)» + return annotation.getDetails().get("modelID"); «nonNLS(1)» } view = (org.eclipse.gmf.runtime.notation.View) view.eContainer(); } @@ -184,23 +184,23 @@ import xpt.diagram.updater.Utils_qvto ''' override def getType(GenDiagram it) ''' - «generatedMemberComment()» - public static String «getTypeMethodName(it)»(String visualID) { + «generatedMemberComment()» + public static String «getTypeMethodName(it)»(String visualID) { return visualID; } ''' override def getViewVisualID(GenDiagram it) ''' - «generatedMemberComment()» - public static String «getVisualIdMethodName(it)»(org.eclipse.gmf.runtime.notation.View view) { + «generatedMemberComment()» + 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)»; + if («modelID(it)».equals(view.getType())) { + return «visualID(it)»; } else { - «unrecognizedVID(it)» + «unrecognizedVID(it)» } } - return «getVisualIDMethodCall(it)»(view.getType()); + return «getVisualIDMethodCall(it)»(view.getType()); } ''' @@ -209,75 +209,75 @@ import xpt.diagram.updater.Utils_qvto ''' override def getVisualID(GenDiagram it) ''' - «generatedMemberComment()» - public static String «getVisualIdMethodName(it)»(String type) { + «generatedMemberComment()» + public static String «getVisualIdMethodName(it)»(String type) { return type; } ''' override def getNodeVisualID(GenDiagram it) ''' - «generatedMemberComment()» - public static String «getNodeVisualIDMethodName(it)»(org.eclipse.gmf.runtime.notation.View containerView, org.eclipse.emf.ecore.EObject domainElement) { + «generatedMemberComment()» + public static String «getNodeVisualIDMethodName(it)»(org.eclipse.gmf.runtime.notation.View containerView, org.eclipse.emf.ecore.EObject domainElement) { if (domainElement == null) { - «unrecognizedVID(it)» + «unrecognizedVID(it)» } - String containerModelID = «getModelIDMethodCall(it)»(containerView); - if (!«modelID(it)».equals(containerModelID)«FOR spf : shortcutsProvidedFor»«checkContainerModelID(spf)»«ENDFOR») { «nonNLS_All(shortcutsProvidedFor)» - «unrecognizedVID(it)» + String containerModelID = «getModelIDMethodCall(it)»(containerView); + if (!«modelID(it)».equals(containerModelID)«FOR spf : shortcutsProvidedFor»«checkContainerModelID(spf)»«ENDFOR») { «nonNLS_All(shortcutsProvidedFor)» + «unrecognizedVID(it)» } String containerVisualID; - if («modelID(it)».equals(containerModelID)) { - containerVisualID = «getVisualIDMethodCall(it)»(containerView); + if («modelID(it)».equals(containerModelID)) { + containerVisualID = «getVisualIDMethodCall(it)»(containerView); } else { if (containerView instanceof org.eclipse.gmf.runtime.notation.Diagram) { - containerVisualID = «visualID(it)»; + containerVisualID = «visualID(it)»; } else { - «unrecognizedVID(it)» + «unrecognizedVID(it)» } } if (containerVisualID != null) { switch (containerVisualID) { - «FOR container : allContainers» - «caseDomainContainerVisualID(container)» - «ENDFOR» + «FOR container : allContainers» + «caseDomainContainerVisualID(container)» + «ENDFOR» } } - «unrecognizedVID(it)» + «unrecognizedVID(it)» } ''' override def getLinkWithClassVisualID(GenDiagram it) ''' - «generatedMemberComment()» - public static String «getLinkWithClassVisualIDMethodName(it)»(org.eclipse.emf.ecore.EObject domainElement) { + «generatedMemberComment()» + public static String «getLinkWithClassVisualIDMethodName(it)»(org.eclipse.emf.ecore.EObject domainElement) { if (domainElement == null) { - «unrecognizedVID(it)» + «unrecognizedVID(it)» } - «FOR typeLink : links.filter[l|isTypeLink(l)]»«returnVisualID(typeLink)»«ENDFOR» - «unrecognizedVID(it)» + «FOR typeLink : links.filter[l|isTypeLink(l)]»«returnVisualID(typeLink)»«ENDFOR» + «unrecognizedVID(it)» } ''' override def canCreateNode(GenDiagram it) ''' - «generatedMemberComment()» - 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)» + «generatedMemberComment()» + 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; } String containerVisualID; - if («modelID(it)».equals(containerModelID)) { - containerVisualID = «getVisualIDMethodCall(it)»(containerView); + if («modelID(it)».equals(containerModelID)) { + containerVisualID = «getVisualIDMethodCall(it)»(containerView); } else { if (containerView instanceof org.eclipse.gmf.runtime.notation.Diagram) { - containerVisualID = «visualID(it)»; + containerVisualID = «visualID(it)»; } else { return false; } } 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» + «FOR container : allContainers.filter[e|getEssentialVisualChildren(e).notEmpty]»«checkEssentialChildren(container)»«ENDFOR» + «FOR link : links.filter[l|getEssentialVisualChildren(l).notEmpty]»«checkEssentialChildren(link)»«ENDFOR» } } return false; @@ -285,22 +285,22 @@ import xpt.diagram.updater.Utils_qvto ''' override def checkEssentialChild(GenCommonBase it) ''' - if («visualID(it)».equals(nodeVisualID)) { + if («visualID(it)».equals(nodeVisualID)) { return true; } ''' override def isCompartmentVisualID(GenDiagram it) ''' - «generatedMemberComment()» - public static boolean «isCompartmentVisualIDMethodName(it)»(String visualID) { - «IF compartments.notEmpty» + «generatedMemberComment()» + public static boolean «isCompartmentVisualIDMethodName(it)»(String visualID) { + «IF compartments.notEmpty» if (visualID != null) { switch (visualID) { - «FOR compartment : compartments»«caseVisualID(compartment)»«ENDFOR» + «FOR compartment : compartments»«caseVisualID(compartment)»«ENDFOR» return true; } } - «ENDIF» + «ENDIF» return false; } ''' @@ -308,17 +308,17 @@ import xpt.diagram.updater.Utils_qvto override def isSemanticLeafVisualID(GenDiagram it) { 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)»(String visualID) { + «generatedMemberComment()» + 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)» + «/*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» + «IF leafs.notEmpty» + «FOR leaf : leafs»«caseVisualID(leaf)»«ENDFOR» return true; - «ENDIF» + «ENDIF» } } return false; @@ -327,16 +327,16 @@ import xpt.diagram.updater.Utils_qvto } override def checkNodeVisualID(GenDiagram it) ''' - «generatedMemberComment()» - public static boolean «checkNodeVisualIDMethodName(it)»(org.eclipse.gmf.runtime.notation.View containerView, org.eclipse.emf.ecore.EObject domainElement, String candidate) { + «generatedMemberComment()» + 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; } - String basic = «getNodeVisualIDMethodName(it)»(containerView, domainElement); + String basic = «getNodeVisualIDMethodName(it)»(containerView, domainElement); return candidate.equals(basic); } ''' - override def domainElementConstraintMethodName(GenCommonBase it) '''is«stringUniqueIdentifier()»''' + override def domainElementConstraintMethodName(GenCommonBase it) '''is«stringUniqueIdentifier()»''' } diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/extensions.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/extensions.xtend index e60a5d48faf..dacba20eb65 100644 --- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/extensions.xtend +++ b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/extensions.xtend @@ -24,82 +24,82 @@ import xpt.Common @Inject extension Common; override extensions(GenEditorGenerator it) ''' - «extraLineBreak» - ««« YT (not used): - ««« «tripleSpace(1)»<extension point="org.eclipse.ui.editors" id="gmf-editor"> - ««« «tripleSpace(2)»«xmlGeneratedTag()» - ««« «tripleSpace(2)»<editor - ««« «tripleSpace(3)»id="«editor.ID»" - ««« «tripleSpace(3)»name="%editorName" - ««« «tripleSpace(3)»icon="«editor.iconPathX»" - ««« «tripleSpace(3)»extensions="«diagramFileExtension»" - ««« «tripleSpace(3)»default="true" - ««« «tripleSpace(3)»class="«xptEditor.qualifiedClassName(editor)»" - ««« «tripleSpace(3)»matchingStrategy="«xptMatching.qualifiedClassName(diagram)»" - ««« «tripleSpace(3)»contributorClass="«xptActionBarContributor.qualifiedClassName(editor)»"> - ««« «tripleSpace(2)»</editor> - ««« «tripleSpace(1)»</extension> + «extraLineBreak» + ««« YT (not used): + ««« «tripleSpace(1)»<extension point="org.eclipse.ui.editors" id="gmf-editor"> + ««« «tripleSpace(2)»«xmlGeneratedTag()» + ««« «tripleSpace(2)»<editor + ««« «tripleSpace(3)»id="«editor.ID»" + ««« «tripleSpace(3)»name="%editorName" + ««« «tripleSpace(3)»icon="«editor.iconPathX»" + ««« «tripleSpace(3)»extensions="«diagramFileExtension»" + ««« «tripleSpace(3)»default="true" + ««« «tripleSpace(3)»class="«xptEditor.qualifiedClassName(editor)»" + ««« «tripleSpace(3)»matchingStrategy="«xptMatching.qualifiedClassName(diagram)»" + ««« «tripleSpace(3)»contributorClass="«xptActionBarContributor.qualifiedClassName(editor)»"> + ««« «tripleSpace(2)»</editor> + ««« «tripleSpace(1)»</extension> - «extraLineBreak»«outTab» - «tripleSpace(1)»<extension point="org.eclipse.ui.contexts" id="ui-context"> - «tripleSpace(2)»«xmlGeneratedTag()» - «tripleSpace(2)»<context - «tripleSpace(3)»description="%context.description" - «tripleSpace(3)»id="«editor.contextID»" - «tripleSpace(3)»name="%context.name" - «tripleSpace(3)»parentId="org.eclipse.gmf.runtime.diagram.ui.diagramContext"> - «tripleSpace(2)»</context> - «tripleSpace(1)»</extension> + «extraLineBreak»«outTab» + «tripleSpace(1)»<extension point="org.eclipse.ui.contexts" id="ui-context"> + «tripleSpace(2)»«xmlGeneratedTag()» + «tripleSpace(2)»<context + «tripleSpace(3)»description="%context.description" + «tripleSpace(3)»id="«editor.contextID»" + «tripleSpace(3)»name="%context.name" + «tripleSpace(3)»parentId="org.eclipse.gmf.runtime.diagram.ui.diagramContext"> + «tripleSpace(2)»</context> + «tripleSpace(1)»</extension> - ««« YT (not used): - ««« «tripleSpace(1)»<extension point="org.eclipse.ui.newWizards" id="creation-wizard"> - ««« «tripleSpace(2)»«xmlGeneratedTag()» - ««« «tripleSpace(2)»<wizard - ««« «tripleSpace(3)»name="%newWizardName" - ««« «tripleSpace(3)»icon="«diagram.creationWizardIconPathX»" - ««« «tripleSpace(3)»category="«diagram.creationWizardCategoryID»" - ««« «tripleSpace(3)»class="«xptCreationWizard.qualifiedClassName(diagram)»" - ««« «tripleSpace(3)»id="«xptCreationWizard.qualifiedClassName(diagram)»ID"> - ««« «tripleSpace(3)»<description>%newWizardDesc</description> - ««« «tripleSpace(2)»</wizard> - ««« «tripleSpace(1)»</extension> - ««« - ««« «IF diagram.generateInitDiagramAction()» - ««« «IF null == application» - ««« «tripleSpace(1)»<extension point="org.eclipse.ui.popupMenus" id="init-diagram-action"> - ««« «tripleSpace(2)»«xmlGeneratedTag()» - ««« «tripleSpace(2)»<objectContribution - ««« «tripleSpace(4)»id="«plugin.ID».InitDiagram" - ««« «tripleSpace(4)»nameFilter="*.«domainFileExtension»" - ««« «tripleSpace(4)»objectClass="org.eclipse.core.resources.IFile"> - ««« «tripleSpace(3)»<action - ««« «tripleSpace(5)»label="%initDiagramActionLabel" - ««« «tripleSpace(5)»class="«xptInitDiagramFileAction.qualifiedClassName(diagram)»" - ««« «tripleSpace(5)»menubarPath="additions" - ««« «tripleSpace(5)»enablesFor="1" - ««« «tripleSpace(5)»id="«plugin.ID».InitDiagramAction"> - ««« «tripleSpace(3)»</action> - ««« «tripleSpace(2)»</objectContribution> - ««« «tripleSpace(1)»</extension> - ««« «ELSE» - ««« «tripleSpace(1)»<extension point="org.eclipse.ui.actionSets" id="init-diagram-action"> - ««« «tripleSpace(2)»«xmlGeneratedTag()» - ««« «tripleSpace(2)»<actionSet - ««« «tripleSpace(4)»label="%initDiagramActionLabel" - ««« «tripleSpace(4)»visible="true" - ««« «tripleSpace(4)»id="«plugin.ID».InitDiagram"> - ««« «tripleSpace(3)»<action - ««« «tripleSpace(5)»label="%initDiagramActionLabel" - ««« «tripleSpace(5)»class="«xptInitDiagramFileAction.qualifiedClassName(diagram)»" - ««« «tripleSpace(5)»menubarPath="file/additions" - ««« «tripleSpace(5)»id="«plugin.ID».InitDiagramAction"> - ««« «tripleSpace(3)»</action> - ««« «tripleSpace(2)»</actionSet> - ««« «tripleSpace(1)»</extension> - ««« «ENDIF» - ««« «extraLineBreak» «tripleSpace(1)» - ««« «ENDIF» - ««« + ««« YT (not used): + ««« «tripleSpace(1)»<extension point="org.eclipse.ui.newWizards" id="creation-wizard"> + ««« «tripleSpace(2)»«xmlGeneratedTag()» + ««« «tripleSpace(2)»<wizard + ««« «tripleSpace(3)»name="%newWizardName" + ««« «tripleSpace(3)»icon="«diagram.creationWizardIconPathX»" + ««« «tripleSpace(3)»category="«diagram.creationWizardCategoryID»" + ««« «tripleSpace(3)»class="«xptCreationWizard.qualifiedClassName(diagram)»" + ««« «tripleSpace(3)»id="«xptCreationWizard.qualifiedClassName(diagram)»ID"> + ««« «tripleSpace(3)»<description>%newWizardDesc</description> + ««« «tripleSpace(2)»</wizard> + ««« «tripleSpace(1)»</extension> + ««« + ««« «IF diagram.generateInitDiagramAction()» + ««« «IF null == application» + ««« «tripleSpace(1)»<extension point="org.eclipse.ui.popupMenus" id="init-diagram-action"> + ««« «tripleSpace(2)»«xmlGeneratedTag()» + ««« «tripleSpace(2)»<objectContribution + ««« «tripleSpace(4)»id="«plugin.ID».InitDiagram" + ««« «tripleSpace(4)»nameFilter="*.«domainFileExtension»" + ««« «tripleSpace(4)»objectClass="org.eclipse.core.resources.IFile"> + ««« «tripleSpace(3)»<action + ««« «tripleSpace(5)»label="%initDiagramActionLabel" + ««« «tripleSpace(5)»class="«xptInitDiagramFileAction.qualifiedClassName(diagram)»" + ««« «tripleSpace(5)»menubarPath="additions" + ««« «tripleSpace(5)»enablesFor="1" + ««« «tripleSpace(5)»id="«plugin.ID».InitDiagramAction"> + ««« «tripleSpace(3)»</action> + ««« «tripleSpace(2)»</objectContribution> + ««« «tripleSpace(1)»</extension> + ««« «ELSE» + ««« «tripleSpace(1)»<extension point="org.eclipse.ui.actionSets" id="init-diagram-action"> + ««« «tripleSpace(2)»«xmlGeneratedTag()» + ««« «tripleSpace(2)»<actionSet + ««« «tripleSpace(4)»label="%initDiagramActionLabel" + ««« «tripleSpace(4)»visible="true" + ««« «tripleSpace(4)»id="«plugin.ID».InitDiagram"> + ««« «tripleSpace(3)»<action + ««« «tripleSpace(5)»label="%initDiagramActionLabel" + ««« «tripleSpace(5)»class="«xptInitDiagramFileAction.qualifiedClassName(diagram)»" + ««« «tripleSpace(5)»menubarPath="file/additions" + ««« «tripleSpace(5)»id="«plugin.ID».InitDiagramAction"> + ««« «tripleSpace(3)»</action> + ««« «tripleSpace(2)»</actionSet> + ««« «tripleSpace(1)»</extension> + ««« «ENDIF» + ««« «extraLineBreak» «tripleSpace(1)» + ««« «ENDIF» + ««« ''' override outTab() { diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/palette/PaletteConfiguration.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/palette/PaletteConfiguration.xtend index 4804a7043c5..60c83f195b8 100644 --- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/palette/PaletteConfiguration.xtend +++ b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/palette/PaletteConfiguration.xtend @@ -38,16 +38,16 @@ import xpt.Common_qvto */ def PaletteConfiguration(GenEditorGenerator it) ''' <?xml version="1.0" encoding="ASCII"?> -«xmlGeneratedTag» +«xmlGeneratedTag» <paletteconfiguration:PaletteConfiguration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:paletteconfiguration="http://www.eclipse.org/papyrus/diagram/paletteconfiguration/0.8" xmlns:elementtypesconfigurations="http://www.eclipse.org/papyrus/infra/elementtypesconfigurations/1.2" - id="«plugin.ID».paletteconfiguration" - label="«plugin.name» Palette" - description="This is the palette of «plugin.name»"> - «FOR tool : diagram.palette.groups» - «addDrawerConfigurations(tool)» - «ENDFOR» + id="«plugin.ID».paletteconfiguration" + label="«plugin.name» Palette" + description="This is the palette of «plugin.name»"> + «FOR tool : diagram.palette.groups» + «addDrawerConfigurations(tool)» + «ENDFOR» </paletteconfiguration:PaletteConfiguration> ''' @@ -56,18 +56,18 @@ import xpt.Common_qvto */ def addDrawerConfigurations(ToolGroup it) ''' <drawerConfigurations - id=«IF isQuoted(id,'"')»«id»«ELSE»"«id»"«ENDIF» - label="«it.title»" - description="«description»"> - <icon pluginID="«retrieveBundleId(smallIconPath,palette.diagram.editorGen.plugin.ID)»" iconPath="«retrieveLocalPath(smallIconPath)»"/> - «FOR entry : entries» - «IF entry instanceof ToolEntry && isValidTool(entry as AbstractToolEntry)» - «addToolConfiguration(entry as ToolEntry)» - «ENDIF» - «IF entry instanceof ToolGroup» - «addStackConfiguration(entry as ToolGroup)» - «ENDIF» - «ENDFOR» + id=«IF isQuoted(id,'"')»«id»«ELSE»"«id»"«ENDIF» + label="«it.title»" + description="«description»"> + <icon pluginID="«retrieveBundleId(smallIconPath,palette.diagram.editorGen.plugin.ID)»" iconPath="«retrieveLocalPath(smallIconPath)»"/> + «FOR entry : entries» + «IF entry instanceof ToolEntry && isValidTool(entry as AbstractToolEntry)» + «addToolConfiguration(entry as ToolEntry)» + «ENDIF» + «IF entry instanceof ToolGroup» + «addStackConfiguration(entry as ToolGroup)» + «ENDIF» + «ENDFOR» </drawerConfigurations> ''' @@ -76,28 +76,28 @@ import xpt.Common_qvto */ def addToolConfiguration(ToolEntry it) ''' <ownedConfigurations xsi:type="paletteconfiguration:ToolConfiguration" - id=«IF isQuoted(id,'"')»«id»«ELSE»"«id»"«ENDIF» - label="«title»" - «IF null!=qualifiedToolName && !qualifiedToolName.empty» - toolClassName="«qualifiedToolName»" - «ENDIF» - description="«description»"«IF genNodes.empty && !genLinks.empty» kind="ConnectionTool"«ENDIF»> - <icon pluginID="«retrieveBundleId(smallIconPath,group.palette.diagram.editorGen.plugin.ID)»" iconPath="«retrieveLocalPath(smallIconPath)»"/> - «IF elements.empty && (null==qualifiedToolName || qualifiedToolName.empty)» - «ERROR('No elements for tool generation (Palette):'+title)» - «ENDIF» - «FOR e : elements» - «val href = getElementTypeConfHRef(e.elementType.uniqueIdentifier,eResource as XMLResource)» - «IF null!=href && !href.empty» + id=«IF isQuoted(id,'"')»«id»«ELSE»"«id»"«ENDIF» + label="«title»" + «IF null!=qualifiedToolName && !qualifiedToolName.empty» + toolClassName="«qualifiedToolName»" + «ENDIF» + description="«description»"«IF genNodes.empty && !genLinks.empty» kind="ConnectionTool"«ENDIF»> + <icon pluginID="«retrieveBundleId(smallIconPath,group.palette.diagram.editorGen.plugin.ID)»" iconPath="«retrieveLocalPath(smallIconPath)»"/> + «IF elements.empty && (null==qualifiedToolName || qualifiedToolName.empty)» + «ERROR('No elements for tool generation (Palette):'+title)» + «ENDIF» + «FOR e : elements» + «val href = getElementTypeConfHRef(e.elementType.uniqueIdentifier,eResource as XMLResource)» + «IF null!=href && !href.empty» <elementDescriptors> <elementType - xsi:type="«getConfigurationXsiType(e.elementType.uniqueIdentifier,eResource as XMLResource)»" - href="«href»"/> + xsi:type="«getConfigurationXsiType(e.elementType.uniqueIdentifier,eResource as XMLResource)»" + href="«href»"/> </elementDescriptors> - «ELSEIF null==qualifiedToolName || qualifiedToolName.empty» - «ERROR('No element type configuration or classToolName for tool generation (Palette):' + title)» - «ENDIF» - «ENDFOR» + «ELSEIF null==qualifiedToolName || qualifiedToolName.empty» + «ERROR('No element type configuration or classToolName for tool generation (Palette):' + title)» + «ENDIF» + «ENDFOR» </ownedConfigurations> ''' @@ -105,12 +105,12 @@ import xpt.Common_qvto * Add stack configuration. */ def addStackConfiguration(ToolGroup it) ''' -<ownedConfigurations xsi:type="paletteconfiguration:StackConfiguration" id=«IF isQuoted(id,'"')»«id»«ELSE»"«id»"«ENDIF» label="«title»"> - «FOR entry : entries» - «IF entry instanceof ToolEntry && isValidTool(entry as AbstractToolEntry)» - «addToolConfiguration(entry as ToolEntry)» - «ENDIF» - «ENDFOR» +<ownedConfigurations xsi:type="paletteconfiguration:StackConfiguration" id=«IF isQuoted(id,'"')»«id»«ELSE»"«id»"«ENDIF» label="«title»"> + «FOR entry : entries» + «IF entry instanceof ToolEntry && isValidTool(entry as AbstractToolEntry)» + «addToolConfiguration(entry as ToolEntry)» + «ENDIF» + «ENDFOR» </ownedConfigurations> ''' } diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/palette/PaletteFactory.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/palette/PaletteFactory.xtend index dbeb9035806..9b4519cc609 100644 --- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/palette/PaletteFactory.xtend +++ b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/palette/PaletteFactory.xtend @@ -33,59 +33,59 @@ import xpt.providers.ElementTypes override PaletteFactory(Palette it) ''' - «copyright(diagram.editorGen)» - package «packageName»; + «copyright(diagram.editorGen)» + package «packageName»; - «generatedClassComment» - public class «factoryClassName» extends org.eclipse.gmf.runtime.diagram.ui.services.palette.PaletteFactory.Adapter { + «generatedClassComment» + public class «factoryClassName» extends org.eclipse.gmf.runtime.diagram.ui.services.palette.PaletteFactory.Adapter { //RS: New Palette generation //Generates the ID for the tool elements //Generate the tool factory (if(ID) createtool...) - «FOR tool : collectTools(it)» - «generateIDAttribute(tool)» - «ENDFOR» + «FOR tool : collectTools(it)» + «generateIDAttribute(tool)» + «ENDFOR» - «««Generates the default constructor - «generatedMemberComment» - public «factoryClassName»() { + «««Generates the default constructor + «generatedMemberComment» + public «factoryClassName»() { } - «««Generates the main method to create tool - «generateCreateTool(it)» + «««Generates the main method to create tool + «generateCreateTool(it)» - «««Generates the main method to create template - «generateGetTemplate(it)» + «««Generates the main method to create template + «generateGetTemplate(it)» - «««Generates each method for tool creation + «««Generates each method for tool creation - «FOR tool : collectTools(it)» - «createTool(tool)» - «ENDFOR» + «FOR tool : collectTools(it)» + «createTool(tool)» + «ENDFOR» } ''' def generateCreateTool(Palette it) ''' - «generatedMemberComment» + «generatedMemberComment» public org.eclipse.gef.Tool createTool(String toolId) { - «FOR tool : collectTools(it)» - «checkToolID(tool)» - «ENDFOR» + «FOR tool : collectTools(it)» + «checkToolID(tool)» + «ENDFOR» // default return: null return null; } ''' def checkToolID(AbstractToolEntry it) ''' - if (toolId.equals(«getConstantIDName(id)»)) { - return «createMethodName»(); + if (toolId.equals(«getConstantIDName(id)»)) { + return «createMethodName»(); } ''' def generateGetTemplate(Palette it) ''' - «generatedMemberComment» + «generatedMemberComment» public Object getTemplate(String templateId) { // default return: null @@ -94,29 +94,29 @@ import xpt.providers.ElementTypes ''' def generateIDAttribute(AbstractToolEntry it) ''' - «generatedMemberComment» - private final static String «getConstantIDName(id)» = «id»;«IF isQuoted(id,'"')»«nonNLS»«ENDIF» + «generatedMemberComment» + private final static String «getConstantIDName(id)» = «id»;«IF isQuoted(id,'"')»«nonNLS»«ENDIF» ''' def createTool(AbstractToolEntry it) ''' - «generatedMemberComment» - private org.eclipse.gef.Tool «createMethodName»() { - «newTool(it as ToolEntry, 'entry')» + «generatedMemberComment» + private org.eclipse.gef.Tool «createMethodName»() { + «newTool(it as ToolEntry, 'entry')» } ''' def newTool(ToolEntry it, String toolVarName) ''' - «IF elements.isEmpty()» - «ERROR('no elements for tool generation (Palette)')» - «ELSE» - java.util.List<org.eclipse.gmf.runtime.emf.type.core.IElementType> types = new java.util.ArrayList<org.eclipse.gmf.runtime.emf.type.core.IElementType>(«elements.size»); - «FOR e : elements» - types.add(«xptElementTypes.accessElementType(e)»); - «ENDFOR» - ««« RS: modified tool creation to have stereotypes-aware tools - org.eclipse.gef.Tool tool = new org.eclipse.papyrus.uml.diagram.common.service.«IF it.genNodes.isEmpty()»AspectUnspecifiedTypeConnectionTool«ELSE»AspectUnspecifiedTypeCreationTool«ENDIF»(types); + «IF elements.isEmpty()» + «ERROR('no elements for tool generation (Palette)')» + «ELSE» + java.util.List<org.eclipse.gmf.runtime.emf.type.core.IElementType> types = new java.util.ArrayList<org.eclipse.gmf.runtime.emf.type.core.IElementType>(«elements.size»); + «FOR e : elements» + types.add(«xptElementTypes.accessElementType(e)»); + «ENDFOR» + ««« RS: modified tool creation to have stereotypes-aware tools + org.eclipse.gef.Tool tool = new org.eclipse.papyrus.uml.diagram.common.service.«IF it.genNodes.isEmpty()»AspectUnspecifiedTypeConnectionTool«ELSE»AspectUnspecifiedTypeCreationTool«ENDIF»(types); return tool; - «ENDIF» + «ENDIF» ''' } diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/expressions/AbstractExpression.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/expressions/AbstractExpression.xtend index 5a167987224..4f3de91d99a 100644 --- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/expressions/AbstractExpression.xtend +++ b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/expressions/AbstractExpression.xtend @@ -24,8 +24,8 @@ import com.google.inject.Singleton @Inject extension Common override performCast(GenDiagram it) ''' - «generatedMemberComment( - 'Expression may return number value which is not directly compatible with feature type (e.g. Double when Integer is expected), or EEnumLiteral meta-object when literal instance is expected')» + «generatedMemberComment( + 'Expression may return number value which is not directly compatible with feature type (e.g. Double when Integer is expected), or EEnumLiteral meta-object when literal instance is expected')» public static Object performCast(Object value, org.eclipse.emf.ecore.EDataType targetType) { if (targetType instanceof org.eclipse.emf.ecore.EEnum) { if (value instanceof org.eclipse.emf.ecore.EEnumLiteral) { diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/AbstractNavigatorItem.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/AbstractNavigatorItem.xtend index e2552c5a2b4..5c0b2512f4b 100644 --- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/AbstractNavigatorItem.xtend +++ b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/AbstractNavigatorItem.xtend @@ -25,33 +25,33 @@ import xpt.Common
import xpt.CodeStyle @Inject extension CodeStyle override def registerAdapterFactory(GenNavigator it) ''' - «generatedMemberComment()» + «generatedMemberComment()» static { @SuppressWarnings("rawtypes") final Class[] supportedTypes = new Class[] { org.eclipse.ui.views.properties.tabbed.ITabbedPropertySheetPageContributor.class }; final org.eclipse.ui.views.properties.tabbed.ITabbedPropertySheetPageContributor propertySheetPageContributor = new org.eclipse.ui.views.properties.tabbed.ITabbedPropertySheetPageContributor() { - «overrideI(it.editorGen.diagram)» + «overrideI(it.editorGen.diagram)» public String getContributorId() { - return "«editorGen.plugin.ID»"; «nonNLS(1)» + return "«editorGen.plugin.ID»"; «nonNLS(1)» } }; org.eclipse.core.runtime.Platform.getAdapterManager().registerAdapters(new org.eclipse.core.runtime.IAdapterFactory() { - «overrideI(it.editorGen.diagram)» + «overrideI(it.editorGen.diagram)» @SuppressWarnings("rawtypes") public Object getAdapter(Object adaptableObject, Class adapterType) { - if (adaptableObject instanceof «qualifiedClassName(it)» && adapterType == org.eclipse.ui.views.properties.tabbed.ITabbedPropertySheetPageContributor.class) { + if (adaptableObject instanceof «qualifiedClassName(it)» && adapterType == org.eclipse.ui.views.properties.tabbed.ITabbedPropertySheetPageContributor.class) { return propertySheetPageContributor; } return null; } - «overrideI(it.editorGen.diagram)» + «overrideI(it.editorGen.diagram)» @SuppressWarnings("rawtypes") public Class[] getAdapterList() { return supportedTypes; } - }, «qualifiedClassName(it)».class); + }, «qualifiedClassName(it)».class); } ''' diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/DomainNavigatorContentProvider.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/DomainNavigatorContentProvider.xtend index 1094034ddc1..990b00249a9 100644 --- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/DomainNavigatorContentProvider.xtend +++ b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/DomainNavigatorContentProvider.xtend @@ -29,12 +29,12 @@ import xpt.Common @Inject DomainNavigatorItem xptDomainNavigatorItem; override def wrapEObjects(GenNavigator it) ''' - «generatedMemberComment()» + «generatedMemberComment()» public Object[] wrapEObjects(Object[] objects, Object parentElement) { - java.util.Collection<«xptDomainNavigatorItem.qualifiedClassName(it)»> result = new java.util.ArrayList<«xptDomainNavigatorItem.qualifiedClassName(it)»>(); + java.util.Collection<«xptDomainNavigatorItem.qualifiedClassName(it)»> result = new java.util.ArrayList<«xptDomainNavigatorItem.qualifiedClassName(it)»>(); for (int i = 0; i < objects.length; i++) { if (objects[i] instanceof org.eclipse.emf.ecore.EObject) { - result.add(new «xptDomainNavigatorItem.qualifiedClassName(it)»((org.eclipse.emf.ecore.EObject) objects[i], parentElement, myAdapterFctoryContentProvier)); + result.add(new «xptDomainNavigatorItem.qualifiedClassName(it)»((org.eclipse.emf.ecore.EObject) objects[i], parentElement, myAdapterFctoryContentProvier)); } } return result.toArray(); diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/DomainNavigatorItem.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/DomainNavigatorItem.xtend index 5d0a58a6af8..4b02de08233 100644 --- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/DomainNavigatorItem.xtend +++ b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/DomainNavigatorItem.xtend @@ -25,17 +25,17 @@ import xpt.CodeStyle @Inject extension CodeStyle override def registerAdapterFactory(GenNavigator it) ''' - «generatedMemberComment()» + «generatedMemberComment()» static { @SuppressWarnings("rawtypes") final Class[] supportedTypes = new Class[] { org.eclipse.emf.ecore.EObject.class, org.eclipse.ui.views.properties.IPropertySource.class }; org.eclipse.core.runtime.Platform.getAdapterManager().registerAdapters(new org.eclipse.core.runtime.IAdapterFactory() { - «overrideI(it.editorGen.diagram)» + «overrideI(it.editorGen.diagram)» @SuppressWarnings("rawtypes") public Object getAdapter(Object adaptableObject, Class adapterType) { - if (adaptableObject instanceof «qualifiedClassName(it)») { - «qualifiedClassName(it)» domainNavigatorItem = («qualifiedClassName(it)») adaptableObject; + if (adaptableObject instanceof «qualifiedClassName(it)») { + «qualifiedClassName(it)» domainNavigatorItem = («qualifiedClassName(it)») adaptableObject; org.eclipse.emf.ecore.EObject eObject = domainNavigatorItem.getEObject(); if (adapterType == org.eclipse.emf.ecore.EObject.class) { return eObject; @@ -48,12 +48,12 @@ import xpt.CodeStyle return null; } - «overrideI(it.editorGen.diagram)» + «overrideI(it.editorGen.diagram)» @SuppressWarnings("rawtypes") public Class[] getAdapterList() { return supportedTypes; } - }, «qualifiedClassName(it)».class); + }, «qualifiedClassName(it)».class); } ''' diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/NavigatorContentProvider.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/NavigatorContentProvider.xtend index af0b1738a60..f8b38e87a40 100644 --- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/NavigatorContentProvider.xtend +++ b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/NavigatorContentProvider.xtend @@ -39,29 +39,29 @@ import xpt.navigator.Utils_qvto override NavigatorContentProvider(GenNavigator it) ''' - «copyright(editorGen)» - package «packageName(it)»; + «copyright(editorGen)» + package «packageName(it)»; - «generatedClassComment()» - public class «className(it)» implements org.eclipse.ui.navigator.ICommonContentProvider { + «generatedClassComment()» + public class «className(it)» implements org.eclipse.ui.navigator.ICommonContentProvider { - «attributes(it)» + «attributes(it)» - «constructor(it)» + «constructor(it)» - «genAllMethodNodeCase» + «genAllMethodNodeCase» - «iContentProvider(it)» + «iContentProvider(it)» - «iStructuredContentProvider(it)» + «iStructuredContentProvider(it)» - «iMementoAware(it)» + «iMementoAware(it)» - «iCommonContentProvider(it)» + «iCommonContentProvider(it)» - «iTreeContentProvider(it)» + «iTreeContentProvider(it)» - «additions(it)» + «additions(it)» } ''' @@ -79,12 +79,12 @@ import xpt.navigator.Utils_qvto ''' override def initCommonAttributes(GenNavigator it) ''' - org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain = «createEditingDomain(it)»; + org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain = «createEditingDomain(it)»; myEditingDomain = (org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain) editingDomain; @SuppressWarnings("serial") java.util.Map<org.eclipse.emf.ecore.resource.Resource, java.lang.Boolean> map = new java.util.HashMap<org.eclipse.emf.ecore.resource.Resource, java.lang.Boolean>() { - «overrideI(it.editorGen.diagram)» + «overrideI(it.editorGen.diagram)» public java.lang.Boolean get(java.lang.Object key) { if (!containsKey(key)) { if (key instanceof org.eclipse.emf.ecore.resource.Resource) { @@ -97,7 +97,7 @@ import xpt.navigator.Utils_qvto myEditingDomain.setResourceToReadOnlyMap(map); myViewerRefreshRunnable = new Runnable() { - «overrideI(it.editorGen.diagram)» + «overrideI(it.editorGen.diagram)» public void run() { if (myViewer != null) { myViewer.refresh(); @@ -106,36 +106,36 @@ import xpt.navigator.Utils_qvto }; myWorkspaceSynchronizer = new org.eclipse.emf.workspace.util.WorkspaceSynchronizer(editingDomain, new org.eclipse.emf.workspace.util.WorkspaceSynchronizer.Delegate() { - «overrideC(it.editorGen.diagram)» + «overrideC(it.editorGen.diagram)» public void dispose() { } - «overrideC(it.editorGen.diagram)» + «overrideC(it.editorGen.diagram)» public boolean handleResourceChanged(final org.eclipse.emf.ecore.resource.Resource resource) { - «processChanges(it)» + «processChanges(it)» } - «overrideC(it.editorGen.diagram)» + «overrideC(it.editorGen.diagram)» public boolean handleResourceDeleted(org.eclipse.emf.ecore.resource.Resource resource) { - «processChanges(it)» + «processChanges(it)» } - «overrideC(it.editorGen.diagram)» + «overrideC(it.editorGen.diagram)» public boolean handleResourceMoved(org.eclipse.emf.ecore.resource.Resource resource, final org.eclipse.emf.common.util.URI newURI) { - «processChanges(it)» + «processChanges(it)» } }); ''' override def constructor(GenNavigator it) ''' - «generatedMemberComment()» - public «className(it)»() { - «initCommonAttributes(it)» + «generatedMemberComment()» + public «className(it)»() { + «initCommonAttributes(it)» } ''' override dispose(GenNavigator it) ''' - «generatedMemberComment()» + «generatedMemberComment()» public void dispose() { myWorkspaceSynchronizer.dispose(); myWorkspaceSynchronizer = null; @@ -154,41 +154,41 @@ import xpt.navigator.Utils_qvto override getFileChildren(GenNavigator it) ''' - «var references = getChildReferencesFrom(it, null)» - «getFileResource(it)» + «var references = getChildReferencesFrom(it, null)» + «getFileResource(it)» java.util.Collection<Object> result = new java.util.ArrayList<Object>(); - «FOR groupName : getGroupNames(references)» - «initGroupVariables(groupName, it, references, 'file', null)» - «ENDFOR» + «FOR groupName : getGroupNames(references)» + «initGroupVariables(groupName, it, references, 'file', null)» + «ENDFOR» java.util.List<org.eclipse.gmf.runtime.notation.View> topViews = new java.util.ArrayList<org.eclipse.gmf.runtime.notation.View>(resource.getContents().size()); for (org.eclipse.emf.ecore.EObject o : resource.getContents()) { if (o instanceof org.eclipse.gmf.runtime.notation.View) { topViews.add((org.eclipse.gmf.runtime.notation.View) o); } } - «FOR ref : references» - «addNavigatorItemsPrefix(ref)»selectViewsByType(resource.getContents(), «getChildViewType(ref.child)»)«addNavigatorItemsSuffix(ref, 'file', false)» - «ENDFOR» - «FOR groupName : getGroupNames(references)» - «addGroups(groupName, references)» - «ENDFOR» + «FOR ref : references» + «addNavigatorItemsPrefix(ref)»selectViewsByType(resource.getContents(), «getChildViewType(ref.child)»)«addNavigatorItemsSuffix(ref, 'file', false)» + «ENDFOR» + «FOR groupName : getGroupNames(references)» + «addGroups(groupName, references)» + «ENDFOR» return result.toArray(); ''' override getViewChildren(GenNavigator it) ''' - «generatedMemberComment()» + «generatedMemberComment()» private Object[] getViewChildren(org.eclipse.gmf.runtime.notation.View view, Object parentElement) { - String vid = «xptVisualIDRegistry.getVisualIDMethodCall(it.editorGen.diagram)»(view); + String vid = «xptVisualIDRegistry.getVisualIDMethodCall(it.editorGen.diagram)»(view); if (vid != null) { switch (vid) { - ««« BEGIN: PapyrusGenCode - ««« Restructuration of the case - «FOR node : getNavigatorContainerNodes(it)» - «caseNavigatorNode(node, it)» - «ENDFOR» - «««BEGIN: PapyrusGenCode + ««« BEGIN: PapyrusGenCode + ««« Restructuration of the case + «FOR node : getNavigatorContainerNodes(it)» + «caseNavigatorNode(node, it)» + «ENDFOR» + «««BEGIN: PapyrusGenCode } } return EMPTY_ARRAY; @@ -196,8 +196,8 @@ import xpt.navigator.Utils_qvto ''' override utilityMethods(GenNavigator it) ''' - «IF getNavigatorContainerNodes(it).notEmpty» - «generatedMemberComment» + «IF getNavigatorContainerNodes(it).notEmpty» + «generatedMemberComment» private java.util.Collection getLinksSourceByType(java.util.Collection edges, String type) { java.util.Collection result = new java.util.ArrayList(); for (java.util.Iterator it = edges.iterator(); it.hasNext();) { @@ -210,7 +210,7 @@ import xpt.navigator.Utils_qvto return result; } - «generatedMemberComment» + «generatedMemberComment» private java.util.Collection getLinksTargetByType(java.util.Collection edges, String type) { java.util.Collection result = new java.util.ArrayList(); for (java.util.Iterator it = edges.iterator(); it.hasNext();) { @@ -222,7 +222,7 @@ import xpt.navigator.Utils_qvto } return result; } - «generatedMemberComment» + «generatedMemberComment» private java.util.Collection getOutgoingLinksByType(java.util.Collection nodes, String type) { java.util.Collection result = new java.util.ArrayList(); for (java.util.Iterator it = nodes.iterator(); it.hasNext();) { @@ -232,7 +232,7 @@ import xpt.navigator.Utils_qvto return result; } - «generatedMemberComment» + «generatedMemberComment» private java.util.Collection getIncomingLinksByType(java.util.Collection nodes, String type) { java.util.Collection result = new java.util.ArrayList(); for (java.util.Iterator it = nodes.iterator(); it.hasNext();) { @@ -241,8 +241,8 @@ import xpt.navigator.Utils_qvto } return result; } -««« - «generatedMemberComment» +««« + «generatedMemberComment» private java.util.Collection getChildrenByType(java.util.Collection nodes, String type) { java.util.Collection result = new java.util.ArrayList(); for (java.util.Iterator it = nodes.iterator(); it.hasNext();) { @@ -252,7 +252,7 @@ import xpt.navigator.Utils_qvto return result; } - «generatedMemberComment» + «generatedMemberComment» private java.util.Collection getDiagramLinksByType(java.util.Collection diagrams, String type) { java.util.Collection result = new java.util.ArrayList(); for (java.util.Iterator it = diagrams.iterator(); it.hasNext();) { @@ -261,7 +261,7 @@ import xpt.navigator.Utils_qvto } return result; } - «generatedMemberComment» + «generatedMemberComment» private java.util.Collection selectViewsByType(java.util.Collection views, String type) { java.util.Collection result = new java.util.ArrayList(); for (java.util.Iterator it = views.iterator(); it.hasNext();) { @@ -273,53 +273,53 @@ import xpt.navigator.Utils_qvto return result; } - «generatedMemberComment» + «generatedMemberComment» private java.util.Collection createNavigatorItems(java.util.Collection views, Object parent, boolean isLeafs) { java.util.Collection result = new java.util.ArrayList(); for (java.util.Iterator it = views.iterator(); it.hasNext();) { - result.add(new «getNavigatorItemQualifiedClassName()»((org.eclipse.gmf.runtime.notation.View) it.next(), parent, isLeafs)); + result.add(new «getNavigatorItemQualifiedClassName()»((org.eclipse.gmf.runtime.notation.View) it.next(), parent, isLeafs)); } return result; } - «ENDIF» + «ENDIF» - «generatedMemberComment()» + «generatedMemberComment()» private boolean isOwnView(org.eclipse.gmf.runtime.notation.View view) { - return «VisualIDRegistry::modelID(editorGen.diagram)».equals(«xptVisualIDRegistry. - getModelIDMethodCall(editorGen.diagram)»(view)); + return «VisualIDRegistry::modelID(editorGen.diagram)».equals(«xptVisualIDRegistry. + getModelIDMethodCall(editorGen.diagram)»(view)); } - «getForeignShortcuts(it)» + «getForeignShortcuts(it)» ''' override getForeignShortcuts(GenNavigator it) ''' - «IF editorGen.diagram.generateCreateShortcutAction() && getChildReferencesFrom(it, editorGen.diagram).notEmpty» + «IF editorGen.diagram.generateCreateShortcutAction() && getChildReferencesFrom(it, editorGen.diagram).notEmpty» - «generatedMemberComment()» + «generatedMemberComment()» private java.util.Collection getForeignShortcuts(org.eclipse.gmf.runtime.notation.Diagram diagram, Object parent) { java.util.Collection result = new java.util.ArrayList(); for (java.util.Iterator it = diagram.getChildren().iterator(); it.hasNext();) { org.eclipse.gmf.runtime.notation.View nextView = (org.eclipse.gmf.runtime.notation.View) it.next(); - if (!isOwnView(nextView) && nextView.getEAnnotation("Shortcut") != null) { «nonNLS» + if (!isOwnView(nextView) && nextView.getEAnnotation("Shortcut") != null) { «nonNLS» result.add(nextView); } } return createNavigatorItems(result, parent, false); } - «ENDIF» + «ENDIF» ''' override caseNavigatorNode(GenCommonBase it, GenNavigator navigator) ''' - case «VisualIDRegistry::visualID(it)»: { - «««BEGIN: PapyrusGenCode - ««« this code has been modified to call directly submethods + case «VisualIDRegistry::visualID(it)»: { + «««BEGIN: PapyrusGenCode + ««« this code has been modified to call directly submethods //modification of the template to avoid mistake of 65kb. - return getViewChildrenFor«it.editPartClassName»(view, parentElement); - «««END: PapyrusGenCode + return getViewChildrenFor«it.editPartClassName»(view, parentElement); + «««END: PapyrusGenCode } ''' @@ -328,9 +328,9 @@ import xpt.navigator.Utils_qvto //BEGIN: PapyrusGenCode //Loop to call generator of each method def genAllMethodNodeCase(GenNavigator it)''' -«FOR container :getNavigatorContainerNodes(it)» -« caseMethodNodeNode(container,it) » -«ENDFOR» +«FOR container :getNavigatorContainerNodes(it)» +« caseMethodNodeNode(container,it) » +«ENDFOR» ''' //END: PapyrusGenCode @@ -344,41 +344,41 @@ def caseMethodNodeNode(GenCommonBase it, GenNavigator navigator) ''' *this method is a modification of gmf code in order to avoid getViewChidreen() method becoming greater than 64kb. *@generated **/ -private Object[] getViewChildrenFor«it.editPartClassName»(org.eclipse.gmf.runtime.notation.View view, Object parentElement){ +private Object[] getViewChildrenFor«it.editPartClassName»(org.eclipse.gmf.runtime.notation.View view, Object parentElement){ java.util.Collection result = new java.util.ArrayList(); - «addForeignShortcuts(it)» - «var _references = getChildReferencesFrom(navigator, it)» - «FOR groupNames : getGroupNames(_references)» - «initGroupVariables(groupNames,navigator, _references, 'parentElement', it)» - «ENDFOR» + «addForeignShortcuts(it)» + «var _references = getChildReferencesFrom(navigator, it)» + «FOR groupNames : getGroupNames(_references)» + «initGroupVariables(groupNames,navigator, _references, 'parentElement', it)» + «ENDFOR» - «IF ! _references.empty» - «FOR referencesIterator : 1.._references.size» - «var reference = _references.get(referencesIterator-1)» - «IF ! reference.findConnectionPaths.empty» - «FOR pathsIterator : 1..reference.findConnectionPaths.size» - «var path = reference.findConnectionPaths.get(pathsIterator-1)» - «IF ! path.segments.empty» - «FOR segmentsIterator : 1..path.segments.size» - «var segment = path.segments.get(segmentsIterator-1)» - «IF referencesIterator==1 && pathsIterator==1 && segmentsIterator==1»java.util.Collection «ENDIF» - connectedViews = «childrenMethodName(segment.from,reference.referenceType, segment) » - («IF segmentsIterator==1»java.util.Collections.singleton(view)«ELSE»connectedViews«ENDIF» - , «xptVisualIDRegistry.typeMethodCall(segment.to)»); + «IF ! _references.empty» + «FOR referencesIterator : 1.._references.size» + «var reference = _references.get(referencesIterator-1)» + «IF ! reference.findConnectionPaths.empty» + «FOR pathsIterator : 1..reference.findConnectionPaths.size» + «var path = reference.findConnectionPaths.get(pathsIterator-1)» + «IF ! path.segments.empty» + «FOR segmentsIterator : 1..path.segments.size» + «var segment = path.segments.get(segmentsIterator-1)» + «IF referencesIterator==1 && pathsIterator==1 && segmentsIterator==1»java.util.Collection «ENDIF» + connectedViews = «childrenMethodName(segment.from,reference.referenceType, segment) » + («IF segmentsIterator==1»java.util.Collections.singleton(view)«ELSE»connectedViews«ENDIF» + , «xptVisualIDRegistry.typeMethodCall(segment.to)»); - «ENDFOR» - «ENDIF» - «addNavigatorItemsPrefix(reference)»connectedViews«addNavigatorItemsSuffix(reference,'parentElement', reference.referenceType != GenNavigatorReferenceType.CHILDREN_LITERAL) » - «ENDFOR» - «ENDIF» - «ENDFOR» - «ENDIF» + «ENDFOR» + «ENDIF» + «addNavigatorItemsPrefix(reference)»connectedViews«addNavigatorItemsSuffix(reference,'parentElement', reference.referenceType != GenNavigatorReferenceType.CHILDREN_LITERAL) » + «ENDFOR» + «ENDIF» + «ENDFOR» + «ENDIF» - «FOR groupNames : getGroupNames(_references)» - « addGroups(groupNames,_references) » - «ENDFOR» + «FOR groupNames : getGroupNames(_references)» + « addGroups(groupNames,_references) » + «ENDFOR» return result.toArray(); diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/NavigatorGroup.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/NavigatorGroup.xtend index 7a84d976666..46b7f695418 100644 --- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/NavigatorGroup.xtend +++ b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/NavigatorGroup.xtend @@ -23,18 +23,18 @@ import xpt.Common @Inject extension Common; override def attributes(GenNavigator it) ''' - «generatedMemberComment()» + «generatedMemberComment()» private String myGroupName; - «generatedMemberComment()» + «generatedMemberComment()» private String myIcon; - «generatedMemberComment()» + «generatedMemberComment()» private java.util.Collection<java.lang.Object> myChildren = new java.util.LinkedList<java.lang.Object>(); ''' override def addChildren(GenNavigator it) ''' - «generatedMemberComment()» + «generatedMemberComment()» public void addChildren(java.util.Collection<java.lang.Object> children) { myChildren.addAll(children); } diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/NavigatorItem.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/NavigatorItem.xtend index 14166d9c2ce..8cd6e668268 100644 --- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/NavigatorItem.xtend +++ b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/NavigatorItem.xtend @@ -25,27 +25,27 @@ import xpt.Common
import xpt.CodeStyle @Inject extension CodeStyle override def registerAdapterFactory(GenNavigator it) ''' - «generatedMemberComment()» + «generatedMemberComment()» static { @SuppressWarnings("rawtypes") final Class[] supportedTypes = new Class[] { org.eclipse.gmf.runtime.notation.View.class, org.eclipse.emf.ecore.EObject.class }; org.eclipse.core.runtime.Platform.getAdapterManager().registerAdapters(new org.eclipse.core.runtime.IAdapterFactory() { - «overrideI(it.editorGen.diagram)» + «overrideI(it.editorGen.diagram)» @SuppressWarnings("rawtypes") public Object getAdapter(Object adaptableObject, Class adapterType) { - if (adaptableObject instanceof «qualifiedClassName(it)» && (adapterType == org.eclipse.gmf.runtime.notation.View.class || adapterType == org.eclipse.emf.ecore.EObject.class)) { - return ((«qualifiedClassName(it)») adaptableObject).getView(); + if (adaptableObject instanceof «qualifiedClassName(it)» && (adapterType == org.eclipse.gmf.runtime.notation.View.class || adapterType == org.eclipse.emf.ecore.EObject.class)) { + return ((«qualifiedClassName(it)») adaptableObject).getView(); } return null; } - «overrideI(it.editorGen.diagram)» + «overrideI(it.editorGen.diagram)» @SuppressWarnings("rawtypes") public Class[] getAdapterList() { return supportedTypes; } - }, «qualifiedClassName(it)».class); + }, «qualifiedClassName(it)».class); } ''' diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/NavigatorLabelProvider.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/NavigatorLabelProvider.xtend index 0e3679498e4..755e266235b 100644 --- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/NavigatorLabelProvider.xtend +++ b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/NavigatorLabelProvider.xtend @@ -36,30 +36,30 @@ import xpt.navigator.Utils_qvto @Inject ParserProvider xptParserProvider; @Inject MetaModel xptMetaModel; - override def getTextMethodName(GenCommonBase it) '''get«stringUniqueIdentifier»Text''' + override def getTextMethodName(GenCommonBase it) '''get«stringUniqueIdentifier»Text''' override def CharSequence getDiagramLabelText(GenCommonBase it, GenCommonBase elementTypeHolder, LabelModelFacet labelModelFacet) ''' - org.eclipse.gmf.runtime.common.ui.services.parser.IParser parser = «xptParserProvider.accessorCall(it, elementTypeHolder, labelModelFacet, 'view.getElement() != null ? view.getElement() : view')»; + org.eclipse.gmf.runtime.common.ui.services.parser.IParser parser = «xptParserProvider.accessorCall(it, elementTypeHolder, labelModelFacet, 'view.getElement() != null ? view.getElement() : view')»; if (parser != null) { return parser.getPrintString(new org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter(view.getElement() != null ? view.getElement() : view), org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions.NONE.intValue()); } else { - «xptActivator.qualifiedClassName(getDiagram().editorGen.plugin)».getInstance().logError("Parser was not found for label «stringVisualID»"); «nonNLS(1)» - «returnEmptyString()» + «xptActivator.qualifiedClassName(getDiagram().editorGen.plugin)».getInstance().logError("Parser was not found for label «stringVisualID»"); «nonNLS(1)» + «returnEmptyString()» } ''' override def getLabelFeatureText(GenCommonBase it, GenClass genClass) ''' - «IF null != genClass && null != genClass.labelFeature» - «xptMetaModel.DeclareAndAssign(genClass, 'domainModelElement', 'view.getElement()')» + «IF null != genClass && null != genClass.labelFeature» + «xptMetaModel.DeclareAndAssign(genClass, 'domainModelElement', 'view.getElement()')» if (domainModelElement != null) { - return «IF !isStringFeature(genClass.labelFeature)»String.valueOf(«ENDIF»UMLLabelInternationalization.getInstance().getLabel(domainModelElement)«IF !isStringFeature(genClass.labelFeature)»)«ENDIF»; + return «IF !isStringFeature(genClass.labelFeature)»String.valueOf(«ENDIF»UMLLabelInternationalization.getInstance().getLabel(domainModelElement)«IF !isStringFeature(genClass.labelFeature)»)«ENDIF»; } else { - «xptActivator.qualifiedClassName(getDiagram().editorGen.plugin)».getInstance().logError("No domain element for view with visualID = «stringVisualID»"); «nonNLS(1)» - «returnEmptyString()» + «xptActivator.qualifiedClassName(getDiagram().editorGen.plugin)».getInstance().logError("No domain element for view with visualID = «stringVisualID»"); «nonNLS(1)» + «returnEmptyString()» } - «ELSE» - «returnEmptyString()» - «ENDIF» + «ELSE» + «returnEmptyString()» + «ENDIF» ''' diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/NavigatorLinkHelper.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/NavigatorLinkHelper.xtend index 8f241b27be2..5639f6b033f 100644 --- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/NavigatorLinkHelper.xtend +++ b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/NavigatorLinkHelper.xtend @@ -27,19 +27,19 @@ import xpt.navigator.Utils_qvto override findSelection(GenNavigator it) ''' - «generatedMemberComment()» + «generatedMemberComment()» public org.eclipse.jface.viewers.IStructuredSelection findSelection(org.eclipse.ui.IEditorInput anInput) { - «IF getDiagramTopReference(it) !=null» - «defineDiagramDocument(editorGen.plugin)» - «ENDIF» - «findSelectionBody(it)» + «IF getDiagramTopReference(it) !=null» + «defineDiagramDocument(editorGen.plugin)» + «ENDIF» + «findSelectionBody(it)» } ''' override findSelectionBody(GenNavigator it) ''' - «IF getDiagramTopReference(it) !=null» - «getDiagramSelection(getDiagramTopReference(it))» - «ENDIF» + «IF getDiagramTopReference(it) !=null» + «getDiagramSelection(getDiagramTopReference(it))» + «ENDIF» return org.eclipse.jface.viewers.StructuredSelection.EMPTY; ''' } diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/NavigatorSorter.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/NavigatorSorter.xtend index 2da4f5259b4..bc41210c125 100644 --- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/NavigatorSorter.xtend +++ b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/NavigatorSorter.xtend @@ -28,16 +28,16 @@ import xpt.editor.VisualIDRegistry @Inject NavigatorItem xptNavigatorItem; override def category(GenNavigator it) ''' - «generatedMemberComment()» + «generatedMemberComment()» public int category(Object element) { - if (element instanceof «xptNavigatorItem.qualifiedClassName(it)») { - «xptNavigatorItem.qualifiedClassName(it)» item = («xptNavigatorItem.qualifiedClassName(it)») element; - «IF editorGen.diagram.generateCreateShortcutAction()» - if (item.getView().getEAnnotation("Shortcut") != null) { «nonNLS(1)» + if (element instanceof «xptNavigatorItem.qualifiedClassName(it)») { + «xptNavigatorItem.qualifiedClassName(it)» item = («xptNavigatorItem.qualifiedClassName(it)») element; + «IF editorGen.diagram.generateCreateShortcutAction()» + if (item.getView().getEAnnotation("Shortcut") != null) { «nonNLS(1)» return SHORTCUTS_CATEGORY; } - «ENDIF» - return «xptVisualIDRegistry.getVisualIDMethodCall(editorGen.diagram)»(item.getView()).hashCode(); + «ENDIF» + return «xptVisualIDRegistry.getVisualIDMethodCall(editorGen.diagram)»(item.getView()).hashCode(); } return GROUP_CATEGORY; } diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/plugin/ActivatorImpl.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/plugin/ActivatorImpl.xtend index 3f70044853b..bf6551bbeca 100644 --- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/plugin/ActivatorImpl.xtend +++ b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/plugin/ActivatorImpl.xtend @@ -34,109 +34,109 @@ import xpt.expressions.getExpression @Inject getExpression xptExpr; override ActivatorImpl(GenPlugin it)''' - «copyright(editorGen)» - package «xptActivator.packageName(it)»; + «copyright(editorGen)» + package «xptActivator.packageName(it)»; - «generatedClassComment» - public class «xptActivator.className(it)» extends org.eclipse.ui.plugin.AbstractUIPlugin { + «generatedClassComment» + public class «xptActivator.className(it)» extends org.eclipse.ui.plugin.AbstractUIPlugin { - «attrs(it)» - «constructor(it)» - «start(it)» - «stop(editorGen)» - «getInstance(it)» + «attrs(it)» + «constructor(it)» + «start(it)» + «stop(editorGen)» + «getInstance(it)» - «getPreferenceStore» - - «getItemProvidersAdaptorFactory(it)» - «getItemImageDescriptor(it)» - «getBundleDescriptorImage(it)» - «findImageDescriptor(it)» - «getBundleImage(it)» - «getString(it)» - «documentProviderGetter(editorGen.diagram)» - «linkConstraint(editorGen.diagram)» - «initializerGetter(editorGen.diagram)» - «initializerSetter(editorGen.diagram)» - «providersAccessMethods(it)» - «logError(it)» - «logInfo(it)» - «getLogError(it)» - «additions(it)» + «getPreferenceStore» + + «getItemProvidersAdaptorFactory(it)» + «getItemImageDescriptor(it)» + «getBundleDescriptorImage(it)» + «findImageDescriptor(it)» + «getBundleImage(it)» + «getString(it)» + «documentProviderGetter(editorGen.diagram)» + «linkConstraint(editorGen.diagram)» + «initializerGetter(editorGen.diagram)» + «initializerSetter(editorGen.diagram)» + «providersAccessMethods(it)» + «logError(it)» + «logInfo(it)» + «getLogError(it)» + «additions(it)» } ''' override attrs(GenPlugin it)''' - «generatedMemberComment» - public static final String ID = "«ID»"; //$NON-NLS-1$ + «generatedMemberComment» + public static final String ID = "«ID»"; //$NON-NLS-1$ - «generatedMemberComment» + «generatedMemberComment» private org.eclipse.papyrus.infra.core.log.LogHelper myLogHelper; - «generatedMemberComment» + «generatedMemberComment» public static final org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint DIAGRAM_PREFERENCES_HINT = new org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint(ID); - «generatedMemberComment» - private static «xptActivator.className(it)» instance; + «generatedMemberComment» + private static «xptActivator.className(it)» instance; - «generatedMemberComment» + «generatedMemberComment» private org.eclipse.emf.common.notify.AdapterFactory adapterFactory; - «generatedMemberComment» - private «xptDocProvider.qualifiedClassName(editorGen.diagram)» documentProvider; + «generatedMemberComment» + private «xptDocProvider.qualifiedClassName(editorGen.diagram)» documentProvider; - «IF editorGen.diagram.links.exists(l| !l.sansDomain)» - «generatedMemberComment» - private «editorGen.diagram.getLinkCreationConstraintsQualifiedClassName()» linkConstraints; - «ENDIF» + «IF editorGen.diagram.links.exists(l| !l.sansDomain)» + «generatedMemberComment» + private «editorGen.diagram.getLinkCreationConstraintsQualifiedClassName()» linkConstraints; + «ENDIF» - «generatedMemberComment» - private «xptElementInitializers.qualifiedClassName(editorGen.diagram)» initializers; + «generatedMemberComment» + private «xptElementInitializers.qualifiedClassName(editorGen.diagram)» initializers; - «IF it.editorGen.expressionProviders != null» - «FOR p : it.editorGen.expressionProviders.providers.filter(typeof(GenExpressionInterpreter))» - «generatedMemberComment» - private «xptExpr.getExpressionInterpriterQualifiedClassName(p)» «p.language»Factory; - «ENDFOR» - «ENDIF» + «IF it.editorGen.expressionProviders != null» + «FOR p : it.editorGen.expressionProviders.providers.filter(typeof(GenExpressionInterpreter))» + «generatedMemberComment» + private «xptExpr.getExpressionInterpriterQualifiedClassName(p)» «p.language»Factory; + «ENDFOR» + «ENDIF» ''' override start(GenPlugin it)''' - «generatedMemberComment» + «generatedMemberComment» public void start(org.osgi.framework.BundleContext context) throws Exception { super.start(context); instance = this; myLogHelper = new org.eclipse.papyrus.infra.core.log.LogHelper(this); org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint.registerPreferenceStore(DIAGRAM_PREFERENCES_HINT, getPreferenceStore()); adapterFactory = org.eclipse.papyrus.infra.gmfdiag.common.Activator.getInstance().getItemProvidersAdapterFactory(); - «it.editorGen.diagram.preferencesPackageName».DiagramPreferenceInitializer diagramPreferenceInitializer = new «it.editorGen.diagram.preferencesPackageName».DiagramPreferenceInitializer(); + «it.editorGen.diagram.preferencesPackageName».DiagramPreferenceInitializer diagramPreferenceInitializer = new «it.editorGen.diagram.preferencesPackageName».DiagramPreferenceInitializer(); diagramPreferenceInitializer.initializeDefaultPreferences(); } ''' override stop(GenEditorGenerator it)''' - «generatedMemberComment» + «generatedMemberComment» public void stop(org.osgi.framework.BundleContext context) throws Exception { adapterFactory = null; - «IF diagram.links.exists(l| !l.sansDomain)» + «IF diagram.links.exists(l| !l.sansDomain)» linkConstraints = null; - «ENDIF» + «ENDIF» initializers = null; - «IF expressionProviders != null» - «FOR p : expressionProviders.providers.filter(typeof(GenExpressionInterpreter))» - «p.language»Factory = null; - «ENDFOR» - «ENDIF» + «IF expressionProviders != null» + «FOR p : expressionProviders.providers.filter(typeof(GenExpressionInterpreter))» + «p.language»Factory = null; + «ENDFOR» + «ENDIF» instance = null; super.stop(context); } ''' def getPreferenceStore()''' - «generatedMemberComment» + «generatedMemberComment» public org.eclipse.jface.preference.IPreferenceStore getPreferenceStore() { org.eclipse.jface.preference.IPreferenceStore store=org.eclipse.papyrus.infra.gmfdiag.preferences.Activator.getDefault().getPreferenceStore(); return store; @@ -145,31 +145,31 @@ def getPreferenceStore()''' ''' override logError(GenPlugin it) ''' - «generatedMemberComment» + «generatedMemberComment» public void logError(String error) { getLogHelper().warn(error); } - «generatedMemberComment» + «generatedMemberComment» public void logError(String error, Throwable throwable) { getLogHelper().error(error, throwable); } ''' override logInfo(GenPlugin it) ''' - «generatedMemberComment» + «generatedMemberComment» public void logInfo(String message) { getLogHelper().info(message); } - «generatedMemberComment» + «generatedMemberComment» public void logInfo(String message, Throwable throwable) { getLogHelper().error(message, throwable); } ''' override getLogError(GenPlugin it) ''' - «generatedMemberComment» + «generatedMemberComment» public org.eclipse.papyrus.infra.core.log.LogHelper getLogHelper() { return myLogHelper; } diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/plugin/manifest.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/plugin/manifest.xtend index eb04c9d9b6f..f958edffe63 100644 --- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/plugin/manifest.xtend +++ b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/plugin/manifest.xtend @@ -30,15 +30,15 @@ import xpt.Common override requireBundle(GenPlugin it)''' Require-Bundle: org.eclipse.core.runtime, -«IF editorGen.application == null» org.eclipse.core.resources, -«ENDIF» -«IF editorGen.diagram.generateShortcutIcon() || (editorGen.navigator != null && editorGen.navigator.generateDomainModelNavigator)» org.eclipse.core.expressions, -«ENDIF» org.eclipse.jface, -«IF editorGen.application == null» org.eclipse.ui.ide, -«ENDIF» org.eclipse.ui.views, -«IF editorGen.navigator != null» org.eclipse.ui.navigator, +«IF editorGen.application == null» org.eclipse.core.resources, +«ENDIF» +«IF editorGen.diagram.generateShortcutIcon() || (editorGen.navigator != null && editorGen.navigator.generateDomainModelNavigator)» org.eclipse.core.expressions, +«ENDIF» org.eclipse.jface, +«IF editorGen.application == null» org.eclipse.ui.ide, +«ENDIF» org.eclipse.ui.views, +«IF editorGen.navigator != null» org.eclipse.ui.navigator, org.eclipse.ui.navigator.resources, -«ENDIF» org.eclipse.emf.ecore, +«ENDIF» org.eclipse.emf.ecore, org.eclipse.emf.ecore.xmi, org.eclipse.emf.edit.ui, org.eclipse.gmf.runtime.emf.core, @@ -51,29 +51,29 @@ Require-Bundle: org.eclipse.core.runtime, org.eclipse.papyrus.infra.widgets, org.eclipse.papyrus.infra.ui, org.eclipse.papyrus.infra.core.sashwindows.di, -«IF printingEnabled» org.eclipse.gmf.runtime.diagram.ui.printing, +«IF printingEnabled» org.eclipse.gmf.runtime.diagram.ui.printing, org.eclipse.gmf.runtime.diagram.ui.printing.render, -«ENDIF» -«IF editorGen.propertySheet != null» org.eclipse.gmf.runtime.diagram.ui.properties, -«ENDIF» org.eclipse.gmf.runtime.diagram.ui.providers, -«IF editorGen.application == null» org.eclipse.gmf.runtime.diagram.ui.providers.ide, -«ENDIF» org.eclipse.gmf.runtime.diagram.ui.render, +«ENDIF» +«IF editorGen.propertySheet != null» org.eclipse.gmf.runtime.diagram.ui.properties, +«ENDIF» org.eclipse.gmf.runtime.diagram.ui.providers, +«IF editorGen.application == null» org.eclipse.gmf.runtime.diagram.ui.providers.ide, +«ENDIF» org.eclipse.gmf.runtime.diagram.ui.render, org.eclipse.gmf.runtime.diagram.ui.resources.editor, -«IF editorGen.application == null» org.eclipse.gmf.runtime.diagram.ui.resources.editor.ide, -«ENDIF» -«var reqPlugins = getAllRequiredPlugins()» -«IF !reqPlugins.contains('org.eclipse.papyrus.infra.gmfdiag.tooling.runtime')» -«var notUsetBooleanVar = reqPlugins.add('org.eclipse.papyrus.infra.gmfdiag.tooling.runtime')» -«ENDIF» -«FOR reqId : reqPlugins» «reqId»;visibility:=reexport,«extraLineBreak» -«ENDFOR» org.eclipse.gef, +«IF editorGen.application == null» org.eclipse.gmf.runtime.diagram.ui.resources.editor.ide, +«ENDIF» +«var reqPlugins = getAllRequiredPlugins()» +«IF !reqPlugins.contains('org.eclipse.papyrus.infra.gmfdiag.tooling.runtime')» +«var notUsetBooleanVar = reqPlugins.add('org.eclipse.papyrus.infra.gmfdiag.tooling.runtime')» +«ENDIF» +«FOR reqId : reqPlugins» «reqId»;visibility:=reexport,«extraLineBreak» +«ENDFOR» org.eclipse.gef, org.eclipse.papyrus.infra.gmfdiag.preferences, - «IF it.eResource.allContents.filter(typeof (EditPartUsingDeleteService)).size != 0 || it.eResource.allContents.filter(typeof (EditPartUsingReorientService)).size != 0» + «IF it.eResource.allContents.filter(typeof (EditPartUsingDeleteService)).size != 0 || it.eResource.allContents.filter(typeof (EditPartUsingReorientService)).size != 0» org.eclipse.papyrus.extensionpoints.editors, org.eclipse.papyrus.infra.services.edit - «ELSE» + «ELSE» org.eclipse.papyrus.extensionpoints.editors -«ENDIF» +«ENDIF» ''' override def executionEnvironment(GenPlugin it) ''' diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/plugin/plugin.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/plugin/plugin.xtend index 600dd345de5..c727b190e20 100644 --- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/plugin/plugin.xtend +++ b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/plugin/plugin.xtend @@ -55,29 +55,29 @@ import java.io.File override plugin(GenPlugin it) ''' <?xml version="1.0" encoding="UTF-8"?> <?eclipse version="3.0"?> - «xcopyright(it.editorGen)» + «xcopyright(it.editorGen)» <plugin> - ««««fileTypes()» - ««««extension_parser()» - «xptEditorExtension.extensions(it.editorGen)» - «««global actions handled in the diagram.common plugin - ««««pluginMenu()» - «validation(it.editorGen.diagram)» - «IF it.editorGen.metrics != null»«metrics(it.editorGen.metrics)»«ENDIF» - «««RS: redefine palette generation -««« «palettePredefinedEntries(editorGen)» -««« «paletteEntries(editorGen)» - «xptPreferencesExtension.extensions(it.editorGen.diagram)» - «IF it.editorGen.propertySheet != null»«xptPropsheetExtension.extensions(it.editorGen.propertySheet)»«ENDIF» - «xptProvidersExtension.extensions(it.editorGen.diagram)» - «IF it.editorGen.navigator != null»«xptNavigatorExtension.extensions(it.editorGen.navigator)»«ENDIF» - «IF it.editorGen.application != null»«xptApplicationExtension.extensions(it.editorGen.application)»«ENDIF» - «extensionsConstraintProviders(it.editorGen)» - «xptUpdaterExtension.extensions(it.editorGen.diagramUpdater)» - «xptActionExtension.Main(it.editorGen)» - «additions(it)» - «notationTypesMap(editorGen)» -««« «paletteConfiguration(editorGen)» + ««««fileTypes()» + ««««extension_parser()» + «xptEditorExtension.extensions(it.editorGen)» + «««global actions handled in the diagram.common plugin + ««««pluginMenu()» + «validation(it.editorGen.diagram)» + «IF it.editorGen.metrics != null»«metrics(it.editorGen.metrics)»«ENDIF» + «««RS: redefine palette generation +««« «palettePredefinedEntries(editorGen)» +««« «paletteEntries(editorGen)» + «xptPreferencesExtension.extensions(it.editorGen.diagram)» + «IF it.editorGen.propertySheet != null»«xptPropsheetExtension.extensions(it.editorGen.propertySheet)»«ENDIF» + «xptProvidersExtension.extensions(it.editorGen.diagram)» + «IF it.editorGen.navigator != null»«xptNavigatorExtension.extensions(it.editorGen.navigator)»«ENDIF» + «IF it.editorGen.application != null»«xptApplicationExtension.extensions(it.editorGen.application)»«ENDIF» + «extensionsConstraintProviders(it.editorGen)» + «xptUpdaterExtension.extensions(it.editorGen.diagramUpdater)» + «xptActionExtension.Main(it.editorGen)» + «additions(it)» + «notationTypesMap(editorGen)» +««« «paletteConfiguration(editorGen)» </plugin> ''' @@ -87,19 +87,19 @@ import java.io.File */ def paletteConfiguration(GenEditorGenerator it) ''' <extension point="org.eclipse.papyrus.infra.gmfdiag.common.paletteDefinition"> - «xmlGeneratedTag» + «xmlGeneratedTag» <paletteDefinition - ID="«plugin.ID».paletteconfiguration" + ID="«plugin.ID».paletteconfiguration" class="org.eclipse.papyrus.infra.gmfdiag.common.service.palette.ExtendedPluginPaletteProvider" - name="«plugin.name» Palette" - path="«relativePath»/«modelID».paletteconfiguration" + name="«plugin.name» Palette" + path="«relativePath»/«modelID».paletteconfiguration" provider="Eclipse Modeling Project"> <Priority name="Lowest"> </Priority> <!-- Specify diagram to which this palette tool relates --> <editor - id="«plugin.ID»"> + id="«plugin.ID»"> </editor> </paletteDefinition> </extension> @@ -107,28 +107,28 @@ import java.io.File override additions(GenPlugin it) '''''' - // def category(GenDiagram it) '''«getDiagramPreferencePageCategory()».«editorGen.modelID»''' + // def category(GenDiagram it) '''«getDiagramPreferencePageCategory()».«editorGen.modelID»''' //RS: redefine palette generation, using predefined entries def palettePredefinedEntries(GenEditorGenerator it) ''' - «xmlGeneratedTag» + «xmlGeneratedTag» <extension - id="«plugin.name».palettedefinition" - name="«plugin.name» Predefined Entries" + id="«plugin.name».palettedefinition" + name="«plugin.name» Predefined Entries" point="org.eclipse.gmf.runtime.diagram.ui.paletteProviders"> - «xmlGeneratedTag» + «xmlGeneratedTag» <paletteProvider class="org.eclipse.gmf.runtime.diagram.ui.providers.DefaultPaletteProvider"> <Priority name="Lowest"/> <contribution - factoryClass="«it.diagram.palette.packageName».«it.diagram.palette.factoryClassName»"> + factoryClass="«it.diagram.palette.packageName».«it.diagram.palette.factoryClassName»"> <predefinedEntry id="standardGroup/noteStack/noteTool" remove="true"/> <predefinedEntry id="standardGroup/noteStack/textTool" remove="true"/> <predefinedEntry id="standardGroup/noteStack/noteattachmentTool" remove="true"/> - «FOR tool : collectTools(diagram.palette)» - «predefinedEntryDefinition(tool)» - «ENDFOR» + «FOR tool : collectTools(diagram.palette)» + «predefinedEntryDefinition(tool)» + «ENDFOR» </contribution> </paletteProvider> @@ -138,26 +138,26 @@ import java.io.File //RS: redefine palette generation, using predefined entries def paletteEntries(GenEditorGenerator it) ''' - «xmlGeneratedTag» + «xmlGeneratedTag» <extension - id="«plugin.name».standard" - name="«plugin.name» Standard Palette" + id="«plugin.name».standard" + name="«plugin.name» Standard Palette" point="org.eclipse.gmf.runtime.diagram.ui.paletteProviders"> - «xmlGeneratedTag» + «xmlGeneratedTag» <paletteProvider class="org.eclipse.gmf.runtime.diagram.ui.providers.DefaultPaletteProvider"> <Priority name="Low"/> <contribution - factoryClass="«it.diagram.palette.packageName».«it.diagram.palette.factoryClassName»"> + factoryClass="«it.diagram.palette.packageName».«it.diagram.palette.factoryClassName»"> <predefinedEntry id="standardGroup/noteStack/noteTool" remove="true"/> <predefinedEntry id="standardGroup/noteStack/textTool" remove="true"/> <predefinedEntry id="standardGroup/noteStack/noteattachmentTool" remove="true"/> - «FOR tool : diagram.palette.groups» - «groupUsage(tool)» - «ENDFOR» + «FOR tool : diagram.palette.groups» + «groupUsage(tool)» + «ENDFOR» </contribution> - <editor id="«plugin.ID»"/> + <editor id="«plugin.ID»"/> </paletteProvider> </extension> @@ -165,24 +165,24 @@ import java.io.File def groupUsage(ToolGroup it) ''' <entry - description="«it.description»" - id=«IF isQuoted(id,'"')»«id»«ELSE»"«id»"«ENDIF» - kind="«IF it.stack && it.toolsOnly»stack«ELSE»drawer«ENDIF»" - label="«it.title»" - large_icon="«largeIconPath»" - path="«getPath(it)»" - small_icon="«smallIconPath»"> + description="«it.description»" + id=«IF isQuoted(id,'"')»«id»«ELSE»"«id»"«ENDIF» + kind="«IF it.stack && it.toolsOnly»stack«ELSE»drawer«ENDIF»" + label="«it.title»" + large_icon="«largeIconPath»" + path="«getPath(it)»" + small_icon="«smallIconPath»"> <expand force="true"> </expand> </entry> - ««« TODO: call sub entries... - «FOR entry : it.entries.filter[e| e instanceof ToolEntry]» - «toolUsage(entry, it)» - «ENDFOR» - «FOR entry : it.entries.filter[e| e instanceof ToolGroup]» - «toolUsage(entry, it)» - «ENDFOR» + ««« TODO: call sub entries... + «FOR entry : it.entries.filter[e| e instanceof ToolEntry]» + «toolUsage(entry, it)» + «ENDFOR» + «FOR entry : it.entries.filter[e| e instanceof ToolGroup]» + «toolUsage(entry, it)» + «ENDFOR» ''' private def getPath(ToolEntry it) { @@ -205,91 +205,91 @@ import java.io.File def dispatch toolUsage(ToolEntry it, ToolGroup group) ''' <predefinedEntry - id=«IF isQuoted(id,'"')»«id»«ELSE»"«id»"«ENDIF» - path="«getPath(it)»"> + id=«IF isQuoted(id,'"')»«id»«ELSE»"«id»"«ENDIF» + path="«getPath(it)»"> </predefinedEntry> ''' def dispatch toolUsage(ToolGroup it, ToolGroup group) ''' - «groupUsage(it)» + «groupUsage(it)» ''' def predefinedEntryDefinition(AbstractToolEntry it) ''' <entry defineOnly="true" - description="«it.description»" - id=«IF isQuoted(id,'"')»«id»«ELSE»"«id»"«ENDIF» + description="«it.description»" + id=«IF isQuoted(id,'"')»«id»«ELSE»"«id»"«ENDIF» kind="tool" - label="«it.title»" - large_icon="«largeIconPath»" + label="«it.title»" + large_icon="«largeIconPath»" path="" - small_icon="«smallIconPath»"> + small_icon="«smallIconPath»"> </entry> ''' // set notation type mapping extension point def notationTypesMap(GenEditorGenerator it) ''' -«tripleSpace(0)»<extension point="org.eclipse.papyrus.infra.gmfdiag.common.notationTypesMapping"> -«tripleSpace(1)»«xmlGeneratedTag» -«tripleSpace(1)»<diagramMappings diagramID="«modelID»"> -«tripleSpace(1)» <mapping type="«modelID»" humanReadableType="«modelID.replaceAll('Papyrus|UML|Diagram', '')»Diagram"/> - «FOR compartment : diagram.compartments» - «compartmentToTypeMap(compartment)» - «ENDFOR» - «FOR link : diagram.links» - «linksToTypeMap(link)» - «ENDFOR» - «FOR externalLabel : diagram.eResource.allContents.filter(typeof (GenExternalNodeLabel)).toIterable» - «floatingLabelToTypeMap(externalLabel)» - «externalNodeLabelToTypeMap(externalLabel)» - «ENDFOR» -«tripleSpace(1)»</diagramMappings> -«tripleSpace(0)»</extension> +«tripleSpace(0)»<extension point="org.eclipse.papyrus.infra.gmfdiag.common.notationTypesMapping"> +«tripleSpace(1)»«xmlGeneratedTag» +«tripleSpace(1)»<diagramMappings diagramID="«modelID»"> +«tripleSpace(1)» <mapping type="«modelID»" humanReadableType="«modelID.replaceAll('Papyrus|UML|Diagram', '')»Diagram"/> + «FOR compartment : diagram.compartments» + «compartmentToTypeMap(compartment)» + «ENDFOR» + «FOR link : diagram.links» + «linksToTypeMap(link)» + «ENDFOR» + «FOR externalLabel : diagram.eResource.allContents.filter(typeof (GenExternalNodeLabel)).toIterable» + «floatingLabelToTypeMap(externalLabel)» + «externalNodeLabelToTypeMap(externalLabel)» + «ENDFOR» +«tripleSpace(1)»</diagramMappings> +«tripleSpace(0)»</extension> ''' def compartmentToTypeMap(GenCompartment it) ''' <mapping - humanReadableType="«title.replaceAll('Compartment', '')»" - type="«stringVisualID»"> + humanReadableType="«title.replaceAll('Compartment', '')»" + type="«stringVisualID»"> </mapping> ''' def linksToTypeMap(GenLink it) ''' - «FOR label : labels» - «linkLabelToTypeMap(label)» - «ENDFOR» + «FOR label : labels» + «linkLabelToTypeMap(label)» + «ENDFOR» ''' def linkLabelToTypeMap(GenLinkLabel it)''' - ««« it is used on a LabelVisibilityPreference... - «LabelVisibilityPreferenceToTypeMap(it.eResource.allContents.filter(typeof (LabelVisibilityPreference)).filter[v | v.linkLabels != null && v.linkLabels.contains(it) && v.role != null], stringVisualID)» + ««« it is used on a LabelVisibilityPreference... + «LabelVisibilityPreferenceToTypeMap(it.eResource.allContents.filter(typeof (LabelVisibilityPreference)).filter[v | v.linkLabels != null && v.linkLabels.contains(it) && v.role != null], stringVisualID)» ''' def externalNodeLabelToTypeMap(GenExternalNodeLabel it)''' - «LabelVisibilityPreferenceToTypeMap(it.eResource.allContents.filter(typeof (LabelVisibilityPreference)).filter[v | v.externalNodeLabels != null && v.externalNodeLabels.contains(it) && v.role != null],stringVisualID)» + «LabelVisibilityPreferenceToTypeMap(it.eResource.allContents.filter(typeof (LabelVisibilityPreference)).filter[v | v.externalNodeLabels != null && v.externalNodeLabels.contains(it) && v.role != null],stringVisualID)» ''' def LabelVisibilityPreferenceToTypeMap(Iterator<LabelVisibilityPreference> it, String visualID)''' - «var List<LabelVisibilityPreference> links = it.toList» - «IF links.size != 0» + «var List<LabelVisibilityPreference> links = it.toList» + «IF links.size != 0» <mapping - humanReadableType="«links.get(0).role»" - type="«visualID»"> + humanReadableType="«links.get(0).role»" + type="«visualID»"> </mapping> - «ENDIF» + «ENDIF» ''' def floatingLabelToTypeMap(GenExternalNodeLabel it)''' - ««« it is used on a ExtensionGenView... - «IF it.eResource.allContents.filter(typeof (ExtendedGenView)).filter[v | v.genView.contains(it) && v.superOwnedEditPart != null].size != 0» - «FOR extendedObject : it.eResource.allContents.filter(typeof (ExtendedGenView)).filter[v|v.genView.contains(it) && v.superOwnedEditPart != null].toIterable» - «««...to be extended as floatingLabel - «IF "FloatingLabelEditPart".equals(extendedObject.name) » + ««« it is used on a ExtensionGenView... + «IF it.eResource.allContents.filter(typeof (ExtendedGenView)).filter[v | v.genView.contains(it) && v.superOwnedEditPart != null].size != 0» + «FOR extendedObject : it.eResource.allContents.filter(typeof (ExtendedGenView)).filter[v|v.genView.contains(it) && v.superOwnedEditPart != null].toIterable» + «««...to be extended as floatingLabel + «IF "FloatingLabelEditPart".equals(extendedObject.name) » <mapping humanReadableType="Floating Label" - type="«stringVisualID»"> + type="«stringVisualID»"> </mapping> - «ENDIF» - «ENDFOR» - «ENDIF» + «ENDIF» + «ENDFOR» + «ENDIF» ''' } diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/propsheet/LabelProvider.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/propsheet/LabelProvider.xtend index da37b34fc4e..a10938f01e2 100644 --- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/propsheet/LabelProvider.xtend +++ b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/propsheet/LabelProvider.xtend @@ -29,7 +29,7 @@ import org.eclipse.gmf.codegen.gmfgen.GenPropertySheet @Inject VisualIDRegistry visualId; override def unwrapMethods(GenPropertySheet it) ''' - «generatedMemberComment» + «generatedMemberComment» private Object unwrap(Object element) { if (element instanceof org.eclipse.jface.viewers.IStructuredSelection) { return ((org.eclipse.jface.viewers.IStructuredSelection) element).getFirstElement(); @@ -37,7 +37,7 @@ import org.eclipse.gmf.codegen.gmfgen.GenPropertySheet return element; } - «generatedMemberComment» + «generatedMemberComment» private org.eclipse.gmf.runtime.notation.View getView(Object element) { if (element instanceof org.eclipse.gmf.runtime.notation.View) { return (org.eclipse.gmf.runtime.notation.View) element; @@ -49,13 +49,13 @@ import org.eclipse.gmf.codegen.gmfgen.GenPropertySheet return null; } - «generatedMemberComment» + «generatedMemberComment» private org.eclipse.gmf.runtime.emf.type.core.IElementType getElementType(org.eclipse.gmf.runtime.notation.View view) { // For intermediate views climb up the containment hierarchy to find the one associated with an element type. while (view != null) { - String vid = «visualId.qualifiedClassName(editorGen.diagram)».getVisualID(view); + String vid = «visualId.qualifiedClassName(editorGen.diagram)».getVisualID(view); org.eclipse.gmf.runtime.emf.type.core.IElementType etype = - «xptElementTypes.qualifiedClassName(editorGen.diagram)».getElementType(vid); + «xptElementTypes.qualifiedClassName(editorGen.diagram)».getElementType(vid); if (etype != null) { return etype; } diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/providers/ElementInitializers.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/providers/ElementInitializers.xtend index 85a3fdb5ca6..c581861911b 100644 --- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/providers/ElementInitializers.xtend +++ b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/providers/ElementInitializers.xtend @@ -50,77 +50,77 @@ import xpt.providers.ElementInitializers_qvto ///////////////////////////////// override dispatch CharSequence javaMethod(GenNode it) ''' - «IF !it.sansDomain» - «javaMethod(it.modelFacet, it)» - «ENDIF» + «IF !it.sansDomain» + «javaMethod(it.modelFacet, it)» + «ENDIF» ''' override dispatch CharSequence javaMethod(GenLink it) ''' - «IF !it.sansDomain» - «javaMethod(it.modelFacet, it)» - «ENDIF» + «IF !it.sansDomain» + «javaMethod(it.modelFacet, it)» + «ENDIF» ''' override dispatch CharSequence performInit(GenFeatureValueSpec it, GenCommonBase diagramElement, String instanceVar, GenClass instanceClass, List<Integer> counters) ''' - «IF it.value.provider.getLanguage() == GenLanguage::LITERAL_LITERAL» - «xptMetaModel.modifyFeature(feature, instanceVar, instanceClass, value.body)» - «extraLineBreak» - «ELSE» - «var expressionVarName = getVariableName('value', counters)» - Object «expressionVarName» = «evaluateExpr(value.provider, diagramElement, it, instanceVar)»; - «IF feature.listType» - if («expressionVarName» instanceof java.util.Collection) { - «xptMetaModel.getFeatureValue(feature, instanceVar, instanceClass, true)».clear(); - «IF feature.typeGenClassifier.expressionResultNeedsCast()» - for (java.util.Iterator it = ((java.util.Collection) «expressionVarName»).iterator(); it.hasNext(); ) { - Object next = «xptAbstractExpression.qualifiedClassName(diagramElement.getDiagram())».performCast(it.next(), «xptMetaModel. - MetaClass(feature.typeGenClassifier)»); - «xptMetaModel.getFeatureValue(feature, instanceVar, instanceClass, true)».add((«xptMetaModel. - QualifiedClassName(feature.typeGenClassifier/*XXX sorta hack, better would be MM::setFeatureValue that supports lists*/)») next); + «IF it.value.provider.getLanguage() == GenLanguage::LITERAL_LITERAL» + «xptMetaModel.modifyFeature(feature, instanceVar, instanceClass, value.body)» + «extraLineBreak» + «ELSE» + «var expressionVarName = getVariableName('value', counters)» + Object «expressionVarName» = «evaluateExpr(value.provider, diagramElement, it, instanceVar)»; + «IF feature.listType» + if («expressionVarName» instanceof java.util.Collection) { + «xptMetaModel.getFeatureValue(feature, instanceVar, instanceClass, true)».clear(); + «IF feature.typeGenClassifier.expressionResultNeedsCast()» + for (java.util.Iterator it = ((java.util.Collection) «expressionVarName»).iterator(); it.hasNext(); ) { + Object next = «xptAbstractExpression.qualifiedClassName(diagramElement.getDiagram())».performCast(it.next(), «xptMetaModel. + MetaClass(feature.typeGenClassifier)»); + «xptMetaModel.getFeatureValue(feature, instanceVar, instanceClass, true)».add((«xptMetaModel. + QualifiedClassName(feature.typeGenClassifier/*XXX sorta hack, better would be MM::setFeatureValue that supports lists*/)») next); } - «ELSE» - «xptMetaModel.getFeatureValue(feature, instanceVar, instanceClass, true)».addAll(((java.util.Collection) «expressionVarName»)); - «ENDIF» - } else if(«expressionVarName» != null) { - «IF feature.typeGenClassifier.expressionResultNeedsCast()» - «expressionVarName» = «xptAbstractExpression - .qualifiedClassName(diagramElement.getDiagram())».performCast(«expressionVarName», «xptMetaModel.MetaClass( - feature.typeGenClassifier)»); - «ENDIF» - «xptMetaModel.getFeatureValue(feature, instanceVar, instanceClass, true)».add((«xptMetaModel. - QualifiedClassName(feature.typeGenClassifier/*XXX sorta hack, better would be MM::setFeatureValue that supports lists*/)») «expressionVarName»); + «ELSE» + «xptMetaModel.getFeatureValue(feature, instanceVar, instanceClass, true)».addAll(((java.util.Collection) «expressionVarName»)); + «ENDIF» + } else if(«expressionVarName» != null) { + «IF feature.typeGenClassifier.expressionResultNeedsCast()» + «expressionVarName» = «xptAbstractExpression + .qualifiedClassName(diagramElement.getDiagram())».performCast(«expressionVarName», «xptMetaModel.MetaClass( + feature.typeGenClassifier)»); + «ENDIF» + «xptMetaModel.getFeatureValue(feature, instanceVar, instanceClass, true)».add((«xptMetaModel. + QualifiedClassName(feature.typeGenClassifier/*XXX sorta hack, better would be MM::setFeatureValue that supports lists*/)») «expressionVarName»); } - «ELSE» - if(«expressionVarName» != null) { - «IF feature.typeGenClassifier.expressionResultNeedsCast()» - «extraLineBreak» - «expressionVarName» = « - xptAbstractExpression.qualifiedClassName(diagramElement.getDiagram())».performCast(«expressionVarName», «xptMetaModel.MetaClass( - feature.typeGenClassifier)»); - «ENDIF» - «xptMetaModel.setFeatureValue(feature, instanceVar, instanceClass, expressionVarName, true)»; + «ELSE» + if(«expressionVarName» != null) { + «IF feature.typeGenClassifier.expressionResultNeedsCast()» + «extraLineBreak» + «expressionVarName» = « + xptAbstractExpression.qualifiedClassName(diagramElement.getDiagram())».performCast(«expressionVarName», «xptMetaModel.MetaClass( + feature.typeGenClassifier)»); + «ENDIF» + «xptMetaModel.setFeatureValue(feature, instanceVar, instanceClass, expressionVarName, true)»; } - «ENDIF/*isListType*/» - «ENDIF/*is literal expression*/» + «ENDIF/*isListType*/» + «ENDIF/*is literal expression*/» ''' override dispatch CharSequence initMethod(GenFeatureSeqInitializer it, GenCommonBase diagramElement) ''' - «generatedMemberComment» - public void init_«diagramElement.stringUniqueIdentifier()»(«xptMetaModel.QualifiedClassName(elementClass)» instance) { + «generatedMemberComment» + public void init_«diagramElement.stringUniqueIdentifier()»(«xptMetaModel.QualifiedClassName(elementClass)» instance) { try { - «FOR i : it.initializers» - «performInit(i, diagramElement, 'instance', elementClass, <Integer>newLinkedList(initializers.indexOf(i)))» - «ENDFOR» + «FOR i : it.initializers» + «performInit(i, diagramElement, 'instance', elementClass, <Integer>newLinkedList(initializers.indexOf(i)))» + «ENDFOR» } catch(RuntimeException e) { - «xptActivator.qualifiedClassName(diagramElement.getDiagram().editorGen.plugin)».getInstance().logError("Element initialization failed", e); //$NON-NLS-1$ + «xptActivator.qualifiedClassName(diagramElement.getDiagram().editorGen.plugin)».getInstance().logError("Element initialization failed", e); //$NON-NLS-1$ } } ''' override def initMethodCall(GenCommonBase linkOrNode, TypeModelFacet modelFacet, String newElementVar) ''' - «IF modelFacet.modelElementInitializer != null» - «elementInitializersInstanceCall(linkOrNode)».init_«linkOrNode.stringUniqueIdentifier»(«newElementVar»); - «ENDIF» + «IF modelFacet.modelElementInitializer != null» + «elementInitializersInstanceCall(linkOrNode)».init_«linkOrNode.stringUniqueIdentifier»(«newElementVar»); + «ENDIF» ''' } diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/providers/ElementTypes.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/providers/ElementTypes.xtend index 91ea7b96a11..ca64770225d 100644 --- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/providers/ElementTypes.xtend +++ b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/providers/ElementTypes.xtend @@ -37,43 +37,43 @@ import plugin.Activator @Inject Activator xptActivator; override def attributes(GenDiagram it) ''' - «generatedMemberComment» + «generatedMemberComment» private static java.util.Map<org.eclipse.gmf.runtime.emf.type.core.IElementType, org.eclipse.emf.ecore.ENamedElement> elements; - «generatedMemberComment» - private static org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.providers.DiagramElementTypeImages elementTypeImages = new org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.providers.DiagramElementTypeImages(« // - xptActivator.qualifiedClassName(editorGen.plugin)».getInstance().getItemProvidersAdapterFactory()); + «generatedMemberComment» + private static org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.providers.DiagramElementTypeImages elementTypeImages = new org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.providers.DiagramElementTypeImages(« // + xptActivator.qualifiedClassName(editorGen.plugin)».getInstance().getItemProvidersAdapterFactory()); - «generatedMemberComment» + «generatedMemberComment» private static java.util.Set<org.eclipse.gmf.runtime.emf.type.core.IElementType> KNOWN_ELEMENT_TYPES; ''' override def getElement(GenDiagram it) ''' - «generatedMemberComment('Returns \'type\' of the ecore object associated with the hint.\n')» + «generatedMemberComment('Returns \'type\' of the ecore object associated with the hint.\n')» public static synchronized org.eclipse.emf.ecore.ENamedElement getElement(org.eclipse.core.runtime.IAdaptable hint) { Object type = hint.getAdapter(org.eclipse.gmf.runtime.emf.type.core.IElementType.class); if (elements == null) { elements = new java.util.IdentityHashMap<org.eclipse.gmf.runtime.emf.type.core.IElementType, org.eclipse.emf.ecore.ENamedElement>(); - «IF domainDiagramElement != null»«bindUniqueIdentifierToNamedElement(domainDiagramElement, stringUniqueIdentifier())»«ENDIF» - «FOR node : getAllNodes()» - «IF node.modelFacet != null»«bindUniqueIdentifierToNamedElement(node.modelFacet, node.stringUniqueIdentifier())»«ENDIF» - «ENDFOR» - «FOR link : it.links» - «IF link.modelFacet != null»«bindUniqueIdentifierToNamedElement(link.modelFacet, link.stringUniqueIdentifier())»«ENDIF» - «ENDFOR» + «IF domainDiagramElement != null»«bindUniqueIdentifierToNamedElement(domainDiagramElement, stringUniqueIdentifier())»«ENDIF» + «FOR node : getAllNodes()» + «IF node.modelFacet != null»«bindUniqueIdentifierToNamedElement(node.modelFacet, node.stringUniqueIdentifier())»«ENDIF» + «ENDFOR» + «FOR link : it.links» + «IF link.modelFacet != null»«bindUniqueIdentifierToNamedElement(link.modelFacet, link.stringUniqueIdentifier())»«ENDIF» + «ENDFOR» } return elements.get(type); } ''' override def isKnownElementType(GenDiagram it) ''' - «generatedMemberComment» + «generatedMemberComment» public static synchronized boolean isKnownElementType(org.eclipse.gmf.runtime.emf.type.core.IElementType elementType) { if (KNOWN_ELEMENT_TYPES == null) { KNOWN_ELEMENT_TYPES = new java.util.HashSet<org.eclipse.gmf.runtime.emf.type.core.IElementType>(); - «FOR e : it.getAllTypedElements()» - «addKnownElementType(e)» - «ENDFOR» + «FOR e : it.getAllTypedElements()» + «addKnownElementType(e)» + «ENDFOR» } boolean result = KNOWN_ELEMENT_TYPES.contains(elementType); @@ -90,9 +90,9 @@ import plugin.Activator ''' override def additions(GenDiagram it) ''' - «super.additions(it)» + «super.additions(it)» - «generatedMemberComment» + «generatedMemberComment» public static boolean isKindOf(org.eclipse.gmf.runtime.emf.type.core.IElementType subtype, org.eclipse.gmf.runtime.emf.type.core.IElementType supertype) { boolean result = subtype == supertype; @@ -108,13 +108,13 @@ import plugin.Activator ''' override def getElementTypeByVisualID(GenDiagram it) ''' - «generatedMemberComment» + «generatedMemberComment» public static org.eclipse.gmf.runtime.emf.type.core.IElementType getElementType(String visualID) { if (visualID != null) { switch (visualID) { - «FOR e : it.getAllTypedElements().filter[el|el.elementType != null]» - «caseElementType(e)» - «ENDFOR» + «FOR e : it.getAllTypedElements().filter[el|el.elementType != null]» + «caseElementType(e)» + «ENDFOR» } } return null; @@ -122,55 +122,55 @@ import plugin.Activator ''' override def getElementType(GenDiagram it) ''' - «generatedMemberComment» + «generatedMemberComment» private static org.eclipse.gmf.runtime.emf.type.core.IElementType getElementTypeByUniqueId(String id) { return org.eclipse.gmf.runtime.emf.type.core.ElementTypeRegistry.getInstance().getType(id); } ''' override def elementTypeField(GenCommonBase it) ''' - «IF null != elementType» - «generatedMemberComment» - public static final org.eclipse.gmf.runtime.emf.type.core.IElementType «stringUniqueIdentifier» = getElementTypeByUniqueId("«elementType. - uniqueIdentifier»"); «nonNLS(1)» - «ENDIF» + «IF null != elementType» + «generatedMemberComment» + public static final org.eclipse.gmf.runtime.emf.type.core.IElementType «stringUniqueIdentifier» = getElementTypeByUniqueId("«elementType. + uniqueIdentifier»"); «nonNLS(1)» + «ENDIF» ''' override def typedInstance(GenDiagram it) ''' - «generatedClassComment» + «generatedClassComment» public static final org.eclipse.papyrus.infra.gmfdiag.common.providers.DiagramElementTypes TYPED_INSTANCE = new org.eclipse.papyrus.infra.gmfdiag.common.providers.DiagramElementTypes(elementTypeImages) { - «generatedMemberComment» - «xptCodeStyle.overrideC(it)» + «generatedMemberComment» + «xptCodeStyle.overrideC(it)» public boolean isKnownElementType(org.eclipse.gmf.runtime.emf.type.core.IElementType elementType) { - return «qualifiedClassName(it)».isKnownElementType(elementType); + return «qualifiedClassName(it)».isKnownElementType(elementType); } - «generatedMemberComment» - «xptCodeStyle.overrideC(it)» + «generatedMemberComment» + «xptCodeStyle.overrideC(it)» public org.eclipse.gmf.runtime.emf.type.core.IElementType getElementTypeForVisualId(String visualID) { - return «qualifiedClassName(it)».getElementType(visualID); + return «qualifiedClassName(it)».getElementType(visualID); } - «generatedMemberComment» - «xptCodeStyle.overrideC(it)» + «generatedMemberComment» + «xptCodeStyle.overrideC(it)» public org.eclipse.emf.ecore.ENamedElement getDefiningNamedElement(org.eclipse.core.runtime.IAdaptable elementTypeAdapter) { - return «qualifiedClassName(it)».getElement(elementTypeAdapter); + return «qualifiedClassName(it)».getElement(elementTypeAdapter); } }; ''' - override def accessElementType(GenCommonBase it) '''«it.diagram.elementTypesQualifiedClassName».«stringUniqueIdentifier»''' + override def accessElementType(GenCommonBase it) '''«it.diagram.elementTypesQualifiedClassName».«stringUniqueIdentifier»''' override def caseElementType(GenCommonBase it) ''' - «xptVisualIDRegistry.caseVisualID(it)» - return «stringUniqueIdentifier()»; + «xptVisualIDRegistry.caseVisualID(it)» + return «stringUniqueIdentifier()»; ''' override def addKnownElementType(GenCommonBase it) ''' - «IF null != elementType» - KNOWN_ELEMENT_TYPES.add(«stringUniqueIdentifier()»); - «ENDIF» + «IF null != elementType» + KNOWN_ELEMENT_TYPES.add(«stringUniqueIdentifier()»); + «ENDIF» ''' }
\ No newline at end of file diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/providers/MarkerNavigationProvider.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/providers/MarkerNavigationProvider.xtend index 00760a6bd11..c44a600f360 100644 --- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/providers/MarkerNavigationProvider.xtend +++ b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/providers/MarkerNavigationProvider.xtend @@ -24,18 +24,18 @@ import xpt.Common @Inject extension Common; override def MarkerNavigationProvider(GenDiagram it) ''' - «copyright(editorGen)» - package «packageName(it)»; + «copyright(editorGen)» + package «packageName(it)»; - «generatedClassComment» - public class «className(it)» + «generatedClassComment» + public class «className(it)» extends org.eclipse.gmf.runtime.emf.ui.providers.marker.AbstractModelMarkerNavigationProvider { - «generatedMemberComment» + «generatedMemberComment» public static final String MARKER_TYPE = - «editorGen.plugin.activatorQualifiedClassName».ID + ".«getValidationDiagnosticMarkerType()»"; «nonNLS(1)» + «editorGen.plugin.activatorQualifiedClassName».ID + ".«getValidationDiagnosticMarkerType()»"; «nonNLS(1)» - «generatedMemberComment» + «generatedMemberComment» protected void doGotoMarker(org.eclipse.core.resources.IMarker marker) { String elementId = marker.getAttribute(org.eclipse.gmf.runtime.common.core.resources.IMarker.ELEMENT_ID, null); if (elementId == null || !(getEditor() instanceof org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditor)) { @@ -50,22 +50,22 @@ import xpt.Common } org.eclipse.gef.EditPart targetEditPart = (org.eclipse.gef.EditPart) editPartRegistry.get(targetView); if (targetEditPart != null) { - «getDiagramEditorUtilQualifiedClassName()».selectElementsInDiagram( + «getDiagramEditorUtilQualifiedClassName()».selectElementsInDiagram( editor, java.util.Arrays.asList(new org.eclipse.gef.EditPart[] { targetEditPart })); } } - «generatedMemberComment» + «generatedMemberComment» public static void deleteMarkers(org.eclipse.core.resources.IResource resource) { try { resource.deleteMarkers(MARKER_TYPE, true, org.eclipse.core.resources.IResource.DEPTH_ZERO); } catch (org.eclipse.core.runtime.CoreException e) { - «editorGen.plugin.activatorQualifiedClassName».getInstance().logError( - "Failed to delete validation markers", e); «nonNLS(1)» + «editorGen.plugin.activatorQualifiedClassName».getInstance().logError( + "Failed to delete validation markers", e); «nonNLS(1)» } } - «generatedMemberComment» + «generatedMemberComment» public static org.eclipse.core.resources.IMarker addMarker(org.eclipse.core.resources.IFile file, String elementId, String location, String message, int statusSeverity) { org.eclipse.core.resources.IMarker marker = null; @@ -83,12 +83,12 @@ import xpt.Common } marker.setAttribute(org.eclipse.core.resources.IMarker.SEVERITY, markerSeverity); } catch (org.eclipse.core.runtime.CoreException e) { - «editorGen.plugin.activatorQualifiedClassName».getInstance().logError( - "Failed to create validation marker", e); «nonNLS(1)» + «editorGen.plugin.activatorQualifiedClassName».getInstance().logError( + "Failed to create validation marker", e); «nonNLS(1)» } return marker; } - «additions(it)» + «additions(it)» } ''' diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/providers/ValidationDecoratorProvider.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/providers/ValidationDecoratorProvider.xtend index 88e26d76105..03462ef8742 100644 --- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/providers/ValidationDecoratorProvider.xtend +++ b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/providers/ValidationDecoratorProvider.xtend @@ -25,7 +25,7 @@ import xpt.editor.VisualIDRegistry /** * FIXME: [MG] monolithic template with most of the code "same-generated". - * Unfortunately, a lot of the logic is based around «IF editorGen.application == null» and we don't have a good ways to deal with taht in GMFT-runtimw + * Unfortunately, a lot of the logic is based around «IF editorGen.application == null» and we don't have a good ways to deal with taht in GMFT-runtimw */ @Singleton class ValidationDecoratorProvider extends xpt.providers.ValidationDecoratorProvider{ @Inject extension Common; @@ -37,15 +37,15 @@ import xpt.editor.VisualIDRegistry override ValidationDecoratorProvider(GenDiagram it) ''' -«copyright(editorGen)» -package «packageName(it)»; +«copyright(editorGen)» +package «packageName(it)»; -«generatedClassComment» -public class «className(it)» +«generatedClassComment» +public class «className(it)» extends org.eclipse.papyrus.uml.diagram.common.providers.ValidationDecoratorProvider implements org.eclipse.gmf.runtime.diagram.ui.services.decorator.IDecoratorProvider { - «generatedMemberComment» + «generatedMemberComment» public void createDecorators(org.eclipse.gmf.runtime.diagram.ui.services.decorator.IDecoratorTarget decoratorTarget) { org.eclipse.gef.EditPart editPart = (org.eclipse.gef.EditPart) decoratorTarget.getAdapter(org.eclipse.gef.EditPart.class); if (editPart instanceof org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart || @@ -62,13 +62,13 @@ public class «className(it)» return; } if (((org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditDomain) ed).getEditorPart() instanceof - «xptEditor.qualifiedClassName(editorGen.editor)») { + «xptEditor.qualifiedClassName(editorGen.editor)») { decoratorTarget.installDecorator(KEY, new StatusDecorator(decoratorTarget)); } } } - «generatedMemberComment» + «generatedMemberComment» public boolean provides(org.eclipse.gmf.runtime.common.core.service.IOperation operation) { if (!(operation instanceof org.eclipse.gmf.runtime.diagram.ui.services.decorator.CreateDecoratorsOperation)) { return false; @@ -77,11 +77,11 @@ public class «className(it)» ((org.eclipse.gmf.runtime.diagram.ui.services.decorator.CreateDecoratorsOperation) operation).getDecoratorTarget(); org.eclipse.gmf.runtime.notation.View view = (org.eclipse.gmf.runtime.notation.View) decoratorTarget.getAdapter( org.eclipse.gmf.runtime.notation.View.class); - return view != null && «VisualIDRegistry::modelID(it)».equals(«xptVisualIDRegistry.getModelIDMethodCall(it)»(view)); + return view != null && «VisualIDRegistry::modelID(it)».equals(«xptVisualIDRegistry.getModelIDMethodCall(it)»(view)); } - «additions(it)» + «additions(it)» } ''' diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/providers/ValidationProvider.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/providers/ValidationProvider.xtend index a1c7d72c020..93184c07597 100644 --- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/providers/ValidationProvider.xtend +++ b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/providers/ValidationProvider.xtend @@ -39,54 +39,54 @@ import xpt.CodeStyle override selectors(GenAuditRoot it) ''' - «IF it !=null» - «IF it.clientContexts !=null» - «FOR ctx : it.clientContexts» - «generatedMemberComment» - public static class «ctx.className» implements org.eclipse.emf.validation.model.IClientSelector { + «IF it !=null» + «IF it.clientContexts !=null» + «FOR ctx : it.clientContexts» + «generatedMemberComment» + public static class «ctx.className» implements org.eclipse.emf.validation.model.IClientSelector { - «generatedMemberComment» + «generatedMemberComment» public boolean selects(Object object) { - «IF ctx.ruleTargets.filter(typeof(GenDiagramElementTarget)).notEmpty» + «IF ctx.ruleTargets.filter(typeof(GenDiagramElementTarget)).notEmpty» if (isInDefaultEditorContext(object) && object instanceof org.eclipse.gmf.runtime.notation.View) { - final String id = «xptVisualIDRegistry.getVisualIDMethodCall(editorGen.diagram)»((org.eclipse.gmf.runtime.notation.View) object); + final String id = «xptVisualIDRegistry.getVisualIDMethodCall(editorGen.diagram)»((org.eclipse.gmf.runtime.notation.View) object); boolean result = false; - «FOR e : getTargetDiagramElements(ctx)» - result = result || «VisualIDRegistry::visualID(e)».equals(id); - «ENDFOR» + «FOR e : getTargetDiagramElements(ctx)» + result = result || «VisualIDRegistry::visualID(e)».equals(id); + «ENDFOR» return result; } return false; - «ELSE» + «ELSE» return isInDefaultEditorContext(object); - «ENDIF» + «ENDIF» } } - «ENDFOR» - «ENDIF» - «ENDIF» + «ENDFOR» + «ENDIF» + «ENDIF» ''' override constraintAdapters(GenAuditRoot it, GenDiagram diagram) ''' - «IF it !=null» - «IF diagram.editorGen.expressionProviders != null» - «FOR next : it.rules.filter[a | a.requiresConstraintAdapter]» - «constraintAdapter(next, diagram.editorGen.expressionProviders)» - «ENDFOR» + «IF it !=null» + «IF diagram.editorGen.expressionProviders != null» + «FOR next : it.rules.filter[a | a.requiresConstraintAdapter]» + «constraintAdapter(next, diagram.editorGen.expressionProviders)» + «ENDFOR» - «IF it.rules.exists[a | a.requiresConstraintAdapter]» - «constraintAdapters_formatMethod(it)» - «ENDIF» - «ENDIF» - «ENDIF» + «IF it.rules.exists[a | a.requiresConstraintAdapter]» + «constraintAdapters_formatMethod(it)» + «ENDIF» + «ENDIF» + «ENDIF» ''' override runWithActiveConstraints(GenDiagram it) ''' - «generatedMemberComment» + «generatedMemberComment» public static void runWithConstraints(org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain, Runnable operation) { final Runnable op = operation; Runnable task = new Runnable() { - «overrideI» + «overrideI» public void run() { try { constraintsActive = true; @@ -100,7 +100,7 @@ import xpt.CodeStyle try { editingDomain.runExclusive(task); } catch (Exception e) { - «xptActivator.qualifiedClassName(editorGen.plugin)».getInstance().logError("Validation failed", e); «nonNLS(1)» + «xptActivator.qualifiedClassName(editorGen.plugin)».getInstance().logError("Validation failed", e); «nonNLS(1)» } } else { task.run(); @@ -109,55 +109,55 @@ import xpt.CodeStyle ''' override def strategy_support(GenDiagram it) ''' - «IF hasDiagramElementTargetRule(editorGen.audits)» - «generatedMemberComment» + «IF hasDiagramElementTargetRule(editorGen.audits)» + «generatedMemberComment» public static org.eclipse.emf.validation.service.ITraversalStrategy getNotationTraversalStrategy( org.eclipse.emf.validation.service.IBatchValidator validator) { return new CtxSwitchStrategy(validator); } - «generatedMemberComment» + «generatedMemberComment» private static class CtxSwitchStrategy implements org.eclipse.emf.validation.service.ITraversalStrategy { - «generatedMemberComment» + «generatedMemberComment» private org.eclipse.emf.validation.service.ITraversalStrategy defaultStrategy; - «generatedMemberComment» + «generatedMemberComment» private String currentSemanticCtxId; - «generatedMemberComment» + «generatedMemberComment» private boolean ctxChanged = true; - «generatedMemberComment» + «generatedMemberComment» private org.eclipse.emf.ecore.EObject currentTarget; - «generatedMemberComment» + «generatedMemberComment» private org.eclipse.emf.ecore.EObject preFetchedNextTarget; - «generatedMemberComment» + «generatedMemberComment» private final String[] contextSwitchingIdentifiers; - «generatedMemberComment» + «generatedMemberComment» CtxSwitchStrategy(org.eclipse.emf.validation.service.IBatchValidator validator) { this.defaultStrategy = validator.getDefaultTraversalStrategy(); this.contextSwitchingIdentifiers = new String[] { - «FOR e : getAllTargetDiagramElements(editorGen.audits) SEPARATOR ','»«VisualIDRegistry::visualID(e)»«ENDFOR» + «FOR e : getAllTargetDiagramElements(editorGen.audits) SEPARATOR ','»«VisualIDRegistry::visualID(e)»«ENDFOR» }; java.util.Arrays.sort(this.contextSwitchingIdentifiers); } - «generatedMemberComment» + «generatedMemberComment» public void elementValidated(org.eclipse.emf.ecore.EObject element, org.eclipse.core.runtime.IStatus status) { defaultStrategy.elementValidated(element, status); } - «generatedMemberComment» + «generatedMemberComment» public boolean hasNext() { return defaultStrategy.hasNext(); } - «generatedMemberComment» + «generatedMemberComment» public boolean isClientContextChanged() { if (preFetchedNextTarget == null) { preFetchedNextTarget = next(); @@ -166,7 +166,7 @@ import xpt.CodeStyle return ctxChanged; } - «generatedMemberComment» + «generatedMemberComment» public org.eclipse.emf.ecore.EObject next() { org.eclipse.emf.ecore.EObject nextTarget = preFetchedNextTarget; if (nextTarget == null) { @@ -176,21 +176,21 @@ import xpt.CodeStyle return this.currentTarget = nextTarget; } - «generatedMemberComment» + «generatedMemberComment» public void startTraversal(java.util.Collection traversalRoots, org.eclipse.core.runtime.IProgressMonitor monitor) { defaultStrategy.startTraversal(traversalRoots, monitor); } - «generatedMemberComment» + «generatedMemberComment» private void prepareNextClientContext(org.eclipse.emf.ecore.EObject nextTarget) { if (nextTarget != null && currentTarget != null) { if (nextTarget instanceof org.eclipse.gmf.runtime.notation.View) { - final String id = «xptVisualIDRegistry.getVisualIDMethodCall(editorGen.diagram)»((org.eclipse.gmf.runtime.notation.View) nextTarget); + final String id = «xptVisualIDRegistry.getVisualIDMethodCall(editorGen.diagram)»((org.eclipse.gmf.runtime.notation.View) nextTarget); String nextSemanticId = (id != null && java.util.Arrays.binarySearch(contextSwitchingIdentifiers, id) >= 0) ? id : null; if ((currentSemanticCtxId != null && currentSemanticCtxId != nextSemanticId) || (nextSemanticId != null && nextSemanticId != currentSemanticCtxId)) { this.ctxChanged = true; - }«/*[artem] not sure why not ctxChanged = <expr>, is it intentional not to reset ctxChanged if condition did not match? I doubt. FIXME?*/» + }«/*[artem] not sure why not ctxChanged = <expr>, is it intentional not to reset ctxChanged if condition did not match? I doubt. FIXME?*/» currentSemanticCtxId = nextSemanticId; } else { // context of domain model @@ -202,6 +202,6 @@ import xpt.CodeStyle } } } - «ENDIF» + «ENDIF» ''' } diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/providers/ViewProvider.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/providers/ViewProvider.xtend index 2d519f8b1fb..51b65b5f791 100644 --- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/providers/ViewProvider.xtend +++ b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/providers/ViewProvider.xtend @@ -58,18 +58,18 @@ import xpt.editor.VisualIDRegistry @Inject ViewStyles xptViewStyles; override ViewProvider(GenDiagram it) ''' - «copyright(editorGen)» - package «packageName(it)»; + «copyright(editorGen)» + package «packageName(it)»; - «generatedClassComment» - public class «className(it)» «extendsList(it)»«implementsList(it)» { + «generatedClassComment» + public class «className(it)» «extendsList(it)»«implementsList(it)» { - «generatedMemberComment» + «generatedMemberComment» public final boolean provides(org.eclipse.gmf.runtime.common.core.service.IOperation operation) { if (operation instanceof org.eclipse.gmf.runtime.diagram.core.services.view.CreateViewForKindOperation) { return provides((org.eclipse.gmf.runtime.diagram.core.services.view.CreateViewForKindOperation) operation); } - «_assert('operation instanceof org.eclipse.gmf.runtime.diagram.core.services.view.CreateViewOperation')» + «_assert('operation instanceof org.eclipse.gmf.runtime.diagram.core.services.view.CreateViewOperation')» /* we check this view provider is the good one for the currently edited diagram */ if (operation instanceof org.eclipse.gmf.runtime.diagram.core.services.view.CreateChildViewOperation) { @@ -90,7 +90,7 @@ import xpt.editor.VisualIDRegistry return false; } - «generatedMemberComment» + «generatedMemberComment» protected boolean provides(org.eclipse.gmf.runtime.diagram.core.services.view.CreateViewForKindOperation op) { /* if (op.getViewKind() == Node.class) @@ -100,20 +100,20 @@ import xpt.editor.VisualIDRegistry */ // check Diagram Type should be the class diagram - String modelID = «getModelIDMethodCall(it)»(op.getContainerView()); + String modelID = «getModelIDMethodCall(it)»(op.getContainerView()); if(!getDiagramProvidedId().equals(modelID)) { return false; } - String visualID = «getVisualIDMethodCall(it)»(op.getSemanticHint()); + String visualID = «getVisualIDMethodCall(it)»(op.getSemanticHint()); if(org.eclipse.gmf.runtime.notation.Node.class.isAssignableFrom(op.getViewKind())) { - return «canCreateNodeMethodCall(it)»(op.getContainerView(), visualID); + return «canCreateNodeMethodCall(it)»(op.getContainerView(), visualID); } return true; } - «generatedMemberComment» + «generatedMemberComment» protected String getDiagramProvidedId() { /* * Indicates for which diagram this provider works for. @@ -123,15 +123,15 @@ import xpt.editor.VisualIDRegistry * * @return the unique identifier of the diagram for which views are provided. */ - return «VisualIDRegistry::modelID(it)»; + return «VisualIDRegistry::modelID(it)»; } - «generatedMemberComment»«/* When diagram domain element is null only diagram kind is checked */» + «generatedMemberComment»«/* When diagram domain element is null only diagram kind is checked */» protected boolean provides(org.eclipse.gmf.runtime.diagram.core.services.view.CreateDiagramViewOperation op) { - return «VisualIDRegistry::modelID(it)».equals(op.getSemanticHint())«IF domainDiagramElement != null» && «xptVisualIDRegistry.getDiagramVisualIDMethodCall(it)»(getSemanticElement(op.getSemanticAdapter())) != null && !«xptVisualIDRegistry.getDiagramVisualIDMethodCall(it)»(getSemanticElement(op.getSemanticAdapter())).isEmpty()«ENDIF»; + return «VisualIDRegistry::modelID(it)».equals(op.getSemanticHint())«IF domainDiagramElement != null» && «xptVisualIDRegistry.getDiagramVisualIDMethodCall(it)»(getSemanticElement(op.getSemanticAdapter())) != null && !«xptVisualIDRegistry.getDiagramVisualIDMethodCall(it)»(getSemanticElement(op.getSemanticAdapter())).isEmpty()«ENDIF»; } - «generatedMemberComment» + «generatedMemberComment» protected boolean provides(org.eclipse.gmf.runtime.diagram.core.services.view.CreateNodeViewOperation op) { if (op.getContainerView() == null) { return false; @@ -143,19 +143,19 @@ import xpt.editor.VisualIDRegistry // Semantic hint is not specified. Can be a result of call from CanonicalEditPolicy. // In this situation there should be NO elementType, visualID will be determined // by VisualIDRegistry.getNodeVisualID() for domainElement. - if (elementType != null || domainElement == null) {«/* XXX Perhaps, better to fix CanonicalEP instead of this hack? */» + if (elementType != null || domainElement == null) {«/* XXX Perhaps, better to fix CanonicalEP instead of this hack? */» return false; } - visualID = «xptVisualIDRegistry.getNodeVisualIDMethodCall(it)»(op.getContainerView(), domainElement); + visualID = «xptVisualIDRegistry.getNodeVisualIDMethodCall(it)»(op.getContainerView(), domainElement); } else { - visualID = «xptVisualIDRegistry.getVisualIDMethodCall(it)»(op.getSemanticHint()); - if (elementType != null) {«/* + visualID = «xptVisualIDRegistry.getVisualIDMethodCall(it)»(op.getSemanticHint()); + if (elementType != null) {«/* Semantic hint is specified together with element type. Both parameters should describe exactly the same diagram element. In addition we check that visualID returned by VisualIDRegistry.getNodeVisualID() for - domainElement (if specified) is the same as in element type. */» + domainElement (if specified) is the same as in element type. */» - if (!«getElementTypesQualifiedClassName()».isKnownElementType(elementType) || (!(elementType instanceof org.eclipse.gmf.runtime.emf.type.core.IHintedType))) { + if (!«getElementTypesQualifiedClassName()».isKnownElementType(elementType) || (!(elementType instanceof org.eclipse.gmf.runtime.emf.type.core.IHintedType))) { return false; // foreign element type } @@ -163,56 +163,56 @@ import xpt.editor.VisualIDRegistry if (!op.getSemanticHint().equals(elementTypeHint)) { return false; // if semantic hint is specified it should be the same as in element type } - //if (domainElement != null && !visualID.equals(«getNodeVisualIDMethodCall(it)»(op.getContainerView(), domainElement))) { + //if (domainElement != null && !visualID.equals(«getNodeVisualIDMethodCall(it)»(op.getContainerView(), domainElement))) { // return false; // visual id for node EClass should match visual id from element type //} - } else {«/* + } else {«/* Element type is not specified. Domain element should be present (except pure design elements). This method is called with EObjectAdapter as parameter from: - ViewService.createNode(View container, EObject eObject, String type, PreferencesHint preferencesHint) - - generated ViewFactory.decorateView() for parent element */» - «IF ! getAllTypedElements(it).filter[e|e.elementType != null].empty» - if (!«VisualIDRegistry::modelID(it)».equals(«xptVisualIDRegistry.getModelIDMethodCall(it)»(op.getContainerView()))) { + - generated ViewFactory.decorateView() for parent element */» + «IF ! getAllTypedElements(it).filter[e|e.elementType != null].empty» + if (!«VisualIDRegistry::modelID(it)».equals(«xptVisualIDRegistry.getModelIDMethodCall(it)»(op.getContainerView()))) { return false; // foreign diagram } if (visualID != null) { switch (visualID) { - «IF getAllNodes().exists[e|e.elementType instanceof NotationType]» - «FOR e : getAllNodes().map[e|e.elementType].filter(typeof(NotationType))» - «localCaseVisualID(e)» - «ENDFOR» + «IF getAllNodes().exists[e|e.elementType instanceof NotationType]» + «FOR e : getAllNodes().map[e|e.elementType].filter(typeof(NotationType))» + «localCaseVisualID(e)» + «ENDFOR» break; // pure design element - «ENDIF» - «IF getAllNodes().exists[e|e.elementType instanceof MetamodelType || e.elementType instanceof SpecializationType]» - «FOR e : getAllNodes().map[e|e.elementType].filter(typeof(MetamodelType))» - «localCaseVisualID(e)» - «ENDFOR» - «FOR e : getAllNodes().map[e|e.elementType].filter(typeof(SpecializationType))» - «localCaseVisualID(e)» - «ENDFOR» - if (domainElement == null || !visualID.equals(«xptVisualIDRegistry.getNodeVisualIDMethodCall(it)»(op.getContainerView(), domainElement))) { + «ENDIF» + «IF getAllNodes().exists[e|e.elementType instanceof MetamodelType || e.elementType instanceof SpecializationType]» + «FOR e : getAllNodes().map[e|e.elementType].filter(typeof(MetamodelType))» + «localCaseVisualID(e)» + «ENDFOR» + «FOR e : getAllNodes().map[e|e.elementType].filter(typeof(SpecializationType))» + «localCaseVisualID(e)» + «ENDFOR» + if (domainElement == null || !visualID.equals(«xptVisualIDRegistry.getNodeVisualIDMethodCall(it)»(op.getContainerView(), domainElement))) { return false; // visual id in semantic hint should match visual id for domain element } - break;«/*FIXME: Perhaps, can return true or false right away, without any further check?*/» - «ENDIF» + break;«/*FIXME: Perhaps, can return true or false right away, without any further check?*/» + «ENDIF» default: return false; } } - «ELSE» + «ELSE» return false; - «ENDIF» + «ENDIF» } } - return «canCreateNodeMethodCall(it)»(op.getContainerView(), visualID); + return «canCreateNodeMethodCall(it)»(op.getContainerView(), visualID); } - «generatedMemberComment»«/* XXX: unlike createNode, we don't check op.containerView() for null here. On purpose? */» + «generatedMemberComment»«/* XXX: unlike createNode, we don't check op.containerView() for null here. On purpose? */» protected boolean provides(org.eclipse.gmf.runtime.diagram.core.services.view.CreateEdgeViewOperation op) { org.eclipse.gmf.runtime.emf.type.core.IElementType elementType = getSemanticElementType(op.getSemanticAdapter()); - if (!«getElementTypesQualifiedClassName()».isKnownElementType(elementType) || (!(elementType instanceof org.eclipse.gmf.runtime.emf.type.core.IHintedType))) { + if (!«getElementTypesQualifiedClassName()».isKnownElementType(elementType) || (!(elementType instanceof org.eclipse.gmf.runtime.emf.type.core.IHintedType))) { return false; // foreign element type } @@ -220,101 +220,101 @@ import xpt.editor.VisualIDRegistry if (elementTypeHint == null || (op.getSemanticHint() != null && !elementTypeHint.equals(op.getSemanticHint()))) { return false; // our hint is visual id and must be specified, and it should be the same as in element type } - //String visualID = «getVisualIDMethodCall(it)»(elementTypeHint); + //String visualID = «getVisualIDMethodCall(it)»(elementTypeHint); //org.eclipse.emf.ecore.EObject domainElement = getSemanticElement(op.getSemanticAdapter()); - //if (domainElement != null && !visualID.equals(«getLinkWithClassVisualIDMethodCall(it)»(domainElement))) { + //if (domainElement != null && !visualID.equals(«getLinkWithClassVisualIDMethodCall(it)»(domainElement))) { // return false; // visual id for link EClass should match visual id from element type //} - return true; «««Does it make sense to check visualID here, like we did for nodes? + return true; «««Does it make sense to check visualID here, like we did for nodes? } - «generatedMemberComment» + «generatedMemberComment» @SuppressWarnings("unchecked") public org.eclipse.gmf.runtime.notation.Diagram createDiagram(org.eclipse.core.runtime.IAdaptable semanticAdapter, String diagramKind, org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint preferencesHint) { - org.eclipse.gmf.runtime.notation.Diagram diagram = org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createDiagram();«/* FIXME instantiate diagramRunTimeClass instead */» - org.eclipse.papyrus.infra.gmfdiag.common.reconciler.DiagramVersioningUtils.stampCurrentVersion(diagram);«/* Papyrus specific diagram versioning */» + org.eclipse.gmf.runtime.notation.Diagram diagram = org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createDiagram();«/* FIXME instantiate diagramRunTimeClass instead */» + org.eclipse.papyrus.infra.gmfdiag.common.reconciler.DiagramVersioningUtils.stampCurrentVersion(diagram);«/* Papyrus specific diagram versioning */» diagram.getStyles().add(org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createDiagramStyle()); - «xptViewStyles.addCustomStyles(it, 'diagram.getStyles()')» - diagram.setType(«VisualIDRegistry::modelID(it)»); - diagram.setElement(«IF domainDiagramElement != null»getSemanticElement(semanticAdapter)«ELSE»null«ENDIF»); - «IF units != null» - diagram.setMeasurementUnit(org.eclipse.gmf.runtime.notation.MeasurementUnit.«units.toUpperCase»_LITERAL); - «ENDIF» - «IF ! styles.empty» + «xptViewStyles.addCustomStyles(it, 'diagram.getStyles()')» + diagram.setType(«VisualIDRegistry::modelID(it)»); + diagram.setElement(«IF domainDiagramElement != null»getSemanticElement(semanticAdapter)«ELSE»null«ENDIF»); + «IF units != null» + diagram.setMeasurementUnit(org.eclipse.gmf.runtime.notation.MeasurementUnit.«units.toUpperCase»_LITERAL); + «ENDIF» + «IF ! styles.empty» // initializeFromPreferences org.eclipse.jface.preferences.IPreferenceStore store = (org.eclipse.jface.preferences.IPreferenceStore) preferencesHint.getPreferenceStore(); - «initializeStyles(it, 'diagram', 'store', false, false, false)» - «ENDIF» + «initializeStyles(it, 'diagram', 'store', false, false, false)» + «ENDIF» return diagram; } - «generatedMemberComment» + «generatedMemberComment» public org.eclipse.gmf.runtime.notation.Node createNode(org.eclipse.core.runtime.IAdaptable semanticAdapter, org.eclipse.gmf.runtime.notation.View containerView, String semanticHint, int index, boolean persisted, org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint preferencesHint) { final org.eclipse.emf.ecore.EObject domainElement = getSemanticElement(semanticAdapter); final String visualID; if (semanticHint == null) { - visualID = «xptVisualIDRegistry.getNodeVisualIDMethodCall(it)»(containerView, domainElement); + visualID = «xptVisualIDRegistry.getNodeVisualIDMethodCall(it)»(containerView, domainElement); } else { - visualID = «xptVisualIDRegistry.getVisualIDMethodCall(it)»(semanticHint); + visualID = «xptVisualIDRegistry.getVisualIDMethodCall(it)»(semanticHint); } if (visualID != null) { switch(visualID) { - «FOR n : getAllNodes()» - «xptVisualIDRegistry.caseVisualID(n)» - return create«n.stringUniqueIdentifier»(domainElement, containerView, index, persisted, preferencesHint); - «ENDFOR» + «FOR n : getAllNodes()» + «xptVisualIDRegistry.caseVisualID(n)» + return create«n.stringUniqueIdentifier»(domainElement, containerView, index, persisted, preferencesHint); + «ENDFOR» } } // can't happen, provided #provides(CreateNodeViewOperation) is correct return null; } - «generatedMemberComment» + «generatedMemberComment» public org.eclipse.gmf.runtime.notation.Edge createEdge(org.eclipse.core.runtime.IAdaptable semanticAdapter, org.eclipse.gmf.runtime.notation.View containerView, String semanticHint, int index, boolean persisted, org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint preferencesHint) { org.eclipse.gmf.runtime.emf.type.core.IElementType elementType = getSemanticElementType(semanticAdapter); String elementTypeHint = ((org.eclipse.gmf.runtime.emf.type.core.IHintedType) elementType).getSemanticHint(); - String vid = «xptVisualIDRegistry.getVisualIDMethodCall(it)»(elementTypeHint); + String vid = «xptVisualIDRegistry.getVisualIDMethodCall(it)»(elementTypeHint); if (vid != null) { switch (vid) { - «FOR link : links» - «xptVisualIDRegistry.caseVisualID(link)» - return create«link.stringUniqueIdentifier»(«IF isTypeLink(link)» getSemanticElement(semanticAdapter), «ENDIF»containerView, index, persisted, preferencesHint); - «ENDFOR» + «FOR link : links» + «xptVisualIDRegistry.caseVisualID(link)» + return create«link.stringUniqueIdentifier»(«IF isTypeLink(link)» getSemanticElement(semanticAdapter), «ENDIF»containerView, index, persisted, preferencesHint); + «ENDFOR» } } // can never happen, provided #provides(CreateEdgeViewOperation) is correct return null; } - «FOR next : getAllNodes()» - «createNodeMethod(next)» - «ENDFOR» - «FOR next : links» - «createEdgeMethod(next)» - «ENDFOR» + «FOR next : getAllNodes()» + «createNodeMethod(next)» + «ENDFOR» + «FOR next : links» + «createEdgeMethod(next)» + «ENDFOR» - «IF ! topLevelNodes.empty» - «generatedMemberComment» + «IF ! topLevelNodes.empty» + «generatedMemberComment» protected void stampShortcut(org.eclipse.gmf.runtime.notation.View containerView, org.eclipse.gmf.runtime.notation.Node target) { - if (!«VisualIDRegistry::modelID(it)».equals(«xptVisualIDRegistry.getModelIDMethodCall(it)»(containerView))) { - «addShortcutAnnotation(it, 'target')» + if (!«VisualIDRegistry::modelID(it)».equals(«xptVisualIDRegistry.getModelIDMethodCall(it)»(containerView))) { + «addShortcutAnnotation(it, 'target')» } } - «ENDIF» + «ENDIF» - «IF links.map[l|l.labels].flatten.notEmpty || topLevelNodes.map[n|n.labels].flatten.notEmpty || childNodes.map[n|n.labels].flatten.notEmpty» - «generatedMemberComment» + «IF links.map[l|l.labels].flatten.notEmpty || topLevelNodes.map[n|n.labels].flatten.notEmpty || childNodes.map[n|n.labels].flatten.notEmpty» + «generatedMemberComment» protected org.eclipse.gmf.runtime.notation.Node createLabel(org.eclipse.gmf.runtime.notation.View owner, String hint) { org.eclipse.gmf.runtime.notation.DecorationNode rv = org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createDecorationNode(); rv.setType(hint); org.eclipse.gmf.runtime.diagram.core.util.ViewUtil.insertChildView(owner, rv, org.eclipse.gmf.runtime.diagram.core.util.ViewUtil.APPEND, true); return rv; } - «ENDIF» + «ENDIF» - «IF getAllNodes().map[n|n.compartments].flatten.notEmpty» - «generatedMemberComment» + «IF getAllNodes().map[n|n.compartments].flatten.notEmpty» + «generatedMemberComment» protected org.eclipse.gmf.runtime.notation.Node createCompartment(org.eclipse.gmf.runtime.notation.View owner, String hint, boolean canCollapse, boolean hasTitle, boolean canSort, boolean canFilter) { //SemanticListCompartment rv = NotationFactory.eINSTANCE.createSemanticListCompartment(); //rv.setShowTitle(showTitle); @@ -337,86 +337,86 @@ import xpt.editor.VisualIDRegistry org.eclipse.gmf.runtime.diagram.core.util.ViewUtil.insertChildView(owner, rv, org.eclipse.gmf.runtime.diagram.core.util.ViewUtil.APPEND, true); return rv; } - «ENDIF» + «ENDIF» - «getSemanticElementMethod(it)» - «getSemanticElementTypeMethod(it)» - «additions(it)» + «getSemanticElementMethod(it)» + «getSemanticElementTypeMethod(it)» + «additions(it)» } ''' override dispatch createNodeMethod(GenNode it) ''' - «generatedMemberComment» - public org.eclipse.gmf.runtime.notation.Node create«stringUniqueIdentifier»(org.eclipse.emf.ecore.EObject domainElement, org.eclipse.gmf.runtime.notation.View containerView, int index, boolean persisted, org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint preferencesHint) { - «IF canUseShapeStyle(viewmap)» + «generatedMemberComment» + public org.eclipse.gmf.runtime.notation.Node create«stringUniqueIdentifier»(org.eclipse.emf.ecore.EObject domainElement, org.eclipse.gmf.runtime.notation.View containerView, int index, boolean persisted, org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint preferencesHint) { + «IF canUseShapeStyle(viewmap)» org.eclipse.gmf.runtime.notation.Shape node = org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createShape(); - «ELSE» + «ELSE» org.eclipse.gmf.runtime.notation.Node node = org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createNode(); - node.getStyles().add(org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createDescriptionStyle());«/* FIXME Contionally add this style, whether toolsmith needs Notes or not */» - «xptViewStyles.addFontLineFillStylesConditionally(it.viewmap, 'node.getStyles()')» - «ENDIF» - «xptViewStyles.addLinkedDiagramStyle(it, 'node.getStyles()')» - «xptViewStyles.addCustomStyles(it, 'node.getStyles()')» + node.getStyles().add(org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createDescriptionStyle());«/* FIXME Contionally add this style, whether toolsmith needs Notes or not */» + «xptViewStyles.addFontLineFillStylesConditionally(it.viewmap, 'node.getStyles()')» + «ENDIF» + «xptViewStyles.addLinkedDiagramStyle(it, 'node.getStyles()')» + «xptViewStyles.addCustomStyles(it, 'node.getStyles()')» node.setLayoutConstraint(org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createBounds()); - node.setType(«xptVisualIDRegistry.typeMethodCall(it)»); + node.setType(«xptVisualIDRegistry.typeMethodCall(it)»); org.eclipse.gmf.runtime.diagram.core.util.ViewUtil.insertChildView(containerView, node, index, persisted); node.setElement(domainElement); - «IF it instanceof GenTopLevelNode» + «IF it instanceof GenTopLevelNode» stampShortcut(containerView, node); - «ENDIF» - // initializeFromPreferences «/* XXX Perhaps, do init only once, for complete figure? */» + «ENDIF» + // initializeFromPreferences «/* XXX Perhaps, do init only once, for complete figure? */» final org.eclipse.jface.preference.IPreferenceStore prefStore = (org.eclipse.jface.preference.IPreferenceStore) preferencesHint.getPreferenceStore(); - «initializeStyles(it, 'node', 'prefStore', !isFixedForeground(viewmap), !isFixedBackground(viewmap), !isFixedFont(viewmap))» - «FOR label : it.labels» - «initLabel(label, 'node', 'prefStore')» - «ENDFOR» - «FOR comp : it.compartments» - «initCompartment(comp, 'node', 'prefStore')» - «ENDFOR» - ««« BEGIN Papyrus Modification - «IF compartments.size != 0» - org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper.initCompartmentsStatusFromPrefs(«'node'», «'prefStore'», "«elementType.displayName»"); - «ENDIF» - ««« END Papyrus Modification - «initLabelVisibility(it,'node', 'prefStore')» + «initializeStyles(it, 'node', 'prefStore', !isFixedForeground(viewmap), !isFixedBackground(viewmap), !isFixedFont(viewmap))» + «FOR label : it.labels» + «initLabel(label, 'node', 'prefStore')» + «ENDFOR» + «FOR comp : it.compartments» + «initCompartment(comp, 'node', 'prefStore')» + «ENDFOR» + ««« BEGIN Papyrus Modification + «IF compartments.size != 0» + org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper.initCompartmentsStatusFromPrefs(«'node'», «'prefStore'», "«elementType.displayName»"); + «ENDIF» + ««« END Papyrus Modification + «initLabelVisibility(it,'node', 'prefStore')» return node; } ''' // Location as layoutConstraint, no children override dispatch createNodeMethod(GenChildLabelNode it) ''' - «generatedMemberComment» - public org.eclipse.gmf.runtime.notation.Node create«stringUniqueIdentifier»(org.eclipse.emf.ecore.EObject domainElement, org.eclipse.gmf.runtime.notation.View containerView, int index, boolean persisted, org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint preferencesHint) { + «generatedMemberComment» + public org.eclipse.gmf.runtime.notation.Node create«stringUniqueIdentifier»(org.eclipse.emf.ecore.EObject domainElement, org.eclipse.gmf.runtime.notation.View containerView, int index, boolean persisted, org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint preferencesHint) { org.eclipse.gmf.runtime.notation.Node node = org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createShape(); - node.setLayoutConstraint(org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createLocation());«/* [artem] XXX not sure, why LabelNode needs location */» - «xptViewStyles.addLinkedDiagramStyle(it, 'node.getStyles()')» - «xptViewStyles.addCustomStyles(it, 'node.getStyles()')» - node.setType(«xptVisualIDRegistry.typeMethodCall(it)»); + node.setLayoutConstraint(org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createLocation());«/* [artem] XXX not sure, why LabelNode needs location */» + «xptViewStyles.addLinkedDiagramStyle(it, 'node.getStyles()')» + «xptViewStyles.addCustomStyles(it, 'node.getStyles()')» + node.setType(«xptVisualIDRegistry.typeMethodCall(it)»); org.eclipse.gmf.runtime.diagram.core.util.ViewUtil.insertChildView(containerView, node, index, persisted); node.setElement(domainElement); final org.eclipse.jface.preference.IPreferenceStore prefStore = (org.eclipse.jface.preference.IPreferenceStore) preferencesHint.getPreferenceStore(); - «initFontFromPrefs(it,'node', 'prefStore')» - «initForegroundFromPrefs(it,'node', 'prefStore')» + «initFontFromPrefs(it,'node', 'prefStore')» + «initForegroundFromPrefs(it,'node', 'prefStore')» return node; } ''' override createEdgeMethod(GenLink it) ''' - «generatedMemberComment» - public org.eclipse.gmf.runtime.notation.Edge create«stringUniqueIdentifier»(«IF isTypeLink(it)»org.eclipse.emf.ecore.EObject domainElement, «ENDIF»org.eclipse.gmf.runtime.notation.View containerView, int index, boolean persisted, org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint preferencesHint) { - «IF isFixedForeground(viewmap)» + «generatedMemberComment» + public org.eclipse.gmf.runtime.notation.Edge create«stringUniqueIdentifier»(«IF isTypeLink(it)»org.eclipse.emf.ecore.EObject domainElement, «ENDIF»org.eclipse.gmf.runtime.notation.View containerView, int index, boolean persisted, org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint preferencesHint) { + «IF isFixedForeground(viewmap)» org.eclipse.gmf.runtime.notation.Edge edge = org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createEdge(); edge.getStyles().add(org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createRoutingStyle()); - «ELSE» + «ELSE» org.eclipse.gmf.runtime.notation.Connector edge = org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createConnector(); - «ENDIF» - «IF !isFixedFont(viewmap)» + «ENDIF» + «IF !isFixedFont(viewmap)» edge.getStyles().add(org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createFontStyle()); - «ENDIF» - «xptViewStyles.addCustomStyles(it, 'edge.getStyles()')» + «ENDIF» + «xptViewStyles.addCustomStyles(it, 'edge.getStyles()')» org.eclipse.gmf.runtime.notation.RelativeBendpoints bendpoints = org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createRelativeBendpoints(); java.util.List<org.eclipse.gmf.runtime.notation.datatype.RelativeBendpoint> points = new java.util.ArrayList<org.eclipse.gmf.runtime.notation.datatype.RelativeBendpoint>(2); points.add(new org.eclipse.gmf.runtime.notation.datatype.RelativeBendpoint()); @@ -424,26 +424,26 @@ import xpt.editor.VisualIDRegistry bendpoints.setPoints(points); edge.setBendpoints(bendpoints); org.eclipse.gmf.runtime.diagram.core.util.ViewUtil.insertChildView(containerView, edge, index, persisted); - edge.setType(«xptVisualIDRegistry.typeMethodCall(it)»); - edge.setElement(«IF isTypeLink(it)»domainElement«ELSE»null«ENDIF»); + edge.setType(«xptVisualIDRegistry.typeMethodCall(it)»); + edge.setElement(«IF isTypeLink(it)»domainElement«ELSE»null«ENDIF»); // initializePreferences final org.eclipse.jface.preference.IPreferenceStore prefStore = (org.eclipse.jface.preference.IPreferenceStore) preferencesHint.getPreferenceStore(); - «initializeStyles(it, 'edge', 'prefStore', !isFixedForeground(viewmap), false, !isFixedFont(viewmap))» + «initializeStyles(it, 'edge', 'prefStore', !isFixedForeground(viewmap), false, !isFixedFont(viewmap))» //org.eclipse.gmf.runtime.notation.Routing routing = org.eclipse.gmf.runtime.notation.Routing.get(prefStore.getInt(org.eclipse.gmf.runtime.diagram.ui.preferences.IPreferenceConstants.PREF_LINE_STYLE)); //if (routing != null) { // org.eclipse.gmf.runtime.diagram.core.util.ViewUtil.setStructuralFeatureValue(edge, org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getRoutingStyle_Routing(), routing); //} - «initRountingFromPrefs(it,'edge', 'prefStore')» - «FOR label : it.labels» - «initLabel(label, 'edge', 'prefStore')» - «ENDFOR» - «initLabelVisibility(it,'edge', 'prefStore')» + «initRountingFromPrefs(it,'edge', 'prefStore')» + «FOR label : it.labels» + «initLabel(label, 'edge', 'prefStore')» + «ENDFOR» + «initLabelVisibility(it,'edge', 'prefStore')» return edge; } ''' override getSemanticElementMethod(GenDiagram it) ''' - «generatedMemberComment» + «generatedMemberComment» protected org.eclipse.emf.ecore.EObject getSemanticElement(org.eclipse.core.runtime.IAdaptable semanticAdapter) { if (semanticAdapter == null) { return null; @@ -457,7 +457,7 @@ import xpt.editor.VisualIDRegistry ''' override getSemanticElementTypeMethod(GenDiagram it) ''' - «generatedMemberComment» + «generatedMemberComment» protected org.eclipse.gmf.runtime.emf.type.core.IElementType getSemanticElementType(org.eclipse.core.runtime.IAdaptable semanticAdapter) { if (semanticAdapter == null) { return null; @@ -466,39 +466,39 @@ import xpt.editor.VisualIDRegistry } ''' override initLabel(GenLabel it, String nodeVar, String prefStoreVar) ''' - «var String labelVar = it.stringUniqueIdentifier.toFirstLower» - org.eclipse.gmf.runtime.notation.Node «labelVar» = createLabel(«nodeVar», «xptVisualIDRegistry.typeMethodCall(it)»); - «IF it.modelFacet !=null» - «xptViewStyles.addTextStyle(it.modelFacet, labelVar + '.getStyles()')» - «ENDIF» - «xptViewStyles.addCustomStyles(it, labelVar + '.getStyles()')» - «IF it.oclIsKindOf(typeof(GenExternalNodeLabel)) || it.oclIsKindOf(typeof(GenLinkLabel))» - «labelVar».setLayoutConstraint(org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createLocation()); - «xptViewStyles.offset(it, labelVar)» - «ENDIF» - «initializeStyles(it, labelVar, prefStoreVar, false, false, false)» + «var String labelVar = it.stringUniqueIdentifier.toFirstLower» + org.eclipse.gmf.runtime.notation.Node «labelVar» = createLabel(«nodeVar», «xptVisualIDRegistry.typeMethodCall(it)»); + «IF it.modelFacet !=null» + «xptViewStyles.addTextStyle(it.modelFacet, labelVar + '.getStyles()')» + «ENDIF» + «xptViewStyles.addCustomStyles(it, labelVar + '.getStyles()')» + «IF it.oclIsKindOf(typeof(GenExternalNodeLabel)) || it.oclIsKindOf(typeof(GenLinkLabel))» + «labelVar».setLayoutConstraint(org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createLocation()); + «xptViewStyles.offset(it, labelVar)» + «ENDIF» + «initializeStyles(it, labelVar, prefStoreVar, false, false, false)» ''' override def initCompartment(GenCompartment it, String nodeVar, String prefStoreVar) ''' - «var String compartmentVar= it.stringUniqueIdentifier.toFirstLower» - «IF it.styles.notEmpty || isStoringChildPositions(it.layoutType)»org.eclipse.gmf.runtime.notation.Node «compartmentVar» = «ENDIF»createCompartment(«nodeVar», «xptVisualIDRegistry.typeMethodCall(it)», «canCollapse», «needsTitle», «listLayout», «listLayout»); - «xptViewStyles.addCustomStyles(it, compartmentVar + '.getStyles()')» - «IF isStoringChildPositions(it.layoutType)» - «IF viewmap.canUseShapeStyle()» - «compartmentVar».add(org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createShapeStyle()); - «ELSE /* Intentionally not adding Description style, as it deemed to be useless for compartments (can't avoid for ShapeStyle - benefits of a single style overwheight drawbacks of Description presence) */» - «xptViewStyles.addFontLineFillStylesConditionally(it.viewmap, compartmentVar + '.getStyles()')» - «ENDIF» - «compartmentVar».setLayoutConstraint(org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createBounds()); - «initializeStyles(it, compartmentVar, prefStoreVar, !viewmap.isFixedForeground(), !viewmap.isFixedBackground(), !viewmap.isFixedFont())» - «ELSE» - «initializeStyles(it, compartmentVar, prefStoreVar, false, false, false)» - «ENDIF» + «var String compartmentVar= it.stringUniqueIdentifier.toFirstLower» + «IF it.styles.notEmpty || isStoringChildPositions(it.layoutType)»org.eclipse.gmf.runtime.notation.Node «compartmentVar» = «ENDIF»createCompartment(«nodeVar», «xptVisualIDRegistry.typeMethodCall(it)», «canCollapse», «needsTitle», «listLayout», «listLayout»); + «xptViewStyles.addCustomStyles(it, compartmentVar + '.getStyles()')» + «IF isStoringChildPositions(it.layoutType)» + «IF viewmap.canUseShapeStyle()» + «compartmentVar».add(org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createShapeStyle()); + «ELSE /* Intentionally not adding Description style, as it deemed to be useless for compartments (can't avoid for ShapeStyle - benefits of a single style overwheight drawbacks of Description presence) */» + «xptViewStyles.addFontLineFillStylesConditionally(it.viewmap, compartmentVar + '.getStyles()')» + «ENDIF» + «compartmentVar».setLayoutConstraint(org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createBounds()); + «initializeStyles(it, compartmentVar, prefStoreVar, !viewmap.isFixedForeground(), !viewmap.isFixedBackground(), !viewmap.isFixedFont())» + «ELSE» + «initializeStyles(it, compartmentVar, prefStoreVar, false, false, false)» + «ENDIF» ''' override additions(GenDiagram it)''' - «generatedMemberComment» + «generatedMemberComment» private void initFontStyleFromPrefs(org.eclipse.gmf.runtime.notation.View view, final org.eclipse.jface.preference.IPreferenceStore store, String elementName) { String fontConstant = org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper.getElementConstant(elementName, org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper.FONT); @@ -518,7 +518,7 @@ override additions(GenDiagram it)''' } } - «generatedMemberComment» + «generatedMemberComment» private void initForegroundFromPrefs(org.eclipse.gmf.runtime.notation.View view, final org.eclipse.jface.preference.IPreferenceStore store, String elementName) { String lineColorConstant = org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper.getElementConstant(elementName, org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper.COLOR_LINE); @@ -526,7 +526,7 @@ override additions(GenDiagram it)''' org.eclipse.gmf.runtime.diagram.core.util.ViewUtil.setStructuralFeatureValue(view, org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getLineStyle_LineColor(), org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities.RGBToInteger(lineRGB)); } - «generatedMemberComment» + «generatedMemberComment» private void initBackgroundFromPrefs(org.eclipse.gmf.runtime.notation.View view, final org.eclipse.jface.preference.IPreferenceStore store, String elementName) { String fillColorConstant = org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper.getElementConstant(elementName, org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper.COLOR_FILL); @@ -557,56 +557,56 @@ override additions(GenDiagram it)''' ''' override initFontFromPrefs(GenCommonBase it,String viewVar, String prefStoreVar)''' - «specificInitFontFromPrefs(it,viewVar, prefStoreVar)» + «specificInitFontFromPrefs(it,viewVar, prefStoreVar)» ''' def specificInitFontFromPrefs(GenNode it,String viewVar, String prefStoreVar)''' - «IF !"UNDEFINED".equals(elementType.displayName.toUpperCase())» - org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper.initFontStyleFromPrefs(«viewVar», «prefStoreVar», "«elementType.displayName»"); - «ENDIF» + «IF !"UNDEFINED".equals(elementType.displayName.toUpperCase())» + org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper.initFontStyleFromPrefs(«viewVar», «prefStoreVar», "«elementType.displayName»"); + «ENDIF» ''' def specificInitFontFromPrefs(GenChildNode it,String viewVar, String prefStoreVar) ''' -«IF !"UNDEFINED".equals(elementType.displayName.toUpperCase())» - org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper.initFontStyleFromPrefs(«viewVar», «prefStoreVar», "«elementType.displayName»"); - «ENDIF» +«IF !"UNDEFINED".equals(elementType.displayName.toUpperCase())» + org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper.initFontStyleFromPrefs(«viewVar», «prefStoreVar», "«elementType.displayName»"); + «ENDIF» ''' def specificInitFontFromPrefs(GenLink it,String viewVar, String prefStoreVar) ''' - «IF !"UNDEFINED".equals(elementType.displayName.toUpperCase())» - org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper.initFontStyleFromPrefs(«viewVar», «prefStoreVar», "«elementType.displayName»"); - «ENDIF» + «IF !"UNDEFINED".equals(elementType.displayName.toUpperCase())» + org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper.initFontStyleFromPrefs(«viewVar», «prefStoreVar», "«elementType.displayName»"); + «ENDIF» ''' def specificInitFontFromPrefs(GenCommonBase it,String viewVar, String prefStoreVar) ''' -«IF !"UNDEFINED".equals(elementType.displayName.toUpperCase())» - org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper.initFontStyleFromPrefs(«viewVar», «prefStoreVar», "«elementType.displayName»"); - «ENDIF» +«IF !"UNDEFINED".equals(elementType.displayName.toUpperCase())» + org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper.initFontStyleFromPrefs(«viewVar», «prefStoreVar», "«elementType.displayName»"); + «ENDIF» ''' override initForegroundFromPrefs(GenCommonBase it,String viewVar, String prefStoreVar) ''' - «specificInitForegroundFromPrefs(it,viewVar, prefStoreVar)» + «specificInitForegroundFromPrefs(it,viewVar, prefStoreVar)» ''' def specificInitForegroundFromPrefs(GenNode it,String viewVar, String prefStoreVar)''' - «IF !"UNDEFINED".equals(elementType.displayName.toUpperCase())» - org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper.initForegroundFromPrefs(«viewVar», «prefStoreVar», "«elementType.displayName»"); - «ENDIF» + «IF !"UNDEFINED".equals(elementType.displayName.toUpperCase())» + org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper.initForegroundFromPrefs(«viewVar», «prefStoreVar», "«elementType.displayName»"); + «ENDIF» ''' def specificInitForegroundFromPrefs(GenChildNode it,String viewVar, String prefStoreVar) ''' - «IF !"UNDEFINED".equals(elementType.displayName.toUpperCase())» - org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper.initForegroundFromPrefs(«viewVar», «prefStoreVar», "«elementType.displayName»"); - «ENDIF» + «IF !"UNDEFINED".equals(elementType.displayName.toUpperCase())» + org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper.initForegroundFromPrefs(«viewVar», «prefStoreVar», "«elementType.displayName»"); + «ENDIF» ''' def specificInitForegroundFromPrefs(GenLink it,String viewVar, String prefStoreVar) ''' - «IF !"UNDEFINED".equals(elementType.displayName.toUpperCase())» - org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper.initForegroundFromPrefs(«viewVar», «prefStoreVar», "«elementType.displayName»"); - «ENDIF» + «IF !"UNDEFINED".equals(elementType.displayName.toUpperCase())» + org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper.initForegroundFromPrefs(«viewVar», «prefStoreVar», "«elementType.displayName»"); + «ENDIF» ''' def specificInitForegroundFromPrefs(GenCommonBase it,String viewVar, String prefStoreVar) ''' @@ -617,25 +617,25 @@ def specificInitForegroundFromPrefs(GenCommonBase it,String viewVar, String pref override initBackgroundFromPrefs(GenCommonBase it,String viewVar, String prefStoreVar) ''' - « specificInitBackgroundFromPrefs(it,viewVar, prefStoreVar) » + « specificInitBackgroundFromPrefs(it,viewVar, prefStoreVar) » ''' def specificInitBackgroundFromPrefs(GenNode it,String viewVar, String prefStoreVar) ''' - «IF !"UNDEFINED".equals(elementType.displayName.toUpperCase())» - org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper.initBackgroundFromPrefs(«viewVar», «prefStoreVar», "«elementType.displayName»"); - «ENDIF» + «IF !"UNDEFINED".equals(elementType.displayName.toUpperCase())» + org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper.initBackgroundFromPrefs(«viewVar», «prefStoreVar», "«elementType.displayName»"); + «ENDIF» ''' def specificInitBackgroundFromPrefs(GenChildNode it,String viewVar, String prefStoreVar) ''' - «IF !"UNDEFINED".equals(elementType.displayName.toUpperCase())» - org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper.initBackgroundFromPrefs(«viewVar», «prefStoreVar», "«elementType.displayName»"); - «ENDIF» + «IF !"UNDEFINED".equals(elementType.displayName.toUpperCase())» + org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper.initBackgroundFromPrefs(«viewVar», «prefStoreVar», "«elementType.displayName»"); + «ENDIF» ''' def specificInitBackgroundFromPrefs(GenLink it, String viewVar, String prefStoreVar) ''' - «IF !"UNDEFINED".equals(elementType.displayName.toUpperCase())» - org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper.initBackgroundFromPrefs(«viewVar», «prefStoreVar», "«elementType.displayName»"); - «ENDIF» + «IF !"UNDEFINED".equals(elementType.displayName.toUpperCase())» + org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper.initBackgroundFromPrefs(«viewVar», «prefStoreVar», "«elementType.displayName»"); + «ENDIF» ''' def specificInitBackgroundFromPrefs(GenCommonBase it,String viewVar, String prefStoreVar) ''' @@ -643,25 +643,25 @@ def specificInitBackgroundFromPrefs(GenCommonBase it,String viewVar, String pref def initRountingFromPrefs(GenCommonBase it,String viewVar, String prefStoreVar) ''' - « specificInitRountingFromPrefs(it,viewVar, prefStoreVar)» + « specificInitRountingFromPrefs(it,viewVar, prefStoreVar)» ''' def specificInitRountingFromPrefs(GenNode it,String viewVar, String prefStoreVar) ''' - «IF !"UNDEFINED".equals(elementType.displayName.toUpperCase())» - org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper.initRountingFromPrefs(«viewVar», «prefStoreVar», "«elementType.displayName»"); - «ENDIF» + «IF !"UNDEFINED".equals(elementType.displayName.toUpperCase())» + org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper.initRountingFromPrefs(«viewVar», «prefStoreVar», "«elementType.displayName»"); + «ENDIF» ''' def specificInitRountingFromPrefs(GenChildNode it,String viewVar, String prefStoreVar) ''' - «IF !"UNDEFINED".equals(elementType.displayName.toUpperCase())» - org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper.initRountingFromPrefs(«viewVar», «prefStoreVar», "«elementType.displayName»"); - «ENDIF» + «IF !"UNDEFINED".equals(elementType.displayName.toUpperCase())» + org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper.initRountingFromPrefs(«viewVar», «prefStoreVar», "«elementType.displayName»"); + «ENDIF» ''' def specificInitRountingFromPrefs(GenLink it, String viewVar, String prefStoreVar) ''' - «IF !"UNDEFINED".equals(elementType.displayName.toUpperCase())» - org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper.initRountingFromPrefs(«viewVar», «prefStoreVar», "«elementType.displayName»"); - «ENDIF» + «IF !"UNDEFINED".equals(elementType.displayName.toUpperCase())» + org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper.initRountingFromPrefs(«viewVar», «prefStoreVar», "«elementType.displayName»"); + «ENDIF» ''' def specificInitRountingFromPrefs(GenCommonBase it,String viewVar, String prefStoreVar) ''' @@ -670,18 +670,18 @@ def specificInitRountingFromPrefs(GenCommonBase it,String viewVar, String prefSt //write the line to initialize the property isVisible for the label of the link def initLabelVisibility(GenLink it,String viewVar, String prefStoreVar) ''' - «IF it.labels.filter(typeof (GenLinkLabel)).exists[lbl | - (it.eResource.allContents.filter(typeof (LabelVisibilityPreference)).filter[label | label.linkLabels.contains(lbl)]).size !=0]» - org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper.initLabelVisibilityFromPrefs(«viewVar», «prefStoreVar», "«elementType.displayName»"); - «ENDIF» + «IF it.labels.filter(typeof (GenLinkLabel)).exists[lbl | + (it.eResource.allContents.filter(typeof (LabelVisibilityPreference)).filter[label | label.linkLabels.contains(lbl)]).size !=0]» + org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper.initLabelVisibilityFromPrefs(«viewVar», «prefStoreVar», "«elementType.displayName»"); + «ENDIF» ''' //write the line to initialize the property isVisible for the label of the link def initLabelVisibility(GenNode it,String viewVar, String prefStoreVar) ''' - «IF it.labels.filter(typeof (GenExternalNodeLabel)).exists[lbl | - (it.eResource.allContents.filter(typeof (LabelVisibilityPreference)).filter[label | label.externalNodeLabels.contains(lbl)]).size !=0]» - org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper.initLabelVisibilityFromPrefs(«viewVar», «prefStoreVar», "«elementType.displayName»"); - «ENDIF» + «IF it.labels.filter(typeof (GenExternalNodeLabel)).exists[lbl | + (it.eResource.allContents.filter(typeof (LabelVisibilityPreference)).filter[label | label.externalNodeLabels.contains(lbl)]).size !=0]» + org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper.initLabelVisibilityFromPrefs(«viewVar», «prefStoreVar», "«elementType.displayName»"); + «ENDIF» ''' } diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/providers/VisualTypeProvider.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/providers/VisualTypeProvider.xtend index 4d693b7c497..7c9228163f1 100644 --- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/providers/VisualTypeProvider.xtend +++ b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/providers/VisualTypeProvider.xtend @@ -34,27 +34,27 @@ import xpt.providers.ElementTypes @Inject VisualIDRegistry visualIDs @Inject ElementTypes elementTypes - def packageName(GenDiagram it) '''«it.providersPackageName»''' + def packageName(GenDiagram it) '''«it.providersPackageName»''' - def className(GenDiagram it) '''«GenVisualTypeProvider.getClassName(it)»''' + def className(GenDiagram it) '''«GenVisualTypeProvider.getClassName(it)»''' - def qualifiedClassName(GenDiagram it) '''«packageName(it)».«className(it)»''' + def qualifiedClassName(GenDiagram it) '''«packageName(it)».«className(it)»''' protected def constructor(GenDiagram it) ''' - «generatedMemberComment» - public «it.className»() { + «generatedMemberComment» + public «it.className»() { super(); } ''' protected def getElementType_(GenDiagram it) ''' - «generatedMemberComment» - «overrideI» + «generatedMemberComment» + «overrideI» public org.eclipse.gmf.runtime.emf.type.core.IElementType getElementType(org.eclipse.gmf.runtime.notation.Diagram diagram, String viewType) { org.eclipse.gmf.runtime.emf.type.core.IElementType result = null; try { - result = «elementTypes.qualifiedClassName(it)».getElementType(viewType); + result = «elementTypes.qualifiedClassName(it)».getElementType(viewType); } catch (NumberFormatException e) { // Not supported by this diagram } @@ -64,35 +64,35 @@ import xpt.providers.ElementTypes ''' protected def getNodeType(GenDiagram it) ''' - «generatedMemberComment» - «overrideI» + «generatedMemberComment» + «overrideI» public String getNodeType(org.eclipse.gmf.runtime.notation.View parentView, org.eclipse.emf.ecore.EObject element) { - return «visualIDs.getNodeVisualIDMethodCall(it)»(parentView, element); + return «visualIDs.getNodeVisualIDMethodCall(it)»(parentView, element); } ''' protected def getLinkType(GenDiagram it) ''' - «generatedMemberComment» - «overrideI» + «generatedMemberComment» + «overrideI» public String getLinkType(org.eclipse.gmf.runtime.notation.Diagram diagram, org.eclipse.emf.ecore.EObject element) { - return «visualIDs.getLinkWithClassVisualIDMethodCall(it)»(element); + return «visualIDs.getLinkWithClassVisualIDMethodCall(it)»(element); } ''' public def VisualTypeProvider(GenDiagram it) ''' - «editorGen.copyright» - package «packageName»; + «editorGen.copyright» + package «packageName»; - «generatedClassComment» - public class «className» extends org.eclipse.papyrus.infra.gmfdiag.common.service.visualtype.AbstractVisualTypeProvider { + «generatedClassComment» + public class «className» extends org.eclipse.papyrus.infra.gmfdiag.common.service.visualtype.AbstractVisualTypeProvider { - «constructor» + «constructor» - «getElementType_» + «getElementType_» - «getNodeType» + «getNodeType» - «getLinkType» + «getLinkType» } ''' diff --git a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/providers/extensions.xtend b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/providers/extensions.xtend index dd328d3a822..13ba443377f 100644 --- a/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/providers/extensions.xtend +++ b/plugins/toolsmiths/org.eclipse.papyrus.def/xtend/aspects/xpt/providers/extensions.xtend @@ -44,120 +44,120 @@ import xpt.providers.ShortcutsDecoratorProvider @Inject EditHelperAdvice editHelperAdvice; override extensions(GenDiagram it) ''' - «extraLineBreak» - «tripleSpace(1)»<extension point="org.eclipse.gmf.runtime.diagram.core.viewProviders" id="view-provider"> - «tripleSpace(2)»«xmlGeneratedTag» - «tripleSpace(2)»<viewProvider class="«viewProvider.qualifiedClassName(it)»"> - «tripleSpace(3)»<Priority name="«notationViewProviderPriority»"/> - «IF ! shortcutsProvidedFor.empty/*allow provider activation when another diagram tries to create a node, perhaps ours*/» - «tripleSpace(3)»<object id="referencing-diagrams" class="org.eclipse.gmf.runtime.notation.Diagram"> - «tripleSpace(4)»<method name="getType()" value="«FOR s : shortcutsProvidedFor SEPARATOR ','»«s»«ENDFOR»"/> - «tripleSpace(3)»</object> - «tripleSpace(3)»<context viewClass="org.eclipse.gmf.runtime.notation.Node" containerViews="referencing-diagrams"/> - «ENDIF» - «tripleSpace(3)»<context viewClass="org.eclipse.gmf.runtime.notation.Diagram" semanticHints="«editorGen.modelID»"/> - «tripleSpace(3)»<context viewClass="org.eclipse.gmf.runtime.notation.Node" semanticHints="«commaSeparatedVisualIDs(allNodes)»"/> - «IF ! links.empty/*it is unlikely there would be a diagram without a node, but a diagram without links deemed possible */» - «tripleSpace(3)»<context viewClass="org.eclipse.gmf.runtime.notation.Edge" semanticHints="«commaSeparatedVisualIDs(links)»"/> - «ENDIF» - «tripleSpace(2)»</viewProvider> - «tripleSpace(1)»</extension> + «extraLineBreak» + «tripleSpace(1)»<extension point="org.eclipse.gmf.runtime.diagram.core.viewProviders" id="view-provider"> + «tripleSpace(2)»«xmlGeneratedTag» + «tripleSpace(2)»<viewProvider class="«viewProvider.qualifiedClassName(it)»"> + «tripleSpace(3)»<Priority name="«notationViewProviderPriority»"/> + «IF ! shortcutsProvidedFor.empty/*allow provider activation when another diagram tries to create a node, perhaps ours*/» + «tripleSpace(3)»<object id="referencing-diagrams" class="org.eclipse.gmf.runtime.notation.Diagram"> + «tripleSpace(4)»<method name="getType()" value="«FOR s : shortcutsProvidedFor SEPARATOR ','»«s»«ENDFOR»"/> + «tripleSpace(3)»</object> + «tripleSpace(3)»<context viewClass="org.eclipse.gmf.runtime.notation.Node" containerViews="referencing-diagrams"/> + «ENDIF» + «tripleSpace(3)»<context viewClass="org.eclipse.gmf.runtime.notation.Diagram" semanticHints="«editorGen.modelID»"/> + «tripleSpace(3)»<context viewClass="org.eclipse.gmf.runtime.notation.Node" semanticHints="«commaSeparatedVisualIDs(allNodes)»"/> + «IF ! links.empty/*it is unlikely there would be a diagram without a node, but a diagram without links deemed possible */» + «tripleSpace(3)»<context viewClass="org.eclipse.gmf.runtime.notation.Edge" semanticHints="«commaSeparatedVisualIDs(links)»"/> + «ENDIF» + «tripleSpace(2)»</viewProvider> + «tripleSpace(1)»</extension> - «tripleSpace(1)»<extension point="org.eclipse.gmf.runtime.diagram.ui.editpartProviders" id="ep-provider"> - «tripleSpace(2)»«xmlGeneratedTag» - «tripleSpace(2)»<editpartProvider class="«editPartProvider.qualifiedClassName(it)»"> - «tripleSpace(3)»<Priority name="«editPartProviderPriority»"/> - «tripleSpace(3)»<object class="org.eclipse.gmf.runtime.notation.Diagram" id="generated-diagram"> - «tripleSpace(4)»<method name="getType()" value="«editorGen.modelID»"/> - «tripleSpace(3)»</object> - «tripleSpace(3)»<object class="org.eclipse.gmf.runtime.notation.Node" id="generated-nodes"> - «tripleSpace(4)»<method name="getType()" value="«commaSeparatedVisualIDs(allNodes)»"/> - «tripleSpace(3)»</object> - «tripleSpace(3)»<object class="org.eclipse.gmf.runtime.notation.Edge" id="generated-links"> - «tripleSpace(4)»<method name="getType()" value="«commaSeparatedVisualIDs(links)»"/> - «tripleSpace(3)»</object> - «tripleSpace(3)»<object class="org.eclipse.gmf.runtime.notation.Node" id="generated-labels"> - «tripleSpace(4)»<method name="getType()" value="«commaSeparatedVisualIDs(allNodes.map[n|n.labels].flatten)»"/> - «tripleSpace(3)»</object> - «tripleSpace(3)»<object class="org.eclipse.gmf.runtime.notation.Node" id="generated-compartments"> - «tripleSpace(4)»<method name="getType()" value="«commaSeparatedVisualIDs(compartments)»"/> - «tripleSpace(3)»</object> - «tripleSpace(3)»<context views="generated-diagram,generated-nodes,generated-links,generated-labels,generated-compartments"/> - «tripleSpace(2)»</editpartProvider> - «tripleSpace(1)»</extension> + «tripleSpace(1)»<extension point="org.eclipse.gmf.runtime.diagram.ui.editpartProviders" id="ep-provider"> + «tripleSpace(2)»«xmlGeneratedTag» + «tripleSpace(2)»<editpartProvider class="«editPartProvider.qualifiedClassName(it)»"> + «tripleSpace(3)»<Priority name="«editPartProviderPriority»"/> + «tripleSpace(3)»<object class="org.eclipse.gmf.runtime.notation.Diagram" id="generated-diagram"> + «tripleSpace(4)»<method name="getType()" value="«editorGen.modelID»"/> + «tripleSpace(3)»</object> + «tripleSpace(3)»<object class="org.eclipse.gmf.runtime.notation.Node" id="generated-nodes"> + «tripleSpace(4)»<method name="getType()" value="«commaSeparatedVisualIDs(allNodes)»"/> + «tripleSpace(3)»</object> + «tripleSpace(3)»<object class="org.eclipse.gmf.runtime.notation.Edge" id="generated-links"> + «tripleSpace(4)»<method name="getType()" value="«commaSeparatedVisualIDs(links)»"/> + «tripleSpace(3)»</object> + «tripleSpace(3)»<object class="org.eclipse.gmf.runtime.notation.Node" id="generated-labels"> + «tripleSpace(4)»<method name="getType()" value="«commaSeparatedVisualIDs(allNodes.map[n|n.labels].flatten)»"/> + «tripleSpace(3)»</object> + «tripleSpace(3)»<object class="org.eclipse.gmf.runtime.notation.Node" id="generated-compartments"> + «tripleSpace(4)»<method name="getType()" value="«commaSeparatedVisualIDs(compartments)»"/> + «tripleSpace(3)»</object> + «tripleSpace(3)»<context views="generated-diagram,generated-nodes,generated-links,generated-labels,generated-compartments"/> + «tripleSpace(2)»</editpartProvider> + «tripleSpace(1)»</extension> -««« «modelingAssistantProvider(it)» +««« «modelingAssistantProvider(it)» - «tripleSpace(1)»<extension point="org.eclipse.gmf.runtime.common.ui.services.iconProviders" id="icon-provider"> - «tripleSpace(2)»«xmlGeneratedTag» - «tripleSpace(2)»<IconProvider class="«iconProvider.qualifiedClassName(it)»"> - «tripleSpace(3)»<Priority name="«iconProviderPriority»"/> - «tripleSpace(2)»</IconProvider> - «tripleSpace(1)»</extension> - «IF editorGen.labelParsers != null && editorGen.labelParsers.extensibleViaService» - «extraLineBreak» - «tripleSpace(1)»<extension point="org.eclipse.gmf.runtime.common.ui.services.parserProviders" id="parser-provider"> - «tripleSpace(2)»«xmlGeneratedTag» - «tripleSpace(2)»<ParserProvider class="«labelParsers.qualifiedClassName(editorGen.labelParsers)»"> - «tripleSpace(3)»<Priority name="«editorGen.labelParsers.providerPriority»"/> - «tripleSpace(2)»</ParserProvider> - «tripleSpace(1)»</extension> - «ENDIF» - «IF generateShortcutIcon()» - «extraLineBreak» - «tripleSpace(1)»<extension point="org.eclipse.gmf.runtime.diagram.ui.decoratorProviders" id="decorator-provider"> - «tripleSpace(2)»«xmlGeneratedTag» - «tripleSpace(2)»<decoratorProvider class="«shorcutProvider.qualifiedClassName(it)»"> - «tripleSpace(3)»<Priority name="«shortcutsDecoratorProviderPriority»"/> - «tripleSpace(3)»<object class="org.eclipse.gmf.runtime.notation.Node(org.eclipse.gmf.runtime.notation)" id="generated-top-nodes"> - «tripleSpace(4)»<method name="getType()" value="«commaSeparatedVisualIDs(it.topLevelNodes)/*generated code supports shortcuts only to top-level nodes*/»"/> - «tripleSpace(3)»</object> - «tripleSpace(3)»<context decoratorTargets="generated-top-nodes"/> - «tripleSpace(2)»</decoratorProvider> - «tripleSpace(1)»</extension> - «ENDIF» + «tripleSpace(1)»<extension point="org.eclipse.gmf.runtime.common.ui.services.iconProviders" id="icon-provider"> + «tripleSpace(2)»«xmlGeneratedTag» + «tripleSpace(2)»<IconProvider class="«iconProvider.qualifiedClassName(it)»"> + «tripleSpace(3)»<Priority name="«iconProviderPriority»"/> + «tripleSpace(2)»</IconProvider> + «tripleSpace(1)»</extension> + «IF editorGen.labelParsers != null && editorGen.labelParsers.extensibleViaService» + «extraLineBreak» + «tripleSpace(1)»<extension point="org.eclipse.gmf.runtime.common.ui.services.parserProviders" id="parser-provider"> + «tripleSpace(2)»«xmlGeneratedTag» + «tripleSpace(2)»<ParserProvider class="«labelParsers.qualifiedClassName(editorGen.labelParsers)»"> + «tripleSpace(3)»<Priority name="«editorGen.labelParsers.providerPriority»"/> + «tripleSpace(2)»</ParserProvider> + «tripleSpace(1)»</extension> + «ENDIF» + «IF generateShortcutIcon()» + «extraLineBreak» + «tripleSpace(1)»<extension point="org.eclipse.gmf.runtime.diagram.ui.decoratorProviders" id="decorator-provider"> + «tripleSpace(2)»«xmlGeneratedTag» + «tripleSpace(2)»<decoratorProvider class="«shorcutProvider.qualifiedClassName(it)»"> + «tripleSpace(3)»<Priority name="«shortcutsDecoratorProviderPriority»"/> + «tripleSpace(3)»<object class="org.eclipse.gmf.runtime.notation.Node(org.eclipse.gmf.runtime.notation)" id="generated-top-nodes"> + «tripleSpace(4)»<method name="getType()" value="«commaSeparatedVisualIDs(it.topLevelNodes)/*generated code supports shortcuts only to top-level nodes*/»"/> + «tripleSpace(3)»</object> + «tripleSpace(3)»<context decoratorTargets="generated-top-nodes"/> + «tripleSpace(2)»</decoratorProvider> + «tripleSpace(1)»</extension> + «ENDIF» -««« commented for bug 520882 -««« «IF !getLocalDefineTypedElements(it).empty» -««« «tripleSpace(1)»<extension point="org.eclipse.gmf.runtime.emf.type.core.elementTypes" id="element-types"> -««« «tripleSpace(2)»«xmlGeneratedTag» -««« «FOR e : getLocalDefineTypedElements(it)» -««« «elementTypeSafe(e.elementType)» -««« «ENDFOR» -««« «tripleSpace(1)»</extension> -««« «ENDIF» -««« -««« «tripleSpace(1)»<extension point="org.eclipse.gmf.runtime.emf.type.core.elementTypeBindings" id="element-types-bindings"> -««« «tripleSpace(2)»«xmlGeneratedTag» -««« «IF it.eResource.allContents.filter(typeof (GenerateUsingElementTypeCreationCommand)).size<1» -««« «tripleSpace(2)»<clientContext id="«editorGen.plugin.ID».TypeContext"> -««« «tripleSpace(3)»<enablement> -««« «tripleSpace(4)»<test -««« «tripleSpace(5)»property="org.eclipse.gmf.runtime.emf.core.editingDomain" -««« «tripleSpace(5)»value="«editingDomainID»"/> -««« «tripleSpace(3)»</enablement> -««« «tripleSpace(2)»</clientContext> -««« «tripleSpace(2)»<binding context="«editorGen.plugin.ID».TypeContext"> -««« «ENDIF» -««« «IF it.eResource.allContents.filter(typeof (GenerateUsingElementTypeCreationCommand)).size>0» -««« -««« <binding context="org.eclipse.papyrus.infra.services.edit.TypeContext"> -««« «ENDIF» -««« «FOR e : getLocalDefineTypedElements(it)» -««« «tripleSpace(3)»<elementType ref="«e.elementType.uniqueIdentifier»"/> -««« «ENDFOR» -««« «tripleSpace(3)»<advice ref="org.eclipse.gmf.runtime.diagram.core.advice.notationDepdendents"/> -««« «tripleSpace(2)»</binding> -««« «tripleSpace(1)»</extension> +««« commented for bug 520882 +««« «IF !getLocalDefineTypedElements(it).empty» +««« «tripleSpace(1)»<extension point="org.eclipse.gmf.runtime.emf.type.core.elementTypes" id="element-types"> +««« «tripleSpace(2)»«xmlGeneratedTag» +««« «FOR e : getLocalDefineTypedElements(it)» +««« «elementTypeSafe(e.elementType)» +««« «ENDFOR» +««« «tripleSpace(1)»</extension> +««« «ENDIF» +««« +««« «tripleSpace(1)»<extension point="org.eclipse.gmf.runtime.emf.type.core.elementTypeBindings" id="element-types-bindings"> +««« «tripleSpace(2)»«xmlGeneratedTag» +««« «IF it.eResource.allContents.filter(typeof (GenerateUsingElementTypeCreationCommand)).size<1» +««« «tripleSpace(2)»<clientContext id="«editorGen.plugin.ID».TypeContext"> +««« «tripleSpace(3)»<enablement> +««« «tripleSpace(4)»<test +««« «tripleSpace(5)»property="org.eclipse.gmf.runtime.emf.core.editingDomain" +««« «tripleSpace(5)»value="«editingDomainID»"/> +««« «tripleSpace(3)»</enablement> +««« «tripleSpace(2)»</clientContext> +««« «tripleSpace(2)»<binding context="«editorGen.plugin.ID».TypeContext"> +««« «ENDIF» +««« «IF it.eResource.allContents.filter(typeof (GenerateUsingElementTypeCreationCommand)).size>0» +««« +««« <binding context="org.eclipse.papyrus.infra.services.edit.TypeContext"> +««« «ENDIF» +««« «FOR e : getLocalDefineTypedElements(it)» +««« «tripleSpace(3)»<elementType ref="«e.elementType.uniqueIdentifier»"/> +««« «ENDFOR» +««« «tripleSpace(3)»<advice ref="org.eclipse.gmf.runtime.diagram.core.advice.notationDepdendents"/> +««« «tripleSpace(2)»</binding> +««« «tripleSpace(1)»</extension> - «extraLineBreak» - «tripleSpace(1)»<extension point="org.eclipse.papyrus.infra.gmfdiag.common.visualTypeProviders"> - «tripleSpace(2)»«xmlGeneratedTag» - «tripleSpace(2)»<visualTypeProvider - «tripleSpace(4)»class="«visualTypeProvider.qualifiedClassName(it)»" - «tripleSpace(4)»diagramType="«editorGen.modelID»"> - «tripleSpace(3)»</visualTypeProvider> - «tripleSpace(1)»</extension> + «extraLineBreak» + «tripleSpace(1)»<extension point="org.eclipse.papyrus.infra.gmfdiag.common.visualTypeProviders"> + «tripleSpace(2)»«xmlGeneratedTag» + «tripleSpace(2)»<visualTypeProvider + «tripleSpace(4)»class="«visualTypeProvider.qualifiedClassName(it)»" + «tripleSpace(4)»diagramType="«editorGen.modelID»"> + «tripleSpace(3)»</visualTypeProvider> + «tripleSpace(1)»</extension> ''' def getLocalDefineTypedElements(GenDiagram it) { @@ -166,63 +166,63 @@ import xpt.providers.ShortcutsDecoratorProvider // override modelingAssistantProvider(GenDiagram it) ''' // // <extension point="org.eclipse.gmf.runtime.emf.ui.modelingAssistantProviders" id="modelassist-provider"> -// «xmlGeneratedTag» -// <modelingAssistantProvider class="«getModelingAssistantProviderQualifiedClassName()»"> -// <Priority name="«modelingAssistantProviderPriority»"/> -// <object class="«getEditPartQualifiedClassName()»" id="«getUniqueIdentifier()»"/> -// «FOR n :topLevelNodes» -// <object class="«n.getEditPartQualifiedClassName()»" id="«n.getUniqueIdentifier()»"/> -// «ENDFOR» -// «FOR n:childNodes» -// <object class="«n.getEditPartQualifiedClassName()»" id="«n.getUniqueIdentifier()»"/> -// «ENDFOR» -// <context elements="«getUniqueIdentifier()»,«FOR n : topLevelNodes SEPARATOR ','»«n.getUniqueIdentifier()»«ENDFOR»,«FOR n : childNodes SEPARATOR ','»«n.getUniqueIdentifier()»«ENDFOR»"/> +// «xmlGeneratedTag» +// <modelingAssistantProvider class="«getModelingAssistantProviderQualifiedClassName()»"> +// <Priority name="«modelingAssistantProviderPriority»"/> +// <object class="«getEditPartQualifiedClassName()»" id="«getUniqueIdentifier()»"/> +// «FOR n :topLevelNodes» +// <object class="«n.getEditPartQualifiedClassName()»" id="«n.getUniqueIdentifier()»"/> +// «ENDFOR» +// «FOR n:childNodes» +// <object class="«n.getEditPartQualifiedClassName()»" id="«n.getUniqueIdentifier()»"/> +// «ENDFOR» +// <context elements="«getUniqueIdentifier()»,«FOR n : topLevelNodes SEPARATOR ','»«n.getUniqueIdentifier()»«ENDFOR»,«FOR n : childNodes SEPARATOR ','»«n.getUniqueIdentifier()»«ENDFOR»"/> // </modelingAssistantProvider> // </extension> // // // ''' - override def commaSeparatedVisualIDs(Iterable<? extends GenCommonBase> list) '''«FOR gcb : list SEPARATOR ','»«gcb.stringUniqueIdentifier»«ENDFOR»''' + override def commaSeparatedVisualIDs(Iterable<? extends GenCommonBase> list) '''«FOR gcb : list SEPARATOR ','»«gcb.stringUniqueIdentifier»«ENDFOR»''' override def dispatch elementType(MetamodelType it) ''' - «tripleSpace(2)»<metamodel nsURI="«getMetaClass().genPackage.getEcorePackage.nsURI»"> - «tripleSpace(3)»<metamodelType - «tripleSpace(5)»id="«uniqueIdentifier»" - «IF null != displayName» - «tripleSpace(5)»name="%metatype.name.«diagramElement.stringUniqueIdentifier»" - «ENDIF» - «tripleSpace(5)»kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType" - «tripleSpace(5)»eclass="«getMetaClass().ecoreClass.name»" - «tripleSpace(5)»edithelper="«editHelper.qualifiedClassName(it)»"> - «tripleSpace(4)»<param name="semanticHint" value="«diagramElement.stringVisualID»"/> - «tripleSpace(3)»</metamodelType> - «tripleSpace(2)»</metamodel> + «tripleSpace(2)»<metamodel nsURI="«getMetaClass().genPackage.getEcorePackage.nsURI»"> + «tripleSpace(3)»<metamodelType + «tripleSpace(5)»id="«uniqueIdentifier»" + «IF null != displayName» + «tripleSpace(5)»name="%metatype.name.«diagramElement.stringUniqueIdentifier»" + «ENDIF» + «tripleSpace(5)»kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType" + «tripleSpace(5)»eclass="«getMetaClass().ecoreClass.name»" + «tripleSpace(5)»edithelper="«editHelper.qualifiedClassName(it)»"> + «tripleSpace(4)»<param name="semanticHint" value="«diagramElement.stringVisualID»"/> + «tripleSpace(3)»</metamodelType> + «tripleSpace(2)»</metamodel> ''' override def specializationType(SpecializationType it) ''' - «tripleSpace(3)»<specializationType - «tripleSpace(5)»id="«uniqueIdentifier»" - «IF null != displayName» - «tripleSpace(5)»name="%metatype.name.«diagramElement.stringUniqueIdentifier»" - «ENDIF» - «tripleSpace(5)»kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"«IF editHelperAdviceClassName != null» - «tripleSpace(5)»edithelperadvice="«editHelperAdvice.qualifiedClassName(it)»"«ENDIF»> - «tripleSpace(4)»<specializes id="«IF (null == metamodelType)»org.eclipse.gmf.runtime.emf.type.core.null«ELSE»«metamodelType. - uniqueIdentifier»«ENDIF»"/> - «tripleSpace(4)»<param name="semanticHint" value="«diagramElement.stringVisualID»"/> - «tripleSpace(3)»</specializationType> + «tripleSpace(3)»<specializationType + «tripleSpace(5)»id="«uniqueIdentifier»" + «IF null != displayName» + «tripleSpace(5)»name="%metatype.name.«diagramElement.stringUniqueIdentifier»" + «ENDIF» + «tripleSpace(5)»kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"«IF editHelperAdviceClassName != null» + «tripleSpace(5)»edithelperadvice="«editHelperAdvice.qualifiedClassName(it)»"«ENDIF»> + «tripleSpace(4)»<specializes id="«IF (null == metamodelType)»org.eclipse.gmf.runtime.emf.type.core.null«ELSE»«metamodelType. + uniqueIdentifier»«ENDIF»"/> + «tripleSpace(4)»<param name="semanticHint" value="«diagramElement.stringVisualID»"/> + «tripleSpace(3)»</specializationType> ''' override def dispatch elementType(NotationType it) ''' - «tripleSpace(2)»<specializationType - «tripleSpace(4)»id="«uniqueIdentifier»" - «IF null != displayName» - «tripleSpace(4)»name="%metatype.name.«diagramElement.stringUniqueIdentifier»" - «ENDIF» - «tripleSpace(4)»kind="org.eclipse.gmf.runtime.diagram.ui.util.INotationType"> - «tripleSpace(3)»<specializes id="org.eclipse.gmf.runtime.emf.type.core.null"/> - «tripleSpace(3)»<param name="semanticHint" value="«diagramElement.stringVisualID»"/> - «tripleSpace(2)»</specializationType> + «tripleSpace(2)»<specializationType + «tripleSpace(4)»id="«uniqueIdentifier»" + «IF null != displayName» + «tripleSpace(4)»name="%metatype.name.«diagramElement.stringUniqueIdentifier»" + «ENDIF» + «tripleSpace(4)»kind="org.eclipse.gmf.runtime.diagram.ui.util.INotationType"> + «tripleSpace(3)»<specializes id="org.eclipse.gmf.runtime.emf.type.core.null"/> + «tripleSpace(3)»<param name="semanticHint" value="«diagramElement.stringVisualID»"/> + «tripleSpace(2)»</specializationType> ''' } diff --git a/plugins/uml/alf/org.eclipse.papyrus.uml.alf.common/src/org/eclipse/papyrus/uml/alf/Common.xtext b/plugins/uml/alf/org.eclipse.papyrus.uml.alf.common/src/org/eclipse/papyrus/uml/alf/Common.xtext index b3e94afd00c..2ba4cd8155c 100644 --- a/plugins/uml/alf/org.eclipse.papyrus.uml.alf.common/src/org/eclipse/papyrus/uml/alf/Common.xtext +++ b/plugins/uml/alf/org.eclipse.papyrus.uml.alf.common/src/org/eclipse/papyrus/uml/alf/Common.xtext @@ -38,6 +38,6 @@ terminal INTEGER_VALUE : //terminal IDENTIFIER : ID ; //terminal IDENTIFIER : ('a'..'z'|'A'..'Z'|'_') ('a'..'z'|'A'..'Z'|'_'|'0'..'9')* | ('\'' -> '\'') ; //terminal DOCUMENTATION_COMMENT : '/*' -> '*/' ; -//terminal ML_COMMENT : '/°' -> '°/'; -//terminal SL_COMMENT : '°°' !('\n'|'\r')* ('\r'? '\n')?; +//terminal ML_COMMENT : '/°' -> '°/'; +//terminal SL_COMMENT : '°°' !('\n'|'\r')* ('\r'? '\n')?; //terminal WS : (' '|'\t'|'\r'|'\n')+;
\ No newline at end of file diff --git a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.state.xtext/src/org/eclipse/papyrus/uml/textedit/state/xtext/UmlState.xtext b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.state.xtext/src/org/eclipse/papyrus/uml/textedit/state/xtext/UmlState.xtext index deebd87c7b2..deebd87c7b2 100755..100644 --- a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.state.xtext/src/org/eclipse/papyrus/uml/textedit/state/xtext/UmlState.xtext +++ b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.state.xtext/src/org/eclipse/papyrus/uml/textedit/state/xtext/UmlState.xtext |