diff --git a/swing/src/net/sf/openrocket/gui/dialogs/BugReportDialog.java b/swing/src/net/sf/openrocket/gui/dialogs/BugReportDialog.java index 4683a6a15..763f873b0 100644 --- a/swing/src/net/sf/openrocket/gui/dialogs/BugReportDialog.java +++ b/swing/src/net/sf/openrocket/gui/dialogs/BugReportDialog.java @@ -27,6 +27,7 @@ import net.miginfocom.swing.MigLayout; import net.sf.openrocket.gui.components.StyledLabel; import net.sf.openrocket.gui.components.URLLabel; import net.sf.openrocket.gui.util.GUIUtil; +import net.sf.openrocket.gui.util.SwingPreferences; import net.sf.openrocket.l10n.Translator; import net.sf.openrocket.logging.LogLevelBufferLogger; import net.sf.openrocket.logging.LogLine; @@ -44,6 +45,7 @@ public class BugReportDialog extends JDialog { private static final String REPORT_EMAIL_URL = "mailto:" + REPORT_EMAIL; private static final Translator trans = Application.getTranslator(); + private static final SwingPreferences preferences = (SwingPreferences) Application.getPreferences(); public BugReportDialog(Window parent, String labelText, final String message, final boolean sendIfUnchanged) { @@ -108,31 +110,10 @@ public class BugReportDialog extends JDialog { * @param parent the parent window (may be null). */ public static void showBugReportDialog(Window parent) { - StringBuilder sb = new StringBuilder(); - - sb.append("---------- Bug report ----------\n"); - sb.append('\n'); - sb.append("Include detailed steps on how to trigger the bug:\n"); - sb.append("(You can edit text directly in this window)\n"); - sb.append('\n'); - sb.append("1. \n"); - sb.append("2. \n"); - sb.append("3. \n"); - sb.append('\n'); - - sb.append("What does the software do and what in your opinion should it do in the " + - "case described above:\n"); - sb.append('\n'); - sb.append('\n'); - sb.append('\n'); - - sb.append("Include your email address (optional; it helps if we can " + - "contact you in case we need additional information):\n"); - sb.append('\n'); - sb.append('\n'); - sb.append('\n'); - + + // ---------- Bug report ---------- + addBugReportInformation(sb); sb.append("(Do not modify anything below this line.)\n"); sb.append("---------- System information ----------\n"); @@ -157,28 +138,9 @@ public class BugReportDialog extends JDialog { */ public static void showExceptionDialog(Window parent, Thread t, Throwable e) { StringBuilder sb = new StringBuilder(); - - sb.append("---------- Bug report ----------\n"); - sb.append('\n'); - sb.append("Please include a description about what actions you were " + - "performing when the exception occurred:\n"); - sb.append("(You can edit text directly in this window)\n"); - sb.append('\n'); - sb.append("1. \n"); - sb.append("2. \n"); - sb.append("3. \n"); - sb.append("\n"); - sb.append("If possible, please send us the .ork file that caused the bug.\n"); - sb.append('\n'); - - - sb.append("Include your email address (optional; it helps if we can " + - "contact you in case we need additional information):\n"); - sb.append('\n'); - sb.append('\n'); - sb.append('\n'); - sb.append('\n'); + // ---------- Bug report ---------- + addBugReportInformation(sb); sb.append("(Do not modify anything below this line.)\n"); sb.append("---------- Exception stack trace ----------\n"); @@ -211,12 +173,37 @@ public class BugReportDialog extends JDialog { new BugReportDialog(parent, trans.get("bugreport.reportDialog.txt2"), sb.toString(), true); reportDialog.setVisible(true); } + + private static void addBugReportInformation(StringBuilder sb) { + sb.append("---------- Bug report ----------\n"); + sb.append('\n'); + sb.append("Please include a description about what actions you were " + + "performing when the exception occurred:\n"); + sb.append("(You can edit text directly in this window)\n"); + sb.append('\n'); + sb.append("1. \n"); + sb.append("2. \n"); + sb.append("3. \n"); + + sb.append("\n"); + sb.append("If possible, please send us the .ork file that caused the bug.\n"); + sb.append('\n'); + + + sb.append("Include your email address (optional; it helps if we can " + + "contact you in case we need additional information):\n"); + sb.append('\n'); + sb.append('\n'); + sb.append('\n'); + sb.append('\n'); + } private static void addSystemInformation(StringBuilder sb) { StringBuilder sbTemp = new StringBuilder(); sbTemp.append("OpenRocket version: " + BuildProperties.getVersion() + "\n"); sbTemp.append("OpenRocket source: " + BuildProperties.getBuildSource() + "\n"); sbTemp.append("OpenRocket location: " + JarUtil.getCurrentJarFile() + "\n"); + sbTemp.append("User-defined thrust curves location: " + preferences.getUserThrustCurveFilesAsString() + "\n"); sbTemp.append("JOGL version: " + JoglVersion.getInstance().getImplementationVersion() + "\n"); sbTemp.append("Current default locale: " + Locale.getDefault() + "\n"); sbTemp.append("System properties:\n"); diff --git a/swing/src/net/sf/openrocket/gui/dialogs/preferences/GeneralPreferencesPanel.java b/swing/src/net/sf/openrocket/gui/dialogs/preferences/GeneralPreferencesPanel.java index 9631603a1..de73270f9 100644 --- a/swing/src/net/sf/openrocket/gui/dialogs/preferences/GeneralPreferencesPanel.java +++ b/swing/src/net/sf/openrocket/gui/dialogs/preferences/GeneralPreferencesPanel.java @@ -86,14 +86,7 @@ public class GeneralPreferencesPanel extends PreferencesPanel { //// User-defined thrust curves: this.add(new JLabel(trans.get("pref.dlg.lbl.User-definedthrust")), "spanx, wrap"); final JTextField field = new JTextField(); - List files = preferences.getUserThrustCurveFiles(); - String str = ""; - for (File file : files) { - if (str.length() > 0) { - str += ";"; - } - str += file.getAbsolutePath(); - } + String str = preferences.getUserThrustCurveFilesAsString(); field.setText(str); field.getDocument().addDocumentListener(new DocumentListener() { @Override diff --git a/swing/src/net/sf/openrocket/gui/util/SwingPreferences.java b/swing/src/net/sf/openrocket/gui/util/SwingPreferences.java index 4a42ffdb9..45c5ce476 100644 --- a/swing/src/net/sf/openrocket/gui/util/SwingPreferences.java +++ b/swing/src/net/sf/openrocket/gui/util/SwingPreferences.java @@ -304,6 +304,24 @@ public class SwingPreferences extends net.sf.openrocket.startup.Preferences { return list; } + + /** + * Returns the files/directories to be loaded as custom thrust curves, formatting as a string. If there are multiple + * locations, they are separated by a semicolon. + * + * @return a list of files to load as thrust curves, formatted as a semicolon separated string. + */ + public String getUserThrustCurveFilesAsString() { + List files = getUserThrustCurveFiles(); + StringBuilder sb = new StringBuilder(); + for (File file : files) { + if (sb.length() > 0) { + sb.append(";"); + } + sb.append(file.getAbsolutePath()); + } + return sb.toString(); + } public File getDefaultUserThrustCurveFile() { File appdir = SystemInfo.getUserApplicationDirectory();