Farewell New Action wizard!

A picture speaks 1000 words:

This great blog entry by Jaroslav Tulach provides most of the info you need for something like the above, coupled with a trip through the NetBeans sources to see how other annotations, such as @ServiceProvider are defined. Together, that should be all you need.

It is by no means finished. For example, the display name should be referenced in the bundle, rather than hardcoded in the annotation. But there are already SO many benefits over the current situation. How about the code completion and Javadoc support for example:

It works exactly as shown, i.e., the above gets me a new menu item and toolbar button, i.e., without writing a single line in my layer file (i.e., I don't need the New Action wizard at all anymore). I plan to write a blog entry describing how I created the above annotation, in the next few days.


Why not move to the Swing Application Framework directly, it's provide more declarative way to process the UI information.

Posted by hantsy on August 16, 2009 at 05:29 PM PDT #

Because I prefer my application to be modular. I also like having a window system and a plugin system. To name just a handful of things. Oh, and also, the Swing Application Framework is dead and it should never have been born in the first place...

Posted by Geertjan on August 16, 2009 at 05:38 PM PDT #

Yes, I know NetBeans provide a module system, a window system. You are the expert of NetBeans platform, I believe.
I have used java in enterprise application for several years, but came to GUI recently, so I am a newbie to NetBeans platform.
But I have to say, many apis in NetBeans platform is not friendly. The action is a example. It is too dependent on hard code and without flexibility. For example, the icon is the path of image. NetBeans platform provide many prefix to path to identity and process different protocol. Why forget a resource protocol to process module resources, such as icon etc.. Let component search resource from the module scope to the global resource scope( NetBeans platform ). Then we will get a skinable icons mechanism for the NetBeans platform, and a module can reuse resources provide in NetBeans platform scope.
I do not known jsr296 is dead, but When read the some example of it, I found some concepts are better than NetBeans provided.

Posted by hantsy on August 17, 2009 at 06:41 PM PDT #

hantsy, the icon story is MUCH more sophisticated than you describe. Read this for example:

Posted by Geertjan Wielenga on August 17, 2009 at 06:58 PM PDT #

And, if you want to use the 'Swing Application Framework', good luck and have fun!

Posted by Geertjan Wielenga on August 17, 2009 at 07:01 PM PDT #

What happens if I make an additional module, and want to hide this action ? will it work if I try to remove it in the layer.xml ?
Personaly I don't like using anotation for those kind of things.

An action is an action that's all, mixing it with it's display environment is I believe a conception error. Same thing for services, I prefer editing an xml file or META-INF/services rather than searching all \*.java to find out who is service.

I would have much more appreciate a rich automatic completion for the layer.xml file.

Posted by eclesia on September 03, 2009 at 09:09 PM PDT #

What happens if I make an additional module, and want to hide this action ? will it work if I try to remove it in the layer.xml ?

Posted by acne information on September 19, 2009 at 03:22 AM PDT #

Jesus Geertjan those are fighting words to some people.

Just an observation. People in official positions are usually more circumspect, no?

Posted by name on March 01, 2011 at 09:23 AM PST #

Post a Comment:
  • HTML Syntax: NOT allowed

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.


« July 2016