我通过以下方式使用带有复选框样式的 tableviewer
tableViewer = new TableViewer(parent, SWT.MULTI | SWT.FULL_SELECTION | SWT.BORDER| SWT.CHECK);
我使用以下代码来收听 tableviewer。我知道这是错误的,因为它听选择而不是复选框选择。
tableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent event) {
IStructuredSelection selection = (IStructuredSelection)tableViewer.getSelection();
Object firstElement = selection.getFirstElement();
System.out.println("firstElement"+firstElement);
// Do something with it
}
});
我需要听 JFace TableViewer 中的复选框选择。
提前致谢