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.
|
|
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
- IntroduceVariable1.png (33.3 kB) -
Introduce Variabl 1
, added by dragisak on 01/02/09 17:17:18. - IntroduceVariable2.png (1.1 kB) -
Introduce Variable 2
, added by dragisak on 01/02/09 17:17:31. - Inline1.png (10.9 kB) - added by dragisak on 01/02/09 17:24:47.
- Inline2.png (0.9 kB) - added by dragisak on 01/02/09 17:24:57.
- ExtractMethod1.png (135.1 kB) - added by dragisak on 01/02/09 17:32:24.
- ExtractMethod2.png (50.2 kB) - added by dragisak on 01/02/09 17:32:33.






