| Summary: | [Viewers] ContainerCheckedTreeViewer: incorrect preservingSelection | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] Platform | Reporter: | Martin Aeschlimann <martinae> | ||||
| Component: | UI | Assignee: | Platform UI Triaged <platform-ui-triaged> | ||||
| Status: | CLOSED WONTFIX | QA Contact: | |||||
| Severity: | normal | ||||||
| Priority: | P3 | CC: | mirek.begier, n.a.edgar, philippe_mulet, wuppiwuppi, wuut | ||||
| Version: | 2.0 | Keywords: | helpwanted | ||||
| Target Milestone: | --- | ||||||
| Hardware: | PC | ||||||
| OS: | Windows 2000 | ||||||
| Whiteboard: | stalebug | ||||||
| Attachments: |
|
||||||
|
Description
Martin Aeschlimann
Martin, would you mind either doing this in client code, or attaching a revised ContainerCheckedTreeViewer? Thanks Created attachment 1083 [details]
updated ContainerCheckedTreeViewer
*** Bug 22033 has been marked as a duplicate of this bug. *** The attached code does not appear to work as expected. On ContainerCheckedTreeViewer I did the steps as reported: 1/ Open Override Methods 2/ Unchecked the Group methods by type checkbox 3/ Select addHelpListener 4/ Check the Group methods by type checkbox No entries appear greyed, nor is there a checkbox beside the viewer class. The selection is not checked in the viewer class when I expand, nor is it selected whn I uncheck the methods by type checkbox a second time (the original configuration when I checked the box). If I perform the same test with addTreeListener (public) checked then I believe I get the expected behaviour. Checking both addTreeListener entries displays the behaviour I mentioned above. Not for 2.1. I find this bug in ContainerCheckedTreeViewer class
in method "updateParentItems(TreeItem item)" there is
item.setChecked(containsChecked);
item.setGrayed(containsChecked && containsUnchecked);
but should be:
if (containsChecked) {
item.setChecked(true);
}
item.setGrayed(containsUnchecked);
Thanks for the suggestion, Mirek, but I think there are a couple of issues with it: 1. items are reused across different elements, so the checked state needs to be assigned each time 2. the invariants we want to maintain are: a) a container node should be white-checked if-and-only-if all children are checked b) a container node should be gray-checked if-and-only-if some but not all children are checked c) a container node should be unchecked if-and-only-if no children are checked but item.setGrayed(containsUnchecked) would incorrectly result in case c being gray. I'm sory I have Eclipse 3.2 M6 but here is 2.0
And there(3.2M6) when I have a tree
vA-|
vB-|
vC
where "v" - means check option
and I want eg. unchecked C, now in (Eclipse 3.2 M6) I get
A-|
B-|
C
but result should be
gvA-|
gvB-|
C
where "gv" is grayed and chacked
That's correct if C has siblings. If C is the only child of B, then B should be unchecked (and not gray), and likewise up the chain. > That's correct if C has siblings. If C is the only child of B, then B should
> be unchecked (and not gray), and likewise up the chain.
Ok,That's correct if tree show some options, but I want show eg. some directories, and don't want check sub directories.
Is this still a problem? Yes, this is still no fixed. In the override dialog, we added a workaround, by setting the checked elements again after refreshing. Hitesh is now responsible for watching bugs in the [Viewers] component area. This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug. If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. -- The automated Eclipse Genie. |