Tool to put selected code in a separate function
Select the code >> Right Click >> Refactor >> Extract >> Method :
I believe what you are looking for is Extract method refactoring. You can access it via Refactor/Extract/Method menu or using a keyboard shortcut:
- CTRL+ALT+M (Linux, Windows)
- ⌥+⌘+M (OS X)