'Eclipse Editor highlight syntax errors
just implemented a custom editor with syntax checker etc. The creation of markers working well on saving editor and are displayed in the problem view. But how to underline the error in the editor. What I missed?
<extension
point="org.eclipse.ui.editors.markerAnnotationSpecification">
<specification
icon = "icons/fail.gif"
annotationType="com.customeditor"
verticalRulerPreferenceKey="highlight.rulers.vertical"
textPreferenceKey="highlight.text"
colorPreferenceKey="highlight.color"
highlightPreferenceKey="highlight.background"
textPreferenceValue="true"
textStylePreferenceValue="PROBLEM_UNDERLINE"
overviewRulerPreferenceKey="highlight.rulers.overview"
presentationLayer="4"
highlightPreferenceValue="true"
label="DiffSiteB"
symbolicIcon="error"
colorPreferenceValue="255,0,0"
verticalRulerPreferenceValue="true"
overviewRulerPreferenceValue="true"
textStylePreferenceKey="highlight.text.style" >
</specification >
</extension>
public IMarker createMarker(IResource res, String location, String message, int start, int end) throws CoreException {
IMarker marker = null;
if (res != null) {
marker = res.createMarker("com.customedtior");
marker.setAttribute(IMarker.SEVERITY, IMarker.SEVERITY_ERROR);
marker.setAttribute(IMarker.CHAR_START, start);
marker.setAttribute(IMarker.CHAR_END, end);
marker.setAttribute(IMarker.LOCATION, location);
marker.setAttribute(IMarker.MESSAGE, message);
SimpleMarkerAnnotation ann = new SimpleMarkerAnnotation(marker);
ann.setType(JavaMarkerAnnotation.ERROR_ANNOTATION_TYPE);
getVerticalRuler().getModel().addAnnotation(ann, new Position(start, end));
getVerticalRuler().update();
}
return marker;
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|


