简体   繁体   中英

How can I open plugin manager in netbeans platform

I'm using "Netbeans platform 8.1" to develop a rich client application. 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?

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 . This will open a generated layer XML that contains the Plugin manager action. 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. Just select Module Development/XML Layer . An XML layer isn't required for the above code to work; 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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