How can I change the contents of a menu according to the selected file in the editor?
Note: These pages are being reviewed.
https://bitbucket.org/jglick/dynamicmenudemo/ also does something similar.
Can I hide or show a whole menu or toolbar?
To hide a menu or toolbar you have to edit your
layer.xml and append
_hidden to the name of the desired menu or toolbar. You may also hide
<syntaxhighlight lang="xml" enclose="div" highlight="6"> <folder name="Menu">
<!-- Hide View menu --> <folder name="View_hidden"/> <folder name="SomeMenu"> <!-- Hide a single menu item --> <file name="SomeAction.instance_hidden"/> </folder>
</folder> <folder name="Toolbars">
<!-- Hide Edit toolbar --> <folder name="Edit_hidden"/>
</folder> </syntaxhighlight >
It’s generally much easier to do this from the NetBeans IDE, as described here.
Note that to hide the Navigate menu one has to declare GoTo_hidden instead of Navigate_hidden (the menu was originally named GoTo, but was later renamed to Navigate by the means of Bundle.properties).