public final void apply(final IDocument document) { final ISpellCheckEngine engine= SpellCheckEngine.getInstance(); final ISpellChecker checker= engine.getSpellChecker(); if (checker != null) { checker.ignoreWord(fWord); SpellingProblem.removeAllInActiveEditor(getEditor(), fWord); } }
protected void handlePreferenceStoreChanged(PropertyChangeEvent event) { if (event.getProperty().equals(SpellingService.PREFERENCE_SPELLING_ENABLED)) { ISourceViewer viewer= getSourceViewer(); if (!(viewer instanceof ISourceViewerExtension2)) return; // cannot unconfigure - do nothing // XXX: this is pretty heavy-weight ((ISourceViewerExtension2)viewer).unconfigure(); viewer.configure(getSourceViewerConfiguration()); if (Boolean.FALSE.equals(event.getNewValue())) SpellingProblem.removeAllInActiveEditor(this, null); IAction quickAssistAction= getAction(ITextEditorActionConstants.QUICK_ASSIST); if (quickAssistAction instanceof IUpdate) ((IUpdate)quickAssistAction).update(); return; } super.handlePreferenceStoreChanged(event); }
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); } }