Examples of CompoundCommand


Examples of org.eclipse.gef.commands.CompoundCommand

  /**
   * @generated
   */
  protected Command getDestroyElementCommand(DestroyElementRequest req) {
    CompoundCommand cc = getDestroyEdgesCommand();
    addDestroyShortcutsCommand(cc);
    View view = (View) getHost().getModel();
    if (view.getEAnnotation("Shortcut") != null) { //$NON-NLS-1$
      req.setElementToDestroy(view);
    }
    cc.add(getGEFWrapper(new DestroyElementCommand(req)));
    return cc.unwrap();
  }
View Full Code Here

Examples of org.eclipse.gef.commands.CompoundCommand

  /**
   * @generated
   */
  protected Command getDestroyElementCommand(DestroyElementRequest req) {
    CompoundCommand cc = getDestroyEdgesCommand();
    addDestroyChildNodesCommand(cc);
    addDestroyShortcutsCommand(cc);
    View view = (View) getHost().getModel();
    if (view.getEAnnotation("Shortcut") != null) { //$NON-NLS-1$
      req.setElementToDestroy(view);
    }
    cc.add(getGEFWrapper(new DestroyElementCommand(req)));
    return cc.unwrap();
  }
View Full Code Here

Examples of org.eclipse.gef.commands.CompoundCommand

  /**
   * @generated
   */
  protected Command getDestroyElementCommand(DestroyElementRequest req) {
    CompoundCommand cc = getDestroyEdgesCommand();
    addDestroyChildNodesCommand(cc);
    addDestroyShortcutsCommand(cc);
    View view = (View) getHost().getModel();
    if (view.getEAnnotation("Shortcut") != null) { //$NON-NLS-1$
      req.setElementToDestroy(view);
    }
    cc.add(getGEFWrapper(new DestroyElementCommand(req)));
    return cc.unwrap();
  }
View Full Code Here

Examples of org.eclipse.gef.commands.CompoundCommand

      return true;
    }
   
    private Command getCommand() {
      List editparts = getSelectedObjects();
      CompoundCommand cc = new CompoundCommand();
      cc.setDebugLabel("Edit Maps");//$NON-NLS-1$
      for (int i=0; i < editparts.size(); i++) {
        EditPart part = (EditPart)editparts.get(i);
        cc.add(part.getCommand(request));
      }
      return cc;
    }
View Full Code Here

Examples of org.eclipse.gef.commands.CompoundCommand

  @Override
  public Command chain(Command command) {
    if (command == null)
      return this;
    if (command instanceof SXECommand) {
      CompoundCommand result = new SXECompoundCommand();
      result.setDebugLabel("chained SXECommands");
      result.add(this);
      result.add(command);
      return result;
    } else
      return super.chain(command);
  }
View Full Code Here

Examples of org.eclipse.gef.commands.CompoundCommand

   */
  protected CompoundCommand getSXECompoundCommand(CompoundCommand cc) {
    if (cc instanceof SXECompoundCommand)
      return cc;

    CompoundCommand r = new CompoundCommand();
    r.setLabel(cc.getLabel());

    SXECompoundCommand sxeCommand = new SXECompoundCommand();
    sxeCommand.setLabel(cc.getLabel());

    for (Object o : cc.getCommands()) {
      if (o instanceof SXECommand)
        sxeCommand.add((SXECommand) o);
      else
        r.add((Command) o);
    }

    if (r.getCommands().size() == 0)
      return sxeCommand;

    r.add(sxeCommand);

    return r;
  }
View Full Code Here

Examples of org.eclipse.gef.commands.CompoundCommand

  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());

      // Because of the scaling and not using double type in size,
      // nodes size was getting bigger. this bug is fixed.
      r.setSize(childPart.getFigure().getSize().getCopy());
      r.setLocation(r.getLocation().translate(1, 1));

      constraint = getConstraintFor(r);
      command.add(createAddCommand(generic,
        childPart,
        translateToModelConstraint(constraint)));
    }

    return command.unwrap();
  }
View Full Code Here

Examples of org.eclipse.gef.commands.CompoundCommand

  }

  public Command getOrphanChildrenCommand(GroupRequest request)
  {
    List parts = request.getEditParts();
    CompoundCommand result =
      new CompoundCommand("MyContainerEditPolicy_OrphanCommandLabelText");

    for (int i = 0; i < parts.size(); i++) {
      OrphanChildCommand orphan = new OrphanChildCommand();
      orphan.setChild((NodeModel)((EditPart)parts.get(i)).getModel());
      orphan.setParent((CompoundModel)getHost().getModel());
      result.add(orphan);
    }

    return result.unwrap();
  }
View Full Code Here

Examples of org.eclipse.gef.commands.CompoundCommand

        if (event.stateMask == SWT.MOD1 && event.keyCode == SWT.DEL) {
          final List<? extends EditorPart> objects = viewer.getSelectedEditParts();
          if (objects == null || objects.isEmpty())
            return true;
          final GroupRequest deleteReq = new GroupRequest(RequestConstants.REQ_DELETE);
          final CompoundCommand compoundCmd = new CompoundCommand("Delete"); //$NON-NLS-1$
          for (int i = 0; i < objects.size(); i++) {
            final EditPart object = (EditPart) objects.get(i);
            deleteReq.setEditParts(object);
            final Command cmd = object.getCommand(deleteReq);
            if (cmd != null)
              compoundCmd.add(cmd);
          }
          getCommandStack().execute(compoundCmd);
          return true;
        }
        if (event.stateMask == SWT.MOD3
          && (event.keyCode == SWT.ARROW_DOWN || event.keyCode == SWT.ARROW_LEFT
            || 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
                  : event.keyCode == SWT.ARROW_UP ? -1 : 0));
              cmd.setRelative(true);
              compoundCmd.add(cmd);
            }
          }
          getCommandStack().execute(compoundCmd);
          return true;
        }
View Full Code Here

Examples of org.eclipse.gef.commands.CompoundCommand

    }
    return false;
  }
 
  public Command createAddPossibleChildrenCommand() {
    CompoundCommand compoundCmd = new CompoundCommand(getCompoundCommandName());
    CreateCommand createCmd = new CreateCommand();
    createCmd.setParent(this.parent);
    createCmd.setChild(this.child);
    compoundCmd.add(createCmd);
    return compoundCmd;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.