IDEA-130964 Spell check in commit dialog only works if enabled in inspection

This commit is contained in:
Dmitry Batrak
2014-10-09 15:15:25 +04:00
parent 7e599e0b06
commit c3759fbaeb
3 changed files with 11 additions and 2 deletions
@@ -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<String> myDisabledInspections = new HashSet<String>();
@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
@@ -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) {
@@ -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;