Buggy code:
public class Shell extends Decorations { NSWindow window ; SWTWindowDelegate windowDelegate ; boolean opened ; boolean moved ; boolean resized ; boolean fullScreen ; Control lastActive ; Rectangle normalBounds ; static int DEFAULT_CLIENT_WIDTH = - 1 ; static int DEFAULT_CLIENT_HEIGHT = - 1 ; public Shell ( ) { } public Shell ( int style ) { } public Shell ( Display display ) { } public Shell ( Display display , int style ) { } Shell ( Display display , Shell parent , int style , int handle , boolean embedded ) { } public Shell ( Shell parent ) { } public Shell ( Shell parent , int style ) { } public static Shell internal_new ( Display display , int handle ) { } public static Shell cocoa_new ( Display display , int handle ) { } static int checkStyle ( int style ) { } boolean accessibilityIsIgnored ( int id , int sel ) { } public void addShellListener ( ShellListener listener ) { } void bringToTop ( boolean force ) { } boolean canBecomeKeyWindow ( int id , int sel ) { } void checkOpen ( ) { } public void close ( ) { } void closeWidget ( ) { } public Rectangle computeTrim ( int x , int y , int width , int height ) { } void createHandle ( ) { } void deregister ( ) { } void destroyWidget ( ) { } void drawWidget ( int id , NSRect rect , boolean sendPaint ) { } Control findBackgroundControl ( ) { } Composite findDeferredControl ( ) { } Cursor findCursor ( ) { } void fixShell ( Shell newShell , Control control ) { } public void forceActive ( ) { } public int getAlpha ( ) { } public Rectangle getBounds ( ) { } public Rectangle getClientArea ( ) { } int getDrawCount ( ) { } public boolean getFullScreen ( ) { } public int getImeInputMode ( ) { } public Point getLocation ( ) { } public boolean getMaximized ( ) { } Shell getModalShell ( ) { } public boolean getMinimized ( ) { } public Point getMinimumSize ( ) { } float [ ] getParentBackground ( ) { } public Region getRegion ( ) { } public Shell getShell ( ) { } public Shell [ ] getShells ( ) { } public Point getSize ( ) { } float getThemeAlpha ( ) { } boolean hasBorder ( ) { } void helpRequested ( int id , int sel , int theEvent ) { } public boolean isEnabled ( ) { } boolean isEnabledCursor ( ) { } public boolean isVisible ( ) { } boolean makeFirstResponder ( int id , int sel , int notification ) { } public void open ( ) { } public boolean print ( GC gc ) { } void register ( ) { } void releaseChildren ( boolean destroy ) { } void releaseHandle ( ) { } void releaseParent ( ) { } void releaseWidget ( ) { } public void removeShellListener ( ShellListener listener ) { } public void setActive ( ) { } void setActiveControl ( Control control ) { } public void setAlpha ( int alpha ) { } void setBounds ( int x , int y , int width , int height , boolean move , boolean resize ) { } void setClipRegion ( float x , float y ) { } public void setEnabled ( boolean enabled ) { } public void setFullScreen ( boolean fullScreen ) { } public void setMenuBar ( Menu menu ) { } public void setImeInputMode ( int mode ) { } public void setMaximized ( boolean maximized ) { } public void setMinimized ( boolean minimized ) { } public void setMinimumSize ( int width , int height ) { } public void setMinimumSize ( Point size ) { } public void setRegion ( Region region ) { } public void setText ( String string ) { } public void setVisible ( boolean visible ) { } void setWindowVisible ( boolean visible , boolean key ) { } void setZOrder ( ) { } void setZOrder ( Control control , boolean above ) { } boolean traverseEscape ( ) { } void updateModal ( ) { } void updateSystemUIMode ( ) { } void windowDidBecomeKey ( int id , int sel , int notification ) { super . windowDidBecomeKey ( id , sel , notification ) ; Display display = this . display ; display . setMenuBar ( menuBar ) ; sendEvent ( Activate ) ; <START_BUG> Control control = display . getFocusControl ( ) ; <END_BUG> if ( ( ( control != null ) && ( ! ( control . isDisposed ( ) ) ) ) && ( control != ( display . focusControl ) ) ) { display . focusControl = control ; control . sendFocusEvent ( FocusIn , false ) ; } } void windowDidMove ( int id , int sel , int notification ) { } void windowDidResize ( int id , int sel , int notification ) { } void windowDidResignKey ( int id , int sel , int notification ) { } boolean windowShouldClose ( int id , int sel , int window ) { } }

Fix:
Control control = Display . GetFocusControl ( window ) ;