Code tolerates null ProgressIndicatorProvider

This commit is contained in:
Dmitry Lomov
2012-10-18 18:28:34 +02:00
parent a2be6066cf
commit e73492cd2b
11 changed files with 50 additions and 33 deletions
@@ -58,7 +58,7 @@ public class ClassInheritorsSearch extends ExtensibleQueryFactory<PsiClass, Clas
LOG.assertTrue(searchScope != null);
ProgressIndicator progress = ProgressIndicatorProvider.getInstance().getProgressIndicator();
ProgressIndicator progress = ProgressIndicatorProvider.getGlobalProgressIndicator();
if (progress != null) {
progress.pushState();
String className = ApplicationManager.getApplication().runReadAction(new Computable<String>() {
@@ -66,7 +66,7 @@ public class AllClassesSearchExecutor implements QueryExecutor<PsiClass, AllClas
}
});
final ProgressIndicator indicator = ProgressIndicatorProvider.getInstance().getProgressIndicator();
final ProgressIndicator indicator = ProgressIndicatorProvider.getGlobalProgressIndicator();
if (indicator != null) {
indicator.checkCanceled();
}
@@ -305,7 +305,7 @@ public class ClsFileImpl extends ClsRepositoryPsiElement<PsiClassHolderFileStub>
final ASTNode mirrorTreeElement = SourceTreeToPsiMap.psiElementToTree(mirror);
//IMPORTANT: do not take lock too early - FileDocumentManager.getInstance().saveToString() can run write action...
final NonCancelableSection section = ProgressIndicatorProvider.getInstance().startNonCancelableSection();
final NonCancelableSection section = ProgressIndicatorProvider.startNonCancelableSectionIfSupported();
try {
setMirror((TreeElement)mirrorTreeElement);