Changeset 6168
- Timestamp:
- 2003-12-08T17:02:31+13:00 (20 years ago)
- 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 372 372 String title = name_textfield.getText(); 373 373 // 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())) { 375 375 // Determine if the user wants to be warned about this 376 376 WarningDialog dialog = new WarningDialog("warning.TitleClashes", true); -
trunk/gli/src/org/greenstone/gatherer/gui/NewCollectionDetailsPrompt.java
r6159 r6168 45 45 extends ModalDialog { 46 46 47 static public boolean titleClashes(String title ) {47 static public boolean titleClashes(String title, File current_config_file) { 48 48 File collection_directory = new File(Utility.getCollectionDir(Gatherer.config.gsdl_path)); 49 49 File children[] = collection_directory.listFiles(); 50 50 for(int i = 0; children != null && i < children.length; i++) { 51 51 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; 55 59 } 56 other_collection= null;60 config_file = null; 57 61 } 58 62 } … … 407 411 // 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 408 412 else { 409 if(titleClashes(title_final )) {413 if(titleClashes(title_final, null)) { 410 414 if(JOptionPane.showConfirmDialog(Gatherer.g_man, Dictionary.get("NewCollectionPrompt.Title_Clash"), Dictionary.get("General.Warning"), JOptionPane.OK_CANCEL_OPTION) == JOptionPane.NO_OPTION) { 411 415 title.setForeground(Gatherer.config.getColor("coloring.error_foreground", false));
Note:
See TracChangeset
for help on using the changeset viewer.