Java Reference
In-Depth Information
Viewing the history of the current selection
The Local History system can also show you the history for an arbitrary block of
code. Highlight an area of code, and then select the
Tools | Local History |
Show History for Selection
command. The history view appears but only shows
changes that affect the current selection. This makes it easy to focus on a selection
portion of the code without being distracted by the changes to the rest of the file.
Other than that, both history views work the same. This works much the same as
the
CVS
command
Show History for Selection
.
Rolling back your changes
Rolling back changes from the
Local History
view works just as it does with
CVS
.
Select the version you'd like to revert back to from those listed, and select
Roll-
back
from the context menu or click the button on the toolbar. Unlike
CVS
, Local
History doesn't require communication back to a central server to update your
source tree.
Viewing the history of the entire project
If you right-click a folder in your
Project
tool window and select the
Local His-
tory | Show History
command, you can access a more holistic view that displays
the files that have changed rather than the contents of a single file, demonstrated
in figure 8.22. Execute this command on your root project folder, and you'll see
changes across the entire project. We like to think of this as a project history view,
because it gives you a good view of changes across the source tree.
The project history view works just like the history view for individual files.
Rather than viewing the lines of a file that have changed, however, you're view-
ing how the source tree has changed at the file and directory level. You can see
where versions have introduced new files, removed them, or modified them. You
can explore file changes, navigate through the history list, and roll back to previ-
ous versions.
The new
View | Recent Changes
(
Alt+Shift+C
) command summarizes recent
changes to the project in a pop-up list that lets you quickly jump into your
Local
History
view to see the results of any particular changes. Each relevant change,
such as adding a file, a refactoring operation, or a search and replace, is listed
along with its time and date. Select one to bring up that change in the
Local His-
tory
view.