Community
Participate
Working Groups
CheckboxTableViewer doesn't fire CheckStateChangedEvent correctly when you set the checked states programmatically with setChecked(Object,boolean). I'm about to write a patch for the CheckboxTableViewer and maybe some tests to cover this scenario. Or is this behavior volitional? Using Eclipse Version: 3.3.0 Build id: N20060812-0010
See also bug 150805 (which is about the tree viewer).
In general, SWT will only fire events if they are generated by the window system (e.g. caused by the user), not when you change state programmatically. We try to follow the same design principle in JFace. Since this is not causing a bug (like bug 150805), I'm closing this as WONTFIX.
Boris, if the JFace team does not like the idea - no problem. But it seems that the users really want this feature. i would propose the do it like this: add new methods to the CheckBoxTable/TreeViewer like this: setChecked(Object element, boolean state, boolean informListeners) in which we have the functionality + fire events if informListeners = true the old setChecked(Object element, boolean state) only calls setChecked(element,state,false); Just an idea...but i like it :) (maybe you could reopen this for some discussions)
(In reply to comment #3) > Boris, if the JFace team does not like the idea - no problem. But it seems that > the users really want this feature. Feel free to reopen this bug, but we would need an argumentation why the current behaviour is not sufficient.
I'll reopen this. This makes it really hard to use this class away from dump user selection. Lets say I want to have a "select all" or "select filtered" or whatever button. I can update the internal state but from the outside world it seems nothing has changed (listener is not called), e.g. if I have a page that listens for changes and set it as done if at least one item is selected I have to code this twice. If it is decided to not change the current behavior, my suggestion would be to add a new method accepting a boolean if or not listeners should be notified about the change. e.g. CheckboxTableViewer.setGrayed(Object item, boolean state, boolean notifyListener)