From 7877d54e1e0b6ff6e39dbc4b089e80ce2a11ea5e Mon Sep 17 00:00:00 2001 From: fros4943 Date: Tue, 2 Jun 2009 15:04:49 +0000 Subject: [PATCH] bugfix: mote plugins should use the start plugin action --- tools/cooja/java/se/sics/cooja/GUI.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/tools/cooja/java/se/sics/cooja/GUI.java b/tools/cooja/java/se/sics/cooja/GUI.java index bcdbb8851..cd0860f5a 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.130 2009/05/28 14:53:26 fros4943 Exp $ + * $Id: GUI.java,v 1.131 2009/06/02 15:04:49 fros4943 Exp $ */ package se.sics.cooja; @@ -594,8 +594,12 @@ public class GUI extends Observable { } /* Mote and mote type menues */ - menuMoteTypeClasses.setEnabled(getSimulation() != null); - menuMoteTypes.setEnabled(getSimulation() != null); + if (menuMoteTypeClasses != null) { + menuMoteTypeClasses.setEnabled(getSimulation() != null); + } + if (menuMoteTypes != null) { + menuMoteTypes.setEnabled(getSimulation() != null); + } } private JMenuBar createMenuBar() { @@ -1818,10 +1822,10 @@ public class GUI extends Observable { JMenu menuMotePlugins = new JMenu("Open mote plugin for " + mote); for (Class motePluginClass: menuMotePluginClasses) { - JMenuItem menuItem = new JMenuItem(getDescriptionOf(motePluginClass)); + GUIAction guiAction = new StartPluginGUIAction(getDescriptionOf(motePluginClass)); + JMenuItem menuItem = new JMenuItem(guiAction); menuItem.putClientProperty("class", motePluginClass); menuItem.putClientProperty("mote", mote); - menuItem.addActionListener(guiEventHandler); menuMotePlugins.add(menuItem); } return menuMotePlugins;