/** @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;
     }
   }
 }
 /** @generated */
 private Node createCompartment(
     View owner,
     String hint,
     boolean canCollapse,
     boolean hasTitle,
     boolean canSort,
     boolean canFilter) {
   // SemanticListCompartment rv = NotationFactory.eINSTANCE.createSemanticListCompartment();
   // rv.setShowTitle(showTitle);
   // rv.setCollapsed(isCollapsed);
   Node rv;
   if (canCollapse) {
     rv = NotationFactory.eINSTANCE.createBasicCompartment();
   } else {
     rv = NotationFactory.eINSTANCE.createDecorationNode();
   }
   if (hasTitle) {
     TitleStyle ts = NotationFactory.eINSTANCE.createTitleStyle();
     ts.setShowTitle(true);
     rv.getStyles().add(ts);
   }
   if (canSort) {
     rv.getStyles().add(NotationFactory.eINSTANCE.createSortingStyle());
   }
   if (canFilter) {
     rv.getStyles().add(NotationFactory.eINSTANCE.createFilteringStyle());
   }
   rv.setType(hint);
   ViewUtil.insertChildView(owner, rv, ViewUtil.APPEND, true);
   return rv;
 }
 /** Refreshes the stereotype display */
 protected void refreshAppliedStereotypesPropertiesInCompartment(
     String stereotypesPropertiesToDisplay, IPapyrusNodeUMLElementFigure figure) {
   final boolean displayInCompartment =
       AppliedStereotypeHelper.hasAppliedStereotypesPropertiesToDisplay(
           (View) (View) getHost().getModel(),
           UMLVisualInformationPapyrusConstant.STEREOTYPE_COMPARTMENT_LOCATION);
   // if the string is not empty, then, the figure has to display it. Else,
   // it displays nothing
   final GraphicalEditPart editPart = (GraphicalEditPart) getHost();
   final View node = editPart.getNotationView();
   int i = 0;
   // we go through all sub nodes
   while (i < node.getChildren().size()) {
     if ((node.getChildren().get(i)) instanceof Node) {
       final Node currentNode = (Node) (node.getChildren().get(i));
       if (currentNode.getType().equals(AppliedStereotypeConpartmentEditPart.ID)) {
         EObject stereotypeApplication = currentNode.getElement();
         Stereotype stereotype = UMLUtil.getStereotype(stereotypeApplication);
         if (stereotype != null
             && stereotypesPropertiesToDisplay.contains(stereotype.getQualifiedName())) {
           setVisivility(currentNode, displayInCompartment);
         } else {
           setVisivility(currentNode, false);
         }
       }
     }
     i++;
   }
 }
  /** @generated */
  public Edge createAssociation_4001(
      EObject domainElement,
      View containerView,
      int index,
      boolean persisted,
      PreferencesHint preferencesHint) {
    Connector edge = NotationFactory.eINSTANCE.createConnector();
    edge.getStyles().add(NotationFactory.eINSTANCE.createFontStyle());
    RelativeBendpoints bendpoints = NotationFactory.eINSTANCE.createRelativeBendpoints();
    ArrayList<RelativeBendpoint> points = new ArrayList<RelativeBendpoint>(2);
    points.add(new RelativeBendpoint());
    points.add(new RelativeBendpoint());
    bendpoints.setPoints(points);
    edge.setBendpoints(bendpoints);
    ViewUtil.insertChildView(containerView, edge, index, persisted);
    edge.setType(
        edu.toronto.cs.se.modelepedia.necsis14_classdiagram.diagram.part
            .NECSIS14_ClassDiagramVisualIDRegistry.getType(
            edu.toronto.cs.se.modelepedia.necsis14_classdiagram.diagram.edit.parts
                .AssociationEditPart.VISUAL_ID));
    edge.setElement(domainElement);
    // initializePreferences
    final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();

    org.eclipse.swt.graphics.RGB lineRGB =
        PreferenceConverter.getColor(prefStore, IPreferenceConstants.PREF_LINE_COLOR);
    ViewUtil.setStructuralFeatureValue(
        edge,
        NotationPackage.eINSTANCE.getLineStyle_LineColor(),
        FigureUtilities.RGBToInteger(lineRGB));
    FontStyle edgeFontStyle = (FontStyle) edge.getStyle(NotationPackage.Literals.FONT_STYLE);
    if (edgeFontStyle != null) {
      FontData fontData =
          PreferenceConverter.getFontData(prefStore, IPreferenceConstants.PREF_DEFAULT_FONT);
      edgeFontStyle.setFontName(fontData.getName());
      edgeFontStyle.setFontHeight(fontData.getHeight());
      edgeFontStyle.setBold((fontData.getStyle() & SWT.BOLD) != 0);
      edgeFontStyle.setItalic((fontData.getStyle() & SWT.ITALIC) != 0);
      org.eclipse.swt.graphics.RGB fontRGB =
          PreferenceConverter.getColor(prefStore, IPreferenceConstants.PREF_FONT_COLOR);
      edgeFontStyle.setFontColor(FigureUtilities.RGBToInteger(fontRGB).intValue());
    }
    Routing routing = Routing.get(prefStore.getInt(IPreferenceConstants.PREF_LINE_STYLE));
    if (routing != null) {
      ViewUtil.setStructuralFeatureValue(
          edge, NotationPackage.eINSTANCE.getRoutingStyle_Routing(), routing);
    }
    Node label6001 =
        createLabel(
            edge,
            edu.toronto.cs.se.modelepedia.necsis14_classdiagram.diagram.part
                .NECSIS14_ClassDiagramVisualIDRegistry.getType(
                edu.toronto.cs.se.modelepedia.necsis14_classdiagram.diagram.edit.parts
                    .AssociationNameEditPart.VISUAL_ID));
    label6001.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
    Location location6001 = (Location) label6001.getLayoutConstraint();
    location6001.setX(0);
    location6001.setY(40);
    return edge;
  }
 /** @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 PackageImportsEditPart.VISUAL_ID:
         for (Iterator<?> cit = node.getChildren().iterator(); cit.hasNext(); ) {
           Node cnode = (Node) cit.next();
           switch (UMLVisualIDRegistry.getVisualID(cnode)) {
             case ElementImportEditPart.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;
     }
   }
 }
Beispiel #6
0
 /**
  * Tests if the node is an inherited element
  *
  * @param node a node
  * @return <code>true</code> if the node is an inherited element <code>false</code> if not
  */
 protected boolean isInherited(Node node) {
   EObject element = node.getElement();
   if (element instanceof Element) {
     EObject container = node.eContainer();
     EObject graphicalParent = null;
     if (container instanceof DecorationNode) {
       graphicalParent = ((DecorationNode) container).getElement();
     } else if (container instanceof View) {
       graphicalParent = ((View) container).getElement();
     }
     if (graphicalParent instanceof Property || graphicalParent instanceof Classifier) {
       Classifier classifier = null;
       if (graphicalParent instanceof Property) {
         Type type = ((Property) graphicalParent).getType();
         if (type instanceof Classifier) {
           classifier = (Classifier) type;
         }
       } else {
         classifier = (Classifier) graphicalParent;
       }
       if (classifier != null) {
         EList<NamedElement> inheritedMembers = classifier.getInheritedMembers();
         return inheritedMembers.contains(element);
       }
     }
   }
   return false;
 }
 private void checkStyleBeforeCustom(SWTBotGefEditPart botGefEditPart) {
   EditPart editPart = botGefEditPart.part();
   Node model = (Node) editPart.getModel();
   ShapeStyle shapeStyle = (ShapeStyle) model.getStyles().get(0);
   assertEquals("Wrong expected fill color.", EXPECTED_FILL_COLOR, shapeStyle.getFillColor());
   assertEquals("Wrong expected font height", EXPECTED_FONT_HEIGHT, shapeStyle.getFontHeight());
   assertEquals("Wrong expected font color", EXPECTED_FONT_COLOR, shapeStyle.getFontColor());
   assertEquals("Wrong expected line color", EXPECTED_LINE_COLOR, shapeStyle.getLineColor());
 }
 /*
  * (non-Javadoc)
  *
  * @see org.eclipse.papyrus.layout.LayouttoolInterface#getBounds(org.eclipse.gef.EditPart)
  */
 public Rectangle getBounds(EditPart element) {
   if (element.getModel() instanceof Node) {
     Node node = (Node) element.getModel();
     if (node.getLayoutConstraint() instanceof Bounds) {
       Bounds bounds = (Bounds) node.getLayoutConstraint();
       return new Rectangle(bounds.getX(), bounds.getY(), bounds.getWidth(), bounds.getHeight());
     }
   }
   return null;
 }
 /** @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 (MappingVisualIDRegistry.getVisualID(node)) {
       case CompositeActionCompositeActionCompartmentEditPart.VISUAL_ID:
         for (Iterator cit = node.getChildren().iterator(); cit.hasNext(); ) {
           Node cnode = (Node) cit.next();
           switch (MappingVisualIDRegistry.getVisualID(cnode)) {
           }
         }
         break;
     }
   }
 }
  /**
   * initialize label location.
   *
   * @param view the element to initialize
   * @param store the preference store
   * @param elementName the name to the element
   */
  public static void initLabelLocationFromPrefs(
      View view, final IPreferenceStore store, String elementName) {
    assert (view instanceof Node);

    Node label = (Node) view;
    Location location = (Location) label.getLayoutConstraint();

    String xKey = getpreferenceKey(view, elementName, PreferenceConstantHelper.LOCATION_X);
    String yKey = getpreferenceKey(view, elementName, PreferenceConstantHelper.LOCATION_Y);

    location.setX(store.getInt(xKey));
    location.setY(store.getInt(yKey));

    label.setLayoutConstraint(location);
  }
Beispiel #11
0
  /** @generated */
  public Node createStakeHolder_2011(
      EObject domainElement,
      View containerView,
      int index,
      boolean persisted,
      PreferencesHint preferencesHint) {
    Shape node = NotationFactory.eINSTANCE.createShape();
    node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
    node.setType(RdalVisualIDRegistry.getType(StakeHolderEditPart.VISUAL_ID));
    ViewUtil.insertChildView(containerView, node, index, persisted);
    node.setElement(domainElement);
    stampShortcut(containerView, node);
    // initializeFromPreferences
    final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();

    org.eclipse.swt.graphics.RGB lineRGB =
        PreferenceConverter.getColor(prefStore, IPreferenceConstants.PREF_LINE_COLOR);
    ViewUtil.setStructuralFeatureValue(
        node,
        NotationPackage.eINSTANCE.getLineStyle_LineColor(),
        FigureUtilities.RGBToInteger(lineRGB));
    FontStyle nodeFontStyle = (FontStyle) node.getStyle(NotationPackage.Literals.FONT_STYLE);
    if (nodeFontStyle != null) {
      FontData fontData =
          PreferenceConverter.getFontData(prefStore, IPreferenceConstants.PREF_DEFAULT_FONT);
      nodeFontStyle.setFontName(fontData.getName());
      nodeFontStyle.setFontHeight(fontData.getHeight());
      nodeFontStyle.setBold((fontData.getStyle() & SWT.BOLD) != 0);
      nodeFontStyle.setItalic((fontData.getStyle() & SWT.ITALIC) != 0);
      org.eclipse.swt.graphics.RGB fontRGB =
          PreferenceConverter.getColor(prefStore, IPreferenceConstants.PREF_FONT_COLOR);
      nodeFontStyle.setFontColor(FigureUtilities.RGBToInteger(fontRGB).intValue());
    }
    org.eclipse.swt.graphics.RGB fillRGB =
        PreferenceConverter.getColor(prefStore, IPreferenceConstants.PREF_FILL_COLOR);
    ViewUtil.setStructuralFeatureValue(
        node,
        NotationPackage.eINSTANCE.getFillStyle_FillColor(),
        FigureUtilities.RGBToInteger(fillRGB));
    Node label5018 =
        createLabel(node, RdalVisualIDRegistry.getType(StakeHolderNameEditPart.VISUAL_ID));
    label5018.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
    Location location5018 = (Location) label5018.getLayoutConstraint();
    location5018.setX(0);
    location5018.setY(5);
    return node;
  }
 /** @generated */
 private void stampShortcut(View containerView, Node target) {
   if (!SchemaEditPart.MODEL_ID.equals(SqlmodelVisualIDRegistry.getModelID(containerView))) {
     EAnnotation shortcutAnnotation = EcoreFactory.eINSTANCE.createEAnnotation();
     shortcutAnnotation.setSource("Shortcut"); // $NON-NLS-1$
     shortcutAnnotation.getDetails().put("modelID", SchemaEditPart.MODEL_ID); // $NON-NLS-1$
     target.getEAnnotations().add(shortcutAnnotation);
   }
 }
 /** @generated */
 public Edge createForeignKey_3001(
     EObject domainElement,
     View containerView,
     int index,
     boolean persisted,
     PreferencesHint preferencesHint) {
   Edge edge = NotationFactory.eINSTANCE.createEdge();
   edge.getStyles().add(NotationFactory.eINSTANCE.createRoutingStyle());
   edge.getStyles().add(NotationFactory.eINSTANCE.createFontStyle());
   RelativeBendpoints bendpoints = NotationFactory.eINSTANCE.createRelativeBendpoints();
   ArrayList points = new ArrayList(2);
   points.add(new RelativeBendpoint());
   points.add(new RelativeBendpoint());
   bendpoints.setPoints(points);
   edge.setBendpoints(bendpoints);
   ViewUtil.insertChildView(containerView, edge, index, persisted);
   edge.setType(SqlmodelVisualIDRegistry.getType(ForeignKeyEditPart.VISUAL_ID));
   edge.setElement(domainElement);
   // initializePreferences
   final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
   FontStyle edgeFontStyle = (FontStyle) edge.getStyle(NotationPackage.Literals.FONT_STYLE);
   if (edgeFontStyle != null) {
     FontData fontData =
         PreferenceConverter.getFontData(prefStore, IPreferenceConstants.PREF_DEFAULT_FONT);
     edgeFontStyle.setFontName(fontData.getName());
     edgeFontStyle.setFontHeight(fontData.getHeight());
     edgeFontStyle.setBold((fontData.getStyle() & SWT.BOLD) != 0);
     edgeFontStyle.setItalic((fontData.getStyle() & SWT.ITALIC) != 0);
     org.eclipse.swt.graphics.RGB fontRGB =
         PreferenceConverter.getColor(prefStore, IPreferenceConstants.PREF_FONT_COLOR);
     edgeFontStyle.setFontColor(FigureUtilities.RGBToInteger(fontRGB).intValue());
   }
   Routing routing = Routing.get(prefStore.getInt(IPreferenceConstants.PREF_LINE_STYLE));
   if (routing != null) {
     ViewUtil.setStructuralFeatureValue(
         edge, NotationPackage.eINSTANCE.getRoutingStyle_Routing(), routing);
   }
   Node label4003 =
       createLabel(edge, SqlmodelVisualIDRegistry.getType(ForeignKeyNameEditPart.VISUAL_ID));
   label4003.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
   Location location4003 = (Location) label4003.getLayoutConstraint();
   location4003.setX(1);
   location4003.setY(-15);
   return edge;
 }
  /** @generated */
  public Node createViewTable_1002(
      EObject domainElement,
      View containerView,
      int index,
      boolean persisted,
      PreferencesHint preferencesHint) {
    Node node = NotationFactory.eINSTANCE.createNode();
    node.getStyles().add(NotationFactory.eINSTANCE.createDescriptionStyle());
    node.getStyles().add(NotationFactory.eINSTANCE.createFontStyle());

    FillStyle fillStyle = NotationFactory.eINSTANCE.createFillStyle();
    Color color = ViewTableEditPart.getDeclaredBackgroundColor();
    fillStyle.setFillColor(FigureUtilities.colorToInteger(color));
    node.getStyles().add(fillStyle);
    LineStyle lineStyle = NotationFactory.eINSTANCE.createLineStyle();
    lineStyle.setLineColor(FigureUtilities.RGBToInteger(new org.eclipse.swt.graphics.RGB(0, 0, 0)));
    node.getStyles().add(lineStyle);

    node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
    node.setType(SqlmodelVisualIDRegistry.getType(ViewTableEditPart.VISUAL_ID));
    ViewUtil.insertChildView(containerView, node, index, persisted);
    node.setElement(domainElement);
    stampShortcut(containerView, node);
    // initializeFromPreferences
    final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
    FontStyle nodeFontStyle = (FontStyle) node.getStyle(NotationPackage.Literals.FONT_STYLE);
    if (nodeFontStyle != null) {
      FontData fontData =
          PreferenceConverter.getFontData(prefStore, IPreferenceConstants.PREF_DEFAULT_FONT);
      nodeFontStyle.setFontName(fontData.getName());
      nodeFontStyle.setFontHeight(fontData.getHeight());
      nodeFontStyle.setBold((fontData.getStyle() & SWT.BOLD) != 0);
      nodeFontStyle.setItalic((fontData.getStyle() & SWT.ITALIC) != 0);
      org.eclipse.swt.graphics.RGB fontRGB =
          PreferenceConverter.getColor(prefStore, IPreferenceConstants.PREF_FONT_COLOR);
      nodeFontStyle.setFontColor(FigureUtilities.RGBToInteger(fontRGB).intValue());
    }
    Node label4002 =
        createLabel(node, SqlmodelVisualIDRegistry.getType(ViewTableNameEditPart.VISUAL_ID));
    createCompartment(
        node,
        SqlmodelVisualIDRegistry.getType(ViewTableViewedColumnsEditPart.VISUAL_ID),
        false,
        false,
        true,
        true);
    createCompartment(
        node,
        SqlmodelVisualIDRegistry.getType(ViewTableViewedTablesEditPart.VISUAL_ID),
        false,
        false,
        true,
        true);
    return node;
  }
 /** @generated */
 public View createView(
     IAdaptable semanticAdapter,
     View containerView,
     String semanticHint,
     int index,
     boolean persisted,
     PreferencesHint preferencesHint) {
   Node view =
       (Node)
           super.createView(
               semanticAdapter, containerView, semanticHint, index, persisted, preferencesHint);
   Location location = (Location) view.getLayoutConstraint();
   IMapMode mapMode =
       MeasurementUnitHelper.getMapMode(containerView.getDiagram().getMeasurementUnit());
   location.setX(mapMode.DPtoLP(0));
   location.setY(mapMode.DPtoLP(5));
   return view;
 }
  /** Refresh EditPartMap */
  public static void refreshEditPartMap() {
    editPartMap.clear();

    if (getDiagramEditor() == null) return;

    @SuppressWarnings("rawtypes")
    Map editPartRegistry =
        getDiagramEditor().getDiagramEditPart().getViewer().getEditPartRegistry();
    for (Object object : editPartRegistry.keySet()) {
      if (object instanceof Node) {
        Node nodeImpl = (Node) object;
        Object ep = editPartRegistry.get(nodeImpl);
        if (ep instanceof ShapeNodeEditPart) {
          editPartMap.put(nodeImpl.getElement(), (ShapeNodeEditPart) ep);
        }
      }
    }
  }
  /** @generated */
  public Node createPersistentTable_2003(
      EObject domainElement,
      View containerView,
      int index,
      boolean persisted,
      PreferencesHint preferencesHint) {
    Node node = NotationFactory.eINSTANCE.createNode();
    node.getStyles().add(NotationFactory.eINSTANCE.createDescriptionStyle());
    node.getStyles().add(NotationFactory.eINSTANCE.createLineStyle());
    node.getStyles().add(NotationFactory.eINSTANCE.createFillStyle());

    node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
    node.setType(SqlmodelVisualIDRegistry.getType(PersistentTable2EditPart.VISUAL_ID));
    ViewUtil.insertChildView(containerView, node, index, persisted);
    node.setElement(domainElement);
    // initializeFromPreferences
    final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();

    org.eclipse.swt.graphics.RGB lineRGB =
        PreferenceConverter.getColor(prefStore, IPreferenceConstants.PREF_LINE_COLOR);
    ViewUtil.setStructuralFeatureValue(
        node,
        NotationPackage.eINSTANCE.getLineStyle_LineColor(),
        FigureUtilities.RGBToInteger(lineRGB));
    org.eclipse.swt.graphics.RGB fillRGB =
        PreferenceConverter.getColor(prefStore, IPreferenceConstants.PREF_FILL_COLOR);
    ViewUtil.setStructuralFeatureValue(
        node,
        NotationPackage.eINSTANCE.getFillStyle_FillColor(),
        FigureUtilities.RGBToInteger(fillRGB));
    return node;
  }
 /** @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;
     }
   }
 }
  /**
   * Corresponds to ticket #1811. Check that after a creation of a diagram with ports (on node) from
   * the model content view , the layoutConstraint of all ports is not {0, 0}.
   */
  public void testPortLocationForCreationFromModelContentView() {

    // Get the desired package
    final Model model = (Model) semanticModel;
    assertNotNull("Corrupted input data", model);
    // Get the diagram for the root of this model.
    diagram = (DDiagram) createRepresentation(NODE_REPRESENTATION_DESC_NAME, model);
    // Get the class named "Class2"
    PackageableElement element = model.getPackagedElement("Class2");
    assertTrue("Corrupted input data", element instanceof Class);
    final Class class2 = (Class) element;

    // Get the class named "Class3"
    element = model.getPackagedElement("Class3");
    assertTrue("Corrupted input data", element instanceof Class);
    final Class class3 = (Class) element;

    final Property firstProperty = class3.getOwnedAttribute("Prop3to2", class2);
    final Property secondProperty = class3.getOwnedAttribute("OtherProp3to2", class2);

    // Open the editor (and refresh it)
    final IEditorPart editorPart =
        DialectUIManager.INSTANCE.openEditor(session, diagram, new NullProgressMonitor());
    TestsUtil.synchronizationWithUIThread();

    final DDiagramElement firstPropertyDiagramElement =
        getFirstDiagramElement(diagram, firstProperty);
    assertNotNull(
        "The first property has no corresponding diagramElement", firstPropertyDiagramElement);
    final Node firstPropertyNode = getGmfNode(firstPropertyDiagramElement);
    assertNotNull("The first property has no corresponding GMF node", firstPropertyNode);
    assertTrue(
        "Bag layout constraint type", firstPropertyNode.getLayoutConstraint() instanceof Location);
    final Location firstLocation = (Location) firstPropertyNode.getLayoutConstraint();
    final DDiagramElement secondPropertyDiagramElement =
        getFirstDiagramElement(diagram, secondProperty);
    assertNotNull(
        "The second property has no corresponding diagramElement", secondPropertyDiagramElement);
    final Node secondPropertyNode = getGmfNode(secondPropertyDiagramElement);
    assertNotNull("The second property has no corresponding GMF node", secondPropertyNode);
    assertTrue(
        "Bag layout constraint type", secondPropertyNode.getLayoutConstraint() instanceof Location);
    final Location secondLocation = (Location) secondPropertyNode.getLayoutConstraint();

    assertFalse(
        "All the layout constraints of the ports should not be in {0,0}",
        firstLocation.getX() == 0
            && firstLocation.getY() == 0
            && secondLocation.getX() == 0
            && secondLocation.getY() == 0);
    assertTrue(
        "All the layout constraints of the ports should be different",
        firstLocation.getX() != secondLocation.getX()
            || firstLocation.getY() != secondLocation.getY());

    DialectUIManager.INSTANCE.closeEditor(editorPart, false);
    TestsUtil.synchronizationWithUIThread();
  }
 /**
  * Extend the given addition group for the given element within the given scope based on GMF
  * peculiarities
  *
  * @param group_p a non-null, modifiable collection
  * @param element_p a non-null element
  * @param scope_p a non-null scope
  */
 protected void extendGMFAdditionGroup(
     Set<EObject> group_p, EObject element_p, IFeaturedModelScope scope_p) {
   // Node -> Node content
   if (element_p instanceof Node) {
     Node elementNode = (Node) element_p;
     EObject representedElement = elementNode.getElement();
     for (EObject child : element_p.eContents()) {
       boolean addChild = true;
       if (child instanceof View) {
         View childView = (View) child;
         EObject childRepresentedElement = childView.getElement();
         addChild =
             childRepresentedElement == null || childRepresentedElement == representedElement;
       }
       if (addChild) group_p.add(child);
     }
   }
   // Edge -> Edge content
   if (element_p instanceof Edge) group_p.addAll(element_p.eContents());
   // Semantic element -> Views
   if (isGraphicalFromSemantic())
     extendGMFAdditionGroupSemanticTarget(group_p, element_p, scope_p);
 }
 /** @generated */
 private void stampShortcut(View containerView, Node target) {
   if (!edu.toronto.cs.se.modelepedia.necsis14_classdiagram.diagram.edit.parts.ClassDiagramEditPart
       .MODEL_ID.equals(
       edu.toronto.cs.se.modelepedia.necsis14_classdiagram.diagram.part
           .NECSIS14_ClassDiagramVisualIDRegistry.getModelID(containerView))) {
     EAnnotation shortcutAnnotation = EcoreFactory.eINSTANCE.createEAnnotation();
     shortcutAnnotation.setSource("Shortcut"); // $NON-NLS-1$
     shortcutAnnotation
         .getDetails()
         .put(
             "modelID",
             edu.toronto.cs.se.modelepedia.necsis14_classdiagram.diagram.edit.parts
                 .ClassDiagramEditPart.MODEL_ID); //$NON-NLS-1$
     target.getEAnnotations().add(shortcutAnnotation);
   }
 }
Beispiel #22
0
 /**
  * Tests if the compartment is a compartment list
  *
  * @param node the node on which we want add an Overlay
  * @return <code>true</code> if the compartment is managed by an {@link XYLayoutEditPolicy}
  */
 protected boolean isInCompartmentList(Node node) {
   IGraphicalEditPart gep =
       (IGraphicalEditPart) getDecoratorTarget().getAdapter(IGraphicalEditPart.class);
   if (gep != null && gep.getRoot() != null) {
     EObject container = node.eContainer();
     if (container instanceof View) {
       EditPart EP = DiagramEditPartsUtil.getEditPartFromView((View) container, gep);
       EditPolicy editPolicy = EP.getEditPolicy(EditPolicy.LAYOUT_ROLE);
       if (!(editPolicy instanceof XYLayoutEditPolicy)) { // we are in a
         // compartment
         // list
         return true;
       }
     }
   }
   return false;
 }
Beispiel #23
0
 /** @generated */
 public Node createRequirementsGroup_2007(
     EObject domainElement,
     View containerView,
     int index,
     boolean persisted,
     PreferencesHint preferencesHint) {
   Node node = NotationFactory.eINSTANCE.createNode();
   node.getStyles().add(NotationFactory.eINSTANCE.createDescriptionStyle());
   node.getStyles().add(NotationFactory.eINSTANCE.createFontStyle());
   node.getStyles().add(NotationFactory.eINSTANCE.createFillStyle());
   node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
   node.setType(RdalVisualIDRegistry.getType(RequirementsGroupEditPart.VISUAL_ID));
   ViewUtil.insertChildView(containerView, node, index, persisted);
   node.setElement(domainElement);
   stampShortcut(containerView, node);
   // initializeFromPreferences
   final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
   FontStyle nodeFontStyle = (FontStyle) node.getStyle(NotationPackage.Literals.FONT_STYLE);
   if (nodeFontStyle != null) {
     FontData fontData =
         PreferenceConverter.getFontData(prefStore, IPreferenceConstants.PREF_DEFAULT_FONT);
     nodeFontStyle.setFontName(fontData.getName());
     nodeFontStyle.setFontHeight(fontData.getHeight());
     nodeFontStyle.setBold((fontData.getStyle() & SWT.BOLD) != 0);
     nodeFontStyle.setItalic((fontData.getStyle() & SWT.ITALIC) != 0);
     org.eclipse.swt.graphics.RGB fontRGB =
         PreferenceConverter.getColor(prefStore, IPreferenceConstants.PREF_FONT_COLOR);
     nodeFontStyle.setFontColor(FigureUtilities.RGBToInteger(fontRGB).intValue());
   }
   org.eclipse.swt.graphics.RGB fillRGB =
       PreferenceConverter.getColor(prefStore, IPreferenceConstants.PREF_FILL_COLOR);
   ViewUtil.setStructuralFeatureValue(
       node,
       NotationPackage.eINSTANCE.getFillStyle_FillColor(),
       FigureUtilities.RGBToInteger(fillRGB));
   Node label5013 =
       createLabel(node, RdalVisualIDRegistry.getType(RequirementsGroupNameEditPart.VISUAL_ID));
   createCompartment(
       node,
       RdalVisualIDRegistry.getType(RequirementsGroupRequirementsCompartmentEditPart.VISUAL_ID),
       true,
       false,
       false,
       false);
   return node;
 }
 /** @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 */
 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;
     }
   }
 }
  /**
   * this method suppress the sub-nodes that references the stereotype application it cleans also
   * all sub-nodes with the type ApplicationStereotype that not references an application of
   * stereotypes (this is the case when a stereotype has been unapplied without suppress the
   * compartment.
   *
   * @param stereotypeApplication
   */
  public void removeAppliedStereotypeCompartment(final EObject stereotypeApplication) {
    if (stereotypeApplication == null) {
      return;
    }
    final GraphicalEditPart editPart = (GraphicalEditPart) getHost();
    final View node = editPart.getNotationView();
    try {
      int i = 0;
      // we go through all sub nodes
      while (i < node.getChildren().size()) {
        if ((node.getChildren().get(i)) instanceof Node) {
          final Node currentNode = (Node) (node.getChildren().get(i));
          // it references the stereotype application?
          if (stereotypeApplication.equals(currentNode.getElement())) {
            // yes, Execution of the Deletion command
            editPart
                .getEditingDomain()
                .runExclusive(
                    new Runnable() {

                      public void run() {
                        Display.getCurrent()
                            .asyncExec(
                                new Runnable() {

                                  public void run() {
                                    DeleteCommand command = new DeleteCommand(currentNode);
                                    editPart
                                        .getEditingDomain()
                                        .getCommandStack()
                                        .execute(new GMFtoEMFCommandWrapper(command));
                                  }
                                });
                      }
                    });
          }
          // the sub nodes has the type appliedStereotypeCompartment but does not references a
          // application of stereotype
          if ((currentNode.getType().equals(AppliedStereotypeConpartmentEditPart.ID))
              && (!(currentNode.getElement() instanceof DynamicEObjectImpl))) {
            // yes, Execution of the Deletion command
            editPart
                .getEditingDomain()
                .runExclusive(
                    new Runnable() {

                      public void run() {
                        Display.getCurrent()
                            .asyncExec(
                                new Runnable() {

                                  public void run() {
                                    DeleteCommand command = new DeleteCommand(currentNode);
                                    editPart
                                        .getEditingDomain()
                                        .getCommandStack()
                                        .execute(new GMFtoEMFCommandWrapper(command));
                                  }
                                });
                      }
                    });
          }
        }
        i++;
      }
    } catch (Exception e) {
      System.err.println(e);
    }
  }
  /** @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 */
 private void addDestroyChildNodesCommand(ICompositeCommand cmd) {
   View view = (View) getHost().getModel();
   for (Iterator<?> nit = view.getChildren().iterator(); nit.hasNext(); ) {
     Node node = (Node) nit.next();
     switch (EsbVisualIDRegistry.getVisualID(node)) {
       case SwitchMediatorInputConnectorEditPart.VISUAL_ID:
         for (Iterator<?> it = node.getTargetEdges().iterator(); it.hasNext(); ) {
           Edge incomingLink = (Edge) it.next();
           if (EsbVisualIDRegistry.getVisualID(incomingLink) == EsbLinkEditPart.VISUAL_ID) {
             DestroyElementRequest r = new DestroyElementRequest(incomingLink.getElement(), false);
             cmd.add(new DestroyElementCommand(r));
             cmd.add(new DeleteCommand(getEditingDomain(), incomingLink));
             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 SwitchMediatorOutputConnectorEditPart.VISUAL_ID:
         for (Iterator<?> it = node.getSourceEdges().iterator(); it.hasNext(); ) {
           Edge outgoingLink = (Edge) it.next();
           if (EsbVisualIDRegistry.getVisualID(outgoingLink) == EsbLinkEditPart.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 SwitchCaseBranchOutputConnectorEditPart.VISUAL_ID:
         for (Iterator<?> it = node.getSourceEdges().iterator(); it.hasNext(); ) {
           Edge outgoingLink = (Edge) it.next();
           if (EsbVisualIDRegistry.getVisualID(outgoingLink) == EsbLinkEditPart.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 SwitchDefaultBranchOutputConnectorEditPart.VISUAL_ID:
         for (Iterator<?> it = node.getSourceEdges().iterator(); it.hasNext(); ) {
           Edge outgoingLink = (Edge) it.next();
           if (EsbVisualIDRegistry.getVisualID(outgoingLink) == EsbLinkEditPart.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 SwitchMediatorContainerEditPart.VISUAL_ID:
         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;
     }
   }
 }
 protected void setPreferredSize() {
   Node node = (Node) getContextObject();
   Bounds bounds = (Bounds) node.getLayoutConstraint();
   bounds.setWidth(-1);
   bounds.setHeight(-1);
 }
Beispiel #30
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;
     }
   }
 }