Java Reference
In-Depth Information
Class name completion
Class name completion works similarly to basic completion, but it only completes
on class and interface names. Unlike basic completion, which only completes the
names of class reachable by the current source, class name completion searches
all the classes in your project. If the class isn't currently imported, the auto-
import mechanism discussed earlier handles it. To complete a class name, choose
the
Code | Complete Code | Class Name
command (
Ctrl+Alt+Space
).
3.6.2
Completing brackets, braces, parentheses,
and quotation marks with smart completion
A number of options in the
Smart Keys
option group of the
Editor
settings help
you when inserting paired symbols such as braces, brackets, and quotes. For
either of the
Insert pair }
and
Insert pair %> in
JSP
options you enable, the edi-
tor automatically indents the pair's closing symbol when the opening symbol is
entered and the
Enter
key is pressed. The appropriate level of indentation is
determined by your
Code Style
settings.
The
Insert pair bracket
(including parentheses) and
Insert pair quote
options work a bit differently. When they're enabled, the editor automatically
adds the appropriate closing symbol for you as soon as you type the opening
bracket or quote. One handy feature is that if you delete the opening brace of an
empty set, the closing bracket or quote is also deleted.
You can automatically complete the current line with the shortcut
Ctrl+Shift+Enter
, which moves the cursor to the end of the line and
adds any required closing punctuation (quotes, parenthesis, and so on)
and the trailing semicolon.
TIP
3.6.3
Commenting out code
You can comment out the current line of source code with the command
Code |
Comment with Line Comment
(
Ctrl+/
). If the current line is already com-
mented, the command uncomments it. In Java, line comments start with double
slashes (
//
).
You can comment out multiple lines of code in one of two ways: You can either
select a series of lines and use the
Code | Comment with Line Comment
com-
mand (
Ctrl+/
) to comment out each line with line comments, or you can use
Code |
Comment with Block Comment
(
Ctrl+Shift+/
) to apply a block comment to your
selection. In Java, block comments are delimited by the symbols
/*
and
*/
.