1 | /* |
2 | * Copyright 2006 SDQ Research Group, University of Karlsruhe (TH) |
3 | */ |
4 | package de.uka.ipd.sdq.pcm.gmf.seff.edit.parts; |
5 | |
6 | import java.util.ArrayList; |
7 | import java.util.List; |
8 | |
9 | import org.eclipse.draw2d.GridData; |
10 | import org.eclipse.draw2d.GridLayout; |
11 | import org.eclipse.draw2d.IFigure; |
12 | import org.eclipse.draw2d.MarginBorder; |
13 | import org.eclipse.draw2d.RoundedRectangle; |
14 | import org.eclipse.draw2d.Shape; |
15 | import org.eclipse.draw2d.StackLayout; |
16 | import org.eclipse.draw2d.geometry.Dimension; |
17 | import org.eclipse.gef.EditPart; |
18 | import org.eclipse.gef.EditPolicy; |
19 | import org.eclipse.gef.Request; |
20 | import org.eclipse.gef.commands.Command; |
21 | import org.eclipse.gef.editpolicies.LayoutEditPolicy; |
22 | import org.eclipse.gef.editpolicies.NonResizableEditPolicy; |
23 | import org.eclipse.gef.requests.CreateRequest; |
24 | import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; |
25 | import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart; |
26 | import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy; |
27 | import org.eclipse.gmf.runtime.diagram.ui.editpolicies.DragDropEditPolicy; |
28 | import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles; |
29 | import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout; |
30 | import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel; |
31 | import org.eclipse.gmf.runtime.emf.type.core.IElementType; |
32 | import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure; |
33 | import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure; |
34 | import org.eclipse.gmf.runtime.notation.View; |
35 | import org.eclipse.swt.SWT; |
36 | import org.eclipse.swt.graphics.Color; |
37 | |
38 | import de.uka.ipd.sdq.pcm.dialogs.seff.OpenLoopIterationsDialog; |
39 | import de.uka.ipd.sdq.pcm.gmf.seff.edit.policies.LoopAction2CanonicalEditPolicy; |
40 | import de.uka.ipd.sdq.pcm.gmf.seff.edit.policies.LoopAction2ItemSemanticEditPolicy; |
41 | import de.uka.ipd.sdq.pcm.gmf.seff.part.PalladioComponentModelVisualIDRegistry; |
42 | import de.uka.ipd.sdq.pcm.gmf.seff.providers.PalladioComponentModelElementTypes; |
43 | |
44 | /** |
45 | * @generated |
46 | */ |
47 | public class LoopAction2EditPart extends ShapeNodeEditPart { |
48 | |
49 | /** |
50 | * @generated |
51 | */ |
52 | public static final int VISUAL_ID = 3006; |
53 | |
54 | /** |
55 | * @generated |
56 | */ |
57 | protected IFigure contentPane; |
58 | |
59 | /** |
60 | * @generated |
61 | */ |
62 | protected IFigure primaryShape; |
63 | |
64 | /** |
65 | * @generated |
66 | */ |
67 | public LoopAction2EditPart(View view) { |
68 | super(view); |
69 | } |
70 | |
71 | /** |
72 | * @generated |
73 | */ |
74 | protected void createDefaultEditPolicies() { |
75 | installEditPolicy(EditPolicyRoles.CREATION_ROLE, |
76 | new CreationEditPolicy()); |
77 | super.createDefaultEditPolicies(); |
78 | installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, |
79 | new LoopAction2ItemSemanticEditPolicy()); |
80 | installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, |
81 | new DragDropEditPolicy()); |
82 | installEditPolicy(EditPolicyRoles.CANONICAL_ROLE, |
83 | new LoopAction2CanonicalEditPolicy()); |
84 | installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy()); |
85 | installEditPolicy(EditPolicyRoles.OPEN_ROLE, |
86 | new OpenLoopIterationsDialog()); |
87 | // XXX need an SCR to runtime to have another abstract superclass that would let children add reasonable editpolicies |
88 | // removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CONNECTION_HANDLES_ROLE); |
89 | } |
90 | |
91 | /** |
92 | * @generated |
93 | */ |
94 | protected LayoutEditPolicy createLayoutEditPolicy() { |
95 | LayoutEditPolicy lep = new LayoutEditPolicy() { |
96 | |
97 | protected EditPolicy createChildEditPolicy(EditPart child) { |
98 | EditPolicy result = child |
99 | .getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); |
100 | if (result == null) { |
101 | result = new NonResizableEditPolicy(); |
102 | } |
103 | return result; |
104 | } |
105 | |
106 | protected Command getMoveChildrenCommand(Request request) { |
107 | return null; |
108 | } |
109 | |
110 | protected Command getCreateCommand(CreateRequest request) { |
111 | return null; |
112 | } |
113 | }; |
114 | return lep; |
115 | } |
116 | |
117 | /** |
118 | * @generated |
119 | */ |
120 | protected IFigure createNodeShape() { |
121 | LoopFigure figure = new LoopFigure(); |
122 | return primaryShape = figure; |
123 | } |
124 | |
125 | /** |
126 | * @generated |
127 | */ |
128 | public LoopFigure getPrimaryShape() { |
129 | return (LoopFigure) primaryShape; |
130 | } |
131 | |
132 | /** |
133 | * @generated |
134 | */ |
135 | protected boolean addFixedChild(EditPart childEditPart) { |
136 | if (childEditPart instanceof LoopActionEntityName2EditPart) { |
137 | ((LoopActionEntityName2EditPart) childEditPart) |
138 | .setLabel(getPrimaryShape().getFigureLoopNameLabelFigure()); |
139 | return true; |
140 | } |
141 | if (childEditPart instanceof Loop2IterationsLabelEditPart) { |
142 | ((Loop2IterationsLabelEditPart) childEditPart) |
143 | .setLabel(getPrimaryShape() |
144 | .getFigureLoopIterationsLabelFigure()); |
145 | return true; |
146 | } |
147 | return false; |
148 | } |
149 | |
150 | /** |
151 | * @generated |
152 | */ |
153 | protected boolean removeFixedChild(EditPart childEditPart) { |
154 | if (childEditPart instanceof LoopActionEntityName2EditPart) { |
155 | return true; |
156 | } |
157 | if (childEditPart instanceof Loop2IterationsLabelEditPart) { |
158 | return true; |
159 | } |
160 | return false; |
161 | } |
162 | |
163 | /** |
164 | * @generated |
165 | */ |
166 | protected void addChildVisual(EditPart childEditPart, int index) { |
167 | if (addFixedChild(childEditPart)) { |
168 | return; |
169 | } |
170 | super.addChildVisual(childEditPart, -1); |
171 | } |
172 | |
173 | /** |
174 | * @generated |
175 | */ |
176 | protected void removeChildVisual(EditPart childEditPart) { |
177 | if (removeFixedChild(childEditPart)) { |
178 | return; |
179 | } |
180 | super.removeChildVisual(childEditPart); |
181 | } |
182 | |
183 | /** |
184 | * @generated |
185 | */ |
186 | protected IFigure getContentPaneFor(IGraphicalEditPart editPart) { |
187 | return getContentPane(); |
188 | } |
189 | |
190 | /** |
191 | * @generated |
192 | */ |
193 | protected NodeFigure createNodePlate() { |
194 | DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(40, 40); |
195 | return result; |
196 | } |
197 | |
198 | /** |
199 | * Creates figure for this edit part. |
200 | * |
201 | * Body of this method does not depend on settings in generation model |
202 | * so you may safely remove <i>generated</i> tag and modify it. |
203 | * |
204 | * @generated |
205 | */ |
206 | protected NodeFigure createNodeFigure() { |
207 | NodeFigure figure = createNodePlate(); |
208 | figure.setLayoutManager(new StackLayout()); |
209 | IFigure shape = createNodeShape(); |
210 | figure.add(shape); |
211 | contentPane = setupContentPane(shape); |
212 | return figure; |
213 | } |
214 | |
215 | /** |
216 | * Default implementation treats passed figure as content pane. |
217 | * Respects layout one may have set for generated figure. |
218 | * @param nodeShape instance of generated figure class |
219 | * @generated |
220 | */ |
221 | protected IFigure setupContentPane(IFigure nodeShape) { |
222 | if (nodeShape.getLayoutManager() == null) { |
223 | ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout(); |
224 | layout.setSpacing(5); |
225 | nodeShape.setLayoutManager(layout); |
226 | } |
227 | return nodeShape; // use nodeShape itself as contentPane |
228 | } |
229 | |
230 | /** |
231 | * @generated |
232 | */ |
233 | public IFigure getContentPane() { |
234 | if (contentPane != null) { |
235 | return contentPane; |
236 | } |
237 | return super.getContentPane(); |
238 | } |
239 | |
240 | /** |
241 | * @generated |
242 | */ |
243 | protected void setForegroundColor(Color color) { |
244 | if (primaryShape != null) { |
245 | primaryShape.setForegroundColor(color); |
246 | } |
247 | } |
248 | |
249 | /** |
250 | * @generated |
251 | */ |
252 | protected void setBackgroundColor(Color color) { |
253 | if (primaryShape != null) { |
254 | primaryShape.setBackgroundColor(color); |
255 | } |
256 | } |
257 | |
258 | /** |
259 | * @generated |
260 | */ |
261 | protected void setLineWidth(int width) { |
262 | if (primaryShape instanceof Shape) { |
263 | ((Shape) primaryShape).setLineWidth(width); |
264 | } |
265 | } |
266 | |
267 | /** |
268 | * @generated |
269 | */ |
270 | protected void setLineType(int style) { |
271 | if (primaryShape instanceof Shape) { |
272 | ((Shape) primaryShape).setLineStyle(style); |
273 | } |
274 | } |
275 | |
276 | /** |
277 | * @generated |
278 | */ |
279 | public EditPart getPrimaryChildEditPart() { |
280 | return getChildBySemanticHint(PalladioComponentModelVisualIDRegistry |
281 | .getType(LoopActionEntityName2EditPart.VISUAL_ID)); |
282 | } |
283 | |
284 | /** |
285 | * @generated |
286 | */ |
287 | public List/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/getMARelTypesOnSource() { |
288 | List/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/types = new ArrayList/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/(); |
289 | types |
290 | .add(PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001); |
291 | return types; |
292 | } |
293 | |
294 | /** |
295 | * @generated |
296 | */ |
297 | public List/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/getMARelTypesOnSourceAndTarget( |
298 | IGraphicalEditPart targetEditPart) { |
299 | List/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/types = new ArrayList/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/(); |
300 | if (targetEditPart instanceof StartActionEditPart) { |
301 | types |
302 | .add(PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001); |
303 | } |
304 | if (targetEditPart instanceof StopActionEditPart) { |
305 | types |
306 | .add(PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001); |
307 | } |
308 | if (targetEditPart instanceof ExternalCallActionEditPart) { |
309 | types |
310 | .add(PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001); |
311 | } |
312 | if (targetEditPart instanceof EmitEventActionEditPart) { |
313 | types |
314 | .add(PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001); |
315 | } |
316 | if (targetEditPart instanceof LoopActionEditPart) { |
317 | types |
318 | .add(PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001); |
319 | } |
320 | if (targetEditPart instanceof BranchActionEditPart) { |
321 | types |
322 | .add(PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001); |
323 | } |
324 | if (targetEditPart instanceof InternalActionEditPart) { |
325 | types |
326 | .add(PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001); |
327 | } |
328 | if (targetEditPart instanceof CollectionIteratorActionEditPart) { |
329 | types |
330 | .add(PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001); |
331 | } |
332 | if (targetEditPart instanceof SetVariableActionEditPart) { |
333 | types |
334 | .add(PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001); |
335 | } |
336 | if (targetEditPart instanceof AcquireActionEditPart) { |
337 | types |
338 | .add(PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001); |
339 | } |
340 | if (targetEditPart instanceof ReleaseActionEditPart) { |
341 | types |
342 | .add(PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001); |
343 | } |
344 | if (targetEditPart instanceof ForkActionEditPart) { |
345 | types |
346 | .add(PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001); |
347 | } |
348 | if (targetEditPart instanceof RecoveryActionEditPart) { |
349 | types |
350 | .add(PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001); |
351 | } |
352 | if (targetEditPart instanceof StartAction2EditPart) { |
353 | types |
354 | .add(PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001); |
355 | } |
356 | if (targetEditPart instanceof StopAction2EditPart) { |
357 | types |
358 | .add(PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001); |
359 | } |
360 | if (targetEditPart instanceof de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.LoopAction2EditPart) { |
361 | types |
362 | .add(PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001); |
363 | } |
364 | if (targetEditPart instanceof InternalAction2EditPart) { |
365 | types |
366 | .add(PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001); |
367 | } |
368 | if (targetEditPart instanceof BranchAction2EditPart) { |
369 | types |
370 | .add(PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001); |
371 | } |
372 | if (targetEditPart instanceof ExternalCallAction2EditPart) { |
373 | types |
374 | .add(PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001); |
375 | } |
376 | if (targetEditPart instanceof EmitEventAction2EditPart) { |
377 | types |
378 | .add(PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001); |
379 | } |
380 | if (targetEditPart instanceof AcquireAction2EditPart) { |
381 | types |
382 | .add(PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001); |
383 | } |
384 | if (targetEditPart instanceof ReleaseAction2EditPart) { |
385 | types |
386 | .add(PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001); |
387 | } |
388 | if (targetEditPart instanceof ForkAction2EditPart) { |
389 | types |
390 | .add(PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001); |
391 | } |
392 | if (targetEditPart instanceof CollectionIteratorAction2EditPart) { |
393 | types |
394 | .add(PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001); |
395 | } |
396 | if (targetEditPart instanceof RecoveryAction2EditPart) { |
397 | types |
398 | .add(PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001); |
399 | } |
400 | if (targetEditPart instanceof SetVariableAction2EditPart) { |
401 | types |
402 | .add(PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001); |
403 | } |
404 | return types; |
405 | } |
406 | |
407 | /** |
408 | * @generated |
409 | */ |
410 | public List/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/getMATypesForTarget( |
411 | IElementType relationshipType) { |
412 | List/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/types = new ArrayList/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/(); |
413 | if (relationshipType == PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001) { |
414 | types.add(PalladioComponentModelElementTypes.StartAction_2001); |
415 | } |
416 | if (relationshipType == PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001) { |
417 | types.add(PalladioComponentModelElementTypes.StopAction_2002); |
418 | } |
419 | if (relationshipType == PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001) { |
420 | types |
421 | .add(PalladioComponentModelElementTypes.ExternalCallAction_2003); |
422 | } |
423 | if (relationshipType == PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001) { |
424 | types.add(PalladioComponentModelElementTypes.EmitEventAction_2013); |
425 | } |
426 | if (relationshipType == PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001) { |
427 | types.add(PalladioComponentModelElementTypes.LoopAction_2004); |
428 | } |
429 | if (relationshipType == PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001) { |
430 | types.add(PalladioComponentModelElementTypes.BranchAction_2005); |
431 | } |
432 | if (relationshipType == PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001) { |
433 | types.add(PalladioComponentModelElementTypes.InternalAction_2006); |
434 | } |
435 | if (relationshipType == PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001) { |
436 | types |
437 | .add(PalladioComponentModelElementTypes.CollectionIteratorAction_2007); |
438 | } |
439 | if (relationshipType == PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001) { |
440 | types |
441 | .add(PalladioComponentModelElementTypes.SetVariableAction_2008); |
442 | } |
443 | if (relationshipType == PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001) { |
444 | types.add(PalladioComponentModelElementTypes.AcquireAction_2012); |
445 | } |
446 | if (relationshipType == PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001) { |
447 | types.add(PalladioComponentModelElementTypes.ReleaseAction_2010); |
448 | } |
449 | if (relationshipType == PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001) { |
450 | types.add(PalladioComponentModelElementTypes.ForkAction_2011); |
451 | } |
452 | if (relationshipType == PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001) { |
453 | types.add(PalladioComponentModelElementTypes.RecoveryAction_2016); |
454 | } |
455 | if (relationshipType == PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001) { |
456 | types.add(PalladioComponentModelElementTypes.StartAction_3004); |
457 | } |
458 | if (relationshipType == PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001) { |
459 | types.add(PalladioComponentModelElementTypes.StopAction_3005); |
460 | } |
461 | if (relationshipType == PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001) { |
462 | types.add(PalladioComponentModelElementTypes.LoopAction_3006); |
463 | } |
464 | if (relationshipType == PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001) { |
465 | types.add(PalladioComponentModelElementTypes.InternalAction_3007); |
466 | } |
467 | if (relationshipType == PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001) { |
468 | types.add(PalladioComponentModelElementTypes.BranchAction_3009); |
469 | } |
470 | if (relationshipType == PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001) { |
471 | types |
472 | .add(PalladioComponentModelElementTypes.ExternalCallAction_3012); |
473 | } |
474 | if (relationshipType == PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001) { |
475 | types.add(PalladioComponentModelElementTypes.EmitEventAction_3046); |
476 | } |
477 | if (relationshipType == PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001) { |
478 | types.add(PalladioComponentModelElementTypes.AcquireAction_3026); |
479 | } |
480 | if (relationshipType == PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001) { |
481 | types.add(PalladioComponentModelElementTypes.ReleaseAction_3020); |
482 | } |
483 | if (relationshipType == PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001) { |
484 | types.add(PalladioComponentModelElementTypes.ForkAction_3023); |
485 | } |
486 | if (relationshipType == PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001) { |
487 | types |
488 | .add(PalladioComponentModelElementTypes.CollectionIteratorAction_3013); |
489 | } |
490 | if (relationshipType == PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001) { |
491 | types.add(PalladioComponentModelElementTypes.RecoveryAction_3057); |
492 | } |
493 | if (relationshipType == PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001) { |
494 | types |
495 | .add(PalladioComponentModelElementTypes.SetVariableAction_3024); |
496 | } |
497 | return types; |
498 | } |
499 | |
500 | /** |
501 | * @generated |
502 | */ |
503 | public List/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/getMARelTypesOnTarget() { |
504 | List/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/types = new ArrayList/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/(); |
505 | types |
506 | .add(PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001); |
507 | return types; |
508 | } |
509 | |
510 | /** |
511 | * @generated |
512 | */ |
513 | public List/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/getMATypesForSource( |
514 | IElementType relationshipType) { |
515 | List/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/types = new ArrayList/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/(); |
516 | if (relationshipType == PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001) { |
517 | types.add(PalladioComponentModelElementTypes.StartAction_2001); |
518 | } |
519 | if (relationshipType == PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001) { |
520 | types.add(PalladioComponentModelElementTypes.StopAction_2002); |
521 | } |
522 | if (relationshipType == PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001) { |
523 | types |
524 | .add(PalladioComponentModelElementTypes.ExternalCallAction_2003); |
525 | } |
526 | if (relationshipType == PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001) { |
527 | types.add(PalladioComponentModelElementTypes.EmitEventAction_2013); |
528 | } |
529 | if (relationshipType == PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001) { |
530 | types.add(PalladioComponentModelElementTypes.LoopAction_2004); |
531 | } |
532 | if (relationshipType == PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001) { |
533 | types.add(PalladioComponentModelElementTypes.BranchAction_2005); |
534 | } |
535 | if (relationshipType == PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001) { |
536 | types.add(PalladioComponentModelElementTypes.InternalAction_2006); |
537 | } |
538 | if (relationshipType == PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001) { |
539 | types |
540 | .add(PalladioComponentModelElementTypes.CollectionIteratorAction_2007); |
541 | } |
542 | if (relationshipType == PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001) { |
543 | types |
544 | .add(PalladioComponentModelElementTypes.SetVariableAction_2008); |
545 | } |
546 | if (relationshipType == PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001) { |
547 | types.add(PalladioComponentModelElementTypes.AcquireAction_2012); |
548 | } |
549 | if (relationshipType == PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001) { |
550 | types.add(PalladioComponentModelElementTypes.ReleaseAction_2010); |
551 | } |
552 | if (relationshipType == PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001) { |
553 | types.add(PalladioComponentModelElementTypes.ForkAction_2011); |
554 | } |
555 | if (relationshipType == PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001) { |
556 | types.add(PalladioComponentModelElementTypes.RecoveryAction_2016); |
557 | } |
558 | if (relationshipType == PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001) { |
559 | types.add(PalladioComponentModelElementTypes.StartAction_3004); |
560 | } |
561 | if (relationshipType == PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001) { |
562 | types.add(PalladioComponentModelElementTypes.StopAction_3005); |
563 | } |
564 | if (relationshipType == PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001) { |
565 | types.add(PalladioComponentModelElementTypes.LoopAction_3006); |
566 | } |
567 | if (relationshipType == PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001) { |
568 | types.add(PalladioComponentModelElementTypes.InternalAction_3007); |
569 | } |
570 | if (relationshipType == PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001) { |
571 | types.add(PalladioComponentModelElementTypes.BranchAction_3009); |
572 | } |
573 | if (relationshipType == PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001) { |
574 | types |
575 | .add(PalladioComponentModelElementTypes.ExternalCallAction_3012); |
576 | } |
577 | if (relationshipType == PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001) { |
578 | types.add(PalladioComponentModelElementTypes.EmitEventAction_3046); |
579 | } |
580 | if (relationshipType == PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001) { |
581 | types.add(PalladioComponentModelElementTypes.AcquireAction_3026); |
582 | } |
583 | if (relationshipType == PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001) { |
584 | types.add(PalladioComponentModelElementTypes.ReleaseAction_3020); |
585 | } |
586 | if (relationshipType == PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001) { |
587 | types.add(PalladioComponentModelElementTypes.ForkAction_3023); |
588 | } |
589 | if (relationshipType == PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001) { |
590 | types |
591 | .add(PalladioComponentModelElementTypes.CollectionIteratorAction_3013); |
592 | } |
593 | if (relationshipType == PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001) { |
594 | types.add(PalladioComponentModelElementTypes.RecoveryAction_3057); |
595 | } |
596 | if (relationshipType == PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001) { |
597 | types |
598 | .add(PalladioComponentModelElementTypes.SetVariableAction_3024); |
599 | } |
600 | return types; |
601 | } |
602 | |
603 | /** |
604 | * @generated |
605 | */ |
606 | public class LoopFigure extends RoundedRectangle { |
607 | /** |
608 | * @generated |
609 | */ |
610 | private WrappingLabel fFigureLoopNameLabelFigure; |
611 | /** |
612 | * @generated |
613 | */ |
614 | private WrappingLabel fFigureLoopIterationsLabelFigure; |
615 | |
616 | /** |
617 | * @generated |
618 | */ |
619 | public LoopFigure() { |
620 | |
621 | GridLayout layoutThis = new GridLayout(); |
622 | layoutThis.numColumns = 1; |
623 | layoutThis.makeColumnsEqualWidth = true; |
624 | layoutThis.horizontalSpacing = 0; |
625 | layoutThis.verticalSpacing = 0; |
626 | layoutThis.marginWidth = 0; |
627 | layoutThis.marginHeight = 0; |
628 | this.setLayoutManager(layoutThis); |
629 | |
630 | this.setCornerDimensions(new Dimension(getMapMode().DPtoLP(8), |
631 | getMapMode().DPtoLP(8))); |
632 | this.setLineWidth(1); |
633 | this.setMinimumSize(new Dimension(getMapMode().DPtoLP(0), |
634 | getMapMode().DPtoLP(0))); |
635 | createContents(); |
636 | } |
637 | |
638 | /** |
639 | * @generated |
640 | */ |
641 | private void createContents() { |
642 | |
643 | WrappingLabel loopStereotype0 = new WrappingLabel(); |
644 | loopStereotype0.setText("<<LoopAction>>"); |
645 | loopStereotype0.setBorder(new MarginBorder(getMapMode().DPtoLP(2), |
646 | getMapMode().DPtoLP(0), getMapMode().DPtoLP(2), |
647 | getMapMode().DPtoLP(0))); |
648 | |
649 | GridData constraintLoopStereotype0 = new GridData(); |
650 | constraintLoopStereotype0.verticalAlignment = GridData.CENTER; |
651 | constraintLoopStereotype0.horizontalAlignment = GridData.CENTER; |
652 | constraintLoopStereotype0.horizontalIndent = 0; |
653 | constraintLoopStereotype0.horizontalSpan = 1; |
654 | constraintLoopStereotype0.verticalSpan = 1; |
655 | constraintLoopStereotype0.grabExcessHorizontalSpace = false; |
656 | constraintLoopStereotype0.grabExcessVerticalSpace = false; |
657 | this.add(loopStereotype0, constraintLoopStereotype0); |
658 | |
659 | fFigureLoopNameLabelFigure = new WrappingLabel(); |
660 | fFigureLoopNameLabelFigure.setText("myLoop"); |
661 | fFigureLoopNameLabelFigure.setBorder(new MarginBorder(getMapMode() |
662 | .DPtoLP(2), getMapMode().DPtoLP(0), getMapMode().DPtoLP(2), |
663 | getMapMode().DPtoLP(0))); |
664 | |
665 | GridData constraintFFigureLoopNameLabelFigure = new GridData(); |
666 | constraintFFigureLoopNameLabelFigure.verticalAlignment = GridData.CENTER; |
667 | constraintFFigureLoopNameLabelFigure.horizontalAlignment = GridData.CENTER; |
668 | constraintFFigureLoopNameLabelFigure.horizontalIndent = 0; |
669 | constraintFFigureLoopNameLabelFigure.horizontalSpan = 1; |
670 | constraintFFigureLoopNameLabelFigure.verticalSpan = 1; |
671 | constraintFFigureLoopNameLabelFigure.grabExcessHorizontalSpace = false; |
672 | constraintFFigureLoopNameLabelFigure.grabExcessVerticalSpace = false; |
673 | this.add(fFigureLoopNameLabelFigure, |
674 | constraintFFigureLoopNameLabelFigure); |
675 | |
676 | fFigureLoopIterationsLabelFigure = new WrappingLabel(); |
677 | fFigureLoopIterationsLabelFigure.setText(""); |
678 | fFigureLoopIterationsLabelFigure.setBorder(new MarginBorder( |
679 | getMapMode().DPtoLP(2), getMapMode().DPtoLP(0), |
680 | getMapMode().DPtoLP(2), getMapMode().DPtoLP(0))); |
681 | |
682 | GridData constraintFFigureLoopIterationsLabelFigure = new GridData(); |
683 | constraintFFigureLoopIterationsLabelFigure.verticalAlignment = GridData.CENTER; |
684 | constraintFFigureLoopIterationsLabelFigure.horizontalAlignment = GridData.CENTER; |
685 | constraintFFigureLoopIterationsLabelFigure.horizontalIndent = 0; |
686 | constraintFFigureLoopIterationsLabelFigure.horizontalSpan = 1; |
687 | constraintFFigureLoopIterationsLabelFigure.verticalSpan = 1; |
688 | constraintFFigureLoopIterationsLabelFigure.grabExcessHorizontalSpace = false; |
689 | constraintFFigureLoopIterationsLabelFigure.grabExcessVerticalSpace = false; |
690 | this.add(fFigureLoopIterationsLabelFigure, |
691 | constraintFFigureLoopIterationsLabelFigure); |
692 | |
693 | } |
694 | |
695 | /** |
696 | * @generated |
697 | */ |
698 | public WrappingLabel getFigureLoopNameLabelFigure() { |
699 | return fFigureLoopNameLabelFigure; |
700 | } |
701 | |
702 | /** |
703 | * @generated |
704 | */ |
705 | public WrappingLabel getFigureLoopIterationsLabelFigure() { |
706 | return fFigureLoopIterationsLabelFigure; |
707 | } |
708 | |
709 | /** |
710 | * @generated |
711 | */ |
712 | private boolean myUseLocalCoordinates = false; |
713 | |
714 | /** |
715 | * @generated |
716 | */ |
717 | protected boolean useLocalCoordinates() { |
718 | return myUseLocalCoordinates; |
719 | } |
720 | |
721 | /** |
722 | * @generated |
723 | */ |
724 | protected void setUseLocalCoordinates(boolean useLocalCoordinates) { |
725 | myUseLocalCoordinates = useLocalCoordinates; |
726 | } |
727 | |
728 | @Override |
729 | public void add(IFigure figure, Object constraint, int index) { |
730 | Object newConstraint = constraint; |
731 | if (newConstraint == null) { |
732 | GridData layout = new GridData(); |
733 | layout.grabExcessHorizontalSpace = true; |
734 | layout.grabExcessVerticalSpace = true; |
735 | layout.horizontalAlignment = SWT.FILL; |
736 | layout.verticalAlignment = SWT.FILL; |
737 | layout.horizontalSpan = 1; |
738 | layout.verticalSpan = 1; |
739 | |
740 | newConstraint = layout; |
741 | } |
742 | super.add(figure, newConstraint, index); |
743 | } |
744 | |
745 | } |
746 | |
747 | } |