Changeset 9341


Ignore:
Timestamp:
2005-03-09T14:16:49+13:00 (19 years ago)
Author:
mdewsnip
Message:

Changed to use the new ModalProgressPopup to prevent race conditions when opening locked collections.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gli/src/org/greenstone/gatherer/collection/CollectionManager.java

    r9166 r9341  
    731731    public void loadCollection(String collection_file_path)
    732732    {
     733    // Display a modal progress popup to indicate that the collection is being loaded
    733734    ModalProgressPopup load_collection_progress_popup = new ModalProgressPopup(Dictionary.get("CollectionManager.Loading_Collection"), Dictionary.get("CollectionManager.Loading_Collection_Please_Wait"));
    734     LoadCollectionTask load_collection_task = new LoadCollectionTask(collection_file_path, load_collection_progress_popup);
    735     load_collection_task.start();
    736     load_collection_progress_popup.display();  // Blocks, so must go *after* starting the task!
     735    load_collection_progress_popup.display();
     736
     737    // Load the collection on a separate thread so the progress bar updates correctly
     738    (new LoadCollectionTask(collection_file_path, load_collection_progress_popup)).start();
    737739    }
    738740
     
    753755    {
    754756        loadCollectionInternal(collection_file_path);
    755         load_collection_progress_popup.setVisible(false);
     757        load_collection_progress_popup.close();
    756758    }
    757759    }
     
    777779    }
    778780
    779     // Check that there is the collection configuration file available
     781    // Check that the collection configuration file is available
    780782    File collection_file = new File(location);
    781     // Ensure that the directory exists.
     783
     784    // Ensure that the directory exists
    782785    File collection_directory = collection_file.getParentFile();
    783     if (!collection_directory.exists()) {
    784         // we cant open this
    785         collection_directory = null;
     786    if (collection_directory == null || !collection_directory.exists()) {
     787        // We can't open this
     788        System.err.println("CollectionManager.loadCollection: No collection directory.");
    786789        return;
    787790    }
     791
    788792    File collection_config_file = new File(collection_directory, Utility.CONFIG_FILE);
    789793    if (!collection_config_file.exists()) {
    790         DebugStream.println("CollectionManager.loadCollection: No config file");
     794        System.err.println("CollectionManager.loadCollection: No config file.");
    791795        collection_directory = null;
    792796        collection_config_file = null;
Note: See TracChangeset for help on using the changeset viewer.