From 75408cd48c09f1eac22b3ac4708fd1b1c4001195 Mon Sep 17 00:00:00 2001 From: SiboVG Date: Fri, 31 Mar 2023 15:12:52 +0200 Subject: [PATCH 1/2] Fix typos --- core/resources/l10n/messages.properties | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/resources/l10n/messages.properties b/core/resources/l10n/messages.properties index 88290ee6d..06927dd56 100644 --- a/core/resources/l10n/messages.properties +++ b/core/resources/l10n/messages.properties @@ -2284,11 +2284,11 @@ IgnitionSelectionDialog.opt.default = Change all configurations using the defaul IgnitionSelectionDialog.opt.override = Override for the {0} flight configuration only DeploymentSelectionDialog.opt.title = Which flight configurations are affected: -DeploymentSelectionDialog.opt.default = Change all configuration using the default deployment event +DeploymentSelectionDialog.opt.default = Change all configurations using the default deployment event DeploymentSelectionDialog.opt.override = Override for the {0} flight configuration only SeparationSelectionDialog.opt.title = Which flight configurations are affected: -SeparationSelectionDialog.opt.default = Change all configuration using the default separation event +SeparationSelectionDialog.opt.default = Change all configurations using the default separation event SeparationSelectionDialog.opt.override = Override for the {0} flight configuration only MotorConfigurationPanel.description = Select the motors and motor ignition events of the selected flight configuration.
Motor mounts: Select which components function as motor mounts.
Motor configurations: Select the motor and ignition event for each motor mount. From 5e99746e715e3dd2f6fac15a1a29a89347660036 Mon Sep 17 00:00:00 2001 From: SiboVG Date: Fri, 31 Mar 2023 15:19:37 +0200 Subject: [PATCH 2/2] [#2150] Don't let illegal file format be a silent warning --- .../file/motor/RASPMotorLoader.java | 9 ++++++--- .../database/MotorDatabaseLoader.java | 20 ++++++++++++------- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/core/src/net/sf/openrocket/file/motor/RASPMotorLoader.java b/core/src/net/sf/openrocket/file/motor/RASPMotorLoader.java index 26c102f71..57bae283c 100644 --- a/core/src/net/sf/openrocket/file/motor/RASPMotorLoader.java +++ b/core/src/net/sf/openrocket/file/motor/RASPMotorLoader.java @@ -94,7 +94,8 @@ public class RASPMotorLoader extends AbstractMotorLoader { // desig diam len delays prop.w tot.w manufacturer pieces = split(line); if (pieces.length != 7) { - throw new IOException("Illegal file format."); + throw new IOException("Illegal file format. Motor header line must contain 7 fields:
" + + "  designation diameter length delays propellantWeight totalWeight manufacturer"); } designation = pieces[0]; @@ -140,7 +141,8 @@ public class RASPMotorLoader extends AbstractMotorLoader { thrust.add(Double.parseDouble(buf[1])); } else { - throw new IOException("Illegal file format."); + throw new IOException("Illegal file format.
" + + "Data should only have 2 entries: a time and thrust value."); } } @@ -158,7 +160,8 @@ public class RASPMotorLoader extends AbstractMotorLoader { } catch (NumberFormatException e) { - throw new IOException("Illegal file format."); + throw new IOException("Illegal file format. Could not convert value to a number.Verify that each number is correctly formatted."); } diff --git a/swing/src/net/sf/openrocket/database/MotorDatabaseLoader.java b/swing/src/net/sf/openrocket/database/MotorDatabaseLoader.java index 279f0cf92..24fd7e4c4 100644 --- a/swing/src/net/sf/openrocket/database/MotorDatabaseLoader.java +++ b/swing/src/net/sf/openrocket/database/MotorDatabaseLoader.java @@ -27,6 +27,7 @@ import net.sf.openrocket.util.Pair; import javax.swing.JDialog; import javax.swing.JOptionPane; +import javax.swing.SwingUtilities; /** * An asynchronous database loader that loads the internal thrust curves @@ -140,21 +141,26 @@ public class MotorDatabaseLoader extends AsynchronousDatabaseLoader { */ private void loadFile(GeneralMotorLoader loader, Pair f) { try { - List motors = loader.load(f.getV(), f.getU().getName()); try { + List 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) {