Package org.eclipse.graphiti.features

Examples of org.eclipse.graphiti.features.IFeatureProvider


              @Override
              protected void doExecute() {
                IDiagramTypeProvider dtp =
                    de.getDiagramTypeProvider();
                IFeatureProvider fp = dtp.getFeatureProvider();
                CreatePEFeature peFeat = null;
                for(ICreateFeature ic :
                  fp.getCreateFeatures()) {
                  if (ic instanceof CreatePEFeature) {
                    peFeat = (CreatePEFeature) ic;
                  }
                }
                assertNotNull(peFeat);
View Full Code Here


              @Override
              protected void doExecute() {
                IDiagramTypeProvider dtp =
                    de.getDiagramTypeProvider();
                IFeatureProvider fp = dtp.getFeatureProvider();
                ICreateConnectionFeature cf =
                    fp.getCreateConnectionFeatures()[0];
                CreateConnectionContext cc =
                    new CreateConnectionContext();
               
                cc.setSourceAnchor(
                    fLiteralShape.getAnchors().get(0));
View Full Code Here

              @Override
              protected void doExecute() {
                IDiagramTypeProvider dtp =
                    de.getDiagramTypeProvider();
                IFeatureProvider fp = dtp.getFeatureProvider();

                final DeleteContext dc = new DeleteContext(
                    deleteShape);
                final IDeleteFeature df =
                    de.getDiagramTypeProvider(
View Full Code Here

              @Override
              protected void doExecute() {
                IDiagramTypeProvider dtp =
                    de.getDiagramTypeProvider();
                IFeatureProvider fp = dtp.getFeatureProvider();
                CreateStringLiteralFeature litFeat = null;
                for(ICreateFeature ic :
                  fp.getCreateFeatures()) {
                  if (ic instanceof
                      CreateStringLiteralFeature) {
                    litFeat =
                        (CreateStringLiteralFeature) ic;
                  }
View Full Code Here

              @Override
              protected void doExecute() {
                IDiagramTypeProvider dtp =
                    de.getDiagramTypeProvider();
                IFeatureProvider fp = dtp.getFeatureProvider();

                final DeleteContext dc = new DeleteContext(
                    deleteShape);
                final IDeleteFeature df =
                    de.getDiagramTypeProvider(
View Full Code Here

              @Override
              protected void doExecute() {
                IDiagramTypeProvider dtp =
                    de.getDiagramTypeProvider();
                IFeatureProvider fp = dtp.getFeatureProvider();
                CreateStringLiteralFeature litFeat = null;
                for(ICreateFeature ic : fp.getCreateFeatures()) {
                  if (ic instanceof CreateStringLiteralFeature) {
                    litFeat = (CreateStringLiteralFeature) ic;
                  }
                }
                assertNotNull(litFeat);
View Full Code Here

    int lastIndex = contextMenuEntries.length - 1;
    IContextMenuEntry addEntries = contextMenuEntries[lastIndex];
    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);
View Full Code Here

   * @see org.eclipse.graphiti.tb.DefaultToolBehaviorProvider#getContextButtonPad(org.eclipse.graphiti.features.context.IPictogramElementContext)
   */
  @Override
  public IContextButtonPadData getContextButtonPad(
      IPictogramElementContext context) {
    final IFeatureProvider featureProvider = getFeatureProvider();

    IContextButtonPadData data = super.getContextButtonPad(context);
    PictogramElement pe = context.getPictogramElement();

    // 1. set the generic context buttons
    // note, that we do not add 'remove' (just as an example)
    setGenericContextButtons(data, pe, CONTEXT_BUTTON_DELETE);

    //    // 2. set the collapse button
    //    // simply use a dummy custom feature (senseless example)
    //    CustomContext cc = new CustomContext(new PictogramElement[] { pe });
    //    ICustomFeature[] cf = getFeatureProvider().getCustomFeatures(cc);
    //    for (int i = 0; i < cf.length; i++) {
    //      ICustomFeature iCustomFeature = cf[i];
    //      if (iCustomFeature instanceof CollapseDummyFeature) {
    //        IContextButtonEntry collapseButton = ContextEntryHelper.createCollapseContextButton(true, iCustomFeature, cc);
    //        data.setCollapseContextButton(collapseButton);
    //      }
    //    }

    // 3. add one domain specific context-button, which offers all
    // available connection-features as drag&drop features...

    // 3.a. create new CreateConnectionContext
    {
      CreateConnectionContext ccc = new CreateConnectionContext();
      ccc.setSourcePictogramElement(pe);
      Anchor anchor = null;
      if (pe instanceof Anchor) {
        anchor = (Anchor) pe;
      } else if (pe instanceof AnchorContainer) {
        // assume, that our shapes always have chopbox anchors
        anchor = Graphiti.getPeService().getChopboxAnchor((AnchorContainer) pe);
      }
      ccc.setSourceAnchor(anchor);

      // 3.b. create context button and add all applicable features
      ContextButtonEntry button = new ContextButtonEntry(null, context);
      button.setText("Create connection"); //$NON-NLS-1$
      button.setIconId(ImageProvider.IMG_FLOW);
      ICreateConnectionFeature[] features = featureProvider.getCreateConnectionFeatures();
      for (ICreateConnectionFeature feature : features) {
        if (feature.isAvailable(ccc) && feature.canStartConnection(ccc))
          button.addDragAndDropFeature(feature);
      }

View Full Code Here

  @Override
  public IContextMenuEntry[] getContextMenu(ICustomContext context) {
    List<IContextMenuEntry> entries = new LinkedList<IContextMenuEntry>();

    // create a menu-entry in the sub-menu for each custom feature
    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);
View Full Code Here

    // first we add super decorators
    IDecorator[] superDecorators = super.getDecorators(pe);
    for (IDecorator d : superDecorators) decorators.add(d);
   
    // and then our own
    IFeatureProvider featureProvider = getFeatureProvider();
    Object bo = featureProvider.getBusinessObjectForPictogramElement(pe);
    if (bo instanceof AbstractNode) {
      AbstractNode node = (AbstractNode) bo;

      ValidationResult res = ValidationFactory.getInstance().validate(node);
      if (res.getInformationCount() > 0) {
View Full Code Here

TOP

Related Classes of org.eclipse.graphiti.features.IFeatureProvider

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.