Occasionally when writing code, you may want to copy a class from one package to another. The NetBeans Copy refactoring wizard allows this to be easily achieved.
First we will need a Java project to perform some Copy refactoring. We will use the same project from the earlier recipe, Rename refactoring, and so ensure that you have the project open from the end of that recipe. If you have not followed that recipe, the project is available from the code download bundle under the
MoveRefactor folder in
Chapter 3. When the Projects explorer shows the
Refactoring project, expand the
Refactoring node if not yet expanded.
To perform a Copy refactor, we need to have a destination package into which we can copy a ...