From 4a546a35291555993a388ef50f6a5bdf58a6f8cc Mon Sep 17 00:00:00 2001 From: fros4943 Date: Thu, 27 Nov 2008 08:51:35 +0000 Subject: [PATCH] automatically stop simulation when script finishes test --- .../se/sics/cooja/plugins/LogScriptEngine.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/tools/cooja/java/se/sics/cooja/plugins/LogScriptEngine.java b/tools/cooja/java/se/sics/cooja/plugins/LogScriptEngine.java index afe69ffcc..0ee7d0f54 100644 --- a/tools/cooja/java/se/sics/cooja/plugins/LogScriptEngine.java +++ b/tools/cooja/java/se/sics/cooja/plugins/LogScriptEngine.java @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: LogScriptEngine.java,v 1.5 2008/11/05 18:16:56 fros4943 Exp $ + * $Id: LogScriptEngine.java,v 1.6 2008/11/27 08:51:35 fros4943 Exp $ */ package se.sics.cooja.plugins; @@ -108,6 +108,9 @@ public class LogScriptEngine { "See console for more information.", "Script error", JOptionPane.ERROR_MESSAGE); unregisterLogObserver(); + if (LogScriptEngine.this.gui.getSimulation() != null) { + LogScriptEngine.this.gui.getSimulation().stopSimulation(); + } } } }; @@ -120,6 +123,9 @@ public class LogScriptEngine { JOptionPane.showMessageDialog(GUI.getTopParentContainer(), "See console for more information.", "Script error", JOptionPane.ERROR_MESSAGE); + if (LogScriptEngine.this.gui.getSimulation() != null) { + LogScriptEngine.this.gui.getSimulation().stopSimulation(); + } unregisterLogObserver(); } } @@ -206,6 +212,9 @@ public class LogScriptEngine { if (GUI.isVisualized()) { log("[if test was run without visualization, COOJA would now have been terminated]\n"); + if (LogScriptEngine.this.gui.getSimulation() != null) { + LogScriptEngine.this.gui.getSimulation().stopSimulation(); + } } else { gui.doQuit(false); } @@ -215,6 +224,9 @@ public class LogScriptEngine { if (GUI.isVisualized()) { log("[if test was run without visualization, COOJA would now have been terminated]\n"); + if (LogScriptEngine.this.gui.getSimulation() != null) { + LogScriptEngine.this.gui.getSimulation().stopSimulation(); + } } else { gui.doQuit(false); }