Search in sources :

Example 1 with DefaultPriorTableDialog

use of dr.app.beauti.priorsPanel.DefaultPriorTableDialog in project beast-mcmc by beast-dev.

the class BeautiFrame method doGenerate.

public final boolean doGenerate() {
    try {
        generator.checkOptions();
    } catch (Generator.GeneratorException ge) {
        ge.printStackTrace(System.err);
        JOptionPane.showMessageDialog(this, ge.getMessage(), "Invalid BEAUti setting : ", JOptionPane.ERROR_MESSAGE);
        if (ge.getSwitchToPanel() != null) {
            switchToPanel(ge.getSwitchToPanel());
        }
        return false;
    }
    DefaultPriorTableDialog defaultPriorDialog = new DefaultPriorTableDialog(this);
    if (!defaultPriorDialog.showDialog(options)) {
        return false;
    }
    File file = selectExportFile("Generate BEAST XML File...", new FileNameExtensionFilter("BEAST XML File", "xml", "beast"));
    if (file != null) {
        try {
            getAllOptions();
            generator.generateXML(file);
        } catch (IOException ioe) {
            ioe.printStackTrace(System.err);
            JOptionPane.showMessageDialog(this, "Unable to generate file due to I/O issue: " + ioe.getMessage(), "Unable to generate file", JOptionPane.ERROR_MESSAGE);
            return false;
        } catch (Generator.GeneratorException e) {
            e.printStackTrace(System.err);
            JOptionPane.showMessageDialog(this, "The BEAST XML is incomplete because :\n" + e.getMessage(), "The BEAST XML is incomplete", JOptionPane.ERROR_MESSAGE);
            return false;
        } catch (Exception e) {
            e.printStackTrace(System.err);
            JOptionPane.showMessageDialog(this, "Unable to generate file: " + e.getMessage(), "Unable to generate file", JOptionPane.ERROR_MESSAGE);
            return false;
        }
        clearDirty();
        return true;
    }
    return false;
}
Also used : DefaultPriorTableDialog(dr.app.beauti.priorsPanel.DefaultPriorTableDialog) FileNameExtensionFilter(javax.swing.filechooser.FileNameExtensionFilter) JDOMException(org.jdom.JDOMException) ImportException(dr.evolution.io.Importer.ImportException) MissingBlockException(dr.evolution.io.NexusImporter.MissingBlockException) Generator(dr.app.beauti.generator.Generator) BeastGenerator(dr.app.beauti.generator.BeastGenerator)

Aggregations

BeastGenerator (dr.app.beauti.generator.BeastGenerator)1 Generator (dr.app.beauti.generator.Generator)1 DefaultPriorTableDialog (dr.app.beauti.priorsPanel.DefaultPriorTableDialog)1 ImportException (dr.evolution.io.Importer.ImportException)1 MissingBlockException (dr.evolution.io.NexusImporter.MissingBlockException)1 FileNameExtensionFilter (javax.swing.filechooser.FileNameExtensionFilter)1 JDOMException (org.jdom.JDOMException)1