Merge remote-tracking branch 'origin/master' into develar/is
authorVladimir Krivosheev <vladimir.krivosheev@jetbrains.com>
Wed, 20 Jul 2016 09:14:43 +0000 (11:14 +0200)
committerVladimir Krivosheev <vladimir.krivosheev@jetbrains.com>
Wed, 20 Jul 2016 09:14:43 +0000 (11:14 +0200)
# Conflicts:
# platform/analysis-impl/src/com/intellij/codeInspection/ex/InspectionProfileImpl.java

1  2 
java/java-tests/testSrc/com/intellij/codeInspection/ex/InspectionProfileTest.java
platform/analysis-api/src/com/intellij/codeInspection/InspectionProfileEntry.java
platform/analysis-impl/src/com/intellij/codeInspection/ex/GlobalInspectionContextBase.java
platform/analysis-impl/src/com/intellij/codeInspection/ex/InspectionProfileImpl.java
platform/configuration-store-impl/src/ExportSettingsAction.kt
xml/xml-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/XmlHighlightVisitor.java

index f2c65d612ba67de299c088aedc61f64bee0d744d,6c8ab275e5a9605e1dc652689e11f398acc3f8d3..3690e3c16b0f9f54730a21683ecd59140da977cf
@@@ -71,13 -70,12 +71,12 @@@ public class InspectionProfileImpl exte
    @NonNls private static final String USED_LEVELS = "used_levels";
    public static final String DEFAULT_PROFILE_NAME = "Default";
    @TestOnly
-   public static boolean INIT_INSPECTIONS;
-   private static Map<String, InspectionElementsMerger> ourMergers;
+   public static boolean INIT_INSPECTIONS = false;
    private final InspectionToolRegistrar myRegistrar;
    @NotNull
 -  private final Map<String, Element> myUninstalledInspectionsSettings;
 +  private final Map<String, Element> myInspectionsSettings = new TreeMap<>();
    protected InspectionProfileImpl mySource;
 -  private Map<String, ToolsImpl> myTools = new THashMap<String, ToolsImpl>();
 +  private Map<String, ToolsImpl> myTools = new THashMap<>();
    private volatile Map<String, Boolean> myDisplayLevelMap;
    @Attribute("is_locked")
    private boolean myLockedProfile;
    }
  
    public InspectionProfileImpl(@NotNull @NonNls String profileName) {
 -    this(profileName, InspectionToolRegistrar.getInstance(), InspectionProfileManager.getInstance(), null);
 +    this(profileName, InspectionToolRegistrar.getInstance(), InspectionProfileManager.getInstance(), null, null);
    }
  
 -  InspectionProfileImpl(@NotNull final String profileName,
 -                        @NotNull InspectionToolRegistrar registrar,
 -                        @NotNull final ProfileManager profileManager,
 -                        InspectionProfileImpl baseProfile) {
 +  public InspectionProfileImpl(@NotNull String profileName,
 +                               @NotNull InspectionToolRegistrar registrar,
 +                               @NotNull ProfileManager profileManager,
 +                               @Nullable InspectionProfileImpl baseProfile,
 +                               @Nullable SchemeDataHolder<InspectionProfileImpl> dataHolder) {
      super(profileName);
 +
      myRegistrar = registrar;
      myBaseProfile = baseProfile;
 -    setProfileManager(profileManager);
 -    myUninstalledInspectionsSettings = new TreeMap<String, Element>();
 +    myDataHolder = dataHolder;
 +    myProfileManager = profileManager;
    }
  
-   @NotNull
-   private static synchronized Map<String, InspectionElementsMerger> getMergers() {
-     if (ourMergers == null) {
-       ourMergers = new LinkedHashMap<>();
-       for (InspectionElementsMerger merger : Extensions.getExtensions(InspectionElementsMerger.EP_NAME)) {
-         ourMergers.put(merger.getMergedToolName(), merger);
-       }
-     }
-     return ourMergers;
-   }
    @NotNull
    public static InspectionProfileImpl createSimple(@NotNull String name,
 -                                                   @NotNull final Project project,
 -                                                   @NotNull final InspectionToolWrapper... toolWrappers) {
 -    InspectionToolRegistrar registrar = new InspectionToolRegistrar() {
 +                                                   @NotNull Project project,
 +                                                   @NotNull List<InspectionToolWrapper> toolWrappers) {
 +    InspectionProfileImpl profile = new InspectionProfileImpl(name, new InspectionToolRegistrar() {
        @NotNull
        @Override
        public List<InspectionToolWrapper> createTools() {
      }
    }
  
 -  private void markSettingsMerged(String toolName, Element element) {
 +  private void markSettingsMerged(@NotNull String toolName, @NotNull Element element) {
      //add marker if already merged but result is now default (-> empty node)
-     final String mergedName = InspectionElementsMerger.getMergedMarkerName(toolName);
-     if (!myInspectionsSettings.containsKey(mergedName)) {
-       final InspectionElementsMerger merger = getMergers().get(toolName);
-       if (merger != null && merger.markSettingsMerged(myInspectionsSettings)) {
+     final String mergedName = InspectionElementsMergerBase.getMergedMarkerName(toolName);
+     if (!myUninstalledInspectionsSettings.containsKey(mergedName)) {
+       final InspectionElementsMergerBase merger = getMerger(toolName);
+       if (merger != null && merger.markSettingsMerged(myUninstalledInspectionsSettings)) {
          element.addContent(new Element(INSPECTION_TOOL_TAG).setAttribute(CLASS_TAG, mergedName));
        }
      }
        if (element != null) {
          toolsList.readExternal(element, this, dependencies);
        }
-       else if (!myInspectionsSettings.containsKey(InspectionElementsMerger.getMergedMarkerName(shortName))) {
-         final InspectionElementsMerger merger = getMergers().get(shortName);
+       else if (!myUninstalledInspectionsSettings.containsKey(InspectionElementsMergerBase.getMergedMarkerName(shortName))) {
+         final InspectionElementsMergerBase merger = getMerger(shortName);
          if (merger != null) {
 -          final Element merged = merger.merge(myUninstalledInspectionsSettings);
 +          final Element merged = merger.merge(myInspectionsSettings);
            if (merged != null) {
              toolsList.readExternal(merged, this, dependencies);
            }