1 | /* |
2 | *Copyright 2006 SDQ Research Group, University of Karlsruhe (TH) |
3 | */ |
4 | package de.uka.ipd.sdq.pcm.gmf.seff.providers; |
5 | |
6 | import java.util.ArrayList; |
7 | import java.util.Collection; |
8 | import java.util.Collections; |
9 | import java.util.HashSet; |
10 | import java.util.Iterator; |
11 | import java.util.List; |
12 | |
13 | import org.eclipse.core.runtime.IAdaptable; |
14 | import org.eclipse.emf.ecore.EObject; |
15 | import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider; |
16 | import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; |
17 | import org.eclipse.gmf.runtime.emf.type.core.ElementTypeRegistry; |
18 | import org.eclipse.gmf.runtime.emf.type.core.IElementType; |
19 | import org.eclipse.gmf.runtime.emf.ui.services.modelingassistant.ModelingAssistantProvider; |
20 | import org.eclipse.gmf.runtime.notation.Diagram; |
21 | import org.eclipse.jface.viewers.ILabelProvider; |
22 | import org.eclipse.jface.window.Window; |
23 | import org.eclipse.swt.widgets.Display; |
24 | import org.eclipse.swt.widgets.Shell; |
25 | import org.eclipse.ui.dialogs.ElementListSelectionDialog; |
26 | |
27 | import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.AcquireAction2EditPart; |
28 | import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.AcquireActionEditPart; |
29 | import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.BranchAction2EditPart; |
30 | import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.BranchActionBranchTransitionCompartment2EditPart; |
31 | import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.BranchActionBranchTransitionCompartmentEditPart; |
32 | import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.BranchActionEditPart; |
33 | import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.CollectionIteratorAction2EditPart; |
34 | import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.CollectionIteratorActionEditPart; |
35 | import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.EmitEventAction2EditPart; |
36 | import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.EmitEventActionEditPart; |
37 | import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.ExternalCallAction2EditPart; |
38 | import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.ExternalCallActionEditPart; |
39 | import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.ForkAction2EditPart; |
40 | import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.ForkActionEditPart; |
41 | import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.ForkActionForkedBehaviours2EditPart; |
42 | import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.ForkActionForkedBehavioursEditPart; |
43 | import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.ForkedBehaviourBehaviourCompartmentEditPart; |
44 | import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.ForkedBehaviourSynchronisationPointForkedBehavioursEditPart; |
45 | import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.GuardedBranchTransitionEditPart; |
46 | import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.InfrastructureCallEditPart; |
47 | import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.InfrastructureCallInfrastructureCallInputVariableUsagesEditPart; |
48 | import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.InternalAction2EditPart; |
49 | import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.InternalActionEditPart; |
50 | import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.InternalActionInfrastructureCallsCompartment2EditPart; |
51 | import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.InternalActionInfrastructureCallsCompartmentEditPart; |
52 | import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.LoopAction2EditPart; |
53 | import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.LoopActionEditPart; |
54 | import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.ProbabilisticBranchTransitionEditPart; |
55 | import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.RecoveryAction2EditPart; |
56 | import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.RecoveryActionBehaviourAlternativeBehaviourCompartmentEditPart; |
57 | import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.RecoveryActionBehaviourEditPart; |
58 | import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.RecoveryActionEditPart; |
59 | import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.RecoveryActionRecoveryBlockCompartment2EditPart; |
60 | import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.RecoveryActionRecoveryBlockCompartmentEditPart; |
61 | import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.ReleaseAction2EditPart; |
62 | import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.ReleaseActionEditPart; |
63 | import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.ResourceDemandingBehaviourBehaviourCompartment2EditPart; |
64 | import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.ResourceDemandingBehaviourBehaviourCompartment3EditPart; |
65 | import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.ResourceDemandingBehaviourBehaviourCompartment4EditPart; |
66 | import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.ResourceDemandingBehaviourBehaviourCompartmentEditPart; |
67 | import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.ResourceDemandingSEFFEditPart; |
68 | import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.SetVariableAction2EditPart; |
69 | import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.SetVariableActionEditPart; |
70 | import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.StartAction2EditPart; |
71 | import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.StartActionEditPart; |
72 | import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.StopAction2EditPart; |
73 | import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.StopActionEditPart; |
74 | import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.SynchronisationPointSynchronisationPointEditPart; |
75 | import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.VariableUsage2EditPart; |
76 | import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.VariableUsage3EditPart; |
77 | import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.VariableUsage4EditPart; |
78 | import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.VariableUsage5EditPart; |
79 | import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.VariableUsageEditPart; |
80 | import de.uka.ipd.sdq.pcm.gmf.seff.part.Messages; |
81 | import de.uka.ipd.sdq.pcm.gmf.seff.part.PalladioComponentModelSeffDiagramEditorPlugin; |
82 | |
83 | /** |
84 | * @generated |
85 | */ |
86 | public class PalladioComponentModelModelingAssistantProvider extends |
87 | ModelingAssistantProvider { |
88 | |
89 | /** |
90 | * @generated |
91 | */ |
92 | public List getTypesForPopupBar(IAdaptable host) { |
93 | IGraphicalEditPart editPart = (IGraphicalEditPart) host |
94 | .getAdapter(IGraphicalEditPart.class); |
95 | if (editPart instanceof ExternalCallActionEditPart) { |
96 | ArrayList types = new ArrayList(2); |
97 | types.add(PalladioComponentModelElementTypes.VariableUsage_3042); |
98 | types.add(PalladioComponentModelElementTypes.VariableUsage_3049); |
99 | return types; |
100 | } |
101 | if (editPart instanceof EmitEventActionEditPart) { |
102 | ArrayList types = new ArrayList(1); |
103 | types.add(PalladioComponentModelElementTypes.VariableUsage_3047); |
104 | return types; |
105 | } |
106 | if (editPart instanceof LoopActionEditPart) { |
107 | ArrayList types = new ArrayList(1); |
108 | types |
109 | .add(PalladioComponentModelElementTypes.ResourceDemandingBehaviour_3003); |
110 | return types; |
111 | } |
112 | if (editPart instanceof InternalActionEditPart) { |
113 | ArrayList types = new ArrayList(3); |
114 | types |
115 | .add(PalladioComponentModelElementTypes.ParametricResourceDemand_3051); |
116 | types |
117 | .add(PalladioComponentModelElementTypes.InternalFailureOccurrenceDescription_3050); |
118 | types |
119 | .add(PalladioComponentModelElementTypes.InfrastructureCall_3053); |
120 | return types; |
121 | } |
122 | if (editPart instanceof CollectionIteratorActionEditPart) { |
123 | ArrayList types = new ArrayList(1); |
124 | types |
125 | .add(PalladioComponentModelElementTypes.ResourceDemandingBehaviour_3014); |
126 | return types; |
127 | } |
128 | if (editPart instanceof SetVariableActionEditPart) { |
129 | ArrayList types = new ArrayList(1); |
130 | types.add(PalladioComponentModelElementTypes.VariableUsage_3036); |
131 | return types; |
132 | } |
133 | if (editPart instanceof VariableUsageEditPart) { |
134 | ArrayList types = new ArrayList(1); |
135 | types |
136 | .add(PalladioComponentModelElementTypes.VariableCharacterisation_3033); |
137 | return types; |
138 | } |
139 | if (editPart instanceof VariableUsage2EditPart) { |
140 | ArrayList types = new ArrayList(1); |
141 | types |
142 | .add(PalladioComponentModelElementTypes.VariableCharacterisation_3035); |
143 | return types; |
144 | } |
145 | if (editPart instanceof VariableUsage4EditPart) { |
146 | ArrayList types = new ArrayList(1); |
147 | types |
148 | .add(PalladioComponentModelElementTypes.VariableCharacterisation_3037); |
149 | return types; |
150 | } |
151 | if (editPart instanceof LoopAction2EditPart) { |
152 | ArrayList types = new ArrayList(1); |
153 | types |
154 | .add(PalladioComponentModelElementTypes.ResourceDemandingBehaviour_3003); |
155 | return types; |
156 | } |
157 | if (editPart instanceof InternalAction2EditPart) { |
158 | ArrayList types = new ArrayList(3); |
159 | types |
160 | .add(PalladioComponentModelElementTypes.ParametricResourceDemand_3051); |
161 | types |
162 | .add(PalladioComponentModelElementTypes.InternalFailureOccurrenceDescription_3050); |
163 | types |
164 | .add(PalladioComponentModelElementTypes.InfrastructureCall_3053); |
165 | return types; |
166 | } |
167 | if (editPart instanceof InfrastructureCallEditPart) { |
168 | ArrayList types = new ArrayList(1); |
169 | types.add(PalladioComponentModelElementTypes.VariableUsage_3054); |
170 | return types; |
171 | } |
172 | if (editPart instanceof VariableUsage5EditPart) { |
173 | ArrayList types = new ArrayList(1); |
174 | types |
175 | .add(PalladioComponentModelElementTypes.VariableCharacterisation_3048); |
176 | return types; |
177 | } |
178 | if (editPart instanceof ProbabilisticBranchTransitionEditPart) { |
179 | ArrayList types = new ArrayList(1); |
180 | types |
181 | .add(PalladioComponentModelElementTypes.ResourceDemandingBehaviour_3011); |
182 | return types; |
183 | } |
184 | if (editPart instanceof ExternalCallAction2EditPart) { |
185 | ArrayList types = new ArrayList(2); |
186 | types.add(PalladioComponentModelElementTypes.VariableUsage_3042); |
187 | types.add(PalladioComponentModelElementTypes.VariableUsage_3049); |
188 | return types; |
189 | } |
190 | if (editPart instanceof EmitEventAction2EditPart) { |
191 | ArrayList types = new ArrayList(1); |
192 | types.add(PalladioComponentModelElementTypes.VariableUsage_3047); |
193 | return types; |
194 | } |
195 | if (editPart instanceof CollectionIteratorAction2EditPart) { |
196 | ArrayList types = new ArrayList(1); |
197 | types |
198 | .add(PalladioComponentModelElementTypes.ResourceDemandingBehaviour_3014); |
199 | return types; |
200 | } |
201 | if (editPart instanceof SetVariableAction2EditPart) { |
202 | ArrayList types = new ArrayList(1); |
203 | types.add(PalladioComponentModelElementTypes.VariableUsage_3036); |
204 | return types; |
205 | } |
206 | if (editPart instanceof VariableUsage3EditPart) { |
207 | ArrayList types = new ArrayList(1); |
208 | types |
209 | .add(PalladioComponentModelElementTypes.VariableCharacterisation_3055); |
210 | return types; |
211 | } |
212 | if (editPart instanceof GuardedBranchTransitionEditPart) { |
213 | ArrayList types = new ArrayList(1); |
214 | types |
215 | .add(PalladioComponentModelElementTypes.ResourceDemandingBehaviour_3018); |
216 | return types; |
217 | } |
218 | if (editPart instanceof ResourceDemandingBehaviourBehaviourCompartmentEditPart) { |
219 | ArrayList types = new ArrayList(13); |
220 | types.add(PalladioComponentModelElementTypes.StartAction_3004); |
221 | types.add(PalladioComponentModelElementTypes.StopAction_3005); |
222 | types.add(PalladioComponentModelElementTypes.LoopAction_3006); |
223 | types.add(PalladioComponentModelElementTypes.InternalAction_3007); |
224 | types.add(PalladioComponentModelElementTypes.BranchAction_3009); |
225 | types |
226 | .add(PalladioComponentModelElementTypes.ExternalCallAction_3012); |
227 | types.add(PalladioComponentModelElementTypes.EmitEventAction_3046); |
228 | types |
229 | .add(PalladioComponentModelElementTypes.CollectionIteratorAction_3013); |
230 | types.add(PalladioComponentModelElementTypes.AcquireAction_3026); |
231 | types.add(PalladioComponentModelElementTypes.ReleaseAction_3020); |
232 | types.add(PalladioComponentModelElementTypes.ForkAction_3023); |
233 | types |
234 | .add(PalladioComponentModelElementTypes.SetVariableAction_3024); |
235 | types.add(PalladioComponentModelElementTypes.RecoveryAction_3057); |
236 | return types; |
237 | } |
238 | if (editPart instanceof BranchActionBranchTransitionCompartmentEditPart) { |
239 | ArrayList types = new ArrayList(2); |
240 | types |
241 | .add(PalladioComponentModelElementTypes.ProbabilisticBranchTransition_3010); |
242 | types |
243 | .add(PalladioComponentModelElementTypes.GuardedBranchTransition_3017); |
244 | return types; |
245 | } |
246 | if (editPart instanceof ResourceDemandingBehaviourBehaviourCompartment2EditPart) { |
247 | ArrayList types = new ArrayList(13); |
248 | types.add(PalladioComponentModelElementTypes.StartAction_3004); |
249 | types.add(PalladioComponentModelElementTypes.StopAction_3005); |
250 | types.add(PalladioComponentModelElementTypes.LoopAction_3006); |
251 | types.add(PalladioComponentModelElementTypes.InternalAction_3007); |
252 | types.add(PalladioComponentModelElementTypes.BranchAction_3009); |
253 | types |
254 | .add(PalladioComponentModelElementTypes.ExternalCallAction_3012); |
255 | types.add(PalladioComponentModelElementTypes.EmitEventAction_3046); |
256 | types.add(PalladioComponentModelElementTypes.AcquireAction_3026); |
257 | types.add(PalladioComponentModelElementTypes.ReleaseAction_3020); |
258 | types.add(PalladioComponentModelElementTypes.ForkAction_3023); |
259 | types |
260 | .add(PalladioComponentModelElementTypes.CollectionIteratorAction_3013); |
261 | types |
262 | .add(PalladioComponentModelElementTypes.SetVariableAction_3024); |
263 | types.add(PalladioComponentModelElementTypes.RecoveryAction_3057); |
264 | return types; |
265 | } |
266 | if (editPart instanceof ForkActionForkedBehavioursEditPart) { |
267 | ArrayList types = new ArrayList(2); |
268 | types.add(PalladioComponentModelElementTypes.ForkedBehaviour_3027); |
269 | types |
270 | .add(PalladioComponentModelElementTypes.SynchronisationPoint_3038); |
271 | return types; |
272 | } |
273 | if (editPart instanceof ForkedBehaviourBehaviourCompartmentEditPart) { |
274 | ArrayList types = new ArrayList(12); |
275 | types.add(PalladioComponentModelElementTypes.StartAction_3004); |
276 | types.add(PalladioComponentModelElementTypes.StopAction_3005); |
277 | types.add(PalladioComponentModelElementTypes.LoopAction_3006); |
278 | types.add(PalladioComponentModelElementTypes.InternalAction_3007); |
279 | types.add(PalladioComponentModelElementTypes.BranchAction_3009); |
280 | types |
281 | .add(PalladioComponentModelElementTypes.ExternalCallAction_3012); |
282 | types.add(PalladioComponentModelElementTypes.EmitEventAction_3046); |
283 | types |
284 | .add(PalladioComponentModelElementTypes.CollectionIteratorAction_3013); |
285 | types.add(PalladioComponentModelElementTypes.AcquireAction_3026); |
286 | types.add(PalladioComponentModelElementTypes.ReleaseAction_3020); |
287 | types.add(PalladioComponentModelElementTypes.ForkAction_3023); |
288 | types.add(PalladioComponentModelElementTypes.RecoveryAction_3057); |
289 | return types; |
290 | } |
291 | if (editPart instanceof ResourceDemandingBehaviourBehaviourCompartment3EditPart) { |
292 | ArrayList types = new ArrayList(12); |
293 | types.add(PalladioComponentModelElementTypes.StartAction_3004); |
294 | types.add(PalladioComponentModelElementTypes.StopAction_3005); |
295 | types.add(PalladioComponentModelElementTypes.LoopAction_3006); |
296 | types.add(PalladioComponentModelElementTypes.InternalAction_3007); |
297 | types.add(PalladioComponentModelElementTypes.BranchAction_3009); |
298 | types |
299 | .add(PalladioComponentModelElementTypes.ExternalCallAction_3012); |
300 | types.add(PalladioComponentModelElementTypes.EmitEventAction_3046); |
301 | types |
302 | .add(PalladioComponentModelElementTypes.CollectionIteratorAction_3013); |
303 | types.add(PalladioComponentModelElementTypes.AcquireAction_3026); |
304 | types.add(PalladioComponentModelElementTypes.ReleaseAction_3020); |
305 | types.add(PalladioComponentModelElementTypes.ForkAction_3023); |
306 | types.add(PalladioComponentModelElementTypes.RecoveryAction_3057); |
307 | return types; |
308 | } |
309 | if (editPart instanceof RecoveryActionRecoveryBlockCompartmentEditPart) { |
310 | ArrayList types = new ArrayList(1); |
311 | types |
312 | .add(PalladioComponentModelElementTypes.RecoveryActionBehaviour_3058); |
313 | return types; |
314 | } |
315 | if (editPart instanceof RecoveryActionBehaviourAlternativeBehaviourCompartmentEditPart) { |
316 | ArrayList types = new ArrayList(13); |
317 | types.add(PalladioComponentModelElementTypes.StartAction_3004); |
318 | types.add(PalladioComponentModelElementTypes.StopAction_3005); |
319 | types.add(PalladioComponentModelElementTypes.LoopAction_3006); |
320 | types.add(PalladioComponentModelElementTypes.InternalAction_3007); |
321 | types.add(PalladioComponentModelElementTypes.BranchAction_3009); |
322 | types |
323 | .add(PalladioComponentModelElementTypes.ExternalCallAction_3012); |
324 | types.add(PalladioComponentModelElementTypes.EmitEventAction_3046); |
325 | types |
326 | .add(PalladioComponentModelElementTypes.CollectionIteratorAction_3013); |
327 | types.add(PalladioComponentModelElementTypes.AcquireAction_3026); |
328 | types.add(PalladioComponentModelElementTypes.ReleaseAction_3020); |
329 | types.add(PalladioComponentModelElementTypes.ForkAction_3023); |
330 | types |
331 | .add(PalladioComponentModelElementTypes.SetVariableAction_3024); |
332 | types.add(PalladioComponentModelElementTypes.RecoveryAction_3057); |
333 | return types; |
334 | } |
335 | if (editPart instanceof SynchronisationPointSynchronisationPointEditPart) { |
336 | ArrayList types = new ArrayList(1); |
337 | types.add(PalladioComponentModelElementTypes.ForkedBehaviour_3039); |
338 | return types; |
339 | } |
340 | if (editPart instanceof ForkedBehaviourSynchronisationPointForkedBehavioursEditPart) { |
341 | ArrayList types = new ArrayList(12); |
342 | types.add(PalladioComponentModelElementTypes.StartAction_3004); |
343 | types.add(PalladioComponentModelElementTypes.StopAction_3005); |
344 | types.add(PalladioComponentModelElementTypes.LoopAction_3006); |
345 | types.add(PalladioComponentModelElementTypes.InternalAction_3007); |
346 | types.add(PalladioComponentModelElementTypes.BranchAction_3009); |
347 | types |
348 | .add(PalladioComponentModelElementTypes.ExternalCallAction_3012); |
349 | types.add(PalladioComponentModelElementTypes.EmitEventAction_3046); |
350 | types |
351 | .add(PalladioComponentModelElementTypes.CollectionIteratorAction_3013); |
352 | types.add(PalladioComponentModelElementTypes.AcquireAction_3026); |
353 | types.add(PalladioComponentModelElementTypes.ReleaseAction_3020); |
354 | types.add(PalladioComponentModelElementTypes.ForkAction_3023); |
355 | types.add(PalladioComponentModelElementTypes.RecoveryAction_3057); |
356 | return types; |
357 | } |
358 | if (editPart instanceof ResourceDemandingBehaviourBehaviourCompartment4EditPart) { |
359 | ArrayList types = new ArrayList(13); |
360 | types.add(PalladioComponentModelElementTypes.StartAction_3004); |
361 | types.add(PalladioComponentModelElementTypes.StopAction_3005); |
362 | types.add(PalladioComponentModelElementTypes.LoopAction_3006); |
363 | types.add(PalladioComponentModelElementTypes.InternalAction_3007); |
364 | types.add(PalladioComponentModelElementTypes.BranchAction_3009); |
365 | types |
366 | .add(PalladioComponentModelElementTypes.ExternalCallAction_3012); |
367 | types.add(PalladioComponentModelElementTypes.EmitEventAction_3046); |
368 | types.add(PalladioComponentModelElementTypes.AcquireAction_3026); |
369 | types.add(PalladioComponentModelElementTypes.ReleaseAction_3020); |
370 | types.add(PalladioComponentModelElementTypes.ForkAction_3023); |
371 | types |
372 | .add(PalladioComponentModelElementTypes.CollectionIteratorAction_3013); |
373 | types |
374 | .add(PalladioComponentModelElementTypes.SetVariableAction_3024); |
375 | types.add(PalladioComponentModelElementTypes.RecoveryAction_3057); |
376 | return types; |
377 | } |
378 | if (editPart instanceof BranchActionBranchTransitionCompartment2EditPart) { |
379 | ArrayList types = new ArrayList(2); |
380 | types |
381 | .add(PalladioComponentModelElementTypes.ProbabilisticBranchTransition_3010); |
382 | types |
383 | .add(PalladioComponentModelElementTypes.GuardedBranchTransition_3017); |
384 | return types; |
385 | } |
386 | if (editPart instanceof ForkActionForkedBehaviours2EditPart) { |
387 | ArrayList types = new ArrayList(2); |
388 | types.add(PalladioComponentModelElementTypes.ForkedBehaviour_3027); |
389 | types |
390 | .add(PalladioComponentModelElementTypes.SynchronisationPoint_3038); |
391 | return types; |
392 | } |
393 | if (editPart instanceof RecoveryActionRecoveryBlockCompartment2EditPart) { |
394 | ArrayList types = new ArrayList(1); |
395 | types |
396 | .add(PalladioComponentModelElementTypes.RecoveryActionBehaviour_3058); |
397 | return types; |
398 | } |
399 | if (editPart instanceof ResourceDemandingSEFFEditPart) { |
400 | ArrayList types = new ArrayList(13); |
401 | types.add(PalladioComponentModelElementTypes.StartAction_2001); |
402 | types.add(PalladioComponentModelElementTypes.StopAction_2002); |
403 | types |
404 | .add(PalladioComponentModelElementTypes.ExternalCallAction_2003); |
405 | types.add(PalladioComponentModelElementTypes.EmitEventAction_2013); |
406 | types.add(PalladioComponentModelElementTypes.LoopAction_2004); |
407 | types.add(PalladioComponentModelElementTypes.BranchAction_2005); |
408 | types.add(PalladioComponentModelElementTypes.InternalAction_2006); |
409 | types |
410 | .add(PalladioComponentModelElementTypes.CollectionIteratorAction_2007); |
411 | types |
412 | .add(PalladioComponentModelElementTypes.SetVariableAction_2008); |
413 | types.add(PalladioComponentModelElementTypes.AcquireAction_2012); |
414 | types.add(PalladioComponentModelElementTypes.ReleaseAction_2010); |
415 | types.add(PalladioComponentModelElementTypes.ForkAction_2011); |
416 | types.add(PalladioComponentModelElementTypes.RecoveryAction_2016); |
417 | return types; |
418 | } |
419 | return Collections.EMPTY_LIST; |
420 | } |
421 | |
422 | /** |
423 | * @generated |
424 | */ |
425 | public List getRelTypesOnSource(IAdaptable source) { |
426 | IGraphicalEditPart sourceEditPart = (IGraphicalEditPart) source |
427 | .getAdapter(IGraphicalEditPart.class); |
428 | if (sourceEditPart instanceof StartActionEditPart) { |
429 | return ((StartActionEditPart) sourceEditPart) |
430 | .getMARelTypesOnSource(); |
431 | } |
432 | if (sourceEditPart instanceof StopActionEditPart) { |
433 | return ((StopActionEditPart) sourceEditPart) |
434 | .getMARelTypesOnSource(); |
435 | } |
436 | if (sourceEditPart instanceof ExternalCallActionEditPart) { |
437 | return ((ExternalCallActionEditPart) sourceEditPart) |
438 | .getMARelTypesOnSource(); |
439 | } |
440 | if (sourceEditPart instanceof EmitEventActionEditPart) { |
441 | return ((EmitEventActionEditPart) sourceEditPart) |
442 | .getMARelTypesOnSource(); |
443 | } |
444 | if (sourceEditPart instanceof LoopActionEditPart) { |
445 | return ((LoopActionEditPart) sourceEditPart) |
446 | .getMARelTypesOnSource(); |
447 | } |
448 | if (sourceEditPart instanceof BranchActionEditPart) { |
449 | return ((BranchActionEditPart) sourceEditPart) |
450 | .getMARelTypesOnSource(); |
451 | } |
452 | if (sourceEditPart instanceof InternalActionEditPart) { |
453 | return ((InternalActionEditPart) sourceEditPart) |
454 | .getMARelTypesOnSource(); |
455 | } |
456 | if (sourceEditPart instanceof CollectionIteratorActionEditPart) { |
457 | return ((CollectionIteratorActionEditPart) sourceEditPart) |
458 | .getMARelTypesOnSource(); |
459 | } |
460 | if (sourceEditPart instanceof SetVariableActionEditPart) { |
461 | return ((SetVariableActionEditPart) sourceEditPart) |
462 | .getMARelTypesOnSource(); |
463 | } |
464 | if (sourceEditPart instanceof AcquireActionEditPart) { |
465 | return ((AcquireActionEditPart) sourceEditPart) |
466 | .getMARelTypesOnSource(); |
467 | } |
468 | if (sourceEditPart instanceof ReleaseActionEditPart) { |
469 | return ((ReleaseActionEditPart) sourceEditPart) |
470 | .getMARelTypesOnSource(); |
471 | } |
472 | if (sourceEditPart instanceof ForkActionEditPart) { |
473 | return ((ForkActionEditPart) sourceEditPart) |
474 | .getMARelTypesOnSource(); |
475 | } |
476 | if (sourceEditPart instanceof RecoveryActionEditPart) { |
477 | return ((RecoveryActionEditPart) sourceEditPart) |
478 | .getMARelTypesOnSource(); |
479 | } |
480 | if (sourceEditPart instanceof StartAction2EditPart) { |
481 | return ((StartAction2EditPart) sourceEditPart) |
482 | .getMARelTypesOnSource(); |
483 | } |
484 | if (sourceEditPart instanceof StopAction2EditPart) { |
485 | return ((StopAction2EditPart) sourceEditPart) |
486 | .getMARelTypesOnSource(); |
487 | } |
488 | if (sourceEditPart instanceof LoopAction2EditPart) { |
489 | return ((LoopAction2EditPart) sourceEditPart) |
490 | .getMARelTypesOnSource(); |
491 | } |
492 | if (sourceEditPart instanceof InternalAction2EditPart) { |
493 | return ((InternalAction2EditPart) sourceEditPart) |
494 | .getMARelTypesOnSource(); |
495 | } |
496 | if (sourceEditPart instanceof BranchAction2EditPart) { |
497 | return ((BranchAction2EditPart) sourceEditPart) |
498 | .getMARelTypesOnSource(); |
499 | } |
500 | if (sourceEditPart instanceof ExternalCallAction2EditPart) { |
501 | return ((ExternalCallAction2EditPart) sourceEditPart) |
502 | .getMARelTypesOnSource(); |
503 | } |
504 | if (sourceEditPart instanceof EmitEventAction2EditPart) { |
505 | return ((EmitEventAction2EditPart) sourceEditPart) |
506 | .getMARelTypesOnSource(); |
507 | } |
508 | if (sourceEditPart instanceof AcquireAction2EditPart) { |
509 | return ((AcquireAction2EditPart) sourceEditPart) |
510 | .getMARelTypesOnSource(); |
511 | } |
512 | if (sourceEditPart instanceof ReleaseAction2EditPart) { |
513 | return ((ReleaseAction2EditPart) sourceEditPart) |
514 | .getMARelTypesOnSource(); |
515 | } |
516 | if (sourceEditPart instanceof ForkAction2EditPart) { |
517 | return ((ForkAction2EditPart) sourceEditPart) |
518 | .getMARelTypesOnSource(); |
519 | } |
520 | if (sourceEditPart instanceof CollectionIteratorAction2EditPart) { |
521 | return ((CollectionIteratorAction2EditPart) sourceEditPart) |
522 | .getMARelTypesOnSource(); |
523 | } |
524 | if (sourceEditPart instanceof RecoveryAction2EditPart) { |
525 | return ((RecoveryAction2EditPart) sourceEditPart) |
526 | .getMARelTypesOnSource(); |
527 | } |
528 | if (sourceEditPart instanceof RecoveryActionBehaviourEditPart) { |
529 | return ((RecoveryActionBehaviourEditPart) sourceEditPart) |
530 | .getMARelTypesOnSource(); |
531 | } |
532 | if (sourceEditPart instanceof SetVariableAction2EditPart) { |
533 | return ((SetVariableAction2EditPart) sourceEditPart) |
534 | .getMARelTypesOnSource(); |
535 | } |
536 | return Collections.EMPTY_LIST; |
537 | } |
538 | |
539 | /** |
540 | * @generated |
541 | */ |
542 | public List getRelTypesOnTarget(IAdaptable target) { |
543 | IGraphicalEditPart targetEditPart = (IGraphicalEditPart) target |
544 | .getAdapter(IGraphicalEditPart.class); |
545 | if (targetEditPart instanceof StartActionEditPart) { |
546 | return ((StartActionEditPart) targetEditPart) |
547 | .getMARelTypesOnTarget(); |
548 | } |
549 | if (targetEditPart instanceof StopActionEditPart) { |
550 | return ((StopActionEditPart) targetEditPart) |
551 | .getMARelTypesOnTarget(); |
552 | } |
553 | if (targetEditPart instanceof ExternalCallActionEditPart) { |
554 | return ((ExternalCallActionEditPart) targetEditPart) |
555 | .getMARelTypesOnTarget(); |
556 | } |
557 | if (targetEditPart instanceof EmitEventActionEditPart) { |
558 | return ((EmitEventActionEditPart) targetEditPart) |
559 | .getMARelTypesOnTarget(); |
560 | } |
561 | if (targetEditPart instanceof LoopActionEditPart) { |
562 | return ((LoopActionEditPart) targetEditPart) |
563 | .getMARelTypesOnTarget(); |
564 | } |
565 | if (targetEditPart instanceof BranchActionEditPart) { |
566 | return ((BranchActionEditPart) targetEditPart) |
567 | .getMARelTypesOnTarget(); |
568 | } |
569 | if (targetEditPart instanceof InternalActionEditPart) { |
570 | return ((InternalActionEditPart) targetEditPart) |
571 | .getMARelTypesOnTarget(); |
572 | } |
573 | if (targetEditPart instanceof CollectionIteratorActionEditPart) { |
574 | return ((CollectionIteratorActionEditPart) targetEditPart) |
575 | .getMARelTypesOnTarget(); |
576 | } |
577 | if (targetEditPart instanceof SetVariableActionEditPart) { |
578 | return ((SetVariableActionEditPart) targetEditPart) |
579 | .getMARelTypesOnTarget(); |
580 | } |
581 | if (targetEditPart instanceof AcquireActionEditPart) { |
582 | return ((AcquireActionEditPart) targetEditPart) |
583 | .getMARelTypesOnTarget(); |
584 | } |
585 | if (targetEditPart instanceof ReleaseActionEditPart) { |
586 | return ((ReleaseActionEditPart) targetEditPart) |
587 | .getMARelTypesOnTarget(); |
588 | } |
589 | if (targetEditPart instanceof ForkActionEditPart) { |
590 | return ((ForkActionEditPart) targetEditPart) |
591 | .getMARelTypesOnTarget(); |
592 | } |
593 | if (targetEditPart instanceof RecoveryActionEditPart) { |
594 | return ((RecoveryActionEditPart) targetEditPart) |
595 | .getMARelTypesOnTarget(); |
596 | } |
597 | if (targetEditPart instanceof StartAction2EditPart) { |
598 | return ((StartAction2EditPart) targetEditPart) |
599 | .getMARelTypesOnTarget(); |
600 | } |
601 | if (targetEditPart instanceof StopAction2EditPart) { |
602 | return ((StopAction2EditPart) targetEditPart) |
603 | .getMARelTypesOnTarget(); |
604 | } |
605 | if (targetEditPart instanceof LoopAction2EditPart) { |
606 | return ((LoopAction2EditPart) targetEditPart) |
607 | .getMARelTypesOnTarget(); |
608 | } |
609 | if (targetEditPart instanceof InternalAction2EditPart) { |
610 | return ((InternalAction2EditPart) targetEditPart) |
611 | .getMARelTypesOnTarget(); |
612 | } |
613 | if (targetEditPart instanceof BranchAction2EditPart) { |
614 | return ((BranchAction2EditPart) targetEditPart) |
615 | .getMARelTypesOnTarget(); |
616 | } |
617 | if (targetEditPart instanceof ExternalCallAction2EditPart) { |
618 | return ((ExternalCallAction2EditPart) targetEditPart) |
619 | .getMARelTypesOnTarget(); |
620 | } |
621 | if (targetEditPart instanceof EmitEventAction2EditPart) { |
622 | return ((EmitEventAction2EditPart) targetEditPart) |
623 | .getMARelTypesOnTarget(); |
624 | } |
625 | if (targetEditPart instanceof AcquireAction2EditPart) { |
626 | return ((AcquireAction2EditPart) targetEditPart) |
627 | .getMARelTypesOnTarget(); |
628 | } |
629 | if (targetEditPart instanceof ReleaseAction2EditPart) { |
630 | return ((ReleaseAction2EditPart) targetEditPart) |
631 | .getMARelTypesOnTarget(); |
632 | } |
633 | if (targetEditPart instanceof ForkAction2EditPart) { |
634 | return ((ForkAction2EditPart) targetEditPart) |
635 | .getMARelTypesOnTarget(); |
636 | } |
637 | if (targetEditPart instanceof CollectionIteratorAction2EditPart) { |
638 | return ((CollectionIteratorAction2EditPart) targetEditPart) |
639 | .getMARelTypesOnTarget(); |
640 | } |
641 | if (targetEditPart instanceof RecoveryAction2EditPart) { |
642 | return ((RecoveryAction2EditPart) targetEditPart) |
643 | .getMARelTypesOnTarget(); |
644 | } |
645 | if (targetEditPart instanceof RecoveryActionBehaviourEditPart) { |
646 | return ((RecoveryActionBehaviourEditPart) targetEditPart) |
647 | .getMARelTypesOnTarget(); |
648 | } |
649 | if (targetEditPart instanceof SetVariableAction2EditPart) { |
650 | return ((SetVariableAction2EditPart) targetEditPart) |
651 | .getMARelTypesOnTarget(); |
652 | } |
653 | return Collections.EMPTY_LIST; |
654 | } |
655 | |
656 | /** |
657 | * @generated |
658 | */ |
659 | public List getRelTypesOnSourceAndTarget(IAdaptable source, |
660 | IAdaptable target) { |
661 | IGraphicalEditPart sourceEditPart = (IGraphicalEditPart) source |
662 | .getAdapter(IGraphicalEditPart.class); |
663 | IGraphicalEditPart targetEditPart = (IGraphicalEditPart) target |
664 | .getAdapter(IGraphicalEditPart.class); |
665 | if (sourceEditPart instanceof StartActionEditPart) { |
666 | return ((StartActionEditPart) sourceEditPart) |
667 | .getMARelTypesOnSourceAndTarget(targetEditPart); |
668 | } |
669 | if (sourceEditPart instanceof StopActionEditPart) { |
670 | return ((StopActionEditPart) sourceEditPart) |
671 | .getMARelTypesOnSourceAndTarget(targetEditPart); |
672 | } |
673 | if (sourceEditPart instanceof ExternalCallActionEditPart) { |
674 | return ((ExternalCallActionEditPart) sourceEditPart) |
675 | .getMARelTypesOnSourceAndTarget(targetEditPart); |
676 | } |
677 | if (sourceEditPart instanceof EmitEventActionEditPart) { |
678 | return ((EmitEventActionEditPart) sourceEditPart) |
679 | .getMARelTypesOnSourceAndTarget(targetEditPart); |
680 | } |
681 | if (sourceEditPart instanceof LoopActionEditPart) { |
682 | return ((LoopActionEditPart) sourceEditPart) |
683 | .getMARelTypesOnSourceAndTarget(targetEditPart); |
684 | } |
685 | if (sourceEditPart instanceof BranchActionEditPart) { |
686 | return ((BranchActionEditPart) sourceEditPart) |
687 | .getMARelTypesOnSourceAndTarget(targetEditPart); |
688 | } |
689 | if (sourceEditPart instanceof InternalActionEditPart) { |
690 | return ((InternalActionEditPart) sourceEditPart) |
691 | .getMARelTypesOnSourceAndTarget(targetEditPart); |
692 | } |
693 | if (sourceEditPart instanceof CollectionIteratorActionEditPart) { |
694 | return ((CollectionIteratorActionEditPart) sourceEditPart) |
695 | .getMARelTypesOnSourceAndTarget(targetEditPart); |
696 | } |
697 | if (sourceEditPart instanceof SetVariableActionEditPart) { |
698 | return ((SetVariableActionEditPart) sourceEditPart) |
699 | .getMARelTypesOnSourceAndTarget(targetEditPart); |
700 | } |
701 | if (sourceEditPart instanceof AcquireActionEditPart) { |
702 | return ((AcquireActionEditPart) sourceEditPart) |
703 | .getMARelTypesOnSourceAndTarget(targetEditPart); |
704 | } |
705 | if (sourceEditPart instanceof ReleaseActionEditPart) { |
706 | return ((ReleaseActionEditPart) sourceEditPart) |
707 | .getMARelTypesOnSourceAndTarget(targetEditPart); |
708 | } |
709 | if (sourceEditPart instanceof ForkActionEditPart) { |
710 | return ((ForkActionEditPart) sourceEditPart) |
711 | .getMARelTypesOnSourceAndTarget(targetEditPart); |
712 | } |
713 | if (sourceEditPart instanceof RecoveryActionEditPart) { |
714 | return ((RecoveryActionEditPart) sourceEditPart) |
715 | .getMARelTypesOnSourceAndTarget(targetEditPart); |
716 | } |
717 | if (sourceEditPart instanceof StartAction2EditPart) { |
718 | return ((StartAction2EditPart) sourceEditPart) |
719 | .getMARelTypesOnSourceAndTarget(targetEditPart); |
720 | } |
721 | if (sourceEditPart instanceof StopAction2EditPart) { |
722 | return ((StopAction2EditPart) sourceEditPart) |
723 | .getMARelTypesOnSourceAndTarget(targetEditPart); |
724 | } |
725 | if (sourceEditPart instanceof LoopAction2EditPart) { |
726 | return ((LoopAction2EditPart) sourceEditPart) |
727 | .getMARelTypesOnSourceAndTarget(targetEditPart); |
728 | } |
729 | if (sourceEditPart instanceof InternalAction2EditPart) { |
730 | return ((InternalAction2EditPart) sourceEditPart) |
731 | .getMARelTypesOnSourceAndTarget(targetEditPart); |
732 | } |
733 | if (sourceEditPart instanceof BranchAction2EditPart) { |
734 | return ((BranchAction2EditPart) sourceEditPart) |
735 | .getMARelTypesOnSourceAndTarget(targetEditPart); |
736 | } |
737 | if (sourceEditPart instanceof ExternalCallAction2EditPart) { |
738 | return ((ExternalCallAction2EditPart) sourceEditPart) |
739 | .getMARelTypesOnSourceAndTarget(targetEditPart); |
740 | } |
741 | if (sourceEditPart instanceof EmitEventAction2EditPart) { |
742 | return ((EmitEventAction2EditPart) sourceEditPart) |
743 | .getMARelTypesOnSourceAndTarget(targetEditPart); |
744 | } |
745 | if (sourceEditPart instanceof AcquireAction2EditPart) { |
746 | return ((AcquireAction2EditPart) sourceEditPart) |
747 | .getMARelTypesOnSourceAndTarget(targetEditPart); |
748 | } |
749 | if (sourceEditPart instanceof ReleaseAction2EditPart) { |
750 | return ((ReleaseAction2EditPart) sourceEditPart) |
751 | .getMARelTypesOnSourceAndTarget(targetEditPart); |
752 | } |
753 | if (sourceEditPart instanceof ForkAction2EditPart) { |
754 | return ((ForkAction2EditPart) sourceEditPart) |
755 | .getMARelTypesOnSourceAndTarget(targetEditPart); |
756 | } |
757 | if (sourceEditPart instanceof CollectionIteratorAction2EditPart) { |
758 | return ((CollectionIteratorAction2EditPart) sourceEditPart) |
759 | .getMARelTypesOnSourceAndTarget(targetEditPart); |
760 | } |
761 | if (sourceEditPart instanceof RecoveryAction2EditPart) { |
762 | return ((RecoveryAction2EditPart) sourceEditPart) |
763 | .getMARelTypesOnSourceAndTarget(targetEditPart); |
764 | } |
765 | if (sourceEditPart instanceof RecoveryActionBehaviourEditPart) { |
766 | return ((RecoveryActionBehaviourEditPart) sourceEditPart) |
767 | .getMARelTypesOnSourceAndTarget(targetEditPart); |
768 | } |
769 | if (sourceEditPart instanceof SetVariableAction2EditPart) { |
770 | return ((SetVariableAction2EditPart) sourceEditPart) |
771 | .getMARelTypesOnSourceAndTarget(targetEditPart); |
772 | } |
773 | return Collections.EMPTY_LIST; |
774 | } |
775 | |
776 | /** |
777 | * @generated |
778 | */ |
779 | public List getTypesForSource(IAdaptable target, |
780 | IElementType relationshipType) { |
781 | IGraphicalEditPart targetEditPart = (IGraphicalEditPart) target |
782 | .getAdapter(IGraphicalEditPart.class); |
783 | if (targetEditPart instanceof StartActionEditPart) { |
784 | return ((StartActionEditPart) targetEditPart) |
785 | .getMATypesForSource(relationshipType); |
786 | } |
787 | if (targetEditPart instanceof StopActionEditPart) { |
788 | return ((StopActionEditPart) targetEditPart) |
789 | .getMATypesForSource(relationshipType); |
790 | } |
791 | if (targetEditPart instanceof ExternalCallActionEditPart) { |
792 | return ((ExternalCallActionEditPart) targetEditPart) |
793 | .getMATypesForSource(relationshipType); |
794 | } |
795 | if (targetEditPart instanceof EmitEventActionEditPart) { |
796 | return ((EmitEventActionEditPart) targetEditPart) |
797 | .getMATypesForSource(relationshipType); |
798 | } |
799 | if (targetEditPart instanceof LoopActionEditPart) { |
800 | return ((LoopActionEditPart) targetEditPart) |
801 | .getMATypesForSource(relationshipType); |
802 | } |
803 | if (targetEditPart instanceof BranchActionEditPart) { |
804 | return ((BranchActionEditPart) targetEditPart) |
805 | .getMATypesForSource(relationshipType); |
806 | } |
807 | if (targetEditPart instanceof InternalActionEditPart) { |
808 | return ((InternalActionEditPart) targetEditPart) |
809 | .getMATypesForSource(relationshipType); |
810 | } |
811 | if (targetEditPart instanceof CollectionIteratorActionEditPart) { |
812 | return ((CollectionIteratorActionEditPart) targetEditPart) |
813 | .getMATypesForSource(relationshipType); |
814 | } |
815 | if (targetEditPart instanceof SetVariableActionEditPart) { |
816 | return ((SetVariableActionEditPart) targetEditPart) |
817 | .getMATypesForSource(relationshipType); |
818 | } |
819 | if (targetEditPart instanceof AcquireActionEditPart) { |
820 | return ((AcquireActionEditPart) targetEditPart) |
821 | .getMATypesForSource(relationshipType); |
822 | } |
823 | if (targetEditPart instanceof ReleaseActionEditPart) { |
824 | return ((ReleaseActionEditPart) targetEditPart) |
825 | .getMATypesForSource(relationshipType); |
826 | } |
827 | if (targetEditPart instanceof ForkActionEditPart) { |
828 | return ((ForkActionEditPart) targetEditPart) |
829 | .getMATypesForSource(relationshipType); |
830 | } |
831 | if (targetEditPart instanceof RecoveryActionEditPart) { |
832 | return ((RecoveryActionEditPart) targetEditPart) |
833 | .getMATypesForSource(relationshipType); |
834 | } |
835 | if (targetEditPart instanceof StartAction2EditPart) { |
836 | return ((StartAction2EditPart) targetEditPart) |
837 | .getMATypesForSource(relationshipType); |
838 | } |
839 | if (targetEditPart instanceof StopAction2EditPart) { |
840 | return ((StopAction2EditPart) targetEditPart) |
841 | .getMATypesForSource(relationshipType); |
842 | } |
843 | if (targetEditPart instanceof LoopAction2EditPart) { |
844 | return ((LoopAction2EditPart) targetEditPart) |
845 | .getMATypesForSource(relationshipType); |
846 | } |
847 | if (targetEditPart instanceof InternalAction2EditPart) { |
848 | return ((InternalAction2EditPart) targetEditPart) |
849 | .getMATypesForSource(relationshipType); |
850 | } |
851 | if (targetEditPart instanceof BranchAction2EditPart) { |
852 | return ((BranchAction2EditPart) targetEditPart) |
853 | .getMATypesForSource(relationshipType); |
854 | } |
855 | if (targetEditPart instanceof ExternalCallAction2EditPart) { |
856 | return ((ExternalCallAction2EditPart) targetEditPart) |
857 | .getMATypesForSource(relationshipType); |
858 | } |
859 | if (targetEditPart instanceof EmitEventAction2EditPart) { |
860 | return ((EmitEventAction2EditPart) targetEditPart) |
861 | .getMATypesForSource(relationshipType); |
862 | } |
863 | if (targetEditPart instanceof AcquireAction2EditPart) { |
864 | return ((AcquireAction2EditPart) targetEditPart) |
865 | .getMATypesForSource(relationshipType); |
866 | } |
867 | if (targetEditPart instanceof ReleaseAction2EditPart) { |
868 | return ((ReleaseAction2EditPart) targetEditPart) |
869 | .getMATypesForSource(relationshipType); |
870 | } |
871 | if (targetEditPart instanceof ForkAction2EditPart) { |
872 | return ((ForkAction2EditPart) targetEditPart) |
873 | .getMATypesForSource(relationshipType); |
874 | } |
875 | if (targetEditPart instanceof CollectionIteratorAction2EditPart) { |
876 | return ((CollectionIteratorAction2EditPart) targetEditPart) |
877 | .getMATypesForSource(relationshipType); |
878 | } |
879 | if (targetEditPart instanceof RecoveryAction2EditPart) { |
880 | return ((RecoveryAction2EditPart) targetEditPart) |
881 | .getMATypesForSource(relationshipType); |
882 | } |
883 | if (targetEditPart instanceof RecoveryActionBehaviourEditPart) { |
884 | return ((RecoveryActionBehaviourEditPart) targetEditPart) |
885 | .getMATypesForSource(relationshipType); |
886 | } |
887 | if (targetEditPart instanceof SetVariableAction2EditPart) { |
888 | return ((SetVariableAction2EditPart) targetEditPart) |
889 | .getMATypesForSource(relationshipType); |
890 | } |
891 | return Collections.EMPTY_LIST; |
892 | } |
893 | |
894 | /** |
895 | * @generated |
896 | */ |
897 | public List getTypesForTarget(IAdaptable source, |
898 | IElementType relationshipType) { |
899 | IGraphicalEditPart sourceEditPart = (IGraphicalEditPart) source |
900 | .getAdapter(IGraphicalEditPart.class); |
901 | if (sourceEditPart instanceof StartActionEditPart) { |
902 | return ((StartActionEditPart) sourceEditPart) |
903 | .getMATypesForTarget(relationshipType); |
904 | } |
905 | if (sourceEditPart instanceof StopActionEditPart) { |
906 | return ((StopActionEditPart) sourceEditPart) |
907 | .getMATypesForTarget(relationshipType); |
908 | } |
909 | if (sourceEditPart instanceof ExternalCallActionEditPart) { |
910 | return ((ExternalCallActionEditPart) sourceEditPart) |
911 | .getMATypesForTarget(relationshipType); |
912 | } |
913 | if (sourceEditPart instanceof EmitEventActionEditPart) { |
914 | return ((EmitEventActionEditPart) sourceEditPart) |
915 | .getMATypesForTarget(relationshipType); |
916 | } |
917 | if (sourceEditPart instanceof LoopActionEditPart) { |
918 | return ((LoopActionEditPart) sourceEditPart) |
919 | .getMATypesForTarget(relationshipType); |
920 | } |
921 | if (sourceEditPart instanceof BranchActionEditPart) { |
922 | return ((BranchActionEditPart) sourceEditPart) |
923 | .getMATypesForTarget(relationshipType); |
924 | } |
925 | if (sourceEditPart instanceof InternalActionEditPart) { |
926 | return ((InternalActionEditPart) sourceEditPart) |
927 | .getMATypesForTarget(relationshipType); |
928 | } |
929 | if (sourceEditPart instanceof CollectionIteratorActionEditPart) { |
930 | return ((CollectionIteratorActionEditPart) sourceEditPart) |
931 | .getMATypesForTarget(relationshipType); |
932 | } |
933 | if (sourceEditPart instanceof SetVariableActionEditPart) { |
934 | return ((SetVariableActionEditPart) sourceEditPart) |
935 | .getMATypesForTarget(relationshipType); |
936 | } |
937 | if (sourceEditPart instanceof AcquireActionEditPart) { |
938 | return ((AcquireActionEditPart) sourceEditPart) |
939 | .getMATypesForTarget(relationshipType); |
940 | } |
941 | if (sourceEditPart instanceof ReleaseActionEditPart) { |
942 | return ((ReleaseActionEditPart) sourceEditPart) |
943 | .getMATypesForTarget(relationshipType); |
944 | } |
945 | if (sourceEditPart instanceof ForkActionEditPart) { |
946 | return ((ForkActionEditPart) sourceEditPart) |
947 | .getMATypesForTarget(relationshipType); |
948 | } |
949 | if (sourceEditPart instanceof RecoveryActionEditPart) { |
950 | return ((RecoveryActionEditPart) sourceEditPart) |
951 | .getMATypesForTarget(relationshipType); |
952 | } |
953 | if (sourceEditPart instanceof StartAction2EditPart) { |
954 | return ((StartAction2EditPart) sourceEditPart) |
955 | .getMATypesForTarget(relationshipType); |
956 | } |
957 | if (sourceEditPart instanceof StopAction2EditPart) { |
958 | return ((StopAction2EditPart) sourceEditPart) |
959 | .getMATypesForTarget(relationshipType); |
960 | } |
961 | if (sourceEditPart instanceof LoopAction2EditPart) { |
962 | return ((LoopAction2EditPart) sourceEditPart) |
963 | .getMATypesForTarget(relationshipType); |
964 | } |
965 | if (sourceEditPart instanceof InternalAction2EditPart) { |
966 | return ((InternalAction2EditPart) sourceEditPart) |
967 | .getMATypesForTarget(relationshipType); |
968 | } |
969 | if (sourceEditPart instanceof BranchAction2EditPart) { |
970 | return ((BranchAction2EditPart) sourceEditPart) |
971 | .getMATypesForTarget(relationshipType); |
972 | } |
973 | if (sourceEditPart instanceof ExternalCallAction2EditPart) { |
974 | return ((ExternalCallAction2EditPart) sourceEditPart) |
975 | .getMATypesForTarget(relationshipType); |
976 | } |
977 | if (sourceEditPart instanceof EmitEventAction2EditPart) { |
978 | return ((EmitEventAction2EditPart) sourceEditPart) |
979 | .getMATypesForTarget(relationshipType); |
980 | } |
981 | if (sourceEditPart instanceof AcquireAction2EditPart) { |
982 | return ((AcquireAction2EditPart) sourceEditPart) |
983 | .getMATypesForTarget(relationshipType); |
984 | } |
985 | if (sourceEditPart instanceof ReleaseAction2EditPart) { |
986 | return ((ReleaseAction2EditPart) sourceEditPart) |
987 | .getMATypesForTarget(relationshipType); |
988 | } |
989 | if (sourceEditPart instanceof ForkAction2EditPart) { |
990 | return ((ForkAction2EditPart) sourceEditPart) |
991 | .getMATypesForTarget(relationshipType); |
992 | } |
993 | if (sourceEditPart instanceof CollectionIteratorAction2EditPart) { |
994 | return ((CollectionIteratorAction2EditPart) sourceEditPart) |
995 | .getMATypesForTarget(relationshipType); |
996 | } |
997 | if (sourceEditPart instanceof RecoveryAction2EditPart) { |
998 | return ((RecoveryAction2EditPart) sourceEditPart) |
999 | .getMATypesForTarget(relationshipType); |
1000 | } |
1001 | if (sourceEditPart instanceof RecoveryActionBehaviourEditPart) { |
1002 | return ((RecoveryActionBehaviourEditPart) sourceEditPart) |
1003 | .getMATypesForTarget(relationshipType); |
1004 | } |
1005 | if (sourceEditPart instanceof SetVariableAction2EditPart) { |
1006 | return ((SetVariableAction2EditPart) sourceEditPart) |
1007 | .getMATypesForTarget(relationshipType); |
1008 | } |
1009 | return Collections.EMPTY_LIST; |
1010 | } |
1011 | |
1012 | /** |
1013 | * @generated |
1014 | */ |
1015 | public EObject selectExistingElementForSource(IAdaptable target, |
1016 | IElementType relationshipType) { |
1017 | return selectExistingElement(target, getTypesForSource(target, |
1018 | relationshipType)); |
1019 | } |
1020 | |
1021 | /** |
1022 | * @generated |
1023 | */ |
1024 | public EObject selectExistingElementForTarget(IAdaptable source, |
1025 | IElementType relationshipType) { |
1026 | return selectExistingElement(source, getTypesForTarget(source, |
1027 | relationshipType)); |
1028 | } |
1029 | |
1030 | /** |
1031 | * @generated |
1032 | */ |
1033 | protected EObject selectExistingElement(IAdaptable host, Collection types) { |
1034 | if (types.isEmpty()) { |
1035 | return null; |
1036 | } |
1037 | IGraphicalEditPart editPart = (IGraphicalEditPart) host |
1038 | .getAdapter(IGraphicalEditPart.class); |
1039 | if (editPart == null) { |
1040 | return null; |
1041 | } |
1042 | Diagram diagram = (Diagram) editPart.getRoot().getContents().getModel(); |
1043 | Collection elements = new HashSet(); |
1044 | for (Iterator it = diagram.getElement().eAllContents(); it.hasNext();) { |
1045 | EObject element = (EObject) it.next(); |
1046 | if (isApplicableElement(element, types)) { |
1047 | elements.add(element); |
1048 | } |
1049 | } |
1050 | if (elements.isEmpty()) { |
1051 | return null; |
1052 | } |
1053 | return selectElement((EObject[]) elements.toArray(new EObject[elements |
1054 | .size()])); |
1055 | } |
1056 | |
1057 | /** |
1058 | * @generated |
1059 | */ |
1060 | protected boolean isApplicableElement(EObject element, Collection types) { |
1061 | IElementType type = ElementTypeRegistry.getInstance().getElementType( |
1062 | element); |
1063 | return types.contains(type); |
1064 | } |
1065 | |
1066 | /** |
1067 | * @generated |
1068 | */ |
1069 | protected EObject selectElement(EObject[] elements) { |
1070 | Shell shell = Display.getCurrent().getActiveShell(); |
1071 | ILabelProvider labelProvider = new AdapterFactoryLabelProvider( |
1072 | PalladioComponentModelSeffDiagramEditorPlugin.getInstance() |
1073 | .getItemProvidersAdapterFactory()); |
1074 | ElementListSelectionDialog dialog = new ElementListSelectionDialog( |
1075 | shell, labelProvider); |
1076 | dialog |
1077 | .setMessage(Messages.PalladioComponentModelModelingAssistantProviderMessage); |
1078 | dialog |
1079 | .setTitle(Messages.PalladioComponentModelModelingAssistantProviderTitle); |
1080 | dialog.setMultipleSelection(false); |
1081 | dialog.setElements(elements); |
1082 | EObject selected = null; |
1083 | if (dialog.open() == Window.OK) { |
1084 | selected = (EObject) dialog.getFirstResult(); |
1085 | } |
1086 | return selected; |
1087 | } |
1088 | } |