How can I indicate syntax errors (e.g. an illegal sequence of tokens) in an eclipse editor plugin just like in the eclipse Java editor, i.e. by red wriggly underlines, a red marker on the scrollbar that you can jump to, and an explanatory message when you hover over either one?
I'm writing an eclipse editor plugin for a custom file format (specifically, the "snake file format" of the Shark3D game engine). I have implemented a scanner to get syntax highlighting, and an outline.
- For the underlines, do I simply have the scanner return an
IToken
with a "wriggly underline"TextAttribute
instead of the normal one, or is there a specific mechanism for marking syntax errors? - How do I implement the scrollbar markers? Is
IAnnotationModel
the relevant interface here? If so, where do I register the implementation so that the markers appear? - I've only found
SourceViewerConfiguration.getAnnotationHover()
, which would allow me to implement the hover behaviour, but only for the "annotation", which I suppose means the scrollbar markers - how do I implement the hover behaviour for the text itself?
I'd be happy specific advice as well as an URL of a tutorial that covers this - the eclipse help documents and examples don't seem to.
Edit:
Markers are the best solutions to this. A working example of how to use them can be found in the plugin example code in org.eclipse.ui.examples.readmetool.AddReadmeMarkerAction