Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » How to draw Annotation in SourceViewer
How to draw Annotation in SourceViewer [message #1718118] Sun, 20 December 2015 06:14
Mihael Schmidt is currently offline Mihael SchmidtFriend
Messages: 81
Registered: August 2010
Member
Hi,

I want to decorate some text in my SourceViewer with an added visual presentation (f. e. like squiggles). I tried to use Annotations.

I added the AnnotationModel

viewer.setDocument(new Document(), new AnnotationModel());

and added the AnnotationPainter:

AnnotationPainter painter = new AnnotationPainter(viewer, annotationAccess);
painter.addDrawingStrategy(Constants.ANNOTATION_VARIABLE_TYPE, new MySquigglesStrategy());
painter.addAnnotationType(Constants.ANNOTATION_VARIABLE_TYPE, Constants.ANNOTATION_VARIABLE_TYPE);
painter.setAnnotationTypeColor(Constants.ANNOTATION_VARIABLE_TYPE, viewer.getTextWidget().getForeground());


And on some action I am adding the Annotation to the AnnotationModel:

Annotation annotation = new Annotation(Constants.ANNOTATION_VARIABLE_TYPE, false, variable.getName());
sourceViewer.getAnnotationModel().addAnnotation(annotation, position);

But nothing is painted. The draw method of my drawing strategy is not called at all. How/When does the AnnotationPainter gets the info that it has something to paint. I cannot see the connection between the AnnotationModel and the AnnotationPainter.

Any idea?

Thanx in advance

Mihael
Previous Topic:How to draw Annotation in SourceViewer
Next Topic:String having new line have escape sequence character "\r\n"
Goto Forum:
  


Current Time: Thu Apr 18 05:05:40 GMT 2024

Powered by FUDForum. Page generated in 0.01725 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top