Hi,
I have written my custom editor in eclipse and adding markers and showing annotations when any syntax error occured on save.
But how can I underline the problem text in red as in Java Editor. Can I do it via the annotation object or?
public IMarker createMarker(IResource res, int line) throws CoreException {
IMarker marker = null;
// note: you use the id that is defined in your plugin.xml
if (res != null) {
marker = res.createMarker("com.my.marker");
marker.setAttribute(IMarker.SEVERITY, IMarker.SEVERITY_ERROR);
marker.setAttribute(IMarker.CHAR_START, 0);
marker.setAttribute(IMarker.CHAR_END, 2);
marker.setAttribute(IMarker.LINE_NUMBER, 2);
marker.setAttribute(IMarker.LOCATION, "Snake file");
marker.setAttribute(IMarker.MESSAGE, "Syntax error");
Annotation annotation = new Annotation("org.eclipse.ui.workbench.texteditor.error", false, "Hello World");
getVerticalRuler().getModel().addAnnotation(annotation, new Position(0, 5));
getVerticalRuler().update();
return marker;
}