How do I hide menus without a layer file in NetBeans Platform?

点点圈 提交于 2019-12-02 02:25:40

The only way to hide menu items is to add the entries to your layer file. To add a layer file to your module you'll need to

  1. Create a new xml file called layer.xml in any package in your module
  2. Register the new layer file in your Module Manifest file (under the Important Files node) using the following pattern OpenIDE-Module-Layer: com/example/layer.xml where com/example is the package that you created the layer file in

In the layer.xml file you'll need to start with the following structure:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.2//EN" "http://www.netbeans.org/dtds/filesystem-1_2.dtd">
<filesystem>
</filesystem>

Shortcut for adding the _hidden nodes

Once you've added a layer file to your module you can get NetBeans to add the necessary _hidden nodes by:

  1. Expand the Important Files node in your module (any module will do but if/when this module is uninstalled then the layer file is also uninstalled)
  2. Expand the XML Layer node (this is added once you've manually added the layer.xml file as above)
  3. Expand the this layer in context node
  4. Expand the Menu Bar node
  5. Right click the menu item you want to hide and select Delete
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!