mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
fix the IDEA-CR-12595 the other way: add LOCAL_ANALYSIS to myJobDescriptors for simple global inspections because they will call inspectFile() which uses LOCAL_ANALYSIS
This commit is contained in:
+2
-7
@@ -446,24 +446,19 @@ public class GlobalInspectionContextBase extends UserDataHolderBase implements G
|
||||
int old = job.getDoneAmount();
|
||||
job.setDoneAmount(old + 1);
|
||||
|
||||
float totalProgress = getTotalProgress(job);
|
||||
float totalProgress = getTotalProgress();
|
||||
|
||||
myProgressIndicator.setFraction(totalProgress);
|
||||
myProgressIndicator.setText(job.getDisplayName() + " " + message);
|
||||
}
|
||||
|
||||
private float getTotalProgress(@NotNull JobDescriptor currentJob) {
|
||||
private float getTotalProgress() {
|
||||
int totalDone = 0;
|
||||
int totalTotal = 0;
|
||||
for (JobDescriptor jobDescriptor : myJobDescriptors) {
|
||||
totalDone += jobDescriptor.getDoneAmount();
|
||||
totalTotal += jobDescriptor.getTotalAmount();
|
||||
}
|
||||
// if we run e.g. just "Annotator" simple global tool then myJobDescriptors are empty
|
||||
if (myJobDescriptors.isEmpty()) {
|
||||
totalDone += currentJob.getDoneAmount();
|
||||
totalTotal += currentJob.getTotalAmount();
|
||||
}
|
||||
return totalTotal == 0 ? 1 : 1.0f * totalDone / totalTotal;
|
||||
}
|
||||
|
||||
|
||||
+15
-9
@@ -15,13 +15,11 @@
|
||||
*/
|
||||
package com.intellij.codeInspection.ex;
|
||||
|
||||
import com.intellij.codeInspection.GlobalInspectionContext;
|
||||
import com.intellij.codeInspection.GlobalInspectionTool;
|
||||
import com.intellij.codeInspection.InspectionEP;
|
||||
import com.intellij.codeInspection.LocalInspectionTool;
|
||||
import com.intellij.codeInspection.*;
|
||||
import com.intellij.codeInspection.reference.RefGraphAnnotator;
|
||||
import com.intellij.codeInspection.reference.RefManagerImpl;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import com.intellij.util.ObjectUtils;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -66,13 +64,20 @@ public class GlobalInspectionToolWrapper extends InspectionToolWrapper<GlobalIns
|
||||
@Override
|
||||
@NotNull
|
||||
public JobDescriptor[] getJobDescriptors(@NotNull GlobalInspectionContext context) {
|
||||
final JobDescriptor[] additionalJobs = getTool().getAdditionalJobs();
|
||||
if (additionalJobs == null) {
|
||||
return getTool().isGraphNeeded() ? context.getStdJobDescriptors().BUILD_GRAPH_ONLY : JobDescriptor.EMPTY_ARRAY;
|
||||
GlobalInspectionTool tool = getTool();
|
||||
JobDescriptor[] additionalJobs = ObjectUtils.notNull(tool.getAdditionalJobs(), JobDescriptor.EMPTY_ARRAY);
|
||||
StdJobDescriptors stdJobDescriptors = context.getStdJobDescriptors();
|
||||
if (tool.isGraphNeeded()) {
|
||||
additionalJobs = additionalJobs.length == 0 ? stdJobDescriptors.BUILD_GRAPH_ONLY :
|
||||
ArrayUtil.append(additionalJobs, stdJobDescriptors.BUILD_GRAPH);
|
||||
}
|
||||
else {
|
||||
return getTool().isGraphNeeded() ? ArrayUtil.append(additionalJobs, context.getStdJobDescriptors().BUILD_GRAPH) : additionalJobs;
|
||||
if (tool instanceof GlobalSimpleInspectionTool) {
|
||||
// if we run e.g. just "Annotator" simple global tool then myJobDescriptors are empty but LOCAL_ANALYSIS is used from inspectFile()
|
||||
additionalJobs = additionalJobs.length == 0 ? stdJobDescriptors.LOCAL_ANALYSIS_ARRAY :
|
||||
ArrayUtil.contains(stdJobDescriptors.LOCAL_ANALYSIS, additionalJobs) ? additionalJobs :
|
||||
ArrayUtil.append(additionalJobs, stdJobDescriptors.LOCAL_ANALYSIS);
|
||||
}
|
||||
return additionalJobs;
|
||||
}
|
||||
|
||||
public boolean worksInBatchModeOnly() {
|
||||
@@ -85,6 +90,7 @@ public class GlobalInspectionToolWrapper extends InspectionToolWrapper<GlobalIns
|
||||
if (sharedTool == null) {
|
||||
return null;
|
||||
}
|
||||
//noinspection TestOnlyProblems
|
||||
return new LocalInspectionToolWrapper(sharedTool);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user