score:216

Accepted answer

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.

score:-4

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

score:2

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.

score: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.

score:10

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.


Related Query

More Query from same tag