Search in sources :

Example 6 with IAnnotationAccess

use of org.eclipse.jface.text.source.IAnnotationAccess in project eclipse.platform.text by eclipse.

the class InlinedAnnotationDemo method createAnnotationPainter.

/**
 * Create annotation painter.
 *
 * @param viewer
 *            the viewer.
 * @return annotation painter.
 */
private static AnnotationPainter createAnnotationPainter(ISourceViewer viewer) {
    IAnnotationAccess annotationAccess = new IAnnotationAccess() {

        @Override
        public Object getType(Annotation annotation) {
            return annotation.getType();
        }

        @Override
        public boolean isMultiLine(Annotation annotation) {
            return true;
        }

        @Override
        public boolean isTemporary(Annotation annotation) {
            return true;
        }
    };
    AnnotationPainter painter = new AnnotationPainter(viewer, annotationAccess);
    ((ITextViewerExtension2) viewer).addPainter(painter);
    return painter;
}
Also used : ITextViewerExtension2(org.eclipse.jface.text.ITextViewerExtension2) IAnnotationAccess(org.eclipse.jface.text.source.IAnnotationAccess) AnnotationPainter(org.eclipse.jface.text.source.AnnotationPainter) LineContentAnnotation(org.eclipse.jface.text.source.inlined.LineContentAnnotation) Annotation(org.eclipse.jface.text.source.Annotation) AbstractInlinedAnnotation(org.eclipse.jface.text.source.inlined.AbstractInlinedAnnotation) LineHeaderAnnotation(org.eclipse.jface.text.source.inlined.LineHeaderAnnotation)

Aggregations

IAnnotationAccess (org.eclipse.jface.text.source.IAnnotationAccess)6 Iterator (java.util.Iterator)3 Annotation (org.eclipse.jface.text.source.Annotation)3 AnnotationPainter (org.eclipse.jface.text.source.AnnotationPainter)3 DefaultMarkerAnnotationAccess (org.eclipse.ui.texteditor.DefaultMarkerAnnotationAccess)3 ITextViewerExtension2 (org.eclipse.jface.text.ITextViewerExtension2)2 ISharedTextColors (org.eclipse.jface.text.source.ISharedTextColors)2 DisposeEvent (org.eclipse.swt.events.DisposeEvent)2 DisposeListener (org.eclipse.swt.events.DisposeListener)2 AnnotationPreference (org.eclipse.ui.texteditor.AnnotationPreference)2 MarkerAnnotationPreferences (org.eclipse.ui.texteditor.MarkerAnnotationPreferences)2 SourceViewerDecorationSupport (org.eclipse.ui.texteditor.SourceViewerDecorationSupport)2 ArrayList (java.util.ArrayList)1 List (java.util.List)1 ColorRegistry (org.eclipse.jface.resource.ColorRegistry)1 Document (org.eclipse.jface.text.Document)1 ITextListener (org.eclipse.jface.text.ITextListener)1 TextEvent (org.eclipse.jface.text.TextEvent)1 AnnotationModel (org.eclipse.jface.text.source.AnnotationModel)1 CompositeRuler (org.eclipse.jface.text.source.CompositeRuler)1