Buggy code:
public class ApplicationWindow extends Window implements IRunnableContext { private MenuManager menuBarManager = null ; private ToolBarManager toolBarManager = null ; private StatusLineManager statusLineManager = null ; private boolean operationInProgress = false ; class ApplicationWindowLayout extends Layout { static final int VGAP = 2 ; protected Point computeSize ( Composite composite , int wHint , int hHint , boolean flushCache ) { } protected void layout ( Composite composite , boolean flushCache ) { } } public ApplicationWindow ( Shell parentShell ) { } protected void addMenuBar ( ) { } protected void addStatusLine ( ) { } protected void addToolBar ( int style ) { } protected void handleShellCloseEvent ( ) { } public boolean close ( ) { } protected void configureShell ( Shell shell ) { } protected MenuManager createMenuManager ( ) { } protected StatusLineManager createStatusLineManager ( ) { } protected ToolBarManager createToolBarManager ( int style ) { } protected Control createToolBarControl ( Shell shell ) { } protected Font getFont ( ) { } public MenuManager getMenuBarManager ( ) { } protected StatusLineManager getStatusLineManager ( ) { } public String getSymbolicFontName ( ) { } public ToolBarManager getToolBarManager ( ) { } protected Control getToolBarControl ( ) { } public void run ( final boolean fork , boolean cancelable , final IRunnableWithProgress runnable ) throws InterruptedException , InvocationTargetException { try { operationInProgress = true ; final StatusLineManager mgr = getStatusLineManager ( ) ; if ( mgr == null ) { runnable . run ( new NullProgressMonitor ( ) ) ; return ; } boolean cancelWasEnabled = mgr . isCancelEnabled ( ) ; final Control contents = getContents ( ) ; final Display display = contents . getDisplay ( ) ; Shell shell = getShell ( ) ; boolean contentsWasEnabled = contents . isEnabled ( ) ; MenuManager manager = getMenuBarManager ( ) ; Menu menuBar = null ; if ( manager != null ) { menuBar = manager . getMenu ( ) ; manager = null ; } boolean menuBarWasEnabled = false ; if ( menuBar != null ) menuBarWasEnabled = menuBar . isEnabled ( ) ; Control toolbarControl = getToolBarControl ( ) ; boolean toolbarWasEnabled = false ; if ( toolbarControl != null ) toolbarWasEnabled = toolbarControl . isEnabled ( ) ; Shell [ ] shells = display . getShells ( ) ; boolean [ ] enabled = new boolean [ shells . length ] ; for ( int i = 0 ; i < ( shells . length ) ; i ++ ) { Shell current = shells [ i ] ; if ( current == shell ) continue ; if ( ( current != null ) && ( ! ( current . isDisposed ( ) ) ) ) { enabled [ i ] = current . isEnabled ( ) ; current . setEnabled ( false ) ; } } Control currentFocus = display . getFocusControl ( ) ; try { contents . setEnabled ( false ) ; if ( menuBar != null ) menuBar . setEnabled ( false ) ; if ( toolbarControl != null ) toolbarControl . setEnabled ( false ) ; mgr . setCancelEnabled ( cancelable ) ; final Exception [ ] holder = new Exception [ 1 ] ; BusyIndicator . showWhile ( display , new Runnable ( ) { public void run ( ) { try { ModalContext . run ( runnable , fork , mgr . getProgressMonitor ( ) , display ) ; } catch ( InvocationTargetException ite ) { holder [ 0 ] = ite ; } catch ( InterruptedException ie ) { holder [ 0 ] = ie ; } } } ) ; if ( ( holder [ 0 ] ) != null ) { if ( ( holder [ 0 ] ) instanceof InvocationTargetException ) { throw ( ( InvocationTargetException ) ( holder [ 0 ] ) ) ; } else if ( ( holder [ 0 ] ) instanceof InterruptedException ) { throw ( ( InterruptedException ) ( holder [ 0 ] ) ) ; } } } finally { operationInProgress = false ; for ( int i = 0 ; i < ( shells . length ) ; i ++ ) { Shell current = shells [ i ] ; if ( current == shell ) continue ; if ( ( current != null ) && ( ! ( current . isDisposed ( ) ) ) ) { current . setEnabled ( enabled [ i ] ) ; } } if ( ! ( contents . isDisposed ( ) ) ) contents . setEnabled ( contentsWasEnabled ) ; if ( ( menuBar != null ) && ( ! ( menuBar . isDisposed ( ) ) ) ) menuBar . setEnabled ( menuBarWasEnabled ) ; if ( ( toolbarControl != null ) && ( ! ( toolbarControl . isDisposed ( ) ) ) ) toolbarControl . setEnabled ( toolbarWasEnabled ) ; mgr . setCancelEnabled ( cancelWasEnabled ) ; <START_BUG> if ( currentFocus != null ) <END_BUG> currentFocus . setFocus ( ) ; } } finally { operationInProgress = false ; } } public void setStatus ( String message ) { } protected boolean toolBarChildrenExist ( ) { } }

Fix:
if ( ( currentFocus != null ) && ( ! ( currentFocus . isDisposed ( ) ) ) )