}
@Override
public Object[] getChildren(Object parentElement) {
if (parentElement instanceof Scripts) {
Scripts scripts = (Scripts) parentElement;
List<String> children = new ArrayList<String>();
for (String event : Scripts.getEvents()) {
if (scripts.has(event)) {
children.add(event);
}
}
return children.toArray();
} else {
String text = parentElement.toString();
if (Arrays.asList(Scripts.getEvents()).contains(text)) {
return scripts.getAsArray(text).toArray();
}
}
return new Object[]{};
}