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.SetVariableActionItemSemanticEditPolicy; |
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 SetVariableActionEditPart extends ShapeNodeEditPart { |
47 | |
48 | /** |
49 | * @generated |
50 | */ |
51 | public static final int VISUAL_ID = 2008; |
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 SetVariableActionEditPart(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 SetVariableActionItemSemanticEditPolicy()); |
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 | SetVariableActionFigure figure = new SetVariableActionFigure(); |
115 | return primaryShape = figure; |
116 | } |
117 | |
118 | /** |
119 | * @generated |
120 | */ |
121 | public SetVariableActionFigure getPrimaryShape() { |
122 | return (SetVariableActionFigure) primaryShape; |
123 | } |
124 | |
125 | /** |
126 | * @generated |
127 | */ |
128 | protected boolean addFixedChild(EditPart childEditPart) { |
129 | if (childEditPart instanceof SetVariableActionEntityNameEditPart) { |
130 | ((SetVariableActionEntityNameEditPart) childEditPart) |
131 | .setLabel(getPrimaryShape() |
132 | .getFigureSetVariableNameLabelFigure()); |
133 | return true; |
134 | } |
135 | if (childEditPart instanceof SetVariableActionVariableSetter2EditPart) { |
136 | IFigure pane = getPrimaryShape() |
137 | .getFigureSetVariableActionCompartment(); |
138 | setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way |
139 | pane.add(((SetVariableActionVariableSetter2EditPart) childEditPart) |
140 | .getFigure()); |
141 | return true; |
142 | } |
143 | return false; |
144 | } |
145 | |
146 | /** |
147 | * @generated |
148 | */ |
149 | protected boolean removeFixedChild(EditPart childEditPart) { |
150 | if (childEditPart instanceof SetVariableActionEntityNameEditPart) { |
151 | return true; |
152 | } |
153 | if (childEditPart instanceof SetVariableActionVariableSetter2EditPart) { |
154 | IFigure pane = getPrimaryShape() |
155 | .getFigureSetVariableActionCompartment(); |
156 | setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way |
157 | pane |
158 | .remove(((SetVariableActionVariableSetter2EditPart) childEditPart) |
159 | .getFigure()); |
160 | return true; |
161 | } |
162 | return false; |
163 | } |
164 | |
165 | /** |
166 | * @generated |
167 | */ |
168 | protected void addChildVisual(EditPart childEditPart, int index) { |
169 | if (addFixedChild(childEditPart)) { |
170 | return; |
171 | } |
172 | super.addChildVisual(childEditPart, -1); |
173 | } |
174 | |
175 | /** |
176 | * @generated |
177 | */ |
178 | protected void removeChildVisual(EditPart childEditPart) { |
179 | if (removeFixedChild(childEditPart)) { |
180 | return; |
181 | } |
182 | super.removeChildVisual(childEditPart); |
183 | } |
184 | |
185 | /** |
186 | * @generated |
187 | */ |
188 | protected IFigure getContentPaneFor(IGraphicalEditPart editPart) { |
189 | if (editPart instanceof SetVariableActionVariableSetter2EditPart) { |
190 | return getPrimaryShape().getFigureSetVariableActionCompartment(); |
191 | } |
192 | return getContentPane(); |
193 | } |
194 | |
195 | /** |
196 | * @generated |
197 | */ |
198 | protected NodeFigure createNodePlate() { |
199 | DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(40, 40); |
200 | return result; |
201 | } |
202 | |
203 | /** |
204 | * Creates figure for this edit part. |
205 | * |
206 | * Body of this method does not depend on settings in generation model |
207 | * so you may safely remove <i>generated</i> tag and modify it. |
208 | * |
209 | * @generated |
210 | */ |
211 | protected NodeFigure createNodeFigure() { |
212 | NodeFigure figure = createNodePlate(); |
213 | figure.setLayoutManager(new StackLayout()); |
214 | IFigure shape = createNodeShape(); |
215 | figure.add(shape); |
216 | contentPane = setupContentPane(shape); |
217 | return figure; |
218 | } |
219 | |
220 | /** |
221 | * Default implementation treats passed figure as content pane. |
222 | * Respects layout one may have set for generated figure. |
223 | * @param nodeShape instance of generated figure class |
224 | * @generated |
225 | */ |
226 | protected IFigure setupContentPane(IFigure nodeShape) { |
227 | if (nodeShape.getLayoutManager() == null) { |
228 | ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout(); |
229 | layout.setSpacing(5); |
230 | nodeShape.setLayoutManager(layout); |
231 | } |
232 | return nodeShape; // use nodeShape itself as contentPane |
233 | } |
234 | |
235 | /** |
236 | * @generated |
237 | */ |
238 | public IFigure getContentPane() { |
239 | if (contentPane != null) { |
240 | return contentPane; |
241 | } |
242 | return super.getContentPane(); |
243 | } |
244 | |
245 | /** |
246 | * @generated |
247 | */ |
248 | protected void setForegroundColor(Color color) { |
249 | if (primaryShape != null) { |
250 | primaryShape.setForegroundColor(color); |
251 | } |
252 | } |
253 | |
254 | /** |
255 | * @generated |
256 | */ |
257 | protected void setBackgroundColor(Color color) { |
258 | if (primaryShape != null) { |
259 | primaryShape.setBackgroundColor(color); |
260 | } |
261 | } |
262 | |
263 | /** |
264 | * @generated |
265 | */ |
266 | protected void setLineWidth(int width) { |
267 | if (primaryShape instanceof Shape) { |
268 | ((Shape) primaryShape).setLineWidth(width); |
269 | } |
270 | } |
271 | |
272 | /** |
273 | * @generated |
274 | */ |
275 | protected void setLineType(int style) { |
276 | if (primaryShape instanceof Shape) { |
277 | ((Shape) primaryShape).setLineStyle(style); |
278 | } |
279 | } |
280 | |
281 | /** |
282 | * @generated |
283 | */ |
284 | public EditPart getPrimaryChildEditPart() { |
285 | return getChildBySemanticHint(PalladioComponentModelVisualIDRegistry |
286 | .getType(SetVariableActionEntityNameEditPart.VISUAL_ID)); |
287 | } |
288 | |
289 | /** |
290 | * @generated |
291 | */ |
292 | public List/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/getMARelTypesOnSource() { |
293 | List/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/types = new ArrayList/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/(); |
294 | types |
295 | .add(PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001); |
296 | return types; |
297 | } |
298 | |
299 | /** |
300 | * @generated |
301 | */ |
302 | public List/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/getMARelTypesOnSourceAndTarget( |
303 | IGraphicalEditPart targetEditPart) { |
304 | List/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/types = new ArrayList/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/(); |
305 | if (targetEditPart instanceof StartActionEditPart) { |
306 | types |
307 | .add(PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001); |
308 | } |
309 | if (targetEditPart instanceof StopActionEditPart) { |
310 | types |
311 | .add(PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001); |
312 | } |
313 | if (targetEditPart instanceof ExternalCallActionEditPart) { |
314 | types |
315 | .add(PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001); |
316 | } |
317 | if (targetEditPart instanceof EmitEventActionEditPart) { |
318 | types |
319 | .add(PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001); |
320 | } |
321 | if (targetEditPart instanceof LoopActionEditPart) { |
322 | types |
323 | .add(PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001); |
324 | } |
325 | if (targetEditPart instanceof BranchActionEditPart) { |
326 | types |
327 | .add(PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001); |
328 | } |
329 | if (targetEditPart instanceof InternalActionEditPart) { |
330 | types |
331 | .add(PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001); |
332 | } |
333 | if (targetEditPart instanceof CollectionIteratorActionEditPart) { |
334 | types |
335 | .add(PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001); |
336 | } |
337 | if (targetEditPart instanceof de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.SetVariableActionEditPart) { |
338 | types |
339 | .add(PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001); |
340 | } |
341 | if (targetEditPart instanceof AcquireActionEditPart) { |
342 | types |
343 | .add(PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001); |
344 | } |
345 | if (targetEditPart instanceof ReleaseActionEditPart) { |
346 | types |
347 | .add(PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001); |
348 | } |
349 | if (targetEditPart instanceof ForkActionEditPart) { |
350 | types |
351 | .add(PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001); |
352 | } |
353 | if (targetEditPart instanceof RecoveryActionEditPart) { |
354 | types |
355 | .add(PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001); |
356 | } |
357 | if (targetEditPart instanceof StartAction2EditPart) { |
358 | types |
359 | .add(PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001); |
360 | } |
361 | if (targetEditPart instanceof StopAction2EditPart) { |
362 | types |
363 | .add(PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001); |
364 | } |
365 | if (targetEditPart instanceof LoopAction2EditPart) { |
366 | types |
367 | .add(PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001); |
368 | } |
369 | if (targetEditPart instanceof InternalAction2EditPart) { |
370 | types |
371 | .add(PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001); |
372 | } |
373 | if (targetEditPart instanceof BranchAction2EditPart) { |
374 | types |
375 | .add(PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001); |
376 | } |
377 | if (targetEditPart instanceof ExternalCallAction2EditPart) { |
378 | types |
379 | .add(PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001); |
380 | } |
381 | if (targetEditPart instanceof EmitEventAction2EditPart) { |
382 | types |
383 | .add(PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001); |
384 | } |
385 | if (targetEditPart instanceof AcquireAction2EditPart) { |
386 | types |
387 | .add(PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001); |
388 | } |
389 | if (targetEditPart instanceof ReleaseAction2EditPart) { |
390 | types |
391 | .add(PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001); |
392 | } |
393 | if (targetEditPart instanceof ForkAction2EditPart) { |
394 | types |
395 | .add(PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001); |
396 | } |
397 | if (targetEditPart instanceof CollectionIteratorAction2EditPart) { |
398 | types |
399 | .add(PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001); |
400 | } |
401 | if (targetEditPart instanceof RecoveryAction2EditPart) { |
402 | types |
403 | .add(PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001); |
404 | } |
405 | if (targetEditPart instanceof SetVariableAction2EditPart) { |
406 | types |
407 | .add(PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001); |
408 | } |
409 | return types; |
410 | } |
411 | |
412 | /** |
413 | * @generated |
414 | */ |
415 | public List/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/getMATypesForTarget( |
416 | IElementType relationshipType) { |
417 | List/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/types = new ArrayList/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/(); |
418 | if (relationshipType == PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001) { |
419 | types.add(PalladioComponentModelElementTypes.StartAction_2001); |
420 | } |
421 | if (relationshipType == PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001) { |
422 | types.add(PalladioComponentModelElementTypes.StopAction_2002); |
423 | } |
424 | if (relationshipType == PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001) { |
425 | types |
426 | .add(PalladioComponentModelElementTypes.ExternalCallAction_2003); |
427 | } |
428 | if (relationshipType == PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001) { |
429 | types.add(PalladioComponentModelElementTypes.EmitEventAction_2013); |
430 | } |
431 | if (relationshipType == PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001) { |
432 | types.add(PalladioComponentModelElementTypes.LoopAction_2004); |
433 | } |
434 | if (relationshipType == PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001) { |
435 | types.add(PalladioComponentModelElementTypes.BranchAction_2005); |
436 | } |
437 | if (relationshipType == PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001) { |
438 | types.add(PalladioComponentModelElementTypes.InternalAction_2006); |
439 | } |
440 | if (relationshipType == PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001) { |
441 | types |
442 | .add(PalladioComponentModelElementTypes.CollectionIteratorAction_2007); |
443 | } |
444 | if (relationshipType == PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001) { |
445 | types |
446 | .add(PalladioComponentModelElementTypes.SetVariableAction_2008); |
447 | } |
448 | if (relationshipType == PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001) { |
449 | types.add(PalladioComponentModelElementTypes.AcquireAction_2012); |
450 | } |
451 | if (relationshipType == PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001) { |
452 | types.add(PalladioComponentModelElementTypes.ReleaseAction_2010); |
453 | } |
454 | if (relationshipType == PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001) { |
455 | types.add(PalladioComponentModelElementTypes.ForkAction_2011); |
456 | } |
457 | if (relationshipType == PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001) { |
458 | types.add(PalladioComponentModelElementTypes.RecoveryAction_2016); |
459 | } |
460 | if (relationshipType == PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001) { |
461 | types.add(PalladioComponentModelElementTypes.StartAction_3004); |
462 | } |
463 | if (relationshipType == PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001) { |
464 | types.add(PalladioComponentModelElementTypes.StopAction_3005); |
465 | } |
466 | if (relationshipType == PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001) { |
467 | types.add(PalladioComponentModelElementTypes.LoopAction_3006); |
468 | } |
469 | if (relationshipType == PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001) { |
470 | types.add(PalladioComponentModelElementTypes.InternalAction_3007); |
471 | } |
472 | if (relationshipType == PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001) { |
473 | types.add(PalladioComponentModelElementTypes.BranchAction_3009); |
474 | } |
475 | if (relationshipType == PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001) { |
476 | types |
477 | .add(PalladioComponentModelElementTypes.ExternalCallAction_3012); |
478 | } |
479 | if (relationshipType == PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001) { |
480 | types.add(PalladioComponentModelElementTypes.EmitEventAction_3046); |
481 | } |
482 | if (relationshipType == PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001) { |
483 | types.add(PalladioComponentModelElementTypes.AcquireAction_3026); |
484 | } |
485 | if (relationshipType == PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001) { |
486 | types.add(PalladioComponentModelElementTypes.ReleaseAction_3020); |
487 | } |
488 | if (relationshipType == PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001) { |
489 | types.add(PalladioComponentModelElementTypes.ForkAction_3023); |
490 | } |
491 | if (relationshipType == PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001) { |
492 | types |
493 | .add(PalladioComponentModelElementTypes.CollectionIteratorAction_3013); |
494 | } |
495 | if (relationshipType == PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001) { |
496 | types.add(PalladioComponentModelElementTypes.RecoveryAction_3057); |
497 | } |
498 | if (relationshipType == PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001) { |
499 | types |
500 | .add(PalladioComponentModelElementTypes.SetVariableAction_3024); |
501 | } |
502 | return types; |
503 | } |
504 | |
505 | /** |
506 | * @generated |
507 | */ |
508 | public List/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/getMARelTypesOnTarget() { |
509 | List/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/types = new ArrayList/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/(); |
510 | types |
511 | .add(PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001); |
512 | return types; |
513 | } |
514 | |
515 | /** |
516 | * @generated |
517 | */ |
518 | public List/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/getMATypesForSource( |
519 | IElementType relationshipType) { |
520 | List/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/types = new ArrayList/*<org.eclipse.gmf.runtime.emf.type.core.IElementType>*/(); |
521 | if (relationshipType == PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001) { |
522 | types.add(PalladioComponentModelElementTypes.StartAction_2001); |
523 | } |
524 | if (relationshipType == PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001) { |
525 | types.add(PalladioComponentModelElementTypes.StopAction_2002); |
526 | } |
527 | if (relationshipType == PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001) { |
528 | types |
529 | .add(PalladioComponentModelElementTypes.ExternalCallAction_2003); |
530 | } |
531 | if (relationshipType == PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001) { |
532 | types.add(PalladioComponentModelElementTypes.EmitEventAction_2013); |
533 | } |
534 | if (relationshipType == PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001) { |
535 | types.add(PalladioComponentModelElementTypes.LoopAction_2004); |
536 | } |
537 | if (relationshipType == PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001) { |
538 | types.add(PalladioComponentModelElementTypes.BranchAction_2005); |
539 | } |
540 | if (relationshipType == PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001) { |
541 | types.add(PalladioComponentModelElementTypes.InternalAction_2006); |
542 | } |
543 | if (relationshipType == PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001) { |
544 | types |
545 | .add(PalladioComponentModelElementTypes.CollectionIteratorAction_2007); |
546 | } |
547 | if (relationshipType == PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001) { |
548 | types |
549 | .add(PalladioComponentModelElementTypes.SetVariableAction_2008); |
550 | } |
551 | if (relationshipType == PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001) { |
552 | types.add(PalladioComponentModelElementTypes.AcquireAction_2012); |
553 | } |
554 | if (relationshipType == PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001) { |
555 | types.add(PalladioComponentModelElementTypes.ReleaseAction_2010); |
556 | } |
557 | if (relationshipType == PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001) { |
558 | types.add(PalladioComponentModelElementTypes.ForkAction_2011); |
559 | } |
560 | if (relationshipType == PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001) { |
561 | types.add(PalladioComponentModelElementTypes.RecoveryAction_2016); |
562 | } |
563 | if (relationshipType == PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001) { |
564 | types.add(PalladioComponentModelElementTypes.StartAction_3004); |
565 | } |
566 | if (relationshipType == PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001) { |
567 | types.add(PalladioComponentModelElementTypes.StopAction_3005); |
568 | } |
569 | if (relationshipType == PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001) { |
570 | types.add(PalladioComponentModelElementTypes.LoopAction_3006); |
571 | } |
572 | if (relationshipType == PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001) { |
573 | types.add(PalladioComponentModelElementTypes.InternalAction_3007); |
574 | } |
575 | if (relationshipType == PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001) { |
576 | types.add(PalladioComponentModelElementTypes.BranchAction_3009); |
577 | } |
578 | if (relationshipType == PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001) { |
579 | types |
580 | .add(PalladioComponentModelElementTypes.ExternalCallAction_3012); |
581 | } |
582 | if (relationshipType == PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001) { |
583 | types.add(PalladioComponentModelElementTypes.EmitEventAction_3046); |
584 | } |
585 | if (relationshipType == PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001) { |
586 | types.add(PalladioComponentModelElementTypes.AcquireAction_3026); |
587 | } |
588 | if (relationshipType == PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001) { |
589 | types.add(PalladioComponentModelElementTypes.ReleaseAction_3020); |
590 | } |
591 | if (relationshipType == PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001) { |
592 | types.add(PalladioComponentModelElementTypes.ForkAction_3023); |
593 | } |
594 | if (relationshipType == PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001) { |
595 | types |
596 | .add(PalladioComponentModelElementTypes.CollectionIteratorAction_3013); |
597 | } |
598 | if (relationshipType == PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001) { |
599 | types.add(PalladioComponentModelElementTypes.RecoveryAction_3057); |
600 | } |
601 | if (relationshipType == PalladioComponentModelElementTypes.AbstractActionSuccessor_AbstractAction_4001) { |
602 | types |
603 | .add(PalladioComponentModelElementTypes.SetVariableAction_3024); |
604 | } |
605 | return types; |
606 | } |
607 | |
608 | /** |
609 | * @generated |
610 | */ |
611 | public EditPart getTargetEditPart(Request request) { |
612 | if (request instanceof CreateViewAndElementRequest) { |
613 | CreateElementRequestAdapter adapter = ((CreateViewAndElementRequest) request) |
614 | .getViewAndElementDescriptor() |
615 | .getCreateElementRequestAdapter(); |
616 | IElementType type = (IElementType) adapter |
617 | .getAdapter(IElementType.class); |
618 | if (type == PalladioComponentModelElementTypes.VariableUsage_3036) { |
619 | return getChildBySemanticHint(PalladioComponentModelVisualIDRegistry |
620 | .getType(SetVariableActionVariableSetter2EditPart.VISUAL_ID)); |
621 | } |
622 | } |
623 | return super.getTargetEditPart(request); |
624 | } |
625 | |
626 | /** |
627 | * @generated |
628 | */ |
629 | public class SetVariableActionFigure extends RoundedRectangle { |
630 | /** |
631 | * @generated |
632 | */ |
633 | private WrappingLabel fFigureSetVariableNameLabelFigure; |
634 | |
635 | /** |
636 | * @generated |
637 | */ |
638 | private RectangleFigure fFigureSetVariableActionCompartment; |
639 | |
640 | /** |
641 | * @generated |
642 | */ |
643 | public SetVariableActionFigure() { |
644 | |
645 | GridLayout layoutThis = new GridLayout(); |
646 | layoutThis.numColumns = 1; |
647 | layoutThis.makeColumnsEqualWidth = true; |
648 | layoutThis.horizontalSpacing = 0; |
649 | layoutThis.verticalSpacing = 0; |
650 | layoutThis.marginWidth = 0; |
651 | layoutThis.marginHeight = 0; |
652 | this.setLayoutManager(layoutThis); |
653 | |
654 | this.setCornerDimensions(new Dimension(getMapMode().DPtoLP(8), |
655 | getMapMode().DPtoLP(8))); |
656 | this.setLineWidth(1); |
657 | this.setMinimumSize(new Dimension(getMapMode().DPtoLP(0), |
658 | getMapMode().DPtoLP(0))); |
659 | createContents(); |
660 | } |
661 | |
662 | /** |
663 | * @generated |
664 | */ |
665 | private void createContents() { |
666 | |
667 | WrappingLabel setVariableActionStereotypeLabelFigure0 = new WrappingLabel(); |
668 | setVariableActionStereotypeLabelFigure0 |
669 | .setText("<<SetVariableAction>>"); |
670 | setVariableActionStereotypeLabelFigure0.setBorder(new MarginBorder( |
671 | getMapMode().DPtoLP(2), getMapMode().DPtoLP(0), |
672 | getMapMode().DPtoLP(2), getMapMode().DPtoLP(0))); |
673 | |
674 | GridData constraintSetVariableActionStereotypeLabelFigure0 = new GridData(); |
675 | constraintSetVariableActionStereotypeLabelFigure0.verticalAlignment = GridData.CENTER; |
676 | constraintSetVariableActionStereotypeLabelFigure0.horizontalAlignment = GridData.CENTER; |
677 | constraintSetVariableActionStereotypeLabelFigure0.horizontalIndent = 0; |
678 | constraintSetVariableActionStereotypeLabelFigure0.horizontalSpan = 1; |
679 | constraintSetVariableActionStereotypeLabelFigure0.verticalSpan = 1; |
680 | constraintSetVariableActionStereotypeLabelFigure0.grabExcessHorizontalSpace = false; |
681 | constraintSetVariableActionStereotypeLabelFigure0.grabExcessVerticalSpace = false; |
682 | this.add(setVariableActionStereotypeLabelFigure0, |
683 | constraintSetVariableActionStereotypeLabelFigure0); |
684 | |
685 | fFigureSetVariableNameLabelFigure = new WrappingLabel(); |
686 | fFigureSetVariableNameLabelFigure.setText(""); |
687 | fFigureSetVariableNameLabelFigure.setBorder(new MarginBorder( |
688 | getMapMode().DPtoLP(2), getMapMode().DPtoLP(0), |
689 | getMapMode().DPtoLP(2), getMapMode().DPtoLP(0))); |
690 | |
691 | GridData constraintFFigureSetVariableNameLabelFigure = new GridData(); |
692 | constraintFFigureSetVariableNameLabelFigure.verticalAlignment = GridData.CENTER; |
693 | constraintFFigureSetVariableNameLabelFigure.horizontalAlignment = GridData.CENTER; |
694 | constraintFFigureSetVariableNameLabelFigure.horizontalIndent = 0; |
695 | constraintFFigureSetVariableNameLabelFigure.horizontalSpan = 1; |
696 | constraintFFigureSetVariableNameLabelFigure.verticalSpan = 1; |
697 | constraintFFigureSetVariableNameLabelFigure.grabExcessHorizontalSpace = false; |
698 | constraintFFigureSetVariableNameLabelFigure.grabExcessVerticalSpace = false; |
699 | this.add(fFigureSetVariableNameLabelFigure, |
700 | constraintFFigureSetVariableNameLabelFigure); |
701 | |
702 | fFigureSetVariableActionCompartment = new RectangleFigure(); |
703 | fFigureSetVariableActionCompartment.setFill(false); |
704 | fFigureSetVariableActionCompartment.setOutline(false); |
705 | fFigureSetVariableActionCompartment.setLineWidth(1); |
706 | fFigureSetVariableActionCompartment.setMinimumSize(new Dimension( |
707 | getMapMode().DPtoLP(0), getMapMode().DPtoLP(0))); |
708 | |
709 | GridData constraintFFigureSetVariableActionCompartment = new GridData(); |
710 | constraintFFigureSetVariableActionCompartment.verticalAlignment = GridData.FILL; |
711 | constraintFFigureSetVariableActionCompartment.horizontalAlignment = GridData.FILL; |
712 | constraintFFigureSetVariableActionCompartment.horizontalIndent = 0; |
713 | constraintFFigureSetVariableActionCompartment.horizontalSpan = 1; |
714 | constraintFFigureSetVariableActionCompartment.verticalSpan = 1; |
715 | constraintFFigureSetVariableActionCompartment.grabExcessHorizontalSpace = true; |
716 | constraintFFigureSetVariableActionCompartment.grabExcessVerticalSpace = true; |
717 | this.add(fFigureSetVariableActionCompartment, |
718 | constraintFFigureSetVariableActionCompartment); |
719 | |
720 | } |
721 | |
722 | /** |
723 | * @generated |
724 | */ |
725 | public WrappingLabel getFigureSetVariableNameLabelFigure() { |
726 | return fFigureSetVariableNameLabelFigure; |
727 | } |
728 | |
729 | /** |
730 | * @generated |
731 | */ |
732 | public RectangleFigure getFigureSetVariableActionCompartment() { |
733 | return fFigureSetVariableActionCompartment; |
734 | } |
735 | |
736 | /** |
737 | * @generated |
738 | */ |
739 | private boolean myUseLocalCoordinates = false; |
740 | |
741 | /** |
742 | * @generated |
743 | */ |
744 | protected boolean useLocalCoordinates() { |
745 | return myUseLocalCoordinates; |
746 | } |
747 | |
748 | /** |
749 | * @generated |
750 | */ |
751 | protected void setUseLocalCoordinates(boolean useLocalCoordinates) { |
752 | myUseLocalCoordinates = useLocalCoordinates; |
753 | } |
754 | |
755 | } |
756 | |
757 | } |