public void run() {
IStructuredSelection selection = getStructuredSelection();
List elements = selection.toList();
for (Object obj : elements) {
if (obj instanceof LiveBean) {
LiveBean bean = (LiveBean) obj;
LiveBeansSession appName = bean.getSession();
String beanClass = bean.getBeanType();
if (appName != null) {
if (beanClass != null && beanClass.trim().length() > 0) {
if (beanClass.startsWith("com.sun.proxy")) {
// Special case for proxy beans, extract the type
// from the resource field
String resource = bean.getResource();
if (resource != null && resource.trim().length() > 0 && !resource.equalsIgnoreCase(null)) {
String resourcePath = extractResourcePath(resource);
if (resourcePath.endsWith(".class")) {
openInEditor(appName, extractClassName(resourcePath));
}
}
}
else {
openInEditor(appName, beanClass);
}
}
else {
// No type field, so infer class from bean ID
openInEditor(appName, bean.getId());
}
}
}
}
}