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);
}
}
Aggregations