简体   繁体   English

如何在NetBeans平台中打开插件管理器

[英]How can I open plugin manager in netbeans platform

I'm using "Netbeans platform 8.1" to develop a rich client application. 我正在使用“ Netbeans平台8.1”开发富客户端应用程序。 It has default menus and actions inside it. 它内部具有默认菜单和操作。 I want to hide "Menu/Tools/Plugins" and open the Plugin Window programmatically from my code. 我想隐藏“菜单/工具/插件”并以编程方式从我的代码中打开“插件窗口”。

My question is: if I hide the menu from "layer.xml" and change its name to "Plugin_hidden", how can I open that window programmatically? 我的问题是:如果我从“ layer.xml”中隐藏菜单并将其名称更改为“ Plugin_hidden”,如何以编程方式打开该窗口?

Use the following code. 使用以下代码。

    Action action = FileUtil.getConfigObject("Actions/System/org-netbeans-modules-autoupdate-ui-actions-PluginManagerAction.instance", Action.class);
    action.actionPerformed(new ActionEvent(this, ActionEvent.ACTION_PERFORMED, ""));

I determined the path for the action by expanding Important Files/XML Layer/<this layer in context>/Menu Bar/Tools under my project in the Projects window and double clicking on Plugins . 我通过在“项目”窗口中的项目下展开“ Important Files/XML Layer/<this layer in context>/Menu Bar/Tools ,并双击“ Plugins来确定操作的路径。 This will open a generated layer XML that contains the Plugin manager action. 这将打开一个包含插件管理器操作的生成的层XML。 From there you can figure out what the action path is. 从那里您可以找出操作路径。

If you don't have an XML Layer in important files, you can add an empty one using the New File wizard. 如果重要文件中没有XML层,则可以使用“新建文件”向导添加一个空的XML层。 Just select Module Development/XML Layer . 只需选择Module Development/XML Layer An XML layer isn't required for the above code to work; 上述代码不需要XML层; it just makes it possible to browse the available actions so that you can determine the path for the action. 它只是使浏览可用操作成为可能,以便您可以确定操作的路径。

For more information see DevFaqInvokeActionProgrammatically 有关更多信息,请参见以编程方式DevFaqInvokeAction

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM