Search in sources :

Example 1 with ResizeTracker

use of org.eclipse.gef.tools.ResizeTracker in project archi by archimatetool.

the class ConstrainedResizableEditPolicy method getResizeTracker.

@Override
protected ResizeTracker getResizeTracker(int direction) {
    return new ResizeTracker((GraphicalEditPart) getHost(), direction) {

        @Override
        protected Request createSourceRequest() {
            ChangeBoundsRequest request = new ChangeBoundsRequest(REQ_RESIZE) {

                @Override
                public boolean isConstrainedResize() {
                    return super.isConstrainedResize();
                // return getCurrentInput().isModKeyDown(SWT.SHIFT) ? false : true;
                }

                @Override
                public boolean isCenteredResize() {
                    return super.isCenteredResize();
                // return false;
                }

                @Override
                public boolean isSnapToEnabled() {
                    return super.isSnapToEnabled();
                // int direction = getResizeDirection();
                // if(direction == PositionConstants.EAST) {
                // return super.isSnapToEnabled();
                // }
                // return false;
                }
            };
            request.setResizeDirection(getResizeDirection());
            return request;
        }

        @Override
        protected Dimension getMinimumSizeFor(ChangeBoundsRequest request) {
            return MIN_DIMENSION;
        }
    };
}
Also used : ChangeBoundsRequest(org.eclipse.gef.requests.ChangeBoundsRequest) ResizeTracker(org.eclipse.gef.tools.ResizeTracker)

Aggregations

ChangeBoundsRequest (org.eclipse.gef.requests.ChangeBoundsRequest)1 ResizeTracker (org.eclipse.gef.tools.ResizeTracker)1