get[Started]Plugin method returns plugins that end with argument + added sim and gui variables accessible from test scripts
This commit is contained in:
parent
bdc42d8e64
commit
0829e50f4b
@ -1882,20 +1882,31 @@ public class GUI extends Observable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns started plugin with given class name, if any.
|
||||
* Returns started plugin that ends with given class name, if any.
|
||||
*
|
||||
* @param classname Class name
|
||||
* @return Plugin instance
|
||||
*/
|
||||
public Plugin getStartedPlugin(String classname) {
|
||||
public Plugin getPlugin(String classname) {
|
||||
for (Plugin p: startedPlugins) {
|
||||
if (p.getClass().getName().equals(classname)) {
|
||||
if (p.getClass().getName().endsWith(classname)) {
|
||||
return p;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns started plugin with given class name, if any.
|
||||
*
|
||||
* @param classname Class name
|
||||
* @return Plugin instance
|
||||
* @deprecated
|
||||
*/
|
||||
public Plugin getStartedPlugin(String classname) {
|
||||
return getPlugin(classname);
|
||||
}
|
||||
|
||||
public Plugin[] getStartedPlugins() {
|
||||
return startedPlugins.toArray(new Plugin[0]);
|
||||
}
|
||||
|
@ -434,6 +434,8 @@ public class LogScriptEngine {
|
||||
|
||||
Hashtable<Object, Object> hash = new Hashtable<Object, Object>();
|
||||
engine.put("global", hash);
|
||||
engine.put("sim", simulation);
|
||||
engine.put("gui", simulation.getGUI());
|
||||
|
||||
scriptMote = new ScriptMote();
|
||||
engine.put("node", scriptMote);
|
||||
|
Loading…
Reference in New Issue
Block a user