Package org.eclipse.draw2d

Examples of org.eclipse.draw2d.ConnectionAnchor


  public ConnectionAnchor getConnectionAnchor(String terminal) {
    return connectionAnchors.get(terminal);
  }

  public ConnectionAnchor getConnectionAnchorAt(Point p) {
    ConnectionAnchor closest = null;
    long min = Long.MAX_VALUE;

    Collection<FixedConnectionAnchor> coll = connectionAnchors.values();
    Iterator<FixedConnectionAnchor> iter = coll.iterator();
    while (iter.hasNext()) {
      ConnectionAnchor anchor = iter.next();
      Point p2 = anchor.getLocation(null);
      long d = p.getDistance2(p2);
      if (d < min) {
        min = d;
        closest = anchor;
      }
View Full Code Here


    }
    return null;
  }

  public ConnectionAnchor getSourceConnectionAnchorAt(Point p) {
    ConnectionAnchor closest = null;
    long min = Long.MAX_VALUE;

    Enumeration<FixedConnectionAnchor> e = getSourceConnectionAnchors().elements();
    while (e.hasMoreElements()) {
      ConnectionAnchor c = e.nextElement();
      Point p2 = c.getLocation(null);
      long d = p.getDistance2(p2);
      if (d < min) {
        min = d;
        closest = c;
      }
View Full Code Here

  public Vector<FixedConnectionAnchor> getSourceConnectionAnchors() {
    return outputConnectionAnchors;
  }

  public ConnectionAnchor getTargetConnectionAnchorAt(Point p) {
    ConnectionAnchor closest = null;
    long min = Long.MAX_VALUE;

    Enumeration<FixedConnectionAnchor> e = getTargetConnectionAnchors().elements();
    while (e.hasMoreElements()) {
      ConnectionAnchor c = e.nextElement();
      Point p2 = c.getLocation(null);
      long d = p.getDistance2(p2);
      if (d < min) {
        min = d;
        closest = c;
      }
View Full Code Here

  @Override
  protected Command getConnectionCompleteCommand(CreateConnectionRequest request) {
    if (request.getStartCommand() instanceof FixedConnectionCreateCommand) {
      FixedConnectionCreateCommand cmd = (FixedConnectionCreateCommand) request.getStartCommand();
      ConnectionAnchor anchor = getActivityPart().getTargetConnectionAnchor(request);
      if (anchor instanceof FixedConnectionAnchor) {
        FixedConnectionAnchor fixedAnchor = (FixedConnectionAnchor) anchor;
        cmd.setTargetAnchor(fixedAnchor);
      }
      else {
View Full Code Here

  protected Command getConnectionCreateCommand(CreateConnectionRequest request) {
    int style = ((Integer) request.getNewObjectType()).intValue();
    Activity source = getActivity();
    FixedConnectionCreateCommand cmd = getConnectionCreateCommand(source.getDiagram().getTextEditor(), style);
    if (cmd != null) {
      ConnectionAnchor anchor = getActivityPart().getSourceConnectionAnchor(request);
      if (anchor instanceof FixedConnectionAnchor) {
        FixedConnectionAnchor fixedAnchor = (FixedConnectionAnchor) anchor;
        cmd.setSourceAnchor(fixedAnchor);
      }
      cmd.setSource(source);
View Full Code Here

  @Override
  protected Command getReconnectSourceCommand(ReconnectRequest request) {
    Activity source = getActivity();
    ReconnectFixedSourceCommand cmd = new ReconnectFixedSourceCommand(source.getDiagram().getTextEditor());
    ConnectionAnchor anchor = getActivityPart().getSourceConnectionAnchor(request);
    if (anchor instanceof FixedConnectionAnchor) {
      FixedConnectionAnchor fixedAnchor = (FixedConnectionAnchor) anchor;
      cmd.setSourceAnchor(fixedAnchor);
    }
    cmd.setTransition((Transition) request.getConnectionEditPart().getModel());
View Full Code Here

  @Override
  protected Command getReconnectTargetCommand(ReconnectRequest request) {
    Activity target = getActivity();
    ReconnectFixedTargetCommand cmd = new ReconnectFixedTargetCommand(target.getDiagram().getTextEditor());
    ConnectionAnchor anchor = getActivityPart().getTargetConnectionAnchor(request);
    if (anchor instanceof FixedConnectionAnchor) {
      FixedConnectionAnchor fixedAnchor = (FixedConnectionAnchor) anchor;
      cmd.setTargetAnchor(fixedAnchor);
    }
    cmd.setTransition((Transition) request.getConnectionEditPart().getModel());
View Full Code Here

    cmd.setTarget(target);
    return cmd;
  }

  private void showConnectionLabel(BorderedActivityPart part, Point location) {
    ConnectionAnchor anchor = part.getConnectionAnchorAt(location);
    if (anchor instanceof FixedConnectionAnchor) {
      part.setBorderLabel(((FixedConnectionAnchor) anchor).getConnectionLabel());
    }
    else {
      part.setBorderLabel(""); //$NON-NLS-1$
View Full Code Here

TOP

Related Classes of org.eclipse.draw2d.ConnectionAnchor

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.