Header javaperspective.com
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:

picture showing the eclipse IDE 30


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:

picture showing the eclipse IDE 31


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:

picture showing the eclipse IDE 32


When you click Refactor -> Move, the following dialog box is displayed:

picture showing the eclipse IDE 33


Choose a destination package and click OK. All the references to the class JavaLoops will be automatically updated.


You are here :  JavaPerspective.com  >   Intermediate Tutorials  >   1. The Eclipse IDE  >   1.3. Tips about Eclipse  >   1.3.4. How to refactor in Eclipse
Next tutorial :  JavaPerspective.com  >   Intermediate Tutorials  >   1. The Eclipse IDE  >   1.3. Tips about Eclipse  >   1.3.5. How to use command-line arguments in Eclipse

Copyright © 2013 - 2016. JavaPerspective.com. All rights reserved.  ( Terms | Contact | About ) 
Java is a trademark of Oracle Corporation
Image 1 Image 2 Image 3 Image 4 Image 5 Image 6 Image 7