/** @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 (CrystalVisualIDRegistry.getVisualID(incomingLink) == TransitionEditPart.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 (CrystalVisualIDRegistry.getVisualID(outgoingLink) == TransitionEditPart.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
     addDestroyShortcutsCommand(cmd, view);
     // delete host element
     cmd.add(new DestroyElementCommand(req));
   } else {
     cmd.add(new DeleteCommand(getEditingDomain(), view));
   }
   return getGEFWrapper(cmd.reduce());
 }
 /** @generated */
 private Collection<View> getOutgoingLinksByType(Collection<? extends View> nodes, String type) {
   LinkedList<View> result = new LinkedList<View>();
   for (View nextNode : nodes) {
     result.addAll(selectViewsByType(nextNode.getSourceEdges(), type));
   }
   return result;
 }
    /** @generated */
    private static boolean buildElement2ViewMap(
        View parentView, Map<EObject, View> element2ViewMap, Set<? extends EObject> elements) {
      if (elements.size() == element2ViewMap.size()) {
        return true;
      }

      if (parentView.isSetElement()
          && !element2ViewMap.containsKey(parentView.getElement())
          && elements.contains(parentView.getElement())) {
        element2ViewMap.put(parentView.getElement(), parentView);
        if (elements.size() == element2ViewMap.size()) {
          return true;
        }
      }
      boolean complete = false;
      for (Iterator<?> it = parentView.getChildren().iterator(); it.hasNext() && !complete; ) {
        complete = buildElement2ViewMap((View) it.next(), element2ViewMap, elements);
      }
      for (Iterator<?> it = parentView.getSourceEdges().iterator(); it.hasNext() && !complete; ) {
        complete = buildElement2ViewMap((View) it.next(), element2ViewMap, elements);
      }
      for (Iterator<?> it = parentView.getTargetEdges().iterator(); it.hasNext() && !complete; ) {
        complete = buildElement2ViewMap((View) it.next(), element2ViewMap, elements);
      }
      return complete;
    }
 /** @generated */
 private Collection collectAllLinks(View view, Map domain2NotationMap) {
   if (!ModuleEditPart.MODEL_ID.equals(AutomataVisualIDRegistry.getModelID(view))) {
     return Collections.EMPTY_LIST;
   }
   Collection result = new LinkedList();
   switch (AutomataVisualIDRegistry.getVisualID(view)) {
     case ModuleEditPart.VISUAL_ID:
       {
         if (!domain2NotationMap.containsKey(view.getElement())) {
           result.addAll(AutomataDiagramUpdater.getModule_1000ContainedLinks(view));
         }
         if (!domain2NotationMap.containsKey(view.getElement())
             || view.getEAnnotation("Shortcut") == null) { // $NON-NLS-1$
           domain2NotationMap.put(view.getElement(), view);
         }
         break;
       }
     case AutomatonEditPart.VISUAL_ID:
       {
         if (!domain2NotationMap.containsKey(view.getElement())) {
           result.addAll(AutomataDiagramUpdater.getAutomaton_1001ContainedLinks(view));
         }
         if (!domain2NotationMap.containsKey(view.getElement())
             || view.getEAnnotation("Shortcut") == null) { // $NON-NLS-1$
           domain2NotationMap.put(view.getElement(), view);
         }
         break;
       }
     case StateEditPart.VISUAL_ID:
       {
         if (!domain2NotationMap.containsKey(view.getElement())) {
           result.addAll(AutomataDiagramUpdater.getState_2001ContainedLinks(view));
         }
         if (!domain2NotationMap.containsKey(view.getElement())
             || view.getEAnnotation("Shortcut") == null) { // $NON-NLS-1$
           domain2NotationMap.put(view.getElement(), view);
         }
         break;
       }
     case TransitionEditPart.VISUAL_ID:
       {
         if (!domain2NotationMap.containsKey(view.getElement())) {
           result.addAll(AutomataDiagramUpdater.getTransition_3001ContainedLinks(view));
         }
         if (!domain2NotationMap.containsKey(view.getElement())
             || view.getEAnnotation("Shortcut") == null) { // $NON-NLS-1$
           domain2NotationMap.put(view.getElement(), view);
         }
         break;
       }
   }
   for (Iterator children = view.getChildren().iterator(); children.hasNext(); ) {
     result.addAll(collectAllLinks((View) children.next(), domain2NotationMap));
   }
   for (Iterator edges = view.getSourceEdges().iterator(); edges.hasNext(); ) {
     result.addAll(collectAllLinks((View) edges.next(), domain2NotationMap));
   }
   return result;
 }
 /**
  * Creates commands to destroy all host incoming and outgoing links.
  *
  * @generated
  */
 protected CompoundCommand getDestroyEdgesCommand() {
   CompoundCommand cmd = new CompoundCommand();
   View view = (View) getHost().getModel();
   for (Iterator it = view.getSourceEdges().iterator(); it.hasNext(); ) {
     cmd.add(getDestroyElementCommand((Edge) it.next()));
   }
   for (Iterator it = view.getTargetEdges().iterator(); it.hasNext(); ) {
     cmd.add(getDestroyElementCommand((Edge) it.next()));
   }
   return cmd;
 }
    /** @generated */
    static Map buildElement2ViewMap(View parentView, Map element2ViewMap, Set elements) {
      if (elements.size() == element2ViewMap.size()) return element2ViewMap;

      if (parentView.isSetElement()
          && !element2ViewMap.containsKey(parentView.getElement())
          && elements.contains(parentView.getElement())) {
        element2ViewMap.put(parentView.getElement(), parentView);
        if (elements.size() == element2ViewMap.size()) return element2ViewMap;
      }

      for (Iterator it = parentView.getChildren().iterator(); it.hasNext(); ) {
        buildElement2ViewMap((View) it.next(), element2ViewMap, elements);
        if (elements.size() == element2ViewMap.size()) return element2ViewMap;
      }
      for (Iterator it = parentView.getSourceEdges().iterator(); it.hasNext(); ) {
        buildElement2ViewMap((View) it.next(), element2ViewMap, elements);
        if (elements.size() == element2ViewMap.size()) return element2ViewMap;
      }
      for (Iterator it = parentView.getSourceEdges().iterator(); it.hasNext(); ) {
        buildElement2ViewMap((View) it.next(), element2ViewMap, elements);
        if (elements.size() == element2ViewMap.size()) return element2ViewMap;
      }
      return element2ViewMap;
    }
 /** @generated */
 private Collection<
         edu.toronto.cs.se.modelepedia.relationaldatabase_mavo.diagram.part
             .RelationalDatabase_MAVOLinkDescriptor>
     collectAllLinks(View view, Domain2Notation domain2NotationMap) {
   if (!edu.toronto.cs.se.modelepedia.relationaldatabase_mavo.diagram.edit.parts
       .RelationalDatabaseEditPart.MODEL_ID.equals(
       edu.toronto.cs.se.modelepedia.relationaldatabase_mavo.diagram.part
           .RelationalDatabase_MAVOVisualIDRegistry.getModelID(view))) {
     return Collections.emptyList();
   }
   LinkedList<
           edu.toronto.cs.se.modelepedia.relationaldatabase_mavo.diagram.part
               .RelationalDatabase_MAVOLinkDescriptor>
       result =
           new LinkedList<
               edu.toronto.cs.se.modelepedia.relationaldatabase_mavo.diagram.part
                   .RelationalDatabase_MAVOLinkDescriptor>();
   switch (edu.toronto.cs.se.modelepedia.relationaldatabase_mavo.diagram.part
       .RelationalDatabase_MAVOVisualIDRegistry.getVisualID(view)) {
     case edu.toronto.cs.se.modelepedia.relationaldatabase_mavo.diagram.edit.parts
         .RelationalDatabaseEditPart.VISUAL_ID:
       {
         if (!domain2NotationMap.containsKey(view.getElement())) {
           result.addAll(
               edu.toronto.cs.se.modelepedia.relationaldatabase_mavo.diagram.part
                   .RelationalDatabase_MAVODiagramUpdater.getRelationalDatabase_1000ContainedLinks(
                   view));
         }
         domain2NotationMap.putView(view.getElement(), view);
         break;
       }
     case edu.toronto.cs.se.modelepedia.relationaldatabase_mavo.diagram.edit.parts.TableEditPart
         .VISUAL_ID:
       {
         if (!domain2NotationMap.containsKey(view.getElement())) {
           result.addAll(
               edu.toronto.cs.se.modelepedia.relationaldatabase_mavo.diagram.part
                   .RelationalDatabase_MAVODiagramUpdater.getTable_2001ContainedLinks(view));
         }
         domain2NotationMap.putView(view.getElement(), view);
         break;
       }
     case edu.toronto.cs.se.modelepedia.relationaldatabase_mavo.diagram.edit.parts.ColumnEditPart
         .VISUAL_ID:
       {
         if (!domain2NotationMap.containsKey(view.getElement())) {
           result.addAll(
               edu.toronto.cs.se.modelepedia.relationaldatabase_mavo.diagram.part
                   .RelationalDatabase_MAVODiagramUpdater.getColumn_3001ContainedLinks(view));
         }
         domain2NotationMap.putView(view.getElement(), view);
         break;
       }
     case edu.toronto.cs.se.modelepedia.relationaldatabase_mavo.diagram.edit.parts
         .ForeignKeyEditPart.VISUAL_ID:
       {
         if (!domain2NotationMap.containsKey(view.getElement())) {
           result.addAll(
               edu.toronto.cs.se.modelepedia.relationaldatabase_mavo.diagram.part
                   .RelationalDatabase_MAVODiagramUpdater.getForeignKey_3002ContainedLinks(view));
         }
         domain2NotationMap.putView(view.getElement(), view);
         break;
       }
     case edu.toronto.cs.se.modelepedia.relationaldatabase_mavo.diagram.edit.parts
         .TableColumnReferenceEditPart.VISUAL_ID:
       {
         if (!domain2NotationMap.containsKey(view.getElement())) {
           result.addAll(
               edu.toronto.cs.se.modelepedia.relationaldatabase_mavo.diagram.part
                   .RelationalDatabase_MAVODiagramUpdater
                   .getTableColumnReference_4001ContainedLinks(view));
         }
         domain2NotationMap.putView(view.getElement(), view);
         break;
       }
     case edu.toronto.cs.se.modelepedia.relationaldatabase_mavo.diagram.edit.parts
         .ForeignColumnReferenceEditPart.VISUAL_ID:
       {
         if (!domain2NotationMap.containsKey(view.getElement())) {
           result.addAll(
               edu.toronto.cs.se.modelepedia.relationaldatabase_mavo.diagram.part
                   .RelationalDatabase_MAVODiagramUpdater
                   .getForeignColumnReference_4002ContainedLinks(view));
         }
         domain2NotationMap.putView(view.getElement(), view);
         break;
       }
   }
   for (Iterator children = view.getChildren().iterator(); children.hasNext(); ) {
     result.addAll(collectAllLinks((View) children.next(), domain2NotationMap));
   }
   for (Iterator edges = view.getSourceEdges().iterator(); edges.hasNext(); ) {
     result.addAll(collectAllLinks((View) edges.next(), domain2NotationMap));
   }
   return result;
 }
 /** @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 */
  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());
  }
 /** @generated */
 private Collection<
         edu.toronto.cs.se.modelepedia.classdiagram_mavo.diagram.part
             .ClassDiagram_MAVOLinkDescriptor>
     collectAllLinks(View view, Domain2Notation domain2NotationMap) {
   if (!edu.toronto.cs.se.modelepedia.classdiagram_mavo.diagram.edit.parts.ClassDiagramEditPart
       .MODEL_ID.equals(
       edu.toronto.cs.se.modelepedia.classdiagram_mavo.diagram.part
           .ClassDiagram_MAVOVisualIDRegistry.getModelID(view))) {
     return Collections.emptyList();
   }
   LinkedList<
           edu.toronto.cs.se.modelepedia.classdiagram_mavo.diagram.part
               .ClassDiagram_MAVOLinkDescriptor>
       result =
           new LinkedList<
               edu.toronto.cs.se.modelepedia.classdiagram_mavo.diagram.part
                   .ClassDiagram_MAVOLinkDescriptor>();
   switch (edu.toronto.cs.se.modelepedia.classdiagram_mavo.diagram.part
       .ClassDiagram_MAVOVisualIDRegistry.getVisualID(view)) {
     case edu.toronto.cs.se.modelepedia.classdiagram_mavo.diagram.edit.parts.ClassDiagramEditPart
         .VISUAL_ID:
       {
         if (!domain2NotationMap.containsKey(view.getElement())) {
           result.addAll(
               edu.toronto.cs.se.modelepedia.classdiagram_mavo.diagram.part
                   .ClassDiagram_MAVODiagramUpdater.getClassDiagram_1000ContainedLinks(view));
         }
         domain2NotationMap.putView(view.getElement(), view);
         break;
       }
     case edu.toronto.cs.se.modelepedia.classdiagram_mavo.diagram.edit.parts.ClassEditPart
         .VISUAL_ID:
       {
         if (!domain2NotationMap.containsKey(view.getElement())) {
           result.addAll(
               edu.toronto.cs.se.modelepedia.classdiagram_mavo.diagram.part
                   .ClassDiagram_MAVODiagramUpdater.getClass_2001ContainedLinks(view));
         }
         domain2NotationMap.putView(view.getElement(), view);
         break;
       }
     case edu.toronto.cs.se.modelepedia.classdiagram_mavo.diagram.edit.parts.AttributeEditPart
         .VISUAL_ID:
       {
         if (!domain2NotationMap.containsKey(view.getElement())) {
           result.addAll(
               edu.toronto.cs.se.modelepedia.classdiagram_mavo.diagram.part
                   .ClassDiagram_MAVODiagramUpdater.getAttribute_3001ContainedLinks(view));
         }
         domain2NotationMap.putView(view.getElement(), view);
         break;
       }
     case edu.toronto.cs.se.modelepedia.classdiagram_mavo.diagram.edit.parts.OperationEditPart
         .VISUAL_ID:
       {
         if (!domain2NotationMap.containsKey(view.getElement())) {
           result.addAll(
               edu.toronto.cs.se.modelepedia.classdiagram_mavo.diagram.part
                   .ClassDiagram_MAVODiagramUpdater.getOperation_3002ContainedLinks(view));
         }
         domain2NotationMap.putView(view.getElement(), view);
         break;
       }
     case edu.toronto.cs.se.modelepedia.classdiagram_mavo.diagram.edit.parts.AssociationEditPart
         .VISUAL_ID:
       {
         if (!domain2NotationMap.containsKey(view.getElement())) {
           result.addAll(
               edu.toronto.cs.se.modelepedia.classdiagram_mavo.diagram.part
                   .ClassDiagram_MAVODiagramUpdater.getAssociation_4001ContainedLinks(view));
         }
         domain2NotationMap.putView(view.getElement(), view);
         break;
       }
     case edu.toronto.cs.se.modelepedia.classdiagram_mavo.diagram.edit.parts
         .NestedInReferenceEditPart.VISUAL_ID:
       {
         if (!domain2NotationMap.containsKey(view.getElement())) {
           result.addAll(
               edu.toronto.cs.se.modelepedia.classdiagram_mavo.diagram.part
                   .ClassDiagram_MAVODiagramUpdater.getNestedInReference_4002ContainedLinks(view));
         }
         domain2NotationMap.putView(view.getElement(), view);
         break;
       }
     case edu.toronto.cs.se.modelepedia.classdiagram_mavo.diagram.edit.parts
         .SuperclassReferenceEditPart.VISUAL_ID:
       {
         if (!domain2NotationMap.containsKey(view.getElement())) {
           result.addAll(
               edu.toronto.cs.se.modelepedia.classdiagram_mavo.diagram.part
                   .ClassDiagram_MAVODiagramUpdater.getSuperclassReference_4003ContainedLinks(
                   view));
         }
         domain2NotationMap.putView(view.getElement(), view);
         break;
       }
     case edu.toronto.cs.se.modelepedia.classdiagram_mavo.diagram.edit.parts.DependencyEditPart
         .VISUAL_ID:
       {
         if (!domain2NotationMap.containsKey(view.getElement())) {
           result.addAll(
               edu.toronto.cs.se.modelepedia.classdiagram_mavo.diagram.part
                   .ClassDiagram_MAVODiagramUpdater.getDependency_4004ContainedLinks(view));
         }
         domain2NotationMap.putView(view.getElement(), view);
         break;
       }
   }
   for (Iterator children = view.getChildren().iterator(); children.hasNext(); ) {
     result.addAll(collectAllLinks((View) children.next(), domain2NotationMap));
   }
   for (Iterator edges = view.getSourceEdges().iterator(); edges.hasNext(); ) {
     result.addAll(collectAllLinks((View) edges.next(), domain2NotationMap));
   }
   return result;
 }
 /** @generated */
 private Collection<TaiPanLinkDescriptor> collectAllLinks(
     View view, Domain2Notation domain2NotationMap) {
   if (!AquatoryEditPart.MODEL_ID.equals(TaiPanVisualIDRegistry.getModelID(view))) {
     return Collections.emptyList();
   }
   LinkedList<TaiPanLinkDescriptor> result = new LinkedList<TaiPanLinkDescriptor>();
   switch (TaiPanVisualIDRegistry.getVisualID(view)) {
     case AquatoryEditPart.VISUAL_ID:
       {
         if (!domain2NotationMap.containsKey(view.getElement())) {
           result.addAll(TaiPanDiagramUpdater.getAquatory_1000ContainedLinks(view));
         }
         domain2NotationMap.putView(view.getElement(), view);
         break;
       }
     case PortEditPart.VISUAL_ID:
       {
         if (!domain2NotationMap.containsKey(view.getElement())) {
           result.addAll(TaiPanDiagramUpdater.getPort_2001ContainedLinks(view));
         }
         domain2NotationMap.putView(view.getElement(), view);
         break;
       }
     case ShipEditPart.VISUAL_ID:
       {
         if (!domain2NotationMap.containsKey(view.getElement())) {
           result.addAll(TaiPanDiagramUpdater.getShip_2002ContainedLinks(view));
         }
         domain2NotationMap.putView(view.getElement(), view);
         break;
       }
     case WarshipEditPart.VISUAL_ID:
       {
         if (!domain2NotationMap.containsKey(view.getElement())) {
           result.addAll(TaiPanDiagramUpdater.getWarship_2003ContainedLinks(view));
         }
         domain2NotationMap.putView(view.getElement(), view);
         break;
       }
     case LargeItemEditPart.VISUAL_ID:
       {
         if (!domain2NotationMap.containsKey(view.getElement())) {
           result.addAll(TaiPanDiagramUpdater.getLargeItem_3002ContainedLinks(view));
         }
         domain2NotationMap.putView(view.getElement(), view);
         break;
       }
     case EmptyBoxEditPart.VISUAL_ID:
       {
         if (!domain2NotationMap.containsKey(view.getElement())) {
           result.addAll(TaiPanDiagramUpdater.getEmptyBox_3003ContainedLinks(view));
         }
         domain2NotationMap.putView(view.getElement(), view);
         break;
       }
     case ReliableRouteEditPart.VISUAL_ID:
       {
         if (!domain2NotationMap.containsKey(view.getElement())) {
           result.addAll(TaiPanDiagramUpdater.getRoute_4002ContainedLinks(view));
         }
         domain2NotationMap.putView(view.getElement(), view);
         break;
       }
     case UnreliableRouteEditPart.VISUAL_ID:
       {
         if (!domain2NotationMap.containsKey(view.getElement())) {
           result.addAll(TaiPanDiagramUpdater.getRoute_4003ContainedLinks(view));
         }
         domain2NotationMap.putView(view.getElement(), view);
         break;
       }
     case BesiegePortOrderEditPart.VISUAL_ID:
       {
         if (!domain2NotationMap.containsKey(view.getElement())) {
           result.addAll(TaiPanDiagramUpdater.getBesiegePortOrder_4005ContainedLinks(view));
         }
         domain2NotationMap.putView(view.getElement(), view);
         break;
       }
     case EscortShipsOrderEditPart.VISUAL_ID:
       {
         if (!domain2NotationMap.containsKey(view.getElement())) {
           result.addAll(TaiPanDiagramUpdater.getEscortShipsOrder_4006ContainedLinks(view));
         }
         domain2NotationMap.putView(view.getElement(), view);
         break;
       }
   }
   for (Iterator children = view.getChildren().iterator(); children.hasNext(); ) {
     result.addAll(collectAllLinks((View) children.next(), domain2NotationMap));
   }
   for (Iterator edges = view.getSourceEdges().iterator(); edges.hasNext(); ) {
     result.addAll(collectAllLinks((View) edges.next(), domain2NotationMap));
   }
   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 (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());
 }