Search in sources :

Example 1 with GitRebaseDialog

use of git4idea.rebase.GitRebaseDialog in project intellij-community by JetBrains.

the class GitRebase method actionPerformed.

@Override
public void actionPerformed(@NotNull AnActionEvent e) {
    final Project project = e.getRequiredData(CommonDataKeys.PROJECT);
    ArrayList<GitRepository> repositories = ContainerUtil.newArrayList(getRepositories(project));
    repositories.removeAll(getRebasingRepositories(project));
    List<VirtualFile> roots = ContainerUtil.newArrayList(getRootsFromRepositories(sortRepositories(repositories)));
    VirtualFile defaultRoot = DvcsUtil.guessVcsRoot(project, e.getData(CommonDataKeys.VIRTUAL_FILE));
    final GitRebaseDialog dialog = new GitRebaseDialog(project, roots, defaultRoot);
    if (dialog.showAndGet()) {
        ProgressManager.getInstance().run(new Task.Backgroundable(project, "Rebasing...") {

            public void run(@NotNull ProgressIndicator indicator) {
                GitRebaseUtils.rebase(project, singletonList(dialog.getSelectedRepository()), dialog.getSelectedParams(), indicator);
            }
        });
    }
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) Project(com.intellij.openapi.project.Project) GitRepository(git4idea.repo.GitRepository) Task(com.intellij.openapi.progress.Task) ProgressIndicator(com.intellij.openapi.progress.ProgressIndicator) GitRebaseDialog(git4idea.rebase.GitRebaseDialog)

Aggregations

ProgressIndicator (com.intellij.openapi.progress.ProgressIndicator)1 Task (com.intellij.openapi.progress.Task)1 Project (com.intellij.openapi.project.Project)1 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1 GitRebaseDialog (git4idea.rebase.GitRebaseDialog)1 GitRepository (git4idea.repo.GitRepository)1