我在添加自定义eclipse标记时遇到了一个奇怪的问题。情况是这样的,当我添加标记时,如果资源(我需要添加标记的资源)已经打开,则标记图标是可见的。但是如果资源没有打开,则会添加标记,但图标不可见。
这是我正在使用的代码片段:
这是我正在使用的代码片段:
<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="X.X.X.HighPriorityAnnotation"
super="org.eclipse.ui.workbench.texteditor.warning"
markerType="X.X.X.HighPriority"/>
</extension>
<extension point="X.X.X.markerAnnotationSpecification">
<specification
annotationType="X.X.X.HighPriorityAnnotation"
icon="icons\img.gif"
/>
</extension>
创建标记的代码是:
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);
我使用以下代码打开编辑器
IDE.openEditor(this.getSite().getPage(), marker, OpenStrategy.activateOnOpen());
在打开编辑器的同时,我需要做些什么吗?
有任何建议吗?