/** @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;
 }
 /**
  * Clean all shortcuts to the host element from the same diagram
  *
  * @generated
  */
 protected void addDestroyShortcutsCommand(ICompositeCommand cmd, View view) {
   assert view.getEAnnotation("Shortcut") == null; // $NON-NLS-1$
   for (Iterator it = view.getDiagram().getChildren().iterator(); it.hasNext(); ) {
     View nextView = (View) it.next();
     if (nextView.getEAnnotation("Shortcut") == null
         || !nextView.isSetElement()
         || nextView.getElement() != view.getElement()) { // $NON-NLS-1$
       continue;
     }
     cmd.add(new DeleteCommand(getEditingDomain(), nextView));
   }
 }
 /** @generated */
 protected void addDestroyShortcutsCommand(CompoundCommand command) {
   View view = (View) getHost().getModel();
   if (view.getEAnnotation("Shortcut") != null) { // $NON-NLS-1$
     return;
   }
   for (Iterator it = view.getDiagram().getChildren().iterator(); it.hasNext(); ) {
     View nextView = (View) it.next();
     if (nextView.getEAnnotation("Shortcut") == null
         || !nextView.isSetElement()
         || nextView.getElement() != view.getElement()) { // $NON-NLS-1$
       continue;
     }
     command.add(getDestroyElementCommand(nextView));
   }
 }
 /** @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 */
 protected Command getDestroyElementCommand(DestroyElementRequest req) {
   CompoundCommand cc = getDestroyEdgesCommand();
   addDestroyShortcutsCommand(cc);
   View view = (View) getHost().getModel();
   if (view.getEAnnotation("Shortcut") != null) { // $NON-NLS-1$
     req.setElementToDestroy(view);
   }
   cc.add(getGEFWrapper(new DestroyElementCommand(req)));
   return cc.unwrap();
 }
 /** @generated */
 public void createDecorators(IDecoratorTarget decoratorTarget) {
   View view = (View) decoratorTarget.getAdapter(View.class);
   if (view != null) {
     EAnnotation annotation = view.getEAnnotation("Shortcut"); // $NON-NLS-1$
     if (annotation != null) {
       decoratorTarget.installDecorator(
           SHORTCUTS_DECORATOR_ID, new ShortcutsDecorator(decoratorTarget));
     }
   }
 }
 /** @generated */
 private Collection<stateAnalysis.diagram.navigator.StateAnalysisNavigatorItem>
     getForeignShortcuts(Diagram diagram, Object parent) {
   LinkedList<View> result = new LinkedList<View>();
   for (Iterator<View> it = diagram.getChildren().iterator(); it.hasNext(); ) {
     View nextView = it.next();
     if (!isOwnView(nextView) && nextView.getEAnnotation("Shortcut") != null) { // $NON-NLS-1$
       result.add(nextView);
     }
   }
   return createNavigatorItems(result, parent, false);
 }
 /** @generated */
 public static String getModelID(View view) {
   View diagram = view.getDiagram();
   while (view != diagram) {
     EAnnotation annotation = view.getEAnnotation("Shortcut"); // $NON-NLS-1$
     if (annotation != null) {
       return (String) annotation.getDetails().get("modelID"); // $NON-NLS-1$
     }
     view = (View) view.eContainer();
   }
   return diagram != null ? diagram.getType() : null;
 }
 public String getArrowDirection() {
   View view = this.getNotationView();
   if (view == null) return "";
   EAnnotation ea = view.getEAnnotation(ARROW);
   if (ea != null) {
     String pos = ea.getDetails().get(DIRECTION);
     if (pos != null) {
       return pos;
     }
   }
   return VERTICAL;
 }
Exemplo n.º 10
0
  protected void handleCustomStyle(
      View view,
      String cssProperty,
      String eAnnotationName,
      Map<Declaration, Boolean> result,
      Expression value) {
    Declaration cssDeclaration = CssFactory.eINSTANCE.createDeclaration();
    cssDeclaration.setProperty(cssProperty);
    cssDeclaration.setExpression(value);

    boolean check = view.getEAnnotation(eAnnotationName) != null;
    result.put(cssDeclaration, check);
  }
 /** @generated */
 protected boolean isOrphaned(Collection semanticChildren, final View view) {
   if (view.getEAnnotation("Shortcut") != null) { // $NON-NLS-1$
     return TaiPanDiagramUpdater.isShortcutOrphaned(view);
   }
   int visualID = TaiPanVisualIDRegistry.getVisualID(view);
   switch (visualID) {
     case PortEditPart.VISUAL_ID:
     case ShipEditPart.VISUAL_ID:
     case WarshipEditPart.VISUAL_ID:
       if (!semanticChildren.contains(view.getElement())) {
         return true;
       }
   }
   return false;
 }
 /** @generated */
 protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info)
     throws ExecutionException {
   for (Iterator it = myDescriptors.iterator(); it.hasNext(); ) {
     CreateViewRequest.ViewDescriptor nextDescriptor =
         (CreateViewRequest.ViewDescriptor) it.next();
     View view = (View) nextDescriptor.getAdapter(View.class);
     if (view != null && view.getEAnnotation("Shortcut") == null) { // $NON-NLS-1$
       EAnnotation shortcutAnnotation = EcoreFactory.eINSTANCE.createEAnnotation();
       shortcutAnnotation.setSource("Shortcut"); // $NON-NLS-1$
       shortcutAnnotation.getDetails().put("modelID", IStarEditPart.MODEL_ID); // $NON-NLS-1$
       view.getEAnnotations().add(shortcutAnnotation);
     }
   }
   return CommandResult.newOKCommandResult();
 }
  public void setArrowDirection(String dir) {
    View view = this.getNotationView();
    if (view == null) return;

    EAnnotation ea = view.getEAnnotation(ARROW);
    if (ea == null) {
      ea = EcoreFactory.eINSTANCE.createEAnnotation();
      ea.setSource(ARROW);
      ea.getDetails().put(DIRECTION, dir);
      view.getEAnnotations().add(ea);
    } else {
      ea.getDetails().clear();
      ea.getDetails().put(DIRECTION, dir);
    }
  }
 /** @generated */
 protected Command getDestroyElementCommand(DestroyElementRequest req) {
   View view = (View) getHost().getModel();
   CompositeTransactionalCommand cmd = new CompositeTransactionalCommand(getEditingDomain(), null);
   cmd.setTransactionNestingEnabled(false);
   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 */
 protected void addDestroyChildNodesCommand(CompoundCommand cmd) {
   View view = (View) getHost().getModel();
   EAnnotation annotation = view.getEAnnotation("Shortcut"); // $NON-NLS-1$
   if (annotation != null) {
     return;
   }
   for (Iterator it = view.getChildren().iterator(); it.hasNext(); ) {
     Node node = (Node) it.next();
     switch (hub.top.adaptiveSystem.diagram.part.AdaptiveSystemVisualIDRegistry.getVisualID(
         node)) {
       case hub.top.adaptiveSystem.diagram.edit.parts.PreNetEditPart.VISUAL_ID:
         cmd.add(getDestroyElementCommand(node));
         break;
       case hub.top.adaptiveSystem.diagram.edit.parts.DoNetEditPart.VISUAL_ID:
         cmd.add(getDestroyElementCommand(node));
         break;
     }
   }
 }
 /** @generated */
 protected Command getDestroyElementCommand(DestroyElementRequest req) {
   View view = (View) getHost().getModel();
   CompositeTransactionalCommand cmd = new CompositeTransactionalCommand(getEditingDomain(), null);
   cmd.setTransactionNestingEnabled(true);
   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
     List<EObject> todestroy = new ArrayList<EObject>();
     todestroy.add(req.getElementToDestroy());
     // cmd.add(new org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand(req));
     cmd.add(new EMFtoGMFCommandWrapper(new DeleteCommand(getEditingDomain(), todestroy)));
   } else {
     cmd.add(
         new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(
             getEditingDomain(), view));
   }
   return getGEFWrapper(cmd.reduce());
 }
 /** @generated */
 protected void addDestroyChildNodesCommand(CompoundCommand cmd) {
   View view = (View) getHost().getModel();
   EAnnotation annotation = view.getEAnnotation("Shortcut"); // $NON-NLS-1$
   if (annotation != null) {
     return;
   }
   for (Iterator it = view.getChildren().iterator(); it.hasNext(); ) {
     Node node = (Node) it.next();
     switch (AutomataVisualIDRegistry.getVisualID(node)) {
       case AutomatonCompartmentEditPart.VISUAL_ID:
         for (Iterator cit = node.getChildren().iterator(); cit.hasNext(); ) {
           Node cnode = (Node) cit.next();
           switch (AutomataVisualIDRegistry.getVisualID(cnode)) {
             case StateEditPart.VISUAL_ID:
               cmd.add(getDestroyElementCommand(cnode));
               break;
           }
         }
         break;
     }
   }
 }
 /** @return a list of selected objects view */
 protected List<View> getSelection() {
   List<View> viewSelected = new ArrayList<View>();
   IWorkbenchWindow activeWorkbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
   if (activeWorkbenchWindow != null) {
     ISelection selection = activeWorkbenchWindow.getSelectionService().getSelection();
     if (false == selection instanceof IStructuredSelection) {
       return Collections.emptyList();
     }
     for (Object object : ((IStructuredSelection) selection).toList()) {
       if (false == object instanceof IGraphicalEditPart) {
         continue;
       }
       if (object instanceof DiagramEditPart) {
         continue;
       }
       View view = ((IGraphicalEditPart) object).getNotationView();
       if (view.getEAnnotation("Shortcut") != null) {
         continue;
       }
       viewSelected.add(view);
     }
   }
   return viewSelected;
 }
 /** @generated */
 private Collection collectAllLinks(View view, Map domain2NotationMap) {
   if (!AquatoryEditPart.MODEL_ID.equals(TaiPanVisualIDRegistry.getModelID(view))) {
     return Collections.EMPTY_LIST;
   }
   Collection result = new LinkedList();
   switch (TaiPanVisualIDRegistry.getVisualID(view)) {
     case AquatoryEditPart.VISUAL_ID:
       {
         if (!domain2NotationMap.containsKey(view.getElement())) {
           result.addAll(TaiPanDiagramUpdater.getAquatory_1000ContainedLinks(view));
         }
         if (!domain2NotationMap.containsKey(view.getElement())
             || view.getEAnnotation("Shortcut") == null) { // $NON-NLS-1$
           domain2NotationMap.put(view.getElement(), view);
         }
         break;
       }
     case PortEditPart.VISUAL_ID:
       {
         if (!domain2NotationMap.containsKey(view.getElement())) {
           result.addAll(TaiPanDiagramUpdater.getPort_2001ContainedLinks(view));
         }
         if (!domain2NotationMap.containsKey(view.getElement())
             || view.getEAnnotation("Shortcut") == null) { // $NON-NLS-1$
           domain2NotationMap.put(view.getElement(), view);
         }
         break;
       }
     case ShipEditPart.VISUAL_ID:
       {
         if (!domain2NotationMap.containsKey(view.getElement())) {
           result.addAll(TaiPanDiagramUpdater.getShip_2002ContainedLinks(view));
         }
         if (!domain2NotationMap.containsKey(view.getElement())
             || view.getEAnnotation("Shortcut") == null) { // $NON-NLS-1$
           domain2NotationMap.put(view.getElement(), view);
         }
         break;
       }
     case WarshipEditPart.VISUAL_ID:
       {
         if (!domain2NotationMap.containsKey(view.getElement())) {
           result.addAll(TaiPanDiagramUpdater.getWarship_2003ContainedLinks(view));
         }
         if (!domain2NotationMap.containsKey(view.getElement())
             || view.getEAnnotation("Shortcut") == null) { // $NON-NLS-1$
           domain2NotationMap.put(view.getElement(), view);
         }
         break;
       }
     case LargeItemEditPart.VISUAL_ID:
       {
         if (!domain2NotationMap.containsKey(view.getElement())) {
           result.addAll(TaiPanDiagramUpdater.getLargeItem_3002ContainedLinks(view));
         }
         if (!domain2NotationMap.containsKey(view.getElement())
             || view.getEAnnotation("Shortcut") == null) { // $NON-NLS-1$
           domain2NotationMap.put(view.getElement(), view);
         }
         break;
       }
     case EmptyBoxEditPart.VISUAL_ID:
       {
         if (!domain2NotationMap.containsKey(view.getElement())) {
           result.addAll(TaiPanDiagramUpdater.getEmptyBox_3003ContainedLinks(view));
         }
         if (!domain2NotationMap.containsKey(view.getElement())
             || view.getEAnnotation("Shortcut") == null) { // $NON-NLS-1$
           domain2NotationMap.put(view.getElement(), view);
         }
         break;
       }
     case ReliableRouteEditPart.VISUAL_ID:
       {
         if (!domain2NotationMap.containsKey(view.getElement())) {
           result.addAll(TaiPanDiagramUpdater.getRoute_4002ContainedLinks(view));
         }
         if (!domain2NotationMap.containsKey(view.getElement())
             || view.getEAnnotation("Shortcut") == null) { // $NON-NLS-1$
           domain2NotationMap.put(view.getElement(), view);
         }
         break;
       }
     case UnreliableRouteEditPart.VISUAL_ID:
       {
         if (!domain2NotationMap.containsKey(view.getElement())) {
           result.addAll(TaiPanDiagramUpdater.getRoute_4003ContainedLinks(view));
         }
         if (!domain2NotationMap.containsKey(view.getElement())
             || view.getEAnnotation("Shortcut") == null) { // $NON-NLS-1$
           domain2NotationMap.put(view.getElement(), view);
         }
         break;
       }
     case BesiegePortOrderEditPart.VISUAL_ID:
       {
         if (!domain2NotationMap.containsKey(view.getElement())) {
           result.addAll(TaiPanDiagramUpdater.getBesiegePortOrder_4005ContainedLinks(view));
         }
         if (!domain2NotationMap.containsKey(view.getElement())
             || view.getEAnnotation("Shortcut") == null) { // $NON-NLS-1$
           domain2NotationMap.put(view.getElement(), view);
         }
         break;
       }
     case EscortShipsOrderEditPart.VISUAL_ID:
       {
         if (!domain2NotationMap.containsKey(view.getElement())) {
           result.addAll(TaiPanDiagramUpdater.getEscortShipsOrder_4006ContainedLinks(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;
 }
 /** @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());
 }
  /** @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 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 static boolean isShortcut(View view) {
   return view.getEAnnotation("Shortcut") != null; // $NON-NLS-1$
 }