Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 123bb9db10d97e440f24011f7692977b41c7ff74 (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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
«IMPORT 'http://www.eclipse.org/gmf/2009/GenModel'»

«EXTENSION xpt::diagram::editparts::Utils»

«DEFINE Main FOR gmfgen::GenContainerBase-»
«EXPAND xpt::Common::copyright FOR getDiagram().editorGen-»
package «EXPAND packageName»;

«EXPAND xpt::Common::generatedClassComment»
public class «EXPAND className»
		extends «getDiagram().providersPackageName».«getDiagram().modelingAssistantProviderClassName» {

	«EXPAND getTypesForPopupBar-»

	«EXPAND additions-»	
}
«ENDDEFINE»

«DEFINE className FOR gmfgen::GenContainerBase»«getDiagram().modelingAssistantProviderClassName»Of«editPartClassName»«ENDDEFINE»

«DEFINE packageName FOR gmfgen::GenContainerBase»«getDiagram().providersPackageName»«ENDDEFINE»

«DEFINE qualifiedClassName FOR gmfgen::GenContainerBase»«EXPAND packageName».«EXPAND className»«ENDDEFINE»

«DEFINE getTypesForPopupBar FOR gmfgen::GenContainerBase-»
	«LET self AS container-»		
		«IF container.getAssistantNodes()->size() > 0-»					
	«EXPAND xpt::Common::generatedMemberComment»
	public java.util.List getTypesForPopupBar(org.eclipse.core.runtime.IAdaptable host) {
		«EXPAND CodeStyle::newGenericInstance('types', 'java.util.ArrayList', 'org.eclipse.gmf.runtime.emf.type.core.IElementType')»(«container.getAssistantNodes()->size()»);
			«FOREACH container.getAssistantNodes()->asSequence() AS node-»
		types.add(«EXPAND xpt::providers::ElementTypes::accessElementType FOR node»);
			«ENDFOREACH-»
		return types;	
	}
		«ENDIF-»
	«ENDLET-»
«ENDDEFINE»

«DEFINE additions FOR gmfgen::GenContainerBase»«ENDDEFINE»

«DEFINE additions FOR gmfgen::GenNode-»
«IF getAssistantOutgoingLinks(self)->size() > 0-»
	«EXPAND getRelTypesOnSource-»
	
	«EXPAND doGetRelTypesOnSource-»
	
	«EXPAND getRelTypesOnSourceAndTarget-»	

	«EXPAND doGetRelTypesOnSourceAndTarget-»	

	«EXPAND getTypesForTarget-»	

	«EXPAND doGetTypesForTarget-»
«ENDIF-»	

«IF getAssistantIncomingLinks(self)->size() > 0-»
	«EXPAND getRelTypesOnTarget-»	

	«EXPAND doGetRelTypesOnTarget-»	

	«EXPAND getTypesForSource-»

	«EXPAND doGetTypesForSource-»
«ENDIF-»
«ENDDEFINE»

«DEFINE getRelTypesOnSource FOR gmfgen::GenNode-»
	«EXPAND xpt::Common::generatedMemberComment»
	public java.util.List getRelTypesOnSource(org.eclipse.core.runtime.IAdaptable source) {
		org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart sourceEditPart =
				(org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart) source.getAdapter(
						org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart.class);
		return doGetRelTypesOnSource((«getEditPartQualifiedClassName()») sourceEditPart);
	}
«ENDDEFINE»

«DEFINE getRelTypesOnTarget FOR gmfgen::GenNode-»
	«EXPAND xpt::Common::generatedMemberComment»
	public java.util.List getRelTypesOnTarget(org.eclipse.core.runtime.IAdaptable target) {
		org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart targetEditPart =
				(org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart) target.getAdapter(
						org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart.class);
		return doGetRelTypesOnTarget((«getEditPartQualifiedClassName()») targetEditPart);
	}
«ENDDEFINE»

«DEFINE getRelTypesOnSourceAndTarget FOR gmfgen::GenNode-»
	«EXPAND xpt::Common::generatedMemberComment»
	public java.util.List getRelTypesOnSourceAndTarget(
			org.eclipse.core.runtime.IAdaptable source, org.eclipse.core.runtime.IAdaptable target) {
		org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart sourceEditPart =
				(org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart) source.getAdapter(
						org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart.class);
		org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart targetEditPart =
				(org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart) target.getAdapter(
						org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart.class);
		return doGetRelTypesOnSourceAndTarget((«getEditPartQualifiedClassName()») sourceEditPart, targetEditPart);
	}
«ENDDEFINE»

«DEFINE getTypesForSource FOR gmfgen::GenNode-»
	«EXPAND xpt::Common::generatedMemberComment»
	public java.util.List getTypesForSource(org.eclipse.core.runtime.IAdaptable target,
			org.eclipse.gmf.runtime.emf.type.core.IElementType relationshipType) {
		org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart targetEditPart =
				(org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart) target.getAdapter(
						org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart.class);
		return doGetTypesForSource((«getEditPartQualifiedClassName()») targetEditPart, relationshipType);
	}
«ENDDEFINE»

«DEFINE getTypesForTarget FOR gmfgen::GenNode-»
	«IF getAssistantOutgoingLinks(self)->size() > 0-»
	«EXPAND xpt::Common::generatedMemberComment»
	public java.util.List getTypesForTarget(org.eclipse.core.runtime.IAdaptable source,
			org.eclipse.gmf.runtime.emf.type.core.IElementType relationshipType) {
		org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart sourceEditPart =
				(org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart) source.getAdapter(
						org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart.class);
		return doGetTypesForTarget((«getEditPartQualifiedClassName()») sourceEditPart, relationshipType);
	}
	«ENDIF-»
«ENDDEFINE»

// pre: getAssistantOutgoingLinks(this).size() > 0
«DEFINE doGetRelTypesOnSource FOR gmfgen::GenNode-»
	«EXPAND xpt::Common::generatedMemberComment»
	public «EXPAND CodeStyle::G('java.util.List', 'org.eclipse.gmf.runtime.emf.type.core.IElementType')» doGetRelTypesOnSource(«getEditPartQualifiedClassName()» source) {
		«EXPAND CodeStyle::newGenericInstance('types', 'java.util.ArrayList', 'org.eclipse.gmf.runtime.emf.type.core.IElementType')»(«getAssistantOutgoingLinks(self)->size()»);
		«FOREACH getAssistantOutgoingLinks(self) AS link-»
		types.add(«EXPAND xpt::providers::ElementTypes::accessElementType FOR link»);
		«ENDFOREACH-»
		return types;
	}
«ENDDEFINE»

// pre: getAssistantIncomingLinks(this).size() > 0
«DEFINE doGetRelTypesOnTarget FOR gmfgen::GenNode-»
	«EXPAND xpt::Common::generatedMemberComment»
	public «EXPAND CodeStyle::G('java.util.List', 'org.eclipse.gmf.runtime.emf.type.core.IElementType')» doGetRelTypesOnTarget(«getEditPartQualifiedClassName()» target) {
		«EXPAND CodeStyle::newGenericInstance('types', 'java.util.ArrayList', 'org.eclipse.gmf.runtime.emf.type.core.IElementType')»(«getAssistantIncomingLinks(self)->size()»);
		«FOREACH getAssistantIncomingLinks(self) AS link-»
		types.add(«EXPAND xpt::providers::ElementTypes::accessElementType FOR link»);
		«ENDFOREACH-»
		return types;
	}
«ENDDEFINE»

// pre: getAssistantOutgoingLinks(this).size() > 0
«DEFINE doGetRelTypesOnSourceAndTarget FOR gmfgen::GenNode-»
	«EXPAND xpt::Common::generatedMemberComment»
	public «EXPAND CodeStyle::G('java.util.List', 'org.eclipse.gmf.runtime.emf.type.core.IElementType')» doGetRelTypesOnSourceAndTarget(«getEditPartQualifiedClassName()» source, org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart targetEditPart) {
		«EXPAND CodeStyle::newGenericInstance('types', 'java.util.LinkedList', 'org.eclipse.gmf.runtime.emf.type.core.IElementType')»();
		«FOREACH getAssistantOutgoingLinks(self) AS link-»
			«FOREACH selectGenNodes(link.targets) AS target-»
		if (targetEditPart instanceof «target.getEditPartQualifiedClassName()») {
			types.add(«EXPAND xpt::providers::ElementTypes::accessElementType FOR link»);
		}
			«ENDFOREACH-»
		«ENDFOREACH-»
		return types;
	}
«ENDDEFINE»

// pre: getAssistantIncomingLinks(this).size() > 0
«DEFINE doGetTypesForSource FOR gmfgen::GenNode-»
	«EXPAND xpt::Common::generatedMemberComment»
	public «EXPAND CodeStyle::G('java.util.List', 'org.eclipse.gmf.runtime.emf.type.core.IElementType')» doGetTypesForSource(«getEditPartQualifiedClassName()» target, org.eclipse.gmf.runtime.emf.type.core.IElementType relationshipType) {
		«EXPAND CodeStyle::newGenericInstance('types', 'java.util.LinkedList', 'org.eclipse.gmf.runtime.emf.type.core.IElementType')»();
		«FOREACH getAssistantIncomingLinks(self) AS link SEPARATOR ' else '-»
		if (relationshipType == «EXPAND xpt::providers::ElementTypes::accessElementType FOR link») {
			«FOREACH selectGenNodes(link.sources) AS source-»
			types.add(«EXPAND xpt::providers::ElementTypes::accessElementType FOR source»);
			«ENDFOREACH-»
		}
		«ENDFOREACH-»
		return types;
	}
«ENDDEFINE»

// pre: getAssistantOutgoingLinks(this).size() > 0
«DEFINE doGetTypesForTarget FOR gmfgen::GenNode-»
	«EXPAND xpt::Common::generatedMemberComment»
	public «EXPAND CodeStyle::G('java.util.List', 'org.eclipse.gmf.runtime.emf.type.core.IElementType')» doGetTypesForTarget(«getEditPartQualifiedClassName()» source, org.eclipse.gmf.runtime.emf.type.core.IElementType relationshipType) {
		«EXPAND CodeStyle::newGenericInstance('types', 'java.util.LinkedList', 'org.eclipse.gmf.runtime.emf.type.core.IElementType')»();
		«FOREACH getAssistantOutgoingLinks(self) AS link SEPARATOR ' else '-»
		if (relationshipType == «EXPAND xpt::providers::ElementTypes::accessElementType FOR link») {
			«FOREACH selectGenNodes(link.targets) AS target-»
			types.add(«EXPAND xpt::providers::ElementTypes::accessElementType FOR target»);
			«ENDFOREACH-»
		}
		«ENDFOREACH-»
		return types;
	}
«ENDDEFINE»


Back to the top