private ChangeBoundsRequest initConstrainedRequest(ChangeBoundsRequest request) {
   ChangeBoundsRequest req = new ChangeBoundsRequest();
   req.setConstrainedResize(true);
   req.setConstrainedMove(true);
   req.setType(request.getType());
   req.setResizeDirection(request.getResizeDirection());
   req.getExtendedData().put(REGION_RESIZE_PROPAGATOR, getHost());
   req.getExtendedData()
       .put(
           SiriusResizeTracker.CHILDREN_MOVE_MODE_KEY,
           request.getExtendedData().get(SiriusResizeTracker.CHILDREN_MOVE_MODE_KEY));
   req.getExtendedData().put(REGION_RESIZE_INITIAL_REQUEST, request);
   return req;
 }
Пример #2
0
  @Override
  protected void updateSourceRequest() {
    ChangeBoundsRequest request = (ChangeBoundsRequest) getSourceRequest();
    Dimension d = getDragMoveDelta();

    Point location = new Point(getLocation());
    Point moveDelta = new Point(0, 0);
    Dimension resizeDelta = new Dimension(0, 0);

    request.setConstrainedResize(false);

    request.setCenteredResize(getCurrentInput().isModKeyDown(SWT.MOD1));

    if ((getResizeDirection() & PositionConstants.NORTH) != 0) {
      moveDelta.y += d.height;
      resizeDelta.height -= d.height;
    }
    if ((getResizeDirection() & PositionConstants.SOUTH) != 0) {
      resizeDelta.height += d.height;
    }
    if ((getResizeDirection() & PositionConstants.WEST) != 0) {
      moveDelta.x += d.width;
      resizeDelta.width -= d.width;
    }
    if ((getResizeDirection() & PositionConstants.EAST) != 0) {
      resizeDelta.width += d.width;
    }

    request.setMoveDelta(moveDelta);
    request.setSizeDelta(resizeDelta);
    request.setLocation(location);
    request.setEditParts(getOperationSet());

    request.getExtendedData().clear();

    // TODO: snapping
  }