我想为标记指定自定义图标.可悲的是,我没有显示我选择的图标.
这是plugin.xml文件的相关部分(项目ID“x”):
我也尝试指定一个类(实现IMarkerImageProvider)而不是图标,但是不会调用该类的getImagePath()方法.
绝望地,你的.
-Itay
更新
VonC的解决方案非常正确,除了您不能将org.eclipse.core.resources.problemmarker指定为标记的超类型.它只在我使用org.eclipse.core.resources.textmarker作为唯一的超类型时才有用.
Tod Creasey 2009-01-21 07:32:38 EST
We have never had the push to make this API because it has some inflexibility that made it generally not consumable – it was written early on to enable the first marker views for the 3 severities we use and as a result was not used by the markerSupport as it was not API.
It is confusing that we have an internal extension point (we don’t generally do
that) but removing it would likely break someone without warning.
[由Itay编辑]
根据Vonc的指示,我最终成功地完成了这项工作.
以下是我的plugin.xml中的相关片段(假设插件名称是a.b.c)
陷阱
>标记的超类型必须设置为org.eclipse.core.resources.textmarker.任何其他值都将阻止您使用自定义图标.
>在代码中创建标记时,请确保其严重性与org.eclipse.ui.editors.annotationTypes扩展点的markerSeverity属性中指定的严重性值相匹配. 1表示警告等
>确保在build.properties文件(或插件编辑器中的“构建”选项卡)中指定了icons文件夹
>上面的声明只会指定一个自定义图标.如果要自定义其他属性(概览标尺上的指示颜色等),请按照此解决方案所基于的here中的示例进行操作.