Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/developer/org.eclipse.papyrus.def/dynamic-templates3.5/codegen/xpt/editor/palette/PaletteFactory.xpt')
-rw-r--r--plugins/developer/org.eclipse.papyrus.def/dynamic-templates3.5/codegen/xpt/editor/palette/PaletteFactory.xpt362
1 files changed, 0 insertions, 362 deletions
diff --git a/plugins/developer/org.eclipse.papyrus.def/dynamic-templates3.5/codegen/xpt/editor/palette/PaletteFactory.xpt b/plugins/developer/org.eclipse.papyrus.def/dynamic-templates3.5/codegen/xpt/editor/palette/PaletteFactory.xpt
deleted file mode 100644
index aaecdf9e48a..00000000000
--- a/plugins/developer/org.eclipse.papyrus.def/dynamic-templates3.5/codegen/xpt/editor/palette/PaletteFactory.xpt
+++ /dev/null
@@ -1,362 +0,0 @@
-/*
- * Copyright (c) 2006, 2009 Borland Software Corporation
- *
- * 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:
- * Artem Tikhomirov (Borland) - initial API and implementation
- */
-
-«IMPORT 'http://www.eclipse.org/gmf/2009/GenModel'»
-«IMPORT 'http://www.eclipse.org/emf/2002/Ecore'»
-«EXTENSION xpt::editor::palette::Utils»
-
-«DEFINE Factory FOR gmfgen::Palette»
-«EXPAND xpt::Common::copyright FOR diagram.editorGen-»
-package «packageName»;
-
-«EXPAND xpt::Common::generatedClassComment»
-public class «factoryClassName» extends org.eclipse.gmf.runtime.diagram.ui.services.palette.PaletteFactory.Adapter {
-
-«REM»RS: New Palette generation«ENDREM»
-
-«REM» Generates the ID for the tool elements«ENDREM»
-«REM» Generate the tool factory (if(ID) createtool...)«ENDREM»
-«EXPAND generateIDAttribute FOREACH collectTools(self)»
-
-«REM» Generates the default constructor«ENDREM»
-«EXPAND xpt::Common::generatedMemberComment»
- public «factoryClassName»() {
-
- }
-
-«REM» Generates the main method to create tool«ENDREM»
-«EXPAND generateCreateTool»
-
-«REM» Generates the main method to create template«ENDREM»
-«EXPAND generateGetTemplate»
-
-«REM» Generates each method for tool creation«ENDREM»
-«EXPAND createTool FOREACH collectTools(self)»
-
-}
-«ENDDEFINE»
-
-«DEFINE generateCreateTool FOR gmfgen::Palette»
- «EXPAND xpt::Common::generatedMemberComment»
- public org.eclipse.gef.Tool createTool(String toolId) {
- «EXPAND checkToolID FOREACH collectTools(self)»
- // default return: null
- return null;
- }
-«ENDDEFINE»
-
-«DEFINE checkToolID FOR gmfgen::AbstractToolEntry-»
- if (toolId.equals(«id.getConstantIDName()»)) {
- return «createMethodName»();
- }
-«ENDDEFINE»
-
-
-«DEFINE generateGetTemplate FOR gmfgen::Palette»
- «EXPAND xpt::Common::generatedMemberComment»
- public Object getTemplate(String templateId) {
-
- // default return: null
- return null;
- }
-«ENDDEFINE»
-
-«DEFINE generateIDAttribute FOR gmfgen::AbstractToolEntry-»
- «EXPAND xpt::Common::generatedMemberComment»
- private final static String «id.getConstantIDName()» = «id»;«IF id.isQuoted('\"')»«EXPAND xpt::Common::nonNLS»«ENDIF»
-«ENDDEFINE»
-
-
-«DEFINE createTool FOR gmfgen::AbstractToolEntry-»
- «EXPAND xpt::Common::generatedMemberComment»
- private org.eclipse.gef.Tool «createMethodName»() {
- «EXPAND newTool('entry')-»
- }
-«ENDDEFINE»
-
-«DEFINE newTool(toolVarName : String) FOR gmfgen::ToolEntry-»
- «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()»);
- «FOREACH elements->asSequence() AS e-»
- types.add(«EXPAND xpt::providers::ElementTypes::accessElementType FOR e»);
- «ENDFOREACH-»
- «REM»RS: modified tool creation to have stereotypes-aware tools«ENDREM»
- org.eclipse.gef.Tool tool = new org.eclipse.papyrus.uml.diagram.common.service.«IF self.genNodes->isEmpty()»AspectUnspecifiedTypeConnectionTool«ELSE»AspectUnspecifiedTypeCreationTool«ENDIF»(types);
- return tool;
- «ENDIF-»
-«ENDDEFINE»
-
-
-
-
-
-«REM»RS: Old Palette generation
-«EXPAND createGroup FOREACH collectGroups(self)»
-«EXPAND createEntry FOREACH collectTools(self)»
-
-«IF needsNodeToolEntryClass(self)»«EXPAND nodeToolEntry»«ENDIF-»
-«IF needsLinkToolEntryClass(self)»«EXPAND linkToolEntry»«ENDIF-»
-}
-«ENDDEFINE»
-
-«DEFINE generateIDAttribute FOR gmfgen::AbstractToolEntry-»
- «EXPAND xpt::Common::generatedMemberComment»
- private final static String «id.getConstantIDName()» = «id»;«IF id.isQuoted('\"')»«EXPAND xpt::Common::nonNLS»«ENDIF»
-«ENDDEFINE»
-
-«DEFINE createGroup FOR gmfgen::ToolGroup-»
- «EXPAND xpt::Common::generatedMemberComment('Creates \"' + title + '\" palette tool group')»
- private org.eclipse.gef.palette.PaletteContainer «createMethodName»() {
- «EXPAND newContainer('paletteContainer')-»
- «EXPAND setIdentity('paletteContainer')-»
- «EXPAND setDescription('paletteContainer', self) FOR description-»
- «EXPAND setSmallImage('paletteContainer', palette)-»
- «EXPAND setLargeImage('paletteContainer', palette)-»
- «EXPAND addEntry('paletteContainer') FOREACH entries-»
- return paletteContainer;
- }
-«ENDDEFINE»
-
-«DEFINE newContainer(varName : String) FOR gmfgen::ToolGroup-»
-«IF collapse and toolsOnly-»
- org.eclipse.gef.palette.PaletteDrawer «varName» = new org.eclipse.gef.palette.PaletteDrawer(«EXPAND i18nTitle»);
-«ELSEIF stack-»
- org.eclipse.gef.palette.PaletteStack «varName» = new org.eclipse.gef.palette.PaletteStack(«EXPAND i18nTitle», null, null);
-«ELSE-»
- org.eclipse.gef.palette.PaletteGroup «varName» = new org.eclipse.gef.palette.PaletteGroup(«EXPAND i18nTitle»);
-«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE setDescription(varName : String, gr : gmfgen::ToolGroup) FOR String-»
-«varName».setDescription(«EXPAND i18nDesc FOR gr»);
-«ENDDEFINE»
-
-«DEFINE addEntry(varName : String) FOR gmfgen::ToolGroupItem»
-«ERROR 'abstract addEntry(ToolGroupItem,String) template'»
-«ENDDEFINE»
-
-«DEFINE addEntry(varName : String) FOR gmfgen::AbstractToolEntry-»
-«varName».add(«createMethodName»());
-«IF _default and group.stack-»
-«varName».setActiveEntry((org.eclipse.gef.palette.ToolEntry) paletteContainer.getChildren().get(paletteContainer.getChildren().size() - 1));
-«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE addEntry(varName : String) FOR gmfgen::Separator-»
-«varName».add(new org.eclipse.gef.palette.PaletteSeparator());
-«ENDDEFINE»
-
-«DEFINE addEntry(varName : String) FOR gmfgen::ToolGroup-»
-«varName».add(«createMethodName»());
-«ENDDEFINE»
-
-«DEFINE createEntry FOR gmfgen::AbstractToolEntry-»
- «EXPAND xpt::Common::generatedMemberComment»
- private org.eclipse.gef.palette.ToolEntry «createMethodName»() {
- «EXPAND newEntry('entry')-»
- «EXPAND setIdentity('entry')-»
- «EXPAND setSmallImage('entry', group.palette)-»
- «EXPAND setLargeImage('entry', group.palette)-»
- «EXPAND setToolClass('entry')-»
- «EXPAND setToolProperty('entry') FOREACH properties-»
- return entry;
- }
-«ENDDEFINE»
-
-«DEFINE newEntry(toolVarName : String) FOR gmfgen::AbstractToolEntry-»
-«ERROR 'abstract newEntry(AbstractToolEntry,String) template'»
-«ENDDEFINE»
-
-«DEFINE newEntry(toolVarName : String) FOR gmfgen::ToolEntry-»
-«IF elements->isEmpty()-»
-org.eclipse.gef.palette.ToolEntry «toolVarName» = new org.eclipse.gef.palette.ToolEntry(«EXPAND i18nTitle», «EXPAND i18nDesc», null, null) {};
-«ELSE-»
-«LET (if genNodes->isEmpty() then 'LinkToolEntry' else 'NodeToolEntry' endif) AS toolEntryClass-»
-java.util.List/*<IElementType>*/ types = new java.util.ArrayList/*<IElementType>*/(«elements->size()»);
-«FOREACH elements->asSequence() AS e-»
-types.add(«EXPAND xpt::providers::ElementTypes::accessElementType FOR e»);
-«ENDFOREACH-»
-«toolEntryClass» «toolVarName» = new «toolEntryClass»(«EXPAND i18nTitle», «EXPAND i18nDesc», types);
-«ENDLET-»
-«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE newEntry(toolVarName : String) FOR gmfgen::StandardEntry-»
-«IF gmfgen::StandardEntryKind::SELECT = kind -»
-«EXPAND newStdSelectEntry(toolVarName)-»
-«ELSEIF kind = gmfgen::StandardEntryKind::MARQUEE-»
-«EXPAND newStdMarqueeEntry(toolVarName)-»
-«ELSEIF kind = gmfgen::StandardEntryKind::ZOOM-»
-«EXPAND newStdZoomEntry(toolVarName)-»
-«ELSE-»
-«EXPAND newStdOtherEntry(toolVarName)-»
-«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE newStdSelectEntry(toolVarName : String) FOR gmfgen::StandardEntry-»
-org.eclipse.gef.palette.PanningSelectionToolEntry «toolVarName» = new org.eclipse.gef.palette.PanningSelectionToolEntry();
-«ENDDEFINE»
-
-«DEFINE newStdMarqueeEntry(toolVarName : String) FOR gmfgen::StandardEntry-»
-org.eclipse.gef.palette.MarqueeToolEntry «toolVarName» = new org.eclipse.gef.palette.MarqueeToolEntry();
-«ENDDEFINE»
-
-«DEFINE newStdZoomEntry(toolVarName : String) FOR gmfgen::StandardEntry-»
-FIXME
-«ENDDEFINE»
-
-«DEFINE newStdOtherEntry(toolVarName : String) FOR gmfgen::StandardEntry-»
-«ERROR 'override newStdOtherEntry(StandardEntry, String) for kind ' + kind.repr()»
-«ENDDEFINE»
-
-// FIXME: odd code - FOR EntryBase, while most of the template is valid for ToolEntry only!!!
-«DEFINE setSmallImage(toolVarName : String, palette : gmfgen::Palette) FOR gmfgen::EntryBase-»
-«IF null <> smallIconPath-»
-«toolVarName».setSmallIcon(«palette.activatorFQN()».findImageDescriptor("«smallIconPath»"));«EXPAND xpt::Common::nonNLS»
-«ELSEIF not (Sequence { self })[gmfgen::ToolEntry].elements->isEmpty()-»
-«LET self.oclAsType(gmfgen::ToolEntry) AS toolEntry-»
-«toolVarName».setSmallIcon(«palette.diagram.getElementTypesQualifiedClassName()».getImageDescriptor(«EXPAND xpt::providers::ElementTypes::accessElementType FOR toolEntry.elements->first().oclAsType(gmfgen::GenCommonBase)»));
-«ENDLET-»
-«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE setLargeImage(toolVarName : String, palette : gmfgen::Palette) FOR gmfgen::EntryBase-»
-«IF null <> largeIconPath-»
-«toolVarName».setLargeIcon(«palette.activatorFQN()».findImageDescriptor("«largeIconPath»")); «EXPAND xpt::Common::nonNLS»
-«ELSEIF not (Sequence { self })[gmfgen::ToolEntry].elements->isEmpty()-»
-«toolVarName».setLargeIcon(«toolVarName».getSmallIcon());
-«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE setToolClass(toolVarName : String) FOR gmfgen::AbstractToolEntry-»
-«IF null <> qualifiedToolName-»
-«toolVarName».setToolClass(«qualifiedToolName».class);
-«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE setToolProperty(toolVarName : String) FOR ecore::EStringToStringMapEntry-»
-«toolVarName».setToolProperty(«key», «value»);
-«ENDDEFINE»
-
-«DEFINE i18nTitle FOR gmfgen::ToolEntry-»
-«IF title = null»null«ELSE»«EXPAND xpt::Externalizer::accessorCall(i18nTitleKey(self)) FOR group.palette.diagram.editorGen»«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE i18nTitle FOR gmfgen::ToolGroup-»
-«IF title = null»null«ELSE»«EXPAND xpt::Externalizer::accessorCall(i18nTitleKey(self)) FOR palette.diagram.editorGen»«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE i18nDesc FOR gmfgen::ToolEntry-»
-«IF null = description»null«ELSE»«EXPAND xpt::Externalizer::accessorCall(i18nDescKey(self)) FOR group.palette.diagram.editorGen»«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE i18nDesc FOR gmfgen::ToolGroup-»
-«IF null = description»null«ELSE»«EXPAND xpt::Externalizer::accessorCall(i18nDescKey(self)) FOR palette.diagram.editorGen»«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE i18nAccessors FOR gmfgen::Palette-»
-«EXPAND internal_i18n_accessors FOREACH collectGroups(self)-»
-«EXPAND internal_i18n_accessors FOREACH collectTools(self)-»
-«ENDDEFINE»
-
-«DEFINE i18nValues FOR gmfgen::Palette-»
-«EXPAND internal_i18n_values FOREACH collectGroups(self)-»
-«EXPAND internal_i18n_values FOREACH collectTools(self)-»
-«ENDDEFINE»
-
-«DEFINE internal_i18n_accessors FOR gmfgen::EntryBase-»
-«IF null <> title»«EXPAND xpt::Externalizer::accessorField(i18nTitleKey(self))»«ENDIF-»
-«IF null <> description»«EXPAND xpt::Externalizer::accessorField(i18nDescKey(self))»«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE internal_i18n_values FOR gmfgen::EntryBase-»
-«IF null <> title»«EXPAND xpt::Externalizer::messageEntry(i18nTitleKey(self), title)»«ENDIF-»
-«IF null <> description»«EXPAND xpt::Externalizer::messageEntry(i18nDescKey(self), description)»«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE cleanStandardToolsHack FOR gmfgen::Palette»
- «EXPAND xpt::Common::generatedMemberComment('Workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=159289')»
- private void cleanStandardTools(org.eclipse.gef.palette.PaletteRoot paletteRoot) {
- for (java.util.Iterator it = paletteRoot.getChildren().iterator(); it.hasNext();) {
- org.eclipse.gef.palette.PaletteEntry entry = (org.eclipse.gef.palette.PaletteEntry) it.next();
- if (!"standardGroup".equals(entry.getId())) { «EXPAND xpt::Common::nonNLS»
- continue;
- }
- for (java.util.Iterator it2 = ((org.eclipse.gef.palette.PaletteContainer) entry).getChildren().iterator(); it2.hasNext();) {
- org.eclipse.gef.palette.PaletteEntry entry2 = (org.eclipse.gef.palette.PaletteEntry) it2.next();
- if ("zoomTool".equals(entry2.getId())) { «EXPAND xpt::Common::nonNLS»
- it2.remove();
- } else if ("noteStack".equals(entry2.getId())) { «EXPAND xpt::Common::nonNLS»
- it2.remove();
- } else if ("selectionTool".equals(entry2.getId())) { «EXPAND xpt::Common::nonNLS»
- it2.remove();
- }
- if (paletteRoot.getDefaultEntry() == entry2) {
- paletteRoot.setDefaultEntry(null);
- }
- }
- }
- }
-«ENDDEFINE»
-
-«DEFINE nodeToolEntry FOR OclAny»
- «EXPAND xpt::Common::generatedClassComment»
- private static class NodeToolEntry extends org.eclipse.gef.palette.ToolEntry {
-
- «EXPAND xpt::Common::generatedMemberComment»
- private final java.util.List elementTypes;
-
- «EXPAND xpt::Common::generatedMemberComment»
- private NodeToolEntry(String title, String description, java.util.List elementTypes) {
- super(title, description, null, null);
- this.elementTypes = elementTypes;
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- public org.eclipse.gef.Tool createTool() {
- org.eclipse.gef.Tool tool = new org.eclipse.gmf.runtime.diagram.ui.tools.UnspecifiedTypeCreationTool(elementTypes);
- tool.setProperties(getToolProperties());
- return tool;
- }
- }
-«ENDDEFINE»
-
-«DEFINE linkToolEntry FOR OclAny»
- «EXPAND xpt::Common::generatedClassComment»
- private static class LinkToolEntry extends org.eclipse.gef.palette.ToolEntry {
-
- «EXPAND xpt::Common::generatedMemberComment»
- private final java.util.List relationshipTypes;
-
- «EXPAND xpt::Common::generatedMemberComment»
- private LinkToolEntry(String title, String description, java.util.List relationshipTypes) {
- super(title, description, null, null);
- this.relationshipTypes = relationshipTypes;
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- public org.eclipse.gef.Tool createTool() {
- org.eclipse.gef.Tool tool = new org.eclipse.gmf.runtime.diagram.ui.tools.UnspecifiedTypeConnectionTool(relationshipTypes);
- tool.setProperties(getToolProperties());
- return tool;
- }
- }
-«ENDDEFINE»
-
-«DEFINE setIdentity(toolVarName : String) FOR gmfgen::EntryBase-»
-«IF id <> null and id.size() != 0-»
- «toolVarName».setId(«id»);«IF id.isQuoted('\"')»«EXPAND xpt::Common::nonNLS»«ENDIF»
-«ENDIF-»
-«ENDDEFINE»
-«ENDREM» \ No newline at end of file

Back to the top