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