Search in sources :

Example 1 with MidpointLocator

use of org.eclipse.draw2d.MidpointLocator in project yamcs-studio by yamcs.

the class ManhattanBendpointEditPolicy method createSelectionHandles.

@Override
protected List<?> createSelectionHandles() {
    List<BendpointHandle> handles = new ArrayList<>();
    final PointList points = getConnection().getPoints();
    if (points.size() < 4)
        return handles;
    for (int i = 1; i < points.size() - 2; i++) {
        handles.add(new BendpointMoveHandle(getConnectionEditPart(), i - 1, new MidpointLocator(getConnection(), i)) {

            @Override
            protected Color getBorderColor() {
                return (isPrimary()) ? ColorConstants.darkGreen : ColorConstants.white;
            }

            @Override
            protected Color getFillColor() {
                return ColorConstants.yellow;
            }
        });
    }
    return handles;
}
Also used : PointList(org.eclipse.draw2d.geometry.PointList) MidpointLocator(org.eclipse.draw2d.MidpointLocator) Color(org.eclipse.swt.graphics.Color) ArrayList(java.util.ArrayList) BendpointHandle(org.eclipse.gef.handles.BendpointHandle) BendpointMoveHandle(org.eclipse.gef.handles.BendpointMoveHandle) Point(org.eclipse.draw2d.geometry.Point)

Aggregations

ArrayList (java.util.ArrayList)1 MidpointLocator (org.eclipse.draw2d.MidpointLocator)1 Point (org.eclipse.draw2d.geometry.Point)1 PointList (org.eclipse.draw2d.geometry.PointList)1 BendpointHandle (org.eclipse.gef.handles.BendpointHandle)1 BendpointMoveHandle (org.eclipse.gef.handles.BendpointMoveHandle)1 Color (org.eclipse.swt.graphics.Color)1