private void updateParentState(IResource child, boolean baseChildState) {
if (mode == MODE_FLAT || child == null || child.getParent() == null || resourceList.contains(child.getParent())) {
return;
}
CheckboxTreeViewer checkboxTreeViewer = (CheckboxTreeViewer)treeViewer;
if (child == null) return;
Object parent = resourceSelectionContentProvider.getParent(child);
if (parent == null) return;
boolean allSameState = true;
Object[] children = null;
children = resourceSelectionContentProvider.getChildren(parent);
for (int i = children.length - 1; i >= 0; i--) {
if (checkboxTreeViewer.getChecked(children[i]) != baseChildState || checkboxTreeViewer.getGrayed(children[i])) {
allSameState = false;
break;
}
}
checkboxTreeViewer.setGrayed(parent, !allSameState);
checkboxTreeViewer.setChecked(parent, !allSameState || baseChildState);
updateParentState((IResource)parent, baseChildState);
}