Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/developer/org.eclipse.papyrus.def/dynamic-templates3.5/codegen/xpt/editor/palette/Utils.qvto')
-rw-r--r--plugins/developer/org.eclipse.papyrus.def/dynamic-templates3.5/codegen/xpt/editor/palette/Utils.qvto85
1 files changed, 0 insertions, 85 deletions
diff --git a/plugins/developer/org.eclipse.papyrus.def/dynamic-templates3.5/codegen/xpt/editor/palette/Utils.qvto b/plugins/developer/org.eclipse.papyrus.def/dynamic-templates3.5/codegen/xpt/editor/palette/Utils.qvto
deleted file mode 100644
index b699f8e7697..00000000000
--- a/plugins/developer/org.eclipse.papyrus.def/dynamic-templates3.5/codegen/xpt/editor/palette/Utils.qvto
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Copyright (c) 2006, 2009 Borland Software Corporation
- *
- * 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:
- * Artem Tikhomirov (Borland) - initial API and implementation
- */
-
-import xpt.StringOperations;
-
-modeltype gmfgen uses "http://www.eclipse.org/gmf/2009/GenModel";
-
-library Utils;
-
-helper gmfgen::Palette::activatorFQN() : String {
- return self.diagram.editorGen.plugin.getActivatorQualifiedClassName()
-}
-
-helper gmfgen::AbstractToolEntry::activatorFQN() : String {
- return self.group.palette.activatorFQN()
-}
-
-helper gmfgen::ToolGroup::activatorFQN() : String {
- return self.palette.activatorFQN()
-}
-
-helper i18nKey(group : gmfgen::EntryBase) : String {
- return let rv = group.createMethodName in (if rv.startsWith('get') then rv.xpandSubstring(3) else (if rv.startsWith('create') then rv.xpandSubstring(6) else rv endif) endif)
-}
-
-helper i18nTitleKey(group : gmfgen::EntryBase) : String {
- return i18nKey(group) + '_title'
-}
-
-helper i18nDescKey(group : gmfgen::EntryBase) : String {
- return i18nKey(group) + '_desc'
-}
-
-helper collectGroups(palette : gmfgen::Palette) : Sequence(gmfgen::ToolGroup) {
- return palette.groups->asSequence()->union(palette.groups->collect(it | collectSubGroups(it)))->asOrderedSet()->asSequence()
-}
-
-helper collectSubGroups(group : gmfgen::ToolGroup) : Sequence(gmfgen::ToolGroup) {
- return let rv = (group.entries)[gmfgen::ToolGroup] in rv->union(rv->collect(g | collectSubGroups(g))->flatten()->asSet())->asSequence()
-}
-
-/**
- * collect all tools availables and valid to generate the palette. A tool is not valid when it does not create either a link or a node
- */
-helper collectTools(palette : gmfgen::Palette) : Sequence(gmfgen::AbstractToolEntry) {
- return collectGroups(palette).entries[gmfgen::AbstractToolEntry]->select(tool | tool.isValidTool())
-}
-
-helper gmfgen::AbstractToolEntry::isValidTool() : Boolean {
- return if(self.oclIsKindOf(ToolEntry)) then ( self[gmfgen::ToolEntry].genNodes->size()+self[gmfgen::ToolEntry].genLinks->size() ) <> 0 else true endif
-}
-
-helper needsNodeToolEntryClass(palette : gmfgen::Palette) : Boolean {
- return collectTools(palette)[gmfgen::ToolEntry]->exists(genNodes->notEmpty())
-}
-
-helper needsLinkToolEntryClass(palette : gmfgen::Palette) : Boolean {
- return collectTools(palette)[gmfgen::ToolEntry]->exists(genLinks->notEmpty())
-}
-
-helper String::getToolPath() : String {
- /** returns the '/' separator and then the id of the parent group path */
- return "/".concat(if(self.isQuoted('\"')) then self.substring(2, self.size()-1) else self endif)
-}
-
-helper String::getConstantIDName() : String {
- return if(self.isQuoted('\"')) then getUpperAndUnderscoreString(self.substring(2, self.size()-1)) else getUpperAndUnderscoreString(self) endif
-}
-
-helper getUpperAndUnderscoreString(value:String) : String {
- return getUpper(value).replace(".", "_")
-}
-
-helper getUpper(value:String) : String {
- return value.toUpper();
-}

Back to the top