Search in sources :

Example 1 with DefaultTextHover

use of org.eclipse.jface.text.DefaultTextHover in project eclipse.platform.text by eclipse.

the class AnnotationHoverDelegate method getDelegate.

private DefaultTextHover getDelegate(ISourceViewer sourceViewer) {
    if (this.delegate == null || this.viewer != sourceViewer) {
        this.delegate = new DefaultTextHover(sourceViewer) {

            @Override
            protected boolean isIncluded(Annotation annotation) {
                if (annotation instanceof MarkerAnnotation) {
                    // this is handled by MarkerAnnotationHover
                    return false;
                }
                AnnotationPreference preference = EditorsUI.getAnnotationPreferenceLookup().getAnnotationPreference(annotation);
                if (preference == null)
                    return false;
                String key = preference.getTextPreferenceKey();
                if (key != null) {
                    if (!EditorsUI.getPreferenceStore().getBoolean(key))
                        return false;
                } else {
                    key = preference.getHighlightPreferenceKey();
                    if (key == null || !EditorsUI.getPreferenceStore().getBoolean(key))
                        return false;
                }
                return true;
            }
        };
        this.viewer = sourceViewer;
    }
    return this.delegate;
}
Also used : MarkerAnnotation(org.eclipse.ui.texteditor.MarkerAnnotation) DefaultTextHover(org.eclipse.jface.text.DefaultTextHover) AnnotationPreference(org.eclipse.ui.texteditor.AnnotationPreference) MarkerAnnotation(org.eclipse.ui.texteditor.MarkerAnnotation) Annotation(org.eclipse.jface.text.source.Annotation)

Aggregations

DefaultTextHover (org.eclipse.jface.text.DefaultTextHover)1 Annotation (org.eclipse.jface.text.source.Annotation)1 AnnotationPreference (org.eclipse.ui.texteditor.AnnotationPreference)1 MarkerAnnotation (org.eclipse.ui.texteditor.MarkerAnnotation)1