Solving My Pet Peeve In NetBeans IDE: Missing Inner Class Hint

My pet peeve in NetBeans IDE is that the hint that appears when I'm instantiating a non-existent class can only create a new class in a new file:

But I don't want a new file. I want the class to be created in the same file, as an inner class. But the IDE doesn't offer that hint. So I inspected the sources and found that all the code for the generation of the inner class is actually already there. It seems to simply be a bug. The appropriate code isn't called at the right time. I created a new module and transferred just the relevant sources to my new module, fixing the code to the point where it works in the way that I think it should. Now, I get the choice I always wanted:

When I choose the new inner class hint, the following is created by the IDE at the bottom of the file, instead of in a new file:

class SliderChangeListener {

    public SliderChangeListener() {
    }
}

It's exactly the same code as before, except that this time it is an inner class. (It would be cool if the correct implementation or extension class were added to the signature, but that isn't the case for the normal hint here either and here I simply want to replicate the existing functionality in an inner class.)

It would be very cool if some people would try this plugin and see if it works. No promises, so don't be disappointed if it doesn't. It's working for me anyway and I'm going to find it pretty handy, though the Beans Binding blog entries I introduced over the last few days should reduce the need for inner classes, by the way! Please make sure you're using NetBeans IDE 6.0.1 and then get the plugin from the Plugin Portal:

http://plugins.netbeans.org/PluginPortal/faces/PluginDetailPage.jsp?pluginid=6152.

Comments:

Post a Comment:
  • HTML Syntax: NOT allowed
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
« April 2014
SunMonTueWedThuFriSat
  
12
13
14
19
21
22
23
24
25
26
27
28
29
30
   
       
Today