如何从现有的Eclipse视图中更改文件/文件夹资源图标 [英] How to change file/folder resource icons from existing eclipse views
问题描述
我想通过更改自定义插件资源的默认文件/文件夹图标来更改Eclipse中项目浏览器视图的外观.我知道装饰器- https://eclipse.org/articles/Article-Decorators/decorators .html ,但是即使仅放置覆盖图像或底层图像,我如何也可以更改现有图标本身?
I want to change the appearance of project explorer view in eclipse by changing the default file/folder icons for my custom plugin resources. I am aware of Decorators - https://eclipse.org/articles/Article-Decorators/decorators.html , But how can I change the existing icons itself inspite of just putting an overlay or underlay image?
我也不想创建一个新视图,只想用我的图标重用项目浏览器.
Also I don't want to create a new view , just want to reuse the project explorer with my icons.
推荐答案
要修改现有项目资源管理器的内容,请首先添加org.eclipse.ui.navigator.viewer
扩展点.在其下添加一个ID为org.eclipse.ui.navigator.ProjectExplorer
(即标准Eclipse项目浏览器视图的ID)的viewerContentBinding
元素.
To modify existing project explorer content first add a org.eclipse.ui.navigator.viewer
extension point. Under that add a viewerContentBinding
element with the id org.eclipse.ui.navigator.ProjectExplorer
(that's the id of the standard Eclipse project explorer view).
在其中添加带有contentExtension
元素的(includes)
.该模式标识要包含并可以包含通配符(例如,通配符)的导航器内容的ID. com.example.mycontent.*
.
Under that add a (includes)
with a contentExtension
element. The pattern identifies the IDs of navigator content to include and can contain wildcards, e.g. com.example.mycontent.*
.
接下来用navigatorContent
元素定义一个org.eclipse.ui.navigator.navigatorContent
扩展点.确保您提供的ID与上述格式匹配.设置内容和标签提供者.如果内容提供者实现IPipelinedTreeContentProvider
,它将允许您修改现有内容(可能将IFolder之类的东西包装在标签提供者理解的类中).您还需要定义triggerPoints
,以标识应为其调用内容提供商的项目.
Next define a org.eclipse.ui.navigator.navigatorContent
extension point with a navigatorContent
element. Make sure the id you provide matches the above pattern. Set the content and label providers. If the content provider implements IPipelinedTreeContentProvider
it will allow you to modify existing content (possibly wrapping things like IFolder inside classes your label provider understands). You'll also need to define triggerPoints
to identify the items for which your content provider should be called.
禁止标准导航器内容可能有用/必需.您可以通过在navigatorContent
下使用策略InvokeAlwaysRegardlessOfSuppressedExt
和ID org.eclipse.ui.navigator.resourceContent
指定一个override
元素来实现.
It may be useful/necessary to suppress standard navigator content. You can do this by specifying an override
element under navigatorContent
with the policy InvokeAlwaysRegardlessOfSuppressedExt
and id org.eclipse.ui.navigator.resourceContent
.
这篇关于如何从现有的Eclipse视图中更改文件/文件夹资源图标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!