Does anyone know how to edit the menus shown in the skeleton created by the Netbeans platform?
Thanks in advance for the time you will spend trying to help me.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Preamble: the only way to edit menu items that are present in the platform is through one of your own modules. This means that in order to remove or rename a menu item in another module you must first add a module to your application. Your application is not itself a module but a (potential) collection of modules.
The simplest way to edit the menus for an NB Platform based application is the following:
Important FilesnodeXML Layernode (assuming the module has a layer file¹)This layer in contextnodeMenu BarnodeDeleteThis will add the necessary entries to your modules layer file (_hidden entry) and as long as this module is loaded these menus and menu items will not be loaded. If you want to restore an item in the future you can either remove the entry from the layer file or right-click the item and select
Restore.Edit
Here’s a method for renaming a menu item:
nameof “SystemFileSystem.localizingBundle”Branding...)Resource BundlestabThe name of the menu item will be located in this Bundle’s node. Just edit this and it will be changed in your application. The key here is to locate the Bundle that the menu item is named in.
Here’s a method for replacing a menu item’s action:
originalFilevalue (you’re only looking for the.instancedeclaration)²delegateattribute you can redefine what action is used for this menu itemThe point here is to override the menu item’s action definition in your layer file, replacing the action with your own. You can also use this technique to override the display name of the action but the Branding technique is simpler if you don’t need to replace the action as well.
¹If your module doesn’t have a layer file you’ll need to create one before you can use this technique. This requires that you create a
layer.xmlfile in one of your module’s packages. Then you need to register this file in your Modules Manifest file using the followingOpenIDE-Module-Layer: com/example/mymodule/layer.xml²For this step you can highlight the
.instancename of theoriginalValueattribute’s value and press Ctrl + F. For example, if theoriginalValueattribute’s value isActions/Window/org-netbeans-core-windows-actions-RecentViewListAction.instanceyou want to highlight only theorg-netbeans-core-windows-actions-RecentViewListAction.instancepart. The point here is to find where the action is defined (this part of the layer file is only adding the action to the menu).