/** * Configures the passed text viewer. This method is called after the three * text viewers have been created for the content areas. The * <code>TextMergeViewer</code> implementation of this method will * configure the viewer with a {@link SourceViewerConfiguration}. * Subclasses may reimplement to provide a specific configuration for the * text viewer. * * @param textViewer * the text viewer to configure */ protected void configureTextViewer(TextViewer textViewer) { // to get undo for all text files, bugzilla 131895, 33665 if(textViewer instanceof ISourceViewer){ SourceViewerConfiguration configuration= new SourceViewerConfiguration(); ((ISourceViewer) textViewer).configure(configuration); } }
@Override public void propertyChange(PropertyChangeEvent event) { if (colorPreferenceKeys.contains(event.getProperty())) { if (getSourceViewer() instanceof SourceViewer) { ((SourceViewer) getSourceViewer()).unconfigure(); initializeEditor(); getSourceViewer().configure(sourceViewerConfiguration); } } } };
protected ISourceViewer getSourceViewer(Shell shell, final IXtextDocument xtextDocument, XtextSourceViewerConfiguration configuration) { XtextSourceViewer.Factory factory = get(XtextSourceViewer.Factory.class); ISourceViewer sourceViewer = factory.createSourceViewer(shell, null, null, false, 0); sourceViewer.configure(configuration); sourceViewer.setDocument(xtextDocument); return sourceViewer; }
protected ISourceViewer getSourceViewer(Shell shell, final IXtextDocument xtextDocument, XtextSourceViewerConfiguration configuration) { XtextSourceViewer.Factory factory = get(XtextSourceViewer.Factory.class); ISourceViewer sourceViewer = factory.createSourceViewer(shell, null, null, false, 0); sourceViewer.configure(configuration); sourceViewer.setDocument(xtextDocument); return sourceViewer; }
/** * Re-initialize the editor after changes have been done to the preferences. */ void reinitialize(){ if( getSourceViewer() instanceof SourceViewer){ ((SourceViewer) getSourceViewer()).unconfigure(); initializeEditor(); getSourceViewer().configure(sourceViewerConfig); } else { String msg = "Expected source viewer to be of type SourceViewer, but is wasn't. "; msg += "Might cause problems with preferences."; YEditLog.logger.warning(msg); } }
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); }
@Override protected void configureSourceViewer(ISourceViewer sourceViewer) { sourceViewer.setEditable(false); sourceViewer.configure(sourceViewerConfiguration); if (sourceViewer instanceof ITextViewerExtension6) { ITextViewerExtension6 textViewerExtension6 = (ITextViewerExtension6) sourceViewer; textViewerExtension6.setHyperlinkDetectors(null, sourceViewerConfiguration.getHyperlinkStateMask(sourceViewer)); } if (sourceViewer instanceof ITextViewerExtension2) { ITextViewerExtension2 textViewerExtension2 = (ITextViewerExtension2) sourceViewer; String[] configuredContentTypes = sourceViewerConfiguration.getConfiguredContentTypes(sourceViewer); for (String contentType : configuredContentTypes) { textViewerExtension2.removeTextHovers(contentType); } } }
@Override 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.removeAll(getSourceViewer(), null); IAction quickAssistAction= getAction(ITextEditorActionConstants.QUICK_ASSIST); if (quickAssistAction instanceof IUpdate) ((IUpdate)quickAssistAction).update(); return; } super.handlePreferenceStoreChanged(event); }
@Override public void createPartControl(Composite composite) { SourceViewer sourceViewer = (SourceViewer) createSourceViewer(composite, createVerticalRuler(), SWT.H_SCROLL | SWT.V_SCROLL | textOrientation); setSourceViewer(this, sourceViewer); getSourceViewer().configure(getXtextSourceViewerConfiguration()); getSourceViewerDecorationSupport(sourceViewer).install(getPreferenceStore()); getSelectionProvider().addSelectionChangedListener(getSelectionChangedListener()); }
protected void doSetInput(IEditorInput input) throws CoreException { ISourceViewer sourceViewer= getSourceViewer(); if (!(sourceViewer instanceof ISourceViewerExtension2)) { setPreferenceStore(createCombinedPreferenceStore(input)); internalDoSetInput(input); return; } // uninstall & unregister preference store listener getSourceViewerDecorationSupport(sourceViewer).uninstall(); ((ISourceViewerExtension2)sourceViewer).unconfigure(); setPreferenceStore(createCombinedPreferenceStore(input)); // install & register preference store listener sourceViewer.configure(getSourceViewerConfiguration()); getSourceViewerDecorationSupport(sourceViewer).install(getPreferenceStore()); internalDoSetInput(input); }
@Override protected void doSetInput(IEditorInput input) throws CoreException { ISourceViewer sourceViewer= getSourceViewer(); if (!(sourceViewer instanceof ISourceViewerExtension2)) { setPreferenceStore(createCombinedPreferenceStore(input)); internalDoSetInput(input); return; } // uninstall & unregister preference store listener getSourceViewerDecorationSupport(sourceViewer).uninstall(); ((ISourceViewerExtension2)sourceViewer).unconfigure(); setPreferenceStore(createCombinedPreferenceStore(input)); // install & register preference store listener sourceViewer.configure(getSourceViewerConfiguration()); getSourceViewerDecorationSupport(sourceViewer).install(getPreferenceStore()); internalDoSetInput(input); }
@Override protected void doSetInput(IEditorInput input) throws CoreException { ISourceViewer sourceViewer= getSourceViewer(); if (!(sourceViewer instanceof ISourceViewerExtension2)) { setPreferenceStore(createCombinedPreferenceStore(input)); internalDoSetInput(input); return; } // uninstall & unregister preference store listener getSourceViewerDecorationSupport(sourceViewer).uninstall(); ((ISourceViewerExtension2)sourceViewer).unconfigure(); setPreferenceStore(createCombinedPreferenceStore(input)); // install & register preference store listener sourceViewer.configure(getSourceViewerConfiguration()); getSourceViewerDecorationSupport(sourceViewer).install(getPreferenceStore()); internalDoSetInput(input); }
SQLSourceViewerConfiguration configuration = createSourceViewerConfiguration(); setSourceViewerConfiguration( configuration ); getSourceViewer().configure(configuration);
fSourceViewer.configure(fConfiguration);
fSourceViewer.configure(fConfiguration);
fSourceViewer.configure(fConfiguration);