On this page:
- Move refactorings: basics
- Moving a file or a directory to another directory
- Moving function/method to the top-level
Move refactorings: basics
- The Move File refactoring moves a file to another directory.
- The Move Directory refactoring moves a directory to another directory.
- The Move Static Member refactoring moves a static method, variable, or constant from one class to another.
Moving a file or a directory to another directory
To move a file or directory to another directory, follow these steps:
- Select the file or directory in the Project tool window.
Do one of the following:
- On the main menu, choose , and then choose .
- On the context menu of the selection, choose , and then choose .
- Press F6.
The dialog that opens depends on the type of the selected symbol.
- In the To directory field, specify the folder to move the selected file or folder to. Choose an existing folder from the drop-down list or type the full path to the parent folder to be created.
- To have the references to the selected file or folder updated according to the refactoring result, select the Search for references check box.
Moving function/method to the top-level
This refactoring moves local functions or methods to the top-level by converting references to instance attributes or variables from enclosing scopes to parameters and updating existing usages accordingly.
To move a function or a method to top-level, follow these steps:
- Place the caret at the local function or method name.
- On the main menu, or on the context menu of the editor, choose , or press F6.
- In the Make Method Top-Level dialog box that opens, specify the destination of move. You can type it manually, or click the browse button and locate the destination file in the Choose Destination File dialog.
- Click Refactor to perform the refactoring, or Preview, to shows the preview in the Find tool window. If satisfied with the preview results, confirm move by clicking Do Refactor.