bugfix: mote plugins should use the start plugin action

This commit is contained in:
fros4943 2009-06-02 15:04:49 +00:00
parent af0c20e00d
commit 7877d54e1e

View File

@ -24,7 +24,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * 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; package se.sics.cooja;
@ -594,8 +594,12 @@ public class GUI extends Observable {
} }
/* Mote and mote type menues */ /* Mote and mote type menues */
menuMoteTypeClasses.setEnabled(getSimulation() != null); if (menuMoteTypeClasses != null) {
menuMoteTypes.setEnabled(getSimulation() != null); menuMoteTypeClasses.setEnabled(getSimulation() != null);
}
if (menuMoteTypes != null) {
menuMoteTypes.setEnabled(getSimulation() != null);
}
} }
private JMenuBar createMenuBar() { private JMenuBar createMenuBar() {
@ -1818,10 +1822,10 @@ public class GUI extends Observable {
JMenu menuMotePlugins = new JMenu("Open mote plugin for " + mote); JMenu menuMotePlugins = new JMenu("Open mote plugin for " + mote);
for (Class<? extends Plugin> motePluginClass: menuMotePluginClasses) { for (Class<? extends Plugin> 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("class", motePluginClass);
menuItem.putClientProperty("mote", mote); menuItem.putClientProperty("mote", mote);
menuItem.addActionListener(guiEventHandler);
menuMotePlugins.add(menuItem); menuMotePlugins.add(menuItem);
} }
return menuMotePlugins; return menuMotePlugins;