blob: 7c3dc7e49ee054c7ac1a7ff82e356398837e5c63 (
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
|
/*
* Copyright (c) 2006, 2007 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 "http://www.eclipse.org/gmf/2006/GraphicalDefinition";
import "http://www.eclipse.org/emf/2002/Ecore";
String compilationUnitName(gmfgraph::FigureDescriptor figure) :
figure.name.toFirstUpper()
;
Boolean hasSourceDecoration(gmfgraph::PolylineConnection figure) :
null != figure.sourceDecoration
;
List[String] requiredBundles(List[String] referencedBundles) :
isFullRuntime() /*&& usesLabelOrPolyline) || usesMapMode()*/ ?
{"org.eclipse.core.runtime","org.eclipse.draw2d", "org.eclipse.gmf.runtime.draw2d.ui"}.union(referencedBundles).toList().purgeDups() :
{"org.eclipse.core.runtime","org.eclipse.draw2d"}.union(referencedBundles).toList().purgeDups()
;
String additionalStaticFields() :
GLOBALVAR outputStaticFields
;
EBoolean hasTargetDecoration(gmfgraph::PolylineConnection figure) :
null != figure.targetDecoration
;
cached boolean isFullRuntime() :
internalCheckRuntimeToken() != null ? internalCheckRuntimeToken().toLowerCase() == "full" : true
;
private String internalCheckRuntimeToken() : GLOBALVAR runtimeToken;
boolean needsField(gmfgraph::RealFigure figure) :
// XXX consider adding generation option "fields for all figures"
figure.descriptor != null && figure.descriptor.accessors.figure.contains(figure)
;
String figureVariableName(gmfgraph::RealFigure figure, EInt count) :
figure.name != null && figure.name.trim().length() > 0 ?
figure.name.toFirstLower() + count :
variableNameStem(figure) + count
;
String nameStem(FigureRef fig) : variableNameStem(fig.figure);
String nameStem(Figure fig) : variableNameStem(fig);
// actually, should be smth like fig.eClass().name
private String variableNameStem(Figure fig) : "fig";
private String variableNameStem(RealFigure fig) : "fig";
private String variableNameStem(Shape fig) : "shape";
private String variableNameStem(Rectangle fig) : "rect";
private String variableNameStem(RoundedRectangle fig) : "rrect";
private String variableNameStem(Ellipse fig) : "elli";
private String variableNameStem(Polyline fig) : "polyline";
private String variableNameStem(Label fig) : "l";
private String variableNameStem(DecorationFigure fig) : "dec";
private String variableNameStem(ConnectionFigure fig) : "conn";
// assert needsField() == true
String figureFieldName(gmfgraph::RealFigure figure) :
figureFieldName(figure.descriptor.accessors.select(a | (figure == a.figure)))
;
private String figureFieldName(List[ChildAccess] aaa) :
aaa.collect(x | figureFieldName(x)).toList().first()
;
String figureFieldName(gmfgraph::ChildAccess childAccess) :
"f" + childAccess.accessor
;
// assert needsField() == true
String figureFieldGetter(gmfgraph::ChildAccess childAccess) :
"getFigure" + childAccess.accessor
;
String borderLayoutConstant(gmfgraph::BorderLayoutData layoutData) :
switch (layoutData.alignment) {
case Alignment::BEGINNING : ( layoutData.vertical ? "TOP" : "LEFT" )
case Alignment::END : ( layoutData.vertical ? "BOTTOM" : "RIGHT" )
default : "CENTER"
}
;
EString messageFormat(EString pattern, List[Object] argument) :
JAVA java.text.MessageFormat.format(java.lang.String, java.lang.Object.List)
;
|