- Select code
- Right click on it and choose "Extract code to new file".
- File chooser opens with the current directory of the file, where you've got the code.
- Set a name (Default name is '"NewFile.fileExtension". The Fileextension was set to the extension of the file, where you've got the code.)