summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorghillairet2012-05-10 10:15:05 (EDT)
committer mgolubev2012-05-10 10:15:05 (EDT)
commit2acb3fe7775eca8223318d59035028225097563b (patch)
treee0745758543f79a875282ff836b5236178a352a6
parent9416caef7b3e7a6ed0b583880367a4b1acdc0d8f (diff)
downloadorg.eclipse.gmf-tooling-2acb3fe7775eca8223318d59035028225097563b.zip
org.eclipse.gmf-tooling-2acb3fe7775eca8223318d59035028225097563b.tar.gz
org.eclipse.gmf-tooling-2acb3fe7775eca8223318d59035028225097563b.tar.bz2
code cleaning
-rw-r--r--plugins/org.eclipse.gmf.bridge/transforms/Identity.qvto8
-rw-r--r--plugins/org.eclipse.gmf.bridge/transforms/Map2Gen.qvto8
-rw-r--r--plugins/org.eclipse.gmf.bridge/transforms/Map2GenUtil.qvto6
-rw-r--r--plugins/org.eclipse.gmf.bridge/transforms/Mappings.qvto77
-rw-r--r--plugins/org.eclipse.gmf.bridge/transforms/ModeledViewmaps.qvto4
-rw-r--r--plugins/org.eclipse.gmf.bridge/transforms/Viewmaps.qvto4
6 files changed, 47 insertions, 60 deletions
diff --git a/plugins/org.eclipse.gmf.bridge/transforms/Identity.qvto b/plugins/org.eclipse.gmf.bridge/transforms/Identity.qvto
index 257025d..88b16bd 100644
--- a/plugins/org.eclipse.gmf.bridge/transforms/Identity.qvto
+++ b/plugins/org.eclipse.gmf.bridge/transforms/Identity.qvto
@@ -10,6 +10,8 @@
* Artem Tikhomirov (Borland) - initial API and implementation
* Guillaume Hillairet (Montages A.G.)
*/
+library Identity;
+
import Mappings;
import gmf.VisualIdentifierDispenser;
@@ -17,11 +19,9 @@ modeltype GMFMAP uses mappings('http://www.eclipse.org/gmf/2006/mappings');
modeltype GMFGEN uses gmfgen('http://www.eclipse.org/gmf/2009/GenModel');
modeltype GMFGRAPH uses gmfgraph('http://www.eclipse.org/gmf/2006/GraphicalDefinition');
-library Identity;
-
--- *************************************************************************************
+--
-- Visual Identity
--- *************************************************************************************
+--
property labelNodes: Sequence(LabelMapping) = Sequence{};
diff --git a/plugins/org.eclipse.gmf.bridge/transforms/Map2Gen.qvto b/plugins/org.eclipse.gmf.bridge/transforms/Map2Gen.qvto
index dec9086..d42042f 100644
--- a/plugins/org.eclipse.gmf.bridge/transforms/Map2Gen.qvto
+++ b/plugins/org.eclipse.gmf.bridge/transforms/Map2Gen.qvto
@@ -26,10 +26,7 @@ import Parsers;
import gmf.GenModelAccess;
modeltype GMFMAP uses mappings('http://www.eclipse.org/gmf/2006/mappings');
-modeltype GMFTOOL uses tooldef('http://www.eclipse.org/gmf/2005/ToolDefinition');
modeltype GMFGEN uses gmfgen('http://www.eclipse.org/gmf/2009/GenModel');
-modeltype GMFGRAPH uses gmfgraph('http://www.eclipse.org/gmf/2006/GraphicalDefinition');
-modeltype ECORE uses ecore('http://www.eclipse.org/emf/2002/Ecore');
modeltype GENMODEL uses genmodel('http://www.eclipse.org/emf/2002/GenModel');
transformation Map2Gen(
@@ -46,7 +43,7 @@ configuration property useInTransformationCodeGen: Boolean;
main() {
var mapRoot := mapModel.rootObjects()![GMFMAP::Mapping];
genModel := domainGenModel.rootObjects()![GENMODEL::GenModel];
- childReferences := mapRoot.getChildReferences();
+ -- childReferences := mapRoot.getChildReferences();
Viewmaps::setMapMode(useMapMode);
var genEditor := mapRoot.map structure();
@@ -87,9 +84,10 @@ main() {
--
mapping GMFMAP::Mapping::editorPlugin() : GMFGEN::GenPlugin {
- requiredPlugins := Set{'org.eclipse.draw2d'};
+ requiredPlugins := Set{'org.eclipse.gmf.tooling.runtime', 'org.eclipse.draw2d'};
if self.links->notEmpty() or GMFMAP::LabelMapping.allInstances()->notEmpty() then
+
requiredPlugins += 'org.eclipse.gmf.runtime.draw2d.ui'
endif;
diff --git a/plugins/org.eclipse.gmf.bridge/transforms/Map2GenUtil.qvto b/plugins/org.eclipse.gmf.bridge/transforms/Map2GenUtil.qvto
index 5cabc9c..039e6a2 100644
--- a/plugins/org.eclipse.gmf.bridge/transforms/Map2GenUtil.qvto
+++ b/plugins/org.eclipse.gmf.bridge/transforms/Map2GenUtil.qvto
@@ -10,12 +10,16 @@
* Artem Tikhomirov (Borland) - initial API and implementation
* Guillaume Hillairet (Montages A.G.)
*/
+library Map2GenUtil;
+
modeltype GMFMAP uses mappings('http://www.eclipse.org/gmf/2006/mappings');
modeltype ECORE uses ecore('http://www.eclipse.org/emf/2002/Ecore');
modeltype GENMODEL uses genmodel('http://www.eclipse.org/emf/2002/GenModel');
modeltype GMFGEN uses gmfgen('http://www.eclipse.org/gmf/2009/GenModel');
-library Map2GenUtil;
+--
+-- Properties
+--
property allChildReferences: Sequence(ChildReference) = Sequence{};
property childReferences: Sequence(ChildReference) = Sequence{};
diff --git a/plugins/org.eclipse.gmf.bridge/transforms/Mappings.qvto b/plugins/org.eclipse.gmf.bridge/transforms/Mappings.qvto
index 6a21f22..53a15f7 100644
--- a/plugins/org.eclipse.gmf.bridge/transforms/Mappings.qvto
+++ b/plugins/org.eclipse.gmf.bridge/transforms/Mappings.qvto
@@ -23,12 +23,17 @@ modeltype GMFGRAPH uses gmfgraph('http://www.eclipse.org/gmf/2006/GraphicalDefin
modeltype ECORE uses ecore('http://www.eclipse.org/emf/2002/Ecore');
modeltype GENMODEL uses genmodel('http://www.eclipse.org/emf/2002/GenModel');
+--
+-- Mapping
+--
mapping GMFMAP::Mapping::structure() : GMFGEN::GenEditorGenerator {
+ childReferences := self.getChildReferences();
+
diagram := self.diagram.map structure();
- diagram.topLevelNodes += self.nodes->map structure()->asOrderedSet();
- childReferences->forEach(c) { diagram.childNodes += c.map structure(c.child); };
+ diagram.topLevelNodes += self.nodes->map structure();
+ diagram.childNodes += childReferences->collect(e | e.map structure(e.child));
diagram.links := self.links->map structure()->asOrderedSet();
self.getCompartments()->forEach(e) { diagram.compartments += e.c.map structure(e.n, e.r); };
@@ -73,14 +78,20 @@ mapping GMFMAP::TopNodeReference::structure() : GMFGEN::GenTopLevelNode {
};
labels += self.child.labelMappings->map createNodeLabel(self);
-
--- viewmap := self.child.diagramNode.viewmap();
behaviour += self.child.relatedDiagrams.handleRelatedDiagram(self.child);
}
--
-- GenChildNode
--
+abstract mapping GMFMAP::ChildReference::abstractStructure(node: GMFMAP::NodeMapping): GMFGEN::GenChildNode {
+ modelFacet := self.createModelFacet();
+ self.child.children[ChildReference]->select(e | e.compartment.oclIsUndefined())->forEach(c) {
+ var node := c.findProcessableChildReference();
+ childNodes += node.map structure(node.child);
+ };
+ self.child.tool.map paletteEntry().oclAsType(ToolEntry).genNodes += result;
+}
mapping GMFMAP::ChildReference::structure(node: GMFMAP::NodeMapping) : GMFGEN::GenChildNode
disjuncts
@@ -89,59 +100,34 @@ mapping GMFMAP::ChildReference::structure(node: GMFMAP::NodeMapping) : GMFGEN::G
GMFMAP::ChildReference::createGenChildNode
{}
-mapping GMFMAP::ChildReference::createGenChildLabelNode(node: GMFMAP::NodeMapping) : GMFGEN::GenChildLabelNode
+mapping GMFMAP::ChildReference::createGenChildLabelNode(node: GMFMAP::NodeMapping) : GMFGEN::GenChildLabelNode
+inherits GMFMAP::ChildReference::abstractStructure
when {
node.isPureLabelNode()
}
-{
- modelFacet := self.createModelFacet();
-
+{
var soleLabel := node.labelMappings->first();
labelModelFacet := soleLabel.map createLabelModelFacet(self);
labelReadOnly := soleLabel.readOnly;
labelElementIcon := soleLabel.diagramLabel.elementIcon;
--- viewmap := soleLabel.diagramLabel.viewmap();
- self.child.tool.map paletteEntry().oclAsType(ToolEntry).genNodes += result;
-
- self.child.children[ChildReference]->select(e | e.compartment.oclIsUndefined())->forEach(c) {
- var node := c.findProcessableChildReference();
- childNodes += node.map structure(node.child);
- };
}
-mapping GMFMAP::ChildReference::createGenChildSideAffixedNode(node: GMFMAP::NodeMapping) : GMFGEN::GenChildSideAffixedNode
+mapping GMFMAP::ChildReference::createGenChildSideAffixedNode(node: GMFMAP::NodeMapping) : GMFGEN::GenChildSideAffixedNode
+inherits GMFMAP::ChildReference::abstractStructure
when {
node.diagramNode.affixedParentSide <> GMFGRAPH::Direction::NONE
}
{
--- viewmap := node.diagramNode.viewmap();
- modelFacet := self.createModelFacet();
- preferredSideName := node.diagramNode.getAffixedSideAsPositionConstantsName();
-
+ preferredSideName := node.diagramNode.getAffixedSideAsPositionConstantsName();
labels += node.labelMappings->map createNodeLabel(self);
- self.child.tool.map paletteEntry().oclAsType(ToolEntry).genNodes += result;
-
- self.child.children[ChildReference]->select(e | e.compartment.oclIsUndefined())->forEach(c) {
- var node := c.findProcessableChildReference();
- childNodes += node.map structure(node.child);
- };
-
behaviour += node.relatedDiagrams.handleRelatedDiagram(node);
}
-mapping GMFMAP::ChildReference::createGenChildNode(node: GMFMAP::NodeMapping) : GMFGEN::GenChildNode {
--- viewmap := node.diagramNode.viewmap();
- modelFacet := self.createModelFacet();
- labels += node.labelMappings->map createNodeLabel(self);
- self.child.tool.map paletteEntry().oclAsType(ToolEntry).genNodes += result;
-
- self.child.children[ChildReference]->select(e | e.compartment.oclIsUndefined())->forEach(c) {
- var node := c.findProcessableChildReference();
- childNodes += node.map structure(node.child);
- };
-
- behaviour += node.relatedDiagrams.handleRelatedDiagram(node);
- -- behaviour += node.visualEffects->map createVisualEffects(result, _node);
+mapping GMFMAP::ChildReference::createGenChildNode(node: GMFMAP::NodeMapping) : GMFGEN::GenChildNode
+inherits GMFMAP::ChildReference::abstractStructure
+{
+ labels += node.labelMappings->map createNodeLabel(self);
+ behaviour += node.relatedDiagrams.handleRelatedDiagram(node);
}
--
@@ -159,8 +145,7 @@ mapping GMFMAP::LabelMapping::createNodeLabel(node: NodeReference) : GMFGEN::Gen
result.modelFacet := self.map createLabelModelFacet(node);
result.readOnly := self.readOnly;
- result.elementIcon := self.diagramLabel.elementIcon;
--- result.viewmap := self.diagramLabel.viewmap();
+ result.elementIcon := self.diagramLabel.elementIcon;
}
mapping GMFMAP::LinkMapping::structure() : GMFGEN::GenLink {
@@ -179,7 +164,6 @@ mapping GMFMAP::LinkMapping::structure() : GMFGEN::GenLink {
self.tool.map paletteEntry().oclAsType(ToolEntry).genLinks += result;
-- setupElementType(result);
--- result.viewmap := self.diagramLink.viewmap();
result.creationConstraints := self.creationConstraints.map structure();
}
@@ -193,7 +177,6 @@ mapping GMFMAP::CompartmentMapping::structure(_mapping: GMFMAP::NodeMapping, con
canCollapse := self.compartment.collapsible;
needsTitle := self.compartment.needsTitle;
title := self.compartment.name;
--- viewmap := self.compartment.viewmap();
};
}
@@ -210,18 +193,19 @@ mapping GMFMAP::CompartmentMapping::structure(_mapping: GMFMAP::NodeMapping, con
if c.child.children->size() > 0 then
listLayout := false
endif;
+
var node := c.findProcessableChildReference();
-- if equivalentChild->hasKey(c) then c else
-- equivalentChild->keys()->selectOne(e | equivalentChild->get(e)->includes(c)) endif;
childNodes += node.map structure(node.child);
- }
+ };
}
mapping LabelMapping::structure(link: GMFMAP::LinkMapping): GenLinkLabel {
readOnly := self.readOnly;
elementIcon := self.diagramLabel.elementIcon;
modelFacet := self.map createLabelModelFacet(link);
-
+
var alignmentFacet := self.diagramLabel.findAlignmentFacet();
if not alignmentFacet.oclIsUndefined() then
alignment := switch {
@@ -233,6 +217,7 @@ mapping LabelMapping::structure(link: GMFMAP::LinkMapping): GenLinkLabel {
endif;
}
+
--
-- Helpers
--
diff --git a/plugins/org.eclipse.gmf.bridge/transforms/ModeledViewmaps.qvto b/plugins/org.eclipse.gmf.bridge/transforms/ModeledViewmaps.qvto
index f45c052..d007568 100644
--- a/plugins/org.eclipse.gmf.bridge/transforms/ModeledViewmaps.qvto
+++ b/plugins/org.eclipse.gmf.bridge/transforms/ModeledViewmaps.qvto
@@ -8,13 +8,13 @@
* Contributors:
* Guillaume Hillairet (Montages A.G.) : initial implementation
*/
+library ModeledViewmaps;
+
modeltype GMFMAP uses mappings('http://www.eclipse.org/gmf/2006/mappings');
modeltype GMFGEN uses gmfgen('http://www.eclipse.org/gmf/2009/GenModel');
modeltype GMFGRAPH uses gmfgraph('http://www.eclipse.org/gmf/2006/GraphicalDefinition');
modeltype ECORE uses ecore('http://www.eclipse.org/emf/2002/Ecore');
-library ModeledViewmaps;
-
-- *************************************************************************************
-- Modeled Viewmaps
-- *************************************************************************************
diff --git a/plugins/org.eclipse.gmf.bridge/transforms/Viewmaps.qvto b/plugins/org.eclipse.gmf.bridge/transforms/Viewmaps.qvto
index 0bf43bb..d050aa5 100644
--- a/plugins/org.eclipse.gmf.bridge/transforms/Viewmaps.qvto
+++ b/plugins/org.eclipse.gmf.bridge/transforms/Viewmaps.qvto
@@ -306,9 +306,9 @@ query DiagramElement::findIndex(): Integer {
return 0;
}
--- =================================================================================================
+--
-- Templates
--- =================================================================================================
+--
property templateRoots : Sequence(String) = Sequence {'platform:/plugin/org.eclipse.gmf.graphdef.codegen/templates/'};
property mapModeTemplateRoots : String = 'platform:/plugin/org.eclipse.gmf.graphdef.codegen/templates/rt_mm/';