Xml eclipse插件装饰器的问题
我正在调整我当前的eclipse插件以获得一些技巧,并为文件和文件夹制作了自己的装饰器。当前文件装饰器如下所示:Xml eclipse插件装饰器的问题,xml,eclipse,plugins,decorator,readonly,Xml,Eclipse,Plugins,Decorator,Readonly,我正在调整我当前的eclipse插件以获得一些技巧,并为文件和文件夹制作了自己的装饰器。当前文件装饰器如下所示: <decorator lightweight="true" id="com.tdm.eclipse.plugin.decorators.readonly" label="readOnly file decorator" icon="icons/readonly.ico" state="true" location="TOP_LEFT" adaptab
<decorator
lightweight="true"
id="com.tdm.eclipse.plugin.decorators.readonly"
label="readOnly file decorator"
icon="icons/readonly.ico"
state="true"
location="TOP_LEFT"
adaptable="true">
<description>
readOnly file decorator
</description>
<enablement>
<and>
<objectClass name="org.eclipse.core.resources.IFile"/>
<objectState name ="readOnly" value="true"/>
</and>
</enablement>
</decorator>
只读文件装饰器
当前问题:
I.)如果文件权限更改为可写,则文件装饰器不会更改,除非重新加载项目(有时会出现文件不同步错误)
二、 )我只想对特定文件使用decorator(当前所有只读文件都被修饰)。尝试使用nameFilter,但不允许在装饰器或objectState/objectName中使用
有什么线索可以帮我解决问题吗?
谢谢您必须编写一个装饰类(指定
类
属性),而不是使用图标
属性
ILightWeightLabelCorator
public void装饰(对象元素,IDecoration装饰)
方法将作为元素传递IFile
,以便您可以对其进行过滤
要处理文件只读属性更改,必须使用IResourceChangeListener
侦听资源更改
当检测到属性更改时,可以通知装饰器管理器更新:
IDecoratorManager decoratorMgr=PlatformUI.getWorkbench().getDecoratorManager();
decoratorMgr.update(“您的decorator id”);
你可以用
按扩展点中的文件扩展名进行筛选。感谢您的快速响应。已经篡改了decorator类,但认为在plugin.xml中这样做要短得多。特定文件的图标至少只能用xml吗?编辑已经太晚了,所以我不得不再次发布:另一个潜在的问题可能是文件权限更改不是在eclipse中完成的,而是通过外部脚本完成的。IResourceChangeListener会注意到吗?在刷新工作区或指定“使用本机挂钩或轮询刷新”首选项之前,Eclipse根本看不到外部更改。您可以按文件扩展名进行筛选-查看更新的应答感谢我刚才查找的信息,但似乎是“使用本机挂钩或轮询刷新”不更新装饰。也许它只适用于您建议的IResourceChangeListener