String helperName = helperSelectionCombo.getValue(helperSelectionCombo.getSelectedIndex());
String eventName = eventSelectionCombo.getValue(eventSelectionCombo.getSelectedIndex());
String helperClassName = helpersAvailable.get(helperName);
try {
FBScriptHelper helper = (FBScriptHelper) ReflectionHelper.newInstance(helperClassName);
FBScript fbScript = eventActions.get(eventName);
if (fbScript == null) {
fbScript = new FBScript();
eventActions.put(eventName, fbScript);
}
List<FBScriptHelper> helpers = getHelpersForEvent(fbScript);
helpers.add(helper);
ScriptHelperListPanel editors = new ScriptHelperListPanel();
for (FBScriptHelper helper2 : helpers) {
editors.addScriptHelper(helper2, newScriptOrderHandler(fbScript));
}
mainPanel.remove(1);
mainPanel.insert(editors, 1);
} catch (Exception e) {
bus.fireEvent(new NotificationEvent(Level.ERROR, "Problem starting script helper " + helperClassName, e));
}
}
});
for (Map.Entry<String, FBScript> entry : this.eventActions.entrySet()) {
FBScript script = entry.getValue();
List<FBScriptHelper> helpers = script == null ? new ArrayList<FBScriptHelper>() : script.getHelpers();
String key = entry.getKey();
FBScript fbScript = this.eventActions.get(key);
if (fbScript == null) {
fbScript = new FBScript();
eventActions.put(key, fbScript);
}
fbScript.setHelpers(helpers);
}
}