Package org.eclipse.graphiti.features.context.impl

Examples of org.eclipse.graphiti.features.context.impl.AddConnectionContext


   
    ConnectionStatement cs = createAndAddConnectionStatement(
        sAnchor, tAnchor);

    // add connection for business object
    AddConnectionContext addContext =
        new AddConnectionContext(sAnchor, tAnchor);
    addContext.setNewObject(cs);
    Connection newConnection =
        (Connection) getFeatureProvider().addIfPossible(addContext);
   
    return newConnection;
  }
View Full Code Here


      } else {
        // create new business object
        Flow eReference = createFlow(source, target);

        // add connection for business object
        AddConnectionContext addContext = new AddConnectionContext(
            context.getSourceAnchor(), context.getTargetAnchor());
        addContext.setNewObject(eReference);
        newConnection = (Connection) getFeatureProvider().addIfPossible(
            addContext);
      }
    }
View Full Code Here

  private Connection createConnectionAndSetBendpoints(BPMNEdge bpmnEdge, PictogramElement sourceElement,
      PictogramElement targetElement) {
    FixPointAnchor sourceAnchor = createAnchor(sourceElement);
    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();
        int size = waypoint.size() - 1;

        setAnchorLocation(sourceElement, sourceAnchor, waypoint.get(0));
        setAnchorLocation(targetElement, targetAnchor, waypoint.get(size));

        for (int i = 1; i < size; i++) {
          DIUtils.addBendPoint(freeForm, waypoint.get(i));
        }
      }
      featureProvider.link(connection, new Object[] { bpmnEdge.getBpmnElement(), bpmnEdge });
      return connection;
    } else {
      Activator.logStatus(new Status(IStatus.WARNING, Activator.PLUGIN_ID, "Unsupported feature "
          + ((EObject) context.getNewObject()).eClass().getName()));
    }
    return null;
  }
View Full Code Here

  public Connection create(ICreateConnectionContext context) {
    try {
      A source = getSourceBo(context);
      B target = getTargetBo(context);
      ModelHandler mh = ModelHandler.getInstance(getDiagram());
      AddConnectionContext addContext = new AddConnectionContext(context.getSourceAnchor(),
          context.getTargetAnchor());
      BaseElement flow = createFlow(mh, source, target);
//      flow.setId(EcoreUtil.generateUUID());
      addContext.setNewObject(flow);
      Connection connection = (Connection) getFeatureProvider().addIfPossible(addContext);
      ModelUtil.setID(flow);
      return connection;
    } catch (IOException e) {
      Activator.logError(e);
View Full Code Here

      return null;
    } else {
      // create new association
      final Association association = createAssociation(sourceBo, targetBo, context);
     
      final AddConnectionContext addContext = new AddConnectionContext(sourceAnchor
                                                                     , targetAnchor);
      addContext.setNewObject(association);
     
      return (Connection) getFeatureProvider().addIfPossible(addContext);
    }
  }
View Full Code Here

    if (source != null && target != null) {
      // create new business object
      SequenceFlow sequenceFlow = createSequenceFlow(source, target, context);

      // add connection for business object
      AddConnectionContext addContext = new AddConnectionContext(context.getSourceAnchor(), context.getTargetAnchor());
      addContext.setNewObject(sequenceFlow);
      newConnection = (Connection) getFeatureProvider().addIfPossible(addContext);
    }
    return newConnection;
  }
View Full Code Here

        targetAnchor = anchor;
        break;
      }
    }

    AddConnectionContext addContext = new AddConnectionContext(sourceAnchor, targetAnchor);

    List<GraphicInfo> bendpointList = new ArrayList<GraphicInfo>();
    if (model.getBpmnModel().getFlowLocationMap().containsKey(sequenceFlow.getId())) {
      List<GraphicInfo> pointList = model.getBpmnModel().getFlowLocationGraphicInfo(sequenceFlow.getId());
      if (pointList.size() > 2) {
        for (int i = 1; i < pointList.size() - 1; i++) {
          bendpointList.add(pointList.get(i));
        }
      }
    }
    addContext.putProperty("org.activiti.designer.bendpoints", bendpointList);
    addContext.putProperty("org.activiti.designer.connectionlabel", model.getBpmnModel().getLabelGraphicInfo(sequenceFlow.getId()));

    addContext.setNewObject(sequenceFlow);
    getDiagramTypeProvider().getFeatureProvider().addIfPossible(addContext);
  }
View Full Code Here

        targetAnchor = anchor;
        break;
      }
    }

    AddConnectionContext addContext = new AddConnectionContext(sourceAnchor, targetAnchor);

    List<GraphicInfo> bendpointList = new ArrayList<GraphicInfo>();
    if (model.getBpmnModel().getFlowLocationMap().containsKey(association.getId())) {
      List<GraphicInfo> pointList = model.getBpmnModel().getFlowLocationGraphicInfo(association.getId());
      if (pointList.size() > 2) {
        for (int i = 1; i < pointList.size() - 1; i++) {
          bendpointList.add(pointList.get(i));
        }
      }
    }

    addContext.putProperty("org.activiti.designer.bendpoints", bendpointList);

    addContext.setNewObject(association);
    getDiagramTypeProvider().getFeatureProvider().addIfPossible(addContext);
  }
View Full Code Here

TOP

Related Classes of org.eclipse.graphiti.features.context.impl.AddConnectionContext

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.