Changeset 19272


Ignore:
Timestamp:
2009-04-27T15:08:43+12:00 (15 years ago)
Author:
kjdon
Message:

made delete prompt handle collection groups

File:
1 edited

Legend:

Unmodified
Added
Removed
  • gli/trunk/src/org/greenstone/gatherer/gui/DeleteCollectionPrompt.java

    r18370 r19272  
    227227    File collect_directory = new File(Gatherer.getCollectDirectoryPath());
    228228    if (collect_directory.exists()) {
    229         // Now for each child directory see if it contains a .col file and
    230         // if so try to load it..
    231         File collections[] = collect_directory.listFiles();
    232         String file_name = (Gatherer.GS3)? Utility.CONFIG_GS3_FILE : Utility.CONFIG_FILE;
    233         ArrayTools.sort(collections);
    234         for(int i = 0; collections != null && i < collections.length; i++) {
    235         if(collections[i].isDirectory() && !collections[i].getName().equals(StaticStrings.MODEL_COLLECTION_NAME)) {
    236             File config_file = new File(collections[i], file_name);
    237             if (config_file.exists()) {
    238             BasicCollectionConfiguration config = new BasicCollectionConfiguration(config_file);
    239             list_model.addElement(config);
    240             config = null;
    241             }
    242         }
    243         }
    244     }
    245     // Otherwise the collect directory doesn't actually exist, so there ain't much we can do.
    246     }
     229      loadCollectionConfigs(collect_directory);
     230    }
     231    }
     232
     233  private void loadCollectionConfigs(File directory) {
     234    // For each child directory see if it contains an
     235    // etc/collect.cfg file and if so try to load it..
     236    File collections[] = directory.listFiles();
     237    String file_name = (Gatherer.GS3)? Utility.CONFIG_GS3_FILE : Utility.CONFIG_FILE;
     238    ArrayTools.sort(collections);
     239    for(int i = 0; collections != null && i < collections.length; i++) {
     240      if(collections[i].isDirectory() && !collections[i].getName().equals(StaticStrings.MODEL_COLLECTION_NAME)) {
     241    File config_file = new File(collections[i], file_name);
     242    if (config_file.exists()) {
     243      BasicCollectionConfiguration config = new BasicCollectionConfiguration(config_file);
     244      if (config.getCollectGroup().equals("true")) {
     245        loadCollectionConfigs(collections[i]);
     246      } else {
     247        list_model.addElement(config);
     248        config = null;
     249      }
     250    }
     251      }
     252    }
     253  }
     254 
    247255
    248256    /** A button listener implementation, which listens for actions on the close button and disposes of the dialog when detected. */
Note: See TracChangeset for help on using the changeset viewer.