Eclipse:改变现有包中包含类的名称 [英] Eclipse: change name of existing package with classes inside

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

问题描述

在Eclipse中,如果包含名称(默认包)并在其中有类,可以更改包的名称?

In Eclipse, is it possible to change name of the package if it has name (default package) and has classes inside it?

推荐答案

在Eclipse的版本中,我使用(Indigo服务版本1),Rename选项不会出现在默认包中(与其他软件包) - 但是如果您选择所有类别,请右键单击并选择移动,以便将它们放入新软件包中。

In the version of Eclipse I'm using (Indigo service release 1), the "Rename" option doesn't come up for the default package (unlike other packages) - but if you select all the classes then right-click and select "Move" that will let you put them in a new package.

(就我而言可以说,重命名选项是用于重命名类,而不用更改其包,但移动肯定适用于在包之间移动。)

(As far as I can tell, the Rename option is for renaming classes without changing their package, but Move certainly works for moving between packages.)

过程的截图:

原始情况

选择所有类并显示Refactor上下文菜单的一部分

选择移动,单击创建包,然后输入名称(在这种情况下为mypackage)

最终结果

或者,如果要将它们移动到现有的包中,您可以拖放类。

Alternatively, if you want to move them to an existing package, you could just drag and drop the classes.

对于那些建议使用Refactor - > Rename的软件包,下面是一个屏幕截图,显示在我的机器上工作的

For those suggesting Refactor -> Rename on the package, here's a screenshot showing that not working on my machine:

这篇关于Eclipse:改变现有包中包含类的名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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