use of com.google.cloud.tools.intellij.resources.ResourceEmptyModelItem in project google-cloud-intellij by GoogleCloudPlatform.
the class ProjectRepositoriesModelItem method loadRepositories.
@SuppressWarnings("FutureReturnValueIgnored")
public void loadRepositories(@NotNull String cloudProject, @NotNull CredentialedUser user, @Nullable Runnable onComplete) {
setUserObject(cloudProject);
cloudRepositoryService.listAsync(user, cloudProject).thenAccept(response -> {
removeAllChildren();
List<Repo> repositories = response.getRepos();
if (!response.isEmpty() && repositories != null) {
repositories.forEach(repo -> {
Object name = repo.get("name");
if (name != null) {
add(new RepositoryModelItem(name.toString()));
}
});
} else {
add(new ResourceEmptyModelItem(GctBundle.message("cloud.repository.list.empty")));
}
if (onComplete != null) {
onComplete.run();
}
}).exceptionally(response -> {
removeAllChildren();
add(new ResourceErrorModelItem(GctBundle.message("cloud.repository.list.error")));
if (onComplete != null) {
onComplete.run();
}
return null;
});
}
Aggregations