@Nullable
  public GithubFullPath showTargetDialog() {
    final GithubInfo2 info = getAvailableForksInModal(myProject, myGitRepository, myAuth, myPath);
    if (info == null) {
      return null;
    }

    Convertor<String, GithubFullPath> getForkPath =
        new Convertor<String, GithubFullPath>() {
          @Nullable
          @Override
          public GithubFullPath convert(@NotNull final String user) {
            return GithubUtil.computeValueInModal(
                myProject,
                "Access to GitHub",
                new Convertor<ProgressIndicator, GithubFullPath>() {
                  @Nullable
                  @Override
                  public GithubFullPath convert(ProgressIndicator o) {
                    return findRepositoryByUser(
                        myProject, user, info.getForks(), myAuth, info.getSource());
                  }
                });
          }
        };
    GithubSelectForkDialog dialog =
        new GithubSelectForkDialog(myProject, info.getForks(), getForkPath);
    DialogManager.show(dialog);
    if (!dialog.isOK()) {
      return null;
    }
    return dialog.getPath();
  }
コード例 #2
0
  @Nullable
  public ForkInfo showTargetDialog() {
    if (myAvailableForks == null) {
      myAvailableForks =
          GithubUtil.computeValueInModal(
              myProject,
              myCurrentBranch,
              new Convertor<ProgressIndicator, List<GithubFullPath>>() {
                @Override
                public List<GithubFullPath> convert(ProgressIndicator indicator) {
                  return getAvailableForks(indicator);
                }
              });
    }

    Convertor<String, ForkInfo> getForkPath =
        new Convertor<String, ForkInfo>() {
          @Nullable
          @Override
          public ForkInfo convert(@NotNull final String user) {
            return GithubUtil.computeValueInModal(
                myProject,
                "Access to GitHub",
                new Convertor<ProgressIndicator, ForkInfo>() {
                  @Nullable
                  @Override
                  public ForkInfo convert(ProgressIndicator indicator) {
                    return findRepositoryByUser(indicator, user);
                  }
                });
          }
        };
    GithubSelectForkDialog dialog =
        new GithubSelectForkDialog(myProject, myAvailableForks, getForkPath);
    DialogManager.show(dialog);
    if (!dialog.isOK()) {
      return null;
    }
    return dialog.getPath();
  }