Java 有没有办法让空包在 Eclipse 中可见?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/24107305/
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
Is there a way to make empty packages visible in Eclipse?
提问by Victor2748
Is there a way in Eclipse, to see empty parent packages? I have an issue freely viewing/accessing package new.galaxywar.client.resources.images.game
that only contains 2 sub-packages:
在 Eclipse 中有没有办法查看空的父包?我有一个问题,可以自由查看/访问new.galaxywar.client.resources.images.game
仅包含 2 个子包的包:
I tried creating that package again, because I thought that i might not have it in my eclipse project, but it won't let me:
我再次尝试创建该包,因为我认为我的 eclipse 项目中可能没有它,但它不会让我:
How do I prevent "views from filtering empty parent packages"?
如何防止“视图过滤空父包”?
采纳答案by vadchen
In "Project Explorer" panel, click on the "View Menu" button (represented as a triangle). Then go to "Customize View..." and deselect "Empty parent packages".
在“项目资源管理器”面板中,单击“查看菜单”按钮(以三角形表示)。然后转到“自定义视图...”并取消选择“空父包”。
This should do the trick.
这应该可以解决问题。
回答by EpicPandaForce
While I'm not sure how to perfectly solve the problem, I do know that you can still access the package if you try creating a new file in there, for example package-info.java.
虽然我不确定如何完美地解决问题,但我知道如果您尝试在其中创建一个新文件,您仍然可以访问该包,例如 package-info.java。
Try doing that by starting to add a Class as usual, but specify the package to be the package you can't seem to access in the Package Explorer.
尝试通过像往常一样开始添加类来执行此操作,但将包指定为您似乎无法在包资源管理器中访问的包。
回答by esQmo_
In recent versionsof Eclipse, the steps in the accepted answer have slightly changed:
在最新版本的 Eclipse 中,接受的答案中的步骤略有变化:
- In
Project Explorer
panel,click onView Menu
button - Then click on
Filter
- Deselect
Empty Parent Packages
- 在
Project Explorer
面板中,单击View Menu
按钮 - 然后点击
Filter
- 取消选择
Empty Parent Packages
Eclipse IDE for Java Developers | Version: Photon Release (4.8.0) Build id: 20180619-1200
面向 Java 开发人员的 Eclipse IDE | 版本:Photon Release (4.8.0) 版本号:20180619-1200
回答by Konstantin
In Eclipse Version: 2019-03 (4.11.0)
在 Eclipse 版本中:2019-03 (4.11.0)
On the Project Explorer tab press the triangle in the upper right corner.
在 Project Explorer 选项卡上,按右上角的三角形。
In the menu choose Filters and Customization...
在菜单中选择过滤器和自定义...
In the Filters and Customization menu unmark Empty packagesand Empty parent packages.
在过滤器和自定义菜单中,取消标记Empty packages和Empty parent packages。
Press OK
按确定
Now you should see the empty packages.
现在您应该看到空包。