Custom Markers not showing in Problems [message #1404282] |
Wed, 30 July 2014 17:17  |
Eclipse User |
|
|
|
Greetings,
For some reason, our custom markers stopped displaying in both in the editor gutter and the Problems view. All that has happened is that we've moved our "marker making" code into a new plugin.
This is our definition of the custom marker in the new plugin.xml
<extension
id="com.sri.sunflower.errormarker"
name="Flora Syntax Error"
point="org.eclipse.core.resources.markers">
<super
type="org.eclipse.core.resources.problemmarker">
</super>
<persistent
value="true">
</persistent>
<super
type="org.eclipse.core.resources.textmarker">
</super>
</extension>
And this is the code I use to make the markers:
public static final String FLORA_SYNTAX_ERROR_ID = "com.sri.sunflower.errormarker";
private static void createFloraErrorMarker(IResource file, int line, int startPos, int endPos,
String message) throws CoreException{
Map<String, Object> attributes = new HashMap<>();
attributes.put(IMarker.SEVERITY, IMarker.SEVERITY_ERROR);
attributes.put(IMarker.MESSAGE, message);
attributes.put(IMarker.LINE_NUMBER, line);
attributes.put(IMarker.CHAR_START, startPos);
attributes.put(IMarker.CHAR_END, endPos);
MarkerUtilities.createMarker(file, attributes, FLORA_SYNTAX_ERROR_ID);
}
If I change FLORA_SYNTAX_ERROR_ID = IMarker.PROBLEM the markers start working again. I've verified that the markers are getting created, but not displayed. My belief is that our custom marker isn't getting registered. Anyone have any thoughts on how I might fix this?
[Updated on: Wed, 30 July 2014 17:50] by Moderator
|
|
|
|
Re: Custom Markers not showing in Problems [message #1404291 is a reply to message #1404290] |
Wed, 30 July 2014 20:46  |
Eclipse User |
|
|
|
Finally fixed this. I'm glad this was documented so well. By debugging the MarkerManager, I was able to figure out all the registered Marker ID's. It turns out that:
MARKER_ID = PLUGIN_ID + '.' + EXTENSION_ID
where EXTENSION_ID is whatever ID you set on the marker declaration inside the plugin.xml.
LAME.
This make to solution for my original post to be:
// The marker ID is the PLUGIN_ID + '.' + the extension id within the plugin.xml
public static final String FLORA_SYNTAX_ERROR_ID =
SunflowerActivator.PLUGIN_ID+".flora.errormarker";
|
|
|
Powered by
FUDForum. Page generated in 0.03955 seconds