Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorashatalin2008-12-29 07:41:38 -0500
committerashatalin2008-12-29 07:41:38 -0500
commitfc1dfb3b462e159eec1b6031bb41ab79c762474b (patch)
tree66acb7873f68640147106dcd919a5041ecbc918b /plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/Utils.qvto
parent7f3bb1960b122d5d9c4edae8dc1c330032c9cf60 (diff)
downloadorg.eclipse.gmf-tooling-fc1dfb3b462e159eec1b6031bb41ab79c762474b.tar.gz
org.eclipse.gmf-tooling-fc1dfb3b462e159eec1b6031bb41ab79c762474b.tar.xz
org.eclipse.gmf-tooling-fc1dfb3b462e159eec1b6031bb41ab79c762474b.zip
QVTO-based xpand implementation was merged to HEAD
Diffstat (limited to 'plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/Utils.qvto')
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/Utils.qvto31
1 files changed, 31 insertions, 0 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
new file mode 100644
index 000000000..551978384
--- /dev/null
+++ b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/diagram/Utils.qvto
@@ -0,0 +1,31 @@
+import xpt.NativeGenModelUtils;
+
+import xpt.GenModelUtils;
+
+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())
+}
+
+helper hasExplicitChildFeature(facet : genModel::TypeModelFacet) : Boolean {
+ return not isDerived(facet.childMetaFeature) and facet.childMetaFeature <> facet.containmentMetaFeature
+}
+
+helper hasContainerOtherThanSource(facet : genModel::TypeLinkModelFacet) : Boolean {
+ return facet.sourceMetaFeature <> null or facet.childMetaFeature <> facet.containmentMetaFeature
+}
+
+helper allPreferencePages(genDiagram : genModel::GenDiagram) : Sequence(genModel::GenPreferencePage) {
+ return recursePages(genDiagram.preferencePages->asSequence())
+}
+
+helper recursePages(pages : Sequence(genModel::GenPreferencePage)) : Sequence(genModel::GenPreferencePage) {
+ return (if pages->isEmpty() then pages else pages->union(recursePages(pages.children))->asOrderedSet()->asSequence() endif)
+}

Back to the top