use of org.eclipse.draw2d.Connection in project tdi-studio-se by Talend.
the class DparallelLocator method getReferencePoint.
@Override
protected Point getReferencePoint() {
Connection conn = getConnection();
Point p = Point.SINGLETON;
Point p1 = conn.getPoints().getPoint(getIndex());
Point p2 = conn.getPoints().getPoint(getIndex() + 1);
conn.translateToAbsolute(p1);
conn.translateToAbsolute(p2);
p.x = ((p2.x - p1.x) / 9) * 8 + p1.x;
p.y = ((p2.y - p1.y) / 9) * 8 + p1.y;
return p;
}
use of org.eclipse.draw2d.Connection in project dbeaver by dbeaver.
the class GraphAnimation method recordFinalState.
public static void recordFinalState(IFigure child) {
if (child instanceof Connection) {
recordFinalState((Connection) child);
return;
}
Rectangle rect2 = child.getBounds().getCopy();
Rectangle rect1 = (Rectangle) initialStates.get(child);
if (rect1.isEmpty()) {
rect1.x = rect2.x;
rect1.y = rect2.y;
rect1.width = rect2.width;
}
finalStates.put(child, rect2);
}
use of org.eclipse.draw2d.Connection in project knime-core by knime.
the class WorkflowConnectionBendpointTracker method updateSourceRequest.
/**
* {@inheritDoc}
*/
@Override
protected void updateSourceRequest() {
BendpointRequest request = (BendpointRequest) getSourceRequest();
// get the currently dragging bendpoint
Point dragPoint = getLocation();
WorkflowEditor.adaptZoom(m_zoomManager, dragPoint, false);
// get the two points next to the dragging bendpoint from the
// list of all points of the connection
PointList pList = ((Connection) request.getSource().getFigure()).getPoints();
Point[] neighbourPoints = getNeighbourPoints(dragPoint, pList);
// if the neighbours could not be determined to not apply snapping
if (neighbourPoints == null) {
request.setLocation(getLocation());
return;
}
double xCorrection = 0.0;
// check the drag point for all 4 vertical / horizontal lines
// to snap to those lines
double diff1 = Math.abs(dragPoint.x - neighbourPoints[0].x);
if (diff1 < THRESHOLD) {
xCorrection = diff1;
}
double diff2 = Math.abs(dragPoint.x - neighbourPoints[1].x);
if ((diff2 < THRESHOLD) && (diff2 < diff1)) {
// always apply the smaller correction
xCorrection = diff2;
}
double yCorrection = 0.0;
diff1 = Math.abs(dragPoint.y - neighbourPoints[0].y);
if (diff1 < THRESHOLD) {
yCorrection = diff1;
}
diff2 = Math.abs(dragPoint.y - neighbourPoints[1].y);
if ((diff2 < THRESHOLD) && (diff2 < diff1)) {
// always apply the smaller correction
yCorrection = diff2;
}
request.setLocation(getLocation().translate((int) xCorrection, (int) yCorrection));
}
use of org.eclipse.draw2d.Connection in project dbeaver by serge-rider.
the class GraphAnimation method recordFinalState.
public static void recordFinalState(IFigure child) {
if (child instanceof Connection) {
recordFinalState((Connection) child);
return;
}
Rectangle rect2 = child.getBounds().getCopy();
Rectangle rect1 = (Rectangle) initialStates.get(child);
if (rect1.isEmpty()) {
rect1.x = rect2.x;
rect1.y = rect2.y;
rect1.width = rect2.width;
}
finalStates.put(child, rect2);
}
use of org.eclipse.draw2d.Connection in project yamcs-studio by yamcs.
the class RerouteConnectionAction method selectionChanged.
@Override
public void selectionChanged(IAction action, ISelection selection) {
super.selectionChanged(action, selection);
if (getSelectedConnection() == null) {
return;
}
Connection figure = getSelectedConnection().getConnectionFigure();
action.setEnabled(figure != null && figure.getConnectionRouter() instanceof FixedPointsConnectionRouter);
}
Aggregations