Eclipse's Rename tool is quite powerful. It can be used to rename variables, methods, class names, and more. Most often, you can simply right-click the item you want to rename and then choose Refactor, Rename. Alternatively, after selecting the item, you can press Ctrl+Alt+R in Windows (or Cmd+Alt+R on a Mac) to begin the renaming process. If you are renaming a top-level class in a file, the filename will have to be changed as well. Eclipse usually handles the source control changes required to do this, if the file is being tracked by source control.
If Eclipse can determine that the item is in reference to the identically named item being renamed, all instances of the name will be renamed as well. Occasionally, this even means comments are updated with the new name. Quite handy!
Was this article helpful?