Over a million developers have joined DZone.

NetBeans IDE 7.1 Review: NetBeans Platform Support

DZone 's Guide to

NetBeans IDE 7.1 Review: NetBeans Platform Support

· Java Zone ·
Free Resource

NetBeans IDE 7.1 adds JavaFX 2.0 Support (see my review of that) and a lot of new features and improvements including improvements to the NetBeans Platform itself.

The NetBeans Platform is an application framework that can be used as a stable basis for mostly Java desktop applications. (Dozens of screenshots of applications using this framework can be found here.)

In this article, I'll focus on the changes to the NetBeans Platform in its newest release, i.e., NetBeans Platform 7.1.

Window System

The NetBeans Platform features a very powerful Window Management System, letting you declaratively define default window positions, resizing and docking/undocking windows, minimize/maximize, persist window state, group behavior, etc. Version 7.1 introduces a couple of new features here. You can see them in the IDE and reuse them in your NetBeans Platform applications.

The reason for the recent improvements is that the NetBeans team apparently has joined forces with the designers of another IDE, planning to reuse the NetBeans window system. From the press release:

The community working on NetBeans project is proud to announce the availability of new, improved and most flexible version of its window system - the docking framework behind the IDEs, as well as many other NetBeans Platform based applications. By joining forces of the teams working on the design of two large IDEs, we managed to marry the expertise, excellence and creativity of human interface designers, artists, look & feel experts, developers and architects to form a window system ready for the 21st century.


Note that the carefully crafted message above avoids to spell out the other IDE's name! Since it seems to not be very public information yet, I'll leave it to the dear reader to speculate. :-) The "other 
IDE" obviously missed some features in the NetBeans Platform window system. So they had to be introduced here before the "other IDE" could adopt the NetBeans Platform.


The most important enhancement seems to be "Perspectives", which are named "Roles" here as a way of switching between window layouts. When registering a window you can now add one or more roles to it in the Annotation, e.g.:

@TopComponent.Registration(mode = "editor", openAtStartup = true, role="admin")

To switch perspectives programmatically you only need to call the Window Manager:


In case you want to pick a Role during startup, there's also a new Listener interface you can use called WindowSystemListener which will receive events during the window system lifecycle (beforeLoad, afterLoad, beforeSave, afterSave). A very handy improvement over the existing system. For more details and a complete example have a look at Geertjan's blog post.

Window Layout Designer

One extremely useful new feature is the new Window Layout Designer allowing you to create new Layouts via drag and drop. You can invoke this functionality using the new "Layout of Windows" wizard. The Wizard will launch your application in a special mode, and allow you to create or change Window Positions, aka "Modes" and save the changes to a layer file and the files required for defining new Modes.

Image 1: Application started in Design Mode

If you've ever tried to create your own Mode, you'll find this feature extremely helpful!


Image 2: Automatically created Mode definitions

Window Group Behaviour

The docking system allows you to undock/dock single Windows. In NetBeans Platform 7.1 you can now do the same with a whole docking area. So you can now easily undock a group of Windows. This functionality is available from the context menu of the Window.


Image 3: A minimized Window Group

That's nice, but the second option, using a drag gesture for this is more intuitive and useful.
 The same improvement has been added for moving a whole docking area or Window Group to a new position. You can simply drag and drop it there, while visual guidelines will help you direct the reordering.

Pluggable MultiViews

In case you're using the MultiView API, there's a very interesting enhancement. You can now register a MultiView for an existing MimeType. It will be available from MimeLookup and can be located by MultiViews.createCloneableMultiView, a factory method that creates a multiview for a given mime type. So any existing MultiView Editor registered for a MimeType automatically has an extension point and can be enhanced.

Image 4: A custom multiview tab in the standard Java Editor

Again Geertjan has a blog entry with a sample for this new functionality.

SaveCookie Replacement

Up to Version 7.1 the System for tracking savable changes in TopComponents was based on the DataSystems API. In order to activate the save Button, a TopComponent was basically forced to be backed by a DataObject and a File. This was in the way of reuse. You couldn't easily plug things like database changes into such a system and caused some issues with the displayName. 7.1 introduces Saveable as a replacement for SaveCookie and AbstractSaveable to help you implement it. 

Visual Debugger

I already described this in my review of the JavaFX support. NetBeans IDE 7.1 has a visual debugger allowing you to take UI snapshots and examine them in the IDE. This feature also works for NetBeans Platform applications. Even when you open multiple windows and undock some of them the it works as expected. The undocked windows will be saved as a separate snapshot in the Editor and you can dig through the component hierarchy, check registered listeners and even attach special Event logging Listeners. I guess that alone should be investigated in an article of it's own. I'm really deeply impressed with this feature. 

Configurable Cache Directory

One thing we often had problems with during our trainings at universities and conferences was the performance of the IDE and NetBeans Platform when the cache dir is on a slow network drive. With the new command line switch "--cachedir", you can override the default location. It has a nice impact on performance if the cache dir is on a fast local disk.

Downloadable NetBeans Platform for ANT builds

NetBeans Platform really has one nice benefit over it's main competitor Eclipse RCP, and that is the use of standard build systems. With NetBeans and Maven setting up a continuous build is a click in a context menu, in Eclipse this is a topic of advanced RCP trainings. One other nice benefit of Maven is the ability to define which platform should be used in an application. This way there's a clearly defined Version hosted in a repository that all developers use.

With ANT it has often been a hassle to really configure everything correctly, so every developer works with the same APIs, and depending on the setup, a single developer updating the IDE could break the build for all team members by setting a module dependency after the update. So you had to be careful what you do and setup policies for which platform to use, e.g. by putting it under version control.

With 7.1 the build harness has been updated to support downloading a specified version of the platform as part of the build process.
It's actually very simple. In your NetBeans Platform Application project you just need to locate the platform.properties file and replace the line specifying your platform which usually is:


with this:


If you do a clean and build ANT will download the platform automatically.

Registration and Layers

In an attempt to convert most of the layer based registry to Annotations and AnnotationProcessors, the registration of File Templates has now been changed. The new Annotation @TemplateRegistration can be used for that. Many of you will probably remember the build warning that the use of an empty layer is highly inefficient. :-).

Now the main reason for this, the checkbox in the Module Project Wizard has been removed. If you still need to register something in the layer, and you're too lazy to write your own AnnotationProcessor, or can't use one for other reasons (there are some corner cases where Annotations won't work), there's now a wizard for creating a layer.

And as another enhancement to the registry, the "this layer in context" UI for investigateing and manipulating the layer file has been fixed to work as expected for Maven based projects, the IDE will download the required JARs from the repository when needed, without the need to a build the suite. 


The NetBeans Platform has received some very useful updates. Primarily, the Window System, which was one of the best on the market before, and at least the best free one, has been further enhanced.

What I really like is that also the tooling has become better. When talking to users who know both Eclipse RCP and NetBeans most of them like the NetBeans APIs (and the build process) better, but they point out that Eclipse RCP tooling is better. So any improvement here really is appreciated.

Congratulations to the NetBeans Team for a great release!


Opinions expressed by DZone contributors are their own.

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

{{ parent.tldr }}

{{ parent.urlSource.name }}