Java Reference
In-Depth Information
You can use any editor to write Java code. The factor that distinguishes IDEA 's
editor is its intelligence: the editor's awareness of the nuances of the Java language
and the set of powerful features that are enabled through that awareness. These
features allow you to perform difficult tasks easily and thus improve your speed
and efficiency in developing Java software. This chapter will go beyond IDEA 's
basic editing capabilities and explore the most useful of these intelligent features.
3.1 What makes IDEA the intelligent editor?
IDEA understands Java.
The IDE has a fundamental understanding of the Java programming lan-
guage. It understands the basic concepts of classes and packages. It knows the
primitive data types, and it knows that they aren't treated the same as fully
fledged objects in the system. It knows about Java language syntax, about inher-
itance and overriding, about interfaces, about reflection and delegation, about
arrays and collections and iterators. It knows about visibility modifiers, and
nested loops, and exception handling. And it knows about all the silly little mis-
takes that humans make when they program in a software language.
And, knowing all this, it's able to provide incredibly useful features that no
simple editor can hope to emulate. It can navigate around the package and class
hierarchy with ease (where most other editors are only familiar with the file and
directory hierarchy). It can provide inline documentation while you write, to
demonstrate proper method call parameters and API usage. It can generate com-
mon code for you, saving you the time of writing mindless, formulaic code again
and again. And it can analyze your code as you write it, looking for common mis-
takes that we all fall into. In some cases, it can even suggest how to fix the codeā€¦
or it can fix it itself, if you want it to.
Be warned. It may even know Java better than you do.
3.2 Using code folding
Code folding is an editor feature that lets you hide portions of your source code
that are irrelevant to the current task or otherwise distracting. You can collapse an
arbitrary selection, an expression, a single line, a method, or even an entire class.
Folding code you aren't interested in makes reading the source code simpler,
because you only see the relevant lines. For example, in figure 3.1, the contents of
one of the if clauses and a previous method have been folded.
Folded code is displayed as a shaded ellipsis, whereas folded blocks also retain
their opening and closing delimiters. You can control the color and style of the
 
 
 
 
 
 
Search WWH ::




Custom Search