Pop up an error dialog and *don't* show the download dialog as if the
open had worked.
Signed-off-by: Keith Packard <keithp@keithp.com>
}
public void start() {
- try {
- serial = new MicroSerial(device);
- serial.set_log(this);
- } catch (FileNotFoundException fe) {
- return;
- }
+ serial.set_log(this);
serial_thread = new Thread(this);
serial_thread.start();
setVisible(false);
}
- public MicroDownload(MicroPeak owner, AltosDevice device) {
+ public MicroDownload(MicroPeak owner, AltosDevice device, MicroSerial serial) {
super (owner, "Download MicroPeak Data", false);
int y = 0;
this.owner = owner;
this.device = device;
+ this.serial = serial;
pane = getScrollablePane();
pane.setLayout(new GridBagLayout());
private void DownloadData() {
AltosDevice device = MicroDeviceDialog.show(this);
+ MicroSerial serial = null;
+ try {
+ serial = new MicroSerial(device);
+ } catch (FileNotFoundException fe) {
+ JOptionPane.showMessageDialog(this,
+ fe.getMessage(),
+ "Cannot open device",
+ JOptionPane.ERROR_MESSAGE);
+ return;
+ }
- if (device != null)
- new MicroDownload(this, device);
+ new MicroDownload(this, device, serial);
}
private void no_data() {