Merge remote-tracking branch 'origin/master' into develar/is
[idea/community.git] / platform / lang-impl / src / com / intellij / codeInspection / InspectionApplication.java
index dc00f6bfb3dd1ce5addeeb4068db06f671f157cb..a6d7c9b2241cee615cdfa19cf53f4f622dc144c6 100644 (file)
@@ -16,6 +16,7 @@
 package com.intellij.codeInspection;
 
 import com.intellij.analysis.AnalysisScope;
 package com.intellij.codeInspection;
 
 import com.intellij.analysis.AnalysisScope;
+import com.intellij.codeInsight.daemon.HighlightDisplayKey;
 import com.intellij.codeInspection.ex.*;
 import com.intellij.conversion.ConversionListener;
 import com.intellij.conversion.ConversionService;
 import com.intellij.codeInspection.ex.*;
 import com.intellij.conversion.ConversionListener;
 import com.intellij.conversion.ConversionService;
@@ -255,7 +256,8 @@ public class InspectionApplication {
       });
       final String descriptionsFile = resultsDataPath + File.separatorChar + DESCRIPTIONS + XML_EXTENSION;
       describeInspections(descriptionsFile,
       });
       final String descriptionsFile = resultsDataPath + File.separatorChar + DESCRIPTIONS + XML_EXTENSION;
       describeInspections(descriptionsFile,
-                          myRunWithEditorSettings ? null : inspectionProfile.getName());
+                          myRunWithEditorSettings ? null : inspectionProfile.getName(),
+                          (InspectionProfile)inspectionProfile);
       inspectionsResults.add(new File(descriptionsFile));
       // convert report
       if (reportConverter != null) {
       inspectionsResults.add(new File(descriptionsFile));
       // convert report
       if (reportConverter != null) {
@@ -446,8 +448,8 @@ public class InspectionApplication {
     }
   }
 
     }
   }
 
-  private static void describeInspections(@NonNls String myOutputPath, final String name) throws IOException {
-    final InspectionToolWrapper[] toolWrappers = InspectionProfileImpl.getDefaultProfile().getInspectionTools(null);
+  private static void describeInspections(@NonNls String myOutputPath, final String name, final InspectionProfile profile) throws IOException {
+    final InspectionToolWrapper[] toolWrappers = profile.getInspectionTools(null);
     final Map<String, Set<InspectionToolWrapper>> map = new HashMap<String, Set<InspectionToolWrapper>>();
     for (InspectionToolWrapper toolWrapper : toolWrappers) {
       final String groupName = toolWrapper.getGroupDisplayName();
     final Map<String, Set<InspectionToolWrapper>> map = new HashMap<String, Set<InspectionToolWrapper>>();
     for (InspectionToolWrapper toolWrapper : toolWrappers) {
       final String groupName = toolWrapper.getGroupDisplayName();
@@ -472,14 +474,17 @@ public class InspectionApplication {
         final Set<InspectionToolWrapper> entries = map.get(groupName);
         for (InspectionToolWrapper toolWrapper : entries) {
           xmlWriter.startNode("inspection");
         final Set<InspectionToolWrapper> entries = map.get(groupName);
         for (InspectionToolWrapper toolWrapper : entries) {
           xmlWriter.startNode("inspection");
-          xmlWriter.addAttribute("shortName", toolWrapper.getShortName());
+          final String shortName = toolWrapper.getShortName();
+          xmlWriter.addAttribute("shortName", shortName);
           xmlWriter.addAttribute("displayName", toolWrapper.getDisplayName());
           xmlWriter.addAttribute("displayName", toolWrapper.getDisplayName());
+          final boolean toolEnabled = profile.isToolEnabled(HighlightDisplayKey.find(shortName));
+          xmlWriter.addAttribute("enabled", Boolean.toString(toolEnabled));
           final String description = toolWrapper.loadDescription();
           if (description != null) {
             xmlWriter.setValue(description);
           }
           else {
           final String description = toolWrapper.loadDescription();
           if (description != null) {
             xmlWriter.setValue(description);
           }
           else {
-            LOG.error(toolWrapper.getShortName() + " descriptionUrl==" + toolWrapper);
+            LOG.error(shortName + " descriptionUrl==" + toolWrapper);
           }
           xmlWriter.endNode();
         }
           }
           xmlWriter.endNode();
         }