Wednesday Aug 28, 2013

Beefed Up Code Completion in NetBeans IDE 7.4

When I call up code completion in all versions of NetBeans IDE, the Java Editor gives typed suggestions for completing the current statement:

This is called code completion. No surprises there.

However, if I invoke code completion a second time (i.e., press Ctrl-Space twice), a deeper level of suggestions is returned in NetBeans IDE 7.3.1, as well as in recent releases before that:

However, in NetBeans IDE 7.4, instead of the above, the code completion includes suggestions applicable to attributes from the current scope of variables, in the form of parameters for methods:

This is also known as "chained completion". In other words, when in NetBeans IDE 7.4 you invoke code completion a second time, the Java Editor will scan variables, fields and methods, which are visible from the context, and then suggest a chain that conforms to the relevant type.

More info about this can be found here:

https://netbeans.org/bugzilla/show_bug.cgi?id=218604

https://netbeans.org/bugzilla/show_bug.cgi?id=229560

Next, another excellent enhancement, this time by external contributor Benno Markiewicz. In 7.3.1, I try to use code completion here, because I'm interested to see whether any methods relating to property listening can be attached to my object:

No luck, as you can see. In 7.4, however, there's a new checkbox in the Options window, disabled by default because the underlying functionality is potentially slower and you'll get more results so is potentially confusing, so that explicit enablement means you know what you're getting yourself into, named "Subword completion", as you can see below:

And now, I get some very interesting and, more importantly, useful results, applicable to properties on my object:

More info about subword completion can be found here: https://netbeans.org/bugzilla/show_bug.cgi?id=212412

About

Geertjan Wielenga (@geertjanw) is a Principal Product Manager in the Oracle Developer Tools group living & working in Amsterdam. He is a Java technology enthusiast, evangelist, trainer, speaker, and writer. He blogs here daily.

The focus of this blog is mostly on NetBeans (a development tool primarily for Java programmers), with an occasional reference to NetBeans, and sometimes diverging to topics relating to NetBeans. And then there are days when NetBeans is mentioned, just for a change.

Search

Archives
« August 2013 »
SunMonTueWedThuFriSat
    
1
24
       
Today