[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.platform.rcp] Re: Detect Check listener events from ContainerCheckedViewer

I probably wasn't too clear with my request, as I now realize, but hopefully this will help somebody in future :)

I added the following listener to my ContainerCheckedTreeViewer, this converts the checked items into a selection, and notifies selection listeners on the workbench:


private class CheckListener implements ICheckStateListener {
@Override
public void checkStateChanged(CheckStateChangedEvent event) {
ContainerCheckedTreeViewer containerCheckedTreeViewer = (ContainerCheckedTreeViewer) event.getSource();
// Get the ticked elements from the viewer
StructuredSelection selection = new StructuredSelection(containerCheckedTreeViewer.getCheckedElements());
// Set the new selection based on what's ticked
containerCheckedTreeViewer.setSelection(selection);
}
}


Jen