Search in sources :

Example 1 with PluginConfigItem

use of com.google.security.zynamics.binnavi.config.PluginConfigItem in project binnavi by google.

the class PluginListBox method createPluginListModel.

/**
   * Creates the list model of the plugin list.
   *
   * @param registry The plugin registry from where the plugin information comes.
   * @param configFile Provides information about which plugins to load and which plugins to skip.
   * @param <T> The interface which is used by plugins to interface with
   *        com.google.security.zynamics.binnavi.
   * @return The list model created from the given arguments.
   */
private static <T> DefaultListModel<PluginItem<T>> createPluginListModel(final IPluginRegistry<com.google.security.zynamics.binnavi.api2.plugins.IPlugin<T>> registry, final ConfigManager configFile) {
    final DefaultListModel<PluginItem<T>> model = new DefaultListModel<PluginItem<T>>();
    final ArrayList<com.google.security.zynamics.binnavi.api2.plugins.IPlugin<T>> added = new ArrayList<com.google.security.zynamics.binnavi.api2.plugins.IPlugin<T>>();
    // which plugins to load in which order.
    for (final PluginConfigItem plugin : configFile.getGeneralSettings().getPlugins()) {
        final long guid = plugin.getGUID();
        addPluginIfLoaded(registry, model, guid, added);
        addPluginIfUnloaded(registry, model, guid, added);
    }
    // Make sure to add the plugins that are not yet mentioned in the XML file
    addUnmentionedPlugins(registry, model, added);
    return model;
}
Also used : ArrayList(java.util.ArrayList) DefaultListModel(javax.swing.DefaultListModel) PluginConfigItem(com.google.security.zynamics.binnavi.config.PluginConfigItem)

Example 2 with PluginConfigItem

use of com.google.security.zynamics.binnavi.config.PluginConfigItem in project binnavi by google.

the class PluginInitializer method initializeKnownPlugins.

/**
   * Loads the plugins that are configured in the configuration file.
   *
   * @param pluginInterface The plugin interface object that's given to all
   *        plugins.
   * @param registry Plugin registry that contains the plugins.
   * @param xmlPluginOrder The plugin load order as defined in the configuration
   *        file.
   * @param validatedPlugins The plugins recognized in the plugins directory.
   * @param initializedPlugins If a plugin initialization is successful, the
   *        plugin is added to this list.
   * @param processedPlugins After this function, the GUIDs of all configured
   *        plugins are stored in this list.
   * @param <T> The interface which is used by plugins to interface with
   *        BinNavi.
   */
private static <T> void initializeKnownPlugins(final T pluginInterface, final IPluginRegistry<IPlugin<T>> registry, final List<PluginConfigItem> xmlPluginOrder, final List<Pair<IPlugin<T>, PluginStatus>> validatedPlugins, final List<Pair<IPlugin<T>, Exception>> initializedPlugins, final Set<Long> processedPlugins) {
    for (final PluginConfigItem pt : xmlPluginOrder) {
        processedPlugins.add(pt.getGUID());
        final IPlugin<T> plugin = findPlugin(validatedPlugins, pt.getGUID());
        if (plugin != null) {
            if (pt.isLoad()) {
                initializePlugin(plugin, pluginInterface, registry, initializedPlugins);
            } else {
                registry.addDisabledPlugin(plugin, DisabledPluginReason.NotLoaded);
            }
        }
    }
}
Also used : PluginConfigItem(com.google.security.zynamics.binnavi.config.PluginConfigItem)

Example 3 with PluginConfigItem

use of com.google.security.zynamics.binnavi.config.PluginConfigItem in project binnavi by google.

the class PluginRegistry method addPlugin.

@Override
public void addPlugin(final IPlugin<IPluginInterface> plugin) {
    verifyPluginToAdd(plugin);
    for (final PluginConfigItem pluginType : ConfigManager.instance().getGeneralSettings().getPlugins()) {
        // not load the plugin.
        if ((pluginType.getGUID() == plugin.getGuid()) && !pluginType.isLoad()) {
            addDisabledPlugin(plugin, DisabledPluginReason.NotLoaded);
            return;
        }
    }
    plugins.add(plugin);
}
Also used : PluginConfigItem(com.google.security.zynamics.binnavi.config.PluginConfigItem)

Aggregations

PluginConfigItem (com.google.security.zynamics.binnavi.config.PluginConfigItem)3 ArrayList (java.util.ArrayList)1 DefaultListModel (javax.swing.DefaultListModel)1