Eclipse:如何在项目资源管理器中隐藏自定义文件
我在 CDT 中有一个自定义构建器,它将很多文件添加到项目目录中。我希望从 Project Explorer 中过滤掉这些文件,但无法弄清楚如何过滤掉(文件掩码是 *.ooj)。
是否可以通过文件掩码将自定义过滤器添加到自定义视图中?或者也许还有另一种方法可以在项目资源管理器中隐藏文件?
I have a custom builder in CDT, which adds alot of files into project directory. I want those files to be filtered out from Project Explorer, but cannot figure out how (the file mask is *.ooj).
Is it possible to add a custom filter by file mask into Customize View? Or maybe there is anther way to hide files in Project Explorer?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您可以为此定义一个过滤器。打开包资源管理器中的视图菜单,然后选择“过滤器...”,您可以在此处定义隐藏文件的模式。
You can define a filter for that. Open the view menu in the Package Explorer and then choose "Filters..." Here you can define a pattern to hide files.
首先感谢@emmzett
只是想以详细的方式解释 emmzett 的答案,因为我对编辑插件文件一无所知,而且我花了 2 个小时在这上面。也许我可以用这个清晰的表达来节省你的时间。
plugins->org.eclipse.ui.navigator.resources_(your eclipse version).jar
plugin.xml
打开使用编辑器(记事本、Notepad++ 等)plugin.xml
文件point="org.eclipse.ui.navigator.navigatorContent"
并粘贴下面的代码SpecifyAnIdForYourFileType
更改为 id 的唯一名称将
“您的特定文件”
更改为您的特定文件后缀,例如*.pdf
或desktop.ini
等。plugin.xml
并退出plugin.properties
粘贴此代码
plugin.properties
并退出Project Explorer
at左侧
View Menu
图标Filters and Customization...
Filters
菜单中勾选您的新过滤器。这就是我要再次感谢 emmzett 的全部。
问候。
Firstly thanks to @emmzett
Just wanna explain in a verbose mode of emmzett's answer because I didn't know anything editing plugin files and I spent 2 hours on this. Maybe I can save your time with this clarified expression.
plugins->org.eclipse.ui.navigator.resources_(your eclipse version).jar
plugin.xml
open with an editor(notepad,Notepad++ etc) theplugin.xml
filepoint="org.eclipse.ui.navigator.navigatorContent"
and paste code belowSpecifyAnIdForYourFileType
with a unique name for idChange
"your specific file"
with your specific file suffix like*.pdf
ordesktop.ini
etc.plugin.xml
and exitplugin.properties
open with an editor same as 3.stepPaste this code
plugin.properties
and exitProject Explorer
atthe left side
View Menu
icon at the top right cornerFilters and Customization...
Filters
menu.That's all I want to thanks again to emmzett.
Regards.
以下是在 Eclipse Indigo/Luna/Neon 上执行此操作的方法(截至 2018 年 5 月 22 日):
Here's how to do it on Eclipse Indigo/Luna/Neon (as of 2018-05-22):
如何将全局用户定义的资源过滤器添加到 Eclipse Project Explorer 视图:
在项目级别修改和切换过滤器需要大量点击,如果工作区中有很多项目,这可能会很乏味。如果您需要一次又一次地在所有项目上应用或切换相同的过滤器设置,您可能更喜欢为所有项目和所有工作区提供更快的全局解决方案。
修改
plugins/org.eclipse.ui.navigator.resources_{version}.jar
中的文件plugin.xml
和plugin.properties
> (提取、修改并重新添加修改后的文件)。例如,将
plugin.xml
中的仅文件过滤器添加到元素/plugin/extension @point="org.eclipse.ui.navigator.navigatorContent"
:作为另一个示例,将
plugin.xml
中的文件和目录过滤器添加到同一元素:为
中添加的所有过滤器提供过滤器名称和说明插件.属性
。项目资源管理器视图中的筛选器显示顺序按此筛选器名称排序,无论筛选器类型如何:重新启动 Eclipse 并重置其缓存:
eclipse.exe -clean
How to add global user defined resource filters to the Eclipse Project Explorer view:
Modifying and switching filters on a project level needs a lot of clicks and can be tedious if you have many projects in your workspace. If you need to apply or switch the same filter settings on all projects again and again you might prefer a quicker and global solution for all projects and all workspaces.
Modify the files
plugin.xml
andplugin.properties
inplugins/org.eclipse.ui.navigator.resources_{version}.jar
(extract, modify and re-add the modified files).For example, add a file only filter in
plugin.xml
to the element/plugin/extension @point="org.eclipse.ui.navigator.navigatorContent"
:As another example, add a file and directory filter in
plugin.xml
to the same element:Provide filter names and descriptions for all added filters in
plugin.properties
. Filter display order in Project Explorer view is by this filter name regardless of filter type:Restart Eclipse and reset its caches:
eclipse.exe -clean