找不到重命名的 Eclipse 快捷方式

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7285228/
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 16:56:42  来源:igfitidea点击:

Can't find Eclipse shortcut for Renaming

javaeclipse

提问by IAmYourFaja

Used to know this, think its something like Ctrl + ??? + F11. Or something.

曾经知道这一点,认为它像Ctrl + ??? + F11. 或者其他的东西。

I have a class member/property that I would like to change the name of. Unfortunately it is sprinkled all over the class, some 100+ references to it. Throughout the various methods.

我有一个班级成员/财产,我想更改其名称。不幸的是,它散布在整个课堂上,大约有 100 多个引用。贯穿各种方法。

Eclipse has a shortcut that allows you to click on an identifier, hit the hotkey (whatever it is), and then modify the text composing the identifier. Then, once you click off of that text, it searches and replaces all references of the "old" identifier and replaces them with the new one.

Eclipse 有一个快捷方式,允许您单击标识符,点击热键(无论它是什么),然后修改组成标识符的文本。然后,一旦您单击该文本,它就会搜索并替换“旧”标识符的所有引用,并将它们替换为新的。

I know I could just do a search & replace. I don't want that. I want the shortcut/hotkey. And its driving me crazy because I can't find it because I don't know what it's called!

我知道我可以做一个搜索和替换。我不想要那个。我想要快捷方式/热键。它让我发疯,因为我找不到它,因为我不知道它叫什么!

Thanks to any Eclipse gurus that can help.

感谢任何可以提供帮助的 Eclipse 专家。

回答by Petar Minchev

The shortcut combination is ALT+ SHIFT+ R.

快捷键组合是ALT+ SHIFT+ R

回答by oliholz

CTRL+SHIFT+Llist of all shortcuts.

CTRL+ SHIFT+L所有的快捷键列表。

回答by Sean Patrick Floyd

The key combination is

组合键是

Alt+ Shift+ R

Alt+ Shift+R

The corresponding menu (and context menu) entry is

相应的菜单(和上下文菜单)条目是

Refactor > Rename ...

重构 > 重命名 ...

回答by Julian J. Tejera

I wanted to specify that the shortcut is Alt+ Command+ Rif you're using Mac OS X.

我想指定的快捷键Alt+ Command+ R,如果你使用的是Mac OS X.

回答by Jorgesys

PC

个人电脑

The shortcut for rename is:

重命名的快捷方式是:

Alt+ Shift+ r.

Alt+ Shift+ r

And the list of shortcuts will be displayed with:

快捷方式列表将显示为:

Ctrl+Shift+L

Ctrl+ Shift+L

Mac OS x

Mac OS X

The shortcut defined for rename/refactoring will work:

为重命名/重构定义的快捷方式将起作用:

option+ ?+ R

option+ ?+R

The option for rename is:

重命名的选项是:

F2

F2

Both are shortcuts defined for Mac, open the Shortcuts List with

两者都是为 Mac 定义的快捷方式,打开快捷方式列表

Shift+ ?+ L:

Shift+ ?+ L

enter image description here

在此处输入图片说明

回答by Robin Dhiman

Simply select the file and press F2. The rename option will open. Other option is ALt + Shift + R. But I prefer F2 is much easier way.

只需选择文件并按 F2。重命名选项将打开。其他选项是 ALT + Shift + R。但我更喜欢 F2 更简单的方法。

回答by el.nicko

For renaming a file, the F2 works in all cases I've encountered.

对于重命名文件,F2 适用于我遇到的所有情况。

However my experience shows that refactoring a class or a method can behave differently in different OS and desktop environments and that they may intercept key modifiers and thus render shortcuts ineffective.

然而,我的经验表明,重构一个类或一个方法在不同的操作系统和桌面环境中可能会有不同的行为,并且它们可能会拦截键修饰符,从而使快捷方式无效。

However, eclipse is good at accessing its main menu from the keyboard. For instance, in plasma in linux (tested with eclipse 2019-09 and older) renaming is achieved pressing Alt-T, then releasing it and pressing Nafterwards. The Alt-T effectively opens up the refactoring menu and the N orders eclipse to rename the selected element. Actually, the whole refactoring menu can be addressed in that manner, this achieving the goal with less friction.

但是,eclipse 擅长从键盘访问其主菜单。例如,在 linux 中的 Plasma 中(使用 eclipse 2019-09 及更早版本进行测试)重命名是按Alt-T实现的,然后释放它并在之后按N。Alt-T 有效地打开重构菜单和 N 命令 eclipse 重命名所选元素。实际上,可以通过这种方式解决整个重构菜单,从而以更少的摩擦实现目标。