org.eclipse.ui.texteditor.spelling.ISpellingProblemCollector Java Examples
The following examples show how to use
org.eclipse.ui.texteditor.spelling.ISpellingProblemCollector.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MultiRegionSpellingReconcileStrategy.java From APICloud-Studio with GNU General Public License v3.0 | 6 votes |
@Override public void reconcile(IRegion region) { if (getAnnotationModel() == null) { return; } try { currentRegion = region; if (region instanceof ITypedRegion && !contentTypes.contains(((ITypedRegion) region).getType())) { ISpellingProblemCollector collector = createSpellingProblemCollector(); collector.beginCollecting(); collector.endCollecting(); } else { super.reconcile(region); } } finally { currentRegion = null; } }
Example #2
Source File: DefaultSpellingEngine.java From xds-ide with Eclipse Public License 1.0 | 5 votes |
@Override public void check(IDocument document, IRegion[] regions, SpellingContext context, ISpellingProblemCollector collector, IProgressMonitor monitor) { ISpellingEngine engine = getEngine(context.getContentType()); if (engine == null){ engine = getEngine(TEXT_CONTENT_TYPE); } if (engine != null){ engine.check(document, regions, context, collector, monitor); } }
Example #3
Source File: TextSpellingEngine.java From xds-ide with Eclipse Public License 1.0 | 5 votes |
@Override protected void check(IDocument document, IRegion[] regions, ISpellChecker checker, ISpellingProblemCollector collector, IProgressMonitor monitor) { SpellEventListener listener= new SpellEventListener(collector, document); for (int i= 0; i < regions.length; i++) { if (monitor != null && monitor.isCanceled()) return; if (listener.isProblemsThresholdReached()) return; checker.execute(listener, new SpellCheckIterator(document, regions[i], checker.getLocale())); } }
Example #4
Source File: SpellingEngine.java From xds-ide with Eclipse Public License 1.0 | 5 votes |
public void check(IDocument document, IRegion[] regions, SpellingContext context, ISpellingProblemCollector collector, IProgressMonitor monitor) { if (collector != null) { final ISpellCheckEngine spellingEngine= SpellCheckEngine.getInstance(); ISpellChecker checker= spellingEngine.getSpellChecker(); if (checker != null) check(document, regions, checker, collector, monitor); } }
Example #5
Source File: GWTSpellingEngine.java From gwt-eclipse-plugin with Eclipse Public License 1.0 | 5 votes |
@Override protected void check(IDocument document, IRegion[] regions, ISpellChecker checker, ISpellingProblemCollector collector, IProgressMonitor monitor) { try { List<IRegion> regionList = new ArrayList<IRegion>(); for (int i = 0; i < regions.length; i++) { IRegion region = regions[i]; // Compute the GWT partitioning so we can identify JSNI blocks ITypedRegion[] partitions = TextUtilities.computePartitioning( document, GWTPartitions.GWT_PARTITIONING, region.getOffset(), region.getLength(), false); // Spelling engine should ignore all JSNI block regions for (int j = 0; j < partitions.length; j++) { ITypedRegion partition = partitions[j]; if (!GWTPartitions.JSNI_METHOD.equals(partition.getType())) { regionList.add(partition); } } } super.check(document, regionList.toArray(new IRegion[regionList.size()]), checker, collector, monitor); } catch (BadLocationException e) { // Ignore: the document has been changed in another thread and will be // checked again (our super class JavaSpellingEngine does the same). } }
Example #6
Source File: GWTSpellingEngine.java From gwt-eclipse-plugin with Eclipse Public License 1.0 | 5 votes |
@Override public void check(IDocument document, IRegion[] regions, SpellingContext context, ISpellingProblemCollector collector, IProgressMonitor monitor) { if (JavaCore.JAVA_SOURCE_CONTENT_TYPE.equals(context.getContentType().getId())) { gwtEngine.check(document, regions, context, collector, monitor); } else { super.check(document, regions, context, collector, monitor); } }
Example #7
Source File: MultiRegionSpellingReconcileStrategy.java From APICloud-Studio with GNU General Public License v3.0 | 5 votes |
@Override protected ISpellingProblemCollector createSpellingProblemCollector() { IAnnotationModel model = getAnnotationModel(); if (model == null) { return null; } return new SpellingProblemCollector(model); }
Example #8
Source File: DefaultSpellingEngine.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
public void check(IDocument document, IRegion[] regions, SpellingContext context, ISpellingProblemCollector collector, IProgressMonitor monitor) { ISpellingEngine engine= getEngine(context.getContentType()); if (engine == null) engine= getEngine(TEXT_CONTENT_TYPE); if (engine != null) engine.check(document, regions, context, collector, monitor); }
Example #9
Source File: TextSpellingEngine.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
@Override protected void check(IDocument document, IRegion[] regions, ISpellChecker checker, ISpellingProblemCollector collector, IProgressMonitor monitor) { SpellEventListener listener= new SpellEventListener(collector, document); for (int i= 0; i < regions.length; i++) { if (monitor != null && monitor.isCanceled()) return; if (listener.isProblemsThresholdReached()) return; checker.execute(listener, new SpellCheckIterator(document, regions[i], checker.getLocale())); } }
Example #10
Source File: SpellingEngine.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
public void check(IDocument document, IRegion[] regions, SpellingContext context, ISpellingProblemCollector collector, IProgressMonitor monitor) { if (collector != null) { final ISpellCheckEngine spellingEngine= SpellCheckEngine.getInstance(); ISpellChecker checker= spellingEngine.getSpellChecker(); if (checker != null) check(document, regions, checker, collector, monitor); } }
Example #11
Source File: TexSpellingEngine.java From texlipse with Eclipse Public License 1.0 | 4 votes |
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(); } }
Example #12
Source File: JavaSpellingReconcileStrategy.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
@Override protected ISpellingProblemCollector createSpellingProblemCollector() { return new SpellingProblemCollector(); }
Example #13
Source File: SpellingEngine.java From xds-ide with Eclipse Public License 1.0 | 2 votes |
/** * Initialize with the given spelling problem collector. * * @param collector the spelling problem collector * @param document the document */ public SpellEventListener(ISpellingProblemCollector collector, IDocument document) { fCollector= collector; fDocument= document; fProblemsThreshold= 100; }
Example #14
Source File: SpellingEngine.java From xds-ide with Eclipse Public License 1.0 | 2 votes |
/** * Spell checks the given document regions with the given arguments. * * @param document the document * @param regions the regions * @param checker the spell checker * @param collector the spelling problem collector * @param monitor the progress monitor, can be <code>null</code> */ protected abstract void check(IDocument document, IRegion[] regions, ISpellChecker checker, ISpellingProblemCollector collector, IProgressMonitor monitor);
Example #15
Source File: SpellingEngine.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 2 votes |
/** * Initialize with the given spelling problem collector. * * @param collector the spelling problem collector * @param document the document */ public SpellEventListener(ISpellingProblemCollector collector, IDocument document) { fCollector= collector; fDocument= document; fProblemsThreshold= PreferenceConstants.getPreferenceStore().getInt(PreferenceConstants.SPELLING_PROBLEMS_THRESHOLD); }
Example #16
Source File: SpellingEngine.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 2 votes |
/** * Spell checks the given document regions with the given arguments. * * @param document the document * @param regions the regions * @param checker the spell checker * @param collector the spelling problem collector * @param monitor the progress monitor, can be <code>null</code> */ protected abstract void check(IDocument document, IRegion[] regions, ISpellChecker checker, ISpellingProblemCollector collector, IProgressMonitor monitor);