I use the org.openide.awt.MenuBar(DataFolder) constructor to automatically build a MenuBar from actions registered in the layer.xml file:
org.openide.awt.MenuBar(DataFolder)
menuBar