event.detail = e.detail;
void textEvent (Event event) {	switch (event.type) {		case SWT.FocusIn: {			if (hasFocus) return;			hasFocus = true;			if (getEditable ()) text.selectAll ();			Event e = new Event();			e.time = event.time;			notifyListeners(SWT.FocusIn, e);			break;		}		case SWT.FocusOut: {			event.display.asyncExec(new Runnable() {				public void run() {					if (CCombo.this.isDisposed()) return;					Control focusControl = getDisplay().getFocusControl();					if (focusControl == arrow || focusControl == list || focusControl == text) return;					hasFocus = false;					Event e = new Event();					notifyListeners(SWT.FocusOut, e);				}			});			break;		}		case SWT.KeyDown: {						if (event.character == SWT.ESC) { // escape key cancels popup list				dropDown (false);			}			if (event.character == SWT.CR) {				dropDown (false);				Event e = new Event();				e.time = event.time;				e.stateMask = event.stateMask;				notifyListeners(SWT.DefaultSelection, e);			}			//At this point the widget may have been disposed.			// If so, do not continue.			if (isDisposed()) break;						if (event.keyCode == SWT.ARROW_UP || event.keyCode == SWT.ARROW_DOWN) {				if ((event.stateMask & SWT.ALT) != 0) {					boolean dropped = isDropped ();					text.selectAll ();					if (!dropped) setFocus ();					dropDown (!dropped);					break;				}				int oldIndex = getSelectionIndex ();				if (event.keyCode == SWT.ARROW_UP) {					select (Math.max (oldIndex - 1, 0));				} else {					select (Math.min (oldIndex + 1, getItemCount () - 1));				}						if (oldIndex != getSelectionIndex ()) {					Event e = new Event();					e.time = event.time;					e.stateMask = event.stateMask;					notifyListeners(SWT.Selection, e);				}				//At this point the widget may have been disposed.				// If so, do not continue.				if (isDisposed()) break;			}						// Further work : Need to add support for incremental search in 			// pop up list as characters typed in text widget									Event e = new Event();			e.time = event.time;			e.character = event.character;			e.keyCode = event.keyCode;			e.stateMask = event.stateMask;			notifyListeners(SWT.KeyDown, e);			break;		}		case SWT.KeyUp: {			Event e = new Event();			e.time = event.time;			e.character = event.character;			e.keyCode = event.keyCode;			e.stateMask = event.stateMask;			notifyListeners(SWT.KeyUp, e);			break;		}		case SWT.Modify: {			list.deselectAll ();			Event e = new Event();			e.time = event.time;			notifyListeners(SWT.Modify, e);			break;		}		case SWT.MouseDown: {			if (event.button != 1) return;			if (text.getEditable ()) return;			boolean dropped = isDropped ();			text.selectAll ();			if (!dropped) setFocus ();			dropDown (!dropped);			break;		}		case SWT.MouseUp: {			if (event.button != 1) return;			if (text.getEditable ()) return;			text.selectAll ();			break;		}		case SWT.Traverse: {					switch (event.detail) {				case SWT.TRAVERSE_RETURN:				case SWT.TRAVERSE_ARROW_PREVIOUS:				case SWT.TRAVERSE_ARROW_NEXT:					// The enter causes default selection and					// the arrow keys are used to manipulate the list contents so					// do not use them for traversal.					event.doit = false;					break;			}						Event e = new Event();			e.time = event.time;			e.detail = event.detail;			e.doit = event.doit;			e.character = event.character;			e.keyCode = event.keyCode;			notifyListeners(SWT.Traverse, e);			event.doit = e.doit;			break;		}	}}