Eclipse - Refactoring


Advertisements

Refactoring using Eclipse

Renaming a class that is used widely throughout a project could take a lot of time but the Eclipse refactoring wizard makes the job easier by automatically detecting all dependencies on the class being renamed and modifying them also.

The refactor menu can be opened by −

  • Right clicking on a Java element in the Package Explorer view and selecting Refactor menu item.

  • Right clicking on a Java element in the Java editor and selecting Refactor menu item.

  • Selecting a Java element in either the Package Explorer view or Java Editor and clicking Shift + Alt + T.

Refactoring

The refactor menu shows all the possible changes that are supported on the selected Java element. To rename a class, select the Rename menu item.

Rename Menu

Click on the Next button to see a preview of the changes (if available). Then click on Finish to get the wizard to do its work.

Advertisements