Move and Copy
Move refactorings allow you to move files, directories, static class members and declarations within a project. CLion tracks these movements and automatically corrects all references to the moved symbols in the source code.
Move File / Directory- moves files/directories to another directory.
Move Static Member- moves static class members to a new or an existing class.
Move Declaration- moves top-level declarations to a new or an existing file.
Move a file or directory to another directory
Select the required file or directory in the Project tool window.
Do one of the following:
Press F6.
Right-click the selection and select
.Call
from the main menu.
In the To directory field, specify the destination folder. Choose an existing folder from the list or type the full path to the parent folder to be created.
Select the Search for references checkbox to have all references updated automatically.
Move static class members to another class
Place the caret inside the class from which you want to move a static member or select it in the Structure view.
Do one of the following:
From the main menu, choose
.From the context menu of the selection, choose
.Press F6.
Select the static members to be moved and specify the destination class name, existing or new.
Click Move to proceed or Preview to check the results before the actual refactoring.
In case of conflicts, when there are members dependent on the one you move, they will be shown in the separate dialog.
Move declarations to another file or namespace
Place the caret in the declaration that you want to move or select it in the Structure view.
Do one of the following:
From the main menu, choose
.From the context menu of the selection, choose
Press F6
Select the destination file. If required, you can also specify the destination namespace, existing or new.
Dependent declarations are highlighted with blue.
Click Move to proceed or Preview to check the results before the actual refactoring.
In case of conflicts, when there are members dependent on the one you move, they will be shown in the separate dialog.
Copy refactoring
The Copy refactoring allows you to copy a file or directory with its entire structure from one directory to another.
Copy a file or directory
Select the desired item in one of the views or open it in the editor.
Do one of the following:
From the main menu or the selection context menu, choose
.Press F5.
Select the desired class in the Project tool window and drag it to the target destination with Ctrl pressed.
In the that opens specify the new name and destination, then click OK.