1 11 package org.eclipse.jdt.internal.ui.text.spelling; 12 13 import org.eclipse.swt.graphics.Image; 14 import org.eclipse.swt.graphics.Point; 15 16 import org.eclipse.jface.preference.IPreferenceStore; 17 18 import org.eclipse.jface.text.IDocument; 19 import org.eclipse.jface.text.contentassist.IContextInformation; 20 21 import org.eclipse.ui.texteditor.spelling.SpellingService; 22 23 import org.eclipse.ui.editors.text.EditorsUI; 24 25 import org.eclipse.jdt.ui.text.java.IInvocationContext; 26 import org.eclipse.jdt.ui.text.java.IJavaCompletionProposal; 27 28 import org.eclipse.jdt.internal.ui.JavaPluginImages; 29 import org.eclipse.jdt.internal.ui.JavaUIMessages; 30 31 32 37 public class DisableSpellCheckingProposal implements IJavaCompletionProposal { 38 39 40 private IInvocationContext fContext; 41 42 47 public DisableSpellCheckingProposal(IInvocationContext context) { 48 fContext= context; 49 } 50 51 54 public final void apply(final IDocument document) { 55 IPreferenceStore store= EditorsUI.getPreferenceStore(); 56 store.setValue(SpellingService.PREFERENCE_SPELLING_ENABLED, false); 57 } 58 59 62 public String getAdditionalProposalInfo() { 63 return JavaUIMessages.Spelling_disable_info; 64 } 65 66 69 public final IContextInformation getContextInformation() { 70 return null; 71 } 72 73 76 public String getDisplayString() { 77 return JavaUIMessages.Spelling_disable_label; 78 } 79 80 83 public Image getImage() { 84 return JavaPluginImages.get(JavaPluginImages.IMG_OBJS_NLS_NEVER_TRANSLATE); 85 } 86 89 public final int getRelevance() { 90 return Integer.MIN_VALUE + 1; 91 } 92 93 96 public final Point getSelection(final IDocument document) { 97 return new Point(fContext.getSelectionOffset(), fContext.getSelectionLength()); 98 } 99 } 100 | Popular Tags |