Sunday August 16, 2009
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.
Aug 16 2009, 02:19:18 PM PDT Permalink
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 17, 2009 at 12:29 AM 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 17, 2009 at 12:38 AM 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.
hantsy, the icon story is MUCH more sophisticated than you describe. Read this for example:
http://netbeans.dzone.com/tips/icon-tip-netbeans-platform
Posted by Geertjan Wielenga on August 18, 2009 at 01:58 AM PDT #
And, if you want to use the 'Swing Application Framework', good luck and have fun!
Posted by Geertjan Wielenga on August 18, 2009 at 02:01 AM 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 04, 2009 at 04:09 AM 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 10:22 AM PDT #


