mirror of
https://github.com/arduino/Arduino.git
synced 2025-02-20 14:54:31 +01:00
Nicer serial port selection dialog box
This commit is contained in:
parent
fd1b598ea2
commit
12b38c5fcd
@ -1961,26 +1961,24 @@ public class Editor extends JFrame implements RunnerListener {
|
||||
names[i] = portMenu.getItem(i).getText();
|
||||
}
|
||||
|
||||
// FIXME: This is horribly unreadable
|
||||
String result = (String)
|
||||
JOptionPane.showInputDialog(this,
|
||||
I18n.format(
|
||||
tr("Serial port {0} not found.\n" +
|
||||
"Retry the upload with another serial port?"),
|
||||
PreferencesData.get("serial.port")
|
||||
),
|
||||
"Serial port not found",
|
||||
JOptionPane.PLAIN_MESSAGE,
|
||||
null,
|
||||
names,
|
||||
0);
|
||||
if (result == null) return false;
|
||||
String port = PreferencesData.get("serial.port");
|
||||
String title;
|
||||
if (port == null || port.isEmpty()) {
|
||||
title = tr("Serial port not selected.");
|
||||
} else {
|
||||
title = I18n.format(tr("Serial port {0} not found."), port);
|
||||
}
|
||||
String question = tr("Retry the upload with another serial port?");
|
||||
String result = (String) JOptionPane
|
||||
.showInputDialog(this, title + "\n" + question, title,
|
||||
JOptionPane.PLAIN_MESSAGE, null, names, 0);
|
||||
if (result == null)
|
||||
return false;
|
||||
selectSerialPort(result);
|
||||
base.onBoardOrPortChange();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Called by Sketch → Export.
|
||||
* Handles calling the export() function on sketch, and
|
||||
|
Loading…
x
Reference in New Issue
Block a user