I have a CheckboxTableViewer which checkElements are bound to an EMF EList Property using JFace and EMF Databinding. This works great.
My problem started when I introduced a filter text field, so the user can filter the entries that are displayed in the table. This is implemented by adding a ViewerFilter to the table which filters the entries based on the filter text field input. The table is refreshed when the text in the filter text field changes. This in itself also works as expected.
Unfortunately, if an element is removed from the display by the filter and is then added again (because the filter text has been changed in a way to include the element again), the element looses it's checked state.
I think the problem might be caused, because the checked state is saved in the TreeItem widget which gets removed and later recreated when the filter changes.
My current thinking is that I will probably have to trigger an updateTargets on the DataBindingContext. I don't realy like this approach because the filter implementation does not know anything about the databinding, so it would be nice if I could solve this issue with the viewer api.
Just for the records as ran into the same problem:
You need to specify a provider that saves the checked states via viewer.setCheckStateProvider(..).
For getting notified of the checkstate-changes you can register the provider as check-state-listener: viewer.addCheckStateListener(...) and update the internal state of the provider accordingly.
Afterwards your CheckboxTableViewer can be filtered without loosing the checked-states.