I am having a weird problem adding a custom eclipse token. The scenario is that when adding a marker, when the resource (which I need to add a marker) is open, then the marker icon is displayed. But if the resource is not open, a marker is added, but the icon is not displayed.
Here is the code snippet I am using
<extension id="HighPriority" name="High Priority problem" point="org.eclipse.core.resources.markers"> <persistent value="true"> </persistent> <super type="org.eclipse.core.resources.problemmarker"/> <super type="org.eclipse.core.resources.textmarker"/> </extension> <extension point="org.eclipse.ui.editors.annotationTypes"> <type name="XXXHighPriorityAnnotation" super="org.eclipse.ui.workbench.texteditor.warning" markerType="XXXHighPriority"/> </extension> <extension point="XXXmarkerAnnotationSpecification"> <specification annotationType="XXXHighPriorityAnnotation" icon="icons\img.gif" /> </extension>
And the code to create the marker
IMarker marker = markerNode.getTargetFile().createMarker(markerNode.getPriority().getMarkerName()); Map<String, Object> attributes = new HashMap<String,Object>(); attributes.put(IMarker.LINE_NUMBER, markerNode.getLineNumber()); attributes.put(IMarker.SEVERITY, Integer.valueOf(IMarker.SEVERITY_WARNING)); attributes.put(IMarker.MESSAGE, markerNode.getMessage()); attributes.put(IMarker.PRIORITY, Integer.valueOf(IMarker.PRIORITY_HIGH)); marker.setAttributes(attributes);
To open the editor, I use the following code
IDE.openEditor(this.getSite().getPage(), marker, OpenStrategy.activateOnOpen());
Is there anything else to do when opening the editor?
Any suggestions...???
source share