Java Reference
In-Depth Information
Configure the options that most closely match your file type:
Ignore case —If selected, keyword matching (discussed in a moment) is
case insensitive.
Line comment —Specify the pattern that signifies the start of a single-line
comment.
Block comment start and end —Specify the pattern that marks the begin-
ning and end of a block comment.
Hex prefix —Specify the pattern that indicates a value is a hexadecimal
number, such as 0x .
Number postfixes —Numbers are recognized automatically if they're sur-
rounded by whitespace, but this setting lets you extend the matching to
include numbers with postfixes. A postfix is any trailing text such as e-5 ,
kg , ft , and so on.
If you're defining a binary file type, all the syntax highlighting options are
unavailable because they don't mean anything. Any option that doesn't apply to
your new file type should be left blank.
Next, define any keywords that you want to receive special attention through
the four sets of keyword tabs at the bottom of the dialog. The coloring of key-
words is determined by your color scheme settings, discussed earlier in this chap-
ter. All custom file types share the same color scheme, so you use the tabs to
define four logical sets of keywords that each receive different coloring. If you're
designing a file type to support cascading stylesheets, for example, you can put
all the selector types into one category of keywords and all the properties in
another. There is no way to teach IDEA how to interpret your new file type's syn-
tax; you can only teach it to recognize keywords and symbols. Once you've created
your new file type, don't forget to register file extensions for it.
12.6 Using file templates
Traditionally, when you're adding a new class or interface to a Java source tree,
you determine the appropriate package and create an empty file in that directory.
It's then your responsibility to add the appropriate Java code, such as the package
statement and the class declaration, to format and structure the class to meet your
needs. When you're working with software design patterns—well documented,
tried and true data structures and algorithms for solving common problems—this
task is amplified, because you have to reimplement an already-defined structure
by hand from scratch.
 
 
 
 
 
 
 
 
 
Search WWH ::




Custom Search