Changeset 12303 for trunk/gli/src/org


Ignore:
Timestamp:
2006-07-25T13:48:53+12:00 (18 years ago)
Author:
kjdon
Message:

made BasicSeparator a static class, removed some custom plugin code

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gli/src/org/greenstone/gatherer/cdm/PluginManager.java

    r12293 r12303  
    848848        Object selected_object = plugin_combobox.getSelectedItem();
    849849        if(selected_object != null) {
    850             // Retrieve the base plugin if any
     850            // Retrieve the base plugin
    851851            Plugin base_plugin = getBasePlugin(selected_object.toString());
    852 
     852            if (base_plugin == null) {
     853            // shouldn't happen
     854            return;
     855            }
     856           
    853857            // Create a new element in the DOM
    854858            Element element = CollectionDesignManager.collect_config.document.createElement(CollectionConfiguration.PLUGIN_ELEMENT);
     
    863867            plugin_list.setSelectedValue(new_plugin, true);
    864868            // Since we weren't cancelled, if we are in a low mode, remove the plugin from the available list (except for UnknownPlug
    865             if(base_plugin != null && Configuration.getMode() <= Configuration.SYSTEMS_MODE && !base_plugin.getName().equals(StaticStrings.UNKNOWNPLUG_STR)) {
     869            if(Configuration.getMode() <= Configuration.SYSTEMS_MODE && !base_plugin.getName().equals(StaticStrings.UNKNOWNPLUG_STR)) {
    866870                plugin_combobox.removeItem(base_plugin);
    867871                plugin_combobox.setSelectedIndex(0);
     
    11961200        Object selected_object = suitable_plugins_combobox.getSelectedItem();
    11971201        Plugin base_plugin = getBasePlugin(selected_object.toString());
    1198 
     1202        if (base_plugin == null) {
     1203            // shouldn't happen - we are not allowed custom plugins anymore
     1204            setVisible(false);
     1205            return;
     1206        }
    11991207        // Create a new element in the DOM
    12001208        Element element = CollectionDesignManager.collect_config.document.createElement(CollectionConfiguration.PLUGIN_ELEMENT);
    1201         // Remember that the plugin supplied might be a custom string rather than a base plugin
    1202         Plugin new_plugin = null;
    1203         if(base_plugin != null) {
    1204             //DebugStream.println("New Plugin based on existing Plugin");
    1205             element.setAttribute(CollectionConfiguration.TYPE_ATTRIBUTE, base_plugin.getName());
    1206             new_plugin = new Plugin(element, base_plugin);
    1207         }
    1208         else {
    1209             //DebugStream.println("New Custom Plugin");
    1210             element.setAttribute(CollectionConfiguration.TYPE_ATTRIBUTE, selected_object.toString());
    1211             new_plugin = new Plugin(element, null);
    1212         }
     1209        element.setAttribute(CollectionConfiguration.TYPE_ATTRIBUTE, base_plugin.getName());
     1210        Plugin new_plugin = new Plugin(element, base_plugin);
    12131211        assignPlugin(new_plugin);
    12141212        } // else do nothing
     
    12381236
    12391237    /** This class behaves just like a normal JSeparator except that, no matter what the current settings in the UIManager are, it always paints itself with BasicSeparatorUI. */
    1240     private class BasicSeparator
     1238    private static class BasicSeparator
    12411239    extends JSeparator {
    12421240
Note: See TracChangeset for help on using the changeset viewer.