TreeViewer notificationViewer = new TreeViewer(notificationTree);
notificationViewer.setLabelProvider(new LabelProvider() {
public String getText(Object element) {
if (element instanceof MBeanNotificationInfoWrapper) {
MBeanNotificationInfoWrapper notifWrapper = (MBeanNotificationInfoWrapper) element;
return notifWrapper.getMBeanNotificationInfo().getName();
}
return super.getText(element);
}
});
notificationViewer.setContentProvider(new ITreeContentProvider() {
public Object[] getChildren(Object parent) {
if (parent instanceof MBeanNotificationInfoWrapper) {
MBeanNotificationInfoWrapper notifWrapper = (MBeanNotificationInfoWrapper) parent;
return notifWrapper.getMBeanNotificationInfo()
.getNotifTypes();
}
return new Object[0];
}
public Object getParent(Object element) {
return null;
}
public boolean hasChildren(Object element) {
if (element instanceof MBeanNotificationInfoWrapper) {
MBeanNotificationInfoWrapper notifWrapper = (MBeanNotificationInfoWrapper) element;
return (notifWrapper.getMBeanNotificationInfo()
.getNotifTypes().length > 0);
}
return false;
}