start plugins in non-dispatcher thread

This commit is contained in:
fros4943 2009-09-18 16:13:31 +00:00
parent d9f3e2b05f
commit 0c4dc6fc6b

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.143 2009/08/27 12:25:12 nvt-se Exp $ * $Id: GUI.java,v 1.144 2009/09/18 16:13:31 fros4943 Exp $
*/ */
package se.sics.cooja; package se.sics.cooja;
@ -4093,11 +4093,15 @@ public class GUI extends Observable {
public StartPluginGUIAction(String name) { public StartPluginGUIAction(String name) {
super(name); super(name);
} }
public void actionPerformed(ActionEvent e) { public void actionPerformed(final ActionEvent e) {
Class<Plugin> pluginClass = new Thread(new Runnable() {
(Class<Plugin>) ((JMenuItem) e.getSource()).getClientProperty("class"); public void run() {
Mote mote = (Mote) ((JMenuItem) e.getSource()).getClientProperty("mote"); Class<Plugin> pluginClass =
tryStartPlugin(pluginClass, myGUI, mySimulation, mote); (Class<Plugin>) ((JMenuItem) e.getSource()).getClientProperty("class");
Mote mote = (Mote) ((JMenuItem) e.getSource()).getClientProperty("mote");
tryStartPlugin(pluginClass, myGUI, mySimulation, mote);
}
}).start();
} }
public boolean shouldBeEnabled() { public boolean shouldBeEnabled() {
return getSimulation() != null; return getSimulation() != null;