optimization updates
[debian/openrocket] / src / net / sf / openrocket / gui / dialogs / BugReportDialog.java
index e916caadcb795aaf5faea187cc0cf64668b85a0e..f9001bf2426edb9ee1b8a46784d42cf04ae1b497 100644 (file)
@@ -43,9 +43,9 @@ public class BugReportDialog extends JDialog {
        
        private static final String REPORT_EMAIL = "openrocket-bugs@lists.sourceforge.net";
        private static final Translator trans = Application.getTranslator();
-
        
-       public BugReportDialog(Window parent, String labelText, String message) {
+       
+       public BugReportDialog(Window parent, String labelText, final String message, final boolean sendIfUnchanged) {
                //// Bug report
                super(parent, trans.get("bugreport.dlg.title"), Dialog.ModalityType.APPLICATION_MODAL);
                
@@ -60,15 +60,14 @@ public class BugReportDialog extends JDialog {
                
                //// <html>If connected to the Internet, you can simply click 
                //// <em>Send bug report</em>.
-               label = new JLabel("<html>If connected to the Internet, you can simply click " +
-                               "<em>Send bug report</em>.");
+               label = new JLabel(trans.get("bugreport.dlg.connectedInternet"));
                d = label.getPreferredSize();
                d.width = 100000;
                label.setMaximumSize(d);
                panel.add(label, "gapleft para, wrap");
                
                //// Otherwise, send the text below to the address:
-               panel.add(new JLabel("Otherwise, send the text below to the address: "),
+               panel.add(new JLabel(trans.get("bugreport.dlg.otherwise") + " "),
                                "gapleft para, split 2, gapright rel");
                panel.add(new SelectableLabel(REPORT_EMAIL), "growx, wrap para");
                
@@ -78,9 +77,7 @@ public class BugReportDialog extends JDialog {
                panel.add(new JScrollPane(textArea), "grow, wrap");
                
 
-               panel.add(new StyledLabel("The information above may be included in a public " +
-                               "bug report.  Make sure it does not contain any sensitive information you " +
-                               "do not want to be made public.", -1), "wrap para");
+               panel.add(new StyledLabel(trans.get("bugreport.lbl.Theinformation"), -1), "wrap para");
                
 
 
@@ -118,6 +115,13 @@ public class BugReportDialog extends JDialog {
                        @Override
                        public void actionPerformed(ActionEvent e) {
                                String text = textArea.getText();
+                               if (text.equals(message) && !sendIfUnchanged) {
+                                       JOptionPane.showMessageDialog(BugReportDialog.this,
+                                                       trans.get("bugreport.dlg.provideDescription"),
+                                                       trans.get("bugreport.dlg.provideDescription.title"), JOptionPane.ERROR_MESSAGE);
+                                       return;
+                               }
+                               
                                try {
                                        
                                        BugReporter.sendBugReport(text);
@@ -130,16 +134,19 @@ public class BugReportDialog extends JDialog {
                                                        "Bug report sent", JOptionPane.INFORMATION_MESSAGE);*/
                                        JOptionPane.showMessageDialog(BugReportDialog.this,
                                                        new Object[] { trans.get("bugreport.dlg.successmsg1"),
-                                                       trans.get("bugreport.dlg.successmsg2") },
+                                                                       trans.get("bugreport.dlg.successmsg2") },
                                                        trans.get("bugreport.dlg.successmsg3"), JOptionPane.INFORMATION_MESSAGE);
                                        
                                } catch (Exception ex) {
                                        // Sending the message failed.
                                        JOptionPane.showMessageDialog(BugReportDialog.this,
-                                                       new Object[] { "OpenRocket was unable to send the bug report:",
+                                                       //// OpenRocket was unable to send the bug report:
+                                                       new Object[] { trans.get("bugreport.dlg.failedmsg1"),
                                                                        ex.getClass().getSimpleName() + ": " + ex.getMessage(), " ",
-                                                                       "Please send the report manually to " + REPORT_EMAIL },
-                                                       "Error sending report", JOptionPane.ERROR_MESSAGE);
+                                                                       //// Please send the report manually to 
+                                                                       trans.get("bugreport.dlg.failedmsg2") + " " + REPORT_EMAIL },
+                                                                       //// Error sending report
+                                                       trans.get("bugreport.dlg.failedmsg3"), JOptionPane.ERROR_MESSAGE);
                                }
                        }
                });
@@ -197,12 +204,8 @@ public class BugReportDialog extends JDialog {
                sb.append("---------- End of bug report ----------\n");
                sb.append('\n');
                
-               BugReportDialog reportDialog =
-                               new BugReportDialog(parent,
-                                               "<html><b>You can report a bug in OpenRocket by filling in and submitting " +
-                                                               "the form below.</b><br>" +
-                                                               "You can also report bugs and include attachments on the project " +
-                                                               "web site.", sb.toString());
+               BugReportDialog reportDialog = new BugReportDialog(parent,
+                                               trans.get("bugreport.reportDialog.txt"), sb.toString(), false);
                reportDialog.setVisible(true);
        }
        
@@ -260,8 +263,8 @@ public class BugReportDialog extends JDialog {
                sb.append('\n');
                
                BugReportDialog reportDialog =
-                               new BugReportDialog(parent, "<html><b>Please include a short description about " +
-                                               "what you were doing when the exception occurred.</b>", sb.toString());
+                               //// <html><b>Please include a short description about what you were doing when the exception occurred.</b>
+                               new BugReportDialog(parent, trans.get("bugreport.reportDialog.txt2"), sb.toString(), true);
                reportDialog.setVisible(true);
        }