Java Reference
In-Depth Information
Figure 3.1 IDEA's code folding feature lets you collapse arbitrary sections
of code to a single line.
folded code through your color scheme. Previewing the contents of a folded area
is also very easy: Move your mouse pointer over the folded region, and its con-
tents appear in a pop-up tool-tip. You can left-click your mouse while viewing the
preview to unfold the code. When you move your mouse away, the preview closes.
Table 3.1 lists all the operations related to code folding.
The icons next to the gutter (see figure 3.1) form an outline used to control
code folding. All JavaDoc blocks, methods, inner classes, and import blocks (those
with more than one line, anyway) are bounded by code folding outlines, making it
easy to collapse and expand them. A plus-sign icon indicates previously folded
code that you can expand by clicking the icon. A minus icon delimits a block of
foldable code. Notice that the minus icons are in little arrow shapes; when you
click one of these icons, the area between the arrows collapses into a single line.
Personally, we find the little icons a distraction, but you can turn them off
through the Editor settings by disabling the Show code folding outline option.
You can still use the code-folding feature through the Folding submenu in the
View or editor context menu. These actions are available even if you have the
code-folding outlines enabled, allowing you to use the menu options if you wish.
Plus, the menu options give you more control than the outlines, letting you fold
arbitrary selections.
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.
Operation
Keystroke
Description
Expand
Ctrl+NumPad+
Expands the method, class, or other foldable region of code
at the caret.
Collapse
Ctrl+NumPad-
Folds the method, class, or other foldable region of code at
the caret.
continued on next page
Search WWH ::




Custom Search