Extracting a Method

To extract a method, highlight a set of statements of a method body in the editor, and from the context menu in the editor, select Extract Method.