11package morphmodels .app .beauti ;
22
3+
34import beast .base .core .Description ;
45import beast .base .core .ProgramStatus ;
56
67import java .io .File ;
78import java .util .*;
89
9- import javax .swing .JFileChooser ;
10- import javax .swing .JOptionPane ;
1110
1211import beastfx .app .inputeditor .BeautiAlignmentProvider ;
1312import beastfx .app .inputeditor .BeautiDoc ;
13+ import beastfx .app .util .Alert ;
1414import beastfx .app .util .ExtensionFileFilter ;
1515import beastfx .app .util .FXUtils ;
16+ import javafx .scene .control .ButtonType ;
1617import beast .base .core .BEASTInterface ;
1718import beast .base .evolution .alignment .Alignment ;
1819import beast .base .evolution .alignment .FilteredAlignment ;
@@ -85,7 +86,7 @@ public List<BEASTInterface> getAlignments(BeautiDoc doc, File[] files) {
8586 + parser .filteredAlignments .get (i % 10000 - 1 ).getID () + "<br/>" ;
8687 }
8788 overlaps += "The first thing you might want to do is delete some of these partitions.</html>" ;
88- JOptionPane .showMessageDialog (null , overlaps );
89+ Alert .showMessageDialog (null , overlaps );
8990 }
9091 /** add alignments **/
9192 for (Alignment data : parser .filteredAlignments ) {
@@ -96,7 +97,7 @@ public List<BEASTInterface> getAlignments(BeautiDoc doc, File[] files) {
9697 }
9798 } catch (Exception ex ) {
9899 ex .printStackTrace ();
99- JOptionPane .showMessageDialog (null , "Loading of " + fileName + " failed: " + ex .getMessage ());
100+ Alert .showMessageDialog (null , "Loading of " + fileName + " failed: " + ex .getMessage ());
100101 return null ;
101102 }
102103 }
@@ -105,20 +106,22 @@ public List<BEASTInterface> getAlignments(BeautiDoc doc, File[] files) {
105106 //"to apply different substitution models for each partition?", "Data partition with respect to the number of states", 0);
106107
107108 List <BEASTInterface > filteredAlignments = new ArrayList <>();
108- int condition = JOptionPane .showConfirmDialog (null , "Would you like to condition on recording variable characters only (Mkv)?" , "Conditioning on variable characters" , 0 );
109+ ButtonType condition = Alert .showConfirmDialog (null ,
110+ "Would you like to condition on recording variable characters only (Mkv)?" ,
111+ "Conditioning on variable characters" , Alert .YES_NO_OPTION );
109112 if (partitions == 0 ) {
110113 try {
111114 for (BEASTInterface o : selectedPlugins ) {
112115 if (o instanceof Alignment ) {
113- if (condition == 0 ) {
116+ if (condition . toString (). toLowerCase (). contains ( "yes" ) ) {
114117 processAlignment ((Alignment ) o , filteredAlignments , true , doc );
115118 } else {
116119 processAlignment ((Alignment ) o , filteredAlignments , false , doc );
117120 }
118121 }
119122 }
120123 } catch (Exception e ) {
121- JOptionPane .showMessageDialog (null , "Something went wrong converting the alignment: " + e .getMessage ());
124+ Alert .showMessageDialog (null , "Something went wrong converting the alignment: " + e .getMessage ());
122125 e .printStackTrace ();
123126 return null ;
124127 }
0 commit comments