wait for user input out of read action (IDEA-115944, consequence of IDEA-115258)

This commit is contained in:
Maxim.Mossienko
2013-11-18 19:12:37 +01:00
parent 07f4120704
commit 7035aa0201
2 changed files with 5 additions and 1 deletions
@@ -36,6 +36,8 @@ import com.intellij.openapi.module.ModuleManager;
import com.intellij.openapi.progress.ProcessCanceledException;
import com.intellij.openapi.progress.ProgressIndicator;
import com.intellij.openapi.progress.ProgressManager;
import com.intellij.openapi.progress.util.ProgressWrapper;
import com.intellij.openapi.progress.util.TooManyUsagesStatus;
import com.intellij.openapi.project.DumbService;
import com.intellij.openapi.project.IndexNotReadyException;
import com.intellij.openapi.project.Project;
@@ -282,7 +284,10 @@ public class FindInProjectUtil {
final int[] offset = {0};
int count = 0;
int found;
ProgressIndicator indicator = ProgressWrapper.unwrap(ProgressManager.getInstance().getProgressIndicator());
TooManyUsagesStatus tooManyUsagesStatus = TooManyUsagesStatus.getFrom(indicator);
do {
tooManyUsagesStatus.pauseProcessingIfTooManyUsages(); // wait for user out of read action
found = ApplicationManager.getApplication().runReadAction(new Computable<Integer>() {
@Override
@NotNull
@@ -353,7 +353,6 @@ public class UsageViewManagerImpl extends UsageViewManager {
ProgressIndicator indicator = ProgressWrapper.unwrap(ProgressManager.getInstance().getProgressIndicator());
if (indicator != null && indicator.isCanceled()) return false;
TooManyUsagesStatus tooManyUsagesStatus = TooManyUsagesStatus.getFrom(indicator);
tooManyUsagesStatus.pauseProcessingIfTooManyUsages();
boolean incrementCounter = !isSelfUsage(usage, mySearchFor);
if (incrementCounter) {