Java 类com.intellij.util.ui.VcsSynchronousProgressWrapper 实例源码

项目:tools-idea    文件:AbstractVcs.java   
@Nullable
public CommittedChangeList loadRevisions(final VirtualFile vf, final VcsRevisionNumber number) {
  final CommittedChangeList[] list = new CommittedChangeList[1];
  final ThrowableRunnable<VcsException> runnable = new ThrowableRunnable<VcsException>() {
    @Override
    public void run() throws VcsException {
      final Pair<CommittedChangeList, FilePath> pair =
        getCommittedChangesProvider().getOneList(vf, number);
      if (pair != null) {
        list[0] = pair.getFirst();
      }
    }
  };
  final boolean succeded = VcsSynchronousProgressWrapper.wrap(runnable, getProject(), "Load revision contents");
  return succeded ? list[0] : null;
}
项目:intellij-ce-playground    文件:AbstractVcs.java   
@Nullable
public CommittedChangeList loadRevisions(final VirtualFile vf, final VcsRevisionNumber number) {
  final CommittedChangeList[] list = new CommittedChangeList[1];
  final ThrowableRunnable<VcsException> runnable = new ThrowableRunnable<VcsException>() {
    @Override
    public void run() throws VcsException {
      final Pair<CommittedChangeList, FilePath> pair =
        getCommittedChangesProvider().getOneList(vf, number);
      if (pair != null) {
        list[0] = pair.getFirst();
      }
    }
  };
  return VcsSynchronousProgressWrapper.wrap(runnable, getProject(), "Load revision contents") ? list[0] : null;
}
项目:Crucible4IDEA    文件:VcsUtils.java   
@Nullable
public static CommittedChangeList loadRevisionsFromGit(@NotNull final Project project,
                                                       final VirtualFile virtualFile,
                                                       final VcsRevisionNumber number) {
  final CommittedChangeList[] list = new CommittedChangeList[1];
  final ThrowableRunnable<VcsException> runnable = () -> {
    FilePath filePath = VcsUtil.getFilePath(virtualFile);

    FilePath lastCommitName = GitHistoryUtils.getLastCommitName(project, filePath);
    GitRepository repository = GitRepositoryManager.getInstance(project).getRepositoryForFile(lastCommitName);
    if (repository == null) {
      return;
    }
    VirtualFile root = repository.getRoot();

    List<VcsFullCommitDetails> gitCommits = ContainerUtil.newArrayList();
    GitHistoryUtils.loadDetails(project, root, gitCommits::add,
                                GitHistoryUtils.formHashParameters(repository.getVcs(), Collections.singleton(number.asString())));
    if (gitCommits.size() != 1) {
      return;
    }
    VcsFullCommitDetails gitCommit = gitCommits.get(0);
    CommittedChangeList commit = new GitCommittedChangeList(gitCommit.getFullMessage() + " (" + gitCommit.getId().toShortString() + ")",
                                                            gitCommit.getFullMessage(), VcsUserUtil.toExactString(gitCommit.getAuthor()),
                                                            (GitRevisionNumber)number,
                                                            new Date(gitCommit.getAuthorTime()), gitCommit.getChanges(),
                                                            assertNotNull(GitVcs.getInstance(project)), true);

    list[0] = commit;
  };
  final boolean success = VcsSynchronousProgressWrapper.wrap(runnable, project, "Load revision contents");
  return success ? list[0] : null;
}
项目:consulo    文件:AbstractVcs.java   
@Nullable
public CommittedChangeList loadRevisions(final VirtualFile vf, final VcsRevisionNumber number) {
  final CommittedChangeList[] list = new CommittedChangeList[1];
  final ThrowableRunnable<VcsException> runnable = () -> {
    final Pair<CommittedChangeList, FilePath> pair =
            getCommittedChangesProvider().getOneList(vf, number);
    if (pair != null) {
      list[0] = pair.getFirst();
    }
  };
  return VcsSynchronousProgressWrapper.wrap(runnable, getProject(), "Load revision contents") ? list[0] : null;
}