-
Notifications
You must be signed in to change notification settings - Fork 1
DevFaqSwitchingMenusByContext
-
Create your action and let it implement Presenter.Menu
-
Return a special
JMenuItem
subclass that implements DynamicMenuContent fromgetMenuPresenter()
-
Implement DynamicMenuContent methods to return the desired menu content, using TopComponent.Registry for finding the selected file in the editor.
https://bitbucket.org/jglick/dynamicmenudemo/ also does something similar.
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 *.instance
files.
<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).
The content in this page was kindly donated by Oracle Corp. to the Apache Software Foundation.
This page was exported from http://wiki.netbeans.org/DevFaqSwitchingMenusByContext , that was last modified by NetBeans user Jglick on 2011-12-14T00:20:23Z.
NOTE: This document was automatically converted to the AsciiDoc format on 2018-01-26, and needs to be reviewed.
Apache NetBeans is an effort undergoing incubation at The Apache Software Foundation (ASF).
Incubation is required of all newly accepted projects until a further review indicates that the infrastructure, communications, and decision making process have stabilized in a manner consistent with other successful ASF projects.
While incubation status is not necessarily a reflection of the completeness or stability of the code, it does indicate that the project has yet to be fully endorsed by the ASF.
This wiki is an experiment pending Apache NetBeans Community approval.