The Extract Method refactoring helps you simplify complicated methods in your code.

For example, in the code fragment below, you could select a block of code

and press &shortcut:ExtractMethod; (Refactor | Extract Method).

This would result in the following: