Geertjan's Blog

  • July 15, 2008

Notes for NetBeans Platform 6.5 (Part 1)

Geertjan Wielenga
Product Manager
Following on from Notes for NetBeans Platform 6.5 Milestone 1, let's look at some more and some slightly subtle changes in the upcoming 6.5 release, when creating new modules (i.e., plugins). I'm using a build from earlier today, you won't find much of what I describe here in earlier builds.

So, first, as always, we start up the New Module wizard. Look, our first change. A checkbox allowing you to enable/disable creating of the layer.xml file, which solves the problem introduced in 6.1 where the problem of modules with empty layer.xml files was solved by not prefilling the XML Layer field, which caused the problem where many people accidentally didn't create it even when they needed it and were confused later:

OK. Now let's create a new window. We use the New Window Component wizard and see a new checkbox, which I've mentioned before but which I will demonstrate in this blog entry. It is called "Keep preferred size when slided-in":

Select it and then click Finish. In the generated TopComponent constructor you'll find this line:

putClientProperty("netbeans.winsys.tc.keep_preferred_size_when_slided_in", Boolean.TRUE);

However, if the selected "Window Position" was "editor", which cannot be slided-in (i.e., minimized), then the above checkbox cannot be selected:

However, look at the generated files:

Where's the Action class? Not there! So how will you open the window? Before, the IDE always generated an action class and registered it in the layer.xml file. This time however, i.e., from 6.5 M2 onwards, you'll see the action declared in the layer file, without being present in your code at all (although you could continue doing things as before, just the wizard won't generate the old code for you):

<folder name="Actions">
<folder name="Window">
<file name="org-netbeans-modules-demo-DemoAction.instance">
<attr name="SystemFileSystem.localizingBundle" stringvalue="org.netbeans.modules.demo.Bundle"/>
<attr name="component" methodvalue="org.netbeans.modules.demo.DemoTopComponent.findInstance"/>
<attr name="displayName" bundlevalue="org.netbeans.modules.demo.Bundle#CTL_DemoAction"/>
<attr name="instanceCreate" methodvalue="org.openide.windows.TopComponent.openAction"/>
<folder name="Menu">
<folder name="Window">
<file name="DemoAction.shadow">
<attr name="originalFile" stringvalue="Actions/Window/org-netbeans-modules-demo-DemoAction.instance"/>
<folder name="Windows2">
<folder name="Components">
<file name="DemoTopComponent.settings" url="DemoTopComponentSettings.xml"/>
<folder name="Modes">
<folder name="navigator">
<file name="DemoTopComponent.wstcref" url="DemoTopComponentWstcref.xml"/>

Look at the above tags carefully and see how the definition of the actions class is handled within the layer.xml file itself, which kind of reminds me of how things are done in Spring RCP.

Finally, when you install the module, you'll see the "Demo" menu item as before and you'll also see that when the window is slided-in (i.e., minimized), its size is now determined by its preferred size property, which means you have control over it for the first time:

There are other related changes too, which I'll discuss soon.

Join the discussion

Comments ( 1 )
  • Varun Wednesday, July 16, 2008


Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.