如何在Eclipse中重命名类及其相应的文件

时间:2022-10-24 23:07:11

cannot find any menu item to do this. Is this doable?

无法找到要执行此操作的任何菜单项。这是可行的吗?

7 个解决方案

#1


128  

Just right click on the class in the project explorer and select "Refactor->Rename". That it is is under the "Refactor" submenu.

只需右键单击project explorer中的类并选择“Refactor->Rename”。它在“重构”子菜单下。

#2


10  

Shift + alt + r (Right click file ->refactor ->rename) when cursor is on class name. The file and constructors will be also changed.

当光标在类名上时,Shift + alt + r(右击文件->重构->重命名)。文件和构造函数也将被修改。

#3


5  

Right click file ->refactor ->rename ?

右击文件->重构->重命名?

#4


4  

You can rename classes or any file by hitting F2 on the filename in Eclipse. It will ask you if you want to update references. It's really as easy as that :)

您可以通过在Eclipse的文件名上按F2来重命名类或任何文件。它会问您是否要更新引用。这真的很简单:

#5


3  

Just rename the class in the source code. Eclipse will point out an error by underlining the class name with a red squiggly line. Hover on that line with your mouse pointer and eclipse will give you the option to rename compilation unit. Click on that.

只需在源代码中重命名类。Eclipse将通过在类名下面加上一条红色的弯曲线来指出错误。将鼠标指针悬停在这一行上,eclipse将为您提供重命名编译单元的选项。点击。

#6


1  

Simply select the class, right click and choose rename (probably F2 will also do). You can also select the class name in the source file, right click, choose Source, Refactor and rename. In both cases, both the class and the filename will be changed.

只需选择类,右键单击并选择rename(可能F2也会这样做)。您还可以在源文件中选择类名,右键单击,选择source、Refactor和rename。在这两种情况下,类和文件名都将被更改。

#7


0  

Shift + alt + r , then you can change the name.

Shift + alt + r,就可以改名字了。

#1


128  

Just right click on the class in the project explorer and select "Refactor->Rename". That it is is under the "Refactor" submenu.

只需右键单击project explorer中的类并选择“Refactor->Rename”。它在“重构”子菜单下。

#2


10  

Shift + alt + r (Right click file ->refactor ->rename) when cursor is on class name. The file and constructors will be also changed.

当光标在类名上时,Shift + alt + r(右击文件->重构->重命名)。文件和构造函数也将被修改。

#3


5  

Right click file ->refactor ->rename ?

右击文件->重构->重命名?

#4


4  

You can rename classes or any file by hitting F2 on the filename in Eclipse. It will ask you if you want to update references. It's really as easy as that :)

您可以通过在Eclipse的文件名上按F2来重命名类或任何文件。它会问您是否要更新引用。这真的很简单:

#5


3  

Just rename the class in the source code. Eclipse will point out an error by underlining the class name with a red squiggly line. Hover on that line with your mouse pointer and eclipse will give you the option to rename compilation unit. Click on that.

只需在源代码中重命名类。Eclipse将通过在类名下面加上一条红色的弯曲线来指出错误。将鼠标指针悬停在这一行上,eclipse将为您提供重命名编译单元的选项。点击。

#6


1  

Simply select the class, right click and choose rename (probably F2 will also do). You can also select the class name in the source file, right click, choose Source, Refactor and rename. In both cases, both the class and the filename will be changed.

只需选择类,右键单击并选择rename(可能F2也会这样做)。您还可以在源文件中选择类名,右键单击,选择source、Refactor和rename。在这两种情况下,类和文件名都将被更改。

#7


0  

Shift + alt + r , then you can change the name.

Shift + alt + r,就可以改名字了。