Extract Field Dialog
Extracting a field using the dialog box
To extract a field using the dialog box
If the Enable in place refactorings check box is cleared on the Editor settings, the Extract Field refactoring is performed by means of the Extract Field Dialog.
- In the editor, select the expression or variable to be replaced with a field, or just place the cursor within such an expression or variable declaration.
- In the main menu, or the context menu of the selection, choose , or press Ctrl+Alt+F.
- In the Expressions pop-up menu, select the expression to be replaced. Note that PyCharm highlights the selected expression in the editor.
- In the dialog that opens, specify the type and name of the new field.
- In the Initialize in section, specify where the new field will be initialized.
- To automatically replace all occurrences of the selected expression (if it is found more than once),select the option Replace all occurrences.
- Click OK to create the field.
Last modified: 9 August 2017