diff options
Diffstat (limited to 'plugins/toolsmiths/org.eclipse.papyrus.dev.types/transforms/VisualID Migration/PrintVisualIDMap.qvto')
-rw-r--r-- | plugins/toolsmiths/org.eclipse.papyrus.dev.types/transforms/VisualID Migration/PrintVisualIDMap.qvto | 125 |
1 files changed, 125 insertions, 0 deletions
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.dev.types/transforms/VisualID Migration/PrintVisualIDMap.qvto b/plugins/toolsmiths/org.eclipse.papyrus.dev.types/transforms/VisualID Migration/PrintVisualIDMap.qvto new file mode 100644 index 00000000000..6e9ca8b1a78 --- /dev/null +++ b/plugins/toolsmiths/org.eclipse.papyrus.dev.types/transforms/VisualID Migration/PrintVisualIDMap.qvto @@ -0,0 +1,125 @@ +/** + * Copyright (c) 2016 CEA LIST. + * + * 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: + * CEA LIST - Initial API and implementation + */ +modeltype UML uses "http://www.eclipse.org/uml2/4.0.0/UML"; +modeltype ElementTypes uses "http://www.eclipse.org/papyrus/infra/elementtypesconfigurations/1.1"; +modeltype GMFGen uses 'http://www.eclipse.org/gmf/2009/GenModel'; +modeltype PapyrusExtension uses 'http://www.eclipse.org/papyrus/2009/papyrusgmfgenextension'; + +transformation PrintVisualIDMap(in gmf : GMFGen); + +main() { + log("public static String getNewVisualID(String oldVisualID) {"); + log("switch(oldVisualID) {"); + gmf.objectsOfKind(GenCommonBase)->forEach(g) { + log("case \""+g.visualID.toString()+"\":"); + log ("return \""+gmf.objectsOfKind(PapyrusExtension::VisualIDOverride)->selectOne(genView = g).visualID+"\";"); + }; + log ("default:"); + log ("return defaultGetNewVisualID(oldVisualID);"); + log("}"); + log("}"); +} + +mapping GMFGen::GenEditorGenerator::print() { + log('Diagrams'); + self.diagram.map print(''); +} + +mapping GMFGen::GenCommonBase::print(s : String) +{ + //log(s+self.editPartClassName); + log(if self.elementType->notEmpty() then self.elementType.uniqueIdentifier else '' endif); +} + +mapping GMFGen::GenContainerBase::print(s : String) + inherits GMFGen::GenCommonBase::print +{ +} + +mapping GMFGen::GenDiagram::print(s : String) + inherits GMFGen::GenContainerBase::print +{ + log('\n List Item Labels'); + self.childNodes[GenChildLabelNode]->map print(s+' '); + log('\nBorder Shapes'); + self.childNodes[GenChildSideAffixedNode]->map print(s+' '); + log('\nNested Nodes'); + self.childNodes->select(oclIsTypeOf(GenChildNode))->map print(s+' '); + log('\nCompartments'); + self.compartments->map print(s+' '); + log('\nShapes'); + self.topLevelNodes->map print(s+' '); + log('\nEdges'); + self.links->map print(s+' '); +} + +mapping GMFGen::GenChildContainer::print(s : String) + inherits GMFGen::GenContainerBase::print +{ +} + +mapping GMFGen::GenNode::print(s : String) + inherits GMFGen::GenChildContainer::print +{ + self.labels->map print(s+' '); +} + +mapping GMFGen::GenChildNode::print(s : String) + inherits GMFGen::GenNode::print +{ +} + +mapping GMFGen::GenChildLabelNode::print(s : String) + inherits GMFGen::GenChildNode::print +{ +} + +mapping GMFGen::GenChildSideAffixedNode::print(s : String) + inherits GMFGen::GenChildNode::print +{ +} + +mapping GMFGen::GenTopLevelNode::print(s : String) + inherits GMFGen::GenNode::print +{ +} + +mapping GMFGen::GenCompartment::print(s : String) + inherits GMFGen::GenChildContainer::print +{ +} + +mapping GMFGen::GenLabel::print(s : String) + inherits GMFGen::GenCommonBase::print +{ +} + +mapping GMFGen::GenNodeLabel::print(s : String) + inherits GMFGen::GenLabel::print +{ +} + +mapping GMFGen::GenExternalNodeLabel::print(s : String) + inherits GMFGen::GenNodeLabel::print +{ +} + +mapping GMFGen::GenLinkLabel::print(s : String) + inherits GMFGen::GenLabel::print +{ +} + +mapping GMFGen::GenLink::print(s : String) + inherits GMFGen::GenCommonBase::print +{ + self.labels->map print(s+' '); +} |