simplify spellchecker strategy a bit

This commit is contained in:
Sergey Ignatov
2014-08-14 18:34:25 +04:00
parent 8598d46ffb
commit 5b0971e7fc
2 changed files with 3 additions and 14 deletions
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -39,7 +39,6 @@ import javax.swing.*;
import java.awt.*;
import java.util.Set;
public class SpellCheckingInspection extends LocalInspectionTool {
public static final String SPELL_CHECKING_INSPECTION_TOOL_NAME = "SpellCheckingInspection";
@@ -161,14 +160,9 @@ public class SpellCheckingInspection extends LocalInspectionTool {
tokenizer.tokenize(element, consumer);
}
private static void addBatchDescriptor(PsiElement element, int offset, @NotNull TextRange textRange, @NotNull ProblemsHolder holder) {
final SpellcheckingStrategy strategy = getSpellcheckingStrategy(element, element.getLanguage());
SpellCheckerQuickFix[] fixes = strategy != null
? strategy.getBatchFixes(element, offset, textRange)
: SpellcheckingStrategy.getDefaultBatchFixes();
final ProblemDescriptor problemDescriptor = createProblemDescriptor(element, offset, textRange, holder, fixes, false);
SpellCheckerQuickFix[] fixes = SpellcheckingStrategy.getDefaultBatchFixes();
ProblemDescriptor problemDescriptor = createProblemDescriptor(element, offset, textRange, holder, fixes, false);
holder.registerProblem(problemDescriptor);
}
@@ -221,7 +215,6 @@ public class SpellCheckingInspection extends LocalInspectionTool {
final JPanel panel = new JPanel(new BorderLayout());
panel.add(verticalBox, BorderLayout.NORTH);
return panel;
}
private static class MyTokenConsumer extends TokenConsumer implements Consumer<TextRange> {
@@ -77,10 +77,6 @@ public class SpellcheckingStrategy {
};
}
public SpellCheckerQuickFix[] getBatchFixes(PsiElement element, int offset, @NotNull TextRange textRange) {
return getDefaultBatchFixes();
}
public static SpellCheckerQuickFix[] getDefaultBatchFixes() {
return BATCH_FIXES;
}