Search in sources :

Example 1 with DragTracker

use of org.eclipse.gef.DragTracker in project whole by wholeplatform.

the class WholeNonResizableEditPolicy method createSelectionHandles.

@Override
protected List<?> createSelectionHandles() {
    final GraphicalEditPart host = (GraphicalEditPart) getHost();
    final DragTracker tracker = new SelectEditPartTracker(host);
    final Cursor cursor = SharedCursors.ARROW;
    final MoveHandle moveHandle = new MoveHandle(host) {

        @Override
        protected void initialize() {
            setOpaque(false);
            setBorder(new LineBorder(ColorConstants.gray, 1));
            setCursor(cursor);
            setDragTracker(tracker);
        }
    };
    final List<Handle> handles = new ArrayList<Handle>(5);
    handles.add(moveHandle);
    if (isDragAllowed()) {
        handles.add(createHandle(host, PositionConstants.SOUTH_EAST, tracker, cursor));
        handles.add(createHandle(host, PositionConstants.SOUTH_WEST, tracker, cursor));
        handles.add(createHandle(host, PositionConstants.NORTH_WEST, tracker, cursor));
        handles.add(createHandle(host, PositionConstants.NORTH_EAST, tracker, cursor));
    }
    return handles;
}
Also used : DragTracker(org.eclipse.gef.DragTracker) MoveHandle(org.eclipse.gef.handles.MoveHandle) LineBorder(org.eclipse.draw2d.LineBorder) ArrayList(java.util.ArrayList) SelectEditPartTracker(org.eclipse.gef.tools.SelectEditPartTracker) Cursor(org.eclipse.swt.graphics.Cursor) GraphicalEditPart(org.eclipse.gef.GraphicalEditPart) Handle(org.eclipse.gef.Handle) ResizeHandle(org.eclipse.gef.handles.ResizeHandle) AbstractHandle(org.eclipse.gef.handles.AbstractHandle) MoveHandle(org.eclipse.gef.handles.MoveHandle)

Aggregations

ArrayList (java.util.ArrayList)1 LineBorder (org.eclipse.draw2d.LineBorder)1 DragTracker (org.eclipse.gef.DragTracker)1 GraphicalEditPart (org.eclipse.gef.GraphicalEditPart)1 Handle (org.eclipse.gef.Handle)1 AbstractHandle (org.eclipse.gef.handles.AbstractHandle)1 MoveHandle (org.eclipse.gef.handles.MoveHandle)1 ResizeHandle (org.eclipse.gef.handles.ResizeHandle)1 SelectEditPartTracker (org.eclipse.gef.tools.SelectEditPartTracker)1 Cursor (org.eclipse.swt.graphics.Cursor)1