Kinds of Refactoring Actions

Depending on the context from which you choose to refactor, various refactoring commands are available.

Refactoring Commands

Context

Available Refactoring Commands

Package

Rename

Class

Rename

Move to another package

Method

Rename

Rename parameters

Code

Extract Method

Rename Element

You can rename an element, and the workbench's refactoring support changes both the selected resource's name and all references to it.

Rename Method Parameters

You can rename the parameters of a method by renaming the parameter's declaration as well as all references to the parameters inside the method body. Use the Rename Parameters command to rename the parameters of a method as well as all references to these parameters.

Move Compilation Unit

You can move a compilation unit to a different package. Imports and references are automatically updated.

Extract Method

When you extract a method, the workbench removes a fragment of code from an existing method body and creates a new method for it, also adding a call from the old method to the new method. This feature is useful for cleaning up lengthy, cluttered, or overly-complicated methods.