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