Move and Copy refactorings
The Copy refactoring lets you create a copy of a class in a different package. It also lets you create a copy of a file, directory or package in a different directory or package.
Perform copy refactoring
- Select an item you want to refactor. (For example, class in the editor or file in the Project tool window.
- Select (F5)
- In the dialog that opens, specify the name and location for your copy, and click OK.
The Move refactoring lets you move packages and classes between the source roots of a project, class members to other classes and inner classes to upper hierarchy levels.
For example, you can perform the move refactoring on method or field if it is used more in another class than in its own class.
Perform move refactoring
- Select an item you want to move.
- Select (F6).
- In the dialog that opens depending on the item you have selected for your refactoring, specify the appropriate options and click Refactor (OK for a package). You can also click Preview, if available, to preview the potential changes.