@@ -1961,26 +1961,24 @@ private boolean serialPrompt() {
19611961 names [i ] = portMenu .getItem (i ).getText ();
19621962 }
19631963
1964- // FIXME: This is horribly unreadable
1965- String result = (String )
1966- JOptionPane .showInputDialog (this ,
1967- I18n .format (
1968- tr ("Serial port {0} not found.\n " +
1969- "Retry the upload with another serial port?" ),
1970- PreferencesData .get ("serial.port" )
1971- ),
1972- "Serial port not found" ,
1973- JOptionPane .PLAIN_MESSAGE ,
1974- null ,
1975- names ,
1976- 0 );
1977- if (result == null ) return false ;
1964+ String port = PreferencesData .get ("serial.port" );
1965+ String title ;
1966+ if (port == null || port .isEmpty ()) {
1967+ title = tr ("Serial port not selected." );
1968+ } else {
1969+ title = I18n .format (tr ("Serial port {0} not found." ), port );
1970+ }
1971+ String question = tr ("Retry the upload with another serial port?" );
1972+ String result = (String ) JOptionPane
1973+ .showInputDialog (this , title + "\n " + question , title ,
1974+ JOptionPane .PLAIN_MESSAGE , null , names , 0 );
1975+ if (result == null )
1976+ return false ;
19781977 selectSerialPort (result );
19791978 base .onBoardOrPortChange ();
19801979 return true ;
19811980 }
19821981
1983-
19841982 /**
19851983 * Called by Sketch → Export.
19861984 * Handles calling the export() function on sketch, and
0 commit comments