Geertjan's Blog

  • August 16, 2009

Farewell New Action wizard!

Geertjan Wielenga
Product Manager
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.

Join the discussion

Comments ( 8 )
  • hantsy Monday, August 17, 2009

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

  • Geertjan Monday, August 17, 2009

    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...

  • hantsy Tuesday, August 18, 2009

    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.

  • Geertjan Wielenga Tuesday, August 18, 2009

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


  • Geertjan Wielenga Tuesday, August 18, 2009

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

  • eclesia Friday, September 4, 2009

    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.

  • acne information Saturday, September 19, 2009

    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 ?

  • name Tuesday, March 1, 2011

    Jesus Geertjan those are fighting words to some people.

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

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