Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 7543

Summary: Import/Export checkbox tree states inconsistent
Product: [Eclipse Project] Platform Reporter: Lynne Kues <lynne_kues>
Component: UIAssignee: Nick Edgar <n.a.edgar>
Status: RESOLVED WORKSFORME QA Contact:
Severity: normal    
Priority: P3 CC: martinae, Tod_Creasey
Version: 2.0   
Target Milestone: ---   
Hardware: PC   
OS: Windows NT   
Whiteboard:
Bug Depends on: 6734    
Bug Blocks:    
Attachments:
Description Flags
zip file containing patched classes none

Description Lynne Kues CLA 2002-01-14 11:39:48 EST
1. Open the Import Wizard.
2. Specify a file directory.
3. Check off the file directory.  All of its children are selected.
4. Uncheck one of the directory's files. The state of the directory check box 
goes to gray.  This is correct.
5. Now check off the file in Step 4.  The state of the directory check box 
remains gray.  It should go back to the "all selected" state.

The same behavior exists in the Export Wizard.  

Is this behavior intentional?  Usually the check box state indicates what is 
checked (all or some) and does not take into account how something was 
checked.
Comment 1 Nick Edgar CLA 2002-01-15 15:03:30 EST
Agree.  In general such trees should maintain the following invariants:
- item is white checked IFF all children are checked
- item is gray checked IFF some but not all children are checked
- item is unchecked IFF all children are unchecked

Note that there is special handling in the export dialog for the create 
directories option.  If unchecked, it only creates directories for folders 
which are white-checked.  I may have this wrong though.  Tod can clarify.
Comment 2 Lynne Kues CLA 2002-01-16 17:36:43 EST
Same scenario exists on tree side also.  Say you have the following hierarchy 
and you check off the root item (ItemA).  Now if you uncheck one of its children 
(say ItemA1), ItemA will be grayed.  Now recheck ItemA1.  ItemA should be white, 
but it is not.

-ItemA
--ItemA1
---ItemA1a
---ItemA1b
--ItemA2
--ItemA3
---ItemA3a

Comment 3 Lynne Kues CLA 2002-01-16 17:51:06 EST
Also if you select the root below (ItemA) and filter types on *.txt the tree 
check boxes are gray (vs. white).

ItemA
--itemA.txt
--ItemA1
---itemA1.txt
--ItemA2
---itemA2.txt

And lastly, if you have all children of an item selected and then open the 
Export Wizard, the item will be gray checked (vs. white checked).

Basically all callers of grayUpdateHierarchy(Object) in ResourceTreeAndListGroup 
need to call updateHierarchy(Object) instead.
Comment 4 Lynne Kues CLA 2002-01-16 18:56:29 EST
Also found a bug with the initial selection setting for the Export Wizard.  I 
have a project hierarchy as follows:

Test (project)
-- My Documents (folder)
---- Licences (folder)
------ file.html (file)
-- Spec (folder)

Select the "My Documents" folder and open the Export Wizard.
Expand the Text project.
Select the Licences folder.
Uncheck file.html.

At this point the check box states are incorrect.
Comment 5 Lynne Kues CLA 2002-01-17 15:17:10 EST
Created attachment 232 [details]
zip file containing patched classes
Comment 6 Lynne Kues CLA 2002-01-17 15:24:11 EST
Asked TC to review.
Comment 7 Tod Creasey CLA 2002-01-17 16:02:02 EST
This is currently working correctly.

If you select a folder it becomes white selected. If you then deselect some of 
its entries it becomes gray selected as you have chosen to longer bring it all 
in.

Now if you select all of the elements in it it stays gray selected as you have 
only selected the contents - not the folder itself.

If we reselect the folder the user will be bringing in the folder as well as 
the files which is not what they chose to do as they had no selected the folder.
Comment 8 Martin Aeschlimann CLA 2002-02-12 13:26:36 EST
sorry for reopening, but the current behaviour is not standard. The behaviour 
should be similar to VAJ: A container is checked and non-gray (white) when all 
its children are checked.

We would like to reuse this component in the Javadoc generation wizard.
also see bug 6734 (JAR packager)

If folders are also considered to be selectable elements (e.g. you want to 
express that a folder is exported), a checkboxviewer without graystates is to 
use. Then, folders and files are independendly checkable and all combination of 
checked folders and files are expressable.

Comment 9 Nick Edgar CLA 2002-02-12 14:44:54 EST
Martin, could you please clarify what you mean by the last paragraph.
Comment 10 Martin Aeschlimann CLA 2002-02-13 12:33:57 EST
If the use case is to only a export a folder directory but the not contained 
resource (resulting in an new, empty folder), then a bare check tree should be 
used.
-> check state of the container is not derived the check state of the children
Comment 11 Tod Creasey CLA 2002-05-07 16:48:01 EDT
This is the current behavior. Any whitechecked entry in either pane will be 
exported. It is currently not possible to export an empty directory. Gray means 
not exported, white means it is.