@@ -538,10 +538,8 @@ public void actionPerformed(ActionEvent e) {
538
538
item = newJMenuItem (_ ("Upload" ), 'U' );
539
539
item .addActionListener (new ActionListener () {
540
540
public void actionPerformed (ActionEvent e ) {
541
- handleExport (false );
542
- // Hide the serial monitor window. It will reopen at the appropriate time
543
- // if "auto show" is enabled
544
541
serialMonitor .setVisible (false );
542
+ handleExport (false );
545
543
}
546
544
});
547
545
fileMenu .add (item );
@@ -961,6 +959,7 @@ protected void selectSerialPort(String name) {
961
959
serialMonitor .closeSerialPort ();
962
960
963
961
serialMonitor = new SerialMonitor (Preferences .get ("serial.port" ));
962
+ serialMonitor .setIconImage (getIconImage ());
964
963
//System.out.println("set to " + get("serial.port"));
965
964
}
966
965
@@ -2393,15 +2392,6 @@ public void run() {
2393
2392
try {
2394
2393
serialMonitor .closeSerialPort ();
2395
2394
2396
- // If "auto show" is disabled make sure we hide the serial monitor window.
2397
- // This causes the IDE to act the way it always has in the the past.
2398
- if (Preferences .getBoolean ("serial.auto_show_monitor_window" )) {
2399
- serialMonitor .setVisible (true );
2400
- }
2401
- else {
2402
- serialMonitor .setVisible (false );
2403
- }
2404
-
2405
2395
uploading = true ;
2406
2396
2407
2397
boolean success = sketch .exportApplet (false );
@@ -2413,9 +2403,14 @@ public void run() {
2413
2403
}
2414
2404
} catch (SerialNotFoundException e ) {
2415
2405
populateSerialMenu ();
2416
- if (serialMenu .getItemCount () == 0 ) statusError (e );
2417
- else if (serialPrompt ()) run ();
2418
- else statusNotice (_ ("Upload canceled." ));
2406
+ if (serialMenu .getItemCount () == 0 ) {
2407
+ statusError (e );
2408
+ } else if (serialPrompt ()) {
2409
+ run ();
2410
+ return ;
2411
+ } else {
2412
+ statusNotice (_ ("Upload canceled." ));
2413
+ }
2419
2414
} catch (RunnerException e ) {
2420
2415
//statusError("Error during upload.");
2421
2416
//e.printStackTrace();
@@ -2428,12 +2423,9 @@ public void run() {
2428
2423
uploading = false ;
2429
2424
2430
2425
// If auto show is enabled make sure the serial monitor is hooked up and visible
2431
- if (uploadSuccessful ) {
2432
- if (Preferences .getBoolean ("serial.auto_show_monitor_window" )) {
2433
- handleSerial (true );
2434
- }
2435
- }
2436
- else {
2426
+ if (uploadSuccessful && Preferences .getBoolean ("serial.auto_show_monitor_window" )) {
2427
+ handleSerial (true );
2428
+ } else {
2437
2429
serialMonitor .setVisible (false );
2438
2430
}
2439
2431
0 commit comments