diff --git a/platform/analysis-impl/src/com/intellij/codeInsight/daemon/InspectionProfileConvertor.java b/platform/analysis-impl/src/com/intellij/codeInsight/daemon/InspectionProfileConvertor.java index 569c95a8b709..1bd194384199 100644 --- a/platform/analysis-impl/src/com/intellij/codeInsight/daemon/InspectionProfileConvertor.java +++ b/platform/analysis-impl/src/com/intellij/codeInsight/daemon/InspectionProfileConvertor.java @@ -129,7 +129,7 @@ public class InspectionProfileConvertor { //set up tools for default profile if (level != HighlightDisplayLevel.DO_NOT_SHOW) { - profile.enableTool(shortName, null, null); + profile.enableTool(shortName, null); } if (level == null || level == HighlightDisplayLevel.DO_NOT_SHOW) { diff --git a/platform/analysis-impl/src/com/intellij/codeInspection/ex/InspectionProfileImpl.java b/platform/analysis-impl/src/com/intellij/codeInspection/ex/InspectionProfileImpl.java index 9140a1847240..c78621b9bca6 100644 --- a/platform/analysis-impl/src/com/intellij/codeInspection/ex/InspectionProfileImpl.java +++ b/platform/analysis-impl/src/com/intellij/codeInspection/ex/InspectionProfileImpl.java @@ -660,13 +660,11 @@ public class InspectionProfileImpl extends NewInspectionProfile { public void enableTool(@NotNull String toolId, Project project) { final ToolsImpl tools = getTools(toolId, project); tools.setEnabled(true); - if (tools.getNonDefaultTools() == null) { - tools.getDefaultState().setEnabled(true); - } + tools.getDefaultState().setEnabled(true); schemeState = SchemeState.POSSIBLY_CHANGED; } - public void enableTool(@NotNull String inspectionTool, NamedScope namedScope, Project project) { + public void enableTool(@NotNull String inspectionTool, @NotNull NamedScope namedScope, Project project) { getTools(inspectionTool, project).enableTool(namedScope, project); schemeState = SchemeState.POSSIBLY_CHANGED; } diff --git a/platform/analysis-impl/src/com/intellij/codeInspection/ex/ToolsImpl.java b/platform/analysis-impl/src/com/intellij/codeInspection/ex/ToolsImpl.java index 48abc015ce7e..8c78dcac7684 100644 --- a/platform/analysis-impl/src/com/intellij/codeInspection/ex/ToolsImpl.java +++ b/platform/analysis-impl/src/com/intellij/codeInspection/ex/ToolsImpl.java @@ -394,10 +394,10 @@ public class ToolsImpl implements Tools { myEnabled = enabled; } - public void enableTool(NamedScope namedScope, Project project) { + public void enableTool(@NotNull NamedScope namedScope, Project project) { if (myTools != null) { for (ScopeToolState state : myTools) { - if (Comparing.equal(state.getScope(project), namedScope)) { + if (namedScope.equals(state.getScope(project))) { state.setEnabled(true); } } diff --git a/python/src/com/jetbrains/python/inspections/PyCompatibilityInspectionAdvertiser.java b/python/src/com/jetbrains/python/inspections/PyCompatibilityInspectionAdvertiser.java index 37962c5280cf..ef2029a27ac9 100644 --- a/python/src/com/jetbrains/python/inspections/PyCompatibilityInspectionAdvertiser.java +++ b/python/src/com/jetbrains/python/inspections/PyCompatibilityInspectionAdvertiser.java @@ -234,13 +234,7 @@ public class PyCompatibilityInspectionAdvertiser implements Annotator { final InspectionProfileImpl profile = InspectionProjectProfileManager.getInstance(project).getCurrentProfile(); final InspectionToolWrapper tool = profile.getInspectionTool(getCompatibilityInspectionShortName(), project); if (tool != null) { - // Partially copied from JSLinterInspection - final InspectionProfileImpl inspectionProfileImpl = as(profile, InspectionProfileImpl.class); - if (inspectionProfileImpl != null) { - final ScopeToolState state = inspectionProfileImpl.getToolDefaultState(tool.getShortName(), project); - state.setEnabled(true); - } - profile.modifyProfile(model -> model.enableTool(tool.getShortName(), null, project)); + profile.modifyProfile(model -> model.enableTool(tool.getShortName(), project)); EditInspectionToolsSettingsAction.editToolSettings(project, profile, getCompatibilityInspectionShortName()); } }