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