- Timestamp:
- 2005-05-03T13:28:34+12:00 (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/gui/GUIManager.java
r9800 r9801 181 181 } 182 182 else if (esrc == menu_bar.file_open) { 183 if (showLoadCollectionBox()) { 184 tab_pane.setSelectedComponent(gather_pane); 183 String collection_file_path = showOpenCollectionDialog(); 184 185 // User has selected a collection to open 186 if (collection_file_path != null) { 187 // If there is already a collection open, save and close it 188 if (Gatherer.c_man.ready()) { 189 tab_pane.setSelectedComponent(gather_pane); // Must be done before closing the collection 190 Gatherer.c_man.saveCollection(); 191 Gatherer.c_man.closeCollection(); 192 } 193 194 // Open the selected collection 195 Gatherer.c_man.loadCollection(collection_file_path); 185 196 } 186 197 } … … 619 630 } 620 631 632 621 633 /** When the load collection option is choosen this method is called to produce the modal file load prompt. 622 634 */ 623 private boolean showLoadCollectionBox() {624 boolean result = false; 635 private String showOpenCollectionDialog() 636 { 625 637 // We first try the simple open collection dialog 626 638 SimpleOpenCollectionDialog dialog = new SimpleOpenCollectionDialog(); 627 639 int user_choice = dialog.display(); 628 String filename = null; 629 // The user may choose to go to the advanced 'browse' dialog 630 if(user_choice == SimpleOpenCollectionDialog.OK_OPTION) { 631 filename = dialog.getFileName(); 632 } 633 else if(user_choice == SimpleOpenCollectionDialog.BROWSE_OPTION) { 640 641 // Used simple collection list 642 if (user_choice == SimpleOpenCollectionDialog.OK_OPTION) { 643 return dialog.getFileName(); 644 } 645 646 // Chosen to use the advanced 'browse' dialog 647 if (user_choice == SimpleOpenCollectionDialog.BROWSE_OPTION) { 634 648 File collect_directory; 635 649 if (Gatherer.GS3) { … … 640 654 } 641 655 OpenCollectionDialog chooser = new OpenCollectionDialog(collect_directory); 642 filename = chooser.getFileName(); 643 chooser.destroy(); 644 chooser = null; 645 } 646 dialog.destroy(); 647 dialog = null; 648 // User can cancel action. 649 if(filename != null) { 650 // If there is already a collection open, save and close it. 651 if (Gatherer.c_man.ready()) { 652 Gatherer.c_man.saveCollection(); 653 Gatherer.c_man.closeCollection(); 654 } 655 656 Gatherer.c_man.loadCollection(filename); 657 658 filename = null; 659 } 660 return result; 656 return chooser.getFileName(); 657 } 658 659 // User must have cancelled the action 660 return null; 661 661 } 662 662
Note:
See TracChangeset
for help on using the changeset viewer.