1 | /* |
2 | * Copyright 2006 SDQ Research Group, University of Karlsruhe (TH) |
3 | */ |
4 | package de.uka.ipd.sdq.pcm.gmf.seff.edit.policies; |
5 | |
6 | import java.util.Iterator; |
7 | |
8 | import org.eclipse.emf.ecore.EAnnotation; |
9 | import org.eclipse.gef.commands.Command; |
10 | import org.eclipse.gmf.runtime.common.core.command.ICompositeCommand; |
11 | import org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand; |
12 | import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand; |
13 | import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand; |
14 | import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyReferenceCommand; |
15 | import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest; |
16 | import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyReferenceRequest; |
17 | import org.eclipse.gmf.runtime.notation.Edge; |
18 | import org.eclipse.gmf.runtime.notation.Node; |
19 | import org.eclipse.gmf.runtime.notation.View; |
20 | |
21 | import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.AbstractActionSuccessor_AbstractActionEditPart; |
22 | import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.AcquireAction2EditPart; |
23 | import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.BranchAction2EditPart; |
24 | import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.CollectionIteratorAction2EditPart; |
25 | import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.EmitEventAction2EditPart; |
26 | import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.ExternalCallAction2EditPart; |
27 | import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.ForkAction2EditPart; |
28 | import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.ForkedBehaviourSynchronisationPointForkedBehavioursEditPart; |
29 | import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.InternalAction2EditPart; |
30 | import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.LoopAction2EditPart; |
31 | import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.RecoveryAction2EditPart; |
32 | import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.ReleaseAction2EditPart; |
33 | import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.StartAction2EditPart; |
34 | import de.uka.ipd.sdq.pcm.gmf.seff.edit.parts.StopAction2EditPart; |
35 | import de.uka.ipd.sdq.pcm.gmf.seff.part.PalladioComponentModelVisualIDRegistry; |
36 | import de.uka.ipd.sdq.pcm.gmf.seff.providers.PalladioComponentModelElementTypes; |
37 | |
38 | /** |
39 | * @generated |
40 | */ |
41 | public class ForkedBehaviour2ItemSemanticEditPolicy extends |
42 | PalladioComponentModelBaseItemSemanticEditPolicy { |
43 | |
44 | /** |
45 | * @generated |
46 | */ |
47 | public ForkedBehaviour2ItemSemanticEditPolicy() { |
48 | super(PalladioComponentModelElementTypes.ForkedBehaviour_3039); |
49 | } |
50 | |
51 | /** |
52 | * @generated |
53 | */ |
54 | protected Command getDestroyElementCommand(DestroyElementRequest req) { |
55 | View view = (View) getHost().getModel(); |
56 | CompositeTransactionalCommand cmd = new CompositeTransactionalCommand( |
57 | getEditingDomain(), null); |
58 | cmd.setTransactionNestingEnabled(false); |
59 | EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$ |
60 | if (annotation == null) { |
61 | // there are indirectly referenced children, need extra commands: false |
62 | addDestroyChildNodesCommand(cmd); |
63 | addDestroyShortcutsCommand(cmd, view); |
64 | // delete host element |
65 | cmd.add(new DestroyElementCommand(req)); |
66 | } else { |
67 | cmd.add(new DeleteCommand(getEditingDomain(), view)); |
68 | } |
69 | return getGEFWrapper(cmd.reduce()); |
70 | } |
71 | |
72 | /** |
73 | * @generated |
74 | */ |
75 | private void addDestroyChildNodesCommand(ICompositeCommand cmd) { |
76 | View view = (View) getHost().getModel(); |
77 | for (Iterator nit = view.getChildren().iterator(); nit.hasNext();) { |
78 | Node node = (Node) nit.next(); |
79 | switch (PalladioComponentModelVisualIDRegistry.getVisualID(node)) { |
80 | case ForkedBehaviourSynchronisationPointForkedBehavioursEditPart.VISUAL_ID: |
81 | for (Iterator cit = node.getChildren().iterator(); cit |
82 | .hasNext();) { |
83 | Node cnode = (Node) cit.next(); |
84 | switch (PalladioComponentModelVisualIDRegistry |
85 | .getVisualID(cnode)) { |
86 | case StartAction2EditPart.VISUAL_ID: |
87 | for (Iterator it = cnode.getTargetEdges().iterator(); it |
88 | .hasNext();) { |
89 | Edge incomingLink = (Edge) it.next(); |
90 | if (PalladioComponentModelVisualIDRegistry |
91 | .getVisualID(incomingLink) == AbstractActionSuccessor_AbstractActionEditPart.VISUAL_ID) { |
92 | DestroyReferenceRequest r = new DestroyReferenceRequest( |
93 | incomingLink.getSource().getElement(), |
94 | null, incomingLink.getTarget() |
95 | .getElement(), false); |
96 | cmd.add(new DestroyReferenceCommand(r)); |
97 | cmd.add(new DeleteCommand(getEditingDomain(), |
98 | incomingLink)); |
99 | continue; |
100 | } |
101 | } |
102 | for (Iterator it = cnode.getSourceEdges().iterator(); it |
103 | .hasNext();) { |
104 | Edge outgoingLink = (Edge) it.next(); |
105 | if (PalladioComponentModelVisualIDRegistry |
106 | .getVisualID(outgoingLink) == AbstractActionSuccessor_AbstractActionEditPart.VISUAL_ID) { |
107 | DestroyReferenceRequest r = new DestroyReferenceRequest( |
108 | outgoingLink.getSource().getElement(), |
109 | null, outgoingLink.getTarget() |
110 | .getElement(), false); |
111 | cmd.add(new DestroyReferenceCommand(r)); |
112 | cmd.add(new DeleteCommand(getEditingDomain(), |
113 | outgoingLink)); |
114 | continue; |
115 | } |
116 | } |
117 | cmd.add(new DestroyElementCommand( |
118 | new DestroyElementRequest(getEditingDomain(), |
119 | cnode.getElement(), false))); // directlyOwned: true |
120 | // don't need explicit deletion of cnode as parent's view deletion would clean child views as well |
121 | // cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), cnode)); |
122 | break; |
123 | case StopAction2EditPart.VISUAL_ID: |
124 | for (Iterator it = cnode.getTargetEdges().iterator(); it |
125 | .hasNext();) { |
126 | Edge incomingLink = (Edge) it.next(); |
127 | if (PalladioComponentModelVisualIDRegistry |
128 | .getVisualID(incomingLink) == AbstractActionSuccessor_AbstractActionEditPart.VISUAL_ID) { |
129 | DestroyReferenceRequest r = new DestroyReferenceRequest( |
130 | incomingLink.getSource().getElement(), |
131 | null, incomingLink.getTarget() |
132 | .getElement(), false); |
133 | cmd.add(new DestroyReferenceCommand(r)); |
134 | cmd.add(new DeleteCommand(getEditingDomain(), |
135 | incomingLink)); |
136 | continue; |
137 | } |
138 | } |
139 | for (Iterator it = cnode.getSourceEdges().iterator(); it |
140 | .hasNext();) { |
141 | Edge outgoingLink = (Edge) it.next(); |
142 | if (PalladioComponentModelVisualIDRegistry |
143 | .getVisualID(outgoingLink) == AbstractActionSuccessor_AbstractActionEditPart.VISUAL_ID) { |
144 | DestroyReferenceRequest r = new DestroyReferenceRequest( |
145 | outgoingLink.getSource().getElement(), |
146 | null, outgoingLink.getTarget() |
147 | .getElement(), false); |
148 | cmd.add(new DestroyReferenceCommand(r)); |
149 | cmd.add(new DeleteCommand(getEditingDomain(), |
150 | outgoingLink)); |
151 | continue; |
152 | } |
153 | } |
154 | cmd.add(new DestroyElementCommand( |
155 | new DestroyElementRequest(getEditingDomain(), |
156 | cnode.getElement(), false))); // directlyOwned: true |
157 | // don't need explicit deletion of cnode as parent's view deletion would clean child views as well |
158 | // cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), cnode)); |
159 | break; |
160 | case LoopAction2EditPart.VISUAL_ID: |
161 | for (Iterator it = cnode.getTargetEdges().iterator(); it |
162 | .hasNext();) { |
163 | Edge incomingLink = (Edge) it.next(); |
164 | if (PalladioComponentModelVisualIDRegistry |
165 | .getVisualID(incomingLink) == AbstractActionSuccessor_AbstractActionEditPart.VISUAL_ID) { |
166 | DestroyReferenceRequest r = new DestroyReferenceRequest( |
167 | incomingLink.getSource().getElement(), |
168 | null, incomingLink.getTarget() |
169 | .getElement(), false); |
170 | cmd.add(new DestroyReferenceCommand(r)); |
171 | cmd.add(new DeleteCommand(getEditingDomain(), |
172 | incomingLink)); |
173 | continue; |
174 | } |
175 | } |
176 | for (Iterator it = cnode.getSourceEdges().iterator(); it |
177 | .hasNext();) { |
178 | Edge outgoingLink = (Edge) it.next(); |
179 | if (PalladioComponentModelVisualIDRegistry |
180 | .getVisualID(outgoingLink) == AbstractActionSuccessor_AbstractActionEditPart.VISUAL_ID) { |
181 | DestroyReferenceRequest r = new DestroyReferenceRequest( |
182 | outgoingLink.getSource().getElement(), |
183 | null, outgoingLink.getTarget() |
184 | .getElement(), false); |
185 | cmd.add(new DestroyReferenceCommand(r)); |
186 | cmd.add(new DeleteCommand(getEditingDomain(), |
187 | outgoingLink)); |
188 | continue; |
189 | } |
190 | } |
191 | cmd.add(new DestroyElementCommand( |
192 | new DestroyElementRequest(getEditingDomain(), |
193 | cnode.getElement(), false))); // directlyOwned: true |
194 | // don't need explicit deletion of cnode as parent's view deletion would clean child views as well |
195 | // cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), cnode)); |
196 | break; |
197 | case InternalAction2EditPart.VISUAL_ID: |
198 | for (Iterator it = cnode.getTargetEdges().iterator(); it |
199 | .hasNext();) { |
200 | Edge incomingLink = (Edge) it.next(); |
201 | if (PalladioComponentModelVisualIDRegistry |
202 | .getVisualID(incomingLink) == AbstractActionSuccessor_AbstractActionEditPart.VISUAL_ID) { |
203 | DestroyReferenceRequest r = new DestroyReferenceRequest( |
204 | incomingLink.getSource().getElement(), |
205 | null, incomingLink.getTarget() |
206 | .getElement(), false); |
207 | cmd.add(new DestroyReferenceCommand(r)); |
208 | cmd.add(new DeleteCommand(getEditingDomain(), |
209 | incomingLink)); |
210 | continue; |
211 | } |
212 | } |
213 | for (Iterator it = cnode.getSourceEdges().iterator(); it |
214 | .hasNext();) { |
215 | Edge outgoingLink = (Edge) it.next(); |
216 | if (PalladioComponentModelVisualIDRegistry |
217 | .getVisualID(outgoingLink) == AbstractActionSuccessor_AbstractActionEditPart.VISUAL_ID) { |
218 | DestroyReferenceRequest r = new DestroyReferenceRequest( |
219 | outgoingLink.getSource().getElement(), |
220 | null, outgoingLink.getTarget() |
221 | .getElement(), false); |
222 | cmd.add(new DestroyReferenceCommand(r)); |
223 | cmd.add(new DeleteCommand(getEditingDomain(), |
224 | outgoingLink)); |
225 | continue; |
226 | } |
227 | } |
228 | cmd.add(new DestroyElementCommand( |
229 | new DestroyElementRequest(getEditingDomain(), |
230 | cnode.getElement(), false))); // directlyOwned: true |
231 | // don't need explicit deletion of cnode as parent's view deletion would clean child views as well |
232 | // cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), cnode)); |
233 | break; |
234 | case BranchAction2EditPart.VISUAL_ID: |
235 | for (Iterator it = cnode.getTargetEdges().iterator(); it |
236 | .hasNext();) { |
237 | Edge incomingLink = (Edge) it.next(); |
238 | if (PalladioComponentModelVisualIDRegistry |
239 | .getVisualID(incomingLink) == AbstractActionSuccessor_AbstractActionEditPart.VISUAL_ID) { |
240 | DestroyReferenceRequest r = new DestroyReferenceRequest( |
241 | incomingLink.getSource().getElement(), |
242 | null, incomingLink.getTarget() |
243 | .getElement(), false); |
244 | cmd.add(new DestroyReferenceCommand(r)); |
245 | cmd.add(new DeleteCommand(getEditingDomain(), |
246 | incomingLink)); |
247 | continue; |
248 | } |
249 | } |
250 | for (Iterator it = cnode.getSourceEdges().iterator(); it |
251 | .hasNext();) { |
252 | Edge outgoingLink = (Edge) it.next(); |
253 | if (PalladioComponentModelVisualIDRegistry |
254 | .getVisualID(outgoingLink) == AbstractActionSuccessor_AbstractActionEditPart.VISUAL_ID) { |
255 | DestroyReferenceRequest r = new DestroyReferenceRequest( |
256 | outgoingLink.getSource().getElement(), |
257 | null, outgoingLink.getTarget() |
258 | .getElement(), false); |
259 | cmd.add(new DestroyReferenceCommand(r)); |
260 | cmd.add(new DeleteCommand(getEditingDomain(), |
261 | outgoingLink)); |
262 | continue; |
263 | } |
264 | } |
265 | cmd.add(new DestroyElementCommand( |
266 | new DestroyElementRequest(getEditingDomain(), |
267 | cnode.getElement(), false))); // directlyOwned: true |
268 | // don't need explicit deletion of cnode as parent's view deletion would clean child views as well |
269 | // cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), cnode)); |
270 | break; |
271 | case ExternalCallAction2EditPart.VISUAL_ID: |
272 | for (Iterator it = cnode.getTargetEdges().iterator(); it |
273 | .hasNext();) { |
274 | Edge incomingLink = (Edge) it.next(); |
275 | if (PalladioComponentModelVisualIDRegistry |
276 | .getVisualID(incomingLink) == AbstractActionSuccessor_AbstractActionEditPart.VISUAL_ID) { |
277 | DestroyReferenceRequest r = new DestroyReferenceRequest( |
278 | incomingLink.getSource().getElement(), |
279 | null, incomingLink.getTarget() |
280 | .getElement(), false); |
281 | cmd.add(new DestroyReferenceCommand(r)); |
282 | cmd.add(new DeleteCommand(getEditingDomain(), |
283 | incomingLink)); |
284 | continue; |
285 | } |
286 | } |
287 | for (Iterator it = cnode.getSourceEdges().iterator(); it |
288 | .hasNext();) { |
289 | Edge outgoingLink = (Edge) it.next(); |
290 | if (PalladioComponentModelVisualIDRegistry |
291 | .getVisualID(outgoingLink) == AbstractActionSuccessor_AbstractActionEditPart.VISUAL_ID) { |
292 | DestroyReferenceRequest r = new DestroyReferenceRequest( |
293 | outgoingLink.getSource().getElement(), |
294 | null, outgoingLink.getTarget() |
295 | .getElement(), false); |
296 | cmd.add(new DestroyReferenceCommand(r)); |
297 | cmd.add(new DeleteCommand(getEditingDomain(), |
298 | outgoingLink)); |
299 | continue; |
300 | } |
301 | } |
302 | cmd.add(new DestroyElementCommand( |
303 | new DestroyElementRequest(getEditingDomain(), |
304 | cnode.getElement(), false))); // directlyOwned: true |
305 | // don't need explicit deletion of cnode as parent's view deletion would clean child views as well |
306 | // cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), cnode)); |
307 | break; |
308 | case EmitEventAction2EditPart.VISUAL_ID: |
309 | for (Iterator it = cnode.getTargetEdges().iterator(); it |
310 | .hasNext();) { |
311 | Edge incomingLink = (Edge) it.next(); |
312 | if (PalladioComponentModelVisualIDRegistry |
313 | .getVisualID(incomingLink) == AbstractActionSuccessor_AbstractActionEditPart.VISUAL_ID) { |
314 | DestroyReferenceRequest r = new DestroyReferenceRequest( |
315 | incomingLink.getSource().getElement(), |
316 | null, incomingLink.getTarget() |
317 | .getElement(), false); |
318 | cmd.add(new DestroyReferenceCommand(r)); |
319 | cmd.add(new DeleteCommand(getEditingDomain(), |
320 | incomingLink)); |
321 | continue; |
322 | } |
323 | } |
324 | for (Iterator it = cnode.getSourceEdges().iterator(); it |
325 | .hasNext();) { |
326 | Edge outgoingLink = (Edge) it.next(); |
327 | if (PalladioComponentModelVisualIDRegistry |
328 | .getVisualID(outgoingLink) == AbstractActionSuccessor_AbstractActionEditPart.VISUAL_ID) { |
329 | DestroyReferenceRequest r = new DestroyReferenceRequest( |
330 | outgoingLink.getSource().getElement(), |
331 | null, outgoingLink.getTarget() |
332 | .getElement(), false); |
333 | cmd.add(new DestroyReferenceCommand(r)); |
334 | cmd.add(new DeleteCommand(getEditingDomain(), |
335 | outgoingLink)); |
336 | continue; |
337 | } |
338 | } |
339 | cmd.add(new DestroyElementCommand( |
340 | new DestroyElementRequest(getEditingDomain(), |
341 | cnode.getElement(), false))); // directlyOwned: true |
342 | // don't need explicit deletion of cnode as parent's view deletion would clean child views as well |
343 | // cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), cnode)); |
344 | break; |
345 | case CollectionIteratorAction2EditPart.VISUAL_ID: |
346 | for (Iterator it = cnode.getTargetEdges().iterator(); it |
347 | .hasNext();) { |
348 | Edge incomingLink = (Edge) it.next(); |
349 | if (PalladioComponentModelVisualIDRegistry |
350 | .getVisualID(incomingLink) == AbstractActionSuccessor_AbstractActionEditPart.VISUAL_ID) { |
351 | DestroyReferenceRequest r = new DestroyReferenceRequest( |
352 | incomingLink.getSource().getElement(), |
353 | null, incomingLink.getTarget() |
354 | .getElement(), false); |
355 | cmd.add(new DestroyReferenceCommand(r)); |
356 | cmd.add(new DeleteCommand(getEditingDomain(), |
357 | incomingLink)); |
358 | continue; |
359 | } |
360 | } |
361 | for (Iterator it = cnode.getSourceEdges().iterator(); it |
362 | .hasNext();) { |
363 | Edge outgoingLink = (Edge) it.next(); |
364 | if (PalladioComponentModelVisualIDRegistry |
365 | .getVisualID(outgoingLink) == AbstractActionSuccessor_AbstractActionEditPart.VISUAL_ID) { |
366 | DestroyReferenceRequest r = new DestroyReferenceRequest( |
367 | outgoingLink.getSource().getElement(), |
368 | null, outgoingLink.getTarget() |
369 | .getElement(), false); |
370 | cmd.add(new DestroyReferenceCommand(r)); |
371 | cmd.add(new DeleteCommand(getEditingDomain(), |
372 | outgoingLink)); |
373 | continue; |
374 | } |
375 | } |
376 | cmd.add(new DestroyElementCommand( |
377 | new DestroyElementRequest(getEditingDomain(), |
378 | cnode.getElement(), false))); // directlyOwned: true |
379 | // don't need explicit deletion of cnode as parent's view deletion would clean child views as well |
380 | // cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), cnode)); |
381 | break; |
382 | case AcquireAction2EditPart.VISUAL_ID: |
383 | for (Iterator it = cnode.getTargetEdges().iterator(); it |
384 | .hasNext();) { |
385 | Edge incomingLink = (Edge) it.next(); |
386 | if (PalladioComponentModelVisualIDRegistry |
387 | .getVisualID(incomingLink) == AbstractActionSuccessor_AbstractActionEditPart.VISUAL_ID) { |
388 | DestroyReferenceRequest r = new DestroyReferenceRequest( |
389 | incomingLink.getSource().getElement(), |
390 | null, incomingLink.getTarget() |
391 | .getElement(), false); |
392 | cmd.add(new DestroyReferenceCommand(r)); |
393 | cmd.add(new DeleteCommand(getEditingDomain(), |
394 | incomingLink)); |
395 | continue; |
396 | } |
397 | } |
398 | for (Iterator it = cnode.getSourceEdges().iterator(); it |
399 | .hasNext();) { |
400 | Edge outgoingLink = (Edge) it.next(); |
401 | if (PalladioComponentModelVisualIDRegistry |
402 | .getVisualID(outgoingLink) == AbstractActionSuccessor_AbstractActionEditPart.VISUAL_ID) { |
403 | DestroyReferenceRequest r = new DestroyReferenceRequest( |
404 | outgoingLink.getSource().getElement(), |
405 | null, outgoingLink.getTarget() |
406 | .getElement(), false); |
407 | cmd.add(new DestroyReferenceCommand(r)); |
408 | cmd.add(new DeleteCommand(getEditingDomain(), |
409 | outgoingLink)); |
410 | continue; |
411 | } |
412 | } |
413 | cmd.add(new DestroyElementCommand( |
414 | new DestroyElementRequest(getEditingDomain(), |
415 | cnode.getElement(), false))); // directlyOwned: true |
416 | // don't need explicit deletion of cnode as parent's view deletion would clean child views as well |
417 | // cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), cnode)); |
418 | break; |
419 | case ReleaseAction2EditPart.VISUAL_ID: |
420 | for (Iterator it = cnode.getTargetEdges().iterator(); it |
421 | .hasNext();) { |
422 | Edge incomingLink = (Edge) it.next(); |
423 | if (PalladioComponentModelVisualIDRegistry |
424 | .getVisualID(incomingLink) == AbstractActionSuccessor_AbstractActionEditPart.VISUAL_ID) { |
425 | DestroyReferenceRequest r = new DestroyReferenceRequest( |
426 | incomingLink.getSource().getElement(), |
427 | null, incomingLink.getTarget() |
428 | .getElement(), false); |
429 | cmd.add(new DestroyReferenceCommand(r)); |
430 | cmd.add(new DeleteCommand(getEditingDomain(), |
431 | incomingLink)); |
432 | continue; |
433 | } |
434 | } |
435 | for (Iterator it = cnode.getSourceEdges().iterator(); it |
436 | .hasNext();) { |
437 | Edge outgoingLink = (Edge) it.next(); |
438 | if (PalladioComponentModelVisualIDRegistry |
439 | .getVisualID(outgoingLink) == AbstractActionSuccessor_AbstractActionEditPart.VISUAL_ID) { |
440 | DestroyReferenceRequest r = new DestroyReferenceRequest( |
441 | outgoingLink.getSource().getElement(), |
442 | null, outgoingLink.getTarget() |
443 | .getElement(), false); |
444 | cmd.add(new DestroyReferenceCommand(r)); |
445 | cmd.add(new DeleteCommand(getEditingDomain(), |
446 | outgoingLink)); |
447 | continue; |
448 | } |
449 | } |
450 | cmd.add(new DestroyElementCommand( |
451 | new DestroyElementRequest(getEditingDomain(), |
452 | cnode.getElement(), false))); // directlyOwned: true |
453 | // don't need explicit deletion of cnode as parent's view deletion would clean child views as well |
454 | // cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), cnode)); |
455 | break; |
456 | case ForkAction2EditPart.VISUAL_ID: |
457 | for (Iterator it = cnode.getTargetEdges().iterator(); it |
458 | .hasNext();) { |
459 | Edge incomingLink = (Edge) it.next(); |
460 | if (PalladioComponentModelVisualIDRegistry |
461 | .getVisualID(incomingLink) == AbstractActionSuccessor_AbstractActionEditPart.VISUAL_ID) { |
462 | DestroyReferenceRequest r = new DestroyReferenceRequest( |
463 | incomingLink.getSource().getElement(), |
464 | null, incomingLink.getTarget() |
465 | .getElement(), false); |
466 | cmd.add(new DestroyReferenceCommand(r)); |
467 | cmd.add(new DeleteCommand(getEditingDomain(), |
468 | incomingLink)); |
469 | continue; |
470 | } |
471 | } |
472 | for (Iterator it = cnode.getSourceEdges().iterator(); it |
473 | .hasNext();) { |
474 | Edge outgoingLink = (Edge) it.next(); |
475 | if (PalladioComponentModelVisualIDRegistry |
476 | .getVisualID(outgoingLink) == AbstractActionSuccessor_AbstractActionEditPart.VISUAL_ID) { |
477 | DestroyReferenceRequest r = new DestroyReferenceRequest( |
478 | outgoingLink.getSource().getElement(), |
479 | null, outgoingLink.getTarget() |
480 | .getElement(), false); |
481 | cmd.add(new DestroyReferenceCommand(r)); |
482 | cmd.add(new DeleteCommand(getEditingDomain(), |
483 | outgoingLink)); |
484 | continue; |
485 | } |
486 | } |
487 | cmd.add(new DestroyElementCommand( |
488 | new DestroyElementRequest(getEditingDomain(), |
489 | cnode.getElement(), false))); // directlyOwned: true |
490 | // don't need explicit deletion of cnode as parent's view deletion would clean child views as well |
491 | // cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), cnode)); |
492 | break; |
493 | case RecoveryAction2EditPart.VISUAL_ID: |
494 | for (Iterator it = cnode.getTargetEdges().iterator(); it |
495 | .hasNext();) { |
496 | Edge incomingLink = (Edge) it.next(); |
497 | if (PalladioComponentModelVisualIDRegistry |
498 | .getVisualID(incomingLink) == AbstractActionSuccessor_AbstractActionEditPart.VISUAL_ID) { |
499 | DestroyReferenceRequest r = new DestroyReferenceRequest( |
500 | incomingLink.getSource().getElement(), |
501 | null, incomingLink.getTarget() |
502 | .getElement(), false); |
503 | cmd.add(new DestroyReferenceCommand(r)); |
504 | cmd.add(new DeleteCommand(getEditingDomain(), |
505 | incomingLink)); |
506 | continue; |
507 | } |
508 | } |
509 | for (Iterator it = cnode.getSourceEdges().iterator(); it |
510 | .hasNext();) { |
511 | Edge outgoingLink = (Edge) it.next(); |
512 | if (PalladioComponentModelVisualIDRegistry |
513 | .getVisualID(outgoingLink) == AbstractActionSuccessor_AbstractActionEditPart.VISUAL_ID) { |
514 | DestroyReferenceRequest r = new DestroyReferenceRequest( |
515 | outgoingLink.getSource().getElement(), |
516 | null, outgoingLink.getTarget() |
517 | .getElement(), false); |
518 | cmd.add(new DestroyReferenceCommand(r)); |
519 | cmd.add(new DeleteCommand(getEditingDomain(), |
520 | outgoingLink)); |
521 | continue; |
522 | } |
523 | } |
524 | cmd.add(new DestroyElementCommand( |
525 | new DestroyElementRequest(getEditingDomain(), |
526 | cnode.getElement(), false))); // directlyOwned: true |
527 | // don't need explicit deletion of cnode as parent's view deletion would clean child views as well |
528 | // cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), cnode)); |
529 | break; |
530 | } |
531 | } |
532 | break; |
533 | } |
534 | } |
535 | } |
536 | |
537 | } |