check enabled status for simple global inspections (IDEA-135031)

This commit is contained in:
Anna Kozlova
2015-01-08 19:54:19 +01:00
parent 51971c4a7a
commit a7912bc4de
@@ -380,17 +380,16 @@ public class GlobalInspectionContextImpl extends GlobalInspectionContextBase imp
final List<LocalInspectionToolWrapper> lTools = getWrappersFromTools(localTools, file);
pass.doInspectInBatch(this, inspectionManager, lTools);
JobLauncher.getInstance().invokeConcurrentlyUnderProgress(globalSimpleTools, myProgressIndicator, false, new Processor<Tools>() {
JobLauncher.getInstance().invokeConcurrentlyUnderProgress(getWrappersFromTools(globalSimpleTools, file), myProgressIndicator, false, new Processor<GlobalInspectionToolWrapper>() {
@Override
public boolean process(Tools tools) {
GlobalInspectionToolWrapper toolWrapper = (GlobalInspectionToolWrapper)tools.getTool();
GlobalSimpleInspectionTool tool = (GlobalSimpleInspectionTool)toolWrapper.getTool();
ProblemsHolder problemsHolder = new ProblemsHolder(inspectionManager, file, false);
ProblemDescriptionsProcessor problemDescriptionProcessor = getProblemDescriptionProcessor(toolWrapper, wrappersMap);
tool.checkFile(file, inspectionManager, problemsHolder, GlobalInspectionContextImpl.this, problemDescriptionProcessor);
InspectionToolPresentation toolPresentation = getPresentation(toolWrapper);
LocalDescriptorsUtil.addProblemDescriptors(problemsHolder.getResults(), false, GlobalInspectionContextImpl.this, null,
CONVERT, toolPresentation);
public boolean process(GlobalInspectionToolWrapper toolWrapper) {
GlobalSimpleInspectionTool tool = (GlobalSimpleInspectionTool)toolWrapper.getTool();
ProblemsHolder problemsHolder = new ProblemsHolder(inspectionManager, file, false);
ProblemDescriptionsProcessor problemDescriptionProcessor = getProblemDescriptionProcessor(toolWrapper, wrappersMap);
tool.checkFile(file, inspectionManager, problemsHolder, GlobalInspectionContextImpl.this, problemDescriptionProcessor);
InspectionToolPresentation toolPresentation = getPresentation(toolWrapper);
LocalDescriptorsUtil.addProblemDescriptors(problemsHolder.getResults(), false, GlobalInspectionContextImpl.this, null,
CONVERT, toolPresentation);
return true;
}
});
@@ -575,10 +574,10 @@ public class GlobalInspectionContextImpl extends GlobalInspectionContextBase imp
}
}
private static List<LocalInspectionToolWrapper> getWrappersFromTools(List<Tools> localTools, PsiFile file) {
final List<LocalInspectionToolWrapper> lTools = new ArrayList<LocalInspectionToolWrapper>();
private static <T extends InspectionToolWrapper> List<T> getWrappersFromTools(List<Tools> localTools, PsiFile file) {
final List<T> lTools = new ArrayList<T>();
for (Tools tool : localTools) {
final LocalInspectionToolWrapper enabledTool = (LocalInspectionToolWrapper)tool.getEnabledTool(file);
final T enabledTool = (T)tool.getEnabledTool(file);
if (enabledTool != null) {
lTools.add(enabledTool);
}