예제 #1
0
  /**
   * Adds a "Set as default" behavior to a list of commands
   *
   * @param commands
   * @return
   */
  protected List<Command> convertToDefault(List<Command> commands) {
    List<Command> result = new ArrayList<Command>(commands.size());
    for (Command command : commands) {
      final Command commandToExecute = command;
      CompoundCommand compound = new CompoundCommand(commandToExecute.getLabel());
      compound.add(commandToExecute);
      compound.add(
          new Command("Set default drop behavior") {

            @Override
            public void execute() {
              defaultHandler.defaultActionSelected(commandToExecute);
            }
          });

      result.add(compound);
    }
    return result;
  }
 /** @see org.eclipse.emf.common.command.Command#getLabel() */
 public String getLabel() {
   return gefCommand.getLabel();
 }