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

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

Pin It on Pinterest

Share This

Share this post with your friends!

Share This

Share this post with your friends!