mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
This commit is contained in:
+3
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 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.
|
||||
@@ -21,6 +21,7 @@ import com.intellij.concurrency.JobLauncher;
|
||||
import com.intellij.injected.editor.DocumentWindow;
|
||||
import com.intellij.lang.Language;
|
||||
import com.intellij.lang.injection.InjectedLanguageManager;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.editor.Document;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
@@ -145,6 +146,7 @@ public class InjectedGeneralHighlightingPass extends GeneralHighlightingPass imp
|
||||
private Set<PsiFile> getInjectedPsiFiles(@NotNull final List<PsiElement> elements1,
|
||||
@NotNull final List<PsiElement> elements2,
|
||||
@NotNull final ProgressIndicator progress) {
|
||||
ApplicationManager.getApplication().assertReadAccessAllowed();
|
||||
final Set<PsiFile> outInjected = new THashSet<PsiFile>();
|
||||
|
||||
List<DocumentWindow> injected = InjectedLanguageUtil.getCachedInjectedDocuments(myFile);
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
package com.intellij.concurrency;
|
||||
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.application.ex.ApplicationManagerEx;
|
||||
import com.intellij.openapi.progress.ProcessCanceledException;
|
||||
import com.intellij.openapi.progress.ProgressIndicator;
|
||||
import com.intellij.openapi.progress.ProgressManager;
|
||||
@@ -129,19 +130,30 @@ public class JobLauncherImpl extends JobLauncher {
|
||||
|
||||
if (things.size() <= 1 || JobSchedulerImpl.CORES_COUNT <= CORES_FORK_THRESHOLD) {
|
||||
final AtomicBoolean result = new AtomicBoolean(true);
|
||||
ProgressManager.getInstance().executeProcessUnderProgress(new Runnable() {
|
||||
Runnable runnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
//noinspection ForLoopReplaceableByForEach
|
||||
for (int i = 0; i < things.size(); i++) {
|
||||
T thing = things.get(i);
|
||||
if (!thingProcessor.process(thing)) {
|
||||
result.set(false);
|
||||
break;
|
||||
ProgressManager.getInstance().executeProcessUnderProgress(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
//noinspection ForLoopReplaceableByForEach
|
||||
for (int i = 0; i < things.size(); i++) {
|
||||
T thing = things.get(i);
|
||||
if (!thingProcessor.process(thing)) {
|
||||
result.set(false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}, wrapper);
|
||||
}
|
||||
}, wrapper);
|
||||
};
|
||||
if (runInReadAction) {
|
||||
if (!ApplicationManagerEx.getApplicationEx().tryRunReadAction(runnable)) return false;
|
||||
}
|
||||
else {
|
||||
runnable.run();
|
||||
}
|
||||
return result.get();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user