Notes for NetBeans Platform 6.5 (Part 2)

Another change, comparable to the registration of the action class within the layer.xml that I showed yesterday, is the way in which actions that are "always enabled" will be created & registered in 6.5. In 6.5, if you make this selection in the New Action wizard:

...everything in the wizard will be the same as it always was. I.e., in the next panel, you'll specify where the "always enabled" action should appear and then, in the panel that appears after that, you will specify the name of the class and the package. However, when you complete the wizard, you will see that the generated class looks exactly like this:

package org.netbeans.modules.demo;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public final class MyWonderfulAction implements ActionListener {
    public void actionPerformed(ActionEvent e) {
       // TODO implement action body
    }
}

And this is how the class will have been registered in the layer.xml by the wizard:

<filesystem>
    <folder name="Actions">
        <folder name="Edit">
            <file name="org-netbeans-modules-demo-MyWonderfulAction.instance">
                <attr name="SystemFileSystem.localizingBundle" stringvalue="org.netbeans.modules.demo.Bundle"/>
                <attr name="delegate" newvalue="org.netbeans.modules.demo.MyWonderfulAction"/>
                <attr name="displayName" bundlevalue="org.netbeans.modules.demo.Bundle#CTL_MyWonderfulAction"/>
                <attr name="iconBase" stringvalue="org/netbeans/modules/demo/icon.png"/>
                <attr name="instanceCreate" methodvalue="org.openide.awt.Actions.alwaysEnabled"/>
                <attr name="noIconInMenu" stringvalue="false"/>
            </file>
        </folder>
    </folder>
    <folder name="Menu">
        <folder name="Edit">
            <file name="org-netbeans-modules-demo-MyWonderfulAction.shadow">
                <attr name="originalFile" stringvalue="Actions/Edit/org-netbeans-modules-demo-MyWonderfulAction.instance"/>
                <attr name="position" intvalue="100"/>
            </file>
        </folder>
    </folder>
</filesystem>

In other words, the "always enabled" action will, from 6.5 onwards, assuming you use the wizard, delegate to a plain old standard Java ActionListener class. And you will be able to focus on the purpose of the action within the class, while all the ancillary information is found within the layer.xml file (take special note of the new bundlevalue attribute), i.e., these properties are available even without the object having been instantiated. (You can go on using CallableSystemAction or AbstractAction if you want, but that's not code that the wizard will generate for you.)

However, while the situation where we don't have code completion in the layer.xml file continues, it will be hard to know exactly which attributes are available. (This has always been a problem, but is exacerbated now that even more is found in that file than before.) In that sense, we currently have better support for Spring RCP!

In other news. One of the current best blogs in the NetBeans world is the newish one by the NetBeans PHP development team: http://blogs.sun.com/netbeansphp/. The actual engineers in that team write that blog, with new developments as they happen. Bookmark it! One of the best blog entries I've seen (ever) in the software development world comes from there, click here to read it and see how immediate the interaction between users and engineers is and how directly one can impact the developments of the PHP team.

Comments:

I want to know is there any article or tutorial about developing projects in struts in Netbeans 6.1 with mysql as a database.

Posted by Hemanth on July 16, 2008 at 03:53 PM PDT #

Gj,

Feature looks cool, so I have to take care when I try to create Actions from scratch, like I did using NB 6.0 and 6.1 IDE's!

Platform is changing for good, and I can't wait to blog about it, enjoy!

Posted by Varun on July 16, 2008 at 06:40 PM PDT #

Is it possible to make the Always Enabled action formed as above run asynchronously?

When we "extends" CallableSystemAction, asynchronous() is overriden to return true/false depending on the scenario.

Btw, the current Action Wizard makes it so simple to create an action..

Posted by N, Varun on September 06, 2008 at 02:43 PM PDT #

Post a Comment:
  • HTML Syntax: NOT allowed
About

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.

Search

Archives
« July 2014
SunMonTueWedThuFriSat
  
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
  
       
Today