@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())); } } }
@Override public final Set<RankedWordProposal> getProposals() { return fChecker.getProposals(fWord, fSentence); }
protected void check(IDocument document, IRegion[] regions, ISpellChecker checker, ISpellingProblemCollector collector, IProgressMonitor monitor) { SpellEventListener listener= new SpellEventListener(collector, document); try { checker.addListener(listener); for (int i= 0; i < regions.length; i++) { if (monitor != null && monitor.isCanceled()) return; if (listener.isProblemsThresholdReached()) return; checker.execute(new SpellCheckIterator(document, regions[i], checker.getLocale())); } } finally { checker.removeListener(listener); } } }
else { proposals= new ArrayList(checker.getProposals(arguments[0], sentence)); size= proposals.size(); boolean extendable= !fixed ? (checker.acceptsWords() || AddWordProposal.canAskToConfigure()) : false; result= new IJavaCompletionProposal[size + (extendable ? 3 : 2)];
@Override public synchronized final ISpellChecker getSpellChecker() throws IllegalStateException { if (fGlobalDictionaries == null) throw new IllegalStateException("spell checker has been shut down"); //$NON-NLS-1$ IPreferenceStore store= JavaPlugin.getDefault().getPreferenceStore(); Locale locale= getCurrentLocale(store); if (fUserDictionary == null && "".equals(locale.toString())) //$NON-NLS-1$ return null; if (fChecker != null && fChecker.getLocale().equals(locale)) return fChecker; resetSpellChecker(); fChecker= new DefaultSpellChecker(store, locale); resetUserDictionary(); for (Iterator<ISpellDictionary> iterator= fGlobalDictionaries.iterator(); iterator.hasNext();) { ISpellDictionary dictionary= iterator.next(); fChecker.addDictionary(dictionary); } ISpellDictionary dictionary= findDictionary(fChecker.getLocale()); if (dictionary != null) fChecker.addDictionary(dictionary); return fChecker; }
public final void apply(final IDocument document) { final ISpellCheckEngine engine= SpellCheckEngine.getInstance(); final ISpellChecker checker= engine.getSpellChecker(); if (checker == null) return; final ITextEditor editor= getEditor(); if (!checker.acceptsWords()) { final Shell shell; if (editor != null) shell= editor.getEditorSite().getShell(); else shell= JavaPlugin.getActiveWorkbenchShell(); if (!canAskToConfigure() || !askUserToConfigureUserDictionary(shell)) return; String[] preferencePageIds= new String[] { "org.eclipse.ui.editors.preferencePages.Spelling" }; //$NON-NLS-1$ PreferencesUtil.createPreferenceDialogOn(shell, preferencePageIds[0], preferencePageIds, null).open(); } if (checker.acceptsWords()) { checker.addWord(fWord); SpellingProblem.removeAllInActiveEditor(editor, fWord); } }
fChecker.removeDictionary(fUserDictionary); fUserDictionary.unload(); fUserDictionary= null; try { fUserDictionary= new PersistentSpellDictionary(url); fChecker.addDictionary(fUserDictionary); } finally { stream.close();
public synchronized final Locale getLocale() { if (fChecker == null) return null; return fChecker.getLocale(); }
@Override public final void apply(final IDocument document) { final ISpellCheckEngine engine= SpellCheckEngine.getInstance(); final ISpellChecker checker= engine.getSpellChecker(); if (checker != null) { checker.ignoreWord(fWord); ISourceViewer sourceViewer= fContext.getSourceViewer(); if (sourceViewer != null) SpellingProblem.removeAll(sourceViewer, fWord); } }
else { proposals= new ArrayList<>(checker.getProposals(arguments[0], sentence)); size= proposals.size(); boolean extendable= !fixed ? (checker.acceptsWords() || AddWordProposal.canAskToConfigure()) : false; result= new IJavaCompletionProposal[size + (extendable ? 3 : 2)];
@Override public synchronized final ISpellChecker getSpellChecker() throws IllegalStateException { if (fGlobalDictionaries == null) throw new IllegalStateException("spell checker has been shut down"); //$NON-NLS-1$ IPreferenceStore store= JavaPlugin.getDefault().getPreferenceStore(); Locale locale= getCurrentLocale(store); if (fUserDictionary == null && "".equals(locale.toString())) //$NON-NLS-1$ return null; if (fChecker != null && fChecker.getLocale().equals(locale)) return fChecker; resetSpellChecker(); fChecker= new DefaultSpellChecker(store, locale); resetUserDictionary(); for (Iterator<ISpellDictionary> iterator= fGlobalDictionaries.iterator(); iterator.hasNext();) { ISpellDictionary dictionary= iterator.next(); fChecker.addDictionary(dictionary); } ISpellDictionary dictionary= findDictionary(fChecker.getLocale()); if (dictionary != null) fChecker.addDictionary(dictionary); return fChecker; }
@Override public final void apply(final IDocument document) { final ISpellCheckEngine engine= SpellCheckEngine.getInstance(); final ISpellChecker checker= engine.getSpellChecker(); if (checker == null) return; if (!checker.acceptsWords()) { final Shell shell; if (fContext != null && fContext.getSourceViewer() != null) shell= fContext.getSourceViewer().getTextWidget().getShell(); else shell= JavaPlugin.getActiveWorkbenchShell(); if (!canAskToConfigure() || !askUserToConfigureUserDictionary(shell)) return; String[] preferencePageIds= new String[] { "org.eclipse.ui.editors.preferencePages.Spelling" }; //$NON-NLS-1$ PreferencesUtil.createPreferenceDialogOn(shell, preferencePageIds[0], preferencePageIds, null).open(); } if (checker.acceptsWords()) { checker.addWord(fWord); if (fContext != null && fContext.getSourceViewer() != null) SpellingProblem.removeAll(fContext.getSourceViewer(), fWord); } }
fChecker.removeDictionary(fUserDictionary); fUserDictionary.unload(); fUserDictionary= null; try { fUserDictionary= new PersistentSpellDictionary(url); fChecker.addDictionary(fUserDictionary); } finally { stream.close();
@Override public synchronized final Locale getLocale() { if (fChecker == null) return null; return fChecker.getLocale(); }
@Override public final void apply(final IDocument document) { final ISpellCheckEngine engine= SpellCheckEngine.getInstance(); final ISpellChecker checker= engine.getSpellChecker(); if (checker != null) { checker.ignoreWord(fWord); ISourceViewer sourceViewer= fContext.getSourceViewer(); if (sourceViewer != null) SpellingProblem.removeAll(sourceViewer, fWord); } }
@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())); } } }
else { proposals= new ArrayList<>(checker.getProposals(arguments[0], sentence)); size= proposals.size(); boolean extendable= !fixed ? (checker.acceptsWords() || AddWordProposal.canAskToConfigure()) : false; result= new IJavaCompletionProposal[size + (extendable ? 3 : 2)];
boolean isIgnoringJavaStrings= PreferenceConstants.getPreferenceStore().getBoolean(SPELLING_IGNORE_JAVA_STRINGS); try { checker.addListener(listener); try { for (int i= 0; i < regions.length; i++) { checker.execute(new SpellCheckIterator(document, partition, checker.getLocale())); checker.removeListener(listener);
public final synchronized ISpellChecker getSpellChecker() throws IllegalStateException { if (fGlobalDictionaries == null) throw new IllegalStateException("spell checker has been shut down"); //$NON-NLS-1$ IPreferenceStore store= JavaPlugin.getDefault().getPreferenceStore(); Locale locale= getCurrentLocale(store); if (fUserDictionary == null && "".equals(locale.toString())) //$NON-NLS-1$ return null; if (fChecker != null && fChecker.getLocale().equals(locale)) return fChecker; resetSpellChecker(); fChecker= new DefaultSpellChecker(store, locale); resetUserDictionary(); for (Iterator iterator= fGlobalDictionaries.iterator(); iterator.hasNext();) { ISpellDictionary dictionary= (ISpellDictionary)iterator.next(); fChecker.addDictionary(dictionary); } ISpellDictionary dictionary= findDictionary(fChecker.getLocale()); if (dictionary != null) fChecker.addDictionary(dictionary); return fChecker; }
@Override public final void apply(final IDocument document) { final ISpellCheckEngine engine= SpellCheckEngine.getInstance(); final ISpellChecker checker= engine.getSpellChecker(); if (checker == null) return; if (!checker.acceptsWords()) { final Shell shell; if (fContext != null && fContext.getSourceViewer() != null) shell= fContext.getSourceViewer().getTextWidget().getShell(); else shell= JavaPlugin.getActiveWorkbenchShell(); if (!canAskToConfigure() || !askUserToConfigureUserDictionary(shell)) return; String[] preferencePageIds= new String[] { "org.eclipse.ui.editors.preferencePages.Spelling" }; //$NON-NLS-1$ PreferencesUtil.createPreferenceDialogOn(shell, preferencePageIds[0], preferencePageIds, null).open(); } if (checker.acceptsWords()) { checker.addWord(fWord); if (fContext != null && fContext.getSourceViewer() != null) SpellingProblem.removeAll(fContext.getSourceViewer(), fWord); } }