Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorashatalin2009-03-16 14:21:35 -0400
committerashatalin2009-03-16 14:21:35 -0400
commit739691256635e02bf2593c2523fb5b6265139772 (patch)
tree21fc906593fef8281379cc747b58ea0afc011aaa
parent55265b6171ba79489e65af18dec2a5757b98d2ea (diff)
downloadorg.eclipse.gmf-tooling-739691256635e02bf2593c2523fb5b6265139772.tar.gz
org.eclipse.gmf-tooling-739691256635e02bf2593c2523fb5b6265139772.tar.xz
org.eclipse.gmf-tooling-739691256635e02bf2593c2523fb5b6265139772.zip
Removing old templates - these files were moved to oeg.templates.legacy plugin.
-rw-r--r--plugins/org.eclipse.gmf.codegen/.settings/org.eclipse.core.resources.prefs4
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates-dynmodel/Facility.ext22
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates-dynmodel/Facility.xpt157
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates-dynmodel/MetaModel.xpt112
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/MetaModel.ext206
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/MetaModel.xpt191
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/diagram/editparts/ChildNodeLabelEditPart.xpt90
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/diagram/editparts/CompartmentEditPart.xpt74
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/diagram/editparts/DiagramEditPart.xpt65
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/diagram/editparts/ExternalNodeLabelEditPart.xpt69
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/diagram/editparts/LinkEditPart.xpt61
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/diagram/editparts/LinkLabelEditPart.xpt68
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/diagram/editparts/NodeEditPart.xpt131
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/diagram/editparts/NodeLabelEditPart.xpt69
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/emf-merge.xml233
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/impl/actions/CreateShortcutAction.xpt97
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/impl/actions/CustomAction.xpt31
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/impl/actions/LoadResourceAction.xpt43
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/impl/actions/MenuAction.ext22
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/impl/actions/PredefinedAction.xpt22
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/impl/actions/extensions.xpt155
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/impl/diagram/editparts/ChildNodeLabelEditPart.xpt43
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/impl/diagram/editparts/CompartmentEditPart.xpt128
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/impl/diagram/editparts/DiagramEditPart.xpt96
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/impl/diagram/editparts/ExternalNodeLabelEditPart.xpt68
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/impl/diagram/editparts/LinkEditPart.xpt144
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/impl/diagram/editparts/LinkLabelEditPart.xpt61
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/impl/diagram/editparts/NodeEditPart.xpt580
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/impl/diagram/editparts/NodeLabelEditPart.xpt70
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/impl/diagram/editparts/TextAware.xpt537
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/impl/parsers/AbstractParser.xpt396
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/impl/parsers/ParserProvider.xpt223
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/impl/parsers/i18n.ext21
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/impl/preferences/CustomPage.xpt83
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/impl/preferences/StandardPage.xpt46
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/parsers/CustomParser.xpt63
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/parsers/ParserProvider.xpt61
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/parsers/PredefinedParser.xpt322
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/Common.xpt90
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/ConstraintProviders.xpt99
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/EMFUtils.ext21
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/Externalizer.xpt102
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/ExternalizerUtils.ext28
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/GenAuditRoot.ext55
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/GenEditorGenerator.ext18
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/GenModelUtils.ext107
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/NonNLSUtils.ext29
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/application/ActionBarAdvisor.xpt266
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/application/Application.xpt51
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/application/Perspective.xpt45
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/application/WizardNewFileCreationPage.xpt206
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/application/WorkbenchAdvisor.xpt63
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/application/WorkbenchWindowAdvisor.xpt63
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/application/extensions.xpt94
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/application/i18n.ext77
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/Utils.ext50
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/ViewmapAttributesUtils.ext62
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/commands/CreateLinkCommand.xpt126
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/commands/CreateLinkUtils.xpt148
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/commands/CreateNodeCommand.xpt161
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/commands/CreateRefLinkCommand.xpt18
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/commands/CreateShortcutDecorationsCommand.xpt60
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/commands/ReorientLinkCommand.xpt46
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/commands/ReorientLinkUtils.xpt302
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/commands/ReorientLinkViewCommand.xpt63
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/commands/ReorientRefLinkCommand.xpt50
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/edithelpers/BaseEditHelper.xpt99
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/edithelpers/EditHelper.xpt25
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/edithelpers/EditHelperAdvice.xpt25
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/editparts/Common.xpt154
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/editparts/EditPartFactory.xpt129
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/editparts/Utils.ext82
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/editpolicies/BaseItemSemanticEditPolicy.xpt540
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/editpolicies/ChildContainerCanonicalEditPolicy.xpt28
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/editpolicies/CompartmentItemSemanticEditPolicy.xpt38
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/editpolicies/DiagramCanonicalEditPolicy.xpt240
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/editpolicies/DiagramItemSemanticEditPolicy.xpt63
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/editpolicies/GraphicalNodeEditPolicy.xpt72
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/editpolicies/LinkItemSemanticEditPolicy.xpt68
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/editpolicies/LinkUtils.ext49
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/editpolicies/NodeItemSemanticEditPolicy.xpt112
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/editpolicies/OpenDiagram.xpt165
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/editpolicies/TextFeedback.xpt203
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/editpolicies/Utils.ext106
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/editpolicies/childContainerCreateCommand.xpt33
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/editpolicies/linkCommands.xpt144
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/preferences/PreferenceInitializer.xpt112
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/preferences/extensions.xpt49
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/updater/DiagramUpdater.xpt487
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/updater/LinkDescriptor.xpt120
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/updater/NodeDescriptor.xpt64
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/updater/UpdateCommand.xpt93
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/updater/Utils.ext184
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/updater/containerBaseCanonicalMethods.xpt166
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/updater/extensions.xpt34
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/views/CompartmentViewFactory.xpt91
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/views/DiagramViewFactory.xpt40
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/views/FloatingLabelViewFactory.xpt70
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/views/LabelNodeViewFactory.xpt44
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/views/LabelViewFactory.xpt34
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/views/LinkViewFactory.xpt54
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/views/NodeViewFactory.xpt70
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/views/Utils.xpt111
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/editor/ActionBarContributor.xpt70
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/editor/CreationWizard.xpt181
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/editor/CreationWizardPage.xpt105
-rwxr-xr-xplugins/org.eclipse.gmf.codegen/templates/xpt/editor/DeleteElementAction.xpt79
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/editor/DiagramContentInitializer.xpt174
-rwxr-xr-xplugins/org.eclipse.gmf.codegen/templates/xpt/editor/DiagramEditorContextMenuProvider.xpt72
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/editor/DiagramEditorUtil.xpt423
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/editor/DocumentProvider.xpt748
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/editor/DomainModelElementTester.xpt50
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/editor/Editor.xpt404
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/editor/ElementChooser.xpt414
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/editor/GenDiagram.ext37
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/editor/InitDiagramFileAction.xpt144
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/editor/MatchingStrategy.xpt49
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/editor/ModelElementSelectionPage.xpt167
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/editor/NewDiagramFileWizard.xpt200
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/editor/ResourceSetInfo.xpt331
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/editor/ResourceSetModificationListener.xpt89
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/editor/ShortcutCreationWizard.xpt156
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/editor/ShortcutPropertyTester.xpt53
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/editor/UriEditorInputTester.xpt40
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/editor/Utils.ext261
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/editor/ValidateAction.xpt350
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/editor/ValidationMarker.xpt112
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/editor/VisualIDRegistry.xpt385
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/editor/diagram.gifbin339 -> 0 bytes
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/editor/extensions.xpt86
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/editor/palette/PaletteFactory.xpt278
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/editor/palette/Utils.ext63
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/editor/shortcut.gifbin93 -> 0 bytes
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/editor/wizban.gifbin2466 -> 0 bytes
-rwxr-xr-xplugins/org.eclipse.gmf.codegen/templates/xpt/expressions/AbstractExpression.xpt145
-rwxr-xr-xplugins/org.eclipse.gmf.codegen/templates/xpt/expressions/OCLExpressionFactory.xpt148
-rwxr-xr-xplugins/org.eclipse.gmf.codegen/templates/xpt/expressions/RegexpExpressionFactory.xpt74
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/expressions/ValueExpression.ext20
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/expressions/getExpression.xpt19
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/navigator/AbstractNavigatorItem.xpt81
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/navigator/DomainNavigatorContentProvider.xpt98
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/navigator/DomainNavigatorItem.xpt121
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/navigator/DomainNavigatorLabelProvider.xpt123
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/navigator/NavigatorActionProvider.xpt206
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/navigator/NavigatorContentProvider.xpt491
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/navigator/NavigatorGroup.xpt129
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/navigator/NavigatorItem.xpt109
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/navigator/NavigatorLabelProvider.xpt424
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/navigator/NavigatorLinkHelper.xpt132
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/navigator/NavigatorSorter.xpt58
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/navigator/Utils.ext85
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/navigator/extensions.xpt176
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/navigator/getEditorInput.xpt44
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/navigator/navigatorGroup.gifbin709 -> 0 bytes
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/plugin/Activator.xpt218
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/plugin/build.xpt26
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/plugin/manifest.xpt75
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/plugin/options.xpt23
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/plugin/plugin.xpt158
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/plugin/properties.xpt53
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/propsheet/LabelProvider.xpt94
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/propsheet/PropertySection.xpt145
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/propsheet/extensions.xpt144
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/providers/EditPartProvider.xpt125
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/providers/ElementInitializers.ext63
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/providers/ElementInitializers.xpt174
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/providers/ElementTypes.xpt257
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/providers/IconProvider.xpt39
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/providers/MarkerNavigationProvider.xpt86
-rwxr-xr-xplugins/org.eclipse.gmf.codegen/templates/xpt/providers/MetricProvider.xpt431
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/providers/Metrics.ext30
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/providers/MetricsResultView.xpt277
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/providers/ModelingAssistantProvider.xpt253
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/providers/ParserUtils.ext27
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/providers/ShortcutsDecoratorProvider.xpt110
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/providers/ValidationDecoratorProvider.xpt393
-rwxr-xr-xplugins/org.eclipse.gmf.codegen/templates/xpt/providers/ValidationProvider.xpt320
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/providers/ViewProvider.xpt227
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/providers/extensions.xpt184
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/providers/i18n.ext26
180 files changed, 1 insertions, 23723 deletions
diff --git a/plugins/org.eclipse.gmf.codegen/.settings/org.eclipse.core.resources.prefs b/plugins/org.eclipse.gmf.codegen/.settings/org.eclipse.core.resources.prefs
index 06ca554cf..e8f690737 100644
--- a/plugins/org.eclipse.gmf.codegen/.settings/org.eclipse.core.resources.prefs
+++ b/plugins/org.eclipse.gmf.codegen/.settings/org.eclipse.core.resources.prefs
@@ -1,6 +1,4 @@
-#Mon Dec 29 13:34:33 CET 2008
+#Mon Mar 16 19:20:08 CET 2009
eclipse.preferences.version=1
-encoding/templates=ISO-8859-1
-encoding/templates-dynmodel=ISO-8859-1
encoding/templates-dynmodel.migrated=ISO-8859-1
encoding/templates.migrated=ISO-8859-1
diff --git a/plugins/org.eclipse.gmf.codegen/templates-dynmodel/Facility.ext b/plugins/org.eclipse.gmf.codegen/templates-dynmodel/Facility.ext
deleted file mode 100644
index e994d63c2..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates-dynmodel/Facility.ext
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Copyright (c) 2008 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/emf/2002/GenModel";
-import "http://www.eclipse.org/emf/2002/Ecore";
-import "http://www.eclipse.org/gmf/2008/GenModel";
-
-String getNameToken(GenPackage gp) : gp.prefix ;
-
-String fieldName(GenPackage gp) : "instance" + getNameToken(gp) ;
-
-// This is a hack, internal use only
-DynamicModelAccess getDMA() : GLOBALVAR DynamicModelAccess ; \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.codegen/templates-dynmodel/Facility.xpt b/plugins/org.eclipse.gmf.codegen/templates-dynmodel/Facility.xpt
deleted file mode 100644
index 4881aa3e8..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates-dynmodel/Facility.xpt
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- * Copyright (c) 2008 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/2008/GenModel"»
-«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
-«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
-
-«EXTENSION Facility»
-
-«DEFINE Main FOR DynamicModelAccess-»
-package «packageName»;
-
-public class «className» {
-
- «EXPAND field(this) FOREACH editorGen.getAllDomainGenPackages(false)-»
-
- «EXPAND xpt::Common::generatedMemberComment»
- private final org.eclipse.emf.ecore.EPackage ePackage;
-
- «EXPAND xpt::Common::generatedMemberComment»
- private «className»(org.eclipse.emf.ecore.EPackage ePackage) {
- this.ePackage = ePackage;
- }
-
- «EXPAND getMethod(this) FOREACH editorGen.getAllDomainGenPackages(false)-»
-
- «EXPAND getRegistryMethod»
-
- «EXPAND xpt::Common::generatedMemberComment»
- public boolean isInstance(Object obj, String metaClassName) {
- org.eclipse.emf.ecore.EClass metaClass = getEClass(metaClassName);
- return obj instanceof org.eclipse.emf.ecore.EObject && metaClass.isSuperTypeOf(((org.eclipse.emf.ecore.EObject) obj).eClass());
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- public org.eclipse.emf.ecore.EObject newInstance(String metaClassName) {
- return this.ePackage.getEFactoryInstance().create(getEClass(metaClassName));
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- public org.eclipse.emf.ecore.EClass getEClass(String metaClassName) {
- «EXPAND xpt::Common::assert("metaClassName != null")-»
- org.eclipse.emf.ecore.EClass metaClass = findMetaClass(metaClassName);
- assertMetaClass(metaClass, metaClassName);
- return metaClass;
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- public org.eclipse.emf.ecore.EStructuralFeature getEFeature(String metaClassName, String metaFeatureName) {
- «EXPAND xpt::Common::assert("metaFeatureName != null")-»
- org.eclipse.emf.ecore.EClass metaClass = getEClass(metaClassName);
- org.eclipse.emf.ecore.EStructuralFeature f = metaClass.getEStructuralFeature(metaFeatureName);
- assertMetaFeature(f, metaClass, metaFeatureName);
- return f;
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- public org.eclipse.emf.ecore.EAttribute getEAttribute(String metaClassName, String metaFeatureName) {
- return (org.eclipse.emf.ecore.EAttribute) getEFeature(metaClassName, metaFeatureName);
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- public org.eclipse.emf.ecore.EReference getEReference(String metaClassName, String metaFeatureName) {
- return (org.eclipse.emf.ecore.EReference) getEFeature(metaClassName, metaFeatureName);
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- public org.eclipse.emf.ecore.EDataType getEDataType(String metaClassName) {
- «EXPAND xpt::Common::assert("metaClassName != null")-»
- org.eclipse.emf.ecore.EClassifier c = this.ePackage.getEClassifier(metaClassName);
- if (false == c instanceof org.eclipse.emf.ecore.EDataType) {
- return null;
- }
- return (org.eclipse.emf.ecore.EDataType) c;
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- public org.eclipse.emf.ecore.EEnum getEEnum(String metaClassName) {
- «EXPAND xpt::Common::assert("metaClassName != null")-»
- org.eclipse.emf.ecore.EClassifier c = this.ePackage.getEClassifier(metaClassName);
- if (false == c instanceof org.eclipse.emf.ecore.EEnum) {
- return null;
- }
- return (org.eclipse.emf.ecore.EEnum) c;
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- private org.eclipse.emf.ecore.EClass findMetaClass(String name) {
- org.eclipse.emf.ecore.EClassifier c = this.ePackage.getEClassifier(name);
- if (false == c instanceof org.eclipse.emf.ecore.EClass) {
- return null;
- }
- return (org.eclipse.emf.ecore.EClass) c;
- }
-
- «EXPAND xpt::Common::generatedMemberComment("Default implementation throws IllegalStateException if metaclass is null")»
- private void assertMetaClass(org.eclipse.emf.ecore.EClass metaClass, String metaClassName) {
- if (metaClass == null) {
- throw new IllegalStateException(java.text.MessageFormat.format("Can't find class {0} in the package {1}", new Object[] {metaClassName, this.ePackage.getName()}));
- }
- }
-
- «EXPAND xpt::Common::generatedMemberComment("Default implementation throws IllegalStateException if meta-feature is null")»
- private void assertMetaFeature(org.eclipse.emf.ecore.EStructuralFeature metaFeature, org.eclipse.emf.ecore.EClass metaClass, String featureName) {
- if (metaFeature == null) {
- throw new IllegalStateException(java.text.MessageFormat.format("Can't find feature {0} of class {1} in the package {2}", new Object[] {featureName, metaClass.getName(), this.ePackage.getName()}));
- }
- }
-
- «EXPAND initMethod FOREACH editorGen.getAllDomainGenPackages(false)-»
-«EXPAND additions-»
-}
-«ENDDEFINE»
-
-«DEFINE additions FOR DynamicModelAccess»«ENDDEFINE»
-
-«DEFINE field(DynamicModelAccess dma) FOR GenPackage-»
-«EXPAND xpt::Common::generatedMemberComment»
-private static «dma.className» «fieldName()»;
-«ENDDEFINE»
-
-«DEFINE getMethod(DynamicModelAccess dma) FOR GenPackage-»
- «EXPAND xpt::Common::generatedMemberComment("@throws IllegalStateException if no EPackage with given URI is registered.")»
- public static «dma.className» get«getNameToken()»() {
- if («fieldName()» == null) {
- org.eclipse.emf.ecore.EPackage pkg = getRegistry().getEPackage("«ecorePackage.nsURI»");
- if (pkg == null) {
- throw new IllegalStateException("Package «ecorePackage.name»(«ecorePackage.nsURI») not found");
- }
- «fieldName()» = new «dma.className»(pkg);
- «fieldName()».init«getNameToken()»();
- }
- return «fieldName()»;
- }
-«ENDDEFINE»
-
-«DEFINE initMethod FOR GenPackage-»
- «EXPAND xpt::Common::generatedMemberComment»
- private void init«getNameToken()»() {
- }
-«ENDDEFINE»
-
-«DEFINE getRegistryMethod FOR DynamicModelAccess»
- «EXPAND xpt::Common::generatedMemberComment("Default implementation returns global registry, clients that need another may redefine.")»
- private static org.eclipse.emf.ecore.EPackage.Registry getRegistry() {
- return org.eclipse.emf.ecore.EPackage.Registry.INSTANCE;
- }
-«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.codegen/templates-dynmodel/MetaModel.xpt b/plugins/org.eclipse.gmf.codegen/templates-dynmodel/MetaModel.xpt
deleted file mode 100644
index c9e8a5fea..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates-dynmodel/MetaModel.xpt
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * Copyright (c) 2008 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/2008/GenModel"»
-«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
-«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
-
-«EXTENSION Facility»
-«EXTENSION xpt::GenModelUtils»
-
-// XXX is isExternalInterface use valid here, won't all objects be just EObject?
-
-«DEFINE IsInstance(String accessor) FOR GenClass-»
-«getDMA().getQualifiedClassName()».get«getNameToken(genPackage)»().isInstance(«accessor», "«ecoreClass.name»")«ENDDEFINE»
-
-«DEFINE NotInstance(String accessor) FOR GenClass»!«EXPAND IsInstance(accessor)»«ENDDEFINE»
-
-«DEFINE IsContainerInstance(String object, GenClass metaClass) FOR GenClass-»
-«getDMA().getQualifiedClassName()».get«getNameToken(genPackage)»().isInstance(«IF isExternalInterface()»((org.eclipse.emf.ecore.EObject) «object»)«ELSE»«object»«ENDIF».eContainer(), "«ecoreClass.name»")«ENDDEFINE»
-
-«DEFINE getFeatureValue(String containerVar, genmodel::GenClass containerClass) FOR genmodel::GenFeature-»
-((«EXPAND featureTargetType») «IF isExternalInterface(containerClass)-»
-((org.eclipse.emf.ecore.EObject) «containerVar»)«ELSE-»
-«containerVar»«ENDIF-»
-.eGet(«EXPAND MetaFeature»))«ENDDEFINE»
-
-«DEFINE featureTargetType FOR GenFeature-»
-«EXPAND _featureTargetType(this) FOR ecoreFeature-»
-«ENDDEFINE»
-
-«DEFINE _featureTargetType(GenFeature gf) FOR EStructuralFeature»NO-OP«ENDDEFINE»
-«DEFINE _featureTargetType(GenFeature gf) FOR EReference-»
-«IF isListType(gf)»java.util.List«ELSE»org.eclipse.emf.ecore.EObject«ENDIF-»
-«ENDDEFINE»
-«DEFINE _featureTargetType(GenFeature gf) FOR EAttribute-»
-«IF isListType(gf)»java.util.List«ELSE»«getObjectCompatibleClassName(eAttributeType)»«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE getFeatureValue(String containerVar, genmodel::GenClass container, boolean needsCastToResultType) FOR genmodel::GenFeature-»
-// ??? FIXME
-«ENDDEFINE»
-
-«DEFINE setFeatureValue(String containerVar, genmodel::GenClass containerClass, String valueVar) FOR genmodel::GenFeature-»
-«IF isExternalInterface(containerClass)-»
-((org.eclipse.emf.ecore.EObject) «containerVar»)«ELSE-»
-«containerVar»«ENDIF-»
-.eSet(«EXPAND MetaFeature», «valueVar»)«ENDDEFINE»
-
-«DEFINE setFeatureValue(String containerVar, genmodel::GenClass containerClass, String valueVar, boolean isPlainObjectValue) FOR genmodel::GenFeature-»
-«EXPAND setFeatureValue(containerVar, containerClass, valueVar)»«ENDDEFINE»
-
-«DEFINE MetaClass FOR genmodel::GenDataType»«getDMA().getQualifiedClassName()».get«getNameToken(genPackage)»().getEDataType("«ecoreDataType.name»")«ENDDEFINE»
-«DEFINE MetaClass FOR genmodel::GenEnum»«getDMA().getQualifiedClassName()».get«getNameToken(genPackage)»().getEEnum("«ecoreEnum.name»")«ENDDEFINE»
-«DEFINE MetaClass FOR genmodel::GenClass»«getDMA().getQualifiedClassName()».get«getNameToken(genPackage)»().getEClass("«ecoreClass.name»")«ENDDEFINE»
-
-«DEFINE MetaFeature FOR genmodel::GenFeature»«EXPAND _metaFeature(ecoreFeature)»«ENDDEFINE»
-
-«DEFINE _metaFeature(EStructuralFeature f) FOR GenFeature»no-op«ENDDEFINE»
-«DEFINE _metaFeature(EReference eRef) FOR GenFeature»«getDMA().getQualifiedClassName()».get«getNameToken(genClass.genPackage)»().getEReference("«genClass.ecoreClass.name»", "«ecoreFeature.name»")«ENDDEFINE»
-«DEFINE _metaFeature(EAttribute eAttr) FOR GenFeature»«getDMA().getQualifiedClassName()».get«getNameToken(genClass.genPackage)»().getEAttribute("«genClass.ecoreClass.name»", "«ecoreFeature.name»")«ENDDEFINE»
-
-«DEFINE NewInstance FOR genmodel::GenClass-»
-«getDMA().getQualifiedClassName()».get«getNameToken(genPackage)»().newInstance("«ecoreClass.name»")«ENDDEFINE»
-
-«DEFINE NewInstance(String varName) FOR genmodel::GenClass-»
-org.eclipse.emf.ecore.EObject «varName» = «EXPAND NewInstance»;«ENDDEFINE»
-
-«DEFINE DowncastToEObject(String value) FOR genmodel::GenClass»«IF isExternalInterface()»(org.eclipse.emf.ecore.EObject) «ENDIF»«value»«ENDDEFINE»
-
-«DEFINE DeclareAndAssign(String assignee, String value) FOR GenClass-»
-org.eclipse.emf.ecore.EObject «assignee» = «value»;«ENDDEFINE»
-
-«DEFINE DeclareAndAssign(String assignee, String value, boolean isPlainObjectValue) FOR GenClass-»
-org.eclipse.emf.ecore.EObject «assignee» = «IF isPlainObjectValue»(org.eclipse.emf.ecore.EObject)«ENDIF»«value»;«ENDDEFINE»
-
-«DEFINE DeclareAndAssign(String assignee, String value, boolean isPlainObjectValue) FOR GenClassifier»NO-OP«ENDDEFINE»
-
-«DEFINE DeclareAndAssign(String assignee, String value, boolean isPlainObjectValue) FOR GenDataType-»
-«EXPAND QualifiedClassName» «assignee» = («EXPAND QualifiedClassName») «value»;«ENDDEFINE»
-
-
-«DEFINE DeclareAndAssignContainer(String assignee, String object, GenClass metaClass) FOR GenClass-»
-org.eclipse.emf.ecore.EObject «assignee» = «IF isExternalInterface(metaClass)»((org.eclipse.emf.ecore.EObject) «object»)«ELSE»«object»«ENDIF».eContainer();«ENDDEFINE»
-
-// FIXME - feature value is not necessarily of EObject type
-«DEFINE DeclareAndAssign(String assignee, String src, GenClass srcMetaClass, GenFeature srcFeature) FOR GenClass-»
-org.eclipse.emf.ecore.EObject «assignee» = «EXPAND getFeatureValue(src, srcMetaClass) FOR srcFeature»;«ENDDEFINE»
-
-«DEFINE DeclareAndAssign2(String assignee, String src, GenClass srcMetaClass, GenFeature srcFeature, String srcExt, boolean needCast) FOR GenClass-»
-org.eclipse.emf.ecore.EObject «assignee» = «EXPAND getFeatureValue(src, srcMetaClass) FOR srcFeature».«srcExt»;«ENDDEFINE»
-
-«DEFINE CastEObject(String eObjectValue) FOR GenClass»«eObjectValue»«ENDDEFINE»
-
-«DEFINE QualifiedClassName FOR GenClassifier»NO-OP«ENDDEFINE»
-«DEFINE QualifiedClassName FOR GenClass»org.eclipse.emf.ecore.EObject«ENDDEFINE»
-«DEFINE QualifiedClassName FOR GenEnum»org.eclipse.emf.common.util.Enumerator«ENDDEFINE»
-«DEFINE QualifiedClassName FOR GenDataType»«getObjectCompatibleClassName(ecoreDataType)»«ENDDEFINE»
-
-«DEFINE PopulateItemProviderFactories(String factoryListVar) FOR GenEditorGenerator-»
-«REM»
- NO-OP since ReflectiveItemProviderAdapterFactory should
- get added anyway.
-«ENDREM»«ENDDEFINE»
diff --git a/plugins/org.eclipse.gmf.codegen/templates/MetaModel.ext b/plugins/org.eclipse.gmf.codegen/templates/MetaModel.ext
deleted file mode 100644
index 8f8c8f305..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates/MetaModel.ext
+++ /dev/null
@@ -1,206 +0,0 @@
-/*
- * Copyright (c) 2008 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/emf/2002/GenModel";
-import "http://www.eclipse.org/emf/2002/Ecore";
-
-extension xpt::GenModelUtils reexport;
-
-/*
- * NOTE: Extensions from this file are supposed to be used
- * ONLY from MetaModel.xpt. No other .xpt or .ext should import
- * this file. Common GenModel functionality, unrelated to meta-model
- * access and access to generated model code should go into GenModelUtils.ext.
- */
-
-
-//
-// GenPackageImpl#getQualifiedPackageInterfaceName()
-//
-String getQualifiedPackageInterfaceName(genmodel::GenPackage gp) :
- gp.genModel.suppressEMFMetaData ? getQualifiedPackageClassName(gp) : getReflectionPackageName(gp) + "." + getPackageInterfaceName(gp)
-;
-
-//
-// GenPackageImpl#getQualifiedFactoryInterfaceName()
-//
-String getQualifiedFactoryInterfaceName(genmodel::GenPackage gp) :
- getReflectionPackageName(gp) + "." + getPrefixedName(gp, "Factory")
-;
-
-//
-// GenPackage#getFactoryInstanceName
-//
-String getFactoryInstanceName(genmodel::GenPackage gp) :
- gp.genModel.suppressEMFMetaData ? "INSTANCE" : "eINSTANCE"
-;
-
-//
-// GenPackageImpl#getQualifiedItemProviderAdapterFactoryClassName()
-//
-String getQualifiedItemProviderAdapterFactoryClassName(genmodel::GenPackage gp) :
- getQualifiedPackageName(gp, gp.providerPackageSuffix) + "." + getItemProviderAdapterFactoryClassName(gp)
-;
-
-//
-// GenPackageImpl#getItemProviderAdapterFactoryClassName()
-//
-private String getItemProviderAdapterFactoryClassName(genmodel::GenPackage gp) :
- getPrefixedName(gp, "ItemProviderAdapterFactory")
-;
-
-//
-// GenClass#getQualifiedInterfaceName
-//
-String getQualifiedInterfaceName(genmodel::GenClass gc) :
- null != gc.ecoreClass.instanceClassName
- ? gc.ecoreClass.instanceClassName.replaceAll('\\$', '\\.')
- : (getInterfacePackageName(gc.genPackage) + "." + gc.ecoreClass.name)
-;
-
-//
-// GenPackageImpl#getInterfacePackageName()
-//
-private String getInterfacePackageName(GenPackage gp) :
- getQualifiedPackageName(gp, gp.interfacePackageSuffix)
-;
-
-String getQualifiedClassName(GenClassifier dt) : null ;
-// NOTE GenDataType#getQualifiedInstanceClassName returns primitive types as is,
-// while we return their java.lang wrappers
-String getQualifiedClassName(GenDataType dt) : getObjectCompatibleClassName(dt.ecoreDataType) ;
-String getQualifiedClassName(GenEnum e) : getInterfacePackageName(e.genPackage) + "." + e.ecoreEnum.name
-;
-
-//
-// GenClass#getClassifierAccessorName
-//
-String getClassifierAccessorName(genmodel::GenClassifier gc) :
- switch (gc.getEcoreClassifier().name) {
- case "Class" : "Class_"
- case "Name" : "Name_"
- default : gc.getEcoreClassifier().name
- }
-;
-
-//
-// GenFeature#getFeatureAccessorName
-//
-String getFeatureAccessorName(genmodel::GenFeature gf) :
- gf.genClass.ecoreClass.name + "_" + gf.ecoreFeature.name.toFirstUpper()
-;
-
-// GenFeatureImpl#getAccessorName
-String getAccessorName(genmodel::GenFeature gf) :
- isMapEntryFeature(gf) ? "Typed" + gf.ecoreFeature.name.toFirstUpper() : gf.ecoreFeature.name.toFirstUpper()
-;
-
-// GenFeature#getGetAccessor()
-String getGetAccessor(genmodel::GenFeature gf) :
-JAVA org.eclipse.gmf.internal.codegen.util.GenModelUtils.getGetAccessor(org.eclipse.emf.codegen.ecore.genmodel.GenFeature)
-;
-
-// GenClassImpl#isMapEntry
-boolean isMapEntry(genmodel::GenClass gc) :
- ("java.util.Map.Entry" == gc.ecoreClass.instanceClassName || "java.util.Map$Entry" == gc.ecoreClass.instanceClassName)
- && gc.ecoreClass.getEStructuralFeature("key") != null
- && gc.ecoreClass.getEStructuralFeature("value") != null
-;
-
-
-/*
- * Casts the argument (which is assumed to be of the given source class) to the given target class.
- * A null value may be used for both source and target class to specify the EObject class.
- * If the cast is required, it will be parenthesized as a whole, producing, e.g., ((EObject) o).
- * If the parentheses are not required, use unparenthesizedCast() extension.
- */
-String parenthesizedCast(String what, genmodel::GenClass source, genmodel::GenClass target) :
- needsCast(source, target) ? "(" + unparenthesizedCast(what, source, target) + ")" : what
-;
-
-/*
- * Casts the argument (which is assumed to be of the given source class) to the given target class.
- * A null value may be used for both source and target class to specify the EObject class.
- * If the cast is required, it will NOT be parenthesized as a whole, producing, e.g., (EObject) o.
- * If the parentheses are required, use parenthesizedCast() extension.
- */
-String unparenthesizedCast(String what, genmodel::GenClass source, genmodel::GenClass target) :
- needsCast(source, target) ?
- (target == null ? "(org.eclipse.emf.ecore.EObject)" + what : "(" + target.getQualifiedInterfaceName() + ")" + what)
- : what
-;
-
-//See cast()
-private boolean needsCast(genmodel::GenClass source, genmodel::GenClass target) :
- source == target ? false :
- (target == null ?
- (source != null && source.isExternalInterface()) :
- source == null || target.isExternalInterface() || source.isExternalInterface() || !target.ecoreClass.isSuperTypeOf(source.ecoreClass))
-;
-
-private ecore::EClassifier getEcoreClassifier(genmodel::GenClassifier gc) : null ;
-private ecore::EClassifier getEcoreClassifier(genmodel::GenClass gc) : gc.ecoreClass ;
-private ecore::EClassifier getEcoreClassifier(genmodel::GenDataType gc) : gc.ecoreDataType ;
-
-// GenPackageImpl#getReflectionPackageName()
-private String getReflectionPackageName(genmodel::GenPackage gp) :
- getQualifiedPackageName(gp, gp.metaDataPackageSuffix)
-;
-
-// GenPackageImpl#getQualifiedPackageClassName()
-private String getQualifiedPackageClassName(genmodel::GenPackage gp) :
- getReflectionClassPackageName(gp) + "." + getPackageClassName(gp)
-;
-
-
-// GenPackageImpl#getReflectionClassPackageName()
-private String getReflectionClassPackageName(genmodel::GenPackage gp) :
- getQualifiedPackageName(gp, gp.genModel.suppressInterfaces ? gp.metaDataPackageSuffix : gp.classPackageSuffix)
-;
-
-// GenPackageImpl#getPackageClassName()
-private string getPackageClassName(genmodel::GenPackage gp) :
- !gp.genModel.suppressEMFMetaData && !gp.genModel.suppressInterfaces ? getPackageInterfaceName(gp) + "Impl" : getPackageInterfaceName(gp)
-;
-
-// GenPackageImpl#getPackageInterfaceName()
-private string getPackageInterfaceName(genmodel::GenPackage gp) :
- gp.genModel.suppressEMFMetaData && !gp.genModel.suppressInterfaces ? getPrefixedName(gp, "PackageImpl") : getPrefixedName(gp, "Package")
-;
-
-// GenPackageImpl#getPrefixedName()
-private string getPrefixedName(genmodel::GenPackage gp, String name) :
- null != gp.prefix ? gp.prefix + name : name
-;
-
-// GenPackageImpl#getQualifiedPackageName(String)
-private String getQualifiedPackageName(genmodel::GenPackage gp, String suffix) :
- isBlank(suffix) ? getQualifiedPackageName(gp) : getQualifiedPackageName(gp) + "." + suffix
-;
-
-// GenPackageImpl#getQualifiedPackageName()
-private String getQualifiedPackageName(genmodel::GenPackage gp) :
- isBlank(gp.basePackage) ? safeName(gp.ecorePackage.name) : gp.basePackage + "." + safeName(gp.ecorePackage.name)
-;
-
-// GenFeatureImpl#isMapEntryFeature
-private boolean isMapEntryFeature(genmodel::GenFeature gf) :
- gf.genClass.isMapEntry() && ("key" == gf.ecoreFeature.name || "value" == gf.ecoreFeature.name)
-;
-
-private boolean isBlank(String s) :
- null == s || s.length() == 0
-;
-
-private String safeName(String name) :
-JAVA org.eclipse.emf.codegen.util.CodeGenUtil.safeName(java.lang.String)
-;
diff --git a/plugins/org.eclipse.gmf.codegen/templates/MetaModel.xpt b/plugins/org.eclipse.gmf.codegen/templates/MetaModel.xpt
deleted file mode 100644
index 98e0daaf8..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates/MetaModel.xpt
+++ /dev/null
@@ -1,191 +0,0 @@
-/*
- * Copyright (c) 2008 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/2008/GenModel"»
-«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
-«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
-
-«EXTENSION MetaModel»
-
-/*
- * Does instanceof check.
- */
-«DEFINE IsInstance(String accessor) FOR GenClass-»
-«accessor» instanceof «getQualifiedInterfaceName()»«ENDDEFINE»
-
-// Shorthand, negates IsInstance - handy if you consider
-// different approaches for generated and dynamic models: false == instanceof
-// vs. !MetaModelFacility.isInstance
-«DEFINE NotInstance(String accessor) FOR GenClass-»
-false == «EXPAND IsInstance(accessor)»«ENDDEFINE»
-
-/**
- * Special kind of instanceof check, that compares eContainer() of the object.
- * Since metaClass may be an external interface, eContainer() might need cast to EObject
- */
-«DEFINE IsContainerInstance(String object, GenClass metaClass) FOR GenClass-»
-«EXPAND _getEObjectFeature(object, "eContainer()") FOR metaClass» instanceof «getQualifiedInterfaceName()»«ENDDEFINE»
-
-«DEFINE _getEObjectFeature(String object, String feature) FOR GenClass-»
-«IF isExternalInterface()»((org.eclipse.emf.ecore.EObject) «object»).«feature»«ELSE»«object».«feature»«ENDIF-»
-«ENDDEFINE»
-
-// Public/API-sort templates are named with first letter capitalized.
-// FIXME getFeatureValue* and setFeatureValue start with lowercase to indicate pending refactoring
-
-«DEFINE getFeatureValue(String containerVar, genmodel::GenClass containerClass) FOR genmodel::GenFeature-»
-«IF isExternalInterface(containerClass)-»
-((«EXPAND featureTargetType») ((org.eclipse.emf.ecore.EObject) «containerVar»).eGet(«EXPAND MetaFeature»))«-»
-«ELSE-»
-«containerVar».«getGetAccessor()»()«-»
-«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE featureTargetType FOR GenFeature»«IF isListType()»java.util.List«ELSE»«EXPAND QualifiedClassName FOR findGenClassifier(genClass.genPackage.genModel, ecoreFeature.eType)»«ENDIF»«ENDDEFINE»
-
-/*
- * FIXME leave only one version of these two getFeatureValue
- *
- * A slightly more sophisticated version of getFeatureValue().
- * @param containerName the name of the container
- * @param feature the feature whose value is in interest
- * @param containerMetaClass the <code>GenClass</code> of the container, or <code>null</code>, if the container is declared as an <code>org.eclipse.emf.ecore.EObject</code>.
- * @param needsCastToResultType whether the cast to the result type is required (this parameter is only used if the <code>org.eclipse.emf.ecore.EClass</code> this feature belongs to is an external interface).
- */
-«DEFINE getFeatureValue(String containerVar, genmodel::GenClass container, boolean needsCastToResultType) FOR genmodel::GenFeature-»
-«IF isExternalInterface(genClass)-»
-«IF needsCastToResultType»((«EXPAND featureTargetType») «ENDIF»«containerVar.parenthesizedCast(container, null)».eGet(«EXPAND MetaFeature»)«IF needsCastToResultType»)«ENDIF-»
-«ELSE-»
-«containerVar.parenthesizedCast(container, genClass)».«getGetAccessor()»()«-»
-«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE modifyFeature(String targetVar, GenClass targetType, String value) FOR GenFeature-»
-«IF isListType()-»
-«EXPAND getFeatureValue(targetVar, targetType)».add(«value»);«-»
-«ELSE-»
-«EXPAND setFeatureValue(targetVar, targetType, value)»;«-»
-«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE replaceFeatureValue(String targetVar, GenClass targetType, String oldValue, String newValue) FOR GenFeature-»
-«IF isListType()-»
- «EXPAND getFeatureValue(targetVar, targetType)».remove(«oldValue»);
-«ENDIF-»
- «EXPAND modifyFeature(targetVar, targetType, newValue)-»
-«ENDDEFINE»
-
-«DEFINE moveFeatureValue(String oldTarget, String newTarget, GenClass targetType, String value) FOR GenFeature-»
-«IF isListType()-»
- «EXPAND getFeatureValue(oldTarget, targetType)».remove(«value»);
-«ELSE-»
- «EXPAND setFeatureValue(oldTarget, targetType, "null")»;
-«ENDIF-»
- «EXPAND modifyFeature(newTarget, targetType, value)-»
-«ENDDEFINE»
-
-«DEFINE setFeatureValue(String targetVar, genmodel::GenClass targetType, String valueVar) FOR genmodel::GenFeature-»
-«EXPAND setFeatureValue(targetVar, targetType, valueVar, false)»«ENDDEFINE»
-
-// FIXME support list features as well, i.e. do .add() instead of eSet
-«DEFINE setFeatureValue(String targetVar, genmodel::GenClass targetType, String valueVar, boolean isPlainObjectValue) FOR genmodel::GenFeature-»
-«IF isExternalInterface(targetType)-»
-((org.eclipse.emf.ecore.EObject) «targetVar»).eSet(«EXPAND MetaFeature», «valueVar»)«-»
-«ELSE-»
-«targetVar».set«getAccessorName(this)»(«IF !isPlainObjectValue»«valueVar»«ELSE»«IF isPrimitiveType()»«EXPAND _unwrapObjectToPrimitiveValue(valueVar)»«ELSE»(«EXPAND featureTargetType») «valueVar»«ENDIF»«ENDIF»)«-»
-«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE _unwrapObjectToPrimitiveValue(String valueVar) FOR GenFeature-»
-((«EXPAND featureTargetType») «valueVar»).«ecoreFeature.eType.instanceClassName»Value()«ENDDEFINE»
-
-«DEFINE MetaClass FOR genmodel::GenClassifier»«getQualifiedPackageInterfaceName(genPackage)».eINSTANCE.get«getClassifierAccessorName(this)»()«ENDDEFINE»
-
-«DEFINE MetaFeature FOR genmodel::GenFeature»«getQualifiedPackageInterfaceName(genClass.genPackage)».eINSTANCE.get«getFeatureAccessorName(this)»()«ENDDEFINE»
-
-// SomeFactory.eINSTANCE.createBlaBla();
-//NB: for map entries, the resulting type is EObject, not the qualified interface name. If cast is needed, use (un)parenthesizedCast() extension.
-//see GenClassImpl#hasFactoryInterfaceCreateMethod() for details why map entries should be treated differently
-«DEFINE NewInstance FOR genmodel::GenClass-»
-«IF isMapEntry()-»
-«genPackage.getQualifiedFactoryInterfaceName()».«genPackage.getFactoryInstanceName()».create(«EXPAND MetaClass»)«ELSE-»
-«genPackage.getQualifiedFactoryInterfaceName()».«genPackage.getFactoryInstanceName()».create«ecoreClass.name»()«ENDIF-»
-«ENDDEFINE»
-
-// XXX Need to take into account possible GenClass from generated and always available code
-// e.g. Notation or Ecore
-
-«DEFINE NewInstance(String varName) FOR genmodel::GenClass-»
-«getQualifiedInterfaceName()» «varName» = «IF isMapEntry()»(«getQualifiedInterfaceName()») «ENDIF»«EXPAND NewInstance»;
-«ENDDEFINE»
-
-/*
- * Ensures value is of type EObject, may be no-op if context GenClass is compatible with EObject.
- * Note, injected value is not surrounded with parenthesis, may need to introduce another
- * template to accomplish that if needed.
- */
-«DEFINE DowncastToEObject(String value) FOR genmodel::GenClass»«IF isExternalInterface()»(org.eclipse.emf.ecore.EObject) «ENDIF»«value»«ENDDEFINE»
-
-/*
- * Declares new variable of appropriate type and assigns casted value to it.
- */
-«DEFINE DeclareAndAssign(String assignee, String value) FOR GenClass-»
-«getQualifiedInterfaceName()» «assignee» = («getQualifiedInterfaceName()») «value»;«ENDDEFINE»
-
-/*
- * third boolean parameter is to indicate the value is not EObject, so may
- * need extra cast in case dynamic model instances are in use.
- */
-«DEFINE DeclareAndAssign(String assignee, String value, boolean isPlainObjectValue) FOR GenClass-»
-«EXPAND DeclareAndAssign(assignee, value)»«ENDDEFINE»
-
-«DEFINE DeclareAndAssign(String assignee, String value, boolean isPlainObjectValue) FOR GenClassifier-»
-«getQualifiedClassName()» «assignee» = («getQualifiedClassName()») «value»;«ENDDEFINE»
-
-// @see IsContainerInstance
-«DEFINE DeclareAndAssignContainer(String assignee, String object, GenClass metaClass) FOR GenClass-»
-«getQualifiedInterfaceName()» «assignee» = («getQualifiedInterfaceName()») «EXPAND _getEObjectFeature(object, "eContainer()") FOR metaClass»;«ENDDEFINE»
-
-/*
- * Declares new variable of context type and assignes a value obtained from 'src',
- * which is of type 'srcMetaClass', via 'srcFeature'
- *
- * XXX in certain scenarions may need extra cast of the feature value
- */
-«DEFINE DeclareAndAssign(String assignee, String src, GenClass srcMetaClass, GenFeature srcFeature) FOR GenClass-»
-«getQualifiedInterfaceName()» «assignee» = «EXPAND getFeatureValue(src, srcMetaClass) FOR srcFeature»;«ENDDEFINE»
-
-/*
- * Same as DeclareAndAssign, with extra operation applied to source object
- */
-«DEFINE DeclareAndAssign2(String assignee, String src, GenClass srcMetaClass, GenFeature srcFeature, String srcExt, boolean needCast) FOR GenClass-»
-«getQualifiedInterfaceName()» «assignee» = «IF needCast»(«getQualifiedInterfaceName()») «ENDIF»«EXPAND getFeatureValue(src, srcMetaClass) FOR srcFeature».«srcExt»;«ENDDEFINE»
-
-/*
- * Cast value of type EObject to specific type. Would be no-op with dynamic model instances,
- * therefore, the fact eObjectValue is actually EObject is essential
- */
-«DEFINE CastEObject(String eObjectValue) FOR GenClass»(«getQualifiedInterfaceName()») «eObjectValue»«ENDDEFINE»
-
-/**
- * Qualified interface name of the generated EClass, or EObject for dynamic models.
- * Use whenever class name is inevitable (e.g. method arguments)
- * SHOULD NEVER APPEAR in instanceof or any other similar comparison operation
- */
-«DEFINE QualifiedClassName FOR GenClass»«getQualifiedInterfaceName()»«ENDDEFINE»
-«DEFINE QualifiedClassName FOR GenClassifier»«getQualifiedClassName()»«ENDDEFINE»
-
-«DEFINE PopulateItemProviderFactories(String factoryListVar) FOR GenEditorGenerator-»
-«FOREACH getAllDomainGenPackages(true) AS genPackage-»
- «factoryListVar».add(new «genPackage.getQualifiedItemProviderAdapterFactoryClassName()»());
-«ENDFOREACH-»
-«ENDDEFINE»
diff --git a/plugins/org.eclipse.gmf.codegen/templates/diagram/editparts/ChildNodeLabelEditPart.xpt b/plugins/org.eclipse.gmf.codegen/templates/diagram/editparts/ChildNodeLabelEditPart.xpt
deleted file mode 100644
index 0c341b7e6..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates/diagram/editparts/ChildNodeLabelEditPart.xpt
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Copyright (c) 2006, 2008 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:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Alexander Shatalin (Borland) - initial API and implementation
- */
-
-«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
-
-«EXTENSION xpt::diagram::editparts::Utils»
-
-«DEFINE Main FOR gmfgen::GenChildLabelNode-»
-«EXPAND xpt::Common::copyright FOR getDiagram().editorGen-»
-package «getDiagram().editPartsPackageName»;
-
-«EXPAND xpt::Common::generatedClassComment»
-public class «editPartClassName» «EXPAND extendsList» «EXPAND implementsList» {
-
- «EXPAND attributes-»
-
- «EXPAND impl::diagram::editparts::ChildNodeLabelEditPart::contsructor-»
-
- «EXPAND getDragTracker-»
-
- «EXPAND createDefaultEditPolicies-»
-
- «EXPAND impl::diagram::editparts::TextAware::methods(false, labelReadOnly, labelElementIcon, viewmap, labelModelFacet, this, getDiagram())-»
-
- «EXPAND xpt::diagram::editparts::Common::notationalListeners-»
-
-«IF getAssistantOutgoingLinks(this).size() > 0-»
- «EXPAND impl::diagram::editparts::NodeEditPart::getMARelTypesOnSource-»
-
- «EXPAND impl::diagram::editparts::NodeEditPart::getMARelTypesOnSourceAndTarget-»
-
- «EXPAND impl::diagram::editparts::NodeEditPart::getMATypesForTarget-»
-«ENDIF-»
-
-«IF getAssistantIncomingLinks(this).size() > 0-»
- «EXPAND impl::diagram::editparts::NodeEditPart::getMARelTypesOnTarget-»
-
- «EXPAND impl::diagram::editparts::NodeEditPart::getMATypesForSource-»
-«ENDIF-»
-
- «EXPAND handleNotificationEvent-»
-
- «EXPAND xpt::diagram::editparts::Common::labelFigure FOR viewmap-»
-
- «EXPAND additions-»
-}
-«ENDDEFINE»
-
-«DEFINE extendsList FOR gmfgen::GenChildLabelNode»extends org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart«ENDDEFINE»
-
-«DEFINE implementsList FOR gmfgen::GenChildLabelNode»implements org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart«ENDDEFINE»
-
-«DEFINE attributes FOR gmfgen::GenChildLabelNode-»
- «EXPAND xpt::diagram::editparts::Common::visualIDConstant FOR this-»
-
- «EXPAND impl::diagram::editparts::TextAware::fields FOR this-»
-«ENDDEFINE»
-
-«DEFINE getDragTracker FOR gmfgen::GenChildLabelNode-»
- «EXPAND xpt::Common::generatedMemberComment»
-public org.eclipse.gef.DragTracker getDragTracker(org.eclipse.gef.Request request) {
- «EXPAND impl::diagram::editparts::ChildNodeLabelEditPart::getDragTrackerBody-»
-}
-«ENDDEFINE»
-
-«DEFINE createDefaultEditPolicies FOR gmfgen::GenChildLabelNode-»
- «EXPAND xpt::Common::generatedMemberComment»
-protected void createDefaultEditPolicies() {
- «EXPAND impl::diagram::editparts::ChildNodeLabelEditPart::createDefaultEditPoliciesBody-»
-}
-«ENDDEFINE»
-
-«DEFINE handleNotificationEvent FOR gmfgen::GenChildLabelNode-»
- «EXPAND xpt::Common::generatedMemberComment»
-protected void handleNotificationEvent(org.eclipse.emf.common.notify.Notification event) {
- «EXPAND impl::diagram::editparts::ChildNodeLabelEditPart::handleNotificationEventBody-»
-}
-«ENDDEFINE»
-
-«DEFINE additions FOR gmfgen::GenChildLabelNode»«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.codegen/templates/diagram/editparts/CompartmentEditPart.xpt b/plugins/org.eclipse.gmf.codegen/templates/diagram/editparts/CompartmentEditPart.xpt
deleted file mode 100644
index e7faabf18..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates/diagram/editparts/CompartmentEditPart.xpt
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Copyright (c) 2006, 2007 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:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Alexander Shatalin (Borland) - initial API and implementation
- */
-
-«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
-«EXTENSION xpt::diagram::editparts::Utils»
-
-«DEFINE Main FOR gmfgen::GenCompartment-»
-«EXPAND xpt::Common::copyright FOR getDiagram().editorGen-»
-package «getDiagram().editPartsPackageName»;
-
-«EXPAND xpt::Common::generatedClassComment»
-public class «editPartClassName» «EXPAND extendsList» «EXPAND implementsList» {
-
- «EXPAND attributes-»
-
- «EXPAND impl::diagram::editparts::CompartmentEditPart::contsructor-»
-
- «EXPAND impl::diagram::editparts::CompartmentEditPart::hasModelChildrenChanged-»
-
- «EXPAND impl::diagram::editparts::CompartmentEditPart::getCompartmentName-»
-
- «EXPAND impl::diagram::editparts::CompartmentEditPart::createFigure-»
-
- «EXPAND createDefaultEditPolicies-»
-
- «EXPAND impl::diagram::editparts::CompartmentEditPart::refreshVisuals-»
-
- «EXPAND handleNotificationEvent-»
-
- «EXPAND impl::diagram::editparts::CompartmentEditPart::refreshBounds-»
-
- «EXPAND impl::diagram::editparts::CompartmentEditPart::setRatio-»
-
- «EXPAND additions-»
-}
-«ENDDEFINE»
-
-«DEFINE extendsList FOR gmfgen::GenCompartment-»
-extends «IF listLayout»org.eclipse.gmf.runtime.diagram.ui.editparts.ListCompartmentEditPart«ELSE»org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeCompartmentEditPart«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE implementsList FOR gmfgen::GenCompartment»«ENDDEFINE»
-
-«DEFINE attributes FOR gmfgen::GenCompartment-»
- «EXPAND xpt::diagram::editparts::Common::visualIDConstant FOR this-»
-«ENDDEFINE»
-
-«DEFINE createDefaultEditPolicies FOR gmfgen::GenCompartment-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected void createDefaultEditPolicies() {
- «EXPAND impl::diagram::editparts::CompartmentEditPart::createDefaultEditPoliciesBody-»
- }
-«ENDDEFINE»
-
-«DEFINE handleNotificationEvent FOR gmfgen::GenCompartment-»
- «IF isStoringChildPositions(node)-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected void handleNotificationEvent(org.eclipse.emf.common.notify.Notification notification) {
- «EXPAND impl::diagram::editparts::CompartmentEditPart::handleNotificationEventBody-»
- }
- «ENDIF-»
-«ENDDEFINE»
-
-«DEFINE additions FOR gmfgen::GenCompartment»«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.codegen/templates/diagram/editparts/DiagramEditPart.xpt b/plugins/org.eclipse.gmf.codegen/templates/diagram/editparts/DiagramEditPart.xpt
deleted file mode 100644
index a3a9eaeb9..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates/diagram/editparts/DiagramEditPart.xpt
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright (c) 2006, 2007 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:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Alexander Shatalin (Borland) - initial API and implementation
- */
-
-«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
-
-«DEFINE Main FOR gmfgen::GenDiagram-»
-«EXPAND xpt::Common::copyright FOR editorGen-»
-package «editPartsPackageName»;
-
-«EXPAND xpt::Common::generatedClassComment»
-public class «editPartClassName» «EXPAND extendsList» «EXPAND implementsList» {
-
- «EXPAND attributes-»
-
- «EXPAND impl::diagram::editparts::DiagramEditPart::constructor-»
-
- «EXPAND createDefaultEditPolicies-»
-
- «EXPAND impl::diagram::editparts::DiagramEditPart::createFigure-»
-
- «EXPAND additions-»
-}
-«ENDDEFINE»
-
-«DEFINE extendsList FOR gmfgen::GenDiagram»extends org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart«ENDDEFINE»
-
-«DEFINE implementsList FOR gmfgen::GenDiagram»«ENDDEFINE»
-
-«DEFINE attributes FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
- public final static String MODEL_ID = "«editorGen.modelID»"; «EXPAND xpt::Common::nonNLS»
-
- «EXPAND xpt::diagram::editparts::Common::visualIDConstant FOR this-»
-«ENDDEFINE»
-
-«DEFINE createDefaultEditPolicies FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected void createDefaultEditPolicies() {
- «EXPAND impl::diagram::editparts::DiagramEditPart::createDefaultEditPoliciesBody-»
- }
-«ENDDEFINE»
-
-«DEFINE definionName FOR gmfgen::GenDiagram-»
-«ENDDEFINE»
-
-«DEFINE definionName FOR gmfgen::GenDiagram-»
-«ENDDEFINE»
-
-«DEFINE definionName FOR gmfgen::GenDiagram-»
-«ENDDEFINE»
-
-«DEFINE definionName FOR gmfgen::GenDiagram-»
-«ENDDEFINE»
-
-«DEFINE additions FOR gmfgen::GenDiagram»«ENDDEFINE»
diff --git a/plugins/org.eclipse.gmf.codegen/templates/diagram/editparts/ExternalNodeLabelEditPart.xpt b/plugins/org.eclipse.gmf.codegen/templates/diagram/editparts/ExternalNodeLabelEditPart.xpt
deleted file mode 100644
index 5ffa738ee..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates/diagram/editparts/ExternalNodeLabelEditPart.xpt
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright (c) 2006, 2007 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:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Alexander Shatalin (Borland) - initial API and implementation
- */
-
-«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
-
-«DEFINE Main FOR gmfgen::GenExternalNodeLabel-»
-«EXPAND xpt::Common::copyright FOR getDiagram().editorGen-»
-package «getDiagram().editPartsPackageName»;
-
-«EXPAND xpt::Common::generatedClassComment»
-public class «editPartClassName» «EXPAND extendsList» «EXPAND implementsList» {
-
- «EXPAND attributes-»
-
- «EXPAND impl::diagram::editparts::ExternalNodeLabelEditPart::initializer-»
-
- «EXPAND impl::diagram::editparts::ExternalNodeLabelEditPart::constructor-»
-
- «EXPAND createDefaultEditPolicies-»
-
- «EXPAND impl::diagram::editparts::ExternalNodeLabelEditPart::getBorderItemLocator-»
-
- «EXPAND impl::diagram::editparts::ExternalNodeLabelEditPart::refreshBounds-»
-
- «EXPAND impl::diagram::editparts::TextAware::methods(false, readOnly, elementIcon, viewmap, modelFacet, node, getDiagram())-»
-
- «EXPAND handleNotificationEvent-»
-
- «EXPAND impl::diagram::editparts::ExternalNodeLabelEditPart::createFigure-»
-
- «EXPAND additions-»
-}
-«ENDDEFINE»
-
-«DEFINE extendsList FOR gmfgen::GenExternalNodeLabel»extends org.eclipse.gmf.runtime.diagram.ui.editparts.LabelEditPart«ENDDEFINE»
-
-«DEFINE implementsList FOR gmfgen::GenExternalNodeLabel»implements org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart, org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart«ENDDEFINE»
-
-«DEFINE attributes FOR gmfgen::GenExternalNodeLabel-»
- «EXPAND xpt::diagram::editparts::Common::visualIDConstant FOR this-»
-
- «EXPAND impl::diagram::editparts::TextAware::fields FOR this-»
-«ENDDEFINE»
-
-«DEFINE createDefaultEditPolicies FOR gmfgen::GenExternalNodeLabel-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected void createDefaultEditPolicies() {
- «EXPAND impl::diagram::editparts::ExternalNodeLabelEditPart::createDefaultEditPoliciesBody-»
- }
-«ENDDEFINE»
-
-«DEFINE handleNotificationEvent FOR gmfgen::GenExternalNodeLabel-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected void handleNotificationEvent(org.eclipse.emf.common.notify.Notification event) {
- «EXPAND impl::diagram::editparts::ExternalNodeLabelEditPart::handleNotificationEventBody-»
- }
-«ENDDEFINE»
-
-«DEFINE additions FOR gmfgen::GenExternalNodeLabel»«ENDDEFINE»
diff --git a/plugins/org.eclipse.gmf.codegen/templates/diagram/editparts/LinkEditPart.xpt b/plugins/org.eclipse.gmf.codegen/templates/diagram/editparts/LinkEditPart.xpt
deleted file mode 100644
index e7a85b461..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates/diagram/editparts/LinkEditPart.xpt
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright (c) 2006, 2007 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:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Alexander Shatalin (Borland) - initial API and implementation
- */
-
-«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
-
-«DEFINE Main FOR gmfgen::GenLink-»
-«EXPAND xpt::Common::copyright FOR getDiagram().editorGen-»
-package «getDiagram().editPartsPackageName»;
-
-«EXPAND xpt::Common::generatedClassComment»
-public class «editPartClassName» «EXPAND extendsList» «EXPAND implementsList» {
-
- «EXPAND attributes-»
-
- «EXPAND impl::diagram::editparts::LinkEditPart::constructor-»
-
- «EXPAND createDefaultEditPolicies-»
-
- «EXPAND impl::diagram::editparts::LinkEditPart::addFixedChild-»
-
- «EXPAND impl::diagram::editparts::LinkEditPart::addChildVisual-»
-
- «EXPAND impl::diagram::editparts::LinkEditPart::removeFixedChild-»
-
- «EXPAND impl::diagram::editparts::LinkEditPart::removeChildVisual-»
-
- «EXPAND impl::diagram::editparts::LinkEditPart::createLinkFigure-»
-
- «EXPAND additions-»
-}
-«ENDDEFINE»
-
-«DEFINE extendsList FOR gmfgen::GenLink»extends org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionNodeEditPart«ENDDEFINE»
-
-«DEFINE implementsList FOR gmfgen::GenLink-»
- «IF treeBranch»implements org.eclipse.gmf.runtime.diagram.ui.editparts.ITreeBranchEditPart«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE attributes FOR gmfgen::GenLink-»
- «EXPAND xpt::diagram::editparts::Common::visualIDConstant-»
-«ENDDEFINE»
-
-«DEFINE createDefaultEditPolicies FOR gmfgen::GenLink-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected void createDefaultEditPolicies() {
- «EXPAND impl::diagram::editparts::LinkEditPart::createDefaultEditPoliciesBody-»
- }
-«ENDDEFINE»
-
-«DEFINE additions FOR gmfgen::GenLink-»
-«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.codegen/templates/diagram/editparts/LinkLabelEditPart.xpt b/plugins/org.eclipse.gmf.codegen/templates/diagram/editparts/LinkLabelEditPart.xpt
deleted file mode 100644
index 8f2fae866..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates/diagram/editparts/LinkLabelEditPart.xpt
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright (c) 2006, 2007 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:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Alexander Shatalin (Borland) - initial API and implementation
- */
-
-«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
-
-«DEFINE Main FOR gmfgen::GenLinkLabel-»
-«EXPAND xpt::Common::copyright FOR getDiagram().editorGen-»
-package «getDiagram().editPartsPackageName»;
-
-«EXPAND xpt::Common::generatedClassComment»
-public class «editPartClassName» «EXPAND extendsList» «EXPAND implementsList» {
-
- «EXPAND attributes-»
-
- «EXPAND impl::diagram::editparts::LinkLabelEditPart::initializer-»
-
- «EXPAND impl::diagram::editparts::LinkLabelEditPart::constructor-»
-
- «EXPAND createDefaultEditPolicies-»
-
- «EXPAND impl::diagram::editparts::LinkLabelEditPart::getKeyPoint-»
-
- «EXPAND impl::diagram::editparts::TextAware::methods(false, readOnly, elementIcon, viewmap, modelFacet, link, getDiagram())-»
-
- «EXPAND handleNotificationEvent-»
-
- «EXPAND xpt::diagram::editparts::Common::labelFigure FOR viewmap-»
-
- «EXPAND additions-»
-}
-«ENDDEFINE»
-
-«DEFINE extendsList FOR gmfgen::GenLinkLabel»extends org.eclipse.gmf.runtime.diagram.ui.editparts.LabelEditPart«ENDDEFINE»
-
-«DEFINE implementsList FOR gmfgen::GenLinkLabel»implements org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart«ENDDEFINE»
-
-«DEFINE attributes FOR gmfgen::GenLinkLabel-»
- «EXPAND xpt::diagram::editparts::Common::visualIDConstant-»
-
- «EXPAND impl::diagram::editparts::TextAware::fields-»
-«ENDDEFINE»
-
-«DEFINE createDefaultEditPolicies FOR gmfgen::GenLinkLabel-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected void createDefaultEditPolicies() {
- «EXPAND impl::diagram::editparts::LinkLabelEditPart::createDefaultEditPoliciesBody-»
- }
-«ENDDEFINE»
-
-«DEFINE handleNotificationEvent FOR gmfgen::GenLinkLabel-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected void handleNotificationEvent(org.eclipse.emf.common.notify.Notification event) {
- «EXPAND impl::diagram::editparts::LinkLabelEditPart::handleNotificationEventBody-»
- }
-«ENDDEFINE»
-
-«DEFINE additions FOR gmfgen::GenLinkLabel-»
-«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.codegen/templates/diagram/editparts/NodeEditPart.xpt b/plugins/org.eclipse.gmf.codegen/templates/diagram/editparts/NodeEditPart.xpt
deleted file mode 100644
index 4e93ab2de..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates/diagram/editparts/NodeEditPart.xpt
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * Copyright (c) 2006, 2008 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:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Alexander Shatalin (Borland) - initial API and implementation
- */
-
-«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
-
-«EXTENSION xpt::diagram::editparts::Utils»
-
-«DEFINE Main FOR gmfgen::GenNode-»
-«EXPAND xpt::Common::copyright FOR getDiagram().editorGen-»
-package «getDiagram().editPartsPackageName»;
-
-«EXPAND xpt::Common::generatedClassComment»
-public class «editPartClassName» «EXPAND extendsList» «EXPAND implementsList» {
-
- «EXPAND attributes-»
-
- «EXPAND impl::diagram::editparts::NodeEditPart::constructor-»
-
- «EXPAND createDefaultEditPolicies-»
-
- «EXPAND impl::diagram::editparts::NodeEditPart::createLayoutEditPolicy-»
-
- «EXPAND impl::diagram::editparts::NodeEditPart::createNodeShape(this) FOR viewmap-»
-
-«IF hasFixedChildren()-»
- «EXPAND impl::diagram::editparts::NodeEditPart::addFixedChild-»
-
- «EXPAND impl::diagram::editparts::NodeEditPart::removeFixedChild-»
-
- «EXPAND impl::diagram::editparts::NodeEditPart::addChildVisual-»
-
- «EXPAND impl::diagram::editparts::NodeEditPart::removeChildVisual-»
-
- «EXPAND impl::diagram::editparts::NodeEditPart::getContentPaneFor-»
-«ENDIF-»
-
- «EXPAND impl::diagram::editparts::NodeEditPart::addBorderItem-»
-
- «EXPAND impl::diagram::editparts::NodeEditPart::createNodePlate-»
-
- «EXPAND impl::diagram::editparts::NodeEditPart::getPrimaryDragEditPolicy-»
-
- «EXPAND impl::diagram::editparts::NodeEditPart::createFigure-»
-
- «EXPAND impl::diagram::editparts::NodeEditPart::setupContentPane-»
-
- «EXPAND impl::diagram::editparts::NodeEditPart::getContentPane-»
-
- «EXPAND impl::diagram::editparts::NodeEditPart::setForegroundColor-»
-
- «EXPAND impl::diagram::editparts::NodeEditPart::setBackgroundColor-»
-
- «EXPAND impl::diagram::editparts::NodeEditPart::setLineWidth-»
-
- «EXPAND impl::diagram::editparts::NodeEditPart::setLineStyle-»
-
- «EXPAND impl::diagram::editparts::NodeEditPart::getPrimaryChildEditPart-»
-
-«IF getAssistantOutgoingLinks(this).size() > 0-»
- «EXPAND impl::diagram::editparts::NodeEditPart::getMARelTypesOnSource-»
-
- «EXPAND impl::diagram::editparts::NodeEditPart::getMARelTypesOnSourceAndTarget-»
-
- «EXPAND impl::diagram::editparts::NodeEditPart::getMATypesForTarget-»
-«ENDIF-»
-
-«IF getAssistantIncomingLinks(this).size() > 0-»
- «EXPAND impl::diagram::editparts::NodeEditPart::getMARelTypesOnTarget-»
-
- «EXPAND impl::diagram::editparts::NodeEditPart::getMATypesForSource-»
-«ENDIF-»
-
-«IF hasChildrenInListCompartments(this)-»
- «EXPAND impl::diagram::editparts::NodeEditPart::getTargetEditPartMethod-»
-«ENDIF-»
-
- «EXPAND handleNotificationEvent-»
-
- «EXPAND impl::diagram::editparts::NodeEditPart::innerClassDeclaration FOR viewmap-»
-
- «EXPAND additions-»
-}
-«ENDDEFINE»
-
-«DEFINE extendsList FOR gmfgen::GenNode»extends «EXPAND impl::diagram::editparts::NodeEditPart::extendsListContents»«ENDDEFINE»
-
-«DEFINE implementsList FOR gmfgen::GenNode»«ENDDEFINE»
-
-«DEFINE attributes FOR gmfgen::GenNode-»
- «EXPAND xpt::diagram::editparts::Common::visualIDConstant FOR this-»
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected org.eclipse.draw2d.IFigure contentPane;
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected org.eclipse.draw2d.IFigure primaryShape;
-«ENDDEFINE»
-
-«DEFINE createDefaultEditPolicies FOR gmfgen::GenNode-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected void createDefaultEditPolicies() {
- «EXPAND impl::diagram::editparts::NodeEditPart::createDefaultEditPoliciesBody-»
- }
-«ENDDEFINE»
-
-«DEFINE handleNotificationEvent FOR gmfgen::GenNode-»
-«ENDDEFINE»
-
-«DEFINE handleNotificationEvent FOR gmfgen::GenTopLevelNode-»
- «REM»This code is important for refreshing shortcut decoration
- on adding corresponding annotation to the View instance.«ENDREM»
- «IF getDiagram().generateShortcutIcon()-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected void handleNotificationEvent(org.eclipse.emf.common.notify.Notification event) {
- «EXPAND impl::diagram::editparts::NodeEditPart::handleNotificationEventBody-»
- }
- «ENDIF-»
-«ENDDEFINE»
-
-«DEFINE additions FOR gmfgen::GenNode-»
-«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.codegen/templates/diagram/editparts/NodeLabelEditPart.xpt b/plugins/org.eclipse.gmf.codegen/templates/diagram/editparts/NodeLabelEditPart.xpt
deleted file mode 100644
index b76295f4b..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates/diagram/editparts/NodeLabelEditPart.xpt
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright (c) 2006, 2007 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:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Alexander Shatalin (Borland) - initial API and implementation
- */
-
-«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
-«EXTENSION xpt::diagram::editparts::Utils»
-
-«DEFINE Main FOR gmfgen::GenNodeLabel-»
-«EXPAND xpt::Common::copyright FOR getDiagram().editorGen-»
-package «getDiagram().editPartsPackageName»;
-
-«EXPAND xpt::Common::generatedClassComment»
-public class «editPartClassName» «EXPAND extendsList» «EXPAND implementsList» {
-
- «EXPAND attributes-»
-
- «EXPAND impl::diagram::editparts::NodeLabelEditPart::constructor-»
-
- «EXPAND createDefaultEditPolicies-»
-
- «EXPAND impl::diagram::editparts::TextAware::methods(isStoringChildPositions(node), readOnly, elementIcon, viewmap, modelFacet, node, getDiagram())-»
-
- «EXPAND xpt::diagram::editparts::Common::notationalListeners-»
-
- «EXPAND impl::diagram::editparts::NodeLabelEditPart::refreshBounds-»
-
- «EXPAND handleNotificationEvent-»
-
- «EXPAND xpt::diagram::editparts::Common::labelFigure FOR viewmap-»
-
- «EXPAND additions-»
-}
-«ENDDEFINE»
-
-«DEFINE extendsList FOR gmfgen::GenNodeLabel»extends org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart«ENDDEFINE»
-
-«DEFINE implementsList FOR gmfgen::GenNodeLabel»implements org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart«ENDDEFINE»
-
-«DEFINE attributes FOR gmfgen::GenNodeLabel-»
- «EXPAND xpt::diagram::editparts::Common::visualIDConstant FOR this-»
-
- «EXPAND impl::diagram::editparts::TextAware::fields FOR this-»
-«ENDDEFINE»
-
-«DEFINE createDefaultEditPolicies FOR gmfgen::GenNodeLabel-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected void createDefaultEditPolicies() {
- «EXPAND impl::diagram::editparts::NodeLabelEditPart::createDefaultEditPoliciesBody-»
- }
-«ENDDEFINE»
-
-«DEFINE handleNotificationEvent FOR gmfgen::GenNodeLabel-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected void handleNotificationEvent(org.eclipse.emf.common.notify.Notification event) {
- «EXPAND impl::diagram::editparts::NodeLabelEditPart::handleNotificationEventBody-»
- }
-«ENDDEFINE»
-
-«DEFINE additions FOR gmfgen::GenNodeLabel-»
-«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.codegen/templates/emf-merge.xml b/plugins/org.eclipse.gmf.codegen/templates/emf-merge.xml
deleted file mode 100644
index c6d592a52..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates/emf-merge.xml
+++ /dev/null
@@ -1,233 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<merge:options
- indent=" "
- braceStyle="matching"
- redirect="Gen"
- block="\s*@\s*generated\s*NOT\s*(?:\n\r?|\r\n?)"
- noImport="\s*//\s*import\s+([\w.*]*)\s*;\s*(?:\n\r?|\r\n?)"
- xmlns:merge="http://www.eclipse.org/org/eclipse/emf/codegen/jmerge/Options">
-
-<!-- Tabbed Standard
-
- indent="&#x9;"
- braceStyle="standard"
-
--->
-
- <!-- this accepts both new and old style markup. -->
-
- <merge:dictionaryPattern
- name="modelMembers"
- select="Member/getComment"
- match="@\s*(model)"/>
-
- <merge:dictionaryPattern
- name="generatedUnmodifiableMembers"
- select="Member/getComment"
- match="@\s*(gen)erated\s*(This field/method[^(?:\n\r?|\r\n?)]*)*(?:\n\r?|\r\n?)"/>
-
- <merge:dictionaryPattern
- name="generatedModifiableMembers"
- select="Member/getComment"
- match="@\s*generated\s*(modifiable)\s*(?:\n\r?|\r\n?)"/>
-
- <!-- This is like the above, but for backward compatibility -->
- <merge:dictionaryPattern
- name="generatedLastGenMembers"
- select="Member/getComment"
- match="@\s*(lastgen).*(?:\n\r?|\r\n?)"/>
-
- <merge:dictionaryPattern
- name="orderedMembers"
- select="Member/getComment"
- match="@\s*(ordered)\s*(?:\n\r?|\r\n?)"/>
-
- <!-- Only push Annotations for the Members marked by gen-->
- <merge:push targetParentMarkup="^gen$" select="Annotation"/>
-
- <merge:pull
- sourceMarkup="^modifiable$"
- sourceGet="Member/getComment"
- sourceTransfer="(\s*&lt;!--\s*begin-user-doc.*?end-user-doc\s*-->\s*)(?:\n\r?|\r\n?)"
- targetMarkup="^modifiable$"
- targetPut="Member/setComment"/>
- <merge:pull
- sourceMarkup="^gen$"
- sourceGet="Member/getComment"
- sourceTransfer="(\s*&lt;!--\s*begin-user-doc.*?end-user-doc\s*-->\s*)(?:\n\r?|\r\n?)"
- targetMarkup="^gen$"
- targetPut="Member/setComment"/>
- <merge:pull
- sourceGet="Member/getFlags"
- targetMarkup="^gen$"
- equals="Member/getName"
- targetPut="Member/setFlags"/>
-
- <merge:pull
- sourceMarkup="^gen$"
- sourceGet="AbstractType/getComment"
- sourceTransfer="(\s*&lt;!--\s*begin-user-doc.*?end-user-doc\s*-->\s*)(?:\n\r?|\r\n?)"
- targetMarkup="^modifiable$"
- targetPut="AbstractType/setComment"/>
-
- <merge:pull
- sourceGet="Type/getTypeParameters"
- targetMarkup="^lastgen$|^gen$|^modifiable$|^model$"
- targetPut="Type/setTypeParameters"/>
- <merge:pull
- sourceGet="Type/getSuperclass"
- targetMarkup="^lastgen$|^gen$|^modifiable$|^model$"
- targetPut="Type/setSuperclass"/>
- <merge:pull
- sourceGet="Type/getSuperInterfaces"
- sourceTransfer="(\s*@\s*extends|\s*@\s*implements)(.*?)(?:&lt;!--|(?:\n\r?|\r\n?))"
- targetMarkup="^lastgen$|^gen$|^modifiable$|^model$"
- targetPut="Type/addSuperInterface"/>
-
- <merge:pull
- sourceGet="Enum/getSuperInterfaces"
- sourceTransfer="(\s*@\s*extends|\s*@\s*implements)(.*?)(?:&lt;!--|(?:\n\r?|\r\n?))"
- targetMarkup="^lastgen$|^gen$|^modifiable$|^model$"
- targetPut="Enum/addSuperInterface"/>
-
- <merge:pull
- sourceGet="EnumConstant/getArguments"
- targetMarkup="^lastgen$|^gen$|^modifiable$|^model$"
- targetPut="EnumConstant/setArguments"/>
- <merge:pull
- sourceGet="EnumConstant/getBody"
- targetMarkup="^lastgen$|^gen$|^modifiable$|^model$$"
- targetPut="EnumConstant/setBody"/>
-
- <merge:pull
- sourceGet="AnnotationTypeMember/getType"
- targetMarkup="^gen$"
- targetPut="AnnotationTypeMember/setType"/>
- <merge:pull
- sourceGet="AnnotationTypeMember/getDefaultValue"
- targetMarkup="^gen$"
- targetPut="AnnotationTypeMember/setDefaultValue"/>
-
- <merge:pull
- sourceGet="Initializer/getBody"
- targetMarkup="^gen$"
- targetPut="Initializer/setBody"/>
-
- <merge:pull
- sourceGet="Field/getType"
- targetMarkup="^gen$"
- targetPut="Field/setType"/>
- <merge:pull
- sourceGet="Field/getInitializer"
- targetMarkup="^gen$"
- targetPut="Field/setInitializer"/>
-
- <merge:pull
- sourceGet="Method/getTypeParameters"
- targetMarkup="^gen$"
- targetPut="Method/setTypeParameters"/>
- <merge:pull
- sourceGet="Method/getReturnType"
- targetMarkup="^gen$|^model$"
- targetPut="Method/setReturnType"/>
- <merge:pull
- sourceGet="Method/getParameters"
- targetMarkup="^gen$"
- targetPut="Method/setParameters"/>
- <merge:pull
- sourceGet="Method/getBody"
- targetMarkup="^gen$"
- targetPut="Method/setBody"/>
- <merge:pull
- sourceGet="Method/getExceptions"
- targetMarkup="^gen$"
- targetPut="Method/addException"/>
-
- <merge:sweep markup="^gen$" select="Member"/>
- <merge:sweep markup="^org.eclipse.emf.ecore.EMetaObject$" select="Import"/>
- <merge:sweep markup="^org.eclipse.emf.ecore.impl.EMetaObjectImpl$" select="Import"/>
- <merge:sweep markup="^org.eclipse.emf.ecore.util.EObjectCompositeEList$" select="Import"/>
- <merge:sweep markup="^org.eclipse.emf.ecore.util.EObjectCompositeWithInverseEList$" select="Import"/>
- <merge:sweep markup="^org.eclipse.emf.common.util.AbstractEnumerator$" select="Import"/>
-
- <merge:sort markup="^ordered$" select="Field"/>
- <merge:sort markup="^ordered$" select="EnumConstant"/>
-
-<!-- Basic Rules
-
- <merge:pull
- sourceGet="CompilationUnit/getHeader"
- targetPut="CompilationUnit/setHeader"/>
-
- <merge:pull
- sourceGet="Package/getName"
- targetPut="Package/setName"/>
-
- <merge:pull
- sourceGet="Member/getFlags"
- targetPut="Member/setFlags"/>
- <merge:pull
- sourceGet="Member/getComment"
- targetPut="Member/setComment"/>
-
- <merge:pull
- sourceGet="Type/getSuperclass"
- targetPut="Type/setSuperclass"/>
- <merge:pull
- sourceGet="Type/getSuperInterfaces"
- targetPut="Type/addSuperInterface"/>
-
- <merge:pull
- sourceGet="Initializer/getBody"
- targetPut="Initializer/setBody"/>
-
- <merge:pull
- sourceGet="Field/getType"
- targetPut="Field/setType"/>
- <merge:pull
- sourceGet="Field/getInitializer"
- targetPut="Field/setInitializer"/>
-
- <merge:pull
- sourceGet="Method/getBody"
- targetPut="Method/setBody"/>
- <merge:pull
- sourceGet="Method/getReturnType"
- targetPut="Method/setReturnType"/>
- <merge:pull
- sourceGet="Method/getExceptions"
- targetPut="Method/addException"/>
--->
-
-<!-- Push Enum Constants only for generated Enums -->
-<!--
- <merge:push targetParentMarkup="^gen$" select="EnumConstant"/>
--->
-
-<!-- Push Annotation Type Members only for generated Annotation Types -->
-<!--
- <merge:push targetParentMarkup="^gen$" select="AnnotationTypeMember"/>
--->
-
-<!-- Sets the content of annotations if the parent is marked with gen -->
-<!--
- <merge:pull
- sourceGet="Annotation/getContents"
- targetParentMarkup="^gen$"
- targetPut="Annotation/setContents"/>
--->
-
-<!-- Remove annotations of generated target nodes if the annotation is not in the source -->
-<!--
- <merge:sweep parentMarkup="^gen$" select="Annotation"/>
--->
-
-<!--
- <merge:pull
- sourceMarkup="^modifiable$"
- sourceGet="Member/getComment"
- targetMarkup="^gen$"
- targetPut="Member/setComment"/>
--->
-
-</merge:options>
diff --git a/plugins/org.eclipse.gmf.codegen/templates/impl/actions/CreateShortcutAction.xpt b/plugins/org.eclipse.gmf.codegen/templates/impl/actions/CreateShortcutAction.xpt
deleted file mode 100644
index 3391925e8..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates/impl/actions/CreateShortcutAction.xpt
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Copyright (c) 2006, 2008 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:
- * Alexander Shatalin (Borland) - initial API and implementation
- * Artem Tikhomirov (Borland) - [174961] migration to Commands/Handlers
- */
-
-«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
-«EXTENSION xpt::editor::Utils»
-
-«DEFINE Main FOR gmfgen::CreateShortcutAction-»
-«EXPAND xpt::Common::copyright FOR owner.editorGen-»
-«EXPAND xpt::Common::packageStatement FOR qualifiedClassName»
-
-«EXPAND xpt::Common::generatedClassComment»
-public class «qualifiedClassName.split('\\.').last()»«EXPAND extendsList»«EXPAND implementsList» {
-«EXPAND executeMethod»
-«EXPAND additions-»
-}
-«ENDDEFINE»
-
-«DEFINE extendsList FOR CreateShortcutAction» extends org.eclipse.core.commands.AbstractHandler«ENDDEFINE»
-«DEFINE implementsList FOR CreateShortcutAction»«ENDDEFINE»
-
-«DEFINE executeMethod FOR gmfgen::CreateShortcutAction-»
- «EXPAND xpt::Common::generatedMemberComment»
- public Object execute(org.eclipse.core.commands.ExecutionEvent event) throws org.eclipse.core.commands.ExecutionException {
- org.eclipse.ui.IEditorPart diagramEditor = org.eclipse.ui.handlers.HandlerUtil.getActiveEditorChecked(event);
- org.eclipse.swt.widgets.Shell shell = diagramEditor.getEditorSite().getShell();
- «EXPAND xpt::Common::assert("diagramEditor instanceof org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditor")-»
- org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain = ((org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditor) diagramEditor).getEditingDomain();
- org.eclipse.jface.viewers.ISelection selection = org.eclipse.ui.handlers.HandlerUtil.getCurrentSelectionChecked(event);
- «EXPAND xpt::Common::assert("selection instanceof org.eclipse.jface.viewers.IStructuredSelection")-»
- «EXPAND xpt::Common::assert("((org.eclipse.jface.viewers.IStructuredSelection) selection).size() == 1")-»
- «EXPAND xpt::Common::assert("((org.eclipse.jface.viewers.IStructuredSelection) selection).getFirstElement() instanceof org.eclipse.gef.EditPart")-»
- org.eclipse.gef.EditPart selectedDiagramPart = (org.eclipse.gef.EditPart) ((org.eclipse.jface.viewers.IStructuredSelection) selection).getFirstElement();
- final org.eclipse.gmf.runtime.notation.View view = (org.eclipse.gmf.runtime.notation.View) selectedDiagramPart.getModel();
-«IF null == owner.editorGen.application-»
- «owner.editorGen.diagram.getElementChooserQualifiedClassName()» elementChooser = new «owner.editorGen.diagram.getElementChooserQualifiedClassName()»(shell, view);
- int result = elementChooser.open();
- if (result != org.eclipse.jface.window.Window.OK) {
- return null;
- }
- org.eclipse.emf.common.util.URI selectedModelElementURI = elementChooser.getSelectedModelElementURI();
- final org.eclipse.emf.ecore.EObject selectedElement;
- try {
- selectedElement = editingDomain.getResourceSet().getEObject(selectedModelElementURI, true);
- } catch (org.eclipse.emf.common.util.WrappedException e) {
- «owner.editorGen.plugin.getActivatorQualifiedClassName()».getInstance().logError("Exception while loading object: " + selectedModelElementURI.toString(), e);«EXPAND xpt::Common::nonNLS»
- return null;
- }
-
- if (selectedElement == null) {
- return null;
- }
- org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest.ViewDescriptor viewDescriptor = new org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest.ViewDescriptor(new org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter(selectedElement), org.eclipse.gmf.runtime.notation.Node.class, null, «EXPAND xpt::plugin::Activator::preferenceHintAccess FOR owner.editorGen»);
- org.eclipse.gmf.runtime.common.core.command.ICommand command = new org.eclipse.gmf.runtime.diagram.ui.commands.CreateCommand(editingDomain, viewDescriptor, view);
- command = command.compose(new «owner.editorGen.diagram.getCreateShortcutDecorationsCommandQualifiedClassName()»(editingDomain, view, viewDescriptor));
- try {
- org.eclipse.core.commands.operations.OperationHistoryFactory.getOperationHistory().execute(command, new org.eclipse.core.runtime.NullProgressMonitor(), null);
- } catch (org.eclipse.core.commands.ExecutionException e) {
- «owner.editorGen.plugin.getActivatorQualifiedClassName()».getInstance().logError("Unable to create shortcut", e);«EXPAND xpt::Common::nonNLS»
- }
-«ELSE-»
- org.eclipse.emf.ecore.resource.Resource resource = «owner.editorGen.diagram.getDiagramEditorUtilQualifiedClassName()».openModel(shell, «EXPAND xpt::Externalizer::accessorCall(titleKey(i18nKeyForCreateShortcutOpenModel())) FOR owner.editorGen», editingDomain);
- if (resource == null || resource.getContents().isEmpty()) {
- return null;
- }
- «EXPAND xpt::editor::ShortcutCreationWizard::qualifiedClassName FOR owner.editorGen.diagram» wizard = new «EXPAND xpt::editor::ShortcutCreationWizard::qualifiedClassName FOR owner.editorGen.diagram»((org.eclipse.emf.ecore.EObject) resource.getContents().get(0), view, editingDomain);
- wizard.setWindowTitle(«EXPAND xpt::Externalizer::accessorCall(titleKey(i18nKeyForCreateShortcutWizard())) FOR owner.editorGen»);
- «owner.editorGen.diagram.getDiagramEditorUtilQualifiedClassName()».runWizard(myShell, wizard, "CreateShortcut");«EXPAND xpt::Common::nonNLS»
-«ENDIF-»
- return null;
- }
-«ENDDEFINE»
-
-«DEFINE additions FOR gmfgen::CreateShortcutAction»«ENDDEFINE»
-
-«DEFINE i18nValues FOR gmfgen::GenDiagram-»
-«IF null != editorGen.application-»
-«EXPAND xpt::Externalizer::messageEntry(titleKey(i18nKeyForCreateShortcutOpenModel()), "Select model to reference")-»
-«EXPAND xpt::Externalizer::messageEntry(titleKey(i18nKeyForCreateShortcutWizard()), "Create shortcut")-»
-«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE i18nAccessors FOR gmfgen::GenDiagram-»
-«IF null != editorGen.application-»
-«EXPAND xpt::Externalizer::accessorField(titleKey(i18nKeyForCreateShortcutOpenModel()))-»
-«EXPAND xpt::Externalizer::accessorField(titleKey(i18nKeyForCreateShortcutWizard()))-»
-«ENDIF-»
-«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.codegen/templates/impl/actions/CustomAction.xpt b/plugins/org.eclipse.gmf.codegen/templates/impl/actions/CustomAction.xpt
deleted file mode 100644
index f1f4d8e5c..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates/impl/actions/CustomAction.xpt
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (c) 2008 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/2008/GenModel"»
-«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
-
-«DEFINE Main FOR gmfgen::GenCustomAction-»
-«EXPAND xpt::Common::copyright FOR owner.editorGen-»
-«EXPAND xpt::Common::packageStatement FOR qualifiedClassName»
-
-«EXPAND xpt::Common::generatedClassComment»
-public class «qualifiedClassName.split('\\.').last()» extends org.eclipse.core.commands.AbstractHandler {
-
- «EXPAND xpt::Common::generatedMemberComment»
- public Object execute(org.eclipse.core.commands.ExecutionEvent event) throws org.eclipse.core.commands.ExecutionException {
- org.eclipse.ui.IEditorPart diagramEditor = org.eclipse.ui.handlers.HandlerUtil.getActiveEditorChecked(event);
- org.eclipse.jface.viewers.ISelection selection = org.eclipse.ui.handlers.HandlerUtil.getCurrentSelectionChecked(event);
- // FIXME implement required behavior
- throw new UnsupportedOperationException();
- }
-}
-«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.codegen/templates/impl/actions/LoadResourceAction.xpt b/plugins/org.eclipse.gmf.codegen/templates/impl/actions/LoadResourceAction.xpt
deleted file mode 100644
index 0693bf348..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates/impl/actions/LoadResourceAction.xpt
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (c) 2007, 2008 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:
- * Alexander Shatalin (Borland) - initial API and implementation
- * Artem Tikhomirov (Borland) - [174961] migration to Commands/Handlers
- */
-
-«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
-
-«DEFINE Main FOR gmfgen::LoadResourceAction-»
-«EXPAND xpt::Common::copyright FOR owner.editorGen-»
-«EXPAND xpt::Common::packageStatement FOR qualifiedClassName»
-
-«EXPAND xpt::Common::generatedClassComment»
-public class «qualifiedClassName.split('\\.').last()»«EXPAND extendsList»«EXPAND implementsList» {
-«EXPAND executeMethod»
-«EXPAND additions-»
-}
-«ENDDEFINE»
-
-«DEFINE extendsList FOR LoadResourceAction» extends org.eclipse.core.commands.AbstractHandler«ENDDEFINE»
-«DEFINE implementsList FOR LoadResourceAction»«ENDDEFINE»
-
-«DEFINE executeMethod FOR gmfgen::LoadResourceAction-»
- «EXPAND xpt::Common::generatedMemberComment»
- public Object execute(org.eclipse.core.commands.ExecutionEvent event) throws org.eclipse.core.commands.ExecutionException {
- org.eclipse.ui.IEditorPart diagramEditor = org.eclipse.ui.handlers.HandlerUtil.getActiveEditorChecked(event);
- org.eclipse.swt.widgets.Shell shell = diagramEditor.getEditorSite().getShell();
- «EXPAND xpt::Common::assert("diagramEditor instanceof org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditor")-»
- org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain = ((org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditor) diagramEditor).getEditingDomain();
- org.eclipse.emf.edit.ui.action.LoadResourceAction.LoadResourceDialog loadResourceDialog = new org.eclipse.emf.edit.ui.action.LoadResourceAction.LoadResourceDialog(shell, editingDomain);
- loadResourceDialog.open();
- return null;
- }
-«ENDDEFINE»
-
-«DEFINE additions FOR gmfgen::LoadResourceAction»«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.codegen/templates/impl/actions/MenuAction.ext b/plugins/org.eclipse.gmf.codegen/templates/impl/actions/MenuAction.ext
deleted file mode 100644
index 37c1417ed..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates/impl/actions/MenuAction.ext
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Copyright (c) 2008 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/2008/GenModel";
-import "http://www.eclipse.org/emf/2002/Ecore";
-
-boolean hasCommandsToContribute(gmfgen::GenEditorGenerator editorGen) :
- !editorGen.contextMenus.isEmpty() // FIXME temp condition, need deep check
-;
-
-boolean hasHandlersToContribute(gmfgen::GenEditorGenerator editorGen) :
- hasCommandsToContribute(editorGen) // exists(GenCustomAction)
-; \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.codegen/templates/impl/actions/PredefinedAction.xpt b/plugins/org.eclipse.gmf.codegen/templates/impl/actions/PredefinedAction.xpt
deleted file mode 100644
index a34ba7693..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates/impl/actions/PredefinedAction.xpt
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Copyright (c) 2008 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/2008/GenModel"»
-«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
-
-«DEFINE Main FOR gmfgen::GenAction»«ERROR "Asbtract template for " + this»«ENDDEFINE»
-
-«DEFINE Main FOR gmfgen::LoadResourceAction»«EXPAND LoadResourceAction::Main»«ENDDEFINE»
-
-«DEFINE Main(gmfgen::GenEditorGenerator editorGen) FOR gmfgen::InitDiagramAction»«EXPAND xpt::editor::InitDiagramFileAction::InitDiagramFileAction(editorGen)»«ENDDEFINE»
-
-«DEFINE Main FOR gmfgen::CreateShortcutAction»«EXPAND CreateShortcutAction::Main»«ENDDEFINE»
diff --git a/plugins/org.eclipse.gmf.codegen/templates/impl/actions/extensions.xpt b/plugins/org.eclipse.gmf.codegen/templates/impl/actions/extensions.xpt
deleted file mode 100644
index 6353110b9..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates/impl/actions/extensions.xpt
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- * Copyright (c) 2008 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/2008/GenModel"»
-«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
-
-«EXTENSION impl::actions::MenuAction»
-
-«DEFINE Main FOR GenEditorGenerator»
- <extension point="org.eclipse.ui.menus" id="context-menus">
- «EXPAND xpt::Common::xmlGeneratedTag»
- <!-- menuContribution locationURI="menu:org.eclipse.ui.main.menu?after=«»">
- </menuContribution>
- <menuContribution locationURI="toolbar:org.eclipse.ui.main.toolbar?after=«»">
- </menuContribution -->
-«EXPAND menuContribution FOREACH contextMenus-»
- </extension>
-
-«IF hasCommandsToContribute()-»
- <extension point="org.eclipse.ui.commands" id="menu-commands">
- «EXPAND xpt::Common::xmlGeneratedTag»
- <category id="«editor.iD»" name="%cmdcategory.name" description="%cmdcategory.desc"/>
-«EXPAND commandContribution FOREACH contextMenus-»
- </extension>
-«ENDIF-»
-
-«IF hasHandlersToContribute()-»
- <extension point="org.eclipse.ui.handlers" id="menu-handlers">
- «EXPAND xpt::Common::xmlGeneratedTag»
-«EXPAND handlerContribution FOREACH contextMenus-»
- </extension>
-«ENDIF-»
-
- <!-- optionally, specify keybindings -->
-«ENDDEFINE»
-
-«DEFINE menuContribution FOR gmfgen::GenContextMenu-»
-«EXPAND _menuContribution(this, "popup:org.eclipse.gmf.runtime.diagram.ui.DiagramEditorContextMenu")-»
-«ENDDEFINE»
-
-«DEFINE menuContribution(gmfgen::GenContextMenu contextMenu) FOR gmfgen::GenContributionManager»«ERROR "Abstract menuContribution for " + this»«ENDDEFINE»
-«DEFINE menuContribution(gmfgen::GenContextMenu contextMenu) FOR gmfgen::GenMenuManager»«EXPAND _menuContribution(contextMenu, "popup:" + iD)»«ENDDEFINE»
-«DEFINE menuContribution(gmfgen::GenContextMenu contextMenu) FOR gmfgen::GenToolBarManager»«EXPAND _menuContribution(contextMenu, "toolbar:" + iD)»«ENDDEFINE»
-
-«DEFINE _menuContribution(gmfgen::GenContextMenu contextMenu, String locationURI) FOR gmfgen::GenContributionManager-»
- <menuContribution locationURI="«locationURI»">
-«EXPAND menuEntry(contextMenu) FOREACH items-»
- </menuContribution>
-«EXPAND menuContribution(contextMenu) FOREACH items.typeSelect(GenContributionManager)-»
-«ENDDEFINE»
-
-
-«DEFINE commandContribution FOR gmfgen::GenContributionManager-»
-«EXPAND commandContribution FOREACH items.typeSelect(GenCustomAction)-»
-«EXPAND commandContribution FOREACH items.typeSelect(GenAction)-»
-«EXPAND commandContribution FOREACH items.typeSelect(GenContributionManager)-»
-«ENDDEFINE»
-
-«DEFINE handlerContribution FOR gmfgen::GenContributionManager-»
-«EXPAND handlerContribution FOREACH items.typeSelect(GenCustomAction).select(a | a.generateBoilerplate)-»
-«EXPAND handlerContribution FOREACH items.typeSelect(GenContributionManager)-»
-«ENDDEFINE»
-
-«DEFINE commandContribution FOR gmfgen::GenCustomAction-»
- <command id="«EXPAND commandIdentifier»"
- name="«name»"
- categoryId="«owner.editorGen.editor.iD»"
- defaultHandler="«qualifiedClassName»"/>
-«ENDDEFINE»
-
-«DEFINE commandContribution FOR gmfgen::GenAction-»
- <command id="«EXPAND commandIdentifier»"
- name="«name/*FIXME: into i18n keys*/»"
- categoryId="«owner.editorGen.editor.iD»"
- defaultHandler="«qualifiedClassName»"/>
-«ENDDEFINE»
-
-«DEFINE handlerContribution FOR gmfgen::GenCustomAction-»
- <handler
- commandId="«EXPAND commandIdentifier»"
- class="«qualifiedClassName»">
- <enabledWhen>
- <with variable="activePartId"><equals value="«owner.editorGen.editor.iD»"/></with>
- </enabledWhen>
- </handler>
-«ENDDEFINE»
-
-«DEFINE commandIdentifier FOR gmfgen::GenCustomAction»«owner.editorGen.plugin.iD».«qualifiedClassName.split('\\.').last()»«ENDDEFINE»
-«DEFINE commandIdentifier FOR gmfgen::GenAction»«owner.editorGen.plugin.iD».«qualifiedClassName.split('\\.').last()»«ENDDEFINE»
-
-«DEFINE menuEntry(gmfgen::GenContextMenu contextMenu) FOR gmfgen::GenContributionItem»«REM»NO-OP XXX or ERROR?«ENDREM»«ENDDEFINE»
-«DEFINE menuEntry(gmfgen::GenContextMenu contextMenu) FOR gmfgen::GenSeparator-»
- <separator «IF groupName != null»name="«groupName»" «ENDIF»visible="true"/>
-«ENDDEFINE»
-«DEFINE menuEntry(gmfgen::GenContextMenu contextMenu) FOR gmfgen::GenGroupMarker-»
- <separator name="«groupName»"/>
-«ENDDEFINE»
-«DEFINE menuEntry(gmfgen::GenContextMenu contextMenu) FOR gmfgen::GenCommandAction-»
- <command commandId="«commandIdentifier»">
- <visibleWhen>
-«EXPAND menuCondition FOR contextMenu-»
- </visibleWhen>
- </command>
-«ENDDEFINE»
-«DEFINE menuEntry(gmfgen::GenContextMenu contextMenu) FOR gmfgen::GenCustomAction-»
- <command commandId="«EXPAND commandIdentifier»">
- <visibleWhen>
-«EXPAND menuCondition FOR contextMenu-»
- </visibleWhen>
- </command>
-«ENDDEFINE»
-«DEFINE menuEntry(gmfgen::GenContextMenu contextMenu) FOR gmfgen::GenAction-»
- <command commandId="«EXPAND commandIdentifier»">
- <visibleWhen>
-«EXPAND menuCondition FOR contextMenu-»
- </visibleWhen>
- </command>
-«ENDDEFINE»
-
-«DEFINE menuEntry(gmfgen::GenContextMenu contextMenu) FOR gmfgen::GenMenuManager»
- <menu id="«iD»" label="«name»">
- <visibleWhen>
-«EXPAND menuCondition FOR contextMenu-»
- </visibleWhen>
- </menu>
-«ENDDEFINE»
-
-«DEFINE menuCondition FOR gmfgen::GenContextMenu-»
- <and>
- <with variable="activePartId"><equals value="«editorGen.editor.iD»"/></with>
- <with variable="selection"><iterate«IF context.size() > 1» operator="or"«ENDIF» ifEmpty="false">
-«REM»XXX, perhaps, <adapt type="EditPart">?«ENDREM-»
-«FOREACH context AS de-»
- <instanceof value="«de.getEditPartQualifiedClassName()»"/>
-«ENDFOREACH-»
- </iterate></with>
- </and>
-«ENDDEFINE»
-
-«DEFINE i18n FOR gmfgen::GenEditorGenerator-»
-«IF hasCommandsToContribute()-»
-# Commands and menu actions
-cmdcategory.name=«modelID» Editor Commands
-cmdcategory.desc=«modelID» Editor Commands
-«ENDIF»
-«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.codegen/templates/impl/diagram/editparts/ChildNodeLabelEditPart.xpt b/plugins/org.eclipse.gmf.codegen/templates/impl/diagram/editparts/ChildNodeLabelEditPart.xpt
deleted file mode 100644
index 9f2df12b7..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates/impl/diagram/editparts/ChildNodeLabelEditPart.xpt
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (c) 2006, 2007 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:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Alexander Shatalin (Borland) - initial API and implementation
- */
-
-«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
-
-«DEFINE contsructor FOR gmfgen::GenChildLabelNode-»
- «EXPAND xpt::Common::generatedMemberComment»
- public «editPartClassName»(org.eclipse.gmf.runtime.notation.View view) {
- super(view);
- }
-«ENDDEFINE»
-
-«DEFINE getDragTrackerBody FOR gmfgen::GenChildLabelNode-»
- if (request instanceof org.eclipse.gef.requests.SelectionRequest && ((org.eclipse.gef.requests.SelectionRequest) request).getLastButtonPressed() == 3) {
- return null;
- }
- return new org.eclipse.gmf.runtime.diagram.ui.tools.DragEditPartsTrackerEx(this);
-«ENDDEFINE»
-
-«DEFINE createDefaultEditPoliciesBody FOR gmfgen::GenChildLabelNode-»
- super.createDefaultEditPolicies();
- installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.SEMANTIC_ROLE, new «getItemSemanticEditPolicyQualifiedClassName()»());
- installEditPolicy(org.eclipse.gef.EditPolicy.PRIMARY_DRAG_ROLE, new «getDiagram().getTextNonResizableEditPolicyQualifiedClassName()»());
- installEditPolicy(org.eclipse.gef.EditPolicy.COMPONENT_ROLE, new org.eclipse.gmf.runtime.diagram.ui.editpolicies.ListItemComponentEditPolicy());
- installEditPolicy(org.eclipse.gef.EditPolicy.DIRECT_EDIT_ROLE, new org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy());
- «EXPAND xpt::diagram::editparts::Common::behaviour FOR this-»
-«ENDDEFINE»
-
-«DEFINE handleNotificationEventBody FOR gmfgen::GenChildLabelNode-»
- Object feature = event.getFeature();
- «EXPAND xpt::diagram::editparts::Common::handleText FOR this-»
- super.handleNotificationEvent(event);
-«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.codegen/templates/impl/diagram/editparts/CompartmentEditPart.xpt b/plugins/org.eclipse.gmf.codegen/templates/impl/diagram/editparts/CompartmentEditPart.xpt
deleted file mode 100644
index 637b5e4c8..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates/impl/diagram/editparts/CompartmentEditPart.xpt
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * Copyright (c) 2006, 2007 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:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Alexander Shatalin (Borland) - initial API and implementation
- */
-
-«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
-«EXTENSION xpt::diagram::editparts::Utils»
-
-«DEFINE contsructor FOR gmfgen::GenCompartment-»
- «EXPAND xpt::Common::generatedMemberComment»
- public «editPartClassName»(org.eclipse.gmf.runtime.notation.View view) {
- super(view);
- }
-«ENDDEFINE»
-
-«DEFINE hasModelChildrenChanged FOR gmfgen::GenCompartment-»
- «IF listLayout-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected boolean hasModelChildrenChanged(org.eclipse.emf.common.notify.Notification evt) {
- return false;
- }
- «ENDIF-»
-«ENDDEFINE»
-
-«DEFINE getCompartmentName FOR gmfgen::GenCompartment-»
- «EXPAND xpt::Common::generatedMemberComment»
- public String getCompartmentName() {
- return «EXPAND xpt::Externalizer::accessorCall(i18nKeyForCompartmentTitle()) FOR getDiagram().editorGen»;
- }
-«ENDDEFINE»
-
-«DEFINE createFigure FOR gmfgen::GenCompartment-»
- «IF !needsTitle-»
- «REM»By default titles are shown even if there are no TitleStyle, we need to switch it off«ENDREM»«-»
- «EXPAND xpt::Common::generatedMemberComment»
- public org.eclipse.draw2d.IFigure createFigure() {
- org.eclipse.gmf.runtime.diagram.ui.figures.ResizableCompartmentFigure result = (org.eclipse.gmf.runtime.diagram.ui.figures.ResizableCompartmentFigure) super.createFigure();
- result.setTitleVisibility(false);
- return result;
- }
- «ENDIF-»
-«ENDDEFINE»
-
-«DEFINE createDefaultEditPoliciesBody FOR gmfgen::GenCompartment-»
- super.createDefaultEditPolicies();
- «IF canCollapse-»
- installEditPolicy(org.eclipse.gef.EditPolicy.PRIMARY_DRAG_ROLE, new org.eclipse.gmf.runtime.diagram.ui.editpolicies.ResizableCompartmentEditPolicy());
- «ENDIF-»
- «EXPAND xpt::diagram::editparts::Common::installSemanticEditPolicy-»
- «IF childNodes.size() > 0-»
- installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CREATION_ROLE, new org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy());
- installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE, new org.eclipse.gmf.runtime.diagram.ui.editpolicies.DragDropEditPolicy());
- «ENDIF-»
- «EXPAND xpt::diagram::editparts::Common::installCanonicalEditPolicy-»
- «EXPAND xpt::diagram::editparts::Common::behaviour-»
-«ENDDEFINE»
-
-«DEFINE refreshVisuals FOR gmfgen::GenCompartment-»
- «IF isStoringChildPositions(node)-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshBounds();
- }
- «ENDIF-»
-«ENDDEFINE»
-
-«DEFINE handleNotificationEventBody FOR gmfgen::GenCompartment-»
- super.handleNotificationEvent(notification);
- Object feature = notification.getFeature();
- if (org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getSize_Width().equals(feature)
- || org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getSize_Height().equals(feature)
- || org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getLocation_X().equals(feature)
- || org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getLocation_Y().equals(feature)) {
- refreshBounds();
- }
-«ENDDEFINE»
-
-«DEFINE refreshBounds FOR gmfgen::GenCompartment-»
- «IF isStoringChildPositions(node)-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected 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();
- 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();
- ((org.eclipse.gef.GraphicalEditPart) getParent()).setLayoutConstraint(this, getFigure(), new org.eclipse.draw2d.geometry.Rectangle(x, y, width, height));
- }
- «ENDIF-»
-«ENDDEFINE»
-
-«DEFINE setRatio FOR gmfgen::GenCompartment-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected void setRatio(Double ratio) {
- «IF gmfgen::ViewmapLayoutType::UNKNOWN.value == node.getLayoutType().value-»
- if (getFigure().getParent().getLayoutManager() instanceof org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout) {
- super.setRatio(ratio);
- }
- «ELSE-»
- // nothing to do -- parent layout does not accept Double constraints as ratio
- // super.setRatio(ratio);
- «ENDIF-»
- }
-«ENDDEFINE»
-
-«DEFINE i18nAccessors FOR gmfgen::GenDiagram-»
-«EXPAND internal_i18nAccessors FOREACH compartments»
-«ENDDEFINE»
-
-«DEFINE internal_i18nAccessors FOR gmfgen::GenCompartment-»
-«IF null != title»«EXPAND xpt::Externalizer::accessorField(i18nKeyForCompartmentTitle())»«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE i18nValues FOR gmfgen::GenDiagram-»
-«EXPAND internal_i18nValues FOREACH compartments»
-«ENDDEFINE»
-
-«DEFINE internal_i18nValues FOR gmfgen::GenCompartment-»
-«IF null != title»«EXPAND xpt::Externalizer::messageEntry(i18nKeyForCompartmentTitle(), title)»«ENDIF-»
-«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.codegen/templates/impl/diagram/editparts/DiagramEditPart.xpt b/plugins/org.eclipse.gmf.codegen/templates/impl/diagram/editparts/DiagramEditPart.xpt
deleted file mode 100644
index d0363138e..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates/impl/diagram/editparts/DiagramEditPart.xpt
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Copyright (c) 2006, 2007 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:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Alexander Shatalin (Borland) - initial API and implementation
- */
-
-«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
-«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
-«EXTENSION xpt::diagram::editparts::Utils»
-
-«DEFINE constructor FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
- public «editPartClassName»(org.eclipse.gmf.runtime.notation.View view) {
- super(view);
- }
-«ENDDEFINE»
-
-«DEFINE createDefaultEditPoliciesBody FOR gmfgen::GenDiagram-»
- super.createDefaultEditPolicies();
- «EXPAND xpt::diagram::editparts::Common::installSemanticEditPolicy-»
- «EXPAND xpt::diagram::editparts::Common::installCanonicalEditPolicy-»
- «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 viewDescriptors = new java.util.ArrayList();
- for (java.util.Iterator it = dropRequest.getObjects().iterator(); it.hasNext();) {
- Object nextObject = it.next();
- if (false == nextObject instanceof org.eclipse.emf.ecore.EObject) {
- continue;
- }
- viewDescriptors.add(new org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest.ViewDescriptor(new org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter((org.eclipse.emf.ecore.EObject) nextObject), org.eclipse.gmf.runtime.notation.Node.class, null, getDiagramPreferencesHint()));
- }
- return createShortcutsCommand(dropRequest, viewDescriptors);
- }
-
- private org.eclipse.gef.commands.Command createShortcutsCommand(org.eclipse.gmf.runtime.diagram.ui.requests.DropObjectsRequest dropRequest, java.util.List 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 «getCreateShortcutDecorationsCommandQualifiedClassName()»(getEditingDomain(), (org.eclipse.gmf.runtime.notation.View) getModel(), viewDescriptors)));
- }
- return null;
- }
- });
- «ENDIF-»
- «IF shouldGenerateDiagramViewmap()-»
- // diagram figure does layout; need to install child editpolicy to show selection feedback
- installEditPolicy(org.eclipse.gef.EditPolicy.LAYOUT_ROLE, new org.eclipse.gef.editpolicies.LayoutEditPolicy() {
- protected org.eclipse.gef.EditPolicy createChildEditPolicy(org.eclipse.gef.EditPart child) {
- final org.eclipse.gef.editpolicies.NonResizableEditPolicy p = new org.eclipse.gef.editpolicies.NonResizableEditPolicy();
- p.setDragAllowed(false);
- return p;
- }
- protected org.eclipse.gef.commands.Command getMoveChildrenCommand(org.eclipse.gef.Request request) {
- return null;
- }
- protected org.eclipse.gef.commands.Command getCreateCommand(org.eclipse.gef.requests.CreateRequest request) {
- return null;
- }
- });
- «ENDIF-»
- «EXPAND xpt::diagram::editparts::Common::behaviour FOR this-»
- // removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.POPUPBAR_ROLE);
-«ENDDEFINE»
-
-«DEFINE createFigure FOR gmfgen::GenDiagram-»
- «IF shouldGenerateDiagramViewmap()-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected org.eclipse.draw2d.IFigure createFigure() {
- org.eclipse.draw2d.FreeformLayer l = new org.eclipse.draw2d.FreeformLayer();
- l.setBorder(new org.eclipse.draw2d.MarginBorder(50));
- «EXPAND initLayout("lm") FOR viewmap.layoutType-»
- l.setLayoutManager(lm);
- return l;
- }
- «ENDIF»
-«ENDDEFINE»
-
-«DEFINE initLayout(String varName) FOR gmfgen::ViewmapLayoutType-»
- «IF value == gmfgen::ViewmapLayoutType::TOOLBAR_LAYOUT.value-»
- org.eclipse.draw2d.ToolbarLayout «varName» = new org.eclipse.draw2d.ToolbarLayout();
- «varName».setSpacing(10);
- «ELSEIF value == gmfgen::ViewmapLayoutType::FLOW_LAYOUT.value-»
- org.eclipse.draw2d.FlowLayout «varName» = new org.eclipse.draw2d.FlowLayout();
- «varName».setMajorSpacing(10);
- «varName».setMinorSpacing(10);
- «ELSE-»
- org.eclipse.draw2d.LayoutManager «varName» = null; /*FIXME - unknown layout type*/
- «ENDIF-»
-«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.codegen/templates/impl/diagram/editparts/ExternalNodeLabelEditPart.xpt b/plugins/org.eclipse.gmf.codegen/templates/impl/diagram/editparts/ExternalNodeLabelEditPart.xpt
deleted file mode 100644
index 9d05aa773..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates/impl/diagram/editparts/ExternalNodeLabelEditPart.xpt
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright (c) 2006, 2008 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:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Alexander Shatalin (Borland) - initial API and implementation
- */
-
-«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
-
-«DEFINE initializer FOR gmfgen::GenExternalNodeLabel-»
- «EXPAND xpt::Common::generatedMemberComment»
- static {
- registerSnapBackPosition(«EXPAND xpt::editor::VisualIDRegistry::typeMethodCall», new org.eclipse.draw2d.geometry.Point(0, 0));
- }
-«ENDDEFINE»
-
-«DEFINE constructor FOR gmfgen::GenExternalNodeLabel-»
- «EXPAND xpt::Common::generatedMemberComment»
- public «editPartClassName»(org.eclipse.gmf.runtime.notation.View view) {
- super(view);
- }
-«ENDDEFINE»
-
-«DEFINE createDefaultEditPoliciesBody FOR gmfgen::GenExternalNodeLabel-»
- 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 «getDiagram().getTextSelectionEditPolicyQualifiedClassName()»());
- «EXPAND xpt::diagram::editparts::Common::behaviour FOR this-»
-«ENDDEFINE»
-
-«DEFINE getBorderItemLocator FOR gmfgen::GenExternalNodeLabel-»
- «EXPAND xpt::Common::generatedMemberComment»
- public org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator getBorderItemLocator() {
- org.eclipse.draw2d.IFigure parentFigure = getFigure().getParent();
- if (parentFigure != null && parentFigure.getLayoutManager() != null) {
- Object constraint = parentFigure.getLayoutManager().getConstraint(getFigure());
- return (org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator) constraint;
- }
- return null;
- }
-«ENDDEFINE»
-
-«DEFINE refreshBounds FOR gmfgen::GenExternalNodeLabel-»
- «EXPAND xpt::Common::generatedMemberComment»
- 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();
- 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();
- getBorderItemLocator().setConstraint(new org.eclipse.draw2d.geometry.Rectangle(x, y, width, height));
- }
-«ENDDEFINE»
-
-«DEFINE handleNotificationEventBody FOR gmfgen::GenExternalNodeLabel-»
- Object feature = event.getFeature();
- «EXPAND xpt::diagram::editparts::Common::handleText FOR this-»
- super.handleNotificationEvent(event);
-«ENDDEFINE»
-
-«DEFINE createFigure FOR gmfgen::GenExternalNodeLabel-»
- «EXPAND xpt::diagram::editparts::Common::labelFigure FOR viewmap-»
-«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.codegen/templates/impl/diagram/editparts/LinkEditPart.xpt b/plugins/org.eclipse.gmf.codegen/templates/impl/diagram/editparts/LinkEditPart.xpt
deleted file mode 100644
index aea76359a..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates/impl/diagram/editparts/LinkEditPart.xpt
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * Copyright (c) 2006, 2007 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:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Alexander Shatalin (Borland) - initial API and implementation
- */
-
-«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
-
-«DEFINE constructor FOR gmfgen::GenLink-»
- «EXPAND xpt::Common::generatedMemberComment»
- public «editPartClassName»(org.eclipse.gmf.runtime.notation.View view) {
- super(view);
- }
-«ENDDEFINE»
-
-«DEFINE createDefaultEditPoliciesBody FOR gmfgen::GenLink-»
- super.createDefaultEditPolicies();
- «IF null == modelFacet-»
- installEditPolicy(org.eclipse.gef.EditPolicy.COMPONENT_ROLE, new org.eclipse.gmf.runtime.diagram.ui.editpolicies.ViewComponentEditPolicy());
- «ENDIF-»
- «EXPAND xpt::diagram::editparts::Common::installSemanticEditPolicy-»
- «EXPAND xpt::diagram::editparts::Common::behaviour FOR this-»
-«ENDDEFINE»
-
-«DEFINE addFixedChild FOR gmfgen::GenLink-»
- «IF labels.size() > 0-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected boolean addFixedChild(org.eclipse.gef.EditPart childEditPart) {
- «FOREACH labels AS label-»
- «EXPAND addLabel(label) FOR label.viewmap-»
- «ENDFOREACH-»
- return false;
- }
- «ENDIF»
-«ENDDEFINE»
-
-«DEFINE addLabel(gmfgen::GenLinkLabel label) FOR gmfgen::Viewmap-»
-«ENDDEFINE»
-
-«DEFINE addLabel(gmfgen::GenLinkLabel label) FOR gmfgen::ParentAssignedViewmap-»
- if (childEditPart instanceof «label.getEditPartQualifiedClassName()») {
- ((«label.getEditPartQualifiedClassName()») childEditPart).«EXPAND impl::diagram::editparts::TextAware::labelSetterName»(
- getPrimaryShape().«getterName»());
- return true;
- }
-«ENDDEFINE»
-
-«DEFINE removeFixedChild FOR gmfgen::GenLink-»
- «IF labels.size() > 0-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected boolean removeFixedChild(org.eclipse.gef.EditPart childEditPart) {
- «FOREACH labels AS label-»
- «EXPAND removeLabel(label) FOR label.viewmap-»
- «ENDFOREACH-»
- return false;
- }
- «ENDIF»
-«ENDDEFINE»
-
-«DEFINE removeLabel(gmfgen::GenLinkLabel label) FOR gmfgen::Viewmap-»
-«ENDDEFINE»
-
-«DEFINE removeLabel(gmfgen::GenLinkLabel label) FOR gmfgen::ParentAssignedViewmap-»
- if (childEditPart instanceof «label.getEditPartQualifiedClassName()») {
- return true;
- }
-«ENDDEFINE»
-
-«DEFINE addChildVisual FOR gmfgen::GenLink-»
- «IF labels.size() > 0-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected void addChildVisual(org.eclipse.gef.EditPart childEditPart, int index) {
- if (addFixedChild(childEditPart)) {
- return;
- }
- super.addChildVisual(childEditPart, -1);
- }
- «ENDIF»
-«ENDDEFINE»
-
-«DEFINE removeChildVisual FOR gmfgen::GenLink-»
- «IF labels.size() > 0-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected void removeChildVisual(org.eclipse.gef.EditPart childEditPart) {
- if (removeFixedChild(childEditPart)) {
- return;
- }
- super.removeChildVisual(childEditPart);
- }
- «ENDIF»
-«ENDDEFINE»
-
-«DEFINE createLinkFigure FOR gmfgen::GenLink-»
- «EXPAND xpt::Common::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"
- )»
- «EXPAND createLinkFigure(this) FOR viewmap-»
-«ENDDEFINE»
-
-«DEFINE createLinkFigure(gmfgen::GenLink link) FOR gmfgen::Viewmap-»
- «ERROR "Unknown viewmap: " + this-»
-«ENDDEFINE»
-
-«DEFINE createLinkFigure(gmfgen::GenLink link) FOR gmfgen::FigureViewmap-»
- «LET figureQualifiedClassName == null ? "org.eclipse.gmf.runtime.draw2d.ui.figures.PolylineConnectionEx" : figureQualifiedClassName AS fqn-»
- protected org.eclipse.draw2d.Connection createConnectionFigure() {
- return new «fqn»();
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- public «fqn» getPrimaryShape() {
- return («fqn») getFigure();
- }
- «ENDLET-»
-«ENDDEFINE»
-
-«DEFINE createLinkFigure(gmfgen::GenLink link) FOR gmfgen::SnippetViewmap»
- protected org.eclipse.draw2d.Connection createConnectionFigure() {
- return «body»;
- }
-«ENDDEFINE»
-
-«DEFINE createLinkFigure(gmfgen::GenLink link) FOR gmfgen::InnerClassViewmap»
- protected org.eclipse.draw2d.Connection createConnectionFigure() {
- return new «className»();
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- public «className» getPrimaryShape() {
- return («className») getFigure();
- }
-
- «classBody»
-«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.codegen/templates/impl/diagram/editparts/LinkLabelEditPart.xpt b/plugins/org.eclipse.gmf.codegen/templates/impl/diagram/editparts/LinkLabelEditPart.xpt
deleted file mode 100644
index ff7c12d33..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates/impl/diagram/editparts/LinkLabelEditPart.xpt
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright (c) 2006, 2008 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:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Alexander Shatalin (Borland) - initial API and implementation
- */
-
-«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
-«EXTENSION xpt::diagram::ViewmapAttributesUtils»
-
-«DEFINE initializer FOR gmfgen::GenLinkLabel-»
- «EXPAND xpt::Common::generatedMemberComment»
- static {
- registerSnapBackPosition(«EXPAND xpt::editor::VisualIDRegistry::typeMethodCall»,
- new org.eclipse.draw2d.geometry.Point(«labelOffsetX(viewmap, 0)», «labelOffsetY(viewmap, 0)»));
- }
-«ENDDEFINE»
-
-«DEFINE constructor FOR gmfgen::GenLinkLabel-»
- «EXPAND xpt::Common::generatedMemberComment»
- public «editPartClassName»(org.eclipse.gmf.runtime.notation.View view) {
- super(view);
- }
-«ENDDEFINE»
-
-«DEFINE createDefaultEditPoliciesBody FOR gmfgen::GenLinkLabel-»
- 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 «getDiagram().getTextSelectionEditPolicyQualifiedClassName()»());
- installEditPolicy(org.eclipse.gef.EditPolicy.PRIMARY_DRAG_ROLE,
- new org.eclipse.gmf.runtime.diagram.ui.editpolicies.NonResizableLabelEditPolicy() {
-
- 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);
- return java.util.Collections.singletonList(mh);
- }
- });
- «EXPAND xpt::diagram::editparts::Common::behaviour FOR this-»
-«ENDDEFINE»
-
-«DEFINE getKeyPoint FOR gmfgen::GenLinkLabel-»
- «EXPAND xpt::Common::generatedMemberComment»
- public int getKeyPoint() {
- return org.eclipse.draw2d.ConnectionLocator.«alignment»;
- }
-«ENDDEFINE»
-
-«DEFINE handleNotificationEventBody FOR gmfgen::GenLinkLabel-»
- Object feature = event.getFeature();
- «EXPAND xpt::diagram::editparts::Common::handleText FOR this-»
- super.handleNotificationEvent(event);
-«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.codegen/templates/impl/diagram/editparts/NodeEditPart.xpt b/plugins/org.eclipse.gmf.codegen/templates/impl/diagram/editparts/NodeEditPart.xpt
deleted file mode 100644
index d32b2019e..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates/impl/diagram/editparts/NodeEditPart.xpt
+++ /dev/null
@@ -1,580 +0,0 @@
-/*
- * Copyright (c) 2006, 2008 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:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Alexander Shatalin (Borland) - initial API and implementation
- */
-
-«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
-«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
-«EXTENSION xpt::diagram::ViewmapAttributesUtils»
-«EXTENSION xpt::diagram::editparts::Utils»
-
-«DEFINE extendsListContents FOR gmfgen::GenNode-»
-«IF hasBorderItems()»org.eclipse.gmf.runtime.diagram.ui.editparts.AbstractBorderedShapeEditPart«ELSE»org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE extendsListContents FOR gmfgen::GenChildSideAffixedNode-»
-«IF hasBorderItems()»org.eclipse.gmf.runtime.diagram.ui.editparts.BorderedBorderItemEditPart«ELSE»org.eclipse.gmf.runtime.diagram.ui.editparts.AbstractBorderItemEditPart«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE constructor FOR gmfgen::GenNode-»
- «EXPAND xpt::Common::generatedMemberComment»
- public «editPartClassName»(org.eclipse.gmf.runtime.notation.View view) {
- super(view);
- }
-«ENDDEFINE»
-
-«DEFINE createDefaultEditPoliciesBody FOR gmfgen::GenNode-»
- «EXPAND installCreationRolePolicy-»
- super.createDefaultEditPolicies();
- «EXPAND installPrimaryDragEditPolicy-»
- «EXPAND xpt::diagram::editparts::Common::installSemanticEditPolicy-»
- «IF needsGraphicalNodeEditPolicy()-»
- installEditPolicy(org.eclipse.gef.EditPolicy.GRAPHICAL_NODE_ROLE, new «getGraphicalNodeEditPolicyQualifiedClassName()»());
- «ENDIF-»
- «IF !childNodes.isEmpty()-»
- installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE, new org.eclipse.gmf.runtime.diagram.ui.editpolicies.DragDropEditPolicy());
- «ENDIF-»
- «EXPAND xpt::diagram::editparts::Common::installCanonicalEditPolicy-»
- installEditPolicy(org.eclipse.gef.EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
- «EXPAND xpt::diagram::editparts::Common::behaviour FOR this-»
- // XXX need an SCR to runtime to have another abstract superclass that would let children add reasonable editpolicies
- // removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CONNECTION_HANDLES_ROLE);
-«ENDDEFINE»
-
-«DEFINE installCreationRolePolicy FOR gmfgen::GenNode-»
-«IF hasChildren() || hasChildrenInListCompartments()-»
- installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CREATION_ROLE, «EXPAND _creationEditPolicyNewInstance»);
-«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE _creationEditPolicyNewInstance FOR gmfgen::GenNode»new org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy()«ENDDEFINE»
-
-«DEFINE installPrimaryDragEditPolicy FOR gmfgen::GenNode»«ENDDEFINE»
-
-«DEFINE installPrimaryDragEditPolicy FOR gmfgen::GenChildSideAffixedNode-»
- installEditPolicy(org.eclipse.gef.EditPolicy.PRIMARY_DRAG_ROLE, getPrimaryDragEditPolicy());
-«ENDDEFINE»
-
-«DEFINE createLayoutEditPolicy FOR gmfgen::GenNode-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected org.eclipse.gef.editpolicies.LayoutEditPolicy createLayoutEditPolicy() {
- «EXPAND createLayoutEditPolicyBody-»
- }
-«ENDDEFINE»
-
-«DEFINE createLayoutEditPolicyBody FOR gmfgen::GenNode-»
- «IF gmfgen::ViewmapLayoutType::XY_LAYOUT.value == getLayoutType().value-»
- org.eclipse.gmf.runtime.diagram.ui.editpolicies.XYLayoutEditPolicy lep = new org.eclipse.gmf.runtime.diagram.ui.editpolicies.XYLayoutEditPolicy() {
-
- protected org.eclipse.gef.EditPolicy createChildEditPolicy(org.eclipse.gef.EditPart child) {
- «EXPAND borderItemSelectionEditPolicy-»
- org.eclipse.gef.EditPolicy result = super.createChildEditPolicy(child);
- if (result == null) {
- return new org.eclipse.gmf.runtime.diagram.ui.editpolicies.ResizableShapeEditPolicy();
- }
- return result;
- }
- };
- return lep;
- «ELSEIF gmfgen::ViewmapLayoutType::TOOLBAR_LAYOUT.value == getLayoutType().value»
- org.eclipse.gmf.runtime.diagram.ui.editpolicies.ConstrainedToolbarLayoutEditPolicy lep = new org.eclipse.gmf.runtime.diagram.ui.editpolicies.ConstrainedToolbarLayoutEditPolicy() {
-
- protected org.eclipse.gef.EditPolicy createChildEditPolicy(org.eclipse.gef.EditPart child) {
- «EXPAND borderItemSelectionEditPolicy-»
- if (child.getEditPolicy(org.eclipse.gef.EditPolicy.PRIMARY_DRAG_ROLE) == null) {
- if (child instanceof org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart) {
- return new «getDiagram().getTextSelectionEditPolicyQualifiedClassName()»();
- }
- }
- return super.createChildEditPolicy(child);
- }
- };
- return lep;
- «ELSEIF gmfgen::ViewmapLayoutType::FLOW_LAYOUT.value == getLayoutType().value»
- org.eclipse.gef.editpolicies.FlowLayoutEditPolicy lep = new org.eclipse.gef.editpolicies.FlowLayoutEditPolicy() {
-
- «IF hasBorderItems()-»
- protected org.eclipse.gef.EditPolicy createChildEditPolicy(org.eclipse.gef.EditPart child) {
- «EXPAND borderItemSelectionEditPolicy-»
- return super.createChildEditPolicy(child);
- }
- «ENDIF-»
-
- protected org.eclipse.gef.commands.Command createAddCommand(org.eclipse.gef.EditPart child, org.eclipse.gef.EditPart after) {
- return null;
- }
-
- protected org.eclipse.gef.commands.Command createMoveChildCommand(org.eclipse.gef.EditPart child, org.eclipse.gef.EditPart after) {
- return null;
- }
-
- protected org.eclipse.gef.commands.Command getCreateCommand(org.eclipse.gef.requests.CreateRequest request) {
- return null;
- }
- };
- return lep;
- «ELSE-»
- org.eclipse.gef.editpolicies.LayoutEditPolicy lep = new org.eclipse.gef.editpolicies.LayoutEditPolicy() {
-
- protected org.eclipse.gef.EditPolicy createChildEditPolicy(org.eclipse.gef.EditPart child) {
- «EXPAND borderItemSelectionEditPolicy-»
- org.eclipse.gef.EditPolicy result = child.getEditPolicy(org.eclipse.gef.EditPolicy.PRIMARY_DRAG_ROLE);
- if (result == null) {
- result = new org.eclipse.gef.editpolicies.NonResizableEditPolicy();
- }
- return result;
- }
-
- protected org.eclipse.gef.commands.Command getMoveChildrenCommand(org.eclipse.gef.Request request) {
- return null;
- }
-
- protected org.eclipse.gef.commands.Command getCreateCommand(org.eclipse.gef.requests.CreateRequest request) {
- return null;
- }
- };
- return lep;
- «ENDIF-»
-«ENDDEFINE»
-
-«DEFINE borderItemSelectionEditPolicy FOR gmfgen::GenNode-»
-«IF hasBorderItems()-»
-org.eclipse.gmf.runtime.notation.View childView = (org.eclipse.gmf.runtime.notation.View) child.getModel();
-switch («EXPAND xpt::editor::VisualIDRegistry::getVisualIDMethodCall FOR getDiagram()»(childView)) {
-«IF getExternalLabels().size() > 0-»
-«FOREACH getExternalLabels() AS nextLabel-»
-«EXPAND xpt::Common::caseVisualID FOR nextLabel-»
-«ENDFOREACH-»
- return «EXPAND borderItemSelectionEP»;
-«ENDIF-»
-«IF getSideAffixedChildren().size() > 0-»
-«FOREACH getSideAffixedChildren() AS nextBorderItem-»
-«EXPAND xpt::Common::caseVisualID FOR nextBorderItem-»
-«ENDFOREACH-»
- return new org.eclipse.gmf.runtime.diagram.ui.editpolicies.BorderItemSelectionEditPolicy();
-«ENDIF-»
-}
-«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE borderItemSelectionEP FOR gmfgen::GenNode-»
-new org.eclipse.gmf.runtime.diagram.ui.editpolicies.BorderItemSelectionEditPolicy() {
-
- 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);
- return java.util.Collections.singletonList(mh);
- }
-}
-«ENDDEFINE»
-
-«DEFINE createNodeShape(gmfgen::GenNode node) FOR gmfgen::Viewmap-»
- «ERROR "Unknown viewmap: " + this-»
-«ENDDEFINE»
-
-«DEFINE createNodeShape(gmfgen::GenNode node) FOR gmfgen::FigureViewmap-»
- «LET figureQualifiedClassName == null ? "org.eclipse.draw2d.RectangleFigure" : figureQualifiedClassName AS fqn-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected org.eclipse.draw2d.IFigure createNodeShape() {
- return primaryShape = new «fqn»()«IF node.getLayoutType().value == gmfgen::ViewmapLayoutType::XY_LAYOUT.value»{
- protected boolean useLocalCoordinates() {
- return true;
- }
- }«ENDIF»;
- }
-
- «EXPAND getPrimaryShapeMethod FOR fqn-»
- «ENDLET-»
-«ENDDEFINE»
-
-«DEFINE createNodeShape(gmfgen::GenNode node) FOR gmfgen::SnippetViewmap-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected org.eclipse.draw2d.IFigure createNodeShape() {
- return «body»;
- }
-«ENDDEFINE»
-
-«DEFINE createNodeShape(gmfgen::GenNode node) FOR gmfgen::InnerClassViewmap-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected org.eclipse.draw2d.IFigure createNodeShape() {
- «className» figure = new «className»();
- «IF node.childNodes.size() > 0 && node.getLayoutType().value == gmfgen::ViewmapLayoutType::XY_LAYOUT.value-»
- figure.setUseLocalCoordinates(true);
- «ENDIF-»
- return primaryShape = figure;
- }
-
- «EXPAND getPrimaryShapeMethod FOR className-»
-«ENDDEFINE»
-
-«DEFINE getPrimaryShapeMethod FOR String-»
- «EXPAND xpt::Common::generatedMemberComment»
- public «this» getPrimaryShape() {
- return («this») primaryShape;
- }
-«ENDDEFINE»
-
-«DEFINE addFixedChild FOR gmfgen::GenNode-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected boolean addFixedChild(org.eclipse.gef.EditPart childEditPart) {
-«FOREACH getInnerFixedLabels() AS label»«LET (gmfgen::ParentAssignedViewmap) label.viewmap AS childViewmap-»
- if (childEditPart instanceof «label.getEditPartQualifiedClassName()») {
- ((«label.getEditPartQualifiedClassName()») childEditPart).«EXPAND impl::diagram::editparts::TextAware::labelSetterName FOR childViewmap»(getPrimaryShape().«childViewmap.getterName»());
- return true;
- }
-«ENDLET»«ENDFOREACH-»
-«FOREACH getPinnedCompartments() AS compartment»«LET (gmfgen::ParentAssignedViewmap) compartment.viewmap AS childViewmap-»
- 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());
- return true;
- }
-«ENDLET»«ENDFOREACH-»
-«FOREACH getSideAffixedChildren() AS child-»
- 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;
- }
-«ENDFOREACH-»
- return false;
- }
-«ENDDEFINE»
-
-«DEFINE removeFixedChild FOR gmfgen::GenNode-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected boolean removeFixedChild(org.eclipse.gef.EditPart childEditPart) {
-«FOREACH getInnerFixedLabels() AS label»«LET (gmfgen::ParentAssignedViewmap) label.viewmap AS childViewmap-»
- if (childEditPart instanceof «label.getEditPartQualifiedClassName()») {
- return true;
- }
-«ENDLET»«ENDFOREACH-»
-«FOREACH getPinnedCompartments() AS compartment»«LET (gmfgen::ParentAssignedViewmap) compartment.viewmap AS childViewmap-»
- 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.remove(((«compartment.getEditPartQualifiedClassName()») childEditPart).getFigure());
- return true;
- }
-«ENDLET»«ENDFOREACH-»
-«FOREACH getSideAffixedChildren() AS child-»
- if (childEditPart instanceof «child.getEditPartQualifiedClassName()») {
- getBorderedFigure().getBorderItemContainer().remove(((«child.getEditPartQualifiedClassName()») childEditPart).getFigure());
- return true;
- }
-«ENDFOREACH-»
- return false;
- }
-«ENDDEFINE»
-
-«DEFINE addChildVisual FOR gmfgen::GenNode-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected void addChildVisual(org.eclipse.gef.EditPart childEditPart, int index) {
- if (addFixedChild(childEditPart)) {
- return;
- }
- super.addChildVisual(childEditPart, -1);
- }
-«ENDDEFINE»
-
-«DEFINE removeChildVisual FOR gmfgen::GenNode-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected void removeChildVisual(org.eclipse.gef.EditPart childEditPart) {
- if (removeFixedChild(childEditPart)){
- return;
- }
- super.removeChildVisual(childEditPart);
- }
-«ENDDEFINE»
-
-«DEFINE getContentPaneFor FOR gmfgen::GenNode-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected org.eclipse.draw2d.IFigure getContentPaneFor(org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart editPart) {
- «REM»it is unclear what we should return for labels here«ENDREM-»
-«FOREACH getPinnedCompartments() AS compartment»«LET (gmfgen::ParentAssignedViewmap) compartment.viewmap AS childViewmap-»
- if (editPart instanceof «compartment.getEditPartQualifiedClassName()») {
- return getPrimaryShape().«childViewmap.getterName»();
- }
-«ENDLET»«ENDFOREACH-»
-«IF hasBorderItems()-»
- if (editPart instanceof org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart) {
- return getBorderedFigure().getBorderItemContainer();
- }
-«ENDIF-»
- return getContentPane();
- }
-«ENDDEFINE»
-
-«DEFINE addBorderItem FOR gmfgen::GenNode-»
- «IF getExternalLabels().size() > 0-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected void addBorderItem(org.eclipse.draw2d.IFigure borderItemContainer, org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart borderItemEditPart) {
- if («FOREACH getExternalLabels() AS label SEPARATOR ' || '»borderItemEditPart instanceof «label.getEditPartQualifiedClassName()»«ENDFOREACH») {
- 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 {
- super.addBorderItem(borderItemContainer, borderItemEditPart);
- }
- }
- «ENDIF-»
-«ENDDEFINE»
-
-«DEFINE createNodePlate FOR gmfgen::GenNode-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure createNodePlate() {
- org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure result =
- new org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure(getMapMode().DPtoLP(«defaultSizeWidth(viewmap, 40)»), getMapMode().DPtoLP(«defaultSizeHeight(viewmap, 40)»));
- «EXPAND setupNodePlate-»
- return result;
- }
-«ENDDEFINE»
-
-«DEFINE setupNodePlate FOR gmfgen::GenNode»«ENDDEFINE»
-
-«DEFINE setupNodePlate FOR gmfgen::GenChildSideAffixedNode»
- //FIXME: workaround for #154536
- result.getBounds().setSize(result.getPreferredSize());
-«ENDDEFINE»
-
-«DEFINE getPrimaryDragEditPolicy FOR gmfgen::GenNode-»
- «LET getResizeConstraints(viewmap) AS rc-»
- «IF null != primaryDragEditPolicyQualifiedClassName || null != rc-»
- «EXPAND xpt::Common::generatedMemberComment»
- public org.eclipse.gef.EditPolicy getPrimaryDragEditPolicy() {
- «IF null != primaryDragEditPolicyQualifiedClassName-»
- return new «primaryDragEditPolicyQualifiedClassName»();
- «ELSE-»
- org.eclipse.gef.EditPolicy result = super.getPrimaryDragEditPolicy();
- if (result instanceof org.eclipse.gef.editpolicies.ResizableEditPolicy) {
- org.eclipse.gef.editpolicies.ResizableEditPolicy ep = (org.eclipse.gef.editpolicies.ResizableEditPolicy) result;
- ep.setResizeDirections(
- «IF rc.resizeHandleNames.size() > 0-»
- «FOREACH rc.resizeHandleNames AS name SEPARATOR ' | '»org.eclipse.draw2d.PositionConstants.«name»«ENDFOREACH-»
- «ELSE»org.eclipse.draw2d.PositionConstants.NONE«ENDIF»);
- }
- return result;
- «ENDIF-»
- }
- «ENDIF-»
- «ENDLET-»
-«ENDDEFINE»
-
-«DEFINE createFigure FOR gmfgen::GenNode-»
- «EXPAND xpt::Common::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()»Main«ELSE»Node«ENDIF»Figure() {
- 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;
- }
-«ENDDEFINE»
-
-«DEFINE setupContentPane FOR gmfgen::GenNode-»
- «EXPAND xpt::Common::generatedMemberComment(
- "Default implementation treats passed figure as content pane.\n" +
- "Respects layout one may have set for generated figure.\n" +
- "@param nodeShape instance of generated figure class"
- )»
- protected org.eclipse.draw2d.IFigure setupContentPane(org.eclipse.draw2d.IFigure nodeShape) {
- «IF !childNodes.isEmpty() || !compartments.isEmpty() || !labels.without(labels.typeSelect(GenExternalNodeLabel)).isEmpty()-»
- if (nodeShape.getLayoutManager() == null) {
- «IF getLayoutType().value == gmfgen::ViewmapLayoutType::XY_LAYOUT.value-»
- nodeShape.setLayoutManager(new org.eclipse.draw2d.FreeformLayout() {
-
- public Object getConstraint(org.eclipse.draw2d.IFigure figure) {
- Object result = constraints.get(figure);
- if (result == null) {
- result = new org.eclipse.draw2d.geometry.Rectangle(0, 0, -1, -1);
- }
- return result;
- }
- });
- «ELSE-»
- org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout layout =new org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout();
- layout.setSpacing(getMapMode().DPtoLP(5));
- nodeShape.setLayoutManager(layout);
- «ENDIF-»
- }
- «ENDIF-»
- return nodeShape; // use nodeShape itself as contentPane
- }
-«ENDDEFINE»
-
-«DEFINE getContentPane FOR gmfgen::GenNode-»
- «EXPAND xpt::Common::generatedMemberComment»
- public org.eclipse.draw2d.IFigure getContentPane() {
- if (contentPane != null) {
- return contentPane;
- }
- return super.getContentPane();
- }
-«ENDDEFINE»
-
-«DEFINE setForegroundColor FOR gmfgen::GenNode-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected void setForegroundColor(org.eclipse.swt.graphics.Color color) {
- if (primaryShape != null) {
- primaryShape.setForegroundColor(color);
- }
- }
-«ENDDEFINE»
-
-«DEFINE setBackgroundColor FOR gmfgen::GenNode-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected void setBackgroundColor(org.eclipse.swt.graphics.Color color) {
- if (primaryShape != null) {
- primaryShape.setBackgroundColor(color);
- }
- }
-«ENDDEFINE»
-
-«DEFINE setLineWidth FOR gmfgen::GenNode-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected void setLineWidth(int width) {
- if (primaryShape instanceof org.eclipse.draw2d.Shape) {
- ((org.eclipse.draw2d.Shape) primaryShape).setLineWidth(getMapMode().DPtoLP(width));
- }
- }
-«ENDDEFINE»
-
-«DEFINE setLineStyle FOR gmfgen::GenNode-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected void setLineType(int style) {
- if (primaryShape instanceof org.eclipse.draw2d.Shape) {
- ((org.eclipse.draw2d.Shape) primaryShape).setLineStyle(style);
- }
- }
-«ENDDEFINE»
-
-«DEFINE getPrimaryChildEditPart FOR gmfgen::GenNode-»
- «IF !labels.isEmpty()-»
- «EXPAND xpt::Common::generatedMemberComment»
- public org.eclipse.gef.EditPart getPrimaryChildEditPart() {
- return getChildBySemanticHint(«EXPAND xpt::editor::VisualIDRegistry::typeMethodCall FOR (GenLabel) labels.first()»);
- }
- «ENDIF-»
-«ENDDEFINE»
-
-// pre: getAssistantOutgoingLinks(this).size() > 0
-«DEFINE getMARelTypesOnSource FOR gmfgen::GenNode-»
- «EXPAND xpt::Common::generatedMemberComment»
- public java.util.List/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/ getMARelTypesOnSource() {
- java.util.List/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/ types = new java.util.ArrayList/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/();
- «FOREACH getAssistantOutgoingLinks(this) AS link-»
- types.add(«EXPAND xpt::providers::ElementTypes::accessElementType FOR link»);
- «ENDFOREACH-»
- return types;
- }
-«ENDDEFINE»
-
-// pre: getAssistantIncomingLinks(this).size() > 0
-«DEFINE getMARelTypesOnTarget FOR gmfgen::GenNode-»
- «EXPAND xpt::Common::generatedMemberComment»
- public java.util.List/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/ getMARelTypesOnTarget() {
- java.util.List/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/ types = new java.util.ArrayList/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/();
- «FOREACH getAssistantIncomingLinks(this) AS link-»
- types.add(«EXPAND xpt::providers::ElementTypes::accessElementType FOR link»);
- «ENDFOREACH-»
- return types;
- }
-«ENDDEFINE»
-
-// pre: getAssistantOutgoingLinks(this).size() > 0
-«DEFINE getMARelTypesOnSourceAndTarget FOR gmfgen::GenNode-»
- «EXPAND xpt::Common::generatedMemberComment»
- public java.util.List/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/ getMARelTypesOnSourceAndTarget(org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart targetEditPart) {
- java.util.List/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/ types = new java.util.ArrayList/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/();
- «FOREACH getAssistantOutgoingLinks(this) AS link-»
- «FOREACH selectGenNodes(link.targets) AS target-»
- if (targetEditPart instanceof «target.getEditPartQualifiedClassName()») {
- types.add(«EXPAND xpt::providers::ElementTypes::accessElementType FOR link»);
- }
- «ENDFOREACH-»
- «ENDFOREACH-»
- return types;
- }
-«ENDDEFINE»
-
-// pre: getAssistantIncomingLinks(this).size() > 0
-«DEFINE getMATypesForSource FOR gmfgen::GenNode-»
- «EXPAND xpt::Common::generatedMemberComment»
- public java.util.List/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/ getMATypesForSource(org.eclipse.gmf.runtime.emf.type.core.IElementType relationshipType) {
- java.util.List/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/ types = new java.util.ArrayList/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/();
- «FOREACH getAssistantIncomingLinks(this) AS link-»
- «FOREACH selectGenNodes(link.sources) AS source-»
- if (relationshipType == «EXPAND xpt::providers::ElementTypes::accessElementType FOR link») {
- types.add(«EXPAND xpt::providers::ElementTypes::accessElementType FOR source»);
- }
- «ENDFOREACH-»
- «ENDFOREACH-»
- return types;
- }
-«ENDDEFINE»
-
-// pre: getAssistantOutgoingLinks(this).size() > 0
-«DEFINE getMATypesForTarget FOR gmfgen::GenNode-»
- «EXPAND xpt::Common::generatedMemberComment»
- public java.util.List/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/ getMATypesForTarget(org.eclipse.gmf.runtime.emf.type.core.IElementType relationshipType) {
- java.util.List/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/ types = new java.util.ArrayList/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/();
- «FOREACH getAssistantOutgoingLinks(this) AS link-»
- «FOREACH link.targets.typeSelect(gmfgen::GenNode) AS target-»
- if (relationshipType == «EXPAND xpt::providers::ElementTypes::accessElementType FOR link») {
- types.add(«EXPAND xpt::providers::ElementTypes::accessElementType FOR target»);
- }
- «ENDFOREACH-»
- «ENDFOREACH-»
- return types;
- }
-«ENDDEFINE»
-
-«DEFINE handleNotificationEventBody FOR gmfgen::GenTopLevelNode-»
- if (event.getNotifier() == getModel() && org.eclipse.emf.ecore.EcorePackage.eINSTANCE.getEModelElement_EAnnotations().equals(event.getFeature())) {
- handleMajorSemanticChange();
- } else {
- super.handleNotificationEvent(event);
- }
-«ENDDEFINE»
-
-«DEFINE innerClassDeclaration FOR gmfgen::Viewmap»
-«ENDDEFINE»
-
-«DEFINE innerClassDeclaration FOR gmfgen::InnerClassViewmap»
- «classBody»
-«ENDDEFINE»
-
-«DEFINE getTargetEditPartMethod FOR gmfgen::GenNode»
- «EXPAND xpt::Common::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);
-«FOREACH compartments AS compartment-»
- «IF listCompartmentHasChildren(compartment)-»
- «FOREACH compartment.childNodes AS childNode-»
- if (type == «EXPAND xpt::providers::ElementTypes::accessElementType FOR childNode») {
- return getChildBySemanticHint(«EXPAND xpt::editor::VisualIDRegistry::typeMethodCall FOR compartment»);
- }
- «ENDFOREACH-»
- «ENDIF-»
-«ENDFOREACH-»
- }
- return super.getTargetEditPart(request);
- }
-«ENDDEFINE»
diff --git a/plugins/org.eclipse.gmf.codegen/templates/impl/diagram/editparts/NodeLabelEditPart.xpt b/plugins/org.eclipse.gmf.codegen/templates/impl/diagram/editparts/NodeLabelEditPart.xpt
deleted file mode 100644
index b0dabbc43..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates/impl/diagram/editparts/NodeLabelEditPart.xpt
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright (c) 2006, 2008 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:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Alexander Shatalin (Borland) - initial API and implementation
- */
-
-«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
-«EXTENSION xpt::diagram::editparts::Utils»
-
-«DEFINE constructor FOR gmfgen::GenNodeLabel-»
- «EXPAND xpt::Common::generatedMemberComment»
- public «editPartClassName»(org.eclipse.gmf.runtime.notation.View view) {
- super(view);
- }
-«ENDDEFINE»
-
-«DEFINE createDefaultEditPoliciesBody FOR gmfgen::GenNodeLabel-»
- super.createDefaultEditPolicies();
- installEditPolicy(org.eclipse.gef.EditPolicy.SELECTION_FEEDBACK_ROLE, new «getDiagram().getTextSelectionEditPolicyQualifiedClassName()»());
- installEditPolicy(org.eclipse.gef.EditPolicy.DIRECT_EDIT_ROLE, new org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy());
- installEditPolicy(org.eclipse.gef.EditPolicy.PRIMARY_DRAG_ROLE, new org.eclipse.gef.editpolicies.NonResizableEditPolicy() {
-
- protected java.util.List createSelectionHandles() {
- java.util.List handles = new java.util.ArrayList();
- org.eclipse.gef.handles.NonResizableHandleKit.addMoveHandle((org.eclipse.gef.GraphicalEditPart) getHost(), handles);
- ((org.eclipse.gef.handles.MoveHandle) handles.get(0)).setBorder(null);
- return handles;
- }
-
- public org.eclipse.gef.commands.Command getCommand(org.eclipse.gef.Request request) {
- return null;
- }
-
- public boolean understandsRequest(org.eclipse.gef.Request request) {
- return false;
- }
- });
- «EXPAND xpt::diagram::editparts::Common::behaviour FOR this-»
-«ENDDEFINE»
-
-«DEFINE refreshBounds FOR gmfgen::GenNodeLabel-»
- «IF isStoringChildPositions(node)-»
- «EXPAND xpt::Common::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();
- org.eclipse.draw2d.geometry.Dimension size = new org.eclipse.draw2d.geometry.Dimension(width, height);
- 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();
- org.eclipse.draw2d.geometry.Point loc = new org.eclipse.draw2d.geometry.Point(x, y);
- ((org.eclipse.gef.GraphicalEditPart) getParent()).setLayoutConstraint(this, getFigure(), new org.eclipse.draw2d.geometry.Rectangle(loc, size));
- }
- «ENDIF-»
-«ENDDEFINE»
-
-«DEFINE handleNotificationEventBody FOR gmfgen::GenNodeLabel-»
- Object feature = event.getFeature();
- «IF isStoringChildPositions(node)-»
- «EXPAND xpt::diagram::editparts::Common::handleBounds FOR this-»
- «ENDIF-»
- «EXPAND xpt::diagram::editparts::Common::handleText FOR this-»
- super.handleNotificationEvent(event);
-«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.codegen/templates/impl/diagram/editparts/TextAware.xpt b/plugins/org.eclipse.gmf.codegen/templates/impl/diagram/editparts/TextAware.xpt
deleted file mode 100644
index f00faaaac..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates/impl/diagram/editparts/TextAware.xpt
+++ /dev/null
@@ -1,537 +0,0 @@
-/*
- * Copyright (c) 2006, 2008 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:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Alexander Shatalin (Borland) - initial API and implementation
- */
-
-«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
-«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
-«EXTENSION xpt::diagram::ViewmapAttributesUtils»
-
-«DEFINE fields FOR gmfgen::GenCommonBase-»
- «EXPAND xpt::Common::generatedMemberComment»
- private org.eclipse.gef.tools.DirectEditManager manager;
-
- «EXPAND xpt::Common::generatedMemberComment»
- private org.eclipse.gmf.runtime.common.ui.services.parser.IParser parser;
-
- «EXPAND xpt::Common::generatedMemberComment»
- private java.util.List parserElements;
-
- «EXPAND xpt::Common::generatedMemberComment»
- private String defaultText;
-«ENDDEFINE»
-
-«DEFINE methods(Boolean needsRefreshBounds, Boolean readOnly, Boolean useElementIcon, gmfgen::Viewmap viewmap,
- gmfgen::LabelModelFacet modelFacet, gmfgen::GenCommonBase host, gmfgen::GenDiagram diagram) FOR gmfgen::GenCommonBase-»
- «EXPAND getLabelTextHelper-»
-
- «EXPAND setLabelTextHelper-»
-
- «EXPAND getLabelIconHelper-»
-
- «EXPAND setLabelIconHelper-»
-
- «EXPAND labelSetter-»
-
- «EXPAND getModelChildren-»
-
- «EXPAND getChildBySemanticHint-»
-
- «EXPAND getParserElement(modelFacet)-»
-
- «EXPAND getLabelIcon(useElementIcon, diagram)-»
-
- «EXPAND getLabelText-»
-
- «EXPAND setLabelText(diagram)-»
-
- «EXPAND getEditText-»
-
- «EXPAND isEditable(readOnly)-»
-
- «EXPAND getEditTextValidator-»
-
- «EXPAND getCompletionProcessor-»
-
- «EXPAND getParserOptions-»
-
- «EXPAND getParser(modelFacet, diagram, host)-»
-
- «EXPAND getManager(diagram)-»
-
- «EXPAND setManager-»
-
- «EXPAND performDirectEdit-»
-
- «EXPAND performDirectEditAtPoint-»
-
- «EXPAND performDirectEditWithInitialChar-»
-
- «EXPAND performDirectEditRequest-»
-
- «EXPAND refreshVisuals(needsRefreshBounds)-»
-
- «EXPAND refreshLabel(diagram)-»
-
- «EXPAND refreshUnderline-»
-
- «EXPAND refreshStrikeThrough-»
-
- «EXPAND refreshFont-»
-
- «EXPAND setFontColor-»
-
- «EXPAND addSemanticListeners-»
-
- «EXPAND removeSemanticListeners-»
-
- «EXPAND getAccessibleEditPart-»
-
- «EXPAND getFontStyleOwnerView(viewmap)-»
-«ENDDEFINE»
-
-«DEFINE labelSetterName FOR gmfgen::ParentAssignedViewmap-»
-«IF setterName != null»«setterName»«ELSE»setLabel«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE labelSetterName FOR gmfgen::Viewmap»setLabel«ENDDEFINE»
-
-«DEFINE getLabelTextHelper FOR gmfgen::GenCommonBase-»
- «EXPAND xpt::Common::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();
- } else {
- return ((org.eclipse.draw2d.Label) figure).getText();
- }
- }
-«ENDDEFINE»
-
-«DEFINE setLabelTextHelper FOR gmfgen::GenCommonBase-»
- «EXPAND xpt::Common::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);
- } else {
- ((org.eclipse.draw2d.Label) figure).setText(text);
- }
- }
-«ENDDEFINE»
-
-«DEFINE getLabelIconHelper FOR gmfgen::GenCommonBase-»
- «EXPAND xpt::Common::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();
- } else {
- return ((org.eclipse.draw2d.Label) figure).getIcon();
- }
- }
-«ENDDEFINE»
-
-«DEFINE setLabelIconHelper FOR gmfgen::GenCommonBase-»
- «EXPAND xpt::Common::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);
- } else {
- ((org.eclipse.draw2d.Label) figure).setIcon(icon);
- }
- }
-«ENDDEFINE»
-
-«DEFINE labelSetter FOR gmfgen::GenCommonBase-»
- «EXPAND xpt::Common::generatedMemberComment»
- public void «EXPAND labelSetterName FOR viewmap»(«EXPAND labelSetterFigureClassName FOR viewmap» figure) {
- unregisterVisuals();
- setFigure(figure);
- defaultText = getLabelTextHelper(figure);
- registerVisuals();
- refreshVisuals();
- }
-«ENDDEFINE»
-
-«DEFINE labelSetterFigureClassName FOR gmfgen::ParentAssignedViewmap-»
- «IF figureQualifiedClassName != null-»
- «figureQualifiedClassName»
- «ELSE-»
- org.eclipse.draw2d.IFigure
- «ENDIF-»
-«ENDDEFINE»
-
-«DEFINE labelSetterFigureClassName FOR gmfgen::Viewmap-»
- org.eclipse.draw2d.IFigure
-«ENDDEFINE»
-
-«DEFINE getModelChildren FOR gmfgen::GenCommonBase-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected java.util.List getModelChildren() {
- return java.util.Collections.EMPTY_LIST;
- }
-«ENDDEFINE»
-
-«DEFINE getChildBySemanticHint FOR gmfgen::GenCommonBase-»
- «EXPAND xpt::Common::generatedMemberComment»
- public org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
- return null;
- }
-«ENDDEFINE»
-
-«DEFINE getParserElement(gmfgen::LabelModelFacet modelFacet) FOR gmfgen::GenCommonBase-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected org.eclipse.emf.ecore.EObject getParserElement() {
-«IF modelFacet == null»
- org.eclipse.emf.ecore.EObject element = resolveSemanticElement();
- return element != null ? element : (org.eclipse.gmf.runtime.notation.View) getModel();
-«ELSE»«EXPAND getParserElement FOR modelFacet»«ENDIF-»
- }
-«ENDDEFINE»
-
-«DEFINE getParserElement FOR gmfgen::LabelModelFacet-»
- return resolveSemanticElement();
-«ENDDEFINE»
-
-«DEFINE getParserElement FOR gmfgen::DesignLabelModelFacet-»
- return (org.eclipse.gmf.runtime.notation.View) getModel();
-«ENDDEFINE»
-
-«DEFINE getLabelIcon(Boolean useElementIcon, gmfgen::GenDiagram diagram) FOR gmfgen::GenCommonBase-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected org.eclipse.swt.graphics.Image getLabelIcon() {
- «IF useElementIcon-»
- org.eclipse.emf.ecore.EObject parserElement = getParserElement();
- if (parserElement == null) {
- return null;
- }
- return «diagram.getElementTypesQualifiedClassName()».getImage(parserElement.eClass());
- «ELSE-»
- return null;
- «ENDIF-»
- }
-«ENDDEFINE»
-
-«DEFINE getLabelText FOR gmfgen::GenCommonBase-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected String getLabelText() {
- String text = null;
- org.eclipse.emf.ecore.EObject parserElement = getParserElement();
- if (parserElement != null && getParser() != null) {
- text = getParser().getPrintString(
- new org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter(parserElement),
- getParserOptions().intValue());
- }
- if (text == null || text.length() == 0) {
- text = defaultText;
- }
- return text;
- }
-«ENDDEFINE»
-
-«DEFINE setLabelText(gmfgen::GenDiagram diagram) FOR gmfgen::GenCommonBase-»
- «EXPAND xpt::Common::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();
- }
- Object sfEditPolicy = getEditPolicy(org.eclipse.gef.EditPolicy.SELECTION_FEEDBACK_ROLE);
- if (sfEditPolicy instanceof «diagram.getTextSelectionEditPolicyQualifiedClassName()») {
- ((«diagram.getTextSelectionEditPolicyQualifiedClassName()») sfEditPolicy).refreshFeedback();
- }
- }
-«ENDDEFINE»
-
-«DEFINE getEditText FOR gmfgen::GenCommonBase-»
- «EXPAND xpt::Common::generatedMemberComment»
- public String getEditText() {
- if (getParserElement() == null || getParser() == null) {
- return ""; «EXPAND xpt::Common::nonNLS»
- }
- return getParser().getEditString(
- new org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter(getParserElement()),
- getParserOptions().intValue());
- }
-«ENDDEFINE»
-
-«DEFINE isEditable(Boolean readOnly) FOR gmfgen::GenCommonBase-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected boolean isEditable() {
- «IF readOnly-»
- return false;
- «ELSE-»
- return getParser() != null;
- «ENDIF-»
- }
-«ENDDEFINE»
-
-«DEFINE getEditTextValidator FOR gmfgen::GenCommonBase-»
- «EXPAND xpt::Common::generatedMemberComment»
- public org.eclipse.jface.viewers.ICellEditorValidator getEditTextValidator() {
- return new org.eclipse.jface.viewers.ICellEditorValidator() {
-
- public String isValid(final Object value) {
- if (value instanceof String) {
- final org.eclipse.emf.ecore.EObject element = getParserElement();
- final org.eclipse.gmf.runtime.common.ui.services.parser.IParser parser = getParser();
- try {
- org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus valid =
- (org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus) getEditingDomain().runExclusive(
- new org.eclipse.emf.transaction.RunnableWithResult.Impl() {
-
- public void run() {
- setResult(parser.isValidEditString(new org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter(element), (String) value));
- }
- });
- return valid.getCode() == org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus.EDITABLE ? null : valid.getMessage();
- } catch (InterruptedException ie) {
- ie.printStackTrace();
- }
- }
-
- // shouldn't get here
- return null;
- }
- };
- }
-«ENDDEFINE»
-
-«DEFINE getCompletionProcessor FOR gmfgen::GenCommonBase-»
- «EXPAND xpt::Common::generatedMemberComment»
- public org.eclipse.jface.text.contentassist.IContentAssistProcessor getCompletionProcessor() {
- if (getParserElement() == null || getParser() == null) {
- return null;
- }
- return getParser().getCompletionProcessor(new org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter(getParserElement()));
- }
-«ENDDEFINE»
-
-«DEFINE getParserOptions FOR gmfgen::GenCommonBase-»
- «EXPAND xpt::Common::generatedMemberComment»
- public org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions getParserOptions() {
- return org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions.NONE;
- }
-«ENDDEFINE»
-
-«DEFINE getParser(gmfgen::LabelModelFacet modelFacet, gmfgen::GenDiagram diagram, gmfgen::GenCommonBase host) FOR gmfgen::GenCommonBase-»
- «EXPAND xpt::Common::generatedMemberComment»
- public org.eclipse.gmf.runtime.common.ui.services.parser.IParser getParser() {
- if (parser == null) {
- parser = «EXPAND parsers::ParserProvider::accessorCall(host, modelFacet, "getParserElement()")»;
- }
- return parser;
- }
-«ENDDEFINE»
-
-«DEFINE getManager(gmfgen::GenDiagram diagram) FOR gmfgen::GenCommonBase-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected org.eclipse.gef.tools.DirectEditManager getManager() {
- if (manager == null) {
- setManager(new org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager(this,
- org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager.getTextCellEditorClass(this),
- «diagram.getEditPartFactoryQualifiedClassName()».getTextCellEditorLocator(this)));
- }
- return manager;
- }
-«ENDDEFINE»
-
-«DEFINE setManager FOR gmfgen::GenCommonBase-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected void setManager(org.eclipse.gef.tools.DirectEditManager manager) {
- this.manager = manager;
- }
-«ENDDEFINE»
-
-«DEFINE performDirectEdit FOR gmfgen::GenCommonBase-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected void performDirectEdit() {
- getManager().show();
- }
-«ENDDEFINE»
-
-«DEFINE performDirectEditAtPoint FOR gmfgen::GenCommonBase-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected void performDirectEdit(org.eclipse.draw2d.geometry.Point eventLocation) {
- if (getManager().getClass() == org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager.class) {
- ((org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
- }
- }
-«ENDDEFINE»
-
-«DEFINE performDirectEditWithInitialChar FOR gmfgen::GenCommonBase-»
- «EXPAND xpt::Common::generatedMemberComment»
- private 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);
- } else {
- performDirectEdit();
- }
- }
-«ENDDEFINE»
-
-«DEFINE performDirectEditRequest FOR gmfgen::GenCommonBase-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected void performDirectEditRequest(org.eclipse.gef.Request request) {
- final org.eclipse.gef.Request theRequest = request;
- try {
- getEditingDomain().runExclusive(new Runnable() {
-
- 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) {
- Character initialChar = (Character) theRequest.getExtendedData().get(org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- } else if ((theRequest instanceof org.eclipse.gef.requests.DirectEditRequest) && (getEditText().equals(getLabelText()))) {
- org.eclipse.gef.requests.DirectEditRequest editRequest = (org.eclipse.gef.requests.DirectEditRequest) theRequest;
- performDirectEdit(editRequest.getLocation());
- } else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-«ENDDEFINE»
-
-«DEFINE refreshVisuals(Boolean needsRefreshBounds) FOR gmfgen::GenCommonBase-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshFont();
- refreshFontColor();
- refreshUnderline();
- refreshStrikeThrough();
- «IF needsRefreshBounds-»
- refreshBounds();
- «ENDIF-»
- }
-«ENDDEFINE»
-
-«DEFINE refreshLabel(gmfgen::GenDiagram diagram) FOR gmfgen::GenCommonBase-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected void refreshLabel() {
- setLabelTextHelper(getFigure(), getLabelText());
- setLabelIconHelper(getFigure(), getLabelIcon());
- Object pdEditPolicy = getEditPolicy(org.eclipse.gef.EditPolicy.PRIMARY_DRAG_ROLE);
- 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();
- }
- }
-«ENDDEFINE»
-
-«DEFINE refreshUnderline FOR gmfgen::GenCommonBase-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected void refreshUnderline() {
- org.eclipse.gmf.runtime.notation.FontStyle style =
- (org.eclipse.gmf.runtime.notation.FontStyle) getFontStyleOwnerView().getStyle(
- org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) {
- ((org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
- }
- }
-«ENDDEFINE»
-
-«DEFINE refreshStrikeThrough FOR gmfgen::GenCommonBase-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected void refreshStrikeThrough() {
- org.eclipse.gmf.runtime.notation.FontStyle style =
- (org.eclipse.gmf.runtime.notation.FontStyle) getFontStyleOwnerView().getStyle(
- org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) {
- ((org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
- }
- }
-«ENDDEFINE»
-
-«DEFINE refreshFont FOR gmfgen::GenCommonBase-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected void refreshFont() {
- org.eclipse.gmf.runtime.notation.FontStyle style =
- (org.eclipse.gmf.runtime.notation.FontStyle) getFontStyleOwnerView().getStyle(
- org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getFontStyle());
- if (style != null) {
- org.eclipse.swt.graphics.FontData fontData = new org.eclipse.swt.graphics.FontData(
- style.getFontName(), style.getFontHeight(),
- (style.isBold() ? org.eclipse.swt.SWT.BOLD : org.eclipse.swt.SWT.NORMAL) |
- (style.isItalic() ? org.eclipse.swt.SWT.ITALIC : org.eclipse.swt.SWT.NORMAL));
- setFont(fontData);
- }
- }
-«ENDDEFINE»
-
-«DEFINE setFontColor FOR gmfgen::GenCommonBase-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected void setFontColor(org.eclipse.swt.graphics.Color color) {
- getFigure().setForegroundColor(color);
- }
-«ENDDEFINE»
-
-«DEFINE addSemanticListeners FOR gmfgen::GenCommonBase-»
- «EXPAND xpt::Common::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)); «EXPAND xpt::Common::nonNLS»
- }
- } else {
- super.addSemanticListeners();
- }
- }
-«ENDDEFINE»
-
-«DEFINE removeSemanticListeners FOR gmfgen::GenCommonBase-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected void removeSemanticListeners() {
- if (parserElements != null) {
- for (int i = 0; i < parserElements.size(); i++) {
- removeListenerFilter("SemanticModel" + i); «EXPAND xpt::Common::nonNLS»
- }
- } else {
- super.removeSemanticListeners();
- }
- }
-«ENDDEFINE»
-
-«DEFINE getAccessibleEditPart FOR gmfgen::GenCommonBase-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected org.eclipse.gef.AccessibleEditPart getAccessibleEditPart() {
- if (accessibleEP == null) {
- accessibleEP = new AccessibleGraphicalEditPart() {
-
- public void getName(org.eclipse.swt.accessibility.AccessibleEvent e) {
- e.result = getLabelTextHelper(getFigure());
- }
- };
- }
- return accessibleEP;
- }
-«ENDDEFINE»
-
-«DEFINE getFontStyleOwnerView(gmfgen::Viewmap viewmap) FOR gmfgen::GenCommonBase-»
- «EXPAND xpt::Common::generatedMemberComment»
- private org.eclipse.gmf.runtime.notation.View getFontStyleOwnerView() {
- «IF isFixedFont(viewmap)-»
- return (org.eclipse.gmf.runtime.notation.View) getModel();
- «ELSE-»
- return getPrimaryView();
- «ENDIF-»
- }
-«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.codegen/templates/impl/parsers/AbstractParser.xpt b/plugins/org.eclipse.gmf.codegen/templates/impl/parsers/AbstractParser.xpt
deleted file mode 100644
index 67bbf096d..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates/impl/parsers/AbstractParser.xpt
+++ /dev/null
@@ -1,396 +0,0 @@
-/*
- * Copyright (c) 2007, 2008 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:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Artem Tikhomirov (Borland) - [235113] alternative parser access
- * [244419] custom parsers
- */
-
-«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
-«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
-«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
-
-«EXTENSION impl::parsers::i18n»
-
-«DEFINE className FOR gmfgen::GenParsers»«defaultAbstractParserClassName()»«ENDDEFINE»
-«DEFINE qualifiedClassName FOR gmfgen::GenParsers»«implPackageName».«EXPAND className»«ENDDEFINE»
-
-«DEFINE Main FOR gmfgen::GenParsers-»
-«EXPAND xpt::Common::copyright FOR editorGen-»
-package «implPackageName»;
-
-«EXPAND xpt::Common::generatedClassComment»
-public abstract class «EXPAND className» implements org.eclipse.gmf.runtime.common.ui.services.parser.IParser {
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected final org.eclipse.emf.ecore.EAttribute[] features;
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected final org.eclipse.emf.ecore.EAttribute[] editableFeatures;
-
- «EXPAND xpt::Common::generatedMemberComment»
- private String viewPattern;
-
- «EXPAND xpt::Common::generatedMemberComment»
- private String editorPattern;
-
- «EXPAND xpt::Common::generatedMemberComment»
- private String editPattern;
-
- «EXPAND xpt::Common::generatedMemberComment»
- public «EXPAND className»(org.eclipse.emf.ecore.EAttribute[] features) {
- if (features == null || java.util.Arrays.asList(features).contains(null)) {
- throw new IllegalArgumentException();
- }
- this.editableFeatures = this.features = features;
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- public «EXPAND className»(org.eclipse.emf.ecore.EAttribute[] features,
- org.eclipse.emf.ecore.EAttribute[] editableFeatures) {
- if (features == null || java.util.Arrays.asList(features).contains(null)) {
- throw new IllegalArgumentException();
- }
- this.features = features;
- if (editableFeatures == null || java.util.Arrays.asList(editableFeatures).contains(null)) {
- throw new IllegalArgumentException();
- }
- this.editableFeatures = editableFeatures;
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- public String getViewPattern() {
- return viewPattern;
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- public void setViewPattern(String viewPattern) {
- this.viewPattern = viewPattern;
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- public String getEditorPattern() {
- return editorPattern;
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- public void setEditorPattern(String editorPattern) {
- this.editorPattern = editorPattern;
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- public String getEditPattern() {
- return editPattern;
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- public void setEditPattern(String editPattern) {
- this.editPattern = editPattern;
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- public boolean isAffectingEvent(Object event, int flags) {
- if (event instanceof org.eclipse.emf.common.notify.Notification) {
- return isAffectingFeature(((org.eclipse.emf.common.notify.Notification) event).getFeature());
- }
- return false;
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected boolean isAffectingFeature(Object feature) {
- for (int i = 0; i < features.length; i++) {
- if (features[i] == feature) {
- return true;
- }
- }
- return false;
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- public org.eclipse.jface.text.contentassist.IContentAssistProcessor getCompletionProcessor(
- org.eclipse.core.runtime.IAdaptable element) {
- return null;
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected Object[] getValues(org.eclipse.emf.ecore.EObject element) {
- Object[] values = new Object[features.length];
- for (int i = 0; i < features.length; i++) {
- values[i] = getValue(element, features[i]);
- }
- return values;
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected Object[] getEditableValues(org.eclipse.emf.ecore.EObject element) {
- Object[] values = new Object[editableFeatures.length];
- for (int i = 0; i < editableFeatures.length; i++) {
- values[i] = getValue(element, editableFeatures[i]);
- }
- return values;
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected Object getValue(org.eclipse.emf.ecore.EObject element, org.eclipse.emf.ecore.EAttribute feature) {
- Object value = element.eGet(feature);
- Class iClass = feature.getEAttributeType().getInstanceClass();
- if (String.class.equals(iClass)) {
- if (value == null) {
- value = ""; «EXPAND xpt::Common::nonNLS»
- }
- }
- return value;
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected org.eclipse.gmf.runtime.common.core.command.ICommand getParseCommand(
- org.eclipse.core.runtime.IAdaptable adapter, Object[] values, int flags) {
- if (values == null || validateNewValues(values).getCode() !=
- org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus.EDITABLE) {
- return org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand.INSTANCE;
- }
- org.eclipse.emf.ecore.EObject element =
- (org.eclipse.emf.ecore.EObject) adapter.getAdapter(org.eclipse.emf.ecore.EObject.class);
- org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain =
- org.eclipse.emf.transaction.util.TransactionUtil.getEditingDomain(element);
- if (editingDomain == null) {
- return org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand.INSTANCE;
- }
- org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand command =
- new org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand(
- editingDomain, "Set Values"); «EXPAND xpt::Common::nonNLS»
- for (int i = 0; i < values.length; i++) {
- command.compose(getModificationCommand(element, editableFeatures[i], values[i]));
- }
- return command;
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected org.eclipse.gmf.runtime.common.core.command.ICommand getModificationCommand(
- org.eclipse.emf.ecore.EObject element, org.eclipse.emf.ecore.EAttribute feature, Object value) {
- value = getValidNewValue(feature, value);
- if (value instanceof InvalidValue) {
- return org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand.INSTANCE;
- }
- org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest request =
- new org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest(element, feature, value);
- return new org.eclipse.gmf.runtime.emf.type.core.commands.SetValueCommand(request);
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus validateNewValues(Object[] values) {
- if (values.length != editableFeatures.length) {
- return org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus.UNEDITABLE_STATUS;
- }
- for (int i = 0; i < values.length; i++) {
- Object value = getValidNewValue(editableFeatures[i], values[i]);
- if (value instanceof InvalidValue) {
- return new org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus(
- «editorGen.plugin.getActivatorQualifiedClassName()».ID,
- org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus.UNEDITABLE,
- value.toString());
- }
- }
- return org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus.EDITABLE_STATUS;
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected Object getValidNewValue(org.eclipse.emf.ecore.EAttribute feature, Object value) {
- org.eclipse.emf.ecore.EClassifier type = feature.getEType();
- if (type instanceof org.eclipse.emf.ecore.EDataType) {
- Class iClass = type.getInstanceClass();
- if (Boolean.TYPE.equals(iClass)) {
- if (value instanceof Boolean) {
- // ok
- } else if (value instanceof String) {
- value = Boolean.valueOf((String) value);
- } else {
- value = new InvalidValue(org.eclipse.osgi.util.NLS.bind(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForAbstractParserUnexpectedValueTypeMessage()) FOR editorGen», iClass.getName()));
- }
- } else if (Character.TYPE.equals(iClass)) {
- if (value instanceof Character) {
- // ok
- } else if (value instanceof String) {
- String s = (String) value;
- if (s.length() == 0) {
- value = null;
- } else {
- value = new Character(s.charAt(0));
- }
- } else {
- value = new InvalidValue(org.eclipse.osgi.util.NLS.bind(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForAbstractParserUnexpectedValueTypeMessage()) FOR editorGen», iClass.getName()));
- }
- } else if (Byte.TYPE.equals(iClass)) {
- if (value instanceof Byte) {
- // ok
- } else if (value instanceof Number) {
- value = new Byte(((Number) value).byteValue());
- } else if (value instanceof String) {
- String s = (String) value;
- if (s.length() == 0) {
- value = null;
- } else {
- try {
- value = Byte.valueOf(s);
- } catch (NumberFormatException nfe) {
- value = new InvalidValue(org.eclipse.osgi.util.NLS.bind(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForAbstractParserWrongStringConversionMessage()) FOR editorGen», iClass.getName()));
- }
- }
- } else {
- value = new InvalidValue(org.eclipse.osgi.util.NLS.bind(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForAbstractParserUnexpectedValueTypeMessage()) FOR editorGen», iClass.getName()));
- }
- } else if (Short.TYPE.equals(iClass)) {
- if (value instanceof Short) {
- // ok
- } else if (value instanceof Number) {
- value = new Short(((Number) value).shortValue());
- } else if (value instanceof String) {
- String s = (String) value;
- if (s.length() == 0) {
- value = null;
- } else {
- try {
- value = Short.valueOf(s);
- } catch (NumberFormatException nfe) {
- value = new InvalidValue(org.eclipse.osgi.util.NLS.bind(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForAbstractParserWrongStringConversionMessage()) FOR editorGen», iClass.getName()));
- }
- }
- } else {
- value = new InvalidValue(org.eclipse.osgi.util.NLS.bind(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForAbstractParserUnexpectedValueTypeMessage()) FOR editorGen», iClass.getName()));
- }
- } else if (Integer.TYPE.equals(iClass)) {
- if (value instanceof Integer) {
- // ok
- } else if (value instanceof Number) {
- value = new Integer(((Number) value).intValue());
- } else if (value instanceof String) {
- String s = (String) value;
- if (s.length() == 0) {
- value = null;
- } else {
- try {
- value = Integer.valueOf(s);
- } catch (NumberFormatException nfe) {
- value = new InvalidValue(org.eclipse.osgi.util.NLS.bind(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForAbstractParserWrongStringConversionMessage()) FOR editorGen», iClass.getName()));
- }
- }
- } else {
- value = new InvalidValue(org.eclipse.osgi.util.NLS.bind(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForAbstractParserUnexpectedValueTypeMessage()) FOR editorGen», iClass.getName()));
- }
- } else if (Long.TYPE.equals(iClass)) {
- if (value instanceof Long) {
- // ok
- } else if (value instanceof Number) {
- value = new Long(((Number) value).longValue());
- } else if (value instanceof String) {
- String s = (String) value;
- if (s.length() == 0) {
- value = null;
- } else {
- try {
- value = Long.valueOf(s);
- } catch (NumberFormatException nfe) {
- value = new InvalidValue(org.eclipse.osgi.util.NLS.bind(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForAbstractParserWrongStringConversionMessage()) FOR editorGen», iClass.getName()));
- }
- }
- } else {
- value = new InvalidValue(org.eclipse.osgi.util.NLS.bind(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForAbstractParserUnexpectedValueTypeMessage()) FOR editorGen», iClass.getName()));
- }
- } else if (Float.TYPE.equals(iClass)) {
- if (value instanceof Float) {
- // ok
- } else if (value instanceof Number) {
- value = new Float(((Number) value).floatValue());
- } else if (value instanceof String) {
- String s = (String) value;
- if (s.length() == 0) {
- value = null;
- } else {
- try {
- value = Float.valueOf(s);
- } catch (NumberFormatException nfe) {
- value = new InvalidValue(org.eclipse.osgi.util.NLS.bind(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForAbstractParserWrongStringConversionMessage()) FOR editorGen», iClass.getName()));
- }
- }
- } else {
- value = new InvalidValue(org.eclipse.osgi.util.NLS.bind(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForAbstractParserUnexpectedValueTypeMessage()) FOR editorGen», iClass.getName()));
- }
- } else if (Double.TYPE.equals(iClass)) {
- if (value instanceof Double) {
- // ok
- } else if (value instanceof Number) {
- value = new Double(((Number) value).doubleValue());
- } else if (value instanceof String) {
- String s = (String) value;
- if (s.length() == 0) {
- value = null;
- } else {
- try {
- value = Double.valueOf(s);
- } catch (NumberFormatException nfe) {
- value = new InvalidValue(org.eclipse.osgi.util.NLS.bind(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForAbstractParserWrongStringConversionMessage()) FOR editorGen», iClass.getName()));
- }
- }
- } else {
- value = new InvalidValue(org.eclipse.osgi.util.NLS.bind(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForAbstractParserUnexpectedValueTypeMessage()) FOR editorGen», iClass.getName()));
- }
- } else if (type instanceof org.eclipse.emf.ecore.EEnum) {
- if (value instanceof String) {
- org.eclipse.emf.ecore.EEnumLiteral literal =
- ((org.eclipse.emf.ecore.EEnum) type).getEEnumLiteralByLiteral((String) value);
- if (literal == null) {
- value = new InvalidValue(org.eclipse.osgi.util.NLS.bind(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForAbstractParserUnknownLiteralMessage()) FOR editorGen», value));
- } else {
- value = literal.getInstance();
- }
- } else {
- value = new InvalidValue(org.eclipse.osgi.util.NLS.bind(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForAbstractParserUnexpectedValueTypeMessage()) FOR editorGen», String.class.getName()));
- }
- }
- }
- return value;
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected class InvalidValue {
-
- «EXPAND xpt::Common::generatedMemberComment»
- private String description;
-
- «EXPAND xpt::Common::generatedMemberComment»
- public InvalidValue(String description) {
- this.description = description;
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- public String toString() {
- return description;
- }
- }
- «EXPAND additions-»
-}
-«ENDDEFINE»
-
-«DEFINE additions FOR gmfgen::GenParsers»«ENDDEFINE»
-
-«DEFINE i18nValues FOR gmfgen::GenParsers-»
-«IF implementations.typeSelect(PredefinedParser).size() > 0-»
-«EXPAND xpt::Externalizer::messageEntry(i18nKeyForAbstractParserUnexpectedValueTypeMessage(), "Value of type {0} is expected")-»
-«EXPAND xpt::Externalizer::messageEntry(i18nKeyForAbstractParserWrongStringConversionMessage(), "String value does not convert to {0} value")-»
-«EXPAND xpt::Externalizer::messageEntry(i18nKeyForAbstractParserUnknownLiteralMessage(), "Unknown literal: {0}")-»
-«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE i18nAccessors FOR gmfgen::GenParsers-»
-«IF implementations.typeSelect(PredefinedParser).size() > 0-»
-«EXPAND xpt::Externalizer::accessorField(i18nKeyForAbstractParserUnexpectedValueTypeMessage())-»
-«EXPAND xpt::Externalizer::accessorField(i18nKeyForAbstractParserWrongStringConversionMessage())-»
-«EXPAND xpt::Externalizer::accessorField(i18nKeyForAbstractParserUnknownLiteralMessage())-»
-«ENDIF-»
-«ENDDEFINE»
diff --git a/plugins/org.eclipse.gmf.codegen/templates/impl/parsers/ParserProvider.xpt b/plugins/org.eclipse.gmf.codegen/templates/impl/parsers/ParserProvider.xpt
deleted file mode 100644
index 5d6131b8b..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates/impl/parsers/ParserProvider.xpt
+++ /dev/null
@@ -1,223 +0,0 @@
-/*
- * Copyright (c) 2007, 2008 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:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Artem Tikhomirov (Borland) - [235113] alternative parser access
- * [244419] custom parsers
- */
-
-«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
-«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
-«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
-
-«EXTENSION xpt::providers::ParserUtils»
-
-«DEFINE accessorMethod_delegate2providers FOR gmfgen::GenParsers-»
- «EXPAND xpt::Common::generatedMemberComment("Utility method that consults ParserService")»
- public static org.eclipse.gmf.runtime.common.ui.services.parser.IParser getParser(org.eclipse.gmf.runtime.emf.type.core.IElementType type, org.eclipse.emf.ecore.EObject object, String parserHint) {
- return org.eclipse.gmf.runtime.common.ui.services.parser.ParserService.getInstance().getParser(new HintAdapter(type, object, parserHint));
- }
-«ENDDEFINE»
-
-// invokes method generated with accessorMethod_delegate2providers template
-«DEFINE accessorCall_delegate2providers(gmfgen::GenCommonBase elementTypeHolder, gmfgen::LabelModelFacet labelModelFacet, String parsedElement) FOR gmfgen::GenCommonBase-»
-«getDiagram().editorGen.labelParsers.getQualifiedClassName()».getParser(«EXPAND xpt::providers::ElementTypes::accessElementType FOR elementTypeHolder», «parsedElement», «IF labelModelFacet == null»«EXPAND xpt::editor::VisualIDRegistry::typeMethodCall»«ELSE»«EXPAND _parserHint(labelModelFacet, this) FOR labelModelFacet.parser»«ENDIF»)«-»
-«ENDDEFINE»
-
-«DEFINE _parserHint(gmfgen::LabelModelFacet labelFacet, gmfgen::GenCommonBase hintHolder) FOR GenParserImplementation»«EXPAND xpt::editor::VisualIDRegistry::typeMethodCall FOR hintHolder»«ENDDEFINE»
-// ExternalParser may override hint
-«DEFINE _parserHint(gmfgen::LabelModelFacet labelFacet, gmfgen::GenCommonBase hintHolder) FOR ExternalParser-»
-«IF hint == null-»
-«EXPAND xpt::editor::VisualIDRegistry::typeMethodCall FOR hintHolder-»
-«ELSE»«hint»«ENDIF-»
-«ENDDEFINE»
-«DEFINE _parserHint(gmfgen::DesignLabelModelFacet labelFacet, gmfgen::GenCommonBase hintHolder) FOR ExternalParser-»
-«IF hint == null»org.eclipse.gmf.runtime.common.ui.services.parser.CommonParserHint.DESCRIPTION«ELSE»«hint»«ENDIF-»
-«ENDDEFINE»
-«DEFINE _parserHint(gmfgen::DesignLabelModelFacet labelFacet, gmfgen::GenCommonBase hintHolder) FOR GenParserImplementation»org.eclipse.gmf.runtime.common.ui.services.parser.CommonParserHint.DESCRIPTION«ENDDEFINE»
-
-// FIXME refactor static field to an instance registered within Activator
-«REM»Complementary method to accessorMethod_delegate2providers, although for direct access need an instance of this class«ENDREM»
-«DEFINE accessorMethod_direct FOR gmfgen::GenParsers-»
- private static «getQualifiedClassName()» ourInstance;
-
- public static «getQualifiedClassName()» get() {
- if (ourInstance == null) {
- ourInstance = new «getQualifiedClassName()»();
- }
- return ourInstance;
- }
-«ENDDEFINE»
-
-// XXX consider adding #getDescriptionParser() method to control that kind of parser access?
-// XXX do I really need GenCommonBase elementTypeHolder, why not use elementType reference directly?
-«DEFINE accessorCall_direct(gmfgen::GenCommonBase elementTypeHolder, gmfgen::LabelModelFacet labelModelFacet, String parsedElement) FOR gmfgen::GenCommonBase-»
-«IF labelModelFacet == null || { labelModelFacet.parser }.typeSelect(ExternalParser).size() == 1-»
-org.eclipse.gmf.runtime.common.ui.services.parser.ParserService.getInstance().getParser(new org.eclipse.gmf.runtime.emf.ui.services.parser.ParserHintAdapter(/*«EXPAND xpt::providers::ElementTypes::accessElementType FOR elementTypeHolder», */«parsedElement», «IF labelModelFacet == null»«EXPAND xpt::editor::VisualIDRegistry::typeMethodCall»«ELSE»«EXPAND _parserHint(labelModelFacet, this) FOR labelModelFacet.parser»«ENDIF»))«-»
-«ELSE-»
-«getDiagram().editorGen.labelParsers.getQualifiedClassName()».get().«parserAccessorName(this)»()«-»
-«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE provider_getParserMethod FOR gmfgen::GenParsers-»
- «EXPAND xpt::Common::generatedMemberComment»
- public org.eclipse.gmf.runtime.common.ui.services.parser.IParser getParser(
- org.eclipse.core.runtime.IAdaptable hint) {
- String vid = (String) hint.getAdapter(String.class);
- if (vid != null) {
- return getParser(«EXPAND xpt::editor::VisualIDRegistry::getVisualIDMethodCall FOR editorGen.diagram»(vid));
- }
- org.eclipse.gmf.runtime.notation.View view =
- (org.eclipse.gmf.runtime.notation.View) hint.getAdapter(org.eclipse.gmf.runtime.notation.View.class);
- if (view != null) {
- return getParser(«EXPAND xpt::editor::VisualIDRegistry::getVisualIDMethodCall FOR editorGen.diagram»(view));
- }
- return null;
- }
-«ENDDEFINE»
-
-«DEFINE provider_providesMethod FOR gmfgen::GenParsers-»
- «EXPAND xpt::Common::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 («editorGen.diagram.getElementTypesQualifiedClassName()».getElement(hint) == null) {
- return false;
- }
- return getParser(hint) != null;
- }
- return false;
- }
-«ENDDEFINE»
-
-«DEFINE HintAdapterClass FOR gmfgen::GenParsers-»
- «EXPAND xpt::Common::generatedMemberComment»
- private static class HintAdapter extends org.eclipse.gmf.runtime.emf.ui.services.parser.ParserHintAdapter {
-
- «EXPAND xpt::Common::generatedMemberComment»
- private final org.eclipse.gmf.runtime.emf.type.core.IElementType elementType;
-
- «EXPAND xpt::Common::generatedMemberComment»
- public HintAdapter(org.eclipse.gmf.runtime.emf.type.core.IElementType type,
- org.eclipse.emf.ecore.EObject object, String parserHint) {
- super(object, parserHint);
- «EXPAND xpt::Common::assert("type != null")-»
- elementType = type;
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- public Object getAdapter(Class adapter) {
- if (org.eclipse.gmf.runtime.emf.type.core.IElementType.class.equals(adapter)) {
- return elementType;
- }
- return super.getAdapter(adapter);
- }
- }
-«ENDDEFINE»
-
-«DEFINE getParserByVisualIdMethod FOR gmfgen::GenParsers-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected org.eclipse.gmf.runtime.common.ui.services.parser.IParser getParser(int visualID) {
- switch (visualID) {
- «EXPAND _getParsers FOREACH editorGen.diagram.topLevelNodes-»
- «EXPAND _getParsers FOREACH editorGen.diagram.childNodes-»
- «EXPAND _getParsers FOREACH editorGen.diagram.links-»
- }
- return null;
- }
-«ENDDEFINE»
-
-«DEFINE _getParsers FOR gmfgen::GenNode»«EXPAND _getParser FOREACH labels»«ENDDEFINE»
-«DEFINE _getParsers FOR gmfgen::GenLink»«EXPAND _getParser FOREACH labels»«ENDDEFINE»
-«DEFINE _getParsers FOR gmfgen::GenChildLabelNode»«EXPAND _getParser(this) FOR labelModelFacet»«ENDDEFINE»
-«DEFINE _getParser FOR gmfgen::GenLabel»«EXPAND _getParser(this) FOR modelFacet»«ENDDEFINE»
-
-«DEFINE _getParser(gmfgen::GenCommonBase element) FOR gmfgen::LabelModelFacet»«EXPAND _getParser(this, element) FOR parser»«ENDDEFINE»
-
-«DEFINE _getParser(LabelModelFacet modelFacet, GenCommonBase element) FOR gmfgen::GenParserImplementation»«ERROR "Abstract template for " + this»«ENDDEFINE»
-«DEFINE _getParser(LabelModelFacet modelFacet, GenCommonBase element) FOR gmfgen::ExternalParser»«REM»NOTHING TO DO«ENDREM»«ENDDEFINE»
-
-«DEFINE _getParser(LabelModelFacet modelFacet, GenCommonBase element) FOR gmfgen::PredefinedParser-»
- «EXPAND xpt::Common::caseVisualID FOR element» return «parserAccessorName(element)»();
-«ENDDEFINE»
-
-«DEFINE _getParser(LabelModelFacet modelFacet, GenCommonBase element) FOR gmfgen::CustomParser-»
- «EXPAND xpt::Common::caseVisualID FOR element» return «parserAccessorName(element)»();
-«ENDDEFINE»
-
-
-«DEFINE parsers FOR gmfgen::GenNode»«EXPAND _parser FOREACH labels»«ENDDEFINE»
-«DEFINE parsers FOR gmfgen::GenLink»«EXPAND _parser FOREACH labels»«ENDDEFINE»
-«DEFINE parsers FOR gmfgen::GenChildLabelNode»«EXPAND _parser(this) FOR labelModelFacet»«ENDDEFINE»
-
-«DEFINE _parser FOR gmfgen::GenLabel»«EXPAND _parser(this) FOR modelFacet»«ENDDEFINE»
-«DEFINE _parser(gmfgen::GenCommonBase element) FOR gmfgen::LabelModelFacet»«EXPAND _parser(this, element) FOR parser»«ENDDEFINE»
-
-«DEFINE _parser(LabelModelFacet modelFacet, GenCommonBase element) FOR gmfgen::GenParserImplementation»«ERROR "Abstract template for " + this»«ENDDEFINE»
-
-«DEFINE _parser(LabelModelFacet modelFacet, GenCommonBase element) FOR gmfgen::CustomParser»
- «EXPAND xpt::Common::generatedMemberComment»
- private «qualifiedName» «parserFieldName(element)»;
-
- «EXPAND xpt::Common::generatedMemberComment»
- «IF holder.extensibleViaService»private«ELSE»public«ENDIF» org.eclipse.gmf.runtime.common.ui.services.parser.IParser «parserAccessorName(element)»() {
- if («parserFieldName(element)» == null) {
- «parserFieldName(element)» = new «qualifiedName»();
- }
- return «parserFieldName(element)»;
- }
-«ENDDEFINE»
-
-«DEFINE _parser(LabelModelFacet modelFacet, GenCommonBase element) FOR gmfgen::ExternalParser-»
-«REM»NO-OP«ENDREM-»
-«ENDDEFINE»
-
-«DEFINE _parser(FeatureLabelModelFacet modelFacet, GenCommonBase element) FOR gmfgen::PredefinedParser»
- «EXPAND xpt::Common::generatedMemberComment»
- private org.eclipse.gmf.runtime.common.ui.services.parser.IParser «parserFieldName(element)»;
-
- «EXPAND xpt::Common::generatedMemberComment»
- «IF holder.extensibleViaService»private«ELSE»public«ENDIF» org.eclipse.gmf.runtime.common.ui.services.parser.IParser «parserAccessorName(element)»() {
- if («parserFieldName(element)» == null) {
- org.eclipse.emf.ecore.EAttribute[] features = new org.eclipse.emf.ecore.EAttribute[] {
- «EXPAND MetaModel::MetaFeature FOREACH modelFacet.metaFeatures SEPARATOR ", " »
- };
- «IF modelFacet.editableMetaFeatures.size() > 0-»
- org.eclipse.emf.ecore.EAttribute[] editableFeatures = new org.eclipse.emf.ecore.EAttribute[] {
- «EXPAND MetaModel::MetaFeature FOREACH modelFacet.editableMetaFeatures SEPARATOR ", "»
- };
- «ENDIF-»
- «getQualifiedClassName()» parser = new «getQualifiedClassName()»(features«IF modelFacet.editableMetaFeatures.size() > 0», editableFeatures«ENDIF»);
- «EXPAND _setPatterns(viewMethod, editMethod, "parser") FOR modelFacet-»
- «parserFieldName(element)» = parser;
- }
- return «parserFieldName(element)»;
- }
-«ENDDEFINE»
-
-«DEFINE _setPatterns(LabelTextAccessMethod viewMethod, LabelTextAccessMethod editMethod, String parserVar) FOR FeatureLabelModelFacet-»
-«IF viewMethod != gmfgen::LabelTextAccessMethod::NATIVE-»
- «IF isPatternSpecified(viewPattern)-»
- «parserVar».setViewPattern("«viewPattern»");«EXPAND xpt::Common::nonNLS(1)»
- «ENDIF-»
- «IF isPatternSpecified(editorPattern)-»
- «parserVar».setEditorPattern("«editorPattern»");«EXPAND xpt::Common::nonNLS(1)»
- «ELSEIF isPatternSpecified(viewPattern)-»
- «parserVar».setEditorPattern("«viewPattern»");«EXPAND xpt::Common::nonNLS(1)»
- «ENDIF-»
-«ENDIF-»
-«IF editMethod != gmfgen::LabelTextAccessMethod::NATIVE-»
- «IF isPatternSpecified(editPattern)-»
- «parserVar».setEditPattern("«editPattern»");«EXPAND xpt::Common::nonNLS(1)»
- «ELSEIF isPatternSpecified(viewPattern)-»
- «parserVar».setEditPattern("«viewPattern»");«EXPAND xpt::Common::nonNLS(1)»
- «ENDIF-»
-«ENDIF-»
-«ENDDEFINE»
diff --git a/plugins/org.eclipse.gmf.codegen/templates/impl/parsers/i18n.ext b/plugins/org.eclipse.gmf.codegen/templates/impl/parsers/i18n.ext
deleted file mode 100644
index d2f51fa1a..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates/impl/parsers/i18n.ext
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Copyright (c) 2007, 2008 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:
- * Anna Karjakina (Borland) - initial API and implementation
- */
-
-import "http://www.eclipse.org/gmf/2008/GenModel";
-import "http://www.eclipse.org/emf/2002/Ecore";
-
-String defaultAbstractParserClassName() : "AbstractParser" ;
-
-String i18nKeyForAbstractParserUnexpectedValueTypeMessage() : defaultAbstractParserClassName()+".UnexpectedValueType" ;
-String i18nKeyForAbstractParserWrongStringConversionMessage() : defaultAbstractParserClassName()+".WrongStringConversion" ;
-String i18nKeyForAbstractParserUnknownLiteralMessage() : defaultAbstractParserClassName()+".UnknownLiteral" ;
-String i18nKeyForMessageFormatParserInvalidInputError() : "MessageFormatParser.InvalidInputError" ;
diff --git a/plugins/org.eclipse.gmf.codegen/templates/impl/preferences/CustomPage.xpt b/plugins/org.eclipse.gmf.codegen/templates/impl/preferences/CustomPage.xpt
deleted file mode 100644
index a024d1a04..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates/impl/preferences/CustomPage.xpt
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Copyright (c) 2008 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/2008/GenModel"»
-«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
-
-«DEFINE Main FOR GenCustomPreferencePage-»
-«EXPAND xpt::Common::copyright FOR getDiagram().editorGen-»
-package «qualifiedClassName == getClassName() ? getDiagram().preferencesPackageName : qualifiedClassName.subString(0, qualifiedClassName.length() - getClassName().length() - 1)»;
-
-«EXPAND xpt::Common::generatedClassComment»
-public class «getClassName()»«EXPAND extendsList»«EXPAND implementsList» {
-
-«EXPAND _constant FOREACH preferences-»
-
- «EXPAND xpt::Common::generatedMemberComment»
- public «getClassName()»() {
- setPreferenceStore(«getDiagram().editorGen.plugin.getActivatorQualifiedClassName()».getInstance().getPreferenceStore());
- }
-«EXPAND methods»
-«EXPAND initDefaultsMethod»
-«EXPAND additions»
-}
-«ENDDEFINE»
-
-«DEFINE extendsList FOR GenCustomPreferencePage» extends org.eclipse.gmf.runtime.common.ui.preferences.AbstractPreferencePage«ENDDEFINE»
-«DEFINE implementsList FOR GenCustomPreferencePage»«REM»no-op«ENDREM»«ENDDEFINE»
-
-«DEFINE additions FOR GenCustomPreferencePage»«ENDDEFINE»
-
-// the reason I didn't split this template up into two distinct, addFieldsMethod and initHelpMethod, is that
-// using superclass other than oe.gmf...AbstractPreferencePage may require implementation of completely different
-// set of methods. Besides, there's not to much generated, anyway.
-«DEFINE methods FOR GenCustomPreferencePage»
- «EXPAND xpt::Common::generatedMemberComment»
- protected void addFields(org.eclipse.swt.widgets.Composite parent) {
- // TODO Provide method implementation
- throw new UnsupportedOperationException();
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected void initHelp() {
- // TODO implement this method if needed, or leave as no-op
- }
-«ENDDEFINE»
-
-
-«DEFINE initDefaultsMethod FOR GenCustomPreferencePage-»
- «EXPAND xpt::Common::generatedMemberComment»
- public static void initDefaults(org.eclipse.jface.preference.IPreferenceStore store) {
-«IF preferences.isEmpty() || preferences.exists(p | p.defaultValue == null)-»
- // TODO this code is invoked during preference store initialization, please fill
- // the store passed with default preference values.
-«ENDIF-»
-«EXPAND _setDefaultValue("store") FOREACH preferences.select(p | p.defaultValue != null)-»
- }
-«ENDDEFINE»
-
-// pair template to initDefaultsMethod, allows external templates invoke generated initDefaults method
-// Note, CustomPage::Main is expected to be invoked only for templates with generateBoilerplate == true,
-// hence no extra check when generating with initDefaultsMethod,
-// however, call_initDefaults may get invoked for any CustomPreferencePage
-«DEFINE call_initDefaults(String storeVarName) FOR GenCustomPreferencePage-»
-«IF generateBoilerplate»«qualifiedClassName».initDefaults(«storeVarName»);«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE _constant FOR gmfgen::GenPreference-»
- «EXPAND xpt::Common::generatedMemberComment»
- public static final String «name» = "«key»";«EXPAND xpt::Common::nonNLS»
-«ENDDEFINE»
-
-«DEFINE _setDefaultValue(String store) FOR gmfgen::GenPreference-»
- «store».setDefault(«name», «defaultValue»);
-«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.codegen/templates/impl/preferences/StandardPage.xpt b/plugins/org.eclipse.gmf.codegen/templates/impl/preferences/StandardPage.xpt
deleted file mode 100644
index 4124dc27f..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates/impl/preferences/StandardPage.xpt
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (c) 2006, 2008 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:
- * Dmitry Stadnik (Borland) - initial API and implementation
- */
-
-«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
-«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
-
-«DEFINE Main FOR GenStandardPreferencePage-»
-«EXPAND xpt::Common::copyright FOR getDiagram().editorGen-»
-package «getDiagram().preferencesPackageName»;
-
-«EXPAND xpt::Common::generatedClassComment»
-public class «getClassName()»«EXPAND extendsList»«EXPAND implementsList» {
-
- «EXPAND xpt::Common::generatedMemberComment»
- public «getClassName()»() {
- setPreferenceStore(«getDiagram().editorGen.plugin.getActivatorQualifiedClassName()».getInstance().getPreferenceStore());
- }
-}
-«ENDDEFINE»
-
-«DEFINE extendsList FOR GenStandardPreferencePage-»
-«IF gmfgen::StandardPreferencePages::General == kind-»
- extends org.eclipse.gmf.runtime.diagram.ui.preferences.DiagramsPreferencePage«-»
-«ELSEIF gmfgen::StandardPreferencePages::Appearance == kind-»
- extends org.eclipse.gmf.runtime.diagram.ui.preferences.AppearancePreferencePage«-»
-«ELSEIF gmfgen::StandardPreferencePages::Connections == kind-»
- extends org.eclipse.gmf.runtime.diagram.ui.preferences.ConnectionsPreferencePage«-»
-«ELSEIF gmfgen::StandardPreferencePages::Printing == kind-»
- extends org.eclipse.gmf.runtime.diagram.ui.preferences.PrintingPreferencePage«-»
-«ELSEIF gmfgen::StandardPreferencePages::RulersAndGrid == kind-»
- extends org.eclipse.gmf.runtime.diagram.ui.preferences.RulerGridPreferencePage«-»
-«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE implementsList FOR GenStandardPreferencePage»«REM»no-op«ENDREM»«ENDDEFINE»
-
-«DEFINE call_initDefaults(String storeVarName) FOR GenStandardPreferencePage»«IF kind != StandardPreferencePages::Pathmaps»«getQualifiedClassName()».initDefaults(«storeVarName»);«ENDIF»«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.codegen/templates/parsers/CustomParser.xpt b/plugins/org.eclipse.gmf.codegen/templates/parsers/CustomParser.xpt
deleted file mode 100644
index d180e4c50..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates/parsers/CustomParser.xpt
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright (c) 2008 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) - [244419] custom parsers
- */
-
-«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
-«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
-
-«DEFINE Main FOR gmfgen::CustomParser»
-«EXPAND xpt::Common::copyright FOR holder.editorGen-»
-«EXPAND xpt::Common::packageStatement FOR qualifiedName»
-
-«EXPAND xpt::Common::generatedClassComment»
-public class «qualifiedName.split('\\.').last()»«EXPAND extendsList»«EXPAND implementsList» {
-«EXPAND body»
-«EXPAND additions»
-}
-«ENDDEFINE»
-
-«DEFINE additions FOR gmfgen::CustomParser»«ENDDEFINE»
-«DEFINE extendsList FOR gmfgen::CustomParser»«ENDDEFINE»
-«DEFINE implementsList FOR gmfgen::CustomParser» implements org.eclipse.gmf.runtime.common.ui.services.parser.IParser«ENDDEFINE»
-
-«DEFINE body FOR gmfgen::CustomParser»
- «EXPAND xpt::Common::generatedMemberComment»
- public String getEditString(org.eclipse.core.runtime.IAdaptable element, int flags) {
- return "";
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- public org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus isValidEditString(org.eclipse.core.runtime.IAdaptable element, String editString) {
- // TODO change to EDITABLE_STATUS as appropriate
- return org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus.UNEDITABLE_STATUS;
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- public org.eclipse.gmf.runtime.common.core.command.ICommand getParseCommand(org.eclipse.core.runtime.IAdaptable element, String newString, int flags) {
- // TODO
- throw new UnsupportedOperationException();
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- public String getPrintString(org.eclipse.core.runtime.IAdaptable element, int flags) {
- return "";
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- public boolean isAffectingEvent(Object event, int flags) {
- return false;
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- public org.eclipse.jface.text.contentassist.IContentAssistProcessor getCompletionProcessor(org.eclipse.core.runtime.IAdaptable element) {
- return null;
- }
-«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.codegen/templates/parsers/ParserProvider.xpt b/plugins/org.eclipse.gmf.codegen/templates/parsers/ParserProvider.xpt
deleted file mode 100644
index e99f08ce1..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates/parsers/ParserProvider.xpt
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright (c) 2007, 2008 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:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Artem Tikhomirov (Borland) - [235113] alternative parser access
- * [244419] custom parsers
- */
-
-«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
-«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
-«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
-«EXTENSION xpt::providers::ParserUtils»
-
-«DEFINE Main FOR gmfgen::GenParsers-»
-«EXPAND xpt::Common::copyright FOR editorGen-»
-package «packageName»;
-
-«EXPAND xpt::Common::generatedClassComment»
-public class «className»«EXPAND extendsList»«EXPAND implementsList» {
- «EXPAND impl::parsers::ParserProvider::parsers FOREACH editorGen.diagram.topLevelNodes»
- «EXPAND impl::parsers::ParserProvider::parsers FOREACH editorGen.diagram.childNodes»
- «EXPAND impl::parsers::ParserProvider::parsers FOREACH editorGen.diagram.links»
-
-«IF extensibleViaService-»
- «EXPAND impl::parsers::ParserProvider::getParserByVisualIdMethod-»
- «EXPAND impl::parsers::ParserProvider::accessorMethod_delegate2providers-»
- «EXPAND impl::parsers::ParserProvider::provider_getParserMethod»
- «EXPAND impl::parsers::ParserProvider::provider_providesMethod»
- «EXPAND impl::parsers::ParserProvider::HintAdapterClass»
-«ELSE-»
- «EXPAND impl::parsers::ParserProvider::accessorMethod_direct-»
-«ENDIF-»
- «EXPAND additions-»
-}
-«ENDDEFINE»
-
-«DEFINE extendsList FOR gmfgen::GenParsers»«IF extensibleViaService» extends org.eclipse.gmf.runtime.common.core.service.AbstractProvider«ENDIF»«ENDDEFINE»
-
-«DEFINE implementsList FOR gmfgen::GenParsers»«IF extensibleViaService» implements org.eclipse.gmf.runtime.common.ui.services.parser.IParserProvider«ENDIF»«ENDDEFINE»
-
-/*
- * this/self - aka hintHolder, visual element to present a text (i.e. one of Node's labels)
- * elementTypeHolder - model element being displayed
- * modelFacet - may be null
- * parsedElement - accessor to EObject being edited
- */
-«DEFINE accessorCall(gmfgen::GenCommonBase elementTypeHolder, gmfgen::LabelModelFacet labelModelFacet, String parsedElement) FOR gmfgen::GenCommonBase-»
-«IF getDiagram().editorGen.labelParsers.extensibleViaService-»
-«EXPAND impl::parsers::ParserProvider::accessorCall_delegate2providers(elementTypeHolder, labelModelFacet, parsedElement)-»
-«ELSE-»
-«EXPAND impl::parsers::ParserProvider::accessorCall_direct(elementTypeHolder, labelModelFacet, parsedElement)-»
-«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE additions FOR gmfgen::GenParsers»«ENDDEFINE»
diff --git a/plugins/org.eclipse.gmf.codegen/templates/parsers/PredefinedParser.xpt b/plugins/org.eclipse.gmf.codegen/templates/parsers/PredefinedParser.xpt
deleted file mode 100644
index eaa03f351..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates/parsers/PredefinedParser.xpt
+++ /dev/null
@@ -1,322 +0,0 @@
-/*
- * Copyright (c) 2007, 2008 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:
- * Dmitry Stadnik (Borland) - initial implementation
- * Artem Tikhomirov (Borland) - [235113] alternative parser access
- * [244419] custom parsers
- * initial API
- */
-
-«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
-«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
-«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
-
-«EXTENSION impl::parsers::i18n»
-
-«DEFINE Main FOR gmfgen::PredefinedParser»
-«EXPAND xpt::Common::copyright FOR holder.editorGen-»
-package «holder.implPackageName»;
-
-«EXPAND xpt::Common::generatedClassComment»
-public class «className» extends «EXPAND impl::parsers::AbstractParser::qualifiedClassName FOR holder» {
-
-«EXPAND fields»
-«EXPAND cons»
-«EXPAND aux_methods»
-«EXPAND parser_getEditStringMethod»
-«EXPAND parser_isValidEditStringMethod»
-«EXPAND parser_getParseCommandMethod»
-«EXPAND parser_getPrintStringMethod»
-«EXPAND parser_isAffectingEventMethod»
-«EXPAND parser_getCompletionProcessorMethod»
-«EXPAND additions»
-}
-«ENDDEFINE»
-
-«DEFINE additions FOR PredefinedParser»«ENDDEFINE»
-
-«DEFINE fields FOR PredefinedParser-»
-«IF viewMethod == LabelTextAccessMethod::MESSAGE_FORMAT || viewMethod == LabelTextAccessMethod::PRINTF-»
- «EXPAND xpt::Common::generatedMemberComment»
- private String defaultPattern;
-
- «EXPAND xpt::Common::generatedMemberComment»
- private String defaultEditablePattern;
-«ENDIF-»
-«IF viewMethod == LabelTextAccessMethod::MESSAGE_FORMAT»
- «EXPAND xpt::Common::generatedMemberComment»
- private java.text.MessageFormat viewProcessor;
-
- «EXPAND xpt::Common::generatedMemberComment»
- private java.text.MessageFormat editorProcessor;
-«ENDIF-»
-«IF editMethod == LabelTextAccessMethod::MESSAGE_FORMAT»
- «EXPAND xpt::Common::generatedMemberComment»
- private java.text.MessageFormat editProcessor;
-«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE cons FOR PredefinedParser-»
- «EXPAND xpt::Common::generatedMemberComment»
- public «className»(org.eclipse.emf.ecore.EAttribute[] features) {
- super(features);
-«IF viewMethod == LabelTextAccessMethod::NATIVE || editMethod == LabelTextAccessMethod::NATIVE-»
- if (features.length != 1) {
- throw new IllegalArgumentException(java.util.Arrays.toString(features));
- }
-«ENDIF-»
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- public «className»(org.eclipse.emf.ecore.EAttribute[] features, org.eclipse.emf.ecore.EAttribute[] editableFeatures) {
- super(features, editableFeatures);
-«IF viewMethod == LabelTextAccessMethod::NATIVE || editMethod == LabelTextAccessMethod::NATIVE-»
- if (features.length != 1) {
- throw new IllegalArgumentException(java.util.Arrays.toString(features));
- }
- if (editableFeatures.length != 1) {
- throw new IllegalArgumentException(java.util.Arrays.toString(editableFeatures));
- }
-«ENDIF-»
- }
-«ENDDEFINE»
-
-«DEFINE aux_methods FOR PredefinedParser-»
-«IF viewMethod == LabelTextAccessMethod::MESSAGE_FORMAT-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected String getDefaultPattern() {
- if (defaultPattern == null) {
- StringBuffer sb = new StringBuffer();
- for (int i = 0; i < features.length; i++) {
- if (i > 0) {
- sb.append(' ');
- }
- sb.append('{');
- sb.append(i);
- sb.append('}');
- }
- defaultPattern = sb.toString();
- }
- return defaultPattern;
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- public void setViewPattern(String viewPattern) {
- super.setViewPattern(viewPattern);
- viewProcessor = null;
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- public void setEditorPattern(String editorPattern) {
- super.setEditorPattern(editorPattern);
- editorProcessor = null;
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected java.text.MessageFormat getViewProcessor() {
- if (viewProcessor == null) {
- viewProcessor = new java.text.MessageFormat(getViewPattern() == null ? getDefaultPattern() : getViewPattern());
- }
- return viewProcessor;
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected java.text.MessageFormat getEditorProcessor() {
- if (editorProcessor == null) {
- editorProcessor = new java.text.MessageFormat(getEditorPattern() == null ? getDefaultEditablePattern() : getEditorPattern());
- }
- return editorProcessor;
- }
-«ELSEIF viewMethod == LabelTextAccessMethod::PRINTF-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected String getDefaultPattern() {
- if (defaultPattern == null) {
- StringBuffer sb = new StringBuffer();
- for (int i = 0; i < features.length; i++) {
- if (i > 0) {
- sb.append(' ');
- }
- sb.append('%');
- sb.append(i + 1);
- sb.append('$');
- sb.append('s');
- }
- defaultPattern = sb.toString();
- }
- return defaultPattern;
- }
-«ENDIF-»
-«IF viewMethod == LabelTextAccessMethod::MESSAGE_FORMAT || editMethod == LabelTextAccessMethod::MESSAGE_FORMAT-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected String getDefaultEditablePattern() {
- if (defaultEditablePattern == null) {
- StringBuffer sb = new StringBuffer();
- for (int i = 0; i < editableFeatures.length; i++) {
- if (i > 0) {
- sb.append(' ');
- }
- sb.append('{');
- sb.append(i);
- sb.append('}');
- }
- defaultEditablePattern = sb.toString();
- }
- return defaultEditablePattern;
- }
-«ENDIF-»
-«IF viewMethod == LabelTextAccessMethod::PRINTF || editMethod == LabelTextAccessMethod::PRINTF-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected String getDefaultEditablePattern() {
- if (defaultEditablePattern == null) {
- StringBuffer sb = new StringBuffer();
- for (int i = 0; i < editableFeatures.length; i++) {
- if (i > 0) {
- sb.append(' ');
- }
- sb.append('%');
- sb.append(i + 1);
- sb.append('$');
- sb.append('s');
- }
- defaultEditablePattern = sb.toString();
- }
- return defaultEditablePattern;
- }
-«ENDIF-»
-«IF editMethod == LabelTextAccessMethod::MESSAGE_FORMAT-»
- «EXPAND xpt::Common::generatedMemberComment»
- public void setEditPattern(String editPattern) {
- super.setEditPattern(editPattern);
- editProcessor = null;
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected java.text.MessageFormat getEditProcessor() {
- if (editProcessor == null) {
- editProcessor = new java.text.MessageFormat(getEditPattern() == null ? getDefaultEditablePattern() : getEditPattern());
- }
- return editProcessor;
- }
-«ELSEIF editMethod == LabelTextAccessMethod::REGEXP-»
- «EXPAND xpt::Common::generatedMemberComment»
- public String getEditPattern() {
- String pattern = super.getEditPattern();
- return pattern != null ? pattern : " ";«EXPAND xpt::Common::nonNLS»
- }
-«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE parser_getEditStringMethod FOR PredefinedParser-»
- «EXPAND xpt::Common::generatedMemberComment»
- public String getEditString(org.eclipse.core.runtime.IAdaptable adapter, int flags) {
-«IF viewMethod == LabelTextAccessMethod::MESSAGE_FORMAT-»
- org.eclipse.emf.ecore.EObject element = (org.eclipse.emf.ecore.EObject) adapter.getAdapter(org.eclipse.emf.ecore.EObject.class);
- return getEditorProcessor().format(getEditableValues(element), new StringBuffer(), new java.text.FieldPosition(0)).toString();
-«ELSEIF viewMethod == LabelTextAccessMethod::PRINTF-»
- org.eclipse.emf.ecore.EObject element = (org.eclipse.emf.ecore.EObject) adapter.getAdapter(org.eclipse.emf.ecore.EObject.class);
- String pattern = getEditorPattern() == null ? getDefaultEditablePattern() : getEditorPattern();
- return String.format(pattern, getEditableValues(element));
-«ELSEIF viewMethod == LabelTextAccessMethod::REGEXP-»
- return "";«EXPAND xpt::Common::nonNLS»
-«ELSEIF viewMethod == LabelTextAccessMethod::NATIVE-»
- org.eclipse.emf.ecore.EObject element = (org.eclipse.emf.ecore.EObject) adapter.getAdapter(org.eclipse.emf.ecore.EObject.class);
- String s = org.eclipse.emf.ecore.util.EcoreUtil.convertToString(editableFeatures[0].getEAttributeType(), element.eGet(editableFeatures[0]));
- return s != null ? s : "";«EXPAND xpt::Common::nonNLS»
-«ENDIF-»
- }
-«ENDDEFINE»
-
-«DEFINE parser_isValidEditStringMethod FOR PredefinedParser-»
- «EXPAND xpt::Common::generatedMemberComment»
- public org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus isValidEditString(org.eclipse.core.runtime.IAdaptable adapter, String editString) {
-«IF editMethod == LabelTextAccessMethod::MESSAGE_FORMAT-»
- java.text.ParsePosition pos = new java.text.ParsePosition(0);
- Object[] values = getEditProcessor().parse(editString, pos);
- if (values == null) {
- return new org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus(
- «holder.editorGen.plugin.getActivatorQualifiedClassName()».ID,
- org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus.UNEDITABLE,
- org.eclipse.osgi.util.NLS.bind(
- «EXPAND xpt::Externalizer::accessorCall(i18nKeyForMessageFormatParserInvalidInputError()) FOR holder.editorGen»,
- new Integer(pos.getErrorIndex())));
- }
- return validateNewValues(values);
-«ELSEIF editMethod == LabelTextAccessMethod::PRINTF-»
- return org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus.UNEDITABLE_STATUS;
-«ELSEIF editMethod == LabelTextAccessMethod::REGEXP-»
- if (editString == null) {
- return org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus.UNEDITABLE_STATUS;
- }
- Object[] values = editString.split(getEditPattern());
- return validateNewValues(values);
-«ELSEIF editMethod == LabelTextAccessMethod::NATIVE-»
- return org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus.EDITABLE_STATUS;
-«ENDIF-»
- }
-«ENDDEFINE»
-
-«DEFINE parser_getParseCommandMethod FOR PredefinedParser-»
- «EXPAND xpt::Common::generatedMemberComment»
- public org.eclipse.gmf.runtime.common.core.command.ICommand getParseCommand(org.eclipse.core.runtime.IAdaptable adapter, String newString, int flags) {
-«IF editMethod == LabelTextAccessMethod::MESSAGE_FORMAT-»
- Object[] values = getEditProcessor().parse(newString, new java.text.ParsePosition(0));
- return getParseCommand(adapter, values, flags);
-«ELSEIF editMethod == LabelTextAccessMethod::PRINTF-»
- return org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand.INSTANCE;
-«ELSEIF editMethod == LabelTextAccessMethod::REGEXP-»
- if (newString == null) {
- return org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand.INSTANCE;
- }
- Object[] values = newString.split(getEditPattern());
- return super.getParseCommand(adapter, values, flags);
-«ELSEIF editMethod == LabelTextAccessMethod::NATIVE-»
- Object value = org.eclipse.emf.ecore.util.EcoreUtil.createFromString(editableFeatures[0].getEAttributeType(), newString);
- return getParseCommand(adapter, new Object[] { value }, flags);
-«ENDIF-»
- }
-«ENDDEFINE»
-
-«DEFINE parser_getPrintStringMethod FOR PredefinedParser-»
- «EXPAND xpt::Common::generatedMemberComment»
- public String getPrintString(org.eclipse.core.runtime.IAdaptable adapter, int flags) {
-«IF viewMethod == LabelTextAccessMethod::MESSAGE_FORMAT-»
- org.eclipse.emf.ecore.EObject element = (org.eclipse.emf.ecore.EObject) adapter.getAdapter(org.eclipse.emf.ecore.EObject.class);
- return getViewProcessor().format(getValues(element), new StringBuffer(), new java.text.FieldPosition(0)).toString();
-«ELSEIF viewMethod == LabelTextAccessMethod::PRINTF-»
- org.eclipse.emf.ecore.EObject element = (org.eclipse.emf.ecore.EObject) adapter.getAdapter(org.eclipse.emf.ecore.EObject.class);
- return String.format(getViewPattern() == null ? getDefaultPattern() : getViewPattern(), getValues(element));
-«ELSEIF viewMethod == LabelTextAccessMethod::REGEXP-»
- return "";«EXPAND xpt::Common::nonNLS»
-«ELSEIF viewMethod == LabelTextAccessMethod::NATIVE-»
- org.eclipse.emf.ecore.EObject element = (org.eclipse.emf.ecore.EObject) adapter.getAdapter(org.eclipse.emf.ecore.EObject.class);
- String s = org.eclipse.emf.ecore.util.EcoreUtil.convertToString(features[0].getEAttributeType(), element.eGet(features[0]));
- return s != null ? s : "";«EXPAND xpt::Common::nonNLS»
-«ENDIF-»
- }
-«ENDDEFINE»
-
-«DEFINE parser_isAffectingEventMethod FOR PredefinedParser-»
-«REM»NO-OP, rely on superclass for now«ENDREM-»
-«ENDDEFINE»
-
-«DEFINE parser_getCompletionProcessorMethod FOR PredefinedParser-»
-«REM»NO-OP, rely on superclass for now«ENDREM-»
-«ENDDEFINE»
-
-«DEFINE i18nValues FOR gmfgen::GenParsers-»
-«IF implementations.typeSelect(PredefinedParser).exists(p | p.editMethod == LabelTextAccessMethod::MESSAGE_FORMAT)»
-«EXPAND xpt::Externalizer::messageEntry(i18nKeyForMessageFormatParserInvalidInputError(), "Invalid input at {0}")-»
-«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE i18nAccessors FOR gmfgen::GenParsers-»
-«IF implementations.typeSelect(PredefinedParser).exists(p | p.editMethod == LabelTextAccessMethod::MESSAGE_FORMAT)»
- «EXPAND xpt::Externalizer::accessorField(i18nKeyForMessageFormatParserInvalidInputError())-»
-«ENDIF-»
-«ENDDEFINE»
diff --git a/plugins/org.eclipse.gmf.codegen/templates/xpt/Common.xpt b/plugins/org.eclipse.gmf.codegen/templates/xpt/Common.xpt
deleted file mode 100644
index 1a234f3a2..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates/xpt/Common.xpt
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Copyright (c) 2006, 2008 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:
- * Dmitry Stadnik (Borland) - initial API and implementation
- */
-
-«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
-«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
-«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
-«EXTENSION xpt::GenModelUtils»
-«EXTENSION xpt::NonNLSUtils»
-
-«DEFINE copyright FOR gmfgen::GenEditorGenerator-»
-«IF copyrightText != null-»
-/*
- * «copyrightText.replaceAll("\n", "\n * ")»
- */
-«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE xcopyright FOR gmfgen::GenEditorGenerator-»
-«IF copyrightText != null-»
-<!--
-«copyrightText»
--->
-«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE generatedClassComment FOR Object»«EXPAND generatedClassComment("")»«ENDDEFINE»
-«DEFINE generatedClassComment(String comment) FOR Object-»
-/**
-«IF comment.length() > 0-»
- * «comment.replaceAll("\n", "\n * ")»
-«ENDIF-»
- * @generated
- */«ENDDEFINE»
-
-«DEFINE generatedMemberComment FOR Object»«EXPAND generatedMemberComment("")»«ENDDEFINE»
-«DEFINE generatedMemberComment(String comment) FOR Object-»
-/**
-«IF comment.length() > 0-»
- * «comment.replaceAll("\n", "\n * ")»
-«ENDIF-»
- * @generated
- */«ENDDEFINE»
-
-«DEFINE xmlGeneratedTag FOR Object»<?gmfgen generated="true"?>«ENDDEFINE»
-
-«DEFINE getSaveOptions FOR gmfgen::GenDiagram»«getDiagramEditorUtilQualifiedClassName()».getSaveOptions()«ENDDEFINE»
-
-«DEFINE setCharset(String varName) FOR gmfgen::GenDiagram-»
-«getDiagramEditorUtilQualifiedClassName()».setCharset(«varName»);
-«ENDDEFINE»
-
-«DEFINE nonNLS FOR Object»«EXPAND nonNLS(1)»«ENDDEFINE»
-
-«DEFINE nonNLS FOR Collection[Object]»«EXPAND nonNLS FOR getNonNLSCounter(this)»«ENDDEFINE»
-
-«DEFINE nonNLS FOR Collection[int]»«EXPAND nonNLS FOREACH this»«ENDDEFINE»
-
-«DEFINE nonNLS(int i) FOR Object»«EXPAND nonNLS FOR i»«ENDDEFINE»
-
-«DEFINE nonNLS FOR int» //$NON-NLS-«this»$«ENDDEFINE»
-
-«DEFINE caseVisualID FOR gmfgen::GenCommonBase»case «EXPAND xpt::editor::VisualIDRegistry::visualID»:«ENDDEFINE»
-
-«DEFINE addShortcutAnnotation(String viewVar) FOR gmfgen::GenDiagram-»
- org.eclipse.emf.ecore.EAnnotation shortcutAnnotation = org.eclipse.emf.ecore.EcoreFactory.eINSTANCE.createEAnnotation();
- shortcutAnnotation.setSource("Shortcut"); «EXPAND xpt::Common::nonNLS»
- shortcutAnnotation.getDetails().put("modelID", «getEditPartQualifiedClassName()».MODEL_ID); «EXPAND xpt::Common::nonNLS»
- «viewVar».getEAnnotations().add(shortcutAnnotation);
-«ENDDEFINE»
-
-
-«DEFINE packageStatement FOR String-»
-«IF this.split('\\.').size() > 1-»
-package «FOREACH this.split('\\.').withoutLast() AS s SEPARATOR "."»«s»«ENDFOREACH»;«ENDIF-»
-«ENDDEFINE»
-
-// Provides handy single point to override generation of assert statements
-// TODO refactor this Common.xpt into different flavours - like CommonCodeStyle (nls, assert), CommonSnippets(pkgStmt, setCharset, getSaveOptions) and so on
-«DEFINE assert(String condition) FOR Object-»
-assert «condition»;«IF condition.toCharList().contains("\"")»«EXPAND nonNLS»«ENDIF»
-«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.codegen/templates/xpt/ConstraintProviders.xpt b/plugins/org.eclipse.gmf.codegen/templates/xpt/ConstraintProviders.xpt
deleted file mode 100644
index 2f97fa443..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates/xpt/ConstraintProviders.xpt
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Copyright (c) 2007, 2008 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/2008/GenModel"»
-«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
-«EXTENSION xpt::GenAuditRoot»
-
-«DEFINE extensions FOR gmfgen::GenEditorGenerator-»
-«IF hasAudits()»«EXPAND extensions FOR audits»«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE extensions FOR gmfgen::GenAuditRoot-»
-«EXPAND extensions_emfv_constraintProviders»
-«EXPAND extensions_emfv_constraintBindings»
-«EXPAND extensions_emfv_uiContexts»
-«ENDDEFINE»
-
-//
-// Extension point: org.eclipse.emf.validation.constraintProviders
-//
-«DEFINE extensions_emfv_constraintProviders FOR GenAuditRoot-»
- <extension point="org.eclipse.emf.validation.constraintProviders">
- «EXPAND xpt::Common::xmlGeneratedTag»
- «EXPAND declareCategory FOREACH categories-»
- <constraintProvider cache="true">
-«FOREACH getAllTargetedModelPackages() AS p-»
- <package namespaceUri="«p.ecorePackage.nsURI»"/>
-«ENDFOREACH-»
- «EXPAND defineCategory FOREACH categories-»
- </constraintProvider>
- </extension>
-«ENDDEFINE»
-
-//
-// Extension point: org.eclipse.emf.validation.constraintBindings
-//
-«DEFINE extensions_emfv_constraintBindings FOR GenAuditRoot-»
- <extension point="org.eclipse.emf.validation.constraintBindings">
- «EXPAND xpt::Common::xmlGeneratedTag»
-«FOREACH clientContexts AS ctx-»
- <clientContext default="false" id="«getQualifiedIdentity(ctx)»">
- <selector class="«ctx.getQualifiedClassName()»"/>
- </clientContext>
- <binding context="«getQualifiedIdentity(ctx)»">
- «FOREACH rules.select(r | r.target != null && r.target.contextSelector == ctx) /*alternative: ctx.ruleTargets.contains(r.target)*/ AS rule-»
- <constraint ref="«editorGen.plugin.iD».«escapeXML(rule.id)»"/>
- «ENDFOREACH-»
- </binding>
-
-«ENDFOREACH-»
- </extension>
-«ENDDEFINE»
-
-//
-// Extension point: org.eclipse.emf.validation.ui.UIRegisteredClientContext
-//
-«DEFINE extensions_emfv_uiContexts FOR GenAuditRoot-»
-«IF editorGen.diagram.liveValidationUIFeedback»
- <extension point="org.eclipse.emf.validation.ui.UIRegisteredClientContext">
- «EXPAND xpt::Common::xmlGeneratedTag»
-«FOREACH clientContexts AS ctx-»
- <clientContext id="«getQualifiedIdentity(ctx)»"/>
-«ENDFOREACH-»
- </extension>
-«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE declareCategory FOR gmfgen::GenAuditContainer-»
- <category id="«EXPAND _pathMap»" mandatory="false" name="«IF name != null»«escapeXML(name)»«ELSE»«EXPAND _pathMap»«ENDIF»">
- <![CDATA[«description != null ? description : ""»]]>
- </category>
-«ENDDEFINE»
-
-«DEFINE defineCategory FOR gmfgen::GenAuditContainer-»
- <constraints categories="«EXPAND _pathMap»">
- «FOREACH audits.select(a | a.target != null && a.target.getTargetClass() != null) AS audit-»
- <constraint id="«escapeXML(audit.id)»"
- «IF audit.requiresConstraintAdapter»lang="Java" class="«audit.getConstraintAdapterQualifiedClassName()»"«ELSE»lang="OCL"«ENDIF»
- name="«escapeXML(audit.name != null ? audit.name : audit.id)»"
- mode="«IF audit.useInLiveMode»Live«ELSE»Batch«ENDIF»"
- severity="«audit.severity.name»" statusCode="200">
- «IF !audit.requiresConstraintAdapter»<![CDATA[«audit.rule != null ? audit.rule.body : ""»]]>«ENDIF»
- <description><![CDATA[«audit.description != null ? audit.description : ""»]]></description>
- <message><![CDATA[«IF audit.message != null»«audit.message»«ELSE»«audit.name != null ? audit.name : audit.id» audit violated«ENDIF»]]></message>
- <target class="«audit.target.getTargetClassModelQualifiedName()»"/>
- </constraint>
- «ENDFOREACH-»
- </constraints>
-«ENDDEFINE»
-
-«DEFINE _pathMap FOR gmfgen::GenAuditContainer»«FOREACH path AS p SEPARATOR "/" »«escapeXML(p.id)»«ENDFOREACH»«ENDDEFINE»
diff --git a/plugins/org.eclipse.gmf.codegen/templates/xpt/EMFUtils.ext b/plugins/org.eclipse.gmf.codegen/templates/xpt/EMFUtils.ext
deleted file mode 100644
index 29aeceba3..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates/xpt/EMFUtils.ext
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Copyright (c) 2007, 2008 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:
- * Alexander Shatalin (Borland) - initial API and implementation
- */
-
-import "http://www.eclipse.org/emf/2002/Ecore";
-
-List[ecore::EObject] getReferencingObjects(ecore::EObject target) :
- JAVA org.eclipse.gmf.internal.codegen.util.EmfUtils.getReferencingObjects(org.eclipse.emf.ecore.EObject)
-;
-
-String toStringLiteral(String strValue) :
- JAVA org.eclipse.gmf.internal.codegen.util.EmfUtils.toStringLiteral(java.lang.String)
-;
diff --git a/plugins/org.eclipse.gmf.codegen/templates/xpt/Externalizer.xpt b/plugins/org.eclipse.gmf.codegen/templates/xpt/Externalizer.xpt
deleted file mode 100644
index 5e6d4c184..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates/xpt/Externalizer.xpt
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Copyright (c) 2006, 2008 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:
- * Anna Karjakina (Borland) - initial API and implementation
- */
-
-«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
-«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
-
-«EXTENSION xpt::ExternalizerUtils»
-
-«DEFINE Access FOR gmfgen::GenEditorGenerator-»
-«EXPAND xpt::Common::copyright-»
-package «getExternalizerPackageName()»;
-
-«EXPAND xpt::Common::generatedClassComment»
-public class «getExternalizerClassName()» extends org.eclipse.osgi.util.NLS {
-
- «EXPAND xpt::Common::generatedMemberComment»
- static {
- org.eclipse.osgi.util.NLS.initializeMessages("«getExternalizerClassName().toLowerCase()»", «getExternalizerClassName()».class); «EXPAND xpt::Common::nonNLS»
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- private «getExternalizerClassName()»() {
- }
-
- «EXPAND Fields»
- //TODO: put accessor fields manually
-}
-«ENDDEFINE»
-
-«DEFINE Fields FOR gmfgen::GenEditorGenerator»
- «EXPAND impl::actions::CreateShortcutAction::i18nAccessors FOR diagram-»
- «EXPAND xpt::editor::CreationWizard::i18nAccessors FOR diagram-»
- «EXPAND xpt::editor::CreationWizardPage::i18nAccessors FOR diagram-»
- «EXPAND xpt::editor::DiagramEditorUtil::i18nAccessors FOR diagram-»
- «EXPAND xpt::editor::DocumentProvider::i18nAccessors FOR diagram-»
- «EXPAND xpt::editor::InitDiagramFileAction::i18nAccessors FOR diagram-»
- «EXPAND xpt::editor::NewDiagramFileWizard::i18nAccessors FOR diagram-»
- «EXPAND xpt::editor::Editor::i18nAccessors FOR editor-»
- «EXPAND xpt::editor::ElementChooser::i18nAccessors FOR diagram-»
- «EXPAND xpt::editor::ShortcutCreationWizard::i18nAccessors FOR diagram-»
- «EXPAND xpt::editor::ModelElementSelectionPage::i18nAccessors FOR diagram-»
- «EXPAND xpt::editor::ValidateAction::i18nAccessors FOR diagram-»
- «EXPAND xpt::editor::palette::PaletteFactory::i18nAccessors FOR diagram.palette-»
- «EXPAND xpt::application::ActionBarAdvisor::i18nAccessors FOR application-»
- «EXPAND xpt::application::WorkbenchWindowAdvisor::i18nAccessors FOR application-»
- «EXPAND xpt::application::WizardNewFileCreationPage::i18nAccessors FOR application-»
- «EXPAND impl::diagram::editparts::CompartmentEditPart::i18nAccessors FOR diagram-»
- «EXPAND xpt::diagram::editpolicies::OpenDiagram::i18nAccessors FOR diagram-»
- «EXPAND xpt::navigator::NavigatorContentProvider::i18nAccessors FOR navigator-»
- «EXPAND xpt::navigator::NavigatorActionProvider::i18nAccessors FOR navigator-»
- «EXPAND impl::parsers::AbstractParser::i18nAccessors FOR labelParsers-»
- «EXPAND parsers::PredefinedParser::i18nAccessors FOR labelParsers-»
- «EXPAND xpt::providers::ModelingAssistantProvider::i18nAccessors FOR diagram-»
-«ENDDEFINE»
-
-«DEFINE Values FOR gmfgen::GenEditorGenerator»
-# TODO: manually put keys and values
-«EXPAND impl::actions::CreateShortcutAction::i18nValues FOR diagram-»
-«EXPAND xpt::editor::CreationWizard::i18nValues FOR diagram-»
-«EXPAND xpt::editor::CreationWizardPage::i18nValues FOR diagram-»
-«EXPAND xpt::editor::DiagramEditorUtil::i18nValues FOR diagram-»
-«EXPAND xpt::editor::DocumentProvider::i18nValues FOR diagram-»
-«EXPAND xpt::editor::InitDiagramFileAction::i18nValues FOR diagram-»
-«EXPAND xpt::editor::NewDiagramFileWizard::i18nValues FOR diagram-»
-«EXPAND xpt::editor::Editor::i18nValues FOR editor-»
-«EXPAND xpt::editor::ElementChooser::i18nValues FOR diagram-»
-«EXPAND xpt::editor::ShortcutCreationWizard::i18nValues FOR diagram-»
-«EXPAND xpt::editor::ModelElementSelectionPage::i18nValues FOR diagram-»
-«EXPAND xpt::editor::ValidateAction::i18nValues FOR diagram-»
-«EXPAND xpt::editor::palette::PaletteFactory::i18nValues FOR diagram.palette-»
-«EXPAND xpt::application::ActionBarAdvisor::i18nValues FOR application-»
-«EXPAND xpt::application::WorkbenchWindowAdvisor::i18nValues FOR application-»
-«EXPAND xpt::application::WizardNewFileCreationPage::i18nValues FOR application-»
-«EXPAND impl::diagram::editparts::CompartmentEditPart::i18nValues FOR diagram-»
-«EXPAND xpt::diagram::editpolicies::OpenDiagram::i18nValues FOR diagram-»
-«EXPAND xpt::navigator::NavigatorContentProvider::i18nValues FOR navigator-»
-«EXPAND xpt::navigator::NavigatorActionProvider::i18nValues FOR navigator-»
-«EXPAND impl::parsers::AbstractParser::i18nValues FOR labelParsers-»
-«EXPAND parsers::PredefinedParser::i18nValues FOR labelParsers-»
-«EXPAND xpt::providers::ModelingAssistantProvider::i18nValues FOR diagram-»
-«ENDDEFINE»
-
-«DEFINE accessorField(String key) FOR Object»
- «EXPAND xpt::Common::generatedMemberComment»
- public static String «escapeIllegalKeySymbols(key)»;
-«ENDDEFINE»
-
-«DEFINE messageEntry(String key, String message) FOR Object-»
-«escapeIllegalKeySymbols(key)»=«escapeIllegalMessageSymbols(message)»
-«ENDDEFINE»
-
-«DEFINE accessorCall(String key) FOR gmfgen::GenEditorGenerator-»
-«getExternalizerPackageName()».«getExternalizerClassName()».«escapeIllegalKeySymbols(key)»«ENDDEFINE»
diff --git a/plugins/org.eclipse.gmf.codegen/templates/xpt/ExternalizerUtils.ext b/plugins/org.eclipse.gmf.codegen/templates/xpt/ExternalizerUtils.ext
deleted file mode 100644
index 65ef19431..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates/xpt/ExternalizerUtils.ext
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (c) 2006 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:
- * Anna Karjakina (Borland) - initial API and implementation
- */
-
-import "http://www.eclipse.org/gmf/2008/GenModel";
-import "http://www.eclipse.org/emf/2002/Ecore";
-
-String getExternalizerPackageName(gmfgen::GenEditorGenerator generator) :
- generator.editor.packageName
-;
-
-String getExternalizerClassName() : "Messages" ;
-
-String escapeIllegalKeySymbols(String key) :
- key.replaceAll("[=&\"]", "").replaceAll("[ .]", "_")
-;
-
-String escapeIllegalMessageSymbols(String message) :
- message.replaceAll("!", "\\\\!")
-;
diff --git a/plugins/org.eclipse.gmf.codegen/templates/xpt/GenAuditRoot.ext b/plugins/org.eclipse.gmf.codegen/templates/xpt/GenAuditRoot.ext
deleted file mode 100644
index c6ed1c58f..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates/xpt/GenAuditRoot.ext
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright (c) 2007, 2008 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/2008/GenModel";
-import "http://www.eclipse.org/emf/2002/Ecore";
-import "http://www.eclipse.org/emf/2002/GenModel";
-
-extension xpt::GenEditorGenerator reexport;
-
-List[genmodel::GenPackage] getAllTargetedModelPackages(gmfgen::GenAuditRoot root) :
- root.rules.select(r | r.target != null && r.target.getTargetClass() != null).collect(r | r.target.getTargetClass().genPackage).toList().purgeDups()
-;
-
-String getQualifiedIdentity(GenAuditContext ctx) :
- ctx.root.editorGen.plugin.iD + ctx.id
-;
-
-boolean hasDiagramElementTargetRule(gmfgen::GenAuditRoot audits) :
- audits != null && audits.rules.target.typeSelect(gmfgen::GenDiagramElementTarget).size() > 0
-;
-
-private boolean hasAnyNotationElementTargetRule(gmfgen::GenAuditRoot audits) :
- audits != null && audits.rules.target.typeSelect(gmfgen::GenNotationElementTarget).size() > 0
-;
-
-// not sure why NotationElementTarget is here - for GenDiagramElementTarget there's special selector,
-// and nothing special for NotationElementTarget (basically, it's just notation.View)
-// Perhaps, the reason is in ValidateAction use of this method - if there are NotationElementTarget, need
-// to run validation on diagram elements.
-// Present method name reflects my understanding at the moment
-boolean shouldRunValidateOnDiagram(gmfgen::GenAuditRoot audits) :
- hasDiagramElementTargetRule(audits) || hasAnyNotationElementTargetRule(audits)
-;
-
-
-List[GenCommonBase] getTargetDiagramElements(GenAuditContext ctx) :
- ctx.ruleTargets.typeSelect(GenDiagramElementTarget).element.purgeDups()
-;
-
-List[GenCommonBase] getAllTargetDiagramElements(GenAuditRoot root) :
- root.clientContexts.getTargetDiagramElements().purgeDups()
-;
-
-
-String escapeXML(String s) :
-JAVA org.eclipse.gmf.internal.common.codegen.Conversions.escapeXML(java.lang.String)
-; \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.codegen/templates/xpt/GenEditorGenerator.ext b/plugins/org.eclipse.gmf.codegen/templates/xpt/GenEditorGenerator.ext
deleted file mode 100644
index 65f471e08..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates/xpt/GenEditorGenerator.ext
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
- * Copyright (c) 2007 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/2008/GenModel";
-import "http://www.eclipse.org/emf/2002/Ecore";
-
-// FIXME remove java-only GenEditorGenerator#hasAudits or declare it in metamodel
-boolean hasAudits(gmfgen::GenEditorGenerator editorGen) :
- editorGen.audits != null && !editorGen.audits.rules.isEmpty()
-;
diff --git a/plugins/org.eclipse.gmf.codegen/templates/xpt/GenModelUtils.ext b/plugins/org.eclipse.gmf.codegen/templates/xpt/GenModelUtils.ext
deleted file mode 100644
index 87dd1e5b2..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates/xpt/GenModelUtils.ext
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Copyright (c) 2006, 2008 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:
- * Dmitry Stadnik (Borland) - initial API and implementation
- */
-
-import "http://www.eclipse.org/emf/2002/GenModel";
-import "http://www.eclipse.org/emf/2002/Ecore";
-
-/*
- * GenModel functionality unrelated to EMF generated code
- * or metamodel access only.
- */
-
-
-// GenPackage#getDocumentRoot
-genmodel::GenClass getDocumentRoot(genmodel::GenPackage gp) :
-JAVA org.eclipse.gmf.internal.codegen.util.GenModelUtils.getDocumentRoot(org.eclipse.emf.codegen.ecore.genmodel.GenPackage)
-;
-
-// GenModel#findGenClassifier()
-genmodel::GenClassifier findGenClassifier(genmodel::GenModel genModel, ecore::EClassifier eClassifier) :
-JAVA org.eclipse.gmf.internal.codegen.util.GenModelUtils.findGenClassifier(org.eclipse.emf.codegen.ecore.genmodel.GenModel, org.eclipse.emf.ecore.EClassifier)
-;
-
-//GenFeature#getReverse
-genmodel::GenFeature getReverse(genmodel::GenFeature feature) :
- isReferenceType(feature) ?
- (let eReverseFeature = ((ecore::EReference) feature.ecoreFeature).eOpposite :
- eReverseFeature != null ?
- (let genClass = (genmodel::GenClass) findGenClassifier(feature.genClass.genPackage.genModel, eReverseFeature.eContainingClass) :
- genClass != null ?
- genClass.genFeatures.select(e|e.ecoreFeature == eReverseFeature).first()
- : null
- )
- : null
- )
- : null
-;
-
-// For primitive types, return their java.lang wrappers, for non-primitive
-// types returns instanceClassName as is
-String getObjectCompatibleClassName(EDataType dt) :
- dt.instanceClassName.toCharList().contains(".")
- ? dt.instanceClassName
- : switch (dt.instanceClassName) {
- case "boolean" : "java.lang.Boolean"
- case "byte" : "java.lang.Byte"
- case "char" : "java.lang.Character"
- case "double" : "java.lang.Double"
- case "float" : "java.lang.Float"
- case "int" : "java.lang.Integer"
- case "long" : "java.lang.Long"
- case "short" : "java.lang.Short"
- default : "java.lang.Object"
- }
-;
-
-// GenFeature#isListType()
-boolean isListType(genmodel::GenFeature feature) :
-JAVA org.eclipse.gmf.internal.codegen.util.GenModelUtils.isListType(org.eclipse.emf.codegen.ecore.genmodel.GenFeature)
-;
-
-// GenFeature#isDerived()
-boolean isDerived(genmodel::GenFeature feature) :
-JAVA org.eclipse.gmf.internal.codegen.util.GenModelUtils.isDerived(org.eclipse.emf.codegen.ecore.genmodel.GenFeature)
-;
-
-// GenFeature#getTypeGenClass()
-genmodel::GenClass getTypeGenClassX(genmodel::GenFeature feature) :
-JAVA org.eclipse.gmf.internal.codegen.util.GenModelUtils.getTypeGenClass(org.eclipse.emf.codegen.ecore.genmodel.GenFeature)
-;
-
-// GenFeature#getTypeGenClassifier()
-genmodel::GenClassifier getTypeGenClassifier(genmodel::GenFeature feature) :
- findGenClassifier(feature.genClass.genPackage.genModel, feature.ecoreFeature.eType)
-;
-
-// FIXME: for models loaded from generated package (e.g. gmf tests often
-// refer to EClass/EOperation directly from EcorePackage) instanceClassName
-// is always set and thus all metamodel types are treated as external interfaces,
-// with useless casts to EObject
-//
-// GenClass#isExternalInterface()
-boolean isExternalInterface(genmodel::GenClass genClass) :
- null != genClass.ecoreClass.instanceClassName
-;
-
-
-// GenFeatureImpl#isContains
-boolean isContains(genmodel::GenFeature gf) :
- isReferenceType(gf) && ((ecore::EReference) gf.ecoreFeature).containment
-;
-
-boolean isPrimitiveType(genmodel::GenFeature gf) :
- {"boolean", "byte", "char", "double", "float", "int", "long", "short"}.contains(gf.ecoreFeature.eType.instanceClassName)
-;
-
-private boolean isReferenceType(genmodel::GenFeature gf) :
- !{gf.ecoreFeature}.typeSelect(ecore::EReference).isEmpty()
-;
diff --git a/plugins/org.eclipse.gmf.codegen/templates/xpt/NonNLSUtils.ext b/plugins/org.eclipse.gmf.codegen/templates/xpt/NonNLSUtils.ext
deleted file mode 100644
index a5328dd10..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates/xpt/NonNLSUtils.ext
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright (c) 2006, 2008 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:
- * Alexander Shatalin (Borland) - initial API and implementation
- */
-
-import "http://www.eclipse.org/emf/2002/Ecore";
-
-cached List[int] getNonNLSCounter() :
- {}
-;
-
-String resetNonNLSCounter() :
- getNonNLSCounter().clear()->""
-;
-
-String incrementNonNLSCounter() :
- getNonNLSCounter().add(getNonNLSCounter().size() + 1)->""
-;
-
-List[int] getNonNLSCounter(Collection[Object] collection) :
- let result = {} : collection.collect(el | result.add(el).size())
-; \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.codegen/templates/xpt/application/ActionBarAdvisor.xpt b/plugins/org.eclipse.gmf.codegen/templates/xpt/application/ActionBarAdvisor.xpt
deleted file mode 100644
index a8371e69d..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates/xpt/application/ActionBarAdvisor.xpt
+++ /dev/null
@@ -1,266 +0,0 @@
-/*
- * Copyright (c) 2006, 2008 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:
- * Dmitry Stadnik (Borland) - initial API and implementation
- */
-
-«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
-«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
-
-«EXTENSION xpt::application::i18n»
-
-«DEFINE ActionBarAdvisor FOR gmfgen::GenApplication-»
-«EXPAND xpt::Common::copyright FOR editorGen-»
-package «packageName»;
-
-«EXPAND xpt::Common::generatedClassComment»
-public class «actionBarAdvisorClassName» extends org.eclipse.ui.application.ActionBarAdvisor {
-
- «EXPAND xpt::Common::generatedMemberComment»
- private org.eclipse.ui.actions.ActionFactory.IWorkbenchAction lockToolBarAction;
-
- «EXPAND xpt::Common::generatedMemberComment»
- private org.eclipse.ui.actions.ActionFactory.IWorkbenchAction toggleCoolbarAction;
-
- «EXPAND xpt::Common::generatedMemberComment»
- public «actionBarAdvisorClassName»(org.eclipse.ui.application.IActionBarConfigurer configurer) {
- super(configurer);
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- private org.eclipse.ui.IWorkbenchWindow getWindow() {
- return getActionBarConfigurer().getWindowConfigurer().getWindow();
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected void makeActions(org.eclipse.ui.IWorkbenchWindow window) {
- toggleCoolbarAction = org.eclipse.ui.actions.ActionFactory.TOGGLE_COOLBAR.create(window);
- register(toggleCoolbarAction);
- lockToolBarAction = org.eclipse.ui.actions.ActionFactory.LOCK_TOOL_BAR.create(window);
- register(lockToolBarAction);
- «EXPAND makeAction("window") FOREACH sharedContributionItems-»
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected void fillMenuBar(org.eclipse.jface.action.IMenuManager menu) {
- «EXPAND fill("menu") FOR mainMenu-»
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected void fillCoolBar(org.eclipse.jface.action.ICoolBarManager toolBar) {
- org.eclipse.jface.action.IMenuManager popUpMenu = new org.eclipse.jface.action.MenuManager();
- popUpMenu.add(new org.eclipse.jface.action.ActionContributionItem(lockToolBarAction));
- popUpMenu.add(new org.eclipse.jface.action.ActionContributionItem(toggleCoolbarAction));
- toolBar.setContextMenuManager(popUpMenu);
- «EXPAND fill("toolBar") FOR mainToolBar-»
- }
-
- «EXPAND openEditor FOR editorGen.editor-»
-
- «EXPAND actions-»
-
- «EXPAND additions-»
-}
-«ENDDEFINE»
-
-«DEFINE openEditor FOR gmfgen::GenEditorView-»
- «EXPAND xpt::Common::generatedMemberComment»
- private static boolean openEditor(org.eclipse.ui.IWorkbench workbench, org.eclipse.emf.common.util.URI fileURI) {
- org.eclipse.ui.IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow();
- org.eclipse.ui.IWorkbenchPage page = workbenchWindow.getActivePage();
- org.eclipse.ui.IEditorDescriptor editorDescriptor =
- workbench.getEditorRegistry().getDefaultEditor(fileURI.toFileString());
- if (editorDescriptor == null) {
- org.eclipse.jface.dialogs.MessageDialog.openError(workbenchWindow.getShell(),
- «EXPAND xpt::Externalizer::accessorCall(editorGen.application.i18nKeyForDefaultFileEditorErrorDialog().titleKey()) FOR editorGen»,
- org.eclipse.osgi.util.NLS.bind(
- «EXPAND xpt::Externalizer::accessorCall(editorGen.application.i18nKeyForDefaultFileEditorErrorDialog().messageKey()) FOR editorGen»,
- fileURI.toFileString()));
- return false;
- } else {
- try {
- page.openEditor(new org.eclipse.emf.common.ui.URIEditorInput(fileURI), editorDescriptor.getId());
- } catch (org.eclipse.ui.PartInitException exception) {
- org.eclipse.jface.dialogs.MessageDialog.openError(
- workbenchWindow.getShell(),
- «EXPAND xpt::Externalizer::accessorCall(editorGen.application.i18nKeyForDefaultEditorOpenErrorDialog().titleKey()) FOR editorGen»,
- exception.getMessage());
- return false;
- }
- }
- return true;
- }
-«ENDDEFINE»
-
-«DEFINE makeAction(String windowVar) FOR gmfgen::GenContributionItem»
- «ERROR "Can not make action for " + this»
-«ENDDEFINE»
-
-«DEFINE makeAction(String windowVar) FOR gmfgen::GenActionFactoryContributionItem»
- register(org.eclipse.ui.actions.ActionFactory.«name».create(«windowVar»));
-«ENDDEFINE»
-
-«DEFINE fill(String managerVar) FOR gmfgen::GenContributionManager»
- «EXPAND contribute(managerVar) FOREACH items-»
-«ENDDEFINE»
-
-«DEFINE contribute(String managerVar) FOR gmfgen::GenContributionItem»
- «ERROR "Can not contribute item: " + this»
-«ENDDEFINE»
-
-«DEFINE contribute(String managerVar) FOR gmfgen::GenGroupMarker»
- «managerVar».add(new org.eclipse.jface.action.GroupMarker(«groupName»));
-«ENDDEFINE»
-
-«DEFINE contribute(String managerVar) FOR gmfgen::GenSeparator»
- «managerVar».add(new org.eclipse.jface.action.Separator(«IF null != groupName»«groupName»«ENDIF»));
-«ENDDEFINE»
-
-«DEFINE contribute(String managerVar) FOR gmfgen::GenMenuManager»
- «LET managerVar + "X" AS menuVar-»
- {
- org.eclipse.jface.action.IMenuManager «menuVar» = new org.eclipse.jface.action.MenuManager(
- «IF null != name»«EXPAND xpt::Externalizer::accessorCall(i18nKeyForMenu()) FOR editorGen»«ELSE»null«ENDIF»«IF null != iD», «iD»«ENDIF»);
- «EXPAND contribute(menuVar) FOREACH items-»
- «managerVar».add(«menuVar»);
- }
- «ENDLET-»
-«ENDDEFINE»
-
-«DEFINE contribute(String managerVar) FOR gmfgen::GenToolBarManager»
- «LET managerVar + "X" AS toolBarVar-»
- {
- org.eclipse.jface.action.IToolBarManager «toolBarVar» = new org.eclipse.jface.action.ToolBarManager();
- «EXPAND contribute(toolBarVar) FOREACH items-»
- «managerVar».add(new org.eclipse.jface.action.ToolBarContributionItem(«toolBarVar»«IF null != iD», «iD»«ENDIF»));
- }
- «ENDLET-»
-«ENDDEFINE»
-
-«DEFINE contribute(String managerVar) FOR gmfgen::GenSharedContributionItem»
- «EXPAND contributeShared(managerVar) FOR actualItem-»
-«ENDDEFINE»
-
-«DEFINE contributeShared(String managerVar) FOR gmfgen::GenContributionItem»
- «ERROR "Can not contribute shared item: " + this»
-«ENDDEFINE»
-
-«DEFINE contributeShared(String managerVar) FOR gmfgen::GenActionFactoryContributionItem»
- «managerVar».add(getAction(org.eclipse.ui.actions.ActionFactory.«name».getId()));
-«ENDDEFINE»
-
-«DEFINE actions FOR gmfgen::GenApplication»
-«EXPAND NewDiagramAction-»
-«EXPAND OpenUriAction-»
-«EXPAND OpenAction-»
-«EXPAND AboutAction-»
-«ENDDEFINE»
-
-«DEFINE NewDiagramAction FOR gmfgen::GenApplication-»
- «EXPAND xpt::Common::generatedClassComment»
- public static class NewDiagramAction extends org.eclipse.emf.common.ui.action.WorkbenchWindowActionDelegate {
-
- «EXPAND xpt::Common::generatedMemberComment»
- public void run(org.eclipse.jface.action.IAction action) {
- «editorGen.diagram.getCreationWizardQualifiedClassName()» wizard =
- new «editorGen.diagram.getCreationWizardQualifiedClassName()»();
- wizard.init(getWindow().getWorkbench(), org.eclipse.jface.viewers.StructuredSelection.EMPTY);
- org.eclipse.jface.wizard.WizardDialog wizardDialog =
- new org.eclipse.jface.wizard.WizardDialog(getWindow().getShell(), wizard);
- wizardDialog.open();
- }
- }
-
-«ENDDEFINE»
-
-«DEFINE OpenUriAction FOR gmfgen::GenApplication-»
- «EXPAND xpt::Common::generatedClassComment»
- public static class OpenURIAction extends org.eclipse.emf.common.ui.action.WorkbenchWindowActionDelegate {
-
- «EXPAND xpt::Common::generatedMemberComment»
- public void run(org.eclipse.jface.action.IAction action) {
- org.eclipse.emf.edit.ui.action.LoadResourceAction.LoadResourceDialog loadResourceDialog =
- new org.eclipse.emf.edit.ui.action.LoadResourceAction.LoadResourceDialog(getWindow().getShell());
- if (org.eclipse.jface.dialogs.Dialog.OK == loadResourceDialog.open()) {
- for (java.util.Iterator i = loadResourceDialog.getURIs().iterator(); i.hasNext();) {
- openEditor(getWindow().getWorkbench(), (org.eclipse.emf.common.util.URI) i.next());
- }
- }
- }
- }
-
-«ENDDEFINE»
-
-«DEFINE OpenAction FOR gmfgen::GenApplication-»
- «EXPAND xpt::Common::generatedClassComment»
- public static class OpenAction extends org.eclipse.emf.common.ui.action.WorkbenchWindowActionDelegate {
-
- «EXPAND xpt::Common::generatedMemberComment»
- public void run(org.eclipse.jface.action.IAction action) {
- org.eclipse.swt.widgets.FileDialog fileDialog =
- new org.eclipse.swt.widgets.FileDialog(getWindow().getShell(), org.eclipse.swt.SWT.OPEN);
- fileDialog.open();
- if (fileDialog.getFileName() != null && fileDialog.getFileName().length() > 0) {
- openEditor(getWindow().getWorkbench(), org.eclipse.emf.common.util.URI.createFileURI(
- fileDialog.getFilterPath() + java.io.File.separator + fileDialog.getFileName()));
- }
- }
- }
-«ENDDEFINE»
-
-«DEFINE AboutAction FOR gmfgen::GenApplication-»
- «EXPAND xpt::Common::generatedClassComment»
- public static class AboutAction extends org.eclipse.emf.common.ui.action.WorkbenchWindowActionDelegate {
-
- «EXPAND xpt::Common::generatedMemberComment»
- public void run(org.eclipse.jface.action.IAction action) {
- org.eclipse.jface.dialogs.MessageDialog.openInformation(getWindow().getShell(),
- «EXPAND xpt::Externalizer::accessorCall(i18nKeyForAboutDialog().titleKey()) FOR editorGen»,
- «EXPAND xpt::Externalizer::accessorCall(i18nKeyForAboutDialog().messageKey()) FOR editorGen»
- );
- }
- }
-«ENDDEFINE»
-
-«DEFINE additions FOR gmfgen::GenApplication-»
-«ENDDEFINE»
-
-«DEFINE i18nAccessors FOR gmfgen::GenApplication-»
-«EXPAND xpt::Externalizer::accessorField(i18nKeyForDefaultFileEditorErrorDialog().titleKey())-»
-«EXPAND xpt::Externalizer::accessorField(i18nKeyForDefaultFileEditorErrorDialog().messageKey())-»
-«EXPAND xpt::Externalizer::accessorField(i18nKeyForDefaultEditorOpenErrorDialog().titleKey())-»
-«EXPAND xpt::Externalizer::accessorField(i18nKeyForAboutDialog().titleKey())-»
-«EXPAND xpt::Externalizer::accessorField(i18nKeyForAboutDialog().messageKey())-»
-«IF null != mainMenu-»
-«EXPAND internal_i18nAccessors FOR mainMenu-»
-«EXPAND internal_i18nAccessors FOREACH mainMenu.items.collectGenMenuManagers()-»
-«ENDIF»
-«EXPAND internal_i18nAccessors FOREACH sharedContributionItems.collectGenMenuManagers()-»
-«ENDDEFINE»
-
-«DEFINE internal_i18nAccessors FOR gmfgen::GenMenuManager-»
-«IF null != name»«EXPAND xpt::Externalizer::accessorField(i18nKeyForMenu())»«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE i18nValues FOR gmfgen::GenApplication-»
-«EXPAND xpt::Externalizer::messageEntry(i18nKeyForDefaultFileEditorErrorDialog().titleKey(), "Error")-»
-«EXPAND xpt::Externalizer::messageEntry(i18nKeyForDefaultFileEditorErrorDialog().messageKey(), "There is no editor registered for the file \"{0}\"")-»
-«EXPAND xpt::Externalizer::messageEntry(i18nKeyForDefaultEditorOpenErrorDialog().titleKey(), "Open Editor")-»
-«EXPAND xpt::Externalizer::messageEntry(i18nKeyForAboutDialog().titleKey(), "About")-»
-«EXPAND xpt::Externalizer::messageEntry(i18nKeyForAboutDialog().messageKey(), editorGen.modelID+" Diagram Editor")-»
-«IF null != mainMenu-»
-«EXPAND internal_i18nValues FOR mainMenu-»
-«EXPAND internal_i18nValues FOREACH mainMenu.items.collectGenMenuManagers()-»
-«ENDIF»
-«EXPAND internal_i18nValues FOREACH sharedContributionItems.collectGenMenuManagers()-»
-«ENDDEFINE»
-
-«DEFINE internal_i18nValues FOR gmfgen::GenMenuManager-»
-«IF null != name»«EXPAND xpt::Externalizer::messageEntry(i18nKeyForMenu(), name)»«ENDIF-»
-«ENDDEFINE»
diff --git a/plugins/org.eclipse.gmf.codegen/templates/xpt/application/Application.xpt b/plugins/org.eclipse.gmf.codegen/templates/xpt/application/Application.xpt
deleted file mode 100644
index 25ec641ed..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates/xpt/application/Application.xpt
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 2006 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:
- * Dmitry Stadnik (Borland) - initial API and implementation
- */
-
-«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
-«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
-
-«DEFINE Application FOR gmfgen::GenApplication-»
-«EXPAND xpt::Common::copyright FOR editorGen-»
-package «packageName»;
-
-«EXPAND xpt::Common::generatedClassComment»
-public class «className» implements org.eclipse.equinox.app.IApplication {
-
-«EXPAND run-»
-
- «EXPAND xpt::Common::generatedMemberComment»
- public void stop() {
- }
-«EXPAND additions-»
-}
-«ENDDEFINE»
-
-«DEFINE run FOR gmfgen::GenApplication-»
-
- «EXPAND xpt::Common::generatedMemberComment»
- public Object start(org.eclipse.equinox.app.IApplicationContext context) throws Exception {
- org.eclipse.swt.widgets.Display display = org.eclipse.ui.PlatformUI.createDisplay();
- try {
- int returnCode = org.eclipse.ui.PlatformUI.createAndRunWorkbench(display,
- new «getWorkbenchAdvisorQualifiedClassName()»());
- if (returnCode == org.eclipse.ui.PlatformUI.RETURN_RESTART) {
- return org.eclipse.equinox.app.IApplication.EXIT_RESTART;
- }
- return org.eclipse.equinox.app.IApplication.EXIT_OK;
- } finally {
- display.dispose();
- }
- }
-«ENDDEFINE»
-
-«DEFINE additions FOR gmfgen::GenApplication-»
-«ENDDEFINE»
diff --git a/plugins/org.eclipse.gmf.codegen/templates/xpt/application/Perspective.xpt b/plugins/org.eclipse.gmf.codegen/templates/xpt/application/Perspective.xpt
deleted file mode 100644
index 7511f8b47..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates/xpt/application/Perspective.xpt
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (c) 2006 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:
- * Dmitry Stadnik (Borland) - initial API and implementation
- */
-
-«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
-«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
-
-«DEFINE Perspective FOR gmfgen::GenApplication-»
-«EXPAND xpt::Common::copyright FOR editorGen-»
-package «packageName»;
-
-«EXPAND xpt::Common::generatedClassComment»
-public class «perspectiveClassName» implements org.eclipse.ui.IPerspectiveFactory {
- «EXPAND createInitialLayout-»
- «EXPAND additions-»
-«ENDDEFINE»
-«DEFINE createInitialLayout FOR gmfgen::GenApplication-»
- «EXPAND xpt::Common::generatedMemberComment»
- public void createInitialLayout(org.eclipse.ui.IPageLayout layout) {
- layout.setEditorAreaVisible(true);
- layout.addPerspectiveShortcut(«getWorkbenchAdvisorQualifiedClassName()».PERSPECTIVE_ID);
- org.eclipse.ui.IFolderLayout right = layout.createFolder(
- "right", org.eclipse.ui.IPageLayout.RIGHT, 0.6f, layout.getEditorArea()); «EXPAND xpt::Common::nonNLS»
- right.addView(org.eclipse.ui.IPageLayout.ID_OUTLINE);
- org.eclipse.ui.IFolderLayout bottomRight = layout.createFolder(
- "bottomRight", org.eclipse.ui.IPageLayout.BOTTOM, 0.6f, "right"); «EXPAND xpt::Common::nonNLS» «EXPAND xpt::Common::nonNLS(2)»
- bottomRight.addView(org.eclipse.ui.IPageLayout.ID_PROP_SHEET);
- «EXPAND layoutAdditions-»
- }
-}
-«ENDDEFINE»
-
-«DEFINE layoutAdditions FOR gmfgen::GenApplication-»
-«ENDDEFINE»
-
-«DEFINE additions FOR gmfgen::GenApplication-»
-«ENDDEFINE»
diff --git a/plugins/org.eclipse.gmf.codegen/templates/xpt/application/WizardNewFileCreationPage.xpt b/plugins/org.eclipse.gmf.codegen/templates/xpt/application/WizardNewFileCreationPage.xpt
deleted file mode 100644
index 77669d263..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates/xpt/application/WizardNewFileCreationPage.xpt
+++ /dev/null
@@ -1,206 +0,0 @@
-/*
- * Copyright (c) 2006 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:
- * Dmitry Stadnik (Borland) - initial API and implementation
- */
-
-«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
-«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
-
-«EXTENSION xpt::application::i18n»
-
-«DEFINE WizardNewFileCreationPage FOR gmfgen::GenApplication-»
-«EXPAND xpt::Common::copyright FOR editorGen-»
-package «packageName»;
-
-«EXPAND xpt::Common::generatedClassComment»
-public class WizardNewFileCreationPage extends org.eclipse.jface.wizard.WizardPage {
-
- «EXPAND xpt::Common::generatedMemberComment»
- private final org.eclipse.jface.viewers.IStructuredSelection currentSelection;
-
- «EXPAND xpt::Common::generatedMemberComment»
- private String initialFileName;
-
- «EXPAND xpt::Common::generatedMemberComment»
- private org.eclipse.core.runtime.IPath initialContainerFullPath;
-
- «EXPAND xpt::Common::generatedMemberComment»
- private org.eclipse.swt.widgets.Text fileNameEditor;
-
- «EXPAND xpt::Common::generatedMemberComment»
- public WizardNewFileCreationPage(String name, org.eclipse.jface.viewers.IStructuredSelection currentSelection) {
- super(name);
- this.currentSelection = currentSelection;
- String home = System.getProperty("user.home"); //$NON-NLS-1$
- if (home != null) {
- initialContainerFullPath = new org.eclipse.core.runtime.Path(home);
- }
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected org.eclipse.jface.viewers.IStructuredSelection getSelection() {
- return currentSelection;
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- public String getFileName() {
- if (fileNameEditor == null) {
- return initialFileName;
- }
- org.eclipse.core.runtime.IPath path = getFilePath();
- if (path == null || path.isEmpty() || path.hasTrailingSeparator()) {
- return null;
- }
- return path.lastSegment();
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- public void setFileName(String fileName) {
- if (fileNameEditor == null) {
- initialFileName = fileName;
- return;
- }
- setFilePath(getContainerFullPath(), fileName);
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- public org.eclipse.core.runtime.IPath getContainerFullPath() {
- if (fileNameEditor == null) {
- return initialContainerFullPath;
- }
- org.eclipse.core.runtime.IPath path = getFilePath();
- if (path == null || path.isEmpty()) {
- return null;
- }
- if (path.hasTrailingSeparator()) {
- return path;
- }
- path = path.removeLastSegments(1);
- if (path.isEmpty()) {
- return null;
- }
- return path.addTrailingSeparator();
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- public void setContainerFullPath(org.eclipse.core.runtime.IPath containerPath) {
- if (fileNameEditor == null) {
- initialContainerFullPath = containerPath;
- return;
- }
- setFilePath(containerPath, getFileName());
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected org.eclipse.core.runtime.IPath getFilePath() {
- String fileName = fileNameEditor.getText().trim();
- if (fileName.length() == 0) {
- return null;
- }
- return new org.eclipse.core.runtime.Path(fileNameEditor.getText());
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected void setFilePath(org.eclipse.core.runtime.IPath containerPath, String fileName) {
- if (fileName == null) {
- fileName = ""; //$NON-NLS-1$
- } else {
- fileName = fileName.trim();
- }
- if (containerPath == null) {
- fileNameEditor.setText(fileName);
- } else {
- if (!containerPath.hasTrailingSeparator()) {
- containerPath = containerPath.addTrailingSeparator();
- }
- org.eclipse.core.runtime.IPath path = fileName.length() == 0 ? containerPath : containerPath.append(fileName);
- fileNameEditor.setText(path.toOSString());
- }
- setPageComplete(validatePage());
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- public void createControl(org.eclipse.swt.widgets.Composite parent) {
- org.eclipse.swt.widgets.Composite plate = new org.eclipse.swt.widgets.Composite(parent, org.eclipse.swt.SWT.NONE);
- plate.setLayout(new org.eclipse.swt.layout.GridLayout(2, false));
- org.eclipse.swt.widgets.Label label = new org.eclipse.swt.widgets.Label(plate, org.eclipse.swt.SWT.NONE);
- label.setText(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForNewFileWizardFileLabel()) FOR editorGen»);
- label.setLayoutData(new org.eclipse.swt.layout.GridData(org.eclipse.swt.SWT.BEGINNING, org.eclipse.swt.SWT.CENTER, false, false, 2, 1));
- fileNameEditor = new org.eclipse.swt.widgets.Text(plate, org.eclipse.swt.SWT.SINGLE | org.eclipse.swt.SWT.BORDER);
- fileNameEditor.setLayoutData(new org.eclipse.swt.layout.GridData(org.eclipse.swt.SWT.FILL, org.eclipse.swt.SWT.CENTER, true, false));
- org.eclipse.swt.widgets.Button button = new org.eclipse.swt.widgets.Button(plate, org.eclipse.swt.SWT.PUSH);
- button.setText(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForNewFileWizardBrowseButton()) FOR editorGen»);
- button.setLayoutData(new org.eclipse.swt.layout.GridData(org.eclipse.swt.SWT.BEGINNING, org.eclipse.swt.SWT.CENTER, false, false));
-
- // logic
- fileNameEditor.addModifyListener(new org.eclipse.swt.events.ModifyListener() {
-
- public void modifyText(org.eclipse.swt.events.ModifyEvent e) {
- setPageComplete(validatePage());
- }
- });
- button.addSelectionListener(new org.eclipse.swt.events.SelectionListener() {
-
- public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
- org.eclipse.swt.widgets.FileDialog dialog = new org.eclipse.swt.widgets.FileDialog(getShell(), org.eclipse.swt.SWT.SAVE);
- dialog.setText(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForNewFileWizardSelectDialog()) FOR editorGen»);
- dialog.setFileName(getFileName());
- String fileName = dialog.open();
- if (fileName != null) {
- fileNameEditor.setText(fileName);
- setPageComplete(validatePage());
- }
- }
-
- public void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent e) {
- }
- });
-
- // init
- setFilePath(initialContainerFullPath, initialFileName);
- setControl(plate);
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected boolean validatePage() {
- String fileName = fileNameEditor.getText().trim();
- if (fileName.length() == 0) {
- setErrorMessage(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForNewFileWizardEmpty()) FOR editorGen»);
- return false;
- }
- if (!new org.eclipse.core.runtime.Path("").isValidPath(fileName)) { //$NON-NLS-1$
- setErrorMessage(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForNewFileWizardInvalid()) FOR editorGen»);
- return false;
- }
- setErrorMessage(null);
- return true;
- }
- «EXPAND additions-»
-}
-«ENDDEFINE»
-
-«DEFINE additions FOR gmfgen::GenApplication-»
-«ENDDEFINE»
-
-«DEFINE i18nValues FOR gmfgen::GenApplication-»
-«EXPAND xpt::Externalizer::messageEntry(i18nKeyForNewFileWizardFileLabel(), "File:")-»
-«EXPAND xpt::Externalizer::messageEntry(i18nKeyForNewFileWizardBrowseButton(), "Browse")-»
-«EXPAND xpt::Externalizer::messageEntry(i18nKeyForNewFileWizardSelectDialog(), "Select new file")-»
-«EXPAND xpt::Externalizer::messageEntry(i18nKeyForNewFileWizardEmpty(), "Specify file name")-»
-«EXPAND xpt::Externalizer::messageEntry(i18nKeyForNewFileWizardInvalid(), "Invalid file name")-»
-«ENDDEFINE»
-
-«DEFINE i18nAccessors FOR gmfgen::GenApplication-»
- «EXPAND xpt::Externalizer::accessorField(i18nKeyForNewFileWizardFileLabel())-»
- «EXPAND xpt::Externalizer::accessorField(i18nKeyForNewFileWizardBrowseButton())-»
- «EXPAND xpt::Externalizer::accessorField(i18nKeyForNewFileWizardSelectDialog())-»
- «EXPAND xpt::Externalizer::accessorField(i18nKeyForNewFileWizardEmpty())-»
- «EXPAND xpt::Externalizer::accessorField(i18nKeyForNewFileWizardInvalid())-»
-«ENDDEFINE»
diff --git a/plugins/org.eclipse.gmf.codegen/templates/xpt/application/WorkbenchAdvisor.xpt b/plugins/org.eclipse.gmf.codegen/templates/xpt/application/WorkbenchAdvisor.xpt
deleted file mode 100644
index a538731c1..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates/xpt/application/WorkbenchAdvisor.xpt
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright (c) 2006 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:
- * Dmitry Stadnik (Borland) - initial API and implementation
- */
-
-«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
-«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
-
-«DEFINE WorkbenchAdvisor FOR gmfgen::GenApplication-»
-«EXPAND xpt::Common::copyright FOR editorGen-»
-package «packageName»;
-
-«EXPAND xpt::Common::generatedClassComment»
-public class «workbenchAdvisorClassName» extends org.eclipse.ui.application.WorkbenchAdvisor {
-«EXPAND perspectiveId-»
-
-«EXPAND getInitialWindowPerspectiveId-»
-
-«EXPAND initialize-»
-
-«EXPAND createWorkbenchWindowAdvisor-»
-
-«EXPAND additions-»
-}
-«ENDDEFINE»
-
-«DEFINE perspectiveId FOR gmfgen::GenApplication-»
- «EXPAND xpt::Common::generatedMemberComment»
- public static final String PERSPECTIVE_ID = "«perspectiveId»"; «EXPAND xpt::Common::nonNLS»
-«ENDDEFINE»
-
-«DEFINE getInitialWindowPerspectiveId FOR gmfgen::GenApplication-»
- «EXPAND xpt::Common::generatedMemberComment»
- public String getInitialWindowPerspectiveId() {
- return PERSPECTIVE_ID;
- }
-«ENDDEFINE»
-
-«DEFINE initialize FOR gmfgen::GenApplication-»
- «EXPAND xpt::Common::generatedMemberComment»
- public void initialize(org.eclipse.ui.application.IWorkbenchConfigurer configurer) {
- super.initialize(configurer);
- configurer.setSaveAndRestore(true);
- }
-«ENDDEFINE»
-
-«DEFINE createWorkbenchWindowAdvisor FOR gmfgen::GenApplication-»
- «EXPAND xpt::Common::generatedMemberComment»
- public org.eclipse.ui.application.WorkbenchWindowAdvisor createWorkbenchWindowAdvisor(
- org.eclipse.ui.application.IWorkbenchWindowConfigurer configurer) {
- return new «getWorkbenchWindowAdvisorQualifiedClassName()»(configurer);
- }
-«ENDDEFINE»
-
-«DEFINE additions FOR gmfgen::GenApplication-»
-«ENDDEFINE»
diff --git a/plugins/org.eclipse.gmf.codegen/templates/xpt/application/WorkbenchWindowAdvisor.xpt b/plugins/org.eclipse.gmf.codegen/templates/xpt/application/WorkbenchWindowAdvisor.xpt
deleted file mode 100644
index ce4242bd3..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates/xpt/application/WorkbenchWindowAdvisor.xpt
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright (c) 2006 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:
- * Dmitry Stadnik (Borland) - initial API and implementation
- */
-
-«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
-«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
-
-«EXTENSION xpt::application::i18n»
-
-«DEFINE WorkbenchWindowAdvisor FOR gmfgen::GenApplication-»
-«EXPAND xpt::Common::copyright FOR editorGen-»
-package «packageName»;
-
-«EXPAND xpt::Common::generatedClassComment»
-public class «workbenchWindowAdvisorClassName» extends org.eclipse.ui.application.WorkbenchWindowAdvisor {
-
- «EXPAND xpt::Common::generatedMemberComment»
- public «workbenchWindowAdvisorClassName»(org.eclipse.ui.application.IWorkbenchWindowConfigurer configurer) {
- super(configurer);
- }
-
- «EXPAND createActionBarAdvisor-»
-
- «EXPAND preWindowOpen-»
-
- «EXPAND additions-»
-}
-«ENDDEFINE»
-
-«DEFINE createActionBarAdvisor FOR gmfgen::GenApplication-»
- «EXPAND xpt::Common::generatedMemberComment»
- public org.eclipse.ui.application.ActionBarAdvisor createActionBarAdvisor(org.eclipse.ui.application.IActionBarConfigurer configurer) {
- return new «getActionBarAdvisorQualifiedClassName()»(configurer);
- }
-«ENDDEFINE»
-
-«DEFINE preWindowOpen FOR gmfgen::GenApplication-»
- «EXPAND xpt::Common::generatedMemberComment»
- public void preWindowOpen() {
- org.eclipse.ui.application.IWorkbenchWindowConfigurer configurer = getWindowConfigurer();
- configurer.setInitialSize(new org.eclipse.swt.graphics.Point(1000, 700));
- configurer.setTitle(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForWindowTitle()) FOR editorGen»);
- }
-«ENDDEFINE»
-
-«DEFINE additions FOR gmfgen::GenApplication-»
-«ENDDEFINE»
-
-«DEFINE i18nAccessors FOR gmfgen::GenApplication-»
-«EXPAND xpt::Externalizer::accessorField(i18nKeyForWindowTitle())-»
-«ENDDEFINE»
-
-«DEFINE i18nValues FOR gmfgen::GenApplication-»
-«EXPAND xpt::Externalizer::messageEntry(i18nKeyForWindowTitle(), title)-»
-«ENDDEFINE»
diff --git a/plugins/org.eclipse.gmf.codegen/templates/xpt/application/extensions.xpt b/plugins/org.eclipse.gmf.codegen/templates/xpt/application/extensions.xpt
deleted file mode 100644
index ffc7150e7..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates/xpt/application/extensions.xpt
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Copyright (c) 2007 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:
- * Dmitry Stadnik (Borland) - initial API and implementation
- */
-
-«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
-«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
-
-«DEFINE extensions FOR gmfgen::GenApplication-»
-
- <extension id="«iD»" point="org.eclipse.core.runtime.applications">
- «EXPAND xpt::Common::xmlGeneratedTag»
- <application>
- <run class="«getQualifiedClassName()»"/>
- </application>
- </extension>
-
- <extension point="org.eclipse.ui.perspectives" id="rcp-perspective">
- «EXPAND xpt::Common::xmlGeneratedTag»
- <perspective
- id="«perspectiveId»"
- name="%perspectiveName"
- class="«getPerspectiveQualifiedClassName()»">
- </perspective>
- </extension>
-
- <extension point="org.eclipse.ui.commands" id="rcp-menu-commands">
- «EXPAND xpt::Common::xmlGeneratedTag»
- <command
- name="%openURIActionLabel"
- description="%openURIActionDescription"
- categoryId="org.eclipse.ui.category.file"
- id="«editorGen.plugin.iD».OpenURICommand"/>
- <command
- name="%openActionLabel"
- description="%openActionDescription"
- categoryId="org.eclipse.ui.category.file"
- id="«editorGen.plugin.iD».OpenCommand"/>
- </extension>
-
- <extension point="org.eclipse.ui.bindings" id="rcp-command-bindings">
- «EXPAND xpt::Common::xmlGeneratedTag»
- <key
- commandId="«editorGen.plugin.iD».OpenURICommand"
- sequence="M1+U"
- schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"/>
- <key
- commandId="«editorGen.plugin.iD».OpenCommand"
- sequence="M1+O"
- schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"/>
- </extension>
-
- <extension point="org.eclipse.ui.actionSets" id="rcp-actions">
- «EXPAND xpt::Common::xmlGeneratedTag»
- <actionSet
- label="%applicationActionSetLabel"
- visible="true"
- id="«editorGen.plugin.iD».ActionSet">
- <action
- label="%newDiagramActionLabel"
- class="«getActionBarAdvisorQualifiedClassName()»$NewDiagramAction"
- menubarPath="file/new/additions"
- id="«editorGen.plugin.iD».NewDiagramAction">
- </action>
- <action
- label="%aboutActionLabel"
- class="«getActionBarAdvisorQualifiedClassName()»$AboutAction"
- menubarPath="help/additions"
- id="«editorGen.plugin.iD».AboutAction">
- </action>
- <action
- label="%openURIActionLabel"
- definitionId="«editorGen.plugin.iD».OpenURICommand"
- class="«getActionBarAdvisorQualifiedClassName()»$OpenURIAction"
- menubarPath="file/additions"
- id="«editorGen.plugin.iD».OpenURIAction">
- </action>
- <action
- label="%openActionLabel"
- definitionId="«editorGen.plugin.iD».OpenCommand"
- class="«getActionBarAdvisorQualifiedClassName()»$OpenAction"
- menubarPath="file/additions"
- id="«editorGen.plugin.iD».OpenAction">
- </action>
- </actionSet>
- </extension>
-«ENDDEFINE»
diff --git a/plugins/org.eclipse.gmf.codegen/templates/xpt/application/i18n.ext b/plugins/org.eclipse.gmf.codegen/templates/xpt/application/i18n.ext
deleted file mode 100644
index a9d218405..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates/xpt/application/i18n.ext
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Copyright (c) 2007 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:
- * Anna Karjakina (Borland) - initial API and implementation
- */
-
-import "http://www.eclipse.org/gmf/2008/GenModel";
-import "http://www.eclipse.org/emf/2002/Ecore";
-
-String i18nKeyForDefaultFileEditorErrorDialog(gmfgen::GenApplication app) :
- app.actionBarAdvisorClassName+".DefaultFileEditor"
-;
-
-String i18nKeyForDefaultEditorOpenErrorDialog(gmfgen::GenApplication app) :
- app.actionBarAdvisorClassName+".DefaultEditorOpenError"
-;
-
-String i18nKeyForWindowTitle(gmfgen::GenApplication app) :
- app.workbenchWindowAdvisorClassName+".Title"
-;
-
-String i18nKeyForAboutDialog(gmfgen::GenApplication app) :
- app.actionBarAdvisorClassName+".AboutDialog"
-;
-
-String titleKey(String dialogKey) :
- dialogKey+"Title"
-;
-
-String messageKey(String dialogKey) :
- dialogKey+"Message"
-;
-
-String i18nKeyForMenu(gmfgen::GenMenuManager menuManager) :
- "ApplicationMenuName."+menuManager.name
-;
-
-List[gmfgen::GenMenuManager] collectGenMenuManagers(Collection[gmfgen::GenContributionItem] allItems) :
- collectAllContributionItems(allItems).typeSelect(gmfgen::GenMenuManager)
-;
-
-List[gmfgen::GenContributionManager] collectAllContributionItems(Collection[gmfgen::GenContributionItem] allItems) :
- let managers = allItems.typeSelect(gmfgen::GenContributionManager) :
- managers.addAll(managers.collect(item| collectAllContributionItems(item.items)).flatten())
-;
-
-String i18nKeyForNewFileWizardFileLabel(gmfgen::GenApplication app) :
-app.wizardNewFileCreationPageClassName()+".FileLabel"
-;
-
-String i18nKeyForNewFileWizardBrowseButton(gmfgen::GenApplication app) :
-app.wizardNewFileCreationPageClassName()+".BrowseButton"
-;
-
-String i18nKeyForNewFileWizardSelectDialog(gmfgen::GenApplication app) :
-app.wizardNewFileCreationPageClassName()+".SelectNewFileDialog"
-;
-
-String i18nKeyForNewFileWizardEmpty(gmfgen::GenApplication app) :
-app.wizardNewFileCreationPageClassName()+".EmptyFileNameError"
-;
-
-String i18nKeyForNewFileWizardInvalid(gmfgen::GenApplication app) :
-app.wizardNewFileCreationPageClassName()+".InvalidFileNameError"
-;
-
-private String wizardNewFileCreationPageClassName(gmfgen::GenApplication app) :
-"WizardNewFileCreationPage"
-;
-
-
diff --git a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/Utils.ext b/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/Utils.ext
deleted file mode 100644
index 8042a0094..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/Utils.ext
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright (c) 2006, 2008 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:
- * Dmitry Stadnik (Borland) - initial API and implementation
- */
-
-import "http://www.eclipse.org/gmf/2008/GenModel";
-import "http://www.eclipse.org/emf/2002/Ecore";
-import "http://www.eclipse.org/emf/2002/GenModel";
-
-extension xpt::GenModelUtils;
-
-// all diagram nodes
-List[gmfgen::GenNode] getNodes(gmfgen::GenDiagram diagram) :
- {}.addAll(diagram.topLevelNodes).addAll(diagram.childNodes)
-;
-
-// all elements that may have element type: diagram, nodes and links
-List[gmfgen::GenCommonBase] getElements(gmfgen::GenDiagram diagram) :
- { diagram }.addAll(diagram.topLevelNodes).addAll(diagram.childNodes).addAll(diagram.links)
-;
-
-boolean hasExplicitChildFeature(gmfgen::TypeModelFacet facet) :
- !isDerived(facet.childMetaFeature) && facet.childMetaFeature != facet.containmentMetaFeature
-;
-
-// true when link is contained in an object other than link's source,
-// (1) sourceMetaFeature is specified
-// (2) childMetaFeature is not the same as containment and belongs to a different class than container
-// for (2), consider scenario from bug #226882, container "A", that holds link "L" and link's source and target,
-// "N1" and "N2". "N1" has a reference to "L" which is being used as childMetaFeature. Hence, link's container, "C"
-// is different from link's source, "N1". As nothing can prevent "C" from subclassing "N1", there's no sure way to
-// tell if container is really different from the source or not, and we'd better assume they are different.
-boolean hasContainerOtherThanSource(gmfgen::TypeLinkModelFacet facet) :
- facet.sourceMetaFeature != null || facet.childMetaFeature != facet.containmentMetaFeature
-;
-
-List[gmfgen::GenPreferencePage] allPreferencePages(gmfgen::GenDiagram genDiagram) :
- recursePages(genDiagram.preferencePages)
-;
-
-private List[gmfgen::GenPreferencePage] recursePages(List[GenPreferencePage] pages) :
- pages.isEmpty() ? pages : pages.union(recursePages(pages.children))
-; \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/ViewmapAttributesUtils.ext b/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/ViewmapAttributesUtils.ext
deleted file mode 100644
index 386f313c8..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/ViewmapAttributesUtils.ext
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright (c) 2006 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:
- * Dmitry Stadnik (Borland) - initial API and implementation
- */
-
-import "http://www.eclipse.org/gmf/2008/GenModel";
-import "http://www.eclipse.org/emf/2002/Ecore";
-
-Boolean isStoringChildPositions(gmfgen::ViewmapLayoutType layoutType) :
- gmfgen::ViewmapLayoutType::XY_LAYOUT.literal == layoutType.literal
-;
-
-Boolean isFixedFont(gmfgen::Viewmap viewmap) :
- null != viewmap && viewmap.attributes.typeSelect(gmfgen::StyleAttributes).exists(e | e.fixedFont)
-;
-
-Boolean isFixedForeground(gmfgen::Viewmap viewmap) :
- null != viewmap && viewmap.attributes.typeSelect(gmfgen::StyleAttributes).exists(e | e.fixedForeground)
-;
-
-Boolean isFixedBackground(gmfgen::Viewmap viewmap) :
- null != viewmap && viewmap.attributes.typeSelect(gmfgen::StyleAttributes).exists(e | e.fixedBackground)
-;
-
-gmfgen::ResizeConstraints getResizeConstraints(gmfgen::Viewmap viewmap) :
- null == viewmap ? null : ((gmfgen::ResizeConstraints) viewmap.attributes.typeSelect(gmfgen::ResizeConstraints).first())
-;
-
-gmfgen::DefaultSizeAttributes getDefaultSizeAttributes(gmfgen::Viewmap viewmap) :
- null == viewmap ? null : ((gmfgen::DefaultSizeAttributes) viewmap.attributes.typeSelect(gmfgen::DefaultSizeAttributes).first())
-;
-
-Integer defaultSizeWidth(gmfgen::Viewmap viewmap, Integer defaultValue) :
- let a = getDefaultSizeAttributes(viewmap) :
- (null == a ? defaultValue : a.width)
-;
-
-Integer defaultSizeHeight(gmfgen::Viewmap viewmap, Integer defaultValue) :
- let a = getDefaultSizeAttributes(viewmap) :
- (null == a ? defaultValue : a.height)
-;
-
-gmfgen::LabelOffsetAttributes getLabelOffsetAttributes(gmfgen::Viewmap viewmap) :
- null == viewmap ? null : ((gmfgen::LabelOffsetAttributes) viewmap.attributes.typeSelect(gmfgen::LabelOffsetAttributes).first())
-;
-
-Integer labelOffsetX(gmfgen::Viewmap viewmap, Integer defaultValue) :
- let a = getLabelOffsetAttributes(viewmap) :
- (null == a ? defaultValue : a.x)
-;
-
-Integer labelOffsetY(gmfgen::Viewmap viewmap, Integer defaultValue) :
- let a = getLabelOffsetAttributes(viewmap) :
- (null == a ? defaultValue : a.y)
-;
diff --git a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/commands/CreateLinkCommand.xpt b/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/commands/CreateLinkCommand.xpt
deleted file mode 100644
index 766ca050a..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/commands/CreateLinkCommand.xpt
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * Copyright (c) 2007, 2008 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:
- * Dmitry Stadnik (Borland) - initial API and implementation
- */
-
-«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
-«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
-«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
-
-«EXTENSION xpt::GenModelUtils»
-«EXTENSION xpt::diagram::Utils»
-
-«DEFINE CreateLinkCommand FOR gmfgen::GenLink»«EXPAND Main»«ENDDEFINE»
-
-«DEFINE Main FOR gmfgen::GenLink-»
-«EXPAND xpt::Common::copyright FOR diagram.editorGen-»
-package «diagram.editCommandsPackageName»;
-
-«EXPAND xpt::Common::generatedClassComment»
-public class «createCommandClassName» extends org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand {
- «EXPAND xpt::diagram::commands::CreateLinkUtils::fields FOR modelFacet-»
-
- «EXPAND xpt::Common::generatedMemberComment»
- public «createCommandClassName»(org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest request, org.eclipse.emf.ecore.EObject source, org.eclipse.emf.ecore.EObject target) {
- super(request.getLabel(), null, request);
- «EXPAND xpt::diagram::commands::CreateLinkUtils::init FOR modelFacet-»
- }
- «EXPAND xpt::diagram::commands::CreateLinkUtils::canCreate(this) FOR modelFacet-»
-
- «EXPAND doExecuteWithResultMethod»
-
- «EXPAND doConfigure(this) FOR modelFacet-»
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected void setElementToEdit(org.eclipse.emf.ecore.EObject element) {
- throw new UnsupportedOperationException();
- }
- «EXPAND xpt::diagram::commands::CreateLinkUtils::accessors FOR modelFacet-»
-«EXPAND additions-»
-}
-«ENDDEFINE»
-
-«DEFINE additions FOR gmfgen::GenLink»«ENDDEFINE»
-
-«DEFINE doExecuteWithResultMethod FOR gmfgen::GenLink»
- «EXPAND xpt::Common::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 create link command");«EXPAND xpt::Common::nonNLS»
- }
- «EXPAND execute(this) FOR modelFacet»
- }
-«ENDDEFINE»
-
-«DEFINE execute(gmfgen::GenLink link) FOR gmfgen::LinkModelFacet»«ENDDEFINE»
-
-«DEFINE execute(gmfgen::GenLink link) FOR gmfgen::TypeLinkModelFacet»
-«IF (sourceMetaFeature == null ? containmentMetaFeature.ecoreFeature.changeable : sourceMetaFeature.ecoreFeature.changeable) && (targetMetaFeature.ecoreFeature.changeable)-»
- «EXPAND MetaModel::NewInstance("newElement") FOR metaClass-»
- «EXPAND MetaModel::modifyFeature(hasContainerOtherThanSource() ? "getContainer()" : "getSource()", containmentMetaFeature.genClass, "newElement") FOR containmentMetaFeature-»
- «IF sourceMetaFeature != null-»
- «EXPAND MetaModel::modifyFeature("newElement", metaClass, "getSource()") FOR sourceMetaFeature-»
- «ENDIF-»
- «EXPAND MetaModel::modifyFeature("newElement", metaClass, "getTarget()") FOR targetMetaFeature-»
- «IF hasExplicitChildFeature()-»
- «IF sourceMetaFeature != null-»
- «EXPAND MetaModel::modifyFeature("getContainer()", containmentMetaFeature.genClass, "newElement") FOR childMetaFeature-»
- «ELSE-»
- «EXPAND MetaModel::modifyFeature("getSource()", getSourceType(), "newElement") FOR childMetaFeature-»
- «ENDIF-»
- «ENDIF-»
- «EXPAND initialize(link, "newElement")-»
- doConfigure(newElement, monitor, info);
- ((org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest) getRequest()).setNewElement(«EXPAND MetaModel::DowncastToEObject("newElement") FOR metaClass»);
- return org.eclipse.gmf.runtime.common.core.command.CommandResult.newOKCommandResult(newElement);
-«ELSE-»
- throw new UnsupportedOperationException();
-«ENDIF-»
-«ENDDEFINE»
-
-
-«DEFINE initialize(GenLink link, String newElementvVar) FOR TypeModelFacet»«IF modelElementInitializer != null-»
-«link.diagram.getElementTypesQualifiedClassName()».init_«link.getUniqueIdentifier()»(«newElementvVar»);
-«ENDIF»«ENDDEFINE»
-
-
-«DEFINE execute(gmfgen::GenLink link) FOR gmfgen::FeatureLinkModelFacet»
-«IF metaFeature.ecoreFeature.changeable-»
- if (getSource() != null && getTarget() != null) {
- «EXPAND MetaModel::modifyFeature("getSource()", getSourceType(), "getTarget()") FOR metaFeature-»
- }
- return org.eclipse.gmf.runtime.common.core.command.CommandResult.newOKCommandResult();
-«ELSE-»
- throw new UnsupportedOperationException();
-«ENDIF-»
-«ENDDEFINE»
-
-
-«DEFINE doConfigure(gmfgen::GenLink link) FOR gmfgen::LinkModelFacet»«ENDDEFINE»
-
-/*
- * TODO invocation of configure command should be optional, and better yet,
- * configuration should rather happen from EditPolicy then from within creation command
- */
-«DEFINE doConfigure(gmfgen::GenLink link) FOR gmfgen::TypeLinkModelFacet-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected void doConfigure(«EXPAND MetaModel::QualifiedClassName FOR metaClass» newElement, org.eclipse.core.runtime.IProgressMonitor monitor, org.eclipse.core.runtime.IAdaptable info) throws org.eclipse.core.commands.ExecutionException {
- org.eclipse.gmf.runtime.emf.type.core.IElementType elementType = ((org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest) getRequest()).getElementType();
- org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest configureRequest = new org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest(getEditingDomain(), «EXPAND MetaModel::DowncastToEObject("newElement") FOR metaClass», elementType);
- configureRequest.setClientContext(((org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest) getRequest()).getClientContext());
- configureRequest.addParameters(getRequest().getParameters());
- configureRequest.setParameter(org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest.SOURCE, getSource());
- configureRequest.setParameter(org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest.TARGET, getTarget());
- org.eclipse.gmf.runtime.common.core.command.ICommand configureCommand = elementType.getEditCommand(configureRequest);
- if (configureCommand != null && configureCommand.canExecute()) {
- configureCommand.execute(monitor, info);
- }
- }
-«ENDDEFINE»
diff --git a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/commands/CreateLinkUtils.xpt b/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/commands/CreateLinkUtils.xpt
deleted file mode 100644
index 3a0acbe11..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/commands/CreateLinkUtils.xpt
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * Copyright (c) 2007, 2008 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:
- * Dmitry Stadnik (Borland) - initial API and implementation
- */
-
-«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
-«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
-«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
-
-«EXTENSION xpt::GenModelUtils»
-«EXTENSION xpt::diagram::Utils»
-
-«REM»
- Check whether link may be created.
-«ENDREM»
-«DEFINE canCreate(gmfgen::GenLink link) FOR gmfgen::LinkModelFacet-»
-
- «EXPAND xpt::Common::generatedMemberComment»
- public boolean canExecute() {
- if (source == null && target == null) {
- return false;
- }
- if (source != null && «EXPAND MetaModel::NotInstance("source") FOR getSourceType()») {
- return false;
- }
- if (target != null && «EXPAND MetaModel::NotInstance("target") FOR getTargetType()») {
- return false;
- }
- if (getSource() == null) {
- return true; // link creation is in progress; source is not defined yet
- }
- // target may be null here but it's possible to check constraint
- «EXPAND canCreateElement(link)-»
- }
-«ENDDEFINE»
-
-«DEFINE canCreateElement(gmfgen::GenLink link) FOR gmfgen::LinkModelFacet-»
-«ENDDEFINE»
-
-«DEFINE canCreateElement(gmfgen::GenLink link) FOR gmfgen::TypeLinkModelFacet-»
-«IF hasContainerOtherThanSource()-»
- if (getContainer() == null) {
- return false;
- }
-«ENDIF-»
- return «EXPAND validatorInvocation FOR link»(«IF hasContainerOtherThanSource()»getContainer(), «ENDIF»getSource(), getTarget());
-«ENDDEFINE»
-
-«DEFINE canCreateElement(gmfgen::GenLink link) FOR gmfgen::FeatureLinkModelFacet-»
- return «EXPAND validatorInvocation FOR link»(getSource(), getTarget());
-«ENDDEFINE»
-
-«DEFINE validatorInvocation FOR gmfgen::GenLink-»
-«diagram.getBaseItemSemanticEditPolicyQualifiedClassName()».«diagram.getLinkCreationConstraintsClassName()».canCreate«getUniqueIdentifier()-»
-«ENDDEFINE»
-
-«REM»
- Fields of command that creates link.
-«ENDREM»
-«DEFINE fields FOR gmfgen::LinkModelFacet»
- «EXPAND xpt::Common::generatedMemberComment»
- private final org.eclipse.emf.ecore.EObject source;
-
- «EXPAND xpt::Common::generatedMemberComment»
- private final org.eclipse.emf.ecore.EObject target;
-«ENDDEFINE»
-
-«DEFINE fields FOR gmfgen::TypeLinkModelFacet»
- «EXPAND xpt::Common::generatedMemberComment»
- private final org.eclipse.emf.ecore.EObject source;
-
- «EXPAND xpt::Common::generatedMemberComment»
- private final org.eclipse.emf.ecore.EObject target;
-«IF hasContainerOtherThanSource()»
-
- «EXPAND xpt::Common::generatedMemberComment»
- private final «EXPAND MetaModel::QualifiedClassName FOR containmentMetaFeature.genClass» container;
-«ENDIF-»
-«ENDDEFINE»
-
-«REM»
- Field accessors of command that creates link.
-«ENDREM»
-«DEFINE accessors FOR gmfgen::LinkModelFacet-»
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected «EXPAND MetaModel::QualifiedClassName FOR getSourceType()» getSource() {
- return «EXPAND MetaModel::CastEObject("source") FOR getSourceType()»;
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected «EXPAND MetaModel::QualifiedClassName FOR getTargetType()» getTarget() {
- return «EXPAND MetaModel::CastEObject("target") FOR getTargetType()»;
- }
- «EXPAND containerAccessor-»
-«ENDDEFINE»
-
-«DEFINE containerAccessor FOR gmfgen::LinkModelFacet»«ENDDEFINE»
-
-«DEFINE containerAccessor FOR gmfgen::TypeLinkModelFacet-»
-«IF hasContainerOtherThanSource()-»
-
- «EXPAND xpt::Common::generatedMemberComment»
- public «EXPAND MetaModel::QualifiedClassName FOR containmentMetaFeature.genClass» getContainer() {
- return container;
- }
-
- «EXPAND xpt::Common::generatedMemberComment(
- "Default approach is to traverse ancestors of the source to find instance of container.\n" +
- "Modify with appropriate logic."
- )»
- private static «EXPAND MetaModel::QualifiedClassName FOR 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 («EXPAND MetaModel::IsInstance("element") FOR containmentMetaFeature.genClass») {
- return «EXPAND MetaModel::CastEObject("element") FOR containmentMetaFeature.genClass»;
- }
- }
- return null;
- }
-«ENDIF-»
-
-«ENDDEFINE»
-
-«REM»
- Part of the constructor that performs initialization.
-«ENDREM»
-«DEFINE init FOR gmfgen::LinkModelFacet-»
- this.source = source;
- this.target = target;
-«ENDDEFINE»
-
-«DEFINE init FOR gmfgen::TypeLinkModelFacet-»
- this.source = source;
- this.target = target;
-«IF hasContainerOtherThanSource()-»
- container = deduceContainer(source, target);
-«ENDIF-»
-«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/commands/CreateNodeCommand.xpt b/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/commands/CreateNodeCommand.xpt
deleted file mode 100644
index 75bedc4a6..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/commands/CreateNodeCommand.xpt
+++ /dev/null
@@ -1,161 +0,0 @@
-/*
- * Copyright (c) 2007, 2008 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:
- * Dmitry Stadnik (Borland) - initial API and implementation
- */
-
-«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
-«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
-«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
-«EXTENSION xpt::GenModelUtils»
-«EXTENSION xpt::diagram::Utils»
-
-«DEFINE CreateNodeCommand FOR gmfgen::GenNode-»
-«EXPAND xpt::Common::copyright FOR getDiagram().editorGen-»
-package «getDiagram().editCommandsPackageName»;
-
-«EXPAND xpt::Common::generatedClassComment»
-public class «createCommandClassName» extends org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand {
-
- «EXPAND constructor-»
-
- «EXPAND getElementToEdit-»
-
- «EXPAND canExecuteMethod-»
-
- «EXPAND doExecuteWithResultMethod»
-
- «EXPAND doConfigureMethod»
-}
-«ENDDEFINE»
-
-«DEFINE constructor FOR gmfgen::GenNode-»
- «EXPAND xpt::Common::generatedMemberComment»
- public «createCommandClassName»(org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest req) {
- super(req.getLabel(), null, req);
- }
-«ENDDEFINE»
-
-/*
- * TODO: either use setElementToEdit, or generate downcasted version (which may be troublesome if containment and child features point to a different parent)
- */
-«DEFINE getElementToEdit FOR gmfgen::GenNode-»
- «EXPAND xpt::Common::generatedMemberComment("FIXME: replace with setElementToEdit()")»
-protected org.eclipse.emf.ecore.EObject getElementToEdit() {
- 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) {
- container = ((org.eclipse.gmf.runtime.notation.View) container).getElement();
- }
- return container;
-}
-«ENDDEFINE»
-
-«DEFINE doExecuteWithResultMethod FOR gmfgen::GenNode-»
- «EXPAND xpt::Common::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 modelFacet.isPhantomElement()-»
- «EXPAND phantomElementCreation(this, "newElement") FOR modelFacet»
-«ELSE-»
- «EXPAND normalElementCreation(this, "newElement") FOR modelFacet»
-«ENDIF»
- «EXPAND initialize(this, "newElement") FOR modelFacet-»
-«IF true/*FIXME boolean needsExternalConfiguration*/»
- doConfigure(newElement, monitor, info);
-«ENDIF»
- ((org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest) getRequest()).setNewElement(«EXPAND MetaModel::DowncastToEObject("newElement") FOR modelFacet.metaClass»);
- return org.eclipse.gmf.runtime.common.core.command.CommandResult.newOKCommandResult(newElement);
- }
-«ENDDEFINE»
-
-/*
- * Unlike original CreateElementCommand, we don't keep track of IStatus from configureCommand.execute,
- * nor allow status setting from doDefaultCreation. The reason is ICommandProxy#execute implementation,
- * which ignores any status from wrapped ICommand. Besides, both CommandResult and IStatus seems too much to me.
- */
-«DEFINE doConfigureMethod FOR gmfgen::GenNode-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected void doConfigure(«EXPAND MetaModel::QualifiedClassName FOR modelFacet.metaClass» newElement, org.eclipse.core.runtime.IProgressMonitor monitor, org.eclipse.core.runtime.IAdaptable info) throws org.eclipse.core.commands.ExecutionException {
- org.eclipse.gmf.runtime.emf.type.core.IElementType elementType = ((org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest) getRequest()).getElementType();
- org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest configureRequest = new org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest(getEditingDomain(), «EXPAND MetaModel::DowncastToEObject("newElement") FOR modelFacet.metaClass», elementType);
- configureRequest.setClientContext(((org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest) getRequest()).getClientContext());
- configureRequest.addParameters(getRequest().getParameters());
- org.eclipse.gmf.runtime.common.core.command.ICommand configureCommand = elementType.getEditCommand(configureRequest);
- if (configureCommand != null && configureCommand.canExecute()) {
- configureCommand.execute(monitor, info);
- }
- }
-«ENDDEFINE»
-
-«DEFINE canExecuteMethod FOR gmfgen::GenNode-»
- «EXPAND xpt::Common::generatedMemberComment»
- public boolean canExecute() {
-«IF modelFacet.isPhantomElement()-»
- return true;
-«ELSE-»
- «EXPAND canExecute_Normal FOR modelFacet»
-«ENDIF-»
- }
-«ENDDEFINE»
-
-«DEFINE canExecute_Normal FOR gmfgen::TypeModelFacet-»
-«IF containmentMetaFeature.ecoreFeature.upperBound > 0 || (childMetaFeature != containmentMetaFeature && childMetaFeature.ecoreFeature.upperBound > 0)-»
- «EXPAND MetaModel::DeclareAndAssign("container", "getElementToEdit()") FOR containmentMetaFeature.genClass-»
- «IF containmentMetaFeature.ecoreFeature.upperBound > 0-»
- «IF containmentMetaFeature.ecoreFeature.upperBound == 1»
- if («EXPAND MetaModel::getFeatureValue("container", containmentMetaFeature.genClass) FOR containmentMetaFeature» != null) {
- «ELSE-»
- if («EXPAND MetaModel::getFeatureValue("container", containmentMetaFeature.genClass) FOR containmentMetaFeature».size() >= «containmentMetaFeature.ecoreFeature.upperBound») {
- «ENDIF-»
- return false;
- }
- «ENDIF-»
- «IF childMetaFeature != containmentMetaFeature && childMetaFeature.ecoreFeature.upperBound > 0-»
- «IF childMetaFeature.ecoreFeature.upperBound == 1-»
- if («EXPAND MetaModel::getFeatureValue("container", containmentMetaFeature.genClass) FOR childMetaFeature» != null) {
- «ELSE-»
- if («EXPAND MetaModel::getFeatureValue("container", containmentMetaFeature.genClass) FOR childMetaFeature».size() >= «childMetaFeature.ecoreFeature.upperBound») {
- «ENDIF-»
- return false;
- }
- «ENDIF-»
-«ENDIF-»
- return true;
-«ENDDEFINE»
-
-«DEFINE phantomElementCreation(gmfgen::GenNode node, String varName) FOR TypeModelFacet-»
- // Uncomment to put "phantom" objects into the diagram file.
- // org.eclipse.emf.ecore.resource.Resource resource =
- // ((org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest) getRequest()).getContainer().eResource();
- // if (resource == null) {
- // return null;
- // }
- org.eclipse.emf.ecore.resource.Resource resource = getElementToEdit().eResource();
- «EXPAND MetaModel::NewInstance(varName) FOR metaClass»
- resource.getContents().add(«EXPAND MetaModel::DowncastToEObject(varName) FOR metaClass»);
-«ENDDEFINE»
-
-«DEFINE normalElementCreation(gmfgen::GenNode node, String varName) FOR gmfgen::TypeModelFacet-»
- «EXPAND MetaModel::NewInstance(varName) FOR metaClass»
-«IF containmentMetaFeature != null-»
- «EXPAND MetaModel::DeclareAndAssign("owner", "getElementToEdit()") FOR containmentMetaFeature.genClass»
- «EXPAND MetaModel::modifyFeature("owner", containmentMetaFeature.genClass, varName) FOR containmentMetaFeature-»
-«ELSE-»
- //
- // FIXME no containment feature found in the genmodel, toolsmith need to manually write code here to add «varName» to a parent
- //
-«ENDIF»
-«IF hasExplicitChildFeature(this)-»
- «EXPAND MetaModel::DeclareAndAssign("childHolder", "getElementToEdit()") FOR childMetaFeature.genClass»
- «EXPAND MetaModel::modifyFeature("childHolder", childMetaFeature.genClass, varName) FOR childMetaFeature»
-«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE initialize(gmfgen::GenNode node, String newElementVar) FOR gmfgen::TypeModelFacet»«IF modelElementInitializer != null-»
-«node.getDiagram().getElementTypesQualifiedClassName()».init_«node.getUniqueIdentifier()»(«newElementVar»);
-«ENDIF»«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/commands/CreateRefLinkCommand.xpt b/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/commands/CreateRefLinkCommand.xpt
deleted file mode 100644
index 3c7fc5077..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/commands/CreateRefLinkCommand.xpt
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
- * Copyright (c) 2007, 2008 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:
- * Dmitry Stadnik (Borland) - initial API and implementation
- */
-
-«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
-
-/*
- * TODO: remove the template, as it's no longer in use
- */
-«DEFINE CreateRefLinkCommand FOR gmfgen::GenLink»«EXPAND CreateLinkCommand::Main»«ENDDEFINE»
diff --git a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/commands/CreateShortcutDecorationsCommand.xpt b/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/commands/CreateShortcutDecorationsCommand.xpt
deleted file mode 100644
index fac3c9eb4..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/commands/CreateShortcutDecorationsCommand.xpt
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (c) 2007 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:
- * Dmitry Stadnik (Borland) - initial API and implementation
- */
-
-«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
-
-«DEFINE CreateShortcutDecorationsCommand FOR gmfgen::GenDiagram-»
-«EXPAND xpt::Common::copyright FOR editorGen-»
-package «editCommandsPackageName»;
-
-«EXPAND xpt::Common::generatedClassComment»
-public class «createShortcutDecorationsCommandClassName»
- extends org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand {
-
- «EXPAND xpt::Common::generatedMemberComment»
- private java.util.List myDescriptors;
-
- «EXPAND xpt::Common::generatedMemberComment»
- public «createShortcutDecorationsCommandClassName»(
- org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain,
- org.eclipse.gmf.runtime.notation.View parentView,
- java.util.List viewDescriptors) {
- super(editingDomain, "Create Shortcuts", getWorkspaceFiles(parentView)); //$NON-NLS-1$
- myDescriptors = viewDescriptors;
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- public «createShortcutDecorationsCommandClassName»(
- org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain,
- org.eclipse.gmf.runtime.notation.View parentView,
- org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest.ViewDescriptor viewDescriptor) {
- this(editingDomain, parentView, java.util.Collections.singletonList(viewDescriptor));
- }
-
- «EXPAND xpt::Common::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 {
- for (java.util.Iterator it = myDescriptors.iterator(); it.hasNext();) {
- org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest.ViewDescriptor nextDescriptor =
- (org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest.ViewDescriptor) it.next();
- org.eclipse.gmf.runtime.notation.View view =
- (org.eclipse.gmf.runtime.notation.View) nextDescriptor.getAdapter(
- org.eclipse.gmf.runtime.notation.View.class);
- if (view != null && view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
- «EXPAND xpt::Common::addShortcutAnnotation("view")-»
- }
- }
- return org.eclipse.gmf.runtime.common.core.command.CommandResult.newOKCommandResult();
- }
-}
-«ENDDEFINE»
diff --git a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/commands/ReorientLinkCommand.xpt b/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/commands/ReorientLinkCommand.xpt
deleted file mode 100644
index 9a6981913..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/commands/ReorientLinkCommand.xpt
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (c) 2007 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:
- * Dmitry Stadnik (Borland) - initial API and implementation
- */
-
-«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
-«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
-«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
-
-«EXTENSION xpt::GenModelUtils»
-
-«DEFINE ReorientLinkCommand FOR gmfgen::GenLink-»
-«EXPAND xpt::Common::copyright FOR diagram.editorGen-»
-package «diagram.editCommandsPackageName»;
-
-«EXPAND xpt::Common::generatedClassComment»
-public class «reorientCommandClassName» extends org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand {
-
- «EXPAND xpt::Common::generatedMemberComment»
- private final int reorientDirection;
-
- «EXPAND xpt::Common::generatedMemberComment»
- private final org.eclipse.emf.ecore.EObject oldEnd;
-
- «EXPAND xpt::Common::generatedMemberComment»
- private final org.eclipse.emf.ecore.EObject newEnd;
-
- «EXPAND xpt::Common::generatedMemberComment»
- public «reorientCommandClassName»(org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest request) {
- super(request.getLabel(), request.getRelationship(), request);
- reorientDirection = request.getDirection();
- oldEnd = request.getOldRelationshipEnd();
- newEnd = request.getNewRelationshipEnd();
- }
- «EXPAND xpt::diagram::commands::ReorientLinkUtils::canReorient(this) FOR modelFacet-»
- «EXPAND xpt::diagram::commands::ReorientLinkUtils::reorient FOR modelFacet-»
- «EXPAND xpt::diagram::commands::ReorientLinkUtils::accessors-»
-}
-«ENDDEFINE»
diff --git a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/commands/ReorientLinkUtils.xpt b/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/commands/ReorientLinkUtils.xpt
deleted file mode 100644
index b51a3c37e..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/commands/ReorientLinkUtils.xpt
+++ /dev/null
@@ -1,302 +0,0 @@
-/*
- * Copyright (c) 2007, 2008 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:
- * Dmitry Stadnik (Borland) - initial API and implementation
- */
-
-«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
-«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
-«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
-
-«EXTENSION xpt::GenModelUtils»
-«EXTENSION xpt::diagram::Utils»
-
-«REM»
- Expands to all accessor methods for link and it's ends.
-«ENDREM»
-«DEFINE accessors FOR gmfgen::GenLink-»
- «EXPAND linkAccessor FOR modelFacet-»
- «EXPAND oldSourceAccessor FOR modelFacet-»
- «EXPAND newSourceAccessor FOR modelFacet-»
- «EXPAND oldTargetAccessor FOR modelFacet-»
- «EXPAND newTargetAccessor FOR modelFacet-»
-«ENDDEFINE»
-
-«DEFINE linkAccessor FOR gmfgen::LinkModelFacet-»
-«ENDDEFINE»
-
-«DEFINE linkAccessor FOR gmfgen::TypeLinkModelFacet-»
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected «EXPAND MetaModel::QualifiedClassName FOR metaClass» getLink() {
- return «EXPAND MetaModel::CastEObject("getElementToEdit()") FOR metaClass»;
- }
-«ENDDEFINE»
-
-«DEFINE oldSourceAccessor FOR gmfgen::LinkModelFacet-»
-«ENDDEFINE»
-
-«DEFINE oldSourceAccessor FOR gmfgen::TypeLinkModelFacet-»
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected «EXPAND MetaModel::QualifiedClassName FOR getSourceType()» getOldSource() {
- return «EXPAND MetaModel::CastEObject("oldEnd") FOR getSourceType()»;
- }
-«ENDDEFINE»
-
-«DEFINE oldSourceAccessor FOR gmfgen::FeatureLinkModelFacet-»
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected «EXPAND MetaModel::QualifiedClassName FOR getSourceType()» getOldSource() {
- return «EXPAND MetaModel::CastEObject("referenceOwner") FOR getSourceType()»;
- }
-«ENDDEFINE»
-
-«DEFINE newSourceAccessor FOR gmfgen::LinkModelFacet-»
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected «EXPAND MetaModel::QualifiedClassName FOR getSourceType()» getNewSource() {
- return «EXPAND MetaModel::CastEObject("newEnd") FOR getSourceType()»;
- }
-«ENDDEFINE»
-
-«DEFINE oldTargetAccessor FOR gmfgen::LinkModelFacet-»
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected «EXPAND MetaModel::QualifiedClassName FOR getTargetType()» getOldTarget() {
- return «EXPAND MetaModel::CastEObject("oldEnd") FOR getTargetType()»;
- }
-«ENDDEFINE»
-
-«DEFINE newTargetAccessor FOR gmfgen::LinkModelFacet-»
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected «EXPAND MetaModel::QualifiedClassName FOR getTargetType()» getNewTarget() {
- return «EXPAND MetaModel::CastEObject("newEnd") FOR getTargetType()»;
- }
-«ENDDEFINE»
-
-«REM»
- Generates canExecute() method for the command that reorients link.
- Implementation should perform all static checks that command can be executed.
-«ENDREM»
-«DEFINE canReorient(gmfgen::GenLink link) FOR gmfgen::LinkModelFacet-»
-
- «EXPAND xpt::Common::generatedMemberComment»
- public boolean canExecute() {
- «EXPAND checkLinkValidity-»
- if (reorientDirection == org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest.REORIENT_SOURCE) {
- return canReorientSource();
- }
- if (reorientDirection == org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest.REORIENT_TARGET) {
- return canReorientTarget();
- }
- return false;
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected boolean canReorientSource() {
- «EXPAND checkSourceRequestValidity(link)-»
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected boolean canReorientTarget() {
- «EXPAND checkTargetRequestValidity(link)-»
- }
-«ENDDEFINE»
-
-«DEFINE checkLinkValidity FOR gmfgen::LinkModelFacet-»
-«ENDDEFINE»
-
-«DEFINE checkLinkValidity FOR gmfgen::TypeLinkModelFacet-»
- if («EXPAND MetaModel::NotInstance("getElementToEdit()") FOR metaClass») {
- return false;
- }
-«ENDDEFINE»
-
-«DEFINE checkLinkValidity FOR gmfgen::FeatureLinkModelFacet-»
- if («EXPAND MetaModel::NotInstance("referenceOwner") FOR getSourceType()») {
- return false;
- }
-«ENDDEFINE»
-
-«DEFINE checkSourceRequestValidity(gmfgen::GenLink link) FOR gmfgen::LinkModelFacet-»
-«ENDDEFINE»
-
-«DEFINE checkSourceRequestValidity(gmfgen::GenLink link) FOR gmfgen::TypeLinkModelFacet-»
- if (!(«EXPAND MetaModel::IsInstance("oldEnd") FOR getSourceType()» && «EXPAND MetaModel::IsInstance("newEnd") FOR getSourceType()»)) {
- return false;
- }
- «EXPAND extractFeatureWithCheck("getLink()", metaClass, "target", getTargetType()) FOR targetMetaFeature-»
- «EXPAND checkLinkConstraint(link, "getNewSource()", "target")-»
-«ENDDEFINE»
-
-«REM»
- When feature source is being reoriented oldEnd is the link target.
-«ENDREM»
-«DEFINE checkSourceRequestValidity(gmfgen::GenLink link) FOR gmfgen::FeatureLinkModelFacet-»
- if (!(«EXPAND MetaModel::IsInstance("oldEnd") FOR getTargetType()» && «EXPAND MetaModel::IsInstance("newEnd") FOR getSourceType()»)) {
- return false;
- }
- return «EXPAND checkLinkConstraintInvocation FOR link»(getNewSource(), getOldTarget());
-«ENDDEFINE»
-
-«DEFINE checkTargetRequestValidity(gmfgen::GenLink link) FOR gmfgen::LinkModelFacet-»
-«ENDDEFINE»
-
-«DEFINE checkTargetRequestValidity(gmfgen::GenLink link) FOR gmfgen::TypeLinkModelFacet-»
- if (!(«EXPAND MetaModel::IsInstance("oldEnd") FOR getTargetType()» && «EXPAND MetaModel::IsInstance("newEnd") FOR getTargetType()»)) {
- return false;
- }
- «IF sourceMetaFeature != null-»
- «EXPAND extractFeatureWithCheck("getLink()", metaClass, "source", getSourceType()) FOR sourceMetaFeature-»
- «ELSE-»
- if (!(«EXPAND MetaModel::IsContainerInstance("getLink()", metaClass) FOR getSourceType()»)) {
- return false;
- }
- «EXPAND MetaModel::DeclareAndAssignContainer("source", "getLink()", metaClass) FOR getSourceType()»
- «ENDIF-»
- «EXPAND checkLinkConstraint(link, "source", "getNewTarget()")-»
-«ENDDEFINE»
-
-«DEFINE checkTargetRequestValidity(gmfgen::GenLink link) FOR gmfgen::FeatureLinkModelFacet-»
- if (!(«EXPAND MetaModel::IsInstance("oldEnd") FOR getTargetType()» && «EXPAND MetaModel::IsInstance("newEnd") FOR getTargetType()»)) {
- return false;
- }
- return «EXPAND checkLinkConstraintInvocation FOR link»(getOldSource(), getNewTarget());
-«ENDDEFINE»
-
-«DEFINE extractFeatureWithCheck(String containerVar, GenClass containerMetaClass, String var, GenClass varMetaClass) FOR genmodel::GenFeature-»
- «IF ecoreFeature.many-»
- if («EXPAND MetaModel::getFeatureValue(containerVar, containerMetaClass)».size() != 1) {
- return false;
- }
- «EXPAND MetaModel::DeclareAndAssign2(var, containerVar, containerMetaClass, this, "get(0)", true) FOR varMetaClass»
- «ELSE-»
- «EXPAND MetaModel::DeclareAndAssign(var, containerVar, containerMetaClass, this) FOR varMetaClass»
- «ENDIF-»
-«ENDDEFINE»
-
-«DEFINE checkLinkConstraint(gmfgen::GenLink link, String sourceVar, String targetVar) FOR gmfgen::TypeLinkModelFacet-»
- «IF hasContainerOtherThanSource()-»
- if (!(«EXPAND MetaModel::IsContainerInstance("getLink()", metaClass) FOR containmentMetaFeature.genClass»)) {
- return false;
- }
- «EXPAND MetaModel::DeclareAndAssignContainer("container", "getLink()", metaClass) FOR containmentMetaFeature.genClass»
- return «EXPAND checkLinkConstraintInvocation FOR link»(container, «sourceVar», «targetVar»);
- «ELSE-»
- return «EXPAND checkLinkConstraintInvocation FOR link»(«sourceVar», «targetVar»);
- «ENDIF-»
-«ENDDEFINE»
-
-«DEFINE checkLinkConstraintInvocation FOR gmfgen::GenLink-»
- «diagram.getBaseItemSemanticEditPolicyQualifiedClassName()».«diagram.getLinkCreationConstraintsClassName()».canExist«getUniqueIdentifier()»
-«ENDDEFINE»
-
-«REM»
- Generates doExecuteWithResult() method for the command that reorients link.
- Implementation should throw ExecutionException if it can't execute the command.
-«ENDREM»
-«DEFINE reorient FOR gmfgen::LinkModelFacet-»
-
- «EXPAND xpt::Common::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"); «EXPAND xpt::Common::nonNLS»
- }
- if (reorientDirection == org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest.REORIENT_SOURCE) {
- return reorientSource();
- }
- if (reorientDirection == org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest.REORIENT_TARGET) {
- return reorientTarget();
- }
- throw new IllegalStateException();
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected org.eclipse.gmf.runtime.common.core.command.CommandResult reorientSource() throws org.eclipse.core.commands.ExecutionException {
- «EXPAND reorientSource-»
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected org.eclipse.gmf.runtime.common.core.command.CommandResult reorientTarget() throws org.eclipse.core.commands.ExecutionException {
- «EXPAND reorientTarget-»
- }
-«ENDDEFINE»
-
-«DEFINE reorientSource FOR gmfgen::LinkModelFacet-»
-«ENDDEFINE»
-
-«REM»
- Shouldn't we change link container here?
- [artem] especially when there's explicit childMetaFeature and
- we changed source to another, but didn't change the container. Perhaps,
- makes sense to deduceContainer() using new source?
-«ENDREM»
-«DEFINE reorientSource FOR gmfgen::TypeLinkModelFacet-»
-«IF sourceMetaFeature == null ? containmentMetaFeature.ecoreFeature.changeable : sourceMetaFeature.ecoreFeature.changeable-»
-«IF sourceMetaFeature != null-»
- «EXPAND changeTarget("getLink()", metaClass, "getOldSource()", "getNewSource()") FOR sourceMetaFeature-»
-«ELSE-»
- «EXPAND changeSource("getLink()", "getOldSource()", "getNewSource()", getSourceType()) FOR hasExplicitChildFeature() /*sic! - childMetaFeature may be derived, no need to change it then*/ ? childMetaFeature : containmentMetaFeature-»
-«ENDIF-»
- return org.eclipse.gmf.runtime.common.core.command.CommandResult.newOKCommandResult(getLink());
-«ELSE-»
- throw new UnsupportedOperationException();
-«ENDIF-»
-«ENDDEFINE»
-
-«REM»
- When feature source is being reoriented oldEnd is the link target.
-«ENDREM»
-«DEFINE reorientSource FOR gmfgen::FeatureLinkModelFacet-»
-«IF metaFeature.ecoreFeature.changeable-»
- «EXPAND changeSource("getOldTarget()", "getOldSource()", "getNewSource()", getSourceType()) FOR metaFeature-»
- return org.eclipse.gmf.runtime.common.core.command.CommandResult.newOKCommandResult(referenceOwner);
-«ELSE-»
- throw new UnsupportedOperationException();
-«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE reorientTarget FOR gmfgen::LinkModelFacet-»
-«ENDDEFINE»
-
-«DEFINE reorientTarget FOR gmfgen::TypeLinkModelFacet-»
-«IF targetMetaFeature.ecoreFeature.changeable-»
- «EXPAND changeTarget("getLink()", metaClass, "getOldTarget()", "getNewTarget()") FOR targetMetaFeature-»
- return org.eclipse.gmf.runtime.common.core.command.CommandResult.newOKCommandResult(getLink());
-«ELSE-»
- throw new UnsupportedOperationException();
-«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE reorientTarget FOR gmfgen::FeatureLinkModelFacet-»
-«IF metaFeature.ecoreFeature.changeable-»
- «EXPAND changeTarget("getOldSource()", getSourceType(), "getOldTarget()", "getNewTarget()") FOR metaFeature-»
- return org.eclipse.gmf.runtime.common.core.command.CommandResult.newOKCommandResult(referenceOwner);
-«ELSE-»
- throw new UnsupportedOperationException();
-«ENDIF-»
-«ENDDEFINE»
-
-«REM»
- Replace old target with the new one in the source.
-«ENDREM»
-«DEFINE changeTarget(String sourceVar, genmodel::GenClass sourceVarGenClass, String oldTargetVar, String newTargetVar) FOR genmodel::GenFeature-»
-«EXPAND MetaModel::replaceFeatureValue(sourceVar, sourceVarGenClass, oldTargetVar, newTargetVar)»
-«ENDDEFINE»
-
-«REM»
- Move target from old source to the new one.
-«ENDREM»
-«DEFINE changeSource(String targetVar, String oldSourceVar, String newSourceVar, genmodel::GenClass sourceVarGenClass) FOR genmodel::GenFeature-»
-«EXPAND MetaModel::moveFeatureValue(oldSourceVar, newSourceVar, sourceVarGenClass, targetVar)»
-«ENDDEFINE»
diff --git a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/commands/ReorientLinkViewCommand.xpt b/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/commands/ReorientLinkViewCommand.xpt
deleted file mode 100644
index 919a2ca6b..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/commands/ReorientLinkViewCommand.xpt
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright (c) 2007, 2008 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:
- * Dmitry Stadnik (Borland) - initial API and implementation
- */
-
-«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
-
-«DEFINE ReorientLinkViewCommand FOR gmfgen::GenDiagram-»
-«EXPAND xpt::Common::copyright FOR editorGen-»
-package «editCommandsPackageName»;
-
-«EXPAND xpt::Common::generatedClassComment»
-public class «reorientConnectionViewCommandClassName»
- extends org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand {
-
- «EXPAND xpt::Common::generatedMemberComment»
- private org.eclipse.core.runtime.IAdaptable edgeAdaptor;
-
- «EXPAND xpt::Common::generatedMemberComment»
- public «reorientConnectionViewCommandClassName»(
- org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain, String label) {
- super(editingDomain, label, null);
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- public java.util.List getAffectedFiles() {
- org.eclipse.gmf.runtime.notation.View view =
- (org.eclipse.gmf.runtime.notation.View) edgeAdaptor.getAdapter(org.eclipse.gmf.runtime.notation.View.class);
- if (view != null) {
- return getWorkspaceFiles(view);
- }
- return super.getAffectedFiles();
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- public org.eclipse.core.runtime.IAdaptable getEdgeAdaptor() {
- return edgeAdaptor;
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- public void setEdgeAdaptor(org.eclipse.core.runtime.IAdaptable edgeAdaptor) {
- this.edgeAdaptor = edgeAdaptor;
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected org.eclipse.gmf.runtime.common.core.command.CommandResult doExecuteWithResult(org.eclipse.core.runtime.IProgressMonitor progressMonitor, org.eclipse.core.runtime.IAdaptable info) {
- «EXPAND xpt::Common::assert("null != edgeAdaptor : \"Null child in " + reorientConnectionViewCommandClassName + "\"")-»
- org.eclipse.gmf.runtime.notation.Edge edge = (org.eclipse.gmf.runtime.notation.Edge) getEdgeAdaptor().getAdapter(org.eclipse.gmf.runtime.notation.Edge.class);
- «EXPAND xpt::Common::assert("null != edge : \"Null edge in " + reorientConnectionViewCommandClassName + "\"")-»
- org.eclipse.gmf.runtime.notation.View tempView = edge.getSource();
- edge.setSource(edge.getTarget());
- edge.setTarget(tempView);
- return org.eclipse.gmf.runtime.common.core.command.CommandResult.newOKCommandResult();
- }
-}
-«ENDDEFINE»
diff --git a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/commands/ReorientRefLinkCommand.xpt b/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/commands/ReorientRefLinkCommand.xpt
deleted file mode 100644
index 626facb50..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/commands/ReorientRefLinkCommand.xpt
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright (c) 2007 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:
- * Dmitry Stadnik (Borland) - initial API and implementation
- */
-
-«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
-«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
-«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
-
-«EXTENSION xpt::GenModelUtils»
-
-«DEFINE ReorientRefLinkCommand FOR gmfgen::GenLink-»
-«EXPAND xpt::Common::copyright FOR diagram.editorGen-»
-package «diagram.editCommandsPackageName»;
-
-«EXPAND xpt::Common::generatedClassComment»
-public class «reorientCommandClassName» extends org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand {
-
- «EXPAND xpt::Common::generatedMemberComment»
- private final int reorientDirection;
-
- «EXPAND xpt::Common::generatedMemberComment»
- private final org.eclipse.emf.ecore.EObject referenceOwner;
-
- «EXPAND xpt::Common::generatedMemberComment»
- private final org.eclipse.emf.ecore.EObject oldEnd;
-
- «EXPAND xpt::Common::generatedMemberComment»
- private final org.eclipse.emf.ecore.EObject newEnd;
-
- «EXPAND xpt::Common::generatedMemberComment»
- public «reorientCommandClassName»(org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest request) {
- super(request.getLabel(), null, request);
- reorientDirection = request.getDirection();
- referenceOwner = request.getReferenceOwner();
- oldEnd = request.getOldRelationshipEnd();
- newEnd = request.getNewRelationshipEnd();
- }
- «EXPAND xpt::diagram::commands::ReorientLinkUtils::canReorient(this) FOR modelFacet-»
- «EXPAND xpt::diagram::commands::ReorientLinkUtils::reorient FOR modelFacet-»
- «EXPAND xpt::diagram::commands::ReorientLinkUtils::accessors-»
-}
-«ENDDEFINE»
diff --git a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/edithelpers/BaseEditHelper.xpt b/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/edithelpers/BaseEditHelper.xpt
deleted file mode 100644
index fe5b0b3f7..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/edithelpers/BaseEditHelper.xpt
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Copyright (c) 2006 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:
- * Dmitry Stadnik (Borland) - initial API and implementation
- */
-
-«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
-
-«DEFINE BaseEditHelper FOR gmfgen::GenDiagram-»
-«EXPAND xpt::Common::copyright FOR editorGen-»
-package «editHelpersPackageName»;
-
-«EXPAND xpt::Common::generatedClassComment»
-public class «baseEditHelperClassName» extends org.eclipse.gmf.runtime.emf.type.core.edithelper.AbstractEditHelper {
-
- «EXPAND attributes-»
-
- «EXPAND getEditHelperAdvice-»
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected org.eclipse.gmf.runtime.common.core.command.ICommand getInsteadCommand(
- org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest req) {
- org.eclipse.gmf.runtime.common.core.command.ICommand epCommand =
- (org.eclipse.gmf.runtime.common.core.command.ICommand) req.getParameter(«EXPAND editPolicyCommand»);
- req.setParameter(«EXPAND editPolicyCommand», null);
- org.eclipse.gmf.runtime.common.core.command.ICommand ehCommand = super.getInsteadCommand(req);
- if (epCommand == null) {
- return ehCommand;
- }
- if (ehCommand == null) {
- return epCommand;
- }
- org.eclipse.gmf.runtime.common.core.command.CompositeCommand command =
- new org.eclipse.gmf.runtime.common.core.command.CompositeCommand(null);
- command.add(epCommand);
- command.add(ehCommand);
- return command;
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected org.eclipse.gmf.runtime.common.core.command.ICommand getCreateCommand(
- org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest req) {
- return null;
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected org.eclipse.gmf.runtime.common.core.command.ICommand getCreateRelationshipCommand(
- org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest req) {
- return null;
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected org.eclipse.gmf.runtime.common.core.command.ICommand getDestroyElementCommand(
- org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest req) {
- return null;
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected org.eclipse.gmf.runtime.common.core.command.ICommand getDestroyReferenceCommand(
- org.eclipse.gmf.runtime.emf.type.core.requests.DestroyReferenceRequest req) {
- return null;
- }
- «EXPAND additions-»
-}
-«ENDDEFINE»
-
-«DEFINE attributes FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
- public static final String «EXPAND editPolicyCommand» = "edit policy command"; //$NON-NLS-1$
-
- «EXPAND xpt::Common::generatedMemberComment»
- public static final String «EXPAND contextElementType» = "context element type"; //$NON-NLS-1$
-«ENDDEFINE»
-
-«DEFINE editPolicyCommand FOR gmfgen::GenDiagram»EDIT_POLICY_COMMAND«ENDDEFINE»
-
-«DEFINE contextElementType FOR gmfgen::GenDiagram»CONTEXT_ELEMENT_TYPE«ENDDEFINE»
-
-«DEFINE editPolicyCommandConstant FOR gmfgen::GenDiagram»«getBaseEditHelperQualifiedClassName()».«EXPAND editPolicyCommand»«ENDDEFINE»
-
-«DEFINE contextElementTypeConstant FOR gmfgen::GenDiagram»«getBaseEditHelperQualifiedClassName()».«EXPAND contextElementType»«ENDDEFINE»
-
-«DEFINE getEditHelperAdvice FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected org.eclipse.gmf.runtime.emf.type.core.edithelper.IEditHelperAdvice[] getEditHelperAdvice(org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest req) {
- if (req.getParameter(«EXPAND contextElementType») instanceof org.eclipse.gmf.runtime.emf.type.core.IElementType) {
- return org.eclipse.gmf.runtime.emf.type.core.ElementTypeRegistry.getInstance().getEditHelperAdvice((org.eclipse.gmf.runtime.emf.type.core.IElementType) req.getParameter(«EXPAND contextElementType»));
- }
- return super.getEditHelperAdvice(req);
- }
-«ENDDEFINE»
-
-«DEFINE additions FOR gmfgen::GenDiagram»«ENDDEFINE»
diff --git a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/edithelpers/EditHelper.xpt b/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/edithelpers/EditHelper.xpt
deleted file mode 100644
index fd947a13b..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/edithelpers/EditHelper.xpt
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Copyright (c) 2006 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:
- * Dmitry Stadnik (Borland) - initial API and implementation
- */
-
-«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
-
-«DEFINE EditHelper FOR gmfgen::MetamodelType-»
-«EXPAND xpt::Common::copyright FOR diagramElement.getDiagram().editorGen-»
-package «diagramElement.getDiagram().editHelpersPackageName»;
-
-«EXPAND xpt::Common::generatedClassComment»
-public class «editHelperClassName» extends «diagramElement.getDiagram().getBaseEditHelperQualifiedClassName()» {
- «EXPAND additions-»
-}
-«ENDDEFINE»
-
-«DEFINE additions FOR gmfgen::MetamodelType»«ENDDEFINE»
diff --git a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/edithelpers/EditHelperAdvice.xpt b/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/edithelpers/EditHelperAdvice.xpt
deleted file mode 100644
index 7179afdd2..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/edithelpers/EditHelperAdvice.xpt
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Copyright (c) 2006 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:
- * Dmitry Stadnik (Borland) - initial API and implementation
- */
-
-«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
-
-«DEFINE EditHelperAdvice FOR gmfgen::SpecializationType-»
-«EXPAND xpt::Common::copyright FOR diagramElement.getDiagram().editorGen-»
-package «diagramElement.getDiagram().editHelpersPackageName»;
-
-«EXPAND xpt::Common::generatedClassComment»
-public class «editHelperAdviceClassName» extends org.eclipse.gmf.runtime.emf.type.core.edithelper.AbstractEditHelperAdvice {
- «EXPAND additions-»
-}
-«ENDDEFINE»
-
-«DEFINE additions FOR gmfgen::SpecializationType»«ENDDEFINE»
diff --git a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/editparts/Common.xpt b/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/editparts/Common.xpt
deleted file mode 100644
index 85e5ea2c0..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/editparts/Common.xpt
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * Copyright (c) 2006 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:
- * Dmitry Stadnik (Borland) - initial API and implementation
- */
-
-«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
-«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
-
-«DEFINE visualIDConstant FOR gmfgen::GenCommonBase-»
- «EXPAND xpt::Common::generatedMemberComment»
- public static final int VISUAL_ID = «visualID»;
-«ENDDEFINE»
-
-«DEFINE behaviour FOR gmfgen::GenCommonBase-»
- «EXPAND behaviour FOREACH behaviour-»
-«ENDDEFINE»
-
-«DEFINE behaviour FOR gmfgen::Behaviour-»
-«ENDDEFINE»
-
-«DEFINE behaviour FOR gmfgen::CustomBehaviour-»
-«IF editPolicyQualifiedClassName == null || editPolicyQualifiedClassName.trim().length() == 0-»
- removeEditPolicy(«key»); «IF key.startsWith('\"') && key.endsWith('\"')»«EXPAND xpt::Common::nonNLS»«ENDIF»
-«ELSE-»
- installEditPolicy(«key», new «getEditPolicyQualifiedClassName()»()); «IF key.startsWith('\"') && key.endsWith('\"')»«EXPAND xpt::Common::nonNLS»«ENDIF»
-«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE behaviour FOR gmfgen::OpenDiagramBehaviour-»
- installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.OPEN_ROLE,
- new «getEditPolicyQualifiedClassName()»());
-«ENDDEFINE»
-
-«DEFINE labelFigure FOR gmfgen::ParentAssignedViewmap-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected org.eclipse.draw2d.IFigure createFigure() {
- // Parent should assign one using «EXPAND impl::diagram::editparts::TextAware::labelSetterName»() method
- return null;
- }
-«ENDDEFINE»
-
-«DEFINE labelFigure FOR gmfgen::Viewmap-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected org.eclipse.draw2d.IFigure createFigure() {
- org.eclipse.draw2d.IFigure label = createFigurePrim();
- defaultText = getLabelTextHelper(label);
- return label;
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected org.eclipse.draw2d.IFigure createFigurePrim() {
- «EXPAND labelFigurePrim FOR this-»
-«ENDDEFINE»
-
-«DEFINE labelFigurePrim FOR gmfgen::FigureViewmap-»
-«IF figureQualifiedClassName == null-»
- return new org.eclipse.draw2d.Label();
-«ELSE-»
- return new «figureQualifiedClassName»();
-«ENDIF-»
- }
-«ENDDEFINE»
-
-«DEFINE labelFigurePrim FOR gmfgen::SnippetViewmap-»
- return «body»;
- }
-«ENDDEFINE»
-
-«DEFINE labelFigurePrim FOR gmfgen::InnerClassViewmap-»
- return new «className»();
- }
-
- «classBody»
-«ENDDEFINE»
-
-«DEFINE labelFigurePrim FOR gmfgen::Viewmap-»
- «ERROR "Unknown viewmap: " + this-»
- }
-«ENDDEFINE»
-
-«DEFINE notationalListeners FOR gmfgen::GenCommonBase-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected void addNotationalListeners() {
- super.addNotationalListeners();
- addListenerFilter("PrimaryView", this, getPrimaryView()); «EXPAND xpt::Common::nonNLS»
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected void removeNotationalListeners() {
- super.removeNotationalListeners();
- removeListenerFilter("PrimaryView"); «EXPAND xpt::Common::nonNLS»
- }
-«ENDDEFINE»
-
-«DEFINE handleBounds FOR gmfgen::GenCommonBase-»
- if (org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getSize_Width().equals(feature) ||
- org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getSize_Height().equals(feature) ||
- org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getLocation_X().equals(feature) ||
- org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getLocation_Y().equals(feature)) {
- refreshBounds();
- }
-«ENDDEFINE»
-
-«DEFINE handleText FOR gmfgen::GenCommonBase-»
- if (org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
- Integer c = (Integer) event.getNewValue();
- setFontColor(org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry.getInstance().getColor(c));
- } else if (org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
- refreshUnderline();
- } else if (org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
- refreshStrikeThrough();
- } else if (org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) ||
- org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) ||
- org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) ||
- org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
- refreshFont();
- } else {
- if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
- refreshLabel();
- }
- if (getParser() instanceof org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser) {
- org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser modelParser =
- (org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser) getParser();
- if (modelParser.areSemanticElementsAffected(null, event)) {
- removeSemanticListeners();
- if (resolveSemanticElement() != null) {
- addSemanticListeners();
- }
- refreshLabel();
- }
- }
- }
-«ENDDEFINE»
-
-«DEFINE installSemanticEditPolicy FOR gmfgen::GenCommonBase-»
- «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 «getItemSemanticEditPolicyQualifiedClassName()»());
- «ENDIF-»
-«ENDDEFINE»
-
-«DEFINE installCanonicalEditPolicy FOR gmfgen::GenContainerBase-»
- «IF needsCanonicalEditPolicy()-»
-installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CANONICAL_ROLE, new «getCanonicalEditPolicyQualifiedClassName()»());
- «ENDIF-»
-«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/editparts/EditPartFactory.xpt b/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/editparts/EditPartFactory.xpt
deleted file mode 100644
index e10030ccf..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/editparts/EditPartFactory.xpt
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * Copyright (c) 2006, 2008 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:
- * Dmitry Stadnik (Borland) - initial API and implementation
- */
-
-«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
-«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
-
-«DEFINE EditPartFactory FOR gmfgen::GenDiagram-»
-«EXPAND xpt::Common::copyright FOR getDiagram().editorGen-»
-package «editPartsPackageName»;
-
-«EXPAND xpt::Common::generatedClassComment»
-public class «editPartFactoryClassName» implements org.eclipse.gef.EditPartFactory {
-
- «EXPAND xpt::Common::generatedMemberComment»
- public org.eclipse.gef.EditPart createEditPart(org.eclipse.gef.EditPart context, Object model) {
- if (model instanceof org.eclipse.gmf.runtime.notation.View) {
- org.eclipse.gmf.runtime.notation.View view = (org.eclipse.gmf.runtime.notation.View) model;
- switch («EXPAND xpt::editor::VisualIDRegistry::getVisualIDMethodCall»(view)) {
- «EXPAND createEditPart FOR this-»
- «FOREACH getAllNodes() AS node-»
- «EXPAND createEditPart FOR node-»
- «EXPAND createEditPart FOREACH node.labels-»
- «ENDFOREACH-»
- «EXPAND createEditPart FOREACH compartments-»
- «FOREACH links AS link-»
- «EXPAND createEditPart FOR link-»
- «EXPAND createEditPart FOREACH link.labels»
- «ENDFOREACH-»
- }
- }
- return createUnrecognizedEditPart(context, model);
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- private org.eclipse.gef.EditPart createUnrecognizedEditPart(org.eclipse.gef.EditPart context, Object model) {
- // Handle creation of unrecognized child node EditParts here
- return null;
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- public static org.eclipse.gef.tools.CellEditorLocator getTextCellEditorLocator(
- org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart source) {
- if (source.getFigure() instanceof org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel)
- return new TextCellEditorLocator((org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) source.getFigure());
- else {
- return new LabelCellEditorLocator((org.eclipse.draw2d.Label) source.getFigure());
- }
- }
-
- «EXPAND xpt::Common::generatedClassComment»
- static private class TextCellEditorLocator implements org.eclipse.gef.tools.CellEditorLocator {
-
- «EXPAND xpt::Common::generatedMemberComment»
- private org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel wrapLabel;
-
- «EXPAND xpt::Common::generatedMemberComment»
- public TextCellEditorLocator(org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel wrapLabel) {
- this.wrapLabel = wrapLabel;
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- public org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel getWrapLabel() {
- return wrapLabel;
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- 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 = getWrapLabel().getTextBounds().getCopy();
- getWrapLabel().translateToAbsolute(rect);
- if (getWrapLabel().isTextWrapOn() && getWrapLabel().getText().length() > 0) {
- rect.setSize(new org.eclipse.draw2d.geometry.Dimension(
- text.computeSize(rect.width, org.eclipse.swt.SWT.DEFAULT)));
- } else {
- int avr = org.eclipse.draw2d.FigureUtilities.getFontMetrics(text.getFont()).getAverageCharWidth();
- rect.setSize(new org.eclipse.draw2d.geometry.Dimension(
- text.computeSize(org.eclipse.swt.SWT.DEFAULT, org.eclipse.swt.SWT.DEFAULT)).expand(avr * 2, 0));
- }
- if (!rect.equals(new org.eclipse.draw2d.geometry.Rectangle(text.getBounds()))) {
- text.setBounds(rect.x, rect.y, rect.width, rect.height);
- }
- }
- }
-
- «EXPAND xpt::Common::generatedClassComment»
- private static class LabelCellEditorLocator implements org.eclipse.gef.tools.CellEditorLocator {
-
- «EXPAND xpt::Common::generatedMemberComment»
- private org.eclipse.draw2d.Label label;
-
- «EXPAND xpt::Common::generatedMemberComment»
- public LabelCellEditorLocator(org.eclipse.draw2d.Label label) {
- this.label = label;
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- public org.eclipse.draw2d.Label getLabel() {
- return label;
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- 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 = getLabel().getTextBounds().getCopy();
- getLabel().translateToAbsolute(rect);
- int avr = org.eclipse.draw2d.FigureUtilities.getFontMetrics(text.getFont()).getAverageCharWidth();
- rect.setSize(new org.eclipse.draw2d.geometry.Dimension(
- text.computeSize(org.eclipse.swt.SWT.DEFAULT, org.eclipse.swt.SWT.DEFAULT)).expand(avr * 2, 0));
- if (!rect.equals(new org.eclipse.draw2d.geometry.Rectangle(text.getBounds()))) {
- text.setBounds(rect.x, rect.y, rect.width, rect.height);
- }
- }
- }
-}
-«ENDDEFINE»
-
-«DEFINE createEditPart FOR gmfgen::GenCommonBase»
- «EXPAND xpt::Common::caseVisualID»
- return new «getEditPartQualifiedClassName()»(view);
-«ENDDEFINE»
diff --git a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/editparts/Utils.ext b/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/editparts/Utils.ext
deleted file mode 100644
index 87f38f708..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/editparts/Utils.ext
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Copyright (c) 2006, 2008 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:
- * Dmitry Stadnik (Borland) - initial API and implementation
- */
-
-import "http://www.eclipse.org/gmf/2008/GenModel";
-import "http://www.eclipse.org/emf/2002/Ecore";
-
-Boolean isStoringChildPositions(gmfgen::GenNode node) :
- node.getLayoutType().value == gmfgen::ViewmapLayoutType::XY_LAYOUT.value
-;
-
-List[gmfgen::GenExternalNodeLabel] getExternalLabels(gmfgen::GenNode node) :
- node.labels.typeSelect(gmfgen::GenExternalNodeLabel)
-;
-
-List[gmfgen::GenChildSideAffixedNode] getSideAffixedChildren(gmfgen::GenNode node) :
- node.childNodes.typeSelect(gmfgen::GenChildSideAffixedNode)
-;
-
-List[gmfgen::GenLabel] getInnerFixedLabels(gmfgen::GenNode node) :
- node.labels.without(node.labels.typeSelect(gmfgen::GenExternalNodeLabel)).
- select(e | { ((gmfgen::GenLabel) e).viewmap }.typeSelect(gmfgen::ParentAssignedViewmap).size() > 0)
-;
-
-List[gmfgen::GenCompartment] getPinnedCompartments(gmfgen::GenNode node) :
- node.compartments.select(e | { e.viewmap }.typeSelect(gmfgen::ParentAssignedViewmap).size() > 0)
-;
-
-Boolean hasFixedChildren(gmfgen::GenNode node) :
- getInnerFixedLabels(node).size() > 0 || getPinnedCompartments(node).size() > 0
-;
-
-Boolean hasChildren(gmfgen::GenNode node) :
- !node.childNodes.isEmpty()
-;
-
-Boolean listCompartmentHasChildren(gmfgen::GenCompartment compartment) :
- compartment.listLayout && compartment.childNodes.size() > 0
-;
-
-Boolean hasChildrenInListCompartments(gmfgen::GenNode node) :
- node.compartments.exists(e | listCompartmentHasChildren(e))
-;
-
-Boolean hasBorderItems(gmfgen::GenNode node) :
- getSideAffixedChildren(node).size() > 0 || getExternalLabels(node).size() > 0
-;
-
-Boolean needsGraphicalNodeEditPolicy(gmfgen::GenNode node) :
- null != node.modelFacet && node.reorientedIncomingLinks.size() > 0
-;
-
-String i18nKeyForCompartmentTitle(gmfgen::GenCompartment compartment) :
- compartment.editPartClassName+".title"
-;
-
-
-boolean shouldGenerateDiagramViewmap(gmfgen::GenDiagram genDiagram) :
- !{gmfgen::ViewmapLayoutType::UNKNOWN.value, gmfgen::ViewmapLayoutType::XY_LAYOUT.value}.contains(genDiagram.viewmap.layoutType.value)
-;
-
-
-List[gmfgen::GenLink] getAssistantOutgoingLinks(gmfgen::GenNode node) :
- node.genOutgoingLinks.select(link | !selectGenNodes(link.targets).isEmpty())
-;
-
-List[gmfgen::GenLink] getAssistantIncomingLinks(gmfgen::GenNode node) :
- node.genIncomingLinks.select(link | !selectGenNodes(link.sources).isEmpty())
-;
-
-// TODO: remove this method allowing creation of links to links using Assistant?
-List[gmfgen::GenLinkEnd] selectGenNodes(List[gmfgen::GenLinkEnd] ends) :
- ends.typeSelect(gmfgen::GenNode)
-;
diff --git a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/editpolicies/BaseItemSemanticEditPolicy.xpt b/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/editpolicies/BaseItemSemanticEditPolicy.xpt
deleted file mode 100644
index 5632a5ab7..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/editpolicies/BaseItemSemanticEditPolicy.xpt
+++ /dev/null
@@ -1,540 +0,0 @@
-/*
- * Copyright (c) 2007, 2008 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:
- * Alexander Shatalin (Borland) - initial API and implementation
- */
-
-«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
-«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
-«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
-
-«EXTENSION xpt::diagram::editpolicies::Utils»
-«EXTENSION xpt::diagram::Utils»
-«EXTENSION xpt::GenModelUtils»
-«EXTENSION xpt::expressions::ValueExpression»
-
-«DEFINE BaseItemSemanticEditPolicy FOR gmfgen::GenDiagram-»
-«EXPAND xpt::Common::copyright FOR editorGen-»
-package «getDiagram().editPoliciesPackageName»;
-
-«EXPAND xpt::Common::generatedClassComment»
-public class «baseItemSemanticEditPolicyClassName» extends org.eclipse.gmf.runtime.diagram.ui.editpolicies.SemanticEditPolicy {
-
- «EXPAND attributes-»
-
- «EXPAND constructor-»
-
- «EXPAND xpt::Common::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"
- )»
- 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) {
- Integer id = new Integer(«EXPAND xpt::editor::VisualIDRegistry::getVisualIDMethodCall»((org.eclipse.gmf.runtime.notation.View) view));
- request.getExtendedData().put(VISUAL_ID_KEY, id);
- }
- }
- return super.getCommand(request);
- }
-
- «EXPAND xpt::Common::generatedMemberComment("Returns visual id from request parameters.\n")»
- protected int getVisualID(org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest request) {
- Object id = request.getParameter(VISUAL_ID_KEY);
- return id instanceof Integer ? ((Integer) id).intValue() : -1;
- }
-
- «EXPAND semanticPart-»
-
- «EXPAND xpt::Common::generatedMemberComment("Returns editing domain from the host edit part.\n")»
- protected org.eclipse.emf.transaction.TransactionalEditingDomain getEditingDomain() {
- return ((org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart) getHost()).getEditingDomain();
- }
-
- «EXPAND xpt::Common::generatedMemberComment("Creates command to destroy the link.\n")»
- protected org.eclipse.gef.commands.Command getDestroyElementCommand(org.eclipse.gmf.runtime.notation.View view) {
- org.eclipse.gef.EditPart editPart = (org.eclipse.gef.EditPart) getHost().getViewer().getEditPartRegistry().get(view);
- org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest request =
- new org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest(getEditingDomain(), false);
- return editPart.getCommand(
- new org.eclipse.gmf.runtime.diagram.ui.requests.EditCommandRequestWrapper(request, java.util.Collections.EMPTY_MAP));
- }
-
- «EXPAND xpt::Common::generatedMemberComment("Creates commands to destroy all host incoming and outgoing links.\n")»
- protected org.eclipse.gef.commands.CompoundCommand getDestroyEdgesCommand() {
- org.eclipse.gef.commands.CompoundCommand cmd = new org.eclipse.gef.commands.CompoundCommand();
- org.eclipse.gmf.runtime.notation.View view = (org.eclipse.gmf.runtime.notation.View) getHost().getModel();
- for (java.util.Iterator it = view.getSourceEdges().iterator(); it.hasNext();) {
- cmd.add(getDestroyElementCommand((org.eclipse.gmf.runtime.notation.Edge) it.next()));
- }
- for (java.util.Iterator it = view.getTargetEdges().iterator(); it.hasNext();) {
- cmd.add(getDestroyElementCommand((org.eclipse.gmf.runtime.notation.Edge) it.next()));
- }
- return cmd;
- }
-
- «EXPAND addDestroyShortcutsCommand-»
-
- «EXPAND linkConstraints-»
-
- «EXPAND additions-»
-}
-«ENDDEFINE»
-
-«DEFINE attributes FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment("Extended request data key to hold editpart visual id.\n")»
- public static final String VISUAL_ID_KEY = "visual_id"; «EXPAND xpt::Common::nonNLS»
-
- «EXPAND xpt::Common::generatedMemberComment»
- private final org.eclipse.gmf.runtime.emf.type.core.IElementType myElementType;
-«ENDDEFINE»
-
-«DEFINE constructor FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected «baseItemSemanticEditPolicyClassName»(org.eclipse.gmf.runtime.emf.type.core.IElementType elementType) {
- myElementType = elementType;
- }
-«ENDDEFINE»
-
-«DEFINE addDestroyShortcutsCommand FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-protected void addDestroyShortcutsCommand(org.eclipse.gef.commands.CompoundCommand command) {
- org.eclipse.gmf.runtime.notation.View view = (org.eclipse.gmf.runtime.notation.View) getHost().getModel();
- if (view.getEAnnotation("Shortcut") != null) { «EXPAND xpt::Common::nonNLS»
- return;
- }
- 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()) { «EXPAND xpt::Common::nonNLS»
- continue;
- }
- command.add(getDestroyElementCommand(nextView));
- }
-}
-«ENDDEFINE»
-
-«DEFINE semanticPart FOR gmfgen::GenDiagram-»
- «EXPAND getSemanticCommand-»
-
- «EXPAND addDeleteViewCommand-»
-
- «EXPAND getEditHelperCommand-»
-
- «EXPAND getContextElementType-»
-
- «EXPAND getSemanticCommandSwitch-»
-
- «EXPAND getConfigureCommand-»
-
- «EXPAND getCreateRelationshipCommand-»
-
- «EXPAND getCreateCommand-»
-
- «EXPAND getSetCommand-»
-
- «EXPAND getEditContextCommand-»
-
- «EXPAND getDestroyElementCommand-»
-
- «EXPAND getDestroyReferenceCommand-»
-
- «EXPAND getDuplicateCommand-»
-
- «EXPAND getMoveCommand-»
-
- «EXPAND getReorientReferenceRelationshipCommand-»
-
- «EXPAND getReorientRelationshipCommand-»
-
- «EXPAND getGEFWrapper-»
- «EXPAND getMSLWrapper-»
-
- «EXPAND getSemanticElement-»
-«ENDDEFINE»
-
-«DEFINE getEditHelperCommand FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
- private org.eclipse.gef.commands.Command getEditHelperCommand(org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest request, org.eclipse.gef.commands.Command editPolicyCommand) {
- if (editPolicyCommand != null) {
- org.eclipse.gmf.runtime.common.core.command.ICommand command = editPolicyCommand instanceof org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy ? ((org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy) editPolicyCommand).getICommand() : new org.eclipse.gmf.runtime.diagram.ui.commands.CommandProxy(editPolicyCommand);
- request.setParameter(«EXPAND xpt::diagram::edithelpers::BaseEditHelper::editPolicyCommandConstant», command);
- }
- org.eclipse.gmf.runtime.emf.type.core.IElementType requestContextElementType = getContextElementType(request);
- request.setParameter(«EXPAND xpt::diagram::edithelpers::BaseEditHelper::contextElementTypeConstant», requestContextElementType);
- org.eclipse.gmf.runtime.common.core.command.ICommand command = requestContextElementType.getEditCommand(request);
- request.setParameter(«EXPAND xpt::diagram::edithelpers::BaseEditHelper::editPolicyCommandConstant», null);
- request.setParameter(«EXPAND xpt::diagram::edithelpers::BaseEditHelper::contextElementTypeConstant», null);
- if (command != null) {
- if (!(command instanceof org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand)) {
- org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain = ((org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart) getHost()).getEditingDomain();
- command = new org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand(editingDomain, command.getLabel()).compose(command);
- }
- return new org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy(command);
- }
- return editPolicyCommand;
- }
-«ENDDEFINE»
-
-«DEFINE getContextElementType FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
- private 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 = «getElementTypesQualifiedClassName()».getElementType(getVisualID(request));
- return requestContextElementType != null ? requestContextElementType : myElementType;
- }
-«ENDDEFINE»
-
-«DEFINE getSemanticCommand FOR gmfgen::GenDiagram-»
-«EXPAND xpt::Common::generatedMemberComment»
-protected org.eclipse.gef.commands.Command getSemanticCommand(org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest request) {
- org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest completedRequest = completeRequest(request);
- org.eclipse.gef.commands.Command semanticCommand = getSemanticCommandSwitch(completedRequest);
- semanticCommand = getEditHelperCommand(completedRequest, semanticCommand);
- if (completedRequest instanceof org.eclipse.gmf.runtime.emf.type.core.requests.DestroyRequest) {
- org.eclipse.gmf.runtime.emf.type.core.requests.DestroyRequest destroyRequest = (org.eclipse.gmf.runtime.emf.type.core.requests.DestroyRequest) completedRequest;
- return shouldProceed(destroyRequest) ? addDeleteViewCommand(semanticCommand, destroyRequest) : null;
- }
- return semanticCommand;
-}
-«ENDDEFINE»
-
-«DEFINE addDeleteViewCommand FOR gmfgen::GenDiagram-»
-«EXPAND xpt::Common::generatedMemberComment»
-protected org.eclipse.gef.commands.Command addDeleteViewCommand(org.eclipse.gef.commands.Command mainCommand, org.eclipse.gmf.runtime.emf.type.core.requests.DestroyRequest completedRequest){
- org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain = ((org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart) getHost()).getEditingDomain();
- org.eclipse.gef.commands.Command deleteViewCommand = getGEFWrapper(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(editingDomain, (org.eclipse.gmf.runtime.notation.View) getHost().getModel()));
- return mainCommand == null ? deleteViewCommand : mainCommand.chain(deleteViewCommand);
-}
-«ENDDEFINE»
-
-«DEFINE getSemanticCommandSwitch FOR gmfgen::GenDiagram-»
-«EXPAND xpt::Common::generatedMemberComment»
-protected org.eclipse.gef.commands.Command getSemanticCommandSwitch(org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest req) {
- if (req instanceof org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest) {
- return getCreateRelationshipCommand((org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest) req);
- } else if (req instanceof org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest) {
- return getCreateCommand((org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest) req);
- } else if (req instanceof org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest) {
- return getConfigureCommand((org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest) req);
- } else if (req instanceof org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest) {
- return getDestroyElementCommand((org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest) req);
- } else if (req instanceof org.eclipse.gmf.runtime.emf.type.core.requests.DestroyReferenceRequest) {
- return getDestroyReferenceCommand((org.eclipse.gmf.runtime.emf.type.core.requests.DestroyReferenceRequest) req);
- } else if (req instanceof org.eclipse.gmf.runtime.emf.type.core.requests.DuplicateElementsRequest) {
- return getDuplicateCommand((org.eclipse.gmf.runtime.emf.type.core.requests.DuplicateElementsRequest) req);
- } else if (req instanceof org.eclipse.gmf.runtime.emf.type.core.requests.GetEditContextRequest) {
- return getEditContextCommand((org.eclipse.gmf.runtime.emf.type.core.requests.GetEditContextRequest) req);
- } else if (req instanceof org.eclipse.gmf.runtime.emf.type.core.requests.MoveRequest) {
- return getMoveCommand((org.eclipse.gmf.runtime.emf.type.core.requests.MoveRequest) req);
- } else if (req instanceof org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest) {
- return getReorientReferenceRelationshipCommand((org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest) req);
- } else if (req instanceof org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest) {
- return getReorientRelationshipCommand((org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest) req);
- } else if (req instanceof org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest) {
- return getSetCommand((org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest) req);
- }
- return null;
-}
-«ENDDEFINE»
-
-«DEFINE getConfigureCommand FOR gmfgen::GenDiagram-»
-«EXPAND xpt::Common::generatedMemberComment»
-protected org.eclipse.gef.commands.Command getConfigureCommand(org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest req) {
- return null;
-}
-«ENDDEFINE»
-
-«DEFINE getCreateRelationshipCommand FOR gmfgen::GenDiagram-»
-«EXPAND xpt::Common::generatedMemberComment»
-protected org.eclipse.gef.commands.Command getCreateRelationshipCommand(org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest req) {
- return null;
-}
-«ENDDEFINE»
-
-«DEFINE getCreateCommand FOR gmfgen::GenDiagram-»
-«EXPAND xpt::Common::generatedMemberComment»
-protected org.eclipse.gef.commands.Command getCreateCommand(org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest req) {
- return null;
-}
-«ENDDEFINE»
-
-«DEFINE getSetCommand FOR gmfgen::GenDiagram-»
-«EXPAND xpt::Common::generatedMemberComment»
-protected org.eclipse.gef.commands.Command getSetCommand(org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest req) {
- return null;
-}
-«ENDDEFINE»
-
-«DEFINE getEditContextCommand FOR gmfgen::GenDiagram-»
-«EXPAND xpt::Common::generatedMemberComment»
-protected org.eclipse.gef.commands.Command getEditContextCommand(org.eclipse.gmf.runtime.emf.type.core.requests.GetEditContextRequest req) {
- return null;
-}
-«ENDDEFINE»
-
-«DEFINE getDestroyElementCommand FOR gmfgen::GenDiagram-»
-«EXPAND xpt::Common::generatedMemberComment»
-protected org.eclipse.gef.commands.Command getDestroyElementCommand(org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest req) {
- return null;
-}
-«ENDDEFINE»
-
-«DEFINE getDestroyReferenceCommand FOR gmfgen::GenDiagram-»
-«EXPAND xpt::Common::generatedMemberComment»
-protected org.eclipse.gef.commands.Command getDestroyReferenceCommand(org.eclipse.gmf.runtime.emf.type.core.requests.DestroyReferenceRequest req) {
- return null;
-}
-«ENDDEFINE»
-
-«DEFINE getDuplicateCommand FOR gmfgen::GenDiagram-»
-«EXPAND xpt::Common::generatedMemberComment»
-protected org.eclipse.gef.commands.Command getDuplicateCommand(org.eclipse.gmf.runtime.emf.type.core.requests.DuplicateElementsRequest req) {
- return null;
-}
-«ENDDEFINE»
-
-«DEFINE getMoveCommand FOR gmfgen::GenDiagram-»
-«EXPAND xpt::Common::generatedMemberComment»
-protected org.eclipse.gef.commands.Command getMoveCommand(org.eclipse.gmf.runtime.emf.type.core.requests.MoveRequest req) {
- return null;
-}
-«ENDDEFINE»
-
-«DEFINE getReorientReferenceRelationshipCommand FOR gmfgen::GenDiagram-»
-«EXPAND xpt::Common::generatedMemberComment»
-protected org.eclipse.gef.commands.Command getReorientReferenceRelationshipCommand(org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest req) {
- return org.eclipse.gef.commands.UnexecutableCommand.INSTANCE;
-}
-«ENDDEFINE»
-
-«DEFINE getReorientRelationshipCommand FOR gmfgen::GenDiagram-»
-«EXPAND xpt::Common::generatedMemberComment»
-protected org.eclipse.gef.commands.Command getReorientRelationshipCommand(org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest req) {
- return org.eclipse.gef.commands.UnexecutableCommand.INSTANCE;
-}
-«ENDDEFINE»
-
-«DEFINE getGEFWrapper FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected final org.eclipse.gef.commands.Command getGEFWrapper(org.eclipse.gmf.runtime.common.core.command.ICommand cmd) {
- return new org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy(cmd);
- }
-«ENDDEFINE»
-
-«DEFINE getMSLWrapper FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment("@deprecated use getGEFWrapper() instead")»
- protected final org.eclipse.gef.commands.Command getMSLWrapper(org.eclipse.gmf.runtime.common.core.command.ICommand cmd) {
- // XXX deprecated: use getGEFWrapper() instead
- return getGEFWrapper(cmd);
- }
-«ENDDEFINE»
-
-«DEFINE getSemanticElement FOR gmfgen::GenDiagram-»
-«EXPAND xpt::Common::generatedMemberComment»
-protected org.eclipse.emf.ecore.EObject getSemanticElement() {
- return org.eclipse.gmf.runtime.diagram.core.util.ViewUtil.resolveSemanticElement((org.eclipse.gmf.runtime.notation.View) getHost().getModel());
-}
-«ENDDEFINE»
-
-
-«REM»
- FIXME need to check constraint's provider to ensure we don't generate a field
- for e.g. Java (or Literal, which is unlikely, though) expressions
-«ENDREM»
-«DEFINE linkConstraints FOR gmfgen::GenDiagram-»
-«EXPAND xpt::Common::generatedClassComment»
-public static class «getLinkCreationConstraintsClassName()» {
-
-«IF null != editorGen.expressionProviders-»
- «EXPAND xpt::Common::generatedMemberComment»
- private static final String OPPOSITE_END_VAR = "oppositeEnd"; «EXPAND xpt::Common::nonNLS»
-
-«FOREACH getValidLinkConstraints(this) AS lc-»
-«IF lc.sourceEnd != null-»
- «EXPAND xpt::Common::generatedMemberComment»
- private static «editorGen.expressionProviders.getAbstractExpressionQualifiedClassName()» «sourceConstraintFieldName(lc.link)»;
-«ENDIF-»
-«IF lc.targetEnd != null-»
- «EXPAND xpt::Common::generatedMemberComment»
- private static «editorGen.expressionProviders.getAbstractExpressionQualifiedClassName()» «targetConstraintFieldName(lc.link)»;
-«ENDIF-»
-«ENDFOREACH»
-«ENDIF-»
-
- «EXPAND canCreate FOREACH links-»
- «EXPAND canExist FOREACH links-»
-}
-«ENDDEFINE»
-
-«DEFINE canCreate FOR gmfgen::GenLink»
-
-«EXPAND xpt::Common::generatedMemberComment»
-public static boolean canCreate«getUniqueIdentifier()»(«EXPAND canCreateParameters FOR modelFacet») {
- «EXPAND checkEMFConstraints FOR modelFacet-»
- return canExist«getUniqueIdentifier()»(«EXPAND canCreateValues FOR modelFacet»);
-}
-«ENDDEFINE»
-
-«REM»
- XXX for now, both constraints are injected into single method
- which may nob be suitable for modification especially when mixing
- java and ocl constraints (former requires manual code).
- Better approach would be:
- if either is non-null and providers are not the same - introduce two methods,
- to check source and target separately. Otherwize, do it inplace.
-«ENDREM»
-«DEFINE canExist FOR gmfgen::GenLink»
-
- «EXPAND xpt::Common::generatedMemberComment»
- public static boolean canExist«getUniqueIdentifier()»(«EXPAND canCreateParameters FOR modelFacet») {
-«IF creationConstraints != null && creationConstraints.isValid() && null != getDiagram().editorGen.expressionProviders-»
- try {
-«IF null != creationConstraints.sourceEnd-»
- «EXPAND checkAdditionalConstraint(creationConstraints.sourceEnd, sourceConstraintFieldName(this), "source", "target", creationConstraints.getSourceEndContextClass(), creationConstraints.getTargetEndContextClass()) FOR creationConstraints.sourceEnd.provider-»
-«ENDIF-»
-«IF null != creationConstraints.targetEnd-»
- «EXPAND checkAdditionalConstraint(creationConstraints.targetEnd, targetConstraintFieldName(this), "target", "source", creationConstraints.getTargetEndContextClass(), creationConstraints.getSourceEndContextClass()) FOR creationConstraints.targetEnd.provider-»
-«ENDIF-»
- return true;
- } catch(Exception e) {
- «getDiagram().editorGen.plugin.getActivatorQualifiedClassName()».getInstance().logError("Link constraint evaluation error", e); «EXPAND xpt::Common::nonNLS»
- return false;
- }
-«ELSE-»
- return true;
-«ENDIF-»
- }
-«ENDDEFINE»
-
-«DEFINE canCreateParameters FOR gmfgen::LinkModelFacet»«EXPAND incorrectLinkModelFacet»«ENDDEFINE»
-«DEFINE canCreateParameters FOR gmfgen::TypeLinkModelFacet»«IF hasContainerOtherThanSource()»«EXPAND MetaModel::QualifiedClassName FOR containmentMetaFeature.genClass» container, «ENDIF»«EXPAND sourceTargetParameters»«ENDDEFINE»
-«DEFINE canCreateParameters FOR gmfgen::FeatureLinkModelFacet»«EXPAND sourceTargetParameters»«ENDDEFINE»
-
-«DEFINE sourceTargetParameters FOR gmfgen::LinkModelFacet»«EXPAND MetaModel::QualifiedClassName FOR getSourceType()» source, «EXPAND MetaModel::QualifiedClassName FOR getTargetType()» target«ENDDEFINE»
-
-«DEFINE canCreateValues FOR gmfgen::LinkModelFacet»«EXPAND incorrectLinkModelFacet»«ENDDEFINE»
-«DEFINE canCreateValues FOR gmfgen::TypeLinkModelFacet»«IF hasContainerOtherThanSource()»container, «ENDIF»source, target«ENDDEFINE»
-«DEFINE canCreateValues FOR gmfgen::FeatureLinkModelFacet»source, target«ENDDEFINE»
-
-
-
-«DEFINE checkEMFConstraints FOR gmfgen::LinkModelFacet»«EXPAND incorrectLinkModelFacet»«ENDDEFINE»
-
-«DEFINE checkEMFConstraints FOR gmfgen::TypeLinkModelFacet-»
- «LET childMetaFeature != containmentMetaFeature && childMetaFeature.ecoreFeature.upperBound > 0 AS checkChildFeatureUpperBound-»
- «IF containmentMetaFeature.ecoreFeature.upperBound > 0 || checkChildFeatureUpperBound-»
-if («getContainerVariable()» != null) {
- «EXPAND checkEMFConstraints(this) FOR containmentMetaFeature-»
- «IF checkChildFeatureUpperBound-»
- «EXPAND checkEMFConstraints(this) FOR childMetaFeature-»
- «ENDIF-»
-}
- «ENDIF-»
- «ENDLET-»
-«ENDDEFINE»
-
-«DEFINE checkEMFConstraints(gmfgen::TypeLinkModelFacet modelFacet) FOR genmodel::GenFeature-»
-«IF ecoreFeature.upperBound > 0-»
-if («EXPAND featureBoundComparator(getContainerVariable(modelFacet), modelFacet.getSourceType())») {
- return false;
-}
-«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE checkEMFConstraints FOR gmfgen::FeatureLinkModelFacet-»
-if (source != null) {
- if («EXPAND featureBoundsConditionClause("source", getSourceType()) FOR metaFeature») {
- return false;
- }
- «IF metaFeature.isContains()-»
- if (source == target) {
- return false;
- }
- «ENDIF-»
-}
-«IF getReverse(metaFeature) != null-»
-if (target != null && («EXPAND featureBoundsConditionClause("target", getTargetType()) FOR getReverse(metaFeature)»)) {
- return false;
-}
-«ENDIF»
-«ENDDEFINE»
-
-«DEFINE featureBoundsConditionClause(String targetVar, GenClass targetType) FOR GenFeature-»
-«REM»Checking upper bounds if was specified in MM«ENDREM»«-»
-«IF ecoreFeature.upperBound > 0»«EXPAND featureBoundComparator(targetVar, targetType)»«ENDIF-»
-«REM»Checking uniqueness in addition if upper bounds > 1«ENDREM»«-»
-«IF ecoreFeature.upperBound > 1» || «ENDIF-»
-«REM»Checking uniqueness in if upper bounds > 1 or < 0«ENDREM»«-»
-«IF ecoreFeature.upperBound != 1»«EXPAND featureUniquenessComparator(targetVar, targetType)»«ENDIF»
-«ENDDEFINE»
-
-«DEFINE featureBoundComparator(String featureVar, genmodel::GenClass featureVarGenClass) FOR genmodel::GenFeature»«EXPAND MetaModel::getFeatureValue(featureVar, featureVarGenClass)»«IF ecoreFeature.upperBound == 1» != null«ELSE».size() >= «ecoreFeature.upperBound»«ENDIF»«ENDDEFINE»
-«DEFINE featureUniquenessComparator(String featureVar, genmodel::GenClass featureVarGenClass) FOR genmodel::GenFeature»«EXPAND MetaModel::getFeatureValue(featureVar, featureVarGenClass) FOR this».contains(target)«ENDDEFINE»
-
-
-«DEFINE checkAdditionalConstraint(gmfgen::ValueExpression valueExpr, String constraintFieldName, String sourceEndVar, String targetEndVar, GenClass context, GenClass oppositeEndContext) FOR gmfgen::GenExpressionProviderBase»
-«ERROR "Have no idea what extra constraints to check for " + this»
-«ENDDEFINE»
-
-«DEFINE checkAdditionalConstraint(gmfgen::ValueExpression valueExpr, String constraintFieldName, String sourceEndVar, String targetEndVar, GenClass context, GenClass oppositeEndContext) FOR gmfgen::GenExpressionInterpreter-»
- if («sourceEndVar» == null) {
- return true;
- }
- if («constraintFieldName» == null) {
- java.util.Map env = java.util.Collections.singletonMap(OPPOSITE_END_VAR, «EXPAND MetaModel::MetaClass FOR oppositeEndContext»);
- «constraintFieldName» = «getQualifiedClassName()».«getExpressionAccessor(valueExpr)»(«valueExpr.getBodyString()», «EXPAND MetaModel::MetaClass FOR context», env); «EXPAND xpt::Common::nonNLS»
- }
- Object «sourceEndVar»Val = «constraintFieldName».evaluate(«sourceEndVar», java.util.Collections.singletonMap(OPPOSITE_END_VAR, «targetEndVar»));
- if (false == «sourceEndVar»Val instanceof Boolean || !((Boolean) «sourceEndVar»Val).booleanValue()) {
- return false;
- } // else fall-through
-«ENDDEFINE»
-
-«DEFINE checkAdditionalConstraint(gmfgen::ValueExpression valueExpr, String constraintFieldName, String sourceEndVar, String targetEndVar, GenClass context, GenClass oppositeEndContext) FOR gmfgen::GenJavaExpressionProvider-»
-«IF injectExpressionBody && valueExpr.body != null && valueExpr.body.length() != 0-»
- «valueExpr.body»
-«ELSEIF throwException || (injectExpressionBody && (valueExpr.body == null || valueExpr.body.length() == 0))-»
- // TODO: implement this method, using «sourceEndVar» and «targetEndVar»
- // to access link source and target, respectively
- // Ensure that you remove @generated or mark it @generated NOT
- if (Boolean.TRUE.booleanValue()) {
- throw new java.lang.UnsupportedOperationException("No java implementation provided");«EXPAND xpt::Common::nonNLS»
- }
-«ELSE-»
- if (Boolean.TRUE.booleanValue()) {«REM»just in case there are two consecutive java expression with neither throw nor inject - avoid unreachable code.«ENDREM»
- return false;
- }
-«ENDIF-»
-«ENDDEFINE»
-
-
-«DEFINE incorrectLinkModelFacet FOR gmfgen::LinkModelFacet»«ERROR "Unrecognized link model facet: " + this»«ENDDEFINE»
-
-«DEFINE additions FOR gmfgen::GenDiagram»«ENDDEFINE»
-
-«DEFINE defaultConstructor FOR gmfgen::GenCommonBase-»
- «EXPAND xpt::Common::generatedMemberComment»
- public «itemSemanticEditPolicyClassName»() {
- «EXPAND defaultConstructorBody-»
- }
-«ENDDEFINE»
-
-«REM»
- This method should be called only with diagram, node or link used as a parameter
- (then elementType != null)
-«ENDREM»
-«DEFINE defaultConstructorBody FOR gmfgen::GenCommonBase-»
- «IF elementType == null-»
- «ERROR "No element type in the passed node. Only diagram, node or link are supported in this template: " + this-»
- «ENDIF-»
- super(«EXPAND xpt::providers::ElementTypes::accessElementType»);
-«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/editpolicies/ChildContainerCanonicalEditPolicy.xpt b/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/editpolicies/ChildContainerCanonicalEditPolicy.xpt
deleted file mode 100644
index 5da05dffc..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/editpolicies/ChildContainerCanonicalEditPolicy.xpt
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (c) 2007 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:
- * Alexander Shatalin (Borland) - initial API and implementation
- */
-
-«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
-
-«DEFINE ChildContainerCanonicalEditPolicy FOR gmfgen::GenChildContainer-»
- «EXPAND xpt::Common::copyright FOR getDiagram().editorGen-»
-package «getDiagram().editPoliciesPackageName»;
-
- «EXPAND xpt::Common::generatedClassComment»
-public class «canonicalEditPolicyClassName» extends org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy {
-
- «EXPAND xpt::diagram::updater::containerBaseCanonicalMethods::containerBaseCanonicalMethods-»
-
- «EXPAND additions-»
-}
-«ENDDEFINE»
-
-«DEFINE additions FOR gmfgen::GenChildContainer»«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/editpolicies/CompartmentItemSemanticEditPolicy.xpt b/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/editpolicies/CompartmentItemSemanticEditPolicy.xpt
deleted file mode 100644
index cd9b3c294..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/editpolicies/CompartmentItemSemanticEditPolicy.xpt
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (c) 2006,2007 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:
- * Alexander Shatalin (Borland) - initial API and implementation
- */
-
-«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
-
-«DEFINE CompartmentItemSemanticEditPolicy FOR gmfgen::GenCompartment-»
- «EXPAND xpt::Common::copyright FOR getDiagram().editorGen-»
-package «getDiagram().editPoliciesPackageName»;
-
- «EXPAND xpt::Common::generatedClassComment»
-public class «itemSemanticEditPolicyClassName» extends «getDiagram().getBaseItemSemanticEditPolicyQualifiedClassName()» {
-
- «EXPAND constructor-»
-
- «EXPAND xpt::diagram::editpolicies::childContainerCreateCommand::childContainerCreateCommand FOR childNodes-»
-
- «EXPAND additions-»
-}
-«ENDDEFINE»
-
-«DEFINE constructor FOR gmfgen::GenCompartment-»
- «EXPAND xpt::Common::generatedMemberComment»
- public «itemSemanticEditPolicyClassName»() {
- «EXPAND xpt::diagram::editpolicies::BaseItemSemanticEditPolicy::defaultConstructorBody FOR node-»
- }
-«ENDDEFINE»
-
-«DEFINE additions FOR gmfgen::GenCompartment-»
-«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/editpolicies/DiagramCanonicalEditPolicy.xpt b/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/editpolicies/DiagramCanonicalEditPolicy.xpt
deleted file mode 100644
index b2b605b48..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/editpolicies/DiagramCanonicalEditPolicy.xpt
+++ /dev/null
@@ -1,240 +0,0 @@
-/*
- * Copyright (c) 2007 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:
- * Alexander Shatalin (Borland) - initial API and implementation
- */
-
-«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
-«EXTENSION xpt::diagram::editpolicies::Utils»
-«EXTENSION xpt::diagram::updater::Utils»
-«EXTENSION xpt::GenModelUtils»
-
-«DEFINE DiagramCanonicalEditPolicy FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::copyright FOR editorGen-»
-package «editPoliciesPackageName»;
-
- «EXPAND xpt::Common::generatedClassComment»
-public class «canonicalEditPolicyClassName» extends org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalConnectionEditPolicy {
-
- «EXPAND xpt::diagram::updater::containerBaseCanonicalMethods::containerBaseCanonicalMethods-»
-
- «EXPAND getSemanticConnectionsList-»
-
- «EXPAND getSourceElement-»
-
- «EXPAND getTargetElement-»
-
- «EXPAND shouldIncludeConnection-»
-
- «EXPAND refreshSemantic-»
-
- «EXPAND getDiagram-»
-
- «EXPAND refreshLinks-»
- «EXPAND additions-»
-}
-«ENDDEFINE»
-
-«DEFINE getSemanticConnectionsList FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-protected java.util.List getSemanticConnectionsList() {
- return java.util.Collections.EMPTY_LIST;
-}
-«ENDDEFINE»
-
-«DEFINE getSourceElement FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-protected org.eclipse.emf.ecore.EObject getSourceElement(org.eclipse.emf.ecore.EObject relationship) {
- return null;
-}
-«ENDDEFINE»
-
-«DEFINE getTargetElement FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-protected org.eclipse.emf.ecore.EObject getTargetElement(org.eclipse.emf.ecore.EObject relationship) {
- return null;
-}
-«ENDDEFINE»
-
-«DEFINE shouldIncludeConnection FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-protected boolean shouldIncludeConnection(org.eclipse.gmf.runtime.notation.Edge connector, java.util.Collection children) {
- return false;
-}
-«ENDDEFINE»
-
-«DEFINE refreshSemantic FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-protected void refreshSemantic() {
- java.util.List createdViews = new java.util.LinkedList();
- createdViews.addAll(refreshSemanticChildren());
- java.util.List createdConnectionViews = new java.util.LinkedList();
- createdConnectionViews.addAll(refreshSemanticConnections());
- «IF !links.isEmpty()-»
- createdConnectionViews.addAll(refreshConnections());
- «ENDIF-»
-
- if (createdViews.size() > 1) {
- // perform a layout of the container
- org.eclipse.gmf.runtime.diagram.ui.commands.DeferredLayoutCommand layoutCmd = new org.eclipse.gmf.runtime.diagram.ui.commands.DeferredLayoutCommand(host().getEditingDomain(), createdViews, host());
- executeCommand(new org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy(layoutCmd));
- }
-
- createdViews.addAll(createdConnectionViews);
- makeViewsImmutable(createdViews);
-}
-«ENDDEFINE»
-
-«DEFINE refreshLinks FOR gmfgen::GenDiagram-»
- «IF !links.isEmpty()-»
- «EXPAND refreshConnections-»
-
- «EXPAND collectAllLinks-»
-
- «EXPAND createConnections-»
-
- «EXPAND getEditPart-»
- «ENDIF-»
-«ENDDEFINE»
-
-«DEFINE refreshConnections FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-private java.util.Collection refreshConnections() {
- java.util.Map domain2NotationMap = new java.util.HashMap();
- java.util.Collection linkDescriptors = collectAllLinks(getDiagram(), domain2NotationMap);
- java.util.Collection existingLinks = new java.util.LinkedList(getDiagram().getEdges());
- for (java.util.Iterator linksIterator = existingLinks.iterator(); linksIterator.hasNext();) {
- org.eclipse.gmf.runtime.notation.Edge nextDiagramLink = (org.eclipse.gmf.runtime.notation.Edge) linksIterator.next();
- int diagramLinkVisualID = «EXPAND xpt::editor::VisualIDRegistry::getVisualIDMethodCall»(nextDiagramLink);
- if (diagramLinkVisualID == -1) {
- if (nextDiagramLink.getSource() != null && nextDiagramLink.getTarget() != null) {
- linksIterator.remove();
- }
- continue;
- }
- 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 linkDescriptorsIterator = linkDescriptors.iterator(); linkDescriptorsIterator.hasNext();) {
- «editorGen.diagramUpdater.getLinkDescriptorQualifiedClassName()» nextLinkDescriptor = («editorGen.diagramUpdater.getLinkDescriptorQualifiedClassName()») linkDescriptorsIterator.next();
- if (diagramLinkObject == nextLinkDescriptor.getModelElement() && diagramLinkSrc == nextLinkDescriptor.getSource() && diagramLinkDst == nextLinkDescriptor.getDestination() && diagramLinkVisualID == nextLinkDescriptor.getVisualID()) {
- linksIterator.remove();
- linkDescriptorsIterator.remove();
- break;
- }
- }
- }
- deleteViews(existingLinks.iterator());
- return createConnections(linkDescriptors, domain2NotationMap);
-}
-«ENDDEFINE»
-
-«DEFINE collectAllLinks FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-private java.util.Collection collectAllLinks(org.eclipse.gmf.runtime.notation.View view, java.util.Map domain2NotationMap) {
- if (!«EXPAND xpt::editor::VisualIDRegistry::modelID».equals(«EXPAND xpt::editor::VisualIDRegistry::getModelIDMethodCall»(view))) {
- return java.util.Collections.EMPTY_LIST;
- }
- java.util.Collection result = new java.util.LinkedList();
- switch («EXPAND xpt::editor::VisualIDRegistry::getVisualIDMethodCall»(view)) {
- «EXPAND caseSemanticElement FOREACH getAllSemanticElements(this)-»
- }
- for (java.util.Iterator children = view.getChildren().iterator(); children.hasNext();) {
- result.addAll(collectAllLinks((org.eclipse.gmf.runtime.notation.View) children.next(), domain2NotationMap));
- }
- for (java.util.Iterator edges = view.getSourceEdges().iterator(); edges.hasNext();) {
- result.addAll(collectAllLinks((org.eclipse.gmf.runtime.notation.View) edges.next(), domain2NotationMap));
- }
- return result;
-}
-«ENDDEFINE»
-
-«DEFINE caseSemanticElement FOR gmfgen::GenCommonBase-»
-«EXPAND xpt::Common::caseVisualID» {
- if (!domain2NotationMap.containsKey(view.getElement())) {
-«REM»
- Processing each domain element only once. Prevents us from
- having duplicated links if a shortcut to one of the "main"
- diagram elements present on diagram.
-«ENDREM»«-»
- result.addAll(«EXPAND xpt::diagram::updater::DiagramUpdater::getContainedLinksMethodCall»(view));
- }
- if (!domain2NotationMap.containsKey(view.getElement()) || view.getEAnnotation("Shortcut") == null) { «EXPAND xpt::Common::nonNLS»
-«REM»
- Storing element view or replacing shortcut by the "original" element view.
-«ENDREM»«-»
- domain2NotationMap.put(view.getElement(), view);
- }
- break;
-}
-«ENDDEFINE»
-
-«REM»
- GMF has no links to "leaf" child nodes.
-«ENDREM»
-«DEFINE caseSemanticElement FOR gmfgen::GenChildLabelNode»«ENDDEFINE»
-
-«DEFINE colectContainedLink FOR gmfgen::GenLink-»
-«EXPAND xpt::diagram::updater::DiagramUpdater::getContainedLinksMethodCall»(modelElement));
-«ENDDEFINE»
-
-«DEFINE createConnections FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-private java.util.Collection createConnections(java.util.Collection linkDescriptors, java.util.Map domain2NotationMap) {
- java.util.List adapters = new java.util.LinkedList();
- for (java.util.Iterator linkDescriptorsIterator = linkDescriptors.iterator(); linkDescriptorsIterator.hasNext();) {
- final «editorGen.diagramUpdater.getLinkDescriptorQualifiedClassName()» nextLinkDescriptor = («editorGen.diagramUpdater.getLinkDescriptorQualifiedClassName()») linkDescriptorsIterator.next();
- org.eclipse.gef.EditPart sourceEditPart = getEditPart(nextLinkDescriptor.getSource(), domain2NotationMap);
- org.eclipse.gef.EditPart targetEditPart = getEditPart(nextLinkDescriptor.getDestination(), domain2NotationMap);
- if (sourceEditPart == null || targetEditPart == null) {
- continue;
- }
- org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewRequest.ConnectionViewDescriptor descriptor = new org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewRequest.ConnectionViewDescriptor(nextLinkDescriptor.getSemanticAdapter(), null, org.eclipse.gmf.runtime.diagram.core.util.ViewUtil.APPEND, false, ((org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart) getHost()).getDiagramPreferencesHint());
- org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewRequest ccr = new org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewRequest(descriptor);
- ccr.setType(org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants.REQ_CONNECTION_START);
- ccr.setSourceEditPart(sourceEditPart);
- sourceEditPart.getCommand(ccr);
- ccr.setTargetEditPart(targetEditPart);
- ccr.setType(org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants.REQ_CONNECTION_END);
- org.eclipse.gef.commands.Command cmd = targetEditPart.getCommand(ccr);
- if (cmd != null && cmd.canExecute()) {
- executeCommand(cmd);
- org.eclipse.core.runtime.IAdaptable viewAdapter = (org.eclipse.core.runtime.IAdaptable) ccr.getNewObject();
- if (viewAdapter != null) {
- adapters.add(viewAdapter);
- }
- }
- }
- return adapters;
-}
-«ENDDEFINE»
-
-«DEFINE getEditPart FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-private org.eclipse.gef.EditPart getEditPart(org.eclipse.emf.ecore.EObject domainModelElement, java.util.Map domain2NotationMap) {
- org.eclipse.gmf.runtime.notation.View view = (org.eclipse.gmf.runtime.notation.View) domain2NotationMap.get(domainModelElement);
- if (view != null) {
- return (org.eclipse.gef.EditPart) getHost().getViewer().getEditPartRegistry().get(view);
- }
- return null;
-}
-«ENDDEFINE»
-
-«DEFINE getDiagram FOR gmfgen::GenContainerBase-»
- «EXPAND xpt::Common::generatedMemberComment»
-private org.eclipse.gmf.runtime.notation.Diagram getDiagram() {
- return ((org.eclipse.gmf.runtime.notation.View) getHost().getModel()).getDiagram();
-}
-«ENDDEFINE»
-
-«DEFINE incorrectLinkModelFacet FOR gmfgen::LinkModelFacet-»
- «ERROR "Incorrect LinkModelFacet: " + this»
-«ENDDEFINE»
-
-«DEFINE additions FOR gmfgen::GenDiagram»«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/editpolicies/DiagramItemSemanticEditPolicy.xpt b/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/editpolicies/DiagramItemSemanticEditPolicy.xpt
deleted file mode 100644
index ca466d9a0..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/editpolicies/DiagramItemSemanticEditPolicy.xpt
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright (c) 2006,2007 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:
- * Alexander Shatalin (Borland) - initial API and implementation
- */
-
-«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
-
-«DEFINE DiagramItemSemanticEditPolicy FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::copyright FOR getDiagram().editorGen-»
-package «editPoliciesPackageName»;
-
- «EXPAND xpt::Common::generatedClassComment»
-public class «itemSemanticEditPolicyClassName» extends «getBaseItemSemanticEditPolicyQualifiedClassName()» {
-
- «EXPAND xpt::diagram::editpolicies::BaseItemSemanticEditPolicy::defaultConstructor-»
-
- «EXPAND xpt::diagram::editpolicies::childContainerCreateCommand::childContainerCreateCommand FOR topLevelNodes-»
-
- «EXPAND getDuplicateCommand-»
-
- «EXPAND DuplicateAnythingCommand-»
-
- «EXPAND additions-»
-}
-«ENDDEFINE»
-
-«DEFINE getDuplicateCommand FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-protected org.eclipse.gef.commands.Command getDuplicateCommand(org.eclipse.gmf.runtime.emf.type.core.requests.DuplicateElementsRequest req) {
- org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain = ((org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart) getHost()).getEditingDomain();
- return getGEFWrapper(new DuplicateAnythingCommand(editingDomain, req));
-}
-«ENDDEFINE»
-
-«DEFINE DuplicateAnythingCommand FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedClassComment»
-private static class DuplicateAnythingCommand extends org.eclipse.gmf.runtime.emf.commands.core.commands.DuplicateEObjectsCommand {
-
- «EXPAND DAC_constructor-»
-
- «EXPAND DAC_additions-»
-}
-«ENDDEFINE»
-
-«DEFINE DAC_constructor FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-public DuplicateAnythingCommand(org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain, org.eclipse.gmf.runtime.emf.type.core.requests.DuplicateElementsRequest req) {
- super(editingDomain, req.getLabel(), req.getElementsToBeDuplicated(), req.getAllDuplicatedElementsMap());
-}
-«ENDDEFINE»
-
-«DEFINE DAC_additions FOR gmfgen::GenDiagram-»
-«ENDDEFINE»
-
-«DEFINE additions FOR gmfgen::GenDiagram-»
-«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/editpolicies/GraphicalNodeEditPolicy.xpt b/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/editpolicies/GraphicalNodeEditPolicy.xpt
deleted file mode 100644
index fc6a1f292..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/editpolicies/GraphicalNodeEditPolicy.xpt
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright (c) 2006, 2008 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:
- * Dmitry Stadnik (Borland) - initial API and implementation
- */
-
-«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
-
-«DEFINE GraphicalNodeEditPolicy FOR gmfgen::GenNode-»
-«EXPAND xpt::Common::copyright FOR getDiagram().editorGen-»
-package «getDiagram().editPoliciesPackageName»;
-
-«EXPAND xpt::Common::generatedClassComment»
-public class «graphicalNodeEditPolicyClassName» extends org.eclipse.gmf.runtime.diagram.ui.editpolicies.GraphicalNodeEditPolicy {
-
- «EXPAND xpt::Common::generatedClassComment»
- protected org.eclipse.gef.commands.Command getConnectionCompleteCommand(
- org.eclipse.gef.requests.CreateConnectionRequest request) {
- org.eclipse.gmf.runtime.emf.type.core.IElementType elementType = getElementType(request);
- «FOREACH reorientedIncomingLinks AS link-»
- if («EXPAND xpt::providers::ElementTypes::accessElementType FOR link» == elementType) {
- «IF link.outgoingCreationAllowed-»
- if (request.getSourceEditPart() != getHost()) {
- «ENDIF-»
- return getConnectionWithReorientedViewCompleteCommand(request);
- «IF link.outgoingCreationAllowed-»
- }
- «ENDIF-»
- }
- «ENDFOREACH-»
- return super.getConnectionCompleteCommand(request);
- }
-
- «EXPAND xpt::Common::generatedClassComment»
- protected org.eclipse.gmf.runtime.emf.type.core.IElementType getElementType(
- org.eclipse.gef.requests.CreateConnectionRequest request) {
- if (request instanceof org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewAndElementRequest) {
- org.eclipse.gmf.runtime.diagram.core.edithelpers.CreateElementRequestAdapter requestAdapter =
- ((org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewAndElementRequest) request)
- .getConnectionViewAndElementDescriptor().getCreateElementRequestAdapter();
- return (org.eclipse.gmf.runtime.emf.type.core.IElementType) requestAdapter.getAdapter(
- org.eclipse.gmf.runtime.emf.type.core.IElementType.class);
- }
- return null;
- }
-
- «EXPAND xpt::Common::generatedClassComment»
- protected org.eclipse.gef.commands.Command getConnectionWithReorientedViewCompleteCommand(
- org.eclipse.gef.requests.CreateConnectionRequest request) {
- org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy c =
- (org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy) super.getConnectionCompleteCommand(request);
- org.eclipse.gmf.runtime.common.core.command.CompositeCommand cc =
- (org.eclipse.gmf.runtime.common.core.command.CompositeCommand) c.getICommand();
- org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain =
- ((org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart) getHost()).getEditingDomain();
- «getDiagram().getReorientConnectionViewCommandQualifiedClassName()» rcvCommand =
- new «getDiagram().getReorientConnectionViewCommandQualifiedClassName()»(editingDomain, null);
- rcvCommand.setEdgeAdaptor(getViewAdapter());
- cc.compose(rcvCommand);
- return c;
- }
- «EXPAND additions-»
-}
-«ENDDEFINE»
-
-«DEFINE additions FOR gmfgen::GenNode»«ENDDEFINE»
diff --git a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/editpolicies/LinkItemSemanticEditPolicy.xpt b/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/editpolicies/LinkItemSemanticEditPolicy.xpt
deleted file mode 100644
index e2743a0d8..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/editpolicies/LinkItemSemanticEditPolicy.xpt
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright (c) 2007, 2008 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:
- * Alexander Shatalin (Borland) - initial API and implementation
- * Michael Golubev (Borland) - [243151] explicit source/target for links
- */
-
-«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
-«EXTENSION xpt::GenModelUtils»
-«EXTENSION xpt::diagram::editpolicies::LinkUtils»
-
-«DEFINE LinkItemSemanticEditPolicy FOR gmfgen::GenLink-»
- «EXPAND xpt::Common::copyright FOR diagram.editorGen-»
-package «getDiagram().editPoliciesPackageName»;
-
-«EXPAND xpt::Common::generatedClassComment»
-public class «itemSemanticEditPolicyClassName» extends «diagram.getBaseItemSemanticEditPolicyQualifiedClassName()» {
-
- «EXPAND xpt::diagram::editpolicies::BaseItemSemanticEditPolicy::defaultConstructor-»
-
- «EXPAND classBody-»
-
- «EXPAND additions-»
-}
-«ENDDEFINE»
-
-«DEFINE classBody FOR gmfgen::GenLink-»
- «EXPAND getDestroySemanticCommand FOR modelFacet -»
- «IF isTypeLink(this)-»
- «EXPAND xpt::diagram::editpolicies::linkCommands::linkCommands -»
- «ENDIF-»
-«ENDDEFINE»
-
-«DEFINE getDestroySemanticCommand FOR gmfgen::LinkModelFacet-»
- «ERROR "Unsupported model facet: " + this-»
-«ENDDEFINE»
-
-«DEFINE getDestroySemanticCommand FOR gmfgen::FeatureLinkModelFacet-»
- «EXPAND xpt::Common::generatedMemberComment»
-protected org.eclipse.gef.commands.Command getDestroyReferenceCommand(org.eclipse.gmf.runtime.emf.type.core.requests.DestroyReferenceRequest req) {
- return getGEFWrapper(new org.eclipse.gmf.runtime.emf.type.core.commands.DestroyReferenceCommand(req)«IF isContains(metaFeature)» {
-
- protected org.eclipse.gmf.runtime.common.core.command.CommandResult doExecuteWithResult(org.eclipse.core.runtime.IProgressMonitor progressMonitor, org.eclipse.core.runtime.IAdaptable info) throws org.eclipse.core.commands.ExecutionException {
- org.eclipse.emf.ecore.EObject referencedObject = getReferencedObject();
- org.eclipse.emf.ecore.resource.Resource resource = referencedObject.eResource();
- org.eclipse.gmf.runtime.common.core.command.CommandResult result = super.doExecuteWithResult(progressMonitor, info);
- resource.getContents().add(referencedObject);
- return result;
- }
-
- }«ENDIF»);
-}
-«ENDDEFINE»
-
-«DEFINE getDestroySemanticCommand FOR gmfgen::TypeLinkModelFacet-»
- «EXPAND xpt::Common::generatedMemberComment»
-protected org.eclipse.gef.commands.Command getDestroyElementCommand(org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest req) {
- return getGEFWrapper(new org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand(req));
-}
-«ENDDEFINE»
-
-«DEFINE additions FOR gmfgen::GenLink»«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/editpolicies/LinkUtils.ext b/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/editpolicies/LinkUtils.ext
deleted file mode 100644
index d2347600c..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/editpolicies/LinkUtils.ext
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright (c) 2007, 2008 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:
- * Alexander Shatalin (Borland) - initial API and implementation
- * Michael Golubev (Borland) - [243151] explicit source/target for links
- */
-
-import "http://www.eclipse.org/gmf/2008/GenModel";
-import "http://www.eclipse.org/emf/2002/Ecore";
-import "http://www.eclipse.org/emf/2002/GenModel";
-
-boolean isTypeLink(gmfgen::GenLink link) :
- {link.modelFacet}.typeSelect(gmfgen::TypeLinkModelFacet).size() > 0
-;
-
-boolean isRefLink(gmfgen::GenLink link) :
- {link.modelFacet}.typeSelect(gmfgen::FeatureLinkModelFacet).size() > 0
-;
-
-boolean canBeSource(gmfgen::GenLink link, gmfgen::GenLinkEnd linkEnd) :
- link.sources.contains(linkEnd)
-;
-
-boolean canBeTarget(gmfgen::GenLink link, gmfgen::GenLinkEnd linkEnd) :
- link.targets.contains(linkEnd)
-;
-
-boolean canBeContainer(gmfgen::GenLink link, genmodel::GenClass metaClass) :
- null != link.modelFacet && isCompatible(getContainerClass(link.modelFacet), metaClass)
-;
-
-private genmodel::GenClass getContainerClass(gmfgen::LinkModelFacet modelFacet) : null /* Should not be called */ ;
-
-private genmodel::GenClass getContainerClass(gmfgen::TypeLinkModelFacet modelFacet) :
- // can't use getSourceType() here as it respects sourceMetaFeature, which is irrelevant for containment
- modelFacet.childMetaFeature.genClass
-;
-
-private genmodel::GenClass getContainerClass(gmfgen::FeatureLinkModelFacet modelFacet) : modelFacet.getSourceType() ;
-
-private boolean isCompatible(genmodel::GenClass desiredType, genmodel::GenClass actualClass) :
- null != desiredType && desiredType.ecoreClass.isSuperTypeOf(actualClass.ecoreClass)
-; \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/editpolicies/NodeItemSemanticEditPolicy.xpt b/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/editpolicies/NodeItemSemanticEditPolicy.xpt
deleted file mode 100644
index bc7592766..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/editpolicies/NodeItemSemanticEditPolicy.xpt
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * Copyright (c) 2007, 2008 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:
- * Alexander Shatalin (Borland) - initial API and implementation
- */
-
-«REM»
- This template should be called only for non-design nodes (modelFacet != null)
- because *ItemSemanticEditPolicy responsible for dealing with semantic model
- elements and meaningless (should not be generated) for pure design nodes.
-«ENDREM»
-
-«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
-«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
-
-«EXTENSION xpt::diagram::editpolicies::Utils»
-
-«DEFINE NodeItemSemanticEditPolicy FOR gmfgen::GenNode-»
- «EXPAND xpt::Common::copyright FOR getDiagram().editorGen-»
-package «getDiagram().editPoliciesPackageName»;
-
-«EXPAND xpt::Common::generatedClassComment»
-public class «itemSemanticEditPolicyClassName» extends «getDiagram().getBaseItemSemanticEditPolicyQualifiedClassName()» {
-
- «EXPAND xpt::diagram::editpolicies::BaseItemSemanticEditPolicy::defaultConstructor-»
-
- «EXPAND xpt::diagram::editpolicies::childContainerCreateCommand::childContainerCreateCommand FOR childNodes-»
-
- «EXPAND getDestroyElementCommand-»
- «IF hasChildrenOrCompartments()-»
- «EXPAND addDestroyChildNodesCommand-»
- «ENDIF-»
- «EXPAND xpt::diagram::editpolicies::linkCommands::linkCommands-»
-
- «EXPAND additions-»
-}
-«ENDDEFINE»
-
-«DEFINE getDestroyElementCommand FOR gmfgen::GenNode-»
-«EXPAND xpt::Common::generatedMemberComment»
-protected org.eclipse.gef.commands.Command getDestroyElementCommand(org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest req) {
- org.eclipse.gef.commands.CompoundCommand cc = getDestroyEdgesCommand();
- «IF hasChildrenOrCompartments()-»
- addDestroyChildNodesCommand(cc);
- «ENDIF-»
- addDestroyShortcutsCommand(cc);
- «EXPAND destroySemanticElement-»
- return cc.unwrap();
-}
-«ENDDEFINE»
-
-«DEFINE destroySemanticElement FOR gmfgen::GenNode-»
- «EXPAND fixElementToDeleteIfShortcut-»
-cc.add(getGEFWrapper(new org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand(req)));
-«ENDDEFINE»
-
-«DEFINE addDestroyChildNodesCommand FOR gmfgen::GenNode-»
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected void addDestroyChildNodesCommand(org.eclipse.gef.commands.CompoundCommand cmd) {
- org.eclipse.gmf.runtime.notation.View view = (org.eclipse.gmf.runtime.notation.View) getHost().getModel();
- org.eclipse.emf.ecore.EAnnotation annotation = view.getEAnnotation("Shortcut"); «EXPAND xpt::Common::nonNLS»
- if (annotation != null) {
- return;
- }
- for (java.util.Iterator it = view.getChildren().iterator(); it.hasNext();) {
- org.eclipse.gmf.runtime.notation.Node node = (org.eclipse.gmf.runtime.notation.Node) it.next();
- switch («EXPAND xpt::editor::VisualIDRegistry::getVisualIDMethodCall FOR getDiagram()»(node)) {
- «EXPAND destroyChildNodes("node")-»
- «IF !compartments.isEmpty()-»
- «FOREACH compartments AS compartment-»
- «EXPAND xpt::Common::caseVisualID FOR 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();
- switch («EXPAND xpt::editor::VisualIDRegistry::getVisualIDMethodCall FOR getDiagram()»(cnode)) {
- «EXPAND destroyChildNodes("cnode") FOR compartment-»
- }
- }
- break;
- «ENDFOREACH-»
- «ENDIF-»
- }
- }
- }
-«ENDDEFINE»
-
-«DEFINE destroyChildNodes(String nodeVar) FOR gmfgen::GenChildContainer-»
- «FOREACH childNodes AS childNode-»
- «EXPAND xpt::Common::caseVisualID FOR childNode»
- cmd.add(getDestroyElementCommand(«nodeVar»));
- break;
- «ENDFOREACH-»
-«ENDDEFINE»
-
-
-«DEFINE fixElementToDeleteIfShortcut FOR gmfgen::GenTopLevelNode-»
- org.eclipse.gmf.runtime.notation.View view = (org.eclipse.gmf.runtime.notation.View) getHost().getModel();
- if (view.getEAnnotation("Shortcut") != null) { «EXPAND xpt::Common::nonNLS»
- req.setElementToDestroy(view);
- }
-«ENDDEFINE»
-
-«REM»Shortcuts supported only for top-level elements«ENDREM»
-«DEFINE fixElementToDeleteIfShortcut FOR gmfgen::GenNode»«ENDDEFINE»
-
-«DEFINE additions FOR gmfgen::GenNode»«ENDDEFINE»
diff --git a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/editpolicies/OpenDiagram.xpt b/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/editpolicies/OpenDiagram.xpt
deleted file mode 100644
index 9d42cbaee..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/editpolicies/OpenDiagram.xpt
+++ /dev/null
@@ -1,165 +0,0 @@
-/*
- * Copyright (c) 2007, 2008 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/2008/GenModel"»
-«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
-«EXTENSION xpt::diagram::editpolicies::Utils»
-
-«DEFINE OpenDiagram FOR gmfgen::OpenDiagramBehaviour»
-«EXPAND xpt::Common::copyright FOR subject.getDiagram().editorGen-»
-package «subject.getDiagram().editPoliciesPackageName»;
-
-«EXPAND xpt::Common::generatedClassComment»
-public class «editPolicyClassName» extends «EXPAND extendsList» {
-
-«EXPAND getOpenCommand-»
-
-«EXPAND openCommandClass-»
-
-«EXPAND additions-»
-}
-«ENDDEFINE»
-
-«DEFINE extendsList FOR OpenDiagramBehaviour»org.eclipse.gmf.runtime.diagram.ui.editpolicies.OpenEditPolicy«ENDDEFINE»
-
-«DEFINE getOpenCommand FOR OpenDiagramBehaviour»
- «EXPAND xpt::Common::generatedMemberComment»
- protected org.eclipse.gef.commands.Command getOpenCommand(org.eclipse.gef.Request request) {
- org.eclipse.gef.EditPart targetEditPart = getTargetEditPart(request);
- if (false == targetEditPart.getModel() instanceof org.eclipse.gmf.runtime.notation.View) {
- return null;
- }
- org.eclipse.gmf.runtime.notation.View view = (org.eclipse.gmf.runtime.notation.View) targetEditPart.getModel();
- org.eclipse.gmf.runtime.notation.Style link = view.getStyle(org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getHintedDiagramLinkStyle());
- if (false == link instanceof org.eclipse.gmf.runtime.notation.HintedDiagramLinkStyle) {
- return null;
- }
- return new org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy(new OpenDiagramCommand((org.eclipse.gmf.runtime.notation.HintedDiagramLinkStyle) link));
- }
-«ENDDEFINE»
-
-«DEFINE openCommandClass FOR OpenDiagramBehaviour»
- «EXPAND xpt::Common::generatedMemberComment»
- private static class OpenDiagramCommand extends org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand {
-
- «EXPAND xpt::Common::generatedMemberComment»
- private final org.eclipse.gmf.runtime.notation.HintedDiagramLinkStyle diagramFacet;
-
- «EXPAND xpt::Common::generatedMemberComment»
- OpenDiagramCommand(org.eclipse.gmf.runtime.notation.HintedDiagramLinkStyle linkStyle) {
- // editing domain is taken for original diagram,
- // if we open diagram from another file, we should use another editing domain
- super(org.eclipse.emf.transaction.util.TransactionUtil.getEditingDomain(linkStyle), «EXPAND xpt::Externalizer::accessorCall(i18nKeyForOpenCommandName()) FOR subject.getDiagram().editorGen», null);
- diagramFacet = linkStyle;
- }
-
- // FIXME canExecute if !(readOnly && getDiagramToOpen == null), i.e. open works on ro diagrams only when there's associated diagram already
-
- «EXPAND xpt::Common::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 {
- try {
- org.eclipse.gmf.runtime.notation.Diagram diagram = getDiagramToOpen();
- if (diagram == null) {
- diagram = intializeNewDiagram();
- }
- «EXPAND xpt::navigator::getEditorInput::defineURIEditorInput("diagram") FOR subject.getDiagram()-»
- org.eclipse.ui.IWorkbenchPage page = org.eclipse.ui.PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
- page.openEditor(editorInput, getEditorID());
- return org.eclipse.gmf.runtime.common.core.command.CommandResult.newOKCommandResult();
- } catch (Exception ex) {
- throw new org.eclipse.core.commands.ExecutionException("Can't open diagram", ex);
- }
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected org.eclipse.gmf.runtime.notation.Diagram getDiagramToOpen() {
- return diagramFacet.getDiagramLink();
- }
-
- «EXPAND xpt::Common::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);
- «EXPAND xpt::Common::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) {
- ((org.eclipse.gmf.runtime.notation.View) container).persist();
- container = container.eContainer();
- }
- try {
- «IF null == subject.getDiagram().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-»
- 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(«EXPAND xpt::Common::getSaveOptions FOR subject.getDiagram()»);
- }
- }
- «IF null == subject.getDiagram().editorGen.application-»
- } catch (java.io.IOException ex) {
- throw new java.lang.reflect.InvocationTargetException(ex, "Save operation failed");
- }
- }
- }.run(null);
- } catch (java.lang.reflect.InvocationTargetException e) {
- throw new org.eclipse.core.commands.ExecutionException("Can't create diagram of '" + getDiagramKind() + "' kind", e);
- } catch (InterruptedException e) {
- throw new org.eclipse.core.commands.ExecutionException("Can't create diagram of '" + getDiagramKind() + "' kind", e);
- }
- «ELSE-»
- } catch (java.io.IOException ex) {
- throw new org.eclipse.core.commands.ExecutionException("Can't create diagram of '" + getDiagramKind() + "' kind", ex);
- }
- «ENDIF-»
- return d;
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected org.eclipse.emf.ecore.EObject getDiagramDomainElement() {
- // use same element as associated with EP
- return ((org.eclipse.gmf.runtime.notation.View) diagramFacet.eContainer()).getElement();
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint getPreferencesHint() {
- // XXX prefhint from target diagram's editor?
- return «EXPAND xpt::plugin::Activator::preferenceHintAccess FOR subject.getDiagram().editorGen»;
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected String getDiagramKind() {
- return «IF diagramKind == null»«EXPAND xpt::editor::VisualIDRegistry::modelID FOR subject.getDiagram()»«ELSE»"«diagramKind»"«ENDIF»;
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected String getEditorID() {
- return «IF editorID == null»«subject.getDiagram().editorGen.editor.getQualifiedClassName()».ID«ELSE»"«editorID»"«ENDIF»;
- }
- }
-«ENDDEFINE»
-
-«DEFINE additions FOR OpenDiagramBehaviour»«ENDDEFINE»
-
-«DEFINE i18nAccessors FOR gmfgen::GenDiagram-»
-«EXPAND xpt::Externalizer::accessorField(i18nKeyForOpenCommandName())-»
-«ENDDEFINE»
-
-«DEFINE i18nValues FOR gmfgen::GenDiagram-»
-«EXPAND xpt::Externalizer::messageEntry(i18nKeyForOpenCommandName(), "Open Diagram")-»
-«ENDDEFINE»
-
diff --git a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/editpolicies/TextFeedback.xpt b/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/editpolicies/TextFeedback.xpt
deleted file mode 100644
index a162f8b60..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/editpolicies/TextFeedback.xpt
+++ /dev/null
@@ -1,203 +0,0 @@
-/*
- * Copyright (c) 2006, 2008 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:
- * Dmitry Stadnik (Borland) - initial API and implementation
- */
-
-«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
-«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
-
-«DEFINE TextSelectionEditPolicy FOR gmfgen::GenDiagram-»
-«EXPAND xpt::Common::copyright FOR editorGen-»
-package «editPoliciesPackageName»;
-
-«EXPAND xpt::Common::generatedClassComment»
-public class «textSelectionEditPolicyClassName» extends org.eclipse.gef.editpolicies.SelectionEditPolicy {
-
- «EXPAND textFeedback FOR this-»
-}
-«ENDDEFINE»
-
-«DEFINE TextNonResizableEditPolicy FOR gmfgen::GenDiagram-»
-«EXPAND xpt::Common::copyright FOR editorGen-»
-package «editPoliciesPackageName»;
-
-«EXPAND xpt::Common::generatedClassComment»
-public class «textNonResizableEditPolicyClassName» extends org.eclipse.gmf.runtime.diagram.ui.editpolicies.NonResizableEditPolicyEx {
-
- «EXPAND textFeedback FOR this-»
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected java.util.List createSelectionHandles() {
- org.eclipse.gef.handles.MoveHandle moveHandle =
- new org.eclipse.gef.handles.MoveHandle((org.eclipse.gef.GraphicalEditPart) getHost());
- moveHandle.setBorder(null);
- moveHandle.setDragTracker(new org.eclipse.gmf.runtime.diagram.ui.tools.DragEditPartsTrackerEx(getHost()));
- return java.util.Collections.singletonList(moveHandle);
- }
-}
-«ENDDEFINE»
-
-«DEFINE textFeedback FOR gmfgen::GenDiagram»
- «EXPAND xpt::Common::generatedMemberComment»
- private org.eclipse.draw2d.IFigure selectionFeedbackFigure;
-
- «EXPAND xpt::Common::generatedMemberComment»
- private org.eclipse.draw2d.IFigure focusFeedbackFigure;
-
- «EXPAND xpt::Common::generatedMemberComment»
- private org.eclipse.draw2d.FigureListener hostPositionListener;
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected void showPrimarySelection() {
- if (getHostFigure() instanceof org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) {
- ((org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) getHostFigure()).setSelected(true);
- ((org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) getHostFigure()).setFocus(true);
- } else {
- showSelection();
- showFocus();
- }
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected void showSelection() {
- if (getHostFigure() instanceof org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) {
- ((org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) getHostFigure()).setSelected(true);
- ((org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) getHostFigure()).setFocus(false);
- } else {
- hideSelection();
- addFeedback(selectionFeedbackFigure = createSelectionFeedbackFigure());
- getHostFigure().addFigureListener(getHostPositionListener());
- refreshSelectionFeedback();
- hideFocus();
- }
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected void hideSelection() {
- if (getHostFigure() instanceof org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) {
- ((org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) getHostFigure()).setSelected(false);
- ((org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) getHostFigure()).setFocus(false);
- } else {
- if (selectionFeedbackFigure != null) {
- removeFeedback(selectionFeedbackFigure);
- getHostFigure().removeFigureListener(getHostPositionListener());
- selectionFeedbackFigure = null;
- }
- hideFocus();
- }
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected void showFocus() {
- if (getHostFigure() instanceof org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) {
- ((org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) getHostFigure()).setFocus(true);
- } else {
- hideFocus();
- addFeedback(focusFeedbackFigure = createFocusFeedbackFigure());
- refreshFocusFeedback();
- }
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected void hideFocus() {
- if (getHostFigure() instanceof org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) {
- ((org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) getHostFigure()).setFocus(false);
- } else {
- if (focusFeedbackFigure != null) {
- removeFeedback(focusFeedbackFigure);
- focusFeedbackFigure = null;
- }
- }
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected org.eclipse.draw2d.geometry.Rectangle getFeedbackBounds() {
- org.eclipse.draw2d.geometry.Rectangle bounds;
- if (getHostFigure() instanceof org.eclipse.draw2d.Label) {
- bounds = ((org.eclipse.draw2d.Label) getHostFigure()).getTextBounds();
- bounds.intersect(getHostFigure().getBounds());
- } else {
- bounds = getHostFigure().getBounds().getCopy();
- }
- getHostFigure().getParent().translateToAbsolute(bounds);
- getFeedbackLayer().translateToRelative(bounds);
- return bounds;
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected org.eclipse.draw2d.IFigure createSelectionFeedbackFigure() {
- if (getHostFigure() instanceof org.eclipse.draw2d.Label) {
- org.eclipse.draw2d.Label feedbackFigure = new org.eclipse.draw2d.Label();
- feedbackFigure.setOpaque(true);
- feedbackFigure.setBackgroundColor(org.eclipse.draw2d.ColorConstants.menuBackgroundSelected);
- feedbackFigure.setForegroundColor(org.eclipse.draw2d.ColorConstants.menuForegroundSelected);
- return feedbackFigure;
- } else {
- org.eclipse.draw2d.RectangleFigure feedbackFigure = new org.eclipse.draw2d.RectangleFigure();
- feedbackFigure.setFill(false);
- return feedbackFigure;
- }
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected org.eclipse.draw2d.IFigure createFocusFeedbackFigure() {
- return new org.eclipse.draw2d.Figure() {
-
- protected void paintFigure(org.eclipse.draw2d.Graphics graphics) {
- graphics.drawFocus(getBounds().getResized(-1, -1));
- }
- };
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected void updateLabel(org.eclipse.draw2d.Label target) {
- org.eclipse.draw2d.Label source = (org.eclipse.draw2d.Label) getHostFigure();
- target.setText(source.getText());
- target.setTextAlignment(source.getTextAlignment());
- target.setFont(source.getFont());
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected void refreshSelectionFeedback() {
- if (selectionFeedbackFigure != null) {
- if (selectionFeedbackFigure instanceof org.eclipse.draw2d.Label) {
- updateLabel((org.eclipse.draw2d.Label) selectionFeedbackFigure);
- selectionFeedbackFigure.setBounds(getFeedbackBounds());
- } else {
- selectionFeedbackFigure.setBounds(getFeedbackBounds().expand(5, 5));
- }
- }
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected void refreshFocusFeedback() {
- if (focusFeedbackFigure != null) {
- focusFeedbackFigure.setBounds(getFeedbackBounds());
- }
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- public void refreshFeedback() {
- refreshSelectionFeedback();
- refreshFocusFeedback();
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- private org.eclipse.draw2d.FigureListener getHostPositionListener() {
- if (hostPositionListener == null) {
- hostPositionListener = new org.eclipse.draw2d.FigureListener() {
- public void figureMoved(org.eclipse.draw2d.IFigure source) {
- refreshFeedback();
- }
- };
- }
- return hostPositionListener;
- }
-«ENDDEFINE»
diff --git a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/editpolicies/Utils.ext b/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/editpolicies/Utils.ext
deleted file mode 100644
index 7ad1f488f..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/editpolicies/Utils.ext
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Copyright (c) 2007, 2008 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:
- * Alexander Shatalin (Borland) - initial API and implementation
- * Michael Golubev (Borland) - [243151] explicit source/target for links
- */
-
-import "http://www.eclipse.org/gmf/2008/GenModel";
-import "http://www.eclipse.org/emf/2002/Ecore";
-extension xpt::diagram::editpolicies::LinkUtils;
-extension xpt::GenModelUtils;
-
-boolean hasChildrenOrCompartments(gmfgen::GenNode node) :
- !node.childNodes.isEmpty() || !node.compartments.isEmpty()
-;
-
-String getContainerVariable(gmfgen::TypeLinkModelFacet modelFacet) :
- null != modelFacet.sourceMetaFeature
- ? "container"
- : "source"
-;
-
-List[gmfgen::GenLinkConstraints] getValidLinkConstraints(gmfgen::GenDiagram diagram) :
- diagram.links.select(l | null != l.creationConstraints && l.creationConstraints.isValid()).collect(l | l.creationConstraints)
-;
-
-List[gmfgen::GenLink] getAllPotentialLinks(gmfgen::GenLinkEnd linkEnd) :
- getAllRelatedLinks(linkEnd).select(link | isCreationAllowed(link))
-;
-
-List[gmfgen::GenLink] getReroutableTypeLinks(gmfgen::GenLinkEnd linkEnd) :
- getAllRelatedReroutableLinks(linkEnd).select(link | isTypeLink(link))
-;
-
-List[gmfgen::GenLink] getReroutableRefLinks(gmfgen::GenLinkEnd linkEnd) :
- getAllRelatedReroutableLinks(linkEnd).select(link | isRefLink(link))
-;
-
-//XXX[MG]: again, it would be better to use linkEnd.incomingLinks.union(linkEnd.outgoingLinks).toList()
-//but it will change the ordering and produce meaningless diff in the generated code
-private cached List[gmfgen::GenLink] getAllRelatedLinks(gmfgen::GenLinkEnd linkEnd) :
- linkEnd.getDiagram().links.select(link | canBeSource(link, linkEnd) || canBeTarget(link, linkEnd))
-;
-
-private cached List[gmfgen::GenLink] getAllRelatedReroutableLinks(gmfgen::GenLinkEnd linkEnd) :
- linkEnd.getDiagram().links.select(link | (canBeSource(link, linkEnd) && link.sourceReorientingAllowed) || (canBeTarget(link, linkEnd) && link.targetReorientingAllowed))
-;
-
-private boolean isCreationAllowed(gmfgen::GenLink link) :
- null != link.modelFacet &&
- (link.outgoingCreationAllowed || link.incomingCreationAllowed)
-;
-
-boolean createStartLinkCommand(gmfgen::GenLink link, gmfgen::GenLinkEnd linkEnd) :
- createStartOutgoingLinkCommand(link, linkEnd) || createStartIncomingLinkCommand(link, linkEnd)
-;
-
-boolean createStartOutgoingLinkCommand(gmfgen::GenLink link, gmfgen::GenLinkEnd linkEnd) :
- isSelf(link, linkEnd) || (isOutgoing(link, linkEnd) && link.outgoingCreationAllowed)
-;
-
-boolean createStartIncomingLinkCommand(gmfgen::GenLink link, gmfgen::GenLinkEnd linkEnd) :
- isIncoming(link, linkEnd) && link.incomingCreationAllowed
-;
-
-boolean createCompleteLinkCommand(gmfgen::GenLink link, gmfgen::GenLinkEnd linkEnd) :
- createCompleteIncomingLinkCommand(link, linkEnd) || createCompleteOutgoingLinkCommand(link, linkEnd)
-;
-
-boolean createCompleteIncomingLinkCommand(gmfgen::GenLink link, gmfgen::GenLinkEnd linkEnd) :
- isSelf(link, linkEnd) || (isIncoming(link, linkEnd) && link.outgoingCreationAllowed)
-;
-
-boolean createCompleteOutgoingLinkCommand(gmfgen::GenLink link, gmfgen::GenLinkEnd linkEnd) :
- isOutgoing(link, linkEnd) && link.incomingCreationAllowed
-;
-
-boolean checkSource(boolean reversedRequest, boolean isCompleteCommand) :
- !reversedRequest || isCompleteCommand
-;
-
-boolean checkTarget(boolean reversedRequest, boolean isCompleteCommand) :
- reversedRequest || isCompleteCommand
-;
-
-private boolean isSelf(gmfgen::GenLink link, gmfgen::GenLinkEnd linkEnd) :
- canBeSource(link, linkEnd) && canBeTarget(link, linkEnd)
-;
-
-private boolean isOutgoing(gmfgen::GenLink link, gmfgen::GenLinkEnd linkEnd) :
- canBeSource(link, linkEnd) && !canBeTarget(link, linkEnd)
-;
-
-private boolean isIncoming(gmfgen::GenLink link, gmfgen::GenLinkEnd linkEnd) :
- canBeTarget(link, linkEnd) && !canBeSource(link, linkEnd)
-;
-
-String i18nKeyForOpenCommandName() :
-"CommandName.OpenDiagram"
-;
diff --git a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/editpolicies/childContainerCreateCommand.xpt b/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/editpolicies/childContainerCreateCommand.xpt
deleted file mode 100644
index 5fa2c7a1d..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/editpolicies/childContainerCreateCommand.xpt
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (c) 2007, 2008 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:
- * Alexander Shatalin (Borland) - initial API and implementation
- */
-
-«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
-«EXTENSION xpt::GenModelUtils»
-
-«DEFINE childContainerCreateCommand FOR List[gmfgen::GenNode]-»
-«IF !isEmpty()-»
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected org.eclipse.gef.commands.Command getCreateCommand(org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest req) {
-«FOREACH this AS n-»
- «EXPAND childNodeCreateCommand(n) FOR n.modelFacet-»
-«ENDFOREACH-»
- return super.getCreateCommand(req);
- }
-«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE childNodeCreateCommand(gmfgen::GenNode node) FOR gmfgen::TypeModelFacet-»
-if («EXPAND xpt::providers::ElementTypes::accessElementType FOR node» == req.getElementType()) {
- return getGEFWrapper(new «node.getCreateCommandQualifiedClassName()»(req));
-}
-«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/editpolicies/linkCommands.xpt b/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/editpolicies/linkCommands.xpt
deleted file mode 100644
index 7b253fec4..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/editpolicies/linkCommands.xpt
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * Copyright (c) 2007, 2008 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:
- * Alexander Shatalin (Borland) - initial API and implementation
- * Dmitry Stadnik (Borland) - creation logic was moved in commands
- * Michael Golubev (Borland) - [243151] explicit source/target for links
- */
-
-«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
-«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
-«EXTENSION xpt::diagram::editpolicies::Utils»
-«EXTENSION xpt::GenModelUtils»
-
-«REM»
- * Start start of link creation.
- * User click to this editpart and start dragging with link tool.
- * Complete end of the command
- * User points to this editpart as a link target and release mouse button.
- *
- * Outgoing the node is link source
- * This element could be a source for this type of link.
- * Incoming the node is link destination
- * This element could be a target for this type of link.
- *
- * Parameters:
- *
- * diagram GenDiagram used to collect all defined links
- *
- * this Instance of GenLinkEnd for the element link could be creates to/from.
- * This could be GenNode or GenLink in case of links to links,
- * in the latter case it is assumed that its a TypeLink (so its model facet is LinkTypeModelFacet),
- * because RefLinks don't have underlying semantic identity
- *
-«ENDREM»
-
-«DEFINE linkCommands FOR gmfgen::GenLinkEnd-»
- «IF getAllPotentialLinks(this).size() > 0-»
- «EXPAND createLinkCommands -»
- «ENDIF-»
- «IF getReroutableTypeLinks(this).size() > 0-»
- «EXPAND reorientTypeLinkCommands -»
- «ENDIF-»
- «IF getReroutableRefLinks(this).size() > 0-»
- «EXPAND reorientRefLinkCommands -»
- «ENDIF-»
-«ENDDEFINE»
-
-«DEFINE createLinkCommands FOR gmfgen::GenLinkEnd-»
-
-«EXPAND xpt::Common::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);
-}
-
-«EXPAND xpt::Common::generatedMemberComment»
-protected org.eclipse.gef.commands.Command getStartCreateRelationshipCommand(
- org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest req) {
- «EXPAND startLinkCommands(this) FOREACH getAllPotentialLinks(this)-»
- return null;
-}
-
-«EXPAND xpt::Common::generatedMemberComment»
-protected org.eclipse.gef.commands.Command getCompleteCreateRelationshipCommand(
- org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest req) {
- «EXPAND completeLinkCommands(this) FOREACH getAllPotentialLinks(this)-»
- return null;
-}
-«ENDDEFINE»
-
-«DEFINE startLinkCommands(gmfgen::GenLinkEnd linkEnd) FOR gmfgen::GenLink-»
-if («EXPAND xpt::providers::ElementTypes::accessElementType» == req.getElementType()) {
- «IF createStartLinkCommand(this, linkEnd)-»
- return getGEFWrapper(new «getCreateCommandQualifiedClassName()»(req,
- «IF createStartIncomingLinkCommand(this, linkEnd)-»
- req.getTarget(), req.getSource()
- «ELSE-»
- req.getSource(), req.getTarget()
- «ENDIF-»
- ));
- «ELSE-»
- return null;
- «ENDIF-»
-}
-«ENDDEFINE»
-
-«DEFINE completeLinkCommands(gmfgen::GenLinkEnd linkEnd) FOR gmfgen::GenLink-»
-if («EXPAND xpt::providers::ElementTypes::accessElementType» == req.getElementType()) {
- «IF createCompleteLinkCommand(this, linkEnd)-»
- return getGEFWrapper(new «getCreateCommandQualifiedClassName()»(req,
- «IF createCompleteOutgoingLinkCommand(this, linkEnd)-»
- req.getTarget(), req.getSource()
- «ELSE-»
- req.getSource(), req.getTarget()
- «ENDIF-»
- ));
- «ELSE-»
- return null;
- «ENDIF-»
-}
-«ENDDEFINE»
-
-«DEFINE reorientTypeLinkCommands FOR gmfgen::GenLinkEnd-»
-
-«EXPAND xpt::Common::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) {
- switch (getVisualID(req)) {
- «EXPAND reorientLinkCommand FOREACH getReroutableTypeLinks(this)-»
- }
- return super.getReorientRelationshipCommand(req);
-}
-«ENDDEFINE»
-
-«DEFINE reorientRefLinkCommands FOR gmfgen::GenLinkEnd-»
-
-«EXPAND xpt::Common::generatedMemberComment(
- "Returns command to reorient EReference 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 getReorientReferenceRelationshipCommand(
- org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest req) {
- switch (getVisualID(req)) {
- «EXPAND reorientLinkCommand FOREACH getReroutableRefLinks(this)-»
- }
- return super.getReorientReferenceRelationshipCommand(req);
-}
-«ENDDEFINE»
-
-«DEFINE reorientLinkCommand FOR gmfgen::GenLink-»
-«EXPAND xpt::Common::caseVisualID»
- return getGEFWrapper(new «getReorientCommandQualifiedClassName()»(req));
-«ENDDEFINE»
diff --git a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/preferences/PreferenceInitializer.xpt b/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/preferences/PreferenceInitializer.xpt
deleted file mode 100644
index 4dd3264a9..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/preferences/PreferenceInitializer.xpt
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * Copyright (c) 2007 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:
- * Dmitry Stadnik (Borland) - initial API and implementation
- */
-
-«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
-«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
-
-«EXTENSION xpt::diagram::Utils»
-
-«DEFINE className FOR gmfgen::GenDiagram»DiagramPreferenceInitializer«ENDDEFINE»
-
-«DEFINE qualifiedClassName FOR gmfgen::GenDiagram»«preferencesPackageName».«EXPAND className»«ENDDEFINE»
-
-«DEFINE PreferenceInitializer FOR gmfgen::GenDiagram-»
-«EXPAND xpt::Common::copyright FOR editorGen-»
-package «preferencesPackageName»;
-
-«EXPAND xpt::Common::generatedClassComment»
-public class «EXPAND className» extends org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer {
-
- «EXPAND xpt::Common::generatedMemberComment»
- public void initializeDefaultPreferences() {
- org.eclipse.jface.preference.IPreferenceStore store = getPreferenceStore();
-«IF preferences == null-»
- «EXPAND initDefaults("store") FOREACH allPreferencePages(this)»
-«ELSE»«REM»default values for predefined pages will be set manually«ENDREM-»
- «EXPAND initDefaults("store") FOREACH allPreferencePages(this).typeSelect(GenCustomPreferencePage)»
- «EXPAND initDefaults("store") FOR preferences-»
-«ENDIF-»
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected org.eclipse.jface.preference.IPreferenceStore getPreferenceStore() {
- return «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().getPreferenceStore();
- }
-}
-«ENDDEFINE»
-
-«DEFINE initDefaults(String storeVar) FOR gmfgen::GenPreferencePage»«ERROR "Abstract define for " + this»«ENDDEFINE»
-
-«DEFINE initDefaults(String storeVar) FOR gmfgen::GenStandardPreferencePage-»
-«EXPAND impl::preferences::StandardPage::call_initDefaults(storeVar)»
-«ENDDEFINE»
-
-«DEFINE initDefaults(String storeVar) FOR gmfgen::GenCustomPreferencePage-»
-«EXPAND impl::preferences::CustomPage::call_initDefaults(storeVar)»
-«ENDDEFINE»
-
-«DEFINE initDefaults(String storeVar) FOR gmfgen::GenDiagramPreferences»
- «storeVar».setDefault(org.eclipse.gmf.runtime.diagram.ui.preferences.IPreferenceConstants.PREF_SHOW_CONNECTION_HANDLES, «showConnectionHandles»);
- «storeVar».setDefault(org.eclipse.gmf.runtime.diagram.ui.preferences.IPreferenceConstants.PREF_SHOW_POPUP_BARS, «showPopupBars»);
- «storeVar».setDefault(org.eclipse.gmf.runtime.diagram.ui.preferences.IPreferenceConstants.PREF_ENABLE_ANIMATED_LAYOUT, «enableAnimatedLayout»);
- «storeVar».setDefault(org.eclipse.gmf.runtime.diagram.ui.preferences.IPreferenceConstants.PREF_ENABLE_ANIMATED_ZOOM, «enableAnimatedZoom»);
- «storeVar».setDefault(org.eclipse.gmf.runtime.diagram.ui.preferences.IPreferenceConstants.PREF_ENABLE_ANTIALIAS, «enableAntiAlias»);
- «EXPAND initDefaultFont(storeVar, "PREF_DEFAULT_FONT") FOR defaultFont-»
- «EXPAND initDefaultColor(storeVar, "PREF_FONT_COLOR") FOR fontColor-»
- «EXPAND initDefaultColor(storeVar, "PREF_FILL_COLOR") FOR fillColor-»
- «EXPAND initDefaultColor(storeVar, "PREF_LINE_COLOR") FOR lineColor-»
- «EXPAND initDefaultColor(storeVar, "PREF_NOTE_FILL_COLOR") FOR noteFillColor-»
- «EXPAND initDefaultColor(storeVar, "PREF_NOTE_LINE_COLOR") FOR noteLineColor-»
- «storeVar».setDefault(org.eclipse.gmf.runtime.diagram.ui.preferences.IPreferenceConstants.PREF_LINE_STYLE, org.eclipse.gmf.runtime.notation.Routing.«lineStyle»);
- «storeVar».setDefault(org.eclipse.gmf.runtime.diagram.ui.preferences.IPreferenceConstants.PREF_SHOW_RULERS, «showRulers»);
- «storeVar».setDefault(org.eclipse.gmf.runtime.diagram.ui.preferences.IPreferenceConstants.PREF_RULER_UNITS, org.eclipse.gef.rulers.RulerProvider.UNIT_«rulerUnits»);
- «storeVar».setDefault(org.eclipse.gmf.runtime.diagram.ui.preferences.IPreferenceConstants.PREF_SHOW_GRID, «showGrid»);
- «storeVar».setDefault(org.eclipse.gmf.runtime.diagram.ui.preferences.IPreferenceConstants.PREF_SNAP_TO_GRID, «snapToGrid»);
- «storeVar».setDefault(org.eclipse.gmf.runtime.diagram.ui.preferences.IPreferenceConstants.PREF_SNAP_TO_GEOMETRY, «snapToGeometry»);
- «storeVar».setDefault(org.eclipse.gmf.runtime.diagram.ui.preferences.IPreferenceConstants.PREF_GRID_SPACING, «gridSpacing»);
- «storeVar».setDefault(org.eclipse.gmf.runtime.diagram.ui.preferences.IPreferenceConstants.PREF_PROMPT_ON_DEL_FROM_MODEL, «promptOnDelFromModel»);
- «storeVar».setDefault(org.eclipse.gmf.runtime.diagram.ui.preferences.IPreferenceConstants.PREF_PROMPT_ON_DEL_FROM_DIAGRAM, «promptOnDelFromDiagram»);
-«ENDDEFINE»
-
-«DEFINE initDefaultColor(String storeVar, String prefName) FOR gmfgen::GenColor»
- org.eclipse.jface.preference.PreferenceConverter.setDefault(«storeVar»,
- org.eclipse.gmf.runtime.diagram.ui.preferences.IPreferenceConstants.«prefName», «EXPAND rgb»);
-«ENDDEFINE»
-
-«DEFINE initDefaultFont(String storeVar, String prefName) FOR gmfgen::GenFont»
- org.eclipse.jface.preference.PreferenceConverter.setDefault(«storeVar»,
- org.eclipse.gmf.runtime.diagram.ui.preferences.IPreferenceConstants.«prefName», «EXPAND fontData»);
-«ENDDEFINE»
-
-«DEFINE rgb FOR gmfgen::GenColor»
- «ERROR "Unknown colour: " + this»
-«ENDDEFINE»
-
-«DEFINE rgb FOR gmfgen::GenConstantColor»
- org.eclipse.gmf.runtime.diagram.ui.figures.DiagramColorConstants.«name».getRGB()
-«ENDDEFINE»
-
-«DEFINE rgb FOR gmfgen::GenRGBColor»
- new org.eclipse.swt.graphics.RGB(«red», «green», «blue»)
-«ENDDEFINE»
-
-«DEFINE fontData FOR gmfgen::GenFont»
- «ERROR "Unknown font: " + this»
-«ENDDEFINE»
-
-«DEFINE fontData FOR gmfgen::GenCustomFont»
- new org.eclipse.swt.graphics.FontData("«name»", «height», org.eclipse.swt.SWT.«style»)
-«ENDDEFINE»
-
-«DEFINE fontData FOR gmfgen::GenStandardFont»
- org.eclipse.jface.resource.JFaceResources.get«name»Font().getFontData()
-«ENDDEFINE»
diff --git a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/preferences/extensions.xpt b/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/preferences/extensions.xpt
deleted file mode 100644
index 62f1f7285..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/preferences/extensions.xpt
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright (c) 2007, 2008 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:
- * Dmitry Stadnik (Borland) - initial API and implementation
- */
-
-«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
-«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
-
-«EXTENSION xpt::diagram::Utils»
-
-«DEFINE extensions FOR gmfgen::GenDiagram-»
-
- <extension point="org.eclipse.core.runtime.preferences" id="prefs">
- «EXPAND xpt::Common::xmlGeneratedTag»
- <initializer class="«EXPAND xpt::diagram::preferences::PreferenceInitializer::qualifiedClassName»"/>
- </extension>
-
-«IF preferencePages.size() > 0-»
- <extension point="org.eclipse.ui.preferencePages" id="prefpages">
- «EXPAND xpt::Common::xmlGeneratedTag»
-«EXPAND preferencePage FOREACH allPreferencePages()-»
- </extension>
-«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE preferencePage FOR gmfgen::GenPreferencePage-»
- <page
- id="«iD»"
- name="%prefpage.«iD»"
-«IF null != parent-»
- category="«parent.iD»"
-«ENDIF-»
- class="«getQualifiedClassName()»">
- </page>
-«ENDDEFINE»
-
-«DEFINE i18n FOR gmfgen::GenDiagram»
-# Preferences
-«FOREACH allPreferencePages() AS p-»
-prefpage.«p.iD»=«p.name»
-«ENDFOREACH»
-«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/updater/DiagramUpdater.xpt b/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/updater/DiagramUpdater.xpt
deleted file mode 100644
index 5c8ed70f2..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/updater/DiagramUpdater.xpt
+++ /dev/null
@@ -1,487 +0,0 @@
-/*
- * Copyright (c) 2007, 2008 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:
- * Alexander Shatalin (Borland) - initial API and implementation
- * Michael Golubev (Borland) - [243151] explicit source/target for links
- */
-
-«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
-«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
-«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
-
-«EXTENSION xpt::diagram::updater::Utils»
-«EXTENSION xpt::diagram::editpolicies::LinkUtils»
-«EXTENSION xpt::GenModelUtils»
-
-«DEFINE DiagramUpdater FOR gmfgen::GenDiagramUpdater-»
- «EXPAND xpt::Common::copyright FOR editorGen-»
-package «editorGen.editor.packageName»;
-
- «EXPAND xpt::Common::generatedClassComment»
-public class «diagramUpdaterClassName» {
- «EXPAND isShortcutOrphaned-»
-«LET editorGen.diagram.getAllContainers().select(container | hasSemanticChildren(container)) AS semanticContainers-»
-
- «EXPAND getGenericSemanticChildrenOfView(semanticContainers)-»
- «EXPAND getSemanticChildrenOfView FOREACH semanticContainers-»
- «EXPAND getPhantomNodesIterator-»
-«ENDLET-»
-
- «EXPAND getGenericConnectedLinks(getAllSemanticElements(editorGen.diagram), getContainedLinksMethodNameSuffix())-»
-
- «EXPAND getGenericConnectedLinks(getAllSemanticDiagramElements(editorGen.diagram), getIncomingLinksMethodNameSuffix())-»
-
- «EXPAND getGenericConnectedLinks(getAllSemanticDiagramElements(editorGen.diagram), getOutgoingLinksMethodNameSuffix())-»
- «EXPAND getContainedLinks FOREACH getAllSemanticElements(editorGen.diagram)-»
- «EXPAND getIncomingLinks FOREACH getAllSemanticDiagramElements(editorGen.diagram)-»
- «EXPAND getOutgoingLinks FOREACH getAllSemanticDiagramElements(editorGen.diagram)-»
- «EXPAND getContainedLinksByTypeMethod FOREACH getAllContainedLinks(editorGen.diagram)-»
- «EXPAND getIncomingLinksByTypeMethod FOREACH getAllIncomingLinks(editorGen.diagram)-»
- «EXPAND getOutgoingLinksByTypeMethod FOREACH getAllOutgoingLinks(editorGen.diagram)-»
-
- «EXPAND additions-»
-}
-«ENDDEFINE»
-
-«REM»
- Currently shortcuts are supported only for domain-based diagram element.
- This means, view.isSetElement() == true.
-«ENDREM»
-«DEFINE isShortcutOrphaned FOR gmfgen::GenDiagramUpdater-»
- «IF !editorGen.diagram.containsShortcutsTo.isEmpty()-»
-
- «EXPAND xpt::Common::generatedMemberComment»
-public static boolean isShortcutOrphaned(org.eclipse.gmf.runtime.notation.View view) {
- return !view.isSetElement() || view.getElement() == null || view.getElement().eIsProxy();
-}
- «ENDIF-»
-«ENDDEFINE»
-
-«DEFINE getGenericSemanticChildrenOfView(List[gmfgen::GenContainerBase] semanticContainers) FOR gmfgen::GenDiagramUpdater-»
- «EXPAND xpt::Common::generatedMemberComment»
-public static java.util.List getSemanticChildren(org.eclipse.gmf.runtime.notation.View view) {
- «IF !semanticContainers.isEmpty()-»
- switch («EXPAND xpt::editor::VisualIDRegistry::getVisualIDMethodCall FOR editorGen.diagram»(view)) {
- «EXPAND getSemanticChildrenCase FOREACH semanticContainers-»
- }
- «ENDIF-»
- return java.util.Collections.EMPTY_LIST;
-}
-«ENDDEFINE»
-
-«DEFINE getSemanticChildrenCase FOR gmfgen::GenContainerBase-»
-«EXPAND xpt::Common::caseVisualID»
- return «EXPAND getSemanticChildrenMethodName»(view);
-«ENDDEFINE»
-
-«DEFINE getSemanticChildrenOfView FOR gmfgen::GenContainerBase-»
-
- «EXPAND xpt::Common::generatedMemberComment»
-public static java.util.List «EXPAND getSemanticChildrenMethodName»(org.eclipse.gmf.runtime.notation.View view) {
- «IF getSemanticChildrenChildFeatures(this).size() > 0 || getPhantomNodes(this).size() > 0-»
- «EXPAND defineModelElement-»
- java.util.List result = new java.util.LinkedList();
-«REM»childMetaFeature can be null here!«ENDREM»«-»
- «FOREACH getSemanticChildrenChildFeatures(this) AS childMetaFeature-»
- «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 isListType(childMetaFeature)-»
- for (java.util.Iterator it = «EXPAND MetaModel::getFeatureValue("modelElement", getModelElementType()) FOR childMetaFeature».iterator(); it.hasNext();) {
- «EXPAND MetaModel::DeclareAndAssign("childElement", "it.next()", true) FOR getTypeGenClassX(childMetaFeature)»
- «ELSE-»
- { «EXPAND MetaModel::DeclareAndAssign("childElement", "modelElement", getModelElementType(), childMetaFeature) FOR getTypeGenClassX(childMetaFeature)»
- «ENDIF-»
- int visualID = «EXPAND xpt::editor::VisualIDRegistry::getNodeVisualIDMethodCall FOR getDiagram()»(view, «EXPAND MetaModel::DowncastToEObject("childElement") FOR getTypeGenClassX(childMetaFeature)»);
- «EXPAND checkChildElementVisualID(null != childMetaFeature && isListType(childMetaFeature)) FOREACH getSemanticChildren(this, childMetaFeature)-»
- }
- «ENDFOREACH-»
- «IF !getPhantomNodes(this).isEmpty()-»
- org.eclipse.emf.ecore.resource.Resource resource = modelElement.eResource();
- for (java.util.Iterator semanticIterator = getPhantomNodesIterator(resource); semanticIterator.hasNext();) {
- org.eclipse.emf.ecore.EObject childElement = (org.eclipse.emf.ecore.EObject) semanticIterator.next();
- if (childElement == modelElement) {
- continue;
- }
- «EXPAND addNextIfPhantom FOREACH getPhantomNodes(this)-»
- }
- «ENDIF-»
- return result;
- «ELSE-»
- return java.util.Collections.EMPTY_LIST;
- «ENDIF-»
-}
-«ENDDEFINE»
-
-«DEFINE defineModelElement FOR gmfgen::GenContainerBase-»
-if (!view.isSetElement()) {
- return java.util.Collections.EMPTY_LIST;
-}
-«EXPAND MetaModel::DeclareAndAssign("modelElement", "view.getElement()") FOR getModelElementType()»
-«ENDDEFINE»
-
-«DEFINE defineModelElement FOR gmfgen::GenCompartment-»
-if (false == view.eContainer() instanceof org.eclipse.gmf.runtime.notation.View) {
- return java.util.Collections.EMPTY_LIST;
-}
-org.eclipse.gmf.runtime.notation.View containerView = (org.eclipse.gmf.runtime.notation.View) view.eContainer();
-if (!containerView.isSetElement()) {
- return java.util.Collections.EMPTY_LIST;
-}
-«EXPAND MetaModel::DeclareAndAssign("modelElement", "containerView.getElement()") FOR getModelElementType()»
-«ENDDEFINE»
-
-«DEFINE getSemanticChildrenMethodName FOR gmfgen::GenContainerBase»get«getUniqueIdentifier()»SemanticChildren«ENDDEFINE»
-
-«DEFINE getSemanticChildrenMethodCall FOR gmfgen::GenContainerBase»«getDiagram().editorGen.diagramUpdater.getDiagramUpdaterQualifiedClassName()».«EXPAND getSemanticChildrenMethodName»«ENDDEFINE»
-
-«DEFINE checkChildElementVisualID(boolean inLoop) FOR gmfgen::GenNode-»
-if (visualID == «EXPAND xpt::editor::VisualIDRegistry::visualID») {
- result.add(new «getDiagram().editorGen.diagramUpdater.getNodeDescriptorQualifiedClassName()»(«IF null != modelFacet.childMetaFeature»«EXPAND MetaModel::DowncastToEObject("childElement") FOR getTypeGenClassX(modelFacet.childMetaFeature)»«ENDIF», visualID));
-«IF inLoop-»
- continue;
-«ENDIF-»
-}
-«ENDDEFINE»
-
-«DEFINE addNextIfPhantom FOR gmfgen::GenNode-»
-if («EXPAND xpt::editor::VisualIDRegistry::getNodeVisualIDMethodCall FOR getDiagram()»(view, childElement) == «EXPAND xpt::editor::VisualIDRegistry::visualID») {
- result.add(new «getDiagram().editorGen.diagramUpdater.getNodeDescriptorQualifiedClassName()»(childElement, «EXPAND xpt::editor::VisualIDRegistry::visualID»));
- continue;
-}
-«ENDDEFINE»
-
-
-«DEFINE getPhantomNodesIterator FOR gmfgen::GenDiagramUpdater-»
- «IF !getPhantomNodes(editorGen.diagram).isEmpty()-»
-
- «EXPAND xpt::Common::generatedMemberComment»
-private static java.util.Iterator getPhantomNodesIterator(org.eclipse.emf.ecore.resource.Resource resource) {
- return resource.getAllContents();
-}
- «ENDIF-»
-«ENDDEFINE»
-
-«DEFINE getGenericConnectedLinks(List[gmfgen::GenCommonBase] linkContainers, String methodNameSuffix) FOR gmfgen::GenDiagramUpdater-»
- «EXPAND xpt::Common::generatedMemberComment»
-public static java.util.List get«methodNameSuffix»Links(org.eclipse.gmf.runtime.notation.View view) {
- «IF !linkContainers.isEmpty()-»
- switch («EXPAND xpt::editor::VisualIDRegistry::getVisualIDMethodCall FOR editorGen.diagram»(view)) {
- «EXPAND getContainedLinksCase(methodNameSuffix) FOREACH linkContainers-»
- }
- «ENDIF-»
- return java.util.Collections.EMPTY_LIST;
-}
-«ENDDEFINE»
-
-«DEFINE getContainedLinksCase(String methodNameSuffix) FOR gmfgen::GenCommonBase-»
-«EXPAND xpt::Common::caseVisualID»
- return «EXPAND linkGetterName(methodNameSuffix)»(view);
-«ENDDEFINE»
-
-«REM»This DEFING can be used from other templates to inject call to the corresponding method«ENDREM»
-«DEFINE getContainedLinksMethodCall FOR gmfgen::GenCommonBase»«getDiagram().editorGen.diagramUpdater.getDiagramUpdaterQualifiedClassName()».«EXPAND linkGetterName(getContainedLinksMethodNameSuffix())»«ENDDEFINE»
-
-«REM»This DEFING can be used from other templates to inject call to the corresponding method«ENDREM»
-«DEFINE getIncomingLinksMethodCall FOR gmfgen::GenCommonBase»«getDiagram().editorGen.diagramUpdater.getDiagramUpdaterQualifiedClassName()».«EXPAND linkGetterName(getIncomingLinksMethodNameSuffix())»«ENDDEFINE»
-
-«REM»This DEFING can be used from other templates to inject call to the corresponding method«ENDREM»
-«DEFINE getOutgoingLinksMethodCall FOR gmfgen::GenCommonBase»«getDiagram().editorGen.diagramUpdater.getDiagramUpdaterQualifiedClassName()».«EXPAND linkGetterName(getOutgoingLinksMethodNameSuffix())»«ENDDEFINE»
-
-«DEFINE linkGetterName(String suffix) FOR gmfgen::GenCommonBase»get«getUniqueIdentifier()»«suffix»Links«ENDDEFINE»
-
-«DEFINE getContainedLinks FOR gmfgen::GenCommonBase-»
- «EXPAND getConnectedLinks(getContainedLinks(getMetaClass(this), getDiagram()), getContainedLinksMethodNameSuffix(), false)-»
-«ENDDEFINE»
-
-«DEFINE getIncomingLinks FOR gmfgen::GenLinkEnd-»
- «EXPAND getConnectedLinks(getIncomingLinks(this), getIncomingLinksMethodNameSuffix(), true)-»
-«ENDDEFINE»
-
-«DEFINE getOutgoingLinks FOR gmfgen::GenLinkEnd-»
- «EXPAND getConnectedLinks(getOutgoingLinks(this), getOutgoingLinksMethodNameSuffix(), false)-»
-«ENDDEFINE»
-
-«DEFINE getConnectedLinks(List[gmfgen::GenLink] genLinks, String methodNameSuffix, boolean needCrossReferencer) FOR gmfgen::GenCommonBase-»
-
- «EXPAND xpt::Common::generatedMemberComment»
-public static java.util.List «EXPAND linkGetterName(methodNameSuffix)»(org.eclipse.gmf.runtime.notation.View view) {
- «IF !genLinks.isEmpty()-»
- «LET getMetaClass(this) AS metaclass-»
- «EXPAND MetaModel::DeclareAndAssign("modelElement", "view.getElement()") FOR metaclass»
- «IF needCrossReferencer-»
- java.util.Map crossReferences = org.eclipse.emf.ecore.util.EcoreUtil.CrossReferencer.find(view.eResource().getResourceSet().getResources());
- «ENDIF-»
- java.util.List result = new java.util.LinkedList();
- «EXPAND colectConnectedLinks(methodNameSuffix, needCrossReferencer, metaclass.isExternalInterface()) FOREACH genLinks-»
- return result;
- «ENDLET-»
- «ELSE-»
- return java.util.Collections.EMPTY_LIST;
- «ENDIF-»
-}
-«ENDDEFINE»
-
-«DEFINE colectConnectedLinks(String methodNameSuffix, boolean needCrossReferencer, boolean isExternalInterface) FOR gmfgen::GenLink-»
-«IF isExternalInterface-»
- if («EXPAND MetaModel::IsInstance("modelElement") FOR modelFacet.getLinkEndType(methodNameSuffix)») {
-«ENDIF-»
- result.addAll(«EXPAND chooseConnectedLinksByTypeMethodName(methodNameSuffix, this) FOR modelFacet»(«IF isExternalInterface-»
-«EXPAND MetaModel::CastEObject("modelElement") FOR getLinkEndType(modelFacet, methodNameSuffix)»«ELSE»modelElement«ENDIF»«IF needCrossReferencer», crossReferences«ENDIF»));
-«IF isExternalInterface-»
- }
-«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE chooseConnectedLinksByTypeMethodName(String methodNameSuffix, gmfgen::GenLink genLink) FOR gmfgen::LinkModelFacet-»
- «EXPAND incorrectLinkModelFacet-»
-«ENDDEFINE»
-
-«REM»
- For FeatureModelFacet-based links we are calling
- getOutgoing???Links instead of getContained???Links
-«ENDREM»
-«DEFINE chooseConnectedLinksByTypeMethodName(String methodNameSuffix, gmfgen::GenLink genLink) FOR gmfgen::FeatureLinkModelFacet-»
-«IF getContainedLinksMethodNameSuffix() == methodNameSuffix»«EXPAND getConnectedLinksByTypeMethodName(getOutgoingLinksMethodNameSuffix()) FOR genLink-»
-«ELSE»«EXPAND getConnectedLinksByTypeMethodName(methodNameSuffix) FOR genLink-»
-«ENDIF-»
-«ENDDEFINE»
-
-«REM»
- For TypeModelFacet-based links we are calling
- getContained???Links instead of getOutgoinf???Links
- if sourceMetaFeature was not specified
-«ENDREM»
-«DEFINE chooseConnectedLinksByTypeMethodName(String methodNameSuffix, gmfgen::GenLink genLink) FOR gmfgen::TypeLinkModelFacet-»
-«IF getOutgoingLinksMethodNameSuffix() == methodNameSuffix && null == sourceMetaFeature»«EXPAND getConnectedLinksByTypeMethodName(getContainedLinksMethodNameSuffix()) FOR genLink-»
-«ELSE»«EXPAND getConnectedLinksByTypeMethodName(methodNameSuffix) FOR genLink-»
-«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE getContainedLinksByTypeMethod FOR gmfgen::GenLink»«EXPAND getContainedLinksByTypeMethod(this) FOR modelFacet»«ENDDEFINE»
-
-«DEFINE getConnectedLinksByTypeMethodName(String suffix) FOR gmfgen::GenLink»get«suffix»«EXPAND getConnectedLinksByTypeMethodFragment FOR modelFacet»_«visualID»«ENDDEFINE»
-
-«DEFINE getConnectedLinksByTypeMethodFragment FOR gmfgen::TypeLinkModelFacet»TypeModelFacetLinks_«metaClass.ecoreClass.name»«ENDDEFINE»
-
-«DEFINE getConnectedLinksByTypeMethodFragment FOR gmfgen::FeatureLinkModelFacet»FeatureModelFacetLinks_«metaFeature.genClass.ecoreClass.name»_«metaFeature.ecoreFeature.name.toFirstUpper()»«ENDDEFINE»
-
-«DEFINE getConnectedLinksByTypeMethodFragment FOR gmfgen::LinkModelFacet-»
- «EXPAND incorrectLinkModelFacet-»
-«ENDDEFINE»
-
-«DEFINE getContainedLinksByTypeMethod(gmfgen::GenLink genLink) FOR gmfgen::LinkModelFacet-»
- «EXPAND incorrectLinkModelFacet-»
-«ENDDEFINE»
-
-«DEFINE getContainedLinksByTypeMethod(gmfgen::GenLink genLink) FOR gmfgen::FeatureLinkModelFacet»«ENDDEFINE»
-
-«DEFINE getContainedLinksByTypeMethod(gmfgen::GenLink genLink) FOR gmfgen::TypeLinkModelFacet-»
-
- «EXPAND xpt::Common::generatedMemberComment»
-private static java.util.Collection «EXPAND getConnectedLinksByTypeMethodName(getContainedLinksMethodNameSuffix()) FOR genLink»(«EXPAND MetaModel::QualifiedClassName FOR childMetaFeature.genClass» container) {
- «EXPAND getContainedLinksByTypeMethodBody(genLink, false)-»
-}
-«ENDDEFINE»
-
-«DEFINE getContainedLinksByTypeMethodBody(gmfgen::GenLink genLink, boolean sourceVarDefined) FOR gmfgen::TypeLinkModelFacet-»
-java.util.Collection result = new java.util.LinkedList();
- «LET childMetaFeature.isListType() AS inLoop-»
-«IF inLoop-»
-for (java.util.Iterator links = «EXPAND MetaModel::getFeatureValue("container", childMetaFeature.genClass) FOR childMetaFeature».iterator(); links.hasNext();) {
- org.eclipse.emf.ecore.EObject linkObject = (org.eclipse.emf.ecore.EObject ) links.next();
- if («EXPAND MetaModel::NotInstance("linkObject") FOR metaClass») {
- continue;
- }
- «EXPAND MetaModel::DeclareAndAssign("link", "linkObject") FOR metaClass»
-«ELSE-»
- «IF getTypeGenClassX(childMetaFeature) == metaClass-»
- «EXPAND MetaModel::DeclareAndAssign("link", "container", getSourceType(), childMetaFeature) FOR metaClass»
- «ELSE-»
- «EXPAND MetaModel::DeclareAndAssign("linkObject", "container", getSourceType(), childMetaFeature) FOR getTypeGenClassX(childMetaFeature)»
- if («EXPAND MetaModel::NotInstance("linkObject") FOR metaClass») {
- return result;
- }
- «EXPAND MetaModel::DeclareAndAssign("link", "linkObject") FOR metaClass»
- «ENDIF-»
-«ENDIF-»
- «EXPAND checkLinkVisualID(genLink, inLoop)-»
- «EXPAND defineLinkDestination(inLoop)-»
- «IF null != sourceMetaFeature-»
- «EXPAND defineLinkSource(inLoop)-»
- «IF sourceVarDefined-»
- «EXPAND checkLinkSource(inLoop)-»
- «ENDIF-»
- «EXPAND addLinkDescriptor(genLink, "src", "dst")-»
- «ELSE-»
- «EXPAND addLinkDescriptor(genLink, "container", "dst")-»
- «ENDIF-»
-«IF inLoop-»
-}
-«ENDIF-»
- «ENDLET-»
-return result;
-«ENDDEFINE»
-
-«DEFINE addLinkDescriptor(gmfgen::GenLink genLink, String srcVar, String dstVar) FOR gmfgen::TypeLinkModelFacet-»
-result.add(new «genLink.getDiagram().editorGen.diagramUpdater.getLinkDescriptorQualifiedClassName()»(«EXPAND MetaModel::DowncastToEObject(srcVar) FOR getSourceType()», «EXPAND MetaModel::DowncastToEObject(dstVar) FOR getTargetType()», «EXPAND MetaModel::DowncastToEObject("link") FOR metaClass», «EXPAND xpt::providers::ElementTypes::accessElementType FOR genLink», «EXPAND xpt::editor::VisualIDRegistry::visualID FOR genLink»));
-«ENDDEFINE»
-
-«DEFINE checkLinkVisualID(gmfgen::GenLink genLink, boolean inLoop) FOR gmfgen::TypeLinkModelFacet-»
-if («EXPAND xpt::editor::VisualIDRegistry::visualID FOR genLink» != «EXPAND xpt::editor::VisualIDRegistry::getLinkWithClassVisualIDMethodCall FOR genLink.getDiagram()»(«EXPAND MetaModel::DowncastToEObject("link") FOR metaClass»)) {
- «EXPAND stopLinkProcessing(inLoop)-»
-}
-«ENDDEFINE»
-
-«DEFINE defineLinkSource(boolean inLoop) FOR gmfgen::TypeLinkModelFacet-»
- «IF sourceMetaFeature.isListType()-»
-java.util.List sources = «EXPAND MetaModel::getFeatureValue("link", metaClass) FOR sourceMetaFeature»;
-Object theSource = sources.size() == 1 ? sources.get(0) : null;
-if («EXPAND MetaModel::NotInstance("theSource") FOR getSourceType()») {
- «EXPAND stopLinkProcessing(inLoop)-»
-}
-«EXPAND MetaModel::DeclareAndAssign("src", "theSource", true) FOR getSourceType()»
- «ELSE-»
-«EXPAND MetaModel::DeclareAndAssign("src", "link", metaClass, sourceMetaFeature) FOR getSourceType()»
- «ENDIF-»
-«ENDDEFINE»
-
-«DEFINE checkLinkSource(boolean inLoop) FOR gmfgen::TypeLinkModelFacet-»
-if (src != source) {
- «EXPAND stopLinkProcessing(inLoop)-»
-}
-«ENDDEFINE»
-
-«DEFINE defineLinkDestination(boolean inLoop) FOR gmfgen::TypeLinkModelFacet-»
- «IF targetMetaFeature.isListType()-»
-java.util.List targets = «EXPAND MetaModel::getFeatureValue("link", metaClass) FOR targetMetaFeature»;
-Object theTarget = targets.size() == 1 ? targets.get(0) : null;
-if («EXPAND MetaModel::NotInstance("theTarget") FOR getTargetType()») {
- «EXPAND stopLinkProcessing(inLoop)-»
-}
-«EXPAND MetaModel::DeclareAndAssign("dst", "theTarget", true) FOR getTargetType()»
- «ELSE-»
-«EXPAND MetaModel::DeclareAndAssign("dst", "link", metaClass, targetMetaFeature) FOR getTargetType()»
- «ENDIF-»
-«ENDDEFINE»
-
-«DEFINE stopLinkProcessing(boolean inLoop) FOR gmfgen::TypeLinkModelFacet-»
-«IF inLoop-»
-continue;
-«ELSE-»
-return result;
-«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE getIncomingLinksByTypeMethod FOR gmfgen::GenLink-»
-
- «EXPAND xpt::Common::generatedMemberComment»
-private static java.util.Collection «EXPAND getConnectedLinksByTypeMethodName(getIncomingLinksMethodNameSuffix())»(«EXPAND MetaModel::QualifiedClassName FOR modelFacet.getTargetType()» target, java.util.Map crossReferences) {
- java.util.Collection result = new java.util.LinkedList();
- java.util.Collection settings = (java.util.Collection) crossReferences.get(target);
- for (java.util.Iterator it = settings.iterator(); it.hasNext();) {
- org.eclipse.emf.ecore.EStructuralFeature.Setting setting = (org.eclipse.emf.ecore.EStructuralFeature.Setting) it.next();
- «EXPAND getIncomingLinksByTypeMethodBody(this) FOR modelFacet-»
- }
- return result;
-}
-«ENDDEFINE»
-
-«DEFINE getIncomingLinksByTypeMethodBody(gmfgen::GenLink genLink) FOR gmfgen::TypeLinkModelFacet-»
-if (setting.getEStructuralFeature() != «EXPAND MetaModel::MetaFeature FOR targetMetaFeature» || «EXPAND MetaModel::NotInstance("setting.getEObject()") FOR metaClass») {
- continue;
-}
-«EXPAND MetaModel::DeclareAndAssign("link", "setting.getEObject()") FOR metaClass»
- «EXPAND checkLinkVisualID(genLink, true)-»
- «IF null != sourceMetaFeature-»
- «EXPAND defineLinkSource(true)-»
- «EXPAND addLinkDescriptor(genLink, "src", "target")-»
- «ELSE-»
- «EXPAND defineLinkContainer(true)-»
- «EXPAND addLinkDescriptor(genLink, "container", "target")-»
-«REM»TODO: continue here.«ENDREM»
- «ENDIF-»
-«ENDDEFINE»
-
-«DEFINE defineLinkContainer(boolean inLoop) FOR gmfgen::TypeLinkModelFacet-»
-if (false == «EXPAND MetaModel::IsContainerInstance("link", metaClass) FOR containmentMetaFeature.genClass») {
- «EXPAND stopLinkProcessing(inLoop)-»
-}
-«EXPAND MetaModel::DeclareAndAssignContainer("container", "link", metaClass) FOR containmentMetaFeature.genClass»
-«ENDDEFINE»
-
-«DEFINE getIncomingLinksByTypeMethodBody(gmfgen::GenLink genLink) FOR gmfgen::FeatureLinkModelFacet-»
-if (setting.getEStructuralFeature() == «EXPAND MetaModel::MetaFeature FOR metaFeature») {
- result.add(new «genLink.getDiagram().editorGen.diagramUpdater.getLinkDescriptorQualifiedClassName()»(setting.getEObject(), «EXPAND MetaModel::DowncastToEObject("target") FOR getTargetType()», «EXPAND xpt::providers::ElementTypes::accessElementType FOR genLink», «EXPAND xpt::editor::VisualIDRegistry::visualID FOR genLink»));
-}
-«ENDDEFINE»
-
-«DEFINE getIncomingLinksByTypeMethodBody(gmfgen::GenLink genLink) FOR gmfgen::LinkModelFacet-»
- «EXPAND incorrectLinkModelFacet-»
-«ENDDEFINE»
-
-«DEFINE getOutgoingLinksByTypeMethod FOR gmfgen::GenLink-»
- «EXPAND getOutgoingLinksByTypeMethod(this) FOR modelFacet-»
-«ENDDEFINE»
-
-«DEFINE getOutgoingLinksByTypeMethodSignature FOR gmfgen::GenLink»private static java.util.Collection «EXPAND getConnectedLinksByTypeMethodName(getOutgoingLinksMethodNameSuffix())»(«EXPAND MetaModel::QualifiedClassName FOR modelFacet.getSourceType()» source)«ENDDEFINE»
-
-«DEFINE getOutgoingLinksByTypeMethod(gmfgen::GenLink genLink) FOR gmfgen::FeatureLinkModelFacet-»
-
- «EXPAND xpt::Common::generatedMemberComment»
-«EXPAND getOutgoingLinksByTypeMethodSignature FOR genLink» {
- java.util.Collection result = new java.util.LinkedList();
- «IF metaFeature.isListType()-»
- for (java.util.Iterator destinations = «EXPAND MetaModel::getFeatureValue("source", getSourceType()) FOR metaFeature».iterator(); destinations.hasNext();) {
- «EXPAND MetaModel::DeclareAndAssign("destination", "destinations.next()", true) FOR getTargetType()»
- «ELSE-»
- «EXPAND MetaModel::DeclareAndAssign("destination", "source", getSourceType(), metaFeature) FOR getTargetType()»
- if (destination == null) {
- return result;
- }
- «ENDIF-»
- result.add(new «genLink.getDiagram().editorGen.diagramUpdater.getLinkDescriptorQualifiedClassName()»(«EXPAND MetaModel::DowncastToEObject("source") FOR getSourceType()», «EXPAND MetaModel::DowncastToEObject("destination") FOR getTargetType()», «EXPAND xpt::providers::ElementTypes::accessElementType FOR genLink», «EXPAND xpt::editor::VisualIDRegistry::visualID FOR genLink»));
- «IF metaFeature.isListType()-»
- }
- «ENDIF-»
- return result;
-}
-«ENDDEFINE»
-
-«REM»More careful way to find container should be used here then GMF will be modified in accordance«ENDREM»
-«DEFINE getOutgoingLinksByTypeMethod(gmfgen::GenLink genLink) FOR gmfgen::TypeLinkModelFacet-»
- «IF null != sourceMetaFeature-»
-
- «EXPAND xpt::Common::generatedMemberComment»
-«EXPAND getOutgoingLinksByTypeMethodSignature FOR genLink» {
- «EXPAND MetaModel::QualifiedClassName FOR containmentMetaFeature.genClass» container = null;
- // Find container element for the 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 = «EXPAND MetaModel::DowncastToEObject("source") FOR getSourceType()»; element != null && container == null; element = element.eContainer()) {
- if («EXPAND MetaModel::IsInstance("element") FOR containmentMetaFeature.genClass») {
- container = «EXPAND MetaModel::CastEObject("element") FOR containmentMetaFeature.genClass»;
- }
- }
- if (container == null) {
- return java.util.Collections.EMPTY_LIST;
- }
- «EXPAND getContainedLinksByTypeMethodBody(genLink, true)-»
-}
- «ENDIF-»
-«ENDDEFINE»
-
-«DEFINE getOutgoingLinksByTypeMethod(gmfgen::GenLink genLink) FOR gmfgen::LinkModelFacet-»
- «EXPAND incorrectLinkModelFacet-»
-«ENDDEFINE»
-
-«DEFINE incorrectLinkModelFacet FOR gmfgen::LinkModelFacet-»
- «ERROR "Incorrect LinkModelFacet: " + this»
-«ENDDEFINE»
-
-«DEFINE additions FOR gmfgen::GenDiagramUpdater»«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/updater/LinkDescriptor.xpt b/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/updater/LinkDescriptor.xpt
deleted file mode 100644
index 172b9bef4..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/updater/LinkDescriptor.xpt
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * Copyright (c) 2007 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:
- * Alexander Shatalin (Borland) - initial API and implementation
- */
-
-«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
-
-«DEFINE LinkDescriptor FOR gmfgen::GenDiagramUpdater-»
- «EXPAND xpt::Common::copyright FOR editorGen-»
-package «editorGen.editor.packageName»;
-
- «EXPAND xpt::Common::generatedClassComment»
-public class «linkDescriptorClassName» extends «getNodeDescriptorQualifiedClassName()» {
-
- «EXPAND attributes-»
-
- «EXPAND constructor-»
-
- «EXPAND refOnlyLinkConstructor-»
-
- «EXPAND typeLinkConstructor-»
-
- «EXPAND getSource-»
-
- «EXPAND getDestination-»
-
- «EXPAND getSemanticAdapter-»
-
- «EXPAND additions-»
-}
-«ENDDEFINE»
-
-
-«DEFINE attributes FOR gmfgen::GenDiagramUpdater-»
- «EXPAND xpt::Common::generatedMemberComment»
-private org.eclipse.emf.ecore.EObject mySource;
-
- «EXPAND xpt::Common::generatedMemberComment»
-private org.eclipse.emf.ecore.EObject myDestination;
-
- «EXPAND xpt::Common::generatedMemberComment»
-private org.eclipse.core.runtime.IAdaptable mySemanticAdapter;
-«ENDDEFINE»
-
-«DEFINE constructor FOR gmfgen::GenDiagramUpdater-»
- «EXPAND xpt::Common::generatedMemberComment»
-private «linkDescriptorClassName»(org.eclipse.emf.ecore.EObject source, org.eclipse.emf.ecore.EObject destination, org.eclipse.emf.ecore.EObject linkElement, int linkVID) {
- super(linkElement, linkVID);
- mySource = source;
- myDestination = destination;
-}
-«ENDDEFINE»
-
-«DEFINE refOnlyLinkConstructor FOR gmfgen::GenDiagramUpdater-»
- «EXPAND xpt::Common::generatedMemberComment»
-public «linkDescriptorClassName»(org.eclipse.emf.ecore.EObject source, org.eclipse.emf.ecore.EObject destination, org.eclipse.gmf.runtime.emf.type.core.IElementType elementType, int linkVID) {
- this(source, destination, (org.eclipse.emf.ecore.EObject) null, linkVID);
- «EXPAND elementTypeCopy-»
- mySemanticAdapter = new org.eclipse.core.runtime.IAdaptable() {
- public Object getAdapter(Class adapter) {
- «EXPAND elementTypeAdapter-»
- return null;
- }
- };
-}
-«ENDDEFINE»
-
-«DEFINE typeLinkConstructor FOR gmfgen::GenDiagramUpdater-»
- «EXPAND xpt::Common::generatedMemberComment»
-public «linkDescriptorClassName»(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, int linkVID) {
- this(source, destination, linkElement, linkVID);
- «EXPAND elementTypeCopy-»
- mySemanticAdapter = new org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter(linkElement) {
- public Object getAdapter(Class adapter) {
- «EXPAND elementTypeAdapter-»
- return super.getAdapter(adapter);
- }
- };
-}
-«ENDDEFINE»
-
-«DEFINE elementTypeCopy FOR gmfgen::GenDiagramUpdater-»
-final org.eclipse.gmf.runtime.emf.type.core.IElementType elementTypeCopy = elementType;
-«ENDDEFINE»
-
-«DEFINE elementTypeAdapter FOR gmfgen::GenDiagramUpdater-»
-if (org.eclipse.gmf.runtime.emf.type.core.IElementType.class.equals(adapter)) {
- return elementTypeCopy;
-}
-«ENDDEFINE»
-
-«DEFINE getSource FOR gmfgen::GenDiagramUpdater-»
- «EXPAND xpt::Common::generatedMemberComment»
-public org.eclipse.emf.ecore.EObject getSource() {
- return mySource;
-}
-«ENDDEFINE»
-
-«DEFINE getDestination FOR gmfgen::GenDiagramUpdater-»
- «EXPAND xpt::Common::generatedMemberComment»
-public org.eclipse.emf.ecore.EObject getDestination() {
- return myDestination;
-}
-«ENDDEFINE»
-
-«DEFINE getSemanticAdapter FOR gmfgen::GenDiagramUpdater-»
- «EXPAND xpt::Common::generatedMemberComment»
-public org.eclipse.core.runtime.IAdaptable getSemanticAdapter() {
- return mySemanticAdapter;
-}
-«ENDDEFINE»
-
-«DEFINE additions FOR gmfgen::GenDiagramUpdater»«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/updater/NodeDescriptor.xpt b/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/updater/NodeDescriptor.xpt
deleted file mode 100644
index e9ea4d1dc..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/updater/NodeDescriptor.xpt
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright (c) 2007 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:
- * Alexander Shatalin (Borland) - initial API and implementation
- */
-
-«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
-
-«DEFINE NodeDescriptor FOR gmfgen::GenDiagramUpdater-»
- «EXPAND xpt::Common::copyright FOR editorGen-»
-package «editorGen.editor.packageName»;
-
- «EXPAND xpt::Common::generatedClassComment»
-public class «nodeDescriptorClassName» {
-
- «EXPAND attributes-»
-
- «EXPAND constructor-»
-
- «EXPAND getModelElement-»
-
- «EXPAND getVisualID-»
-
- «EXPAND additions-»
-}
-«ENDDEFINE»
-
-«DEFINE attributes FOR gmfgen::GenDiagramUpdater-»
- «EXPAND xpt::Common::generatedMemberComment»
- private final org.eclipse.emf.ecore.EObject myModelElement;
-
- «EXPAND xpt::Common::generatedMemberComment»
- private final int myVisualID;
-«ENDDEFINE»
-
-«DEFINE constructor FOR gmfgen::GenDiagramUpdater-»
- «EXPAND xpt::Common::generatedMemberComment»
-public «nodeDescriptorClassName»(org.eclipse.emf.ecore.EObject modelElement, int visualID) {
- myModelElement = modelElement;
- myVisualID = visualID;
-}
-«ENDDEFINE»
-
-«DEFINE getModelElement FOR gmfgen::GenDiagramUpdater-»
- «EXPAND xpt::Common::generatedMemberComment»
-public org.eclipse.emf.ecore.EObject getModelElement() {
- return myModelElement;
-}
-«ENDDEFINE»
-
-«DEFINE getVisualID FOR gmfgen::GenDiagramUpdater-»
- «EXPAND xpt::Common::generatedMemberComment»
-public int getVisualID() {
- return myVisualID;
-}
-«ENDDEFINE»
-
-«DEFINE additions FOR gmfgen::GenDiagramUpdater»«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/updater/UpdateCommand.xpt b/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/updater/UpdateCommand.xpt
deleted file mode 100644
index ae936c2b8..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/updater/UpdateCommand.xpt
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Copyright (c) 2007 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:
- * Alexander Shatalin (Borland) - initial API and implementation
- */
-
-«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
-
-«DEFINE UpdateCommand FOR gmfgen::GenDiagramUpdater-»
- «EXPAND xpt::Common::copyright FOR editorGen-»
-package «editorGen.editor.packageName»;
-
- «EXPAND xpt::Common::generatedClassComment»
-public class «updateCommandClassName» implements org.eclipse.core.commands.IHandler {
-
- «EXPAND addHandlerListener-»
-
- «EXPAND dispose-»
-
- «EXPAND execute-»
-
- «EXPAND isEnabled-»
-
- «EXPAND isHandled-»
-
- «EXPAND removeHandlerListener-»
-
- «EXPAND additions-»
-}
-«ENDDEFINE»
-
-«DEFINE addHandlerListener FOR gmfgen::GenDiagramUpdater-»
- «EXPAND xpt::Common::generatedMemberComment»
-public void addHandlerListener(org.eclipse.core.commands.IHandlerListener handlerListener) {
-}
-«ENDDEFINE»
-
-«DEFINE dispose FOR gmfgen::GenDiagramUpdater-»
- «EXPAND xpt::Common::generatedMemberComment»
-public void dispose() {
-}
-«ENDDEFINE»
-
-«DEFINE execute FOR gmfgen::GenDiagramUpdater-»
- «EXPAND xpt::Common::generatedMemberComment»
-public Object execute(org.eclipse.core.commands.ExecutionEvent event) throws org.eclipse.core.commands.ExecutionException {
- org.eclipse.jface.viewers.ISelection selection = org.eclipse.ui.PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService().getSelection();
- if (selection instanceof org.eclipse.jface.viewers.IStructuredSelection) {
- org.eclipse.jface.viewers.IStructuredSelection structuredSelection = (org.eclipse.jface.viewers.IStructuredSelection) selection;
- if (structuredSelection.size() != 1) {
- return null;
- }
- if (structuredSelection.getFirstElement() instanceof org.eclipse.gef.EditPart && ((org.eclipse.gef.EditPart) structuredSelection.getFirstElement()).getModel() instanceof org.eclipse.gmf.runtime.notation.View) {
- org.eclipse.emf.ecore.EObject modelElement = ((org.eclipse.gmf.runtime.notation.View) ((org.eclipse.gef.EditPart) structuredSelection.getFirstElement()).getModel()).getElement();
- java.util.List editPolicies = org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy.getRegisteredEditPolicies(modelElement);
- for (java.util.Iterator it = editPolicies.iterator(); it.hasNext();) {
- org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy nextEditPolicy = (org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy) it.next();
- nextEditPolicy.refresh();
- }
-
- }
- }
- return null;
-}
-«ENDDEFINE»
-
-«DEFINE isEnabled FOR gmfgen::GenDiagramUpdater-»
- «EXPAND xpt::Common::generatedMemberComment»
-public boolean isEnabled() {
- return true;
-}
-«ENDDEFINE»
-
-«DEFINE isHandled FOR gmfgen::GenDiagramUpdater-»
- «EXPAND xpt::Common::generatedMemberComment»
-public boolean isHandled() {
- return true;
-}
-«ENDDEFINE»
-
-«DEFINE removeHandlerListener FOR gmfgen::GenDiagramUpdater-»
- «EXPAND xpt::Common::generatedMemberComment»
-public void removeHandlerListener(org.eclipse.core.commands.IHandlerListener handlerListener) {
-}
-«ENDDEFINE»
-
-«DEFINE additions FOR gmfgen::GenDiagramUpdater»«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/updater/Utils.ext b/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/updater/Utils.ext
deleted file mode 100644
index 0bc44dc58..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/updater/Utils.ext
+++ /dev/null
@@ -1,184 +0,0 @@
-/*
- * Copyright (c) 2007 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:
- * Alexander Shatalin (Borland) - initial API and implementation
- * Michael Golubev (Borland) - [243151] explicit source/target for links
- */
-
-import "http://www.eclipse.org/gmf/2008/GenModel";
-import "http://www.eclipse.org/emf/2002/GenModel";
-import "http://www.eclipse.org/emf/2002/Ecore";
-extension xpt::diagram::editpolicies::LinkUtils;
-
-String getContainedLinksMethodNameSuffix() :
- "Contained"
-;
-
-String getIncomingLinksMethodNameSuffix() :
- "Incoming"
-;
-
-String getOutgoingLinksMethodNameSuffix() :
- "Outgoing"
-;
-
-cached List[gmfgen::GenLink] getContainedLinks(genmodel::GenClass metaClass, gmfgen::GenDiagram diagram) :
- diagram.links.select(link | canBeContainer(link, metaClass))
-;
-
-//XXX[MG]: it would be better to use linkEnd.outgoingLinks here
-//but it will change the ordering and produce meaningless diff in the generated code
-cached List[gmfgen::GenLink] getOutgoingLinks(gmfgen::GenLinkEnd linkEnd) :
- linkEnd.getDiagram().links.select(link | linkEnd.genOutgoingLinks.contains(link))
-;
-
-//XXX[MG]: see above
-cached List[gmfgen::GenLink] getIncomingLinks(gmfgen::GenLinkEnd linkEnd) :
- linkEnd.getDiagram().links.select(link | linkEnd.genIncomingLinks.contains(link))
-;
-
-List[gmfgen::GenLink] getAllContainedLinks(gmfgen::GenDiagram diagram) :
- diagram.links.select(link | !getAllSemanticElements(diagram).select(commonBase | canBeContainer(link, getMetaClass(commonBase))).isEmpty())
-;
-
-List[gmfgen::GenLink] getAllIncomingLinks(gmfgen::GenDiagram diagram) :
- diagram.links.select(link | !link.targets.isEmpty())
-;
-
-//XXX[MG]: I don't see the reason to make the additional check (isOutgoingLink) below
-List[gmfgen::GenLink] getAllOutgoingLinks(gmfgen::GenDiagram diagram) :
- diagram.links
- .select(link | isOutgoingLink(link))
- .select(link | !link.sources.isEmpty())
-;
-
-private boolean isOutgoingLink(gmfgen::GenLink link) :
- null != link.modelFacet && isOutgoingLink(link.modelFacet)
-;
-
-private boolean isOutgoingLink(gmfgen::LinkModelFacet modelFacet) :
- true
-;
-
-private boolean isOutgoingLink(gmfgen::TypeLinkModelFacet modelFacet) :
- null != modelFacet.sourceMetaFeature
-;
-
-cached List[gmfgen::GenLinkEnd] getAllSemanticDiagramElements(gmfgen::GenDiagram diagram) :
- diagram.getAllNodes().toList().addAll(diagram.links).typeSelect(gmfgen::GenLinkEnd).select(linkEnd | null != getMetaClass(linkEnd))
-;
-
-//(false == GenDiagram instanceof GenLinkEnd), so we have to downcast list type to gmfgen::GenCommonBase
-cached List[gmfgen::GenCommonBase] getAllSemanticElements(gmfgen::GenDiagram diagram) :
- null != diagram.domainDiagramElement
- ? {diagram}.addAll(getAllSemanticDiagramElements(diagram))
- : getAllSemanticDiagramElements(diagram)
-;
-
-cached genmodel::GenClass getMetaClass(gmfgen::GenCommonBase commonBase) :
- null
-;
-
-cached genmodel::GenClass getMetaClass(gmfgen::GenDiagram diagram) :
- diagram.domainDiagramElement
-;
-
-cached genmodel::GenClass getMetaClass(gmfgen::GenNode node) :
- node.modelFacet.metaClass
-;
-
-cached genmodel::GenClass getMetaClass(gmfgen::GenLink link) :
- null != link.modelFacet ? getMetaClass(link.modelFacet) : null
-;
-
-private genmodel::GenClass getMetaClass(gmfgen::LinkModelFacet modelFacet) :
- null
-;
-
-private genmodel::GenClass getMetaClass(gmfgen::TypeLinkModelFacet modelFacet) :
- modelFacet.metaClass
-;
-
-boolean hasSemanticChildren(gmfgen::GenContainerBase container) :
- !container.sansDomain && !container.containedNodes.isEmpty()
-;
-
-genmodel::GenClass getModelElementType(gmfgen::GenContainerBase containerBase) :
-// Never should be here!
- null
-;
-
-genmodel::GenClass getModelElementType(gmfgen::GenDiagram diagram) :
- diagram.domainDiagramElement
-;
-
-genmodel::GenClass getModelElementType(gmfgen::GenCompartment compartment) :
- getModelElementType(compartment.node)
-;
-
-genmodel::GenClass getModelElementType(gmfgen::GenNode node) :
- node.modelFacet.metaClass
-;
-
-cached Set[genmodel::GenFeature] getSemanticChildrenChildFeatures(gmfgen::GenContainerBase containerBase) :
- getNonPhantomSemanticChildren(containerBase).collect(node | node.modelFacet.childMetaFeature).toSet()
-;
-
-cached Set[genmodel::GenFeature] getSemanticChildrenContainmentFeatures(gmfgen::GenContainerBase containerBase) :
- getNonPhantomSemanticChildren(containerBase).collect(node | node.modelFacet.containmentMetaFeature).toSet()
-;
-
-cached List[gmfgen::GenNode] getSemanticChildren(gmfgen::GenContainerBase containerBase, genmodel::GenFeature childMetaFeature) :
- getNonPhantomSemanticChildren(containerBase).select(node | node.modelFacet.childMetaFeature == childMetaFeature)
-;
-
-private cached List[gmfgen::GenNode] getNonPhantomSemanticChildren(gmfgen::GenContainerBase containerBase) :
- getSemanticChildren(containerBase).select(node | !node.modelFacet.isPhantomElement())
-;
-
-cached List[gmfgen::GenNode] getPhantomNodes(gmfgen::GenContainerBase containerBase) :
- {}
-;
-
-cached List[gmfgen::GenNode] getPhantomNodes(gmfgen::GenDiagram diagram) :
- getSemanticChildren(diagram).select(node | node.modelFacet.isPhantomElement())
-;
-
-cached List[gmfgen::GenNode] getSemanticChildren(gmfgen::GenContainerBase containerBase) :
- containerBase.containedNodes.select(node | null != node.modelFacet)
-;
-
-cached boolean hasConformableSemanticChildren(gmfgen::GenContainerBase containerBase) :
- let childMetaClasses = getSemanticChildren(containerBase).collect(node | node.modelFacet.metaClass) :
- !childMetaClasses.forAll(mc | childMetaClasses.select(mc2 | mc == mc2).size() == 1)
-;
-
-GenClass getLinkEndType(gmfgen::LinkModelFacet f, String methodNameSuffix) :
- null
-;
-
-// For FeatureModelFacet-based links we are calling
-// getOutgoing???Links instead of getContained???Links
-GenClass getLinkEndType(gmfgen::FeatureLinkModelFacet f, String methodNameSuffix) :
- getIncomingLinksMethodNameSuffix() == methodNameSuffix
- ? f.getTargetType()
- : f.getSourceType()
-;
-
-// For TypeModelFacet-based links we are calling
-// getContained???Links instead of getOutgoinf???Links
-// if sourceMetaFeature was not specified
-GenClass getLinkEndType(gmfgen::TypeLinkModelFacet f, String methodNameSuffix) :
- getIncomingLinksMethodNameSuffix() == methodNameSuffix
- ? f.getTargetType()
- : (getOutgoingLinksMethodNameSuffix() == methodNameSuffix && null != f.sourceMetaFeature
- ? f.getSourceType()
- : f.containmentMetaFeature.genClass
- )
-;
diff --git a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/updater/containerBaseCanonicalMethods.xpt b/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/updater/containerBaseCanonicalMethods.xpt
deleted file mode 100644
index 858360cef..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/updater/containerBaseCanonicalMethods.xpt
+++ /dev/null
@@ -1,166 +0,0 @@
-/*
- * Copyright (c) 2007, 2008 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:
- * Alexander Shatalin (Borland) - initial API and implementation
- */
-
-«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
-«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
-
-«EXTENSION xpt::diagram::updater::Utils»
-«EXTENSION xpt::GenModelUtils»
-
-«DEFINE containerBaseCanonicalMethods FOR gmfgen::GenContainerBase-»
- «EXPAND attributes-»
-
- «EXPAND getSemanticChildrenList-»
- «EXPAND shouldDeleteView-»
-
- «EXPAND isOrphaned-»
- «IF hasConformableSemanticChildren(this)-»
-
- «EXPAND populateViewProperties-»
- «ENDIF-»
-
- «EXPAND getDefaultFactoryHint-»
- «EXPAND getFeaturesToSynchronize-»
-«ENDDEFINE»
-
-«DEFINE attributes FOR gmfgen::GenContainerBase-»
-«IF getSemanticChildrenContainmentFeatures(this).size() > 0-»
-
- «EXPAND xpt::Common::generatedMemberComment»
-java.util.Set myFeaturesToSynchronize;
-«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE getSemanticChildrenList FOR gmfgen::GenContainerBase-»
- «EXPAND xpt::Common::generatedMemberComment»
-protected java.util.List getSemanticChildrenList() {
- «IF hasSemanticChildren(this)-»
- org.eclipse.gmf.runtime.notation.View viewObject = (org.eclipse.gmf.runtime.notation.View) getHost().getModel();
- java.util.List result = new java.util.LinkedList();
- for (java.util.Iterator it = «EXPAND xpt::diagram::updater::DiagramUpdater::getSemanticChildrenMethodCall»(viewObject).iterator(); it.hasNext();) {
- result.add(((«getDiagram().editorGen.diagramUpdater.getNodeDescriptorQualifiedClassName()») it.next()).getModelElement());
- }
- return result;
- «ELSE-»
- return java.util.Collections.EMPTY_LIST;
- «ENDIF-»
-}
-«ENDDEFINE»
-
-«DEFINE shouldDeleteView FOR gmfgen::GenContainerBase»«ENDDEFINE»
-
-«DEFINE shouldDeleteView FOR gmfgen::GenDiagram-»
-
- «EXPAND xpt::Common::generatedMemberComment»
-protected boolean shouldDeleteView(org.eclipse.gmf.runtime.notation.View view) {
- return true;
-}
-«ENDDEFINE»
-
-«DEFINE checkShortcutProperty FOR gmfgen::GenDiagram-»
- «IF !containsShortcutsTo.isEmpty()-»
-if (view.getEAnnotation("Shortcut") != null) {«EXPAND xpt::Common::nonNLS»
- return «editorGen.diagramUpdater.getDiagramUpdaterQualifiedClassName()».isShortcutOrphaned(view);
-}
- «ENDIF-»
-«ENDDEFINE»
-
-«DEFINE checkShortcutProperty FOR gmfgen::GenContainerBase»«ENDDEFINE»
-
-«DEFINE getDefaultFactoryHint FOR gmfgen::GenContainerBase-»
- «EXPAND xpt::Common::generatedMemberComment»
-protected String getDefaultFactoryHint() {
- return null;
-}
-«ENDDEFINE»
-
-«DEFINE isOrphaned FOR gmfgen::GenContainerBase-»
- «EXPAND xpt::Common::generatedMemberComment»
-protected boolean isOrphaned(java.util.Collection semanticChildren, final org.eclipse.gmf.runtime.notation.View view) {
- «EXPAND checkShortcutProperty-»
- «IF !getSemanticChildren(this).isEmpty()-»
- int visualID = «EXPAND xpt::editor::VisualIDRegistry::getVisualIDMethodCall FOR getDiagram()»(view);
- switch (visualID) {
- «EXPAND xpt::Common::caseVisualID FOREACH getSemanticChildren(this)»
- if (!semanticChildren.contains(view.getElement())) {
- return true;
- }
- «IF hasConformableSemanticChildren(this)-»
- «EXPAND updateNotationModelElement-»
- «ENDIF-»
- }
- «ENDIF-»
- return false;
-}
-«ENDDEFINE»
-
-«DEFINE updateNotationModelElement FOR gmfgen::GenCommonBase-»
- org.eclipse.emf.ecore.EObject domainModelElement = view.getElement();
- if (visualID != «EXPAND xpt::editor::VisualIDRegistry::getNodeVisualIDMethodCall FOR getDiagram()»((org.eclipse.gmf.runtime.notation.View) getHost().getModel(), domainModelElement)) {
- java.util.List createdViews = createViews(java.util.Collections.singletonList(domainModelElement));
- «EXPAND xpt::Common::assert("createdViews.size() == 1")-»
- final org.eclipse.gmf.runtime.notation.View createdView = (org.eclipse.gmf.runtime.notation.View) ((org.eclipse.core.runtime.IAdaptable) createdViews.get(0)).getAdapter(org.eclipse.gmf.runtime.notation.View.class);
- if (createdView != null) {
- try {
- new org.eclipse.emf.workspace.AbstractEMFOperation(host().getEditingDomain(), org.eclipse.gmf.runtime.common.core.util.StringStatics.BLANK, Collections.singletonMap(org.eclipse.emf.transaction.Transaction.OPTION_UNPROTECTED, Boolean.TRUE)) {
- protected org.eclipse.core.runtime.IStatus doExecute(org.eclipse.core.runtime.IProgressMonitor monitor, org.eclipse.core.runtime.IAdaptable info) throws org.eclipse.core.commands.ExecutionException {
- populateViewProperties(view, createdView);
- return org.eclipse.core.runtime.Status.OK_STATUS;
- }
- }.execute(new org.eclipse.core.runtime.NullProgressMonitor(), null);
- } catch (org.eclipse.core.commands.ExecutionException e) {
- «getDiagram().editorGen.plugin.getActivatorQualifiedClassName()».getInstance().logError("Error while copyign view information to newly created view", e); //$NON-NLS-1$
- }
- }
- deleteViews(java.util.Collections.singletonList(view).iterator());
- }
-«ENDDEFINE»
-
-«DEFINE populateViewProperties FOR gmfgen::GenCommonBase-»
- «EXPAND xpt::Common::generatedMemberComment»
-private void populateViewProperties(org.eclipse.gmf.runtime.notation.View oldView, org.eclipse.gmf.runtime.notation.View newView) {
- if (oldView instanceof org.eclipse.gmf.runtime.notation.Node && newView instanceof org.eclipse.gmf.runtime.notation.Node) {
- org.eclipse.gmf.runtime.notation.Node oldNode = (org.eclipse.gmf.runtime.notation.Node) oldView;
- org.eclipse.gmf.runtime.notation.Node newNode = (org.eclipse.gmf.runtime.notation.Node) newView;
- if (oldNode.getLayoutConstraint() instanceof org.eclipse.gmf.runtime.notation.Location && newNode.getLayoutConstraint() instanceof org.eclipse.gmf.runtime.notation.Location) {
- ((org.eclipse.gmf.runtime.notation.Location) newNode.getLayoutConstraint()).setX(((org.eclipse.gmf.runtime.notation.Location) oldNode.getLayoutConstraint()).getX());
- ((org.eclipse.gmf.runtime.notation.Location) newNode.getLayoutConstraint()).setY(((org.eclipse.gmf.runtime.notation.Location) oldNode.getLayoutConstraint()).getY());
- }
- if (oldNode.getLayoutConstraint() instanceof org.eclipse.gmf.runtime.notation.Size && newNode.getLayoutConstraint() instanceof org.eclipse.gmf.runtime.notation.Size) {
- ((org.eclipse.gmf.runtime.notation.Size) newNode.getLayoutConstraint()).setWidth(((org.eclipse.gmf.runtime.notation.Size) oldNode.getLayoutConstraint()).getWidth());
- ((org.eclipse.gmf.runtime.notation.Size) newNode.getLayoutConstraint()).setHeight(((org.eclipse.gmf.runtime.notation.Size) oldNode.getLayoutConstraint()).getHeight());
- }
- if (oldNode.getLayoutConstraint() instanceof org.eclipse.gmf.runtime.notation.Ratio && newNode.getLayoutConstraint() instanceof org.eclipse.gmf.runtime.notation.Ratio) {
- ((org.eclipse.gmf.runtime.notation.Ratio) newNode.getLayoutConstraint()).setValue(((org.eclipse.gmf.runtime.notation.Ratio) oldNode.getLayoutConstraint()).getValue());
- }
- newNode.persist();
- }
-}
-«ENDDEFINE»
-
-«DEFINE getFeaturesToSynchronize FOR gmfgen::GenContainerBase-»
-«IF getSemanticChildrenChildFeatures(this).size() > 0-»
-
- «EXPAND xpt::Common::generatedMemberComment»
-protected java.util.Set getFeaturesToSynchronize(){
- if (myFeaturesToSynchronize == null) {
- myFeaturesToSynchronize = new java.util.HashSet();
- «EXPAND addContainmentFeature FOREACH getSemanticChildrenContainmentFeatures(this)-»
- }
- return myFeaturesToSynchronize;
-}
-«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE addContainmentFeature FOR genmodel::GenFeature-»
-myFeaturesToSynchronize.add(«EXPAND MetaModel::MetaFeature»);
-«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/updater/extensions.xpt b/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/updater/extensions.xpt
deleted file mode 100644
index 5f33af099..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/updater/extensions.xpt
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright (c) 2007 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:
- * Alexander Shatalin (Borland) - initial API and implementation
- */
-
-«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
-
-«DEFINE extensions FOR gmfgen::GenDiagramUpdater-»
- <extension point="org.eclipse.ui.commands" id="update-cmd">
- «EXPAND xpt::Common::xmlGeneratedTag»
- <command
- categoryId="org.eclipse.ui.category.edit"
- defaultHandler="«getUpdateCommandQualifiedClassName()»"
- description="%update.diagram.description"
- id="«updateCommandID»"
- name="%update.diagram.name"/>
- </extension>
-
- <extension point="org.eclipse.ui.bindings" id="update-cmd-binding">
- «EXPAND xpt::Common::xmlGeneratedTag»
- <key
- commandId="«updateCommandID»"
- contextId="«editorGen.editor.contextID»"
- schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
- sequence="F5"/>
- </extension>
-«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/views/CompartmentViewFactory.xpt b/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/views/CompartmentViewFactory.xpt
deleted file mode 100644
index e1cb6e20b..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/views/CompartmentViewFactory.xpt
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Copyright (c) 2007 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:
- * Dmitry Stadnik (Borland) - initial API and implementation
- */
-
-«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
-«EXTENSION xpt::diagram::ViewmapAttributesUtils»
-
-«DEFINE CompartmentViewFactory FOR gmfgen::GenCompartment-»
-«EXPAND xpt::Common::copyright FOR getDiagram().editorGen-»
-package «getDiagram().notationViewFactoriesPackageName»;
-
-«EXPAND xpt::Common::generatedClassComment»
-public class «notationViewFactoryClassName» extends org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory {
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected java.util.List createStyles(org.eclipse.gmf.runtime.notation.View view) {
- java.util.List styles = new java.util.ArrayList();
- «IF canCollapse-»
- styles.add(org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createDrawerStyle());
- «ENDIF-»
- «IF needsTitle-»
- styles.add(org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createTitleStyle());
- «ENDIF-»
- styles.add(org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createSortingStyle());
- styles.add(org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createFilteringStyle());
- «IF isStoringChildPositions(node.getLayoutType())-»
- «EXPAND xpt::diagram::views::Utils::addShapeStyle("styles") FOR viewmap-»
- «ENDIF-»
- «EXPAND xpt::diagram::views::Utils::addCustomStyles("styles")-»
- return styles;
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected void decorateView(org.eclipse.gmf.runtime.notation.View containerView, org.eclipse.gmf.runtime.notation.View view,
- org.eclipse.core.runtime.IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
- «EXPAND xpt::diagram::views::Utils::updateSemanticHint-»
- super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
- setupCompartmentTitle(view);
- setupCompartmentCollapsed(view);
- «EXPAND xpt::diagram::views::Utils::foregroundColour("view") FOR viewmap-»
- }
- «IF isStoringChildPositions(node.getLayoutType())-»
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected org.eclipse.gmf.runtime.notation.LayoutConstraint createLayoutConstraint() {
- return org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createBounds();
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected void initializeFromPreferences(org.eclipse.gmf.runtime.notation.View view) {
- super.initializeFromPreferences(view);
- org.eclipse.jface.preference.IPreferenceStore store =
- (org.eclipse.jface.preference.IPreferenceStore) getPreferencesHint().getPreferenceStore();
- org.eclipse.swt.graphics.RGB fillRGB = org.eclipse.jface.preference.PreferenceConverter.getColor(store,
- org.eclipse.gmf.runtime.diagram.ui.preferences.IPreferenceConstants.PREF_FILL_COLOR);
- org.eclipse.gmf.runtime.diagram.core.util.ViewUtil.setStructuralFeatureValue(view,
- org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getFillStyle_FillColor(),
- org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities.RGBToInteger(fillRGB));
- }
- «ENDIF-»
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected void setupCompartmentTitle(org.eclipse.gmf.runtime.notation.View view) {
- org.eclipse.gmf.runtime.notation.TitleStyle titleStyle = (org.eclipse.gmf.runtime.notation.TitleStyle) view.getStyle(
- org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getTitleStyle());
- if (titleStyle != null){
- titleStyle.setShowTitle(true);
- }
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected void setupCompartmentCollapsed(org.eclipse.gmf.runtime.notation.View view) {
- org.eclipse.gmf.runtime.notation.DrawerStyle drawerStyle = (org.eclipse.gmf.runtime.notation.DrawerStyle) view.getStyle(
- org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getDrawerStyle());
- if (drawerStyle != null){
- drawerStyle.setCollapsed(false);
- }
- }
- «EXPAND additions-»
-}
-«ENDDEFINE»
-
-«DEFINE additions FOR gmfgen::GenCompartment»«ENDDEFINE»
diff --git a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/views/DiagramViewFactory.xpt b/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/views/DiagramViewFactory.xpt
deleted file mode 100644
index 4b275e7df..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/views/DiagramViewFactory.xpt
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 2007 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:
- * Dmitry Stadnik (Borland) - initial API and implementation
- */
-
-«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
-
-«DEFINE DiagramViewFactory FOR gmfgen::GenDiagram-»
-«EXPAND xpt::Common::copyright FOR editorGen-»
-package «notationViewFactoriesPackageName»;
-
-«EXPAND xpt::Common::generatedClassComment»
-public class «notationViewFactoryClassName» extends org.eclipse.gmf.runtime.diagram.ui.view.factories.DiagramViewFactory {
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected java.util.List createStyles(org.eclipse.gmf.runtime.notation.View view) {
- java.util.List styles = new java.util.ArrayList();
- styles.add(org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createDiagramStyle());
- «EXPAND xpt::diagram::views::Utils::addCustomStyles("styles")-»
- return styles;
- }
-«IF units != null-»
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected org.eclipse.gmf.runtime.notation.MeasurementUnit getMeasurementUnit() {
- return org.eclipse.gmf.runtime.notation.MeasurementUnit.«units.toUpperCase()»_LITERAL;
- }
-«ENDIF-»
- «EXPAND additions-»
-}
-«ENDDEFINE»
-
-«DEFINE additions FOR gmfgen::GenDiagram»«ENDDEFINE»
diff --git a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/views/FloatingLabelViewFactory.xpt b/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/views/FloatingLabelViewFactory.xpt
deleted file mode 100644
index a26a14ca6..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/views/FloatingLabelViewFactory.xpt
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright (c) 2007 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:
- * Dmitry Stadnik (Borland) - initial API and implementation
- */
-
-«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
-«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
-«EXTENSION xpt::diagram::ViewmapAttributesUtils»
-
-«DEFINE FloatingLabelViewFactory FOR gmfgen::GenLabel-»
-«EXPAND xpt::Common::copyright FOR getDiagram().editorGen-»
-package «getDiagram().notationViewFactoriesPackageName»;
-
-«EXPAND xpt::Common::generatedClassComment»
-public class «notationViewFactoryClassName» extends org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractLabelViewFactory {
-
- «EXPAND xpt::Common::generatedMemberComment»
- public org.eclipse.gmf.runtime.notation.View createView(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.notation.Node view = (org.eclipse.gmf.runtime.notation.Node) super.createView(
- semanticAdapter, containerView, semanticHint, index, persisted, preferencesHint);
- «EXPAND offset-»
- return view;
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected java.util.List createStyles(org.eclipse.gmf.runtime.notation.View view) {
- java.util.List styles = new java.util.ArrayList();
- «EXPAND xpt::diagram::views::Utils::addTextStyle("styles") FOR modelFacet-»
- «EXPAND xpt::diagram::views::Utils::addCustomStyles("styles")-»
- return styles;
- }
- «EXPAND additions-»
-}
-«ENDDEFINE»
-
-«DEFINE offset FOR gmfgen::GenLabel-»
-«ENDDEFINE»
-
-«DEFINE offset FOR gmfgen::GenLinkLabel-»
- «LET labelOffsetX(viewmap, 0) AS x-»
- «LET labelOffsetY(viewmap, 0) AS y-»
- «IF x != 0 || y != 0-»
- «EXPAND offset(x, y)-»
- «ENDIF-»
- «ENDLET-»
- «ENDLET-»
-«ENDDEFINE»
-
-«DEFINE offset FOR gmfgen::GenExternalNodeLabel-»
- «EXPAND offset(0, 5)-»
-«ENDDEFINE»
-
-«DEFINE offset(Integer x, Integer y) FOR gmfgen::GenLabel-»
- org.eclipse.gmf.runtime.notation.Location location = (org.eclipse.gmf.runtime.notation.Location) view.getLayoutConstraint();
- org.eclipse.gmf.runtime.draw2d.ui.mapmode.IMapMode mapMode =
- org.eclipse.gmf.runtime.diagram.ui.util.MeasurementUnitHelper.getMapMode(containerView.getDiagram().getMeasurementUnit());
- location.setX(mapMode.DPtoLP(«x»));
- location.setY(mapMode.DPtoLP(«y»));
-«ENDDEFINE»
-
-«DEFINE additions FOR gmfgen::GenLabel»«ENDDEFINE»
diff --git a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/views/LabelNodeViewFactory.xpt b/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/views/LabelNodeViewFactory.xpt
deleted file mode 100644
index 1718b8d52..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/views/LabelNodeViewFactory.xpt
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2007 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:
- * Dmitry Stadnik (Borland) - initial API and implementation
- */
-
-«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
-«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
-«EXTENSION xpt::diagram::ViewmapAttributesUtils»
-
-«DEFINE LabelNodeViewFactory FOR gmfgen::GenChildLabelNode-»
-«EXPAND xpt::Common::copyright FOR getDiagram().editorGen-»
-package «getDiagram().notationViewFactoriesPackageName»;
-
-«EXPAND xpt::Common::generatedClassComment»
-public class «notationViewFactoryClassName» extends org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractLabelViewFactory {
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected java.util.List createStyles(org.eclipse.gmf.runtime.notation.View view) {
- java.util.List styles = new java.util.ArrayList();
- «EXPAND xpt::diagram::views::Utils::addLinkedDiagramStyle("styles")-»
- «EXPAND xpt::diagram::views::Utils::addCustomStyles("styles")-»
- return styles;
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected void decorateView(org.eclipse.gmf.runtime.notation.View containerView, org.eclipse.gmf.runtime.notation.View view,
- org.eclipse.core.runtime.IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
- «EXPAND xpt::diagram::views::Utils::updateSemanticHint-»
- super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
- «EXPAND xpt::diagram::views::Utils::foregroundColour("view") FOR viewmap-»
- «EXPAND xpt::diagram::views::Utils::backgroundColour("view") FOR viewmap-»
- }
- «EXPAND additions-»
-}
-«ENDDEFINE»
-
-«DEFINE additions FOR gmfgen::GenChildLabelNode»«ENDDEFINE»
diff --git a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/views/LabelViewFactory.xpt b/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/views/LabelViewFactory.xpt
deleted file mode 100644
index bfeb799e0..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/views/LabelViewFactory.xpt
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright (c) 2007 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:
- * Dmitry Stadnik (Borland) - initial API and implementation
- */
-
-«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
-«EXTENSION xpt::diagram::ViewmapAttributesUtils»
-
-«DEFINE LabelViewFactory FOR gmfgen::GenNodeLabel-»
-«EXPAND xpt::Common::copyright FOR getDiagram().editorGen-»
-package «getDiagram().notationViewFactoriesPackageName»;
-
-«EXPAND xpt::Common::generatedClassComment»
-public class «notationViewFactoryClassName» extends org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory {
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected java.util.List createStyles(org.eclipse.gmf.runtime.notation.View view) {
- java.util.List styles = new java.util.ArrayList();
- «EXPAND xpt::diagram::views::Utils::addTextStyle("styles") FOR modelFacet-»
- «EXPAND xpt::diagram::views::Utils::addCustomStyles("styles")-»
- return styles;
- }
- «EXPAND additions-»
-}
-«ENDDEFINE»
-
-«DEFINE additions FOR gmfgen::GenNodeLabel»«ENDDEFINE»
diff --git a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/views/LinkViewFactory.xpt b/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/views/LinkViewFactory.xpt
deleted file mode 100644
index c0c26dca1..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/views/LinkViewFactory.xpt
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright (c) 2007 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:
- * Dmitry Stadnik (Borland) - initial API and implementation
- */
-
-«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
-«EXTENSION xpt::diagram::ViewmapAttributesUtils»
-
-«DEFINE LinkViewFactory FOR gmfgen::GenLink-»
-«EXPAND xpt::Common::copyright FOR getDiagram().editorGen-»
-package «getDiagram().notationViewFactoriesPackageName»;
-
-«EXPAND xpt::Common::generatedClassComment»
-public class «notationViewFactoryClassName» extends org.eclipse.gmf.runtime.diagram.ui.view.factories.ConnectionViewFactory {
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected java.util.List createStyles(org.eclipse.gmf.runtime.notation.View view) {
- java.util.List styles = new java.util.ArrayList();
- «IF !isFixedForeground(viewmap)-»
- styles.add(org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createConnectorStyle());
- «ELSE-»
- styles.add(org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createRoutingStyle());
- «ENDIF-»
- «IF !isFixedFont(viewmap)-»
- styles.add(org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createFontStyle());
- «ENDIF-»
- «EXPAND xpt::diagram::views::Utils::addCustomStyles("styles")-»
- return styles;
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected void decorateView(org.eclipse.gmf.runtime.notation.View containerView, org.eclipse.gmf.runtime.notation.View view,
- org.eclipse.core.runtime.IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
- «EXPAND xpt::diagram::views::Utils::updateSemanticHint-»
- super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
- «EXPAND xpt::diagram::views::Utils::foregroundColour("view") FOR viewmap-»
- «IF labels.size() > 0-»
- org.eclipse.core.runtime.IAdaptable eObjectAdapter = null;
- «EXPAND xpt::diagram::views::Utils::domainElementAdapter("eObjectAdapter") FOR modelFacet-»
- «EXPAND xpt::diagram::views::Utils::createChildNode FOREACH labels-»
- «ENDIF-»
- }
- «EXPAND additions-»
-}
-«ENDDEFINE»
-
-«DEFINE additions FOR gmfgen::GenLink»«ENDDEFINE»
diff --git a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/views/NodeViewFactory.xpt b/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/views/NodeViewFactory.xpt
deleted file mode 100644
index d3654694c..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/views/NodeViewFactory.xpt
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright (c) 2007 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:
- * Dmitry Stadnik (Borland) - initial API and implementation
- */
-
-«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
-«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
-«EXTENSION xpt::diagram::ViewmapAttributesUtils»
-
-«DEFINE NodeViewFactory FOR gmfgen::GenNode-»
-«EXPAND xpt::Common::copyright FOR getDiagram().editorGen-»
-package «getDiagram().notationViewFactoriesPackageName»;
-
-«EXPAND xpt::Common::generatedClassComment»
-public class «notationViewFactoryClassName» extends org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractShapeViewFactory {
-
- «EXPAND createStyles-»
-
- «EXPAND decorateView-»
- «EXPAND additions-»
-}
-«ENDDEFINE»
-
-«DEFINE createStyles FOR gmfgen::GenNode-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected java.util.List createStyles(org.eclipse.gmf.runtime.notation.View view) {
- java.util.List styles = new java.util.ArrayList();
- «EXPAND xpt::diagram::views::Utils::addShapeStyle("styles") FOR viewmap-»
- «EXPAND xpt::diagram::views::Utils::addLinkedDiagramStyle("styles")-»
- «EXPAND xpt::diagram::views::Utils::addCustomStyles("styles")-»
- return styles;
- }
-«ENDDEFINE»
-
-«DEFINE decorateView FOR gmfgen::GenNode-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected void decorateView(org.eclipse.gmf.runtime.notation.View containerView, org.eclipse.gmf.runtime.notation.View view,
- org.eclipse.core.runtime.IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
- «EXPAND xpt::diagram::views::Utils::updateSemanticHint-»
- super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
- «EXPAND addShortcut-»
- «EXPAND xpt::diagram::views::Utils::foregroundColour("view") FOR viewmap-»
- «EXPAND xpt::diagram::views::Utils::backgroundColour("view") FOR viewmap-»
- «IF labels.size() > 0 || compartments.size() > 0-»
- org.eclipse.core.runtime.IAdaptable eObjectAdapter = null;
- «EXPAND xpt::diagram::views::Utils::domainElementAdapter("eObjectAdapter") FOR modelFacet-»
- «EXPAND xpt::diagram::views::Utils::createChildNode FOREACH labels-»
- «EXPAND xpt::diagram::views::Utils::createChildNode FOREACH compartments-»
- «ENDIF-»
- }
-«ENDDEFINE»
-
-«DEFINE addShortcut FOR gmfgen::GenNode-»
-«ENDDEFINE»
-
-«DEFINE addShortcut FOR gmfgen::GenTopLevelNode-»
- if (!«getDiagram().getEditPartQualifiedClassName()».MODEL_ID.equals(
- «getDiagram().getVisualIDRegistryQualifiedClassName()».getModelID(containerView))) {
- «EXPAND xpt::Common::addShortcutAnnotation("view") FOR getDiagram()-»
- }
-«ENDDEFINE»
-
-«DEFINE additions FOR gmfgen::GenNode»«ENDDEFINE»
diff --git a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/views/Utils.xpt b/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/views/Utils.xpt
deleted file mode 100644
index 07d303a62..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/views/Utils.xpt
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Copyright (c) 2007, 2008 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:
- * Dmitry Stadnik (Borland) - initial API and implementation
- */
-
-«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
-«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
-«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
-«EXTENSION xpt::diagram::ViewmapAttributesUtils»
-«EXTENSION xpt::GenModelUtils»
-
-«DEFINE updateSemanticHint FOR gmfgen::GenCommonBase-»
- if (semanticHint == null) {
- semanticHint = «getDiagram().getVisualIDRegistryQualifiedClassName()».getType(
- «getEditPartQualifiedClassName()».VISUAL_ID);
- view.setType(semanticHint);
- }
-«ENDDEFINE»
-
-«DEFINE createChildNode FOR gmfgen::GenCommonBase-»
- getViewService().createNode(eObjectAdapter, view,
- «getDiagram().getVisualIDRegistryQualifiedClassName()».getType(«getEditPartQualifiedClassName()».VISUAL_ID),
- org.eclipse.gmf.runtime.diagram.core.util.ViewUtil.APPEND, true, getPreferencesHint());
-«ENDDEFINE»
-
-«DEFINE domainElementAdapter(String adapterVar) FOR gmfgen::ModelFacet-»
-«ENDDEFINE»
-
-«DEFINE domainElementAdapter(String adapterVar) FOR gmfgen::TypeModelFacet-»
- org.eclipse.emf.ecore.EObject eObject =
- (org.eclipse.emf.ecore.EObject) semanticAdapter.getAdapter(org.eclipse.emf.ecore.EObject.class);
- if (eObject != null) {
- «adapterVar» = new org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter(eObject);
- }
-«ENDDEFINE»
-
-«DEFINE foregroundColour(String viewVar) FOR gmfgen::Viewmap-»
- «EXPAND foregroundColour(viewVar) FOREACH attributes-»
-«ENDDEFINE»
-
-«DEFINE foregroundColour(String viewVar) FOR gmfgen::Attributes-»
-«ENDDEFINE»
-
-«DEFINE foregroundColour(String viewVar) FOR gmfgen::ColorAttributes-»
- org.eclipse.gmf.runtime.diagram.core.util.ViewUtil.setStructuralFeatureValue(«viewVar»,
- org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getLineStyle_LineColor(),
- org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities.colorToInteger(
- org.eclipse.draw2d.ColorConstants.«foregroundColor»));
-«ENDDEFINE»
-
-«DEFINE backgroundColour(String viewVar) FOR gmfgen::Viewmap-»
- «EXPAND backgroundColour(viewVar) FOREACH attributes-»
-«ENDDEFINE»
-
-«DEFINE backgroundColour(String viewVar) FOR gmfgen::Attributes-»
-«ENDDEFINE»
-
-«DEFINE backgroundColour(String viewVar) FOR gmfgen::ColorAttributes-»
- org.eclipse.gmf.runtime.diagram.core.util.ViewUtil.setStructuralFeatureValue(«viewVar»,
- org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getFillStyle_FillColor(),
- org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities.colorToInteger(
- org.eclipse.draw2d.ColorConstants.«backgroundColor»));
-«ENDDEFINE»
-
-«DEFINE addShapeStyle(String stylesVar) FOR gmfgen::Viewmap-»
- «IF isFixedFont()-»
- «stylesVar».add(org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createDescriptionStyle());
- «stylesVar».add(org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createFillStyle());
- «stylesVar».add(org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createLineStyle());
- «ELSE-»
- «stylesVar».add(org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createShapeStyle());
- «ENDIF-»
-«ENDDEFINE»
-
-«DEFINE addTextStyle(String stylesVar) FOR gmfgen::LabelModelFacet-»
-«ENDDEFINE»
-
-«DEFINE addTextStyle(String stylesVar) FOR gmfgen::DesignLabelModelFacet-»
- «stylesVar».add(org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createDescriptionStyle());
-«ENDDEFINE»
-
-«DEFINE addLinkedDiagramStyle(String stylesVar) FOR gmfgen::GenCommonBase-»
- «EXPAND addLinkedDiagramStyle(stylesVar) FOREACH behaviour-»
-«ENDDEFINE»
-
-«DEFINE addLinkedDiagramStyle(String stylesVar) FOR gmfgen::Behaviour-»
-«ENDDEFINE»
-
-«DEFINE addLinkedDiagramStyle(String stylesVar) FOR gmfgen::OpenDiagramBehaviour-»
- {
- org.eclipse.gmf.runtime.notation.HintedDiagramLinkStyle diagramFacet =
- org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createHintedDiagramLinkStyle();
- «IF diagramKind != null-»
- diagramFacet.setHint("«diagramKind»"); // $NON-NLS-1$
- «ENDIF-»
- «stylesVar».add(diagramFacet);
- }
-«ENDDEFINE»
-
-«DEFINE addCustomStyles(String stylesVar) FOR gmfgen::GenCommonBase-»
- «FOREACH styles AS style-»
- «stylesVar».add(«EXPAND MetaModel::NewInstance FOR style»);
- «ENDFOREACH-»
-«ENDDEFINE»
diff --git a/plugins/org.eclipse.gmf.codegen/templates/xpt/editor/ActionBarContributor.xpt b/plugins/org.eclipse.gmf.codegen/templates/xpt/editor/ActionBarContributor.xpt
deleted file mode 100644
index 12f9acbbe..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates/xpt/editor/ActionBarContributor.xpt
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright (c) 2007, 2008 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:
- * Dmitry Stadnik (Borland) - initial API and implementation
- */
-«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
-
-«EXTENSION xpt::GenEditorGenerator»
-
-«DEFINE ActionBarContributor FOR gmfgen::GenEditorView-»
-«EXPAND xpt::Common::copyright FOR editorGen-»
-package «packageName»;
-
-«EXPAND xpt::Common::generatedClassComment»
-public class «actionBarContributorClassName»«EXPAND extendsList» {
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected Class getEditorClass() {
- return «getQualifiedClassName()».class;
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected String getEditorId() {
- return «getQualifiedClassName()».ID;
- }
- «EXPAND initMethod-»
- «EXPAND additions-»
-}
-«ENDDEFINE»
-
-«DEFINE extendsList FOR gmfgen::GenEditorView» extends org.eclipse.gmf.runtime.diagram.ui.parts.DiagramActionBarContributor«ENDDEFINE»
-
-«DEFINE initMethod FOR gmfgen::GenEditorView»
- «EXPAND xpt::Common::generatedMemberComment»
- public void init(org.eclipse.ui.IActionBars bars, org.eclipse.ui.IWorkbenchPage page) {
- super.init(bars, page);
- // print preview
- org.eclipse.jface.action.IMenuManager fileMenu = bars.getMenuManager().findMenuUsingPath(org.eclipse.ui.IWorkbenchActionConstants.M_FILE);
- «EXPAND xpt::Common::assert("fileMenu != null")-»
-«IF editorGen.plugin.printingEnabled-»
- org.eclipse.jface.action.IAction printPreviewAction = new org.eclipse.gmf.runtime.diagram.ui.printing.render.actions.RenderedPrintPreviewAction(new org.eclipse.gmf.runtime.diagram.ui.printing.render.actions.EnhancedPrintActionHelper());
- fileMenu.insertBefore("print", printPreviewAction);«EXPAND xpt::Common::nonNLS»
-«ELSE-»
- fileMenu.remove("pageSetupAction");«EXPAND xpt::Common::nonNLS»
-«ENDIF-»
-«IF /*hasAudits || hasMetrics */(editorGen.diagram.validationEnabled || editorGen.hasAudits()) || (editorGen.metrics != null && editorGen.metrics.metrics.size() > 0)-»
- org.eclipse.jface.action.IMenuManager editMenu = bars.getMenuManager().findMenuUsingPath(org.eclipse.ui.IWorkbenchActionConstants.M_EDIT);
- «EXPAND xpt::Common::assert("editMenu != null")-»
- if (editMenu.find("validationGroup") == null) {«EXPAND xpt::Common::nonNLS»
- editMenu.add(new org.eclipse.jface.action.GroupMarker("validationGroup"));«EXPAND xpt::Common::nonNLS»
- }
-«IF editorGen.diagram.validationEnabled || editorGen.hasAudits()-»
- org.eclipse.jface.action.IAction validateAction = new «EXPAND xpt::editor::ValidateAction::qualifiedClassName FOR editorGen.diagram»(page);
- editMenu.appendToGroup("validationGroup", validateAction);«EXPAND xpt::Common::nonNLS»
-«ENDIF-»
-«IF editorGen.metrics != null && editorGen.metrics.metrics.size() > 0-»
- org.eclipse.jface.action.IAction metricsAction = new «editorGen.diagram.getMetricProviderQualifiedClassName()».MetricsAction(page);
- editMenu.appendToGroup("validationGroup", metricsAction);«EXPAND xpt::Common::nonNLS»
-«ENDIF-»
-«ENDIF /*hasAudits || hasMetrics */-»
- }
-«ENDDEFINE»
-
-«DEFINE additions FOR gmfgen::GenEditorView»«ENDDEFINE»
diff --git a/plugins/org.eclipse.gmf.codegen/templates/xpt/editor/CreationWizard.xpt b/plugins/org.eclipse.gmf.codegen/templates/xpt/editor/CreationWizard.xpt
deleted file mode 100644
index de42bd2e5..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates/xpt/editor/CreationWizard.xpt
+++ /dev/null
@@ -1,181 +0,0 @@
-/*
- * Copyright (c) 2007 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:
- * Dmitry Stadnik (Borland) - initial API and implementation
- */
-«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
-
-«EXTENSION xpt::editor::Utils»
-
-«DEFINE CreationWizard FOR gmfgen::GenDiagram-»
-«EXPAND xpt::Common::copyright FOR editorGen-»
-package «editorGen.editor.packageName»;
-
-«EXPAND xpt::Common::generatedClassComment»
-public class «creationWizardClassName»
- extends org.eclipse.jface.wizard.Wizard implements org.eclipse.ui.INewWizard {
-
- «EXPAND xpt::Common::generatedMemberComment»
- private org.eclipse.ui.IWorkbench workbench;
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected org.eclipse.jface.viewers.IStructuredSelection selection;
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected «getCreationWizardPageQualifiedClassName()» diagramModelFilePage;
- «IF isStandaloneDomainModel()-»
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected «getCreationWizardPageQualifiedClassName()» domainModelFilePage;
- «ENDIF-»
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected org.eclipse.emf.ecore.resource.Resource diagram;
-
- «EXPAND xpt::Common::generatedMemberComment»
- private boolean openNewlyCreatedDiagramEditor = true;
-
- «EXPAND xpt::Common::generatedMemberComment»
- public org.eclipse.ui.IWorkbench getWorkbench() {
- return workbench;
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- public org.eclipse.jface.viewers.IStructuredSelection getSelection() {
- return selection;
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- public final org.eclipse.emf.ecore.resource.Resource getDiagram() {
- return diagram;
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- public final boolean isOpenNewlyCreatedDiagramEditor() {
- return openNewlyCreatedDiagramEditor;
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- public void setOpenNewlyCreatedDiagramEditor(boolean openNewlyCreatedDiagramEditor) {
- this.openNewlyCreatedDiagramEditor = openNewlyCreatedDiagramEditor;
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- public void init(org.eclipse.ui.IWorkbench workbench, org.eclipse.jface.viewers.IStructuredSelection selection) {
- this.workbench = workbench;
- this.selection = selection;
- setWindowTitle(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForCreationWizard().titleKey()) FOR editorGen»);
- setDefaultPageImageDescriptor(«editorGen.plugin.getActivatorQualifiedClassName()».getBundledImageDescriptor(
- "icons/wizban/New«IF domainDiagramElement != null»«domainDiagramElement.genPackage.prefix»«ENDIF»Wizard.gif")); //$NON-NLS-1$
- setNeedsProgressMonitor(true);
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- public void addPages() {
- diagramModelFilePage = new «getCreationWizardPageQualifiedClassName()»(
- "DiagramModelFile", getSelection(), "«editorGen.diagramFileExtension»"); //$NON-NLS-1$ //$NON-NLS-2$
- diagramModelFilePage.setTitle(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForCreationWizardDiagramPage().titleKey()) FOR editorGen»);
- diagramModelFilePage.setDescription(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForCreationWizardDiagramPage().descriptionKey()) FOR editorGen»);
- addPage(diagramModelFilePage);
- «IF isStandaloneDomainModel()-»
-
- domainModelFilePage = new «getCreationWizardPageQualifiedClassName()»(
- "DomainModelFile", getSelection(), "«editorGen.domainFileExtension»") { //$NON-NLS-1$ //$NON-NLS-2$
-
- public void setVisible(boolean visible) {
- if (visible) {
- String fileName = diagramModelFilePage.getFileName();
- fileName = fileName.substring(0, fileName.length() - ".«editorGen.diagramFileExtension»".length()); //$NON-NLS-1$
- setFileName(«getDiagramEditorUtilQualifiedClassName()».getUniqueFileName(
- getContainerFullPath(), fileName, "«editorGen.domainFileExtension»")); //$NON-NLS-1$
- }
- super.setVisible(visible);
- }
- };
- domainModelFilePage.setTitle(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForCreationWizardDomainPage().titleKey()) FOR editorGen»);
- domainModelFilePage.setDescription(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForCreationWizardDomainPage().descriptionKey()) FOR editorGen»);
- addPage(domainModelFilePage);
- «ENDIF-»
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- public boolean performFinish() {
- org.eclipse.jface.operation.IRunnableWithProgress op =
- «IF editorGen.application == null-»
- new org.eclipse.ui.actions.WorkspaceModifyOperation(null) {
-
- protected void execute(org.eclipse.core.runtime.IProgressMonitor monitor)
- throws org.eclipse.core.runtime.CoreException, InterruptedException {
- «ELSE-»
- new org.eclipse.jface.operation.IRunnableWithProgress() {
-
- public void run(org.eclipse.core.runtime.IProgressMonitor monitor)
- throws InvocationTargetException, InterruptedException {
- «ENDIF-»
- diagram = «getDiagramEditorUtilQualifiedClassName()».createDiagram(diagramModelFilePage.getURI(),
- «IF isStandaloneDomainModel()-»
- domainModelFilePage.getURI(),
- «ENDIF-»
- monitor);
- if (isOpenNewlyCreatedDiagramEditor() && diagram != null) {
- try {
- «getDiagramEditorUtilQualifiedClassName()».openDiagram(diagram);
- } catch (org.eclipse.ui.PartInitException e) {
- org.eclipse.jface.dialogs.ErrorDialog.openError(getContainer().getShell(),
- «EXPAND xpt::Externalizer::accessorCall(i18nKeyForCreationWizardOpenEditorError()) FOR editorGen», null, e.getStatus());
- }
- }
- }
- };
- try {
- getContainer().run(false, true, op);
- } catch (InterruptedException e) {
- return false;
- } catch (java.lang.reflect.InvocationTargetException e) {
- if (e.getTargetException() instanceof org.eclipse.core.runtime.CoreException) {
- org.eclipse.jface.dialogs.ErrorDialog.openError(getContainer().getShell(),
- «EXPAND xpt::Externalizer::accessorCall(i18nKeyForCreationWizardCreationError()) FOR editorGen», null,
- ((org.eclipse.core.runtime.CoreException) e.getTargetException()).getStatus());
- } else {
- «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().logError(
- "Error creating diagram", e.getTargetException()); //$NON-NLS-1$
- }
- return false;
- }
- return diagram != null;
- }
- «EXPAND additions-»
-}
-«ENDDEFINE»
-
-«DEFINE additions FOR gmfgen::GenDiagram»«ENDDEFINE»
-
-«DEFINE i18nValues FOR gmfgen::GenDiagram-»
-«EXPAND xpt::Externalizer::messageEntry(i18nKeyForCreationWizard().titleKey(), "New "+editorGen.modelID+" Diagram")-»
-«EXPAND xpt::Externalizer::messageEntry(i18nKeyForCreationWizardDiagramPage().titleKey(), "Create "+editorGen.modelID+" Diagram")-»
-«EXPAND xpt::Externalizer::messageEntry(i18nKeyForCreationWizardDiagramPage().descriptionKey(), (isStandaloneDomainModel() ? "Select file that will contain diagram model." : "Select file that will contain diagram and domain models."))-»
-«IF isStandaloneDomainModel()-»
-«EXPAND xpt::Externalizer::messageEntry(i18nKeyForCreationWizardDomainPage().titleKey(), "Create "+editorGen.modelID+" Domain Model")-»
-«EXPAND xpt::Externalizer::messageEntry(i18nKeyForCreationWizardDomainPage().descriptionKey(), "Select file that will contain domain model.")-»
-«ENDIF-»
-«EXPAND xpt::Externalizer::messageEntry(i18nKeyForCreationWizardOpenEditorError(), "Error opening diagram editor")-»
-«EXPAND xpt::Externalizer::messageEntry(i18nKeyForCreationWizardCreationError(), "Creation Problems")-»
-«ENDDEFINE»
-
-«DEFINE i18nAccessors FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Externalizer::accessorField(i18nKeyForCreationWizard().titleKey())-»
- «EXPAND xpt::Externalizer::accessorField(i18nKeyForCreationWizardDiagramPage().titleKey())-»
- «EXPAND xpt::Externalizer::accessorField(i18nKeyForCreationWizardDiagramPage().descriptionKey())-»
- «IF isStandaloneDomainModel()-»
- «EXPAND xpt::Externalizer::accessorField(i18nKeyForCreationWizardDomainPage().titleKey())-»
- «EXPAND xpt::Externalizer::accessorField(i18nKeyForCreationWizardDomainPage().descriptionKey())-»
- «ENDIF-»
- «EXPAND xpt::Externalizer::accessorField(i18nKeyForCreationWizardOpenEditorError())-»
- «EXPAND xpt::Externalizer::accessorField(i18nKeyForCreationWizardCreationError())-»
-«ENDDEFINE»
diff --git a/plugins/org.eclipse.gmf.codegen/templates/xpt/editor/CreationWizardPage.xpt b/plugins/org.eclipse.gmf.codegen/templates/xpt/editor/CreationWizardPage.xpt
deleted file mode 100644
index 230bba955..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates/xpt/editor/CreationWizardPage.xpt
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * Copyright (c) 2007 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:
- * Dmitry Stadnik (Borland) - initial API and implementation
- */
-«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
-
-«EXTENSION xpt::editor::Utils»
-
-«DEFINE CreationWizardPage FOR gmfgen::GenDiagram-»
-«EXPAND xpt::Common::copyright FOR editorGen-»
-package «editorGen.editor.packageName»;
-
-«EXPAND xpt::Common::generatedClassComment»
-public class «creationWizardPageClassName» extends
- «IF editorGen.application == null-»
- org.eclipse.ui.dialogs.WizardNewFileCreationPage
- «ELSE-»
- «editorGen.application.packageName».WizardNewFileCreationPage
- «ENDIF-»
- {
-
- «EXPAND xpt::Common::generatedMemberComment»
- private final String fileExtension;
-
- «EXPAND xpt::Common::generatedMemberComment»
- public «creationWizardPageClassName»(String pageName,
- org.eclipse.jface.viewers.IStructuredSelection selection, String fileExtension) {
- super(pageName, selection);
- this.fileExtension = fileExtension;
- }
-
- /**
- * Override to create files with this extension.
- *
- * @generated
- */
- protected String getExtension() {
- return fileExtension;
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- public org.eclipse.emf.common.util.URI getURI() {
- «IF editorGen.application == null-»
- return org.eclipse.emf.common.util.URI.createPlatformResourceURI(getFilePath().toString(), false);
- «ELSE-»
- return org.eclipse.emf.common.util.URI.createFileURI(getFilePath().toString());
- «ENDIF-»
- }
- «IF editorGen.application == null-»
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected org.eclipse.core.runtime.IPath getFilePath() {
- org.eclipse.core.runtime.IPath path = getContainerFullPath();
- if (path == null) {
- path = new org.eclipse.core.runtime.Path(""); //$NON-NLS-1$
- }
- String fileName = getFileName();
- if (fileName != null) {
- path = path.append(fileName);
- }
- return path;
- }
- «ENDIF-»
-
- «EXPAND xpt::Common::generatedMemberComment»
- public void createControl(org.eclipse.swt.widgets.Composite parent) {
- super.createControl(parent);
- setFileName(«getDiagramEditorUtilQualifiedClassName()».getUniqueFileName(
- getContainerFullPath(), getFileName(), getExtension()));
- setPageComplete(validatePage());
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected boolean validatePage() {
- if (!super.validatePage()) {
- return false;
- }
- String extension = getExtension();
- if (extension != null && !getFilePath().toString().endsWith("." + extension)) {
- setErrorMessage(org.eclipse.osgi.util.NLS.bind(
- «EXPAND xpt::Externalizer::accessorCall(i18nKeyForCreationWizardPageExtensionError()) FOR editorGen», extension));
- return false;
- }
- return true;
- }
- «EXPAND additions-»
-}
-«ENDDEFINE»
-
-«DEFINE additions FOR gmfgen::GenDiagram»«ENDDEFINE»
-
-«DEFINE i18nValues FOR gmfgen::GenDiagram-»
-«EXPAND xpt::Externalizer::messageEntry(i18nKeyForCreationWizardPageExtensionError(), "File name should have {0} extension.")-»
-«ENDDEFINE»
-
-«DEFINE i18nAccessors FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Externalizer::accessorField(i18nKeyForCreationWizardPageExtensionError())-»
-«ENDDEFINE»
diff --git a/plugins/org.eclipse.gmf.codegen/templates/xpt/editor/DeleteElementAction.xpt b/plugins/org.eclipse.gmf.codegen/templates/xpt/editor/DeleteElementAction.xpt
deleted file mode 100755
index 3f3894d59..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates/xpt/editor/DeleteElementAction.xpt
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Copyright (c) 2008 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:
- * Dmitry Stadnik (Borland) - initial API and implementation
- */
-
-«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
-
-«DEFINE className FOR gmfgen::GenDiagram»DeleteElementAction«ENDDEFINE»
-
-«DEFINE qualifiedClassName FOR gmfgen::GenDiagram»«editorGen.editor.packageName».«EXPAND className»«ENDDEFINE»
-
-«DEFINE DeleteElementAction FOR gmfgen::GenDiagram-»
-«EXPAND xpt::Common::copyright FOR editorGen-»
-package «editorGen.editor.packageName»;
-
-«EXPAND xpt::Common::generatedClassComment»
-public class «EXPAND className» extends org.eclipse.gmf.runtime.diagram.ui.actions.AbstractDeleteFromAction {
-
- «EXPAND xpt::Common::generatedMemberComment»
- public «EXPAND className»(org.eclipse.ui.IWorkbenchPart part) {
- super(part);
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- public «EXPAND className»(org.eclipse.ui.IWorkbenchPage workbenchPage) {
- super(workbenchPage);
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- public void init() {
- super.init();
- setId(org.eclipse.gmf.runtime.diagram.ui.actions.ActionIds.ACTION_DELETE_FROM_MODEL);
- setText(org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramUIMessages.DiagramEditor_Delete_from_Model);
- setToolTipText(org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramUIMessages.DiagramEditor_Delete_from_ModelToolTip);
- org.eclipse.ui.ISharedImages workbenchImages = org.eclipse.ui.PlatformUI.getWorkbench().getSharedImages();
- setHoverImageDescriptor(workbenchImages.getImageDescriptor(org.eclipse.ui.ISharedImages.IMG_TOOL_DELETE));
- setImageDescriptor(workbenchImages.getImageDescriptor(org.eclipse.ui.ISharedImages.IMG_TOOL_DELETE));
- setDisabledImageDescriptor(workbenchImages.getImageDescriptor(org.eclipse.ui.ISharedImages.IMG_TOOL_DELETE_DISABLED));
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected String getCommandLabel() {
- return org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramUIMessages.DiagramEditor_Delete_from_Model;
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected org.eclipse.gef.commands.Command getCommand(org.eclipse.gef.Request request) {
- java.util.List operationSet = getOperationSet();
- if (operationSet.isEmpty()) {
- return org.eclipse.gef.commands.UnexecutableCommand.INSTANCE;
- }
- java.util.Iterator editParts = operationSet.iterator();
- org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand command =
- new org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand(getEditingDomain(), getCommandLabel());
- while (editParts.hasNext()) {
- org.eclipse.gef.EditPart editPart = (org.eclipse.gef.EditPart) editParts.next();
- org.eclipse.gef.commands.Command curCommand = editPart.getCommand(request);
- if (curCommand != null) {
- command.compose(new org.eclipse.gmf.runtime.diagram.ui.commands.CommandProxy(curCommand));
- }
- }
- if (command.isEmpty() || command.size() != operationSet.size()) {
- return org.eclipse.gef.commands.UnexecutableCommand.INSTANCE;
- }
- return new org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy(command);
- }
- «EXPAND additions-»
-}
-«ENDDEFINE»
-
-«DEFINE additions FOR gmfgen::GenDiagram-»
-«ENDDEFINE»
diff --git a/plugins/org.eclipse.gmf.codegen/templates/xpt/editor/DiagramContentInitializer.xpt b/plugins/org.eclipse.gmf.codegen/templates/xpt/editor/DiagramContentInitializer.xpt
deleted file mode 100644
index b36edb08d..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates/xpt/editor/DiagramContentInitializer.xpt
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
- * Copyright (c) 2007, 2008 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:
- * Alexander Shatalin (Borland) - initial API and implementation
- */
-
-«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
-
-«EXTENSION xpt::diagram::updater::Utils»
-«EXTENSION xpt::GenModelUtils»
-
-«DEFINE DiagramContentInitializer FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::copyright FOR getDiagram().editorGen-»
-package «editorGen.editor.packageName»;
-
- «EXPAND xpt::Common::generatedClassComment»
-public class «diagramContentInitializerClassName» {
-
- «EXPAND attributes-»
-
- «EXPAND initDiagramContent-»
-
- «EXPAND createChildren FOREACH getAllContainers().select(container | !container.sansDomain)-»
-
- «EXPAND createNode-»
-
- «EXPAND createLinks-»
- «IF !getAllContainers().typeSelect(gmfgen::GenCompartment).isEmpty()-»
-
- «EXPAND getCompartment-»
- «ENDIF-»
-
- «EXPAND additions-»
-}
-«ENDDEFINE»
-
-«DEFINE attributes FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-private java.util.Map myDomain2NotationMap = new java.util.HashMap();
-
- «EXPAND xpt::Common::generatedMemberComment»
-private java.util.Collection myLinkDescriptors = new java.util.LinkedList();
-«ENDDEFINE»
-
-«DEFINE initDiagramContent FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-public void initDiagramContent(org.eclipse.gmf.runtime.notation.Diagram diagram) {
- if (!«EXPAND xpt::editor::VisualIDRegistry::modelID».equals(diagram.getType())) {
- «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().logError("Incorrect diagram passed as a parameter: " + diagram.getType());
- return;
- }
- if («EXPAND MetaModel::NotInstance("diagram.getElement()") FOR domainDiagramElement») {
- «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().logError("Incorrect diagram element specified: " + diagram.getElement() + " instead of «domainDiagramElement.ecoreClass.name»");
- return;
- }
- «EXPAND createChildrenMethodName»(diagram);
- createLinks(diagram);
-}
-«ENDDEFINE»
-
-«DEFINE createChildrenMethodName FOR gmfgen::GenContainerBase»create«getUniqueIdentifier()»Children«ENDDEFINE»
-
-«DEFINE createChildren FOR gmfgen::GenContainerBase-»
- «EXPAND xpt::Common::generatedMemberComment»
-private void «EXPAND createChildrenMethodName»(org.eclipse.gmf.runtime.notation.View view) {
- «EXPAND collectContainedLinks-»
- «IF hasSemanticChildren(this)-»
- java.util.Collection childNodeDescriptors = «EXPAND xpt::diagram::updater::DiagramUpdater::getSemanticChildrenMethodCall»(view);
- for (java.util.Iterator it = childNodeDescriptors.iterator(); it.hasNext();) {
- createNode(view, («getDiagram().editorGen.diagramUpdater.getNodeDescriptorQualifiedClassName()») it.next());
- }
- «ENDIF-»
- «EXPAND createCompartmentsChildren-»
-}
-«ENDDEFINE»
-
-«DEFINE collectContainedLinks FOR gmfgen::GenContainerBase»«ENDDEFINE»
-
-«DEFINE collectContainedLinks FOR gmfgen::GenNode-»
- myDomain2NotationMap.put(view.getElement(), view);
- myLinkDescriptors.addAll(«EXPAND xpt::diagram::updater::DiagramUpdater::getOutgoingLinksMethodCall»(view));
-«ENDDEFINE»
-
-«DEFINE createCompartmentsChildren FOR gmfgen::GenContainerBase»«ENDDEFINE»
-
-«DEFINE createCompartmentsChildren FOR gmfgen::GenNode-»
- «EXPAND callCreateCompartmentChildren FOREACH compartments»
-«ENDDEFINE»
-
-«REM»
- Will be called for each compartment of GenNode for GenNode.isSansDomain() == false.
- if !GenNode.isSansDomain() => !GenCompartment.isSansDomain() so should not check
- !this.isSansDomain() here.
-«ENDREM»
-«DEFINE callCreateCompartmentChildren FOR gmfgen::GenCompartment-»
- «EXPAND createChildrenMethodName»(getCompartment(view, «EXPAND xpt::editor::VisualIDRegistry::visualID»));
-«ENDDEFINE»
-
-«DEFINE createNode FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-private void createNode(org.eclipse.gmf.runtime.notation.View parentView, «editorGen.diagramUpdater.getNodeDescriptorQualifiedClassName()» nodeDescriptor) {
- final String nodeType = «EXPAND xpt::editor::VisualIDRegistry::typeMethodCall("nodeDescriptor.getVisualID()")»;
- org.eclipse.gmf.runtime.notation.Node node = org.eclipse.gmf.runtime.diagram.core.services.ViewService.createNode(parentView, nodeDescriptor.getModelElement(), nodeType, «EXPAND xpt::plugin::Activator::preferenceHintAccess FOR editorGen»);
- switch (nodeDescriptor.getVisualID()) {
- «EXPAND createNodeCase FOREACH getAllNodes().select(node | !node.sansDomain)-»
- }
-}
-«ENDDEFINE»
-
-«DEFINE createNodeCase FOR gmfgen::GenContainerBase-»
-«EXPAND xpt::Common::caseVisualID»
- «EXPAND createChildrenMethodName»(node);
- return;
-«ENDDEFINE»
-
-«REM»Adopt this code to work with links to links«ENDREM»
-«DEFINE createLinks FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-private void createLinks(org.eclipse.gmf.runtime.notation.Diagram diagram) {
- for (boolean continueLinkCreation = true; continueLinkCreation;) {
- continueLinkCreation = false;
- java.util.Collection additionalDescriptors = new java.util.LinkedList();
- for (java.util.Iterator it = myLinkDescriptors.iterator(); it.hasNext();) {
- «editorGen.diagramUpdater.getLinkDescriptorQualifiedClassName()» nextLinkDescriptor = («editorGen.diagramUpdater.getLinkDescriptorQualifiedClassName()») it.next();
- if (!myDomain2NotationMap.containsKey(nextLinkDescriptor.getSource()) || !myDomain2NotationMap.containsKey(nextLinkDescriptor.getDestination())) {
- continue;
- }
- final String linkType = «EXPAND xpt::editor::VisualIDRegistry::typeMethodCall("nextLinkDescriptor.getVisualID()")»;
- org.eclipse.gmf.runtime.notation.Edge edge = org.eclipse.gmf.runtime.diagram.core.services.ViewService.getInstance().createEdge(nextLinkDescriptor.getSemanticAdapter(), diagram, linkType, org.eclipse.gmf.runtime.diagram.core.util.ViewUtil.APPEND, true, «EXPAND xpt::plugin::Activator::preferenceHintAccess FOR editorGen»);
- if (edge != null) {
- edge.setSource((org.eclipse.gmf.runtime.notation.View) myDomain2NotationMap.get(nextLinkDescriptor.getSource()));
- edge.setTarget((org.eclipse.gmf.runtime.notation.View) myDomain2NotationMap.get(nextLinkDescriptor.getDestination()));
- it.remove();
- if (nextLinkDescriptor.getModelElement() != null) {
- myDomain2NotationMap.put(nextLinkDescriptor.getModelElement(), edge);
- }
- continueLinkCreation = true;
- switch (nextLinkDescriptor.getVisualID()) {
- «EXPAND createLinksCase FOREACH links.select(link | null != getMetaClass(link))-»
- }
- }
- }
- myLinkDescriptors.addAll(additionalDescriptors);
- }
-}
-«ENDDEFINE»
-
-«DEFINE createLinksCase FOR gmfgen::GenLink-»
-«EXPAND xpt::Common::caseVisualID»
- additionalDescriptors.addAll(«EXPAND xpt::diagram::updater::DiagramUpdater::getOutgoingLinksMethodCall»(edge));
- break;
-«ENDDEFINE»
-
-«DEFINE getCompartment FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-private org.eclipse.gmf.runtime.notation.Node getCompartment(org.eclipse.gmf.runtime.notation.View node, int visualID) {
- String type = «EXPAND xpt::editor::VisualIDRegistry::typeMethodCall("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())) {
- return (org.eclipse.gmf.runtime.notation.Node) nextView;
- }
- }
- return null;
-}
-«ENDDEFINE»
-
-«DEFINE additions FOR gmfgen::GenDiagram»«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.codegen/templates/xpt/editor/DiagramEditorContextMenuProvider.xpt b/plugins/org.eclipse.gmf.codegen/templates/xpt/editor/DiagramEditorContextMenuProvider.xpt
deleted file mode 100755
index 3bdd6fc2d..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates/xpt/editor/DiagramEditorContextMenuProvider.xpt
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright (c) 2008 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:
- * Dmitry Stadnik (Borland) - initial API and implementation
- */
-
-«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
-
-«DEFINE className FOR gmfgen::GenDiagram»DiagramEditorContextMenuProvider«ENDDEFINE»
-
-«DEFINE qualifiedClassName FOR gmfgen::GenDiagram»«editorGen.editor.packageName».«EXPAND className»«ENDDEFINE»
-
-«DEFINE DiagramEditorContextMenuProvider FOR gmfgen::GenDiagram-»
-«EXPAND xpt::Common::copyright FOR editorGen-»
-package «editorGen.editor.packageName»;
-
-«EXPAND xpt::Common::generatedClassComment»
-public class «EXPAND className» extends org.eclipse.gmf.runtime.diagram.ui.providers.DiagramContextMenuProvider {
-
- «EXPAND xpt::Common::generatedMemberComment»
- private org.eclipse.ui.IWorkbenchPart part;
-
- «EXPAND xpt::Common::generatedMemberComment»
- private «EXPAND xpt::editor::DeleteElementAction::qualifiedClassName» deleteAction;
-
- «EXPAND xpt::Common::generatedMemberComment»
- public DiagramEditorContextMenuProvider(org.eclipse.ui.IWorkbenchPart part, org.eclipse.gef.EditPartViewer viewer) {
- super(part, viewer);
- this.part = part;
- deleteAction = new «EXPAND xpt::editor::DeleteElementAction::qualifiedClassName»(part);
- deleteAction.init();
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- public void dispose() {
- if (deleteAction != null) {
- deleteAction.dispose();
- deleteAction = null;
- }
- super.dispose();
- }
-
- «EXPAND xpt::Common::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() {
-
- 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);
- }
- });
- } catch (Exception e) {
- «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().logError("Error building context menu", e);
- }
- }
- «EXPAND additions-»
-}
-«ENDDEFINE»
-
-«DEFINE additions FOR gmfgen::GenDiagram-»
-«ENDDEFINE»
diff --git a/plugins/org.eclipse.gmf.codegen/templates/xpt/editor/DiagramEditorUtil.xpt b/plugins/org.eclipse.gmf.codegen/templates/xpt/editor/DiagramEditorUtil.xpt
deleted file mode 100644
index 0a7476f40..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates/xpt/editor/DiagramEditorUtil.xpt
+++ /dev/null
@@ -1,423 +0,0 @@
-/*
- * Copyright (c) 2007, 2008 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/2008/GenModel"»
-«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
-«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
-«EXTENSION xpt::editor::GenDiagram»
-«EXTENSION xpt::GenModelUtils»
-«EXTENSION xpt::editor::Utils»
-
-«DEFINE DiagramEditorUtil FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::copyright FOR editorGen-»
-package «editorGen.editor.packageName»;
-
-«EXPAND xpt::Common::generatedClassComment»
-public class «diagramEditorUtilClassName» {
-
-«EXPAND saveOptions-»
-
-«EXPAND openDiagramMethod-»
-«IF editorGen.application == null-»
-
- «EXPAND setCharsetMethods-»
-«ENDIF-»
-
-«EXPAND getUniqueFileNameMethod-»
-
-«IF editorGen.application != null»
- /**
- * Allows user to select file and loads it as a model.
- *
- * @generated
- */
- public static org.eclipse.emf.ecore.resource.Resource openModel(
- org.eclipse.swt.widgets.Shell shell, String description, org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain) {
- org.eclipse.swt.widgets.FileDialog fileDialog = new org.eclipse.swt.widgets.FileDialog(shell, org.eclipse.swt.SWT.OPEN);
- if (description != null) {
- fileDialog.setText(description);
- }
- fileDialog.open();
- String fileName = fileDialog.getFileName();
- if (fileName == null || fileName.length() == 0) {
- return null;
- }
- if (fileDialog.getFilterPath() != null) {
- fileName = fileDialog.getFilterPath() + java.io.File.separator + fileName;
- }
- org.eclipse.emf.common.util.URI uri = org.eclipse.emf.common.util.URI.createFileURI(fileName);
- org.eclipse.emf.ecore.resource.Resource resource = null;
- try {
- resource = editingDomain.getResourceSet().getResource(uri, true);
- } catch (org.eclipse.emf.common.util.WrappedException we) {
- «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().logError("Unable to load resource: " + uri, we); «EXPAND xpt::Common::nonNLS»
- org.eclipse.jface.dialogs.MessageDialog.openError(shell,
- «EXPAND xpt::Externalizer::accessorCall(i18nKeyForOpenModelResourceErrorDialog().titleKey()) FOR editorGen»,
- org.eclipse.osgi.util.NLS.bind(
- «EXPAND xpt::Externalizer::accessorCall(i18nKeyForOpenModelResourceErrorDialog().messageKey()) FOR editorGen»,
- fileName));
- }
- return resource;
- }
-«ENDIF»
-
- /**
- * Runs the wizard in a dialog.
- *
- * @generated
- */
- public static void runWizard(org.eclipse.swt.widgets.Shell shell, org.eclipse.jface.wizard.Wizard wizard, String settingsKey) {
- org.eclipse.jface.dialogs.IDialogSettings pluginDialogSettings = «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().getDialogSettings();
- org.eclipse.jface.dialogs.IDialogSettings wizardDialogSettings = pluginDialogSettings.getSection(settingsKey);
- if (wizardDialogSettings == null) {
- wizardDialogSettings = pluginDialogSettings.addNewSection(settingsKey);
- }
- wizard.setDialogSettings(wizardDialogSettings);
- org.eclipse.jface.wizard.WizardDialog dialog = new org.eclipse.jface.wizard.WizardDialog(shell, wizard);
- dialog.create();
- dialog.getShell().setSize(Math.max(500, dialog.getShell().getSize().x), 500);
- dialog.open();
- }
-
-«EXPAND createDiagramMethod-»
-«IF domainDiagramElement != null»
- «EXPAND createInitialModelMethod»
- «EXPAND attachModelMethod»
- «IF hasDocumentRoot()»«EXPAND createDocumentRootMethod»«ENDIF»
-«ENDIF»
-
-«EXPAND selectElementsMethod»
-«EXPAND findElementsMethod»
-«EXPAND findViewMethod»
-
-«EXPAND additions»
-}
-«ENDDEFINE»
-
-«DEFINE additions FOR gmfgen::GenDiagram»«ENDDEFINE»
-
-«DEFINE saveOptions FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
- public static java.util.Map getSaveOptions() {
- java.util.Map saveOptions = new java.util.HashMap();
- saveOptions.put(org.eclipse.emf.ecore.xmi.XMLResource.OPTION_ENCODING, "UTF-8"); «EXPAND xpt::Common::nonNLS»
- saveOptions.put(org.eclipse.emf.ecore.resource.Resource.OPTION_SAVE_ONLY_IF_CHANGED, org.eclipse.emf.ecore.resource.Resource.OPTION_SAVE_ONLY_IF_CHANGED_MEMORY_BUFFER);
- return saveOptions;
- }
-«ENDDEFINE»
-
-«DEFINE openDiagramMethod FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
- public static boolean openDiagram(org.eclipse.emf.ecore.resource.Resource diagram) throws org.eclipse.ui.PartInitException {
-«IF editorGen.application == null-»
- String path = diagram.getURI().toPlatformString(true);
- org.eclipse.core.resources.IResource workspaceResource = org.eclipse.core.resources.ResourcesPlugin.getWorkspace().getRoot().findMember(new org.eclipse.core.runtime.Path(path));
- if (workspaceResource instanceof org.eclipse.core.resources.IFile) {
- org.eclipse.ui.IWorkbenchPage page = org.eclipse.ui.PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
- return null != page.openEditor(new org.eclipse.ui.part.FileEditorInput((org.eclipse.core.resources.IFile) workspaceResource), «editorGen.editor.getQualifiedClassName()».ID);
- }
- return false;
-«ELSE-»
- org.eclipse.ui.IWorkbenchPage page = org.eclipse.ui.PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
- page.openEditor(new org.eclipse.emf.common.ui.URIEditorInput(diagram.getURI()), «editorGen.editor.getQualifiedClassName()».ID);
- return true;
-«ENDIF-»
- }
-«ENDDEFINE»
-
-«DEFINE setCharsetMethods FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
- public static void setCharset(org.eclipse.core.resources.IFile file) {
- if (file == null) {
- return;
- }
- try {
- file.setCharset("UTF-8", new org.eclipse.core.runtime.NullProgressMonitor()); «EXPAND xpt::Common::nonNLS»
- } catch (org.eclipse.core.runtime.CoreException e) {
- «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().logError("Unable to set charset for file " + file.getFullPath(), e); «EXPAND xpt::Common::nonNLS»
- }
- }
-«ENDDEFINE»
-
-«DEFINE getUniqueFileNameMethod FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
- public static String getUniqueFileName(org.eclipse.core.runtime.IPath containerFullPath, String fileName, String extension) {
- if (containerFullPath == null) {
- containerFullPath = new org.eclipse.core.runtime.Path(""); «EXPAND xpt::Common::nonNLS»
- }
- if (fileName == null || fileName.trim().length() == 0) {
- fileName = "default"; «EXPAND xpt::Common::nonNLS»
- }
- org.eclipse.core.runtime.IPath filePath = containerFullPath.append(fileName);
- if (extension != null && !extension.equals(filePath.getFileExtension())) {
- filePath = filePath.addFileExtension(extension);
- }
- extension = filePath.getFileExtension();
- fileName = filePath.removeFileExtension().lastSegment();
- int i = 1;
- while (
- «IF editorGen.application == null-»
- org.eclipse.core.resources.ResourcesPlugin.getWorkspace().getRoot().exists(filePath)
- «ELSE-»
- filePath.toFile().exists()
- «ENDIF-»
- ) {
- i++;
- filePath = containerFullPath.append(fileName + i);
- if (extension != null) {
- filePath = filePath.addFileExtension(extension);
- }
- }
- return filePath.lastSegment();
- }
-«ENDDEFINE»
-
-«DEFINE createDiagramMethod FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment(editorGen.application == null ? "This method should be called within a workspace modify operation since it creates resources." : "")»
- public static org.eclipse.emf.ecore.resource.Resource createDiagram(org.eclipse.emf.common.util.URI diagramURI,«IF standaloneDomainModel()» org.eclipse.emf.common.util.URI modelURI,«ENDIF» org.eclipse.core.runtime.IProgressMonitor progressMonitor) {
- org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain = org.eclipse.gmf.runtime.emf.core.GMFEditingDomainFactory.INSTANCE.createEditingDomain();
- progressMonitor.beginTask(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForCreateDiagramProgressTask()) FOR editorGen», 3);
- final org.eclipse.emf.ecore.resource.Resource diagramResource = editingDomain.getResourceSet().createResource(diagramURI);
-«IF standaloneDomainModel()-»
- final org.eclipse.emf.ecore.resource.Resource modelResource = editingDomain.getResourceSet().createResource(modelURI);
-«ELSEIF domainDiagramElement != null && hasDocumentRoot() /*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-»
- 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, «EXPAND xpt::Externalizer::accessorCall(i18nKeyForCreateDiagramCommandLabel()) FOR editorGen», java.util.Collections.EMPTY_LIST) {
- 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-»
- «EXPAND MetaModel::QualifiedClassName FOR domainDiagramElement» model = createInitialModel();
- attachModelToResource(model, «IF standaloneDomainModel()»model«ELSE»diagram«ENDIF»Resource);
-«ENDIF»
- org.eclipse.gmf.runtime.notation.Diagram diagram = org.eclipse.gmf.runtime.diagram.core.services.ViewService.createDiagram(
-«IF domainDiagramElement != null-»
- «EXPAND MetaModel::DowncastToEObject("model") FOR domainDiagramElement»,
-«ENDIF-»
- «EXPAND xpt::editor::VisualIDRegistry::modelID», «EXPAND xpt::plugin::Activator::preferenceHintAccess FOR editorGen»);
- if (diagram != null) {
- diagramResource.getContents().add(diagram);
- diagram.setName(diagramName);
-«IF domainDiagramElement != null-»
- diagram.setElement(«EXPAND MetaModel::DowncastToEObject("model") FOR domainDiagramElement»);
-«ENDIF-»
- }
-
- try {
- «IF standaloneDomainModel()»modelResource.save(«EXPAND xpt::Common::getSaveOptions»);«ENDIF»
- diagramResource.save(«EXPAND xpt::Common::getSaveOptions»);
- } catch (java.io.IOException e) {
- «/* TODO CommandResult.newErrorCommandResult(e) would be better? Or even throw ExecutionEx?*/»
- «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().logError("Unable to store model and diagram resources", e); «EXPAND xpt::Common::nonNLS»
- }
- 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.SubProgressMonitor(progressMonitor, 1), null);
- } catch (org.eclipse.core.commands.ExecutionException e) {
- «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().logError("Unable to create model and diagram", e); «EXPAND xpt::Common::nonNLS»
- }
-«IF editorGen.application == null-»
- «IF standaloneDomainModel()»setCharset(org.eclipse.emf.workspace.util.WorkspaceSynchronizer.getFile(modelResource));«ENDIF»
- setCharset(org.eclipse.emf.workspace.util.WorkspaceSynchronizer.getFile(diagramResource));
-«ENDIF-»
- return diagramResource;
- }
-«ENDDEFINE»
-
-«DEFINE createInitialModelMethod FOR gmfgen::GenDiagram»
- «EXPAND xpt::Common::generatedMemberComment("Create a new instance of domain element associated with canvas.\n<!-- begin-user-doc -->\n<!-- end-user-doc -->")»
- private static «EXPAND MetaModel::QualifiedClassName FOR domainDiagramElement» createInitialModel() {
- return «EXPAND MetaModel::NewInstance FOR domainDiagramElement»;
- }
-«ENDDEFINE»
-
-«DEFINE attachModelMethod FOR gmfgen::GenDiagram»
- «EXPAND xpt::Common::generatedMemberComment("Store model element in the resource.\n<!-- begin-user-doc -->\n<!-- end-user-doc -->")»
- private static void attachModelToResource(«EXPAND MetaModel::QualifiedClassName FOR domainDiagramElement» model, org.eclipse.emf.ecore.resource.Resource resource) {
- resource.getContents().add(«IF hasDocumentRoot()»createDocumentRoot(model)«ELSE»«EXPAND MetaModel::DowncastToEObject("model") FOR domainDiagramElement»«ENDIF»);
- }
-«ENDDEFINE»
-
-// invoke only when there's DocumentRoot in the domain model
-«DEFINE createDocumentRootMethod FOR gmfgen::GenDiagram»
- «EXPAND xpt::Common::generatedMemberComment»
- private static «EXPAND MetaModel::QualifiedClassName FOR getDocumentRoot()» createDocumentRoot(«EXPAND MetaModel::QualifiedClassName FOR domainDiagramElement» model) {
- «EXPAND MetaModel::NewInstance("docRoot") FOR getDocumentRoot()»
-«LET getDocumentRootSetFeature() AS f»«IF f == null-»
- docRoot.set«domainDiagramElement.ecoreClass.name»(model); // FIXME name of the set method is pure guess«ELSE-»
- «EXPAND MetaModel::modifyFeature("docRoot", getDocumentRoot(), "model") FOR f»;«ENDIF»
-«ENDLET-»
- return docRoot;
- }
-«ENDDEFINE»
-
-«DEFINE selectElementsMethod FOR gmfgen::GenDiagram»
- «EXPAND xpt::Common::generatedMemberComment»
- public static void selectElementsInDiagram(org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramWorkbenchPart diagramPart, java.util.List/*EditPart*/ editParts) {
- diagramPart.getDiagramGraphicalViewer().deselectAll();
-
- org.eclipse.gef.EditPart firstPrimary = null;
- for (java.util.Iterator it = editParts.iterator(); it.hasNext();) {
- org.eclipse.gef.EditPart nextPart = (org.eclipse.gef.EditPart) it.next();
- diagramPart.getDiagramGraphicalViewer().appendSelection(nextPart);
- if(firstPrimary == null && nextPart instanceof org.eclipse.gmf.runtime.diagram.ui.editparts.IPrimaryEditPart) {
- firstPrimary = nextPart;
- }
- }
-
- if(!editParts.isEmpty()) {
- diagramPart.getDiagramGraphicalViewer().reveal(firstPrimary != null ? firstPrimary : (org.eclipse.gef.EditPart)editParts.get(0));
- }
- }
-«ENDDEFINE»
-
-«DEFINE findElementsMethod FOR gmfgen::GenDiagram»
- «EXPAND xpt::Common::generatedMemberComment»
- private static int findElementsInDiagramByID(org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart diagramPart, org.eclipse.emf.ecore.EObject element, java.util.List editPartCollector) {
- org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramGraphicalViewer viewer = (org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramGraphicalViewer) diagramPart.getViewer();
- final int intialNumOfEditParts = editPartCollector.size();
-
- if (element instanceof org.eclipse.gmf.runtime.notation.View) { // support notation element lookup
- org.eclipse.gef.EditPart editPart = (org.eclipse.gef.EditPart) viewer.getEditPartRegistry().get(element);
- if (editPart != null) {
- editPartCollector.add(editPart);
- return 1;
- }
- }
-
- String elementID = org.eclipse.gmf.runtime.emf.core.util.EMFCoreUtil.getProxyID(element);
- java.util.List associatedParts = viewer.findEditPartsForElement(elementID, org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart.class);
- // perform the possible hierarchy disjoint -> take the top-most parts only
- for (java.util.Iterator editPartIt = associatedParts.iterator(); editPartIt.hasNext();) {
- org.eclipse.gef.EditPart nextPart = (org.eclipse.gef.EditPart) editPartIt.next();
- org.eclipse.gef.EditPart parentPart = nextPart.getParent();
- while (parentPart != null && !associatedParts.contains(parentPart)) {
- parentPart = parentPart.getParent();
- }
- if (parentPart == null) {
- editPartCollector.add(nextPart);
- }
- }
-
- if (intialNumOfEditParts == editPartCollector.size()) {
- if (!associatedParts.isEmpty()) {
- editPartCollector.add(associatedParts.iterator().next());
- } else {
- if (element.eContainer() != null) {
- return findElementsInDiagramByID(diagramPart, element.eContainer(), editPartCollector);
- }
- }
- }
- return editPartCollector.size() - intialNumOfEditParts;
- }
-«ENDDEFINE»
-
-«DEFINE findViewMethod FOR gmfgen::GenDiagram»
- «EXPAND xpt::Common::generatedMemberComment»
- public static org.eclipse.gmf.runtime.notation.View findView(org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart diagramEditPart, org.eclipse.emf.ecore.EObject targetElement, LazyElement2ViewMap lazyElement2ViewMap) {
- boolean hasStructuralURI = false;
- if(targetElement.eResource() instanceof org.eclipse.emf.ecore.xmi.XMLResource) {
- hasStructuralURI = ((org.eclipse.emf.ecore.xmi.XMLResource)targetElement.eResource()).getID(targetElement) == null;
- }
-
- org.eclipse.gmf.runtime.notation.View view = null;
- if(hasStructuralURI && !lazyElement2ViewMap.getElement2ViewMap().isEmpty()) {
- view = (org.eclipse.gmf.runtime.notation.View)lazyElement2ViewMap.getElement2ViewMap().get(targetElement);
- } else if (findElementsInDiagramByID(diagramEditPart, targetElement, lazyElement2ViewMap.editPartTmpHolder) > 0) {
- org.eclipse.gef.EditPart editPart = (org.eclipse.gef.EditPart) lazyElement2ViewMap.editPartTmpHolder.get(0);
- lazyElement2ViewMap.editPartTmpHolder.clear();
- view = editPart.getModel() instanceof org.eclipse.gmf.runtime.notation.View ? (org.eclipse.gmf.runtime.notation.View) editPart.getModel() : null;
- }
-
- return (view == null) ? diagramEditPart.getDiagramView() : view;
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- public static class LazyElement2ViewMap {
- «EXPAND xpt::Common::generatedMemberComment»
- private java.util.Map element2ViewMap;
-
- «EXPAND xpt::Common::generatedMemberComment»
- private org.eclipse.gmf.runtime.notation.View scope;
-
- «EXPAND xpt::Common::generatedMemberComment»
- private java.util.Set elementSet;
-
- «EXPAND xpt::Common::generatedMemberComment»
- public final java.util.List editPartTmpHolder = new java.util.ArrayList();
-
- «EXPAND xpt::Common::generatedMemberComment»
- public LazyElement2ViewMap(org.eclipse.gmf.runtime.notation.View scope, java.util.Set elements) {
- this.scope = scope;
- this.elementSet = elements;
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- public final java.util.Map getElement2ViewMap() {
- if(element2ViewMap == null) {
- element2ViewMap = new java.util.HashMap();
- // map possible notation elements to itself as these can't be found by view.getElement()
- for (java.util.Iterator it = elementSet.iterator(); it.hasNext();) {
- org.eclipse.emf.ecore.EObject element = (org.eclipse.emf.ecore.EObject) it.next();
- if(element instanceof org.eclipse.gmf.runtime.notation.View) {
- org.eclipse.gmf.runtime.notation.View view = (org.eclipse.gmf.runtime.notation.View) element;
- if(view.getDiagram() == scope.getDiagram()) {
- element2ViewMap.put(element, element); // take only those that part of our diagram
- }
- }
- }
-
- buildElement2ViewMap(scope, element2ViewMap, elementSet);
- }
- return element2ViewMap;
- }
- «EXPAND xpt::Common::generatedMemberComment»
- static java.util.Map buildElement2ViewMap(org.eclipse.gmf.runtime.notation.View parentView, java.util.Map element2ViewMap, java.util.Set elements) {
- if(elements.size() == element2ViewMap.size()) return element2ViewMap;
-
- if(parentView.isSetElement() && !element2ViewMap.containsKey(parentView.getElement()) && elements.contains(parentView.getElement())) {
- element2ViewMap.put(parentView.getElement(), parentView);
- if(elements.size() == element2ViewMap.size()) return element2ViewMap;
- }
-
- for (java.util.Iterator it = parentView.getChildren().iterator(); it.hasNext();) {
- buildElement2ViewMap((org.eclipse.gmf.runtime.notation.View) it.next(), element2ViewMap, elements);
- if(elements.size() == element2ViewMap.size()) return element2ViewMap;
- }
- for (java.util.Iterator it = parentView.getSourceEdges().iterator(); it.hasNext();) {
- buildElement2ViewMap((org.eclipse.gmf.runtime.notation.View) it.next(), element2ViewMap, elements);
- if(elements.size() == element2ViewMap.size()) return element2ViewMap;
- }
- for (java.util.Iterator it = parentView.getSourceEdges().iterator(); it.hasNext();) {
- buildElement2ViewMap((org.eclipse.gmf.runtime.notation.View) it.next(), element2ViewMap, elements);
- if(elements.size() == element2ViewMap.size()) return element2ViewMap;
- }
- return element2ViewMap;
- }
- } //LazyElement2ViewMap
-«ENDDEFINE»
-
-«DEFINE i18nAccessors FOR gmfgen::GenDiagram-»
-«EXPAND xpt::Externalizer::accessorField(i18nKeyForOpenModelResourceErrorDialog().titleKey())-»
-«EXPAND xpt::Externalizer::accessorField(i18nKeyForOpenModelResourceErrorDialog().messageKey())-»
-«EXPAND xpt::Externalizer::accessorField(i18nKeyForCreateDiagramProgressTask())-»
-«EXPAND xpt::Externalizer::accessorField(i18nKeyForCreateDiagramCommandLabel())-»
-«ENDDEFINE»
-
-«DEFINE i18nValues FOR gmfgen::GenDiagram-»
-«EXPAND xpt::Externalizer::messageEntry(i18nKeyForOpenModelResourceErrorDialog().titleKey(), "Error")-»
-«EXPAND xpt::Externalizer::messageEntry(i18nKeyForOpenModelResourceErrorDialog().messageKey(), "Failed to load model file {0}")-»
-«EXPAND xpt::Externalizer::messageEntry(i18nKeyForCreateDiagramProgressTask(), "Creating diagram and model files")-»
-«EXPAND xpt::Externalizer::messageEntry(i18nKeyForCreateDiagramCommandLabel(), "Creating diagram and model")-»
-«ENDDEFINE»
diff --git a/plugins/org.eclipse.gmf.codegen/templates/xpt/editor/DocumentProvider.xpt b/plugins/org.eclipse.gmf.codegen/templates/xpt/editor/DocumentProvider.xpt
deleted file mode 100644
index f57fc03fc..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates/xpt/editor/DocumentProvider.xpt
+++ /dev/null
@@ -1,748 +0,0 @@
-/*
- * Copyright (c) 2007 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:
- * Alexander Shatalin (Borland) - initial API and implementation
- */
-
-«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
-«EXTENSION xpt::editor::Utils»
-
-«DEFINE DocumentProvider FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::copyright FOR editorGen-»
-package «editorGen.editor.packageName»;
-
-«EXPAND xpt::Common::generatedClassComment»
-public class «documentProviderClassName» extends org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.AbstractDocumentProvider implements org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocumentProvider {
-
- «EXPAND createElementInfo-»
-
- «EXPAND createDocument-»
-
- «EXPAND setupDocument-»
-
- «EXPAND computeModificationStamp-»
-
- «EXPAND createEmptyDocument-»
-
- «EXPAND createEditingDomain-»
-
- «EXPAND setDocumentContent-»
-
- «EXPAND getModificationStamp-»
-
- «EXPAND isDeleted-»
-
- «EXPAND getResourceSetInfo-»
-
- «EXPAND disposeElementInfo-»
- «IF null == editorGen.application-»
-
- «EXPAND doValidateState-»
- «ENDIF-»
-
- «EXPAND isReadOnly-»
-
- «EXPAND isModifiable-»
-
- «EXPAND updateCache-»
-
- «EXPAND doUpdateStateCache-»
-
- «EXPAND isSynchronized-»
- «IF null == editorGen.application-»
-
- «EXPAND getResetRule-»
-
- «EXPAND getSaveRule-»
-
- «EXPAND getSynchronizeRule-»
-
- «EXPAND getValidateStateRule-»
-
- «EXPAND computeSchedulingRule-»
- «ENDIF-»
-
- «EXPAND doSynchronize-»
-
- «EXPAND doSaveDocument-»
-
- «EXPAND handleElementChanged-»
-
- «EXPAND handleElementMoved-»
-
- «EXPAND createInputWithEditingDomain-»
-
- «EXPAND getDiagramDocument-»
-
- «EXPAND getOperationRunner-»
- «IF null != editorGen.application-»
-
- «EXPAND getFile-»
- «ENDIF-»
-
- «EXPAND xpt::editor::ResourceSetInfo::ResourceSetInfo-»
-
- «EXPAND xpt::editor::ResourceSetModificationListener::ResourceSetModificationListener-»
-
- «EXPAND additions-»
-}
-«ENDDEFINE»
-
-«DEFINE createElementInfo FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-protected ElementInfo createElementInfo(Object element) throws org.eclipse.core.runtime.CoreException {
- «EXPAND checkEditorInputInstance-»
- org.eclipse.ui.IEditorInput editorInput = (org.eclipse.ui.IEditorInput) element;
- org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocument document = (org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocument) createDocument(editorInput);
-
- ResourceSetInfo info = new ResourceSetInfo(document, editorInput);
- info.setModificationStamp(computeModificationStamp(info));
- info.fStatus = null;
- return info;
-}
-«ENDDEFINE»
-
-«DEFINE checkEditorInputInstance FOR gmfgen::GenDiagram-»
-if («IF null == editorGen.application»false == element instanceof «EXPAND fileEditorInputClassFQName» && «ENDIF»false == element instanceof «EXPAND uriEditorInputClassFQName») {
- «EXPAND throwIncorrectInputException-»
-}
-«ENDDEFINE»
-
-«DEFINE throwIncorrectInputException FOR gmfgen::GenDiagram-»
-throw new org.eclipse.core.runtime.CoreException(new org.eclipse.core.runtime.Status(org.eclipse.core.runtime.IStatus.ERROR, «editorGen.plugin.getActivatorQualifiedClassName()».ID, 0,
- org.eclipse.osgi.util.NLS.bind(
- «EXPAND xpt::Externalizer::accessorCall(i18nKeyForDocumentProviderIncorrectInputError()) FOR editorGen»,
- new Object[] {element, «IF null == editorGen.application»"«EXPAND fileEditorInputClassFQName»", «ENDIF»"«EXPAND uriEditorInputClassFQName»"}),«EXPAND xpt::Common::nonNLS(1)»«IF null == editorGen.application»«EXPAND xpt::Common::nonNLS(2)»«ENDIF»
- null));
-«ENDDEFINE»
-
-«DEFINE fileEditorInputClassFQName FOR gmfgen::GenDiagram»org.eclipse.ui.part.FileEditorInput«ENDDEFINE»
-
-«DEFINE uriEditorInputClassFQName FOR gmfgen::GenDiagram»org.eclipse.emf.common.ui.URIEditorInput«ENDDEFINE»
-
-«DEFINE createDocument FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-protected org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDocument createDocument(Object element) throws org.eclipse.core.runtime.CoreException {
- «EXPAND checkEditorInputInstance-»
- org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDocument document = createEmptyDocument();
- setDocumentContent(document, (org.eclipse.ui.IEditorInput) element);
- setupDocument(element, document);
- return document;
-}
-«ENDDEFINE»
-
-«DEFINE setupDocument FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment(
- "Sets up the given document as it would be provided for the given element. The\n" +
- "content of the document is not changed. This default implementation is empty.\n" +
- "Subclasses may reimplement.\n" +
- "\n" +
- "@param element the blue-print element\n" +
- "@param document the document to set up"
- )»
-protected void setupDocument(Object element, org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDocument document) {
- // for subclasses
-}
-«ENDDEFINE»
-
-«DEFINE computeModificationStamp FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-private long computeModificationStamp(ResourceSetInfo info) {
- int result = 0;
- for (java.util.Iterator/*<org.eclipse.emf.ecore.resource.Resource>*/ it = info.getLoadedResourcesIterator(); it.hasNext();) {
- org.eclipse.emf.ecore.resource.Resource nextResource = (org.eclipse.emf.ecore.resource.Resource) it.next();
- «IF null == editorGen.application-»
- org.eclipse.core.resources.IFile file = org.eclipse.emf.workspace.util.WorkspaceSynchronizer.getFile(nextResource);
- if (file != null) {
- if (file.getLocation() != null) {
- result += file.getLocation().toFile().lastModified();
- } else {
- result += file.getModificationStamp();
- }
- }
- «ELSE-»
- java.io.File file = getFile(nextResource);
- if (file != null && file.exists()) {
- result += file.lastModified();
- }
- «ENDIF-»
- }
- return result;
-}
-«ENDDEFINE»
-
-«DEFINE createEmptyDocument FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-protected org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDocument createEmptyDocument() {
- org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.DiagramDocument document = new org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.DiagramDocument();
- document.setEditingDomain(createEditingDomain());
- return document;
-}
-«ENDDEFINE»
-
-«DEFINE createEditingDomain FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::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»");«EXPAND xpt::Common::nonNLS»
- 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;
-
- public org.eclipse.emf.common.notify.Notifier getTarget() {
- return myTarger;
- }
-
- public boolean isAdapterForType(Object type) {
- return false;
- }
-
- public void notifyChanged(org.eclipse.emf.common.notify.Notification notification) {
- if (diagramResourceModifiedFilter.matches(notification)) {
- Object value = notification.getNewValue();
- if (value instanceof org.eclipse.emf.ecore.resource.Resource) {
- ((org.eclipse.emf.ecore.resource.Resource) value).setTrackingModification(true);
- }
- }
- }
-
- public void setTarget(org.eclipse.emf.common.notify.Notifier newTarget) {
- myTarger = newTarget;
- }
-
- });
-
- return editingDomain;
-}
-«ENDDEFINE»
-
-«DEFINE setDocumentContent FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::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 == editorGen.application»if (element instanceof «EXPAND fileEditorInputClassFQName») {
- org.eclipse.core.resources.IStorage storage = ((«EXPAND fileEditorInputClassFQName») 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 «EXPAND uriEditorInputClassFQName») {
- org.eclipse.emf.common.util.URI uri = ((«EXPAND uriEditorInputClassFQName») element).getURI();
- org.eclipse.emf.ecore.resource.Resource resource = null;
- try {
- resource = domain.getResourceSet().getResource(uri.trimFragment(), false);
- if (resource == null) {
- resource = domain.getResourceSet().createResource(uri.trimFragment());
- }
- if (!resource.isLoaded()) {
- try {
- java.util.Map options = new java.util.HashMap(org.eclipse.gmf.runtime.emf.core.resources.GMFResourceFactory.getDefaultLoadOptions());
- // @see 171060
- // options.put(org.eclipse.emf.ecore.xmi.XMLResource.OPTION_RECORD_UNKNOWN_FEATURE, Boolean.TRUE);
- resource.load(options);
- } catch (java.io.IOException e) {
- resource.unload();
- throw e;
- }
- }
- if (uri.fragment() != null) {
- org.eclipse.emf.ecore.EObject rootElement = resource.getEObject(uri.fragment());
- if (rootElement instanceof org.eclipse.gmf.runtime.notation.Diagram) {
- document.setContent((org.eclipse.gmf.runtime.notation.Diagram) rootElement);
- return;
- }
- } else {
- for (java.util.Iterator it = resource.getContents().iterator(); it.hasNext();) {
- Object rootElement = it.next();
- if (rootElement instanceof org.eclipse.gmf.runtime.notation.Diagram) {
- document.setContent((org.eclipse.gmf.runtime.notation.Diagram) rootElement);
- return;
- }
- }
- }
- throw new RuntimeException(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForDocumentProviderNoDiagramInResourceError()) FOR editorGen»);
- } 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, «editorGen.plugin.getActivatorQualifiedClassName()».ID, 0,
- msg != null ? msg : «EXPAND xpt::Externalizer::accessorCall(i18nKeyForDocumentProviderDiagramLoadingError()) FOR editorGen», e));
- }
- throw thrownExcp;
- }
- } else {
- «EXPAND throwIncorrectInputException-»
- }
-}
-«ENDDEFINE»
-
-«DEFINE getModificationStamp FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-public long getModificationStamp(Object element) {
- ResourceSetInfo info = getResourceSetInfo(element);
- if (info != null) {
- return computeModificationStamp(info);
- }
- return super.getModificationStamp(element);
-}
-«ENDDEFINE»
-
-«DEFINE isDeleted FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-public boolean isDeleted(Object element) {
- org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocument document = getDiagramDocument(element);
- if (document != null) {
- org.eclipse.emf.ecore.resource.Resource diagramResource = document.getDiagram().eResource();
- if (diagramResource != null) {
- «IF null == editorGen.application-»
- org.eclipse.core.resources.IFile file = org.eclipse.emf.workspace.util.WorkspaceSynchronizer.getFile(diagramResource);
- return file == null || file.getLocation() == null || !file.getLocation().toFile().exists();
- «ELSE-»
- java.io.File file = getFile(diagramResource);
- return file != null && !file.exists();
- «ENDIF-»
- }
- }
- return super.isDeleted(element);
-}
-«ENDDEFINE»
-
-«DEFINE getResourceSetInfo FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-public ResourceSetInfo getResourceSetInfo(Object editorInput) {
- return (ResourceSetInfo) super.getElementInfo(editorInput);
-}
-«ENDDEFINE»
-
-«DEFINE disposeElementInfo FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-protected void disposeElementInfo(Object element, ElementInfo info) {
- if (info instanceof ResourceSetInfo) {
- ResourceSetInfo resourceSetInfo = (ResourceSetInfo) info;
- resourceSetInfo.dispose();
- }
- super.disposeElementInfo(element, info);
-}
-«ENDDEFINE»
-
-«DEFINE doValidateState FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-protected void doValidateState(Object element, Object computationContext) throws org.eclipse.core.runtime.CoreException {
- ResourceSetInfo info = getResourceSetInfo(element);
- if (info != null) {
- java.util.Collection/*<org.eclipse.core.resources.IFile>*/ files2Validate = new java.util.ArrayList/*<org.eclipse.core.resources.IFile>*/();
- for (java.util.Iterator/*<org.eclipse.emf.ecore.resource.Resource>*/ it = info.getLoadedResourcesIterator(); it.hasNext();) {
- org.eclipse.emf.ecore.resource.Resource nextResource = (org.eclipse.emf.ecore.resource.Resource) it.next();
- org.eclipse.core.resources.IFile file = org.eclipse.emf.workspace.util.WorkspaceSynchronizer.getFile(nextResource);
- if (file != null && file.isReadOnly()) {
- files2Validate.add(file);
- }
- }
- org.eclipse.core.resources.ResourcesPlugin.getWorkspace().validateEdit((org.eclipse.core.resources.IFile[]) files2Validate.toArray(new org.eclipse.core.resources.IFile[files2Validate.size()]), computationContext);
- }
-
- super.doValidateState(element, computationContext);
-}
-«ENDDEFINE»
-
-«DEFINE isReadOnly FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-public boolean isReadOnly(Object element) {
- ResourceSetInfo info = getResourceSetInfo(element);
- if (info != null) {
- «EXPAND callUpdateCache-»
- return info.isReadOnly();
- }
- return super.isReadOnly(element);
-}
-«ENDDEFINE»
-
-«DEFINE isModifiable FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-public boolean isModifiable(Object element) {
- if (!isStateValidated(element)) {
- if («IF null == editorGen.application»element instanceof «EXPAND fileEditorInputClassFQName» || «ENDIF»element instanceof «EXPAND uriEditorInputClassFQName») {
- return true;
- }
- }
- ResourceSetInfo info = getResourceSetInfo(element);
- if (info != null) {
- «EXPAND callUpdateCache-»
- return info.isModifiable();
- }
- return super.isModifiable(element);
-}
-«ENDDEFINE»
-
-«DEFINE callUpdateCache FOR gmfgen::GenDiagram-»
-if (info.isUpdateCache()) {
- try {
- updateCache(element);
- } catch (org.eclipse.core.runtime.CoreException ex) {
- «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().logError(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForDocumentProviderIsModifiable()) FOR editorGen», ex);
- // Error message to log was initially taken from org.eclipse.gmf.runtime.diagram.ui.resources.editor.ide.internal.l10n.EditorMessages.StorageDocumentProvider_isModifiable
- }
-}
-«ENDDEFINE»
-
-«DEFINE updateCache FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-protected void updateCache(Object element) throws org.eclipse.core.runtime.CoreException {
- ResourceSetInfo info = getResourceSetInfo(element);
- if (info != null) {
- for (java.util.Iterator/*<org.eclipse.emf.ecore.resource.Resource>*/ it = info.getLoadedResourcesIterator(); it.hasNext();) {
- org.eclipse.emf.ecore.resource.Resource nextResource = (org.eclipse.emf.ecore.resource.Resource) it.next();
- «IF null == editorGen.application-»
- org.eclipse.core.resources.IFile file = org.eclipse.emf.workspace.util.WorkspaceSynchronizer.getFile(nextResource);
- if (file != null && file.isReadOnly()) {
- «ELSE-»
- java.io.File file = getFile(nextResource);
- if (file != null && file.exists() && !file.canWrite()) {
- «ENDIF-»
- info.setReadOnly(true);
- info.setModifiable(false);
- return;
- }
- }
- info.setReadOnly(false);
- info.setModifiable(true);
- return;
- }
-}
-«ENDDEFINE»
-
-«DEFINE doUpdateStateCache FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-protected void doUpdateStateCache(Object element) throws org.eclipse.core.runtime.CoreException {
- ResourceSetInfo info = getResourceSetInfo(element);
- if (info != null) {
- info.setUpdateCache(true);
- }
- super.doUpdateStateCache(element);
-}
-«ENDDEFINE»
-
-«DEFINE isSynchronized FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-public boolean isSynchronized(Object element) {
- ResourceSetInfo info = getResourceSetInfo(element);
- if (info != null) {
- return info.isSynchronized();
- }
- return super.isSynchronized(element);
-}
-«ENDDEFINE»
-
-«DEFINE getResetRule FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-protected org.eclipse.core.runtime.jobs.ISchedulingRule getResetRule(Object element) {
- ResourceSetInfo info = getResourceSetInfo(element);
- if (info != null) {
- java.util.Collection/*<org.eclipse.core.runtime.jobs.ISchedulingRule>*/ rules = new java.util.ArrayList/*<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 = (org.eclipse.emf.ecore.resource.Resource) it.next();
- org.eclipse.core.resources.IFile file = org.eclipse.emf.workspace.util.WorkspaceSynchronizer.getFile(nextResource);
- if (file != null) {
- rules.add(org.eclipse.core.resources.ResourcesPlugin.getWorkspace().getRuleFactory().modifyRule(file));
- }
- }
- return new org.eclipse.core.runtime.jobs.MultiRule((org.eclipse.core.runtime.jobs.ISchedulingRule[]) rules.toArray(new org.eclipse.core.runtime.jobs.ISchedulingRule[rules.size()]));
- }
- return null;
-}
-«ENDDEFINE»
-
-«DEFINE getSaveRule FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-protected org.eclipse.core.runtime.jobs.ISchedulingRule getSaveRule(Object element) {
- ResourceSetInfo info = getResourceSetInfo(element);
- if (info != null) {
- java.util.Collection/*<org.eclipse.core.runtime.jobs.ISchedulingRule>*/ rules = new java.util.ArrayList/*<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 = (org.eclipse.emf.ecore.resource.Resource) it.next();
- org.eclipse.core.resources.IFile file = org.eclipse.emf.workspace.util.WorkspaceSynchronizer.getFile(nextResource);
- if (file != null) {
- rules.add(computeSchedulingRule(file));
- }
- }
- return new org.eclipse.core.runtime.jobs.MultiRule((org.eclipse.core.runtime.jobs.ISchedulingRule[]) rules.toArray(new org.eclipse.core.runtime.jobs.ISchedulingRule[rules.size()]));
- }
- return null;
-}
-«ENDDEFINE»
-
-«DEFINE getSynchronizeRule FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-protected org.eclipse.core.runtime.jobs.ISchedulingRule getSynchronizeRule(Object element) {
- ResourceSetInfo info = getResourceSetInfo(element);
- if (info != null) {
- java.util.Collection/*<org.eclipse.core.runtime.jobs.ISchedulingRule>*/ rules = new java.util.ArrayList/*<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 = (org.eclipse.emf.ecore.resource.Resource) it.next();
- org.eclipse.core.resources.IFile file = org.eclipse.emf.workspace.util.WorkspaceSynchronizer.getFile(nextResource);
- if (file != null) {
- rules.add(org.eclipse.core.resources.ResourcesPlugin.getWorkspace().getRuleFactory().refreshRule(file));
- }
- }
- return new org.eclipse.core.runtime.jobs.MultiRule((org.eclipse.core.runtime.jobs.ISchedulingRule[]) rules.toArray(new org.eclipse.core.runtime.jobs.ISchedulingRule[rules.size()]));
- }
- return null;
-}
-«ENDDEFINE»
-
-«DEFINE getValidateStateRule FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-protected org.eclipse.core.runtime.jobs.ISchedulingRule getValidateStateRule(Object element) {
- ResourceSetInfo info = getResourceSetInfo(element);
- if (info != null) {
- java.util.Collection/*<org.eclipse.core.runtime.jobs.ISchedulingRule>*/ files = new java.util.ArrayList/*<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 = (org.eclipse.emf.ecore.resource.Resource) it.next();
- org.eclipse.core.resources.IFile file = org.eclipse.emf.workspace.util.WorkspaceSynchronizer.getFile(nextResource);
- if (file != null) {
- files.add(file);
- }
- }
- return org.eclipse.core.resources.ResourcesPlugin.getWorkspace().getRuleFactory().validateEditRule((org.eclipse.core.resources.IFile[]) files.toArray(new org.eclipse.core.resources.IFile[files.size()]));
- }
- return null;
-}
-«ENDDEFINE»
-
-«DEFINE computeSchedulingRule FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::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 {
- /*
- * XXX This is a workaround for
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=67601
- * IResourceRuleFactory.createRule should iterate the hierarchy
- * itself.
- */
- toCreateOrModify = parent;
- parent = toCreateOrModify.getParent();
- } while (parent != null && !parent.exists());
-
- return org.eclipse.core.resources.ResourcesPlugin.getWorkspace().getRuleFactory().createRule(toCreateOrModify);
-}
-«ENDDEFINE»
-
-«DEFINE doSynchronize FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-protected void doSynchronize(Object element, org.eclipse.core.runtime.IProgressMonitor monitor) throws org.eclipse.core.runtime.CoreException {
- ResourceSetInfo info = getResourceSetInfo(element);
- if (info != null) {
- for (java.util.Iterator/*<org.eclipse.emf.ecore.resource.Resource>*/ it = info.getLoadedResourcesIterator(); it.hasNext();) {
- org.eclipse.emf.ecore.resource.Resource nextResource = (org.eclipse.emf.ecore.resource.Resource) it.next();
- handleElementChanged(info, nextResource, monitor);
- }
- return;
- }
- super.doSynchronize(element, monitor);
-}
-«ENDDEFINE»
-
-«DEFINE handleElementChanged FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-protected void handleElementChanged(ResourceSetInfo info, org.eclipse.emf.ecore.resource.Resource changedResource, org.eclipse.core.runtime.IProgressMonitor monitor) {
- «IF null == editorGen.application-»
- org.eclipse.core.resources.IFile file = org.eclipse.emf.workspace.util.WorkspaceSynchronizer.getFile(changedResource);
- if (file != null) {
- try {
- file.refreshLocal(org.eclipse.core.resources.IResource.DEPTH_INFINITE, monitor);
- } catch (org.eclipse.core.runtime.CoreException ex) {
- «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().logError(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForDocumentProviderHandleElementContentChanged()) FOR editorGen», ex);
- // Error message to log was initially taken from org.eclipse.gmf.runtime.diagram.ui.resources.editor.ide.internal.l10n.EditorMessages.FileDocumentProvider_handleElementContentChanged
- }
- }
- «ENDIF-»
- changedResource.unload();
-
- fireElementContentAboutToBeReplaced(info.getEditorInput());
- removeUnchangedElementListeners(info.getEditorInput(), info);
- info.fStatus = null;
- try {
- setDocumentContent(info.fDocument, info.getEditorInput());
- } catch (org.eclipse.core.runtime.CoreException e) {
- info.fStatus = e.getStatus();
- }
-«REM»TODO: Remove this if and call setModificationStamp only from doSaveDocument method«ENDREM»«-»
- if (!info.fCanBeSaved) {
- info.setModificationStamp(computeModificationStamp(info));
- }
- addUnchangedElementListeners(info.getEditorInput(), info);
- fireElementContentReplaced(info.getEditorInput());
-}
-«ENDDEFINE»
-
-«DEFINE doSaveDocument FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::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, «editorGen.plugin.getActivatorQualifiedClassName()».ID,
- «IF null == editorGen.application»org.eclipse.core.resources.IResourceStatus.OUT_OF_SYNC_LOCAL«ELSE»org.eclipse.core.runtime.IStatus.ERROR«ENDIF»,
- «EXPAND xpt::Externalizer::accessorCall(i18nKeyForDocumentUnsynchronizedFileSaveError()) FOR editorGen»,
- null));
- }
- «IF null == editorGen.application-»
- info.stopResourceListening();
- «ENDIF-»
- fireElementStateChanging(element);
- try {
- monitor.beginTask(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForDocumentSaveDiagramTask()) FOR editorGen», 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 = (org.eclipse.emf.ecore.resource.Resource) it.next();</