From e44657d05d2ef786f386863670a09194262b6dda Mon Sep 17 00:00:00 2001 From: fros4943 Date: Mon, 2 Apr 2007 16:50:07 +0000 Subject: [PATCH] added menu option for removing all motes from simulation --- tools/cooja/java/se/sics/cooja/GUI.java | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/tools/cooja/java/se/sics/cooja/GUI.java b/tools/cooja/java/se/sics/cooja/GUI.java index d29650a39..091d04fe3 100644 --- a/tools/cooja/java/se/sics/cooja/GUI.java +++ b/tools/cooja/java/se/sics/cooja/GUI.java @@ -24,7 +24,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: GUI.java,v 1.39 2007/04/02 13:42:05 fros4943 Exp $ + * $Id: GUI.java,v 1.40 2007/04/02 16:50:07 fros4943 Exp $ */ package se.sics.cooja; @@ -501,6 +501,12 @@ public class GUI { }); menu.add(menuMoteTypes); + menuItem = new JMenuItem("Remove all motes"); + menuItem.setActionCommand("remove all motes"); + menuItem.addActionListener(guiEventHandler); + + menu.add(menuItem); + // Plugins menu menuPlugins = new JMenu("Plugins"); menuPlugins.setMnemonic(KeyEvent.VK_P); @@ -2373,6 +2379,15 @@ public class GUI { Object[] plugins = startedPlugins.toArray(); for (Object plugin : plugins) removePlugin((Plugin) plugin, false); + } else if (e.getActionCommand().equals("remove all motes")) { + if (getSimulation() != null) { + if (getSimulation().isRunning()) + getSimulation().stopSimulation(); + + while (getSimulation().getMotesCount() > 0) { + getSimulation().removeMote(getSimulation().getMote(0)); + } + } } else if (e.getActionCommand().equals("manage projects")) { Vector newProjects = ProjectDirectoriesDialog.showDialog(frame, currentProjectDirs, null);