Java Reference
In-Depth Information
Brackets options
These options dictate how the code-completion features handle brackets when
inserting a method call. You can elect to insert the full set of brackets or only a
single opening bracket. In either case, your cursor is positioned just after the
opening bracket at the end of the completion operation. If you select the opening
bracket option only, you have the additional option of going ahead and inserting
both brackets in the single case where the called method takes no arguments.
Lookup list options
These four options dictate the behavior of the items in the suggestion list:
Show signatures— If enabled, methods are shown with full signatures,
including their parameters. If disabled, methods appear in the suggest list
by name only.
Autopopup JavaDoc— If enabled, the quick JavaDoc for the currently
highlighted selection appears after the specified number of milliseconds.
Lookup height— This option indicates the maximum number of entries
that the completion list can contain.
Sort lookup lists in XML alphabetically— If enabled, XML tag completion
lists the tags alphabetically rather than the order specified in the DTD .
3.7 Using IDEA's code-generation tools
We've looked at IDEA 's code-completion features, which help you fill out method
calls, name variables, and other operations. Now we'll discuss IDEA 's code-
generation features, which go a step further by creating entire methods for you.
3.7.1
Generating constructors
To access the constructor code-generation feature, execute the Code | Generate
command ( Alt+Insert ) and select the Constructor option from the pop-up
menu. The constructor generator lets you create class constructors that accept
arguments that are then assigned to field variables. You need to create your fields
first. Pick the fields you wish to include in your constructor (see figure 3.18): You
can hold down the Ctrl key to select more than one, or press Shift to select a
range of parameters. Click OK to create your constructor. It will appear in your
source code at the location specified in your Code Style settings, usually at the
top of the class under your field declarations. If you don't want any arguments to
your constructor, click the Select None button instead of OK .
 
 
 
 
 
 
 
 
Search WWH ::




Custom Search