Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Custom Markers not showing in Problems
icon5.gif  Custom Markers not showing in Problems [message #1404282] Wed, 30 July 2014 21:17 Go to next message
Jim Klo is currently offline Jim KloFriend
Messages: 33
Registered: September 2012
Member
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 21:50]

Report message to a moderator

Re: Custom Markers not showing in Problems [message #1404290 is a reply to message #1404282] Thu, 31 July 2014 00:23 Go to previous messageGo to next message
Jim Klo is currently offline Jim KloFriend
Messages: 33
Registered: September 2012
Member
To add to the confusion.

When debugging marker creation inside MarkerUtilities:

IMarker marker= resource.createMarker(markerType);


marker.isSubtype(IMarker.PROBLEM) == false

So it seems the question really is "Why is the declaration of my custom problem marker not getting read from the plugin.xml?"
Re: Custom Markers not showing in Problems [message #1404291 is a reply to message #1404290] Thu, 31 July 2014 00:46 Go to previous message
Jim Klo is currently offline Jim KloFriend
Messages: 33
Registered: September 2012
Member
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";
Previous Topic:Hide Views (not dispose)
Next Topic:RCP EOL
Goto Forum:
  


Current Time: Mon Mar 02 05:17:24 GMT 2015

Powered by FUDForum. Page generated in 0.02085 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software