The introduce variable operation adds a variable that is initialized to the value of an existing expression and then replaces the expression with the new variable. To start an introduce variable operation, select an existing expression and then select Introduce Variable from the Refactor menu or from the Refactor sub-menu of the editor context menu (right-click). Wing will find all places the expression is used in the current scope and list them in the Refactoring tool. To complete the operation, enter the name for the new variable and press the Introduce Variable button. The name may include a dot, so a name starting with self. may be used to introduce an instance attribute in a method.
Note that each found match for the expression is displayed with a check box that can be deselected to omit that match from the rename operation.
After it completes, the introduce variable operation can be undone with the Revert button in the Refactoring tool.
|« 6.2. Extract Function / Method||Table of Contents||7. Diff/Merge Tool »|