int index = selectedIndex + offset;
int index; if (!mru) { index = selectedIndex + offset; } else { int[] visible = new int[items.length]; int idx = 0; int current = -1; for (int i = 0; i < items.length; i++) { if (items[i].showing) { if (i == selectedIndex) current = idx; visible [idx++] = i; } } if (current + offset >= 0 && current + offset < idx){ index = visible [current + offset]; } else { if (showChevron) { CTabFolderEvent e = new CTabFolderEvent(this); e.widget = this; e.time = event.time; e.x = chevronRect.x; e.y = chevronRect.y; e.width = chevronRect.width; e.height = chevronRect.height; e.doit = true; for (int i = 0; i < folderListeners.length; i++) { folderListeners[i].showList(e); } if (e.doit && !isDisposed()) { showList(chevronRect); } } return; } }
void onKeyDown (Event event) {	switch (event.keyCode) {		case SWT.ARROW_LEFT:		case SWT.ARROW_RIGHT:			int count = items.length;			if (count == 0) return;			if (selectedIndex  == -1) return;			int leadKey = (getStyle() & SWT.RIGHT_TO_LEFT) != 0 ? SWT.ARROW_RIGHT : SWT.ARROW_LEFT;			int offset =  event.keyCode == leadKey ? -1 : 1;			int index = selectedIndex + offset;			if (index < 0 || index >= count) return;			setSelection (index, true);			forceFocus();	}}