在Eclipse中重命名包 [英] Renaming packages in Eclipse

查看:352
本文介绍了在Eclipse中重命名包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Eclipse的Package Explorer中,假设我有一个这样的包列表:

In Eclipse's "Package Explorer", let's say I have a list of packages like this:


  • com.dog

  • com.cat

  • com.frog

如果我想将包结构的com部分重命名为动物,然后我可以选择每个包(上面)并执行重构>重命名。

If I want to rename the "com" part of the package structure to be "animal", then I could select each package (above) and perform a refactor > rename.

如果我有许多包从com开始,该过程可能需要一段时间。有没有一个简单的方法重命名com包名称,而不必单独重命名包资源管理器中的每个包?或者在重命名之前从构建路径中删除这些包?

If I have many packages that start with "com", that process may take a while. Is there an easy way to rename the "com" package name without having to individually rename each package in the Package Explorer? or removing those packages from the build path before renaming?

我尝试转到导航器窗格,其中显示树结构中的文件夹,但是我没有给出重命名能力。

I tried going to the "Navigator" pane where it displays the folders in a tree structure but I am not given the rename capability.

推荐答案

如果您修改了过滤器,默认情况下,空父父程序包将隐藏在程序包资源管理器中。 。在软件包资源管理器中,取消选中清空父软件包(第二个截图中的第三个),您将可以看到空的软件包。

By default empty parent packages are hidden in the package explorer, if you modify the Filters... in the Package Explorer to uncheck Empty Parent Packages (third from top in second screenshot) you'll be able to see the empty packages.

过滤器查看http://archive.eclipse.org/eclipse/downloads/drops/R-2.1-200303272130/images/non-shared-project-filter.gif

然后,您可以重命名 com 包,并检查重命名子包选项,强制重新命名所有子包。

You can then rename the com package and check the Rename subpackages option to force all child packages to be renamed.

重命名包http://archive.eclipse。 org / eclipse / downloads / drops / R-3.2-200606291905 / new_noteworthy / images / hierarchical_package_rename.png

然后当你重新应用过滤器再次隐藏所有这些空包。

Then when you're done reapply the filter to hide all those empty packages again.

这篇关于在Eclipse中重命名包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆