version 1.1.9
[debian/openrocket] / src / net / sf / openrocket / gui / main / SimulationRunDialog.java
index 1788515e78f62b0a16beb18e43d9145cd4994d8b..9ac4a3690f3c86fb9d3bd63d9295026bfed47576 100644 (file)
@@ -8,8 +8,6 @@ import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
 import java.awt.event.WindowAdapter;
 import java.awt.event.WindowEvent;
-import java.io.CharArrayWriter;
-import java.io.PrintWriter;
 import java.util.Iterator;
 import java.util.List;
 import java.util.concurrent.ExecutorService;
@@ -125,7 +123,7 @@ public class SimulationRunDialog extends JDialog {
                //// Simulation time: 
                panel.add(new JLabel(trans.get("SimuRunDlg.lbl.Simutime") + " "), "gapright para");
                timeLabel = new JLabel("");
-               panel.add(timeLabel, "growx, wrap rel");
+               panel.add(timeLabel, "growx, wmin 200lp, wrap rel");
                
                //// Altitude:
                panel.add(new JLabel(trans.get("SimuRunDlg.lbl.Altitude") + " "));
@@ -382,12 +380,6 @@ public class SimulationRunDialog extends JDialog {
                                return; // Ignore cancellations
                        }
                        
-                       // Retrieve the stack trace in a textual form
-                       CharArrayWriter arrayWriter = new CharArrayWriter();
-                       arrayWriter.append(t.toString() + "\n" + "\n");
-                       t.printStackTrace(new PrintWriter(arrayWriter));
-                       String stackTrace = arrayWriter.toString();
-                       
                        // Analyze the exception type
                        if (t instanceof SimulationLaunchException) {
                                
@@ -407,52 +399,17 @@ public class SimulationRunDialog extends JDialog {
                                                                trans.get("SimuRunDlg.msg.errorOccurred"),
                                                                t.getMessage()
                                                },
-                                               stackTrace, simulation.getName(), JOptionPane.ERROR_MESSAGE);
-                               
-                       } else if (t instanceof Exception) {
-                               
-                               // TODO: MEDIUM: Check the exception handling here...
-                               t.printStackTrace();
-                               DetailDialog.showDetailedMessageDialog(SimulationRunDialog.this,
-                                               new Object[] {
-                                                               //// An exception occurred during the simulation:
-                                                               trans.get("SimuRunDlg.msg.AnException1"),
-                                                               t.getMessage(),
-                                                               simulation.getSimulationListeners().isEmpty() ?
-                                                                               trans.get("SimuRunDlg.msg.AnException2") : ""
-                                               },
-                                               stackTrace, simulation.getName(), JOptionPane.ERROR_MESSAGE);
-                               
-                       } else if (t instanceof AssertionError) {
-                               
-                               t.printStackTrace();
-                               DetailDialog.showDetailedMessageDialog(SimulationRunDialog.this,
-                                               new Object[] {
-                                                               //// A computation error occurred during the simulation.
-                                                               trans.get("SimuRunDlg.msg.AssertionError1"),
-                                                               //// Please report this as a bug along with the details below.
-                                                               trans.get("SimuRunDlg.msg.AssertionError2")
-                                               },
-                                               stackTrace, simulation.getName(), JOptionPane.ERROR_MESSAGE);
+                                               null, simulation.getName(), JOptionPane.ERROR_MESSAGE);
                                
                        } else {
                                
-                               // Probably an Error
-                               DetailDialog.showDetailedMessageDialog(SimulationRunDialog.this,
-                                               new Object[] {
-                                                               //// An unknown error was encountered during the simulation.
-                                                               trans.get("SimuRunDlg.msg.unknownerror1"),
-                                                               //// The program may be unstable, you should save all your designs and restart OpenRocket now!
-                                                               trans.get("SimuRunDlg.msg.unknownerror2")
-                                               },
-                                               stackTrace, simulation.getName(), JOptionPane.ERROR_MESSAGE);
+                               ExceptionHandler.handleErrorCondition("An exception occurred during the simulation", t);
                                
                        }
                        simulationDone();
                }
                
                
-
                private void setSimulationProgress(double p) {
                        int exact = Math.max(progress, (int) (100 * p + 0.5));
                        progress = MathUtil.clamp(exact, 0, 100);