From 3989f4efd78872c9e70f28ed99d02bd9fa60bcf9 Mon Sep 17 00:00:00 2001 From: Eugene Zhuravlev Date: Tue, 27 Oct 2009 00:22:30 +0300 Subject: [PATCH] added some waitForSmartMode() to reduce possibility of IndexNotReadyException() --- .../impl/src/com/intellij/compiler/impl/CompileDriver.java | 4 ++++ .../src/com/intellij/util/indexing/FileBasedIndex.java | 5 ++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/CompileDriver.java b/java/compiler/impl/src/com/intellij/compiler/impl/CompileDriver.java index ff3f5491d80a..cce777214891 100644 --- a/java/compiler/impl/src/com/intellij/compiler/impl/CompileDriver.java +++ b/java/compiler/impl/src/com/intellij/compiler/impl/CompileDriver.java @@ -859,6 +859,8 @@ public class CompileDriver { throw new ExitException(ExitStatus.CANCELLED); } + DumbService.getInstance(myProject).waitForSmartMode(); + if (snapshot == null || ContainerUtil.intersects(generatedTypes, compilerManager.getRegisteredInputTypes(translator))) { // rescan snapshot if previously generated files can influence the input of this compiler snapshot = ApplicationManager.getApplication().runReadAction(new Computable() { @@ -1318,6 +1320,7 @@ public class CompileDriver { finally { CompilerUtil.refreshIOFiles(filesToRefresh); if (!generatedFiles.isEmpty()) { + DumbService.getInstance(myProject).waitForSmartMode(); List vFiles = ApplicationManager.getApplication().runReadAction(new Computable>() { public List compute() { final ArrayList vFiles = new ArrayList(generatedFiles.size()); @@ -1544,6 +1547,7 @@ public class CompileDriver { final List toProcess = new ArrayList(); final Set allUrls = new HashSet(); final IOException[] ex = {null}; + DumbService.getInstance(myProject).waitForSmartMode(); ApplicationManager.getApplication().runReadAction(new Runnable() { public void run() { try { diff --git a/platform/lang-impl/src/com/intellij/util/indexing/FileBasedIndex.java b/platform/lang-impl/src/com/intellij/util/indexing/FileBasedIndex.java index fbc60acce57c..aea6b47bb529 100644 --- a/platform/lang-impl/src/com/intellij/util/indexing/FileBasedIndex.java +++ b/platform/lang-impl/src/com/intellij/util/indexing/FileBasedIndex.java @@ -591,10 +591,9 @@ public class FileBasedIndex implements ApplicationComponent { return; //indexed eagerly in foreground while building unindexed file list } - final ProgressManager progressManager = ProgressManager.getInstance(); - progressManager.checkCanceled(); // DumbModeAction.CANCEL + ProgressManager.checkCanceled(); // DumbModeAction.CANCEL - final ProgressIndicator progressIndicator = progressManager.getProgressIndicator(); + final ProgressIndicator progressIndicator = ProgressManager.getInstance().getProgressIndicator(); if (progressIndicator instanceof BackgroundableProcessIndicator) { final BackgroundableProcessIndicator indicator = (BackgroundableProcessIndicator)progressIndicator; if (indicator.getDumbModeAction() == DumbModeAction.WAIT) {