Search in sources :

Example 1 with SeqMonkParser

use of uk.ac.babraham.SeqMonk.DataParsers.SeqMonkParser in project SeqMonk by s-andrews.

the class SeqMonkApplication method loadProject.

public void loadProject(File file, boolean forceAssembly) {
    if (file == null)
        return;
    if (changesWereMade) {
        int answer = JOptionPane.showOptionDialog(this, "You have made changes which were not saved.  Do you want to save before exiting?", "Save before loading new data?", 0, JOptionPane.QUESTION_MESSAGE, null, new String[] { "Save before Loading", "Load without Saving", "Cancel" }, "Save");
        switch(answer) {
            case 0:
                fileToLoad = file;
                saveProject();
                return;
            case 1:
                break;
            case 2:
                return;
        }
    }
    SeqMonkPreferences.getInstance().setLastUsedSaveLocation(file);
    if (!forceAssembly) {
        wipeAllData();
    }
    currentFile = file;
    SeqMonkParser parser = new SeqMonkParser(this);
    parser.addProgressListener(this);
    ProgressDialog dppd = new ProgressDialog(this, "Loading data...");
    parser.addProgressListener(dppd);
    parser.parseFile(file, forceAssembly);
    dppd.requestFocus();
    setTitle("SeqMonk [" + file.getName() + "]");
    SeqMonkPreferences.getInstance().addRecentlyOpenedFile(file.getAbsolutePath());
}
Also used : ProgressDialog(uk.ac.babraham.SeqMonk.Dialogs.ProgressDialog.ProgressDialog) SeqMonkParser(uk.ac.babraham.SeqMonk.DataParsers.SeqMonkParser)

Aggregations

SeqMonkParser (uk.ac.babraham.SeqMonk.DataParsers.SeqMonkParser)1 ProgressDialog (uk.ac.babraham.SeqMonk.Dialogs.ProgressDialog.ProgressDialog)1