Search in sources :

Example 1 with GithubUserDetailed

use of org.jetbrains.plugins.github.api.data.GithubUserDetailed in project intellij-community by JetBrains.

the class GithubShareAction method loadGithubInfoWithModal.

@Nullable
private static GithubInfo loadGithubInfoWithModal(@NotNull final GithubAuthDataHolder authHolder, @NotNull final Project project) {
    try {
        return GithubUtil.computeValueInModalIO(project, "Access to GitHub", indicator -> {
            return GithubUtil.runTask(project, authHolder, indicator, connection -> {
                GithubUserDetailed userInfo = GithubApiUtil.getCurrentUser(connection);
                HashSet<String> names = new HashSet<>();
                for (GithubRepo info : GithubApiUtil.getUserRepos(connection)) {
                    names.add(info.getName());
                }
                return new GithubInfo(userInfo, names);
            });
        });
    } catch (IOException e) {
        GithubNotifications.showErrorDialog(project, "Failed to Connect to GitHub", e);
        return null;
    }
}
Also used : GithubUserDetailed(org.jetbrains.plugins.github.api.data.GithubUserDetailed) GithubRepo(org.jetbrains.plugins.github.api.data.GithubRepo) IOException(java.io.IOException) HashSet(com.intellij.util.containers.HashSet) Nullable(org.jetbrains.annotations.Nullable)

Aggregations

HashSet (com.intellij.util.containers.HashSet)1 IOException (java.io.IOException)1 Nullable (org.jetbrains.annotations.Nullable)1 GithubRepo (org.jetbrains.plugins.github.api.data.GithubRepo)1 GithubUserDetailed (org.jetbrains.plugins.github.api.data.GithubUserDetailed)1