summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorghillairet2012-05-10 10:15:53 (EDT)
committer mgolubev2012-05-10 10:15:53 (EDT)
commit63d5f3f6821284830b3149963f643233a8c8c178 (patch)
treecbc1ec1ff34f7596ba9afa9ac279776265cd9484
parent2acb3fe7775eca8223318d59035028225097563b (diff)
downloadorg.eclipse.gmf-tooling-63d5f3f6821284830b3149963f643233a8c8c178.zip
org.eclipse.gmf-tooling-63d5f3f6821284830b3149963f643233a8c8c178.tar.gz
org.eclipse.gmf-tooling-63d5f3f6821284830b3149963f643233a8c8c178.tar.bz2
CustomBehaviours library contains mappings for CustomBehaviour objects, e.g. VisualEffect
-rw-r--r--plugins/org.eclipse.gmf.bridge/transforms/CustomBehaviours.qvto56
1 files changed, 56 insertions, 0 deletions
diff --git a/plugins/org.eclipse.gmf.bridge/transforms/CustomBehaviours.qvto b/plugins/org.eclipse.gmf.bridge/transforms/CustomBehaviours.qvto
new file mode 100644
index 0000000..d9f3ab2
--- /dev/null
+++ b/plugins/org.eclipse.gmf.bridge/transforms/CustomBehaviours.qvto
@@ -0,0 +1,56 @@
+/**
+ * Copyright (c) 2011, 2012 Montages A.G.
+ * 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:
+ * Guillaume Hillairet (Montages A.G.) : initial implementation
+*/
+library CustomBehaviours;
+
+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');
+
+--
+-- VisualEffect
+--
+
+mapping GMFMAP::VisualEffectMapping::createVisualEffects(parent: GMFGEN::GenNode): GMFGEN::GenVisualEffect {
+ name := self.diagramPin.name;
+ pinKind := self.diagramPin.oclAsType(EObject).eClass().name;
+ operationName := self.diagramPin.getOperationName();
+ operationType := self.diagramPin.getOperationType();
+ oclExpression := self.oclExpression;
+
+ editPolicyQualifiedClassName :=
+ parent.getDiagram().editPoliciesPackageName +
+ '.' +
+ self.diagramPin.name.firstToUpper() + // FIXME Should be valid Java Class Name
+ parent.visualID.toString();
+ key := result.editPolicyQualifiedClassName + '.KEY';
+}
+
+--
+-- Helpers
+--
+
+helper GMFGRAPH::DiagramElement::getOperationName(pin: GMFGRAPH::Pin): String =
+ if not self.figure.actualFigure.hasFigurePin(pin) then
+ let graphChildAccess = self.figure.accessors->any(figure.hasFigurePin(pin)) in
+ if graphChildAccess.oclIsUndefined() then
+ pin.getOperationName()
+ else
+ graphChildAccess.accessor + "()." + pin.getOperationName()
+ endif
+ else pin.getOperationName() endif;
+
+helper GMFGRAPH::Figure::hasFigurePin(pin: GMFGRAPH::Pin): Boolean =
+ let realFigure =
+ if self.oclIsTypeOf(FigureRef) then
+ self.oclAsType(FigureRef).figure
+ else self.oclAsType(RealFigure) endif
+ in realFigure.pins->includes(pin);