Changeset 826:f686890a3177
- Timestamp:
- 08/09/08 22:14:35 (4 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
src/com/vectrace/MercurialEclipse/dialogs/CommitDialog.java
r825 r826 19 19 import org.eclipse.compare.ResourceNode; 20 20 import org.eclipse.core.resources.IResource; 21 import org.eclipse.core.runtime.Platform;22 import org.eclipse.core.runtime.content.IContentType;23 import org.eclipse.core.runtime.content.IContentTypeManager;24 21 import org.eclipse.jface.dialogs.TrayDialog; 25 22 import org.eclipse.jface.text.Document; 26 23 import org.eclipse.jface.text.IDocument; 27 import org.eclipse.jface.text.ITextListener;28 import org.eclipse.jface.text.TextEvent;29 24 import org.eclipse.jface.text.source.AnnotationModel; 30 25 import org.eclipse.jface.text.source.ISourceViewer; … … 42 37 import org.eclipse.jface.viewers.ViewerFilter; 43 38 import org.eclipse.swt.SWT; 39 import org.eclipse.swt.events.DisposeEvent; 40 import org.eclipse.swt.events.DisposeListener; 44 41 import org.eclipse.swt.events.SelectionAdapter; 45 42 import org.eclipse.swt.events.SelectionEvent; … … 56 53 import org.eclipse.swt.widgets.TableColumn; 57 54 import org.eclipse.ui.editors.text.EditorsUI; 55 import org.eclipse.ui.editors.text.TextSourceViewerConfiguration; 58 56 import org.eclipse.ui.texteditor.AnnotationPreference; 59 57 import org.eclipse.ui.texteditor.DefaultMarkerAnnotationAccess; 60 58 import org.eclipse.ui.texteditor.SourceViewerDecorationSupport; 61 59 import org.eclipse.ui.texteditor.spelling.SpellingAnnotation; 62 import org.eclipse.ui.texteditor.spelling.SpellingContext;63 import org.eclipse.ui.texteditor.spelling.SpellingService;64 60 65 61 import com.vectrace.MercurialEclipse.TableColumnSorter; … … 67 63 import com.vectrace.MercurialEclipse.model.HgRoot; 68 64 import com.vectrace.MercurialEclipse.team.IStorageMercurialRevision; 69 import com.vectrace.MercurialEclipse.ui.TextSpellingProblemCollector;70 65 import com.vectrace.MercurialEclipse.utils.CompareUtils; 71 66 … … 181 176 182 177 // set up spell-check annotations 183 184 AnnotationModel annotationModel = new AnnotationModel();185 commitTextBox.setDocument(commitTextDocument, annotationModel);186 187 178 decorationSupport = new SourceViewerDecorationSupport(commitTextBox, 188 179 null, new DefaultMarkerAnnotationAccess(), EditorsUI … … 193 184 194 185 decorationSupport.setAnnotationPreference(pref); 195 decorationSupport.install(EditorsUI.getPreferenceStore()); 196 197 ITextListener textListener = new ITextListener() { 198 199 private SpellingService spellService; 200 private SpellingContext spellContext; 201 private TextSpellingProblemCollector collector; 202 203 public void textChanged(TextEvent event) { 204 // connect to spell service if necessary 205 if (spellService == null) { 206 spellService = EditorsUI.getSpellingService(); 207 } 208 209 if (spellContext == null) { 210 spellContext = new SpellingContext(); 211 IContentType contentType = Platform.getContentTypeManager() 212 .getContentType(IContentTypeManager.CT_TEXT); 213 spellContext.setContentType(contentType); 214 } 215 216 if (collector == null) { 217 collector = new TextSpellingProblemCollector(commitTextBox); 218 } 219 220 // check and highlight errors 221 spellService.check(commitTextDocument, spellContext, collector, 222 null); 223 } 224 }; 225 commitTextBox.addTextListener(textListener); 186 decorationSupport.install(EditorsUI.getPreferenceStore()); 187 188 commitTextBox.configure(new TextSourceViewerConfiguration(EditorsUI 189 .getPreferenceStore())); 190 AnnotationModel annotationModel = new AnnotationModel(); 191 commitTextBox.setDocument(commitTextDocument, annotationModel); 192 commitTextBox.getTextWidget().addDisposeListener(new DisposeListener() { 193 194 public void widgetDisposed(DisposeEvent e) { 195 decorationSupport.uninstall(); 196 } 197 198 }); 226 199 227 200 commitFilesLabel = new Label(container, SWT.NONE);