lastFocus[0] = currentFocus;
private static void initCheckFocus (final Display display) {	if (display.getData(CHECK_FOCUS) != null) return;	display.setData(CHECK_FOCUS, CHECK_FOCUS);	final int time = 50;	final Runnable[] timer = new Runnable[1];	final Control[] lastFocus = new Control[1];	timer[0] = new Runnable() {		public void run() {			Control currentFocus = display.getFocusControl();			if (lastFocus[0] != currentFocus) {				Event event = new Event();				if (lastFocus[0] instanceof OleFrame) {					if (!lastFocus [0].isDisposed()) {						OleFrame frame = (OleFrame) lastFocus[0];						OleClientSite client = frame.getCurrentDocument();						if (client != null) {							client.notifyListeners (SWT.FocusOut, event);						}					}				}				if (lastFocus [0] instanceof OleControlSite) {					if (!lastFocus[0].isDisposed()) {						lastFocus[0].notifyListeners (SWT.FocusOut, event);					}				}				if (currentFocus instanceof OleFrame) {					OleFrame frame = (OleFrame) currentFocus;					OleClientSite client = frame.getCurrentDocument();					if (client != null) {						client.notifyListeners (SWT.FocusIn, event);					}				}				if (currentFocus instanceof OleControlSite) {					currentFocus.notifyListeners(SWT.FocusIn, event);				}			}			lastFocus[0] = currentFocus;			display.timerExec(time, timer[0]);		}	};	display.timerExec(time, timer[0]);}