I am creating an eclipse plug-in that verifies XML and XSL code by applying some specific rules, and which generates some custom error markers (ex: Error, Warning, Info) in a custom view (called PCC Markers).
I create my markers like this :
marker = resource.createMarker("pccplug.myMarker");
marker.setAttribute(IMarker.MESSAGE, message);
marker.setAttribute(IMarker.LINE_NUMBER, line);
marker.setAttribute(IMarker.SEVERITY, IMarker.SEVERITY_ERROR);
Here is my plugin.xml :
<extension point="org.eclipse.ui.ide.markerSupport">
<markerField class="pccplug.views.Recommendations" id="champRecommendations"
name="Recommendatio开发者_Python百科ns" />
<markerContentGenerator id="pccplug.views.myCustomMarkerGenerator"
name="My Marker Generator">
<markerTypeReference id="pccplug.coolMarker" />
<markerFieldReference id="org.eclipse.ui.ide.severityAndDescriptionField"/>
<markerFieldReference id="org.eclipse.ui.ide.resourceField" />
<markerFieldReference id="org.eclipse.ui.ide.pathField" />
<markerFieldReference id="org.eclipse.ui.ide.locationField" />
<markerFieldReference id="org.eclipse.ui.ide.markerType" />
<markerFieldReference id="org.eclipse.ui.ide.priorityField" />
<markerFieldReference id="champRecommendations" />
</markerContentGenerator>
</extension>
My problem is that all the errors are not grouped, they are all one after the other : My current output
And I would like to have them grouped by categories (ex: SEVERITY or PRIORITY), as it is already the case in the Problems View : My desired output
How can I create these groups of markers (I tried almost every MarkerField,Type,Group, but I couldn't do it) ?
Does anyone has any idea on how to do that ?
Your current output and desired output are the same, so I guess you have achieved what you need already ;-)
You have to specify defaultMarkerGrouping in your markerContentGenerator. As in:
<extension point="org.eclipse.ui.ide.markerSupport">
<markerContentGenerator id="pccplug.views.myCustomMarkerGenerator"
defaultMarkerGrouping="org.eclipse.ui.ide.severity"
name="My Marker Generator">
... others here ...
</markerContentGenerator>
</extension>
精彩评论