Package org.eclipse.graphiti.mm.pictograms

Examples of org.eclipse.graphiti.mm.pictograms.Connection


    // 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


   * Handle moving a connection.
   */
  @Override
  public void postReconnect(IReconnectionContext context) {
   
    Connection conn = context.getConnection();
    Object bo = getBusinessObjectForPictogramElement(conn);
    eu.admire.dispel.containers.Package pck =
        Utility.getPackage(getDiagram());
   
    if (bo instanceof ConnectionStatement) {
     
      //if old source is CI, need to add it back as a statement
      ConnectionInitialization old =
          mCreateConnFeature.getConnectionInitialization(
              context.getOldAnchor())
      if (old != null) {
        ExpressionStatement es = Utility.wrapCI(old);
        Utility.addAsLastNonSubmitStatement(es, pck.getStatements());
      }
     
      //Remove the old connection
      ConnectionStatement cs = (ConnectionStatement) bo;
      EcoreUtil.delete(cs);

       //And add the new one
      mCreateConnFeature.createAndAddConnectionStatement(
          conn.getStart(), conn.getEnd());
    }

  }
View Full Code Here

            (ConnectionStatement) context.getNewObject();
        IPeCreateService peCreateService = Graphiti.getPeCreateService();
       
        // CONNECTION WITH POLYLINE

        Connection connection = peCreateService
            .createFreeFormConnection(getDiagram());
        connection.setStart(addConContext.getSourceAnchor());
        connection.setEnd(addConContext.getTargetAnchor());

        IGaService gaService = Graphiti.getGaService();
        Polyline polyline = gaService.createPolyline(connection);
        polyline.setStyle(StyleUtil.getStyleForConn(getDiagram()));
        ConnectionDecorator cd = peCreateService.createConnectionDecorator(
View Full Code Here

    return getCreateImageId();
  }

  @Override
  public Connection create(ICreateConnectionContext context) {
    Connection newConnection = null;

    // get EClasses which should be connected
    AbstractNode source = getNode(context.getSourceAnchor());
    AbstractNode target = getNode(context.getTargetAnchor());
View Full Code Here

    IAddConnectionContext addConContext = (IAddConnectionContext) context;
    Flow addedEReference = (Flow) context.getNewObject();

    IPeCreateService peCreateService = Graphiti.getPeCreateService();
    // CONNECTION WITH POLYLINE
    Connection connection = peCreateService.createFreeFormConnection(getDiagram());
    connection.setStart(addConContext.getSourceAnchor());
    connection.setEnd(addConContext.getTargetAnchor());
   
    IGaService gaService = Graphiti.getGaService();
    Polyline polyline = gaService.createPolyline(connection);
    polyline.setStyle(StyleUtil.getStyleForEClass(getDiagram()));
    polyline.setForeground(manageColor(StyleUtil.getColorConstant(PreferenceManager.getInstance().loadPreferenceAsString(PreferencesConstants.EDITOR_CONNECTION_COLOR))));
View Full Code Here

    int bottomConnectionIndex = 0;

    boolean hasTopMessage = false;
    EList<Connection> topConnections = topBoundaryAnchor.anchor.getOutgoingConnections();
    for (int i = 0; i < topConnections.size(); i++) {
      Connection connection = topConnections.get(i);
      EObject container = connection.getEnd().eContainer();
      if (container instanceof PropertyContainer) {
        String property = peService.getPropertyValue((PropertyContainer) container, MESSAGE_LINK);
        if (property != null && new Boolean(property)) {
          topConnectionIndex = i;
          hasTopMessage = true;
          break;
        }
      }
    }

    boolean hasBottomMessage = false;
    EList<Connection> bottomConnections = bottomBoundaryAnchor.anchor.getOutgoingConnections();
    for (int i = 0; i < bottomConnections.size(); i++) {
      Connection connection = bottomConnections.get(i);
      EObject container = connection.getEnd().eContainer();
      if (container instanceof PropertyContainer) {
        String property = peService.getPropertyValue((PropertyContainer) container, MESSAGE_LINK);
        if (property != null && new Boolean(property)) {
          bottomConnectionIndex = i;
          hasBottomMessage = true;
View Full Code Here

    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

  private static void updateEdge(BPMNEdge edge, Diagram diagram) {
    ContainerShape source = (ContainerShape) Graphiti.getLinkService()
        .getPictogramElements(diagram, edge.getSourceElement()).get(0);
    ContainerShape target = (ContainerShape) Graphiti.getLinkService()
        .getPictogramElements(diagram, edge.getTargetElement()).get(0);
    Connection connection = (Connection) Graphiti.getLinkService().getPictogramElements(diagram, edge).get(0);
    Tuple<FixPointAnchor, FixPointAnchor> anchors = getSourceAndTargetBoundaryAnchors(source, target, connection);

    ILocation loc = peService.getLocationRelativeToDiagram(anchors.getFirst());
    org.eclipse.dd.dc.Point p = edge.getWaypoint().get(0);
    p.setX(loc.getX());
View Full Code Here

      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

    IGaService gaService = Graphiti.getGaService();

    BaseElement element = (BaseElement) context.getNewObject();
    IAddConnectionContext addConContext = (IAddConnectionContext) context;

    Connection connection = peService.createFreeFormConnection(getDiagram());

    Object importProp = context.getProperty(DIImport.IMPORT_PROPERTY);
    if (importProp != null && (Boolean) importProp) {
      connection.setStart(addConContext.getSourceAnchor());
      connection.setEnd(addConContext.getTargetAnchor());
    } else {
      ContainerShape sourceContainer = (ContainerShape) addConContext.getSourceAnchor().eContainer();
      ContainerShape targetContainer = (ContainerShape) addConContext.getTargetAnchor().eContainer();
      Tuple<FixPointAnchor, FixPointAnchor> anchors = AnchorUtil.getSourceAndTargetBoundaryAnchors(
          sourceContainer, targetContainer, connection);

      connection.setStart(anchors.getFirst());
      connection.setEnd(anchors.getSecond());
    }
   
    if (ModelUtil.hasName(element)) {
      ConnectionDecorator labelDecorator = Graphiti.getPeService().createConnectionDecorator(connection, true, 0.5, true);
      Text text = gaService.createText(labelDecorator, ModelUtil.getName(element));
View Full Code Here

TOP

Related Classes of org.eclipse.graphiti.mm.pictograms.Connection

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.