diff options
Diffstat (limited to 'plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/plugin/plugin.xtend')
-rw-r--r-- | plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/plugin/plugin.xtend | 356 |
1 files changed, 178 insertions, 178 deletions
diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/plugin/plugin.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/plugin/plugin.xtend index 962deb0b53d..a9070fe132a 100644 --- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/plugin/plugin.xtend +++ b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/plugin/plugin.xtend @@ -1,39 +1,39 @@ -/*****************************************************************************
- * Copyright (c) 2017 CEA LIST, ALL4TEC and others.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - initial API and implementation
- * Mickaël ADAM (ALL4TEC) mickael.adam@all4tec.net - Bug 510587: the palette must not be generated by using GMF gen
- *****************************************************************************/
-package aspects.xpt.plugin
-
-import aspects.xpt.Common
-import aspects.xpt.editor.palette.Utils_qvto
-import com.google.inject.Inject
-import com.google.inject.Singleton
-import java.util.Iterator
-import java.util.List
-import org.eclipse.emf.ecore.EObject
-import org.eclipse.gmf.codegen.gmfgen.AbstractToolEntry
-import org.eclipse.gmf.codegen.gmfgen.GenCompartment
-import org.eclipse.gmf.codegen.gmfgen.GenEditorGenerator
-import org.eclipse.gmf.codegen.gmfgen.GenExternalNodeLabel
-import org.eclipse.gmf.codegen.gmfgen.GenLink
-import org.eclipse.gmf.codegen.gmfgen.GenLinkLabel
-import org.eclipse.gmf.codegen.gmfgen.GenPlugin
-import org.eclipse.gmf.codegen.gmfgen.ToolEntry
-import org.eclipse.gmf.codegen.gmfgen.ToolGroup
-import org.eclipse.papyrus.papyrusgmfgenextension.ExtendedGenView
-import org.eclipse.papyrus.papyrusgmfgenextension.LabelVisibilityPreference
-import xpt.editor.extensions
-import xpt.plugin.pluginUtils
-import java.io.File
-
+/***************************************************************************** + * Copyright (c) 2017 CEA LIST, ALL4TEC and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * CEA LIST - initial API and implementation + * Mickaël ADAM (ALL4TEC) mickael.adam@all4tec.net - Bug 510587: the palette must not be generated by using GMF gen + *****************************************************************************/ +package aspects.xpt.plugin + +import aspects.xpt.Common +import aspects.xpt.editor.palette.Utils_qvto +import com.google.inject.Inject +import com.google.inject.Singleton +import java.util.Iterator +import java.util.List +import org.eclipse.emf.ecore.EObject +import org.eclipse.gmf.codegen.gmfgen.AbstractToolEntry +import org.eclipse.gmf.codegen.gmfgen.GenCompartment +import org.eclipse.gmf.codegen.gmfgen.GenEditorGenerator +import org.eclipse.gmf.codegen.gmfgen.GenExternalNodeLabel +import org.eclipse.gmf.codegen.gmfgen.GenLink +import org.eclipse.gmf.codegen.gmfgen.GenLinkLabel +import org.eclipse.gmf.codegen.gmfgen.GenPlugin +import org.eclipse.gmf.codegen.gmfgen.ToolEntry +import org.eclipse.gmf.codegen.gmfgen.ToolGroup +import org.eclipse.papyrus.papyrusgmfgenextension.ExtendedGenView +import org.eclipse.papyrus.papyrusgmfgenextension.LabelVisibilityPreference +import xpt.editor.extensions +import xpt.plugin.pluginUtils +import java.io.File + @Singleton class plugin extends xpt.plugin.plugin { @Inject extension Common @@ -72,34 +72,34 @@ import java.io.File «extensionsConstraintProviders(it.editorGen)» «xptUpdaterExtension.extensions(it.editorGen.diagramUpdater)» «xptActionExtension.Main(it.editorGen)» - «additions(it)»
- «notationTypesMap(editorGen)»
-««« «paletteConfiguration(editorGen)»
+ «additions(it)» + «notationTypesMap(editorGen)» +««« «paletteConfiguration(editorGen)» </plugin> - '''
-
-
- /**
- * deprecated: palette configuration are now declared through architecture model.
- */
- def paletteConfiguration(GenEditorGenerator it) '''
-<extension point="org.eclipse.papyrus.infra.gmfdiag.common.paletteDefinition">
- «xmlGeneratedTag»
- <paletteDefinition
- ID="«plugin.ID».paletteconfiguration"
- class="org.eclipse.papyrus.infra.gmfdiag.common.service.palette.ExtendedPluginPaletteProvider"
- 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»">
- </editor>
- </paletteDefinition>
-</extension>
+ ''' + + + /** + * deprecated: palette configuration are now declared through architecture model. + */ + def paletteConfiguration(GenEditorGenerator it) ''' +<extension point="org.eclipse.papyrus.infra.gmfdiag.common.paletteDefinition"> + «xmlGeneratedTag» + <paletteDefinition + ID="«plugin.ID».paletteconfiguration" + class="org.eclipse.papyrus.infra.gmfdiag.common.service.palette.ExtendedPluginPaletteProvider" + 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»"> + </editor> + </paletteDefinition> +</extension> ''' override additions(GenPlugin it) '''''' @@ -150,7 +150,7 @@ import java.io.File <predefinedEntry id="standardGroup/noteStack/textTool" remove="true"/> <predefinedEntry id="standardGroup/noteStack/noteattachmentTool" remove="true"/> - «FOR tool : diagram.palette.groups»
+ «FOR tool : diagram.palette.groups» «groupUsage(tool)» «ENDFOR» </contribution> @@ -161,54 +161,54 @@ 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»">
- <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»
+ <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»"> + <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» ''' -
- private def getPath(ToolEntry it) {
- return buildPath(it.eContainer);
- }
-
- private def getPath(ToolGroup it) {
- return buildPath(it.eContainer);
- }
-
- private def buildPath(EObject it) {
- var path = new StringBuilder();
- var container = it;
- while (container instanceof ToolGroup) {
- path.insert(0, getToolPath((container as ToolGroup).id));
- container = container.eContainer;
- }
- return if(path.length() != 0) path.toString else "/" ;
- }
-
- def dispatch toolUsage(ToolEntry it, ToolGroup group) '''
- <predefinedEntry
- id=«IF isQuoted(id,'"')»«id»«ELSE»"«id»"«ENDIF»
- path="«getPath(it)»">
- </predefinedEntry>
- '''
-
- def dispatch toolUsage(ToolGroup it, ToolGroup group) '''
- «groupUsage(it)»
+ + private def getPath(ToolEntry it) { + return buildPath(it.eContainer); + } + + private def getPath(ToolGroup it) { + return buildPath(it.eContainer); + } + + private def buildPath(EObject it) { + var path = new StringBuilder(); + var container = it; + while (container instanceof ToolGroup) { + path.insert(0, getToolPath((container as ToolGroup).id)); + container = container.eContainer; + } + return if(path.length() != 0) path.toString else "/" ; + } + + def dispatch toolUsage(ToolEntry it, ToolGroup group) ''' + <predefinedEntry + id=«IF isQuoted(id,'"')»«id»«ELSE»"«id»"«ENDIF» + path="«getPath(it)»"> + </predefinedEntry> + ''' + + def dispatch toolUsage(ToolGroup it, ToolGroup group) ''' + «groupUsage(it)» ''' def predefinedEntryDefinition(AbstractToolEntry it) ''' @@ -222,71 +222,71 @@ import java.io.File path="" 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>
- '''
- def compartmentToTypeMap(GenCompartment it) '''
- <mapping
- humanReadableType="«title.replaceAll('Compartment', '')»"
- type="«stringVisualID»">
- </mapping>
- '''
-
- def linksToTypeMap(GenLink it) '''
- «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)»
- '''
-
- def externalNodeLabelToTypeMap(GenExternalNodeLabel it)'''
- «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»
- <mapping
- humanReadableType="«links.get(0).role»"
- type="«visualID»">
- </mapping>
- «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) »
- <mapping
- humanReadableType="Floating Label"
- type="«stringVisualID»">
- </mapping>
- «ENDIF»
- «ENDFOR»
- «ENDIF»
- '''
+ ''' + + // 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> + ''' + def compartmentToTypeMap(GenCompartment it) ''' + <mapping + humanReadableType="«title.replaceAll('Compartment', '')»" + type="«stringVisualID»"> + </mapping> + ''' + + def linksToTypeMap(GenLink it) ''' + «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)» + ''' + + def externalNodeLabelToTypeMap(GenExternalNodeLabel it)''' + «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» + <mapping + humanReadableType="«links.get(0).role»" + type="«visualID»"> + </mapping> + «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) » + <mapping + humanReadableType="Floating Label" + type="«stringVisualID»"> + </mapping> + «ENDIF» + «ENDFOR» + «ENDIF» + ''' } |