You can extract a method from an expression at the caret, or from a group of selected statements. Press &shortcut:ExtractMethod; (Refactor | Extract | Method).