Пример #1
0
 /**
  * Shows GitHub login settings if credentials are wrong or empty and return the list of all the
  * watched repos by user
  *
  * @param project
  * @return
  */
 @Nullable
 public static RepositoryInfo getDetailedRepositoryInfo(
     final Project project, final String owner, final String name) throws IOException {
   while (!checkCredentials(project)) {
     final GithubLoginDialog dialog = new GithubLoginDialog(project);
     dialog.show();
     if (!dialog.isOK()) {
       return null;
     }
   }
   // Otherwise our credentials are valid and they are successfully stored in settings
   final GithubSettings settings = GithubSettings.getInstance();
   final String validPassword = settings.getPassword();
   return accessToGithubWithModalProgress(
       project,
       settings.getHost(),
       new ThrowableComputable<RepositoryInfo, IOException>() {
         @Nullable
         @Override
         public RepositoryInfo compute() {
           ProgressManager.getInstance()
               .getProgressIndicator()
               .setText("Extracting detailed info about repository ''" + name + "''");
           return getDetailedRepoInfo(
               settings.getHost(), settings.getLogin(), validPassword, owner, name);
         }
       });
 }
Пример #2
0
 /**
  * Shows GitHub login settings if credentials are wrong or empty and return the list of all the
  * watched repos by user
  *
  * @param project
  * @return
  */
 @Nullable
 public static List<RepositoryInfo> getAvailableRepos(final Project project) throws IOException {
   while (!checkCredentials(project)) {
     final GithubLoginDialog dialog = new GithubLoginDialog(project);
     dialog.show();
     if (!dialog.isOK()) {
       return null;
     }
   }
   // Otherwise our credentials are valid and they are successfully stored in settings
   final GithubSettings settings = GithubSettings.getInstance();
   final String validPassword = settings.getPassword();
   return accessToGithubWithModalProgress(
       project,
       settings.getHost(),
       new ThrowableComputable<List<RepositoryInfo>, IOException>() {
         @Override
         public List<RepositoryInfo> compute() throws IOException {
           ProgressManager.getInstance()
               .getProgressIndicator()
               .setText("Extracting info about available repositories");
           return getAvailableRepos(settings.getHost(), settings.getLogin(), validPassword);
         }
       });
 }