Java Reference
In-Depth Information
change your mind about a file before committing it, you can delete the file, and it
will be as if it never existed: Right-click the file, and select the
Delete
option. In
the case of Java files, you can use the
Refactor | Safe Delete
option, as discussed
in chapter 9, to verify that you're removing an unused class. Upon issuing the
delete request,
IDEA
asks if you wish to delete the file from
CVS
as well, as shown
in figure 8.9. If you select the option to no longer show the dialog, the option you
select (
Delete
or
Don't Delete
) becomes the default behavior for
IDEA
. You can
later reset this setting in the
CVS
configuration panel.
The file is deleted from your working directory and from
CVS
as well if
requested. Just like when you add a file, the file isn't removed from the repository
until you commit your changes. You can un-remove the file using
IDEA
's rollback
feature, discussed later in this chapter. When you commit your removals, the file
is removed from the repository.
Of course, files in
CVS
are never really deleted—they're moved into a hidden
archive folder called
Attic
and marked as deleted in the latest version. That way,
older revisions of the source tree still have access to them. Note, however, that
CVS
doesn't let you delete directories; you're stuck with them. You can make them
disappear from your workspace by using the
Prune Empty Directories
option
when checking out your project from
CVS
.
Renaming, moving, and copying files
First the bad news:
CVS
doesn't provide rename or move facilities. If you're using
the command-line client, you have to manually copy the file to its new location or
name, add the new file to
CVS
, and remove the old file from
CVS
. Luckily, inte-
gration of
CVS
with
IDEA
's refactoring features relieves you from the underlying
machinations. By using, for example, the
Refactor | Rename
refactoring,
IDEA
executes any and all
CVS
operations required to perform the requested refactor-
ing. You can even use the
Undo
command to revert this change. When you com-
mit your project, the removal and addition are recorded. If you've renamed a
Java class (which results in the renaming of a Java file),
IDEA
's refactoring facility
automatically corrects all the code references for you as well. The refactoring
commands
Move
and
Copy
work the same way.
Figure 8.9
IDEA automatically deletes files
from CVS, as well as the file system.