Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram')
-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
41 files changed, 0 insertions, 4811 deletions
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»

Back to the top