I realized this very concretely again, today. We're using a DocBook module (made by Jesse and Tim), which integrates DocBook into NetBeans. For example, a DocBook book is recognized as a project, there are templates for chapters, and you can use a menu item to convert either the whole book or individual chapters to HTML. However, there are things missing. There are always things missing! In this case, filling in the gaps was easy. Whenever I wanted to make a piece of text bold, for whatever reason, I had to manually add the <command> tag before the selection and the </command> afterwards. Too much work! I'd much rather right-click on a word, or a selection of words, and choose "Make Bold". Well, that's exactly what I now have. And...
...it took no more than three lines of code:
JTextComponent editor = Registry.getMostActiveComponent();
String selection = editor.getSelectedText();
editor.replaceSelection("<command>" + selection + "</command>");
A lot of other stuff was needed, but in each case it was generated by the IDE. For example, the Java class that provides the menu item was generated by a wizard. It contained skeleton methods, including "performAction". And the above three lines was all I needed to stick in that "performAction". The wizard also added registration entries into the XML Layer file, so that the menu item appears in the right-click popup menu for files of the MIME type that I'm using for the DocBook chapters. And then I just installed the whole module again, into the same development IDE I had been using to write the DocBook chapters. And then, straight away, I was able to use the module I had made.
Pretty cool. I'm hoping more and more non-module developers who are NetBeans users begin realizing the power of module development in NetBeans. In many cases, creating a little module like the above could be a standard part of the development process. You might be creating a web application, for example, and then think: "Wouldn't it be cool if NetBeans was able to do XYZ?" And then, without thinking further about it, you'd use the same Java development skills you needed for creating the web application to create a module to provide the functionality you're missing. Not all functionality can be provided by a small module like this one, of course. But, on the other hand, you'd be surprised how much can be done in this way, with small modules created on the fly in the middle of some totally random development process.