public Image getColumnImage(Object element, int columnIndex) {
if (element instanceof INodeNotifier) {
INodeAdapter adapterFor = ((INodeNotifier) element).getAdapterFor(IJFaceNodeAdapter.class);
if (columnIndex == 2 && adapterFor != null && adapterFor instanceof IJFaceNodeAdapter) {
IJFaceNodeAdapter adapter = (IJFaceNodeAdapter) adapterFor;
return adapter.getLabelImage((element));
}
}
return null;
}
public String getColumnText(Object element, int columnIndex) {
String text = null;
if (element != null) {
switch (columnIndex) {
case 0 : {
text = String.valueOf(((List) structuredSelectionTable.getInput()).indexOf(element));
}
break;
case 1 : {
text = element.getClass().getName();
}
break;
case 2 : {
text = StringUtils.firstLineOf(element.toString());
}
break;
default :
text = ""; //$NON-NLS-1$
}
}
return text;
}
public boolean isLabelProperty(Object element, String property) {
return false;
}
public void removeListener(ILabelProviderListener listener) {
}
});
TableLayout tlayout = new TableLayout();
tlayout.addColumnData(new ColumnWeightData(7, true));
tlayout.addColumnData(new ColumnWeightData(28, true));
tlayout.addColumnData(new ColumnWeightData(50, true));
structuredSelectionTable.getTable().setLayout(tlayout);
TableColumn tc = new TableColumn(structuredSelectionTable.getTable(), SWT.NONE);
tc.setText("Item"); //$NON-NLS-1$
tc.setResizable(true);
tc.setWidth(40);
tc = new TableColumn(structuredSelectionTable.getTable(), SWT.NONE);
tc.setText("Class"); //$NON-NLS-1$
tc.setResizable(true);
tc.setWidth(40);
tc = new TableColumn(structuredSelectionTable.getTable(), SWT.NONE);
tc.setText("Value"); //$NON-NLS-1$
tc.setResizable(true);
tc.setWidth(40);
structuredSelectionTable.setContentProvider(new ArrayContentProvider());
final List input = selection;
structuredSelectionTable.setInput(input);
final TreeViewer infoTree = new TreeViewer(structuredSashForm, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
infoTree.setLabelProvider(new LabelProvider() {
public Image getImage(Object element) {
if (element instanceof TreeViewer && infoTree.getInput() instanceof INodeNotifier) {
INodeAdapter adapterFor = ((INodeNotifier) infoTree.getInput()).getAdapterFor(IJFaceNodeAdapter.class);
if (adapterFor != null && adapterFor instanceof IJFaceNodeAdapter) {
IJFaceNodeAdapter adapter = (IJFaceNodeAdapter) adapterFor;
return adapter.getLabelImage((infoTree.getInput()));
}
}
return super.getImage(element);
}
public String getText(Object element) {
if (element instanceof Class) {
return "Class: " + ((Class) element).getName(); //$NON-NLS-1$
}
if (element instanceof Collection) {
return "Registered Adapters:"; //$NON-NLS-1$
}
if (element instanceof IRegion) {
return "Indexed Region offset span: [" + ((IRegion) element).getOffset() + "-" + ((IRegion) element).getLength() + "]"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
if (element instanceof TreeViewer && infoTree.getInput() instanceof INodeNotifier) {
IJFaceNodeAdapter adapter = (IJFaceNodeAdapter) ((INodeNotifier) infoTree.getInput()).getAdapterFor(IJFaceNodeAdapter.class);
if (adapter != null) {
return adapter.getLabelText((infoTree.getInput()));
}
}
return super.getText(element);
}
});