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 82cf36946b9e..346a4446090a 100644 --- a/platform/analysis-impl/src/com/intellij/codeInspection/ex/InspectionProfileImpl.java +++ b/platform/analysis-impl/src/com/intellij/codeInspection/ex/InspectionProfileImpl.java @@ -885,13 +885,13 @@ public class InspectionProfileImpl extends ProfileEx implements ModifiableModel, getTools(toolId, project).removeScope(scopeIdx); } - public void removeScope(@NotNull String toolId, @NotNull NamedScope scope, Project project) { - getTools(toolId, project).removeScope(scope); + public void removeScope(@NotNull String toolId, @NotNull String scopeName, Project project) { + getTools(toolId, project).removeScope(scopeName); } - public void removeScopes(@NotNull List toolIds, @NotNull NamedScope scope, Project project) { + public void removeScopes(@NotNull List toolIds, @NotNull String scopeName, Project project) { for (final String toolId : toolIds) { - removeScope(toolId, scope, project); + removeScope(toolId, scopeName, project); } } 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 267c0ee67fc3..caeb02a2316f 100644 --- a/platform/analysis-impl/src/com/intellij/codeInspection/ex/ToolsImpl.java +++ b/platform/analysis-impl/src/com/intellij/codeInspection/ex/ToolsImpl.java @@ -267,25 +267,26 @@ public class ToolsImpl implements Tools { public void removeScope(int scopeIdx) { if (myTools != null && scopeIdx >= 0 && myTools.size() > scopeIdx) { myTools.remove(scopeIdx); - if (myTools.isEmpty()) { - myTools = null; - setEnabled(myDefaultState.isEnabled()); - } + checkToolsIsEmpty(); } } - public void removeScope(final NamedScope scope) { + public void removeScope(final @NotNull String scopeName) { if (myTools != null) { - for (final ScopeToolState tool : myTools) { - if (Comparing.equal(tool.getScopeName(), scope.getName())) { + for (ScopeToolState tool : myTools) { + if (scopeName.equals(tool.getScopeName())) { myTools.remove(tool); break; } } - if (myTools.isEmpty()) { - myTools = null; - setEnabled(myDefaultState.isEnabled()); - } + checkToolsIsEmpty(); + } + } + + private void checkToolsIsEmpty() { + if (myTools.isEmpty()) { + myTools = null; + setEnabled(myDefaultState.isEnabled()); } } diff --git a/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/table/ScopesAndSeveritiesTable.java b/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/table/ScopesAndSeveritiesTable.java index 385b764af027..58e35083a247 100644 --- a/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/table/ScopesAndSeveritiesTable.java +++ b/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/table/ScopesAndSeveritiesTable.java @@ -357,6 +357,9 @@ public class ScopesAndSeveritiesTable extends JBTable { } else if (columnIndex == SCOPE_ENABLED_COLUMN) { final NamedScope scope = getScope(rowIndex); + if (scope == null) { + return; + } if ((Boolean)value) { if (rowIndex == lastRowIndex()) { myInspectionProfile.enableToolsByDefault(myKeyNames, myProject); @@ -381,7 +384,7 @@ public class ScopesAndSeveritiesTable extends JBTable { @Override public void removeRow(final int idx) { if (idx != lastRowIndex()) { - myInspectionProfile.removeScopes(myKeyNames, getScope(idx), myProject); + myInspectionProfile.removeScopes(myKeyNames, getScopeName(idx), myProject); refreshAggregatedScopes(); myTableSettings.onScopeRemoved(getRowCount()); }