Search in sources :

Example 1 with GitPullDialog

use of git4idea.merge.GitPullDialog in project intellij-community by JetBrains.

the class GitPull method displayDialog.

@Override
protected DialogState displayDialog(@NotNull Project project, @NotNull List<VirtualFile> gitRoots, @NotNull VirtualFile defaultRoot) {
    final GitPullDialog dialog = new GitPullDialog(project, gitRoots, defaultRoot);
    if (!dialog.showAndGet()) {
        return null;
    }
    GitRepositoryManager repositoryManager = GitUtil.getRepositoryManager(project);
    GitRepository repository = repositoryManager.getRepositoryForRoot(dialog.gitRoot());
    assert repository != null : "Repository can't be null for root " + dialog.gitRoot();
    String remoteOrUrl = dialog.getRemote();
    if (remoteOrUrl == null) {
        return null;
    }
    GitRemote remote = GitUtil.findRemoteByName(repository, remoteOrUrl);
    final List<String> urls = remote == null ? Collections.singletonList(remoteOrUrl) : remote.getUrls();
    Computable<GitLineHandler> handlerProvider = new Computable<GitLineHandler>() {

        @Override
        public GitLineHandler compute() {
            return dialog.makeHandler(urls);
        }
    };
    return new DialogState(dialog.gitRoot(), GitBundle.message("pulling.title", dialog.getRemote()), handlerProvider);
}
Also used : GitRemote(git4idea.repo.GitRemote) GitRepository(git4idea.repo.GitRepository) GitPullDialog(git4idea.merge.GitPullDialog) GitLineHandler(git4idea.commands.GitLineHandler) GitRepositoryManager(git4idea.repo.GitRepositoryManager) Computable(com.intellij.openapi.util.Computable)

Aggregations

Computable (com.intellij.openapi.util.Computable)1 GitLineHandler (git4idea.commands.GitLineHandler)1 GitPullDialog (git4idea.merge.GitPullDialog)1 GitRemote (git4idea.repo.GitRemote)1 GitRepository (git4idea.repo.GitRepository)1 GitRepositoryManager (git4idea.repo.GitRepositoryManager)1