try {
LinkedList<String> names = new LinkedList<String>();
LinkedList<String> uniq = new LinkedList<String>();
JackElement first = (JackElement) sources.getElements().next();
CaoApplication app = first.getApplication();
services.clear();
IConfigurationElement[] config = Platform.getExtensionRegistry().getConfigurationElementsFor(SERVICE_CREATE_NODE);
for (IConfigurationElement e : config) {
String title = e.getAttribute("title");
String appClass = e.getAttribute("application_class");
boolean ok = true;
if (!MString.isEmptyTrim(appClass)) {
ok = false;
// if (!ok) {
for (Class<?> c = app.getClass(); c != null; c = c.getSuperclass())
if (c.getName().equals(appClass)) {
ok = true;
break;
}
// }
if (!ok) {
for (Class<?> i : app.getClass().getInterfaces()) {
if (i.getName().equals(appClass)) {
ok = true;
break;
}
}
}
}
if (ok) {
//String clazz = e.getAttribute("class");
String id = UUID.randomUUID().toString();
//factory.registerDriver(id,title,new Activator(e));
names.add(title);
uniq.add(id);
services.put(id, e);
}
}
names.add("---");
uniq.add("---");
for ( NodeTypeIterator typeIter = first.getNode().getSession().getWorkspace().getNodeTypeManager().getPrimaryNodeTypes();typeIter.hasNext(); ) {
NodeType type = typeIter.nextNodeType();
names.add(type.getName());
uniq.add(type.getName());
}
return new SimpleDynOptionsProvider(uniq.toArray(new String[uniq.size()]),names.toArray(new String[names.size()]));