如何在NetBeans平台中隐藏没有图层文件的菜单? [英] How do I hide menus without a layer file in NetBeans Platform?

查看:111
本文介绍了如何在NetBeans平台中隐藏没有图层文件的菜单?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很难在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

  1. 在模块的任何包中创建一个名为layer.xml的新xml文件
  2. 使用以下模式OpenIDE-Module-Layer: com/example/layer.xml将新的图层文件注册到模块清单文件中(在重要文件"节点下),其中com/example是您在其中创建图层文件的程序包
  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

在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:

  1. 在模块中扩展重要文件节点(任何模块都可以,但是如果/当此模块被卸载时,层文件也将被卸载)
  2. 扩展 XML层节点(一旦您如上所述手动添加了layer.xml文件,就会添加该节点)
  3. 在上下文中扩展此层节点
  4. 展开菜单栏节点
  5. 右键单击要隐藏的菜单项,然后选择删除"
  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

这篇关于如何在NetBeans平台中隐藏没有图层文件的菜单?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆