コード例 #1
0
  /** Caches ID_SORTING, ID_SORTED_OBJECTS and ID_SORTING_KEYS values for local access. */
  private void tokenizeSortProperty() {
    Object model = editPart.getModel();
    if (model instanceof View) {
      View view = (View) model;
      SortingStyle style =
          (SortingStyle) view.getStyle(NotationPackage.eINSTANCE.getSortingStyle());
      if (style != null) {
        _sorting = style.getSorting();
        _sortedObjects =
            style.eIsSet(NotationPackage.eINSTANCE.getSortingStyle_SortedObjects())
                ? new ArrayList(style.getSortedObjects())
                : Collections.EMPTY_LIST;
        _sortingKeys =
            style.eIsSet(NotationPackage.eINSTANCE.getSortingStyle_SortingKeys())
                ? new HashMap(style.getSortingKeys())
                : Collections.EMPTY_MAP;

        // Currently, only one sorting column can be defined.
        if (_sortingKeys.size() > 0) {
          Set keySet = _sortingKeys.keySet();
          Iterator iter = keySet.iterator();
          if (iter.hasNext()) {
            _sortColumn = (String) iter.next();
            _sortingDirection = (SortingDirection) _sortingKeys.get(_sortColumn);
          }
        }
      }
    }
  }
 /** @generated */
 public String getText(View view) {
   if (view.getElement() != null && view.getElement().eIsProxy()) {
     return getUnresolvedDomainElementProxyText(view);
   }
   switch (hub.top.adaptiveSystem.diagram.part.AdaptiveSystemVisualIDRegistry.getVisualID(view)) {
     case hub.top.adaptiveSystem.diagram.edit.parts.AdaptiveSystemEditPart.VISUAL_ID:
       return getAdaptiveSystem_79Text(view);
     case hub.top.adaptiveSystem.diagram.edit.parts.AdaptiveProcessEditPart.VISUAL_ID:
       return getAdaptiveProcess_1001Text(view);
     case hub.top.adaptiveSystem.diagram.edit.parts.OcletEditPart.VISUAL_ID:
       return getOclet_1002Text(view);
     case hub.top.adaptiveSystem.diagram.edit.parts.ConditionAPEditPart.VISUAL_ID:
       return getCondition_2001Text(view);
     case hub.top.adaptiveSystem.diagram.edit.parts.EventAPEditPart.VISUAL_ID:
       return getEvent_2002Text(view);
     case hub.top.adaptiveSystem.diagram.edit.parts.PreNetEditPart.VISUAL_ID:
       return getPreNet_2003Text(view);
     case hub.top.adaptiveSystem.diagram.edit.parts.ConditionPreNetEditPart.VISUAL_ID:
       return getCondition_2004Text(view);
     case hub.top.adaptiveSystem.diagram.edit.parts.EventPreNetEditPart.VISUAL_ID:
       return getEvent_2005Text(view);
     case hub.top.adaptiveSystem.diagram.edit.parts.DoNetEditPart.VISUAL_ID:
       return getDoNet_2006Text(view);
     case hub.top.adaptiveSystem.diagram.edit.parts.ConditionDoNetEditPart.VISUAL_ID:
       return getCondition_2007Text(view);
     case hub.top.adaptiveSystem.diagram.edit.parts.EventDoNetEditPart.VISUAL_ID:
       return getEvent_2008Text(view);
     case hub.top.adaptiveSystem.diagram.edit.parts.ArcToConditionEditPart.VISUAL_ID:
       return getArcToCondition_3001Text(view);
     case hub.top.adaptiveSystem.diagram.edit.parts.ArcToEventEditPart.VISUAL_ID:
       return getArcToEvent_3002Text(view);
   }
   return getUnknownElementText(view);
 }
コード例 #3
0
 /** @generated */
 protected void decorateView(
     View containerView,
     View view,
     IAdaptable semanticAdapter,
     String semanticHint,
     int index,
     boolean persisted) {
   if (semanticHint == null) {
     semanticHint =
         BusinessVisualIDRegistry.getType(
             org.talend.designer.business.model.business.diagram.edit.parts
                 .DataBusinessItemEditPart.VISUAL_ID);
     view.setType(semanticHint);
   }
   super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
   if (!BusinessProcessEditPart.MODEL_ID.equals(
       BusinessVisualIDRegistry.getModelID(containerView))) {
     EAnnotation shortcutAnnotation = EcoreFactory.eINSTANCE.createEAnnotation();
     shortcutAnnotation.setSource("Shortcut"); // $NON-NLS-1$
     shortcutAnnotation
         .getDetails()
         .put("modelID", BusinessProcessEditPart.MODEL_ID); // $NON-NLS-1$
     view.getEAnnotations().add(shortcutAnnotation);
   }
   getViewService()
       .createNode(
           semanticAdapter,
           view,
           BusinessVisualIDRegistry.getType(DataBusinessItemNameEditPart.VISUAL_ID),
           ViewUtil.APPEND,
           true,
           getPreferencesHint());
 }
コード例 #4
0
  /** @generated NOT */
  protected void decorateView(
      View containerView,
      View view,
      IAdaptable semanticAdapter,
      String semanticHint,
      int index,
      boolean persisted) {
    if (semanticHint == null) {
      semanticHint = OepcVisualIDRegistry.getType(XORConnectorEditPart.VISUAL_ID);
      view.setType(semanticHint);
    }
    super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
    if (!OEPCEditPart.MODEL_ID.equals(OepcVisualIDRegistry.getModelID(containerView))) {
      EAnnotation shortcutAnnotation = EcoreFactory.eINSTANCE.createEAnnotation();
      shortcutAnnotation.setSource("Shortcut"); // $NON-NLS-1$
      shortcutAnnotation.getDetails().put("modelID", OEPCEditPart.MODEL_ID); // $NON-NLS-1$
      view.getEAnnotations().add(shortcutAnnotation);
    }

    // setting up default color background to view style
    NotationPackage NOTATION = NotationPackage.eINSTANCE;
    EClass shapeStyle = NOTATION.getShapeStyle();
    ShapeStyle style = (ShapeStyle) view.getStyle(shapeStyle);
    if (style == null) {
      style = (ShapeStyle) view.createStyle(shapeStyle);
    }
    BflowDiagramEditPart.apply(XORConnectorEditPart.class, style);
  }
  /**
   * Update the Flash animation. This generates the flash code and writes it to the temporary file.
   */
  public void update(View view) {

    // Create a new network.
    Network network = null;
    Module module = null;
    if (view.getElement() instanceof Connector) {
      Connector connector = (Connector) view.getElement();
      network = new Network(connector);
      module = connector.getModule();
    }
    if (view.getElement() instanceof Component) {
      Component component = (Component) view.getElement();
      network = new Network(component);
      module = component.getModule();
    }

    if (module == null || network == null) {
      return; // Abort.
    }

    // Module scope?
    if (ReoPreferences.useModuleScope()) {
      network = new Network(module);
    }

    // Check if all component ends are connected.
    for (Component component : network.getAllComponents()) {
      for (PrimitiveEnd end : component.getAllEnds()) {
        if (end.getNode() == null) return; // Abort.
      }
    }

    // Do the actual job.
    update(network, null);
  }
 /** @generated */
 public static List getAdaptiveSystem_79SemanticChildren(View view) {
   if (!view.isSetElement()) {
     return Collections.EMPTY_LIST;
   }
   hub.top.adaptiveSystem.AdaptiveSystem modelElement =
       (hub.top.adaptiveSystem.AdaptiveSystem) view.getElement();
   List result = new LinkedList();
   {
     hub.top.adaptiveSystem.AdaptiveProcess childElement = modelElement.getAdaptiveProcess();
     int visualID =
         hub.top.adaptiveSystem.diagram.part.AdaptiveSystemVisualIDRegistry.getNodeVisualID(
             view, childElement);
     if (visualID == hub.top.adaptiveSystem.diagram.edit.parts.AdaptiveProcessEditPart.VISUAL_ID) {
       result.add(
           new hub.top.adaptiveSystem.diagram.part.AdaptiveSystemNodeDescriptor(
               childElement, visualID));
     }
   }
   for (Iterator it = modelElement.getOclets().iterator(); it.hasNext(); ) {
     hub.top.adaptiveSystem.Oclet childElement = (hub.top.adaptiveSystem.Oclet) it.next();
     int visualID =
         hub.top.adaptiveSystem.diagram.part.AdaptiveSystemVisualIDRegistry.getNodeVisualID(
             view, childElement);
     if (visualID == hub.top.adaptiveSystem.diagram.edit.parts.OcletEditPart.VISUAL_ID) {
       result.add(
           new hub.top.adaptiveSystem.diagram.part.AdaptiveSystemNodeDescriptor(
               childElement, visualID));
       continue;
     }
   }
   return result;
 }
コード例 #7
0
 /** @generated */
 protected Command getDestroyElementCommand(DestroyElementRequest req) {
   View view = (View) getHost().getModel();
   CompositeTransactionalCommand cmd = new CompositeTransactionalCommand(getEditingDomain(), null);
   cmd.setTransactionNestingEnabled(false);
   for (Iterator<?> it = view.getTargetEdges().iterator(); it.hasNext(); ) {
     Edge incomingLink = (Edge) it.next();
     if (CrystalVisualIDRegistry.getVisualID(incomingLink) == TransitionEditPart.VISUAL_ID) {
       DestroyElementRequest r = new DestroyElementRequest(incomingLink.getElement(), false);
       cmd.add(new DestroyElementCommand(r));
       cmd.add(new DeleteCommand(getEditingDomain(), incomingLink));
       continue;
     }
   }
   for (Iterator<?> it = view.getSourceEdges().iterator(); it.hasNext(); ) {
     Edge outgoingLink = (Edge) it.next();
     if (CrystalVisualIDRegistry.getVisualID(outgoingLink) == TransitionEditPart.VISUAL_ID) {
       DestroyElementRequest r = new DestroyElementRequest(outgoingLink.getElement(), false);
       cmd.add(new DestroyElementCommand(r));
       cmd.add(new DeleteCommand(getEditingDomain(), outgoingLink));
       continue;
     }
   }
   EAnnotation annotation = view.getEAnnotation("Shortcut"); // $NON-NLS-1$
   if (annotation == null) {
     // there are indirectly referenced children, need extra commands: false
     addDestroyShortcutsCommand(cmd, view);
     // delete host element
     cmd.add(new DestroyElementCommand(req));
   } else {
     cmd.add(new DeleteCommand(getEditingDomain(), view));
   }
   return getGEFWrapper(cmd.reduce());
 }
コード例 #8
0
 /** @generated */
 public String getText(View view) {
   if (view.getElement() != null && view.getElement().eIsProxy()) {
     return getUnresolvedDomainElementProxyText(view);
   }
   switch (TOEVisualIDRegistry.getVisualID(view)) {
     case AllHolderEditPart.VISUAL_ID:
       return getAllHolder_1000Text(view);
     case EmployeeEditPart.VISUAL_ID:
       return getEmployee_2001Text(view);
     case DepartmentEditPart.VISUAL_ID:
       return getDepartment_2002Text(view);
     case ProjectEditPart.VISUAL_ID:
       return getProject_2003Text(view);
     case ManagerEditPart.VISUAL_ID:
       return getManager_2004Text(view);
     case Employee2EditPart.VISUAL_ID:
       return getEmployee_3001Text(view);
     case Department2EditPart.VISUAL_ID:
       return getDepartment_3002Text(view);
     case ManagerManagedDepartmentEditPart.VISUAL_ID:
       return getManagerManagedDepartment_4001Text(view);
     case ManagerLeadsEditPart.VISUAL_ID:
       return getManagerLeads_4002Text(view);
     case ContributionEditPart.VISUAL_ID:
       return getContribution_4003Text(view);
   }
   return getUnknownElementText(view);
 }
コード例 #9
0
 /** @generated */
 private Collection<View> getOutgoingLinksByType(Collection<? extends View> nodes, String type) {
   LinkedList<View> result = new LinkedList<View>();
   for (View nextNode : nodes) {
     result.addAll(selectViewsByType(nextNode.getSourceEdges(), type));
   }
   return result;
 }
コード例 #10
0
 /** @generated */
 private Collection<View> getChildrenByType(Collection<? extends View> nodes, String type) {
   LinkedList<View> result = new LinkedList<View>();
   for (View nextNode : nodes) {
     result.addAll(selectViewsByType(nextNode.getChildren(), type));
   }
   return result;
 }
コード例 #11
0
  /**
   * Create a decoration based on a figure
   *
   * @param decoratorTarget the decorator target
   * @param figure the figure
   * @param position the position
   * @param percentageFromSource the percentage from source
   * @param margin the margin
   * @param isVolatile the is volatile
   * @return the decoration
   */
  public final IDecoration createDecorationFigure(
      IDecoratorTarget decoratorTarget,
      IFigure figure,
      int percentageFromSource,
      int margin,
      boolean isVolatile) {

    final View view = (View) decoratorTarget.getAdapter(View.class);
    org.eclipse.gmf.runtime.diagram.ui.services.decorator.IDecoration decoration = null;
    if (view == null || view.eResource() == null || figure == null) {
      return decoration;
    }
    EditPart editPart = (EditPart) decoratorTarget.getAdapter(EditPart.class);
    if (editPart == null || editPart.getViewer() == null) {
      return decoration;
    }
    if (editPart instanceof GraphicalEditPart) {
      if (view instanceof Edge) {
        decoration =
            decoratorTarget.addConnectionDecoration(figure, percentageFromSource, isVolatile);
      } else {
        IFigure parentFig = ((GraphicalEditPart) editPart).getFigure();
        margin = MapModeUtil.getMapMode(parentFig).DPtoLP(margin);

        // Locator locator = new MultiIconTopRightLocator(parentFig, margin);

        // decoration = decoratorTarget.addDecoration(figure, locator, isVolatile);
        decoration =
            decoratorTarget.addShapeDecoration(
                figure, IDecoratorTarget.Direction.NORTH_EAST, margin, isVolatile);
      }
    }
    return decoration;
  }
 /** @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;
     }
   }
 }
コード例 #13
0
  /**
   * Checks if is correct graphical view.
   *
   * @param connectorEnd a connector end
   * @param view a view
   * @return <code>true</code> if the view represents the role of the connector AND if the view is
   *     encapsulated as required by the nested path of the connector end
   */
  protected boolean isCorrectGraphicalView(final ConnectorEnd connectorEnd, final View view) {
    final NestedConnectorEnd nestedConnectorEnd =
        org.eclipse.uml2.uml.util.UMLUtil.getStereotypeApplication(
            connectorEnd, NestedConnectorEnd.class);
    final Property partWithPort = connectorEnd.getPartWithPort();
    // final ConnectableElement role = end.getRole();
    // 1. we get the top view of this view with the same semantic element
    View localView = getTopViewWithSameSemanticElement(view);

    // 2. we verify the part with port
    if (partWithPort != null) {
      View parent = getTopViewWithSameSemanticElement(ViewUtil.getViewContainer(localView));
      if (parent.getElement() != partWithPort) {
        return false;
      }
    }

    // 3. we verify the nested path
    if (nestedConnectorEnd != null && nestedConnectorEnd.getPropertyPath().size() > 0) {
      View parent = view;
      final List<Property> paths = nestedConnectorEnd.getPropertyPath();
      for (int i = paths.size() - 1; i >= 0; i--) {
        final Property currentProperty = paths.get(i);
        parent = getTopViewWithSameSemanticElement(ViewUtil.getViewContainer(parent));
        if (parent.getElement() != currentProperty) {
          return false;
        }
      }
    }
    return true;
  }
コード例 #14
0
  /**
   * This method looks for inconsistent views to delete in case the message is deleted or the
   * connector of the message is re-oriented.
   *
   * @param destructee the modified message
   * @param request the request to destroy a message or to re-orient a message
   * @return the list of {@link View} to delete
   */
  public static Set<View> getMemberViewsToDestroy(Message destructee, IEditCommandRequest request) {
    Set<View> viewsToDestroy = new HashSet<View>();
    CrossReferenceAdapter crossReferenceAdapter =
        InconsistentMessageViewsHelper.getCrossReferenceAdapter(request, destructee);
    if (crossReferenceAdapter != null) {

      Collection<Setting> revRefs =
          crossReferenceAdapter.getNonNavigableInverseReferences(destructee);
      if (!revRefs.isEmpty()) {
        for (Setting current : revRefs) {
          // test if the view is linked with the removed message
          if (current.getEObject() instanceof View) {
            View view = (View) current.getEObject();
            // we remove the view only if they are owned by the CompositeStructureDiagram
            if (InconsistentMessageViewsHelper.isOwnedByCommunicationDiagram(view)) {

              viewsToDestroy.add(view);
              if (InconsistentMessageViewsHelper.isLastMessageOnConnection(view)) {
                // remove the connector
                // System.err.println("+-> the connector will be deleted : " +
                // (View)view.eContainer());
                // System.err.println("+-> the parent of the connector is : " +
                // (View)view.eContainer().eContainer());
                viewsToDestroy.add((View) view.eContainer());
              }
            }
          }
        }
      }
    }

    return viewsToDestroy;
  }
 @Override
 protected View getObjectFlowExtremityView(boolean isStartEnd) {
   Object objectFlowView = getViewAdapter().getAdapter(Connector.class);
   if (objectFlowView instanceof Connector) {
     EObject objectFlow = ((Connector) objectFlowView).getElement();
     if (objectFlow instanceof ObjectFlow) {
       ActivityNode actNode = null;
       if (isStartEnd) {
         actNode = ((ObjectFlow) objectFlow).getSource();
       } else {
         actNode = ((ObjectFlow) objectFlow).getTarget();
       }
       if (actNode != null) {
         if (getHost().getModel() instanceof View) {
           View view = (View) getHost().getModel();
           if (actNode.equals(view.getElement())) {
             return view;
           }
           // if there is no existing view we create it
           Node node =
               ViewService.createNode(
                   view,
                   actNode,
                   UMLVisualIDRegistry.getType(UMLVisualIDRegistry.getNodeVisualID(view, actNode)),
                   UMLDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT);
           if (node != null) {
             return node;
           }
         }
       }
     }
   }
   return null;
 }
コード例 #16
0
 /** @generated */
 protected void registerModel() {
   super.registerModel();
   View view = (View) getModel();
   if (view != null && view.isSetElement() && view.getElement() != null) {
     getViewer().getEditPartRegistry().put(view.getElement(), this);
   }
 }
コード例 #17
0
    /** @generated */
    protected List getObjectsBeingDropped() {
      TransferData data = getCurrentEvent().currentDataType;
      Collection uris = new HashSet();

      List result = new ArrayList();
      Object transferedObject = getJavaObject(data);
      if (transferedObject instanceof IStructuredSelection) {
        IStructuredSelection selection = (IStructuredSelection) transferedObject;
        for (Iterator it = selection.iterator(); it.hasNext(); ) {
          Object nextSelectedObject = it.next();
          if (nextSelectedObject instanceof SqlmodelNavigatorItem) {
            View view = ((SqlmodelNavigatorItem) nextSelectedObject).getView();
            nextSelectedObject = view.getElement();
          } else if (nextSelectedObject instanceof IAdaptable) {
            IAdaptable adaptable = (IAdaptable) nextSelectedObject;
            nextSelectedObject = adaptable.getAdapter(EObject.class);
          }

          if (nextSelectedObject instanceof EObject) {
            EObject modelElement = (EObject) nextSelectedObject;
            Resource modelElementResource = modelElement.eResource();
            uris.add(
                modelElementResource
                    .getURI()
                    .appendFragment(modelElementResource.getURIFragment(modelElement)));
          }

          if (nextSelectedObject instanceof EObject) {
            result.add(nextSelectedObject);
          }
        }
      }
      return result;
    }
コード例 #18
0
 /** @generated */
 public static List getOclet_1002SemanticChildren(View view) {
   if (!view.isSetElement()) {
     return Collections.EMPTY_LIST;
   }
   hub.top.adaptiveSystem.Oclet modelElement = (hub.top.adaptiveSystem.Oclet) view.getElement();
   List result = new LinkedList();
   {
     hub.top.adaptiveSystem.PreNet childElement = modelElement.getPreNet();
     int visualID =
         hub.top.adaptiveSystem.diagram.part.AdaptiveSystemVisualIDRegistry.getNodeVisualID(
             view, childElement);
     if (visualID == hub.top.adaptiveSystem.diagram.edit.parts.PreNetEditPart.VISUAL_ID) {
       result.add(
           new hub.top.adaptiveSystem.diagram.part.AdaptiveSystemNodeDescriptor(
               childElement, visualID));
     }
   }
   {
     hub.top.adaptiveSystem.DoNet childElement = modelElement.getDoNet();
     int visualID =
         hub.top.adaptiveSystem.diagram.part.AdaptiveSystemVisualIDRegistry.getNodeVisualID(
             view, childElement);
     if (visualID == hub.top.adaptiveSystem.diagram.edit.parts.DoNetEditPart.VISUAL_ID) {
       result.add(
           new hub.top.adaptiveSystem.diagram.part.AdaptiveSystemNodeDescriptor(
               childElement, visualID));
     }
   }
   return result;
 }
コード例 #19
0
 /** 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++;
   }
 }
コード例 #20
0
 /** @generated */
 protected void refreshLabel() {
   EditPolicy maskLabelPolicy =
       getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
   if (maskLabelPolicy == null) {
     maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
   }
   if (maskLabelPolicy == null) {
     View view = (View) getModel();
     if (view.isVisible()) {
       setLabelTextHelper(getFigure(), getLabelText());
       setLabelIconHelper(getFigure(), getLabelIcon());
     } else {
       setLabelTextHelper(getFigure(), ""); // $NON-NLS-1$
       setLabelIconHelper(getFigure(), null);
     }
   }
   Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
   if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
     ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
   }
   Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
   if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
     ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
   }
 }
コード例 #21
0
 /** @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;
     }
   }
 }
コード例 #22
0
  /** @generated */
  private String getLabelMapping_3003Text(View view) {
    IParser parser =
        ParserService.getInstance()
            .getParser(
                new IAdaptable() {

                  public Object getAdapter(Class adapter) {
                    if (String.class.equals(adapter)) {
                      return GMFMapVisualIDRegistry.getType(LabelMapping2EditPart.VISUAL_ID);
                    }
                    if (IElementType.class.equals(adapter)) {
                      return GMFMapElementTypes.LabelMapping_3003;
                    }
                    return null;
                  }
                });
    if (parser != null) {
      return parser.getPrintString(
          new EObjectAdapter(view.getElement() != null ? view.getElement() : view),
          ParserOptions.NONE.intValue());
    } else {
      GMFMapDiagramEditorPlugin.getInstance().logError("Parser was not found for label " + 3003);
      return "";
    }
  }
コード例 #23
0
    /** @was-generated */
    @Override
    public void activate() {
      if (viewId == null) {
        return;
      }

      // add self to global decorators registry
      List list = (List) allDecorators.get(viewId);
      if (list == null) {
        list = new ArrayList(2);
        list.add(this);
        allDecorators.put(viewId, list);
      } else if (!list.contains(this)) {
        list.add(this);
      }

      // start listening to changes in resources
      View view = (View) getDecoratorTarget().getAdapter(View.class);
      if (view == null) {
        return;
      }
      Diagram diagramView = view.getDiagram();
      if (diagramView == null) {
        return;
      }
      if (fileObserver == null) {
        FileChangeManager.getInstance()
            .addFileObserver(fileObserver = new MarkerObserver(diagramView));
      }
    }
コード例 #24
0
 /** @generated */
 public static List getAdaptiveProcessAdaptiveProcessCompartment_5001SemanticChildren(View view) {
   if (false == view.eContainer() instanceof View) {
     return Collections.EMPTY_LIST;
   }
   View containerView = (View) view.eContainer();
   if (!containerView.isSetElement()) {
     return Collections.EMPTY_LIST;
   }
   hub.top.adaptiveSystem.AdaptiveProcess modelElement =
       (hub.top.adaptiveSystem.AdaptiveProcess) containerView.getElement();
   List result = new LinkedList();
   for (Iterator it = modelElement.getNodes().iterator(); it.hasNext(); ) {
     hub.top.adaptiveSystem.Node childElement = (hub.top.adaptiveSystem.Node) it.next();
     int visualID =
         hub.top.adaptiveSystem.diagram.part.AdaptiveSystemVisualIDRegistry.getNodeVisualID(
             view, childElement);
     if (visualID == hub.top.adaptiveSystem.diagram.edit.parts.ConditionAPEditPart.VISUAL_ID) {
       result.add(
           new hub.top.adaptiveSystem.diagram.part.AdaptiveSystemNodeDescriptor(
               childElement, visualID));
       continue;
     }
     if (visualID == hub.top.adaptiveSystem.diagram.edit.parts.EventAPEditPart.VISUAL_ID) {
       result.add(
           new hub.top.adaptiveSystem.diagram.part.AdaptiveSystemNodeDescriptor(
               childElement, visualID));
       continue;
     }
   }
   return result;
 }
コード例 #25
0
  /**
   * Get the snap back hint for the view.
   *
   * @param view the view to snap back.
   * @return the snap back hint.
   */
  private String getSnapBackHint(View view) {

    String diagramType = view.getDiagram().getType();
    String parentType = ViewUtil.getViewContainer(view).getType();
    String labelType = view.getType();

    return diagramType + "_" + parentType + "-" + labelType;
  }
コード例 #26
0
 /** @generated */
 public static List getEvent_2008IncomingLinks(View view) {
   hub.top.adaptiveSystem.Event modelElement = (hub.top.adaptiveSystem.Event) view.getElement();
   Map crossReferences =
       EcoreUtil.CrossReferencer.find(view.eResource().getResourceSet().getResources());
   List result = new LinkedList();
   result.addAll(getIncomingTypeModelFacetLinks_ArcToEvent_3002(modelElement, crossReferences));
   return result;
 }
コード例 #27
0
 /**
  * Compares semantically the two given edit parts
  *
  * @param one The first edit part to be compared
  * @param other The second edit part to be compared
  * @return True if the two edit parts refer to the same model element, false otherwise
  */
 private boolean semanticCompareEditParts(EditPart one, EditPart other) {
   if (one.getModel() instanceof View && other.getModel() instanceof View) {
     View view1 = (View) one.getModel();
     View view2 = (View) other.getModel();
     return view1 != null && view2 != null && view1.getElement() == view2.getElement();
   }
   return false;
 }
コード例 #28
0
 /** @generated */
 private Collection<View> selectViewsByType(Collection<View> views, String type) {
   ArrayList<View> result = new ArrayList<View>();
   for (View nextView : views) {
     if (type.equals(nextView.getType()) && isOwnView(nextView)) {
       result.add(nextView);
     }
   }
   return result;
 }
コード例 #29
0
 /** @generated */
 protected void decorateView(
     View containerView,
     View view,
     IAdaptable semanticAdapter,
     String semanticHint,
     int index,
     boolean persisted) {
   if (semanticHint == null) {
     semanticHint =
         OntoUML.diagram.part.OntoUMLVisualIDRegistry.getType(
             OntoUML.diagram.edit.parts.RoleEditPart.VISUAL_ID);
     view.setType(semanticHint);
   }
   super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
   if (!OntoUML.diagram.edit.parts.ContainerEditPart.MODEL_ID.equals(
       OntoUML.diagram.part.OntoUMLVisualIDRegistry.getModelID(containerView))) {
     EAnnotation shortcutAnnotation = EcoreFactory.eINSTANCE.createEAnnotation();
     shortcutAnnotation.setSource("Shortcut"); // $NON-NLS-1$
     shortcutAnnotation
         .getDetails()
         .put("modelID", OntoUML.diagram.edit.parts.ContainerEditPart.MODEL_ID); // $NON-NLS-1$
     view.getEAnnotations().add(shortcutAnnotation);
   }
   IAdaptable eObjectAdapter = null;
   EObject eObject = (EObject) semanticAdapter.getAdapter(EObject.class);
   if (eObject != null) {
     eObjectAdapter = new EObjectAdapter(eObject);
   }
   getViewService()
       .createNode(
           eObjectAdapter,
           view,
           OntoUML.diagram.part.OntoUMLVisualIDRegistry.getType(
               OntoUML.diagram.edit.parts.WrappingLabel9EditPart.VISUAL_ID),
           ViewUtil.APPEND,
           true,
           getPreferencesHint());
   getViewService()
       .createNode(
           eObjectAdapter,
           view,
           OntoUML.diagram.part.OntoUMLVisualIDRegistry.getType(
               OntoUML.diagram.edit.parts.RoleNameEditPart.VISUAL_ID),
           ViewUtil.APPEND,
           true,
           getPreferencesHint());
   getViewService()
       .createNode(
           eObjectAdapter,
           view,
           OntoUML.diagram.part.OntoUMLVisualIDRegistry.getType(
               OntoUML.diagram.edit.parts.RoleAttributeCompartmentEditPart.VISUAL_ID),
           ViewUtil.APPEND,
           true,
           getPreferencesHint());
 }
コード例 #30
0
 /** @generated */
 public void createDecorators(IDecoratorTarget decoratorTarget) {
   View view = (View) decoratorTarget.getAdapter(View.class);
   if (view != null) {
     EAnnotation annotation = view.getEAnnotation("Shortcut"); // $NON-NLS-1$
     if (annotation != null) {
       decoratorTarget.installDecorator(
           SHORTCUTS_DECORATOR_ID, new ShortcutsDecorator(decoratorTarget));
     }
   }
 }