aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorghillairet2012-05-18 13:05:05 (EDT)
committermgolubev2012-05-18 13:05:05 (EDT)
commit5550cff90b07ebebca9577d24572b73b28d317d8 (patch)
treed8c4056c0a3d0ef10c7cf18496c09161cd817a8b
parent3e6a60bb9f093f39a59c9da39f5f03627d987388 (diff)
downloadorg.eclipse.gmf-tooling-5550cff90b07ebebca9577d24572b73b28d317d8.zip
org.eclipse.gmf-tooling-5550cff90b07ebebca9577d24572b73b28d317d8.tar.gz
org.eclipse.gmf-tooling-5550cff90b07ebebca9577d24572b73b28d317d8.tar.bz2
Setting of visualIDs now handle in Mappings.
Identity library kept for further port of NaiveVisualIdentityDispenser in qvto.
-rw-r--r--plugins/org.eclipse.gmf.bridge/transforms/Identity.qvto88
1 files changed, 1 insertions, 87 deletions
diff --git a/plugins/org.eclipse.gmf.bridge/transforms/Identity.qvto b/plugins/org.eclipse.gmf.bridge/transforms/Identity.qvto
index 6ff1eda..0311dc0 100644
--- a/plugins/org.eclipse.gmf.bridge/transforms/Identity.qvto
+++ b/plugins/org.eclipse.gmf.bridge/transforms/Identity.qvto
@@ -12,98 +12,12 @@
*/
library Identity;
-import Mappings;
import gmf.VisualIdentifierDispenser;
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');
---
--- Visual Identity
---
-property labelNodes: Sequence(LabelMapping) = Sequence{};
+query GMFGEN::GenCommonBase::visualID(): Integer = self.getVisualID();
---
--- Visual IDs are set by traversing the model tree from top to bottom.
---
-helper GMFMAP::Mapping::visualIdentity() {
- self.diagram.resolveone(GenDiagram).visualID := 1000;
-
- self.nodes->collect(e |
- if e.resolveone(GenTopLevelNode).visualID <= 0 then {
- var genNode := e.resolveone(GenTopLevelNode);
- genNode.visualID := genNode.getVisualID();
- e.child.compartments->collect(c | c.visualIdentity(e.child, e));
- e.child.children->collect(visualIdentity());
- e.child.labelMappings->collect(visualIdentity(e));
- } endif
- );
-
- self.links->collect(visualIdentity());
-
- return;
-}
-
-helper GMFMAP::ChildReference::visualIdentity() {
- var node := self.findProcessableChildReference();
- if not node.oclIsUndefined() then
- if node.map structure(node.child).visualID <= 0 then {
- if not node.referencedChild.oclIsUndefined() then {
- var genNode := node.map structure(node.child);
- genNode.visualID := genNode.getVisualID();
- } else {
- var genNode := node.map structure(node.child);
- genNode.visualID := genNode.getVisualID();
- node.child.children->collect(e |
- if e.needVisualID() then e.visualIdentity() endif
- );
- } endif;
- node.child.compartments->collect(c | c.visualIdentity(node.child, node));
- node.map structure(node.child).labels->collect(e | visualIdentity(e));
- } endif
- endif
-}
-
-query ChildReference::needVisualID(): Boolean {
- var node := self.findProcessableChildReference();
- return
- if node.oclIsUndefined() then false else
- node.map structure(node.child).visualID <= 0
- endif
-}
-
-helper visualIdentity(inout genNode: GMFGEN::GenNodeLabel) {
- if genNode.visualID <= 0 then {
- genNode.visualID := genNode.getVisualID();
- } endif;
-}
-
-helper GMFMAP::LabelMapping::visualIdentity(node: GMFMAP::NodeReference) {
- if self.map createNodeLabel(node).visualID <= 0 then {
- var genNode := self.map createNodeLabel(node);
- genNode.visualID := genNode.getVisualID();
- } endif;
-}
-
-helper visualIdentity(inout label: GenLinkLabel) {
- if label.visualID <= 0 then
- label.visualID := label.getVisualID()
- endif;
-}
-
-helper GMFMAP::LinkMapping::visualIdentity() {
- if self.map structure().visualID <= 0 then {
- var genLink := self.map structure();
- genLink.visualID := genLink.getVisualID();
- self.map structure().labels->collect(e | visualIdentity(e))
- } endif;
-}
-
-helper GMFMAP::CompartmentMapping::visualIdentity(_mapping: NodeMapping, node: NodeReference) {
- if self.map structure(_mapping, node).visualID <= 0 then {
- var genNode := self.map structure(_mapping, node);
- genNode.visualID := genNode.getVisualID();
- } endif
-}