String[] classesNames = classesString.split(",");
for (String className : classesNames) {
try {
Object obj = ReflectionHelper.newInstance(className);
if (obj instanceof FBScriptHelper) {
FBScriptHelper helper = (FBScriptHelper) obj;
helpersAvailable.put(helper.getName(), className);
}
} catch (Exception e) {
bus.fireEvent(new NotificationEvent(Level.ERROR, "Problem loading script helper " + className, e));
}
}
}
for (Map.Entry<String, String> entry : helpersAvailable.entrySet()) {
helperSelectionCombo.addItem(entry.getKey());
}
addHelperButton.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
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);
}