Wednesday Apr 09, 2008

Plugin for Creating Web Framework Plugins

Let's say you're beginning to create a plugin that will integrate tools for some web framework into NetBeans IDE. Download this plugin to help you get started:

Install it in NetBeans IDE 6.1 Beta:

  1. Create a new module called, for example, FooFrameworkSupport.

  2. Right-click it and choose "Web Framework Provider Support".

  3. In the first panel, choose a library containing the JARs required by your web framework. You can also add those JARs to a new library, after clicking "Manage Libraries". Finally, make sure to check the "Use in New Web Framework" checkbox! Click Next.

  4. In the second panel, change the suggested library name and display name, if needed. Click Finish and wait a bit for the files to be generated.

  5. Inspect the generated sources. You get a WebFrameworkProvider class, a WebModuleExtender class, and an empty configuration panel. You also get a library descriptor. All of these are correctly registered in the layer.xml file and the necessary API dependencies are in the project.xml file.

  6. Install the module right away without making any changes to the code at all. Then create a new web application and notice, in the final panel, i.e., the Frameworks panel, that a new entry is available for your web framework. The configuration panel is empty. Select the checkbox next to the name of the web framework, click Finish, and the library is added to the application's classpath.

Now study the NetBeans sources, such as web.struts, to see how to continue developing the plugin. You probably want to let the user configure something in the Frameworks panel so that some artifacts specific to the framework are generated into the web application source structure when the wizard is completed. The next version of this plugin will add some code that will help you get started with this part.


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.


« April 2008 »