@@ -1961,26 +1961,24 @@ private boolean serialPrompt() {
1961
1961
names [i ] = portMenu .getItem (i ).getText ();
1962
1962
}
1963
1963
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 ;
1978
1977
selectSerialPort (result );
1979
1978
base .onBoardOrPortChange ();
1980
1979
return true ;
1981
1980
}
1982
1981
1983
-
1984
1982
/**
1985
1983
* Called by Sketch → Export.
1986
1984
* Handles calling the export() function on sketch, and
0 commit comments