Search in sources :

Example 1 with ResizeHandle

use of org.eclipse.gef.handles.ResizeHandle in project whole by wholeplatform.

the class WholeNonResizableEditPolicy method createHandle.

public Handle createHandle(GraphicalEditPart owner, int direction, DragTracker tracker, Cursor cursor) {
    ResizeHandle handle = new ResizeHandle(owner, direction) {

        protected Color getBorderColor() {
            return ColorConstants.black;
        }

        protected Color getFillColor() {
            return (isPrimary()) ? FigureConstants.lightBlueColor : ColorConstants.white;
        }

        public void paintFigure(Graphics g) {
            Rectangle r = getBounds();
            r.shrink(1, 1);
            try {
                g.setBackgroundColor(getFillColor());
                g.fillOval(r.x, r.y, r.width, r.height);
                g.setForegroundColor(getBorderColor());
                g.drawOval(r.x, r.y, r.width, r.height);
            } finally {
                r.expand(1, 1);
            }
        }
    };
    handle.setCursor(cursor);
    handle.setDragTracker(tracker);
    return handle;
}
Also used : ResizeHandle(org.eclipse.gef.handles.ResizeHandle) SWTGraphics(org.eclipse.draw2d.SWTGraphics) Graphics(org.eclipse.draw2d.Graphics) PrecisionRectangle(org.eclipse.draw2d.geometry.PrecisionRectangle) Rectangle(org.eclipse.draw2d.geometry.Rectangle)

Aggregations

Graphics (org.eclipse.draw2d.Graphics)1 SWTGraphics (org.eclipse.draw2d.SWTGraphics)1 PrecisionRectangle (org.eclipse.draw2d.geometry.PrecisionRectangle)1 Rectangle (org.eclipse.draw2d.geometry.Rectangle)1 ResizeHandle (org.eclipse.gef.handles.ResizeHandle)1