diff --git a/core/resources/l10n/messages.properties b/core/resources/l10n/messages.properties index e3c8090eb..9cc4cf088 100644 --- a/core/resources/l10n/messages.properties +++ b/core/resources/l10n/messages.properties @@ -1840,6 +1840,7 @@ EditDecalDialog.btn.chooser = Select Graphics Editor Program EditDecalHelper.createFileException = Cannot create temporary file {0} EditDecalHelper.launchSystemEditorException = Cannot launch system graphics editor EditDecalHelper.launchCustomEditorException = Cannot launch graphics editor with command ''{0}'' +EditDecalHelper.editPreferencesHelp = The editor used can be modified in the Preferences dialog. MotorConfigurationPanel.lbl.motorMounts = Motor mounts: MotorConfigurationPanel.lbl.motorConfiguration = Motor configurations: diff --git a/core/src/net/sf/openrocket/gui/util/EditDecalHelper.java b/core/src/net/sf/openrocket/gui/util/EditDecalHelper.java index 6591cbcb5..f67722ad1 100644 --- a/core/src/net/sf/openrocket/gui/util/EditDecalHelper.java +++ b/core/src/net/sf/openrocket/gui/util/EditDecalHelper.java @@ -18,10 +18,29 @@ public class EditDecalHelper { public static class EditDecalHelperException extends Exception { + private String extraMessage = ""; + public EditDecalHelperException(String message, Throwable cause) { super(message, cause); } + public EditDecalHelperException(String message, String extraMessage, Throwable cause) { + super(message, cause); + this.extraMessage = extraMessage; + } + + @Override + public String getMessage() { + if (extraMessage == null || extraMessage.isEmpty()) { + return super.getMessage(); + } + return super.getMessage() + "\n" + getExtraMessage(); + } + + public String getExtraMessage() { + return extraMessage; + } + } private static final Translator trans = Application.getTranslator(); @@ -113,7 +132,7 @@ public class EditDecalHelper { try { Desktop.getDesktop().edit(tmpFile); } catch (IOException ioex) { - throw new EditDecalHelperException(trans.get("EditDecalHelper.launchSystemEditorException"), ioex); + throw new EditDecalHelperException(trans.get("EditDecalHelper.launchSystemEditorException"), trans.get("EditDecalHelper.editPreferencesHelp"), ioex); } } else { @@ -130,7 +149,7 @@ public class EditDecalHelper { Runtime.getRuntime().exec(command); } catch (IOException ioex) { String message = MessageFormat.format(trans.get("EditDecalHelper.launchCustomEditorException"), command); - throw new EditDecalHelperException(message, ioex); + throw new EditDecalHelperException(message, trans.get("EditDecalHelper.editPreferencesHelp"), ioex); } }