So I am working with Eclipse, and am trying to enable Java error highlighting inside of a standalone SourceViewer. I have done quite a bit of searching the web, but nothing seems to come up. I have looked into dealing with Annotations, Markers, etc… Everything that comes up seems to be for implementing custom methods.
http://wiki.eclipse.org/Platform_Text
has helped a bit, but seems to be not exactly what I want.
The SourceViewer is going to be a basic Java editor, so it can be assumed that everything will be java code. I would just like the red squiggly lines to appear under syntax errors, maybe also have the red boxes on a ruler on the side. There should be a default easy way to enable this, but I cannot find it.
Thanks in advance!
It is doable, but it can be a bit of work. What makes it difficult is that a standalone
SourceViewerwidget doesn’t support theIDocumentProviderinterface that does a lot of the work so you have to do all of that yourself.I found this post helpful as far as adding the red squiggly lines is concerned:
http://www.eclipsezone.com/eclipse/forums/t30082.html
For the squiggly lines you want to set up an
AnnotationPainter.If you want the red boxes on a ruler, use the SourceViewer constructor that accepts an
IOverviewRuler. There’s a standard OverviewRuler that should work for you.