Java Reference
In-Depth Information
Open in new tab
displays the results of the usage search in its own tab of
the results window rather than overwriting the existing results, preserving
both sets of results.
■
The
Find
group lets you constrain the search to subset of usages. For classes
and interfaces, you can specify any usage of the class, or just usages of fields,
methods, and so forth. For interfaces and superclasses, you can search for
implementations and derived classes.
■
Search in non-java files
searches for a literal reference (as far as
IDEA
can
tell) to the class outside of source files, such as in an
XML
configuration file
or tag library.
■
Scope
lets you define exactly where the searching will take place among
external libraries and project files. The ellipsis button (
…
) to the right of
the option lets you configure common scope options for quick selection
and reuse in the future.
■
The results of a search are displayed in a
Find
tool window, just as you'd see
when searching for matching text (See figure 9.2). Clicking any entry in the win-
dow or using the
Next
and
Previous
controls (
Ctrl+Alt+Down
/
Ctrl+Alt+Up
)
lets you navigate through the usages. Using the
Find
window is covered in detail
in chapter 2.
Highlighting usages in the current file
Another search option,
Search | Highlight Usages in File
(
Ctrl+Shift+F7
), is
similar to the
Find
usages in the
File
command. In this case, however, the current
symbol is highlighted throughout the current file, providing a visual indication of
where it's being used. The highlighting also helps you quickly identify the type
of use: They're color-coded by whether the symbol is used for write or read access.
Figure 9.1
The Find Usages operation is
sophisticated enough to search for
contextual references. This figure shows
Find Usages being applied to a class; you
can narrow a find to a specific usage
context, such as “find all classes that are
derived from this class” or “find all places
where methods in this class get called.”