if (focusItem.availableIndex < anchorItem.availableIndex) { deselectItem (focusItem); redrawItem (focusItem.availableIndex, true); }
void onArrowDown (int stateMask) {	if ((stateMask & (SWT.SHIFT | SWT.CTRL)) == 0) {		/* Down Arrow with no modifiers */		int newFocusIndex = focusItem.availableIndex + 1;		if (newFocusIndex == availableItemsCount) return; 	/* at bottom */		selectItem (availableItems [newFocusIndex], false);		setFocusItem (availableItems [newFocusIndex], true);		redrawItem (newFocusIndex, true);		showItem (availableItems [newFocusIndex]);		Event newEvent = new Event ();		newEvent.item = availableItems [newFocusIndex];		postEvent (SWT.Selection, newEvent);		return;	}	if ((style & SWT.SINGLE) != 0) {		if ((stateMask & SWT.CTRL) != 0) {			/* CTRL+Down Arrow, CTRL+Shift+Down Arrow */			Rectangle clientArea = getClientArea ();			int visibleItemCount = (clientArea.height - getHeaderHeight ()) / itemHeight;			if (availableItemsCount <= topIndex + visibleItemCount) return;	/* at bottom */			update ();			topIndex++;			getVerticalBar ().setSelection (topIndex);			GC gc = new GC (this);			gc.copyArea (				0, 0,				clientArea.width, clientArea.height,				0, -itemHeight);			gc.dispose ();			return;		}		/* Shift+Down Arrow */		int newFocusIndex = focusItem.availableIndex + 1;		if (newFocusIndex == availableItemsCount) return; 	/* at bottom */		selectItem (availableItems [newFocusIndex], false);		setFocusItem (availableItems [newFocusIndex], true);		redrawItem (newFocusIndex, true);		showItem (availableItems [newFocusIndex]);		Event newEvent = new Event ();		newEvent.item = availableItems [newFocusIndex];		postEvent (SWT.Selection, newEvent);		return;	}	/* SWT.MULTI */	if ((stateMask & SWT.CTRL) != 0) {		if ((stateMask & SWT.SHIFT) != 0) {			/* CTRL+Shift+Down Arrow */			Rectangle clientArea = getClientArea ();			int visibleItemCount = (clientArea.height - getHeaderHeight ()) / itemHeight;			if (availableItemsCount <= topIndex + visibleItemCount) return;	/* at bottom */			update ();			topIndex++;			getVerticalBar ().setSelection (topIndex);			GC gc = new GC (this);			gc.copyArea (				0, 0,				clientArea.width, clientArea.height,				0, -itemHeight);			gc.dispose ();			return;		}		/* CTRL+Down Arrow */		int focusIndex = focusItem.availableIndex; 		if (focusIndex == availableItemsCount - 1) return;	/* at bottom */		TreeItem newFocusItem = availableItems [focusIndex + 1];		setFocusItem (newFocusItem, true);		redrawItem (newFocusItem.availableIndex, true);		showItem (newFocusItem);		return;	}	/* Shift+Down Arrow */	int newFocusIndex = focusItem.availableIndex + 1;	if (newFocusIndex == availableItemsCount) return; 	/* at bottom */	if (anchorItem == null) anchorItem = focusItem;	selectItem (availableItems [newFocusIndex], true);	setFocusItem (availableItems [newFocusIndex], true);	redrawItem (newFocusIndex, true);	showItem (availableItems [newFocusIndex]);	Event newEvent = new Event ();	newEvent.item = availableItems [newFocusIndex];	postEvent (SWT.Selection, newEvent);}