Changeset 13182


Ignore:
Timestamp:
2006-10-30T13:46:35+13:00 (18 years ago)
Author:
kjdon
Message:

placeSeparator() is now private and called from the constructor. also call ensureMetadataXMLPlugIsLoaded - GLI needs metadataXMLPlug to be in the collection to process metadata.xml files

File:
1 edited

Legend:

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

    r12808 r13182  
    8181        getElementAt(i);
    8282    }
    83 
     83   
    8484    // Create the separator, cause we can reuse it.
    8585    separator = getSeparator();
    86 
     86    placeSeparator();
     87    // check for MetadataXMLPlug
     88    ensureMetadataXMLPlugIsLoaded();
    8789    // Listen for CollectionContentsChanged events, so we can give plugin hints when new files are added
    8890    Gatherer.c_man.addCollectionContentsChangedListener(this);
    89     }
    90 
    91 
     91   
     92    }
     93
     94    private void ensureMetadataXMLPlugIsLoaded() {
     95
     96    Plugin metaxmlplug = Plugins.getPlugin("MetadataXMLPlug", false);
     97    if (metaxmlplug!= null) {
     98        if (!contains(metaxmlplug)) {
     99        // Create a new element in the DOM
     100        Element new_plugin_element = CollectionConfiguration.createElement(StaticStrings.PLUGIN_ELEMENT);
     101        new_plugin_element.setAttribute(StaticStrings.TYPE_ATTRIBUTE, metaxmlplug.getName());
     102        Plugin new_plugin = new Plugin(new_plugin_element, metaxmlplug);
     103        assignPlugin(new_plugin);
     104        }
     105    }
     106    }
    92107    /** Retrieve a list of the plugins that are available to be added to the collection. */
    93108    private Object[] getAvailablePlugins()
     
    311326    /** We attempt to place the separator between the unfixed and the fixed plugins. Since we only know of two fixed plugins, we search for either of them, and place the separator before them.
    312327     */
    313     public void placeSeparator() {
     328    private void placeSeparator() {
    314329    ///ystem.err.println("Placing separator.");
    315330    int separator_index = super.getSize();
     
    679694                remove.setEnabled(false);
    680695                }
     696                else if (plugin_name.equals(StaticStrings.METADATAXMLPLUG_STR)) {
     697                remove.setEnabled(false);
     698                }
     699               
    681700                else {
    682701                // don't let people remove special plugins such GAPlug an METSPlug,
Note: See TracChangeset for help on using the changeset viewer.