Bug 6733 - [Viewers] API: inconsistent for CheckBoxTreeViewer
Summary: [Viewers] API: inconsistent for CheckBoxTreeViewer
Status: NEW
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 1.0   Edit
Hardware: PC Windows 2000
: P4 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Platform UI Triaged CLA
QA Contact:
URL:
Whiteboard:
Keywords: api, helpwanted
Depends on:
Blocks:
 
Reported: 2001-12-10 10:47 EST by Adam Kiezun CLA
Modified: 2019-09-06 15:31 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Adam Kiezun CLA 2001-12-10 10:47:34 EST
in order to make the graying and checking work correctly, you need methods that 
are missing from CheckBoxTreeViewer

API for that class is _very_ inconsistent:
1. there's setGrayChecked but it takes only 1 flag instead of 2
2. there's setParentsGrayed but there's no setParentsChecked
3. there's setSubtreeChecked but there's no setSubtreeGrayed

is there any reason why these method should be missing?

how do i work around this limitation?
Comment 1 Nick Edgar CLA 2001-12-19 11:06:20 EST
1. setGrayChecked is just an optimization to set the gray and check state at 
the same time, to the same value.  Use setGrayed and setChecked separately if 
this is not what you want.

2. When all child elements become white checked, you want to white check the 
parent, but not necessarily all parents, since there may be siblings that 
aren't white checked.  What is your use case for wanting setParentsChecked?

3. Normally graying only occurs on parents, when not all children are checked.  
What is your use case here?

Check box trees should maintain the following invariants:
- parent is white checked IFF all children are white checked
- parent is gray checked IFF some but not all children are unchecked or gray 
checked
- parent is unchecked IFF all children are unchecked

The viewer could do more to help with this, but it's not clear that the changes 
proposed above would actually help.
Comment 2 Adam Kiezun CLA 2001-12-19 13:23:20 EST
1. this method should be removed then - the performance benefit is next to none 
and confusion is real. no benefit in keeping such a method.

2. i select a leaf node - i want all parents checked
3. i select a middle-tier node - want all subnodes white (checked)


>- parent is white checked IFF all children are white checked
>- parent is gray checked IFF some but not all children are unchecked or gray 
>checked
>- parent is unchecked IFF all children are unchecked

btw, import wizard in the resource perspective violates *all* 3 of these rules.

to make it work for our own dialogs we had to subclass the viewer and put 
workarounds for the missing functionality.

i'm not saying these methods will be enough - but they are needed
Comment 3 Nick Edgar CLA 2003-02-09 22:19:15 EST
Not for 2.1.
Comment 4 Nick Edgar CLA 2004-05-07 10:19:43 EDT
Not for 3.0.
Comment 5 Boris Bokowski CLA 2009-11-26 09:49:32 EST
Hitesh is now responsible for watching bugs in the [Viewers] component area.
Comment 6 Eclipse Webmaster CLA 2019-09-06 15:31:15 EDT
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.

If you have further information on the current state of the bug, please add it. 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.