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/editor/palette/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/editor/palette/Utils.qvto')
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/palette/Utils.qvto49
1 files changed, 49 insertions, 0 deletions
diff --git a/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/palette/Utils.qvto b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/palette/Utils.qvto
new file mode 100644
index 000000000..b7f133e41
--- /dev/null
+++ b/plugins/org.eclipse.gmf.codegen/templates.migrated/xpt/editor/palette/Utils.qvto
@@ -0,0 +1,49 @@
+import xpt.StringOperations;
+
+modeltype genModel uses "http://www.eclipse.org/gmf/2008/GenModel";
+
+library Utils;
+
+helper genModel::Palette::activatorFQN() : String {
+ return self.diagram.editorGen.plugin.getActivatorQualifiedClassName()
+}
+
+helper genModel::AbstractToolEntry::activatorFQN() : String {
+ return self.group.palette.activatorFQN()
+}
+
+helper genModel::ToolGroup::activatorFQN() : String {
+ return self.palette.activatorFQN()
+}
+
+helper i18nKey(group : genModel::EntryBase) : String {
+ return let rv = group.createMethodName in (if rv.xpandStartsWith('get') then rv.xpandSubstring(3) else (if rv.xpandStartsWith('create') then rv.xpandSubstring(6) else rv endif) endif)
+}
+
+helper i18nTitleKey(group : genModel::EntryBase) : String {
+ return i18nKey(group) + '_title'
+}
+
+helper i18nDescKey(group : genModel::EntryBase) : String {
+ return i18nKey(group) + '_desc'
+}
+
+helper collectGroups(palette : genModel::Palette) : Sequence(genModel::ToolGroup) {
+ return palette.groups->asSequence()->union(palette.groups->collect(it | collectSubGroups(it)))->asOrderedSet()->asSequence()
+}
+
+helper collectSubGroups(group : genModel::ToolGroup) : Sequence(genModel::ToolGroup) {
+ return let rv = (group.entries)[genModel::ToolGroup] in rv->union(rv->collect(g | collectSubGroups(g))->flatten()->asSet())->asSequence()
+}
+
+helper collectTools(palette : genModel::Palette) : Sequence(genModel::AbstractToolEntry) {
+ return collectGroups(palette)->collect(g | (g.entries)[genModel::AbstractToolEntry])->flatten()
+}
+
+helper needsNodeToolEntryClass(palette : genModel::Palette) : Boolean {
+ return (collectTools(palette))[genModel::ToolEntry]->exists(e | not e.genNodes->isEmpty())
+}
+
+helper needsLinkToolEntryClass(palette : genModel::Palette) : Boolean {
+ return (collectTools(palette))[genModel::ToolEntry]->exists(e | not e.genLinks->isEmpty())
+}

Back to the top