Java Reference
In-Depth Information
in either file and choose the Select Change option from the context menu, the
affected code is automatically selected. By using the Copy icon in the difference
viewer toolbar, you can copy the selected code into the clipboard for future use
when you're back in the editor. You can also edit the current version of the file
directly from the diff tool. Specifics of merging changes are described later in
this chapter.
Ignoring whitespace
Often, minor changes or reformatting introduce new whitespace into a file. Extra
whitespace won't affect the operation of the code, so IDEA provides a way to
ignore these differences, allowing you to concentrate on the important changes.
At the top of IDEA 's diff viewer, you can control how it deals with whitespace by
selecting one of these options:
Do not ignore— Whitespace is important; highlight any changes.
Leading and trailing— Ignore differences in whitespace if they appear at
the beginning or end of the line only.
All— Ignore all whitespace, wherever it occurs on the line.
Viewing the differences between files
In addition to viewing the differences between two versions of the same file, you
can use the diff tool to examine the differences between two completely different
files. To view the differences between any two files, select the first file from the
project or source code views, and then hold down the Ctrl key and right-click the
second file. From the context menu, select the Compare Two Files option to
bring up the diff viewer with the first file on the left and the second on the right.
This is a good way to spot differences between configuration files, output logs,
DTD s, and so on.
Sometimes it's useful to compare two arbitrary blocks of code—say, two
methods in different classes. IDEA gives you the ability to launch the diff
between the current selection and the contents of your clipboard. To do
so, copy the first block of code into the clipboard, make a selection in the
editor, and select Compare with Clipboard from the context menu. The
initial selection doesn't even have to come from another file within IDEA :
You can copy it from another editor, your shell, or a web page.
TIP
 
 
 
 
 
Search WWH ::




Custom Search