Ignore:
Timestamp:
2014-04-24T21:34:33+12:00 (10 years ago)
Author:
ak19
Message:

First commit for GLI part of GS2 to GS3 Format Conversion. Contains all the changes needed for the FormatConversionDialog to work, and some cosmetic changes to cdm.Format4gs3Manager.java. Still need to implement undo and redo and think about what needs to happen and how for Remote GS3.

File:
1 edited

Legend:

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

    r23238 r28995  
    4343import org.greenstone.gatherer.shell.GShellListener;
    4444import org.greenstone.gatherer.shell.GShellProgressMonitor;
     45
    4546
    4647/** A dialog which provides a straight-forward access to the currently installed collections. It also will contain the ability to continue through to the original OpenCollectionDialog if your source collection is located somewhere other than the gsdl collect folder. */
     
    399400        process.run(); // Don't bother threading this... yet
    400401       
    401         collect_cfg_file.delete();
    402         build_cfg_file.delete();
     402        // From now, won't dangerously delete GS2 collect and build config files anymore
     403        //collect_cfg_file.delete();
     404        //build_cfg_file.delete();
     405
     406        File collect_bak_file = new File(collection_folder.getAbsolutePath() + File.separator + "etc" + File.separator + "collect.cfg.bak");
     407        File build_bak_file = new File(collection_folder.getAbsolutePath() + File.separator+"index" + File.separator + "build.cfg.bak");
     408        if(!collect_cfg_file.renameTo(collect_bak_file)) {
     409            System.err.println("Unable to move collect.cfg to " + collect_bak_file);
     410        }
     411        if(!build_cfg_file.renameTo(build_bak_file)) {
     412            System.err.println("Unable to move build.cfg to " + build_bak_file);
     413        }
    403414        }
    404415    }
     
    415426        //****************
    416427        File collect_cfg_file = collection_configuration.getFile(); // returns the collect.cfg file
    417         File etc_folder = collect_cfg_file.getParentFile();
    418         File collection_folder = etc_folder.getParentFile();
    419         filename = collection_folder.getAbsolutePath() + File.separator + "gli.col";
    420         collection_folder = null;
    421         etc_folder = null;
    422         collect_cfg_file = null;
    423         collection_configuration = null;
     428        result = FormatConversionDialog.checkForGS2FormatStatements(collect_cfg_file);
     429        if(result == OK_OPTION) { // either there were no gs2 format stmts or user chose to proceed
     430            File etc_folder = collect_cfg_file.getParentFile();
     431            File collection_folder = etc_folder.getParentFile();
     432            filename = collection_folder.getAbsolutePath() + File.separator + "gli.col";
     433            collection_folder = null;
     434            etc_folder = null;
     435            collect_cfg_file = null;
     436            collection_configuration = null;
     437        }
    424438        OpenCollectionDialog.this.dispose();
    425439        }
    426440
    427         Gatherer.collectDirectoryHasChanged(Gatherer.getCollectDirectoryPath(),
     441        if(result == OK_OPTION) {
     442        Gatherer.collectDirectoryHasChanged(Gatherer.getCollectDirectoryPath(),
    428443                newCollectPath, Gatherer.g_man.getContentPane());
    429444            // will tell the server that the collect directory has changed and that
    430445            // the workspace needs to be refreshed (Documents in Greenstone Collections)
     446        }
    431447    }
    432448    }
Note: See TracChangeset for help on using the changeset viewer.