Eclipse Tips : Rename Variable (ALT + SHIFT + R)

Eclipse provides cool short cut key for renaming the variables across within a class or entire workspace. If you are not aware of this feature, you would use “find” option and replace the variable with new name. But, this will lead to a problem of not renaming all the references. You can easily rename the variables by typing the short cut ALT + SHIFT + R in your Eclipse. There are two ways to to this:

  1. Move the curson over variable name and type CTRL + 1 for quick fix which would suggest the option to change the variable in a file or workspace. You just select the desired one to start rename the variable.
  2. Second option is to directly type ALT + SHIFT + R to rename the variable.

Look at the below screenshots which clearly describes how to do the renaming.

1. Short Cut Key : CTRL + 1

When you type the short cut key CTRL + 1, it will display the suggestion box like this one below.

Eclipse Rename Variable using CTRL + 1

Eclipse Rename Variable using CTRL + 1

2. Short Cut Key : ALT + SHIFT + R

When you type the short cut key ALT + SHIFT + R, it will change the editor like shown below to allow the editing variable names.

Eclipse Rename Variable using ALT + SHIFT + R

Eclipse Rename Variable using ALT + SHIFT + R

Comments

comments

About Krishna Srinivasan

He is Founder and Chief Editor of JavaBeat. He has more than 8+ years of experience on developing Web applications. He writes about Spring, DOJO, JSF, Hibernate and many other emerging technologies in this blog.

Speak Your Mind

*