Examples of IAddFeature


Examples of org.eclipse.graphiti.features.IAddFeature

    addContext.setTargetContainer(diagram);
    addContext.setX(x);
    addContext.setY(y);
    y += 100;

    IAddFeature addFeature = featureProvider.getAddFeature(addContext);
    if (addFeature.canAdd(addContext)) {
      PictogramElement destState = null;
      if (processedNodes.contains(node) == false) {
        destState = addFeature.add(addContext);
      } else {
        destState = featureProvider.getPictogramElementForBusinessObject(node);
      }
      // remember the node
      processedNodes.add(node);
View Full Code Here

Examples of org.eclipse.graphiti.features.IAddFeature

    addContext.setNewObject(node);
    addContext.setLocation(x, y);
    addContext.setTargetContainer(getDiagram());

    // execute the add to diagram action
    IAddFeature addFeature = getFeatureProvider().getAddFeature(addContext);
    PictogramElement newNode = null;
    if (addFeature.canAdd(addContext)) {
      newNode = addFeature.add(addContext);
      if (newNode != null) {
        RouteSupport selectedRoute = Activator.getDiagramEditor().getSelectedRoute();
        if (selectedRoute != null) {
          selectedRoute.addChild(node);
        }
View Full Code Here

Examples of org.eclipse.graphiti.features.IAddFeature

    BaseElement bpmnElement = shape.getBpmnElement();
    if (shape.getChoreographyActivityShape() != null) {
      // FIXME: we currently generate participant bands automatically
      return;
    }
    IAddFeature addFeature = featureProvider.getAddFeature(new AddContext(new AreaContext(), bpmnElement));

    if (addFeature == null) {
      Activator.logStatus(new Status(IStatus.WARNING, Activator.PLUGIN_ID, "Element not supported: "
          + bpmnElement.eClass().getName()));
      return;
    }

    AddContext context = new AddContext();
    context.putProperty(IMPORT_PROPERTY, true);
    context.setNewObject(bpmnElement);
    context.setSize((int) shape.getBounds().getWidth(), (int) shape.getBounds().getHeight());

    if (bpmnElement instanceof Lane) {
      handleLane(bpmnElement, context, shape);
    } else if (bpmnElement instanceof FlowNode) {
      handleFlowNode((FlowNode) bpmnElement, context, shape);
    } else {
      context.setTargetContainer(diagram);
      context.setLocation((int) shape.getBounds().getX(), (int) shape.getBounds().getY());
    }

    if (addFeature.canAdd(context)) {
      PictogramElement newContainer = addFeature.add(context);
      featureProvider.link(newContainer, new Object[] { bpmnElement, shape });
      if (bpmnElement instanceof Participant) {
        elements.put(((Participant) bpmnElement).getProcessRef(), newContainer);
      }
      elements.put(bpmnElement, newContainer);
View Full Code Here

Examples of org.eclipse.graphiti.features.IAddFeature

        AddContext context = new AddContext();
        context.setTargetContainer((ContainerShape) newContainer);
        context.setNewObject(obj);

        IAddFeature aFeat = featureProvider.getAddFeature(context);
        if (aFeat != null && aFeat.canAdd(context)) {
          aFeat.add(context);
        }
      }
    }
  }
View Full Code Here

Examples of org.eclipse.graphiti.features.IAddFeature

    FixPointAnchor targetAnchor = createAnchor(targetElement);

    AddConnectionContext context = new AddConnectionContext(sourceAnchor, targetAnchor);
    context.setNewObject(bpmnEdge.getBpmnElement());

    IAddFeature addFeature = featureProvider.getAddFeature(context);
    if (addFeature != null && addFeature.canAdd(context)) {
      context.putProperty(IMPORT_PROPERTY, true);
      Connection connection = (Connection) addFeature.add(context);

      if (connection instanceof FreeFormConnectionImpl) {
        FreeFormConnectionImpl freeForm = (FreeFormConnectionImpl) connection;

        List<Point> waypoint = bpmnEdge.getWaypoint();
View Full Code Here

Examples of org.eclipse.graphiti.features.IAddFeature

    for (FeatureContainer container : containers) {
      if (id!=null && !(container instanceof CustomTaskFeatureContainer))
        continue;
      Object o = container.getApplyObject(context);
      if (o != null && container.canApplyTo(o)) {
        IAddFeature feature = container.getAddFeature(this);
        if (feature == null) {
          break;
        }
        return feature;
      }
View Full Code Here

Examples of org.eclipse.graphiti.features.IAddFeature

    lane.setId(getNextId(lane, "lane"));
    lane.setParentProcess(newProcess);
    newProcess.getLanes().add(lane);

    AddContext laneContext = new AddContext(new AreaContext(), lane);
    IAddFeature addFeature = getFeatureProvider().getAddFeature(laneContext);
    laneContext.setNewObject(lane);
    laneContext.setSize(poolElement.getGraphicsAlgorithm().getWidth() - 20, poolElement.getGraphicsAlgorithm().getHeight());
    laneContext.setTargetContainer((ContainerShape) poolElement);
    laneContext.setLocation(20, 0);
    if (addFeature.canAdd(laneContext)) {
      PictogramElement laneContainer = addFeature.add(laneContext);
      getFeatureProvider().link(laneContainer, new Object[] { lane });
    }

    // return newly created business object(s)
    return new Object[] { newPool };
View Full Code Here

Examples of org.eclipse.graphiti.features.IAddFeature

    }

    final IFeatureProvider featureProvider = getDiagramTypeProvider().getFeatureProvider();

    AddContext context = new AddContext(new AreaContext(), element);
    IAddFeature addFeature = featureProvider.getAddFeature(context);
    context.setNewObject(element);
    context.setSize((int) graphicInfo.getWidth(), (int) graphicInfo.getHeight());
    context.setTargetContainer(parent);

    int x = (int) graphicInfo.getX();
    int y = (int) graphicInfo.getY();

    if (parent instanceof Diagram == false) {
      x = x - parent.getGraphicsAlgorithm().getX();
      y = y - parent.getGraphicsAlgorithm().getY();
    }

    context.setLocation(x, y);

    PictogramElement pictElement = null;
    if (addFeature.canAdd(context)) {
      pictElement = addFeature.add(context);
      featureProvider.link(pictElement, new Object[] { element });
    }

    return pictElement;
  }
View Full Code Here

Examples of org.eclipse.graphiti.features.IAddFeature

      if (flowElement instanceof SequenceFlow) {
        continue;
      }

      AddContext context = new AddContext(new AreaContext(), flowElement);
      IAddFeature addFeature = featureProvider.getAddFeature(context);

      if (addFeature == null) {
        System.out.println("Element not supported: " + flowElement);
        return;
      }

      GraphicInfo graphicInfo = locationMap.get(flowElement.getId());
      if (graphicInfo == null) {

        noDIList.add(flowElement);

      } else {

        context.setNewObject(flowElement);
        context.setSize((int) graphicInfo.getWidth(), (int) graphicInfo.getHeight());

        ContainerShape parentContainer = null;
        if (parentShape instanceof Diagram) {
          parentContainer = getParentContainer(flowElement.getId(), process, (Diagram) parentShape);
        } else {
          parentContainer = parentShape;
        }

        context.setTargetContainer(parentContainer);
        if (parentContainer instanceof Diagram == false) {
          Point location = getLocation(parentContainer);
          context.setLocation((int) graphicInfo.getX() - location.x, (int) graphicInfo.getY() - location.y);
        } else {
          context.setLocation((int) graphicInfo.getX(), (int) graphicInfo.getY());
        }

        if (flowElement instanceof ServiceTask) {

          ServiceTask serviceTask = (ServiceTask) flowElement;

          if (serviceTask.isExtended()) {

            CustomServiceTask targetTask = findCustomServiceTask(serviceTask);

            if (targetTask != null) {
              serviceTask.setImplementationType(ImplementationType.IMPLEMENTATION_TYPE_CLASS);
              serviceTask.setImplementation(targetTask.getRuntimeClassname());
              for (FieldExtension field : serviceTask.getFieldExtensions()) {
                CustomProperty customFieldProperty = new CustomProperty();
                customFieldProperty.setName(field.getFieldName());
                if (StringUtils.isNotEmpty(field.getExpression())) {
                  customFieldProperty.setSimpleValue(field.getExpression());
                } else {
                  customFieldProperty.setSimpleValue(field.getStringValue());
                }
                serviceTask.getCustomProperties().add(customFieldProperty);
              }

              serviceTask.getFieldExtensions().clear();
            }
          }

        }

        if (flowElement instanceof BoundaryEvent) {
          BoundaryEvent boundaryEvent = (BoundaryEvent) flowElement;
          if (boundaryEvent.getAttachedToRef() != null) {
            ContainerShape container = (ContainerShape) featureProvider.getPictogramElementForBusinessObject(boundaryEvent.getAttachedToRef());

            if (container != null) {
              AddContext boundaryContext = new AddContext(new AreaContext(), boundaryEvent);
              boundaryContext.setTargetContainer(container);
              Point location = getLocation(container);
              boundaryContext.setLocation((int) graphicInfo.getX() - location.x, (int) graphicInfo.getY() - location.y);

              if (addFeature.canAdd(boundaryContext)) {
                PictogramElement newBoundaryContainer = addFeature.add(boundaryContext);
                featureProvider.link(newBoundaryContainer, new Object[] { boundaryEvent });
              }
            }
          }
        } else if (addFeature.canAdd(context)) {
          PictogramElement newContainer = addFeature.add(context);
          featureProvider.link(newContainer, new Object[] { flowElement });

          if (flowElement instanceof SubProcess) {
            drawFlowElements(((SubProcess) flowElement).getFlowElements(), locationMap, (ContainerShape) newContainer, process);
          }
View Full Code Here

Examples of org.eclipse.graphiti.features.IAddFeature

      if (artifact instanceof Association) {
        continue;
      }

      final AddContext context = new AddContext(new AreaContext(), artifact);
      final IAddFeature addFeature = featureProvider.getAddFeature(context);

      if (addFeature == null) {
        System.out.println("Element not supported: " + artifact);
        return;
      }

      final GraphicInfo gi = locationMap.get(artifact.getId());
      if (gi == null) {
        artifactsWithoutDI.add(artifact);
      } else {
        context.setNewObject(artifact);
        context.setSize((int) gi.getWidth(), (int) gi.getHeight());

        ContainerShape parentContainer = null;
        if (parent instanceof Diagram) {
          parentContainer = getParentContainer(artifact.getId(), process, (Diagram) parent);
        } else {
          parentContainer = parent;
        }

        context.setTargetContainer(parentContainer);
        if (parentContainer instanceof Diagram) {
          context.setLocation((int) gi.getX(), (int) gi.getY());
        } else {
          final Point location = getLocation(parentContainer);

          context.setLocation((int) gi.getX() - location.x, (int) gi.getY() - location.y);
        }

        if (addFeature.canAdd(context)) {
          final PictogramElement newContainer = addFeature.add(context);
          featureProvider.link(newContainer, new Object[] { artifact });
        }
      }
    }
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.