Java Reference
In-Depth Information
select whatever you want—for example,
My
Code
Style
. This name will be used
here and in your Project Settings
when selecting the code style for the project.
You can delete a code style if you wish by selecting it from the list and clicking the
Delete
button. The editor will use the selected code style scheme, unless you've
specified a different scheme for the project.
Managing code style schemes across projects
In the Project Settings, you can choose to use something other than the currently
selected code style by enabling the
Project Code Style
option. Radio buttons pro-
vide the options to
Use the global code style
or
Use per-project code style
scheme
. Choose the per-project option, and then select the scheme you wish to
use from the drop-down list.
12.2.2
Variable naming and general formatting
The
General
tab of the code style settings contains a number of general format-
ting options that apply across the board. The
Naming
and
Order of Members
options apply to code completion operations as well as any code generation oper-
ation.
IDEA
doesn't use these options to rename or reorder your source code, only
to generate suggested variable names and properly place inserted members. We
covered the usage of the
J2EE
Names
tab in chapter 11, when we talked about
how to build
EJB
s in
IDEA
.
Specifying naming prefixes and suffixes
The naming prefix and suffix options allow you to specify a prefix or suffix to be
used when generating suggestions for naming new symbols through
IDEA
's code-
generation features. Enter any combination of prefixes and suffixes you desire.
Any blank entries will use the default name suggestions without any special pre-
fixes or suffixes. When you add prefix values,
IDEA
automatically uppercases the
suggested base name. For example, if
IDEA
is going to suggest the name
count
for
a new field variable, and you've specified a prefix
f
for field variables,
IDEA
sug-
gests the name
fCount
. You can even enter both a prefix and suffix—both will be
applied. The option
Prefer longer names
determines the default selection when
multiple names are suggested.
Determining the order of inserted members
The
Order of Members
option lets you tell
IDEA
where you want it to place new
members it inserts during code refactoring and generation operations. This
option has no effect on reformatting operations as you might first expect. Use the
Move Up
and
Move Down
buttons to reorder the list to your liking.