1.
|
In the Package Explorer view, select junit.framework.TestCase.java.
Note: Most refactorings also work from a text selection: select the element in the
Java editor and then start your favorite refactoring.
|
2.
|
From its context menu, select Refactor
> Rename.
Refactoring actions change the structure of your code
without changing its semantic behavior.
|
3.
|
In the Enter New Name
field on the Rename Compilation Unit page, type "MyTestCase",
then click Next.
![]() |
4.
|
The workbench analyzes the proposed change and presents
you with a preview of the changes that would take place if you actually
choose to rename this resource.
Renaming a compilation unit invalidates import statements
in other compilation units; therefore, a simple rename operation is not
sufficient in this case and would result in compile errors.
![]() |
5.
|
On the Refactoring preview page, you can scroll through
the various proposed changes and select or deselect changes, if necessary.
Note: Typically, you will accept all the proposed changes.
|
6.
|
Click Finish to accept
all proposed changes.
|
7.
|
In the menu bar, select Refactor
> Undo Rename TestCase.java to MyTestCase.java.
![]() |
8.
|
The refactoring changes are undone, and the workbench
returns to its previous state. You can undo refactoring actions right up
until you change and save a compilation unit, at which time the refactoring
undo buffer is cleared.
|