Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoratikhomirov2009-02-17 11:48:50 -0500
committeratikhomirov2009-02-17 11:48:50 -0500
commitf749504c513d4d6b48deaeb4ae3be322df2b3ebe (patch)
treeee68dd73deb7f4fc7cd930546eb5675fdcbb9ff6
parent5dcc6010608d45abf7c18f7c6710d3d1b3f3f3d0 (diff)
downloadorg.eclipse.gmf-tooling-f749504c513d4d6b48deaeb4ae3be322df2b3ebe.tar.gz
org.eclipse.gmf-tooling-f749504c513d4d6b48deaeb4ae3be322df2b3ebe.tar.xz
org.eclipse.gmf-tooling-f749504c513d4d6b48deaeb4ae3be322df2b3ebe.zip
migrated templates are missing copyright and comments; removed superfluous getNodes, cleaned getElements
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/Utils.qvto27
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/providers/ElementTypes.xpt10
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/providers/ModelingAssistantProvider.xpt13
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/providers/ViewProvider.xpt16
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/providers/extensions.xpt8
5 files changed, 44 insertions, 30 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
index 551978384..2a0d21726 100644
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/Utils.qvto
+++ b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/Utils.qvto
@@ -1,3 +1,14 @@
+/*
+ * 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 xpt.NativeGenModelUtils;
import xpt.GenModelUtils;
@@ -6,18 +17,22 @@ modeltype genModel uses "http://www.eclipse.org/gmf/2008/GenModel";
library Utils;
-helper getNodes(diagram : genModel::GenDiagram) : Sequence(genModel::GenNode) {
- return ((Sequence { })[genModel::GenTopLevelNode]->union(diagram.topLevelNodes->asSequence()))[genModel::GenNode]->union(diagram.childNodes->asSequence())
-}
-
-helper getElements(diagram : genModel::GenDiagram) : Sequence(genModel::GenCommonBase) {
- return ((Sequence { diagram })[genModel::GenContainerBase]->union(diagram.topLevelNodes->asSequence())->union(diagram.childNodes->asSequence()))[genModel::GenCommonBase]->union(diagram.links->asSequence())
+-- all elements that may have element type: diagram, nodes and links
+helper GenDiagram::getAllTypedElements() : Sequence(genModel::GenCommonBase) {
+ return Sequence { self }[genModel::GenCommonBase]->union(self.getAllNodes()->asSequence())->union(self.links->asSequence());
}
helper hasExplicitChildFeature(facet : genModel::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 : genModel::TypeLinkModelFacet) : Boolean {
return facet.sourceMetaFeature <> null or facet.childMetaFeature <> facet.containmentMetaFeature
}
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/providers/ElementTypes.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/providers/ElementTypes.xpt
index ac9b774f7..80f5cae47 100644
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/providers/ElementTypes.xpt
+++ b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/providers/ElementTypes.xpt
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006, 2008 Borland Software Corporation
+ * 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
@@ -27,7 +27,7 @@ public class «elementTypesClassName» extends ElementInitializers {
«EXPAND attributes-»
- «EXPAND elementTypeField FOREACH getElements(self)-»
+ «EXPAND elementTypeField FOREACH getAllTypedElements()-»
«EXPAND getImageRegistry-»
@@ -179,7 +179,7 @@ public static org.eclipse.emf.ecore.ENamedElement getElement(org.eclipse.core.ru
if (elements == null) {
elements = new java.util.IdentityHashMap();
«EXPAND bindUniqueIdentifierToNamedElement(getUniqueIdentifier()) FOR domainDiagramElement-»
- «FOREACH getNodes(self) AS node-»
+ «FOREACH getAllNodes() AS node-»
«EXPAND bindUniqueIdentifierToNamedElement(node.getUniqueIdentifier()) FOR node.modelFacet-»
«ENDFOREACH-»
«FOREACH links->asSequence() AS link-»
@@ -227,7 +227,7 @@ private static org.eclipse.gmf.runtime.emf.type.core.IElementType getElementType
public static boolean isKnownElementType(org.eclipse.gmf.runtime.emf.type.core.IElementType elementType) {
if (KNOWN_ELEMENT_TYPES == null) {
KNOWN_ELEMENT_TYPES = new java.util.HashSet();
- «EXPAND addKnownElementType FOREACH getElements(self)-»
+ «EXPAND addKnownElementType FOREACH getAllTypedElements()-»
}
return KNOWN_ELEMENT_TYPES.contains(elementType);
}
@@ -243,7 +243,7 @@ KNOWN_ELEMENT_TYPES.add(«getUniqueIdentifier()»);
«EXPAND xpt::Common::generatedMemberComment»
public static org.eclipse.gmf.runtime.emf.type.core.IElementType getElementType(int visualID) {
switch (visualID) {
- «EXPAND caseElementType FOREACH getElements(self)->select(el | el.elementType <> null)-»
+ «EXPAND caseElementType FOREACH getAllTypedElements()->select(el | el.elementType <> null)-»
}
return null;
}
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/providers/ModelingAssistantProvider.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/providers/ModelingAssistantProvider.xpt
index 5eb871f8a..91376a798 100644
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/providers/ModelingAssistantProvider.xpt
+++ b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/providers/ModelingAssistantProvider.xpt
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, 2008 Borland Software Corporation
+ * 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
@@ -14,7 +14,6 @@
«IMPORT 'http://www.eclipse.org/gmf/2008/GenModel'»
«EXTENSION xpt::diagram::editparts::Utils»
-«EXTENSION xpt::diagram::Utils»
«EXTENSION xpt::providers::i18n»
«DEFINE ModelingAssistantProvider FOR gmfgen::GenDiagram-»
@@ -77,7 +76,7 @@ public class «modelingAssistantProviderClassName»
org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart sourceEditPart =
(org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart) source.getAdapter(
org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart.class);
- «FOREACH getNodes(self) AS source-»
+ «FOREACH getAllNodes() AS source-»
«IF getAssistantOutgoingLinks(source)->size() > 0-»
if (sourceEditPart instanceof «source.getEditPartQualifiedClassName()») {
return ((«source.getEditPartQualifiedClassName()») sourceEditPart).getMARelTypesOnSource();
@@ -94,7 +93,7 @@ public class «modelingAssistantProviderClassName»
org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart targetEditPart =
(org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart) target.getAdapter(
org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart.class);
- «FOREACH getNodes(self) AS target-»
+ «FOREACH getAllNodes() AS target-»
«IF getAssistantIncomingLinks(target)->size() > 0-»
if (targetEditPart instanceof «target.getEditPartQualifiedClassName()») {
return ((«target.getEditPartQualifiedClassName()») targetEditPart).getMARelTypesOnTarget();
@@ -115,7 +114,7 @@ public class «modelingAssistantProviderClassName»
org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart targetEditPart =
(org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart) target.getAdapter(
org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart.class);
- «FOREACH getNodes(self) AS source-»
+ «FOREACH getAllNodes() AS source-»
«IF getAssistantOutgoingLinks(source)->size() > 0-»
if (sourceEditPart instanceof «source.getEditPartQualifiedClassName()») {
return ((«source.getEditPartQualifiedClassName()») sourceEditPart).getMARelTypesOnSourceAndTarget(targetEditPart);
@@ -133,7 +132,7 @@ public class «modelingAssistantProviderClassName»
org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart targetEditPart =
(org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart) target.getAdapter(
org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart.class);
- «FOREACH getNodes(self) AS target-»
+ «FOREACH getAllNodes() AS target-»
«IF getAssistantIncomingLinks(target)->size() > 0-»
if (targetEditPart instanceof «target.getEditPartQualifiedClassName()») {
return ((«target.getEditPartQualifiedClassName()») targetEditPart).getMATypesForSource(relationshipType);
@@ -151,7 +150,7 @@ public class «modelingAssistantProviderClassName»
org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart sourceEditPart =
(org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart) source.getAdapter(
org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart.class);
- «FOREACH getNodes(self) AS source-»
+ «FOREACH getAllNodes() AS source-»
«IF getAssistantOutgoingLinks(source)->size() > 0-»
if (sourceEditPart instanceof «source.getEditPartQualifiedClassName()») {
return ((«source.getEditPartQualifiedClassName()») sourceEditPart).getMATypesForTarget(relationshipType);
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/providers/ViewProvider.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/providers/ViewProvider.xpt
index b1abb033a..cff29374d 100644
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/providers/ViewProvider.xpt
+++ b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/providers/ViewProvider.xpt
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007 Borland Software Corporation
+ * 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
@@ -91,24 +91,24 @@ protected Class getNodeViewClass(org.eclipse.core.runtime.IAdaptable semanticAda
// This method is called with EObjectAdapter as parameter from:
// - ViewService.createNode(View container, EObject eObject, String type, PreferencesHint preferencesHint)
// - generated ViewFactory.decorateView() for parent element
- «IF getElements(self)->select(e | e.elementType <> null)->size() > 0-»
+ «IF getAllTypedElements()->select(e | e.elementType <> null)->size() > 0-»
if (!«getEditPartQualifiedClassName()».MODEL_ID.equals(«getVisualIDRegistryQualifiedClassName()».getModelID(containerView))) {
return null; // foreign diagram
}
switch (visualID) {
- «IF ((getElements(self))[gmfgen::GenNode].elementType)[gmfgen::NotationType]->size() > 0-»
- «EXPAND caseVisualID FOREACH ((getElements(self))[gmfgen::GenNode].elementType)[gmfgen::NotationType]-»
+ «IF getAllNodes().elementType[gmfgen::NotationType]->size() > 0-»
+ «EXPAND caseVisualID FOREACH getAllNodes().elementType[gmfgen::NotationType]-»
break; // pure design element
«ENDIF-»
- «IF ((getElements(self))[gmfgen::GenNode].elementType)[gmfgen::MetamodelType]->size() > 0 or ((getElements(self))[gmfgen::GenNode].elementType)[gmfgen::SpecializationType]->size() > 0-»
- «EXPAND caseVisualID FOREACH ((getElements(self))[gmfgen::GenNode].elementType)[gmfgen::MetamodelType]-»
- «EXPAND caseVisualID FOREACH ((getElements(self))[gmfgen::GenNode].elementType)[gmfgen::SpecializationType]-»
+ «IF getAllNodes().elementType[gmfgen::MetamodelType]->size() > 0 or getAllNodes().elementType[gmfgen::SpecializationType]->size() > 0-»
+ «EXPAND caseVisualID FOREACH getAllNodes().elementType[gmfgen::MetamodelType]-»
+ «EXPAND caseVisualID FOREACH getAllNodes().elementType[gmfgen::SpecializationType]-»
if (domainElement == null || visualID != «EXPAND xpt::editor::VisualIDRegistry::getNodeVisualIDMethodCall»(containerView, domainElement)) {
return null; // visual id in semantic hint should match visual id for domain element
}
break;
«ENDIF-»
- «EXPAND checkChildrenVisualIDs FOREACH getElements(self)->select(e | e.elementType <> null)-»
+ «EXPAND checkChildrenVisualIDs FOREACH getAllTypedElements()->select(e | e.elementType <> null)-»
default:
return null;
}
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/providers/extensions.xpt b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/providers/extensions.xpt
index c19044384..da8f3494f 100644
--- a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/providers/extensions.xpt
+++ b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/providers/extensions.xpt
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, 2008 Borland Software Corporation
+ * 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
@@ -90,7 +90,7 @@
<extension point="org.eclipse.gmf.runtime.emf.type.core.elementTypes" id="element-types">
«EXPAND xpt::Common::xmlGeneratedTag»
-«FOREACH getElements(self) AS e-»
+«FOREACH getAllTypedElements() AS e-»
«EXPAND elementTypeSafe FOR e.elementType-»
«ENDFOREACH-»
</extension>
@@ -105,7 +105,7 @@
</enablement>
</clientContext>
<binding context="«editorGen.plugin.iD».TypeContext">
-«FOREACH getElements(self) AS e-»
+«FOREACH getAllTypedElements() AS e-»
<elementType ref="«e.elementType.uniqueIdentifier»"/>
«ENDFOREACH-»
<advice ref="org.eclipse.gmf.runtime.diagram.core.advice.notationDepdendents"/>
@@ -176,7 +176,7 @@
«DEFINE i18n FOR gmfgen::GenDiagram-»
# Providers
-«EXPAND internal_i18n FOREACH getElements(self).elementType»
+«EXPAND internal_i18n FOREACH getAllTypedElements().elementType»
«ENDDEFINE»
«DEFINE internal_i18n FOR gmfgen::ElementType-»

Back to the top