2525
2626import java .awt .Dimension ;
2727import java .awt .event .ActionEvent ;
28+ import java .io .File ;
2829import java .util .logging .Logger ;
30+
2931import javax .swing .AbstractAction ;
3032import javax .swing .Action ;
31-
32-
3333import javax .swing .Box ;
3434import javax .swing .JButton ;
3535import javax .swing .JComboBox ;
3636import javax .swing .JFrame ;
3737import javax .swing .JLabel ;
3838import javax .swing .JMenuBar ;
3939import javax .swing .JOptionPane ;
40-
4140import javax .swing .JProgressBar ;
4241import javax .swing .JTabbedPane ;
4342
5150import org .biojava .bio .structure .align .util .ResourceManager ;
5251import org .biojava .bio .structure .align .util .UserConfiguration ;
5352import org .biojava .bio .structure .align .webstart .AligUIManager ;
54-
5553import org .biojava .bio .structure .align .webstart .WebStartMain ;
5654import org .biojava .bio .structure .gui .util .PDBUploadPanel ;
5755import org .biojava .bio .structure .gui .util .ScopSelectPanel ;
@@ -442,7 +440,7 @@ private void calcDBSearch() {
442440 s = tab .getStructure1 ();
443441
444442 if ( s == null ) {
445- System . err . println ( "please select structure 1" );
443+ JOptionPane . showMessageDialog ( null , "please select structure 1" );
446444 return ;
447445 }
448446
@@ -458,10 +456,18 @@ private void calcDBSearch() {
458456
459457 System .out .println ("name1 in alig gui:" + name1 );
460458 String file = dbsearch .getOutFileLocation ();
461- if ( file == null || file .equals ("" )){
459+ if ( file == null || file .equals ("" ) ){
462460 JOptionPane .showMessageDialog (null ,"Please select a directory to contain the DB search results." );
463461 return ;
464462 }
463+ File outFile = new File (file );
464+ if ( !outFile .exists () ) {
465+ outFile .mkdirs ();
466+ }
467+ if ( !outFile .isDirectory () || !outFile .canWrite ()) {
468+ JOptionPane .showMessageDialog (null ,"Unable to write to " +outFile .getAbsolutePath ());
469+ return ;
470+ }
465471
466472 UserConfiguration config = WebStartMain .getWebStartConfig ();
467473
0 commit comments