How to use SpellingService [message #723144] |
Wed, 07 September 2011 15:56  |
Eclipse User |
|
|
|
Hello,
how can i use the ui.texteditor SpellingService in a SourceViewer? If i write a wrong word nothing is underlined. What's missing?
My try:
SourceViewer viewer =new SourceViewer(currentVersionTextsComposite,null,SWT.BORDER | SWT.WRAP | SWT.MULTI | SWT.V_SCROLL );
IPreferenceStore iPreferenceStore = new PreferenceStore();
iPreferenceStore.setValue(SpellingService.PREFERENCE_SPELLING_ENABLED, true);
TextSourceViewerConfiguration configuration = new TextSourceViewerConfiguration(iPreferenceStore);
viewer.configure(configuration);
|
|
|
|
|
|
Re: How to use SpellingService [message #726146 is a reply to message #724954] |
Fri, 16 September 2011 12:40   |
Eclipse User |
|
|
|
no i have jdt installed
here my new version with underlined words =), but now i miss the quick assistant =(. and how can i choose a dictanory?
private void createSourceViewer(Composite parent) {
final IAnnotationAccess access = new DefaultMarkerAnnotationAccess();
final SourceViewer sourceViewer = new SourceViewer(parent, null,
null, true, SWT.MULTI | SWT.V_SCROLL | SWT.WRAP);
Document document = new Document("dfg");
SourceViewerConfiguration config = new TextSourceViewerConfiguration(
EditorsUI.getPreferenceStore());
sourceViewer.configure(config);
sourceViewer.setDocument(document, new AnnotationModel());
SourceViewerDecorationSupport decorationSupport = new SourceViewerDecorationSupport(
sourceViewer, null, access, EditorsPlugin.getDefault()
.getSharedTextColors());
configureSourceViewerDecorationSupport(decorationSupport);
if (sourceViewer instanceof ISourceViewerExtension3)
((IAnnotationAccessExtension2) access)
.setQuickAssistAssistant(((ISourceViewerExtension3) sourceViewer)
.getQuickAssistAssistant());
GridDataFactory.fillDefaults().grab(true, true)
.applyTo(sourceViewer.getTextWidget());
}
private void configureSourceViewerDecorationSupport(
SourceViewerDecorationSupport support) {
for(Object o :new MarkerAnnotationPreferences()
.getAnnotationPreferences())
support.setAnnotationPreference((AnnotationPreference)o);
support.setCursorLinePainterPreferenceKeys(
AbstractDecoratedTextEditorPreferenceConstants.EDITOR_CURRENT_LINE,
AbstractDecoratedTextEditorPreferenceConstants.EDITOR_CURRENT_LINE_COLOR);
support.install(EditorsUI.getPreferenceStore());
}
|
|
|
Re: How to use SpellingService [message #727886 is a reply to message #726146] |
Thu, 22 September 2011 02:45   |
Eclipse User |
|
|
|
On 16.09.2011 18:40, SirWayne wrote:
> no i have jdt installed
>
> here my new version with underlined words =), but now i miss the quick
> assistant =(. and how can i choose a dictanory?
Take a look at TextSourceViewerConfiguration.
Dani
>
>
> private void createSourceViewer(Composite parent) {
> final IAnnotationAccess access = new
> DefaultMarkerAnnotationAccess();
> final SourceViewer sourceViewer = new SourceViewer(parent,
> null,
> null, true, SWT.MULTI | SWT.V_SCROLL | SWT.WRAP);
> Document document = new Document("dfg");
> SourceViewerConfiguration config = new
> TextSourceViewerConfiguration(
> EditorsUI.getPreferenceStore());
> sourceViewer.configure(config);
> sourceViewer.setDocument(document, new AnnotationModel());
> SourceViewerDecorationSupport decorationSupport = new
> SourceViewerDecorationSupport(
> sourceViewer, null, access,
> EditorsPlugin.getDefault()
> .getSharedTextColors());
> configureSourceViewerDecorationSupport(decorationSupport);
> if (sourceViewer instanceof ISourceViewerExtension3)
> ((IAnnotationAccessExtension2) access)
>
> .setQuickAssistAssistant(((ISourceViewerExtension3) sourceViewer)
> .getQuickAssistAssistant());
>
> GridDataFactory.fillDefaults().grab(true, true)
> .applyTo(sourceViewer.getTextWidget());
>
> }
>
> private void configureSourceViewerDecorationSupport(
> SourceViewerDecorationSupport support) {
>
> for(Object o :new MarkerAnnotationPreferences()
> .getAnnotationPreferences())
> support.setAnnotationPreference((AnnotationPreference)o);
>
> support.setCursorLinePainterPreferenceKeys(
>
> AbstractDecoratedTextEditorPreferenceConstants.EDITOR_CURRENT_LINE,
>
> AbstractDecoratedTextEditorPreferenceConstants.EDITOR_CURRENT_LINE_COLOR);
> support.install(EditorsUI.getPreferenceStore());
> }
>
>
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.12259 seconds