Search in sources :

Example 1 with EnrichMode

use of org.eclipse.jface.text.ITextViewerExtension8.EnrichMode in project eclipse.platform.text by eclipse.

the class AbstractTextEditor method initializeSourceViewer.

/**
 * Initializes the editor's source viewer based on the given editor input.
 *
 * @param input the editor input to be used to initialize the source viewer
 */
private void initializeSourceViewer(IEditorInput input) {
    IDocumentProvider documentProvider = getDocumentProvider();
    IAnnotationModel model = documentProvider.getAnnotationModel(input);
    IDocument document = documentProvider.getDocument(input);
    if (document != null) {
        fSourceViewer.setDocument(document, model);
        fSourceViewer.setEditable(isEditable());
        fSourceViewer.showAnnotations(model != null);
    }
    if (fElementStateListener instanceof IElementStateListenerExtension) {
        boolean isStateValidated = false;
        if (documentProvider instanceof IDocumentProviderExtension)
            isStateValidated = ((IDocumentProviderExtension) documentProvider).isStateValidated(input);
        IElementStateListenerExtension extension = (IElementStateListenerExtension) fElementStateListener;
        extension.elementStateValidationChanged(input, isStateValidated);
    }
    if (fInitialCaret == null)
        fInitialCaret = fSourceViewer.getTextWidget().getCaret();
    if (fIsOverwriting)
        fSourceViewer.getTextWidget().invokeAction(ST.TOGGLE_OVERWRITE);
    handleInsertModeChanged();
    if (isTabsToSpacesConversionEnabled())
        installTabsToSpacesConverter();
    if (fSourceViewer instanceof ITextViewerExtension8) {
        IPreferenceStore store = getPreferenceStore();
        EnrichMode mode = store != null ? convertEnrichModePreference(store.getInt(PREFERENCE_HOVER_ENRICH_MODE)) : EnrichMode.AFTER_DELAY;
        ((ITextViewerExtension8) fSourceViewer).setHoverEnrichMode(mode);
    }
    if (fSourceViewer instanceof ISourceViewerExtension5)
        installCodeMiningProviders();
}
Also used : ITextViewerExtension8(org.eclipse.jface.text.ITextViewerExtension8) ISourceViewerExtension5(org.eclipse.jface.text.source.ISourceViewerExtension5) IAnnotationModel(org.eclipse.jface.text.source.IAnnotationModel) IPreferenceStore(org.eclipse.jface.preference.IPreferenceStore) EnrichMode(org.eclipse.jface.text.ITextViewerExtension8.EnrichMode) IDocument(org.eclipse.jface.text.IDocument)

Aggregations

IPreferenceStore (org.eclipse.jface.preference.IPreferenceStore)1 IDocument (org.eclipse.jface.text.IDocument)1 ITextViewerExtension8 (org.eclipse.jface.text.ITextViewerExtension8)1 EnrichMode (org.eclipse.jface.text.ITextViewerExtension8.EnrichMode)1 IAnnotationModel (org.eclipse.jface.text.source.IAnnotationModel)1 ISourceViewerExtension5 (org.eclipse.jface.text.source.ISourceViewerExtension5)1