Java Reference
In-Depth Information
Table 3.1 Summary of all the operations related to folding and expanding code, including their key-
strokes. These operations are usable regardless of whether the code-folding outline is displayed in
the editor's gutter.
(continued)
Operation
Keystroke
Description
Expand All
Ctrl+Shift+NumPad+
Expands all folded regions throughout the entire current
source file.
Collapse All
Ctrl+Shift+NumPad-
Folds all foldable regions throughout the entire current source
file.
Expand JavaDocs
unmapped
Expands all folded JavaDoc regions in the current source file.
Collapse JavaDocs
unmapped
Folds all foldable JavaDoc regions in the current source file.
Fold Selection
Ctrl+.
Folds the current selection. This option lets you fold arbitrary
selections of code, even in the middle of a line.
Fold Code Block
Ctrl+Shift+.
Folds a current block of code, even if that block doesn't
typically have code folding handles (for example, fold an
if
or
while
code block).
You can also expand any folded region by clicking it with the mouse. Code fold-
ing is purely a function of the
IDE
. It doesn't affect your source code in any way.
In the
Editor
settings, you can select categories of code that should be folded
by default on file opening. These settings affect any newly opened files but not
currently opened or recently opened files. Under the
Code Folding
options
group, you can choose to collapse the following areas of code automatically:
File header
—Folds comments at the top of the file
■
Imports
—Folds blocks of two or more import statements
■
JavaDoc comments
—Folds all your JavaDoc comments
■
Method bodies
—Folds all your methods, leaving just the method signatures
■
Simple property accessors
—Folds getter and setter methods
■
Inner classes and Anonymous classes
—Folds these types of classes
■
XML
tags
—Folds the body contents of
XML
tags (applies to
XML
files, not
Java files)
■
3.3 Navigating through your Java code
When working with Java code, it's often useful to navigate around your document
tree by using the code's structure rather than by moving to the next page, the end
of the line, and so forth.
IDEA
doesn't just let you type Java code; it can interpret