/** @generated */
 private Collection refreshConnections() {
   Map domain2NotationMap = new HashMap();
   Collection linkDescriptors = collectAllLinks(getDiagram(), domain2NotationMap);
   Collection existingLinks = new LinkedList(getDiagram().getEdges());
   for (Iterator linksIterator = existingLinks.iterator(); linksIterator.hasNext(); ) {
     Edge nextDiagramLink = (Edge) linksIterator.next();
     int diagramLinkVisualID = AutomataVisualIDRegistry.getVisualID(nextDiagramLink);
     if (diagramLinkVisualID == -1) {
       if (nextDiagramLink.getSource() != null && nextDiagramLink.getTarget() != null) {
         linksIterator.remove();
       }
       continue;
     }
     EObject diagramLinkObject = nextDiagramLink.getElement();
     EObject diagramLinkSrc = nextDiagramLink.getSource().getElement();
     EObject diagramLinkDst = nextDiagramLink.getTarget().getElement();
     for (Iterator LinkDescriptorsIterator = linkDescriptors.iterator();
         LinkDescriptorsIterator.hasNext(); ) {
       AutomataLinkDescriptor nextLinkDescriptor =
           (AutomataLinkDescriptor) LinkDescriptorsIterator.next();
       if (diagramLinkObject == nextLinkDescriptor.getModelElement()
           && diagramLinkSrc == nextLinkDescriptor.getSource()
           && diagramLinkDst == nextLinkDescriptor.getDestination()
           && diagramLinkVisualID == nextLinkDescriptor.getVisualID()) {
         linksIterator.remove();
         LinkDescriptorsIterator.remove();
       }
     }
   }
   deleteViews(existingLinks.iterator());
   return createConnections(linkDescriptors, domain2NotationMap);
 }
 /** @generated */
 protected Command getDestroyElementCommand(DestroyElementRequest req) {
   View view = (View) getHost().getModel();
   CompositeTransactionalCommand cmd = new CompositeTransactionalCommand(getEditingDomain(), null);
   cmd.setTransactionNestingEnabled(false);
   for (Iterator<?> it = view.getTargetEdges().iterator(); it.hasNext(); ) {
     Edge incomingLink = (Edge) it.next();
     if (UMLVisualIDRegistry.getVisualID(incomingLink) == GeneralizationEditPart.VISUAL_ID) {
       DestroyElementRequest r = new DestroyElementRequest(incomingLink.getElement(), false);
       cmd.add(new DestroyElementCommand(r));
       cmd.add(new DeleteCommand(getEditingDomain(), incomingLink));
       continue;
     }
     if (UMLVisualIDRegistry.getVisualID(incomingLink)
         == ConstraintConstrainedElementEditPart.VISUAL_ID) {
       DestroyReferenceRequest r =
           new DestroyReferenceRequest(
               incomingLink.getSource().getElement(),
               null,
               incomingLink.getTarget().getElement(),
               false);
       cmd.add(new DestroyReferenceCommand(r));
       cmd.add(new DeleteCommand(getEditingDomain(), incomingLink));
       continue;
     }
     if (UMLVisualIDRegistry.getVisualID(incomingLink)
         == CommentAnnotatedElementEditPart.VISUAL_ID) {
       DestroyReferenceRequest r =
           new DestroyReferenceRequest(
               incomingLink.getSource().getElement(),
               null,
               incomingLink.getTarget().getElement(),
               false);
       cmd.add(new DestroyReferenceCommand(r));
       cmd.add(new DeleteCommand(getEditingDomain(), incomingLink));
       continue;
     }
   }
   for (Iterator<?> it = view.getSourceEdges().iterator(); it.hasNext(); ) {
     Edge outgoingLink = (Edge) it.next();
     if (UMLVisualIDRegistry.getVisualID(outgoingLink) == GeneralizationEditPart.VISUAL_ID) {
       DestroyElementRequest r = new DestroyElementRequest(outgoingLink.getElement(), false);
       cmd.add(new DestroyElementCommand(r));
       cmd.add(new DeleteCommand(getEditingDomain(), outgoingLink));
       continue;
     }
   }
   EAnnotation annotation = view.getEAnnotation("Shortcut"); // $NON-NLS-1$
   if (annotation == null) {
     // there are indirectly referenced children, need extra commands: false
     addDestroyChildNodesCommand(cmd);
     addDestroyShortcutsCommand(cmd, view);
     // delete host element
     cmd.add(new DestroyElementCommand(req));
   } else {
     cmd.add(new DeleteCommand(getEditingDomain(), view));
   }
   return getGEFWrapper(cmd.reduce());
 }
 /** @generated */
 private void addDestroyChildNodesCommand(ICompositeCommand cmd) {
   View view = (View) getHost().getModel();
   for (Iterator<?> nit = view.getChildren().iterator(); nit.hasNext(); ) {
     Node node = (Node) nit.next();
     switch (UMLVisualIDRegistry.getVisualID(node)) {
       case ParameterEditPart.VISUAL_ID:
         for (Iterator<?> it = node.getTargetEdges().iterator(); it.hasNext(); ) {
           Edge incomingLink = (Edge) it.next();
           if (UMLVisualIDRegistry.getVisualID(incomingLink)
               == CommentAnnotatedElementEditPart.VISUAL_ID) {
             DestroyReferenceRequest r =
                 new DestroyReferenceRequest(
                     incomingLink.getSource().getElement(),
                     null,
                     incomingLink.getTarget().getElement(),
                     false);
             cmd.add(new DestroyReferenceCommand(r));
             cmd.add(new DeleteCommand(getEditingDomain(), incomingLink));
             continue;
           }
         }
         cmd.add(
             new DestroyElementCommand(
                 new DestroyElementRequest(
                     getEditingDomain(), node.getElement(), false))); // directlyOwned: false
         // don't need explicit deletion of node as parent's view deletion would clean child views
         // as well
         // cmd.add(new
         // org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), node));
         break;
     }
   }
 }
 @SuppressWarnings("unchecked")
 protected void createEntryExitPoints(Diagram subdiagram) {
   TreeIterator<EObject> eAllContents = subdiagram.eAllContents();
   List<Edge> entryPointsToCreate = new ArrayList<Edge>();
   List<Edge> exitPointstoCreate = new ArrayList<Edge>();
   while (eAllContents.hasNext()) {
     EObject next = eAllContents.next();
     if (next instanceof View) {
       EList<Edge> targetEdges = ((View) next).getTargetEdges();
       for (Edge edge : targetEdges) {
         if (!EcoreUtil.isAncestor(subdiagram, edge.getSource())) entryPointsToCreate.add(edge);
       }
       EList<Edge> sourceEdges = ((View) next).getSourceEdges();
       for (Edge edge : sourceEdges) {
         if (!EcoreUtil.isAncestor(subdiagram, edge.getTarget())) exitPointstoCreate.add(edge);
       }
     }
   }
   for (Edge edge : entryPointsToCreate) {
     createEntryPoint(edge, subdiagram);
   }
   for (Edge edge : exitPointstoCreate) {
     createExitPoint(edge, subdiagram);
   }
 }
  protected void createEntryPoint(Edge edge, Diagram subdiagram) {
    Transition transition = (Transition) edge.getElement();
    Region entryPointContainer = getEntryPointContainer(transition);
    Entry entryPoint = createSemanticEntryPoint(transition);

    // re-wire old transition to targeting the selected state
    transition.setTarget((State) subdiagram.getElement());
    View oldTarget = edge.getTarget();
    edge.setTarget(getContextObject());

    // create node for entry point
    View entryPointContainerView =
        helper.getViewForSemanticElement(entryPointContainer, subdiagram);
    View entryPointRegionCompartment =
        ViewUtil.getChildBySemanticHint(entryPointContainerView, SemanticHints.REGION_COMPARTMENT);
    Node entryNode =
        ViewService.createNode(
            entryPointRegionCompartment, entryPoint, SemanticHints.ENTRY, preferencesHint);
    ViewService.createEdge(
        entryNode,
        oldTarget,
        entryPoint.getOutgoingTransitions().get(0),
        SemanticHints.TRANSITION,
        preferencesHint);

    addEntryPointSpec(transition, entryPoint);
  }
  protected void createExitPoint(Edge edge, Diagram subdiagram) {
    Transition transition = (Transition) edge.getElement();
    // create semantic exit point
    Region exitPointContainer = getExitPointContainer(transition);
    Exit exitPoint = createSemanticExitPoint(transition);

    // create node for exit point
    View exitPointContainerView = helper.getViewForSemanticElement(exitPointContainer, subdiagram);
    View exitPointRegionCompartment =
        ViewUtil.getChildBySemanticHint(exitPointContainerView, SemanticHints.REGION_COMPARTMENT);
    Node exitNode =
        ViewService.createNode(
            exitPointRegionCompartment, exitPoint, SemanticHints.EXIT, preferencesHint);

    // re-wire existing transition to new exit point
    Vertex oldTarget = transition.getTarget();
    transition.setTarget(exitPoint);
    ViewService.createEdge(
        edge.getSource(), exitNode, transition, SemanticHints.TRANSITION, preferencesHint);

    // create transition from selected state to former transition target
    Transition exitPointTransition = SGraphFactory.eINSTANCE.createTransition();
    exitPointTransition.setSource((State) subdiagram.getElement());
    exitPointTransition.setTarget(oldTarget);
    ViewService.createEdge(
        getContextObject(),
        edge.getTarget(),
        exitPointTransition,
        SemanticHints.TRANSITION,
        preferencesHint);

    addExitPointSpec(exitPointTransition, exitPoint);
  }
 /** @generated */
 private Collection<View> getLinksTargetByType(Collection<Edge> edges, String type) {
   LinkedList<View> result = new LinkedList<View>();
   for (Edge nextEdge : edges) {
     View nextEdgeTarget = nextEdge.getTarget();
     if (type.equals(nextEdgeTarget.getType()) && isOwnView(nextEdgeTarget)) {
       result.add(nextEdgeTarget);
     }
   }
   return result;
 }
 /** @generated */
 private Collection<IAdaptable> refreshConnections() {
   Domain2Notation domain2NotationMap = new Domain2Notation();
   Collection<
           edu.toronto.cs.se.modelepedia.relationaldatabase_mavo.diagram.part
               .RelationalDatabase_MAVOLinkDescriptor>
       linkDescriptors = collectAllLinks(getDiagram(), domain2NotationMap);
   Collection existingLinks = new LinkedList(getDiagram().getEdges());
   for (Iterator linksIterator = existingLinks.iterator(); linksIterator.hasNext(); ) {
     Edge nextDiagramLink = (Edge) linksIterator.next();
     int diagramLinkVisualID =
         edu.toronto.cs.se.modelepedia.relationaldatabase_mavo.diagram.part
             .RelationalDatabase_MAVOVisualIDRegistry.getVisualID(nextDiagramLink);
     if (diagramLinkVisualID == -1) {
       if (nextDiagramLink.getSource() != null && nextDiagramLink.getTarget() != null) {
         linksIterator.remove();
       }
       continue;
     }
     EObject diagramLinkObject = nextDiagramLink.getElement();
     EObject diagramLinkSrc = nextDiagramLink.getSource().getElement();
     EObject diagramLinkDst = nextDiagramLink.getTarget().getElement();
     for (Iterator<
                 edu.toronto.cs.se.modelepedia.relationaldatabase_mavo.diagram.part
                     .RelationalDatabase_MAVOLinkDescriptor>
             linkDescriptorsIterator = linkDescriptors.iterator();
         linkDescriptorsIterator.hasNext(); ) {
       edu.toronto.cs.se.modelepedia.relationaldatabase_mavo.diagram.part
               .RelationalDatabase_MAVOLinkDescriptor
           nextLinkDescriptor = linkDescriptorsIterator.next();
       if (diagramLinkObject == nextLinkDescriptor.getModelElement()
           && diagramLinkSrc == nextLinkDescriptor.getSource()
           && diagramLinkDst == nextLinkDescriptor.getDestination()
           && diagramLinkVisualID == nextLinkDescriptor.getVisualID()) {
         linksIterator.remove();
         linkDescriptorsIterator.remove();
         break;
       }
     }
   }
   deleteViews(existingLinks.iterator());
   return createConnections(linkDescriptors, domain2NotationMap);
 }
  /**
   * get the member end that will be managed by the branch of the association.
   *
   * @param associationBranchView the association branch view
   * @param association the association
   * @return the property concerned by the branch or null if the property is not found
   */
  public static Property getPropertyToListen(Edge associationBranchView, Association association) {
    Property semanticBranch = getSemanticBranchEnd(associationBranchView);
    if (semanticBranch != null) {
      return semanticBranch;
    }

    Classifier target = (Classifier) (associationBranchView.getTarget().getElement());
    // look for the property that is typed by the classifier
    Property propertyToDisplay = null;
    Iterator<Property> propertiesIterator = association.getMemberEnds().iterator();

    while (propertiesIterator.hasNext()) {
      Property currentProperty = propertiesIterator.next();
      if (currentProperty.getType().equals(target)) {
        propertyToDisplay = currentProperty;
      }
    }
    return propertyToDisplay;
  }
 /** @generated */
 protected List getNotationalChildLinks() {
   List result = new LinkedList();
   List allLinks = getDiagram().getEdges();
   for (Iterator it = allLinks.iterator(); it.hasNext(); ) {
     Edge next = (Edge) it.next();
     if (next.isSetElement()
         && next.getElement() != null
         && next.getElement().eResource() == null) {
       result.add(next);
       continue;
     }
     View source = next.getSource();
     if (source == null
         || (source.isSetElement()
             && source.getElement() != null
             && source.getElement().eResource() == null)) {
       result.add(next);
       continue;
     }
     View target = next.getTarget();
     if (target == null
         || (target.isSetElement()
             && target.getElement() != null
             && target.getElement().eResource() == null)) {
       result.add(next);
       continue;
     }
     if (next.isSetElement() && next.getElement() != null) {
       if (next.getElement().eContainer() == getDiagram().getElement()) {
         int linkVID = MindmapVisualIDRegistry.getVisualID(next);
         switch (linkVID) {
           case RelationshipEditPart.VISUAL_ID:
           case Relationship2EditPart.VISUAL_ID:
           case Relationship3EditPart.VISUAL_ID:
             result.add(next);
             break;
         }
       }
     }
   }
   return result;
 }
  /** @generated */
  protected Command getDestroyElementCommand(DestroyElementRequest req) {
    View view = (View) getHost().getModel();
    CompositeTransactionalCommand cmd = new CompositeTransactionalCommand(getEditingDomain(), null);
    cmd.setTransactionNestingEnabled(false);
    for (Iterator<?> it = view.getTargetEdges().iterator(); it.hasNext(); ) {
      Edge incomingLink = (Edge) it.next();
      if (UMLVisualIDRegistry.getVisualID(incomingLink) == ControlFlowEditPart.VISUAL_ID) {
        DestroyElementRequest r = new DestroyElementRequest(incomingLink.getElement(), false);
        cmd.add(new DestroyElementCommand(r));
        cmd.add(new DeleteCommand(getEditingDomain(), incomingLink));
        continue;
      }
      if (UMLVisualIDRegistry.getVisualID(incomingLink) == ObjectFlowEditPart.VISUAL_ID) {
        DestroyElementRequest r = new DestroyElementRequest(incomingLink.getElement(), false);
        cmd.add(new DestroyElementCommand(r));
        cmd.add(new DeleteCommand(getEditingDomain(), incomingLink));
        continue;
      }
      if (UMLVisualIDRegistry.getVisualID(incomingLink) == ExceptionHandlerEditPart.VISUAL_ID) {
        DestroyElementRequest r = new DestroyElementRequest(incomingLink.getElement(), false);
        cmd.add(new DestroyElementCommand(r));
        cmd.add(new DeleteCommand(getEditingDomain(), incomingLink));
        continue;
      }
      if (UMLVisualIDRegistry.getVisualID(incomingLink)
          == CommentAnnotatedElementEditPart.VISUAL_ID) {
        DestroyReferenceRequest r =
            new DestroyReferenceRequest(
                incomingLink.getSource().getElement(),
                null,
                incomingLink.getTarget().getElement(),
                false);
        cmd.add(new DestroyReferenceCommand(r));
        cmd.add(new DeleteCommand(getEditingDomain(), incomingLink));
        continue;
      }
    }
    for (Iterator<?> it = view.getSourceEdges().iterator(); it.hasNext(); ) {
      Edge outgoingLink = (Edge) it.next();
      if (UMLVisualIDRegistry.getVisualID(outgoingLink) == ControlFlowEditPart.VISUAL_ID) {
        DestroyElementRequest r = new DestroyElementRequest(outgoingLink.getElement(), false);
        cmd.add(new DestroyElementCommand(r));
        cmd.add(new DeleteCommand(getEditingDomain(), outgoingLink));
        continue;
      }
      if (UMLVisualIDRegistry.getVisualID(outgoingLink) == ObjectFlowEditPart.VISUAL_ID) {
        DestroyElementRequest r = new DestroyElementRequest(outgoingLink.getElement(), false);
        cmd.add(new DestroyElementCommand(r));
        cmd.add(new DeleteCommand(getEditingDomain(), outgoingLink));
        continue;
      }
      if (UMLVisualIDRegistry.getVisualID(outgoingLink)
          == ActionLocalPreconditionEditPart.VISUAL_ID) {
        DestroyReferenceRequest r =
            new DestroyReferenceRequest(
                outgoingLink.getSource().getElement(),
                null,
                outgoingLink.getTarget().getElement(),
                false);
        cmd.add(
            new DestroyReferenceCommand(r) {

              protected CommandResult doExecuteWithResult(
                  IProgressMonitor progressMonitor, IAdaptable info) throws ExecutionException {
                EObject referencedObject = getReferencedObject();
                Resource resource = referencedObject.eResource();
                CommandResult result = super.doExecuteWithResult(progressMonitor, info);
                if (resource != null) {
                  resource.getContents().add(referencedObject);
                }
                return result;
              }
            });
        cmd.add(new DeleteCommand(getEditingDomain(), outgoingLink));
        continue;
      }
      if (UMLVisualIDRegistry.getVisualID(outgoingLink)
          == ActionLocalPostconditionEditPart.VISUAL_ID) {
        DestroyReferenceRequest r =
            new DestroyReferenceRequest(
                outgoingLink.getSource().getElement(),
                null,
                outgoingLink.getTarget().getElement(),
                false);
        cmd.add(
            new DestroyReferenceCommand(r) {

              protected CommandResult doExecuteWithResult(
                  IProgressMonitor progressMonitor, IAdaptable info) throws ExecutionException {
                EObject referencedObject = getReferencedObject();
                Resource resource = referencedObject.eResource();
                CommandResult result = super.doExecuteWithResult(progressMonitor, info);
                if (resource != null) {
                  resource.getContents().add(referencedObject);
                }
                return result;
              }
            });
        cmd.add(new DeleteCommand(getEditingDomain(), outgoingLink));
        continue;
      }
      if (UMLVisualIDRegistry.getVisualID(outgoingLink) == ExceptionHandlerEditPart.VISUAL_ID) {
        DestroyElementRequest r = new DestroyElementRequest(outgoingLink.getElement(), false);
        cmd.add(new DestroyElementCommand(r));
        cmd.add(new DeleteCommand(getEditingDomain(), outgoingLink));
        continue;
      }
    }
    EAnnotation annotation = view.getEAnnotation("Shortcut"); // $NON-NLS-1$
    if (annotation == null) {
      // there are indirectly referenced children, need extra commands: false
      addDestroyChildNodesCommand(cmd);
      addDestroyShortcutsCommand(cmd, view);
      // delete host element
      cmd.add(new DestroyElementCommand(req));
    } else {
      cmd.add(new DeleteCommand(getEditingDomain(), view));
    }
    return getGEFWrapper(cmd.reduce());
  }
  @Override
  protected ICommand getAfterReorientRelationshipCommand(ReorientRelationshipRequest request) {
    ICommand defaultCommand = super.getAfterReorientRelationshipCommand(request);

    int reorientDirection = request.getDirection();
    Edge reorientedEdgeView = RequestParameterUtils.getReconnectedEdge(request);
    View newEndView = RequestParameterUtils.getReconnectedEndView(request);
    View oppositeEndView =
        (reorientDirection == ReorientRelationshipRequest.REORIENT_SOURCE)
            ? reorientedEdgeView.getTarget()
            : reorientedEdgeView.getSource();

    // Restrict this advice action to the end of Connector creation gesture (before clicking on
    // target)
    // in order to add SysML specific constraint
    Connector connector = (Connector) request.getRelationship();

    // Restrict action to SysML Connector (meaning owned by Block)
    if (((ISpecializationType) SysMLElementTypes.BLOCK)
        .getMatcher()
        .matches(connector.eContainer())) {

      // If the source or target view is enclosed in a structure encapsulated view, forbid creation.
      if (utils.isCrossingEncapsulation(newEndView, oppositeEndView)
          || utils.isCrossingEncapsulation(oppositeEndView, newEndView)) {
        return UnexecutableCommand.INSTANCE;
      }

      int tmpNestedPathDirection = -1;
      List<Property> tmpNestedPath = Collections.emptyList();

      // Check if new end view is nested
      tmpNestedPathDirection =
          (reorientDirection == ReorientRelationshipRequest.REORIENT_SOURCE)
              ? SetNestedPathCommand.NESTED_SOURCE
              : SetNestedPathCommand.NESTED_TARGET;
      tmpNestedPath = utils.getNestedPropertyPath(newEndView, oppositeEndView);
      defaultCommand =
          CompositeCommand.compose(
              defaultCommand,
              new SetNestedPathCommand(
                  "Set connector nested source path",
                  request.getRelationship(),
                  request,
                  tmpNestedPath,
                  tmpNestedPathDirection)); //$NON-NLS-0$

      // Check if opposite end view is nested
      tmpNestedPathDirection =
          (reorientDirection == ReorientRelationshipRequest.REORIENT_SOURCE)
              ? SetNestedPathCommand.NESTED_TARGET
              : SetNestedPathCommand.NESTED_SOURCE;
      tmpNestedPath = utils.getNestedPropertyPath(oppositeEndView, newEndView);
      defaultCommand =
          CompositeCommand.compose(
              defaultCommand,
              new SetNestedPathCommand(
                  "Set connector nested target path",
                  request.getRelationship(),
                  request,
                  tmpNestedPath,
                  tmpNestedPathDirection)); //$NON-NLS-0$
    }

    return defaultCommand;
  }
 /** @generated */
 private void addDestroyChildNodesCommand(ICompositeCommand cmd) {
   View view = (View) getHost().getModel();
   for (Iterator nit = view.getChildren().iterator(); nit.hasNext(); ) {
     Node node = (Node) nit.next();
     switch (BpeldiagVisualIDRegistry.getVisualID(node)) {
       case ForEachForEachCompartment9EditPart.VISUAL_ID:
         for (Iterator cit = node.getChildren().iterator(); cit.hasNext(); ) {
           Node cnode = (Node) cit.next();
           switch (BpeldiagVisualIDRegistry.getVisualID(cnode)) {
             case Assign4EditPart.VISUAL_ID:
               cmd.add(
                   new DestroyElementCommand(
                       new DestroyElementRequest(
                           getEditingDomain(), cnode.getElement(), false))); // directlyOwned: true
               // don't need explicit deletion of cnode as parent's view deletion would clean child
               // views as well
               // cmd.add(new
               // org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(),
               // cnode));
               break;
             case Compensate4EditPart.VISUAL_ID:
               cmd.add(
                   new DestroyElementCommand(
                       new DestroyElementRequest(
                           getEditingDomain(), cnode.getElement(), false))); // directlyOwned: true
               // don't need explicit deletion of cnode as parent's view deletion would clean child
               // views as well
               // cmd.add(new
               // org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(),
               // cnode));
               break;
             case CompensateScope4EditPart.VISUAL_ID:
               cmd.add(
                   new DestroyElementCommand(
                       new DestroyElementRequest(
                           getEditingDomain(), cnode.getElement(), false))); // directlyOwned: true
               // don't need explicit deletion of cnode as parent's view deletion would clean child
               // views as well
               // cmd.add(new
               // org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(),
               // cnode));
               break;
             case Empty4EditPart.VISUAL_ID:
               cmd.add(
                   new DestroyElementCommand(
                       new DestroyElementRequest(
                           getEditingDomain(), cnode.getElement(), false))); // directlyOwned: true
               // don't need explicit deletion of cnode as parent's view deletion would clean child
               // views as well
               // cmd.add(new
               // org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(),
               // cnode));
               break;
             case Exit4EditPart.VISUAL_ID:
               cmd.add(
                   new DestroyElementCommand(
                       new DestroyElementRequest(
                           getEditingDomain(), cnode.getElement(), false))); // directlyOwned: true
               // don't need explicit deletion of cnode as parent's view deletion would clean child
               // views as well
               // cmd.add(new
               // org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(),
               // cnode));
               break;
             case ExtensionActivity4EditPart.VISUAL_ID:
               cmd.add(
                   new DestroyElementCommand(
                       new DestroyElementRequest(
                           getEditingDomain(), cnode.getElement(), false))); // directlyOwned: true
               // don't need explicit deletion of cnode as parent's view deletion would clean child
               // views as well
               // cmd.add(new
               // org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(),
               // cnode));
               break;
             case ForEach3EditPart.VISUAL_ID:
               cmd.add(
                   new DestroyElementCommand(
                       new DestroyElementRequest(
                           getEditingDomain(), cnode.getElement(), false))); // directlyOwned: true
               // don't need explicit deletion of cnode as parent's view deletion would clean child
               // views as well
               // cmd.add(new
               // org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(),
               // cnode));
               break;
             case If2EditPart.VISUAL_ID:
               cmd.add(
                   new DestroyElementCommand(
                       new DestroyElementRequest(
                           getEditingDomain(), cnode.getElement(), false))); // directlyOwned: true
               // don't need explicit deletion of cnode as parent's view deletion would clean child
               // views as well
               // cmd.add(new
               // org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(),
               // cnode));
               break;
             case Invoke2EditPart.VISUAL_ID:
               for (Iterator it = cnode.getSourceEdges().iterator(); it.hasNext(); ) {
                 Edge outgoingLink = (Edge) it.next();
                 if (BpeldiagVisualIDRegistry.getVisualID(outgoingLink)
                     == PartnerActivityOperationEditPart.VISUAL_ID) {
                   DestroyReferenceRequest r =
                       new DestroyReferenceRequest(
                           outgoingLink.getSource().getElement(),
                           null,
                           outgoingLink.getTarget().getElement(),
                           false);
                   cmd.add(new DestroyReferenceCommand(r));
                   cmd.add(new DeleteCommand(getEditingDomain(), outgoingLink));
                   continue;
                 }
               }
               cmd.add(
                   new DestroyElementCommand(
                       new DestroyElementRequest(
                           getEditingDomain(), cnode.getElement(), false))); // directlyOwned: true
               // don't need explicit deletion of cnode as parent's view deletion would clean child
               // views as well
               // cmd.add(new
               // org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(),
               // cnode));
               break;
             case OpaqueActivity2EditPart.VISUAL_ID:
               cmd.add(
                   new DestroyElementCommand(
                       new DestroyElementRequest(
                           getEditingDomain(), cnode.getElement(), false))); // directlyOwned: true
               // don't need explicit deletion of cnode as parent's view deletion would clean child
               // views as well
               // cmd.add(new
               // org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(),
               // cnode));
               break;
             case PartnerActivity2EditPart.VISUAL_ID:
               for (Iterator it = cnode.getSourceEdges().iterator(); it.hasNext(); ) {
                 Edge outgoingLink = (Edge) it.next();
                 if (BpeldiagVisualIDRegistry.getVisualID(outgoingLink)
                     == PartnerActivityOperationEditPart.VISUAL_ID) {
                   DestroyReferenceRequest r =
                       new DestroyReferenceRequest(
                           outgoingLink.getSource().getElement(),
                           null,
                           outgoingLink.getTarget().getElement(),
                           false);
                   cmd.add(new DestroyReferenceCommand(r));
                   cmd.add(new DeleteCommand(getEditingDomain(), outgoingLink));
                   continue;
                 }
               }
               cmd.add(
                   new DestroyElementCommand(
                       new DestroyElementRequest(
                           getEditingDomain(), cnode.getElement(), false))); // directlyOwned: true
               // don't need explicit deletion of cnode as parent's view deletion would clean child
               // views as well
               // cmd.add(new
               // org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(),
               // cnode));
               break;
             case Pick2EditPart.VISUAL_ID:
               cmd.add(
                   new DestroyElementCommand(
                       new DestroyElementRequest(
                           getEditingDomain(), cnode.getElement(), false))); // directlyOwned: true
               // don't need explicit deletion of cnode as parent's view deletion would clean child
               // views as well
               // cmd.add(new
               // org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(),
               // cnode));
               break;
             case Receive3EditPart.VISUAL_ID:
               for (Iterator it = cnode.getSourceEdges().iterator(); it.hasNext(); ) {
                 Edge outgoingLink = (Edge) it.next();
                 if (BpeldiagVisualIDRegistry.getVisualID(outgoingLink)
                     == PartnerActivityOperationEditPart.VISUAL_ID) {
                   DestroyReferenceRequest r =
                       new DestroyReferenceRequest(
                           outgoingLink.getSource().getElement(),
                           null,
                           outgoingLink.getTarget().getElement(),
                           false);
                   cmd.add(new DestroyReferenceCommand(r));
                   cmd.add(new DeleteCommand(getEditingDomain(), outgoingLink));
                   continue;
                 }
               }
               cmd.add(
                   new DestroyElementCommand(
                       new DestroyElementRequest(
                           getEditingDomain(), cnode.getElement(), false))); // directlyOwned: true
               // don't need explicit deletion of cnode as parent's view deletion would clean child
               // views as well
               // cmd.add(new
               // org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(),
               // cnode));
               break;
             case RepeatUntil4EditPart.VISUAL_ID:
               cmd.add(
                   new DestroyElementCommand(
                       new DestroyElementRequest(
                           getEditingDomain(), cnode.getElement(), false))); // directlyOwned: true
               // don't need explicit deletion of cnode as parent's view deletion would clean child
               // views as well
               // cmd.add(new
               // org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(),
               // cnode));
               break;
             case Reply3EditPart.VISUAL_ID:
               for (Iterator it = cnode.getSourceEdges().iterator(); it.hasNext(); ) {
                 Edge outgoingLink = (Edge) it.next();
                 if (BpeldiagVisualIDRegistry.getVisualID(outgoingLink)
                     == PartnerActivityOperationEditPart.VISUAL_ID) {
                   DestroyReferenceRequest r =
                       new DestroyReferenceRequest(
                           outgoingLink.getSource().getElement(),
                           null,
                           outgoingLink.getTarget().getElement(),
                           false);
                   cmd.add(new DestroyReferenceCommand(r));
                   cmd.add(new DeleteCommand(getEditingDomain(), outgoingLink));
                   continue;
                 }
               }
               cmd.add(
                   new DestroyElementCommand(
                       new DestroyElementRequest(
                           getEditingDomain(), cnode.getElement(), false))); // directlyOwned: true
               // don't need explicit deletion of cnode as parent's view deletion would clean child
               // views as well
               // cmd.add(new
               // org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(),
               // cnode));
               break;
             case Rethrow3EditPart.VISUAL_ID:
               cmd.add(
                   new DestroyElementCommand(
                       new DestroyElementRequest(
                           getEditingDomain(), cnode.getElement(), false))); // directlyOwned: true
               // don't need explicit deletion of cnode as parent's view deletion would clean child
               // views as well
               // cmd.add(new
               // org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(),
               // cnode));
               break;
             case Scope4EditPart.VISUAL_ID:
               cmd.add(
                   new DestroyElementCommand(
                       new DestroyElementRequest(
                           getEditingDomain(), cnode.getElement(), false))); // directlyOwned: true
               // don't need explicit deletion of cnode as parent's view deletion would clean child
               // views as well
               // cmd.add(new
               // org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(),
               // cnode));
               break;
             case Throw3EditPart.VISUAL_ID:
               cmd.add(
                   new DestroyElementCommand(
                       new DestroyElementRequest(
                           getEditingDomain(), cnode.getElement(), false))); // directlyOwned: true
               // don't need explicit deletion of cnode as parent's view deletion would clean child
               // views as well
               // cmd.add(new
               // org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(),
               // cnode));
               break;
             case Validate3EditPart.VISUAL_ID:
               cmd.add(
                   new DestroyElementCommand(
                       new DestroyElementRequest(
                           getEditingDomain(), cnode.getElement(), false))); // directlyOwned: true
               // don't need explicit deletion of cnode as parent's view deletion would clean child
               // views as well
               // cmd.add(new
               // org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(),
               // cnode));
               break;
             case Wait3EditPart.VISUAL_ID:
               cmd.add(
                   new DestroyElementCommand(
                       new DestroyElementRequest(
                           getEditingDomain(), cnode.getElement(), false))); // directlyOwned: true
               // don't need explicit deletion of cnode as parent's view deletion would clean child
               // views as well
               // cmd.add(new
               // org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(),
               // cnode));
               break;
             case While3EditPart.VISUAL_ID:
               cmd.add(
                   new DestroyElementCommand(
                       new DestroyElementRequest(
                           getEditingDomain(), cnode.getElement(), false))); // directlyOwned: true
               // don't need explicit deletion of cnode as parent's view deletion would clean child
               // views as well
               // cmd.add(new
               // org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(),
               // cnode));
               break;
           }
         }
         break;
     }
   }
 }
 /** @generated */
 public ReconnectTransition4001TargetCommand(Edge edge, View newTarget) {
   this.edge = edge;
   this.newTarget = newTarget;
   this.oldTarget = edge.getTarget();
 }
Beispiel #15
0
 /** @generated */
 protected void addDestroyChildNodesCommand(ICompositeCommand cmd) {
   View view = (View) getHost().getModel();
   for (Iterator<?> nit = view.getChildren().iterator(); nit.hasNext(); ) {
     Node node = (Node) nit.next();
     switch (UMLVisualIDRegistry.getVisualID(node)) {
       case InteractionCompartmentEditPart.VISUAL_ID:
         for (Iterator<?> cit = node.getChildren().iterator(); cit.hasNext(); ) {
           Node cnode = (Node) cit.next();
           switch (UMLVisualIDRegistry.getVisualID(cnode)) {
             case LifelineEditPartCN.VISUAL_ID:
               for (Iterator<?> it = cnode.getTargetEdges().iterator(); it.hasNext(); ) {
                 Edge incomingLink = (Edge) it.next();
                 switch (UMLVisualIDRegistry.getVisualID(incomingLink)) {
                   case CommentAnnotatedElementEditPart.VISUAL_ID:
                   case ConstraintConstrainedElementEditPart.VISUAL_ID:
                   case ConnectorDurationObservationEditPart.VISUAL_ID:
                   case ConnectorTimeObservationEditPart.VISUAL_ID:
                     DestroyReferenceRequest destroyRefReq =
                         new DestroyReferenceRequest(
                             incomingLink.getSource().getElement(),
                             null,
                             incomingLink.getTarget().getElement(),
                             false);
                     cmd.add(new DestroyReferenceCommand(destroyRefReq));
                     cmd.add(
                         new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(
                             getEditingDomain(), incomingLink));
                     break;
                   case MessageEditPart.VISUAL_ID:
                     DestroyElementRequest destroyEltReq =
                         new DestroyElementRequest(incomingLink.getElement(), false);
                     cmd.add(new DestroyElementCommand(destroyEltReq));
                     cmd.add(
                         new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(
                             getEditingDomain(), incomingLink));
                     break;
                 }
               }
               cmd.add(
                   new DestroyElementCommand(
                       new DestroyElementRequest(
                           getEditingDomain(), cnode.getElement(), false))); // directlyOwned: true
               // don't need explicit deletion of cnode as parent's view deletion would clean child
               // views as well
               // cmd.add(new
               // org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(),
               // cnode));
               break;
             case CommentEditPartCN.VISUAL_ID:
               for (Iterator<?> it = cnode.getTargetEdges().iterator(); it.hasNext(); ) {
                 Edge incomingLink = (Edge) it.next();
                 switch (UMLVisualIDRegistry.getVisualID(incomingLink)) {
                   case CommentAnnotatedElementEditPart.VISUAL_ID:
                   case ConstraintConstrainedElementEditPart.VISUAL_ID:
                     DestroyReferenceRequest destroyRefReq =
                         new DestroyReferenceRequest(
                             incomingLink.getSource().getElement(),
                             null,
                             incomingLink.getTarget().getElement(),
                             false);
                     cmd.add(new DestroyReferenceCommand(destroyRefReq));
                     cmd.add(
                         new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(
                             getEditingDomain(), incomingLink));
                     break;
                   case MessageEditPart.VISUAL_ID:
                     DestroyElementRequest destroyEltReq =
                         new DestroyElementRequest(incomingLink.getElement(), false);
                     cmd.add(new DestroyElementCommand(destroyEltReq));
                     cmd.add(
                         new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(
                             getEditingDomain(), incomingLink));
                     break;
                 }
               }
               cmd.add(
                   new DestroyElementCommand(
                       new DestroyElementRequest(
                           getEditingDomain(), cnode.getElement(), false))); // directlyOwned: true
               // don't need explicit deletion of cnode as parent's view deletion would clean child
               // views as well
               // cmd.add(new
               // org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(),
               // cnode));
               break;
             case ConstraintEditPartCN.VISUAL_ID:
               for (Iterator<?> it = cnode.getTargetEdges().iterator(); it.hasNext(); ) {
                 Edge incomingLink = (Edge) it.next();
                 switch (UMLVisualIDRegistry.getVisualID(incomingLink)) {
                   case CommentAnnotatedElementEditPart.VISUAL_ID:
                   case ConstraintConstrainedElementEditPart.VISUAL_ID:
                   case ConnectorDurationObservationEditPart.VISUAL_ID:
                   case ConnectorTimeObservationEditPart.VISUAL_ID:
                     DestroyReferenceRequest destroyRefReq =
                         new DestroyReferenceRequest(
                             incomingLink.getSource().getElement(),
                             null,
                             incomingLink.getTarget().getElement(),
                             false);
                     cmd.add(new DestroyReferenceCommand(destroyRefReq));
                     cmd.add(
                         new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(
                             getEditingDomain(), incomingLink));
                     break;
                   case MessageEditPart.VISUAL_ID:
                     DestroyElementRequest destroyEltReq =
                         new DestroyElementRequest(incomingLink.getElement(), false);
                     cmd.add(new DestroyElementCommand(destroyEltReq));
                     cmd.add(
                         new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(
                             getEditingDomain(), incomingLink));
                     break;
                 }
               }
               cmd.add(
                   new DestroyElementCommand(
                       new DestroyElementRequest(
                           getEditingDomain(), cnode.getElement(), false))); // directlyOwned: true
               // don't need explicit deletion of cnode as parent's view deletion would clean child
               // views as well
               // cmd.add(new
               // org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(),
               // cnode));
               break;
             case TimeObservationEditPartCN.VISUAL_ID:
               for (Iterator<?> it = cnode.getTargetEdges().iterator(); it.hasNext(); ) {
                 Edge incomingLink = (Edge) it.next();
                 switch (UMLVisualIDRegistry.getVisualID(incomingLink)) {
                   case CommentAnnotatedElementEditPart.VISUAL_ID:
                   case ConstraintConstrainedElementEditPart.VISUAL_ID:
                   case ConnectorDurationObservationEditPart.VISUAL_ID:
                   case ConnectorTimeObservationEditPart.VISUAL_ID:
                     DestroyReferenceRequest destroyRefReq =
                         new DestroyReferenceRequest(
                             incomingLink.getSource().getElement(),
                             null,
                             incomingLink.getTarget().getElement(),
                             false);
                     cmd.add(new DestroyReferenceCommand(destroyRefReq));
                     cmd.add(
                         new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(
                             getEditingDomain(), incomingLink));
                     break;
                   case MessageEditPart.VISUAL_ID:
                     DestroyElementRequest destroyEltReq =
                         new DestroyElementRequest(incomingLink.getElement(), false);
                     cmd.add(new DestroyElementCommand(destroyEltReq));
                     cmd.add(
                         new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(
                             getEditingDomain(), incomingLink));
                     break;
                 }
               }
               cmd.add(
                   new DestroyElementCommand(
                       new DestroyElementRequest(
                           getEditingDomain(),
                           cnode.getElement(),
                           false))); // directlyOwned: false
               // don't need explicit deletion of cnode as parent's view deletion would clean child
               // views as well
               // cmd.add(new
               // org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(),
               // cnode));
               break;
             case DurationObservationEditPartCN.VISUAL_ID:
               for (Iterator<?> it = cnode.getTargetEdges().iterator(); it.hasNext(); ) {
                 Edge incomingLink = (Edge) it.next();
                 switch (UMLVisualIDRegistry.getVisualID(incomingLink)) {
                   case CommentAnnotatedElementEditPart.VISUAL_ID:
                   case ConstraintConstrainedElementEditPart.VISUAL_ID:
                   case ConnectorDurationObservationEditPart.VISUAL_ID:
                   case ConnectorTimeObservationEditPart.VISUAL_ID:
                     DestroyReferenceRequest destroyRefReq =
                         new DestroyReferenceRequest(
                             incomingLink.getSource().getElement(),
                             null,
                             incomingLink.getTarget().getElement(),
                             false);
                     cmd.add(new DestroyReferenceCommand(destroyRefReq));
                     cmd.add(
                         new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(
                             getEditingDomain(), incomingLink));
                     break;
                   case MessageEditPart.VISUAL_ID:
                     DestroyElementRequest destroyEltReq =
                         new DestroyElementRequest(incomingLink.getElement(), false);
                     cmd.add(new DestroyElementCommand(destroyEltReq));
                     cmd.add(
                         new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(
                             getEditingDomain(), incomingLink));
                     break;
                 }
               }
               cmd.add(
                   new DestroyElementCommand(
                       new DestroyElementRequest(
                           getEditingDomain(),
                           cnode.getElement(),
                           false))); // directlyOwned: false
               // don't need explicit deletion of cnode as parent's view deletion would clean child
               // views as well
               // cmd.add(new
               // org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(),
               // cnode));
               break;
           }
         }
         break;
     }
   }
 }
 /** @generated */
 private void addDestroyChildNodesCommand(ICompositeCommand cmd) {
   View view = (View) getHost().getModel();
   for (Iterator<?> nit = view.getChildren().iterator(); nit.hasNext(); ) {
     Node node = (Node) nit.next();
     switch (UMLVisualIDRegistry.getVisualID(node)) {
       case StateMachine_RegionSubverticesEditPart.VISUAL_ID:
         for (Iterator<?> cit = node.getChildren().iterator(); cit.hasNext(); ) {
           Node cnode = (Node) cit.next();
           switch (UMLVisualIDRegistry.getVisualID(cnode)) {
             case SimpleStateEditPart.VISUAL_ID:
               for (Iterator<?> it = cnode.getTargetEdges().iterator(); it.hasNext(); ) {
                 Edge incomingLink = (Edge) it.next();
                 if (UMLVisualIDRegistry.getVisualID(incomingLink)
                     == TransitionEditPart.VISUAL_ID) {
                   DestroyElementRequest r =
                       new DestroyElementRequest(incomingLink.getElement(), false);
                   cmd.add(new DestroyElementCommand(r));
                   cmd.add(new DeleteCommand(getEditingDomain(), incomingLink));
                   continue;
                 }
                 if (UMLVisualIDRegistry.getVisualID(incomingLink)
                     == CommentAnnotatedElementEditPart.VISUAL_ID) {
                   DestroyReferenceRequest r =
                       new DestroyReferenceRequest(
                           incomingLink.getSource().getElement(),
                           null,
                           incomingLink.getTarget().getElement(),
                           false);
                   cmd.add(new DestroyReferenceCommand(r));
                   cmd.add(new DeleteCommand(getEditingDomain(), incomingLink));
                   continue;
                 }
               }
               for (Iterator<?> it = cnode.getSourceEdges().iterator(); it.hasNext(); ) {
                 Edge outgoingLink = (Edge) it.next();
                 if (UMLVisualIDRegistry.getVisualID(outgoingLink)
                     == TransitionEditPart.VISUAL_ID) {
                   DestroyElementRequest r =
                       new DestroyElementRequest(outgoingLink.getElement(), false);
                   cmd.add(new DestroyElementCommand(r));
                   cmd.add(new DeleteCommand(getEditingDomain(), outgoingLink));
                   continue;
                 }
               }
               cmd.add(
                   new DestroyElementCommand(
                       new DestroyElementRequest(
                           getEditingDomain(), cnode.getElement(), false))); // directlyOwned: true
               // don't need explicit deletion of cnode as parent's view deletion would clean child
               // views as well
               // cmd.add(new
               // org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(),
               // cnode));
               break;
             case CompositeStateEditPart.VISUAL_ID:
               for (Iterator<?> it = cnode.getTargetEdges().iterator(); it.hasNext(); ) {
                 Edge incomingLink = (Edge) it.next();
                 if (UMLVisualIDRegistry.getVisualID(incomingLink)
                     == TransitionEditPart.VISUAL_ID) {
                   DestroyElementRequest r =
                       new DestroyElementRequest(incomingLink.getElement(), false);
                   cmd.add(new DestroyElementCommand(r));
                   cmd.add(new DeleteCommand(getEditingDomain(), incomingLink));
                   continue;
                 }
                 if (UMLVisualIDRegistry.getVisualID(incomingLink)
                     == CommentAnnotatedElementEditPart.VISUAL_ID) {
                   DestroyReferenceRequest r =
                       new DestroyReferenceRequest(
                           incomingLink.getSource().getElement(),
                           null,
                           incomingLink.getTarget().getElement(),
                           false);
                   cmd.add(new DestroyReferenceCommand(r));
                   cmd.add(new DeleteCommand(getEditingDomain(), incomingLink));
                   continue;
                 }
               }
               for (Iterator<?> it = cnode.getSourceEdges().iterator(); it.hasNext(); ) {
                 Edge outgoingLink = (Edge) it.next();
                 if (UMLVisualIDRegistry.getVisualID(outgoingLink)
                     == TransitionEditPart.VISUAL_ID) {
                   DestroyElementRequest r =
                       new DestroyElementRequest(outgoingLink.getElement(), false);
                   cmd.add(new DestroyElementCommand(r));
                   cmd.add(new DeleteCommand(getEditingDomain(), outgoingLink));
                   continue;
                 }
               }
               cmd.add(
                   new DestroyElementCommand(
                       new DestroyElementRequest(
                           getEditingDomain(), cnode.getElement(), false))); // directlyOwned: true
               // don't need explicit deletion of cnode as parent's view deletion would clean child
               // views as well
               // cmd.add(new
               // org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(),
               // cnode));
               break;
             case SubmachineStateEditPart.VISUAL_ID:
               for (Iterator<?> it = cnode.getTargetEdges().iterator(); it.hasNext(); ) {
                 Edge incomingLink = (Edge) it.next();
                 if (UMLVisualIDRegistry.getVisualID(incomingLink)
                     == TransitionEditPart.VISUAL_ID) {
                   DestroyElementRequest r =
                       new DestroyElementRequest(incomingLink.getElement(), false);
                   cmd.add(new DestroyElementCommand(r));
                   cmd.add(new DeleteCommand(getEditingDomain(), incomingLink));
                   continue;
                 }
                 if (UMLVisualIDRegistry.getVisualID(incomingLink)
                     == CommentAnnotatedElementEditPart.VISUAL_ID) {
                   DestroyReferenceRequest r =
                       new DestroyReferenceRequest(
                           incomingLink.getSource().getElement(),
                           null,
                           incomingLink.getTarget().getElement(),
                           false);
                   cmd.add(new DestroyReferenceCommand(r));
                   cmd.add(new DeleteCommand(getEditingDomain(), incomingLink));
                   continue;
                 }
               }
               for (Iterator<?> it = cnode.getSourceEdges().iterator(); it.hasNext(); ) {
                 Edge outgoingLink = (Edge) it.next();
                 if (UMLVisualIDRegistry.getVisualID(outgoingLink)
                     == TransitionEditPart.VISUAL_ID) {
                   DestroyElementRequest r =
                       new DestroyElementRequest(outgoingLink.getElement(), false);
                   cmd.add(new DestroyElementCommand(r));
                   cmd.add(new DeleteCommand(getEditingDomain(), outgoingLink));
                   continue;
                 }
               }
               cmd.add(
                   new DestroyElementCommand(
                       new DestroyElementRequest(
                           getEditingDomain(), cnode.getElement(), false))); // directlyOwned: true
               // don't need explicit deletion of cnode as parent's view deletion would clean child
               // views as well
               // cmd.add(new
               // org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(),
               // cnode));
               break;
             case FinalStateEditPart.VISUAL_ID:
               for (Iterator<?> it = cnode.getTargetEdges().iterator(); it.hasNext(); ) {
                 Edge incomingLink = (Edge) it.next();
                 if (UMLVisualIDRegistry.getVisualID(incomingLink)
                     == TransitionEditPart.VISUAL_ID) {
                   DestroyElementRequest r =
                       new DestroyElementRequest(incomingLink.getElement(), false);
                   cmd.add(new DestroyElementCommand(r));
                   cmd.add(new DeleteCommand(getEditingDomain(), incomingLink));
                   continue;
                 }
                 if (UMLVisualIDRegistry.getVisualID(incomingLink)
                     == CommentAnnotatedElementEditPart.VISUAL_ID) {
                   DestroyReferenceRequest r =
                       new DestroyReferenceRequest(
                           incomingLink.getSource().getElement(),
                           null,
                           incomingLink.getTarget().getElement(),
                           false);
                   cmd.add(new DestroyReferenceCommand(r));
                   cmd.add(new DeleteCommand(getEditingDomain(), incomingLink));
                   continue;
                 }
               }
               for (Iterator<?> it = cnode.getSourceEdges().iterator(); it.hasNext(); ) {
                 Edge outgoingLink = (Edge) it.next();
                 if (UMLVisualIDRegistry.getVisualID(outgoingLink)
                     == TransitionEditPart.VISUAL_ID) {
                   DestroyElementRequest r =
                       new DestroyElementRequest(outgoingLink.getElement(), false);
                   cmd.add(new DestroyElementCommand(r));
                   cmd.add(new DeleteCommand(getEditingDomain(), outgoingLink));
                   continue;
                 }
               }
               cmd.add(
                   new DestroyElementCommand(
                       new DestroyElementRequest(
                           getEditingDomain(), cnode.getElement(), false))); // directlyOwned: true
               // don't need explicit deletion of cnode as parent's view deletion would clean child
               // views as well
               // cmd.add(new
               // org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(),
               // cnode));
               break;
             case InitialPseudostateEditPart.VISUAL_ID:
               for (Iterator<?> it = cnode.getTargetEdges().iterator(); it.hasNext(); ) {
                 Edge incomingLink = (Edge) it.next();
                 if (UMLVisualIDRegistry.getVisualID(incomingLink)
                     == TransitionEditPart.VISUAL_ID) {
                   DestroyElementRequest r =
                       new DestroyElementRequest(incomingLink.getElement(), false);
                   cmd.add(new DestroyElementCommand(r));
                   cmd.add(new DeleteCommand(getEditingDomain(), incomingLink));
                   continue;
                 }
                 if (UMLVisualIDRegistry.getVisualID(incomingLink)
                     == CommentAnnotatedElementEditPart.VISUAL_ID) {
                   DestroyReferenceRequest r =
                       new DestroyReferenceRequest(
                           incomingLink.getSource().getElement(),
                           null,
                           incomingLink.getTarget().getElement(),
                           false);
                   cmd.add(new DestroyReferenceCommand(r));
                   cmd.add(new DeleteCommand(getEditingDomain(), incomingLink));
                   continue;
                 }
               }
               for (Iterator<?> it = cnode.getSourceEdges().iterator(); it.hasNext(); ) {
                 Edge outgoingLink = (Edge) it.next();
                 if (UMLVisualIDRegistry.getVisualID(outgoingLink)
                     == TransitionEditPart.VISUAL_ID) {
                   DestroyElementRequest r =
                       new DestroyElementRequest(outgoingLink.getElement(), false);
                   cmd.add(new DestroyElementCommand(r));
                   cmd.add(new DeleteCommand(getEditingDomain(), outgoingLink));
                   continue;
                 }
               }
               cmd.add(
                   new DestroyElementCommand(
                       new DestroyElementRequest(
                           getEditingDomain(), cnode.getElement(), false))); // directlyOwned: true
               // don't need explicit deletion of cnode as parent's view deletion would clean child
               // views as well
               // cmd.add(new
               // org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(),
               // cnode));
               break;
             case ShallowHistoryPseudostateEditPart.VISUAL_ID:
               for (Iterator<?> it = cnode.getTargetEdges().iterator(); it.hasNext(); ) {
                 Edge incomingLink = (Edge) it.next();
                 if (UMLVisualIDRegistry.getVisualID(incomingLink)
                     == TransitionEditPart.VISUAL_ID) {
                   DestroyElementRequest r =
                       new DestroyElementRequest(incomingLink.getElement(), false);
                   cmd.add(new DestroyElementCommand(r));
                   cmd.add(new DeleteCommand(getEditingDomain(), incomingLink));
                   continue;
                 }
                 if (UMLVisualIDRegistry.getVisualID(incomingLink)
                     == CommentAnnotatedElementEditPart.VISUAL_ID) {
                   DestroyReferenceRequest r =
                       new DestroyReferenceRequest(
                           incomingLink.getSource().getElement(),
                           null,
                           incomingLink.getTarget().getElement(),
                           false);
                   cmd.add(new DestroyReferenceCommand(r));
                   cmd.add(new DeleteCommand(getEditingDomain(), incomingLink));
                   continue;
                 }
               }
               for (Iterator<?> it = cnode.getSourceEdges().iterator(); it.hasNext(); ) {
                 Edge outgoingLink = (Edge) it.next();
                 if (UMLVisualIDRegistry.getVisualID(outgoingLink)
                     == TransitionEditPart.VISUAL_ID) {
                   DestroyElementRequest r =
                       new DestroyElementRequest(outgoingLink.getElement(), false);
                   cmd.add(new DestroyElementCommand(r));
                   cmd.add(new DeleteCommand(getEditingDomain(), outgoingLink));
                   continue;
                 }
               }
               cmd.add(
                   new DestroyElementCommand(
                       new DestroyElementRequest(
                           getEditingDomain(), cnode.getElement(), false))); // directlyOwned: true
               // don't need explicit deletion of cnode as parent's view deletion would clean child
               // views as well
               // cmd.add(new
               // org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(),
               // cnode));
               break;
             case DeepHistoryPseudostateEditPart.VISUAL_ID:
               for (Iterator<?> it = cnode.getTargetEdges().iterator(); it.hasNext(); ) {
                 Edge incomingLink = (Edge) it.next();
                 if (UMLVisualIDRegistry.getVisualID(incomingLink)
                     == TransitionEditPart.VISUAL_ID) {
                   DestroyElementRequest r =
                       new DestroyElementRequest(incomingLink.getElement(), false);
                   cmd.add(new DestroyElementCommand(r));
                   cmd.add(new DeleteCommand(getEditingDomain(), incomingLink));
                   continue;
                 }
                 if (UMLVisualIDRegistry.getVisualID(incomingLink)
                     == CommentAnnotatedElementEditPart.VISUAL_ID) {
                   DestroyReferenceRequest r =
                       new DestroyReferenceRequest(
                           incomingLink.getSource().getElement(),
                           null,
                           incomingLink.getTarget().getElement(),
                           false);
                   cmd.add(new DestroyReferenceCommand(r));
                   cmd.add(new DeleteCommand(getEditingDomain(), incomingLink));
                   continue;
                 }
               }
               for (Iterator<?> it = cnode.getSourceEdges().iterator(); it.hasNext(); ) {
                 Edge outgoingLink = (Edge) it.next();
                 if (UMLVisualIDRegistry.getVisualID(outgoingLink)
                     == TransitionEditPart.VISUAL_ID) {
                   DestroyElementRequest r =
                       new DestroyElementRequest(outgoingLink.getElement(), false);
                   cmd.add(new DestroyElementCommand(r));
                   cmd.add(new DeleteCommand(getEditingDomain(), outgoingLink));
                   continue;
                 }
               }
               cmd.add(
                   new DestroyElementCommand(
                       new DestroyElementRequest(
                           getEditingDomain(), cnode.getElement(), false))); // directlyOwned: true
               // don't need explicit deletion of cnode as parent's view deletion would clean child
               // views as well
               // cmd.add(new
               // org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(),
               // cnode));
               break;
             case ForkPseudostateEditPart.VISUAL_ID:
               for (Iterator<?> it = cnode.getTargetEdges().iterator(); it.hasNext(); ) {
                 Edge incomingLink = (Edge) it.next();
                 if (UMLVisualIDRegistry.getVisualID(incomingLink)
                     == TransitionEditPart.VISUAL_ID) {
                   DestroyElementRequest r =
                       new DestroyElementRequest(incomingLink.getElement(), false);
                   cmd.add(new DestroyElementCommand(r));
                   cmd.add(new DeleteCommand(getEditingDomain(), incomingLink));
                   continue;
                 }
                 if (UMLVisualIDRegistry.getVisualID(incomingLink)
                     == CommentAnnotatedElementEditPart.VISUAL_ID) {
                   DestroyReferenceRequest r =
                       new DestroyReferenceRequest(
                           incomingLink.getSource().getElement(),
                           null,
                           incomingLink.getTarget().getElement(),
                           false);
                   cmd.add(new DestroyReferenceCommand(r));
                   cmd.add(new DeleteCommand(getEditingDomain(), incomingLink));
                   continue;
                 }
               }
               for (Iterator<?> it = cnode.getSourceEdges().iterator(); it.hasNext(); ) {
                 Edge outgoingLink = (Edge) it.next();
                 if (UMLVisualIDRegistry.getVisualID(outgoingLink)
                     == TransitionEditPart.VISUAL_ID) {
                   DestroyElementRequest r =
                       new DestroyElementRequest(outgoingLink.getElement(), false);
                   cmd.add(new DestroyElementCommand(r));
                   cmd.add(new DeleteCommand(getEditingDomain(), outgoingLink));
                   continue;
                 }
               }
               cmd.add(
                   new DestroyElementCommand(
                       new DestroyElementRequest(
                           getEditingDomain(), cnode.getElement(), false))); // directlyOwned: true
               // don't need explicit deletion of cnode as parent's view deletion would clean child
               // views as well
               // cmd.add(new
               // org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(),
               // cnode));
               break;
             case JoinPseudostateEditPart.VISUAL_ID:
               for (Iterator<?> it = cnode.getTargetEdges().iterator(); it.hasNext(); ) {
                 Edge incomingLink = (Edge) it.next();
                 if (UMLVisualIDRegistry.getVisualID(incomingLink)
                     == TransitionEditPart.VISUAL_ID) {
                   DestroyElementRequest r =
                       new DestroyElementRequest(incomingLink.getElement(), false);
                   cmd.add(new DestroyElementCommand(r));
                   cmd.add(new DeleteCommand(getEditingDomain(), incomingLink));
                   continue;
                 }
                 if (UMLVisualIDRegistry.getVisualID(incomingLink)
                     == CommentAnnotatedElementEditPart.VISUAL_ID) {
                   DestroyReferenceRequest r =
                       new DestroyReferenceRequest(
                           incomingLink.getSource().getElement(),
                           null,
                           incomingLink.getTarget().getElement(),
                           false);
                   cmd.add(new DestroyReferenceCommand(r));
                   cmd.add(new DeleteCommand(getEditingDomain(), incomingLink));
                   continue;
                 }
               }
               for (Iterator<?> it = cnode.getSourceEdges().iterator(); it.hasNext(); ) {
                 Edge outgoingLink = (Edge) it.next();
                 if (UMLVisualIDRegistry.getVisualID(outgoingLink)
                     == TransitionEditPart.VISUAL_ID) {
                   DestroyElementRequest r =
                       new DestroyElementRequest(outgoingLink.getElement(), false);
                   cmd.add(new DestroyElementCommand(r));
                   cmd.add(new DeleteCommand(getEditingDomain(), outgoingLink));
                   continue;
                 }
               }
               cmd.add(
                   new DestroyElementCommand(
                       new DestroyElementRequest(
                           getEditingDomain(), cnode.getElement(), false))); // directlyOwned: true
               // don't need explicit deletion of cnode as parent's view deletion would clean child
               // views as well
               // cmd.add(new
               // org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(),
               // cnode));
               break;
             case JunctionPseudostateEditPart.VISUAL_ID:
               for (Iterator<?> it = cnode.getTargetEdges().iterator(); it.hasNext(); ) {
                 Edge incomingLink = (Edge) it.next();
                 if (UMLVisualIDRegistry.getVisualID(incomingLink)
                     == TransitionEditPart.VISUAL_ID) {
                   DestroyElementRequest r =
                       new DestroyElementRequest(incomingLink.getElement(), false);
                   cmd.add(new DestroyElementCommand(r));
                   cmd.add(new DeleteCommand(getEditingDomain(), incomingLink));
                   continue;
                 }
                 if (UMLVisualIDRegistry.getVisualID(incomingLink)
                     == CommentAnnotatedElementEditPart.VISUAL_ID) {
                   DestroyReferenceRequest r =
                       new DestroyReferenceRequest(
                           incomingLink.getSource().getElement(),
                           null,
                           incomingLink.getTarget().getElement(),
                           false);
                   cmd.add(new DestroyReferenceCommand(r));
                   cmd.add(new DeleteCommand(getEditingDomain(), incomingLink));
                   continue;
                 }
               }
               for (Iterator<?> it = cnode.getSourceEdges().iterator(); it.hasNext(); ) {
                 Edge outgoingLink = (Edge) it.next();
                 if (UMLVisualIDRegistry.getVisualID(outgoingLink)
                     == TransitionEditPart.VISUAL_ID) {
                   DestroyElementRequest r =
                       new DestroyElementRequest(outgoingLink.getElement(), false);
                   cmd.add(new DestroyElementCommand(r));
                   cmd.add(new DeleteCommand(getEditingDomain(), outgoingLink));
                   continue;
                 }
               }
               cmd.add(
                   new DestroyElementCommand(
                       new DestroyElementRequest(
                           getEditingDomain(), cnode.getElement(), false))); // directlyOwned: true
               // don't need explicit deletion of cnode as parent's view deletion would clean child
               // views as well
               // cmd.add(new
               // org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(),
               // cnode));
               break;
             case ChoicePseudostateEditPart.VISUAL_ID:
               for (Iterator<?> it = cnode.getTargetEdges().iterator(); it.hasNext(); ) {
                 Edge incomingLink = (Edge) it.next();
                 if (UMLVisualIDRegistry.getVisualID(incomingLink)
                     == TransitionEditPart.VISUAL_ID) {
                   DestroyElementRequest r =
                       new DestroyElementRequest(incomingLink.getElement(), false);
                   cmd.add(new DestroyElementCommand(r));
                   cmd.add(new DeleteCommand(getEditingDomain(), incomingLink));
                   continue;
                 }
                 if (UMLVisualIDRegistry.getVisualID(incomingLink)
                     == CommentAnnotatedElementEditPart.VISUAL_ID) {
                   DestroyReferenceRequest r =
                       new DestroyReferenceRequest(
                           incomingLink.getSource().getElement(),
                           null,
                           incomingLink.getTarget().getElement(),
                           false);
                   cmd.add(new DestroyReferenceCommand(r));
                   cmd.add(new DeleteCommand(getEditingDomain(), incomingLink));
                   continue;
                 }
               }
               for (Iterator<?> it = cnode.getSourceEdges().iterator(); it.hasNext(); ) {
                 Edge outgoingLink = (Edge) it.next();
                 if (UMLVisualIDRegistry.getVisualID(outgoingLink)
                     == TransitionEditPart.VISUAL_ID) {
                   DestroyElementRequest r =
                       new DestroyElementRequest(outgoingLink.getElement(), false);
                   cmd.add(new DestroyElementCommand(r));
                   cmd.add(new DeleteCommand(getEditingDomain(), outgoingLink));
                   continue;
                 }
               }
               cmd.add(
                   new DestroyElementCommand(
                       new DestroyElementRequest(
                           getEditingDomain(), cnode.getElement(), false))); // directlyOwned: true
               // don't need explicit deletion of cnode as parent's view deletion would clean child
               // views as well
               // cmd.add(new
               // org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(),
               // cnode));
               break;
             case TerminatePseudostateEditPart.VISUAL_ID:
               for (Iterator<?> it = cnode.getTargetEdges().iterator(); it.hasNext(); ) {
                 Edge incomingLink = (Edge) it.next();
                 if (UMLVisualIDRegistry.getVisualID(incomingLink)
                     == TransitionEditPart.VISUAL_ID) {
                   DestroyElementRequest r =
                       new DestroyElementRequest(incomingLink.getElement(), false);
                   cmd.add(new DestroyElementCommand(r));
                   cmd.add(new DeleteCommand(getEditingDomain(), incomingLink));
                   continue;
                 }
                 if (UMLVisualIDRegistry.getVisualID(incomingLink)
                     == CommentAnnotatedElementEditPart.VISUAL_ID) {
                   DestroyReferenceRequest r =
                       new DestroyReferenceRequest(
                           incomingLink.getSource().getElement(),
                           null,
                           incomingLink.getTarget().getElement(),
                           false);
                   cmd.add(new DestroyReferenceCommand(r));
                   cmd.add(new DeleteCommand(getEditingDomain(), incomingLink));
                   continue;
                 }
               }
               for (Iterator<?> it = cnode.getSourceEdges().iterator(); it.hasNext(); ) {
                 Edge outgoingLink = (Edge) it.next();
                 if (UMLVisualIDRegistry.getVisualID(outgoingLink)
                     == TransitionEditPart.VISUAL_ID) {
                   DestroyElementRequest r =
                       new DestroyElementRequest(outgoingLink.getElement(), false);
                   cmd.add(new DestroyElementCommand(r));
                   cmd.add(new DeleteCommand(getEditingDomain(), outgoingLink));
                   continue;
                 }
               }
               cmd.add(
                   new DestroyElementCommand(
                       new DestroyElementRequest(
                           getEditingDomain(), cnode.getElement(), false))); // directlyOwned: true
               // don't need explicit deletion of cnode as parent's view deletion would clean child
               // views as well
               // cmd.add(new
               // org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(),
               // cnode));
               break;
           }
         }
         break;
     }
   }
 }
 /** @generated NOT adding the deletion of local conditions */
 protected Command getDestroyElementCommand(DestroyElementRequest req) {
   View view = (View) getHost().getModel();
   CompositeTransactionalCommand cmd = new CompositeTransactionalCommand(getEditingDomain(), null);
   cmd.setTransactionNestingEnabled(false);
   for (Iterator it = view.getTargetEdges().iterator(); it.hasNext(); ) {
     Edge incomingLink = (Edge) it.next();
     if (UMLVisualIDRegistry.getVisualID(incomingLink) == ObjectFlowEditPart.VISUAL_ID) {
       DestroyElementRequest r = new DestroyElementRequest(incomingLink.getElement(), false);
       cmd.add(new DestroyElementCommand(r));
       cmd.add(new DeleteCommand(getEditingDomain(), incomingLink));
       continue;
     }
     if (UMLVisualIDRegistry.getVisualID(incomingLink) == ControlFlowEditPart.VISUAL_ID) {
       DestroyElementRequest r = new DestroyElementRequest(incomingLink.getElement(), false);
       cmd.add(new DestroyElementCommand(r));
       cmd.add(new DeleteCommand(getEditingDomain(), incomingLink));
       continue;
     }
   }
   for (Iterator it = view.getSourceEdges().iterator(); it.hasNext(); ) {
     Edge outgoingLink = (Edge) it.next();
     if (UMLVisualIDRegistry.getVisualID(outgoingLink)
         == ActionLocalPreconditionEditPart.VISUAL_ID) {
       /*
        * Simply delete the link and the local condition view.
        * Model arrangement are automatic since local condition is contained by the action.
        */
       cmd.add(new DeleteCommand(getEditingDomain(), outgoingLink.getTarget()));
       cmd.add(new DeleteCommand(getEditingDomain(), outgoingLink));
       continue;
     }
     if (UMLVisualIDRegistry.getVisualID(outgoingLink)
         == ActionLocalPostconditionEditPart.VISUAL_ID) {
       /*
        * Simply delete the link and the local condition view.
        * Model arrangement are automatic since local condition is contained by the action.
        */
       cmd.add(new DeleteCommand(getEditingDomain(), outgoingLink.getTarget()));
       cmd.add(new DeleteCommand(getEditingDomain(), outgoingLink));
       continue;
     }
     if (UMLVisualIDRegistry.getVisualID(outgoingLink) == ObjectFlowEditPart.VISUAL_ID) {
       DestroyElementRequest r = new DestroyElementRequest(outgoingLink.getElement(), false);
       cmd.add(new DestroyElementCommand(r));
       cmd.add(new DeleteCommand(getEditingDomain(), outgoingLink));
       continue;
     }
     if (UMLVisualIDRegistry.getVisualID(outgoingLink) == ControlFlowEditPart.VISUAL_ID) {
       DestroyElementRequest r = new DestroyElementRequest(outgoingLink.getElement(), false);
       cmd.add(new DestroyElementCommand(r));
       cmd.add(new DeleteCommand(getEditingDomain(), outgoingLink));
       continue;
     }
   }
   EAnnotation annotation = view.getEAnnotation("Shortcut"); // $NON-NLS-1$
   if (annotation == null) {
     // there are indirectly referenced children, need extra commands: false
     addDestroyChildNodesCommand(cmd);
     addDestroyShortcutsCommand(cmd, view);
     // delete host element
     cmd.add(new DestroyElementCommand(req));
   } else {
     cmd.add(new DeleteCommand(getEditingDomain(), view));
   }
   return getGEFWrapper(cmd.reduce());
 }
 /** @generated */
 private void addDestroyChildNodesCommand(ICompositeCommand cmd) {
   View view = (View) getHost().getModel();
   for (Iterator<?> nit = view.getChildren().iterator(); nit.hasNext(); ) {
     Node node = (Node) nit.next();
     switch (UMLVisualIDRegistry.getVisualID(node)) {
       case Port3EditPart.VISUAL_ID:
         for (Iterator<?> it = node.getTargetEdges().iterator(); it.hasNext(); ) {
           Edge incomingLink = (Edge) it.next();
           if (UMLVisualIDRegistry.getVisualID(incomingLink) == ConnectorEditPart.VISUAL_ID) {
             DestroyElementRequest r = new DestroyElementRequest(incomingLink.getElement(), false);
             cmd.add(new DestroyElementCommand(r));
             cmd.add(new DeleteCommand(getEditingDomain(), incomingLink));
             continue;
           }
           if (UMLVisualIDRegistry.getVisualID(incomingLink) == DependencyEditPart.VISUAL_ID) {
             DestroyElementRequest r = new DestroyElementRequest(incomingLink.getElement(), false);
             cmd.add(new DestroyElementCommand(r));
             cmd.add(new DeleteCommand(getEditingDomain(), incomingLink));
             continue;
           }
           if (UMLVisualIDRegistry.getVisualID(incomingLink) == UsageEditPart.VISUAL_ID) {
             DestroyElementRequest r = new DestroyElementRequest(incomingLink.getElement(), false);
             cmd.add(new DestroyElementCommand(r));
             cmd.add(new DeleteCommand(getEditingDomain(), incomingLink));
             continue;
           }
           if (UMLVisualIDRegistry.getVisualID(incomingLink)
               == ConstraintConstrainedElementEditPart.VISUAL_ID) {
             DestroyReferenceRequest r =
                 new DestroyReferenceRequest(
                     incomingLink.getSource().getElement(),
                     null,
                     incomingLink.getTarget().getElement(),
                     false);
             cmd.add(new DestroyReferenceCommand(r));
             cmd.add(new DeleteCommand(getEditingDomain(), incomingLink));
             continue;
           }
           if (UMLVisualIDRegistry.getVisualID(incomingLink)
               == CommentAnnotatedElementEditPart.VISUAL_ID) {
             DestroyReferenceRequest r =
                 new DestroyReferenceRequest(
                     incomingLink.getSource().getElement(),
                     null,
                     incomingLink.getTarget().getElement(),
                     false);
             cmd.add(new DestroyReferenceCommand(r));
             cmd.add(new DeleteCommand(getEditingDomain(), incomingLink));
             continue;
           }
           if (UMLVisualIDRegistry.getVisualID(incomingLink) == Dependency2EditPart.VISUAL_ID) {
             DestroyElementRequest r = new DestroyElementRequest(incomingLink.getElement(), false);
             cmd.add(new DestroyElementCommand(r));
             cmd.add(new DeleteCommand(getEditingDomain(), incomingLink));
             continue;
           }
         }
         for (Iterator<?> it = node.getSourceEdges().iterator(); it.hasNext(); ) {
           Edge outgoingLink = (Edge) it.next();
           if (UMLVisualIDRegistry.getVisualID(outgoingLink) == ConnectorEditPart.VISUAL_ID) {
             DestroyElementRequest r = new DestroyElementRequest(outgoingLink.getElement(), false);
             cmd.add(new DestroyElementCommand(r));
             cmd.add(new DeleteCommand(getEditingDomain(), outgoingLink));
             continue;
           }
           if (UMLVisualIDRegistry.getVisualID(outgoingLink) == DependencyEditPart.VISUAL_ID) {
             DestroyElementRequest r = new DestroyElementRequest(outgoingLink.getElement(), false);
             cmd.add(new DestroyElementCommand(r));
             cmd.add(new DeleteCommand(getEditingDomain(), outgoingLink));
             continue;
           }
           if (UMLVisualIDRegistry.getVisualID(outgoingLink) == UsageEditPart.VISUAL_ID) {
             DestroyElementRequest r = new DestroyElementRequest(outgoingLink.getElement(), false);
             cmd.add(new DestroyElementCommand(r));
             cmd.add(new DeleteCommand(getEditingDomain(), outgoingLink));
             continue;
           }
           if (UMLVisualIDRegistry.getVisualID(outgoingLink) == PortProvidedEditPart.VISUAL_ID) {
             DestroyReferenceRequest r =
                 new DestroyReferenceRequest(
                     outgoingLink.getSource().getElement(),
                     null,
                     outgoingLink.getTarget().getElement(),
                     false);
             cmd.add(new DestroyReferenceCommand(r));
             cmd.add(new DeleteCommand(getEditingDomain(), outgoingLink));
             continue;
           }
           if (UMLVisualIDRegistry.getVisualID(outgoingLink) == PortRequiredEditPart.VISUAL_ID) {
             DestroyReferenceRequest r =
                 new DestroyReferenceRequest(
                     outgoingLink.getSource().getElement(),
                     null,
                     outgoingLink.getTarget().getElement(),
                     false);
             cmd.add(new DestroyReferenceCommand(r));
             cmd.add(new DeleteCommand(getEditingDomain(), outgoingLink));
             continue;
           }
           if (UMLVisualIDRegistry.getVisualID(outgoingLink) == Dependency2EditPart.VISUAL_ID) {
             DestroyElementRequest r = new DestroyElementRequest(outgoingLink.getElement(), false);
             cmd.add(new DestroyElementCommand(r));
             cmd.add(new DeleteCommand(getEditingDomain(), outgoingLink));
             continue;
           }
         }
         cmd.add(
             new DestroyElementCommand(
                 new DestroyElementRequest(
                     getEditingDomain(), node.getElement(), false))); // directlyOwned: true
         // don't need explicit deletion of node as parent's view deletion would clean child views
         // as well
         // cmd.add(new
         // org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), node));
         break;
       case ClassClass_contentsEditPart.VISUAL_ID:
         for (Iterator<?> cit = node.getChildren().iterator(); cit.hasNext(); ) {
           Node cnode = (Node) cit.next();
           switch (UMLVisualIDRegistry.getVisualID(cnode)) {
             case Property3EditPart.VISUAL_ID:
               for (Iterator<?> it = cnode.getTargetEdges().iterator(); it.hasNext(); ) {
                 Edge incomingLink = (Edge) it.next();
                 if (UMLVisualIDRegistry.getVisualID(incomingLink)
                     == ConnectorEditPart.VISUAL_ID) {
                   DestroyElementRequest r =
                       new DestroyElementRequest(incomingLink.getElement(), false);
                   cmd.add(new DestroyElementCommand(r));
                   cmd.add(new DeleteCommand(getEditingDomain(), incomingLink));
                   continue;
                 }
                 if (UMLVisualIDRegistry.getVisualID(incomingLink)
                     == DependencyEditPart.VISUAL_ID) {
                   DestroyElementRequest r =
                       new DestroyElementRequest(incomingLink.getElement(), false);
                   cmd.add(new DestroyElementCommand(r));
                   cmd.add(new DeleteCommand(getEditingDomain(), incomingLink));
                   continue;
                 }
                 if (UMLVisualIDRegistry.getVisualID(incomingLink) == UsageEditPart.VISUAL_ID) {
                   DestroyElementRequest r =
                       new DestroyElementRequest(incomingLink.getElement(), false);
                   cmd.add(new DestroyElementCommand(r));
                   cmd.add(new DeleteCommand(getEditingDomain(), incomingLink));
                   continue;
                 }
                 if (UMLVisualIDRegistry.getVisualID(incomingLink)
                     == ConstraintConstrainedElementEditPart.VISUAL_ID) {
                   DestroyReferenceRequest r =
                       new DestroyReferenceRequest(
                           incomingLink.getSource().getElement(),
                           null,
                           incomingLink.getTarget().getElement(),
                           false);
                   cmd.add(new DestroyReferenceCommand(r));
                   cmd.add(new DeleteCommand(getEditingDomain(), incomingLink));
                   continue;
                 }
                 if (UMLVisualIDRegistry.getVisualID(incomingLink)
                     == CommentAnnotatedElementEditPart.VISUAL_ID) {
                   DestroyReferenceRequest r =
                       new DestroyReferenceRequest(
                           incomingLink.getSource().getElement(),
                           null,
                           incomingLink.getTarget().getElement(),
                           false);
                   cmd.add(new DestroyReferenceCommand(r));
                   cmd.add(new DeleteCommand(getEditingDomain(), incomingLink));
                   continue;
                 }
                 if (UMLVisualIDRegistry.getVisualID(incomingLink)
                     == Dependency2EditPart.VISUAL_ID) {
                   DestroyElementRequest r =
                       new DestroyElementRequest(incomingLink.getElement(), false);
                   cmd.add(new DestroyElementCommand(r));
                   cmd.add(new DeleteCommand(getEditingDomain(), incomingLink));
                   continue;
                 }
               }
               for (Iterator<?> it = cnode.getSourceEdges().iterator(); it.hasNext(); ) {
                 Edge outgoingLink = (Edge) it.next();
                 if (UMLVisualIDRegistry.getVisualID(outgoingLink)
                     == ConnectorEditPart.VISUAL_ID) {
                   DestroyElementRequest r =
                       new DestroyElementRequest(outgoingLink.getElement(), false);
                   cmd.add(new DestroyElementCommand(r));
                   cmd.add(new DeleteCommand(getEditingDomain(), outgoingLink));
                   continue;
                 }
                 if (UMLVisualIDRegistry.getVisualID(outgoingLink)
                     == DependencyEditPart.VISUAL_ID) {
                   DestroyElementRequest r =
                       new DestroyElementRequest(outgoingLink.getElement(), false);
                   cmd.add(new DestroyElementCommand(r));
                   cmd.add(new DeleteCommand(getEditingDomain(), outgoingLink));
                   continue;
                 }
                 if (UMLVisualIDRegistry.getVisualID(outgoingLink) == UsageEditPart.VISUAL_ID) {
                   DestroyElementRequest r =
                       new DestroyElementRequest(outgoingLink.getElement(), false);
                   cmd.add(new DestroyElementCommand(r));
                   cmd.add(new DeleteCommand(getEditingDomain(), outgoingLink));
                   continue;
                 }
                 if (UMLVisualIDRegistry.getVisualID(outgoingLink)
                     == Dependency2EditPart.VISUAL_ID) {
                   DestroyElementRequest r =
                       new DestroyElementRequest(outgoingLink.getElement(), false);
                   cmd.add(new DestroyElementCommand(r));
                   cmd.add(new DeleteCommand(getEditingDomain(), outgoingLink));
                   continue;
                 }
               }
               cmd.add(
                   new DestroyElementCommand(
                       new DestroyElementRequest(
                           getEditingDomain(), cnode.getElement(), false))); // directlyOwned: true
               // don't need explicit deletion of cnode as parent's view deletion would clean child
               // views as well
               // cmd.add(new
               // org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(),
               // cnode));
               break;
           }
         }
         break;
     }
   }
 }
 /** @generated */
 protected void addDestroyChildNodesCommand(ICompositeCommand cmd) {
   View view = (View) getHost().getModel();
   for (Iterator<?> nit = view.getChildren().iterator(); nit.hasNext(); ) {
     Node node = (Node) nit.next();
     switch (UMLVisualIDRegistry.getVisualID(node)) {
       case ValuePinInCallBeActEditPart.VISUAL_ID:
         for (Iterator<?> it = node.getTargetEdges().iterator(); it.hasNext(); ) {
           Edge incomingLink = (Edge) it.next();
           switch (UMLVisualIDRegistry.getVisualID(incomingLink)) {
             case CommentLinkEditPart.VISUAL_ID:
               DestroyReferenceRequest destroyRefReq =
                   new DestroyReferenceRequest(
                       incomingLink.getSource().getElement(),
                       null,
                       incomingLink.getTarget().getElement(),
                       false);
               cmd.add(new DestroyReferenceCommand(destroyRefReq));
               cmd.add(new DeleteCommand(getEditingDomain(), incomingLink));
               break;
             case ObjectFlowEditPart.VISUAL_ID:
             case ControlFlowEditPart.VISUAL_ID:
             case ExceptionHandlerEditPart.VISUAL_ID:
               DestroyElementRequest destroyEltReq =
                   new DestroyElementRequest(incomingLink.getElement(), false);
               cmd.add(new DestroyElementCommand(destroyEltReq));
               cmd.add(new DeleteCommand(getEditingDomain(), incomingLink));
               break;
           }
         }
         for (Iterator<?> it = node.getSourceEdges().iterator(); it.hasNext(); ) {
           Edge outgoingLink = (Edge) it.next();
           switch (UMLVisualIDRegistry.getVisualID(outgoingLink)) {
             case ObjectFlowEditPart.VISUAL_ID:
             case ControlFlowEditPart.VISUAL_ID:
               DestroyElementRequest destroyEltReq =
                   new DestroyElementRequest(outgoingLink.getElement(), false);
               cmd.add(new DestroyElementCommand(destroyEltReq));
               cmd.add(new DeleteCommand(getEditingDomain(), outgoingLink));
               break;
           }
         }
         cmd.add(
             new DestroyElementCommand(
                 new DestroyElementRequest(
                     getEditingDomain(), node.getElement(), false))); // directlyOwned: true
         // don't need explicit deletion of node as parent's view deletion would clean child views
         // as well
         // cmd.add(new
         // org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), node));
         break;
       case ActionInputPinInCallBeActEditPart.VISUAL_ID:
         for (Iterator<?> it = node.getTargetEdges().iterator(); it.hasNext(); ) {
           Edge incomingLink = (Edge) it.next();
           switch (UMLVisualIDRegistry.getVisualID(incomingLink)) {
             case CommentLinkEditPart.VISUAL_ID:
               DestroyReferenceRequest destroyRefReq =
                   new DestroyReferenceRequest(
                       incomingLink.getSource().getElement(),
                       null,
                       incomingLink.getTarget().getElement(),
                       false);
               cmd.add(new DestroyReferenceCommand(destroyRefReq));
               cmd.add(new DeleteCommand(getEditingDomain(), incomingLink));
               break;
             case ObjectFlowEditPart.VISUAL_ID:
             case ControlFlowEditPart.VISUAL_ID:
             case ExceptionHandlerEditPart.VISUAL_ID:
               DestroyElementRequest destroyEltReq =
                   new DestroyElementRequest(incomingLink.getElement(), false);
               cmd.add(new DestroyElementCommand(destroyEltReq));
               cmd.add(new DeleteCommand(getEditingDomain(), incomingLink));
               break;
           }
         }
         for (Iterator<?> it = node.getSourceEdges().iterator(); it.hasNext(); ) {
           Edge outgoingLink = (Edge) it.next();
           switch (UMLVisualIDRegistry.getVisualID(outgoingLink)) {
             case ObjectFlowEditPart.VISUAL_ID:
             case ControlFlowEditPart.VISUAL_ID:
               DestroyElementRequest destroyEltReq =
                   new DestroyElementRequest(outgoingLink.getElement(), false);
               cmd.add(new DestroyElementCommand(destroyEltReq));
               cmd.add(new DeleteCommand(getEditingDomain(), outgoingLink));
               break;
           }
         }
         cmd.add(
             new DestroyElementCommand(
                 new DestroyElementRequest(
                     getEditingDomain(), node.getElement(), false))); // directlyOwned: true
         // don't need explicit deletion of node as parent's view deletion would clean child views
         // as well
         // cmd.add(new
         // org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), node));
         break;
       case InputPinInCallBeActEditPart.VISUAL_ID:
         for (Iterator<?> it = node.getTargetEdges().iterator(); it.hasNext(); ) {
           Edge incomingLink = (Edge) it.next();
           switch (UMLVisualIDRegistry.getVisualID(incomingLink)) {
             case CommentLinkEditPart.VISUAL_ID:
               DestroyReferenceRequest destroyRefReq =
                   new DestroyReferenceRequest(
                       incomingLink.getSource().getElement(),
                       null,
                       incomingLink.getTarget().getElement(),
                       false);
               cmd.add(new DestroyReferenceCommand(destroyRefReq));
               cmd.add(new DeleteCommand(getEditingDomain(), incomingLink));
               break;
             case ObjectFlowEditPart.VISUAL_ID:
             case ControlFlowEditPart.VISUAL_ID:
             case ExceptionHandlerEditPart.VISUAL_ID:
               DestroyElementRequest destroyEltReq =
                   new DestroyElementRequest(incomingLink.getElement(), false);
               cmd.add(new DestroyElementCommand(destroyEltReq));
               cmd.add(new DeleteCommand(getEditingDomain(), incomingLink));
               break;
           }
         }
         for (Iterator<?> it = node.getSourceEdges().iterator(); it.hasNext(); ) {
           Edge outgoingLink = (Edge) it.next();
           switch (UMLVisualIDRegistry.getVisualID(outgoingLink)) {
             case ObjectFlowEditPart.VISUAL_ID:
             case ControlFlowEditPart.VISUAL_ID:
               DestroyElementRequest destroyEltReq =
                   new DestroyElementRequest(outgoingLink.getElement(), false);
               cmd.add(new DestroyElementCommand(destroyEltReq));
               cmd.add(new DeleteCommand(getEditingDomain(), outgoingLink));
               break;
           }
         }
         cmd.add(
             new DestroyElementCommand(
                 new DestroyElementRequest(
                     getEditingDomain(), node.getElement(), false))); // directlyOwned: true
         // don't need explicit deletion of node as parent's view deletion would clean child views
         // as well
         // cmd.add(new
         // org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), node));
         break;
       case OutputPinInCallBeActEditPart.VISUAL_ID:
         for (Iterator<?> it = node.getTargetEdges().iterator(); it.hasNext(); ) {
           Edge incomingLink = (Edge) it.next();
           switch (UMLVisualIDRegistry.getVisualID(incomingLink)) {
             case CommentLinkEditPart.VISUAL_ID:
               DestroyReferenceRequest destroyRefReq =
                   new DestroyReferenceRequest(
                       incomingLink.getSource().getElement(),
                       null,
                       incomingLink.getTarget().getElement(),
                       false);
               cmd.add(new DestroyReferenceCommand(destroyRefReq));
               cmd.add(new DeleteCommand(getEditingDomain(), incomingLink));
               break;
             case ObjectFlowEditPart.VISUAL_ID:
             case ControlFlowEditPart.VISUAL_ID:
             case ExceptionHandlerEditPart.VISUAL_ID:
               DestroyElementRequest destroyEltReq =
                   new DestroyElementRequest(incomingLink.getElement(), false);
               cmd.add(new DestroyElementCommand(destroyEltReq));
               cmd.add(new DeleteCommand(getEditingDomain(), incomingLink));
               break;
           }
         }
         for (Iterator<?> it = node.getSourceEdges().iterator(); it.hasNext(); ) {
           Edge outgoingLink = (Edge) it.next();
           switch (UMLVisualIDRegistry.getVisualID(outgoingLink)) {
             case ObjectFlowEditPart.VISUAL_ID:
             case ControlFlowEditPart.VISUAL_ID:
               DestroyElementRequest destroyEltReq =
                   new DestroyElementRequest(outgoingLink.getElement(), false);
               cmd.add(new DestroyElementCommand(destroyEltReq));
               cmd.add(new DeleteCommand(getEditingDomain(), outgoingLink));
               break;
           }
         }
         cmd.add(
             new DestroyElementCommand(
                 new DestroyElementRequest(
                     getEditingDomain(), node.getElement(), false))); // directlyOwned: true
         // don't need explicit deletion of node as parent's view deletion would clean child views
         // as well
         // cmd.add(new
         // org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), node));
         break;
     }
   }
 }
  /** @generated */
  protected void addDestroyChildNodesCommand(ICompositeCommand cmd) {
    View view = (View) getHost().getModel();
    for (Iterator<?> nit = view.getChildren().iterator(); nit.hasNext(); ) {
      Node node = (Node) nit.next();
      switch (UMLVisualIDRegistry.getVisualID(node)) {
        case ProfilePackageableElementCompartmentEditPartTN.VISUAL_ID:
          for (Iterator<?> cit = node.getChildren().iterator(); cit.hasNext(); ) {
            Node cnode = (Node) cit.next();
            switch (UMLVisualIDRegistry.getVisualID(cnode)) {
              case StereotypeEditPartCN.VISUAL_ID:
                for (Iterator<?> it = cnode.getTargetEdges().iterator(); it.hasNext(); ) {
                  Edge incomingLink = (Edge) it.next();
                  switch (UMLVisualIDRegistry.getVisualID(incomingLink)) {
                    case CommentAnnotatedElementEditPart.VISUAL_ID:
                    case ConstraintConstrainedElementEditPart.VISUAL_ID:
                      DestroyReferenceRequest destroyRefReq =
                          new DestroyReferenceRequest(
                              incomingLink.getSource().getElement(),
                              null,
                              incomingLink.getTarget().getElement(),
                              false);
                      cmd.add(new DestroyReferenceCommand(destroyRefReq));
                      cmd.add(
                          new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(
                              getEditingDomain(), incomingLink));
                      break;
                    case ExtensionEditPart.VISUAL_ID:
                    case AssociationEditPart.VISUAL_ID:
                    case AssociationBranchEditPart.VISUAL_ID:
                    case GeneralizationEditPart.VISUAL_ID:
                    case DependencyEditPart.VISUAL_ID:
                    case DependencyBranchEditPart.VISUAL_ID:
                    case ElementImportEditPart.VISUAL_ID:
                      DestroyElementRequest destroyEltReq =
                          new DestroyElementRequest(incomingLink.getElement(), false);
                      cmd.add(new DestroyElementCommand(destroyEltReq));
                      cmd.add(
                          new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(
                              getEditingDomain(), incomingLink));
                      break;
                  }
                }

                for (Iterator<?> it = cnode.getSourceEdges().iterator(); it.hasNext(); ) {
                  Edge outgoingLink = (Edge) it.next();
                  switch (UMLVisualIDRegistry.getVisualID(outgoingLink)) {
                    case AssociationEditPart.VISUAL_ID:
                    case AssociationBranchEditPart.VISUAL_ID:
                    case GeneralizationEditPart.VISUAL_ID:
                    case DependencyEditPart.VISUAL_ID:
                    case DependencyBranchEditPart.VISUAL_ID:
                    case ElementImportEditPart.VISUAL_ID:
                    case PackageImportEditPart.VISUAL_ID:
                      DestroyElementRequest destroyEltReq =
                          new DestroyElementRequest(outgoingLink.getElement(), false);
                      cmd.add(new DestroyElementCommand(destroyEltReq));
                      cmd.add(
                          new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(
                              getEditingDomain(), outgoingLink));
                      break;
                  }
                }
                cmd.add(
                    new DestroyElementCommand(
                        new DestroyElementRequest(
                            getEditingDomain(), cnode.getElement(), false))); // directlyOwned: true
                // don't need explicit deletion of cnode as parent's view deletion would clean child
                // views as well
                // cmd.add(new
                // org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(),
                // cnode));
                break;
              case ModelEditPartCN.VISUAL_ID:
                for (Iterator<?> it = cnode.getTargetEdges().iterator(); it.hasNext(); ) {
                  Edge incomingLink = (Edge) it.next();
                  switch (UMLVisualIDRegistry.getVisualID(incomingLink)) {
                    case CommentAnnotatedElementEditPart.VISUAL_ID:
                    case ConstraintConstrainedElementEditPart.VISUAL_ID:
                      DestroyReferenceRequest destroyRefReq =
                          new DestroyReferenceRequest(
                              incomingLink.getSource().getElement(),
                              null,
                              incomingLink.getTarget().getElement(),
                              false);
                      cmd.add(new DestroyReferenceCommand(destroyRefReq));
                      cmd.add(
                          new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(
                              getEditingDomain(), incomingLink));
                      break;
                    case DependencyEditPart.VISUAL_ID:
                    case DependencyBranchEditPart.VISUAL_ID:
                    case ElementImportEditPart.VISUAL_ID:
                    case PackageImportEditPart.VISUAL_ID:
                      DestroyElementRequest destroyEltReq =
                          new DestroyElementRequest(incomingLink.getElement(), false);
                      cmd.add(new DestroyElementCommand(destroyEltReq));
                      cmd.add(
                          new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(
                              getEditingDomain(), incomingLink));
                      break;
                  }
                }

                for (Iterator<?> it = cnode.getSourceEdges().iterator(); it.hasNext(); ) {
                  Edge outgoingLink = (Edge) it.next();
                  switch (UMLVisualIDRegistry.getVisualID(outgoingLink)) {
                    case ProfileApplicationEditPart.VISUAL_ID:
                    case DependencyEditPart.VISUAL_ID:
                    case DependencyBranchEditPart.VISUAL_ID:
                    case ElementImportEditPart.VISUAL_ID:
                    case PackageImportEditPart.VISUAL_ID:
                      DestroyElementRequest destroyEltReq =
                          new DestroyElementRequest(outgoingLink.getElement(), false);
                      cmd.add(new DestroyElementCommand(destroyEltReq));
                      cmd.add(
                          new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(
                              getEditingDomain(), outgoingLink));
                      break;
                  }
                }
                cmd.add(
                    new DestroyElementCommand(
                        new DestroyElementRequest(
                            getEditingDomain(), cnode.getElement(), false))); // directlyOwned: true
                // don't need explicit deletion of cnode as parent's view deletion would clean child
                // views as well
                // cmd.add(new
                // org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(),
                // cnode));
                break;
              case ProfileEditPartCN.VISUAL_ID:
                for (Iterator<?> it = cnode.getTargetEdges().iterator(); it.hasNext(); ) {
                  Edge incomingLink = (Edge) it.next();
                  switch (UMLVisualIDRegistry.getVisualID(incomingLink)) {
                    case CommentAnnotatedElementEditPart.VISUAL_ID:
                    case ConstraintConstrainedElementEditPart.VISUAL_ID:
                      DestroyReferenceRequest destroyRefReq =
                          new DestroyReferenceRequest(
                              incomingLink.getSource().getElement(),
                              null,
                              incomingLink.getTarget().getElement(),
                              false);
                      cmd.add(new DestroyReferenceCommand(destroyRefReq));
                      cmd.add(
                          new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(
                              getEditingDomain(), incomingLink));
                      break;
                    case ProfileApplicationEditPart.VISUAL_ID:
                    case DependencyEditPart.VISUAL_ID:
                    case DependencyBranchEditPart.VISUAL_ID:
                    case ElementImportEditPart.VISUAL_ID:
                    case PackageImportEditPart.VISUAL_ID:
                      DestroyElementRequest destroyEltReq =
                          new DestroyElementRequest(incomingLink.getElement(), false);
                      cmd.add(new DestroyElementCommand(destroyEltReq));
                      cmd.add(
                          new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(
                              getEditingDomain(), incomingLink));
                      break;
                  }
                }

                for (Iterator<?> it = cnode.getSourceEdges().iterator(); it.hasNext(); ) {
                  Edge outgoingLink = (Edge) it.next();
                  switch (UMLVisualIDRegistry.getVisualID(outgoingLink)) {
                    case ProfileApplicationEditPart.VISUAL_ID:
                    case DependencyEditPart.VISUAL_ID:
                    case DependencyBranchEditPart.VISUAL_ID:
                    case ElementImportEditPart.VISUAL_ID:
                    case PackageImportEditPart.VISUAL_ID:
                      DestroyElementRequest destroyEltReq =
                          new DestroyElementRequest(outgoingLink.getElement(), false);
                      cmd.add(new DestroyElementCommand(destroyEltReq));
                      cmd.add(
                          new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(
                              getEditingDomain(), outgoingLink));
                      break;
                  }
                }
                cmd.add(
                    new DestroyElementCommand(
                        new DestroyElementRequest(
                            getEditingDomain(), cnode.getElement(), false))); // directlyOwned: true
                // don't need explicit deletion of cnode as parent's view deletion would clean child
                // views as well
                // cmd.add(new
                // org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(),
                // cnode));
                break;
              case PackageEditPartCN.VISUAL_ID:
                for (Iterator<?> it = cnode.getTargetEdges().iterator(); it.hasNext(); ) {
                  Edge incomingLink = (Edge) it.next();
                  switch (UMLVisualIDRegistry.getVisualID(incomingLink)) {
                    case CommentAnnotatedElementEditPart.VISUAL_ID:
                    case ConstraintConstrainedElementEditPart.VISUAL_ID:
                      DestroyReferenceRequest destroyRefReq =
                          new DestroyReferenceRequest(
                              incomingLink.getSource().getElement(),
                              null,
                              incomingLink.getTarget().getElement(),
                              false);
                      cmd.add(new DestroyReferenceCommand(destroyRefReq));
                      cmd.add(
                          new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(
                              getEditingDomain(), incomingLink));
                      break;
                    case DependencyEditPart.VISUAL_ID:
                    case DependencyBranchEditPart.VISUAL_ID:
                    case ElementImportEditPart.VISUAL_ID:
                    case PackageImportEditPart.VISUAL_ID:
                      DestroyElementRequest destroyEltReq =
                          new DestroyElementRequest(incomingLink.getElement(), false);
                      cmd.add(new DestroyElementCommand(destroyEltReq));
                      cmd.add(
                          new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(
                              getEditingDomain(), incomingLink));
                      break;
                  }
                }

                for (Iterator<?> it = cnode.getSourceEdges().iterator(); it.hasNext(); ) {
                  Edge outgoingLink = (Edge) it.next();
                  switch (UMLVisualIDRegistry.getVisualID(outgoingLink)) {
                    case ProfileApplicationEditPart.VISUAL_ID:
                    case DependencyEditPart.VISUAL_ID:
                    case DependencyBranchEditPart.VISUAL_ID:
                    case ElementImportEditPart.VISUAL_ID:
                    case PackageImportEditPart.VISUAL_ID:
                      DestroyElementRequest destroyEltReq =
                          new DestroyElementRequest(outgoingLink.getElement(), false);
                      cmd.add(new DestroyElementCommand(destroyEltReq));
                      cmd.add(
                          new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(
                              getEditingDomain(), outgoingLink));
                      break;
                  }
                }
                cmd.add(
                    new DestroyElementCommand(
                        new DestroyElementRequest(
                            getEditingDomain(), cnode.getElement(), false))); // directlyOwned: true
                // don't need explicit deletion of cnode as parent's view deletion would clean child
                // views as well
                // cmd.add(new
                // org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(),
                // cnode));
                break;
              case ConstraintEditPartCN.VISUAL_ID:
                for (Iterator<?> it = cnode.getTargetEdges().iterator(); it.hasNext(); ) {
                  Edge incomingLink = (Edge) it.next();
                  switch (UMLVisualIDRegistry.getVisualID(incomingLink)) {
                    case CommentAnnotatedElementEditPart.VISUAL_ID:
                    case ConstraintConstrainedElementEditPart.VISUAL_ID:
                      DestroyReferenceRequest destroyRefReq =
                          new DestroyReferenceRequest(
                              incomingLink.getSource().getElement(),
                              null,
                              incomingLink.getTarget().getElement(),
                              false);
                      cmd.add(new DestroyReferenceCommand(destroyRefReq));
                      cmd.add(
                          new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(
                              getEditingDomain(), incomingLink));
                      break;
                    case DependencyEditPart.VISUAL_ID:
                    case DependencyBranchEditPart.VISUAL_ID:
                    case ElementImportEditPart.VISUAL_ID:
                      DestroyElementRequest destroyEltReq =
                          new DestroyElementRequest(incomingLink.getElement(), false);
                      cmd.add(new DestroyElementCommand(destroyEltReq));
                      cmd.add(
                          new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(
                              getEditingDomain(), incomingLink));
                      break;
                  }
                }

                for (Iterator<?> it = cnode.getSourceEdges().iterator(); it.hasNext(); ) {
                  Edge outgoingLink = (Edge) it.next();
                  switch (UMLVisualIDRegistry.getVisualID(outgoingLink)) {
                    case ConstraintConstrainedElementEditPart.VISUAL_ID:
                      DestroyReferenceRequest destroyRefReq =
                          new DestroyReferenceRequest(
                              outgoingLink.getSource().getElement(),
                              null,
                              outgoingLink.getTarget().getElement(),
                              false);
                      cmd.add(new DestroyReferenceCommand(destroyRefReq));
                      cmd.add(
                          new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(
                              getEditingDomain(), outgoingLink));
                      break;
                    case DependencyEditPart.VISUAL_ID:
                    case DependencyBranchEditPart.VISUAL_ID:
                      DestroyElementRequest destroyEltReq =
                          new DestroyElementRequest(outgoingLink.getElement(), false);
                      cmd.add(new DestroyElementCommand(destroyEltReq));
                      cmd.add(
                          new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(
                              getEditingDomain(), outgoingLink));
                      break;
                  }
                }
                cmd.add(
                    new DestroyElementCommand(
                        new DestroyElementRequest(
                            getEditingDomain(), cnode.getElement(), false))); // directlyOwned: true
                // don't need explicit deletion of cnode as parent's view deletion would clean child
                // views as well
                // cmd.add(new
                // org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(),
                // cnode));
                break;
              case EnumerationEditPartCN.VISUAL_ID:
                for (Iterator<?> it = cnode.getTargetEdges().iterator(); it.hasNext(); ) {
                  Edge incomingLink = (Edge) it.next();
                  switch (UMLVisualIDRegistry.getVisualID(incomingLink)) {
                    case CommentAnnotatedElementEditPart.VISUAL_ID:
                    case ConstraintConstrainedElementEditPart.VISUAL_ID:
                      DestroyReferenceRequest destroyRefReq =
                          new DestroyReferenceRequest(
                              incomingLink.getSource().getElement(),
                              null,
                              incomingLink.getTarget().getElement(),
                              false);
                      cmd.add(new DestroyReferenceCommand(destroyRefReq));
                      cmd.add(
                          new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(
                              getEditingDomain(), incomingLink));
                      break;
                    case AssociationEditPart.VISUAL_ID:
                    case AssociationBranchEditPart.VISUAL_ID:
                    case GeneralizationEditPart.VISUAL_ID:
                    case DependencyEditPart.VISUAL_ID:
                    case DependencyBranchEditPart.VISUAL_ID:
                    case ElementImportEditPart.VISUAL_ID:
                      DestroyElementRequest destroyEltReq =
                          new DestroyElementRequest(incomingLink.getElement(), false);
                      cmd.add(new DestroyElementCommand(destroyEltReq));
                      cmd.add(
                          new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(
                              getEditingDomain(), incomingLink));
                      break;
                  }
                }

                for (Iterator<?> it = cnode.getSourceEdges().iterator(); it.hasNext(); ) {
                  Edge outgoingLink = (Edge) it.next();
                  switch (UMLVisualIDRegistry.getVisualID(outgoingLink)) {
                    case AssociationEditPart.VISUAL_ID:
                    case AssociationBranchEditPart.VISUAL_ID:
                    case GeneralizationEditPart.VISUAL_ID:
                    case DependencyEditPart.VISUAL_ID:
                    case DependencyBranchEditPart.VISUAL_ID:
                    case ElementImportEditPart.VISUAL_ID:
                    case PackageImportEditPart.VISUAL_ID:
                      DestroyElementRequest destroyEltReq =
                          new DestroyElementRequest(outgoingLink.getElement(), false);
                      cmd.add(new DestroyElementCommand(destroyEltReq));
                      cmd.add(
                          new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(
                              getEditingDomain(), outgoingLink));
                      break;
                  }
                }
                cmd.add(
                    new DestroyElementCommand(
                        new DestroyElementRequest(
                            getEditingDomain(), cnode.getElement(), false))); // directlyOwned: true
                // don't need explicit deletion of cnode as parent's view deletion would clean child
                // views as well
                // cmd.add(new
                // org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(),
                // cnode));
                break;
              case PrimitiveTypeEditPartCN.VISUAL_ID:
                for (Iterator<?> it = cnode.getTargetEdges().iterator(); it.hasNext(); ) {
                  Edge incomingLink = (Edge) it.next();
                  switch (UMLVisualIDRegistry.getVisualID(incomingLink)) {
                    case CommentAnnotatedElementEditPart.VISUAL_ID:
                    case ConstraintConstrainedElementEditPart.VISUAL_ID:
                      DestroyReferenceRequest destroyRefReq =
                          new DestroyReferenceRequest(
                              incomingLink.getSource().getElement(),
                              null,
                              incomingLink.getTarget().getElement(),
                              false);
                      cmd.add(new DestroyReferenceCommand(destroyRefReq));
                      cmd.add(
                          new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(
                              getEditingDomain(), incomingLink));
                      break;
                    case AssociationEditPart.VISUAL_ID:
                    case AssociationBranchEditPart.VISUAL_ID:
                    case GeneralizationEditPart.VISUAL_ID:
                    case DependencyEditPart.VISUAL_ID:
                    case DependencyBranchEditPart.VISUAL_ID:
                    case ElementImportEditPart.VISUAL_ID:
                      DestroyElementRequest destroyEltReq =
                          new DestroyElementRequest(incomingLink.getElement(), false);
                      cmd.add(new DestroyElementCommand(destroyEltReq));
                      cmd.add(
                          new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(
                              getEditingDomain(), incomingLink));
                      break;
                  }
                }

                for (Iterator<?> it = cnode.getSourceEdges().iterator(); it.hasNext(); ) {
                  Edge outgoingLink = (Edge) it.next();
                  switch (UMLVisualIDRegistry.getVisualID(outgoingLink)) {
                    case AssociationEditPart.VISUAL_ID:
                    case AssociationBranchEditPart.VISUAL_ID:
                    case GeneralizationEditPart.VISUAL_ID:
                    case DependencyEditPart.VISUAL_ID:
                    case DependencyBranchEditPart.VISUAL_ID:
                    case ElementImportEditPart.VISUAL_ID:
                    case PackageImportEditPart.VISUAL_ID:
                      DestroyElementRequest destroyEltReq =
                          new DestroyElementRequest(outgoingLink.getElement(), false);
                      cmd.add(new DestroyElementCommand(destroyEltReq));
                      cmd.add(
                          new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(
                              getEditingDomain(), outgoingLink));
                      break;
                  }
                }
                cmd.add(
                    new DestroyElementCommand(
                        new DestroyElementRequest(
                            getEditingDomain(), cnode.getElement(), false))); // directlyOwned: true
                // don't need explicit deletion of cnode as parent's view deletion would clean child
                // views as well
                // cmd.add(new
                // org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(),
                // cnode));
                break;
              case DataTypeEditPartCN.VISUAL_ID:
                for (Iterator<?> it = cnode.getTargetEdges().iterator(); it.hasNext(); ) {
                  Edge incomingLink = (Edge) it.next();
                  switch (UMLVisualIDRegistry.getVisualID(incomingLink)) {
                    case CommentAnnotatedElementEditPart.VISUAL_ID:
                    case ConstraintConstrainedElementEditPart.VISUAL_ID:
                      DestroyReferenceRequest destroyRefReq =
                          new DestroyReferenceRequest(
                              incomingLink.getSource().getElement(),
                              null,
                              incomingLink.getTarget().getElement(),
                              false);
                      cmd.add(new DestroyReferenceCommand(destroyRefReq));
                      cmd.add(
                          new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(
                              getEditingDomain(), incomingLink));
                      break;
                    case AssociationEditPart.VISUAL_ID:
                    case AssociationBranchEditPart.VISUAL_ID:
                    case GeneralizationEditPart.VISUAL_ID:
                    case DependencyEditPart.VISUAL_ID:
                    case DependencyBranchEditPart.VISUAL_ID:
                    case ElementImportEditPart.VISUAL_ID:
                      DestroyElementRequest destroyEltReq =
                          new DestroyElementRequest(incomingLink.getElement(), false);
                      cmd.add(new DestroyElementCommand(destroyEltReq));
                      cmd.add(
                          new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(
                              getEditingDomain(), incomingLink));
                      break;
                  }
                }

                for (Iterator<?> it = cnode.getSourceEdges().iterator(); it.hasNext(); ) {
                  Edge outgoingLink = (Edge) it.next();
                  switch (UMLVisualIDRegistry.getVisualID(outgoingLink)) {
                    case AssociationEditPart.VISUAL_ID:
                    case AssociationBranchEditPart.VISUAL_ID:
                    case GeneralizationEditPart.VISUAL_ID:
                    case DependencyEditPart.VISUAL_ID:
                    case DependencyBranchEditPart.VISUAL_ID:
                    case ElementImportEditPart.VISUAL_ID:
                    case PackageImportEditPart.VISUAL_ID:
                      DestroyElementRequest destroyEltReq =
                          new DestroyElementRequest(outgoingLink.getElement(), false);
                      cmd.add(new DestroyElementCommand(destroyEltReq));
                      cmd.add(
                          new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(
                              getEditingDomain(), outgoingLink));
                      break;
                  }
                }
                cmd.add(
                    new DestroyElementCommand(
                        new DestroyElementRequest(
                            getEditingDomain(), cnode.getElement(), false))); // directlyOwned: true
                // don't need explicit deletion of cnode as parent's view deletion would clean child
                // views as well
                // cmd.add(new
                // org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(),
                // cnode));
                break;
              case CommentEditPartCN.VISUAL_ID:
                for (Iterator<?> it = cnode.getTargetEdges().iterator(); it.hasNext(); ) {
                  Edge incomingLink = (Edge) it.next();
                  switch (UMLVisualIDRegistry.getVisualID(incomingLink)) {
                    case CommentAnnotatedElementEditPart.VISUAL_ID:
                    case ConstraintConstrainedElementEditPart.VISUAL_ID:
                      DestroyReferenceRequest destroyRefReq =
                          new DestroyReferenceRequest(
                              incomingLink.getSource().getElement(),
                              null,
                              incomingLink.getTarget().getElement(),
                              false);
                      cmd.add(new DestroyReferenceCommand(destroyRefReq));
                      cmd.add(
                          new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(
                              getEditingDomain(), incomingLink));
                      break;
                  }
                }

                for (Iterator<?> it = cnode.getSourceEdges().iterator(); it.hasNext(); ) {
                  Edge outgoingLink = (Edge) it.next();
                  switch (UMLVisualIDRegistry.getVisualID(outgoingLink)) {
                    case CommentAnnotatedElementEditPart.VISUAL_ID:
                      DestroyReferenceRequest destroyRefReq =
                          new DestroyReferenceRequest(
                              outgoingLink.getSource().getElement(),
                              null,
                              outgoingLink.getTarget().getElement(),
                              false);
                      cmd.add(new DestroyReferenceCommand(destroyRefReq));
                      cmd.add(
                          new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(
                              getEditingDomain(), outgoingLink));
                      break;
                  }
                }
                cmd.add(
                    new DestroyElementCommand(
                        new DestroyElementRequest(
                            getEditingDomain(), cnode.getElement(), false))); // directlyOwned: true
                // don't need explicit deletion of cnode as parent's view deletion would clean child
                // views as well
                // cmd.add(new
                // org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(),
                // cnode));
                break;
              case MetaclassEditPartCN.VISUAL_ID:
                for (Iterator<?> it = cnode.getTargetEdges().iterator(); it.hasNext(); ) {
                  Edge incomingLink = (Edge) it.next();
                  switch (UMLVisualIDRegistry.getVisualID(incomingLink)) {
                    case CommentAnnotatedElementEditPart.VISUAL_ID:
                    case ConstraintConstrainedElementEditPart.VISUAL_ID:
                      DestroyReferenceRequest destroyRefReq =
                          new DestroyReferenceRequest(
                              incomingLink.getSource().getElement(),
                              null,
                              incomingLink.getTarget().getElement(),
                              false);
                      cmd.add(new DestroyReferenceCommand(destroyRefReq));
                      cmd.add(
                          new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(
                              getEditingDomain(), incomingLink));
                      break;
                    case ExtensionEditPart.VISUAL_ID:
                    case AssociationEditPart.VISUAL_ID:
                    case AssociationBranchEditPart.VISUAL_ID:
                    case GeneralizationEditPart.VISUAL_ID:
                    case DependencyEditPart.VISUAL_ID:
                    case DependencyBranchEditPart.VISUAL_ID:
                    case ElementImportEditPart.VISUAL_ID:
                      DestroyElementRequest destroyEltReq =
                          new DestroyElementRequest(incomingLink.getElement(), false);
                      cmd.add(new DestroyElementCommand(destroyEltReq));
                      cmd.add(
                          new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(
                              getEditingDomain(), incomingLink));
                      break;
                  }
                }

                for (Iterator<?> it = cnode.getSourceEdges().iterator(); it.hasNext(); ) {
                  Edge outgoingLink = (Edge) it.next();
                  switch (UMLVisualIDRegistry.getVisualID(outgoingLink)) {
                    case AssociationEditPart.VISUAL_ID:
                    case AssociationBranchEditPart.VISUAL_ID:
                    case GeneralizationEditPart.VISUAL_ID:
                    case DependencyEditPart.VISUAL_ID:
                    case DependencyBranchEditPart.VISUAL_ID:
                    case ElementImportEditPart.VISUAL_ID:
                    case PackageImportEditPart.VISUAL_ID:
                      DestroyElementRequest destroyEltReq =
                          new DestroyElementRequest(outgoingLink.getElement(), false);
                      cmd.add(new DestroyElementCommand(destroyEltReq));
                      cmd.add(
                          new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(
                              getEditingDomain(), outgoingLink));
                      break;
                  }
                }
                cmd.add(
                    new DestroyElementCommand(
                        new DestroyElementRequest(
                            getEditingDomain(), cnode.getElement(), false))); // directlyOwned: true
                // don't need explicit deletion of cnode as parent's view deletion would clean child
                // views as well
                // cmd.add(new
                // org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(),
                // cnode));
                break;
            }
          }
          break;
      }
    }
  }
 /** @generated */
 protected Command getDestroyElementCommand(DestroyElementRequest req) {
   View view = (View) getHost().getModel();
   CompositeTransactionalCommand cmd = new CompositeTransactionalCommand(getEditingDomain(), null);
   cmd.setTransactionNestingEnabled(false);
   for (Iterator it = view.getTargetEdges().iterator(); it.hasNext(); ) {
     Edge incomingLink = (Edge) it.next();
     if (CoordinationVisualIDRegistry.getVisualID(incomingLink)
         == CompositeProcessComposedOfEditPart.VISUAL_ID) {
       DestroyReferenceRequest r =
           new DestroyReferenceRequest(
               incomingLink.getSource().getElement(),
               null,
               incomingLink.getTarget().getElement(),
               false);
       cmd.add(
           new DestroyReferenceCommand(r) {
             protected CommandResult doExecuteWithResult(
                 IProgressMonitor progressMonitor, IAdaptable info) throws ExecutionException {
               EObject referencedObject = getReferencedObject();
               Resource resource = referencedObject.eResource();
               CommandResult result = super.doExecuteWithResult(progressMonitor, info);
               if (resource != null) {
                 resource.getContents().add(referencedObject);
               }
               return result;
             }
           });
       cmd.add(new DeleteCommand(getEditingDomain(), incomingLink));
       continue;
     }
     if (CoordinationVisualIDRegistry.getVisualID(incomingLink)
         == IfThenElseThenEditPart.VISUAL_ID) {
       DestroyReferenceRequest r =
           new DestroyReferenceRequest(
               incomingLink.getSource().getElement(),
               null,
               incomingLink.getTarget().getElement(),
               false);
       cmd.add(
           new DestroyReferenceCommand(r) {
             protected CommandResult doExecuteWithResult(
                 IProgressMonitor progressMonitor, IAdaptable info) throws ExecutionException {
               EObject referencedObject = getReferencedObject();
               Resource resource = referencedObject.eResource();
               CommandResult result = super.doExecuteWithResult(progressMonitor, info);
               if (resource != null) {
                 resource.getContents().add(referencedObject);
               }
               return result;
             }
           });
       cmd.add(new DeleteCommand(getEditingDomain(), incomingLink));
       continue;
     }
     if (CoordinationVisualIDRegistry.getVisualID(incomingLink)
         == IfThenElseElseEditPart.VISUAL_ID) {
       DestroyReferenceRequest r =
           new DestroyReferenceRequest(
               incomingLink.getSource().getElement(),
               null,
               incomingLink.getTarget().getElement(),
               false);
       cmd.add(
           new DestroyReferenceCommand(r) {
             protected CommandResult doExecuteWithResult(
                 IProgressMonitor progressMonitor, IAdaptable info) throws ExecutionException {
               EObject referencedObject = getReferencedObject();
               Resource resource = referencedObject.eResource();
               CommandResult result = super.doExecuteWithResult(progressMonitor, info);
               if (resource != null) {
                 resource.getContents().add(referencedObject);
               }
               return result;
             }
           });
       cmd.add(new DeleteCommand(getEditingDomain(), incomingLink));
       continue;
     }
     if (CoordinationVisualIDRegistry.getVisualID(incomingLink)
         == RepeatUntilUntilProcessEditPart.VISUAL_ID) {
       DestroyReferenceRequest r =
           new DestroyReferenceRequest(
               incomingLink.getSource().getElement(),
               null,
               incomingLink.getTarget().getElement(),
               false);
       cmd.add(
           new DestroyReferenceCommand(r) {
             protected CommandResult doExecuteWithResult(
                 IProgressMonitor progressMonitor, IAdaptable info) throws ExecutionException {
               EObject referencedObject = getReferencedObject();
               Resource resource = referencedObject.eResource();
               CommandResult result = super.doExecuteWithResult(progressMonitor, info);
               if (resource != null) {
                 resource.getContents().add(referencedObject);
               }
               return result;
             }
           });
       cmd.add(new DeleteCommand(getEditingDomain(), incomingLink));
       continue;
     }
     if (CoordinationVisualIDRegistry.getVisualID(incomingLink)
         == RepeatWhileWhileProcessEditPart.VISUAL_ID) {
       DestroyReferenceRequest r =
           new DestroyReferenceRequest(
               incomingLink.getSource().getElement(),
               null,
               incomingLink.getTarget().getElement(),
               false);
       cmd.add(
           new DestroyReferenceCommand(r) {
             protected CommandResult doExecuteWithResult(
                 IProgressMonitor progressMonitor, IAdaptable info) throws ExecutionException {
               EObject referencedObject = getReferencedObject();
               Resource resource = referencedObject.eResource();
               CommandResult result = super.doExecuteWithResult(progressMonitor, info);
               if (resource != null) {
                 resource.getContents().add(referencedObject);
               }
               return result;
             }
           });
       cmd.add(new DeleteCommand(getEditingDomain(), incomingLink));
       continue;
     }
     if (CoordinationVisualIDRegistry.getVisualID(incomingLink)
         == ControlConstructBagFirstEditPart.VISUAL_ID) {
       DestroyReferenceRequest r =
           new DestroyReferenceRequest(
               incomingLink.getSource().getElement(),
               null,
               incomingLink.getTarget().getElement(),
               false);
       cmd.add(
           new DestroyReferenceCommand(r) {
             protected CommandResult doExecuteWithResult(
                 IProgressMonitor progressMonitor, IAdaptable info) throws ExecutionException {
               EObject referencedObject = getReferencedObject();
               Resource resource = referencedObject.eResource();
               CommandResult result = super.doExecuteWithResult(progressMonitor, info);
               if (resource != null) {
                 resource.getContents().add(referencedObject);
               }
               return result;
             }
           });
       cmd.add(new DeleteCommand(getEditingDomain(), incomingLink));
       continue;
     }
     if (CoordinationVisualIDRegistry.getVisualID(incomingLink)
         == ControlConstructListFirstEditPart.VISUAL_ID) {
       DestroyReferenceRequest r =
           new DestroyReferenceRequest(
               incomingLink.getSource().getElement(),
               null,
               incomingLink.getTarget().getElement(),
               false);
       cmd.add(
           new DestroyReferenceCommand(r) {
             protected CommandResult doExecuteWithResult(
                 IProgressMonitor progressMonitor, IAdaptable info) throws ExecutionException {
               EObject referencedObject = getReferencedObject();
               Resource resource = referencedObject.eResource();
               CommandResult result = super.doExecuteWithResult(progressMonitor, info);
               if (resource != null) {
                 resource.getContents().add(referencedObject);
               }
               return result;
             }
           });
       cmd.add(new DeleteCommand(getEditingDomain(), incomingLink));
       continue;
     }
   }
   for (Iterator it = view.getSourceEdges().iterator(); it.hasNext(); ) {
     Edge outgoingLink = (Edge) it.next();
     if (CoordinationVisualIDRegistry.getVisualID(outgoingLink)
         == PerformProcessEditPart.VISUAL_ID) {
       DestroyReferenceRequest r =
           new DestroyReferenceRequest(
               outgoingLink.getSource().getElement(),
               null,
               outgoingLink.getTarget().getElement(),
               false);
       cmd.add(new DestroyReferenceCommand(r));
       cmd.add(new DeleteCommand(getEditingDomain(), outgoingLink));
       continue;
     }
     if (CoordinationVisualIDRegistry.getVisualID(outgoingLink)
         == PerformHasDataFromEditPart.VISUAL_ID) {
       DestroyReferenceRequest r =
           new DestroyReferenceRequest(
               outgoingLink.getSource().getElement(),
               null,
               outgoingLink.getTarget().getElement(),
               false);
       cmd.add(
           new DestroyReferenceCommand(r) {
             protected CommandResult doExecuteWithResult(
                 IProgressMonitor progressMonitor, IAdaptable info) throws ExecutionException {
               EObject referencedObject = getReferencedObject();
               Resource resource = referencedObject.eResource();
               CommandResult result = super.doExecuteWithResult(progressMonitor, info);
               if (resource != null) {
                 resource.getContents().add(referencedObject);
               }
               return result;
             }
           });
       cmd.add(new DeleteCommand(getEditingDomain(), outgoingLink));
       continue;
     }
   }
   EAnnotation annotation = view.getEAnnotation("Shortcut"); // $NON-NLS-1$
   if (annotation == null) {
     // there are indirectly referenced children, need extra commands: false
     addDestroyShortcutsCommand(cmd, view);
     // delete host element
     cmd.add(new DestroyElementCommand(req));
   } else {
     cmd.add(new DeleteCommand(getEditingDomain(), view));
   }
   return getGEFWrapper(cmd.reduce());
 }