Intentions:
Some errors in code represent temporary errors because you are still typing which IDEA can determine your "intent", such as creating classes, constructors, methods, fields, local variables, etc. Others "fix" code automatically, like generate cases, exception clauses, etc for you.
For example, in IDEA if I type
Code:
public class Foo
{
public void method()
{
(1) x=new Bar("one", "two");
(2) x.doSomething();
(3) x.doSomethingWhichCanGenerateException();
(4) y = x.methodReturnsCollection();
(5) itco<TAB>
(6) Baz b = hashtable.get("foo");
}
}
Notice line 1, I have not declared x's type, nor does Bar exist. First, IDEA will ask to create bar. If I simply hit ALT-ENTER, it will automatically create this class, generate a constructor which takes 2 string arguments, and offer the generate two member variables on Bar to store these two strings, and automatically generate the assignments if I want.
Next, I would hit CTRL-ALT-LEFTARROW which would go back to line (1). IDEA now offers to create either a local stack variable to hold Bar, or a member variable on Foo. I hit ALT-ENTER and choose member variable.
Now line 2. IDEA offers to automatically create a method on Bar called doSomething(), returning void, taking void. I fill in this function, and hit CTRL-ALT-LEFTARROW.
Line 3 is same as line 2, but after coming back, IDEA offers to automatically generate a TRY/CATCH block, or add an Exception to the method signature.
Line 4, IDEA will offer to create a local/member variable Y.
Line 5, IDEA will expand "itco" into the following
Code:
for(Iterator (*)i = y.iterator(); i.hasNext(); )
{
(*) Object o = i.next();
}
However, the items marked (*) will be popups allowing you to override, for example, the types returned. Sometimes IDEA can even figure out that only 1 type is possible and it puts that as default.
Finally, line 7 needs a Cast to (Baz), and IDEA will automatically offer to insert it. Just press ALT-ENTER.
There are dozens and dozens, if not hundreds of these intentions. (from Plugins), like the Intention Power Pack (
http://www.intellij.org/twiki/bin/view/Main/IntentionPowerPack)
Besides Intentions, which are creation helpers and micro-refactoring automated editor actions, there are Live Templates, which are abbreviations + TAB key which expand into templated coded which then has slots in it which get filled in. These slots get filled in intelligently by being aware of what variables are in scope, so the editor makes it easier by prompting you.
On top of that, IDEA offers 25 powerful refactoring tools, and probably some of the most powerful code-completion you've ever seen. Simply put, there is no code editor on the planet I've seen which comes close, exception many Eclipse, which is stealing a bunch of stuff from IDEA. I used to be a hard-core Emacs junkie, but IDEA easily bests Emacs, BBEditor, CodeWarrior, VS.NET, JBuilder, Delphi, TogetherJ, and Netbeans.
And don't even get me started on how well IDEA handles Unit testing frameworks, XML editing, JSP, etc. VS.NET still has the edge on WYSIWYG (sorta) ASP.NET editing, but IDEA is meant for hard core programmers, not people who like to drag-and-drop.
Here's a PDF that has some screen shots of what it looks like. The PDF covers intentions from IDEA 3.0, which is an old version. There is alot more now than is mentioned.
http://www.jetbrains.com/idea/docs/Programming_by_Intention.pdf