Download NetBeans!

20091101 Sunday November 01, 2009

Tip for Wicket Users in NetBeans IDE

If you're using Wicket, you're using its forms, text fields, labels, and so on. So, you call up code completion and you see "java.awt" and "java.text" being offered first, meaning you need to scroll down in each drop-down for the applicable Wicket class:

You can save yourself that trouble, by excluding the "java.awt" and "java.text" packages (which you're not using with Wicket anyway) in the "Editor" section of the Options window (under the Tools menu):

With those packages excluded, the first class that appears in code completion is the one you want for your Wicket applications:

Then just press OK and you have all the imports from Wicket and you're ready to continue coding right away.

Nov 01 2009, 04:34:41 AM PST Permalink

Trackback URL: http://blogs.sun.com/geertjan/entry/tip_for_wicket_users_in
Comments:

Great way to get rid off the annoying Swing libs. Like Geertjan said: Who needs them, since Wicket rocks your world anyway ;-)?

Posted by Yves Chaves on November 01, 2009 at 11:37 PM PST #

The problem with this workaround - besides the fact that the user has to know to do it - is that it applied globally, which would be irritating if you were making a Wicket app which launched a JNLP Swing app, and had them both open at once, etc.

http://qa.netbeans.org/nonav/issues/show_bug.cgi?id=170231 suggests a new API - or rather, an extension of the applicability of an existing API - which (among other things) would let the project itself omit sections of rt.jar from not only code completion but compilation generally (i.e. treat usages as errors). In this case, web applications might omit java.awt.** and javax.swing.** classes from the boot classpath by default. (JSR 294 would provide a cleaner mechanism for this case, but that is a long way off.)

As to java.text.Normalizer.Form being offered by default in Fix Imports instead of org.apache.wicket.markup.html.form.Form, I would suggest that this be corrected simply by making the IDE always offer top-level classes before any nested classes. In general, this kind of logic can probably be tuned to better guess what you meant, e.g. by looking to see if you were already using a class with that simple name elsewhere in the same source root.

Posted by Jesse Glick on November 02, 2009 at 08:27 AM PST #

Post a Comment:

Name:
E-Mail:
URL:

Your Comment:

HTML Syntax: NOT allowed