Changeset 9334


Ignore:
Timestamp:
2005-03-09T12:05:40+13:00 (19 years ago)
Author:
mdewsnip
Message:

Improved previous change so the GLI won't completely crap out if an exception happens while adding/replacing/removing metadata.

File:
1 edited

Legend:

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

    r9331 r9334  
    553553    public void run()
    554554    {
    555         // Edit metadata.xml files to add the metadata
    556         MetadataXMLFileManager.addMetadata(file_nodes, metadata_value);
    557 
    558         // Update the metadata value table and tree
    559         metadata_edit_event = true;
    560         metadata_value_table.rebuildAndSelectRowWithValueClosestTo(metadata_value);
    561         metadata_edit_event = false;
    562 
    563         // Operation finished, so turn busy cursor off
     555        try {
     556        // Edit metadata.xml files to add the metadata
     557        MetadataXMLFileManager.addMetadata(file_nodes, metadata_value);
     558
     559        // Update the metadata value table and tree
     560        metadata_edit_event = true;
     561        metadata_value_table.rebuildAndSelectRowWithValueClosestTo(metadata_value);
     562        metadata_edit_event = false;
     563        }
     564        catch (Exception exception) {
     565        // We need to catch any exceptions here so the interface is unlocked below
     566        DebugStream.printStackTrace(exception);
     567        }
     568
     569        // Operation finished, so turn busy cursor off and unlock interface
    564570        Gatherer.g_man.wait(false);
    565571    }
     
    581587    public void run()
    582588    {
    583         // Edit metadata.xml files to replace the metadata
    584         MetadataXMLFileManager.removeMetadata(file_nodes, selected_metadata_value_table_entry);
    585         MetadataXMLFileManager.addMetadata(file_nodes, metadata_value);
    586 
    587         // Update the metadata value table and tree
    588         metadata_edit_event = true;
    589         metadata_value_table.rebuildAndSelectRowWithValueClosestTo(metadata_value);
    590         metadata_edit_event = false;
    591 
    592         // Operation finished, so turn busy cursor off
     589        try {
     590        // Edit metadata.xml files to replace the metadata
     591        MetadataXMLFileManager.removeMetadata(file_nodes, selected_metadata_value_table_entry);
     592        MetadataXMLFileManager.addMetadata(file_nodes, metadata_value);
     593
     594        // Update the metadata value table and tree
     595        metadata_edit_event = true;
     596        metadata_value_table.rebuildAndSelectRowWithValueClosestTo(metadata_value);
     597        metadata_edit_event = false;
     598        }
     599        catch (Exception exception) {
     600        // We need to catch any exceptions here so the interface is unlocked below
     601        DebugStream.printStackTrace(exception);
     602        }
     603
     604        // Operation finished, so turn busy cursor off and unlock interface
    593605        Gatherer.g_man.wait(false);
    594606    }
     
    608620    public void run()
    609621    {
    610         // Edit metadata.xml files to remove the metadata
    611         MetadataXMLFileManager.removeMetadata(file_nodes, selected_metadata_value_table_entry);
    612 
    613         // Update the metadata value table and tree
    614         metadata_edit_event = true;
    615         metadata_value_table.rebuildAndSelectRowWithValueClosestTo(selected_metadata_value_table_entry);
    616         metadata_edit_event = false;
    617 
    618         // Operation finished, so turn busy cursor off
     622        try {
     623        // Edit metadata.xml files to remove the metadata
     624        MetadataXMLFileManager.removeMetadata(file_nodes, selected_metadata_value_table_entry);
     625
     626        // Update the metadata value table and tree
     627        metadata_edit_event = true;
     628        metadata_value_table.rebuildAndSelectRowWithValueClosestTo(selected_metadata_value_table_entry);
     629        metadata_edit_event = false;
     630        }
     631        catch (Exception exception) {
     632        // We need to catch any exceptions here so the interface is unlocked below
     633        DebugStream.printStackTrace(exception);
     634        }
     635
     636        // Operation finished, so turn busy cursor off and unlock interface
    619637        Gatherer.g_man.wait(false);
    620638    }
Note: See TracChangeset for help on using the changeset viewer.