more granular "too many usages" warning

This commit is contained in:
Alexey Kudravtsev
2013-10-28 17:21:09 +04:00
parent 963157fecd
commit 7ec28c22da
3 changed files with 4 additions and 3 deletions
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
* Copyright 2000-2013 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -445,7 +445,6 @@ public interface PsiElement extends UserDataHolder, Iconable {
* for processing to the specified scope processor.
*
* @param processor the processor receiving the declarations.
* @param state
* @param lastParent the child of this element has been processed during the previous
* step of the tree up walk (declarations under this element do not need
* to be processed again)
@@ -766,7 +766,6 @@ public class PsiSearchHelperImpl implements PsiSearchHelper {
return processPsiFileRootsAsync(files, totalSize, alreadyProcessedFiles, progress, new Processor<PsiFile>() {
@Override
public boolean process(final PsiFile psiRoot) {
TooManyUsagesStatus.getFrom(progress).pauseProcessingIfTooManyUsages();
final VirtualFile vfile = ApplicationManager.getApplication().runReadAction(new Computable<VirtualFile>() {
@Override
public VirtualFile compute() {
@@ -775,6 +774,7 @@ public class PsiSearchHelperImpl implements PsiSearchHelper {
});
for (final RequestWithProcessor singleRequest : candidateFiles.get(vfile)) {
Processor<PsiElement> localProcessor = localProcessors.get(singleRequest);
TooManyUsagesStatus.getFrom(progress).pauseProcessingIfTooManyUsages();
if (!localProcessor.process(psiRoot)) {
return false;
}
@@ -796,6 +796,7 @@ public class UsageViewImpl implements UsageView, UsageModelTracker.UsageModelTra
@Override
public boolean process(final Usage usage) {
if (searchHasBeenCancelled()) return false;
TooManyUsagesStatus.getFrom(indicator).pauseProcessingIfTooManyUsages();
boolean incrementCounter = !com.intellij.usages.UsageViewManager.isSelfUsage(usage, myTargets);
@@ -808,6 +809,7 @@ public class UsageViewImpl implements UsageView, UsageModelTracker.UsageModelTra
}
}
ApplicationManager.getApplication().runReadAction(new Runnable() {
@Override
public void run() {
appendUsage(usage);
}