[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.platform] Re: How can I tell TextEditor to spell check only the desired content type/partition type?

AL wrote:

Daniel Megert wrote:

AL wrote:

Hi,

I have MyTextEditor extend TextEditor, and got the spelling thing working by default, stuff inherited from TextEditor. But, I want to spell check on a certain partition or content type in my document, basically the comments not the code. How would I tell TextEditor to do that? Right now it spellchecks everything in the document.


In your source viewer config use a Reconciler instead of a MonoReconciler.

Dani


Thanks.


I override TextSourceViewerConfiguration's getReconciler() to return a Reconciler as below, but that does not seem to work. No spellcheck at all. My class's getReconciler()'s implementation is basically TextSourceViewerConfiguration's implementation, except for setting the partition and content type to MyPartitionScanner.COMMENT_PARTITION for spell checking. Any tips? Thx.

Make sure the partitioning is correct (see SourceViewerConfiguration.getConfiguredDocumentPartitioning(ISourceViewer)).
And please don't cross-post. You just asked the same question again on the jdt newsgroup.


Dani


@Override public IReconciler getReconciler(ISourceViewer sourceViewer) { if (fPreferenceStore == null || !fPreferenceStore .getBoolean(SpellingService.PREFERENCE_SPELLING_ENABLED)) return null;

SpellingService spellingService = EditorsUI.getSpellingService();
if (spellingService.getActiveSpellingEngineDescriptor(fPreferenceStore) == null)
return null;


IReconcilingStrategy strategy = new SpellingReconcileStrategy(sourceViewer, spellingService);
Reconciler reconciler = new Reconciler();
reconciler.setDocumentPartitioning(
MyPartitionScanner.COMMENT_PARTITION);
reconciler.setReconcilingStrategy(strategy,
MyPartitionScanner.COMMENT_PARTITION);
reconciler.setIsIncrementalReconciler(false);
reconciler.setProgressMonitor(new NullProgressMonitor());
reconciler.setDelay(500);
return reconciler;
}