Search in sources :

Example 1 with CNodeSelectionUpdater

use of com.google.security.zynamics.binnavi.Gui.MainWindow.ProjectTree.Updaters.CNodeSelectionUpdater in project binnavi by google.

the class CProjectContainerNodeMenuBuilder method createMenu.

@Override
protected void createMenu(final JComponent menu) {
    menu.add(new JMenuItem(CActionProxy.proxy(new CCreateProjectAction(getParent(), database, new CNodeSelectionUpdater(getProjectTree(), findNode())))));
    final List<IProjectFolderMenuPlugin> plugins = new ArrayList<IProjectFolderMenuPlugin>();
    for (final IPlugin<IPluginInterface> plugin : PluginInterface.instance().getPluginRegistry()) {
        if (plugin instanceof IProjectFolderMenuPlugin) {
            plugins.add((IProjectFolderMenuPlugin) plugin);
        }
    }
    if (!plugins.isEmpty()) {
        menu.add(new JSeparator());
        for (final IProjectFolderMenuPlugin plugin : plugins) {
            try {
                final List<JComponent> menuItems = plugin.extendProjectFolderMenu(getPluginDatabase());
                if (menuItems != null) {
                    for (final JComponent menuItem : menuItems) {
                        menu.add(menuItem);
                    }
                }
            } catch (final Exception exception) {
                CUtilityFunctions.logException(exception);
                final String innerMessage = "E00089: " + "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);
            }
        }
    }
}
Also used : IPluginInterface(com.google.security.zynamics.binnavi.api2.IPluginInterface) ArrayList(java.util.ArrayList) JComponent(javax.swing.JComponent) CCreateProjectAction(com.google.security.zynamics.binnavi.Gui.MainWindow.ProjectTree.Actions.CCreateProjectAction) JSeparator(javax.swing.JSeparator) IProjectFolderMenuPlugin(com.google.security.zynamics.binnavi.API.plugins.IProjectFolderMenuPlugin) CNodeSelectionUpdater(com.google.security.zynamics.binnavi.Gui.MainWindow.ProjectTree.Updaters.CNodeSelectionUpdater) JMenuItem(javax.swing.JMenuItem)

Aggregations

IProjectFolderMenuPlugin (com.google.security.zynamics.binnavi.API.plugins.IProjectFolderMenuPlugin)1 CCreateProjectAction (com.google.security.zynamics.binnavi.Gui.MainWindow.ProjectTree.Actions.CCreateProjectAction)1 CNodeSelectionUpdater (com.google.security.zynamics.binnavi.Gui.MainWindow.ProjectTree.Updaters.CNodeSelectionUpdater)1 IPluginInterface (com.google.security.zynamics.binnavi.api2.IPluginInterface)1 ArrayList (java.util.ArrayList)1 JComponent (javax.swing.JComponent)1 JMenuItem (javax.swing.JMenuItem)1 JSeparator (javax.swing.JSeparator)1