1 11 12 package org.eclipse.jdt.internal.ui.text.spelling; 13 14 import org.eclipse.core.runtime.IProgressMonitor; 15 16 import org.eclipse.jface.text.IDocument; 17 import org.eclipse.jface.text.IRegion; 18 19 import org.eclipse.ui.texteditor.spelling.ISpellingProblemCollector; 20 21 import org.eclipse.jdt.internal.ui.text.spelling.engine.ISpellChecker; 22 23 28 public class TextSpellingEngine extends SpellingEngine { 29 30 33 protected void check(IDocument document, IRegion[] regions, ISpellChecker checker, ISpellingProblemCollector collector, IProgressMonitor monitor) { 34 SpellEventListener listener= new SpellEventListener(collector, document); 35 try { 36 checker.addListener(listener); 37 for (int i= 0; i < regions.length; i++) { 38 if (monitor != null && monitor.isCanceled()) 39 return; 40 if (listener.isProblemsThresholdReached()) 41 return; 42 checker.execute(new SpellCheckIterator(document, regions[i], checker.getLocale())); 43 } 44 } finally { 45 checker.removeListener(listener); 46 } 47 } 48 } 49 | Popular Tags |