本文整理汇总了Java中com.swabunga.spell.event.SpellCheckEvent类的典型用法代码示例。如果您正苦于以下问题:Java SpellCheckEvent类的具体用法?Java SpellCheckEvent怎么用?Java SpellCheckEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SpellCheckEvent类属于com.swabunga.spell.event包,在下文中一共展示了SpellCheckEvent类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: spellingError
import com.swabunga.spell.event.SpellCheckEvent; //导入依赖的package包/类
public void spellingError(SpellCheckEvent event) {
String invalidWord = event.getInvalidWord();
List suggestionsList = event.getSuggestions();
//System.out.println("Invalid Word: " + event.getInvalidWord());
if (mSuggestions.containsKey(invalidWord)) // if we already recorded this misspell previously, exit
return;
mMisspelledWords.add(event.getInvalidWord());
ArrayList suggestionsForWord = new ArrayList<String>();
for (Iterator suggestedWord = suggestionsList.iterator(); suggestedWord.hasNext();) {
Word currentSuggestion = (Word) suggestedWord.next();
suggestionsForWord.add(currentSuggestion.getWord());
//System.out.println("\tSuggested Word: " + currentSuggestion);
}
mSuggestions.put(invalidWord, suggestionsForWord);
}
开发者ID:scheah,项目名称:eulexia,代码行数:17,代码来源:SpellCheck.java
示例2: spellingError
import com.swabunga.spell.event.SpellCheckEvent; //导入依赖的package包/类
/**
* @param event Description of the Parameter
*/
public void spellingError(SpellCheckEvent event) {
// java.util.List suggestions = event.getSuggestions();
event.getSuggestions();
int start = event.getWordContextPosition();
int end = start + event.getInvalidWord().length();
// Mark the invalid word in TextComponent
// added by Saruta
CaretListener cl[] = textComp.getCaretListeners();
for (int i = 0; i < cl.length; i++)
textComp.removeCaretListener(cl[i]);
textComp.requestFocus();
textComp.setCaretPosition(0);
textComp.setCaretPosition(start);
textComp.moveCaretPosition(end);
for (int i = 0; i < cl.length; i++)
textComp.addCaretListener(cl[i]);
try {
Rectangle r = textComp.modelToView(start);
r.add(textComp.modelToView(end));
textComp.scrollRectToVisible(r);
}
catch (Exception ex) {}
dlg.show(event);
}
开发者ID:SarutaSan72,项目名称:Yass,代码行数:33,代码来源:JTextComponentSpellChecker.java
示例3: spellingError
import com.swabunga.spell.event.SpellCheckEvent; //导入依赖的package包/类
public void spellingError(SpellCheckEvent event) {
@SuppressWarnings("unchecked")
List<Word> suggestions = (List<Word>) event.getSuggestions();
if (suggestions.size() > 0) {
Iterator<Word> suggestedWord = suggestions.iterator();
if (suggestedWord.hasNext()) {
String orig = event.getInvalidWord();
String sugg = suggestedWord.next().getWord();
if (_correctionType == SpellCorrectionType.Add)
event.replaceWord(sugg + " ( " + orig + " ) ", false);
else if (_correctionType == SpellCorrectionType.Replace)
event.replaceWord(sugg, false);
}
}
}
开发者ID:jatecs,项目名称:jatecs,代码行数:16,代码来源:SpellCheck.java
示例4: check
import com.swabunga.spell.event.SpellCheckEvent; //导入依赖的package包/类
public void check(IDocument document, IRegion[] regions, SpellingContext context,
ISpellingProblemCollector collector, IProgressMonitor monitor) {
if (ignore == null) {
ignore = new HashSet<String>();
}
IProject project = getProject(document);
String lang = DEFAULT_LANG;
if (project != null) {
lang = TexlipseProperties.getProjectProperty(project, TexlipseProperties.LANGUAGE_PROPERTY);
}
//Get spellchecker for the correct language
SpellChecker spellCheck = getSpellChecker(lang);
if (spellCheck == null) return;
if (collector instanceof TeXSpellingProblemCollector) {
((TeXSpellingProblemCollector) collector).setRegions(regions);
}
try {
spellCheck.addSpellCheckListener(this);
for (final IRegion r : regions) {
errors = new LinkedList<SpellCheckEvent>();
int roffset = r.getOffset();
//Create a new wordfinder and initialize it
TexlipseWordFinder wf = new TexlipseWordFinder();
wf.setIgnoreComments(TexlipsePlugin.getDefault().getPreferenceStore().getBoolean(TexlipseProperties.SPELLCHECKER_IGNORE_COMMENTS));
wf.setIgnoreMath(TexlipsePlugin.getDefault().getPreferenceStore().getBoolean(TexlipseProperties.SPELLCHECKER_IGNORE_MATH));
spellCheck.checkSpelling(new StringWordTokenizer(
document.get(roffset, r.getLength()), wf));
for (SpellCheckEvent error : errors) {
SpellingProblem p = new TexSpellingProblem(error, roffset, lang);
collector.accept(p);
}
}
spellCheck.removeSpellCheckListener(this);
} catch (BadLocationException e) {
e.printStackTrace();
}
}
开发者ID:eclipse,项目名称:texlipse,代码行数:46,代码来源:TexSpellingEngine.java
示例5: spellingError
import com.swabunga.spell.event.SpellCheckEvent; //导入依赖的package包/类
public void spellingError(SpellCheckEvent event) {
String invWord = event.getInvalidWord();
if (invWord.length() < 3) return;
if (invWord.indexOf('_') > -1) return;
if (invWord.indexOf('^') > -1) return;
if (ignore.contains(invWord)) return;
if (TexlipsePlugin.getDefault().getPreferenceStore().getBoolean(TexlipseProperties.SPELLCHECKER_IGNORE_MIXED_CASE)) {
if (isMixedCase(invWord)) return;
}
errors.add(event);
}
开发者ID:eclipse,项目名称:texlipse,代码行数:13,代码来源:TexSpellingEngine.java
示例6: SpellCheckError
import com.swabunga.spell.event.SpellCheckEvent; //导入依赖的package包/类
public SpellCheckError(SpellCheckEvent event, SpellChecker spellChecker) {
this.error = event.getInvalidWord();
this.position = event.getWordContextPosition();
// List<String> suggestions = event.getSuggestions();
List<Word> suggestions = spellChecker.getSuggestions(error, 1);
if (suggestions != null && suggestions.size() > 0) {
String firstSuggestion = suggestions.get(0).getWord();
if (!firstSuggestion.equals(this.error)) {
this.suggestion = firstSuggestion;
}
}
}
开发者ID:rquinio,项目名称:l10n-maven-plugin,代码行数:15,代码来源:SpellCheckError.java
示例7: spellingError
import com.swabunga.spell.event.SpellCheckEvent; //导入依赖的package包/类
@Override
public void spellingError(SpellCheckEvent event) {
event.ignoreWord(true);
misspelledWords.add(event.getInvalidWord());
}
开发者ID:ikhamlic,项目名称:esct-messenger-bot,代码行数:6,代码来源:JazzySpellChecker.java
示例8: AddToDictProposal
import com.swabunga.spell.event.SpellCheckEvent; //导入依赖的package包/类
public AddToDictProposal(SpellCheckEvent error, String lang,
ISourceViewer viewer) {
ferror = error;
fLang = lang;
fviewer = viewer;
}
开发者ID:eclipse,项目名称:texlipse,代码行数:7,代码来源:AddToDictProposal.java
示例9: TexSpellingProblem
import com.swabunga.spell.event.SpellCheckEvent; //导入依赖的package包/类
public TexSpellingProblem(SpellCheckEvent error, int roffset, String lang) {
this.fError = error;
this.fOffset = roffset + fError.getWordContextPosition();
fLang = lang;
}
开发者ID:eclipse,项目名称:texlipse,代码行数:6,代码来源:TexSpellingEngine.java
示例10: spellingError
import com.swabunga.spell.event.SpellCheckEvent; //导入依赖的package包/类
public void spellingError(SpellCheckEvent event) {
spellCheckErrors.add(new SpellCheckError(event, spellChecker));
}
开发者ID:rquinio,项目名称:l10n-maven-plugin,代码行数:4,代码来源:SpellCheckValidator.java
示例11: iterator
import com.swabunga.spell.event.SpellCheckEvent; //导入依赖的package包/类
@Override
public Iterator<SpellCheckEvent> iterator() {
return ImmutableList.copyOf(errors).iterator();
}
开发者ID:killjoy1221,项目名称:TabbyChat-2,代码行数:5,代码来源:Spellcheck.java
注:本文中的com.swabunga.spell.event.SpellCheckEvent类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论