Refactoring in Intellij IDEA

Rename (Shift-F6)

You can rename variables, fields, methods or classes, Place cursor on the name and press Shift-F6. IDEA will rename all references to those classes/methods/variables.

Warning: Be careful with Freemarker templates. Idea has no way of knowing if a property is used in a template and will not rename it.

Introduce Variable (Ctrl-Alt-V)

Select an expression. Ctrl-Alt-V and you can create a variable to hold the result.

Introduce Variabl 1 Introduce Variable 2

Inline (Ctrl-Alt-N)

Inline is oposite from introduce variable. Select a variable and IDEA will try to replace it with expression.

Extract Method (Ctrl-Alt-M)

Wanna simplify those 500-line methods ? Select a piece of code Ctrl-Alt-M and IDEA will try to create a method and replace the section with method call. If it finds similar sections it will offer you to replace those too.

Attachments