diff --git a/platform/testFramework/src/com/intellij/testFramework/fixtures/impl/CodeInsightTestFixtureImpl.java b/platform/testFramework/src/com/intellij/testFramework/fixtures/impl/CodeInsightTestFixtureImpl.java index 6e684b690f06..804c20272076 100644 --- a/platform/testFramework/src/com/intellij/testFramework/fixtures/impl/CodeInsightTestFixtureImpl.java +++ b/platform/testFramework/src/com/intellij/testFramework/fixtures/impl/CodeInsightTestFixtureImpl.java @@ -150,6 +150,9 @@ public class CodeInsightTestFixtureImpl extends BaseFixture implements CodeInsig private boolean myAllowDirt; private boolean myCaresAboutInjection = true; + // this allows an inspection to be represented in profile, but to appear disabled + public final Set myDisabledInspections = new HashSet(); + @SuppressWarnings("JUnitTestCaseWithNonTrivialConstructors") public CodeInsightTestFixtureImpl(@NotNull IdeaProjectTestFixture projectFixture, @NotNull TempDirTestFixture tempDirTestFixture) { myProjectFixture = projectFixture; @@ -1268,7 +1271,7 @@ public class CodeInsightTestFixtureImpl extends BaseFixture implements CodeInsig @Override public boolean isToolEnabled(HighlightDisplayKey key, PsiElement element) { - return key != null && key.toString() != null && myAvailableTools.containsKey(key.toString()); + return key != null && key.toString() != null && myAvailableTools.containsKey(key.toString()) && !myDisabledInspections.contains(key.toString()); } @Override diff --git a/spellchecker/src/com/intellij/spellchecker/ui/SpellCheckingEditorCustomization.java b/spellchecker/src/com/intellij/spellchecker/ui/SpellCheckingEditorCustomization.java index b71b5994cdb4..53668c2e73ff 100644 --- a/spellchecker/src/com/intellij/spellchecker/ui/SpellCheckingEditorCustomization.java +++ b/spellchecker/src/com/intellij/spellchecker/ui/SpellCheckingEditorCustomization.java @@ -154,7 +154,7 @@ public class SpellCheckingEditorCustomization extends SimpleEditorCustomization @Override public boolean isToolEnabled(HighlightDisplayKey key, PsiElement element) { - return myDelegate.isToolEnabled(key, element) && SPELL_CHECK_TOOLS.containsKey(key.toString()) && myUseSpellCheck; + return SPELL_CHECK_TOOLS.containsKey(key.toString()) && myUseSpellCheck; } public void setUseSpellCheck(boolean useSpellCheck) { diff --git a/spellchecker/testSrc/com/intellij/spellchecker/ui/SpellCheckingEditorCustomizationTest.java b/spellchecker/testSrc/com/intellij/spellchecker/ui/SpellCheckingEditorCustomizationTest.java index 3fd653fd7e61..799fe3331740 100644 --- a/spellchecker/testSrc/com/intellij/spellchecker/ui/SpellCheckingEditorCustomizationTest.java +++ b/spellchecker/testSrc/com/intellij/spellchecker/ui/SpellCheckingEditorCustomizationTest.java @@ -20,6 +20,7 @@ import com.intellij.openapi.editor.ex.EditorEx; import com.intellij.openapi.fileTypes.PlainTextFileType; import com.intellij.spellchecker.inspections.SpellCheckingInspection; import com.intellij.testFramework.fixtures.LightPlatformCodeInsightFixtureTestCase; +import com.intellij.testFramework.fixtures.impl.CodeInsightTestFixtureImpl; public class SpellCheckingEditorCustomizationTest extends LightPlatformCodeInsightFixtureTestCase { public void testEnabled() throws Exception { @@ -30,6 +31,11 @@ public class SpellCheckingEditorCustomizationTest extends LightPlatformCodeInsig doTest(false, "missspelling"); } + public void testEnabledEvenIfDisabledInMainProfile() throws Exception { + ((CodeInsightTestFixtureImpl)myFixture).myDisabledInspections.add(SpellCheckingInspection.SPELL_CHECKING_INSPECTION_TOOL_NAME); + testEnabled(); + } + @Override protected boolean isWriteActionRequired() { return false;