示例#1
0
  private void renameBranch(String newName) {
    service.branchRename(
        workspaceId,
        project.getRootProject(),
        selectedBranch.getDisplayName(),
        newName,
        new AsyncRequestCallback<String>() {
          @Override
          protected void onSuccess(String result) {
            getBranches();
          }

          @Override
          protected void onFailure(Throwable exception) {
            String errorMessage =
                (exception.getMessage() != null)
                    ? exception.getMessage()
                    : constant.branchRenameFailed();
            final GitOutputConsole console =
                gitOutputConsoleFactory.create(BRANCH_RENAME_COMMAND_NAME);
            console.printError(errorMessage);
            consolesPanelPresenter.addCommandOutput(appContext.getDevMachineId(), console);
            notificationManager.notify(
                constant.branchRenameFailed(), FAIL, true, project.getRootProject());
            getBranches(); // rename of remote branch occurs in three stages, so needs update list
            // of branches on view
          }
        });
  }