Eclipse - 忽略整个目录

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/968643/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 13:46:51  来源:igfitidea点击:

Eclipse - Ignore Entire Directories

eclipseaptana

提问by Justin Noel

I use Aptana Studio (based on Eclipse). I'm trying to get Eclipse to completely ignore an entire directory inside a project. I mean COMPLETELY. I don't want it to display in the project folder. I don't want Eclipse to even be aware it exists.

我使用 Aptana Studio(基于 Eclipse)。我试图让 Eclipse 完全忽略项目中的整个目录。我的意思是完全。我不希望它显示在项目文件夹中。我不希望 Eclipse 知道它的存在。

Unfortunately, all my efforts to add it as a filter don't work. See http://forums.aptana.com/viewtopic.php?f=14&t=8340#p33714. I think the filter only prevents the folder from being displayed in the project display. It doesn't keep Eclipse from actually looking at all the files in that folder for code assist, etc.

不幸的是,我将它添加为过滤器的所有努力都不起作用。参见http://forums.aptana.com/viewtopic.php?f=14&t=8340#p33714。我认为过滤器只会阻止文件夹显示在项目显示中。它不会阻止 Eclipse 实际查看该文件夹中的所有文件以获取代码帮助等。

My problem is that directory has thousands of text files. So, each time Eclipse opens or refreshes this project, it analyzes all those files.

我的问题是该目录有数千个文本文件。因此,每次 Eclipse 打开或刷新此项目时,它都会分析所有这些文件。

How can I prevent this?

我怎样才能防止这种情况?

采纳答案by Andrew Niefer

If you have a linked resource (pointing off to some other file/folder on disk) with the same name in the same location in the resource tree, then the real folder on disk will be hidden from the resource model.

如果您在资源树中的同一位置有一个同名的链接资源(指向磁盘上的某个其他文件/文件夹),那么磁盘上的真实文件夹将对资源模型隐藏。

Unfortunately you can't create the linked resource if the real directory is already there in the project structure. You can try something like this:

不幸的是,如果项目结构中已经存在实际目录,则无法创建链接资源。你可以尝试这样的事情:

  1. On disk, rename/move the directory in question
  2. Refresh the project, the directory is gone
  3. Create a linked resource ( New -> File/Folder >> Advanced -> Link to file in the file system ). Name it the same as the original directory.
  4. On disk, restore the original name of the directory
  5. Refresh project.
  1. 在磁盘上,重命名/移动有问题的目录
  2. 刷新项目,目录没了
  3. 创建链接资源(新建 -> 文件/文件夹 >> 高级 -> 文件系统中的文件链接)。将其命名为与原始目录相同的名称。
  4. 在磁盘上,恢复目录的原始名称
  5. 刷新项目。

回答by Gleb Varenov

Not sure about this aptana thing, but there is a convenient way to do it in native eclipse:

不确定这个 aptana 的事情,但有一种方便的方法可以在本机 eclipse 中做到这一点:

  1. Right-click a project folder in Project Explorer tree and go to "Properties".
  2. Resource -> Resource Filters.
  3. Add as much exclusion filters for files/folders as you like.
  1. 右键单击项目资源管理器树中的项目文件夹,然后转到“属性”。
  2. 资源 -> 资源过滤器。
  3. 根据需要为文件/文件夹添加尽可能多的排除过滤器。

If your project tree is not refreshed immediately, press F5 to enforce it.

如果您的项目树没有立即刷新,请按 F5 强制执行。

回答by James Clark

Consider also the 'Derived' checkbox: right-click an entry in the package explorer, choose properties, check Derived. This may solve part of your problem.

还要考虑“派生”复选框:右键单击包资源管理器中的条目,选择属性,选中派生。这可能会解决您的部分问题。

See http://robmayhew.com/eclipse-ignore-folder/

http://robmayhew.com/eclipse-ignore-folder/

回答by Matt W.

Try right-clicking "Properties" and unchecking all permissions.

尝试右键单击“属性”并取消选中所有权限。