Refactoring
Scala Refactoring is integrated in Scala IDE. It offers a broad range of refactoring actions.
Extracting Local Values
The Extract Local action does the opposite work of Inline Local. It creates a value of an expression. It is a must use to make code more readable.
Select an expression to extract.
![../../_images/feature-refactoring-extract-local-01.png](../../_images/feature-refactoring-extract-local-01.png)
Call the action, then set a name for the created value.
![../../_images/feature-refactoring-extract-local-02.png](../../_images/feature-refactoring-extract-local-02.png)
Extracting Methods
The Extract Method action extract the set of selected statements into a new method. The original code is replaced by the equivalent method call.
![../../_images/feature-refactoring-extract-method-01.png](../../_images/feature-refactoring-extract-method-01.png)
Inlining Local Values
The Inline Local action helps removing unneeded values.
The action is performed on the currently selected value.
![../../_images/feature-refactoring-inline-local-01.png](../../_images/feature-refactoring-inline-local-01.png)
Organizing Imports
The Organize Imports action allows to do some automated cleanup on the list of imports. It removes the unused or unneeded imports and organizes the remainder.
![../../_images/feature-refactoring-organize-import-01.png](../../_images/feature-refactoring-organize-import-01.png)
This action can be configure in the Scala → Organize Import preference page.
Renaming
The Rename action allows to change any name, and update its reference.
The action is performed in in-line mode if the name as only a local scope.
![../../_images/feature-refactoring-rename-01.png](../../_images/feature-refactoring-rename-01.png)
The action is done through a wizard if the name can be referenced from different source files.
![../../_images/feature-refactoring-rename-02.png](../../_images/feature-refactoring-rename-02.png)