开发者

Can't find Eclipse shortcut for Renaming

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

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.

Eclipse has a shortcut that allows you to click on a开发者_如何学Cn 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.

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.


The shortcut combination is ALT + SHIFT + R.


CTRL+SHIFT+L list of all shortcuts.


The key combination is

Alt + Shift + R

The corresponding menu (and context menu) entry is

Refactor > Rename ...


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


PC

The shortcut for rename is:

Alt + Shift + r.

And the list of shortcuts will be displayed with:

Ctrl+Shift+L

Mac OS x

The shortcut defined for rename/refactoring will work:

option + + R

The option for rename is:

F2

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

Shift + + L:

Can't find Eclipse shortcut for Renaming


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.


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

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 N afterwards. 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.


For Mac, use the below keys

OPTION + COMMAND + R
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜