Search in sources :

Example 1 with FeedbackImageFigure

use of org.whole.lang.ui.editpolicies.WholeNonResizableEditPolicy.FeedbackImageFigure in project whole by wholeplatform.

the class WholeResizableEditPolicy method createDragSourceFeedbackFigure.

@Override
protected IFigure createDragSourceFeedbackFigure() {
    IFigure figure = new FeedbackImageFigure(WholeNonResizableEditPolicy.createFeedbackImage((IGraphicalEntityPart) getHost(), FeedbackImageFigure.ALPHA, true, FitToScreenStrategy.instance())) {

        @Override
        protected void paintFigure(Graphics graphics) {
            Rectangle area = getClientArea();
            org.eclipse.swt.graphics.Rectangle imageBounds = getImage().getBounds();
            // graphics.drawImage(getImage(), area.x + ix, area.y + iy);
            graphics.drawImage(getImage(), 0, 0, imageBounds.width, imageBounds.height, area.x, area.y, Math.max(0, area.width), Math.max(0, area.height));
        }
    };
    figure.setBounds(getInitialFeedbackBounds());
    addFeedback(figure);
    return figure;
}
Also used : Graphics(org.eclipse.draw2d.Graphics) FeedbackImageFigure(org.whole.lang.ui.editpolicies.WholeNonResizableEditPolicy.FeedbackImageFigure) IGraphicalEntityPart(org.whole.lang.ui.editparts.IGraphicalEntityPart) Rectangle(org.eclipse.draw2d.geometry.Rectangle) IFigure(org.eclipse.draw2d.IFigure)

Aggregations

Graphics (org.eclipse.draw2d.Graphics)1 IFigure (org.eclipse.draw2d.IFigure)1 Rectangle (org.eclipse.draw2d.geometry.Rectangle)1 IGraphicalEntityPart (org.whole.lang.ui.editparts.IGraphicalEntityPart)1 FeedbackImageFigure (org.whole.lang.ui.editpolicies.WholeNonResizableEditPolicy.FeedbackImageFigure)1