mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
cancel job when one of tasks threw PCE
This commit is contained in:
+1
-2
@@ -275,9 +275,8 @@ public class LocalInspectionsPass extends ProgressableTextEditorHighlightingPass
|
||||
if (problemDescriptors == null) return;
|
||||
InspectionProfile inspectionProfile = InspectionProjectProfileManager.getInstance(myProject).getInspectionProfile();
|
||||
final HighlightSeverity severity = inspectionProfile.getErrorLevel(HighlightDisplayKey.find(tool.getShortName()), myFile).getSeverity();
|
||||
ProgressManager progressManager = ProgressManager.getInstance();
|
||||
for (ProblemDescriptor problemDescriptor : problemDescriptors) {
|
||||
progressManager.checkCanceled();
|
||||
ProgressManager.checkCanceled();
|
||||
if (!(ignoreSuppressed && InspectionManagerEx.inspectionResultSuppressed(problemDescriptor.getPsiElement(), tool))) {
|
||||
myDescriptors.add(problemDescriptor);
|
||||
HighlightInfoType type = highlightTypeFromDescriptor(problemDescriptor, severity);
|
||||
|
||||
-20
@@ -53,7 +53,6 @@ import com.intellij.util.SmartList;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.containers.MultiMap;
|
||||
import gnu.trove.THashMap;
|
||||
import gnu.trove.TObjectHashingStrategy;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.TestOnly;
|
||||
|
||||
@@ -77,25 +76,6 @@ public class UpdateHighlightersUtil {
|
||||
return o1.getStartOffset() - o2.getStartOffset();
|
||||
}
|
||||
};
|
||||
private static final TObjectHashingStrategy<HighlightInfo> DISTINQUISH_INVALID_MARKERS = new TObjectHashingStrategy<HighlightInfo>() {
|
||||
public int computeHashCode(HighlightInfo info) {
|
||||
return info.getActualStartOffset();
|
||||
}
|
||||
|
||||
public boolean equals(HighlightInfo info1, HighlightInfo info2) {
|
||||
if (info1 == info2) return true;
|
||||
if (info1.highlighter != null && !info1.highlighter.isValid()) return false;
|
||||
if (info2.highlighter != null && !info2.highlighter.isValid()) return false;
|
||||
return info1.getSeverity() == info2.getSeverity() &&
|
||||
info1.getActualStartOffset() == info2.getActualStartOffset() &&
|
||||
info1.getActualEndOffset() == info2.getActualEndOffset() &&
|
||||
info1.type.equals(info2.type) &&
|
||||
Comparing.equal(info1.getGutterIconRenderer(), info2.getGutterIconRenderer()) &&
|
||||
Comparing.equal(info1.forcedTextAttributes, info2.forcedTextAttributes) &&
|
||||
Comparing.strEqual(info1.description, info2.description)
|
||||
;
|
||||
}
|
||||
};
|
||||
|
||||
private static void cleanFileLevelHighlights(@NotNull Project project, final int group, PsiFile psiFile) {
|
||||
if (psiFile == null || !psiFile.getViewProvider().isPhysical()) return;
|
||||
|
||||
@@ -53,14 +53,19 @@ public class JobUtil {
|
||||
final Job<String> job = JobScheduler.getInstance().createJob(jobName, Job.DEFAULT_PRIORITY);
|
||||
|
||||
for (final T thing : things) {
|
||||
//noinspection HardCodedStringLiteral
|
||||
job.addTask(new Runnable(){
|
||||
public void run() {
|
||||
if (!thingProcessor.process(thing)) {
|
||||
try {
|
||||
if (!thingProcessor.process(thing)) {
|
||||
job.cancel();
|
||||
}
|
||||
}
|
||||
catch (ProcessCanceledException e) {
|
||||
job.cancel();
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}, "done");
|
||||
});
|
||||
}
|
||||
try {
|
||||
job.scheduleAndWaitForResults();
|
||||
@@ -77,7 +82,9 @@ public class JobUtil {
|
||||
}
|
||||
|
||||
// execute in multiple threads, with checkCanceled in each delegated to our current progress
|
||||
public static <T> boolean invokeConcurrentlyUnderMyProgress(@NotNull Collection<T> things, @NotNull final Processor<T> thingProcessor, @NotNull @NonNls String jobName) throws ProcessCanceledException {
|
||||
public static <T> boolean invokeConcurrentlyUnderMyProgress(@NotNull Collection<T> things,
|
||||
@NotNull final Processor<T> thingProcessor,
|
||||
@NotNull @NonNls String jobName) throws ProcessCanceledException {
|
||||
final ProgressIndicator indicator = ProgressManager.getInstance().getProgressIndicator();
|
||||
return invokeConcurrentlyForAll(things, new Processor<T>() {
|
||||
public boolean process(final T t) {
|
||||
|
||||
Reference in New Issue
Block a user