Search in sources :

Example 1 with CPluginsReloadAction

use of com.google.security.zynamics.binnavi.Gui.MainWindow.ProjectTree.Actions.CPluginsReloadAction in project binnavi by google.

the class CAbstractMenuBuilder method createPluginsMenu.

/**
   * Creates the plugin menu.
   * 
   * @return The created menu.
   */
private JMenu createPluginsMenu() {
    final List<IMainWindowMenuPlugin> plugins = new ArrayList<IMainWindowMenuPlugin>();
    for (@SuppressWarnings("rawtypes") final IPlugin plugin : PluginInterface.instance().getPluginRegistry()) {
        if (plugin instanceof IMainWindowMenuPlugin) {
            plugins.add((IMainWindowMenuPlugin) plugin);
        }
    }
    final JMenu menu = new JMenu("Plugins");
    menu.setMnemonic('U');
    menu.add(CActionProxy.proxy(new CActionOpenScriptingDialog(getParent())));
    menu.add(CActionProxy.proxy(new CActionOpenLogConsole()));
    menu.addSeparator();
    menu.add(CActionProxy.proxy(new CPluginManagementAction(getParent())));
    menu.add(CActionProxy.proxy(new CPluginsReloadAction()));
    menu.addSeparator();
    for (final IMainWindowMenuPlugin plugin : plugins) {
        // ESCA-JAVA0166: Catch Exception because we are calling a plugin function.
        try {
            final List<JMenuItem> menus = plugin.extendPluginMenu();
            for (final JMenuItem m : menus) {
                menu.add(m);
            }
        } catch (final Exception exception) {
            CUtilityFunctions.logException(exception);
            final String innerMessage = "E00092: " + "Plugin caused an unexpected exception";
            final String innerDescription = CUtilityFunctions.createDescription(String.format("The plugin %s caused an unexpected exception.", plugin.getName()), new String[] { "The plugin contains a bug." }, new String[] { "The plugin probably behaves erroneously from this point on but it remains active" });
            NaviErrorDialog.show(getParent(), innerMessage, innerDescription, exception);
        }
    }
    return menu;
}
Also used : CActionOpenLogConsole(com.google.security.zynamics.binnavi.Gui.MainWindow.ProjectTree.Actions.CActionOpenLogConsole) ArrayList(java.util.ArrayList) IMainWindowMenuPlugin(com.google.security.zynamics.binnavi.API.plugins.IMainWindowMenuPlugin) IPlugin(com.google.security.zynamics.binnavi.api2.plugins.IPlugin) CPluginsReloadAction(com.google.security.zynamics.binnavi.Gui.MainWindow.ProjectTree.Actions.CPluginsReloadAction) CActionOpenScriptingDialog(com.google.security.zynamics.binnavi.Gui.MainWindow.ProjectTree.Actions.CActionOpenScriptingDialog) CPluginManagementAction(com.google.security.zynamics.binnavi.Gui.MainWindow.ProjectTree.Actions.CPluginManagementAction) JMenuItem(javax.swing.JMenuItem) JMenu(javax.swing.JMenu)

Aggregations

IMainWindowMenuPlugin (com.google.security.zynamics.binnavi.API.plugins.IMainWindowMenuPlugin)1 CActionOpenLogConsole (com.google.security.zynamics.binnavi.Gui.MainWindow.ProjectTree.Actions.CActionOpenLogConsole)1 CActionOpenScriptingDialog (com.google.security.zynamics.binnavi.Gui.MainWindow.ProjectTree.Actions.CActionOpenScriptingDialog)1 CPluginManagementAction (com.google.security.zynamics.binnavi.Gui.MainWindow.ProjectTree.Actions.CPluginManagementAction)1 CPluginsReloadAction (com.google.security.zynamics.binnavi.Gui.MainWindow.ProjectTree.Actions.CPluginsReloadAction)1 IPlugin (com.google.security.zynamics.binnavi.api2.plugins.IPlugin)1 ArrayList (java.util.ArrayList)1 JMenu (javax.swing.JMenu)1 JMenuItem (javax.swing.JMenuItem)1