Package org.eclipse.gef.requests

Examples of org.eclipse.gef.requests.ChangeBoundsRequest


  public final Command getCommand(Request request) {
    if (!(request instanceof ChangeBoundsRequest)) {
      return null;
    }

    ChangeBoundsRequest r = (ChangeBoundsRequest) request;

    // we only support move/copy a single node.
    if (!MoveSupport.isSingleNode(r)) {
      return UnexecutableCommand.INSTANCE;
    }

    // the edit policy only handle at the target part, so only care about
    // the
    // target part request.
    final Object type = r.getType();
    if (type != REQ_ADD && type != REQ_CLONE && type != REQ_MOVE_CHILDREN) {

      return null;
    }
View Full Code Here


    return figure;
  }

  protected Command getAddCommand(Request generic)
  {
    ChangeBoundsRequest request = (ChangeBoundsRequest) generic;
    List editParts = request.getEditParts();
    CompoundCommand command = new CompoundCommand();
    command.setDebugLabel("Add in ConstrainedLayoutEditPolicy");
    GraphicalEditPart childPart;
    Rectangle r;
    Object constraint;

    for (int i = 0; i < editParts.size(); i++)
    {
      childPart = (GraphicalEditPart) editParts.get(i);
      r = childPart.getFigure().getBounds().getCopy();
      //convert r to absolute from childpart figure
      childPart.getFigure().translateToAbsolute(r);
      r = request.getTransformedRectangle(r);
      //convert this figure to relative
      getLayoutContainer().translateToRelative(r);
      getLayoutContainer().translateFromParent(r);
      r.translate(getLayoutOrigin().getNegated());
View Full Code Here

            || event.keyCode == SWT.ARROW_RIGHT || event.keyCode == SWT.ARROW_UP)) {
          final List<? extends EditorPart> objects = viewer.getSelectedEditParts();
          if (objects == null || objects.isEmpty())
            return true;
          // move request
          final GroupRequest moveReq = new ChangeBoundsRequest(RequestConstants.REQ_MOVE);
          final CompoundCommand compoundCmd = new CompoundCommand("Move"); //$NON-NLS-1$
          for (int i = 0; i < objects.size(); i++) {
            final EditPart object = (EditPart) objects.get(i);
            moveReq.setEditParts(object);
            final LocationCommand cmd = (LocationCommand) object.getCommand(moveReq);
            if (cmd != null) {
              cmd.setLocation(new Point(event.keyCode == SWT.ARROW_LEFT ? -1
                : event.keyCode == SWT.ARROW_RIGHT ? 1 : 0,
                event.keyCode == SWT.ARROW_DOWN ? 1
View Full Code Here

}

@Override
@SuppressWarnings("rawtypes")
protected Command getAddCommand(Request generic) {
  ChangeBoundsRequest request = (ChangeBoundsRequest)generic;
  List editParts = request.getEditParts();
  CompoundCommand command = new CompoundCommand();
  command.setDebugLabel("Add in ConstrainedLayoutEditPolicy");//$NON-NLS-1$
  GraphicalEditPart childPart;
  Rectangle r;
  Object constraint;

  for (int i = 0; i < editParts.size(); i++) {
    childPart = (GraphicalEditPart)editParts.get(i);
    r = childPart.getFigure().getBounds().getCopy();
    //convert r to absolute from childpart figure
    childPart.getFigure().translateToAbsolute(r);
    r = request.getTransformedRectangle(r);
    //convert this figure to relative
    getLayoutContainer().translateToRelative(r);
    getLayoutContainer().translateFromParent(r);
    r.translate(getLayoutOrigin().getNegated());
    constraint = getConstraintFor(r);
View Full Code Here

}

protected Command getMoveCommand(ChangeBoundsRequest req){
  EditPart parent = getHost().getParent();
  if(parent != null){
    ChangeBoundsRequest request = new ChangeBoundsRequest(REQ_MOVE_CHILDREN);
    request.setEditParts(getHost());
    request.setLocation(req.getLocation());
    return parent.getCommand(request);
  }
  return UnexecutableCommand.INSTANCE;
}
View Full Code Here

    fb.setPoint(p2, 1);
  }

  private boolean isLayoutHorizontal(Request request)
  {
    ChangeBoundsRequest cbReq = (ChangeBoundsRequest)request;
    List<?> editParts = cbReq.getEditParts();
    GraphicalEditPart shapeEditPart = (GraphicalEditPart)editParts.get(0);   
    IFigure figure = shapeEditPart.getContentPane().getParent();
    return ((SapphireSequenceLayout) figure.getLayoutManager()).isHorizontal();
  }
View Full Code Here

  @Override
  public EditPart getTargetEditPart(Request request)
  {
    if (request instanceof ChangeBoundsRequest)
    {
      ChangeBoundsRequest cbr = (ChangeBoundsRequest)request;
      List<?> editParts = cbr.getEditParts();
      boolean moveShapeFactoryPart = false;
      for (Object obj : editParts)
      {
        EditPart editPart = (EditPart)obj;
        if (editPart instanceof ShapeEditPart)
View Full Code Here

}

protected Command getMoveCommand(ChangeBoundsRequest req){
  EditPart parent = getHost().getParent();
  if(parent != null){
    ChangeBoundsRequest request = new ChangeBoundsRequest(REQ_MOVE_CHILDREN);
    request.setEditParts(getHost());
    request.setLocation(req.getLocation());
    return parent.getCommand(request);
  }
  return UnexecutableCommand.INSTANCE;
}
View Full Code Here

      : RulerProvider.PROPERTY_HORIZONTAL_RULER));
  return (LogicGuide)provider.getGuideAt(pos);
}

protected Command getAddCommand(Request generic) {
  ChangeBoundsRequest request = (ChangeBoundsRequest)generic;
  List editParts = request.getEditParts();
  CompoundCommand command = new CompoundCommand();
  command.setDebugLabel("Add in ConstrainedLayoutEditPolicy");//$NON-NLS-1$
  GraphicalEditPart childPart;
  Rectangle r;
  Object constraint;

  for (int i = 0; i < editParts.size(); i++) {
    childPart = (GraphicalEditPart)editParts.get(i);
    r = childPart.getFigure().getBounds().getCopy();
    //convert r to absolute from childpart figure
    childPart.getFigure().translateToAbsolute(r);
    r = request.getTransformedRectangle(r);
    //convert this figure to relative
    getLayoutContainer().translateToRelative(r);
    getLayoutContainer().translateFromParent(r);
    r.translate(getLayoutOrigin().getNegated());
    constraint = getConstraintFor(r);
View Full Code Here

  /*
   * (non-Javadoc)
   * @see org.eclipse.gef.editpolicies.LayoutEditPolicy#getAddCommand(org.eclipse.gef.Request)
   */
  protected Command getAddCommand(Request req) {
    ChangeBoundsRequest request = (ChangeBoundsRequest) req;
    List editParts = request.getEditParts();
    CompoundCommand command = new CompoundCommand();
    for (int i = 0; i < editParts.size(); i++) {
      EditPart child = (EditPart) editParts.get(i);
      if (child.getModel() instanceof IActionElement) {
        IActionElement ae = (IActionElement) child.getModel();
View Full Code Here

TOP

Related Classes of org.eclipse.gef.requests.ChangeBoundsRequest

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.