Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Fixing My Pet Peeve in NetBeans IDE 6.0

DZone's Guide to

Fixing My Pet Peeve in NetBeans IDE 6.0

· Java Zone ·
Free Resource

The CMS developers love. Open Source, API-first and Enterprise-grade. Try BloomReach CMS for free.

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 if you use Beans Binding you shouldn't need to use very many 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

 

BloomReach CMS: the API-first CMS of the future. Open-source & enterprise-grade. - As a Java developer, you will feel at home using Maven builds and your favorite IDE (e.g. Eclipse or IntelliJ) and continuous integration server (e.g. Jenkins). Manage your Java objects using Spring Framework, write your templates in JSP or Freemarker. Try for free.

Topics:

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}