JavaPerspective.com > Intermediate Tutorials > 1. The Eclipse IDE > 1.3. Tips about Eclipse > 1.3.4. How to refactor in Eclipse
1.3.4. How to refactor in Eclipse
Last updated: 25 January 2013.
The refactoring functions in Eclipse allow you to rename items and also move them from one location to another. To rename an item, just select it, right-click it and click Refactor -> Rename in the drop down menu. For example, the picture below shows how to rename the class JavaLoops:
When you click Refactor -> Rename, you can rename the class JavaLoops as shown below and all the references to the class JavaLoops throughout the application will be renamed as well:
In the same way, you can rename interfaces, packages, variables, constants and methods.
To move an item from one location to another, just right-click the item and click Refactor -> Move in the drop down menu. For example, you can move the class JavaLoops to another package as shown below:
When you click Refactor -> Move, the following dialog box is displayed:
Choose a destination package and click OK. All the references to the class JavaLoops will be automatically updated.