motors = loader.load(f.getV(), f.getU().getName());
addMotorsFromBuilders(motors);
}
- catch (IllegalArgumentException e) {
+ catch (IllegalArgumentException | IOException e) {
Translator trans = Application.getTranslator();
String fullPath = f.getU().getPath();
String message = "" + e.getMessage() +
".
" + MessageFormat.format( trans.get("MotorDbLoaderDlg.message1"), fullPath) +
"
" + trans.get("MotorDbLoaderDlg.message2") + "
";
- JOptionPane pane = new JOptionPane(message, JOptionPane.WARNING_MESSAGE);
- JDialog dialog = pane.createDialog(null, trans.get("MotorDbLoaderDlg.title"));
- dialog.setModalityType(Dialog.ModalityType.MODELESS);
- dialog.setAlwaysOnTop(true);
- dialog.setVisible(true);
+ SwingUtilities.invokeLater(new Runnable() {
+ @Override
+ public void run() {
+ JOptionPane pane = new JOptionPane(message, JOptionPane.WARNING_MESSAGE);
+ JDialog dialog = pane.createDialog(null, trans.get("MotorDbLoaderDlg.title"));
+ dialog.setModalityType(Dialog.ModalityType.MODELESS);
+ dialog.setAlwaysOnTop(true);
+ dialog.setVisible(true);
+ }
+ });
}
f.getV().close();
} catch (Exception e) {