So you like our tools and want to use some of our infrastructure for your own project? Great! This document should help you get started.
Where to Get the Code
We've made the source code available through Subversion. Point your subversion client at:
While Eclipse allows you to add IMarkers
and custom Annotations
to editors, we have found that neither have been flexible enough for our needs. For instance, while you can add custom Annotation types, you can't easily add an IDrawingStrategy
for that AnnotationType. And if you do, you'll find that Annotation drawing is optimized for drawing one-line-at-a-time IDrawingStrategies, so drawing Annotations over multiple lines is difficult.
In response, we've created edu.pdx.cs.multiview.jface.annotation.AnnotationPainter to use instead of Eclipse's org.eclipse.jface.text.source.AnnotationPainter and AnnotationModel. Also, rather having your annotations extend that standard Annotation and using an IDrawingStrategy, each annotation just needs to implement our edu.pdx.cs.multiview.jface.annotation.ISelfDrawingAnnotation. Here's how you use our AnnotationPainter:
ISelfDrawingAnnotation ann = ... // your annotation
Position p = ... // the position that annotation goes at
AbstractDecoratedSourceEditor editor = ... //the editor you want to annotate
AnnotationPainter painter = new AnnotationPainter(editor);
And that's it. I recommend you call dispose() on your painter when you are done with it (such as when the editor it works over closes). There are several examples of AnnotationPainters and ISelfDrawingAnnotations in our projects.
If you have a need for abitrary SWT components as Annotations, check out edu.pdx.cs.multiview.jface.annotation.ControlAnnotation.
Making Refactoring Annotations work in Language X
A few of people have asked to how make Refactoring Annotations work in other object-oriented languages. This shouldn't be terribly difficult - you will need at least an AST and an AbstractDecoratedSourceEditor. If you have those things already, contact me directly and I would be happy to get you started - emerson-at-cs-dot-pdx-dot-edu.