Ignore:
Timestamp:
2009-01-12T11:40:15+13:00 (15 years ago)
Author:
kjdon
Message:

updated the rtl-gli branch with files from trunk. Result of a merge 14807:18318, and fixed some conflicts. I think this is the last commit following merging the files. Haven't tried to compile yet... here goes...

File:
1 edited

Legend:

Unmodified
Added
Removed
  • gli/branches/rtl-gli/src/org/greenstone/gatherer/gui/Preferences.java

    r18297 r18364  
    731731    public void actionPerformed(ActionEvent event)
    732732    {
     733        // Several options requiring restarting the GLI to apply:
     734        // interface font, interface language, changed gliserver url or library url
     735        boolean restart_required = false;
     736        String restart_message = "";
     737
     738       
    733739        // Connection preferences
    734740        String program_str = program_field.getText();
     
    738744        Configuration.setPreviewCommand(program_str);
    739745
     746        String old_library_url = (Configuration.library_url == null) ? null : Configuration.library_url.toString();
    740747        String library_url_string = library_path_field.getText();
     748        if(old_library_url != null && !old_library_url.equals(library_url_string)) {
     749
     750        // If the server is remote and the library path's been changed, then GLI client needs restart
     751        // If the server is local, GLI is going to work with the collection of GSDLPath anyway,
     752        // even if the library path for previewing has changed
     753        if (Gatherer.isGsdlRemote) {
     754            restart_required = true;
     755            restart_message = Dictionary.get("Preferences.General.Manual_Restart_Required");
     756        }
     757        if(Gatherer.c_man.getCollection() != null) {
     758            // if the gliserver url has changed while a collection is open,
     759            // close the open collection of the old library URL
     760            Gatherer.c_man.saveCollection();
     761            Gatherer.c_man.closeCollection();
     762            Configuration.setString("general.open_collection"+Configuration.gliPropertyNameSuffix(), true, "");
     763        }
     764        }
    741765        if (library_url_string.equals("")) {
    742766        Configuration.library_url = null;
     
    750774        }
    751775        }
    752         Configuration.setString("general.library_url", true, library_url_string);
     776
     777        Configuration.setString("general.library_url"+Configuration.gliPropertyNameSuffix(),
     778                    true, library_url_string);
    753779
    754780        if (Gatherer.isGsdlRemote && !Gatherer.GS3) {
     781        String old_gliserver_url = Configuration.gliserver_url.toString();
    755782        String gliserver_url_string = gliserver_url_field.getText();
     783        if(!old_gliserver_url.equals(gliserver_url_string)) {
     784            restart_required = true;
     785            restart_message = Dictionary.get("Preferences.General.Manual_Restart_Required");
     786
     787            if(Gatherer.c_man.getCollection() != null) {
     788            // if the gliserver url has changed while a collection is open,
     789            // close the open collection of the old gliserver URL
     790            Gatherer.c_man.saveCollection();
     791            Gatherer.c_man.closeCollection();
     792            Configuration.setString("general.open_collection"+Configuration.gliPropertyNameSuffix(), true, "");
     793            }
     794        }
    756795        if (gliserver_url_string.equals("")) {
    757796            Configuration.gliserver_url = null;
     
    767806        Configuration.setString("general.gliserver_url", true, gliserver_url_string);
    768807        }
     808       
    769809
    770810        boolean site_changed = false;
     
    777817        Configuration.setSiteAndServlet(new_site, (String)servlet_combobox.getSelectedItem());
    778818        }
    779 
     819       
    780820        Configuration.set("general.use_proxy", true, use_proxy_checkbox.isSelected());
    781821        Configuration.setString("general.proxy_host", true, proxy_host_field.getText());
     
    788828        Configuration.set("general.view_extracted_metadata", Configuration.COLLECTION_SPECIFIC, view_extracted_metadata_checkbox.isSelected());
    789829
    790         // Two options requiring restarting the GLI to apply: interface font, and interface language
    791         boolean restart_required = false;
    792830
    793831        // GLI interface font
     
    796834        Configuration.setString("general.font", true, font_field.getText());
    797835        restart_required = true;
     836        restart_message = Dictionary.get("Preferences.General.Restart_Required");
    798837        }
    799838
     
    803842        Configuration.setLocale("general.locale", Configuration.GENERAL_SETTING, ((DictionaryEntry) language_combobox.getSelectedItem()).getLocale());
    804843        restart_required = true;
     844        restart_message = Dictionary.get("Preferences.General.Restart_Required");
    805845        }
    806846
    807847        // Inform the user that a restart is required, if necessary
    808848        if (restart_required) {
    809         JOptionPane.showMessageDialog(Gatherer.g_man, Dictionary.get("Preferences.General.Restart_Required"), Dictionary.get("General.Warning"), JOptionPane.WARNING_MESSAGE);
     849        JOptionPane.showMessageDialog(Gatherer.g_man, restart_message, Dictionary.get("General.Warning"), JOptionPane.WARNING_MESSAGE);
    810850        }
    811851
     
    845885        if (Gatherer.GS3 && site_changed && Gatherer.c_man.getCollection() != null && !Gatherer.isGsdlRemote) {
    846886        // shut down the collection
    847         System.err.println("shutting down teh collection");
     887        System.err.println("shutting down the collection");
    848888        Gatherer.g_man.saveThenCloseCurrentCollection();
    849889        }
     
    867907        Configuration.save();
    868908        if (Gatherer.isGsdlRemote && Gatherer.GS3 && site_changed ){
    869         RemoteGreenstoneServer.downloadCollectionConfigurations();
     909        Gatherer.remoteGreenstoneServer.downloadCollectionConfigurations();
    870910        }
    871911        // Refresh the GLI to account for the configuration changes
     
    9971037            if (Gatherer.c_man.getCollection()!=null){
    9981038            File lock_file = new File(Gatherer.c_man.getLoadedCollectionDirectoryPath() + "gli.lck");
    999             RemoteGreenstoneServer.deleteCollectionFile(Gatherer.c_man.getLoadedCollectionName(),lock_file);
     1039            Gatherer.remoteGreenstoneServer.deleteCollectionFile(Gatherer.c_man.getLoadedCollectionName(),lock_file);
    10001040            Gatherer.g_man.closeCurrentCollection();
    10011041            }
    10021042            Configuration.site_name=site;
    1003             RemoteGreenstoneServer.set_remote_greenstone_server_authentication_to_null();
    1004             RemoteGreenstoneServer.downloadCollectionConfigurations();
     1043            Gatherer.remoteGreenstoneServer.set_remote_greenstone_server_authentication_to_null();
     1044            Gatherer.remoteGreenstoneServer.downloadCollectionConfigurations();
    10051045        }
    10061046        }
Note: See TracChangeset for help on using the changeset viewer.