Changeset 6168


Ignore:
Timestamp:
2003-12-08T17:02:31+13:00 (20 years ago)
Author:
jmt12
Message:

Had forgotten to exclude the current collection when searching for title clashes

Location:
trunk/gli/src/org/greenstone/gatherer
Files:
2 edited

Legend:

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

    r6152 r6168  
    372372        String title = name_textfield.getText();
    373373        // I just happen to have a handy method in the new details prompt to detect this very thing
    374         if(NewCollectionDetailsPrompt.titleClashes(title)) {
     374        if(NewCollectionDetailsPrompt.titleClashes(title, CollectionDesignManager.collect_config.getFile())) {
    375375            // Determine if the user wants to be warned about this
    376376            WarningDialog dialog = new WarningDialog("warning.TitleClashes", true);
  • trunk/gli/src/org/greenstone/gatherer/gui/NewCollectionDetailsPrompt.java

    r6159 r6168  
    4545    extends ModalDialog {
    4646
    47     static public boolean titleClashes(String title) {
     47    static public boolean titleClashes(String title, File current_config_file) {
    4848    File collection_directory = new File(Utility.getCollectionDir(Gatherer.config.gsdl_path));
    4949    File children[] = collection_directory.listFiles();
    5050    for(int i = 0; children != null && i < children.length; i++) {
    5151        if(children[i].isDirectory()) {
    52         BasicCollectionConfiguration other_collection = new BasicCollectionConfiguration(new File(children[i], Utility.CONFIG_DIR));
    53         if(other_collection.getName().equalsIgnoreCase(title)) { 
    54             return true;
     52        File config_file = new File(children[i], Utility.CONFIG_DIR);
     53        if(current_config_file == null || !config_file.equals(current_config_file)) {
     54            BasicCollectionConfiguration other_collection = new BasicCollectionConfiguration(config_file);
     55            if(other_collection.getName().equalsIgnoreCase(title)) { 
     56            return true;
     57            }
     58            other_collection = null;
    5559        }
    56         other_collection = null;
     60        config_file = null;
    5761        }
    5862    }
     
    407411        // We must ensure that the collection title is unique. This is a pain in the nether regions as we are forced to load the collect.cfg of each other collection in turn looking for a conflicting title
    408412        else {
    409         if(titleClashes(title_final)) {
     413        if(titleClashes(title_final, null)) {
    410414            if(JOptionPane.showConfirmDialog(Gatherer.g_man, Dictionary.get("NewCollectionPrompt.Title_Clash"), Dictionary.get("General.Warning"), JOptionPane.OK_CANCEL_OPTION) == JOptionPane.NO_OPTION) {
    411415            title.setForeground(Gatherer.config.getColor("coloring.error_foreground", false));
Note: See TracChangeset for help on using the changeset viewer.