mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
ensure offline inspections are able to write result files during processing to avoid problems to be collected; ensure writeOutput is performed synchronously
This commit is contained in:
+1
-2
@@ -167,13 +167,12 @@ public class GlobalInspectionContextImpl extends GlobalInspectionContextBase imp
|
||||
cleanupTools();
|
||||
setCurrentScope(scope);
|
||||
|
||||
DefaultInspectionToolPresentation.setOutputPath(null);
|
||||
final Runnable action = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
performInspectionsWithProgress(scope, runGlobalToolsOnly, isOfflineInspections);
|
||||
DefaultInspectionToolPresentation.setOutputPath(outputPath);
|
||||
try {
|
||||
performInspectionsWithProgress(scope, runGlobalToolsOnly, isOfflineInspections);
|
||||
exportResults(inspectionsResults, outputPath);
|
||||
}
|
||||
finally {
|
||||
|
||||
+8
-4
@@ -62,7 +62,7 @@ public class DefaultInspectionToolPresentation implements ProblemDescriptionsPro
|
||||
|
||||
@NotNull
|
||||
private final GlobalInspectionContextImpl myContext;
|
||||
protected static String ourOutputPath;
|
||||
private static String ourOutputPath;
|
||||
private InspectionNode myToolNode;
|
||||
|
||||
private static final Object lock = new Object();
|
||||
@@ -200,7 +200,7 @@ public class DefaultInspectionToolPresentation implements ProblemDescriptionsPro
|
||||
if (refElement == null) return;
|
||||
if (descriptors.length == 0) return;
|
||||
if (filterSuppressed) {
|
||||
if (ourOutputPath == null || !(myToolWrapper instanceof LocalInspectionToolWrapper)) {
|
||||
if (!isOutputPathSet() || !(myToolWrapper instanceof LocalInspectionToolWrapper)) {
|
||||
synchronized (lock) {
|
||||
Map<RefEntity, CommonProblemDescriptor[]> problemElements = getProblemElements();
|
||||
CommonProblemDescriptor[] problems = problemElements.get(refElement);
|
||||
@@ -310,7 +310,7 @@ public class DefaultInspectionToolPresentation implements ProblemDescriptionsPro
|
||||
return isDisposed;
|
||||
}
|
||||
|
||||
private void writeOutput(@NotNull final CommonProblemDescriptor[] descriptions, @NotNull RefEntity refElement) {
|
||||
private synchronized void writeOutput(@NotNull final CommonProblemDescriptor[] descriptions, @NotNull RefEntity refElement) {
|
||||
final Element parentNode = new Element(InspectionsBundle.message("inspection.problems"));
|
||||
exportResults(descriptions, refElement, parentNode);
|
||||
final List list = parentNode.getChildren();
|
||||
@@ -850,7 +850,11 @@ public class DefaultInspectionToolPresentation implements ProblemDescriptionsPro
|
||||
};
|
||||
}
|
||||
|
||||
public static void setOutputPath(final String output) {
|
||||
public synchronized static void setOutputPath(final String output) {
|
||||
ourOutputPath = output;
|
||||
}
|
||||
|
||||
private synchronized static boolean isOutputPathSet() {
|
||||
return ourOutputPath != null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user