Java Reference
In-Depth Information
Figure 9.25
The Replace Inheritance with
Delegation refactoring
the command. You're asked to pick which of the superclasses or interfaces you'd
like to use.
9.4.7
Migrating source code to new package or class names
You probably won't use the migration tool much, but if and when you do need it,
you'll be glad it's there. The migration tool is accessible from the
Tools | Migrate
command. It lets you define a series of rename operations in order to take source
code developed with a package or class naming scheme and migrate to a new
naming scheme.
The only migration included with
IDEA
is a good example of the type of thing
you'll find yourself using this tool for. When Sun introduced the Swing compo-
nents, they were placed in the package hierarchy
com.sun.java.swing
. However,
by the time 1.1 came around, they were moved to
javax.swing
. This is a real prob-
lem if you've already written code against the old package.
To perform a migration, bring up the migration tool and select a migration
from the list. When you click
Run
,
IDEA
performs a
Find Usages
-type command
to locate all the code that needs to be changed. As with the
Refactoring Preview
window, you can choose to accept the changes or cancel. Once you proceed, you
can still undo just as you can with a refactoring.