if ((oldCount == 0 || itemsCount == 0) && isFocusControl ()) { redraw (); return; }
public void setItemCount (int count) {	checkWidget ();	count = Math.max (0, count);	if (count == itemsCount) return;	int redrawStart, redrawEnd;		/* if the new item count is less than the current count then remove all excess items from the end */	if (count < itemsCount) {		redrawStart = count;		redrawEnd = itemsCount - 1;		for (int i = count; i < itemsCount; i++) {			items [i].dispose (false);		}		int newSelectedCount = 0;		for (int i = 0; i < selectedItems.length; i++) {			if (!selectedItems [i].isDisposed ()) newSelectedCount++;		}		if (newSelectedCount != selectedItems.length) {			/* one or more selected items have been disposed */			TableItem[] newSelectedItems = new TableItem [newSelectedCount];			int pos = 0;			for (int i = 0; i < selectedItems.length; i++) {				TableItem item = selectedItems [i];				if (!item.isDisposed ()) {					newSelectedItems [pos++] = item;				}			}			selectedItems = newSelectedItems;		}		if (anchorItem != null && anchorItem.isDisposed ()) anchorItem = null;		if (lastClickedItem != null && lastClickedItem.isDisposed ()) lastClickedItem = null;		if (focusItem != null && focusItem.isDisposed ()) {			TableItem newFocusItem = count > 0 ? items [count - 1] : null; 			setFocusItem (newFocusItem, false);		}		itemsCount = count;		if (columns.length == 0) updateHorizontalBar ();	} else {		redrawStart = itemsCount;		redrawEnd = count - 1;		TableItem[] newItems = new TableItem [count];		System.arraycopy (items, 0, newItems, 0, itemsCount);		items = newItems;		for (int i = itemsCount; i < count; i++) {			items [i] = new TableItem (this, SWT.NONE, i, false);			itemsCount++;		}	}	updateVerticalBar ();	redrawItems (redrawStart, redrawEnd, false);}