Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/org.eclipse.gmf.codegen/templates.migrated/xpt')
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/Common.xpt92
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/ConstraintProviders.xpt101
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/Externalizer.xpt102
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/ExternalizerUtils.qvto21
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/GenAuditRoot.qvto35
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/GenEditorGenerator.qvto7
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/GenModelUtils.qvto40
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/NonNLSUtils.qvto21
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/application/ActionBarAdvisor.xpt266
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/application/Application.xpt51
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/application/Perspective.xpt45
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/application/WizardNewFileCreationPage.xpt206
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/application/WorkbenchAdvisor.xpt63
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/application/WorkbenchWindowAdvisor.xpt63
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/application/extensions.xpt94
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/application/i18n.qvto63
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/Utils.qvto64
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/ViewmapAttributesUtils.qvto62
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/commands/CreateLinkCommand.xpt126
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/commands/CreateLinkUtils.xpt148
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/commands/CreateNodeCommand.xpt161
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/commands/CreateRefLinkCommand.xpt18
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/commands/CreateShortcutDecorationsCommand.xpt60
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/commands/ReorientLinkCommand.xpt46
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/commands/ReorientLinkUtils.xpt302
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/commands/ReorientLinkViewCommand.xpt63
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/commands/ReorientRefLinkCommand.xpt50
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/edithelpers/BaseEditHelper.xpt99
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/edithelpers/EditHelper.xpt25
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/edithelpers/EditHelperAdvice.xpt25
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/editparts/Common.xpt155
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/editparts/EditPartFactory.xpt129
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/editparts/Utils.qvto67
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/editpolicies/BaseItemSemanticEditPolicy.xpt496
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/editpolicies/ChildContainerCanonicalEditPolicy.xpt28
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/editpolicies/CompartmentItemSemanticEditPolicy.xpt38
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/editpolicies/DiagramCanonicalEditPolicy.xpt240
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/editpolicies/DiagramItemSemanticEditPolicy.xpt63
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/editpolicies/GraphicalNodeEditPolicy.xpt72
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/editpolicies/LinkItemSemanticEditPolicy.xpt56
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/editpolicies/LinkUtils.qvto54
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/editpolicies/NodeItemSemanticEditPolicy.xpt141
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/editpolicies/OpenDiagram.xpt165
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/editpolicies/TextFeedback.xpt203
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/editpolicies/Utils.qvto115
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/editpolicies/childContainerCreateCommand.xpt33
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/editpolicies/linkCommands.xpt144
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/preferences/PreferenceInitializer.xpt112
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/preferences/extensions.xpt49
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/updater/DiagramUpdater.xpt488
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/updater/LinkDescriptor.xpt120
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/updater/NodeDescriptor.xpt64
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/updater/UpdateCommand.xpt93
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/updater/Utils.qvto150
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/updater/containerBaseCanonicalMethods.xpt166
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/updater/extensions.xpt34
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/views/Utils.xpt87
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/ActionBarContributor.xpt70
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/CreationWizard.xpt181
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/CreationWizardPage.xpt105
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/DeleteElementAction.xpt79
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/DiagramContentInitializer.xpt174
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/DiagramEditorContextMenuProvider.xpt72
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/DiagramEditorUtil.xpt423
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/DocumentProvider.xpt748
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/Editor.xpt404
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/ElementChooser.xpt414
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/GenDiagram.qvto27
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/InitDiagramFileAction.xpt145
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/MatchingStrategy.xpt49
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/ModelElementSelectionPage.xpt167
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/NewDiagramFileWizard.xpt200
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/ResourceSetInfo.xpt331
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/ResourceSetModificationListener.xpt89
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/ShortcutCreationWizard.xpt156
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/ShortcutPropertyTester.xpt53
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/UriEditorInputTester.xpt40
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/Utils.qvto255
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/ValidateAction.xpt351
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/ValidationMarker.xpt112
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/VisualIDRegistry.xpt386
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/diagram.gifbin339 -> 0 bytes
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/extensions.xpt86
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/palette/PaletteFactory.xpt286
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/palette/Utils.qvto49
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/shortcut.gifbin93 -> 0 bytes
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/wizban.gifbin2466 -> 0 bytes
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/expressions/AbstractExpression.xpt145
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/expressions/OCLExpressionFactory.xpt148
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/expressions/RegexpExpressionFactory.xpt74
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/expressions/ValueExpression.qvto15
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/expressions/getExpression.xpt19
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/navigator/AbstractNavigatorItem.xpt81
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/navigator/DomainNavigatorContentProvider.xpt98
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/navigator/DomainNavigatorItem.xpt121
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/navigator/DomainNavigatorLabelProvider.xpt123
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/navigator/NavigatorActionProvider.xpt206
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/navigator/NavigatorContentProvider.xpt492
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/navigator/NavigatorGroup.xpt129
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/navigator/NavigatorItem.xpt109
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/navigator/NavigatorLabelProvider.xpt424
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/navigator/NavigatorLinkHelper.xpt132
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/navigator/NavigatorSorter.xpt58
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/navigator/Utils.qvto63
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/navigator/extensions.xpt166
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/navigator/getEditorInput.xpt44
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/navigator/navigatorGroup.gifbin709 -> 0 bytes
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/plugin/Activator.xpt218
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/plugin/build.xpt26
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/plugin/manifest.xpt74
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/plugin/options.xpt23
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/plugin/plugin.xpt158
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/plugin/properties.xpt53
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/propsheet/LabelProvider.xpt94
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/propsheet/PropertySection.xpt145
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/propsheet/extensions.xpt144
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/providers/EditPartProvider.xpt125
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/providers/ElementInitializers.qvto78
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/providers/ElementInitializers.xpt177
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/providers/ElementTypes.xpt257
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/providers/IconProvider.xpt39
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/providers/MarkerNavigationProvider.xpt86
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/providers/MetricProvider.xpt432
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/providers/Metrics.qvto26
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/providers/MetricsResultView.xpt277
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/providers/ModelingAssistantProvider.xpt252
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/providers/ParserUtils.qvto17
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/providers/ShortcutsDecoratorProvider.xpt110
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/providers/ValidationDecoratorProvider.xpt393
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/providers/ValidationProvider.xpt321
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/providers/ViewProvider.xpt432
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/providers/extensions.xpt184
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/providers/i18n.qvto15
133 files changed, 0 insertions, 18336 deletions
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/Common.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/Common.xpt
deleted file mode 100644
index 2b51ce783..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/Common.xpt
+++ /dev/null
@@ -1,92 +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»
-«EXTENSION xpt::StringOperations»
-
-«DEFINE copyright FOR gmfgen::GenEditorGenerator-»
-«IF copyrightText <> null-»
-/*
- * «copyrightText.xpandReplaceAll('\n', '\n * ')»
- */
-«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE xcopyright FOR gmfgen::GenEditorGenerator-»
-«IF copyrightText <> null-»
-<!--
-«copyrightText»
--->
-«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE generatedClassComment FOR OclAny»«EXPAND generatedClassComment('')»«ENDDEFINE»
-«DEFINE generatedClassComment(comment : String) FOR OclAny-»
-/**
-«IF comment.xpandLength() > 0-»
- * «comment.xpandReplaceAll('\n', '\n * ')»
-«ENDIF-»
- * @generated
- */«ENDDEFINE»
-
-«DEFINE generatedMemberComment FOR Collection(OclAny)»«EXPAND generatedMemberComment('') FOR ''»«ENDDEFINE»
-«DEFINE generatedMemberComment FOR OclAny»«EXPAND generatedMemberComment('')»«ENDDEFINE»
-«DEFINE generatedMemberComment(comment : String) FOR OclAny-»
-/**
-«IF comment.xpandLength() > 0-»
- * «comment.xpandReplaceAll('\n', '\n * ')»
-«ENDIF-»
- * @generated
- */«ENDDEFINE»
-
-«DEFINE xmlGeneratedTag FOR OclAny»<?gmfgen generated="true"?>«ENDDEFINE»
-
-«DEFINE getSaveOptions FOR gmfgen::GenDiagram»«getDiagramEditorUtilQualifiedClassName()».getSaveOptions()«ENDDEFINE»
-
-«DEFINE setCharset(varName : String) FOR gmfgen::GenDiagram-»
-«getDiagramEditorUtilQualifiedClassName()».setCharset(«varName»);
-«ENDDEFINE»
-
-«DEFINE nonNLS FOR OclAny»«EXPAND nonNLS(1)»«ENDDEFINE»
-
-«DEFINE nonNLS FOR Collection(OclAny)»«EXPAND nonNLS FOR getNonNLSCounter(self)»«ENDDEFINE»
-
-«DEFINE nonNLS FOR Collection(Integer)»«EXPAND nonNLS FOREACH self»«ENDDEFINE»
-
-«DEFINE nonNLS(i : Integer) FOR OclAny»«EXPAND nonNLS FOR i»«ENDDEFINE»
-
-«DEFINE nonNLS FOR Integer» //$NON-NLS-«self»$«ENDDEFINE»
-
-«DEFINE caseVisualID FOR gmfgen::GenCommonBase»case «EXPAND xpt::editor::VisualIDRegistry::visualID»:«ENDDEFINE»
-
-«DEFINE addShortcutAnnotation(viewVar : String) 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", «EXPAND xpt::editor::VisualIDRegistry::modelID»);«EXPAND xpt::Common::nonNLS»
- «viewVar».getEAnnotations().add(shortcutAnnotation);
-«ENDDEFINE»
-
-
-«DEFINE packageStatement FOR String-»
-«IF self.xpandSplit('\\.')->size() > 1-»
-package «FOREACH let tmpVar = self.xpandSplit('\\.') in if tmpVar->size() < 2 then Sequence{}[String] else tmpVar->subSequence(1, tmpVar->size() - 1) endif 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(condition : String) FOR OclAny-»
-assert «condition»;«IF condition.isQuoted('\"')»«EXPAND nonNLS»«ENDIF»
-«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/ConstraintProviders.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/ConstraintProviders.xpt
deleted file mode 100644
index dbb98dd7b..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/ConstraintProviders.xpt
+++ /dev/null
@@ -1,101 +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»
-«EXTENSION xpt::GenEditorGenerator»
-«EXTENSION org::eclipse::gmf::internal::codegen::util::CodeGenerationUtils»
-
-«DEFINE extensions FOR gmfgen::GenEditorGenerator-»
-«IF hasAudits(self)»«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 gmfgen::GenAuditRoot-»
- <extension point="org.eclipse.emf.validation.constraintProviders">
- «EXPAND xpt::Common::xmlGeneratedTag»
- «EXPAND declareCategory FOREACH categories-»
- <constraintProvider cache="true">
-«FOREACH getAllTargetedModelPackages(self) 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 gmfgen::GenAuditRoot-»
- <extension point="org.eclipse.emf.validation.constraintBindings">
- «EXPAND xpt::Common::xmlGeneratedTag»
-«FOREACH clientContexts->asSequence() AS ctx-»
- <clientContext default="false" id="«getQualifiedIdentity(ctx)»">
- <selector class="«ctx.getQualifiedClassName()»"/>
- </clientContext>
- <binding context="«getQualifiedIdentity(ctx)»">
- «FOREACH rules->select(r | r.target <> null and r.target.contextSelector = ctx)->asSequence() /*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 gmfgen::GenAuditRoot-»
-«IF editorGen.diagram.liveValidationUIFeedback»
- <extension point="org.eclipse.emf.validation.ui.UIRegisteredClientContext">
- «EXPAND xpt::Common::xmlGeneratedTag»
-«FOREACH clientContexts->asSequence() 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[«(if description <> null then description else '' endif)»]]>
- </category>
-«ENDDEFINE»
-
-«DEFINE defineCategory FOR gmfgen::GenAuditContainer-»
- <constraints categories="«EXPAND _pathMap»">
- «FOREACH audits->select(a | a.target <> null and a.target.getTargetClass() <> null)->asSequence() AS audit-»
- <constraint id="«escapeXML(audit.id)»"
- «IF audit.requiresConstraintAdapter»lang="Java" class="«audit.getConstraintAdapterQualifiedClassName()»"«ELSE»lang="OCL"«ENDIF»
- name="«escapeXML((if audit.name <> null then audit.name else audit.id endif))»"
- mode="«IF audit.useInLiveMode»Live«ELSE»Batch«ENDIF»"
- severity="«audit.severity.repr()»" statusCode="200">
- «IF not audit.requiresConstraintAdapter»<![CDATA[«(if audit.rule <> null then audit.rule.body else '' endif)»]]>«ENDIF»
- <description><![CDATA[«(if audit.description <> null then audit.description else '' endif)»]]></description>
- <message><![CDATA[«IF audit.message <> null»«audit.message»«ELSE»«(if audit.name <> null then audit.name else audit.id endif)» audit violated«ENDIF»]]></message>
- <target class="«audit.target.getTargetClassModelQualifiedName()»"/>
- </constraint>
- «ENDFOREACH-»
- </constraints>
-«ENDDEFINE»
-
-«DEFINE _pathMap FOR gmfgen::GenAuditContainer»«FOREACH path->asSequence() AS p SEPARATOR '/' »«escapeXML(p.id)»«ENDFOREACH»«ENDDEFINE»
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/Externalizer.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/Externalizer.xpt
deleted file mode 100644
index 4e8ef19d1..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/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(self)»;
-
-«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().toLower()»", «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(key : String) FOR OclAny»
- «EXPAND xpt::Common::generatedMemberComment»
- public static String «escapeIllegalKeySymbols(key)»;
-«ENDDEFINE»
-
-«DEFINE messageEntry(key : String, message : String) FOR OclAny-»
-«escapeIllegalKeySymbols(key)»=«escapeIllegalMessageSymbols(message)»
-«ENDDEFINE»
-
-«DEFINE accessorCall(key : String) FOR gmfgen::GenEditorGenerator-»
-«getExternalizerPackageName(self)».«getExternalizerClassName()».«escapeIllegalKeySymbols(key)»«ENDDEFINE»
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/ExternalizerUtils.qvto b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/ExternalizerUtils.qvto
deleted file mode 100644
index 8e8bb5381..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/ExternalizerUtils.qvto
+++ /dev/null
@@ -1,21 +0,0 @@
-import xpt.StringOperations;
-
-modeltype genModel uses "http://www.eclipse.org/gmf/2008/GenModel";
-
-library ExternalizerUtils;
-
-helper getExternalizerPackageName(generator : genModel::GenEditorGenerator) : String {
- return generator.editor.packageName
-}
-
-helper getExternalizerClassName() : String {
- return 'Messages'
-}
-
-helper escapeIllegalKeySymbols(key : String) : String {
- return key.xpandReplaceAll('[=&\"]', '').xpandReplaceAll('[ .]', '_')
-}
-
-helper escapeIllegalMessageSymbols(message : String) : String {
- return message.xpandReplaceAll('!', '\\\\!')
-}
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/GenAuditRoot.qvto b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/GenAuditRoot.qvto
deleted file mode 100644
index 4c8839345..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/GenAuditRoot.qvto
+++ /dev/null
@@ -1,35 +0,0 @@
-import xpt.GenEditorGenerator;
-
-modeltype genModel uses "http://www.eclipse.org/gmf/2008/GenModel";
-modeltype genModel_1 uses "http://www.eclipse.org/emf/2002/GenModel";
-
-library GenAuditRoot;
-
-helper getAllTargetedModelPackages(root : genModel::GenAuditRoot) : Sequence(genModel_1::GenPackage) {
- return root.rules->select(r | r.target <> null and r.target.getTargetClass() <> null)->collect(r | r.target.getTargetClass().genPackage)->asOrderedSet()->asSequence()
-}
-
-helper getQualifiedIdentity(ctx : genModel::GenAuditContext) : String {
- return ctx.root.editorGen.plugin.iD + ctx.id
-}
-
-helper hasDiagramElementTargetRule(audits : genModel::GenAuditRoot) : Boolean {
- return audits <> null and (audits.rules.target)[genModel::GenDiagramElementTarget]->size() > 0
-}
-
-helper hasAnyNotationElementTargetRule(audits : genModel::GenAuditRoot) : Boolean {
- return audits <> null and (audits.rules.target)[genModel::GenNotationElementTarget]->size() > 0
-}
-
-helper shouldRunValidateOnDiagram(audits : genModel::GenAuditRoot) : Boolean {
- return hasDiagramElementTargetRule(audits) or hasAnyNotationElementTargetRule(audits)
-}
-
-helper getTargetDiagramElements(ctx : genModel::GenAuditContext) : Sequence(genModel::GenCommonBase) {
- return (ctx.ruleTargets)[genModel::GenDiagramElementTarget].element->asOrderedSet()->asSequence()
-}
-
-helper getAllTargetDiagramElements(root : genModel::GenAuditRoot) : Sequence(genModel::GenCommonBase) {
- return root.clientContexts->collect(it | getTargetDiagramElements(it))->asOrderedSet()->asSequence()
-}
-
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/GenEditorGenerator.qvto b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/GenEditorGenerator.qvto
deleted file mode 100644
index e2ca0489d..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/GenEditorGenerator.qvto
+++ /dev/null
@@ -1,7 +0,0 @@
-modeltype genModel uses "http://www.eclipse.org/gmf/2008/GenModel";
-
-library GenEditorGenerator;
-
-helper hasAudits(editorGen : genModel::GenEditorGenerator) : Boolean {
- return editorGen.audits <> null and not editorGen.audits.rules->isEmpty()
-}
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/GenModelUtils.qvto b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/GenModelUtils.qvto
deleted file mode 100644
index f314ceadc..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/GenModelUtils.qvto
+++ /dev/null
@@ -1,40 +0,0 @@
-import org.eclipse.gmf.internal.codegen.util.GenModelUtils;
-import xpt.StringOperations;
-
-modeltype genModel uses "http://www.eclipse.org/emf/2002/GenModel";
-modeltype ecore uses "http://www.eclipse.org/emf/2002/Ecore";
-
-library GenModelUtils;
-
-
-
-helper getReverse(feature : genModel::GenFeature) : genModel::GenFeature {
- return (if isReferenceType(feature) then let eReverseFeature = feature.ecoreFeature.oclAsType(ecore::EReference).eOpposite in (if eReverseFeature <> null then let genClass = findGenClassifier(feature.genClass.genPackage.genModel, eReverseFeature.eContainingClass).oclAsType(genModel::GenClass) in (if genClass <> null then genClass.genFeatures->select(e | e.ecoreFeature = eReverseFeature)->first() else null endif) else null endif) else null endif)
-}
-
-helper getObjectCompatibleClassName(dt : ecore::EDataType) : String {
- return (if dt.instanceClassName.xpandToCharList()->includes('.') then dt.instanceClassName else switch { case (dt.instanceClassName = 'boolean') 'java.lang.Boolean'; case (dt.instanceClassName = 'byte') 'java.lang.Byte'; case (dt.instanceClassName = 'char') 'java.lang.Character'; case (dt.instanceClassName = 'double') 'java.lang.Double'; case (dt.instanceClassName = 'float') 'java.lang.Float'; case (dt.instanceClassName = 'int') 'java.lang.Integer'; case (dt.instanceClassName = 'long') 'java.lang.Long'; case (dt.instanceClassName = 'short') 'java.lang.Short'; else 'java.lang.Object'; } endif)
-}
-
-
-
-
-helper getTypeGenClassifier(feature : genModel::GenFeature) : genModel::GenClassifier {
- return findGenClassifier(feature.genClass.genPackage.genModel, feature.ecoreFeature.eType)
-}
-
-helper isExternalInterface(genClass : genModel::GenClass) : Boolean {
- return null <> genClass.ecoreClass.instanceClassName
-}
-
-helper isContains(gf : genModel::GenFeature) : Boolean {
- return isReferenceType(gf) and gf.ecoreFeature.oclAsType(ecore::EReference).containment
-}
-
-helper isPrimitiveType(gf : genModel::GenFeature) : Boolean {
- return Sequence { 'boolean', 'byte', 'char', 'double', 'float', 'int', 'long', 'short' }->includes(gf.ecoreFeature.eType.instanceClassName)
-}
-
-helper isReferenceType(gf : genModel::GenFeature) : Boolean {
- return not (Sequence { gf.ecoreFeature })[ecore::EReference]->isEmpty()
-}
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/NonNLSUtils.qvto b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/NonNLSUtils.qvto
deleted file mode 100644
index cd397dc70..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/NonNLSUtils.qvto
+++ /dev/null
@@ -1,21 +0,0 @@
-library NonNLSUtils;
-
-property counter : Sequence(Integer) = Sequence{};
-
-helper incrementNonNLSCounter() : OclVoid {
- counter := counter->including(counter->size() + 1);
- return null
-}
-
-helper resetNonNLSCounter() : OclVoid {
- counter := Sequence { };
- return null
-}
-
-helper getNonNLSCounter() : Sequence(Integer) {
- return counter;
-}
-
-helper getNonNLSCounter(collection : Collection(OclAny)) : Sequence(Integer) {
- return collection->iterate(element : OclAny; acc : Sequence(Integer) = Sequence{} | acc->including(acc->size() + 1))
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/application/ActionBarAdvisor.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/application/ActionBarAdvisor.xpt
deleted file mode 100644
index afefe9c7e..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/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(titleKey(i18nKeyForDefaultFileEditorErrorDialog(editorGen.application))) FOR editorGen»,
- org.eclipse.osgi.util.NLS.bind(
- «EXPAND xpt::Externalizer::accessorCall(messageKey(i18nKeyForDefaultFileEditorErrorDialog(editorGen.application))) 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(titleKey(i18nKeyForDefaultEditorOpenErrorDialog(editorGen.application))) FOR editorGen»,
- exception.getMessage());
- return false;
- }
- }
- return true;
- }
-«ENDDEFINE»
-
-«DEFINE makeAction(windowVar : String) FOR gmfgen::GenContributionItem»
- «ERROR 'Can not make action for ' + self.repr()»
-«ENDDEFINE»
-
-«DEFINE makeAction(windowVar : String) FOR gmfgen::GenActionFactoryContributionItem»
- register(org.eclipse.ui.actions.ActionFactory.«name».create(«windowVar»));
-«ENDDEFINE»
-
-«DEFINE fill(managerVar : String) FOR gmfgen::GenContributionManager»
- «EXPAND contribute(managerVar) FOREACH items-»
-«ENDDEFINE»
-
-«DEFINE contribute(managerVar : String) FOR gmfgen::GenContributionItem»
- «ERROR 'Can not contribute item: ' + self.repr()»
-«ENDDEFINE»
-
-«DEFINE contribute(managerVar : String) FOR gmfgen::GenGroupMarker»
- «managerVar».add(new org.eclipse.jface.action.GroupMarker(«groupName»));
-«ENDDEFINE»
-
-«DEFINE contribute(managerVar : String) FOR gmfgen::GenSeparator»
- «managerVar».add(new org.eclipse.jface.action.Separator(«IF null <> groupName»«groupName»«ENDIF»));
-«ENDDEFINE»
-
-«DEFINE contribute(managerVar : String) 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(self)) FOR editorGen»«ELSE»null«ENDIF»«IF null <> iD», «iD»«ENDIF»);
- «EXPAND contribute(menuVar) FOREACH items-»
- «managerVar».add(«menuVar»);
- }
- «ENDLET-»
-«ENDDEFINE»
-
-«DEFINE contribute(managerVar : String) 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(managerVar : String) FOR gmfgen::GenSharedContributionItem»
- «EXPAND contributeShared(managerVar) FOR actualItem-»
-«ENDDEFINE»
-
-«DEFINE contributeShared(managerVar : String) FOR gmfgen::GenContributionItem»
- «ERROR 'Can not contribute shared item: ' + self.repr()»
-«ENDDEFINE»
-
-«DEFINE contributeShared(managerVar : String) 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(titleKey(i18nKeyForAboutDialog(self))) FOR editorGen»,
- «EXPAND xpt::Externalizer::accessorCall(messageKey(i18nKeyForAboutDialog(self))) FOR editorGen»
- );
- }
- }
-«ENDDEFINE»
-
-«DEFINE additions FOR gmfgen::GenApplication-»
-«ENDDEFINE»
-
-«DEFINE i18nAccessors FOR gmfgen::GenApplication-»
-«EXPAND xpt::Externalizer::accessorField(titleKey(i18nKeyForDefaultFileEditorErrorDialog(self)))-»
-«EXPAND xpt::Externalizer::accessorField(messageKey(i18nKeyForDefaultFileEditorErrorDialog(self)))-»
-«EXPAND xpt::Externalizer::accessorField(titleKey(i18nKeyForDefaultEditorOpenErrorDialog(self)))-»
-«EXPAND xpt::Externalizer::accessorField(titleKey(i18nKeyForAboutDialog(self)))-»
-«EXPAND xpt::Externalizer::accessorField(messageKey(i18nKeyForAboutDialog(self)))-»
-«IF null <> mainMenu-»
-«EXPAND internal_i18nAccessors FOR mainMenu-»
-«EXPAND internal_i18nAccessors FOREACH collectGenMenuManagers(mainMenu.items)-»
-«ENDIF»
-«EXPAND internal_i18nAccessors FOREACH collectGenMenuManagers(sharedContributionItems)-»
-«ENDDEFINE»
-
-«DEFINE internal_i18nAccessors FOR gmfgen::GenMenuManager-»
-«IF null <> name»«EXPAND xpt::Externalizer::accessorField(i18nKeyForMenu(self))»«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE i18nValues FOR gmfgen::GenApplication-»
-«EXPAND xpt::Externalizer::messageEntry(titleKey(i18nKeyForDefaultFileEditorErrorDialog(self)), 'Error')-»
-«EXPAND xpt::Externalizer::messageEntry(messageKey(i18nKeyForDefaultFileEditorErrorDialog(self)), 'There is no editor registered for the file \"{0}\"')-»
-«EXPAND xpt::Externalizer::messageEntry(titleKey(i18nKeyForDefaultEditorOpenErrorDialog(self)), 'Open Editor')-»
-«EXPAND xpt::Externalizer::messageEntry(titleKey(i18nKeyForAboutDialog(self)), 'About')-»
-«EXPAND xpt::Externalizer::messageEntry(messageKey(i18nKeyForAboutDialog(self)), editorGen.modelID + ' Diagram Editor')-»
-«IF null <> mainMenu-»
-«EXPAND internal_i18nValues FOR mainMenu-»
-«EXPAND internal_i18nValues FOREACH collectGenMenuManagers(mainMenu.items)-»
-«ENDIF»
-«EXPAND internal_i18nValues FOREACH collectGenMenuManagers(sharedContributionItems)-»
-«ENDDEFINE»
-
-«DEFINE internal_i18nValues FOR gmfgen::GenMenuManager-»
-«IF null <> name»«EXPAND xpt::Externalizer::messageEntry(i18nKeyForMenu(self), name)»«ENDIF-»
-«ENDDEFINE»
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/application/Application.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/application/Application.xpt
deleted file mode 100644
index 0543e7b46..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/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.migrated/xpt/application/Perspective.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/application/Perspective.xpt
deleted file mode 100644
index 3bdcfff58..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/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.migrated/xpt/application/WizardNewFileCreationPage.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/application/WizardNewFileCreationPage.xpt
deleted file mode 100644
index adec03972..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/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(self)) 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(self)) 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(self)) 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(self)) FOR editorGen»);
- return false;
- }
- if (!new org.eclipse.core.runtime.Path("").isValidPath(fileName)) { //$NON-NLS-1$
- setErrorMessage(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForNewFileWizardInvalid(self)) 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(self), 'File:')-»
-«EXPAND xpt::Externalizer::messageEntry(i18nKeyForNewFileWizardBrowseButton(self), 'Browse')-»
-«EXPAND xpt::Externalizer::messageEntry(i18nKeyForNewFileWizardSelectDialog(self), 'Select new file')-»
-«EXPAND xpt::Externalizer::messageEntry(i18nKeyForNewFileWizardEmpty(self), 'Specify file name')-»
-«EXPAND xpt::Externalizer::messageEntry(i18nKeyForNewFileWizardInvalid(self), 'Invalid file name')-»
-«ENDDEFINE»
-
-«DEFINE i18nAccessors FOR gmfgen::GenApplication-»
- «EXPAND xpt::Externalizer::accessorField(i18nKeyForNewFileWizardFileLabel(self))-»
- «EXPAND xpt::Externalizer::accessorField(i18nKeyForNewFileWizardBrowseButton(self))-»
- «EXPAND xpt::Externalizer::accessorField(i18nKeyForNewFileWizardSelectDialog(self))-»
- «EXPAND xpt::Externalizer::accessorField(i18nKeyForNewFileWizardEmpty(self))-»
- «EXPAND xpt::Externalizer::accessorField(i18nKeyForNewFileWizardInvalid(self))-»
-«ENDDEFINE»
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/application/WorkbenchAdvisor.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/application/WorkbenchAdvisor.xpt
deleted file mode 100644
index 925ca847a..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/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.migrated/xpt/application/WorkbenchWindowAdvisor.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/application/WorkbenchWindowAdvisor.xpt
deleted file mode 100644
index 0d3c81408..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/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(self)) FOR editorGen»);
- }
-«ENDDEFINE»
-
-«DEFINE additions FOR gmfgen::GenApplication-»
-«ENDDEFINE»
-
-«DEFINE i18nAccessors FOR gmfgen::GenApplication-»
-«EXPAND xpt::Externalizer::accessorField(i18nKeyForWindowTitle(self))-»
-«ENDDEFINE»
-
-«DEFINE i18nValues FOR gmfgen::GenApplication-»
-«EXPAND xpt::Externalizer::messageEntry(i18nKeyForWindowTitle(self), title)-»
-«ENDDEFINE»
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/application/extensions.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/application/extensions.xpt
deleted file mode 100644
index ddd2eb7e2..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/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.migrated/xpt/application/i18n.qvto b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/application/i18n.qvto
deleted file mode 100644
index db283db08..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/application/i18n.qvto
+++ /dev/null
@@ -1,63 +0,0 @@
-modeltype genModel uses "http://www.eclipse.org/gmf/2008/GenModel";
-
-library i18n;
-
-helper i18nKeyForDefaultFileEditorErrorDialog(app : genModel::GenApplication) : String {
- return app.actionBarAdvisorClassName + '.DefaultFileEditor'
-}
-
-helper i18nKeyForDefaultEditorOpenErrorDialog(app : genModel::GenApplication) : String {
- return app.actionBarAdvisorClassName + '.DefaultEditorOpenError'
-}
-
-helper i18nKeyForWindowTitle(app : genModel::GenApplication) : String {
- return app.workbenchWindowAdvisorClassName + '.Title'
-}
-
-helper i18nKeyForAboutDialog(app : genModel::GenApplication) : String {
- return app.actionBarAdvisorClassName + '.AboutDialog'
-}
-
-helper titleKey(dialogKey : String) : String {
- return dialogKey + 'Title'
-}
-
-helper messageKey(dialogKey : String) : String {
- return dialogKey + 'Message'
-}
-
-helper i18nKeyForMenu(menuManager : genModel::GenMenuManager) : String {
- return 'ApplicationMenuName.' + menuManager.name
-}
-
-helper collectGenMenuManagers(allItems : Collection(genModel::GenContributionItem)) : Sequence(genModel::GenMenuManager) {
- return (collectAllContributionItems(allItems))[genModel::GenMenuManager]
-}
-
-helper collectAllContributionItems(allItems : Collection(genModel::GenContributionItem)) : Sequence(genModel::GenContributionManager) {
- return let managers = (allItems->collect(it | it))[genModel::GenContributionManager]->asSequence() in managers->union(managers->collect(item | collectAllContributionItems(item.items))->flatten())
-}
-
-helper i18nKeyForNewFileWizardFileLabel(app : genModel::GenApplication) : String {
- return wizardNewFileCreationPageClassName(app) + '.FileLabel'
-}
-
-helper i18nKeyForNewFileWizardBrowseButton(app : genModel::GenApplication) : String {
- return wizardNewFileCreationPageClassName(app) + '.BrowseButton'
-}
-
-helper i18nKeyForNewFileWizardSelectDialog(app : genModel::GenApplication) : String {
- return wizardNewFileCreationPageClassName(app) + '.SelectNewFileDialog'
-}
-
-helper i18nKeyForNewFileWizardEmpty(app : genModel::GenApplication) : String {
- return wizardNewFileCreationPageClassName(app) + '.EmptyFileNameError'
-}
-
-helper i18nKeyForNewFileWizardInvalid(app : genModel::GenApplication) : String {
- return wizardNewFileCreationPageClassName(app) + '.InvalidFileNameError'
-}
-
-helper wizardNewFileCreationPageClassName(app : genModel::GenApplication) : String {
- return 'WizardNewFileCreationPage'
-}
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/Utils.qvto b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/Utils.qvto
deleted file mode 100644
index 83ba9d40a..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/Utils.qvto
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright (c) 2006, 2009 Borland Software Corporation
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Dmitry Stadnik (Borland) - initial API and implementation
- */
-import org.eclipse.gmf.internal.codegen.util.GenModelUtils;
-
-modeltype gmfgen uses "http://www.eclipse.org/gmf/2008/GenModel";
-modeltype notation uses "http://www.eclipse.org/gmf/runtime/1.0.2/notation";
-
-library Utils;
-
--- all elements that may have element type: diagram, nodes and links
-helper GenDiagram::getAllTypedElements() : Sequence(gmfgen::GenCommonBase) {
- return Sequence { self }[gmfgen::GenCommonBase]->union(self.getAllNodes()->asSequence())->union(self.links->asSequence());
-}
-
-helper hasExplicitChildFeature(facet : gmfgen::TypeModelFacet) : Boolean {
- return not isDerived(facet.childMetaFeature) and 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.
-helper hasContainerOtherThanSource(facet : gmfgen::TypeLinkModelFacet) : Boolean {
- return facet.sourceMetaFeature <> null or facet.childMetaFeature <> facet.containmentMetaFeature
-}
-
-helper allPreferencePages(genDiagram : gmfgen::GenDiagram) : Sequence(gmfgen::GenPreferencePage) {
- return recursePages(genDiagram.preferencePages->asSequence())
-}
-
-helper recursePages(pages : Sequence(gmfgen::GenPreferencePage)) : Sequence(gmfgen::GenPreferencePage) {
- return (if pages->isEmpty() then pages else pages->union(recursePages(pages.children))->asOrderedSet()->asSequence() endif)
-}
-
--- check if there's notation::FontStyle among diagram element's custom styles
--- XXX the reason this is not inlined mostly because of troubles importing notation model into xpt
-helper gmfgen::GenCommonBase::hasFontStyleInCustom() : Boolean {
- return self.styles->exists(s | s.ecoreClass.oclIsKindOf(notation::FontStyle));
-}
-
-helper gmfgen::GenCommonBase::hasLineStyleInCustom() : Boolean {
- return self.styles->exists(s | s.ecoreClass.oclIsKindOf(notation::LineStyle));
-}
-
-helper gmfgen::GenCommonBase::hasFillStyleInCustom() : Boolean {
- return self.styles->exists(s | s.ecoreClass.oclIsKindOf(notation::FillStyle));
-}
-
--- if diagram is in pixel map mode, no reason to use getMapMode()
-helper gmfgen::GenDiagram::isPixelMapMode() : Boolean {
- return self.units = 'Pixel';
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/ViewmapAttributesUtils.qvto b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/ViewmapAttributesUtils.qvto
deleted file mode 100644
index 78c53ddcc..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/ViewmapAttributesUtils.qvto
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright (c) 2006, 2009 Borland Software Corporation
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Dmitry Stadnik (Borland) - initial API and implementation
- */
-modeltype gmfgen uses "http://www.eclipse.org/gmf/2008/GenModel";
-
-library ViewmapAttributesUtils;
-
-helper isStoringChildPositions(layoutType : gmfgen::ViewmapLayoutType) : Boolean {
- return gmfgen::ViewmapLayoutType::XY_LAYOUT = layoutType
-}
-
-helper gmfgen::Viewmap::isFixedFont() : Boolean {
- return self.attributes[gmfgen::StyleAttributes]->exists(fixedFont)
-}
-
-helper gmfgen::Viewmap::isFixedForeground() : Boolean {
- return self.attributes[gmfgen::StyleAttributes]->exists(fixedForeground)
-}
-
-helper gmfgen::Viewmap::isFixedBackground() : Boolean {
- return self.attributes[gmfgen::StyleAttributes]->exists(fixedBackground)
-}
-
-helper gmfgen::Viewmap::canUseShapeStyle() : Boolean {
- return not (self.isFixedFont() or self.isFixedForeground() or self.isFixedBackground());
-}
-
-helper getResizeConstraints(viewmap : gmfgen::Viewmap) : gmfgen::ResizeConstraints {
- return (if null = viewmap then null else viewmap.attributes[gmfgen::ResizeConstraints]->first() endif)
-}
-
-helper getDefaultSizeAttributes(viewmap : gmfgen::Viewmap) : gmfgen::DefaultSizeAttributes {
- return (if null = viewmap then null else viewmap.attributes[gmfgen::DefaultSizeAttributes]->first() endif)
-}
-
-helper defaultSizeWidth(viewmap : gmfgen::Viewmap, defaultValue : Integer) : Integer {
- return let a = getDefaultSizeAttributes(viewmap) in (if null = a then defaultValue else a.width endif)
-}
-
-helper defaultSizeHeight(viewmap : gmfgen::Viewmap, defaultValue : Integer) : Integer {
- return let a = getDefaultSizeAttributes(viewmap) in (if null = a then defaultValue else a.height endif)
-}
-
-helper getLabelOffsetAttributes(viewmap : gmfgen::Viewmap) : gmfgen::LabelOffsetAttributes {
- return (if null = viewmap then null else viewmap.attributes[gmfgen::LabelOffsetAttributes]->first() endif)
-}
-
-helper labelOffsetX(viewmap : gmfgen::Viewmap, defaultValue : Integer) : Integer {
- return let a = getLabelOffsetAttributes(viewmap) in (if null = a then defaultValue else a.x endif)
-}
-
-helper labelOffsetY(viewmap : gmfgen::Viewmap, defaultValue : Integer) : Integer {
- return let a = getLabelOffsetAttributes(viewmap) in (if null = a then defaultValue else a.y endif)
-}
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/commands/CreateLinkCommand.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/commands/CreateLinkCommand.xpt
deleted file mode 100644
index 969764c76..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/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(self) FOR modelFacet-»
-
- «EXPAND doExecuteWithResultMethod»
-
- «EXPAND doConfigure(self) 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(self) FOR modelFacet»
- }
-«ENDDEFINE»
-
-«DEFINE execute(link : gmfgen::GenLink) FOR gmfgen::LinkModelFacet»«ENDDEFINE»
-
-«DEFINE execute(link : gmfgen::GenLink) FOR gmfgen::TypeLinkModelFacet»
-«IF (if sourceMetaFeature = null then containmentMetaFeature.ecoreFeature.changeable else sourceMetaFeature.ecoreFeature.changeable endif) and targetMetaFeature.ecoreFeature.changeable-»
- «EXPAND MetaModel::NewInstance('newElement') FOR metaClass-»
- «EXPAND MetaModel::modifyFeature((if hasContainerOtherThanSource(self) then 'getContainer()' else 'getSource()' endif), 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(self)-»
- «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(link : gmfgen::GenLink, newElementvVar : String) FOR gmfgen::TypeModelFacet»«IF modelElementInitializer <> null-»
-«link.diagram.getElementTypesQualifiedClassName()».init_«link.getUniqueIdentifier()»(«newElementvVar»);
-«ENDIF»«ENDDEFINE»
-
-
-«DEFINE execute(link : gmfgen::GenLink) 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(link : gmfgen::GenLink) 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(link : gmfgen::GenLink) 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.migrated/xpt/diagram/commands/CreateLinkUtils.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/commands/CreateLinkUtils.xpt
deleted file mode 100644
index 2ef4afb83..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/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(link : gmfgen::GenLink) 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(link : gmfgen::GenLink) FOR gmfgen::LinkModelFacet-»
-«ENDDEFINE»
-
-«DEFINE canCreateElement(link : gmfgen::GenLink) FOR gmfgen::TypeLinkModelFacet-»
-«IF hasContainerOtherThanSource(self)-»
- if (getContainer() == null) {
- return false;
- }
-«ENDIF-»
- return «EXPAND validatorInvocation FOR link»(«IF hasContainerOtherThanSource(self)»getContainer(), «ENDIF»getSource(), getTarget());
-«ENDDEFINE»
-
-«DEFINE canCreateElement(link : gmfgen::GenLink) 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(self)»
-
- «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(self)-»
-
- «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(self)-»
- container = deduceContainer(source, target);
-«ENDIF-»
-«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/commands/CreateNodeCommand.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/commands/CreateNodeCommand.xpt
deleted file mode 100644
index bd46cb821..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/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(self, 'newElement') FOR modelFacet»
-«ELSE-»
- «EXPAND normalElementCreation(self, 'newElement') FOR modelFacet»
-«ENDIF»
- «EXPAND initialize(self, '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.oclAsType(Integer) > 0 or (childMetaFeature <> containmentMetaFeature and childMetaFeature.ecoreFeature.upperBound.oclAsType(Integer) > 0)-»
- «EXPAND MetaModel::DeclareAndAssign('container', 'getElementToEdit()') FOR containmentMetaFeature.genClass-»
- «IF containmentMetaFeature.ecoreFeature.upperBound.oclAsType(Integer) > 0-»
- «IF containmentMetaFeature.ecoreFeature.upperBound.oclAsType(Integer) = 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.oclAsType(Integer)») {
- «ENDIF-»
- return false;
- }
- «ENDIF-»
- «IF childMetaFeature <> containmentMetaFeature and childMetaFeature.ecoreFeature.upperBound.oclAsType(Integer) > 0-»
- «IF childMetaFeature.ecoreFeature.upperBound.oclAsType(Integer) = 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.oclAsType(Integer)») {
- «ENDIF-»
- return false;
- }
- «ENDIF-»
-«ENDIF-»
- return true;
-«ENDDEFINE»
-
-«DEFINE phantomElementCreation(node : gmfgen::GenNode, varName : String) FOR gmfgen::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(node : gmfgen::GenNode, varName : String) 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(self)-»
- «EXPAND MetaModel::DeclareAndAssign('childHolder', 'getElementToEdit()') FOR childMetaFeature.genClass»
- «EXPAND MetaModel::modifyFeature('childHolder', childMetaFeature.genClass, varName) FOR childMetaFeature»
-«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE initialize(node : gmfgen::GenNode, newElementVar : String) 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.migrated/xpt/diagram/commands/CreateRefLinkCommand.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/commands/CreateRefLinkCommand.xpt
deleted file mode 100644
index 67ca118a7..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/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.migrated/xpt/diagram/commands/CreateShortcutDecorationsCommand.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/commands/CreateShortcutDecorationsCommand.xpt
deleted file mode 100644
index e2609af6f..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/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.migrated/xpt/diagram/commands/ReorientLinkCommand.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/commands/ReorientLinkCommand.xpt
deleted file mode 100644
index 4772f23c9..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/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(self) 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.migrated/xpt/diagram/commands/ReorientLinkUtils.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/commands/ReorientLinkUtils.xpt
deleted file mode 100644
index 7ff98dbfa..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/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(link : gmfgen::GenLink) 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(link : gmfgen::GenLink) FOR gmfgen::LinkModelFacet-»
-«ENDDEFINE»
-
-«DEFINE checkSourceRequestValidity(link : gmfgen::GenLink) 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(link : gmfgen::GenLink) 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(link : gmfgen::GenLink) FOR gmfgen::LinkModelFacet-»
-«ENDDEFINE»
-
-«DEFINE checkTargetRequestValidity(link : gmfgen::GenLink) 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(link : gmfgen::GenLink) 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(containerVar : String, containerMetaClass : genmodel::GenClass, _var : String, varMetaClass : genmodel::GenClass) FOR genmodel::GenFeature-»
- «IF ecoreFeature.many-»
- if («EXPAND MetaModel::getFeatureValue(containerVar, containerMetaClass)».size() != 1) {
- return false;
- }
- «EXPAND MetaModel::DeclareAndAssign2(_var, containerVar, containerMetaClass, self, 'get(0)', true) FOR varMetaClass»
- «ELSE-»
- «EXPAND MetaModel::DeclareAndAssign(_var, containerVar, containerMetaClass, self) FOR varMetaClass»
- «ENDIF-»
-«ENDDEFINE»
-
-«DEFINE checkLinkConstraint(link : gmfgen::GenLink, sourceVar : String, targetVar : String) FOR gmfgen::TypeLinkModelFacet-»
- «IF hasContainerOtherThanSource(self)-»
- 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 (if sourceMetaFeature = null then containmentMetaFeature.ecoreFeature.changeable else sourceMetaFeature.ecoreFeature.changeable endif)-»
-«IF sourceMetaFeature <> null-»
- «EXPAND changeTarget('getLink()', metaClass, 'getOldSource()', 'getNewSource()') FOR sourceMetaFeature-»
-«ELSE-»
- «EXPAND changeSource('getLink()', 'getOldSource()', 'getNewSource()', getSourceType()) FOR (if hasExplicitChildFeature(self) then childMetaFeature else containmentMetaFeature endif)-»
-«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(sourceVar : String, sourceVarGenClass : genmodel::GenClass, oldTargetVar : String, newTargetVar : String) FOR genmodel::GenFeature-»
-«EXPAND MetaModel::replaceFeatureValue(sourceVar, sourceVarGenClass, oldTargetVar, newTargetVar)»
-«ENDDEFINE»
-
-«REM»
- Move target from old source to the new one.
-«ENDREM»
-«DEFINE changeSource(targetVar : String, oldSourceVar : String, newSourceVar : String, sourceVarGenClass : genmodel::GenClass) FOR genmodel::GenFeature-»
-«EXPAND MetaModel::moveFeatureValue(oldSourceVar, newSourceVar, sourceVarGenClass, targetVar)»
-«ENDDEFINE»
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/commands/ReorientLinkViewCommand.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/commands/ReorientLinkViewCommand.xpt
deleted file mode 100644
index cd996909c..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/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.migrated/xpt/diagram/commands/ReorientRefLinkCommand.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/commands/ReorientRefLinkCommand.xpt
deleted file mode 100644
index 60b348301..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/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(self) 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.migrated/xpt/diagram/edithelpers/BaseEditHelper.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/edithelpers/BaseEditHelper.xpt
deleted file mode 100644
index 71eeb0382..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/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.migrated/xpt/diagram/edithelpers/EditHelper.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/edithelpers/EditHelper.xpt
deleted file mode 100644
index f5e436dfb..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/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.migrated/xpt/diagram/edithelpers/EditHelperAdvice.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/edithelpers/EditHelperAdvice.xpt
deleted file mode 100644
index 8709546c3..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/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.migrated/xpt/diagram/editparts/Common.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/editparts/Common.xpt
deleted file mode 100644
index abebed619..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/editparts/Common.xpt
+++ /dev/null
@@ -1,155 +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::StringOperations»
-
-«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 or editPolicyQualifiedClassName.trim().xpandLength() = 0-»
- removeEditPolicy(«key»); «IF key.xpandStartsWith('\"') and key.xpandEndsWith('\"')»«EXPAND xpt::Common::nonNLS»«ENDIF»
-«ELSE-»
- installEditPolicy(«key», new «getEditPolicyQualifiedClassName()»()); «IF key.xpandStartsWith('\"') and key.xpandEndsWith('\"')»«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 self-»
-«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: ' + self.repr()-»
- }
-«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.migrated/xpt/diagram/editparts/EditPartFactory.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/editparts/EditPartFactory.xpt
deleted file mode 100644
index e505c92c8..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/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 self-»
- «FOREACH getAllNodes()->asSequence() AS node-»
- «EXPAND createEditPart FOR node-»
- «EXPAND createEditPart FOREACH node.labels-»
- «ENDFOREACH-»
- «EXPAND createEditPart FOREACH compartments-»
- «FOREACH links->asSequence() 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.migrated/xpt/diagram/editparts/Utils.qvto b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/editparts/Utils.qvto
deleted file mode 100644
index 5275ce260..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/editparts/Utils.qvto
+++ /dev/null
@@ -1,67 +0,0 @@
-modeltype genModel uses "http://www.eclipse.org/gmf/2008/GenModel";
-
-library Utils;
-
-helper isStoringChildPositions(node : genModel::GenNode) : Boolean {
- return node.getLayoutType() = genModel::ViewmapLayoutType::XY_LAYOUT
-}
-
-helper getExternalLabels(node : genModel::GenNode) : Sequence(genModel::GenExternalNodeLabel) {
- return (node.labels)[genModel::GenExternalNodeLabel]->asSequence()
-}
-
-helper getSideAffixedChildren(node : genModel::GenNode) : Sequence(genModel::GenChildSideAffixedNode) {
- return (node.childNodes)[genModel::GenChildSideAffixedNode]->asSequence()
-}
-
-helper getInnerFixedLabels(node : genModel::GenNode) : Sequence(genModel::GenLabel) {
- return node.labels->-((node.labels)[genModel::GenExternalNodeLabel])->select(e | (Sequence { e.oclAsType(genModel::GenLabel).viewmap })[genModel::ParentAssignedViewmap]->size() > 0)->asSequence()
-}
-
-helper getPinnedCompartments(node : genModel::GenNode) : Sequence(genModel::GenCompartment) {
- return node.compartments->select(e | (Sequence { e.viewmap })[genModel::ParentAssignedViewmap]->size() > 0)->asSequence()
-}
-
-helper hasFixedChildren(node : genModel::GenNode) : Boolean {
- return getInnerFixedLabels(node)->size() > 0 or getPinnedCompartments(node)->size() > 0
-}
-
-helper hasChildren(node : genModel::GenNode) : Boolean {
- return not node.childNodes->isEmpty()
-}
-
-helper listCompartmentHasChildren(compartment : genModel::GenCompartment) : Boolean {
- return compartment.listLayout and compartment.childNodes->size() > 0
-}
-
-helper hasChildrenInListCompartments(node : genModel::GenNode) : Boolean {
- return node.compartments->exists(e | listCompartmentHasChildren(e))
-}
-
-helper hasBorderItems(node : genModel::GenNode) : Boolean {
- return getSideAffixedChildren(node)->size() > 0 or getExternalLabels(node)->size() > 0
-}
-
-helper needsGraphicalNodeEditPolicy(node : genModel::GenNode) : Boolean {
- return null <> node.modelFacet and node.reorientedIncomingLinks->size() > 0
-}
-
-helper i18nKeyForCompartmentTitle(compartment : genModel::GenCompartment) : String {
- return compartment.editPartClassName + '.title'
-}
-
-helper shouldGenerateDiagramViewmap(genDiagram : genModel::GenDiagram) : Boolean {
- return not Sequence { genModel::ViewmapLayoutType::UNKNOWN, genModel::ViewmapLayoutType::XY_LAYOUT }->includes(genDiagram.viewmap.layoutType)
-}
-
-helper getAssistantOutgoingLinks(node : genModel::GenNode) : Sequence(genModel::GenLink) {
- return node.genOutgoingLinks->select(link | not selectGenNodes(link.targets->asSequence())->isEmpty())->asSequence()
-}
-
-helper getAssistantIncomingLinks(node : genModel::GenNode) : Sequence(genModel::GenLink) {
- return node.genIncomingLinks->select(link | not selectGenNodes(link.sources->asSequence())->isEmpty())->asSequence()
-}
-
-helper selectGenNodes(ends : Sequence(genModel::GenLinkEnd)) : Sequence(genModel::GenLinkEnd) {
- return (ends)[genModel::GenNode]
-}
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/editpolicies/BaseItemSemanticEditPolicy.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/editpolicies/BaseItemSemanticEditPolicy.xpt
deleted file mode 100644
index 6f1b172aa..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/editpolicies/BaseItemSemanticEditPolicy.xpt
+++ /dev/null
@@ -1,496 +0,0 @@
-/*
- * Copyright (c) 2007, 2009 Borland Software Corporation
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * 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»
-«EXTENSION xpt::StringOperations»
-
-«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.')»
- 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.')»
- protected org.eclipse.emf.transaction.TransactionalEditingDomain getEditingDomain() {
- return ((org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart) getHost()).getEditingDomain();
- }
-
- «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.')»
- 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('Clean all shortcuts to the host element from the same diagram')»
- protected void addDestroyShortcutsCommand(org.eclipse.gmf.runtime.common.core.command.ICompositeCommand cmd, org.eclipse.gmf.runtime.notation.View view) {
- «EXPAND xpt::Common::_assert('view.getEAnnotation(\"Shortcut\") == null')-»
- for (java.util.Iterator it = view.getDiagram().getChildren().iterator(); it.hasNext();) {
- org.eclipse.gmf.runtime.notation.View nextView = (org.eclipse.gmf.runtime.notation.View) it.next();
- if (nextView.getEAnnotation("Shortcut") == null || !nextView.isSetElement() || nextView.getElement() != view.getElement()) {«EXPAND xpt::Common::nonNLS»
- continue;
- }
- cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), 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-»
-«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)) {
- command = new org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand(getEditingDomain(), 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.gef.commands.Command deleteViewCommand = getGEFWrapper(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), (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»
-
-
-«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(self) 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 and (creationConstraints.isValid() and null <> getDiagram().editorGen.expressionProviders)-»
- try {
-«IF null <> creationConstraints.sourceEnd-»
- «EXPAND checkAdditionalConstraint(creationConstraints.sourceEnd, sourceConstraintFieldName(self), 'source', 'target', creationConstraints.getSourceEndContextClass(), creationConstraints.getTargetEndContextClass()) FOR creationConstraints.sourceEnd.provider-»
-«ENDIF-»
-«IF null <> creationConstraints.targetEnd-»
- «EXPAND checkAdditionalConstraint(creationConstraints.targetEnd, targetConstraintFieldName(self), '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(self)»«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(self)»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 and childMetaFeature.ecoreFeature.upperBound.oclAsType(Integer) > 0 AS checkChildFeatureUpperBound-»
- «IF containmentMetaFeature.ecoreFeature.upperBound.oclAsType(Integer) > 0 or checkChildFeatureUpperBound-»
-if («getContainerVariable(self)» != null) {
- «EXPAND checkEMFConstraints(self) FOR containmentMetaFeature-»
- «IF checkChildFeatureUpperBound-»
- «EXPAND checkEMFConstraints(self) FOR childMetaFeature-»
- «ENDIF-»
-}
- «ENDIF-»
- «ENDLET-»
-«ENDDEFINE»
-
-«DEFINE checkEMFConstraints(modelFacet : gmfgen::TypeLinkModelFacet) FOR genmodel::GenFeature-»
-«IF ecoreFeature.upperBound.oclAsType(Integer) > 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 isContains(metaFeature)-»
- 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(targetVar : String, targetType : genmodel::GenClass) FOR genmodel::GenFeature-»
-«REM»Checking upper bounds if was specified in MM«ENDREM»«-»
-«IF ecoreFeature.upperBound.oclAsType(Integer) > 0»«EXPAND featureBoundComparator(targetVar, targetType)»«ENDIF-»
-«REM»Checking uniqueness in addition if upper bounds > 1«ENDREM»«-»
-«IF ecoreFeature.upperBound.oclAsType(Integer) > 1» || «ENDIF-»
-«REM»Checking uniqueness in if upper bounds > 1 or < 0«ENDREM»«-»
-«IF ecoreFeature.upperBound.oclAsType(Integer) <> 1»«EXPAND featureUniquenessComparator(targetVar, targetType)»«ENDIF»
-«ENDDEFINE»
-
-«DEFINE featureBoundComparator(featureVar : String, featureVarGenClass : genmodel::GenClass) FOR genmodel::GenFeature»«EXPAND MetaModel::getFeatureValue(featureVar, featureVarGenClass)»«IF ecoreFeature.upperBound.oclAsType(Integer) = 1» != null«ELSE».size() >= «ecoreFeature.upperBound.oclAsType(Integer)»«ENDIF»«ENDDEFINE»
-«DEFINE featureUniquenessComparator(featureVar : String, featureVarGenClass : genmodel::GenClass) FOR genmodel::GenFeature»«EXPAND MetaModel::getFeatureValue(featureVar, featureVarGenClass) FOR self».contains(target)«ENDDEFINE»
-
-
-«DEFINE checkAdditionalConstraint(valueExpr : gmfgen::ValueExpression, constraintFieldName : String, sourceEndVar : String, targetEndVar : String, context : genmodel::GenClass, oppositeEndContext : genmodel::GenClass) FOR gmfgen::GenExpressionProviderBase»
-«ERROR 'Have no idea what extra constraints to check for ' + self.repr()»
-«ENDDEFINE»
-
-«DEFINE checkAdditionalConstraint(valueExpr : gmfgen::ValueExpression, constraintFieldName : String, sourceEndVar : String, targetEndVar : String, context : genmodel::GenClass, oppositeEndContext : genmodel::GenClass) 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(valueExpr : gmfgen::ValueExpression, constraintFieldName : String, sourceEndVar : String, targetEndVar : String, context : genmodel::GenClass, oppositeEndContext : genmodel::GenClass) FOR gmfgen::GenJavaExpressionProvider-»
-«IF injectExpressionBody and (valueExpr.body <> null and valueExpr.body.xpandLength() <> 0)-»
- «valueExpr.body»
-«ELSEIF throwException or (injectExpressionBody and (valueExpr.body = null or valueExpr.body.xpandLength() = 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: ' + self.repr()»«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: ' + self.repr()-»
- «ENDIF-»
- super(«EXPAND xpt::providers::ElementTypes::accessElementType»);
-«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/editpolicies/ChildContainerCanonicalEditPolicy.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/editpolicies/ChildContainerCanonicalEditPolicy.xpt
deleted file mode 100644
index a13e0fed6..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/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.migrated/xpt/diagram/editpolicies/CompartmentItemSemanticEditPolicy.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/editpolicies/CompartmentItemSemanticEditPolicy.xpt
deleted file mode 100644
index 72cbc5316..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/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->asSequence()-»
-
- «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.migrated/xpt/diagram/editpolicies/DiagramCanonicalEditPolicy.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/editpolicies/DiagramCanonicalEditPolicy.xpt
deleted file mode 100644
index 143126a59..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/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 not 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 not 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(self)-»
- }
- 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: ' + self.repr()»
-«ENDDEFINE»
-
-«DEFINE additions FOR gmfgen::GenDiagram»«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/editpolicies/DiagramItemSemanticEditPolicy.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/editpolicies/DiagramItemSemanticEditPolicy.xpt
deleted file mode 100644
index 687c1ff54..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/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->asSequence()-»
-
- «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.migrated/xpt/diagram/editpolicies/GraphicalNodeEditPolicy.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/editpolicies/GraphicalNodeEditPolicy.xpt
deleted file mode 100644
index c0590c364..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/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->asSequence() 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.migrated/xpt/diagram/editpolicies/LinkItemSemanticEditPolicy.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/editpolicies/LinkItemSemanticEditPolicy.xpt
deleted file mode 100644
index e03b33e36..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/editpolicies/LinkItemSemanticEditPolicy.xpt
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (c) 2007, 2009 Borland Software Corporation
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * 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(self) FOR modelFacet -»
- «IF isTypeLink()»«EXPAND xpt::diagram::editpolicies::linkCommands::linkCommands»«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE getDestroySemanticCommand(gmfgen::GenLink genLink) FOR gmfgen::LinkModelFacet-»
- «ERROR 'Unsupported model facet: ' + self.repr()-»
-«ENDDEFINE»
-
-«DEFINE getDestroySemanticCommand(gmfgen::GenLink genLink) 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(«EXPAND impl::diagram::commands::DeleteLinkCommand::newDeleteReferenceLinkCommand(genLink, 'req')»);
- }
-«ENDDEFINE»
-
-«DEFINE getDestroySemanticCommand(gmfgen::GenLink genLink) 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(«EXPAND impl::diagram::commands::DeleteLinkCommand::newDeleteLinkWithClassCommand(genLink, 'req')»);
- }
-«ENDDEFINE»
-
-«DEFINE additions FOR gmfgen::GenLink»«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/editpolicies/LinkUtils.qvto b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/editpolicies/LinkUtils.qvto
deleted file mode 100644
index 3d9f43de1..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/editpolicies/LinkUtils.qvto
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright (c) 2007, 2009 Borland Software Corporation
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Alexander Shatalin (Borland) - initial API and implementation
- * Michael Golubev (Borland) - [243151] explicit source/target for links
- */
-
-modeltype gmfgen uses "http://www.eclipse.org/gmf/2008/GenModel";
-modeltype genmodel uses "http://www.eclipse.org/emf/2002/GenModel";
-
-library LinkUtils;
-
-helper gmfgen::GenLink::isTypeLink() : Boolean {
- return not self.modelFacet.oclIsUndefined() and self.modelFacet.oclIsKindOf(gmfgen::TypeLinkModelFacet)
-}
-
-helper gmfgen::GenLink::isRefLink() : Boolean {
- return not self.modelFacet.oclIsUndefined() and self.modelFacet.oclIsKindOf(gmfgen::FeatureLinkModelFacet)
-}
-
-helper canBeSource(link : gmfgen::GenLink, linkEnd : gmfgen::GenLinkEnd) : Boolean {
- return link.sources->includes(linkEnd)
-}
-
-helper canBeTarget(link : gmfgen::GenLink, linkEnd : gmfgen::GenLinkEnd) : Boolean {
- return link.targets->includes(linkEnd)
-}
-
-helper canBeContainer(link : gmfgen::GenLink, metaClass : genmodel::GenClass) : Boolean {
- return null <> link.modelFacet and isCompatible(link.modelFacet.getContainerClass(), metaClass)
-}
--- MODIFIERS: private
-helper gmfgen::LinkModelFacet::getContainerClass() : genmodel::GenClass {
- return null
-}
--- MODIFIERS: private
-helper gmfgen::TypeLinkModelFacet::getContainerClass() : genmodel::GenClass {
- return self.childMetaFeature.genClass
-}
--- MODIFIERS: private
-helper gmfgen::FeatureLinkModelFacet::getContainerClass() : genmodel::GenClass {
- return self.getSourceType()
-}
-
--- MODIFIERS: private
-helper isCompatible(desiredType : genmodel::GenClass, actualClass : genmodel::GenClass) : Boolean {
- return null <> desiredType and desiredType.ecoreClass.isSuperTypeOf(actualClass.ecoreClass)
-}
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/editpolicies/NodeItemSemanticEditPolicy.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/editpolicies/NodeItemSemanticEditPolicy.xpt
deleted file mode 100644
index 8e85154e2..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/editpolicies/NodeItemSemanticEditPolicy.xpt
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- * Copyright (c) 2007, 2009 Borland Software Corporation
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Alexander Shatalin (Borland) - initial API and implementation
- * Artem Tikhomirov (Borland) - [257632] do not rely on EditPart presence for element deletion
- */
-
-«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->asSequence()-»
-
- «EXPAND getDestroyElementCommand-»
- «IF hasChildrenOrCompartments(self)-»
- «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.gmf.runtime.notation.View view = (org.eclipse.gmf.runtime.notation.View) getHost().getModel();
- org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand cmd = new org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand(getEditingDomain(), null);
- cmd.setTransactionNestingEnabled(false);
- «EXPAND destroyEdges('view')-»
- org.eclipse.emf.ecore.EAnnotation annotation = view.getEAnnotation("Shortcut");«EXPAND xpt::Common::nonNLS»
- if (annotation == null) {
- // there are indirectly referenced children, need extra commands: «childNodes->union(compartments.childNodes->asBag())->exists(not isDirectlyOwned(self))»
-«IF hasChildrenOrCompartments(self)-»
- addDestroyChildNodesCommand(cmd);
-«ENDIF-»
- addDestroyShortcutsCommand(cmd, view);
- // delete host element
- cmd.add(new org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand(req));
- } else {«REM»Here, we may play smart and don't generate else for non-toplevel nodes(which can't be shortcuts). Is it worth doing?«ENDREM»
- cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), view));
- }
- return getGEFWrapper(cmd.reduce());
-}
-«ENDDEFINE»
-
-«DEFINE addDestroyChildNodesCommand FOR gmfgen::GenNode-»
-
- «EXPAND xpt::Common::generatedMemberComment»
- private void addDestroyChildNodesCommand(org.eclipse.gmf.runtime.common.core.command.ICompositeCommand cmd) {
- org.eclipse.gmf.runtime.notation.View view = (org.eclipse.gmf.runtime.notation.View) getHost().getModel();
- for (java.util.Iterator nit = view.getChildren().iterator(); nit.hasNext();) {
- org.eclipse.gmf.runtime.notation.Node node = (org.eclipse.gmf.runtime.notation.Node) nit.next();
- switch («EXPAND xpt::editor::VisualIDRegistry::getVisualIDMethodCall FOR getDiagram()»(node)) {
- «EXPAND destroyChildNodes('node', self) FOREACH childNodes-»
- «IF compartments->notEmpty()»«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', self) FOREACH compartment.childNodes-»
- }
- }
- break;
- «ENDFOREACH»«ENDIF-»
- }
- }
- }
-«ENDDEFINE»
-
-«DEFINE destroyChildNodes(nodeVar : String, gmfgen::GenNode genNode) FOR gmfgen::GenChildNode-»
-«EXPAND xpt::Common::caseVisualID»
- «EXPAND destroyEdges(nodeVar)-»
- cmd.add(new org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand(new org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest(getEditingDomain(), «nodeVar».getElement(), false))); // directlyOwned: «self.isDirectlyOwned(genNode)»
- // don't need explicit deletion of «nodeVar» as parent's view deletion would clean child views as well
- // cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), «nodeVar»));
- break;
-«ENDDEFINE»
-
-// @param view - Notation element for the passed node
-// assumes 'cmd' to point to composite command
-«DEFINE destroyEdges(String view) FOR gmfgen::GenNode-»
-«REM»
- XXX: Though semantic editpolicy is supposed to create commands that operate with semantic elements only,
- old code used to delegate child/link deletion to respective editparts, which in turn led to semantic commands
- being combined with notational commands (BaseItemSemanticEditPolicy#addDeleteViewCommand()).
- ---
- Use DiagramUpdater.get[Incoming|Outgoing]View instead, to clean links that are not present on a diagram
- (but don't forget to clean corresponding Edge, if any)
-«ENDREM-»
-«IF genIncomingLinks->notEmpty()-»
- for (java.util.Iterator it = «view».getTargetEdges().iterator(); it.hasNext();) {
- org.eclipse.gmf.runtime.notation.Edge incomingLink = (org.eclipse.gmf.runtime.notation.Edge) it.next();
-«FOREACH genIncomingLinks AS il-»
- if («EXPAND xpt::editor::VisualIDRegistry::getVisualIDMethodCall FOR getDiagram()»(incomingLink) == «EXPAND xpt::editor::VisualIDRegistry::visualID FOR il») {
- «EXPAND impl::diagram::commands::DeleteLinkCommand::newRequest('r', 'incomingLink') FOR il-»
- cmd.add(«EXPAND impl::diagram::commands::DeleteLinkCommand::newInstance('r') FOR il»);
- cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), incomingLink));
- continue;
- }
-«ENDFOREACH-»
- }
-«ENDIF-»
-«IF genOutgoingLinks->notEmpty()-»
- for (java.util.Iterator it = «view».getSourceEdges().iterator(); it.hasNext();) {
- org.eclipse.gmf.runtime.notation.Edge outgoingLink = (org.eclipse.gmf.runtime.notation.Edge) it.next();
-«FOREACH genOutgoingLinks AS ol-»
- if («EXPAND xpt::editor::VisualIDRegistry::getVisualIDMethodCall FOR getDiagram()»(outgoingLink) == «EXPAND xpt::editor::VisualIDRegistry::visualID FOR ol») {
- «EXPAND impl::diagram::commands::DeleteLinkCommand::newRequest('r', 'outgoingLink') FOR ol-»
- cmd.add(«EXPAND impl::diagram::commands::DeleteLinkCommand::newInstance('r') FOR ol»);
- cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), outgoingLink));
- continue;
- }
-«ENDFOREACH-»
- }
-«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE additions FOR gmfgen::GenNode»«ENDDEFINE»
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/editpolicies/OpenDiagram.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/editpolicies/OpenDiagram.xpt
deleted file mode 100644
index 306ca246d..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/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 gmfgen::OpenDiagramBehaviour»org.eclipse.gmf.runtime.diagram.ui.editpolicies.OpenEditPolicy«ENDDEFINE»
-
-«DEFINE getOpenCommand FOR gmfgen::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 gmfgen::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 gmfgen::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.migrated/xpt/diagram/editpolicies/TextFeedback.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/editpolicies/TextFeedback.xpt
deleted file mode 100644
index 5f1bca683..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/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 self-»
-}
-«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 self-»
-
- «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.migrated/xpt/diagram/editpolicies/Utils.qvto b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/editpolicies/Utils.qvto
deleted file mode 100644
index b31bf14e8..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/editpolicies/Utils.qvto
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * Copyright (c) 2007, 2009 Borland Software Corporation
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Alexander Shatalin (Borland) - initial API and implementation
- * Michael Golubev (Borland) - [243151] explicit source/target for links
- */
-import xpt.diagram.editpolicies.LinkUtils;
-import xpt.GenModelUtils;
-
-modeltype genModel uses "http://www.eclipse.org/gmf/2008/GenModel";
-
-library Utils;
-
-helper hasChildrenOrCompartments(node : genModel::GenNode) : Boolean {
- return not node.childNodes->isEmpty() or not node.compartments->isEmpty()
-}
-
-helper getContainerVariable(modelFacet : genModel::TypeLinkModelFacet) : String {
- return (if null <> modelFacet.sourceMetaFeature then 'container' else 'source' endif)
-}
-
-helper getValidLinkConstraints(diagram : genModel::GenDiagram) : Sequence(genModel::GenLinkConstraints) {
- return diagram.links->select(l | null <> l.creationConstraints and l.creationConstraints.isValid())->collect(l | l.creationConstraints)
-}
-
-helper getAllPotentialLinks(linkEnd : genModel::GenLinkEnd) : Sequence(genModel::GenLink) {
- return getAllRelatedLinks(linkEnd)->select(link | isCreationAllowed(link))
-}
-
-helper getReroutableTypeLinks(linkEnd : genModel::GenLinkEnd) : Sequence(genModel::GenLink) {
- return getAllRelatedReroutableLinks(linkEnd)->select(isTypeLink())
-}
-
-helper getReroutableRefLinks(linkEnd : genModel::GenLinkEnd) : Sequence(genModel::GenLink) {
- return getAllRelatedReroutableLinks(linkEnd)->select(isRefLink())
-}
-
---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
--- MODIFIERS: private cached
-helper getAllRelatedLinks(linkEnd : genModel::GenLinkEnd) : Sequence(genModel::GenLink) {
- return linkEnd.getDiagram().links->select(link | canBeSource(link, linkEnd) or canBeTarget(link, linkEnd))->asSequence()
-}
-
--- MODIFIERS: private cached
-helper getAllRelatedReroutableLinks(linkEnd : genModel::GenLinkEnd) : Sequence(genModel::GenLink) {
- return linkEnd.getDiagram().links->select(link | canBeSource(link, linkEnd) and link.sourceReorientingAllowed or (canBeTarget(link, linkEnd) and link.targetReorientingAllowed))->asSequence()
-}
-
--- MODIFIERS: private
-helper isCreationAllowed(link : genModel::GenLink) : Boolean {
- return null <> link.modelFacet and (link.outgoingCreationAllowed or link.incomingCreationAllowed)
-}
-
-helper createStartLinkCommand(link : genModel::GenLink, linkEnd : genModel::GenLinkEnd) : Boolean {
- return createStartOutgoingLinkCommand(link, linkEnd) or createStartIncomingLinkCommand(link, linkEnd)
-}
-
-helper createStartOutgoingLinkCommand(link : genModel::GenLink, linkEnd : genModel::GenLinkEnd) : Boolean {
- return isSelf(link, linkEnd) or (isOutgoing(link, linkEnd) and link.outgoingCreationAllowed)
-}
-
-helper createStartIncomingLinkCommand(link : genModel::GenLink, linkEnd : genModel::GenLinkEnd) : Boolean {
- return isIncoming(link, linkEnd) and link.incomingCreationAllowed
-}
-
-helper createCompleteLinkCommand(link : genModel::GenLink, linkEnd : genModel::GenLinkEnd) : Boolean {
- return createCompleteIncomingLinkCommand(link, linkEnd) or createCompleteOutgoingLinkCommand(link, linkEnd)
-}
-
-helper createCompleteIncomingLinkCommand(link : genModel::GenLink, linkEnd : genModel::GenLinkEnd) : Boolean {
- return isSelf(link, linkEnd) or (isIncoming(link, linkEnd) and link.outgoingCreationAllowed)
-}
-
-helper createCompleteOutgoingLinkCommand(link : genModel::GenLink, linkEnd : genModel::GenLinkEnd) : Boolean {
- return isOutgoing(link, linkEnd) and link.incomingCreationAllowed
-}
-
-helper checkSource(reversedRequest : Boolean, isCompleteCommand : Boolean) : Boolean {
- return not reversedRequest or isCompleteCommand
-}
-
-helper checkTarget(reversedRequest : Boolean, isCompleteCommand : Boolean) : Boolean {
- return reversedRequest or isCompleteCommand
-}
-
--- MODIFIERS: private
-helper isSelf(link : genModel::GenLink, linkEnd : genModel::GenLinkEnd) : Boolean {
- return canBeSource(link, linkEnd) and canBeTarget(link, linkEnd)
-}
-
--- MODIFIERS: private
-helper isOutgoing(link : genModel::GenLink, linkEnd : genModel::GenLinkEnd) : Boolean {
- return canBeSource(link, linkEnd) and not canBeTarget(link, linkEnd)
-}
-
--- MODIFIERS: private
-helper isIncoming(link : genModel::GenLink, linkEnd : genModel::GenLinkEnd) : Boolean {
- return canBeTarget(link, linkEnd) and not canBeSource(link, linkEnd)
-}
-
-helper i18nKeyForOpenCommandName() : String {
- return 'CommandName.OpenDiagram'
-}
--- if child's containment feature comes from the node, assume deletion of the parent would delete the child.
-helper GenChildNode::isDirectlyOwned(genNode : GenNode) : Boolean {
- if self.modelFacet.oclIsUndefined() or genNode.modelFacet.oclIsUndefined() then return false endif; -- can't assume anything
- return self.modelFacet.containmentMetaFeature.ecoreFeature.eContainingClass.isSuperTypeOf(genNode.modelFacet.metaClass.ecoreClass)
-}
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/editpolicies/childContainerCreateCommand.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/editpolicies/childContainerCreateCommand.xpt
deleted file mode 100644
index 675eda752..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/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 Sequence(gmfgen::GenNode)-»
-«IF not self->isEmpty()-»
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected org.eclipse.gef.commands.Command getCreateCommand(org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest req) {
-«FOREACH self AS n-»
- «EXPAND childNodeCreateCommand(n) FOR n.modelFacet-»
-«ENDFOREACH-»
- return super.getCreateCommand(req);
- }
-«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE childNodeCreateCommand(node : gmfgen::GenNode) 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.migrated/xpt/diagram/editpolicies/linkCommands.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/editpolicies/linkCommands.xpt
deleted file mode 100644
index ffd497348..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/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(self)->size() > 0-»
- «EXPAND createLinkCommands -»
- «ENDIF-»
- «IF getReroutableTypeLinks(self)->size() > 0-»
- «EXPAND reorientTypeLinkCommands -»
- «ENDIF-»
- «IF getReroutableRefLinks(self)->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(self) FOREACH getAllPotentialLinks(self)-»
- 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(self) FOREACH getAllPotentialLinks(self)-»
- return null;
-}
-«ENDDEFINE»
-
-«DEFINE startLinkCommands(linkEnd : gmfgen::GenLinkEnd) FOR gmfgen::GenLink-»
-if («EXPAND xpt::providers::ElementTypes::accessElementType» == req.getElementType()) {
- «IF createStartLinkCommand(self, linkEnd)-»
- return getGEFWrapper(new «getCreateCommandQualifiedClassName()»(req,
- «IF createStartIncomingLinkCommand(self, linkEnd)-»
- req.getTarget(), req.getSource()
- «ELSE-»
- req.getSource(), req.getTarget()
- «ENDIF-»
- ));
- «ELSE-»
- return null;
- «ENDIF-»
-}
-«ENDDEFINE»
-
-«DEFINE completeLinkCommands(linkEnd : gmfgen::GenLinkEnd) FOR gmfgen::GenLink-»
-if («EXPAND xpt::providers::ElementTypes::accessElementType» == req.getElementType()) {
- «IF createCompleteLinkCommand(self, linkEnd)-»
- return getGEFWrapper(new «getCreateCommandQualifiedClassName()»(req,
- «IF createCompleteOutgoingLinkCommand(self, 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(self)-»
- }
- 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(self)-»
- }
- 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.migrated/xpt/diagram/preferences/PreferenceInitializer.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/preferences/PreferenceInitializer.xpt
deleted file mode 100644
index a67a67305..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/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(self)»
-«ELSE»«REM»default values for predefined pages will be set manually«ENDREM-»
- «EXPAND initDefaults('store') FOREACH (allPreferencePages(self))[gmfgen::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(storeVar : String) FOR gmfgen::GenPreferencePage»«ERROR 'Abstract define for ' + self.repr()»«ENDDEFINE»
-
-«DEFINE initDefaults(storeVar : String) FOR gmfgen::GenStandardPreferencePage-»
-«EXPAND impl::preferences::StandardPage::call_initDefaults(storeVar)»
-«ENDDEFINE»
-
-«DEFINE initDefaults(storeVar : String) FOR gmfgen::GenCustomPreferencePage-»
-«EXPAND impl::preferences::CustomPage::call_initDefaults(storeVar)»
-«ENDDEFINE»
-
-«DEFINE initDefaults(storeVar : String) 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(storeVar : String, prefName : String) FOR gmfgen::GenColor»
- org.eclipse.jface.preference.PreferenceConverter.setDefault(«storeVar»,
- org.eclipse.gmf.runtime.diagram.ui.preferences.IPreferenceConstants.«prefName», «EXPAND rgb»);
-«ENDDEFINE»
-
-«DEFINE initDefaultFont(storeVar : String, prefName : String) 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: ' + self.repr()»
-«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: ' + self.repr()»
-«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.migrated/xpt/diagram/preferences/extensions.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/preferences/extensions.xpt
deleted file mode 100644
index eaf445a07..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/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(self)-»
- </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(self) AS p-»
-prefpage.«p.iD»=«p.name»
-«ENDFOREACH»
-«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/updater/DiagramUpdater.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/updater/DiagramUpdater.xpt
deleted file mode 100644
index 3778df79b..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/updater/DiagramUpdater.xpt
+++ /dev/null
@@ -1,488 +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»
-«EXTENSION org::eclipse::gmf::internal::codegen::util::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))->asSequence() 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 not 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(semanticContainers : Sequence(gmfgen::GenContainerBase)) FOR gmfgen::GenDiagramUpdater-»
- «EXPAND xpt::Common::generatedMemberComment»
-public static java.util.List getSemanticChildren(org.eclipse.gmf.runtime.notation.View view) {
- «IF not 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(self)->size() > 0 or self.getPhantomNodes()->size() > 0-»
- «EXPAND defineModelElement-»
- java.util.List result = new java.util.LinkedList();
-«REM»childMetaFeature can be null here!«ENDREM»«-»
- «FOREACH getSemanticChildrenChildFeatures(self) 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', self.getModelElementType()) FOR childMetaFeature».iterator(); it.hasNext();) {
- «EXPAND MetaModel::DeclareAndAssign('childElement', 'it.next()', true) FOR getTypeGenClassX(childMetaFeature)»
- «ELSE-»
- { «EXPAND MetaModel::DeclareAndAssign('childElement', 'modelElement', self.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 and isListType(childMetaFeature)) FOREACH getSemanticChildren(self, childMetaFeature)-»
- }
- «ENDFOREACH-»
- «IF not self.getPhantomNodes()->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 self.getPhantomNodes()-»
- }
- «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 self.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 self.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(inLoop : Boolean) 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 not editorGen.diagram.getPhantomNodes()->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(linkContainers : Sequence(gmfgen::GenCommonBase), methodNameSuffix : String) FOR gmfgen::GenDiagramUpdater-»
- «EXPAND xpt::Common::generatedMemberComment»
-public static java.util.List get«methodNameSuffix»Links(org.eclipse.gmf.runtime.notation.View view) {
- «IF not 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(methodNameSuffix : String) 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(suffix : String) FOR gmfgen::GenCommonBase»get«getUniqueIdentifier()»«suffix»Links«ENDDEFINE»
-
-«DEFINE getContainedLinks FOR gmfgen::GenCommonBase-»
- «EXPAND getConnectedLinks(getContainedLinks(self.getMetaClass(), getDiagram()), getContainedLinksMethodNameSuffix(), false)-»
-«ENDDEFINE»
-
-«DEFINE getIncomingLinks FOR gmfgen::GenLinkEnd-»
- «EXPAND getConnectedLinks(getIncomingLinks(self), getIncomingLinksMethodNameSuffix(), true)-»
-«ENDDEFINE»
-
-«DEFINE getOutgoingLinks FOR gmfgen::GenLinkEnd-»
- «EXPAND getConnectedLinks(getOutgoingLinks(self), getOutgoingLinksMethodNameSuffix(), false)-»
-«ENDDEFINE»
-
-«DEFINE getConnectedLinks(genLinks : Sequence(gmfgen::GenLink), methodNameSuffix : String, needCrossReferencer : Boolean) FOR gmfgen::GenCommonBase-»
-
- «EXPAND xpt::Common::generatedMemberComment»
-public static java.util.List «EXPAND linkGetterName(methodNameSuffix)»(org.eclipse.gmf.runtime.notation.View view) {
- «IF not genLinks->isEmpty()-»
- «LET self.getMetaClass() 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, isExternalInterface(metaclass)) FOREACH genLinks-»
- return result;
- «ENDLET-»
- «ELSE-»
- return java.util.Collections.EMPTY_LIST;
- «ENDIF-»
-}
-«ENDDEFINE»
-
-«DEFINE colectConnectedLinks(methodNameSuffix : String, needCrossReferencer : Boolean, isExternalInterface : Boolean) FOR gmfgen::GenLink-»
-«IF isExternalInterface-»
- if («EXPAND MetaModel::IsInstance('modelElement') FOR modelFacet.getLinkEndType(methodNameSuffix)») {
-«ENDIF-»
- result.addAll(«EXPAND chooseConnectedLinksByTypeMethodName(methodNameSuffix, self) FOR modelFacet»(«IF isExternalInterface-»
-«EXPAND MetaModel::CastEObject('modelElement') FOR modelFacet.getLinkEndType(methodNameSuffix)»«ELSE»modelElement«ENDIF»«IF needCrossReferencer», crossReferences«ENDIF»));
-«IF isExternalInterface-»
- }
-«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE chooseConnectedLinksByTypeMethodName(methodNameSuffix : String, genLink : gmfgen::GenLink) FOR gmfgen::LinkModelFacet-»
- «EXPAND incorrectLinkModelFacet-»
-«ENDDEFINE»
-
-«REM»
- For FeatureModelFacet-based links we are calling
- getOutgoing???Links instead of getContained???Links
-«ENDREM»
-«DEFINE chooseConnectedLinksByTypeMethodName(methodNameSuffix : String, genLink : gmfgen::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(methodNameSuffix : String, genLink : gmfgen::GenLink) FOR gmfgen::TypeLinkModelFacet-»
-«IF getOutgoingLinksMethodNameSuffix() = methodNameSuffix and null = sourceMetaFeature»«EXPAND getConnectedLinksByTypeMethodName(getContainedLinksMethodNameSuffix()) FOR genLink-»
-«ELSE»«EXPAND getConnectedLinksByTypeMethodName(methodNameSuffix) FOR genLink-»
-«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE getContainedLinksByTypeMethod FOR gmfgen::GenLink»«EXPAND getContainedLinksByTypeMethod(self) FOR modelFacet»«ENDDEFINE»
-
-«DEFINE getConnectedLinksByTypeMethodName(suffix : String) 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.firstToUpper()»«ENDDEFINE»
-
-«DEFINE getConnectedLinksByTypeMethodFragment FOR gmfgen::LinkModelFacet-»
- «EXPAND incorrectLinkModelFacet-»
-«ENDDEFINE»
-
-«DEFINE getContainedLinksByTypeMethod(genLink : gmfgen::GenLink) FOR gmfgen::LinkModelFacet-»
- «EXPAND incorrectLinkModelFacet-»
-«ENDDEFINE»
-
-«DEFINE getContainedLinksByTypeMethod(genLink : gmfgen::GenLink) FOR gmfgen::FeatureLinkModelFacet»«ENDDEFINE»
-
-«DEFINE getContainedLinksByTypeMethod(genLink : gmfgen::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(genLink : gmfgen::GenLink, sourceVarDefined : Boolean) FOR gmfgen::TypeLinkModelFacet-»
-java.util.Collection result = new java.util.LinkedList();
- «LET isListType(childMetaFeature) 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(genLink : gmfgen::GenLink, srcVar : String, dstVar : String) 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(genLink : gmfgen::GenLink, inLoop : Boolean) 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(inLoop : Boolean) FOR gmfgen::TypeLinkModelFacet-»
- «IF isListType(sourceMetaFeature)-»
-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(inLoop : Boolean) FOR gmfgen::TypeLinkModelFacet-»
-if (src != source) {
- «EXPAND stopLinkProcessing(inLoop)-»
-}
-«ENDDEFINE»
-
-«DEFINE defineLinkDestination(inLoop : Boolean) FOR gmfgen::TypeLinkModelFacet-»
- «IF isListType(targetMetaFeature)-»
-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(inLoop : Boolean) 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(self) FOR modelFacet-»
- }
- return result;
-}
-«ENDDEFINE»
-
-«DEFINE getIncomingLinksByTypeMethodBody(genLink : gmfgen::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(inLoop : Boolean) 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(genLink : gmfgen::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(genLink : gmfgen::GenLink) FOR gmfgen::LinkModelFacet-»
- «EXPAND incorrectLinkModelFacet-»
-«ENDDEFINE»
-
-«DEFINE getOutgoingLinksByTypeMethod FOR gmfgen::GenLink-»
- «EXPAND getOutgoingLinksByTypeMethod(self) 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(genLink : gmfgen::GenLink) FOR gmfgen::FeatureLinkModelFacet-»
-
- «EXPAND xpt::Common::generatedMemberComment»
-«EXPAND getOutgoingLinksByTypeMethodSignature FOR genLink» {
- java.util.Collection result = new java.util.LinkedList();
- «IF isListType(metaFeature)-»
- 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 isListType(metaFeature)-»
- }
- «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(genLink : gmfgen::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(genLink : gmfgen::GenLink) FOR gmfgen::LinkModelFacet-»
- «EXPAND incorrectLinkModelFacet-»
-«ENDDEFINE»
-
-«DEFINE incorrectLinkModelFacet FOR gmfgen::LinkModelFacet-»
- «ERROR 'Incorrect LinkModelFacet: ' + self.repr()»
-«ENDDEFINE»
-
-«DEFINE additions FOR gmfgen::GenDiagramUpdater»«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/updater/LinkDescriptor.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/updater/LinkDescriptor.xpt
deleted file mode 100644
index 5343f13dc..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/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.migrated/xpt/diagram/updater/NodeDescriptor.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/updater/NodeDescriptor.xpt
deleted file mode 100644
index 6ed617fae..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/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.migrated/xpt/diagram/updater/UpdateCommand.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/updater/UpdateCommand.xpt
deleted file mode 100644
index 490e9c464..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/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.migrated/xpt/diagram/updater/Utils.qvto b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/updater/Utils.qvto
deleted file mode 100644
index 9deb8b939..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/updater/Utils.qvto
+++ /dev/null
@@ -1,150 +0,0 @@
-import xpt.diagram.editpolicies.LinkUtils;
-
-modeltype genModel uses "http://www.eclipse.org/gmf/2008/GenModel";
-modeltype genModel_1 uses "http://www.eclipse.org/emf/2002/GenModel";
-
-library Utils;
-
-helper getContainedLinksMethodNameSuffix() : String {
- return 'Contained'
-}
-
-helper getIncomingLinksMethodNameSuffix() : String {
- return 'Incoming'
-}
-
-helper getOutgoingLinksMethodNameSuffix() : String {
- return 'Outgoing'
-}
-
-helper getContainedLinks(metaClass : genModel_1::GenClass, diagram : genModel::GenDiagram) : Sequence(genModel::GenLink) {
- return diagram.links->select(link | canBeContainer(link, metaClass))->asSequence()
-}
-
-helper getOutgoingLinks(linkEnd : genModel::GenLinkEnd) : Sequence(genModel::GenLink) {
- return linkEnd.getDiagram().links->select(link | linkEnd.genOutgoingLinks->includes(link))->asSequence()
-}
-
-helper getIncomingLinks(linkEnd : genModel::GenLinkEnd) : Sequence(genModel::GenLink) {
- return linkEnd.getDiagram().links->select(link | linkEnd.genIncomingLinks->includes(link))->asSequence()
-}
-
-helper getAllContainedLinks(diagram : genModel::GenDiagram) : Sequence(genModel::GenLink) {
- return diagram.links->select(link | not getAllSemanticElements(diagram)->select(commonBase | canBeContainer(link, commonBase.getMetaClass()))->isEmpty())->asSequence()
-}
-
-helper getAllIncomingLinks(diagram : genModel::GenDiagram) : Sequence(genModel::GenLink) {
- return diagram.links->select(link | not link.targets->isEmpty())->asSequence()
-}
-
-helper getAllOutgoingLinks(diagram : genModel::GenDiagram) : Sequence(genModel::GenLink) {
- return diagram.links->select(link | link.isOutgoingLink())->select(link | not link.sources->isEmpty())->asSequence()
-}
-
-helper genModel::GenLink::isOutgoingLink() : Boolean {
- return null <> self.modelFacet and self.modelFacet.isOutgoingLink()
-}
-
-helper genModel::LinkModelFacet::isOutgoingLink() : Boolean {
- return true
-}
-
-helper genModel::TypeLinkModelFacet::isOutgoingLink() : Boolean {
- return null <> self.sourceMetaFeature
-}
-
-helper getAllSemanticDiagramElements(diagram : genModel::GenDiagram) : Sequence(genModel::GenLinkEnd) {
- return ((diagram.getAllNodes()->asSequence())[genModel::GenLinkEnd]->union(diagram.links->asSequence()))[genModel::GenLinkEnd]->select(linkEnd | not linkEnd.getMetaClass().oclIsUndefined())
-}
-
-helper getAllSemanticElements(diagram : genModel::GenDiagram) : Sequence(genModel::GenCommonBase) {
- return (if null <> diagram.domainDiagramElement then (Sequence { diagram })[genModel::GenCommonBase]->union(getAllSemanticDiagramElements(diagram)) else getAllSemanticDiagramElements(diagram) endif)
-}
-
-helper genModel::GenCommonBase::getMetaClass() : genModel_1::GenClass {
- return null
-}
-
-helper genModel::GenDiagram::getMetaClass() : genModel_1::GenClass {
- return self.domainDiagramElement
-}
-
-helper genModel::GenNode::getMetaClass() : genModel_1::GenClass {
- return self.modelFacet.metaClass
-}
-
-helper genModel::GenLink::getMetaClass() : genModel_1::GenClass {
- return (if null <> self.modelFacet then self.modelFacet.getMetaClass() else null endif)
-}
-
-helper genModel::LinkModelFacet::getMetaClass() : genModel_1::GenClass {
- return null
-}
-
-helper genModel::TypeLinkModelFacet::getMetaClass() : genModel_1::GenClass {
- return self.metaClass
-}
-
-helper hasSemanticChildren(container : genModel::GenContainerBase) : Boolean {
- return not container.sansDomain and not container.containedNodes->isEmpty()
-}
-
-helper genModel::GenContainerBase::getModelElementType() : genModel_1::GenClass {
- return null
-}
-
-helper genModel::GenDiagram::getModelElementType() : genModel_1::GenClass {
- return self.domainDiagramElement
-}
-
-helper genModel::GenCompartment::getModelElementType() : genModel_1::GenClass {
- return self.node.getModelElementType()
-}
-
-helper genModel::GenNode::getModelElementType() : genModel_1::GenClass {
- return self.modelFacet.metaClass
-}
-
-helper getSemanticChildrenChildFeatures(containerBase : genModel::GenContainerBase) : Set(genModel_1::GenFeature) {
- return getNonPhantomSemanticChildren(containerBase)->collect(node | node.modelFacet.childMetaFeature)->asOrderedSet()
-}
-
-helper getSemanticChildrenContainmentFeatures(containerBase : genModel::GenContainerBase) : Set(genModel_1::GenFeature) {
- return getNonPhantomSemanticChildren(containerBase)->collect(node | node.modelFacet.containmentMetaFeature)->asOrderedSet()
-}
-
-helper getSemanticChildren(containerBase : genModel::GenContainerBase, childMetaFeature : genModel_1::GenFeature) : Sequence(genModel::GenNode) {
- return getNonPhantomSemanticChildren(containerBase)->select(node | node.modelFacet.childMetaFeature = childMetaFeature)
-}
-
-helper getNonPhantomSemanticChildren(containerBase : genModel::GenContainerBase) : Sequence(genModel::GenNode) {
- return getSemanticChildren(containerBase)->select(node | not node.modelFacet.isPhantomElement())
-}
-
-helper genModel::GenContainerBase::getPhantomNodes() : Sequence(genModel::GenNode) {
- return Sequence { }
-}
-
-helper genModel::GenDiagram::getPhantomNodes() : Sequence(genModel::GenNode) {
- return getSemanticChildren(self)->select(node | node.modelFacet.isPhantomElement())
-}
-
-helper getSemanticChildren(containerBase : genModel::GenContainerBase) : Sequence(genModel::GenNode) {
- return containerBase.containedNodes->select(node | null <> node.modelFacet)->asSequence()
-}
-
-helper hasConformableSemanticChildren(containerBase : genModel::GenContainerBase) : Boolean {
- return let childMetaClasses = getSemanticChildren(containerBase)->collect(node | node.modelFacet.metaClass) in not childMetaClasses->forAll(mc | childMetaClasses->select(mc2 | mc = mc2)->size() = 1)
-}
-
-helper genModel::LinkModelFacet::getLinkEndType(methodNameSuffix : String) : genModel_1::GenClass {
- return null
-}
-
-helper genModel::FeatureLinkModelFacet::getLinkEndType(methodNameSuffix : String) : genModel_1::GenClass {
- return (if getIncomingLinksMethodNameSuffix() = methodNameSuffix then self.getTargetType() else self.getSourceType() endif)
-}
-
-helper genModel::TypeLinkModelFacet::getLinkEndType(methodNameSuffix : String) : genModel_1::GenClass {
- return (if getIncomingLinksMethodNameSuffix() = methodNameSuffix then self.getTargetType() else (if getOutgoingLinksMethodNameSuffix() = methodNameSuffix and null <> self.sourceMetaFeature then self.getSourceType() else self.containmentMetaFeature.genClass endif) endif)
-}
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/updater/containerBaseCanonicalMethods.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/updater/containerBaseCanonicalMethods.xpt
deleted file mode 100644
index 4a2666aaa..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/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(self)-»
-
- «EXPAND populateViewProperties-»
- «ENDIF-»
-
- «EXPAND getDefaultFactoryHint-»
- «EXPAND getFeaturesToSynchronize-»
-«ENDDEFINE»
-
-«DEFINE attributes FOR gmfgen::GenContainerBase-»
-«IF getSemanticChildrenContainmentFeatures(self)->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(self)-»
- 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 not 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 not getSemanticChildren(self)->isEmpty()-»
- int visualID = «EXPAND xpt::editor::VisualIDRegistry::getVisualIDMethodCall FOR getDiagram()»(view);
- switch (visualID) {
- «EXPAND xpt::Common::caseVisualID FOREACH getSemanticChildren(self)»
- if (!semanticChildren.contains(view.getElement())) {
- return true;
- }
- «IF hasConformableSemanticChildren(self)-»
- «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(self)->size() > 0-»
-
- «EXPAND xpt::Common::generatedMemberComment»
-protected java.util.Set getFeaturesToSynchronize(){
- if (myFeaturesToSynchronize == null) {
- myFeaturesToSynchronize = new java.util.HashSet();
- «EXPAND addContainmentFeature FOREACH getSemanticChildrenContainmentFeatures(self)-»
- }
- 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.migrated/xpt/diagram/updater/extensions.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/updater/extensions.xpt
deleted file mode 100644
index 49f34316f..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/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.migrated/xpt/diagram/views/Utils.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/views/Utils.xpt
deleted file mode 100644
index ba8bc695c..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/views/Utils.xpt
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Copyright (c) 2007, 2009 Borland Software Corporation
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Dmitry Stadnik (Borland) - initial API and implementation
- * Artem Tikhomirov (Borland) - [257119] Create views directly, not through ViewFactories
- */
-
-«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::diagram::Utils»
-
-// FIXME ColorAttributes class is deprecated
-«DEFINE foregroundColour(viewVar : String) FOR gmfgen::Viewmap»«EXPAND foregroundColour(viewVar) FOREACH attributes[gmfgen::ColorAttributes]»«ENDDEFINE»
-«DEFINE foregroundColour(viewVar : String) 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(viewVar : String) FOR gmfgen::Viewmap»«EXPAND backgroundColour(viewVar) FOREACH attributes[gmfgen::ColorAttributes]»«ENDDEFINE»
-«DEFINE backgroundColour(viewVar : String) 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 addFontLineFillStylesConditionally(stylesVar : String) FOR gmfgen::Viewmap-»
-«IF not self.isFixedFont()-»
- «stylesVar».add(org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createFontStyle());
-«ENDIF-»
-«IF not self.isFixedForeground()-»
- «stylesVar».add(org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createLineStyle());
-«ENDIF-»
-«IF not self.isFixedBackground()-»
- «stylesVar».add(org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createFillStyle());
-«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE addTextStyle(stylesVar : String) FOR gmfgen::LabelModelFacet»«ENDDEFINE»
-«DEFINE addTextStyle(stylesVar : String) FOR gmfgen::DesignLabelModelFacet»«stylesVar».add(org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createDescriptionStyle());
-«ENDDEFINE»
-
-«DEFINE addLinkedDiagramStyle(stylesVar : String) FOR gmfgen::GenCommonBase»«EXPAND addLinkedDiagramStyle(stylesVar) FOREACH behaviour»«ENDDEFINE»
-«DEFINE addLinkedDiagramStyle(stylesVar : String) FOR gmfgen::Behaviour»«ENDDEFINE»
-«DEFINE addLinkedDiagramStyle(stylesVar : String) FOR gmfgen::OpenDiagramBehaviour-»
-«IF diagramKind <> null-»
- {
- org.eclipse.gmf.runtime.notation.HintedDiagramLinkStyle diagramFacet = org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createHintedDiagramLinkStyle();
- diagramFacet.setHint("«diagramKind»");«EXPAND xpt::Common::nonNLS»
- «stylesVar».add(diagramFacet);
- }
-«ELSE-»
- «stylesVar».add(org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createHintedDiagramLinkStyle());
-«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE addCustomStyles(stylesVar : String) FOR gmfgen::GenCommonBase-»
-«FOREACH styles AS style-»
- «stylesVar».add(«EXPAND MetaModel::NewInstance FOR style»);
-«ENDFOREACH-»
-«ENDDEFINE»
-
-// external node and link labels' offset
-
-«DEFINE offset(String viewVar) FOR gmfgen::GenLabel»«ENDDEFINE»
-
-«DEFINE offset(String viewVar) FOR gmfgen::GenLinkLabel-»
-«IF labelOffsetX(viewmap, 0) <> 0 or labelOffsetY(viewmap, 0) <> 0-»
- «EXPAND offset(viewVar, labelOffsetX(viewmap, 0), labelOffsetY(viewmap, 0))-»
-«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE offset(String viewVar) FOR gmfgen::GenExternalNodeLabel»«EXPAND offset(viewVar, 0, 5)»«ENDDEFINE»
-
-// viewVar must be already inserted into a diagram (view.getDiagram() should be meaningful)
-«DEFINE offset(String viewVar, x : Integer, y : Integer) FOR gmfgen::GenLabel-»
- org.eclipse.gmf.runtime.notation.Location location«visualID» = (org.eclipse.gmf.runtime.notation.Location) «viewVar».getLayoutConstraint();
-«IF self.getDiagram().isPixelMapMode()-»
- location«visualID».setX(«x»);
- location«visualID».setY(«y»);
-«ELSE-»
- location«visualID».setX(org.eclipse.gmf.runtime.diagram.ui.util.MeasurementUnitHelper.getMapMode(«viewVar».getDiagram().getMeasurementUnit()).DPtoLP(«x»));
- location«visualID».setY(org.eclipse.gmf.runtime.diagram.ui.util.MeasurementUnitHelper.getMapMode(«viewVar».getDiagram().getMeasurementUnit()).DPtoLP(«y»));
-«ENDIF-»
-«ENDDEFINE»
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/ActionBarContributor.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/ActionBarContributor.xpt
deleted file mode 100644
index 4caf0da89..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/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 or hasAudits(editorGen) or (editorGen.metrics <> null and 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 or hasAudits(editorGen)-»
- 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 and 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.migrated/xpt/editor/CreationWizard.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/CreationWizard.xpt
deleted file mode 100644
index c6af45b84..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/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(self)-»
-
- «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(titleKey(i18nKeyForCreationWizard(self))) 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(titleKey(i18nKeyForCreationWizardDiagramPage(self))) FOR editorGen»);
- diagramModelFilePage.setDescription(«EXPAND xpt::Externalizer::accessorCall(descriptionKey(i18nKeyForCreationWizardDiagramPage(self))) FOR editorGen»);
- addPage(diagramModelFilePage);
- «IF isStandaloneDomainModel(self)-»
-
- 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(titleKey(i18nKeyForCreationWizardDomainPage(self))) FOR editorGen»);
- domainModelFilePage.setDescription(«EXPAND xpt::Externalizer::accessorCall(descriptionKey(i18nKeyForCreationWizardDomainPage(self))) 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(self)-»
- 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(self)) 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(self)) 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(titleKey(i18nKeyForCreationWizard(self)), 'New ' + editorGen.modelID + ' Diagram')-»
-«EXPAND xpt::Externalizer::messageEntry(titleKey(i18nKeyForCreationWizardDiagramPage(self)), 'Create ' + editorGen.modelID + ' Diagram')-»
-«EXPAND xpt::Externalizer::messageEntry(descriptionKey(i18nKeyForCreationWizardDiagramPage(self)), (if isStandaloneDomainModel(self) then 'Select file that will contain diagram model.' else 'Select file that will contain diagram and domain models.' endif))-»
-«IF isStandaloneDomainModel(self)-»
-«EXPAND xpt::Externalizer::messageEntry(titleKey(i18nKeyForCreationWizardDomainPage(self)), 'Create ' + editorGen.modelID + ' Domain Model')-»
-«EXPAND xpt::Externalizer::messageEntry(descriptionKey(i18nKeyForCreationWizardDomainPage(self)), 'Select file that will contain domain model.')-»
-«ENDIF-»
-«EXPAND xpt::Externalizer::messageEntry(i18nKeyForCreationWizardOpenEditorError(self), 'Error opening diagram editor')-»
-«EXPAND xpt::Externalizer::messageEntry(i18nKeyForCreationWizardCreationError(self), 'Creation Problems')-»
-«ENDDEFINE»
-
-«DEFINE i18nAccessors FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Externalizer::accessorField(titleKey(i18nKeyForCreationWizard(self)))-»
- «EXPAND xpt::Externalizer::accessorField(titleKey(i18nKeyForCreationWizardDiagramPage(self)))-»
- «EXPAND xpt::Externalizer::accessorField(descriptionKey(i18nKeyForCreationWizardDiagramPage(self)))-»
- «IF isStandaloneDomainModel(self)-»
- «EXPAND xpt::Externalizer::accessorField(titleKey(i18nKeyForCreationWizardDomainPage(self)))-»
- «EXPAND xpt::Externalizer::accessorField(descriptionKey(i18nKeyForCreationWizardDomainPage(self)))-»
- «ENDIF-»
- «EXPAND xpt::Externalizer::accessorField(i18nKeyForCreationWizardOpenEditorError(self))-»
- «EXPAND xpt::Externalizer::accessorField(i18nKeyForCreationWizardCreationError(self))-»
-«ENDDEFINE»
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/CreationWizardPage.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/CreationWizardPage.xpt
deleted file mode 100644
index ef872708e..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/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(self)) 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(self), 'File name should have {0} extension.')-»
-«ENDDEFINE»
-
-«DEFINE i18nAccessors FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Externalizer::accessorField(i18nKeyForCreationWizardPageExtensionError(self))-»
-«ENDDEFINE»
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/DeleteElementAction.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/DeleteElementAction.xpt
deleted file mode 100644
index 13b6490a3..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/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.migrated/xpt/editor/DiagramContentInitializer.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/DiagramContentInitializer.xpt
deleted file mode 100644
index 9397e3041..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/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 | not container.sansDomain)-»
-
- «EXPAND createNode-»
-
- «EXPAND createLinks-»
- «IF not (getAllContainers())[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(self)-»
- 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 | not 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 <> link.getMetaClass())-»
- }
- }
- }
- 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.migrated/xpt/editor/DiagramEditorContextMenuProvider.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/DiagramEditorContextMenuProvider.xpt
deleted file mode 100644
index b60800bcc..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/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.migrated/xpt/editor/DiagramEditorUtil.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/DiagramEditorUtil.xpt
deleted file mode 100644
index 10b8ea2b3..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/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(titleKey(i18nKeyForOpenModelResourceErrorDialog(self))) FOR editorGen»,
- org.eclipse.osgi.util.NLS.bind(
- «EXPAND xpt::Externalizer::accessorCall(messageKey(i18nKeyForOpenModelResourceErrorDialog(self))) 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(self)»«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((if editorGen.application = null then 'This method should be called within a workspace modify operation since it creates resources.' else '' endif))»
- public static org.eclipse.emf.ecore.resource.Resource createDiagram(org.eclipse.emf.common.util.URI diagramURI,«IF standaloneDomainModel(self)» 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(self)) FOR editorGen», 3);
- final org.eclipse.emf.ecore.resource.Resource diagramResource = editingDomain.getResourceSet().createResource(diagramURI);
-«IF standaloneDomainModel(self)-»
- final org.eclipse.emf.ecore.resource.Resource modelResource = editingDomain.getResourceSet().createResource(modelURI);
-«ELSEIF domainDiagramElement <> null and hasDocumentRoot(self) /*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(self)) 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(self)»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(self)»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(self)»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(self)»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(self)» createDocumentRoot(«EXPAND MetaModel::QualifiedClassName FOR domainDiagramElement» model) {
- «EXPAND MetaModel::NewInstance('docRoot') FOR getDocumentRoot(self)»
-«LET getDocumentRootSetFeature(self) 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(self), '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(titleKey(i18nKeyForOpenModelResourceErrorDialog(self)))-»
-«EXPAND xpt::Externalizer::accessorField(messageKey(i18nKeyForOpenModelResourceErrorDialog(self)))-»
-«EXPAND xpt::Externalizer::accessorField(i18nKeyForCreateDiagramProgressTask(self))-»
-«EXPAND xpt::Externalizer::accessorField(i18nKeyForCreateDiagramCommandLabel(self))-»
-«ENDDEFINE»
-
-«DEFINE i18nValues FOR gmfgen::GenDiagram-»
-«EXPAND xpt::Externalizer::messageEntry(titleKey(i18nKeyForOpenModelResourceErrorDialog(self)), 'Error')-»
-«EXPAND xpt::Externalizer::messageEntry(messageKey(i18nKeyForOpenModelResourceErrorDialog(self)), 'Failed to load model file {0}')-»
-«EXPAND xpt::Externalizer::messageEntry(i18nKeyForCreateDiagramProgressTask(self), 'Creating diagram and model files')-»
-«EXPAND xpt::Externalizer::messageEntry(i18nKeyForCreateDiagramCommandLabel(self), 'Creating diagram and model')-»
-«ENDDEFINE»
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/DocumentProvider.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/DocumentProvider.xpt
deleted file mode 100644
index 5d0cf0b65..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/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(self)) 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(self)) 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(self)) 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(self)) 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(self)) 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(self)) FOR editorGen»,
- null));
- }
- «IF null = editorGen.application-»
- info.stopResourceListening();
- «ENDIF-»
- fireElementStateChanging(element);
- try {
- monitor.beginTask(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForDocumentSaveDiagramTask(self)) 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();
- monitor.setTaskName(org.eclipse.osgi.util.NLS.bind(
- «EXPAND xpt::Externalizer::accessorCall(i18nKeyForDocumentSaveNextResourceTask(self)) FOR editorGen»,
- nextResource.getURI()));
- if (nextResource.isLoaded() && !info.getEditingDomain().isReadOnly(nextResource)) {
- try {
- nextResource.save(«EXPAND xpt::Common::getSaveOptions»);
- } catch (java.io.IOException e) {
- fireElementStateChangeFailed(element);
- throw new org.eclipse.core.runtime.CoreException(new org.eclipse.core.runtime.Status(org.eclipse.core.runtime.IStatus.ERROR, «editorGen.plugin.getActivatorQualifiedClassName()».ID, org.eclipse.gmf.runtime.diagram.ui.resources.editor.internal.EditorStatusCodes.RESOURCE_FAILURE, e.getLocalizedMessage(), null));
- }
- }
- monitor.worked(1);
- }
- monitor.done();
- info.setModificationStamp(computeModificationStamp(info));
- } catch (RuntimeException x) {
- fireElementStateChangeFailed(element);
- throw x;
- } «IF null = editorGen.application» finally {
- info.startResourceListening();
- } «ENDIF»
- } else {
- org.eclipse.emf.common.util.URI newResoruceURI;
- java.util.List affectedFiles = null;
- «IF null = editorGen.application»if (element instanceof «EXPAND fileEditorInputClassFQName») {
- org.eclipse.core.resources.IFile newFile = ((«EXPAND fileEditorInputClassFQName») element).getFile();
- affectedFiles = java.util.Collections.singletonList(newFile);
- newResoruceURI = org.eclipse.emf.common.util.URI.createPlatformResourceURI(newFile.getFullPath().toString(), true);
- } else «ENDIF»if(element instanceof «EXPAND uriEditorInputClassFQName») {
- newResoruceURI = ((«EXPAND uriEditorInputClassFQName») element).getURI();
- } else {
- fireElementStateChangeFailed(element);
- «EXPAND throwIncorrectInputException-»
- }
- if (false == document instanceof org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocument) {
- fireElementStateChangeFailed(element);
- throw new org.eclipse.core.runtime.CoreException(new org.eclipse.core.runtime.Status(org.eclipse.core.runtime.IStatus.ERROR, «editorGen.plugin.getActivatorQualifiedClassName()».ID, 0,
- "Incorrect document used: " + document + " instead of org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocument", null));«EXPAND xpt::Common::nonNLS(1)»«EXPAND xpt::Common::nonNLS(2)»
- }
- org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocument diagramDocument = (org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocument) document;
- final org.eclipse.emf.ecore.resource.Resource newResource = diagramDocument.getEditingDomain().getResourceSet().createResource(newResoruceURI);
- final org.eclipse.gmf.runtime.notation.Diagram diagramCopy = (org.eclipse.gmf.runtime.notation.Diagram) org.eclipse.emf.ecore.util.EcoreUtil.copy(diagramDocument.getDiagram());
- try {
- new org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand(diagramDocument.getEditingDomain(), org.eclipse.osgi.util.NLS.bind(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForDocumentSaveAs(self)) FOR editorGen», diagramCopy.getName()), affectedFiles) {
- protected org.eclipse.gmf.runtime.common.core.command.CommandResult doExecuteWithResult(org.eclipse.core.runtime.IProgressMonitor monitor, org.eclipse.core.runtime.IAdaptable info) throws org.eclipse.core.commands.ExecutionException {
- newResource.getContents().add(diagramCopy);
- return org.eclipse.gmf.runtime.common.core.command.CommandResult.newOKCommandResult();
- }
- }.execute(monitor, null);
- newResource.save(«EXPAND xpt::Common::getSaveOptions»);
- } catch (org.eclipse.core.commands.ExecutionException e) {
- fireElementStateChangeFailed(element);
- throw new org.eclipse.core.runtime.CoreException(new org.eclipse.core.runtime.Status(org.eclipse.core.runtime.IStatus.ERROR, «editorGen.plugin.getActivatorQualifiedClassName()».ID, 0, e.getLocalizedMessage(), null));
- } catch (java.io.IOException e) {
- fireElementStateChangeFailed(element);
- throw new org.eclipse.core.runtime.CoreException(new org.eclipse.core.runtime.Status(org.eclipse.core.runtime.IStatus.ERROR, «editorGen.plugin.getActivatorQualifiedClassName()».ID, 0, e.getLocalizedMessage(), null));
- }
- newResource.unload();
- }
-}
-«ENDDEFINE»
-
-«DEFINE handleElementMoved FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-protected void handleElementMoved(org.eclipse.ui.IEditorInput input, org.eclipse.emf.common.util.URI uri) {
- «IF null = editorGen.application»if (input instanceof «EXPAND fileEditorInputClassFQName») {
- org.eclipse.core.resources.IFile newFile = org.eclipse.core.resources.ResourcesPlugin.getWorkspace().getRoot().getFile(new org.eclipse.core.runtime.Path(org.eclipse.emf.common.util.URI.decode(uri.path())).removeFirstSegments(1));
- fireElementMoved(input, newFile == null ? null : new org.eclipse.ui.part.FileEditorInput(newFile));
- return;
- }«ENDIF»
- // TODO: append suffix to the URI! (use diagram as a parameter)
- fireElementMoved(input, new org.eclipse.emf.common.ui.URIEditorInput(uri));
-}
-«ENDDEFINE»
-
-«DEFINE createInputWithEditingDomain FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-public org.eclipse.ui.IEditorInput createInputWithEditingDomain(org.eclipse.ui.IEditorInput editorInput, org.eclipse.emf.transaction.TransactionalEditingDomain domain) {
- return editorInput;
-}
-«ENDDEFINE»
-
-«DEFINE getDiagramDocument FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-public org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocument getDiagramDocument(Object element) {
- org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDocument doc = getDocument(element);
- if (doc instanceof org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocument) {
- return (org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocument) doc;
- }
- return null;
-}
-«ENDDEFINE»
-
-«DEFINE getOperationRunner FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-protected org.eclipse.jface.operation.IRunnableContext getOperationRunner(org.eclipse.core.runtime.IProgressMonitor monitor) {
- return null;
-}
-«ENDDEFINE»
-
-«DEFINE getFile FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-private static java.io.File getFile(org.eclipse.emf.ecore.resource.Resource resource) {
- org.eclipse.emf.common.util.URI resourceUri = resource.getURI();
- if (resourceUri != null && resourceUri.isFile()) {
- java.io.File file = new java.io.File(resourceUri.toFileString());
- if (!file.isDirectory()) {
- return file;
- }
- }
- return null;
-}
-«ENDDEFINE»
-
-«DEFINE i18nAccessors FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Externalizer::accessorField(i18nKeyForDocumentProviderIsModifiable(self))-»
- «EXPAND xpt::Externalizer::accessorField(i18nKeyForDocumentProviderHandleElementContentChanged(self))-»
- «EXPAND xpt::Externalizer::accessorField(i18nKeyForDocumentProviderIncorrectInputError(self))-»
- «EXPAND xpt::Externalizer::accessorField(i18nKeyForDocumentProviderNoDiagramInResourceError(self))-»
- «EXPAND xpt::Externalizer::accessorField(i18nKeyForDocumentProviderDiagramLoadingError(self))-»
- «EXPAND xpt::Externalizer::accessorField(i18nKeyForDocumentUnsynchronizedFileSaveError(self))-»
- «EXPAND xpt::Externalizer::accessorField(i18nKeyForDocumentSaveDiagramTask(self))-»
- «EXPAND xpt::Externalizer::accessorField(i18nKeyForDocumentSaveNextResourceTask(self))-»
- «EXPAND xpt::Externalizer::accessorField(i18nKeyForDocumentSaveAs(self))-»
-«ENDDEFINE»
-
-«DEFINE i18nValues FOR gmfgen::GenDiagram-»
-«EXPAND xpt::Externalizer::messageEntry(i18nKeyForDocumentProviderIsModifiable(self), 'Updating cache failed')-»
-«EXPAND xpt::Externalizer::messageEntry(i18nKeyForDocumentProviderHandleElementContentChanged(self), 'Failed to refresh hierarchy for changed resource')-»
-«EXPAND xpt::Externalizer::messageEntry(i18nKeyForDocumentProviderIncorrectInputError(self), (if 'Incorrect element used: {0} instead of ' + editorGen.application.repr() = null then '{1} or {2}' else '{1}' endif))-»
-«EXPAND xpt::Externalizer::messageEntry(i18nKeyForDocumentProviderNoDiagramInResourceError(self), 'Diagram is not present in resource')-»
-«EXPAND xpt::Externalizer::messageEntry(i18nKeyForDocumentProviderDiagramLoadingError(self), 'Error loading diagram')-»
-«EXPAND xpt::Externalizer::messageEntry(i18nKeyForDocumentUnsynchronizedFileSaveError(self), 'The file has been changed on the file system')-»
-«EXPAND xpt::Externalizer::messageEntry(i18nKeyForDocumentSaveDiagramTask(self), 'Saving diagram')-»
-«EXPAND xpt::Externalizer::messageEntry(i18nKeyForDocumentSaveNextResourceTask(self), 'Saving {0}')-»
-«EXPAND xpt::Externalizer::messageEntry(i18nKeyForDocumentSaveAs(self), 'Saving {0} diagram as')-»
-«ENDDEFINE»
-
-«DEFINE additions FOR gmfgen::GenDiagram-»
-«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/Editor.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/Editor.xpt
deleted file mode 100644
index 93903cb4e..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/Editor.xpt
+++ /dev/null
@@ -1,404 +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/gmf/2008/GenModel'»
-«IMPORT 'http://www.eclipse.org/emf/2002/Ecore'»
-«EXTENSION xpt::editor::Utils»
-
-«DEFINE Editor FOR gmfgen::GenEditorView-»
- «EXPAND xpt::Common::copyright FOR editorGen-»
-package «packageName»;
-
- «EXPAND xpt::Common::generatedClassComment»
-public class «className» extends org.eclipse.gmf.runtime.diagram.ui.resources.editor.parts.DiagramDocumentEditor«EXPAND implementsList FOR getEditorImplementsList(self)» {
-
- «EXPAND attributes-»
-
- «EXPAND _constructor-»
-
- «EXPAND getContextID-»
- «EXPAND createPaletteRoot FOR editorGen.diagram.palette-»
-
- «EXPAND getPreferencesHint-»
-
- «EXPAND getContributorId-»
- «EXPAND getAdapter-»
-
- «EXPAND getDocumentProvider-»
-
- «EXPAND getEditingDomain-»
-
- «EXPAND setDocumentProvider-»
- «IF isIDEMode(self)-»
-
- «EXPAND gotoMarker-»
-
- «EXPAND isSaveAsAllowed-»
-
- «EXPAND doSaveAs-»
-
- «EXPAND performSaveAs-»
-
- «EXPAND getShowInContext-»
- «EXPAND getNavigatorSelection FOR editorGen.navigator-»
- «ENDIF-»
-
- «EXPAND configureGraphicalViewer-»
-
- «IF editorGen.diagram.generateCreateShortcutAction()-»
-
- «EXPAND initializeGraphicalViewer-»
-
- «EXPAND DropTargetListener-»
- «ENDIF-»
-
- «EXPAND additions-»
-}
-«ENDDEFINE»
-
-«DEFINE attributes FOR gmfgen::GenEditorView-»
- «EXPAND xpt::Common::generatedMemberComment»
-public static final String ID = "«iD»"; «EXPAND xpt::Common::nonNLS»
-
- «EXPAND xpt::Common::generatedMemberComment»
-public static final String CONTEXT_ID = "«contextID»"; «EXPAND xpt::Common::nonNLS»
-«ENDDEFINE»
-
-«DEFINE _constructor FOR gmfgen::GenEditorView-»
- «EXPAND xpt::Common::generatedMemberComment»
-public «className»() {
- super(«null <> editorGen.diagram.palette and editorGen.diagram.palette.flyout»);
-}
-«ENDDEFINE»
-
-«DEFINE getContextID FOR gmfgen::GenEditorView-»
- «EXPAND xpt::Common::generatedMemberComment»
-protected String getContextID() {
- return CONTEXT_ID;
-}
-«ENDDEFINE»
-
-«DEFINE createPaletteRoot FOR gmfgen::Palette-»
-
- «EXPAND xpt::Common::generatedMemberComment»
-protected org.eclipse.gef.palette.PaletteRoot createPaletteRoot(org.eclipse.gef.palette.PaletteRoot existingPaletteRoot) {
- org.eclipse.gef.palette.PaletteRoot root = super.createPaletteRoot(existingPaletteRoot);
- new «getFactoryQualifiedClassName()»().fillPalette(root);
- return root;
-}
-«ENDDEFINE»
-
-«DEFINE getPreferencesHint FOR gmfgen::GenEditorView-»
- «EXPAND xpt::Common::generatedMemberComment»
-protected org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint getPreferencesHint() {
-«REM»
- XXX seems better we use preference store directly (in configureGraphicalViewer) instead all these indirect ids
-«ENDREM»«-»
- return «EXPAND xpt::plugin::Activator::preferenceHintAccess FOR editorGen»;
-}
-«ENDDEFINE»
-
-«DEFINE getContributorId FOR gmfgen::GenEditorView-»
- «EXPAND xpt::Common::generatedMemberComment»
-public String getContributorId() {
- return «editorGen.plugin.getActivatorQualifiedClassName()».ID;
-}
-«ENDDEFINE»
-
-«DEFINE getAdapter FOR gmfgen::GenEditorView-»
- «IF not hasPropertySheet(self) or hasNavigator(self)-»
-
- «EXPAND xpt::Common::generatedMemberComment»
-public Object getAdapter(Class type) {
- «IF not hasPropertySheet(self)-»
- if (type == org.eclipse.ui.views.properties.IPropertySheetPage.class) {
- return null;
- }
- «ENDIF-»
- «IF hasNavigator(self)-»
- if (type == org.eclipse.ui.part.IShowInTargetList.class) {
- return new org.eclipse.ui.part.IShowInTargetList() {
- public String[] getShowInTargetIds() {
- return new String[] { org.eclipse.ui.navigator.resources.ProjectExplorer.VIEW_ID };
- }
- };
- }
- «ENDIF-»
- return super.getAdapter(type);
-}
- «ENDIF-»
-«ENDDEFINE»
-
-«DEFINE getDocumentProvider FOR gmfgen::GenEditorView-»
- «EXPAND xpt::Common::generatedMemberComment»
-protected org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDocumentProvider getDocumentProvider(org.eclipse.ui.IEditorInput input) {
- if («EXPAND checkEditorInput») {
- return «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().getDocumentProvider();
- }
- return super.getDocumentProvider(input);
-}
-«ENDDEFINE»
-
-«DEFINE getEditingDomain FOR gmfgen::GenEditorView-»
- «EXPAND xpt::Common::generatedMemberComment»
-public org.eclipse.emf.transaction.TransactionalEditingDomain getEditingDomain() {
- org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDocument document = getEditorInput() != null ? getDocumentProvider().getDocument(getEditorInput()) : null;
- if (document instanceof org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocument) {
- return ((org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocument) document).getEditingDomain();
- }
- return super.getEditingDomain();
-}
-«ENDDEFINE»
-
-«DEFINE setDocumentProvider FOR gmfgen::GenEditorView-»
- «EXPAND xpt::Common::generatedMemberComment»
-protected void setDocumentProvider(org.eclipse.ui.IEditorInput input) {
- if («EXPAND checkEditorInput») {
- setDocumentProvider(«editorGen.plugin.getActivatorQualifiedClassName()».getInstance().getDocumentProvider());
- } else {
- super.setDocumentProvider(input);
- }
-}
-«ENDDEFINE»
-
-«DEFINE checkEditorInput FOR gmfgen::GenEditorView»«IF isIDEMode(self)»input instanceof org.eclipse.ui.IFileEditorInput || «ENDIF»input instanceof org.eclipse.emf.common.ui.URIEditorInput«ENDDEFINE»
-
-«DEFINE gotoMarker FOR gmfgen::GenEditorView-»
- «EXPAND xpt::Common::generatedMemberComment»
-public void gotoMarker(org.eclipse.core.resources.IMarker marker) {
- org.eclipse.gmf.runtime.common.ui.services.marker.MarkerNavigationService.getInstance().gotoMarker(this, marker);
-}
-«ENDDEFINE»
-
-«DEFINE isSaveAsAllowed FOR gmfgen::GenEditorView-»
- «EXPAND xpt::Common::generatedMemberComment»
-public boolean isSaveAsAllowed() {
- return true;
-}
-«ENDDEFINE»
-
-«DEFINE doSaveAs FOR gmfgen::GenEditorView-»
- «EXPAND xpt::Common::generatedMemberComment»
-public void doSaveAs() {
- performSaveAs(new org.eclipse.core.runtime.NullProgressMonitor());
-}
-«ENDDEFINE»
-
-«DEFINE performSaveAs FOR gmfgen::GenEditorView-»
- «EXPAND xpt::Common::generatedMemberComment»
-protected void performSaveAs(org.eclipse.core.runtime.IProgressMonitor progressMonitor) {
- org.eclipse.swt.widgets.Shell shell = getSite().getShell();
- org.eclipse.ui.IEditorInput input = getEditorInput();
- org.eclipse.ui.dialogs.SaveAsDialog dialog = new org.eclipse.ui.dialogs.SaveAsDialog(shell);
- org.eclipse.core.resources.IFile original = input instanceof org.eclipse.ui.IFileEditorInput ? ((org.eclipse.ui.IFileEditorInput) input).getFile() : null;
- if (original != null) {
- dialog.setOriginalFile(original);
- }
- dialog.create();
- org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDocumentProvider provider = getDocumentProvider();
- if (provider == null) {
- // editor has been programmatically closed while the dialog was open
- return;
- }
- if (provider.isDeleted(input) && original != null) {
- String message = org.eclipse.osgi.util.NLS.bind(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForSavingDeletedFile(self)) FOR editorGen», original.getName());
- dialog.setErrorMessage(null);
- dialog.setMessage(message, org.eclipse.jface.dialogs.IMessageProvider.WARNING);
- }
- if (dialog.open() == org.eclipse.jface.window.Window.CANCEL) {
- if (progressMonitor != null) {
- progressMonitor.setCanceled(true);
- }
- return;
- }
- org.eclipse.core.runtime.IPath filePath = dialog.getResult();
- if (filePath == null) {
- if (progressMonitor != null) {
- progressMonitor.setCanceled(true);
- }
- return;
- }
- org.eclipse.core.resources.IWorkspaceRoot workspaceRoot = org.eclipse.core.resources.ResourcesPlugin.getWorkspace().getRoot();
- org.eclipse.core.resources.IFile file = workspaceRoot.getFile(filePath);
- final org.eclipse.ui.IEditorInput newInput = new org.eclipse.ui.part.FileEditorInput(file);
- // Check if the editor is already open
- org.eclipse.ui.IEditorMatchingStrategy matchingStrategy = getEditorDescriptor().getEditorMatchingStrategy();
- org.eclipse.ui.IEditorReference[] editorRefs = org.eclipse.ui.PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getEditorReferences();
- for (int i = 0; i < editorRefs.length; i++) {
- if (matchingStrategy.matches(editorRefs[i], newInput)) {
- org.eclipse.jface.dialogs.MessageDialog.openWarning(shell, «EXPAND xpt::Externalizer::accessorCall(titleKey(i18nKeyForSaveAsProblems(self))) FOR editorGen», «EXPAND xpt::Externalizer::accessorCall(messageKey(i18nKeyForSaveAsProblems(self))) FOR editorGen»);
- return;
- }
- }
- boolean success = false;
- try {
- provider.aboutToChange(newInput);
- getDocumentProvider(newInput).saveDocument(progressMonitor, newInput, getDocumentProvider().getDocument(getEditorInput()), true);
- success = true;
- } catch (org.eclipse.core.runtime.CoreException x) {
- org.eclipse.core.runtime.IStatus status = x.getStatus();
- if (status == null || status.getSeverity() != org.eclipse.core.runtime.IStatus.CANCEL) {
- org.eclipse.jface.dialogs.ErrorDialog.openError(shell, «EXPAND xpt::Externalizer::accessorCall(titleKey(i18nKeyForSaveProblems(self))) FOR editorGen», «EXPAND xpt::Externalizer::accessorCall(messageKey(i18nKeyForSaveProblems(self))) FOR editorGen», x.getStatus());
- }
- } finally {
- provider.changed(newInput);
- if (success) {
- setInput(newInput);
- }
- }
- if (progressMonitor != null) {
- progressMonitor.setCanceled(!success);
- }
-}
-«ENDDEFINE»
-
-«DEFINE getShowInContext FOR gmfgen::GenEditorView-»
- «EXPAND xpt::Common::generatedMemberComment»
-public org.eclipse.ui.part.ShowInContext getShowInContext() {
- return new org.eclipse.ui.part.ShowInContext(getEditorInput(), «IF hasNavigator(self)»getNavigatorSelection()«ELSE»getGraphicalViewer().getSelection()«ENDIF»);
-}
-«ENDDEFINE»
-
-«DEFINE getNavigatorSelection FOR gmfgen::GenNavigator-»
-
- «EXPAND xpt::Common::generatedMemberComment»
-private org.eclipse.jface.viewers.ISelection getNavigatorSelection() {
- org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocument document = getDiagramDocument();
- «EXPAND xpt::navigator::NavigatorLinkHelper::findSelectionBody-»
-}
-«ENDDEFINE»
-
-«DEFINE configureGraphicalViewer FOR gmfgen::GenEditorView-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected void configureGraphicalViewer() {
- super.configureGraphicalViewer();
- «EXPAND xpt::editor::DiagramEditorContextMenuProvider::qualifiedClassName FOR editorGen.diagram» provider =
- new «EXPAND xpt::editor::DiagramEditorContextMenuProvider::qualifiedClassName FOR editorGen.diagram»(this, getDiagramGraphicalViewer());
- getDiagramGraphicalViewer().setContextMenu(provider);
- getSite().registerContextMenu(org.eclipse.gmf.runtime.diagram.ui.actions.ActionIds.DIAGRAM_EDITOR_CONTEXT_MENU, provider, getDiagramGraphicalViewer());
- }
-«ENDDEFINE»
-
-«DEFINE initializeGraphicalViewer FOR gmfgen::GenEditorView-»
- «EXPAND xpt::Common::generatedMemberComment»
-protected void initializeGraphicalViewer() {
- super.initializeGraphicalViewer();
- «EXPAND addDropTargetListener('org.eclipse.jface.util.LocalSelectionTransfer.getTransfer()')-»
- «EXPAND addDropTargetListener('org.eclipse.emf.edit.ui.dnd.LocalTransfer.getInstance()')-»
-}
-«ENDDEFINE»
-
-«DEFINE addDropTargetListener(transferAccessor : String) FOR gmfgen::GenEditorView-»
-getDiagramGraphicalViewer().addDropTargetListener(new DropTargetListener(getDiagramGraphicalViewer(), «transferAccessor») {
-
- protected Object getJavaObject(org.eclipse.swt.dnd.TransferData data) {
- return «transferAccessor».nativeToJava(data);
- }
-
-});
-«ENDDEFINE»
-
-«DEFINE DropTargetListener FOR gmfgen::GenEditorView-»
- «EXPAND xpt::Common::generatedClassComment»
-private abstract class DropTargetListener extends org.eclipse.gmf.runtime.diagram.ui.parts.DiagramDropTargetListener {
-
- «EXPAND DTL_constructor-»
-
- «EXPAND DTL_getObjectsBeingDropped-»
-
- «EXPAND DTL_getJavaObject-»
-
- «EXPAND DTL_additions-»
-}
-«ENDDEFINE»
-
-
-«DEFINE DTL_constructor FOR gmfgen::GenEditorView-»
- «EXPAND xpt::Common::generatedMemberComment»
-public DropTargetListener(org.eclipse.gef.EditPartViewer viewer, org.eclipse.swt.dnd.Transfer xfer) {
- super(viewer, xfer);
-}
-«ENDDEFINE»
-
-«DEFINE DTL_getObjectsBeingDropped FOR gmfgen::GenEditorView-»
- «EXPAND xpt::Common::generatedMemberComment»
-protected java.util.List getObjectsBeingDropped() {
- org.eclipse.swt.dnd.TransferData data = getCurrentEvent().currentDataType;
- java.util.Collection uris = new java.util.HashSet();
-
- Object transferedObject = getJavaObject(data);
- if (transferedObject instanceof org.eclipse.jface.viewers.IStructuredSelection) {
- org.eclipse.jface.viewers.IStructuredSelection selection = (org.eclipse.jface.viewers.IStructuredSelection) transferedObject;
- for (java.util.Iterator it = selection.iterator(); it.hasNext();) {
- Object nextSelectedObject = it.next();
-«REM»
- TODO: move NavigatorItem to some place available in runtime and remove
- "genEditor.getEditorGen().getNavigator() != null" test
-«ENDREM»«-»
- «IF hasNavigator(self)»if (nextSelectedObject instanceof «editorGen.navigator.getNavigatorItemQualifiedClassName()») {
- org.eclipse.gmf.runtime.notation.View view = ((«editorGen.navigator.getNavigatorItemQualifiedClassName()») nextSelectedObject).getView();
- nextSelectedObject = view.getElement();
- } else «ENDIF»if (nextSelectedObject instanceof org.eclipse.core.runtime.IAdaptable) {
- org.eclipse.core.runtime.IAdaptable adaptable = (org.eclipse.core.runtime.IAdaptable) nextSelectedObject;
- nextSelectedObject = adaptable.getAdapter(org.eclipse.emf.ecore.EObject.class);
- }
-
- if (nextSelectedObject instanceof org.eclipse.emf.ecore.EObject) {
- org.eclipse.emf.ecore.EObject modelElement = (org.eclipse.emf.ecore.EObject) nextSelectedObject;
- org.eclipse.emf.ecore.resource.Resource modelElementResource = modelElement.eResource();
- uris.add(modelElementResource.getURI().appendFragment(modelElementResource.getURIFragment(modelElement)));
- }
- }
- }
-
- java.util.List result = new java.util.ArrayList();
- for (java.util.Iterator it = uris.iterator(); it.hasNext();) {
- org.eclipse.emf.common.util.URI nextURI = (org.eclipse.emf.common.util.URI) it.next();
- org.eclipse.emf.ecore.EObject modelObject = getEditingDomain().getResourceSet().getEObject(nextURI, true);
- result.add(modelObject);
- }
- return result;
-}
-«ENDDEFINE»
-
-«DEFINE DTL_getJavaObject FOR gmfgen::GenEditorView-»
- «EXPAND xpt::Common::generatedMemberComment»
-protected abstract Object getJavaObject(org.eclipse.swt.dnd.TransferData data);
-«ENDDEFINE»
-
-«DEFINE implementsList FOR Sequence(String)-»
-«IF not self->isEmpty()» implements «EXPAND implementsListEntry FOREACH self SEPARATOR ', '»«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE implementsListEntry FOR String»«self»«ENDDEFINE»
-
-«DEFINE DTL_additions FOR gmfgen::GenEditorView-»
-«ENDDEFINE»
-
-«DEFINE additions FOR gmfgen::GenEditorView-»
-«ENDDEFINE»
-
-«DEFINE i18nValues FOR gmfgen::GenEditorView-»
-«EXPAND xpt::Externalizer::messageEntry(i18nKeyForSavingDeletedFile(self), 'The original file \"{0}\" has been deleted.')-»
-«EXPAND xpt::Externalizer::messageEntry(titleKey(i18nKeyForSaveAsProblems(self)), 'Problem During Save As...')-»
-«EXPAND xpt::Externalizer::messageEntry(messageKey(i18nKeyForSaveAsProblems(self)), 'Save could not be completed. Target file is already open in another editor.')-»
-«EXPAND xpt::Externalizer::messageEntry(titleKey(i18nKeyForSaveProblems(self)), 'Save Problems')-»
-«EXPAND xpt::Externalizer::messageEntry(messageKey(i18nKeyForSaveProblems(self)), 'Could not save file.')-»
-«ENDDEFINE»
-
-«DEFINE i18nAccessors FOR gmfgen::GenEditorView-»
- «EXPAND xpt::Externalizer::accessorField(i18nKeyForSavingDeletedFile(self))-»
- «EXPAND xpt::Externalizer::accessorField(titleKey(i18nKeyForSaveAsProblems(self)))-»
- «EXPAND xpt::Externalizer::accessorField(messageKey(i18nKeyForSaveAsProblems(self)))-»
- «EXPAND xpt::Externalizer::accessorField(titleKey(i18nKeyForSaveProblems(self)))-»
- «EXPAND xpt::Externalizer::accessorField(messageKey(i18nKeyForSaveProblems(self)))-»
-«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/ElementChooser.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/ElementChooser.xpt
deleted file mode 100644
index 4481be47b..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/ElementChooser.xpt
+++ /dev/null
@@ -1,414 +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'»
-«EXTENSION xpt::editor::Utils»
-
-«DEFINE ElementChooser FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::copyright FOR editorGen-»
-package «editorGen.editor.packageName»;
-
- «EXPAND xpt::Common::generatedClassComment»
-public class «elementChooserClassName» extends org.eclipse.jface.dialogs.Dialog {
-
- «EXPAND attributes-»
-
- «EXPAND _constructor-»
-
- «EXPAND createDialogArea-»
-
- «EXPAND createButtonBar-»
-
- «EXPAND createModelBrowser-»
-
- «EXPAND setOkButtonEnabled-»
-
- «EXPAND isValidModelFile-»
-
- «EXPAND getSelectedModelElementURI-»
-
- «EXPAND open-»
-
- «EXPAND ModelElementsTreeContentProvider-»
-
- «EXPAND ModelElementsTreeLabelProvider-»
-
- «EXPAND ModelFilesFilter-»
-
- «EXPAND OkButtonEnabler-»
-
- «EXPAND additions-»
-}
-«ENDDEFINE»
-
-«DEFINE attributes FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-private org.eclipse.jface.viewers.TreeViewer myTreeViewer;
-
- «EXPAND xpt::Common::generatedMemberComment»
-private org.eclipse.emf.common.util.URI mySelectedModelElementURI;
-
- «EXPAND xpt::Common::generatedMemberComment»
-private org.eclipse.gmf.runtime.notation.View myView;
-
- «EXPAND xpt::Common::generatedMemberComment»
-private org.eclipse.emf.transaction.TransactionalEditingDomain myEditingDomain = org.eclipse.gmf.runtime.emf.core.GMFEditingDomainFactory.INSTANCE.createEditingDomain();
-«ENDDEFINE»
-
-«DEFINE _constructor FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-public «elementChooserClassName»(org.eclipse.swt.widgets.Shell parentShell, org.eclipse.gmf.runtime.notation.View view) {
- super(parentShell);
- setShellStyle(getShellStyle() | org.eclipse.swt.SWT.RESIZE);
- myView = view;
-}
-«ENDDEFINE»
-
-«DEFINE createDialogArea FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-protected org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite parent) {
- org.eclipse.swt.widgets.Composite composite = (org.eclipse.swt.widgets.Composite) super.createDialogArea(parent);
- getShell().setText(«EXPAND xpt::Externalizer::accessorCall(titleKey(i18nKeyForSelectModelElement(self))) FOR editorGen»);
- createModelBrowser(composite);
- return composite;
-}
-«ENDDEFINE»
-
-«DEFINE createButtonBar FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-protected org.eclipse.swt.widgets.Control createButtonBar(org.eclipse.swt.widgets.Composite parent) {
- org.eclipse.swt.widgets.Control buttonBar = super.createButtonBar(parent);
- setOkButtonEnabled(false);
- return buttonBar;
-}
-«ENDDEFINE»
-
-«DEFINE createModelBrowser FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-private void createModelBrowser(org.eclipse.swt.widgets.Composite composite) {
- myTreeViewer = new org.eclipse.jface.viewers.TreeViewer(composite, org.eclipse.swt.SWT.SINGLE | org.eclipse.swt.SWT.H_SCROLL | org.eclipse.swt.SWT.V_SCROLL | org.eclipse.swt.SWT.BORDER);
- org.eclipse.swt.layout.GridData layoutData = new org.eclipse.swt.layout.GridData(org.eclipse.swt.layout.GridData.FILL_BOTH);
- layoutData.heightHint = 300;
- layoutData.widthHint = 300;
- myTreeViewer.getTree().setLayoutData(layoutData);
- myTreeViewer.setContentProvider(new ModelElementsTreeContentProvider());
- myTreeViewer.setLabelProvider(new ModelElementsTreeLabelProvider());
- myTreeViewer.setInput(org.eclipse.core.resources.ResourcesPlugin.getWorkspace().getRoot());
- myTreeViewer.addFilter(new ModelFilesFilter());
- myTreeViewer.addSelectionChangedListener(new OkButtonEnabler());
-}
-«ENDDEFINE»
-
-«DEFINE setOkButtonEnabled FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-private void setOkButtonEnabled(boolean enabled) {
- getButton(org.eclipse.jface.dialogs.IDialogConstants.OK_ID).setEnabled(enabled);
-}
-«ENDDEFINE»
-
-«DEFINE isValidModelFile FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-private boolean isValidModelFile(org.eclipse.core.resources.IFile file) {
- String fileExtension = file.getFullPath().getFileExtension();
- return «EXPAND compareModelFileExtension FOREACH containsShortcutsTo SEPARATOR ' || '»; «EXPAND xpt::Common::nonNLS FOR containsShortcutsTo->asSequence()»
-}
-«ENDDEFINE»
-
-«DEFINE compareModelFileExtension FOR String»"«self»".equals(fileExtension)«ENDDEFINE»
-
-«DEFINE getSelectedModelElementURI FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-public org.eclipse.emf.common.util.URI getSelectedModelElementURI() {
- return mySelectedModelElementURI;
-}
-«ENDDEFINE»
-
-«DEFINE open FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-public int open() {
- int result = super.open();
- for (java.util.Iterator it = myEditingDomain.getResourceSet().getResources().iterator(); it.hasNext();) {
- org.eclipse.emf.ecore.resource.Resource resource = (org.eclipse.emf.ecore.resource.Resource) it.next();
- resource.unload();
- }
- myEditingDomain.dispose();
- return result;
-}
-«ENDDEFINE»
-
-«DEFINE ModelElementsTreeContentProvider FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedClassComment»
-private class ModelElementsTreeContentProvider implements org.eclipse.jface.viewers.ITreeContentProvider {
-
- «EXPAND METCP_attributes-»
-
- «EXPAND METCP_getChildren-»
-
- «EXPAND METCP_getParent-»
-
- «EXPAND METCP_hasChildren-»
-
- «EXPAND METCP_getElements-»
-
- «EXPAND METCP_dispose-»
-
- «EXPAND METCP_inputChanged-»
-
- «EXPAND METCP_additions-»
-}
-«ENDDEFINE»
-
-«DEFINE METCP_attributes FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-private org.eclipse.jface.viewers.ITreeContentProvider myWorkbenchContentProvider = new «IF null = editorGen.application»org.eclipse.ui.model.WorkbenchContentProvider«ELSE»org.eclipse.ui.model.BaseWorkbenchContentProvider«ENDIF»();
-
- «EXPAND xpt::Common::generatedMemberComment»
-private org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider myAdapterFctoryContentProvier = new org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider(«editorGen.plugin.getActivatorQualifiedClassName()».getInstance().getItemProvidersAdapterFactory());
-«ENDDEFINE»
-
-«DEFINE METCP_getChildren FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-public Object[] getChildren(Object parentElement) {
- Object[] result = myWorkbenchContentProvider.getChildren(parentElement);
- if (result != null && result.length > 0) {
- return result;
- }
- if (parentElement instanceof org.eclipse.core.resources.IFile) {
- org.eclipse.core.resources.IFile modelFile = (org.eclipse.core.resources.IFile) parentElement;
- org.eclipse.core.runtime.IPath resourcePath = modelFile.getFullPath();
- org.eclipse.emf.ecore.resource.ResourceSet resourceSet = myEditingDomain.getResourceSet();
- try {
- org.eclipse.emf.ecore.resource.Resource modelResource = resourceSet.getResource(org.eclipse.emf.common.util.URI.createPlatformResourceURI(resourcePath.toString(), true), true);
- return myAdapterFctoryContentProvier.getChildren(modelResource);
- } catch (org.eclipse.emf.common.util.WrappedException e) {
- «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().logError("Unable to load resource: " + resourcePath.toString(), e); «EXPAND xpt::Common::nonNLS»
- }
- return java.util.Collections.EMPTY_LIST.toArray();
- }
- return myAdapterFctoryContentProvier.getChildren(parentElement);
-}
-«ENDDEFINE»
-
-«DEFINE METCP_getParent FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-public Object getParent(Object element) {
- Object parent = myWorkbenchContentProvider.getParent(element);
- if (parent != null) {
- return parent;
- }
- if (element instanceof org.eclipse.emf.ecore.EObject) {
- org.eclipse.emf.ecore.EObject eObject = (org.eclipse.emf.ecore.EObject) element;
- if (eObject.eContainer() == null && eObject.eResource().getURI().isFile()) {
- String path = eObject.eResource().getURI().path();
- return org.eclipse.core.resources.ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(new org.eclipse.core.runtime.Path(path));
- }
- return myAdapterFctoryContentProvier.getParent(eObject);
- }
- return null;
-}
-«ENDDEFINE»
-
-«DEFINE METCP_hasChildren FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-public boolean hasChildren(Object element) {
- if (element instanceof org.eclipse.core.resources.IFile) {
- return isValidModelFile((org.eclipse.core.resources.IFile) element);
- }
- return myWorkbenchContentProvider.hasChildren(element) || myAdapterFctoryContentProvier.hasChildren(element);
-}
-«ENDDEFINE»
-
-«DEFINE METCP_getElements FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-public Object[] getElements(Object inputElement) {
- Object[] elements = myWorkbenchContentProvider.getElements(inputElement);
- return elements;
-}
-«ENDDEFINE»
-
-«DEFINE METCP_dispose FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-public void dispose() {
- myWorkbenchContentProvider.dispose();
- myAdapterFctoryContentProvier.dispose();
-}
-«ENDDEFINE»
-
-«DEFINE METCP_inputChanged FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-public void inputChanged(org.eclipse.jface.viewers.Viewer viewer, Object oldInput, Object newInput) {
- myWorkbenchContentProvider.inputChanged(viewer, oldInput, newInput);
- myAdapterFctoryContentProvier.inputChanged(viewer, oldInput, newInput);
-}
-«ENDDEFINE»
-
-«DEFINE ModelElementsTreeLabelProvider FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedClassComment»
-private class ModelElementsTreeLabelProvider implements org.eclipse.jface.viewers.ILabelProvider {
-
- «EXPAND METLP_attributes-»
-
- «EXPAND METLP_getImage-»
-
- «EXPAND METLP_getText-»
-
- «EXPAND METLP_addListener-»
-
- «EXPAND METLP_dispose-»
-
- «EXPAND METLP_isLabelProperty-»
-
- «EXPAND METLP_removeListener-»
-
- «EXPAND METLP_additions-»
-}
-«ENDDEFINE»
-
-
-«DEFINE METLP_attributes FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
- private org.eclipse.ui.model.WorkbenchLabelProvider myWorkbenchLabelProvider = new org.eclipse.ui.model.WorkbenchLabelProvider();
-
- «EXPAND xpt::Common::generatedMemberComment»
- private org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider myAdapterFactoryLabelProvider = new org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider(«editorGen.plugin.getActivatorQualifiedClassName()».getInstance().getItemProvidersAdapterFactory());
-«ENDDEFINE»
-
-«DEFINE METLP_getImage FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-public org.eclipse.swt.graphics.Image getImage(Object element) {
- org.eclipse.swt.graphics.Image result = myWorkbenchLabelProvider.getImage(element);
- return result != null ? result : myAdapterFactoryLabelProvider.getImage(element);
-}
-«ENDDEFINE»
-
-«DEFINE METLP_getText FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-public String getText(Object element) {
- String result = myWorkbenchLabelProvider.getText(element);
- return result != null && result.length() > 0 ? result : myAdapterFactoryLabelProvider.getText(element);
-}
-«ENDDEFINE»
-
-«DEFINE METLP_addListener FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-public void addListener(org.eclipse.jface.viewers.ILabelProviderListener listener) {
- myWorkbenchLabelProvider.addListener(listener);
- myAdapterFactoryLabelProvider.addListener(listener);
-}
-«ENDDEFINE»
-
-«DEFINE METLP_dispose FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-public void dispose() {
- myWorkbenchLabelProvider.dispose();
- myAdapterFactoryLabelProvider.dispose();
-}
-«ENDDEFINE»
-
-«DEFINE METLP_isLabelProperty FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-public boolean isLabelProperty(Object element, String property) {
- return myWorkbenchLabelProvider.isLabelProperty(element, property) || myAdapterFactoryLabelProvider.isLabelProperty(element, property);
-}
-«ENDDEFINE»
-
-«DEFINE METLP_removeListener FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-public void removeListener(org.eclipse.jface.viewers.ILabelProviderListener listener) {
- myWorkbenchLabelProvider.removeListener(listener);
- myAdapterFactoryLabelProvider.removeListener(listener);
-}
-«ENDDEFINE»
-
-«DEFINE ModelFilesFilter FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedClassComment»
-private class ModelFilesFilter extends org.eclipse.jface.viewers.ViewerFilter {
-
- «EXPAND MFF_select-»
-
- «EXPAND MFF_additions-»
-}
-«ENDDEFINE»
-
-«DEFINE MFF_select FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-public boolean select(org.eclipse.jface.viewers.Viewer viewer, Object parentElement, Object element) {
- if (element instanceof org.eclipse.core.resources.IContainer) {
- return true;
- }
- if (element instanceof org.eclipse.core.resources.IFile) {
- org.eclipse.core.resources.IFile file = (org.eclipse.core.resources.IFile) element;
- return isValidModelFile(file);
- }
- return true;
-}
-«ENDDEFINE»
-
-«DEFINE OkButtonEnabler FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedClassComment»
-private class OkButtonEnabler implements org.eclipse.jface.viewers.ISelectionChangedListener {
-
- «EXPAND OBE_selectionChanged-»
-
- «EXPAND OBE_additions-»
-}
-«ENDDEFINE»
-
-«DEFINE OBE_selectionChanged FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-public void selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent event) {
- if (event.getSelection() instanceof org.eclipse.jface.viewers.IStructuredSelection) {
- org.eclipse.jface.viewers.IStructuredSelection selection = (org.eclipse.jface.viewers.IStructuredSelection) event.getSelection();
- if (selection.size() == 1) {
- Object selectedElement = selection.getFirstElement();
- if (selectedElement instanceof org.eclipse.emf.edit.provider.IWrapperItemProvider) {
- selectedElement = ((org.eclipse.emf.edit.provider.IWrapperItemProvider) selectedElement).getValue();
- }
- if (selectedElement instanceof org.eclipse.emf.ecore.util.FeatureMap.Entry) {
- selectedElement = ((org.eclipse.emf.ecore.util.FeatureMap.Entry) selectedElement).getValue();
- }
- if (selectedElement instanceof org.eclipse.emf.ecore.EObject) {
- org.eclipse.emf.ecore.EObject selectedModelElement = (org.eclipse.emf.ecore.EObject) selectedElement;
- setOkButtonEnabled(org.eclipse.gmf.runtime.diagram.core.services.ViewService.getInstance().provides(org.eclipse.gmf.runtime.notation.Node.class, new org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter(selectedModelElement), myView, null, org.eclipse.gmf.runtime.diagram.core.util.ViewUtil.APPEND, true, «EXPAND xpt::plugin::Activator::preferenceHintAccess FOR editorGen»));
- mySelectedModelElementURI = org.eclipse.emf.ecore.util.EcoreUtil.getURI(selectedModelElement);
- return;
- }
- }
- }
- mySelectedModelElementURI = null;
- setOkButtonEnabled(false);
-}
-«ENDDEFINE»
-
-«DEFINE METCP_additions FOR gmfgen::GenDiagram-»
-«ENDDEFINE»
-
-«DEFINE METLP_additions FOR gmfgen::GenDiagram-»
-«ENDDEFINE»
-
-«DEFINE MFF_additions FOR gmfgen::GenDiagram-»
-«ENDDEFINE»
-
-«DEFINE OBE_additions FOR gmfgen::GenDiagram-»
-«ENDDEFINE»
-
-«DEFINE additions FOR gmfgen::GenDiagram-»
-«ENDDEFINE»
-
-«DEFINE i18nValues FOR gmfgen::GenDiagram-»
-«EXPAND xpt::Externalizer::messageEntry(titleKey(i18nKeyForSelectModelElement(self)), 'Select model element')-»
-«ENDDEFINE»
-
-«DEFINE i18nAccessors FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Externalizer::accessorField(titleKey(i18nKeyForSelectModelElement(self)))-»
-«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/GenDiagram.qvto b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/GenDiagram.qvto
deleted file mode 100644
index 4a355e60b..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/GenDiagram.qvto
+++ /dev/null
@@ -1,27 +0,0 @@
-import org.eclipse.gmf.internal.codegen.util.GenModelUtils;
-
-modeltype genModel uses "http://www.eclipse.org/gmf/2008/GenModel";
-modeltype genModel_1 uses "http://www.eclipse.org/emf/2002/GenModel";
-modeltype ecore uses "http://www.eclipse.org/emf/2002/Ecore";
-
-library GenDiagram;
-
-helper standaloneDomainModel(genDiagram : genModel::GenDiagram) : Boolean {
- return not genDiagram.editorGen.sameFileForDiagramAndModel and genDiagram.domainDiagramElement <> null
-}
-
-helper hasDocumentRoot(genDiagram : genModel::GenDiagram) : Boolean {
- return getDocumentRoot(genDiagram) <> null
-}
-
-helper getDocumentRoot(genDiagram : genModel::GenDiagram) : genModel_1::GenClass {
- return (if genDiagram.domainDiagramElement = null then null else getDocumentRoot(genDiagram.domainDiagramElement.genPackage) endif)
-}
-
-helper getDocumentRootSetFeature(genDiagram : genModel::GenDiagram) : genModel_1::GenFeature {
- return getDocumentRoot(genDiagram).genFeatures->select(f | isDocRootSetFeature(f, genDiagram.domainDiagramElement.ecoreClass))->first()
-}
-
-helper isDocRootSetFeature(gf : genModel_1::GenFeature, eType : ecore::EClass) : Boolean {
- return not isListType(gf) and gf.ecoreFeature.changeable and (-2 = gf.ecoreFeature.upperBound.oclAsType(Integer) and (gf.ecoreFeature.eClass().name = 'EReference' and gf.ecoreFeature.eType.oclAsType(ecore::EClass).isSuperTypeOf(eType)))
-}
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/InitDiagramFileAction.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/InitDiagramFileAction.xpt
deleted file mode 100644
index 84536f72d..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/InitDiagramFileAction.xpt
+++ /dev/null
@@ -1,145 +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) - rewritten in xpand
- */
-
-«IMPORT 'http://www.eclipse.org/gmf/2008/GenModel'»
-«IMPORT 'http://www.eclipse.org/emf/2002/Ecore'»
-
-«EXTENSION xpt::editor::Utils»
-«EXTENSION xpt::StringOperations»
-
-«DEFINE InitDiagramFileAction(editorGen : gmfgen::GenEditorGenerator) FOR gmfgen::InitDiagramAction-»
-«EXPAND xpt::Common::copyright FOR editorGen-»
-«EXPAND xpt::Common::packageStatement FOR qualifiedClassName»
-
-«EXPAND xpt::Common::generatedClassComment»
-public class «qualifiedClassName.xpandSplit('\\.')->last()»
- «IF editorGen.application = null-»
-implements org.eclipse.ui.IObjectActionDelegate {
-
- «EXPAND xpt::Common::generatedMemberComment»
- private org.eclipse.ui.IWorkbenchPart targetPart;
-
- «EXPAND xpt::Common::generatedMemberComment»
- private org.eclipse.emf.common.util.URI domainModelURI;
-
- «EXPAND xpt::Common::generatedMemberComment»
- public void setActivePart(org.eclipse.jface.action.IAction action, org.eclipse.ui.IWorkbenchPart targetPart) {
- this.targetPart = targetPart;
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- public void selectionChanged(org.eclipse.jface.action.IAction action, org.eclipse.jface.viewers.ISelection selection) {
- domainModelURI = null;
- action.setEnabled(false);
- if (selection instanceof org.eclipse.jface.viewers.IStructuredSelection == false || selection.isEmpty()) {
- return;
- }
- org.eclipse.core.resources.IFile file =
- (org.eclipse.core.resources.IFile) ((org.eclipse.jface.viewers.IStructuredSelection) selection).getFirstElement();
- domainModelURI = org.eclipse.emf.common.util.URI.createPlatformResourceURI(file.getFullPath().toString(), true);
- action.setEnabled(true);
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- private org.eclipse.swt.widgets.Shell getShell() {
- return targetPart.getSite().getShell();
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- public void run(org.eclipse.jface.action.IAction action) {
- org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain =
- org.eclipse.gmf.runtime.emf.core.GMFEditingDomainFactory.INSTANCE.createEditingDomain();
- «IF editorGen.sameFileForDiagramAndModel-»
- org.eclipse.emf.ecore.resource.ResourceSet resourceSet = new org.eclipse.emf.ecore.resource.impl.ResourceSetImpl();
- «ELSE-»
- org.eclipse.emf.ecore.resource.ResourceSet resourceSet = editingDomain.getResourceSet();
- «ENDIF-»
- org.eclipse.emf.ecore.EObject diagramRoot = null;
- try {
- org.eclipse.emf.ecore.resource.Resource resource = resourceSet.getResource(domainModelURI, true);
- diagramRoot = (org.eclipse.emf.ecore.EObject) resource.getContents().get(0);
- } catch (org.eclipse.emf.common.util.WrappedException ex) {
- «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().logError(
- "Unable to load resource: " + domainModelURI, ex);«EXPAND xpt::Common::nonNLS»
- }
- if (diagramRoot == null) {
- org.eclipse.jface.dialogs.MessageDialog.openError(getShell(),
- «EXPAND xpt::Externalizer::accessorCall(titleKey(i18nKeyForInitDiagramFileResourceErrorDialog())) FOR editorGen»,
- «EXPAND xpt::Externalizer::accessorCall(messageKey(i18nKeyForInitDiagramFileResourceErrorDialog())) FOR editorGen»);
- return;
- }
- org.eclipse.jface.wizard.Wizard wizard = new «editorGen.diagram.getNewDiagramFileWizardQualifiedClassName()»(domainModelURI, diagramRoot, editingDomain);
- wizard.setWindowTitle(org.eclipse.osgi.util.NLS.bind(
- «EXPAND xpt::Externalizer::accessorCall(i18nKeyForInitDiagramFileWizardTitle()) FOR editorGen»,
- «EXPAND xpt::editor::VisualIDRegistry::modelID FOR editorGen.diagram»));
- «editorGen.diagram.getDiagramEditorUtilQualifiedClassName()».runWizard(getShell(), wizard, "InitDiagramFile");«EXPAND xpt::Common::nonNLS»
- }
- «ELSE-»
-implements org.eclipse.ui.IWorkbenchWindowActionDelegate {
-
- «EXPAND xpt::Common::generatedMemberComment»
- private org.eclipse.ui.IWorkbenchWindow window;
-
- «EXPAND xpt::Common::generatedMemberComment»
- public void init(org.eclipse.ui.IWorkbenchWindow window) {
- this.window = window;
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- public void dispose() {
- window = null;
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- public void selectionChanged(org.eclipse.jface.action.IAction action, org.eclipse.jface.viewers.ISelection selection) {
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- private org.eclipse.swt.widgets.Shell getShell() {
- return window.getShell();
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- public void run(org.eclipse.jface.action.IAction action) {
- org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain =
- org.eclipse.gmf.runtime.emf.core.GMFEditingDomainFactory.INSTANCE.createEditingDomain();
- org.eclipse.emf.ecore.resource.Resource resource =
- «editorGen.diagram.getDiagramEditorUtilQualifiedClassName()».openModel(getShell(),
- «EXPAND xpt::Externalizer::accessorCall(i18nKeyForInitDiagramOpenFileDialogTitle()) FOR editorGen», editingDomain);
- if (resource == null || resource.getContents().isEmpty()) {
- return;
- }
- org.eclipse.emf.ecore.EObject diagramRoot = (org.eclipse.emf.ecore.EObject) resource.getContents().get(0);
- org.eclipse.jface.wizard.Wizard wizard = new «editorGen.diagram.getNewDiagramFileWizardQualifiedClassName()»(resource.getURI(), diagramRoot, editingDomain);
- wizard.setWindowTitle(org.eclipse.osgi.util.NLS.bind(
- «EXPAND xpt::Externalizer::accessorCall(i18nKeyForInitDiagramFileWizardTitle()) FOR editorGen»,
- «EXPAND xpt::editor::VisualIDRegistry::modelID FOR editorGen.diagram»));
- «editorGen.diagram.getDiagramEditorUtilQualifiedClassName()».runWizard(getShell(), wizard, "InitDiagramFile");«EXPAND xpt::Common::nonNLS»
- }
- «ENDIF-»
-}
-«ENDDEFINE»
-
-«DEFINE i18nAccessors FOR gmfgen::GenDiagram-»
-«EXPAND xpt::Externalizer::accessorField(titleKey(i18nKeyForInitDiagramFileResourceErrorDialog()))-»
-«EXPAND xpt::Externalizer::accessorField(messageKey(i18nKeyForInitDiagramFileResourceErrorDialog()))-»
-«EXPAND xpt::Externalizer::accessorField(i18nKeyForInitDiagramFileWizardTitle())-»
-«EXPAND xpt::Externalizer::accessorField(i18nKeyForInitDiagramOpenFileDialogTitle())-»
-«ENDDEFINE»
-
-«DEFINE i18nValues FOR gmfgen::GenDiagram-»
-«EXPAND xpt::Externalizer::messageEntry(titleKey(i18nKeyForInitDiagramFileResourceErrorDialog()), 'Error')-»
-«EXPAND xpt::Externalizer::messageEntry(messageKey(i18nKeyForInitDiagramFileResourceErrorDialog()), 'Model file loading failed')-»
-«EXPAND xpt::Externalizer::messageEntry(i18nKeyForInitDiagramFileWizardTitle(), 'Initialize new {0} diagram file')-»
-«EXPAND xpt::Externalizer::messageEntry(i18nKeyForInitDiagramOpenFileDialogTitle(), 'Select domain model')-»
-«ENDDEFINE»
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/MatchingStrategy.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/MatchingStrategy.xpt
deleted file mode 100644
index 6e7a81455..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/MatchingStrategy.xpt
+++ /dev/null
@@ -1,49 +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 MatchingStrategy FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::copyright FOR editorGen-»
-package «editorGen.editor.packageName»;
-
- «EXPAND xpt::Common::generatedClassComment»
-public class «matchingStrategyClassName» implements org.eclipse.ui.IEditorMatchingStrategy {
-
- «EXPAND matches-»
-
-}
-«ENDDEFINE»
-
-«DEFINE matches FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-public boolean matches(org.eclipse.ui.IEditorReference editorRef, org.eclipse.ui.IEditorInput input) {
- org.eclipse.ui.IEditorInput editorInput;
- try {
- editorInput = editorRef.getEditorInput();
- } catch (org.eclipse.ui.PartInitException e) {
- return false;
- }
-
- if (editorInput.equals(input)) {
- return true;
- }
-«REM»
- Should be removed then https://bugs.eclipse.org/bugs/show_bug.cgi?id=175260 commited.
- Problem is: URIEditorInput has no .equals() overriden
-«ENDREM-»
- if (editorInput instanceof org.eclipse.emf.common.ui.URIEditorInput && input instanceof org.eclipse.emf.common.ui.URIEditorInput) {
- return ((org.eclipse.emf.common.ui.URIEditorInput) editorInput).getURI().equals(((org.eclipse.emf.common.ui.URIEditorInput) input).getURI());
- }
- return false;
-}
-«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/ModelElementSelectionPage.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/ModelElementSelectionPage.xpt
deleted file mode 100644
index 397b50fa8..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/ModelElementSelectionPage.xpt
+++ /dev/null
@@ -1,167 +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::editor::GenDiagram»
-«EXTENSION xpt::editor::Utils»
-
-«DEFINE className FOR gmfgen::GenDiagram»«defaultModelElementSelectionPageClassName(self)»«ENDDEFINE»
-
-«DEFINE qualifiedClassName FOR gmfgen::GenDiagram»«editorGen.editor.packageName».«EXPAND className»«ENDDEFINE»
-
-«DEFINE ModelElementSelectionPage FOR gmfgen::GenDiagram-»
-«EXPAND xpt::Common::copyright FOR editorGen-»
-package «editorGen.editor.packageName»;
-
-«EXPAND xpt::Common::generatedClassComment('Wizard page that allows to select element from model.')»
-public class «EXPAND className» extends org.eclipse.jface.wizard.WizardPage {
- «EXPAND attributes-»
-
- «EXPAND ctor-»
-
- «EXPAND getModelElement-»
-
- «EXPAND setModelElement-»
-
- «EXPAND createControl-»
-
- «EXPAND getSelectionTitle-»
-
- «EXPAND updateSelection-»
-
- «EXPAND validatePage-»
-
- «EXPAND additions-»
-}
-«ENDDEFINE»
-
-«DEFINE attributes FOR gmfgen::GenDiagram-»
-«EXPAND xpt::Common::generatedMemberComment»
-protected org.eclipse.emf.ecore.EObject selectedModelElement;
-
-«EXPAND xpt::Common::generatedMemberComment»
-private org.eclipse.jface.viewers.TreeViewer modelViewer;
-«ENDDEFINE»
-
-«DEFINE ctor FOR gmfgen::GenDiagram-»
-«EXPAND xpt::Common::generatedMemberComment»
-public «EXPAND className»(String pageName) {
- super(pageName);
-}
-«ENDDEFINE»
-
-«DEFINE getModelElement FOR gmfgen::GenDiagram-»
-«EXPAND xpt::Common::generatedMemberComment»
-public org.eclipse.emf.ecore.EObject getModelElement() {
- return selectedModelElement;
-}
-«ENDDEFINE»
-
-«DEFINE setModelElement FOR gmfgen::GenDiagram-»
-«EXPAND xpt::Common::generatedMemberComment»
-public void setModelElement(org.eclipse.emf.ecore.EObject modelElement) {
- selectedModelElement = modelElement;
- if (modelViewer != null) {
- if (selectedModelElement != null) {
- modelViewer.setInput(selectedModelElement.eResource());
- modelViewer.setSelection(new org.eclipse.jface.viewers.StructuredSelection(selectedModelElement));
- } else {
- modelViewer.setInput(null);
- }
- setPageComplete(validatePage());
- }
-}
-«ENDDEFINE»
-
-«DEFINE createControl FOR gmfgen::GenDiagram-»
-«EXPAND xpt::Common::generatedMemberComment»
-public void createControl(org.eclipse.swt.widgets.Composite parent) {
- initializeDialogUnits(parent);
-
- org.eclipse.swt.widgets.Composite plate = new org.eclipse.swt.widgets.Composite(parent, org.eclipse.swt.SWT.NONE);
- plate.setLayoutData(new org.eclipse.swt.layout.GridData(org.eclipse.swt.layout.GridData.FILL_BOTH));
- org.eclipse.swt.layout.GridLayout layout = new org.eclipse.swt.layout.GridLayout();
- layout.marginWidth = 0;
- plate.setLayout(layout);
- setControl(plate);
-
- org.eclipse.swt.widgets.Label label = new org.eclipse.swt.widgets.Label(plate, org.eclipse.swt.SWT.NONE);
- label.setText(getSelectionTitle());
- label.setLayoutData(new org.eclipse.swt.layout.GridData(org.eclipse.swt.layout.GridData.HORIZONTAL_ALIGN_BEGINNING));
-
- modelViewer = new org.eclipse.jface.viewers.TreeViewer(
- plate, org.eclipse.swt.SWT.SINGLE | org.eclipse.swt.SWT.H_SCROLL | org.eclipse.swt.SWT.V_SCROLL | org.eclipse.swt.SWT.BORDER);
- org.eclipse.swt.layout.GridData layoutData = new org.eclipse.swt.layout.GridData(org.eclipse.swt.layout.GridData.FILL_BOTH);
- layoutData.heightHint = 300;
- layoutData.widthHint = 300;
- modelViewer.getTree().setLayoutData(layoutData);
- modelViewer.setContentProvider(new org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider(
- «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().getItemProvidersAdapterFactory()));
- modelViewer.setLabelProvider(new org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider(
- «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().getItemProvidersAdapterFactory()));
- if (selectedModelElement != null) {
- modelViewer.setInput(selectedModelElement.eResource());
- modelViewer.setSelection(new org.eclipse.jface.viewers.StructuredSelection(selectedModelElement));
- }
- modelViewer.addSelectionChangedListener(new org.eclipse.jface.viewers.ISelectionChangedListener() {
- public void selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent event) {
- «EXPAND className».this.updateSelection((org.eclipse.jface.viewers.IStructuredSelection) event.getSelection());
- }
- });
-
- setPageComplete(validatePage());
-}
-«ENDDEFINE»
-
-«DEFINE getSelectionTitle FOR gmfgen::GenDiagram-»
-«EXPAND xpt::Common::generatedMemberComment('Override to provide custom model element description.')»
-protected String getSelectionTitle() {
- return «EXPAND xpt::Externalizer::accessorCall(messageKey(i18nKeyForModelElementSelectionPage(self))) FOR editorGen»;
-}
-«ENDDEFINE»
-
-«DEFINE updateSelection FOR gmfgen::GenDiagram-»
-«EXPAND xpt::Common::generatedMemberComment»
-protected void updateSelection(org.eclipse.jface.viewers.IStructuredSelection selection) {
- selectedModelElement = null;
- if (selection.size() == 1) {
- Object selectedElement = selection.getFirstElement();
- if (selectedElement instanceof org.eclipse.emf.edit.provider.IWrapperItemProvider) {
- selectedElement = ((org.eclipse.emf.edit.provider.IWrapperItemProvider) selectedElement).getValue();
- }
- if (selectedElement instanceof org.eclipse.emf.ecore.util.FeatureMap.Entry) {
- selectedElement = ((org.eclipse.emf.ecore.util.FeatureMap.Entry) selectedElement).getValue();
- }
- if (selectedElement instanceof org.eclipse.emf.ecore.EObject) {
- selectedModelElement = (org.eclipse.emf.ecore.EObject) selectedElement;
- }
- }
- setPageComplete(validatePage());
-}
-«ENDDEFINE»
-
-«DEFINE validatePage FOR gmfgen::GenDiagram-»
-«EXPAND xpt::Common::generatedMemberComment('Override to provide specific validation of the selected model element.')»
-protected boolean validatePage() {
- return true;
-}
-«ENDDEFINE»
-
-«DEFINE additions FOR gmfgen::GenDiagram»«ENDDEFINE»
-
-«DEFINE i18nValues FOR gmfgen::GenDiagram-»
-«EXPAND xpt::Externalizer::messageEntry(messageKey(i18nKeyForModelElementSelectionPage(self)), 'Select model element:')-»
-«ENDDEFINE»
-
-«DEFINE i18nAccessors FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Externalizer::accessorField(messageKey(i18nKeyForModelElementSelectionPage(self)))-»
-«ENDDEFINE»
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/NewDiagramFileWizard.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/NewDiagramFileWizard.xpt
deleted file mode 100644
index e71bd7fdb..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/NewDiagramFileWizard.xpt
+++ /dev/null
@@ -1,200 +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) - rewritten in xpand
- */
-
-«IMPORT 'http://www.eclipse.org/gmf/2008/GenModel'»
-«IMPORT 'http://www.eclipse.org/emf/2002/Ecore'»
-
-«EXTENSION xpt::editor::Utils»
-
-«DEFINE className FOR gmfgen::GenDiagram»«newDiagramFileWizardClassName»«ENDDEFINE»
-
-«DEFINE qualifiedClassName FOR gmfgen::GenDiagram»«editorGen.editor.packageName».«EXPAND className»«ENDDEFINE»
-
-«DEFINE NewDiagramFileWizard FOR gmfgen::GenDiagram-»
-«EXPAND xpt::Common::copyright FOR editorGen-»
-package «editorGen.editor.packageName»;
-
-«EXPAND xpt::Common::generatedClassComment»
-public class «EXPAND className» extends org.eclipse.jface.wizard.Wizard {
-
- «EXPAND xpt::Common::generatedMemberComment»
- private «EXPAND creationPage» myFileCreationPage;
-
- «EXPAND xpt::Common::generatedMemberComment»
- private «EXPAND xpt::editor::ModelElementSelectionPage::qualifiedClassName» diagramRootElementSelectionPage;
-
- «EXPAND xpt::Common::generatedMemberComment»
- private org.eclipse.emf.transaction.TransactionalEditingDomain myEditingDomain;
-
- «EXPAND xpt::Common::generatedMemberComment»
- public «EXPAND className»(org.eclipse.emf.common.util.URI domainModelURI,
- org.eclipse.emf.ecore.EObject diagramRoot,
- org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain) {
- «EXPAND xpt::Common::_assert('domainModelURI != null : \"Domain model uri must be specified\"')-»
- «EXPAND xpt::Common::_assert('diagramRoot != null : \"Doagram root element must be specified\"')-»
- «EXPAND xpt::Common::_assert('editingDomain != null : \"Editing domain must be specified\"')-»
-
- myFileCreationPage = new «EXPAND creationPage»(«EXPAND xpt::Externalizer::accessorCall(nameKey(i18nKeyForNewDiagramFileWizardCreationPage(self))) FOR editorGen», org.eclipse.jface.viewers.StructuredSelection.EMPTY);
- myFileCreationPage.setTitle(«EXPAND xpt::Externalizer::accessorCall(titleKey(i18nKeyForNewDiagramFileWizardCreationPage(self))) FOR editorGen»);
- myFileCreationPage.setDescription(org.eclipse.osgi.util.NLS.bind(
- «EXPAND xpt::Externalizer::accessorCall(descriptionKey(i18nKeyForNewDiagramFileWizardCreationPage(self))) FOR editorGen»,
- «EXPAND xpt::editor::VisualIDRegistry::modelID»));
- org.eclipse.core.runtime.IPath filePath;
- String fileName = org.eclipse.emf.common.util.URI.decode(domainModelURI.trimFileExtension().lastSegment());
- if (domainModelURI.isPlatformResource()) {
- filePath = new org.eclipse.core.runtime.Path(domainModelURI.trimSegments(1).toPlatformString(true));
- } else if (domainModelURI.isFile()) {
- filePath = new org.eclipse.core.runtime.Path(domainModelURI.trimSegments(1).toFileString());
- } else {
- // TODO : use some default path
- throw new IllegalArgumentException("Unsupported URI: " + domainModelURI); «EXPAND xpt::Common::nonNLS»
- }
- myFileCreationPage.setContainerFullPath(filePath);
- myFileCreationPage.setFileName(«getDiagramEditorUtilQualifiedClassName()».getUniqueFileName(
- filePath, fileName, "«editorGen.diagramFileExtension»")); «EXPAND xpt::Common::nonNLS»
-
- diagramRootElementSelectionPage = new DiagramRootElementSelectionPage(«EXPAND xpt::Externalizer::accessorCall(nameKey(i18nKeyForNewDiagramFileWizardRootSelectionPage(self))) FOR editorGen»);
- diagramRootElementSelectionPage.setTitle(«EXPAND xpt::Externalizer::accessorCall(titleKey(i18nKeyForNewDiagramFileWizardRootSelectionPage(self))) FOR editorGen»);
- diagramRootElementSelectionPage.setDescription(«EXPAND xpt::Externalizer::accessorCall(descriptionKey(i18nKeyForNewDiagramFileWizardRootSelectionPage(self))) FOR editorGen»);
- diagramRootElementSelectionPage.setModelElement(diagramRoot);
-
- myEditingDomain = editingDomain;
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- public void addPages() {
- addPage(myFileCreationPage);
- addPage(diagramRootElementSelectionPage);
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- public boolean performFinish() {
- java.util.List affectedFiles = new java.util.LinkedList();
- «IF null = editorGen.application-»
- org.eclipse.core.resources.IFile diagramFile = myFileCreationPage.createNewFile();
- «EXPAND xpt::Common::setCharset('diagramFile')-»
- affectedFiles.add(diagramFile);
- org.eclipse.emf.common.util.URI diagramModelURI = org.eclipse.emf.common.util.URI.createPlatformResourceURI(diagramFile.getFullPath().toString(), true);
- «ELSE-»
- org.eclipse.core.runtime.IPath diagramModelPath = myFileCreationPage.getContainerFullPath().append(myFileCreationPage.getFileName());
- org.eclipse.emf.common.util.URI diagramModelURI = org.eclipse.emf.common.util.URI.createFileURI(diagramModelPath.toString());
- «ENDIF-»
- org.eclipse.emf.ecore.resource.ResourceSet resourceSet = myEditingDomain.getResourceSet();
- final org.eclipse.emf.ecore.resource.Resource diagramResource = resourceSet.createResource(diagramModelURI);
- org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand command =
- new org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand(
- myEditingDomain, «EXPAND xpt::Externalizer::accessorCall(i18nKeyForNewDiagramFileWizardInitDiagramCommand(self)) FOR editorGen», affectedFiles) {
-
- 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 {
- int diagramVID = «EXPAND xpt::editor::VisualIDRegistry::getDiagramVisualIDMethodCall»(diagramRootElementSelectionPage.getModelElement());
- if (diagramVID != «EXPAND xpt::editor::VisualIDRegistry::visualID») {
- return org.eclipse.gmf.runtime.common.core.command.CommandResult.newErrorCommandResult(
- «EXPAND xpt::Externalizer::accessorCall(i18nKeyForNewDiagramFileWizardIncorrectRootError(self)) FOR editorGen»);
- }
- org.eclipse.gmf.runtime.notation.Diagram diagram =
- org.eclipse.gmf.runtime.diagram.core.services.ViewService.createDiagram(
- diagramRootElementSelectionPage.getModelElement(), «EXPAND xpt::editor::VisualIDRegistry::modelID»,
- «EXPAND xpt::plugin::Activator::preferenceHintAccess FOR editorGen»);
- diagramResource.getContents().add(diagram);
- «IF editorGen.sameFileForDiagramAndModel-»
- diagramResource.getContents().add(diagram.getElement());
- «ENDIF-»
- «IF not synchronized-»
- new «getDiagramContentInitializerQualifiedClassName()»().initDiagramContent(diagram);
- «ENDIF-»
- return org.eclipse.gmf.runtime.common.core.command.CommandResult.newOKCommandResult();
- }
- };
- try {
- org.eclipse.core.commands.operations.OperationHistoryFactory.getOperationHistory().execute(
- command, new org.eclipse.core.runtime.NullProgressMonitor(), null);
- diagramResource.save(«EXPAND xpt::Common::getSaveOptions»);
- «getDiagramEditorUtilQualifiedClassName()».openDiagram(diagramResource);
- } catch (org.eclipse.core.commands.ExecutionException e) {
- «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().logError(
- "Unable to create model and diagram", e); «EXPAND xpt::Common::nonNLS»
- } catch (java.io.IOException ex) {
- «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().logError(
- "Save operation failed for: " + diagramModelURI, ex); «EXPAND xpt::Common::nonNLS»
- } catch (org.eclipse.ui.PartInitException ex) {
- «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().logError(
- "Unable to open editor", ex); «EXPAND xpt::Common::nonNLS»
- }
- return true;
- }
-
- «EXPAND xpt::Common::generatedClassComment»
- private static class DiagramRootElementSelectionPage extends «EXPAND xpt::editor::ModelElementSelectionPage::qualifiedClassName» {
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected DiagramRootElementSelectionPage(String pageName) {
- super(pageName);
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected String getSelectionTitle() {
- return «EXPAND xpt::Externalizer::accessorCall(i18nKeyForNewDiagramFileWizardRootSelectionPageSelectionTitle(self)) FOR editorGen»;
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected boolean validatePage() {
- if (selectedModelElement == null) {
- setErrorMessage(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForNewDiagramFileWizardRootSelectionPageNoSelectionMessage(self)) FOR editorGen»);
- return false;
- }
- boolean result = org.eclipse.gmf.runtime.diagram.core.services.ViewService.getInstance().provides(
- new org.eclipse.gmf.runtime.diagram.core.services.view.CreateDiagramViewOperation(
- new org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter(selectedModelElement),
- «EXPAND xpt::editor::VisualIDRegistry::modelID», «EXPAND xpt::plugin::Activator::preferenceHintAccess FOR editorGen»));
- setErrorMessage(result ? null : «EXPAND xpt::Externalizer::accessorCall(i18nKeyForNewDiagramFileWizardRootSelectionPageInvalidSelectionMessage(self)) FOR editorGen»);
- return result;
- }
- }
-}
-«ENDDEFINE»
-
-«DEFINE creationPage FOR gmfgen::GenDiagram»
-«IF null = editorGen.application-»
-org.eclipse.ui.dialogs.WizardNewFileCreationPage«ELSE-»
-«editorGen.application.packageName».WizardNewFileCreationPage«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE i18nAccessors FOR gmfgen::GenDiagram-»
-«EXPAND xpt::Externalizer::accessorField(nameKey(i18nKeyForNewDiagramFileWizardCreationPage(self)))-»
-«EXPAND xpt::Externalizer::accessorField(titleKey(i18nKeyForNewDiagramFileWizardCreationPage(self)))-»
-«EXPAND xpt::Externalizer::accessorField(descriptionKey(i18nKeyForNewDiagramFileWizardCreationPage(self)))-»
-«EXPAND xpt::Externalizer::accessorField(nameKey(i18nKeyForNewDiagramFileWizardRootSelectionPage(self)))-»
-«EXPAND xpt::Externalizer::accessorField(titleKey(i18nKeyForNewDiagramFileWizardRootSelectionPage(self)))-»
-«EXPAND xpt::Externalizer::accessorField(descriptionKey(i18nKeyForNewDiagramFileWizardRootSelectionPage(self)))-»
-«EXPAND xpt::Externalizer::accessorField(i18nKeyForNewDiagramFileWizardRootSelectionPageSelectionTitle(self))-»
-«EXPAND xpt::Externalizer::accessorField(i18nKeyForNewDiagramFileWizardRootSelectionPageNoSelectionMessage(self))-»
-«EXPAND xpt::Externalizer::accessorField(i18nKeyForNewDiagramFileWizardRootSelectionPageInvalidSelectionMessage(self))-»
-«EXPAND xpt::Externalizer::accessorField(i18nKeyForNewDiagramFileWizardInitDiagramCommand(self))-»
-«EXPAND xpt::Externalizer::accessorField(i18nKeyForNewDiagramFileWizardIncorrectRootError(self))-»
-«ENDDEFINE»
-
-«DEFINE i18nValues FOR gmfgen::GenDiagram-»
-«EXPAND xpt::Externalizer::messageEntry(nameKey(i18nKeyForNewDiagramFileWizardCreationPage(self)), 'Initialize new diagram file')-»
-«EXPAND xpt::Externalizer::messageEntry(titleKey(i18nKeyForNewDiagramFileWizardCreationPage(self)), 'Diagram file')-»
-«EXPAND xpt::Externalizer::messageEntry(descriptionKey(i18nKeyForNewDiagramFileWizardCreationPage(self)), 'Create new diagram based on {0} model content')-»
-«EXPAND xpt::Externalizer::messageEntry(nameKey(i18nKeyForNewDiagramFileWizardRootSelectionPage(self)), 'Select diagram root element')-»
-«EXPAND xpt::Externalizer::messageEntry(titleKey(i18nKeyForNewDiagramFileWizardRootSelectionPage(self)), 'Diagram root element')-»
-«EXPAND xpt::Externalizer::messageEntry(descriptionKey(i18nKeyForNewDiagramFileWizardRootSelectionPage(self)), 'Select semantic model element to be depicted on diagram')-»"Select diagram root element:"
-«EXPAND xpt::Externalizer::messageEntry(i18nKeyForNewDiagramFileWizardRootSelectionPageSelectionTitle(self), 'Select diagram root element:')-»
-«EXPAND xpt::Externalizer::messageEntry(i18nKeyForNewDiagramFileWizardRootSelectionPageNoSelectionMessage(self), 'Diagram root element is not selected')-»
-«EXPAND xpt::Externalizer::messageEntry(i18nKeyForNewDiagramFileWizardRootSelectionPageInvalidSelectionMessage(self), 'Invalid diagram root element is selected')-»
-«EXPAND xpt::Externalizer::messageEntry(i18nKeyForNewDiagramFileWizardInitDiagramCommand(self), 'Initializing diagram contents')-»
-«EXPAND xpt::Externalizer::messageEntry(i18nKeyForNewDiagramFileWizardIncorrectRootError(self), 'Incorrect model object stored as a root resource object')-»
-«ENDDEFINE»
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/ResourceSetInfo.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/ResourceSetInfo.xpt
deleted file mode 100644
index c5bb5b25d..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/ResourceSetInfo.xpt
+++ /dev/null
@@ -1,331 +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'»
-
-«REM»Inner class of DocumentProvider«ENDREM»
-«DEFINE ResourceSetInfo FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedClassComment»
-protected class ResourceSetInfo extends ElementInfo {
-
- «EXPAND attributes-»
-
- «EXPAND _constructor-»
-
- «EXPAND getModificationStamp-»
-
- «EXPAND setModificationStamp-»
-
- «EXPAND getEditingDomain-»
-
- «EXPAND getResourceSet-»
-
- «EXPAND getLoadedResourcesIterator-»
-
- «EXPAND getEditorInput-»
-
- «EXPAND dispose-»
-
- «EXPAND isSynchronized-»
-
- «IF null = editorGen.application-»
- «EXPAND setUnSynchronized-»
-
- «EXPAND setSynchronized-»
-
- «EXPAND stopResourceListening-»
-
- «EXPAND startResourceListening-»
-
- «ENDIF-»
- «EXPAND isUpdateCache-»
-
- «EXPAND setUpdateCache-»
-
- «EXPAND isModifiable-»
-
- «EXPAND setModifiable-»
-
- «EXPAND isReadOnly-»
-
- «EXPAND setReadOnly-»
-
- «IF null = editorGen.application-»
- «EXPAND SynchronizerDelegate-»
-
- «ENDIF-»
- «EXPAND additions-»
-}
-«ENDDEFINE»
-
-«DEFINE attributes FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
- private long myModificationStamp = «IF null = editorGen.application»org.eclipse.core.resources.IResource.NULL_STAMP«ELSE»0«ENDIF»;
-
- «IF null = editorGen.application-»
- «EXPAND xpt::Common::generatedMemberComment»
- private org.eclipse.emf.workspace.util.WorkspaceSynchronizer mySynchronizer;
-
- «EXPAND xpt::Common::generatedMemberComment»
- private java.util.Collection myUnSynchronizedResources = new java.util.ArrayList();
-
- «ENDIF-»
- «EXPAND xpt::Common::generatedMemberComment»
- private org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocument myDocument;
-
- «EXPAND xpt::Common::generatedMemberComment»
- private org.eclipse.ui.IEditorInput myEditorInput;
-
- «EXPAND xpt::Common::generatedMemberComment»
- private boolean myUpdateCache = true;
-
- «EXPAND xpt::Common::generatedMemberComment»
- private boolean myModifiable = false;
-
- «EXPAND xpt::Common::generatedMemberComment»
- private boolean myReadOnly = true;
-
- «EXPAND xpt::Common::generatedMemberComment»
- private ResourceSetModificationListener myResourceSetListener;
-«ENDDEFINE»
-
-«DEFINE _constructor FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-public ResourceSetInfo(org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocument document, org.eclipse.ui.IEditorInput editorInput) {
- super(document);
- myDocument = document;
- myEditorInput = editorInput;
- «IF null = editorGen.application-»
- startResourceListening();
- «ENDIF-»
- myResourceSetListener = new ResourceSetModificationListener(this);
- getResourceSet().eAdapters().add(myResourceSetListener);
-}
-«ENDDEFINE»
-
-«DEFINE getModificationStamp FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-public long getModificationStamp() {
- return myModificationStamp;
-}
-«ENDDEFINE»
-
-«DEFINE setModificationStamp FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-public void setModificationStamp(long modificationStamp) {
- myModificationStamp = modificationStamp;
-}
-«ENDDEFINE»
-
-«DEFINE getEditingDomain FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-public org.eclipse.emf.transaction.TransactionalEditingDomain getEditingDomain() {
- return myDocument.getEditingDomain();
-}
-«ENDDEFINE»
-
-«DEFINE getResourceSet FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-public org.eclipse.emf.ecore.resource.ResourceSet getResourceSet() {
- return getEditingDomain().getResourceSet();
-}
-«ENDDEFINE»
-
-«DEFINE getLoadedResourcesIterator FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-public java.util.Iterator/*<org.eclipse.emf.ecore.resource.Resource>*/ getLoadedResourcesIterator() {
- return new java.util.ArrayList/*<org.eclipse.emf.ecore.resource.Resource>*/(getResourceSet().getResources()).iterator();
-}
-«ENDDEFINE»
-
-«DEFINE getEditorInput FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-public org.eclipse.ui.IEditorInput getEditorInput() {
- return myEditorInput;
-}
-«ENDDEFINE»
-
-«DEFINE dispose FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-public void dispose() {
- «IF null = editorGen.application-»
- stopResourceListening();
- «ENDIF-»
- getResourceSet().eAdapters().remove(myResourceSetListener);
- for (java.util.Iterator/*<org.eclipse.emf.ecore.resource.Resource>*/ it = getLoadedResourcesIterator(); it.hasNext();) {
- org.eclipse.emf.ecore.resource.Resource resource = (org.eclipse.emf.ecore.resource.Resource) it.next();
- resource.unload();
- }
-}
-«ENDDEFINE»
-
-«DEFINE isSynchronized FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-public boolean isSynchronized() {
- «IF null = editorGen.application-»
- return myUnSynchronizedResources.size() == 0;
- «ELSE-»
- return getModificationStamp() == computeModificationStamp(this);
- «ENDIF-»
-}
-«ENDDEFINE»
-
-«DEFINE setUnSynchronized FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-public void setUnSynchronized(org.eclipse.emf.ecore.resource.Resource resource) {
- myUnSynchronizedResources.add(resource);
-}
-«ENDDEFINE»
-
-«DEFINE setSynchronized FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-public void setSynchronized(org.eclipse.emf.ecore.resource.Resource resource) {
- myUnSynchronizedResources.remove(resource);
-}
-«ENDDEFINE»
-
-«DEFINE stopResourceListening FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-public final void stopResourceListening() {
- mySynchronizer.dispose();
- mySynchronizer = null;
-}
-«ENDDEFINE»
-
-«DEFINE startResourceListening FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-public final void startResourceListening() {
- mySynchronizer = new org.eclipse.emf.workspace.util.WorkspaceSynchronizer(getEditingDomain(), new SynchronizerDelegate());
-}
-«ENDDEFINE»
-
-«DEFINE isUpdateCache FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-public boolean isUpdateCache() {
- return myUpdateCache;
-}
-«ENDDEFINE»
-
-«DEFINE setUpdateCache FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-public void setUpdateCache(boolean update) {
- myUpdateCache = update;
-}
-«ENDDEFINE»
-
-«DEFINE isModifiable FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-public boolean isModifiable() {
- return myModifiable;
-}
-«ENDDEFINE»
-
-«DEFINE setModifiable FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-public void setModifiable(boolean modifiable) {
- myModifiable = modifiable;
-}
-«ENDDEFINE»
-
-«DEFINE isReadOnly FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-public boolean isReadOnly() {
- return myReadOnly;
-}
-«ENDDEFINE»
-
-«DEFINE setReadOnly FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-public void setReadOnly(boolean readOnly) {
- myReadOnly = readOnly;
-}
-«ENDDEFINE»
-
-«DEFINE SynchronizerDelegate FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedClassComment»
-private class SynchronizerDelegate implements org.eclipse.emf.workspace.util.WorkspaceSynchronizer.Delegate {
-
- «EXPAND disposeSD-»
-
- «EXPAND handleResourceChangedSD-»
-
- «EXPAND handleResourceDeletedSD-»
-
- «EXPAND handleResourceMovedSD-»
-
- «EXPAND additionsSD-»
-}
-«ENDDEFINE»
-
-«DEFINE disposeSD FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-public void dispose() {
-}
-«ENDDEFINE»
-
-«DEFINE handleResourceChangedSD FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-public boolean handleResourceChanged(final org.eclipse.emf.ecore.resource.Resource resource) {
- «EXPAND updateSynchStateSD-»
- org.eclipse.swt.widgets.Display.getDefault().asyncExec(new java.lang.Runnable() {
- public void run() {
- handleElementChanged(ResourceSetInfo.this, resource, null);
- }
- });
- return true;
-}
-«ENDDEFINE»
-
-«DEFINE handleResourceDeletedSD FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-public boolean handleResourceDeleted(org.eclipse.emf.ecore.resource.Resource resource) {
- «EXPAND updateSynchStateSD-»
- org.eclipse.swt.widgets.Display.getDefault().asyncExec(new java.lang.Runnable() {
- public void run() {
- fireElementDeleted(ResourceSetInfo.this.getEditorInput());
- }
- });
- return true;
-}
-«ENDDEFINE»
-
-«DEFINE handleResourceMovedSD FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-public boolean handleResourceMoved(org.eclipse.emf.ecore.resource.Resource resource, final org.eclipse.emf.common.util.URI newURI) {
- «EXPAND updateSynchStateSD-»
- if (myDocument.getDiagram().eResource() == resource) {
- org.eclipse.swt.widgets.Display.getDefault().asyncExec(new java.lang.Runnable() {
- public void run() {
- handleElementMoved(ResourceSetInfo.this.getEditorInput(), newURI);
- }
- });
- } else {
- handleResourceDeleted(resource);
- }
- return true;
-}
-«ENDDEFINE»
-
-«DEFINE updateSynchStateSD FOR gmfgen::GenDiagram-»
-synchronized (ResourceSetInfo.this) {
- if (ResourceSetInfo.this.fCanBeSaved) {
- ResourceSetInfo.this.setUnSynchronized(resource);
- return true;
- }
-}
-«ENDDEFINE»
-
-«DEFINE additionsSD 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.migrated/xpt/editor/ResourceSetModificationListener.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/ResourceSetModificationListener.xpt
deleted file mode 100644
index 673974d78..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/ResourceSetModificationListener.xpt
+++ /dev/null
@@ -1,89 +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'»
-
-«REM»Inner class of DocumentProvider«ENDREM»
-«DEFINE ResourceSetModificationListener FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedClassComment»
-private class ResourceSetModificationListener extends org.eclipse.emf.ecore.util.EContentAdapter {
-
- «EXPAND attributes-»
-
- «EXPAND _constructor-»
-
- «EXPAND notifyChanged-»
-
- «EXPAND additions-»
-}
-«ENDDEFINE»
-
-«DEFINE attributes FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
- private org.eclipse.emf.transaction.NotificationFilter myModifiedFilter;
-
- «EXPAND xpt::Common::generatedMemberComment»
- private ResourceSetInfo myInfo;
-«ENDDEFINE»
-
-«DEFINE _constructor FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-public ResourceSetModificationListener(ResourceSetInfo info) {
- myInfo = info;
- myModifiedFilter = org.eclipse.emf.transaction.NotificationFilter.createEventTypeFilter(org.eclipse.emf.common.notify.Notification.SET).or(org.eclipse.emf.transaction.NotificationFilter.createEventTypeFilter(org.eclipse.emf.common.notify.Notification.UNSET)).and(org.eclipse.emf.transaction.NotificationFilter.createFeatureFilter(org.eclipse.emf.ecore.resource.Resource.class, org.eclipse.emf.ecore.resource.Resource.RESOURCE__IS_MODIFIED));
-}
-«ENDDEFINE»
-
-«DEFINE notifyChanged FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-public void notifyChanged(org.eclipse.emf.common.notify.Notification notification) {
- if (notification.getNotifier() instanceof org.eclipse.emf.ecore.resource.ResourceSet) {
- super.notifyChanged(notification);
- }
- if (!notification.isTouch() && myModifiedFilter.matches(notification)) {
- if (notification.getNotifier() instanceof org.eclipse.emf.ecore.resource.Resource) {
- org.eclipse.emf.ecore.resource.Resource resource = (org.eclipse.emf.ecore.resource.Resource) notification.getNotifier();
- if (resource.isLoaded()) {
- boolean modified = false;
- for (java.util.Iterator/*<org.eclipse.emf.ecore.resource.Resource>*/ it = myInfo.getLoadedResourcesIterator(); it.hasNext() && !modified;) {
- org.eclipse.emf.ecore.resource.Resource nextResource = (org.eclipse.emf.ecore.resource.Resource) it.next();
- if (nextResource.isLoaded()) {
- modified = nextResource.isModified();
- }
- }
- boolean dirtyStateChanged = false;
- synchronized (myInfo) {
- if (modified != myInfo.fCanBeSaved) {
- myInfo.fCanBeSaved = modified;
- dirtyStateChanged = true;
- }
- «IF null = editorGen.application-»
- if (!resource.isModified()) {
- myInfo.setSynchronized(resource);
- }
- «ENDIF-»
- }
- if (dirtyStateChanged) {
- fireElementDirtyStateChanged(myInfo.getEditorInput(), modified);
-
- if (!modified) {
- myInfo.setModificationStamp(computeModificationStamp(myInfo));
- }
- }
- }
- }
- }
-}
-«ENDDEFINE»
-
-«DEFINE additions FOR gmfgen::GenDiagram-»
-«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/ShortcutCreationWizard.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/ShortcutCreationWizard.xpt
deleted file mode 100644
index 2eba54561..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/ShortcutCreationWizard.xpt
+++ /dev/null
@@ -1,156 +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::editor::GenDiagram»
-«EXTENSION xpt::editor::Utils»
-
-«DEFINE className FOR gmfgen::GenDiagram»«defaultShortcutCreationWizardClassName(self)»«ENDDEFINE»
-
-«DEFINE qualifiedClassName FOR gmfgen::GenDiagram»«editorGen.editor.packageName».«EXPAND className»«ENDDEFINE»
-
-«DEFINE ShortcutCreationWizard FOR gmfgen::GenDiagram-»
-«EXPAND xpt::Common::copyright FOR editorGen-»
-package «editorGen.editor.packageName»;
-
-/**
- * Allows to select foreign model element and add shortcut to the diagram.
- *
- * @generated
- */
-public class «EXPAND className» extends org.eclipse.jface.wizard.Wizard {
-
- /**
- * @generated
- */
- private ReferencedElementSelectionPage referencedElementSelectionPage;
-
- /**
- * @generated
- */
- private org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain;
-
- /**
- * @generated
- */
- public «EXPAND className»(org.eclipse.emf.ecore.EObject modelElement, org.eclipse.gmf.runtime.notation.View view,
- org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain) {
- referencedElementSelectionPage = new ReferencedElementSelectionPage(«EXPAND xpt::Externalizer::accessorCall(nameKey(i18nKeyForShortcutWizardReferencedElementPage(self))) FOR editorGen», view);
- referencedElementSelectionPage.setTitle(«EXPAND xpt::Externalizer::accessorCall(titleKey(i18nKeyForShortcutWizardReferencedElementPage(self))) FOR editorGen»);
- referencedElementSelectionPage.setDescription(«EXPAND xpt::Externalizer::accessorCall(descriptionKey(i18nKeyForShortcutWizardReferencedElementPage(self))) FOR editorGen»);
- referencedElementSelectionPage.setModelElement(modelElement);
-
- this.editingDomain = editingDomain;
- }
-
- /**
- * @generated
- */
- public void addPages() {
- addPage(referencedElementSelectionPage);
- }
-
- /**
- * @generated
- */
- public boolean performFinish() {
- 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(referencedElementSelectionPage.getModelElement()),
- org.eclipse.gmf.runtime.notation.Node.class, null, «EXPAND xpt::plugin::Activator::preferenceHintAccess FOR editorGen»);
- org.eclipse.gmf.runtime.common.core.command.ICommand command =
- new org.eclipse.gmf.runtime.diagram.ui.commands.CreateCommand(
- editingDomain, viewDescriptor, referencedElementSelectionPage.getView());
- command = command.compose(new «getCreateShortcutDecorationsCommandQualifiedClassName()»(
- editingDomain, referencedElementSelectionPage.getView(), viewDescriptor));
- try {
- org.eclipse.core.commands.operations.OperationHistoryFactory.getOperationHistory().execute(
- command, new org.eclipse.core.runtime.NullProgressMonitor(), null);
- } catch (org.eclipse.core.commands.ExecutionException ee) {
- «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().logError("Unable to create shortcut", ee);«EXPAND xpt::Common::nonNLS»
- }
- return true;
- }
-
- /**
- * @generated
- */
- private static class ReferencedElementSelectionPage extends «EXPAND xpt::editor::ModelElementSelectionPage::qualifiedClassName» {
-
- /**
- * @generated
- */
- private org.eclipse.gmf.runtime.notation.View view;
-
- /**
- * @generated
- */
- public ReferencedElementSelectionPage(String pageName, org.eclipse.gmf.runtime.notation.View view) {
- super(pageName);
- this.view = view;
- }
-
- /**
- * @generated
- */
- public org.eclipse.gmf.runtime.notation.View getView() {
- return view;
- }
-
- /**
- * @generated
- */
- protected String getSelectionTitle() {
- return «EXPAND xpt::Externalizer::accessorCall(messageKey(i18nKeyForShortcutWizardReferencedElementPage(self))) FOR editorGen»;
- }
-
- /**
- * @generated
- */
- protected boolean validatePage() {
- if (selectedModelElement == null) {
- setErrorMessage(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForShortcutWizardReferencedElementPageEmptyError(self)) FOR editorGen»);
- return false;
- }
- boolean result = org.eclipse.gmf.runtime.diagram.core.services.ViewService.getInstance().provides(
- org.eclipse.gmf.runtime.notation.Node.class,
- new org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter(selectedModelElement),
- view, null, org.eclipse.gmf.runtime.diagram.core.util.ViewUtil.APPEND, true,
- «EXPAND xpt::plugin::Activator::preferenceHintAccess FOR editorGen»);
- setErrorMessage(result ? null : «EXPAND xpt::Externalizer::accessorCall(i18nKeyForShortcutWizardReferencedElementPageInvalidError(self)) FOR editorGen»);
- return result;
- }
- }
-}
-«ENDDEFINE»
-
-«DEFINE i18nValues FOR gmfgen::GenDiagram-»
-«IF null <> editorGen.application-»
-«EXPAND xpt::Externalizer::messageEntry(nameKey(i18nKeyForShortcutWizardReferencedElementPage(self)), 'Select referenced element')-»
-«EXPAND xpt::Externalizer::messageEntry(titleKey(i18nKeyForShortcutWizardReferencedElementPage(self)), 'Referenced element')-»
-«EXPAND xpt::Externalizer::messageEntry(descriptionKey(i18nKeyForShortcutWizardReferencedElementPage(self)), 'Select element that the new shortcut will refer to.')-»
-«EXPAND xpt::Externalizer::messageEntry(messageKey(i18nKeyForShortcutWizardReferencedElementPage(self)), 'Select referenced element:')-»
-«EXPAND xpt::Externalizer::messageEntry(i18nKeyForShortcutWizardReferencedElementPageEmptyError(self), 'Referenced element is not selected')-»
-«EXPAND xpt::Externalizer::messageEntry(i18nKeyForShortcutWizardReferencedElementPageInvalidError(self), 'Invalid referenced element is selected')-»
-«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE i18nAccessors FOR gmfgen::GenDiagram-»
-«IF null <> editorGen.application-»
- «EXPAND xpt::Externalizer::accessorField(nameKey(i18nKeyForShortcutWizardReferencedElementPage(self)))-»
- «EXPAND xpt::Externalizer::accessorField(titleKey(i18nKeyForShortcutWizardReferencedElementPage(self)))-»
- «EXPAND xpt::Externalizer::accessorField(descriptionKey(i18nKeyForShortcutWizardReferencedElementPage(self)))-»
- «EXPAND xpt::Externalizer::accessorField(messageKey(i18nKeyForShortcutWizardReferencedElementPage(self)))-»
- «EXPAND xpt::Externalizer::accessorField(i18nKeyForShortcutWizardReferencedElementPageEmptyError(self))-»
- «EXPAND xpt::Externalizer::accessorField(i18nKeyForShortcutWizardReferencedElementPageInvalidError(self))-»
-«ENDIF-»
-«ENDDEFINE»
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/ShortcutPropertyTester.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/ShortcutPropertyTester.xpt
deleted file mode 100644
index a71ad737a..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/ShortcutPropertyTester.xpt
+++ /dev/null
@@ -1,53 +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 ShortcutPropertyTester FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::copyright FOR editorGen-»
-package «editorGen.editor.packageName»;
-
- «EXPAND xpt::Common::generatedClassComment»
-public class «shortcutPropertyTesterClassName» extends org.eclipse.core.expressions.PropertyTester {
-
- «EXPAND attributes-»
-
- «EXPAND test-»
-
- «EXPAND additions-»
-}
-«ENDDEFINE»
-
-«DEFINE attributes FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-protected static final String SHORTCUT_PROPERTY = "isShortcut"; «EXPAND xpt::Common::nonNLS»
-«ENDDEFINE»
-
-«DEFINE test FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-public boolean test(Object receiver, String method, Object[] args, Object expectedValue) {
- if (false == receiver instanceof org.eclipse.gmf.runtime.notation.View) {
- return false;
- }
- org.eclipse.gmf.runtime.notation.View view = (org.eclipse.gmf.runtime.notation.View) receiver;
- if (SHORTCUT_PROPERTY.equals(method)) {
- org.eclipse.emf.ecore.EAnnotation annotation = view.getEAnnotation("Shortcut"); «EXPAND xpt::Common::nonNLS»
- if (annotation != null) {
- return «EXPAND xpt::editor::VisualIDRegistry::modelID».equals(annotation.getDetails().get("modelID")); «EXPAND xpt::Common::nonNLS»
- }
- }
- return false;
-}
-«ENDDEFINE»
-
-«DEFINE additions FOR gmfgen::GenDiagram-»
-«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/UriEditorInputTester.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/UriEditorInputTester.xpt
deleted file mode 100644
index 1501222c2..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/UriEditorInputTester.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:
- * Alexander Shatalin (Borland) - initial API and implementation
- */
-
-«IMPORT 'http://www.eclipse.org/gmf/2008/GenModel'»
-
-«DEFINE UriEditorInputTester FOR gmfgen::GenNavigator-»
- «EXPAND xpt::Common::copyright FOR editorGen-»
-package «editorGen.editor.packageName»;
-
- «EXPAND xpt::Common::generatedClassComment»
-public class «uriInputTesterClassName» extends org.eclipse.core.expressions.PropertyTester {
-
- «EXPAND test FOR editorGen-»
-
- «EXPAND additions-»
-}
-«ENDDEFINE»
-
-«DEFINE test FOR gmfgen::GenEditorGenerator-»
- «EXPAND xpt::Common::generatedMemberComment»
-public boolean test(Object receiver, String method, Object[] args, Object expectedValue) {
- if (false == receiver instanceof org.eclipse.emf.common.ui.URIEditorInput) {
- return false;
- }
- org.eclipse.emf.common.ui.URIEditorInput editorInput = (org.eclipse.emf.common.ui.URIEditorInput) receiver;
- return "«diagramFileExtension»".equals(editorInput.getURI().fileExtension()); «EXPAND xpt::Common::nonNLS»
-}
-«ENDDEFINE»
-
-«DEFINE additions FOR gmfgen::GenNavigator-»
-«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/Utils.qvto b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/Utils.qvto
deleted file mode 100644
index 3891b3bfa..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/Utils.qvto
+++ /dev/null
@@ -1,255 +0,0 @@
-modeltype genModel uses "http://www.eclipse.org/gmf/2008/GenModel";
-
-library Utils;
-
-helper isStandaloneDomainModel(diagram : genModel::GenDiagram) : Boolean {
- return not diagram.editorGen.sameFileForDiagramAndModel and null <> diagram.domainDiagramElement
-}
-
-helper hasNavigator(editorView : genModel::GenEditorView) : Boolean {
- return null <> editorView.editorGen.navigator
-}
-
-helper addGotoMarker(editorView : genModel::GenEditorView, implementsList : Sequence(String)) : Sequence(String) {
- return (if isIDEMode(editorView) then implementsList->including('org.eclipse.ui.ide.IGotoMarker') else implementsList endif)
-}
-
-helper isIDEMode(editorView : genModel::GenEditorView) : Boolean {
- return null = editorView.editorGen.application
-}
-
-helper addReadOnlyPropSheet(editorView : genModel::GenEditorView, implementsList : Sequence(String)) : Sequence(String) {
- return (if hasPropertySheet(editorView) and editorView.editorGen.propertySheet.readOnly then implementsList->including('org.eclipse.gmf.runtime.diagram.ui.properties.views.IReadOnlyDiagramPropertySheetPageContributor') else implementsList endif)
-}
-
-helper hasPropertySheet(editorView : genModel::GenEditorView) : Boolean {
- return null <> editorView.editorGen.propertySheet
-}
-
-helper getEditorImplementsList(editorView : genModel::GenEditorView) : Sequence(String) {
- return addGotoMarker(editorView, addReadOnlyPropSheet(editorView, Sequence { }))
-}
-
-helper getContainedSemanticNodes(container : genModel::GenContainerBase) : Sequence(genModel::GenNode) {
- return container.containedNodes->select(node | null <> node.modelFacet)->asSequence()
-}
-
-helper genModel::GenCommonBase::getEssentialVisualChildren() : Collection(genModel::GenCommonBase) {
- return Sequence { }
-}
-
-helper genModel::GenLink::getEssentialVisualChildren() : Collection(genModel::GenCommonBase) {
- return self.labels
-}
-
-helper genModel::GenContainerBase::getEssentialVisualChildren() : Collection(genModel::GenCommonBase) {
- return self.containedNodes
-}
-
-helper genModel::GenNode::getEssentialVisualChildren() : Collection(genModel::GenCommonBase) {
- return ((Sequence { })[genModel::GenNodeLabel]->union(self.labels->asSequence()))[genModel::GenCommonBase]->union(self.compartments->asSequence())->union(self.containedNodes->asSequence())
-}
-
-helper defaultShortcutCreationWizardClassName(diagram : genModel::GenDiagram) : String {
- return 'ShortcutCreationWizard'
-}
-
-helper defaultModelElementSelectionPageClassName(diagram : genModel::GenDiagram) : String {
- return 'ModelElementSelectionPage'
-}
-
-helper defaultValidateActionClassName(diagram : genModel::GenDiagram) : String {
- return 'ValidateAction'
-}
-
-helper i18nKeyForDocumentProvider(diagram : genModel::GenDiagram) : String {
- return diagram.documentProviderClassName
-}
-
-helper i18nKeyForDocumentProviderIsModifiable(diagram : genModel::GenDiagram) : String {
- return i18nKeyForDocumentProvider(diagram) + '_isModifiable'
-}
-
-helper i18nKeyForDocumentProviderHandleElementContentChanged(diagram : genModel::GenDiagram) : String {
- return i18nKeyForDocumentProvider(diagram) + '_handleElementContentChanged'
-}
-
-helper i18nKeyForDocumentProviderIncorrectInputError(diagram : genModel::GenDiagram) : String {
- return i18nKeyForDocumentProvider(diagram) + '.IncorrectInputError'
-}
-
-helper i18nKeyForDocumentProviderNoDiagramInResourceError(diagram : genModel::GenDiagram) : String {
- return i18nKeyForDocumentProvider(diagram) + '.NoDiagramInResourceError'
-}
-
-helper i18nKeyForDocumentProviderDiagramLoadingError(diagram : genModel::GenDiagram) : String {
- return i18nKeyForDocumentProvider(diagram) + '.DiagramLoadingError'
-}
-
-helper i18nKeyForDocumentUnsynchronizedFileSaveError(diagram : genModel::GenDiagram) : String {
- return i18nKeyForDocumentProvider(diagram) + '.UnsynchronizedFileSaveError'
-}
-
-helper i18nKeyForDocumentSaveDiagramTask(diagram : genModel::GenDiagram) : String {
- return i18nKeyForDocumentProvider(diagram) + '.SaveDiagramTask'
-}
-
-helper i18nKeyForDocumentSaveNextResourceTask(diagram : genModel::GenDiagram) : String {
- return i18nKeyForDocumentProvider(diagram) + '.SaveNextResourceTask'
-}
-
-helper i18nKeyForDocumentSaveAs(diagram : genModel::GenDiagram) : String {
- return i18nKeyForDocumentProvider(diagram) + '.SaveAsOperation'
-}
-
-helper i18nKeyForDiagramEditorUtil(diagram : genModel::GenDiagram) : String {
- return diagram.diagramEditorUtilClassName
-}
-
-helper i18nKeyForOpenModelResourceErrorDialog(diagram : genModel::GenDiagram) : String {
- return i18nKeyForDiagramEditorUtil(diagram) + '.OpenModelResourceErrorDialog'
-}
-
-helper i18nKeyForCreateDiagramProgressTask(diagram : genModel::GenDiagram) : String {
- return i18nKeyForDiagramEditorUtil(diagram) + '.CreateDiagramProgressTask'
-}
-
-helper i18nKeyForCreateDiagramCommandLabel(diagram : genModel::GenDiagram) : String {
- return i18nKeyForDiagramEditorUtil(diagram) + '.CreateDiagramCommandLabel'
-}
-
-helper i18nKeyForInitDiagramFileResourceErrorDialog() : String {
- return 'InitDiagramFile.ResourceErrorDialog'
-}
-
-helper i18nKeyForInitDiagramFileWizardTitle() : String {
- return 'InitDiagramFile.WizardTitle'
-}
-
-helper i18nKeyForInitDiagramOpenFileDialogTitle() : String {
- return 'InitDiagramFile.OpenModelFileDialogTitle'
-}
-
-helper i18nKeyForNewDiagramFileWizard(diagram : genModel::GenDiagram) : String {
- return diagram.newDiagramFileWizardClassName
-}
-
-helper i18nKeyForNewDiagramFileWizardCreationPage(diagram : genModel::GenDiagram) : String {
- return i18nKeyForNewDiagramFileWizard(diagram) + '.CreationPage'
-}
-
-helper i18nKeyForNewDiagramFileWizardRootSelectionPage(diagram : genModel::GenDiagram) : String {
- return i18nKeyForNewDiagramFileWizard(diagram) + '.RootSelectionPage'
-}
-
-helper i18nKeyForNewDiagramFileWizardRootSelectionPageSelectionTitle(diagram : genModel::GenDiagram) : String {
- return i18nKeyForNewDiagramFileWizardRootSelectionPage(diagram) + 'SelectionTitle'
-}
-
-helper i18nKeyForNewDiagramFileWizardRootSelectionPageNoSelectionMessage(diagram : genModel::GenDiagram) : String {
- return i18nKeyForNewDiagramFileWizardRootSelectionPage(diagram) + 'NoSelectionMessage'
-}
-
-helper i18nKeyForNewDiagramFileWizardRootSelectionPageInvalidSelectionMessage(diagram : genModel::GenDiagram) : String {
- return i18nKeyForNewDiagramFileWizardRootSelectionPage(diagram) + 'InvalidSelectionMessage'
-}
-
-helper i18nKeyForNewDiagramFileWizardInitDiagramCommand(diagram : genModel::GenDiagram) : String {
- return i18nKeyForNewDiagramFileWizard(diagram) + '.InitDiagramCommand'
-}
-
-helper i18nKeyForNewDiagramFileWizardIncorrectRootError(diagram : genModel::GenDiagram) : String {
- return i18nKeyForNewDiagramFileWizard(diagram) + '.IncorrectRootError'
-}
-
-helper i18nKeyForSavingDeletedFile(editor : genModel::GenEditorView) : String {
- return i18nKeyForEditor(editor) + '.SavingDeletedFile'
-}
-
-helper i18nKeyForSaveAsProblems(editor : genModel::GenEditorView) : String {
- return i18nKeyForEditor(editor) + '.SaveAsError'
-}
-
-helper i18nKeyForSaveProblems(editor : genModel::GenEditorView) : String {
- return i18nKeyForEditor(editor) + '.SaveError'
-}
-
-helper i18nKeyForEditor(editor : genModel::GenEditorView) : String {
- return editor.className
-}
-
-helper i18nKeyForSelectModelElement(diagram : genModel::GenDiagram) : String {
- return i18nKeyForElementChooser(diagram) + '.SelectModelElement'
-}
-
-helper i18nKeyForElementChooser(diagram : genModel::GenDiagram) : String {
- return diagram.elementChooserClassName
-}
-
-helper i18nKeyForCreateShortcutOpenModel() : String {
- return 'CreateShortcutAction.OpenModel'
-}
-
-helper i18nKeyForCreateShortcutWizard() : String {
- return 'CreateShortcutAction.Wizard'
-}
-
-helper i18nKeyForShortcutWizardReferencedElementPage(diagram : genModel::GenDiagram) : String {
- return defaultShortcutCreationWizardClassName(diagram) + '.ReferencedElementSelectionPage'
-}
-
-helper i18nKeyForModelElementSelectionPage(diagram : genModel::GenDiagram) : String {
- return defaultModelElementSelectionPageClassName(diagram)
-}
-
-helper i18nKeyForValidateAction(diagram : genModel::GenDiagram) : String {
- return defaultValidateActionClassName(diagram)
-}
-
-helper i18nKeyForShortcutWizardReferencedElementPageEmptyError(diagram : genModel::GenDiagram) : String {
- return i18nKeyForShortcutWizardReferencedElementPage(diagram) + 'EmptyError'
-}
-
-helper i18nKeyForShortcutWizardReferencedElementPageInvalidError(diagram : genModel::GenDiagram) : String {
- return i18nKeyForShortcutWizardReferencedElementPage(diagram) + 'InvalidError'
-}
-
-helper i18nKeyForCreationWizard(diagram : genModel::GenDiagram) : String {
- return diagram.creationWizardClassName
-}
-
-helper i18nKeyForCreationWizardDiagramPage(diagram : genModel::GenDiagram) : String {
- return diagram.creationWizardClassName + '.DiagramModelFilePage'
-}
-
-helper i18nKeyForCreationWizardDomainPage(diagram : genModel::GenDiagram) : String {
- return diagram.creationWizardClassName + '.DomainModelFilePage'
-}
-
-helper i18nKeyForCreationWizardOpenEditorError(diagram : genModel::GenDiagram) : String {
- return diagram.creationWizardClassName + 'OpenEditorError'
-}
-
-helper i18nKeyForCreationWizardCreationError(diagram : genModel::GenDiagram) : String {
- return diagram.creationWizardClassName + 'CreationError'
-}
-
-helper i18nKeyForCreationWizardPageExtensionError(diagram : genModel::GenDiagram) : String {
- return diagram.creationWizardPageClassName + 'ExtensionError'
-}
-
-helper titleKey(dialogKey : String) : String {
- return dialogKey + 'Title'
-}
-
-helper messageKey(dialogKey : String) : String {
- return dialogKey + 'Message'
-}
-
-helper nameKey(dialogKey : String) : String {
- return dialogKey + 'Name'
-}
-
-helper descriptionKey(dialogKey : String) : String {
- return dialogKey + 'Description'
-}
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/ValidateAction.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/ValidateAction.xpt
deleted file mode 100644
index 5914f7df0..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/ValidateAction.xpt
+++ /dev/null
@@ -1,351 +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/GenModel'»
-«IMPORT 'http://www.eclipse.org/emf/2002/Ecore'»
-
-«EXTENSION xpt::editor::Utils»
-«EXTENSION xpt::GenAuditRoot»
-«EXTENSION xpt::GenEditorGenerator»
-
-«DEFINE className FOR gmfgen::GenDiagram»«defaultValidateActionClassName(self)»«ENDDEFINE»
-
-«DEFINE qualifiedClassName FOR gmfgen::GenDiagram»«editorGen.editor.packageName».«EXPAND className»«ENDDEFINE»
-
-«DEFINE ValidateAction FOR gmfgen::GenDiagram-»
-«EXPAND xpt::Common::copyright FOR editorGen-»
-package «editorGen.editor.packageName»;
-
-«EXPAND xpt::Common::generatedClassComment»
-public class «EXPAND className» extends org.eclipse.jface.action.Action {
- «EXPAND attributes-»
- «EXPAND _constructor-»
- «EXPAND run-»
- «EXPAND runValidation-»
- «EXPAND runNonUIValidation-»
- «EXPAND runValidationWithEP-»
- «EXPAND runEMFValidator-»
- «EXPAND validate-»
- «EXPAND createMarkersForStatus-»
- «EXPAND createMarkersForDiagnostic-»
- «EXPAND addMarker-»
- «EXPAND diagnosticToStatusSeverity-»
- «EXPAND collectTargetElementsFromStatus-»
- «EXPAND collectTargetElementsFromDiagnostic-»
- «EXPAND additions-»
-}
-«ENDDEFINE»
-
-«DEFINE attributes FOR gmfgen::GenDiagram»
- «EXPAND xpt::Common::generatedMemberComment»
- private org.eclipse.ui.IWorkbenchPage page;
-«ENDDEFINE»
-
-«DEFINE _constructor FOR gmfgen::GenDiagram»
- «EXPAND xpt::Common::generatedMemberComment»
- public «EXPAND className»(org.eclipse.ui.IWorkbenchPage page) {
- setText(«EXPAND xpt::Externalizer::accessorCall(messageKey(i18nKeyForValidateAction(self))) FOR editorGen»);
- this.page = page;
- }
-«ENDDEFINE»
-
-«DEFINE run FOR gmfgen::GenDiagram-»
-
- «EXPAND xpt::Common::generatedMemberComment»
- public void run() {
- org.eclipse.ui.IWorkbenchPart workbenchPart = page.getActivePart();
- if (workbenchPart instanceof org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramWorkbenchPart) {
- final org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramWorkbenchPart part = (org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramWorkbenchPart) workbenchPart;
- try {
- «IF editorGen.application = null-»
- new org.eclipse.ui.actions.WorkspaceModifyDelegatingOperation(
- «ENDIF-»
- new org.eclipse.jface.operation.IRunnableWithProgress() {
-
- public void run(org.eclipse.core.runtime.IProgressMonitor monitor)
- throws InterruptedException, java.lang.reflect.InvocationTargetException {
- runValidation(part.getDiagramEditPart(), part.getDiagram());
- }
- }
- «IF editorGen.application = null-»
- )
- «ENDIF-»
- .run(new org.eclipse.core.runtime.NullProgressMonitor());
- } catch (Exception e) {
- «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().logError("Validation action failed", e);«EXPAND xpt::Common::nonNLS»
- }
- }
- }
-«ENDDEFINE»
-
-«DEFINE runValidation FOR gmfgen::GenDiagram-»
-
- «EXPAND xpt::Common::generatedMemberComment»
- public static void runValidation(org.eclipse.gmf.runtime.notation.View view) {
- try {
- if («getDiagramEditorUtilQualifiedClassName()».openDiagram(view.eResource())) {
- org.eclipse.ui.IEditorPart editorPart = org.eclipse.ui.PlatformUI.getWorkbench()
- .getActiveWorkbenchWindow().getActivePage().getActiveEditor();
- if (editorPart instanceof org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramWorkbenchPart) {
- runValidation(((org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramWorkbenchPart) editorPart).
- getDiagramEditPart(), view);
- } else {
- runNonUIValidation(view);
- }
- }
- } catch (Exception e) {
- «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().logError(
- "Validation action failed", e); «EXPAND xpt::Common::nonNLS»
- }
- }
-«ENDDEFINE»
-
-«DEFINE runNonUIValidation FOR gmfgen::GenDiagram-»
-
- «EXPAND xpt::Common::generatedMemberComment»
- public static void runNonUIValidation(org.eclipse.gmf.runtime.notation.View view) {
- org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart diagramEditPart =
- org.eclipse.gmf.runtime.diagram.ui.OffscreenEditPartFactory.getInstance().createDiagramEditPart(
- view.getDiagram());
- runValidation(diagramEditPart, view);
- }
-«ENDDEFINE»
-
-«DEFINE runValidationWithEP FOR gmfgen::GenDiagram-»
-
- «EXPAND xpt::Common::generatedMemberComment»
- public static void runValidation(org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart diagramEditPart, org.eclipse.gmf.runtime.notation.View view) {
- final org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart fpart = diagramEditPart;
- final org.eclipse.gmf.runtime.notation.View fview = view;
- org.eclipse.emf.transaction.TransactionalEditingDomain txDomain = org.eclipse.emf.transaction.util.TransactionUtil.getEditingDomain(view);
- «getValidationProviderQualifiedClassName()».runWithConstraints(txDomain, new Runnable() {
-
- public void run() {
- validate(fpart, fview);
- }
- });
- }
-«ENDDEFINE»
-
-«DEFINE runEMFValidator FOR gmfgen::GenDiagram-»
-
- «EXPAND xpt::Common::generatedMemberComment»
- private static org.eclipse.emf.common.util.Diagnostic runEMFValidator(
- org.eclipse.gmf.runtime.notation.View target) {
- if (target.isSetElement() && target.getElement() != null) {
- return new org.eclipse.emf.ecore.util.Diagnostician() {
-
- public String getObjectLabel(org.eclipse.emf.ecore.EObject eObject) {
- return org.eclipse.gmf.runtime.emf.core.util.EMFCoreUtil.getQualifiedName(eObject, true);
- }
- }.validate(target.getElement());
- }
- return org.eclipse.emf.common.util.Diagnostic.OK_INSTANCE;
- }
-«ENDDEFINE»
-
-«DEFINE validate FOR gmfgen::GenDiagram-»
-
- «EXPAND xpt::Common::generatedMemberComment»
- private static void validate(org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart diagramEditPart,
- org.eclipse.gmf.runtime.notation.View view) {
- «IF editorGen.application = null-»
- org.eclipse.core.resources.IFile target = view.eResource() != null ?
- org.eclipse.emf.workspace.util.WorkspaceSynchronizer.getFile(view.eResource()) : null;
- if (target != null) {
- «getMarkerNavigationProviderQualifiedClassName()».deleteMarkers(target);
- }
- «ELSE-»
- org.eclipse.gmf.runtime.notation.View target = view;
- «EXPAND xpt::editor::ValidationMarker::qualifiedClassName».removeAllMarkers(diagramEditPart.getViewer());
- «ENDIF-»
- org.eclipse.emf.common.util.Diagnostic diagnostic = runEMFValidator(view);
- createMarkers(target, diagnostic, diagramEditPart);
- org.eclipse.emf.validation.service.IBatchValidator validator =
- (org.eclipse.emf.validation.service.IBatchValidator)
- org.eclipse.emf.validation.service.ModelValidationService.getInstance().newValidator(
- org.eclipse.emf.validation.model.EvaluationMode.BATCH);
- validator.setIncludeLiveConstraints(true);
- if (view.isSetElement() && view.getElement() != null) {
- org.eclipse.core.runtime.IStatus status = validator.validate(view.getElement());
- createMarkers(target, status, diagramEditPart);
- }
-«IF shouldRunValidateOnDiagram(editorGen.audits)-»
-«IF hasDiagramElementTargetRule(editorGen.audits)-»
- validator.setTraversalStrategy(«getValidationProviderQualifiedClassName()».getNotationTraversalStrategy(validator));
-«ENDIF-»
- org.eclipse.core.runtime.IStatus status = validator.validate(view);
- createMarkers(target, status, diagramEditPart);
-«ENDIF-»
- «IF editorGen.application <> null and validationDecorators-»
- «getValidationDecoratorProviderQualifiedClassName()».refreshDecorators(view);
- for (java.util.Iterator it = view.eAllContents(); it.hasNext();) {
- org.eclipse.emf.ecore.EObject next = (org.eclipse.emf.ecore.EObject) it.next();
- if (next instanceof org.eclipse.gmf.runtime.notation.View) {
- «getValidationDecoratorProviderQualifiedClassName()».refreshDecorators(
- (org.eclipse.gmf.runtime.notation.View) next);
- }
- }
- «ENDIF-»
- }
-«ENDDEFINE»
-
-«DEFINE createMarkersForStatus FOR gmfgen::GenDiagram-»
-
- «EXPAND xpt::Common::generatedMemberComment»
- private static void createMarkers(
- «IF editorGen.application = null»org.eclipse.core.resources.IFile
- «ELSE»org.eclipse.gmf.runtime.notation.View«ENDIF» target,
- org.eclipse.core.runtime.IStatus validationStatus,
- org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart diagramEditPart) {
- if (validationStatus.isOK()) {
- return;
- }
- final org.eclipse.core.runtime.IStatus rootStatus = validationStatus;
- java.util.List allStatuses = new java.util.ArrayList();
- «getDiagramEditorUtilQualifiedClassName()».LazyElement2ViewMap element2ViewMap =
- new «getDiagramEditorUtilQualifiedClassName()».LazyElement2ViewMap(
- diagramEditPart.getDiagramView(),
- collectTargetElements(rootStatus, new java.util.HashSet(), allStatuses));
- for (java.util.Iterator it = allStatuses.iterator(); it.hasNext();) {
- org.eclipse.emf.validation.model.IConstraintStatus nextStatus =
- (org.eclipse.emf.validation.model.IConstraintStatus) it.next();
- org.eclipse.gmf.runtime.notation.View view = «getDiagramEditorUtilQualifiedClassName()».findView(
- diagramEditPart, nextStatus.getTarget(), element2ViewMap);
- addMarker(diagramEditPart.getViewer(), target, view.eResource().getURIFragment(view),
- org.eclipse.gmf.runtime.emf.core.util.EMFCoreUtil.getQualifiedName(nextStatus.getTarget(), true),
- nextStatus.getMessage(), nextStatus.getSeverity());
- }
- }
-«ENDDEFINE»
-
-«DEFINE createMarkersForDiagnostic FOR gmfgen::GenDiagram-»
-
- «EXPAND xpt::Common::generatedMemberComment»
- private static void createMarkers(
- «IF editorGen.application = null»org.eclipse.core.resources.IFile
- «ELSE»org.eclipse.gmf.runtime.notation.View«ENDIF» target,
- org.eclipse.emf.common.util.Diagnostic emfValidationStatus,
- org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart diagramEditPart) {
- if (emfValidationStatus.getSeverity() == org.eclipse.emf.common.util.Diagnostic.OK) {
- return;
- }
- final org.eclipse.emf.common.util.Diagnostic rootStatus = emfValidationStatus;
- java.util.List allDiagnostics = new java.util.ArrayList();
- «getDiagramEditorUtilQualifiedClassName()».LazyElement2ViewMap element2ViewMap =
- new «getDiagramEditorUtilQualifiedClassName()».LazyElement2ViewMap(
- diagramEditPart.getDiagramView(),
- collectTargetElements(rootStatus, new java.util.HashSet(), allDiagnostics));
- for (java.util.Iterator it = emfValidationStatus.getChildren().iterator(); it.hasNext();) {
- org.eclipse.emf.common.util.Diagnostic nextDiagnostic = (org.eclipse.emf.common.util.Diagnostic) it.next();
- java.util.List data = nextDiagnostic.getData();
- if (data != null && !data.isEmpty() && data.get(0) instanceof org.eclipse.emf.ecore.EObject) {
- org.eclipse.emf.ecore.EObject element = (org.eclipse.emf.ecore.EObject) data.get(0);
- org.eclipse.gmf.runtime.notation.View view = «getDiagramEditorUtilQualifiedClassName()».findView(
- diagramEditPart, element, element2ViewMap);
- addMarker(diagramEditPart.getViewer(), target, view.eResource().getURIFragment(view),
- org.eclipse.gmf.runtime.emf.core.util.EMFCoreUtil.getQualifiedName(element, true),
- nextDiagnostic.getMessage(), diagnosticToStatusSeverity(nextDiagnostic.getSeverity()));
- }
- }
- }
-«ENDDEFINE»
-
-«DEFINE addMarker FOR gmfgen::GenDiagram-»
-
- «EXPAND xpt::Common::generatedMemberComment»
- private static void addMarker(org.eclipse.gef.EditPartViewer viewer,
- «IF editorGen.application = null»org.eclipse.core.resources.IFile
- «ELSE»org.eclipse.gmf.runtime.notation.View«ENDIF» target,
- String elementId, String location, String message, int statusSeverity) {
- if (target == null) {
- return;
- }
- «IF editorGen.application = null-»
- «getMarkerNavigationProviderQualifiedClassName()».addMarker(
- target, elementId, location, message, statusSeverity);
- «ELSE-»
- new «EXPAND xpt::editor::ValidationMarker::qualifiedClassName»(
- location, message, statusSeverity).add(viewer, elementId);
- «ENDIF-»
- }
-«ENDDEFINE»
-
-«DEFINE diagnosticToStatusSeverity FOR gmfgen::GenDiagram-»
-
- «EXPAND xpt::Common::generatedMemberComment»
- private static int diagnosticToStatusSeverity(int diagnosticSeverity) {
- if (diagnosticSeverity == org.eclipse.emf.common.util.Diagnostic.OK) {
- return org.eclipse.core.runtime.IStatus.OK;
- } else if (diagnosticSeverity == org.eclipse.emf.common.util.Diagnostic.INFO) {
- return org.eclipse.core.runtime.IStatus.INFO;
- } else if (diagnosticSeverity == org.eclipse.emf.common.util.Diagnostic.WARNING) {
- return org.eclipse.core.runtime.IStatus.WARNING;
- } else if (diagnosticSeverity == org.eclipse.emf.common.util.Diagnostic.ERROR
- || diagnosticSeverity == org.eclipse.emf.common.util.Diagnostic.CANCEL) {
- return org.eclipse.core.runtime.IStatus.ERROR;
- }
- return org.eclipse.core.runtime.IStatus.INFO;
- }
-«ENDDEFINE»
-
-«DEFINE collectTargetElementsFromStatus FOR gmfgen::GenDiagram-»
-
- «EXPAND xpt::Common::generatedMemberComment»
- private static java.util.Set collectTargetElements(org.eclipse.core.runtime.IStatus status,
- java.util.Set targetElementCollector, java.util.List allConstraintStatuses) {
- if (status instanceof org.eclipse.emf.validation.model.IConstraintStatus) {
- targetElementCollector.add(((org.eclipse.emf.validation.model.IConstraintStatus) status).getTarget());
- allConstraintStatuses.add(status);
- }
- if (status.isMultiStatus()) {
- org.eclipse.core.runtime.IStatus[] children = status.getChildren();
- for (int i = 0; i < children.length; i++) {
- collectTargetElements(children[i], targetElementCollector, allConstraintStatuses);
- }
- }
- return targetElementCollector;
- }
-«ENDDEFINE»
-
-«DEFINE collectTargetElementsFromDiagnostic FOR gmfgen::GenDiagram-»
-
- «EXPAND xpt::Common::generatedMemberComment»
- private static java.util.Set collectTargetElements(org.eclipse.emf.common.util.Diagnostic diagnostic,
- java.util.Set targetElementCollector, java.util.List allDiagnostics) {
- java.util.List data = diagnostic.getData();
- org.eclipse.emf.ecore.EObject target = null;
- if (data != null && !data.isEmpty() && data.get(0) instanceof org.eclipse.emf.ecore.EObject) {
- target = (org.eclipse.emf.ecore.EObject) data.get(0);
- targetElementCollector.add(target);
- allDiagnostics.add(diagnostic);
- }
- if (diagnostic.getChildren() != null && !diagnostic.getChildren().isEmpty()) {
- for (java.util.Iterator it = diagnostic.getChildren().iterator(); it.hasNext();) {
- collectTargetElements((org.eclipse.emf.common.util.Diagnostic) it.next(),
- targetElementCollector, allDiagnostics);
- }
- }
- return targetElementCollector;
- }
-«ENDDEFINE»
-
-«DEFINE additions FOR gmfgen::GenDiagram»«ENDDEFINE»
-
-«DEFINE i18nValues FOR gmfgen::GenDiagram-»
-«EXPAND xpt::Externalizer::messageEntry(messageKey(i18nKeyForValidateAction(self)), 'Validate')-»
-«ENDDEFINE»
-
-«DEFINE i18nAccessors FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Externalizer::accessorField(messageKey(i18nKeyForValidateAction(self)))-»
-«ENDDEFINE»
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/ValidationMarker.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/ValidationMarker.xpt
deleted file mode 100644
index b2b938e16..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/ValidationMarker.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/GenModel'»
-«IMPORT 'http://www.eclipse.org/emf/2002/Ecore'»
-
-«EXTENSION xpt::editor::Utils»
-
-«DEFINE className FOR gmfgen::GenDiagram»ValidationMarker«ENDDEFINE»
-
-«DEFINE qualifiedClassName FOR gmfgen::GenDiagram»«editorGen.editor.packageName».«EXPAND className»«ENDDEFINE»
-
-«DEFINE ValidationMarker FOR gmfgen::GenDiagram-»
-«EXPAND xpt::Common::copyright FOR editorGen-»
-package «editorGen.editor.packageName»;
-
-«EXPAND xpt::Common::generatedClassComment»
-public class «EXPAND className» {
-
- «EXPAND xpt::Common::generatedMemberComment»
- private static final String KEY = "validation_marker"; //$NON-NLS-1$
-
- «EXPAND xpt::Common::generatedMemberComment»
- public static final «EXPAND className»[] EMPTY_ARRAY = new «EXPAND className»[0];
-
- «EXPAND xpt::Common::generatedMemberComment»
- private final String location;
-
- «EXPAND xpt::Common::generatedMemberComment»
- private final String message;
-
- «EXPAND xpt::Common::generatedMemberComment»
- private final int statusSeverity;
-
- «EXPAND xpt::Common::generatedMemberComment»
- public «EXPAND className»(String location, String message, int statusSeverity) {
- this.location = location;
- this.message = message;
- this.statusSeverity = statusSeverity;
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- public String getLocation() {
- return location;
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- public String getMessage() {
- return message;
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- public int getStatusSeverity() {
- return statusSeverity;
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- private static java.util.Map getMarkers(org.eclipse.gef.EditPartViewer viewer) {
- java.util.Map markers = (java.util.Map) viewer.getProperty(KEY);
- if (markers == null) {
- markers = new java.util.HashMap();
- viewer.setProperty(KEY, markers);
- }
- return markers;
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- private static java.util.Set getMarkers(org.eclipse.gef.EditPartViewer viewer, String viewId, boolean create) {
- java.util.Set markers = (java.util.Set) getMarkers(viewer).get(viewId);
- if (markers == null) {
- if (!create) {
- return java.util.Collections.EMPTY_SET;
- }
- markers = new java.util.HashSet();
- getMarkers(viewer).put(viewId, markers);
- }
- return markers;
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- public static «EXPAND className»[] getMarkers(org.eclipse.gef.EditPartViewer viewer, String viewId) {
- java.util.Set markers = getMarkers(viewer, viewId, false);
- if (markers.isEmpty()) {
- return EMPTY_ARRAY;
- }
- return («EXPAND className»[]) markers.toArray(new «EXPAND className»[markers.size()]);
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- public static void removeAllMarkers(org.eclipse.gef.EditPartViewer viewer) {
- getMarkers(viewer).clear();
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- public void add(org.eclipse.gef.EditPartViewer viewer, String viewId) {
- getMarkers(viewer, viewId, true).add(this);
- }
- «EXPAND additions-»
-}
-«ENDDEFINE»
-
-«DEFINE additions FOR gmfgen::GenDiagram»«ENDDEFINE»
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/VisualIDRegistry.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/VisualIDRegistry.xpt
deleted file mode 100644
index 79c072420..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/VisualIDRegistry.xpt
+++ /dev/null
@@ -1,386 +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::editor::Utils»
-«EXTENSION xpt::GenModelUtils»
-«EXTENSION xpt::diagram::editpolicies::LinkUtils»
-«EXTENSION xpt::expressions::ValueExpression»
-«EXTENSION xpt::StringOperations»
-
-«DEFINE VisualIDRegistry FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::copyright FOR getDiagram().editorGen-»
-package «editorGen.editor.packageName»;
-
- «EXPAND xpt::Common::generatedClassComment(
- 'This registry is used to determine which type of visual object should be\n' +
- 'created for the corresponding Diagram, Node, ChildNode or Link represented\n' +
- 'by a domain model object.\n'
- )»
-public class «visualIDRegistryClassName» {
-
- «EXPAND attributes-»
-
- «EXPAND getViewVisualID-»
-
- «EXPAND getModelID-»
-
- «EXPAND getVisualID-»
-
- «EXPAND getType-»
-
- «EXPAND getDiagramVisualID-»
-
- «EXPAND getNodeVisualID-»
-
- «EXPAND canCreateNode-»
-
- «EXPAND getLinkWithClassVisualID-»
-
- «EXPAND isDiagram-»
-
- «EXPAND _constraintMethods-»
-
- «EXPAND additions-»
-}
-«ENDDEFINE»
-
-«REM»
- <Definitions of templates for outside usage>
-«ENDREM»
-
-«DEFINE visualID FOR gmfgen::GenCommonBase»«getEditPartQualifiedClassName()».VISUAL_ID«ENDDEFINE»
-
-«DEFINE modelID FOR gmfgen::GenDiagram»«getEditPartQualifiedClassName()».MODEL_ID«ENDDEFINE»
-
-«DEFINE getVisualIDMethodCall FOR gmfgen::GenDiagram»«getVisualIDRegistryQualifiedClassName()».«EXPAND getVisualIdMethodName»«ENDDEFINE»
-
-«DEFINE getModelIDMethodCall FOR gmfgen::GenDiagram»«getVisualIDRegistryQualifiedClassName()».«EXPAND getModelIDMethodName»«ENDDEFINE»
-
-«REM»
- XXX looks like these methods would produce incorrect result for visualID of GenDiagram itself - ask Vano if
- getType() method shouldn't be fixed similar to getVisualID, i.e. map diagram's visual id to MODEL_ID instead plain String.valueOf()
-«ENDREM»
-«DEFINE typeMethodCall(visualIdVar : String) FOR gmfgen::GenCommonBase»«getDiagram().getVisualIDRegistryQualifiedClassName()».«EXPAND getTypeMethodName FOR getDiagram()»(«visualIdVar»)«ENDDEFINE»
-«DEFINE typeMethodCall FOR gmfgen::GenCommonBase»«getDiagram().getVisualIDRegistryQualifiedClassName()».«EXPAND getTypeMethodName FOR getDiagram()»(«EXPAND visualID»)«ENDDEFINE»
-
-«DEFINE getDiagramVisualIDMethodCall FOR gmfgen::GenDiagram»«getVisualIDRegistryQualifiedClassName()».«EXPAND getDiagramVisualIDMethodName»«ENDDEFINE»
-
-«DEFINE getNodeVisualIDMethodCall FOR gmfgen::GenDiagram»«getVisualIDRegistryQualifiedClassName()».«EXPAND getNodeVisualIDMethodName»«ENDDEFINE»
-
-«DEFINE canCreateNodeMethodCall FOR gmfgen::GenDiagram»«getVisualIDRegistryQualifiedClassName()».«EXPAND canCreateNodeMethodName»«ENDDEFINE»
-
-«DEFINE getLinkWithClassVisualIDMethodCall FOR gmfgen::GenDiagram»«getVisualIDRegistryQualifiedClassName()».«EXPAND getLinkWithClassVisualIDMethodName»«ENDDEFINE»
-
-«REM»
- </Definitions of templates for outside usage>
-«ENDREM»
-
-«DEFINE attributes FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
- private static final String DEBUG_KEY = "«editorGen.plugin.iD»/debug/visualID"; «EXPAND xpt::Common::nonNLS»
-«IF null <> editorGen.expressionProviders-»
- «EXPAND _constraintField FOREACH topLevelNodes-»
- «EXPAND _constraintField FOREACH childNodes-»
- «EXPAND _constraintField FOREACH links-»
-«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE getViewVisualID FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-public static int «EXPAND getVisualIdMethodName»(org.eclipse.gmf.runtime.notation.View view) {
- if (view instanceof org.eclipse.gmf.runtime.notation.Diagram) {
- if («EXPAND modelID».equals(view.getType())) {
- return «EXPAND visualID»;
- } else {
- «EXPAND unrecognizedVID-»
- }
- }
- return «EXPAND getVisualIDMethodCall»(view.getType());
-}
-«ENDDEFINE»
-
-«DEFINE getVisualIdMethodName FOR gmfgen::GenDiagram»getVisualID«ENDDEFINE»
-
-«DEFINE getModelID FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-public static String «EXPAND getModelIDMethodName»(org.eclipse.gmf.runtime.notation.View view) {
- org.eclipse.gmf.runtime.notation.View diagram = view.getDiagram();
- while (view != diagram) {
- org.eclipse.emf.ecore.EAnnotation annotation = view.getEAnnotation("Shortcut"); «EXPAND xpt::Common::nonNLS»
- if (annotation != null) {
- return (String) annotation.getDetails().get("modelID"); «EXPAND xpt::Common::nonNLS»
- }
- view = (org.eclipse.gmf.runtime.notation.View) view.eContainer();
- }
- return diagram != null ? diagram.getType() : null;
-}
-«ENDDEFINE»
-
-«DEFINE getModelIDMethodName FOR gmfgen::GenDiagram»getModelID«ENDDEFINE»
-
-«DEFINE getVisualID FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-public static int «EXPAND getVisualIdMethodName»(String type) {
- try {
- return Integer.parseInt(type);
- } catch (NumberFormatException e) {
- if (Boolean.TRUE.toString().equalsIgnoreCase(org.eclipse.core.runtime.Platform.getDebugOption(DEBUG_KEY))) {
- «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().logError("Unable to parse view type as a visualID number: " + type);
- }
- }
- «EXPAND unrecognizedVID-»
-}
-«ENDDEFINE»
-
-«DEFINE getType FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-public static String «EXPAND getTypeMethodName»(int visualID) {
- return String.valueOf(visualID);
-}
-«ENDDEFINE»
-
-«DEFINE getTypeMethodName FOR gmfgen::GenDiagram»getType«ENDDEFINE»
-
-«DEFINE getDiagramVisualID FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-public static int «EXPAND getDiagramVisualIDMethodName»(org.eclipse.emf.ecore.EObject domainElement) {
- if (domainElement == null) {
- «EXPAND unrecognizedVID-»
- }
-«IF null <> domainDiagramElement-»
- «EXPAND returnVisualID-»
-«ENDIF-»
- «EXPAND unrecognizedVID-»
-}
-«ENDDEFINE»
-
-«DEFINE getDiagramVisualIDMethodName FOR gmfgen::GenDiagram»getDiagramVisualID«ENDDEFINE»
-
-«DEFINE returnVisualID FOR gmfgen::GenCommonBase-»
-if («EXPAND checkSemanticElement») {
- return «EXPAND visualID»;
-}
-«ENDDEFINE»
-
-«DEFINE checkSemanticElement FOR gmfgen::GenCommonBase-»
- «ERROR 'checkSemanticElement not supported for: ' + self.repr()-»
-«ENDDEFINE»
-
-«DEFINE checkSemanticElement FOR gmfgen::GenDiagram»«EXPAND checkDomainElementMetaclass FOR domainDiagramElement» && isDiagram(«EXPAND MetaModel::CastEObject('domainElement') FOR domainDiagramElement»)«ENDDEFINE»
-«DEFINE checkSemanticElement FOR gmfgen::GenNode»«EXPAND checkDomainElementMetaclass FOR modelFacet.metaClass»«EXPAND checkDomainElementConstraints(self) FOR modelFacet»«ENDDEFINE»
-«DEFINE checkSemanticElement FOR gmfgen::GenLink»«EXPAND checkSemanticElement(self) FOR modelFacet»«ENDDEFINE»
-
-«DEFINE checkDomainElementMetaclass FOR genmodel::GenClass»«EXPAND MetaModel::MetaClass».isSuperTypeOf(domainElement.eClass())«ENDDEFINE»
-
-«DEFINE checkDomainElementConstraints(commonBase : gmfgen::GenCommonBase) FOR gmfgen::TypeModelFacet-»
-«IF null <> modelElementSelector» && «EXPAND _domainElementConstraintMethodName FOR commonBase»(«EXPAND MetaModel::CastEObject('domainElement') FOR metaClass»)«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE checkSemanticElement(genLink : gmfgen::GenLink) FOR gmfgen::LinkModelFacet»«ERROR 'checkSemanticElement is supported only for TypeLinkModelFacet: ' + self.repr()»«ENDDEFINE»
-«DEFINE checkSemanticElement(genLink : gmfgen::GenLink) FOR gmfgen::TypeLinkModelFacet»«EXPAND checkDomainElementMetaclass FOR metaClass»«EXPAND checkDomainElementConstraints(genLink)»«ENDDEFINE»
-
-
-«DEFINE getNodeVisualID FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-public static int «EXPAND getNodeVisualIDMethodName»(org.eclipse.gmf.runtime.notation.View containerView, org.eclipse.emf.ecore.EObject domainElement) {
- if (domainElement == null) {
- «EXPAND unrecognizedVID-»
- }
- String containerModelID = «EXPAND getModelIDMethodCall»(containerView);
- if (!«EXPAND modelID».equals(containerModelID)«EXPAND checkContainerModelID FOREACH shortcutsProvidedFor») { «EXPAND xpt::Common::nonNLS FOR shortcutsProvidedFor->asSequence()»
- «EXPAND unrecognizedVID-»
- }
- int containerVisualID;
- if («EXPAND modelID».equals(containerModelID)) {
- containerVisualID = «EXPAND getVisualIDMethodCall»(containerView);
- } else {
- if (containerView instanceof org.eclipse.gmf.runtime.notation.Diagram) {
- containerVisualID = «EXPAND visualID»;
- } else {
- «EXPAND unrecognizedVID-»
- }
- }
- switch (containerVisualID) {
- «EXPAND caseDomainContainerVisualID FOREACH getAllContainers()-»
- }
- «EXPAND unrecognizedVID-»
-}
-«ENDDEFINE»
-
-«DEFINE getNodeVisualIDMethodName FOR gmfgen::GenDiagram»getNodeVisualID«ENDDEFINE»
-
-«DEFINE caseDomainContainerVisualID FOR gmfgen::GenContainerBase-»
- «IF getContainedSemanticNodes(self)->size() > 0-»
-«EXPAND xpt::Common::caseVisualID»
- «EXPAND returnVisualID FOREACH getContainedSemanticNodes(self)-»
- break;
- «ENDIF-»
-«ENDDEFINE»
-
-
-«DEFINE canCreateNode FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-public static boolean «EXPAND canCreateNodeMethodName»(org.eclipse.gmf.runtime.notation.View containerView, int nodeVisualID) {
- String containerModelID = «EXPAND getModelIDMethodCall»(containerView);
- if (!«EXPAND modelID».equals(containerModelID)«EXPAND checkContainerModelID FOREACH shortcutsProvidedFor») { «EXPAND xpt::Common::nonNLS FOR shortcutsProvidedFor->asSequence()»
- return false;
- }
- int containerVisualID;
- if («EXPAND modelID».equals(containerModelID)) {
- containerVisualID = «EXPAND getVisualIDMethodCall»(containerView);
- } else {
- if (containerView instanceof org.eclipse.gmf.runtime.notation.Diagram) {
- containerVisualID = «EXPAND visualID»;
- } else {
- return false;
- }
- }
- switch (containerVisualID) {
- «EXPAND caseVisualID FOREACH getAllContainers()->select(e | not e.getEssentialVisualChildren()->isEmpty())-»
- «EXPAND caseVisualID FOREACH links->select(e | not e.getEssentialVisualChildren()->isEmpty())-»
- }
- return false;
-}
-«ENDDEFINE»
-
-«DEFINE canCreateNodeMethodName FOR gmfgen::GenDiagram»canCreateNode«ENDDEFINE»
-
-«DEFINE checkContainerModelID FOR String» && !"«self»".equals(containerModelID)«ENDDEFINE»
-
-«DEFINE caseVisualID FOR gmfgen::GenCommonBase-»
-«EXPAND xpt::Common::caseVisualID»
- «EXPAND checkEssentialChild FOREACH self.getEssentialVisualChildren()-»
- break;
-«ENDDEFINE»
-
-«DEFINE checkEssentialChild FOR gmfgen::GenCommonBase-»
-if («EXPAND visualID» == nodeVisualID) {
- return true;
-}
-«ENDDEFINE»
-
-«DEFINE getLinkWithClassVisualID FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
-public static int «EXPAND getLinkWithClassVisualIDMethodName»(org.eclipse.emf.ecore.EObject domainElement) {
- if (domainElement == null) {
- «EXPAND unrecognizedVID-»
- }
- «EXPAND returnVisualID FOREACH links->select(isTypeLink())-»
- «EXPAND unrecognizedVID-»
-}
-«ENDDEFINE»
-
-«DEFINE getLinkWithClassVisualIDMethodName FOR gmfgen::GenDiagram»getLinkWithClassVisualID«ENDDEFINE»
-
-
-«DEFINE isDiagram FOR gmfgen::GenDiagram-»
- «IF null <> domainDiagramElement-»
- «EXPAND xpt::Common::generatedMemberComment(
- 'User can change implementation of this method to handle some specific\n' +
- 'situations not covered by default logic.\n'
- )»
-private static boolean isDiagram(«EXPAND MetaModel::QualifiedClassName FOR domainDiagramElement» element) {
- return true;
-}
- «ENDIF-»
-«ENDDEFINE»
-
-
-«REM»
-
- Support for extra contstraints to check about model element.
- Includes expression fields for interpreted constrains (like ocl or regexp).
- For each model element that has an associated constraint, there's a method is<DomainElement>_<UID>()
- that performs extra specification as defined by value expression
-
- FIXME don't use static fields, replace with instance/separate cache (e.g. accessible from Activator)
-«ENDREM»
-
-«DEFINE _constraintMethods FOR gmfgen::GenDiagram-»
-«IF null <> editorGen.expressionProviders-»
- «EXPAND _constraintMethod FOREACH topLevelNodes->select(n | n.modelFacet.modelElementSelector <> null)-»
- «EXPAND _constraintMethod FOREACH childNodes->select(n | n.modelFacet.modelElementSelector <> null)-»
- «FOREACH links->asSequence() AS l»«EXPAND _constraintMethod(l) FOR l.modelFacet»«ENDFOREACH»
-«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE _constraintMethod FOR gmfgen::GenNode-»
-«EXPAND _domainElementConstraintMethod(self, modelFacet.modelElementSelector, modelFacet.metaClass) FOR modelFacet.modelElementSelector.provider»
-«ENDDEFINE»
-
-«DEFINE _constraintMethod(l : gmfgen::GenLink) FOR gmfgen::LinkModelFacet»«ENDDEFINE» // no-op
-«DEFINE _constraintMethod(l : gmfgen::GenLink) FOR gmfgen::TypeLinkModelFacet-»
-«IF modelElementSelector <> null»«EXPAND _domainElementConstraintMethod(l, modelElementSelector, metaClass) FOR modelElementSelector.provider»«ENDIF-»
-«ENDDEFINE»
-
-
-«DEFINE _domainElementConstraintMethodName FOR gmfgen::GenCommonBase»is«getUniqueIdentifier()»«ENDDEFINE»
-
-«DEFINE _domainElementConstraintMethod(diagramElement : gmfgen::GenCommonBase, expression : gmfgen::ValueExpression, context : genmodel::GenClass) FOR gmfgen::GenExpressionProviderBase»«ERROR 'Constraint method is not supported for ' + self.repr()»«ENDDEFINE»
-
-«DEFINE _domainElementConstraintMethod(diagramElement : gmfgen::GenCommonBase, expression : gmfgen::ValueExpression, context : genmodel::GenClass) FOR gmfgen::GenJavaExpressionProvider-»
- «EXPAND xpt::Common::generatedMemberComment»
- private static boolean «EXPAND _domainElementConstraintMethodName FOR diagramElement»(«EXPAND MetaModel::QualifiedClassName FOR context» domainElement) {
-«IF injectExpressionBody and (expression.body <> null and expression.body.xpandLength() <> 0)-»
- «expression.body»
-«ELSEIF throwException or (injectExpressionBody and (expression.body = null or expression.body.xpandLength() = 0))-»
- // FIXME: implement this method
- // Ensure that you remove @generated or mark it @generated NOT
- throw new java.lang.UnsupportedOperationException("No java implementation provided in '«EXPAND _domainElementConstraintMethodName FOR diagramElement»' operation");«EXPAND xpt::Common::nonNLS»
-«ELSE-»
- return false;
-«ENDIF-»
- }
-«ENDDEFINE»
-
-«DEFINE _domainElementConstraintMethod(diagramElement : gmfgen::GenCommonBase, expression : gmfgen::ValueExpression, context : genmodel::GenClass) FOR gmfgen::GenExpressionInterpreter-»
- «EXPAND xpt::Common::generatedMemberComment»
- private static boolean «EXPAND _domainElementConstraintMethodName FOR diagramElement»(«EXPAND MetaModel::QualifiedClassName FOR context» domainElement) {
- if («constraintFieldName(diagramElement)» == null) { // lazy initialization
- «constraintFieldName(diagramElement)» = «EXPAND xpt::expressions::getExpression::getExpression(expression, context)»; «EXPAND xpt::Common::nonNLS»
- }
- Object result = «constraintFieldName(diagramElement)».evaluate(domainElement);
- return result instanceof Boolean && ((Boolean)result).booleanValue();
- }
-«ENDDEFINE»
-
-
-«DEFINE _constraintField FOR gmfgen::GenNode»«EXPAND _constraintField(self) FOR modelFacet»«ENDDEFINE»
-«DEFINE _constraintField FOR gmfgen::GenLink»«EXPAND _constraintField(self) FOR modelFacet»«ENDDEFINE»
-
-«DEFINE _constraintField(diagramElement : gmfgen::GenCommonBase) FOR gmfgen::ModelFacet»«ENDDEFINE»
-«DEFINE _constraintField(diagramElement : gmfgen::GenCommonBase) FOR gmfgen::TypeModelFacet-»
-«IF modelElementSelector <> null»«EXPAND _constraintField(diagramElement) FOR modelElementSelector.provider»«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE _constraintField(diagramElement : gmfgen::GenCommonBase) FOR gmfgen::GenExpressionInterpreter»
- «EXPAND xpt::Common::generatedMemberComment»
- private static «container.getAbstractExpressionQualifiedClassName()» «constraintFieldName(diagramElement)»;
-«ENDDEFINE»
-
-«DEFINE _constraintField(diagramElement : gmfgen::GenCommonBase) FOR gmfgen::GenExpressionProviderBase»«ERROR 'Need to define approach to constraint fields for ' + self.repr()»«ENDDEFINE»
-«DEFINE _constraintField(diagramElement : gmfgen::GenCommonBase) FOR gmfgen::GenJavaExpressionProvider»«ENDDEFINE»// IOW, no fields for Java
-
-«REM»
- Constraints support end.
-«ENDREM»
-
-
-«DEFINE unrecognizedVID FOR gmfgen::GenDiagram-»
-return -1;
-«ENDDEFINE»
-
-«DEFINE additions FOR gmfgen::GenDiagram»«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/diagram.gif b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/diagram.gif
deleted file mode 100644
index bdc8ae9a0..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/diagram.gif
+++ /dev/null
Binary files differ
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/extensions.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/extensions.xpt
deleted file mode 100644
index a4c3889bf..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/extensions.xpt
+++ /dev/null
@@ -1,86 +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'»
-
-«DEFINE extensions FOR gmfgen::GenEditorGenerator»
- <extension point="org.eclipse.ui.editors" id="gmf-editor">
- «EXPAND xpt::Common::xmlGeneratedTag»
- <editor
- id="«editor.iD»"
- name="%editorName"
- icon="«editor.iconPathX»"
- extensions="«diagramFileExtension»"
- default="true"
- class="«editor.getQualifiedClassName()»"
- matchingStrategy="«diagram.getMatchingStrategyQualifiedClassName()»"
- contributorClass="«editor.getActionBarContributorQualifiedClassName()»">
- </editor>
- </extension>
-
- <extension point="org.eclipse.ui.contexts" id="ui-context">
- «EXPAND xpt::Common::xmlGeneratedTag»
- <context
- description="%context.description"
- id="«editor.contextID»"
- name="%context.name"
- parentId="org.eclipse.gmf.runtime.diagram.ui.diagramContext">
- </context>
- </extension>
-
- <extension point="org.eclipse.ui.newWizards" id="creation-wizard">
- «EXPAND xpt::Common::xmlGeneratedTag»
- <wizard
- name="%newWizardName"
- icon="«diagram.creationWizardIconPathX»"
- category="«diagram.creationWizardCategoryID»"
- class="«diagram.getCreationWizardQualifiedClassName()»"
- id="«diagram.getCreationWizardQualifiedClassName()»ID">
- <description>%newWizardDesc</description>
- </wizard>
- </extension>
-
-«IF diagram.generateInitDiagramAction()-»
- «IF null = application»<extension point="org.eclipse.ui.popupMenus" id="init-diagram-action">
- «EXPAND xpt::Common::xmlGeneratedTag»
- <objectContribution
- id="«plugin.iD».InitDiagram"
- nameFilter="*.«domainFileExtension»"
- objectClass="org.eclipse.core.resources.IFile">
- <action
- label="%initDiagramActionLabel"
- class="«diagram.getInitDiagramFileActionQualifiedClassName()»"
- menubarPath="additions"
- enablesFor="1"
- id="«plugin.iD».InitDiagramAction">
- </action>
- </objectContribution>
- </extension>
- «ELSE-»
- <extension point="org.eclipse.ui.actionSets" id="init-diagram-action">
- «EXPAND xpt::Common::xmlGeneratedTag»
- <actionSet
- label="%initDiagramActionLabel"
- visible="true"
- id="«plugin.iD».InitDiagram">
- <action
- label="%initDiagramActionLabel"
- class="«diagram.getInitDiagramFileActionQualifiedClassName()»"
- menubarPath="file/additions"
- id="«plugin.iD».InitDiagramAction">
- </action>
- </actionSet>
- </extension>
- «ENDIF-»
-«ENDIF-»
-«ENDDEFINE»
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/palette/PaletteFactory.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/palette/PaletteFactory.xpt
deleted file mode 100644
index 5d43d2606..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/palette/PaletteFactory.xpt
+++ /dev/null
@@ -1,286 +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:
- * 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::editor::palette::Utils»
-
-«DEFINE Factory FOR gmfgen::Palette»
-«EXPAND xpt::Common::copyright FOR diagram.editorGen-»
-package «packageName»;
-
-«EXPAND xpt::Common::generatedClassComment»
-public class «factoryClassName» {
-
- «EXPAND xpt::Common::generatedMemberComment»
- public void fillPalette(org.eclipse.gef.palette.PaletteRoot paletteRoot) {
-«IF definesStandardTools()-»
- cleanStandardTools(paletteRoot);
-«ENDIF-»
- «EXPAND addEntry('paletteRoot') FOREACH groups-»
- }
-«IF definesStandardTools()»
-«EXPAND cleanStandardToolsHack-»
-«ENDIF-»
-
-«EXPAND createGroup FOREACH collectGroups(self)»
-«EXPAND createEntry FOREACH collectTools(self)»
-
-«IF needsNodeToolEntryClass(self)»«EXPAND nodeToolEntry»«ENDIF-»
-«IF needsLinkToolEntryClass(self)»«EXPAND linkToolEntry»«ENDIF-»
-}
-«ENDDEFINE»
-
-«DEFINE createGroup FOR gmfgen::ToolGroup-»
- «EXPAND xpt::Common::generatedMemberComment('Creates \"' + title + '\" palette tool group')»
- private org.eclipse.gef.palette.PaletteContainer «createMethodName»() {
- «EXPAND newContainer('paletteContainer')-»
- «EXPAND setIdentity('paletteContainer')-»
- «EXPAND setDescription('paletteContainer', self) FOR description-»
- «EXPAND setSmallImage('paletteContainer', palette)-»
- «EXPAND setLargeImage('paletteContainer', palette)-»
- «EXPAND addEntry('paletteContainer') FOREACH entries-»
- return paletteContainer;
- }
-«ENDDEFINE»
-
-«DEFINE newContainer(varName : String) FOR gmfgen::ToolGroup-»
-«IF collapse and toolsOnly-»
- org.eclipse.gef.palette.PaletteDrawer «varName» = new org.eclipse.gef.palette.PaletteDrawer(«EXPAND i18nTitle»);
-«ELSEIF stack-»
- org.eclipse.gef.palette.PaletteStack «varName» = new org.eclipse.gef.palette.PaletteStack(«EXPAND i18nTitle», null, null);
-«ELSE-»
- org.eclipse.gef.palette.PaletteGroup «varName» = new org.eclipse.gef.palette.PaletteGroup(«EXPAND i18nTitle»);
-«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE setDescription(varName : String, gr : gmfgen::ToolGroup) FOR String-»
-«varName».setDescription(«EXPAND i18nDesc FOR gr»);
-«ENDDEFINE»
-
-«DEFINE addEntry(varName : String) FOR gmfgen::ToolGroupItem»
-«ERROR 'abstract addEntry(ToolGroupItem,String) template'»
-«ENDDEFINE»
-
-«DEFINE addEntry(varName : String) FOR gmfgen::AbstractToolEntry-»
-«varName».add(«createMethodName»());
-«IF _default and group.stack-»
-«varName».setActiveEntry((org.eclipse.gef.palette.ToolEntry) paletteContainer.getChildren().get(paletteContainer.getChildren().size() - 1));
-«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE addEntry(varName : String) FOR gmfgen::Separator-»
-«varName».add(new org.eclipse.gef.palette.PaletteSeparator());
-«ENDDEFINE»
-
-«DEFINE addEntry(varName : String) FOR gmfgen::ToolGroup-»
-«varName».add(«createMethodName»());
-«ENDDEFINE»
-
-«DEFINE createEntry FOR gmfgen::AbstractToolEntry-»
- «EXPAND xpt::Common::generatedMemberComment»
- private org.eclipse.gef.palette.ToolEntry «createMethodName»() {
- «EXPAND newEntry('entry')-»
- «EXPAND setIdentity('entry')-»
- «EXPAND setSmallImage('entry', group.palette)-»
- «EXPAND setLargeImage('entry', group.palette)-»
- «EXPAND setToolClass('entry')-»
- «EXPAND setToolProperty('entry') FOREACH properties-»
- return entry;
- }
-«ENDDEFINE»
-
-«DEFINE newEntry(toolVarName : String) FOR gmfgen::AbstractToolEntry-»
-«ERROR 'abstract newEntry(AbstractToolEntry,String) template'»
-«ENDDEFINE»
-
-«DEFINE newEntry(toolVarName : String) FOR gmfgen::ToolEntry-»
-«IF elements->isEmpty()-»
-org.eclipse.gef.palette.ToolEntry «toolVarName» = new org.eclipse.gef.palette.ToolEntry(«EXPAND i18nTitle», «EXPAND i18nDesc», null, null) {};
-«ELSE-»
-«LET (if genNodes->isEmpty() then 'LinkToolEntry' else 'NodeToolEntry' endif) AS toolEntryClass-»
-java.util.List/*<IElementType>*/ types = new java.util.ArrayList/*<IElementType>*/(«elements->size()»);
-«FOREACH elements->asSequence() AS e-»
-types.add(«EXPAND xpt::providers::ElementTypes::accessElementType FOR e»);
-«ENDFOREACH-»
-«toolEntryClass» «toolVarName» = new «toolEntryClass»(«EXPAND i18nTitle», «EXPAND i18nDesc», types);
-«ENDLET-»
-«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE newEntry(toolVarName : String) FOR gmfgen::StandardEntry-»
-«IF gmfgen::StandardEntryKind::SELECT = kind -»
-«EXPAND newStdSelectEntry(toolVarName)-»
-«ELSEIF kind = gmfgen::StandardEntryKind::MARQUEE-»
-«EXPAND newStdMarqueeEntry(toolVarName)-»
-«ELSEIF kind = gmfgen::StandardEntryKind::ZOOM-»
-«EXPAND newStdZoomEntry(toolVarName)-»
-«ELSE-»
-«EXPAND newStdOtherEntry(toolVarName)-»
-«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE newStdSelectEntry(toolVarName : String) FOR gmfgen::StandardEntry-»
-org.eclipse.gef.palette.PanningSelectionToolEntry «toolVarName» = new org.eclipse.gef.palette.PanningSelectionToolEntry();
-«ENDDEFINE»
-
-«DEFINE newStdMarqueeEntry(toolVarName : String) FOR gmfgen::StandardEntry-»
-org.eclipse.gef.palette.MarqueeToolEntry «toolVarName» = new org.eclipse.gef.palette.MarqueeToolEntry();
-«ENDDEFINE»
-
-«DEFINE newStdZoomEntry(toolVarName : String) FOR gmfgen::StandardEntry-»
-FIXME
-«ENDDEFINE»
-
-«DEFINE newStdOtherEntry(toolVarName : String) FOR gmfgen::StandardEntry-»
-«ERROR 'override newStdOtherEntry(StandardEntry, String) for kind ' + kind.repr()»
-«ENDDEFINE»
-
-// FIXME: odd code - FOR EntryBase, while most of the template is valid for ToolEntry only!!!
-«DEFINE setSmallImage(toolVarName : String, palette : gmfgen::Palette) FOR gmfgen::EntryBase-»
-«IF null <> smallIconPath-»
-«toolVarName».setSmallIcon(«palette.activatorFQN()».findImageDescriptor("«smallIconPath»"));«EXPAND xpt::Common::nonNLS»
-«ELSEIF not (Sequence { self })[gmfgen::ToolEntry].elements->isEmpty()-»
-«LET self.oclAsType(gmfgen::ToolEntry) AS toolEntry-»
-«toolVarName».setSmallIcon(«palette.diagram.getElementTypesQualifiedClassName()».getImageDescriptor(«EXPAND xpt::providers::ElementTypes::accessElementType FOR toolEntry.elements->first().oclAsType(gmfgen::GenCommonBase)»));
-«ENDLET-»
-«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE setLargeImage(toolVarName : String, palette : gmfgen::Palette) FOR gmfgen::EntryBase-»
-«IF null <> largeIconPath-»
-«toolVarName».setLargeIcon(«palette.activatorFQN()».findImageDescriptor("«largeIconPath»")); «EXPAND xpt::Common::nonNLS»
-«ELSEIF not (Sequence { self })[gmfgen::ToolEntry].elements->isEmpty()-»
-«toolVarName».setLargeIcon(«toolVarName».getSmallIcon());
-«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE setToolClass(toolVarName : String) FOR gmfgen::AbstractToolEntry-»
-«IF null <> qualifiedToolName-»
-«toolVarName».setToolClass(«qualifiedToolName».class);
-«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE setToolProperty(toolVarName : String) FOR ecore::EStringToStringMapEntry-»
-«toolVarName».setToolProperty(«key», «value»);
-«ENDDEFINE»
-
-«DEFINE i18nTitle FOR gmfgen::ToolEntry-»
-«IF title = null»null«ELSE»«EXPAND xpt::Externalizer::accessorCall(i18nTitleKey(self)) FOR group.palette.diagram.editorGen»«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE i18nTitle FOR gmfgen::ToolGroup-»
-«IF title = null»null«ELSE»«EXPAND xpt::Externalizer::accessorCall(i18nTitleKey(self)) FOR palette.diagram.editorGen»«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE i18nDesc FOR gmfgen::ToolEntry-»
-«IF null = description»null«ELSE»«EXPAND xpt::Externalizer::accessorCall(i18nDescKey(self)) FOR group.palette.diagram.editorGen»«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE i18nDesc FOR gmfgen::ToolGroup-»
-«IF null = description»null«ELSE»«EXPAND xpt::Externalizer::accessorCall(i18nDescKey(self)) FOR palette.diagram.editorGen»«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE i18nAccessors FOR gmfgen::Palette-»
-«EXPAND internal_i18n_accessors FOREACH collectGroups(self)-»
-«EXPAND internal_i18n_accessors FOREACH collectTools(self)-»
-«ENDDEFINE»
-
-«DEFINE i18nValues FOR gmfgen::Palette-»
-«EXPAND internal_i18n_values FOREACH collectGroups(self)-»
-«EXPAND internal_i18n_values FOREACH collectTools(self)-»
-«ENDDEFINE»
-
-«DEFINE internal_i18n_accessors FOR gmfgen::EntryBase-»
-«IF null <> title»«EXPAND xpt::Externalizer::accessorField(i18nTitleKey(self))»«ENDIF-»
-«IF null <> description»«EXPAND xpt::Externalizer::accessorField(i18nDescKey(self))»«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE internal_i18n_values FOR gmfgen::EntryBase-»
-«IF null <> title»«EXPAND xpt::Externalizer::messageEntry(i18nTitleKey(self), title)»«ENDIF-»
-«IF null <> description»«EXPAND xpt::Externalizer::messageEntry(i18nDescKey(self), description)»«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE cleanStandardToolsHack FOR gmfgen::Palette»
- «EXPAND xpt::Common::generatedMemberComment('Workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=159289')»
- private void cleanStandardTools(org.eclipse.gef.palette.PaletteRoot paletteRoot) {
- for (java.util.Iterator it = paletteRoot.getChildren().iterator(); it.hasNext();) {
- org.eclipse.gef.palette.PaletteEntry entry = (org.eclipse.gef.palette.PaletteEntry) it.next();
- if (!"standardGroup".equals(entry.getId())) { «EXPAND xpt::Common::nonNLS»
- continue;
- }
- for (java.util.Iterator it2 = ((org.eclipse.gef.palette.PaletteContainer) entry).getChildren().iterator(); it2.hasNext();) {
- org.eclipse.gef.palette.PaletteEntry entry2 = (org.eclipse.gef.palette.PaletteEntry) it2.next();
- if ("zoomTool".equals(entry2.getId())) { «EXPAND xpt::Common::nonNLS»
- it2.remove();
- } else if ("noteStack".equals(entry2.getId())) { «EXPAND xpt::Common::nonNLS»
- it2.remove();
- } else if ("selectionTool".equals(entry2.getId())) { «EXPAND xpt::Common::nonNLS»
- it2.remove();
- }
- if (paletteRoot.getDefaultEntry() == entry2) {
- paletteRoot.setDefaultEntry(null);
- }
- }
- }
- }
-«ENDDEFINE»
-
-«DEFINE nodeToolEntry FOR OclAny»
- «EXPAND xpt::Common::generatedClassComment»
- private static class NodeToolEntry extends org.eclipse.gef.palette.ToolEntry {
-
- «EXPAND xpt::Common::generatedMemberComment»
- private final java.util.List elementTypes;
-
- «EXPAND xpt::Common::generatedMemberComment»
- private NodeToolEntry(String title, String description, java.util.List elementTypes) {
- super(title, description, null, null);
- this.elementTypes = elementTypes;
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- public org.eclipse.gef.Tool createTool() {
- org.eclipse.gef.Tool tool = new org.eclipse.gmf.runtime.diagram.ui.tools.UnspecifiedTypeCreationTool(elementTypes);
- tool.setProperties(getToolProperties());
- return tool;
- }
- }
-«ENDDEFINE»
-
-«DEFINE linkToolEntry FOR OclAny»
- «EXPAND xpt::Common::generatedClassComment»
- private static class LinkToolEntry extends org.eclipse.gef.palette.ToolEntry {
-
- «EXPAND xpt::Common::generatedMemberComment»
- private final java.util.List relationshipTypes;
-
- «EXPAND xpt::Common::generatedMemberComment»
- private LinkToolEntry(String title, String description, java.util.List relationshipTypes) {
- super(title, description, null, null);
- this.relationshipTypes = relationshipTypes;
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- public org.eclipse.gef.Tool createTool() {
- org.eclipse.gef.Tool tool = new org.eclipse.gmf.runtime.diagram.ui.tools.UnspecifiedTypeConnectionTool(relationshipTypes);
- tool.setProperties(getToolProperties());
- return tool;
- }
- }
-«ENDDEFINE»
-
-«DEFINE setIdentity(toolVarName : String) FOR gmfgen::EntryBase-»
-«IF id <> null and id.size() != 0-»
- «toolVarName».setId(«id»);«IF id.isQuoted('\"')»«EXPAND xpt::Common::nonNLS»«ENDIF»
-«ENDIF-»
-«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/palette/Utils.qvto b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/palette/Utils.qvto
deleted file mode 100644
index b7f133e41..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/palette/Utils.qvto
+++ /dev/null
@@ -1,49 +0,0 @@
-import xpt.StringOperations;
-
-modeltype genModel uses "http://www.eclipse.org/gmf/2008/GenModel";
-
-library Utils;
-
-helper genModel::Palette::activatorFQN() : String {
- return self.diagram.editorGen.plugin.getActivatorQualifiedClassName()
-}
-
-helper genModel::AbstractToolEntry::activatorFQN() : String {
- return self.group.palette.activatorFQN()
-}
-
-helper genModel::ToolGroup::activatorFQN() : String {
- return self.palette.activatorFQN()
-}
-
-helper i18nKey(group : genModel::EntryBase) : String {
- return let rv = group.createMethodName in (if rv.xpandStartsWith('get') then rv.xpandSubstring(3) else (if rv.xpandStartsWith('create') then rv.xpandSubstring(6) else rv endif) endif)
-}
-
-helper i18nTitleKey(group : genModel::EntryBase) : String {
- return i18nKey(group) + '_title'
-}
-
-helper i18nDescKey(group : genModel::EntryBase) : String {
- return i18nKey(group) + '_desc'
-}
-
-helper collectGroups(palette : genModel::Palette) : Sequence(genModel::ToolGroup) {
- return palette.groups->asSequence()->union(palette.groups->collect(it | collectSubGroups(it)))->asOrderedSet()->asSequence()
-}
-
-helper collectSubGroups(group : genModel::ToolGroup) : Sequence(genModel::ToolGroup) {
- return let rv = (group.entries)[genModel::ToolGroup] in rv->union(rv->collect(g | collectSubGroups(g))->flatten()->asSet())->asSequence()
-}
-
-helper collectTools(palette : genModel::Palette) : Sequence(genModel::AbstractToolEntry) {
- return collectGroups(palette)->collect(g | (g.entries)[genModel::AbstractToolEntry])->flatten()
-}
-
-helper needsNodeToolEntryClass(palette : genModel::Palette) : Boolean {
- return (collectTools(palette))[genModel::ToolEntry]->exists(e | not e.genNodes->isEmpty())
-}
-
-helper needsLinkToolEntryClass(palette : genModel::Palette) : Boolean {
- return (collectTools(palette))[genModel::ToolEntry]->exists(e | not e.genLinks->isEmpty())
-}
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/shortcut.gif b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/shortcut.gif
deleted file mode 100644
index c8ebb3156..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/shortcut.gif
+++ /dev/null
Binary files differ
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/wizban.gif b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/wizban.gif
deleted file mode 100644
index cc3848e15..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/wizban.gif
+++ /dev/null
Binary files differ
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/expressions/AbstractExpression.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/expressions/AbstractExpression.xpt
deleted file mode 100644
index 47f7a0866..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/expressions/AbstractExpression.xpt
+++ /dev/null
@@ -1,145 +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 AbstractExpression FOR gmfgen::GenDiagram-»
-«EXPAND xpt::Common::copyright FOR editorGen-»
-package «editorGen.expressionProviders.expressionsPackageName»;
-
-«EXPAND xpt::Common::generatedClassComment»
-public abstract class «editorGen.expressionProviders.abstractExpressionClassName» «EXPAND supertypes»{
-
-«EXPAND status-»
-
-«EXPAND body-»
-
-«EXPAND context-»
-
-«EXPAND ctors-»
-
-«EXPAND evaluate-»
-
-«EXPAND performCast-»
-
-«EXPAND additions-»
-}
-«ENDDEFINE»
-
-«DEFINE supertypes FOR gmfgen::GenDiagram»«ENDDEFINE»
-«DEFINE additions FOR gmfgen::GenDiagram»«ENDDEFINE»
-
-«DEFINE status FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
- private org.eclipse.core.runtime.IStatus status = org.eclipse.core.runtime.Status.OK_STATUS;
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected void setStatus(int severity, String message, Throwable throwable) {
- String pluginID = «editorGen.plugin.getActivatorQualifiedClassName()».ID;
- this.status = new org.eclipse.core.runtime.Status(severity, pluginID, -1, (message != null) ? message : "", throwable);«EXPAND xpt::Common::nonNLS»
- if(!this.status.isOK()) {
- «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().logError("Expression problem:" + message + "body:"+ body(), throwable);«EXPAND xpt::Common::nonNLS»«EXPAND xpt::Common::nonNLS(2)»
- }
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- public org.eclipse.core.runtime.IStatus getStatus() {
- return status;
- }
-«ENDDEFINE»
-
-«DEFINE body FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
- private final String myBody;
-
- «EXPAND xpt::Common::generatedMemberComment»
- public String body() {
- return myBody;
- }
-«ENDDEFINE»
-
-«DEFINE context FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
- private final org.eclipse.emf.ecore.EClassifier myContext;
-
- «EXPAND xpt::Common::generatedMemberComment»
- public org.eclipse.emf.ecore.EClassifier context() {
- return myContext;
- }
-«ENDDEFINE»
-
-«DEFINE ctors FOR gmfgen::GenDiagram-»
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected «editorGen.expressionProviders.abstractExpressionClassName»(String body, org.eclipse.emf.ecore.EClassifier context) {
- myBody = body;
- myContext = context;
- }
-«ENDDEFINE»
-
-«DEFINE evaluate FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected abstract Object doEvaluate(Object context, java.util.Map env);
-
- «EXPAND xpt::Common::generatedMemberComment»
- public Object evaluate(Object context) {
- return evaluate(context, java.util.Collections.EMPTY_MAP);
- }
-
-«EXPAND xpt::Common::generatedMemberComment»
- public Object evaluate(Object context, java.util.Map env) {
- if(context().isInstance(context)) {
- try {
- return doEvaluate(context, env);
- } catch(Exception e) {
- «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().logError("Expression evaluation failure: " + body(), e);«EXPAND xpt::Common::nonNLS»
- }
- }
- return null;
- }
-«ENDDEFINE»
-
-«DEFINE performCast FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment('Expression may return number value which is not directly compatible with feature type (e.g. Double when Integer is expected), or EEnumLiteral meta-object when literal instance is expected')»
- public static Object performCast(Object value, org.eclipse.emf.ecore.EDataType targetType) {
- if (targetType instanceof org.eclipse.emf.ecore.EEnum) {
- if (value instanceof org.eclipse.emf.ecore.EEnumLiteral) {
- org.eclipse.emf.ecore.EEnumLiteral literal = (org.eclipse.emf.ecore.EEnumLiteral) value;
- return (literal.getInstance() != null) ? literal.getInstance() : literal;
- }
- }
- if (false == value instanceof Number || targetType == null || targetType.getInstanceClass() == null) {
- return value;
- }
- Class targetClass = targetType.getInstanceClass();
- Number num = (Number) value;
- Class valClass = value.getClass();
- Class targetWrapperClass = targetClass;
- if (targetClass.isPrimitive()) {
- targetWrapperClass = org.eclipse.emf.ecore.util.EcoreUtil.wrapperClassFor(targetClass);
- }
- if (valClass.equals(targetWrapperClass)) {
- return value;
- }
- if (Number.class.isAssignableFrom(targetWrapperClass)) {
- if (targetWrapperClass.equals(Byte.class)) return new Byte(num.byteValue());
- if (targetWrapperClass.equals(Integer.class)) return new Integer(num.intValue());
- if (targetWrapperClass.equals(Short.class)) return new Short(num.shortValue());
- if (targetWrapperClass.equals(Long.class)) return new Long(num.longValue());
- if (targetWrapperClass.equals(java.math.BigInteger.class)) return java.math.BigInteger.valueOf(num.longValue());
- if (targetWrapperClass.equals(Float.class)) return new Float(num.floatValue());
- if (targetWrapperClass.equals(Double.class)) return new Double(num.doubleValue());
- if (targetWrapperClass.equals(java.math.BigDecimal.class)) return new java.math.BigDecimal(num.doubleValue());
- }
- return value;
- }
-«ENDDEFINE»
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/expressions/OCLExpressionFactory.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/expressions/OCLExpressionFactory.xpt
deleted file mode 100644
index 5d96611e0..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/expressions/OCLExpressionFactory.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'»
-
-«DEFINE OCLExpressionFactory FOR gmfgen::GenExpressionInterpreter-»
-«EXPAND xpt::Common::copyright FOR container.editorGen-»
-package «container.expressionsPackageName»;
-
-«EXPAND xpt::Common::generatedClassComment»
-public class «className» {
-
- «EXPAND xpt::Common::generatedMemberComment»
- private «className»() {
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- public static «container.getAbstractExpressionQualifiedClassName()» getExpression(
- String body, org.eclipse.emf.ecore.EClassifier context, java.util.Map environment) {
- return new Expression(body, context, environment);
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- public static «container.getAbstractExpressionQualifiedClassName()» getExpression(
- String body, org.eclipse.emf.ecore.EClassifier context) {
- return getExpression(body, context, java.util.Collections.EMPTY_MAP);
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- private static class Expression extends «container.getAbstractExpressionQualifiedClassName()» {
-
- «EXPAND xpt::Common::generatedMemberComment»
- private java.lang.ref.WeakReference queryRef;
-
- «EXPAND xpt::Common::generatedMemberComment»
- private final org.eclipse.ocl.ecore.OCL oclInstance;
-
- «EXPAND xpt::Common::generatedMemberComment»
- public Expression(String body, org.eclipse.emf.ecore.EClassifier context, java.util.Map environment) {
- super(body, context);
- oclInstance = org.eclipse.ocl.ecore.OCL.newInstance();
- initCustomEnv(oclInstance.getEnvironment(), environment);
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected org.eclipse.ocl.Query getQuery() {
- org.eclipse.ocl.Query oclQuery = null;
- if (this.queryRef != null) {
- oclQuery = (org.eclipse.ocl.Query) this.queryRef.get();
- }
- if (oclQuery == null) {
- org.eclipse.ocl.helper.OCLHelper oclHelper = oclInstance.createOCLHelper();
- oclHelper.setContext(context());
- try {
- org.eclipse.ocl.expressions.OCLExpression oclExpression = oclHelper.createQuery(body());
- oclQuery = oclInstance.createQuery(oclExpression);
- this.queryRef = new java.lang.ref.WeakReference(oclQuery);
- setStatus(org.eclipse.core.runtime.IStatus.OK, null, null);
- } catch (org.eclipse.ocl.ParserException e) {
- setStatus(org.eclipse.core.runtime.IStatus.ERROR, e.getMessage(), e);
- }
- }
- return oclQuery;
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected Object doEvaluate(Object context, java.util.Map env) {
- org.eclipse.ocl.Query oclQuery = getQuery();
- if (oclQuery == null) {
- return null;
- }
- org.eclipse.ocl.EvaluationEnvironment evalEnv = oclQuery.getEvaluationEnvironment();
- // init environment
- for (java.util.Iterator it = env.entrySet().iterator(); it.hasNext();) {
- java.util.Map.Entry nextEntry = (java.util.Map.Entry) it.next();
- evalEnv.replace((String) nextEntry.getKey(), nextEntry.getValue());
- }
- try {
- initExtentMap(context);
- Object result = oclQuery.evaluate(context);
- return (result != oclInstance.getEnvironment().getOCLStandardLibrary().getOclInvalid()) ? result : null;
- } finally {
- evalEnv.clear();
- oclQuery.getExtentMap().clear();
- }
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- private void initExtentMap(Object context) {
- if (!getStatus().isOK() || context == null) {
- return;
- }
- final org.eclipse.ocl.Query queryToInit = getQuery();
- final Object extentContext = context;
- queryToInit.getExtentMap().clear();
- if (queryToInit.queryText() != null
- && queryToInit.queryText().indexOf(org.eclipse.ocl.utilities.PredefinedType.ALL_INSTANCES_NAME) >= 0) {
- org.eclipse.ocl.utilities.AbstractVisitor visitior = new org.eclipse.ocl.utilities.AbstractVisitor() {
-
- private boolean usesAllInstances = false;
-
- public Object visitOperationCallExp(org.eclipse.ocl.expressions.OperationCallExp oc) {
- if (!usesAllInstances) {
- usesAllInstances = org.eclipse.ocl.utilities.PredefinedType.ALL_INSTANCES == oc.getOperationCode();
- if (usesAllInstances) {
- queryToInit.getExtentMap().putAll(
- oclInstance.getEvaluationEnvironment().createExtentMap(extentContext));
- }
- }
- return super.visitOperationCallExp(oc);
- }
- };
- queryToInit.getExpression().accept(visitior);
- }
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- private static void initCustomEnv(org.eclipse.ocl.Environment ecoreEnv, java.util.Map environment) {
- for (java.util.Iterator it = environment.keySet().iterator(); it.hasNext();) {
- String varName = (String) it.next();
- org.eclipse.emf.ecore.EClassifier varType = (org.eclipse.emf.ecore.EClassifier) environment.get(varName);
- ecoreEnv.addElement(varName, createVar(ecoreEnv, varName, varType), false);
- }
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- private static org.eclipse.ocl.expressions.Variable createVar(
- org.eclipse.ocl.Environment ecoreEnv, String name, org.eclipse.emf.ecore.EClassifier type) {
- org.eclipse.ocl.expressions.Variable var = org.eclipse.ocl.ecore.EcoreFactory.eINSTANCE.createVariable();
- var.setName(name);
- var.setType(ecoreEnv.getUMLReflection().getOCLType(type));
- return var;
- }
- }
- «EXPAND additions-»
-}
-«ENDDEFINE»
-
-«DEFINE additions FOR gmfgen::GenExpressionInterpreter»«ENDDEFINE»
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/expressions/RegexpExpressionFactory.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/expressions/RegexpExpressionFactory.xpt
deleted file mode 100644
index 42c3c6f16..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/expressions/RegexpExpressionFactory.xpt
+++ /dev/null
@@ -1,74 +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 RegexpExpressionFactory FOR gmfgen::GenExpressionInterpreter-»
-«EXPAND xpt::Common::copyright FOR container.editorGen-»
-package «container.expressionsPackageName»;
-
-«EXPAND xpt::Common::generatedClassComment»
-public class «className» {
-
- «EXPAND xpt::Common::generatedMemberComment»
- private «className»() {
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- public static «container.getAbstractExpressionQualifiedClassName()» getExpression(
- String body, org.eclipse.emf.ecore.EClassifier context, java.util.Map environment) {
- return new Expression(body, context, environment);
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- public static «container.getAbstractExpressionQualifiedClassName()» getExpression(
- String body, org.eclipse.emf.ecore.EClassifier context) {
- return getExpression(body, context, java.util.Collections.EMPTY_MAP);
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- private static class Expression extends «container.getAbstractExpressionQualifiedClassName()» {
-
- «EXPAND xpt::Common::generatedMemberComment»
- private final java.util.regex.Pattern pattern;
-
- «EXPAND xpt::Common::generatedMemberComment»
- public Expression(String body, org.eclipse.emf.ecore.EClassifier context, java.util.Map environment) {
- super(body, context);
- java.util.regex.Pattern p;
- try {
- p = java.util.regex.Pattern.compile(body);
- } catch (java.util.regex.PatternSyntaxException e) {
- setStatus(org.eclipse.core.runtime.IStatus.ERROR, e.getMessage(), e);
- p = null;
- }
- this.pattern = p;
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- protected Object doEvaluate(Object contextInstance, java.util.Map env) {
- if (pattern == null) {
- return null;
- }
- if (context() instanceof org.eclipse.emf.ecore.EDataType) {
- contextInstance = org.eclipse.emf.ecore.util.EcoreUtil.convertToString(
- (org.eclipse.emf.ecore.EDataType) context(), contextInstance);
- }
- java.util.regex.Matcher matcher = this.pattern.matcher(String.valueOf(contextInstance));
- return Boolean.valueOf(«IF language = gmfgen::GenLanguage::nregexp»!«ENDIF»matcher.matches());
- }
- }
- «EXPAND additions-»
-}
-«ENDDEFINE»
-
-«DEFINE additions FOR gmfgen::GenExpressionInterpreter»«ENDDEFINE»
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/expressions/ValueExpression.qvto b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/expressions/ValueExpression.qvto
deleted file mode 100644
index 15a65f053..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/expressions/ValueExpression.qvto
+++ /dev/null
@@ -1,15 +0,0 @@
-modeltype genModel uses "http://www.eclipse.org/gmf/2008/GenModel";
-
-library ValueExpression;
-
-helper constraintFieldName(cb : genModel::GenCommonBase) : String {
- return cb.getUniqueIdentifier() + '_Constraint'
-}
-
-helper sourceConstraintFieldName(l : genModel::GenLink) : String {
- return l.getUniqueIdentifier() + '_SourceExpression'
-}
-
-helper targetConstraintFieldName(l : genModel::GenLink) : String {
- return l.getUniqueIdentifier() + '_TargetExpression'
-}
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/expressions/getExpression.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/expressions/getExpression.xpt
deleted file mode 100644
index abb1d699a..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/expressions/getExpression.xpt
+++ /dev/null
@@ -1,19 +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'»
-«IMPORT 'http://www.eclipse.org/emf/2002/Ecore'»
-
-«DEFINE getExpression(valueExpr : gmfgen::ValueExpression, context : genmodel::GenClassifier) FOR gmfgen::GenExpressionInterpreter-»
-«getQualifiedClassName()».«getExpressionAccessor(valueExpr)»(«valueExpr.getBodyString()», «EXPAND MetaModel::MetaClass FOR context»)«-»
-«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/navigator/AbstractNavigatorItem.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/navigator/AbstractNavigatorItem.xpt
deleted file mode 100644
index 50511d162..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/navigator/AbstractNavigatorItem.xpt
+++ /dev/null
@@ -1,81 +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 AbstractNavigatorItem FOR gmfgen::GenNavigator-»
- «EXPAND xpt::Common::copyright FOR editorGen-»
-package «packageName»;
-
- «EXPAND xpt::Common::generatedClassComment»
-public abstract class «abstractNavigatorItemClassName» extends org.eclipse.core.runtime.PlatformObject {
-
-«IF null <> editorGen.propertySheet»
- «EXPAND registerAdapterFactory-»
-«ENDIF-»
-
- «EXPAND attributes-»
-
- «EXPAND _constructor-»
-
- «EXPAND getParent-»
-
- «EXPAND additions-»
-}
-«ENDDEFINE»
-
-«DEFINE registerAdapterFactory FOR gmfgen::GenNavigator-»
- «EXPAND xpt::Common::generatedMemberComment»
-static {
- final Class[] supportedTypes = new Class[] { org.eclipse.ui.views.properties.tabbed.ITabbedPropertySheetPageContributor.class };
- final org.eclipse.ui.views.properties.tabbed.ITabbedPropertySheetPageContributor propertySheetPageContributor = new org.eclipse.ui.views.properties.tabbed.ITabbedPropertySheetPageContributor() {
- public String getContributorId() {
- return "«editorGen.plugin.iD»"; «EXPAND xpt::Common::nonNLS»
- }
- };
- org.eclipse.core.runtime.Platform.getAdapterManager().registerAdapters(new org.eclipse.core.runtime.IAdapterFactory() {
-
- public Object getAdapter(Object adaptableObject, Class adapterType) {
- if (adaptableObject instanceof «getAbstractNavigatorItemQualifiedClassName()» && adapterType == org.eclipse.ui.views.properties.tabbed.ITabbedPropertySheetPageContributor.class) {
- return propertySheetPageContributor;
- }
- return null;
- }
-
- public Class[] getAdapterList() {
- return supportedTypes;
- }
- }, «getAbstractNavigatorItemQualifiedClassName()».class);
-}
-«ENDDEFINE»
-
-«DEFINE attributes FOR gmfgen::GenNavigator-»
- «EXPAND xpt::Common::generatedMemberComment»
-private Object myParent;
-«ENDDEFINE»
-
-«DEFINE _constructor FOR gmfgen::GenNavigator-»
- «EXPAND xpt::Common::generatedMemberComment»
-protected «abstractNavigatorItemClassName»(Object parent) {
- myParent = parent;
-}
-«ENDDEFINE»
-
-«DEFINE getParent FOR gmfgen::GenNavigator-»
- «EXPAND xpt::Common::generatedMemberComment»
-public Object getParent() {
- return myParent;
-}
-«ENDDEFINE»
-
-«DEFINE additions FOR gmfgen::GenNavigator-»
-«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/navigator/DomainNavigatorContentProvider.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/navigator/DomainNavigatorContentProvider.xpt
deleted file mode 100644
index df4a887f9..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/navigator/DomainNavigatorContentProvider.xpt
+++ /dev/null
@@ -1,98 +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 DomainNavigatorContentProvider FOR gmfgen::GenNavigator-»
- «EXPAND xpt::Common::copyright FOR editorGen-»
-package «packageName»;
-
- «EXPAND xpt::Common::generatedClassComment»
-public class «domainContentProviderClassName» implements org.eclipse.ui.navigator.ICommonContentProvider {
-
- «EXPAND attributes-»
-
- «EXPAND _constructor-»
-
- «EXPAND xpt::navigator::NavigatorContentProvider::iContentProvider-»
-
- «EXPAND xpt::navigator::NavigatorContentProvider::iStructuredContentProvider-»
-
- «EXPAND xpt::navigator::NavigatorContentProvider::iMementoAware-»
-
- «EXPAND xpt::navigator::NavigatorContentProvider::iCommonContentProvider-»
-
- «EXPAND iTreeContentProvider-»
-
- «EXPAND additions-»
-}
-«ENDDEFINE»
-
-«DEFINE attributes FOR gmfgen::GenNavigator-»
- «EXPAND xpt::Common::generatedMemberComment»
-private org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider myAdapterFctoryContentProvier;
-
- «EXPAND xpt::navigator::NavigatorContentProvider::attributes-»
-«ENDDEFINE»
-
-«DEFINE _constructor FOR gmfgen::GenNavigator-»
- «EXPAND xpt::Common::generatedMemberComment»
-public «domainContentProviderClassName»() {
- myAdapterFctoryContentProvier = new org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider(«editorGen.plugin.getActivatorQualifiedClassName()».getInstance().getItemProvidersAdapterFactory());
- «EXPAND xpt::navigator::NavigatorContentProvider::initCommonAttributes-»
-}
-«ENDDEFINE»
-
-«DEFINE iTreeContentProvider FOR gmfgen::GenNavigator-»
- «EXPAND getChildren-»
-
- «EXPAND wrapEObjects-»
-
- «EXPAND xpt::navigator::NavigatorContentProvider::getParent-»
-
- «EXPAND xpt::navigator::NavigatorContentProvider::hasChildren-»
-«ENDDEFINE»
-
-«DEFINE getChildren FOR gmfgen::GenNavigator-»
- «EXPAND xpt::Common::generatedMemberComment»
-public Object[] getChildren(Object parentElement) {
- if (parentElement instanceof org.eclipse.core.resources.IFile) {
- «EXPAND xpt::navigator::NavigatorContentProvider::getFileResoruce-»
- return wrapEObjects(myAdapterFctoryContentProvier.getChildren(resource), parentElement);
- }
-
- if (parentElement instanceof «getDomainNavigatorItemQualifiedClassName()») {
- return wrapEObjects(myAdapterFctoryContentProvier.getChildren(((«getDomainNavigatorItemQualifiedClassName()») parentElement).getEObject()), parentElement);
- }
- «EXPAND getOtherChildren-»
-}
-«ENDDEFINE»
-
-«DEFINE getOtherChildren FOR gmfgen::GenNavigator-»
-return EMPTY_ARRAY;
-«ENDDEFINE»
-
-«DEFINE wrapEObjects FOR gmfgen::GenNavigator-»
- «EXPAND xpt::Common::generatedMemberComment»
-public Object[] wrapEObjects(Object[] objects, Object parentElement) {
- java.util.Collection result = new java.util.ArrayList();
- for (int i = 0; i < objects.length; i++) {
- if (objects[i] instanceof org.eclipse.emf.ecore.EObject) {
- result.add(new «getDomainNavigatorItemQualifiedClassName()»((org.eclipse.emf.ecore.EObject) objects[i], parentElement, myAdapterFctoryContentProvier));
- }
- }
- return result.toArray();
-}
-«ENDDEFINE»
-
-«DEFINE additions FOR gmfgen::GenNavigator-»
-«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/navigator/DomainNavigatorItem.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/navigator/DomainNavigatorItem.xpt
deleted file mode 100644
index 456459aba..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/navigator/DomainNavigatorItem.xpt
+++ /dev/null
@@ -1,121 +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 DomainNavigatorItem FOR gmfgen::GenNavigator-»
- «EXPAND xpt::Common::copyright FOR editorGen-»
-package «packageName»;
-
- «EXPAND xpt::Common::generatedClassComment»
-public class «domainNavigatorItemClassName» extends org.eclipse.core.runtime.PlatformObject {
-
- «EXPAND registerAdapterFactory-»
-
- «EXPAND xpt::navigator::AbstractNavigatorItem::attributes-»
-
- «EXPAND attributes-»
-
- «EXPAND _constructor-»
-
- «EXPAND xpt::navigator::AbstractNavigatorItem::getParent-»
-
- «EXPAND getEObject-»
-
- «EXPAND getPropertySourceProvider-»
-
- «EXPAND equals-»
-
- «EXPAND hashCode-»
-
- «EXPAND additions-»
-}
-«ENDDEFINE»
-
-«DEFINE registerAdapterFactory FOR gmfgen::GenNavigator-»
- «EXPAND xpt::Common::generatedMemberComment»
-static {
- final Class[] supportedTypes = new Class[] { org.eclipse.emf.ecore.EObject.class, org.eclipse.ui.views.properties.IPropertySource.class };
- org.eclipse.core.runtime.Platform.getAdapterManager().registerAdapters(new org.eclipse.core.runtime.IAdapterFactory() {
-
- public Object getAdapter(Object adaptableObject, Class adapterType) {
- if (adaptableObject instanceof «getDomainNavigatorItemQualifiedClassName()») {
- «getDomainNavigatorItemQualifiedClassName()» domainNavigatorItem = («getDomainNavigatorItemQualifiedClassName()») adaptableObject;
- org.eclipse.emf.ecore.EObject eObject = domainNavigatorItem.getEObject();
- if (adapterType == org.eclipse.emf.ecore.EObject.class) {
- return eObject;
- }
- if (adapterType == org.eclipse.ui.views.properties.IPropertySource.class) {
- return domainNavigatorItem.getPropertySourceProvider().getPropertySource(eObject);
- }
- }
-
- return null;
- }
-
- public Class[] getAdapterList() {
- return supportedTypes;
- }
- }, «getDomainNavigatorItemQualifiedClassName()».class);
-}
-«ENDDEFINE»
-
-«DEFINE attributes FOR gmfgen::GenNavigator-»
- «EXPAND xpt::Common::generatedMemberComment»
-private org.eclipse.emf.ecore.EObject myEObject;
-
- «EXPAND xpt::Common::generatedMemberComment»
-private org.eclipse.ui.views.properties.IPropertySourceProvider myPropertySourceProvider;
-«ENDDEFINE»
-
-«DEFINE _constructor FOR gmfgen::GenNavigator-»
- «EXPAND xpt::Common::generatedMemberComment»
-public «domainNavigatorItemClassName»(org.eclipse.emf.ecore.EObject eObject, Object parent, org.eclipse.ui.views.properties.IPropertySourceProvider propertySourceProvider) {
- myParent = parent;
- myEObject = eObject;
- myPropertySourceProvider = propertySourceProvider;
-}
-«ENDDEFINE»
-
-«DEFINE getEObject FOR gmfgen::GenNavigator-»
- «EXPAND xpt::Common::generatedMemberComment»
-public org.eclipse.emf.ecore.EObject getEObject() {
- return myEObject;
-}
-«ENDDEFINE»
-
-«DEFINE getPropertySourceProvider FOR gmfgen::GenNavigator-»
- «EXPAND xpt::Common::generatedMemberComment»
-public org.eclipse.ui.views.properties.IPropertySourceProvider getPropertySourceProvider() {
- return myPropertySourceProvider;
-}
-«ENDDEFINE»
-
-«DEFINE equals FOR gmfgen::GenNavigator-»
- «EXPAND xpt::Common::generatedMemberComment»
-public boolean equals(Object obj) {
- if (obj instanceof «getDomainNavigatorItemQualifiedClassName()») {
- return org.eclipse.emf.ecore.util.EcoreUtil.getURI(getEObject()).equals(org.eclipse.emf.ecore.util.EcoreUtil.getURI(((«getDomainNavigatorItemQualifiedClassName()») obj).getEObject()));
- }
- return super.equals(obj);
-}
-«ENDDEFINE»
-
-«DEFINE hashCode FOR gmfgen::GenNavigator-»
- «EXPAND xpt::Common::generatedMemberComment»
-public int hashCode() {
- return org.eclipse.emf.ecore.util.EcoreUtil.getURI(getEObject()).hashCode();
-}
-«ENDDEFINE»
-
-«DEFINE additions FOR gmfgen::GenNavigator-»
-«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/navigator/DomainNavigatorLabelProvider.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/navigator/DomainNavigatorLabelProvider.xpt
deleted file mode 100644
index 325c52700..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/navigator/DomainNavigatorLabelProvider.xpt
+++ /dev/null
@@ -1,123 +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 DomainNavigatorLabelProvider FOR gmfgen::GenNavigator-»
- «EXPAND xpt::Common::copyright FOR editorGen-»
-package «packageName»;
-
- «EXPAND xpt::Common::generatedClassComment»
-public class «domainLabelProviderClassName» implements org.eclipse.ui.navigator.ICommonLabelProvider {
-
- «EXPAND attributes-»
-
- «EXPAND iCommonLabelProvider-»
-
- «EXPAND iLabelProvider-»
-
- «EXPAND iBaseLabelProvider-»
-
- «EXPAND xpt::navigator::NavigatorContentProvider::iMementoAware-»
-
- «EXPAND iDescriptionProvider-»
-
- «EXPAND additions-»
-}
-«ENDDEFINE»
-
-«DEFINE attributes FOR gmfgen::GenNavigator-»
- «EXPAND xpt::Common::generatedMemberComment»
-private org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider myAdapterFactoryLabelProvider = new org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider(«editorGen.plugin.getActivatorQualifiedClassName()».getInstance().getItemProvidersAdapterFactory());
-«ENDDEFINE»
-
-«DEFINE iCommonLabelProvider FOR gmfgen::GenNavigator-»
- «EXPAND xpt::Common::generatedMemberComment»
-public void init(org.eclipse.ui.navigator.ICommonContentExtensionSite aConfig) {
-}
-«ENDDEFINE»
-
-«DEFINE iLabelProvider FOR gmfgen::GenNavigator-»
- «EXPAND getImage-»
-
- «EXPAND getText-»
-«ENDDEFINE»
-
-«DEFINE iBaseLabelProvider FOR gmfgen::GenNavigator-»
- «EXPAND addListener-»
-
- «EXPAND dispose-»
-
- «EXPAND isLabelProperty-»
-
- «EXPAND removeListener-»
-«ENDDEFINE»
-
-«DEFINE iDescriptionProvider FOR gmfgen::GenNavigator-»
- «EXPAND xpt::Common::generatedMemberComment»
-public String getDescription(Object anElement) {
- return null;
-}
-«ENDDEFINE»
-
-«DEFINE addListener FOR gmfgen::GenNavigator-»
- «EXPAND xpt::Common::generatedMemberComment»
-public void addListener(org.eclipse.jface.viewers.ILabelProviderListener listener) {
- myAdapterFactoryLabelProvider.addListener(listener);
-}
-«ENDDEFINE»
-
-«DEFINE dispose FOR gmfgen::GenNavigator-»
- «EXPAND xpt::Common::generatedMemberComment»
-public void dispose() {
- myAdapterFactoryLabelProvider.dispose();
-}
-«ENDDEFINE»
-
-«DEFINE isLabelProperty FOR gmfgen::GenNavigator-»
- «EXPAND xpt::Common::generatedMemberComment»
-public boolean isLabelProperty(Object element, String property) {
- return myAdapterFactoryLabelProvider.isLabelProperty(element, property);
-}
-«ENDDEFINE»
-
-«DEFINE removeListener FOR gmfgen::GenNavigator-»
- «EXPAND xpt::Common::generatedMemberComment»
-public void removeListener(org.eclipse.jface.viewers.ILabelProviderListener listener) {
- myAdapterFactoryLabelProvider.removeListener(listener);
-}
-«ENDDEFINE»
-
-«DEFINE getImage FOR gmfgen::GenNavigator-»
- «EXPAND xpt::Common::generatedMemberComment»
-public org.eclipse.swt.graphics.Image getImage(Object element) {
- if (element instanceof «getDomainNavigatorItemQualifiedClassName()») {
- return myAdapterFactoryLabelProvider.getImage(«EXPAND getEObject»);
- }
- return null;
-}
-«ENDDEFINE»
-
-«DEFINE getEObject FOR gmfgen::GenNavigator»((«getDomainNavigatorItemQualifiedClassName()») element).getEObject()«ENDDEFINE»
-
-«DEFINE getText FOR gmfgen::GenNavigator-»
- «EXPAND xpt::Common::generatedMemberComment»
-public String getText(Object element) {
- if (element instanceof «getDomainNavigatorItemQualifiedClassName()») {
- return myAdapterFactoryLabelProvider.getText(«EXPAND getEObject»);
- }
- return null;
-}
-«ENDDEFINE»
-
-«DEFINE additions FOR gmfgen::GenNavigator-»
-«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/navigator/NavigatorActionProvider.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/navigator/NavigatorActionProvider.xpt
deleted file mode 100644
index 0a2bc7993..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/navigator/NavigatorActionProvider.xpt
+++ /dev/null
@@ -1,206 +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'»
-«EXTENSION xpt::navigator::Utils»
-
-«DEFINE NavigatorActionProvider FOR gmfgen::GenNavigator-»
- «EXPAND xpt::Common::copyright FOR editorGen-»
-package «packageName»;
-
- «EXPAND xpt::Common::generatedClassComment»
-public class «actionProviderClassName» extends org.eclipse.ui.navigator.CommonActionProvider {
-
- «EXPAND attributes-»
-
- «EXPAND _init-»
-
- «EXPAND makeActions-»
-
- «EXPAND fillActionBars-»
-
- «EXPAND fillContextMenu-»
-
- «EXPAND OpenDiagramAction-»
-
- «EXPAND additions-»
-}
-«ENDDEFINE»
-
-«DEFINE attributes FOR gmfgen::GenNavigator-»
- «EXPAND xpt::Common::generatedMemberComment»
-private boolean myContribute;
-
- «EXPAND xpt::Common::generatedMemberComment»
-private OpenDiagramAction myOpenDiagramAction;
-«ENDDEFINE»
-
-«DEFINE _init FOR gmfgen::GenNavigator-»
- «EXPAND xpt::Common::generatedMemberComment»
-public void init(org.eclipse.ui.navigator.ICommonActionExtensionSite aSite) {
- super.init(aSite);
- if (aSite.getViewSite() instanceof org.eclipse.ui.navigator.ICommonViewerWorkbenchSite) {
- myContribute = true;
- makeActions((org.eclipse.ui.navigator.ICommonViewerWorkbenchSite) aSite.getViewSite());
- } else {
- myContribute = false;
- }
-}
-«ENDDEFINE»
-
-«DEFINE makeActions FOR gmfgen::GenNavigator-»
- «EXPAND xpt::Common::generatedMemberComment»
-private void makeActions(org.eclipse.ui.navigator.ICommonViewerWorkbenchSite viewerSite) {
- myOpenDiagramAction = new OpenDiagramAction(viewerSite);
-}
-«ENDDEFINE»
-
-«DEFINE fillActionBars FOR gmfgen::GenNavigator-»
- «EXPAND xpt::Common::generatedMemberComment»
-public void fillActionBars(org.eclipse.ui.IActionBars actionBars) {
- if (!myContribute) {
- return;
- }
- org.eclipse.jface.viewers.IStructuredSelection selection = (org.eclipse.jface.viewers.IStructuredSelection) getContext().getSelection();
- myOpenDiagramAction.selectionChanged(selection);
- if (myOpenDiagramAction.isEnabled()) {
- actionBars.setGlobalActionHandler(org.eclipse.ui.navigator.ICommonActionConstants.OPEN, myOpenDiagramAction);
- }
-}
-«ENDDEFINE»
-
-«DEFINE fillContextMenu FOR gmfgen::GenNavigator-»
- «EXPAND xpt::Common::generatedMemberComment»
-public void fillContextMenu(org.eclipse.jface.action.IMenuManager menu) {
-«REM»
-/*
- * Put following code into the template to generate popup menu
- *
- if (!myContribute || getContext().getSelection().isEmpty()) {
- return;
- }
-
- org.eclipse.jface.viewers.IStructuredSelection selection = (org.eclipse.jface.viewers.IStructuredSelection) getContext().getSelection();
-
- myOpenDiagramAction.selectionChanged(selection);
- if (myOpenDiagramAction.isEnabled()) {
- menu.insertAfter(org.eclipse.ui.navigator.ICommonMenuConstants.GROUP_OPEN, myOpenDiagramAction);
- }*/
-«ENDREM»«-»
-}
-«ENDDEFINE»
-
-«DEFINE OpenDiagramAction FOR gmfgen::GenNavigator-»
- «EXPAND xpt::Common::generatedClassComment»
-private class OpenDiagramAction extends org.eclipse.jface.action.Action {
-
- «EXPAND ODA_attributes-»
-
- «EXPAND ODA_constructor-»
-
- «EXPAND ODA_selectionChanged-»
-
- «EXPAND ODA_run-»
-
- «EXPAND ODA_getEditorInput-»
-
- «EXPAND ODA_additions-»
-}
-«ENDDEFINE»
-
-«DEFINE ODA_attributes FOR gmfgen::GenNavigator-»
- «EXPAND xpt::Common::generatedMemberComment»
-private org.eclipse.gmf.runtime.notation.Diagram myDiagram;
-
- «EXPAND xpt::Common::generatedMemberComment»
-private org.eclipse.ui.navigator.ICommonViewerWorkbenchSite myViewerSite;
-«ENDDEFINE»
-
-«DEFINE ODA_constructor FOR gmfgen::GenNavigator-»
- «EXPAND xpt::Common::generatedMemberComment»
-public OpenDiagramAction(org.eclipse.ui.navigator.ICommonViewerWorkbenchSite viewerSite) {
- super(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForOpenDiagramActionName()) FOR editorGen»);
- myViewerSite = viewerSite;
-}
-«ENDDEFINE»
-
-«DEFINE ODA_selectionChanged FOR gmfgen::GenNavigator-»
- «EXPAND xpt::Common::generatedMemberComment»
-public final void selectionChanged(org.eclipse.jface.viewers.IStructuredSelection selection) {
- myDiagram = null;
- if (selection.size() == 1) {
- Object selectedElement = selection.getFirstElement();
- if (selectedElement instanceof «getNavigatorItemQualifiedClassName()») {
- selectedElement = ((«getNavigatorItemQualifiedClassName()») selectedElement).getView();
- } else if (selectedElement instanceof org.eclipse.core.runtime.IAdaptable) {
- selectedElement = ((org.eclipse.core.runtime.IAdaptable) selectedElement).getAdapter(org.eclipse.gmf.runtime.notation.View.class);
- }
- if (selectedElement instanceof org.eclipse.gmf.runtime.notation.Diagram) {
- org.eclipse.gmf.runtime.notation.Diagram diagram = (org.eclipse.gmf.runtime.notation.Diagram) selectedElement;
- if («EXPAND xpt::editor::VisualIDRegistry::modelID FOR editorGen.diagram».equals(«EXPAND xpt::editor::VisualIDRegistry::getModelIDMethodCall FOR editorGen.diagram»(diagram))) {
- myDiagram = diagram;
- }
- }
- }
- setEnabled(myDiagram != null);
-}
-«ENDDEFINE»
-
-«DEFINE ODA_run FOR gmfgen::GenNavigator-»
- «EXPAND xpt::Common::generatedMemberComment»
-public void run() {
- if (myDiagram == null || myDiagram.eResource() == null) {
- return;
- }
-
- org.eclipse.ui.IEditorInput editorInput = getEditorInput();
- org.eclipse.ui.IWorkbenchPage page = myViewerSite.getPage();
- try {
- page.openEditor(editorInput, «editorGen.editor.getQualifiedClassName()».ID);
- } catch (org.eclipse.ui.PartInitException e) {
- «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().logError("Exception while openning diagram", e); «EXPAND xpt::Common::nonNLS»
- }
-}
-«ENDDEFINE»
-
-«DEFINE ODA_getEditorInput FOR gmfgen::GenNavigator-»
- «EXPAND xpt::Common::generatedMemberComment»
-private org.eclipse.ui.IEditorInput getEditorInput() {
- «IF null = editorGen.application-»
- for (java.util.Iterator it = myDiagram.eResource().getContents().iterator(); it.hasNext();) {
- org.eclipse.emf.ecore.EObject nextEObject = (org.eclipse.emf.ecore.EObject) it.next();
- if (nextEObject == myDiagram) {
- return new org.eclipse.ui.part.FileEditorInput(org.eclipse.emf.workspace.util.WorkspaceSynchronizer.getFile(myDiagram.eResource()));
- }
- if (nextEObject instanceof org.eclipse.gmf.runtime.notation.Diagram) {
- break;
- }
- }
- «ENDIF-»
- «EXPAND xpt::navigator::getEditorInput::defineURIEditorInput('myDiagram') FOR editorGen.diagram-»
- return editorInput;
-}
-«ENDDEFINE»
-
-«DEFINE ODA_additions FOR gmfgen::GenNavigator-»
-«ENDDEFINE»
-
-«DEFINE additions FOR gmfgen::GenNavigator-»
-«ENDDEFINE»
-
-«DEFINE i18nValues FOR gmfgen::GenNavigator-»
-«EXPAND xpt::Externalizer::messageEntry(i18nKeyForOpenDiagramActionName(), 'Open Diagram')-»
-«ENDDEFINE»
-
-«DEFINE i18nAccessors FOR gmfgen::GenNavigator-»
- «EXPAND xpt::Externalizer::accessorField(i18nKeyForOpenDiagramActionName())-»
-«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/navigator/NavigatorContentProvider.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/navigator/NavigatorContentProvider.xpt
deleted file mode 100644
index 9e8a05070..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/navigator/NavigatorContentProvider.xpt
+++ /dev/null
@@ -1,492 +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'»
-«IMPORT 'http://www.eclipse.org/emf/2002/Ecore'»
-«EXTENSION xpt::navigator::Utils»
-«EXTENSION org::eclipse::gmf::internal::codegen::util::CodeGenerationUtils»
-
-«DEFINE NavigatorContentProvider FOR gmfgen::GenNavigator-»
- «EXPAND xpt::Common::copyright FOR editorGen-»
-package «packageName»;
-
-«EXPAND xpt::Common::generatedClassComment»
-public class «contentProviderClassName» implements org.eclipse.ui.navigator.ICommonContentProvider {
-
- «EXPAND attributes-»
-
- «EXPAND _constructor-»
-
- «EXPAND iContentProvider-»
-
- «EXPAND iStructuredContentProvider-»
-
- «EXPAND iMementoAware-»
-
- «EXPAND iCommonContentProvider-»
-
- «EXPAND iTreeContentProvider-»
-
- «EXPAND additions-»
-}
-«ENDDEFINE»
-
-«DEFINE attributes FOR gmfgen::GenNavigator-»
- «EXPAND xpt::Common::generatedMemberComment»
-private static final Object[] EMPTY_ARRAY = new Object[0];
-
- «EXPAND xpt::Common::generatedMemberComment»
-private org.eclipse.jface.viewers.Viewer myViewer;
-
- «EXPAND xpt::Common::generatedMemberComment»
-private org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain myEditingDomain;
-
- «EXPAND xpt::Common::generatedMemberComment»
-private org.eclipse.emf.workspace.util.WorkspaceSynchronizer myWorkspaceSynchronizer;
-
- «EXPAND xpt::Common::generatedMemberComment»
-private Runnable myViewerRefreshRunnable;
-«ENDDEFINE»
-
-«DEFINE _constructor FOR gmfgen::GenNavigator-»
- «EXPAND xpt::Common::generatedMemberComment»
-public «contentProviderClassName»() {
- «EXPAND initCommonAttributes-»
-}
-«ENDDEFINE»
-
-«DEFINE initCommonAttributes FOR gmfgen::GenNavigator-»
-org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain = «EXPAND createEditingDomain»;
-myEditingDomain = (org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain) editingDomain;
-myEditingDomain.setResourceToReadOnlyMap(new java.util.HashMap() {
- public Object get(Object key) {
- if (!containsKey(key)) {
- put(key, Boolean.TRUE);
- }
- return super.get(key);
- }
-});
-myViewerRefreshRunnable = new Runnable() {
- public void run() {
- if (myViewer != null) {
- myViewer.refresh();
- }
- }
-};
-myWorkspaceSynchronizer = new org.eclipse.emf.workspace.util.WorkspaceSynchronizer(editingDomain, new org.eclipse.emf.workspace.util.WorkspaceSynchronizer.Delegate() {
- public void dispose() {
- }
-
- public boolean handleResourceChanged(final org.eclipse.emf.ecore.resource.Resource resource) {
- «EXPAND processChanges-»
- }
-
- public boolean handleResourceDeleted(org.eclipse.emf.ecore.resource.Resource resource) {
- «EXPAND processChanges-»
- }
-
- public boolean handleResourceMoved(org.eclipse.emf.ecore.resource.Resource resource, final org.eclipse.emf.common.util.URI newURI) {
- «EXPAND processChanges-»
- }
-});
-«ENDDEFINE»
-
-«DEFINE processChanges FOR gmfgen::GenNavigator-»
-for (java.util.Iterator it = myEditingDomain.getResourceSet().getResources().iterator(); it.hasNext();) {
- org.eclipse.emf.ecore.resource.Resource nextResource = (org.eclipse.emf.ecore.resource.Resource) it.next();
- nextResource.unload();
-}
-if (myViewer != null) {
- myViewer.getControl().getDisplay().asyncExec(myViewerRefreshRunnable);
-}
-return true;
-«ENDDEFINE»
-
-«DEFINE iContentProvider FOR gmfgen::GenNavigator-»
- «EXPAND dispose-»
-
- «EXPAND inputChanged-»
-«ENDDEFINE»
-
-«DEFINE dispose FOR gmfgen::GenNavigator-»
- «EXPAND xpt::Common::generatedMemberComment»
-public void dispose() {
- myWorkspaceSynchronizer.dispose();
- myWorkspaceSynchronizer = null;
- myViewerRefreshRunnable = null;
- for (java.util.Iterator it = myEditingDomain.getResourceSet().getResources().iterator(); it.hasNext();) {
- org.eclipse.emf.ecore.resource.Resource resource = (org.eclipse.emf.ecore.resource.Resource) it.next();
- resource.unload();
- }
- ((org.eclipse.emf.transaction.TransactionalEditingDomain) myEditingDomain).dispose();
- myEditingDomain = null;
-}
-«ENDDEFINE»
-
-«DEFINE inputChanged FOR gmfgen::GenNavigator-»
- «EXPAND xpt::Common::generatedMemberComment»
-public void inputChanged(org.eclipse.jface.viewers.Viewer viewer, Object oldInput, Object newInput) {
- myViewer = viewer;
-}
-«ENDDEFINE»
-
-«DEFINE iStructuredContentProvider FOR gmfgen::GenNavigator-»
-«EXPAND xpt::Common::generatedMemberComment»
-public Object[] getElements(Object inputElement) {
- return getChildren(inputElement);
-}
-«ENDDEFINE»
-
-«DEFINE iMementoAware FOR gmfgen::GenNavigator-»
-«EXPAND xpt::Common::generatedMemberComment»
-public void restoreState(org.eclipse.ui.IMemento aMemento) {
-}
-
-«EXPAND xpt::Common::generatedMemberComment»
-public void saveState(org.eclipse.ui.IMemento aMemento) {
-}
-«ENDDEFINE»
-
-«DEFINE iCommonContentProvider FOR gmfgen::GenNavigator-»
-«EXPAND xpt::Common::generatedMemberComment»
-public void init(org.eclipse.ui.navigator.ICommonContentExtensionSite aConfig) {
-}
-«ENDDEFINE»
-
-«DEFINE iTreeContentProvider FOR gmfgen::GenNavigator-»
- «EXPAND getChildren-»
-
- «EXPAND getParent-»
-
- «EXPAND hasChildren-»
-«ENDDEFINE»
-
-«DEFINE getChildren FOR gmfgen::GenNavigator-»
-«EXPAND xpt::Common::generatedMemberComment»
-public Object[] getChildren(Object parentElement) {
- if (parentElement instanceof org.eclipse.core.resources.IFile) {
- «EXPAND getFileChildren-»
- }
-
- if (parentElement instanceof «getNavigatorGroupQualifiedClassName()») {
- «EXPAND getGroupChildren-»
- }
-
- if (parentElement instanceof «getNavigatorItemQualifiedClassName()») {
- «EXPAND getItemChildren-»
- }
-
- «IF editorGen.diagram.generateShortcutIcon()-»
- «EXPAND getAdaptableChildren»
- «ENDIF-»
- «EXPAND getOtherChildren-»
-}
-
- «EXPAND getViewChildren-»
-
- «EXPAND utilityMethods-»
-«ENDDEFINE»
-
-«DEFINE getParent FOR gmfgen::GenNavigator-»
-«EXPAND xpt::Common::generatedMemberComment»
-public Object getParent(Object element) {
- if (element instanceof «getAbstractNavigatorItemQualifiedClassName()») {
- «getAbstractNavigatorItemQualifiedClassName()» abstractNavigatorItem = («getAbstractNavigatorItemQualifiedClassName()») element;
- return abstractNavigatorItem.getParent();
- }
- return null;
-}
-«ENDDEFINE»
-
-«DEFINE hasChildren FOR gmfgen::GenNavigator-»
-«EXPAND xpt::Common::generatedMemberComment»
-public boolean hasChildren(Object element) {
- return element instanceof org.eclipse.core.resources.IFile || getChildren(element).length > 0;
-}
-«ENDDEFINE»
-
-«DEFINE getFileChildren FOR gmfgen::GenNavigator-»
- «EXPAND getFileResoruce-»
-java.util.Collection result = new java.util.ArrayList();
- «LET getChildReferencesFrom(self, null) AS _references-»
- «EXPAND initGroupVariables(self, _references, 'file', null) FOREACH getGroupNames(_references)-»
- «FOREACH _references AS ref-»
- «EXPAND addNavigatorItemsPrefix FOR ref»selectViewsByType(resource.getContents(), «EXPAND getChildViewType FOR ref.child»)«EXPAND addNavigatorItemsSuffix('file', false) FOR ref-»
- «ENDFOREACH-»
- «EXPAND addGroups(_references) FOREACH getGroupNames(_references)-»
- «ENDLET-»
-return result.toArray();
-«ENDDEFINE»
-
-«DEFINE getFileResoruce FOR gmfgen::GenNavigator-»
-org.eclipse.core.resources.IFile file = (org.eclipse.core.resources.IFile) parentElement;
-org.eclipse.emf.common.util.URI fileURI = org.eclipse.emf.common.util.URI.createPlatformResourceURI(file.getFullPath().toString(), true);
-org.eclipse.emf.ecore.resource.Resource resource = myEditingDomain.getResourceSet().getResource(fileURI, true);
-«ENDDEFINE»
-
-«DEFINE getGroupChildren FOR gmfgen::GenNavigator-»
-«getNavigatorGroupQualifiedClassName()» group = («getNavigatorGroupQualifiedClassName()») parentElement;
-return group.getChildren();
-«ENDDEFINE»
-
-«DEFINE getItemChildren FOR gmfgen::GenNavigator-»
-«getNavigatorItemQualifiedClassName()» navigatorItem = («getNavigatorItemQualifiedClassName()») parentElement;
-if (navigatorItem.isLeaf() || !isOwnView(navigatorItem.getView())) {
- return EMPTY_ARRAY;
-}
-return getViewChildren(navigatorItem.getView(), parentElement);
-«ENDDEFINE»
-
-«DEFINE getAdaptableChildren FOR gmfgen::GenNavigator-»
-/*
- * Due to plugin.xml restrictions this code will be called only for views representing
- * shortcuts to this diagram elements created on other diagrams.
-*/
-if (parentElement instanceof org.eclipse.core.runtime.IAdaptable) {
- org.eclipse.gmf.runtime.notation.View view = (org.eclipse.gmf.runtime.notation.View) ((org.eclipse.core.runtime.IAdaptable) parentElement).getAdapter(org.eclipse.gmf.runtime.notation.View.class);
- if (view != null) {
- return getViewChildren(view, parentElement);
- }
-}
-«ENDDEFINE»
-
-«DEFINE getOtherChildren FOR gmfgen::GenNavigator-»
-return EMPTY_ARRAY;
-«ENDDEFINE»
-
-«DEFINE getViewChildren FOR gmfgen::GenNavigator-»
-«EXPAND xpt::Common::generatedMemberComment»
-private Object[] getViewChildren(org.eclipse.gmf.runtime.notation.View view, Object parentElement) {
- switch («EXPAND xpt::editor::VisualIDRegistry::getVisualIDMethodCall FOR editorGen.diagram»(view)) {
- «EXPAND caseNavigatorNode(self) FOREACH getNavigatorContainerNodes(self)-»
- }
- return EMPTY_ARRAY;
-}
-«ENDDEFINE»
-
-«DEFINE utilityMethods FOR gmfgen::GenNavigator-»
-«EXPAND xpt::Common::generatedMemberComment»
-private java.util.Collection getLinksSourceByType(java.util.Collection edges, String type) {
- java.util.Collection result = new java.util.ArrayList();
- for (java.util.Iterator it = edges.iterator(); it.hasNext();) {
- org.eclipse.gmf.runtime.notation.Edge nextEdge = (org.eclipse.gmf.runtime.notation.Edge) it.next();
- org.eclipse.gmf.runtime.notation.View nextEdgeSource = nextEdge.getSource();
- if (type.equals(nextEdgeSource.getType()) && isOwnView(nextEdgeSource)) {
- result.add(nextEdgeSource);
- }
- }
- return result;
-}
-
-«EXPAND xpt::Common::generatedMemberComment»
- private java.util.Collection getLinksTargetByType(java.util.Collection edges, String type) {
- java.util.Collection result = new java.util.ArrayList();
- for (java.util.Iterator it = edges.iterator(); it.hasNext();) {
- org.eclipse.gmf.runtime.notation.Edge nextEdge = (org.eclipse.gmf.runtime.notation.Edge) it.next();
- org.eclipse.gmf.runtime.notation.View nextEdgeTarget = nextEdge.getTarget();
- if (type.equals(nextEdgeTarget.getType()) && isOwnView(nextEdgeTarget)) {
- result.add(nextEdgeTarget);
- }
- }
- return result;
-}
-
-«EXPAND xpt::Common::generatedMemberComment»
- private java.util.Collection getOutgoingLinksByType(java.util.Collection nodes, String type) {
- java.util.Collection result = new java.util.ArrayList();
- for (java.util.Iterator it = nodes.iterator(); it.hasNext();) {
- org.eclipse.gmf.runtime.notation.View nextNode = (org.eclipse.gmf.runtime.notation.View) it.next();
- result.addAll(selectViewsByType(nextNode.getSourceEdges(), type));
- }
- return result;
-}
-
-«EXPAND xpt::Common::generatedMemberComment»
-private java.util.Collection getIncomingLinksByType(java.util.Collection nodes, String type) {
- java.util.Collection result = new java.util.ArrayList();
- for (java.util.Iterator it = nodes.iterator(); it.hasNext();) {
- org.eclipse.gmf.runtime.notation.View nextNode = (org.eclipse.gmf.runtime.notation.View) it.next();
- result.addAll(selectViewsByType(nextNode.getTargetEdges(), type));
- }
- return result;
-}
-
-«EXPAND xpt::Common::generatedMemberComment»
-private java.util.Collection getChildrenByType(java.util.Collection nodes, String type) {
- java.util.Collection result = new java.util.ArrayList();
- for (java.util.Iterator it = nodes.iterator(); it.hasNext();) {
- org.eclipse.gmf.runtime.notation.View nextNode = (org.eclipse.gmf.runtime.notation.View) it.next();
- result.addAll(selectViewsByType(nextNode.getChildren(), type));
- }
- return result;
-}
-
-«EXPAND xpt::Common::generatedMemberComment»
-private java.util.Collection getDiagramLinksByType(java.util.Collection diagrams, String type) {
- java.util.Collection result = new java.util.ArrayList();
- for (java.util.Iterator it = diagrams.iterator(); it.hasNext();) {
- org.eclipse.gmf.runtime.notation.Diagram nextDiagram = (org.eclipse.gmf.runtime.notation.Diagram) it.next();
- result.addAll(selectViewsByType(nextDiagram.getEdges(), type));
- }
- return result;
-}
-
-«EXPAND xpt::Common::generatedMemberComment»
-private java.util.Collection selectViewsByType(java.util.Collection views, String type) {
- java.util.Collection result = new java.util.ArrayList();
- for (java.util.Iterator it = views.iterator(); it.hasNext();) {
- org.eclipse.gmf.runtime.notation.View nextView = (org.eclipse.gmf.runtime.notation.View) it.next();
- if (type.equals(nextView.getType()) && isOwnView(nextView)) {
- result.add(nextView);
- }
- }
- return result;
-}
-
-«EXPAND xpt::Common::generatedMemberComment»
-private boolean isOwnView(org.eclipse.gmf.runtime.notation.View view) {
- return «EXPAND xpt::editor::VisualIDRegistry::modelID FOR editorGen.diagram».equals(«EXPAND xpt::editor::VisualIDRegistry::getModelIDMethodCall FOR editorGen.diagram»(view));
-}
-
-«EXPAND xpt::Common::generatedMemberComment»
-private java.util.Collection createNavigatorItems(java.util.Collection views, Object parent, boolean isLeafs) {
- java.util.Collection result = new java.util.ArrayList();
- for (java.util.Iterator it = views.iterator(); it.hasNext();) {
- result.add(new «getNavigatorItemQualifiedClassName()»((org.eclipse.gmf.runtime.notation.View) it.next(), parent, isLeafs));
- }
- return result;
-}
-«EXPAND getForeignShortcuts-»
-«ENDDEFINE»
-
-«DEFINE getForeignShortcuts FOR gmfgen::GenNavigator-»
- «IF editorGen.diagram.generateCreateShortcutAction() and getChildReferencesFrom(self, editorGen.diagram)->size() > 0-»
-
-«EXPAND xpt::Common::generatedMemberComment»
-private java.util.Collection getForeignShortcuts(org.eclipse.gmf.runtime.notation.Diagram diagram, Object parent) {
- java.util.Collection result = new java.util.ArrayList();
- for (java.util.Iterator it = diagram.getChildren().iterator(); it.hasNext();) {
- org.eclipse.gmf.runtime.notation.View nextView = (org.eclipse.gmf.runtime.notation.View) it.next();
- if (!isOwnView(nextView) && nextView.getEAnnotation("Shortcut") != null) { «EXPAND xpt::Common::nonNLS»
- result.add(nextView);
- }
- }
- return createNavigatorItems(result, parent, false);
-}
- «ENDIF-»
-«ENDDEFINE»
-
-«DEFINE createEditingDomain FOR gmfgen::GenNavigator»org.eclipse.gmf.runtime.emf.core.GMFEditingDomainFactory.INSTANCE.createEditingDomain()«ENDDEFINE»
-
-«DEFINE initGroupVariables(navigator : gmfgen::GenNavigator, _references : Sequence(gmfgen::GenNavigatorChildReference), parentVarName : String, contextElement : gmfgen::GenCommonBase) FOR String-»
- «navigator.getNavigatorGroupQualifiedClassName()» «validJavaIdentifier(self)» = new «navigator.getNavigatorGroupQualifiedClassName()»(
- «EXPAND xpt::Externalizer::accessorCall(i18nKeyForGroup(self, contextElement)) FOR navigator.editorGen»,
- "«getNavigatorReference(self, _references).groupIcon»", «parentVarName»); «EXPAND xpt::Common::nonNLS»
-«ENDDEFINE»
-
-«DEFINE addNavigatorItemsPrefix FOR gmfgen::GenNavigatorChildReference»«IF isInsideGroup()»«validJavaIdentifier(groupName)».addChildren(«ELSE»result.addAll(«ENDIF»createNavigatorItems(«ENDDEFINE»
-
-«DEFINE addNavigatorItemsSuffix(parentVarName : String, isLeaf : Boolean) FOR gmfgen::GenNavigatorChildReference-»
-, «IF isInsideGroup()»«validJavaIdentifier(groupName)»«ELSE»«parentVarName»«ENDIF», «isLeaf»));
-«ENDDEFINE»
-
-«DEFINE addGroups(_references : Sequence(gmfgen::GenNavigatorChildReference)) FOR String-»
- «LET getNavigatorReference(self, _references) AS ref-»
- «IF ref.hideIfEmpty-»
- if (!«validJavaIdentifier(self)».isEmpty()) {«ENDIF-»
- result.add(«validJavaIdentifier(self)»);
- «IF ref.hideIfEmpty-»
- }«ENDIF-»
- «ENDLET-»
-«ENDDEFINE»
-
-«DEFINE getChildViewType FOR gmfgen::GenDiagram»«EXPAND xpt::editor::VisualIDRegistry::modelID»«ENDDEFINE»
-
-«DEFINE getChildViewType FOR gmfgen::GenCommonBase»«EXPAND xpt::editor::VisualIDRegistry::typeMethodCall»«ENDDEFINE»
-
-«DEFINE caseNavigatorNode(navigator : gmfgen::GenNavigator) FOR gmfgen::GenCommonBase»
-«EXPAND xpt::Common::caseVisualID» {
- java.util.Collection result = new java.util.ArrayList();
- «EXPAND addForeignShortcuts FOR self-»
- «LET getChildReferencesFrom(navigator, self) AS _references-»
- «EXPAND initGroupVariables(navigator, _references, 'parentElement', self) FOREACH getGroupNames(_references)-»
- «FOREACH _references AS reference ITERATOR referencesIterator-»
- «FOREACH reference.findConnectionPaths()->asSequence() AS path ITERATOR pathsIterator-»
- «FOREACH path.segments->asSequence() AS segment ITERATOR segmentsIterator-»
- «IF referencesIterator.isFirstIteration() and (pathsIterator.isFirstIteration() and segmentsIterator.isFirstIteration())»java.util.Collection «ENDIF-»
- connectedViews = «EXPAND childrenMethodName(reference.referenceType, segment) FOR segment._from-»
- («IF segmentsIterator.isFirstIteration()»java.util.Collections.singleton(view)«ELSE»connectedViews«ENDIF-»
- , «EXPAND xpt::editor::VisualIDRegistry::typeMethodCall FOR segment.to»);
- «ENDFOREACH-»
- «EXPAND addNavigatorItemsPrefix FOR reference»connectedViews«EXPAND addNavigatorItemsSuffix('parentElement', reference.referenceType <> gmfgen::GenNavigatorReferenceType::children) FOR reference-»
- «ENDFOREACH-»
- «ENDFOREACH-»
- «EXPAND addGroups(_references) FOREACH getGroupNames(_references)-»
- «ENDLET-»
- return result.toArray();
-}
-«ENDDEFINE»
-
-«DEFINE addForeignShortcuts FOR gmfgen::GenDiagram-»
- «IF generateCreateShortcutAction()-»
-result.addAll(getForeignShortcuts((org.eclipse.gmf.runtime.notation.Diagram) view, parentElement));
- «ENDIF-»
-«ENDDEFINE»
-
-«DEFINE addForeignShortcuts FOR gmfgen::GenCommonBase»«ENDDEFINE»
-
-«DEFINE childrenMethodName(referenceType : gmfgen::GenNavigatorReferenceType, segment : gmfgen::GenNavigatorPathSegment) FOR gmfgen::GenLink-»
- «IF referenceType = gmfgen::GenNavigatorReferenceType::out_target»getLinksTargetByType«ELSE»getLinksSourceByType«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE childrenMethodName(referenceType : gmfgen::GenNavigatorReferenceType, segment : gmfgen::GenNavigatorPathSegment) FOR gmfgen::GenCommonBase-»
- «IF referenceType = gmfgen::GenNavigatorReferenceType::out_target-»
- getOutgoingLinksByType«ELSEIF referenceType = gmfgen::GenNavigatorReferenceType::in_source-»
- getIncomingLinksByType«ELSE-»
- «IF (Sequence { segment._from })[gmfgen::GenDiagram]->size() > 0 and (Sequence { segment.to })[gmfgen::GenLink]->size() > 0-»
- getDiagramLinksByType«ELSE-»
- getChildrenByType«ENDIF-»
- «ENDIF-»
-«ENDDEFINE»
-
-«DEFINE additions FOR gmfgen::GenNavigator-»
-«ENDDEFINE»
-
-«DEFINE i18nAccessors FOR gmfgen::GenNavigator-»
- «LET getChildReferencesFrom(self, null) AS _references-»
- «EXPAND internal_i18nAccessors(null) FOREACH getGroupNames(_references)-»
- «ENDLET-»
- «FOREACH getNavigatorContainerNodes(self) AS contextElement-»
- «LET getChildReferencesFrom(self, contextElement) AS _references-»
- «EXPAND internal_i18nAccessors(contextElement) FOREACH getGroupNames(_references)-»
- «ENDLET-»
- «ENDFOREACH-»
-«ENDDEFINE»
-
-«DEFINE internal_i18nAccessors(contextElement : gmfgen::GenCommonBase) FOR String-»
-«IF null <> self»«EXPAND xpt::Externalizer::accessorField(i18nKeyForGroup(self, contextElement))»«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE i18nValues FOR gmfgen::GenNavigator-»
-«LET getChildReferencesFrom(self, null) AS _references-»
-«EXPAND internal_i18nValues(null) FOREACH getGroupNames(_references)-»
-«ENDLET-»
-«FOREACH getNavigatorContainerNodes(self) AS contextElement-»
-«LET getChildReferencesFrom(self, contextElement) AS _references-»
-«EXPAND internal_i18nValues(contextElement) FOREACH getGroupNames(_references)-»
-«ENDLET-»
-«ENDFOREACH-»
-«ENDDEFINE»
-
-«DEFINE internal_i18nValues(contextElement : gmfgen::GenCommonBase) FOR String-»
-«IF null <> self»«EXPAND xpt::Externalizer::messageEntry(i18nKeyForGroup(self, contextElement), self)»«ENDIF-»
-«ENDDEFINE»
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/navigator/NavigatorGroup.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/navigator/NavigatorGroup.xpt
deleted file mode 100644
index 2a05b29cf..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/navigator/NavigatorGroup.xpt
+++ /dev/null
@@ -1,129 +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 NavigatorGroup FOR gmfgen::GenNavigator-»
- «EXPAND xpt::Common::copyright FOR editorGen-»
-package «packageName»;
-
- «EXPAND xpt::Common::generatedClassComment»
-public class «navigatorGroupClassName» extends «getAbstractNavigatorItemQualifiedClassName()» {
-
- «EXPAND attributes-»
-
- «EXPAND _constructor-»
-
- «EXPAND getGroupName-»
-
- «EXPAND getIcon-»
-
- «EXPAND getChildren-»
-
- «EXPAND addChildren-»
-
- «EXPAND addChild-»
-
- «EXPAND isEmpty-»
-
- «EXPAND equals-»
-
- «EXPAND hashCode-»
-
- «EXPAND additions-»
-}
-«ENDDEFINE»
-
-«DEFINE attributes FOR gmfgen::GenNavigator-»
- «EXPAND xpt::Common::generatedMemberComment»
-private String myGroupName;
-
- «EXPAND xpt::Common::generatedMemberComment»
-private String myIcon;
-
- «EXPAND xpt::Common::generatedMemberComment»
-private java.util.Collection myChildren = new java.util.LinkedList();
-«ENDDEFINE»
-
-«DEFINE _constructor FOR gmfgen::GenNavigator-»
- «EXPAND xpt::Common::generatedMemberComment»
-«navigatorGroupClassName»(String groupName, String icon, Object parent) {
- super(parent);
- myGroupName = groupName;
- myIcon = icon;
-}
-«ENDDEFINE»
-
-«DEFINE getGroupName FOR gmfgen::GenNavigator-»
- «EXPAND xpt::Common::generatedMemberComment»
-public String getGroupName() {
- return myGroupName;
-}
-«ENDDEFINE»
-
-«DEFINE getIcon FOR gmfgen::GenNavigator-»
- «EXPAND xpt::Common::generatedMemberComment»
-public String getIcon() {
- return myIcon;
-}
-«ENDDEFINE»
-
-«DEFINE getChildren FOR gmfgen::GenNavigator-»
- «EXPAND xpt::Common::generatedMemberComment»
-public Object[] getChildren() {
- return myChildren.toArray();
-}
-«ENDDEFINE»
-
-«DEFINE addChildren FOR gmfgen::GenNavigator-»
- «EXPAND xpt::Common::generatedMemberComment»
-public void addChildren(java.util.Collection children) {
- myChildren.addAll(children);
-}
-«ENDDEFINE»
-
-«DEFINE addChild FOR gmfgen::GenNavigator-»
- «EXPAND xpt::Common::generatedMemberComment»
-public void addChild(Object child) {
- myChildren.add(child);
-}
-«ENDDEFINE»
-
-«DEFINE isEmpty FOR gmfgen::GenNavigator-»
- «EXPAND xpt::Common::generatedMemberComment»
-public boolean isEmpty() {
- return myChildren.size() == 0;
-}
-«ENDDEFINE»
-
-«DEFINE equals FOR gmfgen::GenNavigator-»
- «EXPAND xpt::Common::generatedMemberComment»
-public boolean equals(Object obj) {
- if (obj instanceof «getNavigatorGroupQualifiedClassName()») {
- «getNavigatorGroupQualifiedClassName()» anotherGroup = («getNavigatorGroupQualifiedClassName()») obj;
- if (getGroupName().equals(anotherGroup.getGroupName())) {
- return getParent().equals(anotherGroup.getParent());
- }
- }
- return super.equals(obj);
-}
-«ENDDEFINE»
-
-«DEFINE hashCode FOR gmfgen::GenNavigator-»
- «EXPAND xpt::Common::generatedMemberComment»
-public int hashCode() {
- return getGroupName().hashCode();
-}
-«ENDDEFINE»
-
-«DEFINE additions FOR gmfgen::GenNavigator-»
-«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/navigator/NavigatorItem.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/navigator/NavigatorItem.xpt
deleted file mode 100644
index fca531c27..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/navigator/NavigatorItem.xpt
+++ /dev/null
@@ -1,109 +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 NavigatorItem FOR gmfgen::GenNavigator-»
- «EXPAND xpt::Common::copyright FOR editorGen-»
-package «packageName»;
-
- «EXPAND xpt::Common::generatedClassComment»
-public class «navigatorItemClassName» extends «getAbstractNavigatorItemQualifiedClassName()» {
-
- «EXPAND registerAdapterFactory-»
-
- «EXPAND attributes-»
-
- «EXPAND _constructor-»
-
- «EXPAND getView-»
-
- «EXPAND isLeaf-»
-
- «EXPAND equals-»
-
- «EXPAND hashCode-»
-
- «EXPAND additions-»
-}
-«ENDDEFINE»
-
-«DEFINE registerAdapterFactory FOR gmfgen::GenNavigator-»
- «EXPAND xpt::Common::generatedMemberComment»
-static {
- final Class[] supportedTypes = new Class[] { org.eclipse.gmf.runtime.notation.View.class, org.eclipse.emf.ecore.EObject.class };
- org.eclipse.core.runtime.Platform.getAdapterManager().registerAdapters(new org.eclipse.core.runtime.IAdapterFactory() {
-
- public Object getAdapter(Object adaptableObject, Class adapterType) {
- if (adaptableObject instanceof «getNavigatorItemQualifiedClassName()» && (adapterType == org.eclipse.gmf.runtime.notation.View.class || adapterType == org.eclipse.emf.ecore.EObject.class)) {
- return ((«getNavigatorItemQualifiedClassName()») adaptableObject).getView();
- }
- return null;
- }
-
- public Class[] getAdapterList() {
- return supportedTypes;
- }
- }, «getNavigatorItemQualifiedClassName()».class);
-}
-«ENDDEFINE»
-
-«DEFINE attributes FOR gmfgen::GenNavigator-»
- «EXPAND xpt::Common::generatedMemberComment»
-private org.eclipse.gmf.runtime.notation.View myView;
-
- «EXPAND xpt::Common::generatedMemberComment»
-private boolean myLeaf = false;
-«ENDDEFINE»
-
-«DEFINE _constructor FOR gmfgen::GenNavigator-»
- «EXPAND xpt::Common::generatedMemberComment»
-public «navigatorItemClassName»(org.eclipse.gmf.runtime.notation.View view, Object parent, boolean isLeaf) {
- super(parent);
- myView = view;
- myLeaf = isLeaf;
-}
-«ENDDEFINE»
-
-«DEFINE getView FOR gmfgen::GenNavigator-»
- «EXPAND xpt::Common::generatedMemberComment»
-public org.eclipse.gmf.runtime.notation.View getView() {
- return myView;
-}
-«ENDDEFINE»
-
-«DEFINE isLeaf FOR gmfgen::GenNavigator-»
- «EXPAND xpt::Common::generatedMemberComment»
-public boolean isLeaf() {
- return myLeaf;
-}
-«ENDDEFINE»
-
-«DEFINE equals FOR gmfgen::GenNavigator-»
- «EXPAND xpt::Common::generatedMemberComment»
-public boolean equals(Object obj) {
- if (obj instanceof «getNavigatorItemQualifiedClassName()») {
- return org.eclipse.emf.ecore.util.EcoreUtil.getURI(getView()).equals(org.eclipse.emf.ecore.util.EcoreUtil.getURI(((«getNavigatorItemQualifiedClassName()») obj).getView()));
- }
- return super.equals(obj);
-}
-«ENDDEFINE»
-
-«DEFINE hashCode FOR gmfgen::GenNavigator-»
- «EXPAND xpt::Common::generatedMemberComment»
-public int hashCode() {
- return org.eclipse.emf.ecore.util.EcoreUtil.getURI(getView()).hashCode();
-}
-«ENDDEFINE»
-
-«DEFINE additions FOR gmfgen::GenNavigator-»
-«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/navigator/NavigatorLabelProvider.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/navigator/NavigatorLabelProvider.xpt
deleted file mode 100644
index 4f2d3510b..000000000
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/navigator/NavigatorLabelProvider.xpt
+++ /dev/null
@@ -1,424 +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/gmf/2008/GenModel'»
-«IMPORT 'http://www.eclipse.org/emf/2002/GenModel'»
-«IMPORT 'http://www.eclipse.org/emf/2002/Ecore'»
-«EXTENSION xpt::navigator::Utils»
-«EXTENSION xpt::GenModelUtils»
-
-«DEFINE NavigatorLabelProvider FOR gmfgen::GenNavigator-»
- «EXPAND xpt::Common::copyright FOR editorGen-»
-package «packageName»;
-
-«EXPAND xpt::Common::generatedClassComment»
-public class «labelProviderClassName» extends org.eclipse.jface.viewers.LabelProvider implements org.eclipse.ui.navigator.ICommonLabelProvider, org.eclipse.jface.viewers.ITreePathLabelProvider {
-
- «EXPAND staticInitializer-»
-
- «EXPAND updateLabel-»
-
- «EXPAND getImage-»
-
- «EXPAND getViewImage-»
-
- «EXPAND getImageByKey-»
-
- «EXPAND getText-»
-
- «EXPAND getViewText-»
-
- «EXPAND getTextMethod FOREACH getNavigatorContainedNodes(self)-»
-
- «EXPAND getUnknownElementText-»
-
- «EXPAND getUnresolvedDomainElementProxyText-»
-
- «EXPAND _init-»
-
- «EXPAND restoreState-»
-
- «EXPAND saveState-»
-
- «EXPAND getDescription-»
-
- «EXPAND isOwnView-»
-
- «EXPAND additions-»
-}
-«ENDDEFINE»
-
-«DEFINE staticInitializer FOR gmfgen::GenNavigator-»
- «EXPAND xpt::Common::generatedMemberComment»
-static {
- «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().getImageRegistry().put(«EXPAND unknownElementKey», org.eclipse.jface.resource.ImageDescriptor.getMissingImageDescriptor()); «EXPAND xpt::Common::nonNLS»
- «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().getImageRegistry().put(«EXPAND notFoundElementKey», org.eclipse.jface.resource.ImageDescriptor.getMissingImageDescriptor()); «EXPAND xpt::Common::nonNLS»
-}
-«ENDDEFINE»
-
-«DEFINE updateLabel FOR gmfgen::GenNavigator-»
- «EXPAND xpt::Common::generatedMemberComment»
-public void updateLabel(org.eclipse.jface.viewers.ViewerLabel label, org.eclipse.jface.viewers.TreePath elementPath) {
- Object element = elementPath.getLastSegment();
- if (element instanceof «getNavigatorItemQualifiedClassName()» && !isOwnView(((«getNavigatorItemQualifiedClassName()») element).getView())) {
- return;
- }
- label.setText(getText(element));
- label.setImage(getImage(element));
-}
-«ENDDEFINE»
-
-«DEFINE getImage FOR gmfgen::GenNavigator-»
- «EXPAND xpt::Common::generatedMemberComment»
-public org.eclipse.swt.graphics.Image getImage(Object element) {
- «EXPAND getNavigatorGroupImage-»
-
- «EXPAND getNavigatorItemImage-»
-
- «EXPAND getAdaptableImage-»
-
- «EXPAND getAdditionalInputImage-»
- return super.getImage(element);
-}
-«ENDDEFINE»
-
-«DEFINE getNavigatorGroupImage FOR gmfgen::GenNavigator-»
-if (element instanceof «getNavigatorGroupQualifiedClassName()») {
- «getNavigatorGroupQualifiedClassName()» group = («getNavigatorGroupQualifiedClassName()») element;
- return «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().getBundledImage(group.getIcon());
-}
-«ENDDEFINE»
-
-«DEFINE getNavigatorItemImage FOR gmfgen::GenNavigator-»
-if (element instanceof «getNavigatorItemQualifiedClassName()») {
- «getNavigatorItemQualifiedClassName()» navigatorItem = («getNavigatorItemQualifiedClassName()») element;
- if (!isOwnView(navigatorItem.getView())) {
- return super.getImage(element);
- }
- return getImage(navigatorItem.getView());
-}
-«ENDDEFINE»
-
-«DEFINE getAdaptableImage FOR gmfgen::GenNavigator-»
-«IF editorGen.diagram.generateShortcutIcon()-»
-// Due to plugin.xml content will be called only for "own" views
-if (element instanceof org.eclipse.core.runtime.IAdaptable) {
- org.eclipse.gmf.runtime.notation.View view = (org.eclipse.gmf.runtime.notation.View) ((org.eclipse.core.runtime.IAdaptable) element).getAdapter(org.eclipse.gmf.runtime.notation.View.class);
- if (view != null && isOwnView(view)) {
- return getImage(view);
- }
-}
-«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE getAdditionalInputImage FOR gmfgen::GenNavigator-»
-«ENDDEFINE»
-
-«DEFINE getViewImage FOR gmfgen::GenNavigator-»
- «EXPAND xpt::Common::generatedMemberComment»
-public org.eclipse.swt.graphics.Image getImage(org.eclipse.gmf.runtime.notation.View view) {
- «IF not getNavigatorContainedNodes(self)->isEmpty()-»
- switch («EXPAND xpt::editor::VisualIDRegistry::getVisualIDMethodCall FOR editorGen.diagram»(view)) {
- «EXPAND caseImage FOREACH getNavigatorContainedNodes(self)-»
- }
- «ENDIF-»
- return getImage(«EXPAND unknownElementKey», null); «EXPAND xpt::Common::nonNLS»
-}
-«ENDDEFINE»
-
-«DEFINE caseImage FOR gmfgen::GenCommonBase-»
-«EXPAND xpt::Common::caseVisualID»
- return getImage("«EXPAND key»", «IF null <> elementType»«EXPAND xpt::providers::ElementTypes::accessElementType»«ELSE»null«ENDIF»);«EXPAND xpt::Common::nonNLS»
-«ENDDEFINE»
-
-«DEFINE getImageByKey FOR gmfgen::GenNavigator-»
- «EXPAND xpt::Common::generatedMemberComment»
-private org.eclipse.swt.graphics.Image getImage(String key, org.eclipse.gmf.runtime.emf.type.core.IElementType elementType) {
- org.eclipse.jface.resource.ImageRegistry imageRegistry = «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().getImageRegistry();
- org.eclipse.swt.graphics.Image image = imageRegistry.get(key);
- if (image == null && elementType != null && «editorGen.diagram.getElementTypesQualifiedClassName()».isKnownElementType(elementType)) {
- image = «editorGen.diagram.getElementTypesQualifiedClassName()».getImage(elementType);
- imageRegistry.put(key, image);
- }
-
- if (image == null) {
- image = imageRegistry.get(«EXPAND notFoundElementKey»); «EXPAND xpt::Common::nonNLS»
- imageRegistry.put(key, image);
- }
- return image;
-}
-«ENDDEFINE»
-
-«DEFINE getText FOR gmfgen::GenNavigator-»
- «EXPAND xpt::Common::generatedMemberComment»
-public String getText(Object element) {
- «EXPAND getNavigatorGroupText-»
-
- «EXPAND getNavigatorItemText-»
-
- «EXPAND getAdaptableText-»
-
- «EXPAND getAdditionalInputText-»
- return super.getText(element);
-}
-«ENDDEFINE»
-
-«DEFINE getNavigatorGroupText FOR gmfgen::GenNavigator-»
-if (element instanceof «getNavigatorGroupQualifiedClassName()») {
- «getNavigatorGroupQualifiedClassName()» group = («getNavigatorGroupQualifiedClassName()») element;
- return group.getGroupName();
-}
-«ENDDEFINE»
-
-«DEFINE getNavigatorItemText FOR gmfgen::GenNavigator-»
-if (element instanceof «getNavigatorItemQualifiedClassName()») {
- «getNavigatorItemQualifiedClassName()» navigatorItem = («getNavigatorItemQualifiedClassName()») element;
- if (!isOwnView(navigatorItem.getView())) {
- return null;
- }
- return getText(navigatorItem.getView());
- }
-«ENDDEFINE»
-
-«DEFINE getAdaptableText FOR gmfgen::GenNavigator-»
-«IF editorGen.diagram.generateShortcutIcon()-»
-// Due to plugin.xml content will be called only for "own" views
-if (element instanceof org.eclipse.core.runtime.IAdaptable) {
- org.eclipse.gmf.runtime.notation.View view = (org.eclipse.gmf.runtime.notation.View) ((org.eclipse.core.runtime.IAdaptable) element).getAdapter(org.eclipse.gmf.runtime.notation.View.class);
- if (view != null && isOwnView(view)) {
- return getText(view);
- }
-}
-«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE getAdditionalInputText FOR gmfgen::GenNavigator-»
-«ENDDEFINE»
-
-«DEFINE getViewText FOR gmfgen::GenNavigator-»
- «EXPAND xpt::Common::generatedMemberComment»
-public String getText(org.eclipse.gmf.runtime.notation.View view) {
- if (view.getElement() != null && view.getElement().eIsProxy()) {
- return getUnresolvedDomainElementProxyText(view);
- }
- «IF not getNavigatorContainedNodes(self)->isEmpty()-»
- switch («EXPAND xpt::editor::VisualIDRegistry::getVisualIDMethodCall FOR editorGen.diagram»(view)) {
- «EXPAND caseText FOREACH getNavigatorContainedNodes(self)-»
- }
- «ENDIF-»
- return getUnknownElementText(view);
-}
-«ENDDEFINE»
-
-«DEFINE caseText FOR gmfgen::GenCommonBase-»
-«EXPAND xpt::Common::caseVisualID»
- return «EXPAND getTextMethodName»(view);
-«ENDDEFINE»
-
-«DEFINE getTextMethodName FOR gmfgen::GenCommonBase»get«getUniqueIdentifier()»Text«ENDDEFINE»
-
-«DEFINE getTextMethod FOR gmfgen::GenCommonBase-»
- «EXPAND xpt::Common::generatedMemberComment»
-private String «EXPAND getTextMethodName»(org.eclipse.gmf.runtime.notation.View view) {
- «EXPAND getText-»
-}
-«ENDDEFINE»
-
-«DEFINE getText FOR gmfgen::GenCommonBase»«ERROR 'Incorrect GenCommonBase: ' + self.repr()»«ENDDEFINE»
-
-«DEFINE getText FOR gmfgen::GenDiagram-»
- «EXPAND getLabelFeatureText(domainDiagramElement)-»
-«ENDDEFINE»
-
-«DEFINE getText FOR gmfgen::GenChildLabelNode-»
-«EXPAND getDiagramLabelText(self, labelModelFacet)-»
-«ENDDEFINE»
-
-«DEFINE getText FOR gmfgen::GenLinkLabel»«EXPAND getDiagramLabelText(link, modelFacet)»«ENDDEFINE»
-«DEFINE getText FOR gmfgen::GenNodeLabel»«EXPAND getDiagramLabelText(node, modelFacet)»«ENDDEFINE»
-
-«DEFINE getText FOR gmfgen::GenNode-»
-«IF labels->isEmpty()-»
- «EXPAND getLabelFeatureText(modelFacet.metaClass)-»
-«ELSE-»
- «EXPAND getDiagramLabelText(labels->asSequence())-»
-«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE getText FOR gmfgen::GenLink-»
-«IF labels->isEmpty()-»
- «IF null <> modelFacet-»
- «EXPAND getText(modelFacet)-»
-«ELSE-»
- «EXPAND returnEmptyString-»
- «ENDIF-»
-«ELSE-»
- «EXPAND getDiagramLabelText(labels->asSequence())-»
-«ENDIF-»
-«ENDDEFINE»
-
-«DEFINE getDiagramLabelText(labels : Sequence(gmfgen::GenLabel)) FOR gmfgen::GenCommonBase-»
- «IF labels->isEmpty()-»
- «ERROR 'Empty list of labels passed'-»
- «ENDIF-»
- «LET labels->first().oclAsType(gmfgen::GenLabel) AS label-»
- «EXPAND getDiagramLabelText(self, label.modelFacet) FOR label-»
- «ENDLET-»
-«ENDDEFINE»
-
-«DEFINE getText(modelFacet : gmfgen::LinkModelFacet) FOR gmfgen::GenLink-»
- «EXPAND returnEmptyString-»
-«ENDDEFINE»
-
-«DEFINE getText(modelFacet : gmfgen::TypeLinkModelFacet) FOR gmfgen::GenLink-»
- «EXPAND getLabelFeatureText(modelFacet.metaClass)-»
-«ENDDEFINE»
-
-«DEFINE getText FOR gmfgen::GenCompartment-»
-return "«title»"; «EXPAND xpt::Common::nonNLS»
-«ENDDEFINE»
-
-«REM»FIXME: Refactor. Need to reuse parts of TextAware.xpt«ENDREM»
-/*
- * this/self - aka hintHolder, visual element to present a text
- * elementTypeHolder - model element being displayed
- * modelFacet - may be null
- */
-«DEFINE getDiagramLabelText(elementTypeHolder : gmfgen::GenCommonBase, labelModelFacet : gmfgen::LabelModelFacet) FOR gmfgen::GenCommonBase-»
-org.eclipse.gmf.runtime.common.ui.services.parser.IParser parser = «EXPAND parsers::ParserProvider::accessorCall(elementTypeHolder, labelModelFacet, 'view.getElement() != null ? view.getElement() : view')»;
-if (parser != null) {
- return parser.getPrintString(new org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter(view.getElement() != null ? view.getElement() : view), org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions.NONE.intValue());
-} else {
- «getDiagram().editorGen.plugin.getActivatorQualifiedClassName()».getInstance().logError("Parser was not found for label " + «visualID»);«EXPAND xpt::Common::nonNLS»
- «EXPAND returnEmptyString-»
-}
-«ENDDEFINE»
-
-
-«DEFINE getLabelFeatureText(genClass : genmodel::GenClass) FOR gmfgen::GenCommonBase-»
- «IF null <> genClass and null <> genClass.labelFeature-»
-«EXPAND MetaModel::DeclareAndAssign('domainModelElement', 'view.getElement()') FOR genClass»
-if (domainModelElement != null) {
- return «IF not isStringFeature(genClass.labelFeature)»String.valueOf(«ENDIF»«EXPAND MetaModel::getFeatureValue('domainModelElement', genClass) FOR genClass.labelFeature»«IF not isStringFeature(genClass.labelFeature)»)«ENDIF»;
-} else {
- «getDiagram().editorGen.plugin.getActivatorQualifiedClassName()».getInstance().logError("No domain element for view with visualID = " + «visualID»); «EXPAND xpt::Common::nonNLS»
- «EXPAND returnEmptyString-»
-}
- «ELSE-»
- «EXPAND returnEmptyString-»
- «ENDIF-»
-«ENDDEFINE»
-
-«DEFINE returnEmptyString FOR OclAny-»
-return ""; «EXPAND xpt::Common::nonNLS»
-«ENDDEFINE»
-
-«DEFINE getUnknownElementText FOR gmfgen::GenNavigator-»
- «EXPAND xpt::Common::generatedMemberComment»
-private String getUnknownElementText(org.eclipse.gmf.runtime.notation.View view) {
- return "<UnknownElement Visual_ID = " + view.getType() + ">"; «EXPAND xpt::Common::nonNLS(1)» «EXPAND xpt::Common::nonNLS(2)»
-}
-«ENDDEFINE»
-
-«DEFINE getUnresolvedDomainElementProxyText FOR gmfgen::GenNavigator-»
- «EXPAND xpt::Common::generatedMemberComment»
-private String getUnresolvedDomainElementProxyText(org.eclipse.gmf.runtime.notation.View view) {
- return "<Unresolved domain element Visual_ID = " + view.getType() + ">"; «EXPAND xpt::Common::nonNLS(1)» «EXPAND xpt::Common::nonNLS(2)»
-}
-«ENDDEFINE»
-
-«DEFINE _init FOR gmfgen::GenNavigator-»
- «EXPAND xpt::Common::generatedMemberComment»
-public void init(org.eclipse.ui.navigator.ICommonContentExtensionSite aConfig) {
-}
-«ENDDEFINE»
-
-«DEFINE restoreState FOR gmfgen::GenNavigator-»
- «EXPAND xpt::Common::generatedMemberComment»
-public void restoreState(org.eclipse.ui.IMemento aMemento) {
-}
-«ENDDEFINE»
-
-«DEFINE saveState FOR gmfgen::GenNavigator-»
- «EXPAND xpt::Common::generatedMemberComment»
-public void saveState(org.eclipse.ui.IMemento aMemento) {
-}
-«ENDDEFINE»
-
-«DEFINE getDescription FOR gmfgen::GenNavigator-»
- «EXPAND xpt::Common::generatedMemberComment»
-public String getDescription(Object anElement) {
- return null;
-}
-«ENDDEFINE»
-
-«DEFINE isOwnView FOR gmfgen::GenNavigator-»
- «EXPAND xpt::Common::generatedMemberComment»
-private boolean isOwnView(org.eclipse.gmf.runtime.notation.View view) {
- return «EXPAND xpt::editor::VisualIDRegistry::modelID FOR editorGen.diagram».equals(«EXPAND xpt::editor::VisualIDRegistry::getModelIDMethodCall FOR editorGen.diagram»(view));
-}
-«ENDDEFINE»
-
-«DEFINE unknownElementKey FOR OclAny»"«EXPAND commonKeyPrefix»UnknownElement"«ENDDEFINE»
-
-«DEFINE notFoundElementKey FOR OclAny»"«EXPAND commonKeyPrefix»ImageNotFound"«ENDDEFINE»
-
-«DEFINE key FOR gmfgen::GenCommonBase»«ERROR 'Incorrect GenCommonBase: ' + self.repr()»«ENDDEFINE»
-
-«DEFINE key FOR gmfgen::GenDiagram»«EXPAND commonKeyPrefix»Diagram?«EXPAND keyFragment FOR domainDiagramElement»«ENDDEFINE»
-
-«DEFINE key FOR gmfgen::GenNode»«EXPAND commonKeyPrefix»«EXPAND keyFragment»«IF null <> modelFacet»«EXPAND keyFragment FOR modelFacet.metaClass»«ELSE»«EXPAND keyFragment FOR viewmap»«ENDIF»«ENDDEFINE»
-
-«DEFINE keyFragment FOR gmfgen::GenNode»Node?«ENDDEFINE»
-
-«DEFINE keyFragment FOR gmfgen::GenTopLevelNode»TopLevelNode?«ENDDEFINE»
-
-«DEFINE key FOR gmfgen::GenLink»«EXPAND commonKeyPrefix»Link?«IF null <> modelFacet»«EXPAND keyFragment FOR modelFacet»«ELSE»«EXPAND keyFragment FOR viewmap»«ENDIF»«ENDDEFINE»
-
-«DEFINE keyFragment FOR gmfgen::LinkModelFacet»«ERROR 'Incorrect link model facet passed: ' + self.repr()»«ENDDEFINE»
-
-«DEFINE keyFragment FOR gmfgen::TypeLinkModelFacet»«EXPAND keyFragment FOR metaClass»«ENDDEFINE»
-
-«DEFINE keyFragment FOR gmfgen::FeatureLinkModelFacet»«EXPAND keyFragment FOR metaFeature»«ENDDEFINE»
-
-«DEFINE key FOR gmfgen::GenCompartment»«EXPAND key FOR node»?Compartment?«title»«ENDDEFINE»
-
-«DEFINE key FOR gmfgen::GenLabel»«ERROR 'Incorrect GenLabel:' + self.repr()»«ENDDEFINE»
-
-«DEFINE key FOR gmfgen::GenNodeLabel»«EXPAND key FOR node»«EXPAND keyFragment»«ENDDEFINE»
-
-«DEFINE key FOR gmfgen::GenLinkLabel»«EXPAND key FOR link»«EXPAND keyFragment»«ENDDEFINE»
-
-«DEFINE keyFragment FOR gmfgen::GenLabel»?Label?«EXPAND keyFragment(self) FOR modelFacet»«ENDDEFINE»
-
-«DEFINE keyFragment FOR genmodel::GenClass»«genPackage.ecorePackage.nsURI»?«ecoreClass.name»«ENDDEFINE»
-
-«DEFINE keyFragment FOR genmodel::GenFeature»«EXPAND keyFragment FOR genClass»?«ecoreFeature.name»«ENDDEFINE»
-
-«DEFINE keyFragment FOR gmfgen::Viewmap»«ENDDEFINE»
-
-«DEFINE keyFragment FOR gmfgen::FigureViewmap»«figureQualifiedClassName»«ENDDEFINE»
-
-«DEFINE keyFragment FOR gmfgen::InnerClassViewmap»«className»«ENDDEFINE»
-
-«DEFINE keyFragment FOR gmfgen::ParentAssignedViewmap»«figureQualifiedClassName»«ENDDEFINE»
-
-«DEFINE keyFragment(label : gmfgen::GenLabel) FOR gmfgen::LabelModelFacet»«ERROR 'Incorrect label model facet: ' + self.repr()