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