blob: 6e9ca8b1a78b2eae4dc9b674d7a3888eedaccafa (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
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+' ');
}
|