Search in sources :

Example 1 with GithubUser

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

the class GithubCredentialsPanel method testAuthData.

private void testAuthData(@NotNull Project project) {
    try {
        GithubAuthData auth = getAuthData();
        GithubUser user = GithubUtil.computeValueInModalIO(project, "Access to GitHub", indicator -> GithubUtil.checkAuthData(project, new GithubAuthDataHolder(auth), indicator));
        if (AuthType.TOKEN.equals(auth.getAuthType())) {
            GithubNotifications.showInfoDialog(myPane, "Success", "Connection successful for user " + user.getLogin());
        } else {
            GithubNotifications.showInfoDialog(myPane, "Success", "Connection successful");
        }
    } catch (GithubAuthenticationException ex) {
        GithubNotifications.showErrorDialog(myPane, "Login Failure", "Can't login using given credentials: ", ex);
    } catch (IOException ex) {
        GithubNotifications.showErrorDialog(myPane, "Login Failure", "Can't login: ", ex);
    }
}
Also used : GithubAuthenticationException(org.jetbrains.plugins.github.exceptions.GithubAuthenticationException) GithubUser(org.jetbrains.plugins.github.api.data.GithubUser) IOException(java.io.IOException)

Aggregations

IOException (java.io.IOException)1 GithubUser (org.jetbrains.plugins.github.api.data.GithubUser)1 GithubAuthenticationException (org.jetbrains.plugins.github.exceptions.GithubAuthenticationException)1