Examples of PaletteCompartmentEntry


Examples of org.eclipse.graphiti.palette.impl.PaletteCompartmentEntry

  @Override
  public IPaletteCompartmentEntry[] getPalette() {
    List<IPaletteCompartmentEntry> ret = new ArrayList<IPaletteCompartmentEntry>();

    // the folder for endpoint types
    PaletteCompartmentEntry compartmentEntryEndpoints = new PaletteCompartmentEntry(Messages.endpointsDrawerTitle, null);
    ret.add(compartmentEntryEndpoints);
    compartmentEntryEndpoints.setInitiallyOpen(true);

    // the folder for routing types
    PaletteCompartmentEntry compartmentEntryRouting = new PaletteCompartmentEntry(Messages.routingDrawerTitle, null);
    ret.add(compartmentEntryRouting);
    compartmentEntryRouting.setInitiallyOpen(false);
   
    // the folder for control flow types
    PaletteCompartmentEntry compartmentEntryControlFlow = new PaletteCompartmentEntry(Messages.controlFlowDrawerTitle, null);
    ret.add(compartmentEntryControlFlow);
    compartmentEntryControlFlow.setInitiallyOpen(false);
   
    // the folder for transformation types
    PaletteCompartmentEntry compartmentEntryTransformation = new PaletteCompartmentEntry(Messages.transformationDrawerTitle, null);
    ret.add(compartmentEntryTransformation);
    compartmentEntryTransformation.setInitiallyOpen(false);

    // the folder for other types
    PaletteCompartmentEntry compartmentEntryMisc = new PaletteCompartmentEntry(Messages.miscellaneousDrawerTitle, null);
    ret.add(compartmentEntryMisc);
    compartmentEntryMisc.setInitiallyOpen(false);
   
    // add compartments from super class and skip first as its the connection menu
    IPaletteCompartmentEntry[] superCompartments = super.getPalette();
    for (int i = 1; i < superCompartments.length; i++) {
      IPaletteCompartmentEntry entry = superCompartments[i];
      for (IToolEntry toolEntry : entry.getToolEntries()) {
        if (toolEntry instanceof ObjectCreationToolEntry) {
          ObjectCreationToolEntry octe = (ObjectCreationToolEntry) toolEntry;
          if (octe.getCreateFeature() instanceof PaletteCategoryItemProvider) {
            PaletteCategoryItemProvider pcit = (PaletteCategoryItemProvider)octe.getCreateFeature();
            switch (pcit.getCategoryType()) {
            case ENDPOINTS:      compartmentEntryEndpoints.addToolEntry(toolEntry);
            break;
            case ROUTING:      compartmentEntryRouting.addToolEntry(toolEntry);
            break;
            case CONTROL_FLOW:    compartmentEntryControlFlow.addToolEntry(toolEntry);
            break;
            case TRANSFORMATION:  compartmentEntryTransformation.addToolEntry(toolEntry);
            break;
            case MISCELLANEOUS:    compartmentEntryMisc.addToolEntry(toolEntry);
            break;
            case NONE:
            default:        // do not add those items
              break;
            }
View Full Code Here

Examples of org.eclipse.graphiti.palette.impl.PaletteCompartmentEntry

    return ret.toArray(new IPaletteCompartmentEntry[ret.size()]);
  }

  private void createEventsCompartments(Bpmn2Preferences pref, List<IPaletteCompartmentEntry> ret,
      IFeatureProvider featureProvider) {
    PaletteCompartmentEntry compartmentEntry = new PaletteCompartmentEntry("Events", null);
    ret.add(compartmentEntry);

    createEntries(pref, FeatureMap.EVENTS, compartmentEntry, featureProvider);
  }
View Full Code Here

Examples of org.eclipse.graphiti.palette.impl.PaletteCompartmentEntry

    createEntries(pref, FeatureMap.EVENTS, compartmentEntry, featureProvider);
  }

  private void createOtherCompartments(Bpmn2Preferences pref, List<IPaletteCompartmentEntry> ret,
      IFeatureProvider featureProvider) {
    PaletteCompartmentEntry compartmentEntry = new PaletteCompartmentEntry("Other", null);
    compartmentEntry.setInitiallyOpen(false);
    ret.add(compartmentEntry);

    createEntries(pref, FeatureMap.OTHER, compartmentEntry, featureProvider);

  }
View Full Code Here

Examples of org.eclipse.graphiti.palette.impl.PaletteCompartmentEntry

  }

  private void createDataCompartments(Bpmn2Preferences pref, List<IPaletteCompartmentEntry> ret,
      IFeatureProvider featureProvider) {
    PaletteCompartmentEntry compartmentEntry = new PaletteCompartmentEntry("Data Items", null);
    compartmentEntry.setInitiallyOpen(false);
    ret.add(compartmentEntry);

    createEntries(pref, FeatureMap.DATA, compartmentEntry, featureProvider);

  }
View Full Code Here

Examples of org.eclipse.graphiti.palette.impl.PaletteCompartmentEntry

  }

  private void createEventDefinitionsCompartments(Bpmn2Preferences pref, List<IPaletteCompartmentEntry> ret,
      IFeatureProvider featureProvider) {
    PaletteCompartmentEntry compartmentEntry = new PaletteCompartmentEntry("Event Definitions", null);
    compartmentEntry.setInitiallyOpen(false);
    ret.add(compartmentEntry);

    createEntries(pref, FeatureMap.EVENT_DEFINITIONS, compartmentEntry, featureProvider);

  }
View Full Code Here

Examples of org.eclipse.graphiti.palette.impl.PaletteCompartmentEntry

  }

  private void createGatewaysCompartments(Bpmn2Preferences pref, List<IPaletteCompartmentEntry> ret,
      IFeatureProvider featureProvider) {
    PaletteCompartmentEntry compartmentEntry = new PaletteCompartmentEntry("Gateways", null);
    ret.add(compartmentEntry);

    createEntries(pref, FeatureMap.GATEWAYS, compartmentEntry, featureProvider);

  }
View Full Code Here

Examples of org.eclipse.graphiti.palette.impl.PaletteCompartmentEntry

  }

  private void createTasksCompartments(Bpmn2Preferences pref, List<IPaletteCompartmentEntry> ret,
      IFeatureProvider featureProvider) {
    PaletteCompartmentEntry compartmentEntry = new PaletteCompartmentEntry("Tasks", null);
    ret.add(compartmentEntry);

    createEntries(pref, FeatureMap.TASKS, compartmentEntry, featureProvider);

  }
View Full Code Here

Examples of org.eclipse.graphiti.palette.impl.PaletteCompartmentEntry

  }

  private void createConnectors(Bpmn2Preferences pref, List<IPaletteCompartmentEntry> ret,
      IFeatureProvider featureProvider) {
    PaletteCompartmentEntry compartmentEntry;
    compartmentEntry = new PaletteCompartmentEntry("Connectors", null);
    ret.add(compartmentEntry);
    // add all create-connection-features to the new stack-entry
    ICreateConnectionFeature[] createConnectionFeatures = featureProvider.getCreateConnectionFeatures();
    for (ICreateConnectionFeature cf : createConnectionFeatures) {
      if (pref.isEnabled(FeatureMap.getElement(cf))) {
        ConnectionCreationToolEntry connectionCreationToolEntry = new ConnectionCreationToolEntry(
            cf.getCreateName(), cf.getCreateDescription(), cf.getCreateImageId(),
            cf.getCreateLargeImageId());
        connectionCreationToolEntry.addCreateConnectionFeature(cf);
        compartmentEntry.addToolEntry(connectionCreationToolEntry);
      }
    }
  }
View Full Code Here

Examples of org.eclipse.graphiti.palette.impl.PaletteCompartmentEntry

      }
    }
  }

  private void createCustomTasks(List<IPaletteCompartmentEntry> ret, IFeatureProvider featureProvider) {
    PaletteCompartmentEntry compartmentEntry;
    compartmentEntry = new PaletteCompartmentEntry("Custom Task", null);
    compartmentEntry.setInitiallyOpen(false);
    ret.add(compartmentEntry);

    IConfigurationElement[] config = Platform.getExtensionRegistry().getConfigurationElementsFor(
        ICustomTaskEditor.TASK_EDITOR_ID);

    try {
      for (IConfigurationElement e : config) {
        String name = e.getAttribute("name");
        String id = e.getAttribute("id");

        final Object o = e.createExecutableExtension("createFeature");
        if (o instanceof CustomTaskFeatureContainer) {

          CustomTaskFeatureContainer container = (CustomTaskFeatureContainer)o;
          container.setId(featureProvider, id);
          ICreateFeature cf = container.getCreateFeature(featureProvider);
          ObjectCreationToolEntry objectCreationToolEntry = new ObjectCreationToolEntry(name,
              cf.getCreateDescription(), cf.getCreateImageId(), cf.getCreateLargeImageId(), cf);
          compartmentEntry.addToolEntry(objectCreationToolEntry);

        }
      }
    } catch (Exception ex) {
      Activator.logError(ex);
View Full Code Here

Examples of org.eclipse.graphiti.palette.impl.PaletteCompartmentEntry

    // add compartments from super class if not disabled
    IPaletteCompartmentEntry[] superCompartments = super.getPalette();

    // create new compartments
    IPaletteCompartmentEntry connectionCompartmentEntry = new PaletteCompartmentEntry("Connection", null);
    IPaletteCompartmentEntry eventCompartmentEntry = new PaletteCompartmentEntry("Event", null);
    IPaletteCompartmentEntry taskCompartmentEntry = new PaletteCompartmentEntry("Task", null);
    IPaletteCompartmentEntry gatewayCompartmentEntry = new PaletteCompartmentEntry("Gateway", null);
    IPaletteCompartmentEntry containerCompartmentEntry = new PaletteCompartmentEntry("Container", null);
    IPaletteCompartmentEntry boundaryEventCompartmentEntry = new PaletteCompartmentEntry("Boundary event", null);
    IPaletteCompartmentEntry intermediateEventCompartmentEntry = new PaletteCompartmentEntry("Intermediate event", null);
    IPaletteCompartmentEntry artifactsCompartmentEntry = new PaletteCompartmentEntry("Artifacts", null);
    IPaletteCompartmentEntry alfrescoCompartmentEntry = new PaletteCompartmentEntry("Alfresco", PluginImage.IMG_ALFRESCO_LOGO.getImageKey());

    for (final IPaletteCompartmentEntry entry : superCompartments) {

      // Prune any disabled palette entries in the Objects compartment
      if ("Objects".equals(entry.getLabel())) {
        pruneDisabledPaletteEntries(project, entry);
      }
    }

    for (IPaletteCompartmentEntry iPaletteCompartmentEntry : superCompartments) {
      final List<IToolEntry> toolEntries = iPaletteCompartmentEntry.getToolEntries();

      for (IToolEntry toolEntry : toolEntries) {
        if ("sequenceflow".equalsIgnoreCase(toolEntry.getLabel())) {
          connectionCompartmentEntry.getToolEntries().add(toolEntry);
        } else if ("association".equalsIgnoreCase(toolEntry.getLabel())) {
          connectionCompartmentEntry.getToolEntries().add(toolEntry);
        } else if ("startevent".equalsIgnoreCase(toolEntry.getLabel())) {
          eventCompartmentEntry.getToolEntries().add(toolEntry);
        } else if ("timerstartevent".equalsIgnoreCase(toolEntry.getLabel())) {
          eventCompartmentEntry.getToolEntries().add(toolEntry);
        } else if ("errorstartevent".equalsIgnoreCase(toolEntry.getLabel())) {
          eventCompartmentEntry.getToolEntries().add(toolEntry);
        } else if ("endevent".equalsIgnoreCase(toolEntry.getLabel())) {
          eventCompartmentEntry.getToolEntries().add(toolEntry);
        } else if ("errorendevent".equalsIgnoreCase(toolEntry.getLabel())) {
          eventCompartmentEntry.getToolEntries().add(toolEntry);
        } else if ("terminateendevent".equalsIgnoreCase(toolEntry.getLabel())) {
          eventCompartmentEntry.getToolEntries().add(toolEntry);
        } else if ("usertask".equalsIgnoreCase(toolEntry.getLabel())) {
          taskCompartmentEntry.getToolEntries().add(toolEntry);
        } else if ("messagestartevent".equalsIgnoreCase(toolEntry.getLabel())) {
          eventCompartmentEntry.getToolEntries().add(toolEntry);
        } else if ("scripttask".equalsIgnoreCase(toolEntry.getLabel())) {
          taskCompartmentEntry.getToolEntries().add(toolEntry);
        } else if ("servicetask".equalsIgnoreCase(toolEntry.getLabel())) {
          taskCompartmentEntry.getToolEntries().add(toolEntry);
        } else if ("mailtask".equalsIgnoreCase(toolEntry.getLabel())) {
          taskCompartmentEntry.getToolEntries().add(toolEntry);
        } else if ("manualtask".equalsIgnoreCase(toolEntry.getLabel())) {
          taskCompartmentEntry.getToolEntries().add(toolEntry);
        } else if ("receivetask".equalsIgnoreCase(toolEntry.getLabel())) {
          taskCompartmentEntry.getToolEntries().add(toolEntry);
        } else if ("businessruletask".equalsIgnoreCase(toolEntry.getLabel())) {
          taskCompartmentEntry.getToolEntries().add(toolEntry);
        } else if ("timerboundaryevent".equalsIgnoreCase(toolEntry.getLabel())) {
          boundaryEventCompartmentEntry.getToolEntries().add(toolEntry);
        } else if ("errorboundaryevent".equalsIgnoreCase(toolEntry.getLabel())) {
          boundaryEventCompartmentEntry.getToolEntries().add(toolEntry);
        } else if ("signalboundaryevent".equalsIgnoreCase(toolEntry.getLabel())) {
          boundaryEventCompartmentEntry.getToolEntries().add(toolEntry);
        } else if ("messageboundaryevent".equalsIgnoreCase(toolEntry.getLabel())) {
          boundaryEventCompartmentEntry.getToolEntries().add(toolEntry);
        } else if ("timercatchingevent".equalsIgnoreCase(toolEntry.getLabel())) {
          intermediateEventCompartmentEntry.getToolEntries().add(toolEntry);
        } else if ("signalcatchingevent".equalsIgnoreCase(toolEntry.getLabel())) {
          intermediateEventCompartmentEntry.getToolEntries().add(toolEntry);
        } else if ("messagecatchingevent".equalsIgnoreCase(toolEntry.getLabel())) {
          intermediateEventCompartmentEntry.getToolEntries().add(toolEntry);
        } else if ("signalthrowingevent".equalsIgnoreCase(toolEntry.getLabel())) {
          intermediateEventCompartmentEntry.getToolEntries().add(toolEntry);
        } else if ("nonethrowingevent".equalsIgnoreCase(toolEntry.getLabel())) {
          intermediateEventCompartmentEntry.getToolEntries().add(toolEntry);
        } else if ("parallelgateway".equalsIgnoreCase(toolEntry.getLabel())) {
          gatewayCompartmentEntry.getToolEntries().add(toolEntry);
        } else if ("exclusivegateway".equalsIgnoreCase(toolEntry.getLabel())) {
          gatewayCompartmentEntry.getToolEntries().add(toolEntry);
        } else if ("inclusivegateway".equalsIgnoreCase(toolEntry.getLabel())) {
          gatewayCompartmentEntry.getToolEntries().add(toolEntry);
        } else if ("eventgateway".equalsIgnoreCase(toolEntry.getLabel())) {
          gatewayCompartmentEntry.getToolEntries().add(toolEntry);
        } else if ("subprocess".equalsIgnoreCase(toolEntry.getLabel())) {
          containerCompartmentEntry.getToolEntries().add(toolEntry);
        } else if ("pool".equalsIgnoreCase(toolEntry.getLabel())) {
          containerCompartmentEntry.getToolEntries().add(toolEntry);
        } else if ("lane".equalsIgnoreCase(toolEntry.getLabel())) {
          containerCompartmentEntry.getToolEntries().add(toolEntry);
        } else if ("eventsubprocess".equalsIgnoreCase(toolEntry.getLabel())) {
          containerCompartmentEntry.getToolEntries().add(toolEntry);
        } else if ("callactivity".equalsIgnoreCase(toolEntry.getLabel())) {
          taskCompartmentEntry.getToolEntries().add(toolEntry);
        } else if ("alfrescousertask".equalsIgnoreCase(toolEntry.getLabel())) {
          alfrescoCompartmentEntry.getToolEntries().add(toolEntry);
        } else if ("alfrescostartevent".equalsIgnoreCase(toolEntry.getLabel())) {
          alfrescoCompartmentEntry.getToolEntries().add(toolEntry);
        } else if ("alfrescoscripttask".equalsIgnoreCase(toolEntry.getLabel())) {
          alfrescoCompartmentEntry.getToolEntries().add(toolEntry);
        } else if ("alfrescomailtask".equalsIgnoreCase(toolEntry.getLabel())) {
          alfrescoCompartmentEntry.getToolEntries().add(toolEntry);
        } else if ("annotation".equalsIgnoreCase(toolEntry.getLabel())) {
          artifactsCompartmentEntry.getToolEntries().add(toolEntry);
        }
      }
    }
    // Always add the connection compartment
    ret.add(connectionCompartmentEntry);

    if (eventCompartmentEntry.getToolEntries().size() > 0) {
      ret.add(eventCompartmentEntry);
    }
    if (taskCompartmentEntry.getToolEntries().size() > 0) {
      ret.add(taskCompartmentEntry);
    }
    if (containerCompartmentEntry.getToolEntries().size() > 0) {
      ret.add(containerCompartmentEntry);
    }
    if (gatewayCompartmentEntry.getToolEntries().size() > 0) {
      ret.add(gatewayCompartmentEntry);
    }
    if (boundaryEventCompartmentEntry.getToolEntries().size() > 0) {
      ret.add(boundaryEventCompartmentEntry);
    }
    if (intermediateEventCompartmentEntry.getToolEntries().size() > 0) {
      ret.add(intermediateEventCompartmentEntry);
    }
    if (!artifactsCompartmentEntry.getToolEntries().isEmpty()) {
      ret.add(artifactsCompartmentEntry);
    }
    if (PreferencesUtil.getBooleanPreference(Preferences.ALFRESCO_ENABLE) && alfrescoCompartmentEntry.getToolEntries().size() > 0) {
      ret.add(alfrescoCompartmentEntry);
    }

    final Map<String, List<CustomServiceTaskContext>> tasksInDrawers = new HashMap<String, List<CustomServiceTaskContext>>();

    final List<CustomServiceTaskContext> customServiceTaskContexts = ExtensionUtil.getCustomServiceTaskContexts(project);

    final ImageRegistry reg = GraphitiUIPlugin.getDefault().getImageRegistry();
    for (final CustomServiceTaskContext taskContext : customServiceTaskContexts) {
      if (reg.get(taskContext.getSmallImageKey()) == null) {
        reg.put(taskContext.getSmallImageKey(),
                new Image(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell().getDisplay(), taskContext.getSmallIconStream()));
      }
      if (reg.get(taskContext.getLargeImageKey()) == null) {
        reg.put(taskContext.getLargeImageKey(),
                new Image(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell().getDisplay(), taskContext.getLargeIconStream()));
      }
      if (reg.get(taskContext.getShapeImageKey()) == null) {
        reg.put(taskContext.getShapeImageKey(),
                new Image(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell().getDisplay(), taskContext.getShapeIconStream()));
      }
    }

    for (final CustomServiceTaskContext taskContext : customServiceTaskContexts) {
      if (!tasksInDrawers.containsKey(taskContext.getServiceTask().contributeToPaletteDrawer())) {
        tasksInDrawers.put(taskContext.getServiceTask().contributeToPaletteDrawer(), new ArrayList<CustomServiceTaskContext>());
      }
      tasksInDrawers.get(taskContext.getServiceTask().contributeToPaletteDrawer()).add(taskContext);
    }

    for (final Entry<String, List<CustomServiceTaskContext>> drawer : tasksInDrawers.entrySet()) {

      // Sort the list
      Collections.sort(drawer.getValue());

      final IPaletteCompartmentEntry paletteCompartmentEntry = new PaletteCompartmentEntry(drawer.getKey(), null);

      for (final CustomServiceTaskContext currentDrawerItem : drawer.getValue()) {
        final CreateCustomServiceTaskFeature feature = new CreateCustomServiceTaskFeature(getFeatureProvider(), currentDrawerItem.getServiceTask().getName(),
                currentDrawerItem.getServiceTask().getDescription(), currentDrawerItem.getServiceTask().getClass().getCanonicalName());
        final IToolEntry entry = new ObjectCreationToolEntry(currentDrawerItem.getServiceTask().getName(), currentDrawerItem.getServiceTask().getDescription(),
                currentDrawerItem.getSmallImageKey(), null, feature);
        paletteCompartmentEntry.getToolEntries().add(entry);
      }
      ret.add(paletteCompartmentEntry);
    }

    return ret.toArray(new IPaletteCompartmentEntry[ret.size()]);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.