Any refactoring tool like this?
-
32`Ctrl+Shift+Y` for Lowercase, `Ctrl+Shift+X` for Uppercase. – Pratik Butani Aug 06 '14 at 07:20
-
2Possible duplicate of [changing the case of a string in Eclipse](http://stackoverflow.com/questions/6793570/changing-the-case-of-a-string-in-eclipse) – ks1322 Jul 27 '16 at 14:03
5 Answers
Windows
After you press Alt+Shift+R as mentioned by kostja, you can select the text you want to change, then
- Ctrl+Shift+Y for lowercase, or
- Ctrl+Shift+X for uppercase.
Mac OS
- Cmd+Shift+Y lowercase
- Cmd+Shift+X uppercase
There is no intelligence in this. It just blindly changes the case on the selected characters.
note: This tip comes from eclipse help. If you need to find it, click Help, Search, then type "uppercase". You'll find a page with lots of shortcuts.

- 4,168
- 5
- 29
- 42
-
this doesn't work with my version of Eclipse 3.6.2 - I'd *LOVE* to be able to select the text to capitalize, then right click, select Source, select "make capital" or "make lower case". I miss that user-friendly aspect from Visual Studio ! – Someone Somewhere Sep 30 '11 at 22:06
-
5It only works on the selection (and it's cmd-shift-x/y on the mac.) It's a shame that it won't do the next character if you haven't selected a range, since the keybinding is doing nothing in that case. – Joshua Goldberg Oct 21 '11 at 02:25
-
The commands work how is expected, just curious, where they appear through the Eclipse's Menu bar? – Manuel Jordan Jun 15 '20 at 19:15
What I find useful is column select using Alt+Shift+A and select a column of letters. Then use Ctrl+Shift+Y or Ctrl+Shift+X to lower case or uppercase letters.
This works for eclipse on windows.

- 27,123
- 14
- 62
- 101

- 129
- 1
- 5
There are a number of problems:
fooBar -> FooBar and vice-versa are unlikely to occur unless someone has been ignoring the Java style guidelines. (I rarely encounter such code, and when I do my initial reaction is to write off the code as beyond salvage.)
fooBar -> FOO_BAR and vice-versa are plausible, but pretty unusual.
foobar -> fooBar is also plausible, but it is problematic. It would entail Eclipse figuring out where the intended word boundaries are in a sequence of characters, and that is hard to get right.
If you look at these, they are all either unlikely to be needed much, or too hard to do properly. Hence, it doesn't surprise me that they are not supported by the standard Eclipse codebase.

- 698,415
- 94
- 811
- 1,216
Pressing Alt+Shift+R gives you all the power to refactor your variable name to your liking. AFAIK, there is no tool or shortcut that does just the capitalizing.

- 60,521
- 48
- 179
- 224
-
There IS a shortcut to quickly capitalize, un capitalize. See accepted answer. More, Alt+Shift+R is not allowed in JSP editor for example. – el-teedee Sep 04 '18 at 11:48
-
I do hope they added it in the meantime, I have not used Eclipse in years, so I can neither confirm nor refute. – kostja Sep 04 '18 at 13:20
-
It looks like [this function already existed in 2009](https://www.daveoncode.com/2009/08/25/eclipse-shortcut-switch-convert-uppercase-text-cod-lowercase/), thus, I think it was added before your answer. – el-teedee Sep 04 '18 at 15:42
-
1This function is to change the case of the entire selected string. This is not capitalization, which changes the case only for the first letter of the selected string. I really doubt that one existed back in 2011, I have been searching myself back then. – kostja Sep 05 '18 at 08:25
-
You are right, indeed, this CTRL+SHIFT+Y shortcut does NOT make capitalization but put all selected caracters upper or lowercase. Thus, my downvote on your answer was not relevant. Can you edit your answer, so that I can remove my downvote? You can add precision that your shortcut is only available in Java editors (?) but not in JSP editors? – el-teedee Sep 05 '18 at 08:31
-
No. You'll have to use the standard rename refactoring and retype the variable name in capital letters.
Capitalizing variable names should be limited to those cases, where we change a class attribute to a "constant", and this doesn't happen that often...

- 113,398
- 19
- 180
- 268