@Override
  public IStatus handleDrop(
      CommonDropAdapter aDropAdapter, DropTargetEvent aDropTargetEvent, Object aTarget) {
    TreeSelection selection = (TreeSelection) LocalSelectionTransfer.getTransfer().getSelection();
    String operation = getOperationType(selection);

    if (STAGE_OP.equals(operation)) runCommand(ADD_TO_INDEX, selection);
    else if (UNSTAGE_OP.equals(operation)) runCommand(REMOVE_FROM_INDEX, selection);

    return Status.OK_STATUS;
  }
Пример #2
0
 protected void buttonPressed(int buttonId) {
   switch (buttonId) {
     case IDialogConstants.PROCEED_ID:
       CommonUtils.runCommand(ActionCommands.COMMIT_ACTION, new StructuredSelection(repository));
       break;
     case IDialogConstants.ABORT_ID:
       CommonUtils.runCommand(
           ResetCommand.ID, new StructuredSelection(new RepositoryNode(null, repository)));
       break;
     case IDialogConstants.SKIP_ID:
       CommonUtils.runCommand(
           ActionCommands.STASH_CREATE,
           new StructuredSelection(new RepositoryNode(null, repository)));
       break;
   }
   super.buttonPressed(buttonId);
 }
Пример #3
0
  public Object execute(ExecutionEvent event) throws ExecutionException {
    RevCommit commit = getSelectedCommit(event);
    Repository repo = getRepository(event);
    if (repo == null) return null;

    final IStructuredSelection selected =
        new StructuredSelection(new RepositoryCommit(repo, commit));
    CommonUtils.runCommand(
        org.eclipse.egit.ui.internal.commit.command.CherryPickHandler.ID, selected);
    return null;
  }