use of org.eclipse.jface.text.source.OverviewRuler in project hale by halestudio.
the class SimpleAnnotationUtil method createDefaultOverviewRuler.
/**
* Create a default overview ruler configured for displaying
* {@link SimpleAnnotations}.
*
* @param width the ruler width
* @param colorManager the color manager
* @param annotationModel the annotation model
* @return the overview ruler
*/
public static IOverviewRuler createDefaultOverviewRuler(int width, ISharedTextColors colorManager, IAnnotationModel annotationModel) {
IOverviewRuler ruler = new OverviewRuler(new SimpleAnnotations(), width, colorManager);
// type configuration
// error (including header)
ruler.addAnnotationType(SimpleAnnotations.TYPE_ERROR);
ruler.addHeaderAnnotationType(SimpleAnnotations.TYPE_ERROR);
ruler.setAnnotationTypeColor(SimpleAnnotations.TYPE_ERROR, colorManager.getColor(new RGB(255, 0, 0)));
ruler.setAnnotationTypeLayer(SimpleAnnotations.TYPE_ERROR, IAnnotationAccessExtension.DEFAULT_LAYER);
// warning
ruler.addAnnotationType(SimpleAnnotations.TYPE_WARN);
ruler.setAnnotationTypeColor(SimpleAnnotations.TYPE_WARN, colorManager.getColor(new RGB(255, 255, 0)));
ruler.setAnnotationTypeLayer(SimpleAnnotations.TYPE_WARN, IAnnotationAccessExtension.DEFAULT_LAYER);
// information
ruler.addAnnotationType(SimpleAnnotations.TYPE_INFO);
ruler.setAnnotationTypeColor(SimpleAnnotations.TYPE_INFO, colorManager.getColor(new RGB(0, 0, 255)));
ruler.setAnnotationTypeLayer(SimpleAnnotations.TYPE_INFO, IAnnotationAccessExtension.DEFAULT_LAYER);
ruler.setModel(annotationModel);
return ruler;
}
use of org.eclipse.jface.text.source.OverviewRuler 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);
@SuppressWarnings("unchecked") 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.OverviewRuler in project tmdm-studio-se by Talend.
the class ElementFKInfoFormatHelper method createOverviewRuler.
public static IOverviewRuler createOverviewRuler() {
IOverviewRuler ruler = new OverviewRuler(getAnnotationAccess(), VERTICAL_RULER_WIDTH, getSharedColors());
Iterator<?> e = getAnnotationPreferences().getAnnotationPreferences().iterator();
while (e.hasNext()) {
AnnotationPreference preference = (AnnotationPreference) e.next();
if (preference.contributesToHeader()) {
ruler.addHeaderAnnotationType(preference.getAnnotationType());
}
}
return ruler;
}
use of org.eclipse.jface.text.source.OverviewRuler in project tmdm-studio-se by Talend.
the class XMLSourceViewerHelper method createOverviewRuler.
public IOverviewRuler createOverviewRuler() {
IOverviewRuler ruler = new OverviewRuler(getAnnotationAccess(), VERTICAL_RULER_WIDTH, getSharedColors());
Iterator e = getAnnotationPreferences().getAnnotationPreferences().iterator();
while (e.hasNext()) {
AnnotationPreference preference = (AnnotationPreference) e.next();
if (preference.contributesToHeader()) {
ruler.addHeaderAnnotationType(preference.getAnnotationType());
}
}
return ruler;
}
use of org.eclipse.jface.text.source.OverviewRuler in project tdi-studio-se by Talend.
the class TalendJavaSourceViewer method initializeViewer.
private static ReconcilerViewer initializeViewer(Composite composite, int styles, boolean checkCode, IDocument document, int visibleOffset) {
IAnnotationAccess annotationAccess = new DefaultMarkerAnnotationAccess();
ISharedTextColors sharedColors = JavaPlugin.getDefault().getJavaTextTools().getColorManager();
IOverviewRuler overviewRuler = null;
IVerticalRuler verticalRuler = null;
if (checkCode) {
overviewRuler = new OverviewRuler(annotationAccess, 12, sharedColors);
Iterator e = EditorsPlugin.getDefault().getMarkerAnnotationPreferences().getAnnotationPreferences().iterator();
while (e.hasNext()) {
AnnotationPreference preference = (AnnotationPreference) e.next();
if (preference.contributesToHeader()) {
overviewRuler.addHeaderAnnotationType(preference.getAnnotationType());
}
}
}
verticalRuler = new CompositeRuler(12);
ReconcilerViewer viewer = new TalendJavaSourceViewer(composite, verticalRuler, overviewRuler, checkCode, styles, annotationAccess, sharedColors, checkCode, document);
if (visibleOffset != -1) {
viewer.setVisibleRegion(visibleOffset, 0);
}
return viewer;
}
Aggregations