Ordering of NetBeans Platform Menu/Toolbar Positions

Since there's no annotation for setting the position of a menu/toolbar (but only for items within them), here's a quick and easy way to do it by combining a layer file with the standard annorations:

<folder name="Menu">
    <folder name="Analyzers">
        <attr intvalue="300" name="position"/>
    </folder>
</folder>

And now that the menu position is set, you can use the annotations exactly as before:

@ActionID(
    category = "Tools",
id = "de.damaico.connection.analyzer.AnalyzeConnectionsActionListener")
@ActionRegistration(
    iconBase = "de/damaico/connection/analyzer/customer.png",
displayName = "#CTL_AnalyzeConnectionsActionListener")
@ActionReferences({
    @ActionReference(path = "Menu/Analyzers", position = 0),
    @ActionReference(path = "Toolbars/Analyzers", position = 300)
})
@Messages("CTL_AnalyzeConnectionsActionListener=Analyze Connections")
public final class AnalyzeConnectionsActionListener implements ActionListener {

I.e., thanks to this tip (from Benno Markiewicz from Leipzig), you get the best of both worlds.

There's also a related patch in Issuezilla by Ernest Lotter. The patch creates a new annotation for registering menu positions:

http://netbeans.org/bugzilla/show_bug.cgi?id=203556

Comments:

would like to see the issues fixed:http://tomaszdziurko.pl/2010/04/my-first-tdd-or-why-netbeans-sucks/#more-225

Posted by guest on September 22, 2012 at 09:54 AM PDT #

"Hello, good evening. Would I need to create a new layer.xml file for this? I asked since everything in the build folder is recreated for clean and build and without cleaning I am still not able to see any form of changes."

Posted by guest on June 26, 2013 at 10:20 PM PDT #

Yes, you need to create your own layer.xml file for this.

Posted by Geertjan on June 26, 2013 at 11:24 PM PDT #

OK, thanks for the clarification.

Posted by Winnifred777 on June 27, 2013 at 09:51 AM 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
« April 2014
SunMonTueWedThuFriSat
  
12
13
14
24
25
26
27
28
29
30
   
       
Today