如何在NetBeans平台中隐藏没有图层文件的菜单? [英] How do I hide menus without a layer file in NetBeans Platform?
问题描述
我很难在NetBeans平台中自定义菜单.我所看到的示例要求您具有一个我不相信自己在NetBeans Platform Project中拥有的Layer文件.
I am having a hard time customizing my menus in the NetBeans Platform. The examples I've seen require you to have a Layer file which I don't believe I have in my NetBeans Platform Project.
要通过图层隐藏菜单,您应该执行以下操作:
To hide a menu via layers you are supposed to do this:
<folder name="Menu">
<folder name="View_hidden"/>
<folder name="Edit">
<file name="org-openide-actions-FindAction.shadow_hidden"/>
</folder>
</folder>
我想知道隐藏菜单的注释方式.但是,如果这是唯一的方法,那么我将图层文件放在哪里,我将其命名为什么?
I would like to know the annotation way of hiding menus. However, if this is the only way to do it, where would I put the layer file and what would i name it?
推荐答案
隐藏菜单项的唯一方法是将条目添加到图层文件中.要将图层文件添加到模块中,您需要
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
- 在模块的任何包中创建一个名为
layer.xml
的新xml文件 - 使用以下模式
OpenIDE-Module-Layer: com/example/layer.xml
将新的图层文件注册到模块清单文件中(在重要文件"节点下),其中com/example
是您在其中创建图层文件的程序包
- Create a new xml file called
layer.xml
in any package in your module - 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
wherecom/example
is the package that you created the layer file in
在layer.xml文件中,您需要以以下结构开始:
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>
添加_hidden节点的快捷方式
在模块中添加了图层文件后,您可以通过以下方式使NetBeans添加必要的_hidden
节点:
Once you've added a layer file to your module you can get NetBeans to add the necessary _hidden
nodes by:
- 在模块中扩展重要文件节点(任何模块都可以,但是如果/当此模块被卸载时,层文件也将被卸载)
- 扩展 XML层节点(一旦您如上所述手动添加了layer.xml文件,就会添加该节点)
- 在上下文中扩展此层节点
- 展开菜单栏节点
- 右键单击要隐藏的菜单项,然后选择删除"
- 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)
- Expand the XML Layer node (this is added once you've manually added the layer.xml file as above)
- Expand the this layer in context node
- Expand the Menu Bar node
- Right click the menu item you want to hide and select Delete
这篇关于如何在NetBeans平台中隐藏没有图层文件的菜单?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!