| Summary: | [api] Inconsistency in AnnotationPainter API : addAnnotationType vs addHighlightAnnotationType | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] Platform | Reporter: | Alan Mising name <adman1108> | ||||
| Component: | Text | Assignee: | Platform-Text-Inbox <platform-text-inbox> | ||||
| Status: | RESOLVED FIXED | QA Contact: | |||||
| Severity: | normal | ||||||
| Priority: | P3 | CC: | daniel_megert | ||||
| Version: | 3.0 | Keywords: | needinfo | ||||
| Target Milestone: | 3.7 M2 | ||||||
| Hardware: | All | ||||||
| OS: | All | ||||||
| Whiteboard: | |||||||
| Attachments: |
|
||||||
|
Description
Alan Mising name
Mmh, I don't think it's true that your snippet simply works without attaching the listener yourself. Can you please attach a sample plug-in that shows this. Created attachment 176157 [details]
Plugin showing condition
Plugin with a view (TestAnnotationPainter) that shows highlighting with squigglies is effective without the AnnotationPainter being made a TextPresentationListener
The attached plugin has a view with a SourceViewer. It opens with text containing an annotation, highlighted with squigglies. The AnnotationPainter is defined in SampleView#createSourceViewer2. However, the AnnotationPainter is not made a TestPresentationListener to the SourceViewer. OK, I see now. The API is from the old days where we did custom squiggle drawing. This got replaced by a new mechanism that lets the widget do the drawing itself. When we added that new mechanism we also added to feature that clients can quickly turn this on and off by delegating the listener addition/removal to them.
I've deprecated the old method and added a comment that the listener must be added to the corresponding methods.
You should change your code to
1. register your own text style strategy (use new
AnnotationPainter.UnderlineStrategy(SWT.UNDERLINE_SQUIGGLE)
2. add your type with the id that you used in step 1
3. add the text presentation listener
|