protected void createEntryPoint(Edge edge, Diagram subdiagram) {
    Transition transition = (Transition) edge.getElement();
    Region entryPointContainer = getEntryPointContainer(transition);
    Entry entryPoint = createSemanticEntryPoint(transition);

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

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

    addEntryPointSpec(transition, entryPoint);
  }
Ejemplo n.º 2
0
 /**
  * Creates an edge for a given eObject and with a given type and connects it between a given
  * source and a given target
  *
  * @param source The edge's source view
  * @param target The edge's target view
  * @param eObject The edge view object context
  * @param type The edge view type, check {@link ViewType} for predefined values
  * @param preferencesHint The preference hint that is to be used to find the appropriate
  *     preference store from which to retrieve diagram preference values. The preference hint is
  *     mapped to a preference store in the preference registry <@link DiagramPreferencesRegistry>.
  * @return A newly created <code>Edge</code>
  */
 public static Edge createEdge(
     View source, View target, EObject eObject, String type, PreferencesHint preferencesHint) {
   assert source != null : "The source is null"; // $NON-NLS-1$
   assert target != null : "The target is null"; // $NON-NLS-1$
   assert source.getDiagram() != null : "The source is detached"; // $NON-NLS-1$
   assert target.getDiagram() != null : "The target is detached"; // $NON-NLS-1$
   IAdaptable viewModel = (eObject != null) ? new EObjectAdapter(eObject) : null;
   Edge edge =
       (Edge)
           ViewService.getInstance()
               .createEdge(viewModel, source.getDiagram(), type, ViewUtil.APPEND, preferencesHint);
   if (edge != null) {
     edge.setSource(source);
     edge.setTarget(target);
   }
   return edge;
 }
 /** @generated */
 private void createLinks(Diagram diagram) {
   for (boolean continueLinkCreation = true; continueLinkCreation; ) {
     continueLinkCreation = false;
     Collection additionalDescriptors = new LinkedList();
     for (Iterator it = myLinkDescriptors.iterator(); it.hasNext(); ) {
       UMLLinkDescriptor nextLinkDescriptor = (UMLLinkDescriptor) it.next();
       if (!myDomain2NotationMap.containsKey(nextLinkDescriptor.getSource())
           || !myDomain2NotationMap.containsKey(nextLinkDescriptor.getDestination())) {
         continue;
       }
       final String linkType = UMLVisualIDRegistry.getType(nextLinkDescriptor.getVisualID());
       Edge edge =
           ViewService.getInstance()
               .createEdge(
                   nextLinkDescriptor.getSemanticAdapter(),
                   diagram,
                   linkType,
                   ViewUtil.APPEND,
                   true,
                   UMLDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT);
       if (edge != null) {
         edge.setSource((View) myDomain2NotationMap.get(nextLinkDescriptor.getSource()));
         edge.setTarget((View) myDomain2NotationMap.get(nextLinkDescriptor.getDestination()));
         it.remove();
         if (nextLinkDescriptor.getModelElement() != null) {
           myDomain2NotationMap.put(nextLinkDescriptor.getModelElement(), edge);
         }
         continueLinkCreation = true;
         switch (nextLinkDescriptor.getVisualID()) {
           case ExtensionEditPart.VISUAL_ID:
             additionalDescriptors.addAll(UMLDiagramUpdater.getExtension_1013OutgoingLinks(edge));
             break;
           case AssociationEditPart.VISUAL_ID:
             additionalDescriptors.addAll(
                 UMLDiagramUpdater.getAssociation_4001OutgoingLinks(edge));
             break;
           case ProfileApplicationEditPart.VISUAL_ID:
             additionalDescriptors.addAll(
                 UMLDiagramUpdater.getProfileApplication_1045OutgoingLinks(edge));
             break;
           case AssociationBranchEditPart.VISUAL_ID:
             additionalDescriptors.addAll(
                 UMLDiagramUpdater.getAssociation_4019OutgoingLinks(edge));
             break;
           case GeneralizationEditPart.VISUAL_ID:
             additionalDescriptors.addAll(
                 UMLDiagramUpdater.getGeneralization_4002OutgoingLinks(edge));
             break;
           case DependencyEditPart.VISUAL_ID:
             additionalDescriptors.addAll(UMLDiagramUpdater.getDependency_4008OutgoingLinks(edge));
             break;
           case DependencyBranchEditPart.VISUAL_ID:
             additionalDescriptors.addAll(UMLDiagramUpdater.getDependency_4018OutgoingLinks(edge));
             break;
           case ElementImportEditPart.VISUAL_ID:
             additionalDescriptors.addAll(
                 UMLDiagramUpdater.getElementImport_1064OutgoingLinks(edge));
             break;
           case PackageImportEditPart.VISUAL_ID:
             additionalDescriptors.addAll(
                 UMLDiagramUpdater.getPackageImport_1065OutgoingLinks(edge));
             break;
         }
       }
     }
     myLinkDescriptors.addAll(additionalDescriptors);
   }
 }