summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorghillairet2012-05-18 13:10:49 (EDT)
committer mgolubev2012-05-18 13:10:49 (EDT)
commite1dcb3f68c8e76d777381d039e8d62dd599ac5ac (patch)
tree45d760873c3e0e547ab41bc1899e3baf15bc8602
parente7c0ea8b4967d177d7dd3379204f0158e6f9d5fa (diff)
downloadorg.eclipse.gmf-tooling-e1dcb3f68c8e76d777381d039e8d62dd599ac5ac.zip
org.eclipse.gmf-tooling-e1dcb3f68c8e76d777381d039e8d62dd599ac5ac.tar.gz
org.eclipse.gmf-tooling-e1dcb3f68c8e76d777381d039e8d62dd599ac5ac.tar.bz2
Modifications to handle setting of viewmaps in Mappings.
-rw-r--r--plugins/org.eclipse.gmf.bridge/transforms/ModeledViewmaps.qvto43
-rw-r--r--plugins/org.eclipse.gmf.bridge/transforms/Viewmaps.qvto70
2 files changed, 17 insertions, 96 deletions
diff --git a/plugins/org.eclipse.gmf.bridge/transforms/ModeledViewmaps.qvto b/plugins/org.eclipse.gmf.bridge/transforms/ModeledViewmaps.qvto
index d007568..ea6ab2f 100644
--- a/plugins/org.eclipse.gmf.bridge/transforms/ModeledViewmaps.qvto
+++ b/plugins/org.eclipse.gmf.bridge/transforms/ModeledViewmaps.qvto
@@ -15,48 +15,9 @@ 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');
--- *************************************************************************************
+--
-- Modeled Viewmaps
--- *************************************************************************************
-
-helper viewmaps(in mapRoot : GMFMAP::Mapping, inout genDiagram : GMFGEN::GenDiagram) {
-
- genDiagram.viewmap := object ModeledViewmap {
- figureModel := mapRoot.diagram.diagramCanvas.oclAsType(EObject);
- };
-
- genDiagram.topLevelNodes->forEach(node) {
- var topReference := node.invresolveone(TopNodeReference);
- node.viewmap := topReference.child.diagramNode.viewmap();
- node.labels->forEach(label) {
- var labelMapping := label.invresolveone(LabelMapping);
- label.viewmap := labelMapping.diagramLabel.viewmap();
- }
- };
-
- genDiagram.childNodes->forEach(node) {
- var childReference := node.invresolveone(ChildReference);
- node.viewmap := childReference.child.diagramNode.viewmap();
- node.labels->forEach(label) {
- var labelMapping := label.invresolveone(LabelMapping);
- label.viewmap := labelMapping.diagramLabel.viewmap();
- }
- };
-
- genDiagram.links->forEach(link) {
- var linkMapping := link.invresolveone(LinkMapping);
- link.viewmap := linkMapping.diagramLink.viewmap();
- link.labels->forEach(label) {
- var labelMapping := label.invresolveone(LabelMapping);
- label.viewmap := labelMapping.diagramLabel.viewmap();
- }
- };
-
- genDiagram.compartments->forEach(cpt) {
- var cptMapping := cpt.invresolveone(CompartmentMapping);
- cpt.viewmap := cptMapping.compartment.viewmap();
- }
-}
+--
helper GMFGRAPH::Node::viewmap() : GMFGEN::Viewmap {
var rs := object ModeledViewmap {
diff --git a/plugins/org.eclipse.gmf.bridge/transforms/Viewmaps.qvto b/plugins/org.eclipse.gmf.bridge/transforms/Viewmaps.qvto
index b0625b9..2676012 100644
--- a/plugins/org.eclipse.gmf.bridge/transforms/Viewmaps.qvto
+++ b/plugins/org.eclipse.gmf.bridge/transforms/Viewmaps.qvto
@@ -20,51 +20,11 @@ modeltype ECORE uses ecore('http://www.eclipse.org/emf/2002/Ecore');
library Viewmaps;
-helper viewmaps(in mapRoot : GMFMAP::Mapping, inout genDiagram : GMFGEN::GenDiagram) {
-
- genDiagram.viewmap := mapRoot.diagram.diagramCanvas.map viewmap();
-
- genDiagram.topLevelNodes->forEach(node) {
- var topReference := node.invresolveone(TopNodeReference);
- node.viewmap := topReference.child.diagramNode.viewmap();
- node.labels->forEach(label) {
- var labelMapping := label.invresolveone(LabelMapping);
- label.viewmap := labelMapping.diagramLabel.viewmap();
- }
- };
-
- genDiagram.childNodes->forEach(node) {
- var childReference := node.invresolveone(ChildReference);
- node.viewmap := childReference.viewmap(childReference.child);
- node.labels->forEach(label) {
- var labelMapping := label.invresolveone(LabelMapping);
- label.viewmap := labelMapping.diagramLabel.viewmap();
- }
- };
-
- genDiagram.compartments->forEach(cpt) {
- var compartmentMapping := cpt.invresolveone(CompartmentMapping);
- cpt.viewmap := compartmentMapping.compartment.viewmap();
- };
-
- genDiagram.links->forEach(link) {
- var linkMapping := link.invresolveone(LinkMapping);
- link.viewmap := linkMapping.diagramLink.viewmap();
- link.labels->forEach(label) {
- var labelMapping := label.invresolveone(LabelMapping);
- label.viewmap := labelMapping.diagramLabel.viewmap();
- label.viewmap.attributes += labelMapping.diagramLabel.labelOffSetAttributes(link.labels->indexOf(label));
- }
- };
-
- return;
-}
-
--- =================================================================================================
+--
-- Canvas
--- =================================================================================================
+--
-mapping GMFGRAPH::Canvas::viewmap() : GMFGEN::Viewmap when {true} {
+mapping GMFGRAPH::Canvas::viewmap() : GMFGEN::Viewmap {
init {
result := object GMFGEN::FigureViewmap {
figureQualifiedClassName := 'org.eclipse.draw2d.FreeformLayer';
@@ -72,9 +32,9 @@ mapping GMFGRAPH::Canvas::viewmap() : GMFGEN::Viewmap when {true} {
}
}
--- =================================================================================================
+--
-- ChildReference
--- =================================================================================================
+--
helper GMFMAP::ChildReference::viewmap(node: GMFMAP::NodeMapping) : GMFGEN::Viewmap =
if node.isPureLabelNode() then
@@ -83,9 +43,9 @@ helper GMFMAP::ChildReference::viewmap(node: GMFMAP::NodeMapping) : GMFGEN::View
node.diagramNode.map viewmap()
endif;
--- =================================================================================================
+--
-- Node
--- =================================================================================================
+--
helper GMFGRAPH::Node::viewmap(): GMFGEN::Viewmap {
var rs := self.figure.viewmap();
@@ -142,9 +102,9 @@ query GMFGRAPH::Node::getLayoutType(): GMFGEN::ViewmapLayoutType {
return layout;
}
--- =================================================================================================
+--
-- Compartment
--- =================================================================================================
+--
helper GMFGRAPH::Compartment::viewmap() : GMFGEN::Viewmap {
if self.figure.oclIsUndefined() then
@@ -157,9 +117,9 @@ helper GMFGRAPH::Compartment::viewmap() : GMFGEN::Viewmap {
return self.figure.viewmap(self.accessor);
}
--- =================================================================================================
+--
-- Connection
--- =================================================================================================
+--
helper GMFGRAPH::Connection::viewmap() : GMFGEN::Viewmap {
var rs : GMFGEN::Viewmap := null;
@@ -175,9 +135,9 @@ helper GMFGRAPH::Connection::viewmap() : GMFGEN::Viewmap {
return rs;
}
--- =================================================================================================
+--
-- DiagramLabel
--- =================================================================================================
+--
helper GMFGRAPH::DiagramLabel::viewmap(): GMFGEN::Viewmap {
var rs : GMFGEN::Viewmap := null;
@@ -210,9 +170,9 @@ helper DiagramLabel::labelOffSetAttributes(position: Integer): LabelOffsetAttrib
} endif;
};
--- =================================================================================================
+--
-- Figure
--- =================================================================================================
+--
helper GMFGRAPH::FigureDescriptor::viewmap() : GMFGEN::Viewmap {
var rs: GMFGEN::Viewmap := null;