void setSelection (CTableItem[] items, boolean updateViewport) {
	if (items.length == 0 || ((getStyle () & SWT.SINGLE) != 0 && items.length > 1)) {
		deselectAll ();
		return;
	}
	CTableItem[] oldSelection = selectedItems;
	
	/* remove null and duplicate items */
	int index = 0;
	selectedItems = new CTableItem [items.length];	/* assume all valid items */
	for (int i = 0; i < items.length; i++) {
		CTableItem item = items [i];
		if (item != null && item.parent == this && !item.isSelected ()) {
			selectedItems [index++] = item;
		}
	}
	if (index != items.length) {
		/* an invalid item was provided so resize the array accordingly */
		CTableItem[] temp = new CTableItem [index];
		System.arraycopy (selectedItems, 0, temp, 0, index);
		selectedItems = temp;
	}
	if (selectedItems.length == 0) {	/* no valid items */
		deselectAll ();
		return;
	}

	boolean tableSelectionChanged = false;
	if (isFocusControl () || (getStyle () & SWT.HIDE_SELECTION) == 0) {
		for (int i = 0; i < oldSelection.length; i++) {
			if (!oldSelection [i].isSelected ()) {
				redrawItem (oldSelection [i].index, true);
				oldSelection[i].getAccessible(getAccessible(), 0).selectionChanged();
				tableSelectionChanged = true;
			}
		}
		for (int i = 0; i < selectedItems.length; i++) {
			redrawItem (selectedItems [i].index, true);
			selectedItems[i].getAccessible(getAccessible(), 0).selectionChanged();
			tableSelectionChanged = true;
		}
	}
	if (updateViewport) {
		showItem (selectedItems [0]);
		setFocusItem (selectedItems [0], true);
	}
	
	if (tableSelectionChanged) getAccessible().selectionChanged();
}