Package org.eclipse.graphiti.tb

Examples of org.eclipse.graphiti.tb.ContextMenuEntry


    addEntry(manager, addEntries, context, GEFActionConstants.GROUP_ADD, null);
    addActionToMenuIfAvailable(manager, RemoveAction.ACTION_ID, GEFActionConstants.GROUP_ADD);

    IFeatureProvider fp = getConfigurationProvider().getFeatureProvider();
    //IFeatureProvider fp = addEntries.getFeature().getFeatureProvider();
    addEntry(manager, new ContextMenuEntry(new DeleteRouteFeature(fp), context), context, GEFActionConstants.GROUP_ADD, null);

    IContextMenuEntry[] otherEntries = new IContextMenuEntry[lastIndex];
    System.arraycopy(contextMenuEntries, 0, otherEntries, 0, lastIndex);

    addEntries(manager, otherEntries, context, GEFActionConstants.GROUP_REST, null);
View Full Code Here


    IFeatureProvider fp = getFeatureProvider();
    ICustomFeature[] customFeatures = fp.getCustomFeatures(context);
    for (int i = 0; i < customFeatures.length; i++) {
      ICustomFeature customFeature = customFeatures[i];
      if (customFeature.isAvailable(context)) {
        ContextMenuEntry menuEntry = new ContextMenuEntry(customFeature, context);
        entries.add(menuEntry);
      }
    }

    // create a sub-menu for all AddNode operations
    ContextMenuEntry addNodesMenu = new ContextMenuEntry(null, null);
    // set the menu label
    addNodesMenu.setText(EditorMessages.camelMenuAddLabel); //$NON-NLS-1$
    // set the description
    addNodesMenu.setDescription("Add and connect new nodes"); //$NON-NLS-1$
    // display sub-menu hierarchical or flat
    addNodesMenu.setSubmenu(true);

    // new use a factory for building the menu structure
    AddNodeMenuFactory f = new AddNodeMenuFactory();
    f.setupMenuStructure(addNodesMenu, context, fp);

    entries.add(addNodesMenu);

    addNodesMenu.add(new ContextMenuEntry(new AddRouteFeature(fp), context));

    return entries.toArray(new IContextMenuEntry[entries.size()]);
  }
View Full Code Here

      // commented out as we already have a "add route" menu entry
      //addMenuItem(rootMenu, Messages.paletteRouteTitle, Messages.paletteRouteDescription, Route.class, context, fp);
      onlyEndpoints = true;
    }

    ContextMenuEntry endpointsEntry = new ContextMenuEntry(null, null);
    endpointsEntry.setText(Messages.endpointsDrawerTitle);
    endpointsEntry.setSubmenu(true);

    ContextMenuEntry routingEntry = new ContextMenuEntry(null, context);
    routingEntry.setText(Messages.routingDrawerTitle);
    routingEntry.setSubmenu(true);

    ContextMenuEntry controlFlowEntry = new ContextMenuEntry(null, context);
    controlFlowEntry.setText(Messages.controlFlowDrawerTitle);
    controlFlowEntry.setSubmenu(true);

    ContextMenuEntry transformationEntry = new ContextMenuEntry(null, context);
    transformationEntry.setText(Messages.transformationDrawerTitle);
    transformationEntry.setSubmenu(true);

    ContextMenuEntry miscEntry = new ContextMenuEntry(null, context);
    miscEntry.setText(Messages.miscellaneousDrawerTitle);
    miscEntry.setSubmenu(true);

    // then we need to fill the shelves menus
    fillEndpointsContextMenu(endpointsEntry, context, fp);
    if (!onlyEndpoints) {
      fillRoutingContextMenu(routingEntry, context, fp);
      fillControlFlowContextMenu(controlFlowEntry, context, fp);
      fillTransformationContextMenu(transformationEntry, context, fp);
      fillMiscellaneousContextMenu(miscEntry, context, fp);
    }

    // lets find what endpoints are available...
    if (selectedNode != null) {
      Set<Endpoint> endpoints = AbstractNodes.getAllEndpoints(selectedNode);
      Map<String, String> beans = AbstractNodes.getAllBeans(selectedNode);
      if (endpoints.size() > 0 || beans.size() > 0) {
        /*
        // TODO add a separator...
        ContextMenuEntry menuEntry = new ContextMenuEntry(null, null);
        menuEntry.setSubmenu(false);
        // add entry to parent
        endpointsEntry.add(menuEntry);
         */
      }
      if (endpoints.size() > 0) {
        boolean useChildMenu = false;
        if (useChildMenu) {
          ContextMenuEntry values = new ContextMenuEntry(null, null);
          values.setText(Messages.endpointsDrawerTitle);
          values.setSubmenu(true);

          addEndpointInstances(values, endpoints, context, fp);
          endpointsEntry.add(values);
        } else {
          addEndpointInstances(endpointsEntry, endpoints, context, fp);
        }
      }
      if (beans.size() > 0) {
        boolean useChildMenu = false;
        if (useChildMenu) {
          ContextMenuEntry values = new ContextMenuEntry(null, null);
          values.setText(Messages.endpointsDrawerTitle);
          values.setSubmenu(true);

          addBeanInstances(values, beans, context, fp);
          endpointsEntry.add(values);
        } else {
          addBeanInstances(endpointsEntry, beans, context, fp);
View Full Code Here

      // TODO change to allow us to add any new item to the selection...
      //if (newNode instanceof RouteSupport || (selectedNode != null && selectedNode.canConnectTo(newNode))) {

      // create a sub-menu for all AddNode operations
      ContextMenuEntry menuEntry = new ContextMenuEntry(feature, context);
      // set the menu label
      menuEntry.setText(label);
      // set the description
      menuEntry.setDescription(description);
      try {
        // set the image
        AbstractNode node = clazz.newInstance();
        String iconName = node.getIconName();
        menuEntry.setIconId(ImageProvider.getKeyForSmallIcon(iconName));
      } catch (Exception ex) {
        menuEntry.setIconId(DEFAULT_IMAGE_KEY);
      }
      // display sub-menu hierarchical or flat
      menuEntry.setSubmenu(false);
      // add entry to parent
      parent.add(menuEntry);
      //}
    }
  }
View Full Code Here

        if (getFeatureProvider().getBusinessObjectForPictogramElement(pictogramElement) == null) {
          continue;
        }
        Object object = getFeatureProvider().getBusinessObjectForPictogramElement(pictogramElement);
        if (object instanceof SequenceFlow) {
          ContextMenuEntry subMenuDelete = new ContextMenuEntry(new DeleteSequenceFlowFeature(getFeatureProvider()), context);
          subMenuDelete.setText("Delete sequence flow"); //$NON-NLS-1$
          subMenuDelete.setSubmenu(false);
          menuList.add(subMenuDelete);
        } else if (object instanceof Association) {
          final ContextMenuEntry subMenuDelete = new ContextMenuEntry(new DeleteAssociationFeature(getFeatureProvider()), context);
          subMenuDelete.setText(subMenuDelete.getFeature().getDescription());
          subMenuDelete.setSubmenu(false);
          menuList.add(subMenuDelete);
        } else if (object instanceof Pool) {
          ContextMenuEntry subMenuDelete = new ContextMenuEntry(new DeletePoolFeature(getFeatureProvider()), context);
          subMenuDelete.setText("Delete pool"); //$NON-NLS-1$
          subMenuDelete.setSubmenu(false);
          menuList.add(subMenuDelete);
        } else if (object instanceof CallActivity) {
          final CallActivity ca = (CallActivity) object;
          final String calledElement = ca.getCalledElement();

          if (calledElement != null && StringUtils.isNotBlank(calledElement)
                  && ActivitiWorkspaceUtil.getDiagramDataFilesByProcessId(calledElement).size() == 1) {
            final ContextMenuEntry openCalledElement
              = new ContextMenuEntry(new OpenCalledElementForCallActivity(getFeatureProvider()), context);
            openCalledElement.setText("Open Process '" + calledElement + "' in new diagram");
            openCalledElement.setSubmenu(false);
            menuList.add(openCalledElement);
          }
        }
      }
    }
View Full Code Here

TOP

Related Classes of org.eclipse.graphiti.tb.ContextMenuEntry

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.