Bug 270457 [Viewers] [regression] CheckBoxTreeViewer clears check state after collapseAll
Hi there :) In my RCP I've a CheckBoxTreeViewer that looses check states for invisible items. Turns out if a disable the collapseAll() call things go back to normal. So, in a tree like this: [x] root [x] sub a collapseAll expandAll will create this: [x] root [] sub Could still be my fault, feel free to have me try some workarounds or other tests that help you find the cause...
bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/CheckboxTreeViewer.java
/* (non-Javadoc)
     * Method declared on Viewer.
     */
    protected void preservingSelection(Runnable updateCode) {
    	if (!getPreserveSelection()) {
    		return;
    	}
    	
    	
    	if(checkStateProvider != null) {
    		 
    		
    		super.preservingSelection(updateCode);
    		return;
    	}
    	
    	
        int n = getItemCount(getControl());
        CustomHashtable checkedNodes = newHashtable(n * 2 + 1);
        CustomHashtable grayedNodes = newHashtable(n * 2 + 1);
        gatherState(checkedNodes, grayedNodes, getControl());
        super.preservingSelection(updateCode);
        applyState(checkedNodes, grayedNodes, getControl());
    }
    /* (non-Javadoc)
     * Method declared on ICheckable.
     */
    public void removeCheckStateListener(ICheckStateListener listener) {
        checkStateListeners.remove(listener);
    }