use of org.eclipse.jface.text.source.DefaultAnnotationHover in project xtext-xtend by eclipse.
the class DerivedSourceView method createSourceViewer.
@Override
protected SourceViewer createSourceViewer(Composite parent) {
IPreferenceStore store = JavaPlugin.getDefault().getCombinedPreferenceStore();
IOverviewRuler overviewRuler = new OverviewRuler(defaultMarkerAnnotationAccess, OVERVIEW_RULER_WIDTH, getSharedTextColors());
AnnotationRulerColumn annotationRulerColumn = new AnnotationRulerColumn(VERTICAL_RULER_WIDTH, defaultMarkerAnnotationAccess);
List<AnnotationPreference> annotationPreferences = markerAnnotationPreferences.getAnnotationPreferences();
for (AnnotationPreference annotationPreference : annotationPreferences) {
String key = annotationPreference.getVerticalRulerPreferenceKey();
boolean showAnnotation = true;
if (key != null && store.contains(key)) {
showAnnotation = store.getBoolean(key);
}
if (showAnnotation) {
annotationRulerColumn.addAnnotationType(annotationPreference.getAnnotationType());
}
}
annotationRulerColumn.addAnnotationType(Annotation.TYPE_UNKNOWN);
lineNumberRulerColumn = new LineNumberRulerColumn();
CompositeRuler compositeRuler = new CompositeRuler();
compositeRuler.addDecorator(0, annotationRulerColumn);
compositeRuler.addDecorator(1, lineNumberRulerColumn);
javaSourceViewer = new JavaSourceViewer(parent, compositeRuler, overviewRuler, true, SWT.V_SCROLL | SWT.H_SCROLL, store);
javaSourceViewerConfiguration = new SimpleJavaSourceViewerConfiguration(JavaPlugin.getDefault().getJavaTextTools().getColorManager(), store, null, IJavaPartitions.JAVA_PARTITIONING, true) {
@Override
public IInformationControlCreator getInformationControlCreator(ISourceViewer sourceViewer) {
return new IInformationControlCreator() {
@Override
public IInformationControl createInformationControl(final Shell parent) {
return new DefaultInformationControl(parent, true);
}
};
}
@Override
public IAnnotationHover getAnnotationHover(ISourceViewer sourceViewer) {
return new DefaultAnnotationHover();
}
};
javaSourceViewer.configure(javaSourceViewerConfiguration);
javaSourceViewer.setEditable(false);
javaSourceViewer.showAnnotations(true);
sourceViewerDecorationSupport = new SourceViewerDecorationSupport(javaSourceViewer, overviewRuler, defaultMarkerAnnotationAccess, getSharedTextColors());
for (AnnotationPreference annotationPreference : annotationPreferences) {
sourceViewerDecorationSupport.setAnnotationPreference(annotationPreference);
}
sourceViewerDecorationSupport.install(preferenceStoreAccess.getPreferenceStore());
return javaSourceViewer;
}
use of org.eclipse.jface.text.source.DefaultAnnotationHover in project hale by halestudio.
the class SimpleAnnotationUtil method createDefaultAnnotationRuler.
/**
* Create a default annotation ruler configured for displaying
* {@link SimpleAnnotations}.
*
* @param annotationModel the annotation model
* @return the annotation ruler
*/
public static AnnotationRulerColumn createDefaultAnnotationRuler(IAnnotationModel annotationModel) {
AnnotationRulerColumn annotations = new AnnotationRulerColumn(annotationModel, 12, new SimpleAnnotations());
// error
annotations.addAnnotationType(SimpleAnnotations.TYPE_ERROR);
// warning
annotations.addAnnotationType(SimpleAnnotations.TYPE_WARN);
// information
annotations.addAnnotationType(SimpleAnnotations.TYPE_INFO);
annotations.setHover(new DefaultAnnotationHover());
return annotations;
}
Aggregations