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