protected void preservingSelection(Runnable updateCode) {
		if (!getPreserveSelection()) {
			return;
		}
    	//If a check provider is present, it determines the state across input
    	//changes.
    	if(checkStateProvider != null) {
    		//Try to preserve the selection, let the ICheckProvider manage 
    		//the check states
    		super.preservingSelection(updateCode);
    		return;
    	}
    	
    	//Preserve checked items
        TableItem[] children = getTable().getItems();
        CustomHashtable checked = newHashtable(children.length * 2 + 1);
        CustomHashtable grayed = newHashtable(children.length * 2 + 1);

        for (int i = 0; i < children.length; i++) {
            TableItem item = children[i];
            Object data = item.getData();
            if (data != null) {
                if (item.getChecked()) {
					checked.put(data, data);
				}
                if (item.getGrayed()) {
					grayed.put(data, data);
				}
            }
        }

        super.preservingSelection(updateCode);

        children = getTable().getItems();
        for (int i = 0; i < children.length; i++) {
            TableItem item = children[i];
            Object data = item.getData();
            if (data != null) {
                item.setChecked(checked.containsKey(data));
                item.setGrayed(grayed.containsKey(data));
            }
        }
    }