summaryrefslogtreecommitdiff
path: root/platform/structuralsearch/testData/java/DoNotFindReturn.java
diff options
context:
space:
mode:
Diffstat (limited to 'platform/structuralsearch/testData/java/DoNotFindReturn.java')
-rw-r--r--platform/structuralsearch/testData/java/DoNotFindReturn.java43
1 files changed, 43 insertions, 0 deletions
diff --git a/platform/structuralsearch/testData/java/DoNotFindReturn.java b/platform/structuralsearch/testData/java/DoNotFindReturn.java
new file mode 100644
index 000000000000..2a97989b7564
--- /dev/null
+++ b/platform/structuralsearch/testData/java/DoNotFindReturn.java
@@ -0,0 +1,43 @@
+class X {
+ void foo() {
+ boolean completed = JobUtil.invokeConcurrentlyUnderProgress(files, new Processor<VirtualFile>() {
+ public boolean process(final VirtualFile vfile) {
+ final PsiFile file = ApplicationManager.getApplication().runReadAction(new Computable<PsiFile>() {
+ public PsiFile compute() {
+ return myManager.findFile(vfile);
+ }
+ });
+ if (file != null && !(file instanceof PsiBinaryFile)) {
+ file.getViewProvider().getContents(); // load contents outside readaction
+ ApplicationManager.getApplication().runReadAction(new Runnable() {
+ public void run() {
+ try {
+ PsiElement[] psiRoots = file.getPsiRoots();
+ Set<PsiElement> processed = new HashSet<PsiElement>(psiRoots.length * 2, (float)0.5);
+ for (PsiElement psiRoot : psiRoots) {
+ if (progress != null) progress.checkCanceled();
+ if (!processed.add(psiRoot)) continue;
+ if (!psiRootProcessor.process(psiRoot)) {
+ canceled.set(true);
+ return;
+ }
+ }
+ myManager.dropResolveCaches();
+ }
+ catch (ProcessCanceledException e) {
+ canceled.set(true);
+ pceThrown.set(true);
+ }
+ }
+ });
+ }
+ if (progress != null) {
+ double fraction = (double)counter.incrementAndGet() / size;
+ progress.setFraction(fraction);
+ }
+ return !canceled.get();
+ }
+ }, false, progress);
+
+ }
+} \ No newline at end of file