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;
}
Aggregations