Buggy code:
public class Workbench implements IPlatformRunnable , IExecutableExtension , IWorkbench { private WindowManager windowManager ; private WorkbenchWindow activatedWindow ; private EditorHistory editorHistory ; private PerspectiveHistory perspHistory ; private boolean runEventLoop ; private boolean isStarting = true ; private boolean isClosing = false ; private boolean autoBuild ; private Object returnCode ; private WorkbenchConfigurationInfo configurationInfo ; private ListenerList windowListeners = new ListenerList ( ) ; private String [ ] commandLineArgs ; private final IPropertyChangeListener propertyChangeListener = new IPropertyChangeListener ( ) { public void propertyChange ( PropertyChangeEvent event ) { } } ; private static final String [ ] VERSION_STRING = new String [ ] { "0.046" , "2.0" } ; private static final String DEFAULT_WORKBENCH_STATE_FILENAME = "workbench.xml" ; private static final int RESTORE_CODE_OK = 0 ; private static final int RESTORE_CODE_RESET = 1 ; private static final int RESTORE_CODE_EXIT = 2 ; protected static final String WELCOME_EDITOR_ID = "org.eclipse.ui.internal.dialogs.WelcomeEditor" ; public Workbench ( ) { } private IResourceChangeListener getShowTasksChangeListener ( ) { } private IMarker findProblemToShow ( IResourceChangeEvent event ) { } public void addWindowListener ( IWindowListener l ) { } public void removeWindowListener ( IWindowListener l ) { } protected void fireWindowOpened ( IWorkbenchWindow window ) { } protected void fireWindowClosed ( IWorkbenchWindow window ) { } protected void fireWindowActivated ( IWorkbenchWindow window ) { } protected void fireWindowDeactivated ( IWorkbenchWindow window ) { } private void addAdapters ( ) { } private boolean busyClose ( final boolean force ) { } public boolean saveAllEditors ( boolean confirm ) { } private IWorkbenchWindow busyOpenWorkbenchWindow ( String perspID , IAdaptable input ) throws WorkbenchException { } private void checkUpdates ( String [ ] commandLineArgs ) { } public boolean close ( ) { } public boolean close ( Object returnCode ) { } public boolean close ( Object returnCode , final boolean force ) { } protected WorkbenchActionBuilder createActionBuilder ( IWorkbenchWindow window ) { } private void connectToWorkspace ( ) { } private void disableAutoBuild ( ) { } private void disconnectFromWorkspace ( ) { } private void enableAutoBuild ( ) { } public IWorkbenchWindow getActiveWorkbenchWindow ( ) { } public String [ ] getCommandLineArgs ( ) { } public EditorHistory getEditorHistory ( ) { } public PerspectiveHistory getPerspectiveHistory ( ) { } public IEditorRegistry getEditorRegistry ( ) { } protected int getNewWindowNumber ( ) { } public IPerspectiveRegistry getPerspectiveRegistry ( ) { } public PreferenceManager getPreferenceManager ( ) { } public IPreferenceStore getPreferenceStore ( ) { } public ISharedImages getSharedImages ( ) { } public IMarkerHelpRegistry getMarkerHelpRegistry ( ) { } protected WindowManager getWindowManager ( ) { } public WorkbenchConfigurationInfo getConfigurationInfo ( ) { } private File getWorkbenchStateFile ( ) { } public int getWorkbenchWindowCount ( ) { } public IWorkbenchWindow [ ] getWorkbenchWindows ( ) { } public IWorkingSetManager getWorkingSetManager ( ) { } public void updateActiveGestureBindingService ( ) { } public void updateActiveKeyBindingService ( ) { IWorkbenchWindow workbenchWindow = getActiveWorkbenchWindow ( ) ; if ( ( workbenchWindow != null ) && ( workbenchWindow instanceof WorkbenchWindow ) ) <START_BUG> ( ( WorkbenchWindow ) ( workbenchWindow ) ) . updateActionAndContextManager ( ) ; <END_BUG> } private void handlePropertyChange ( PropertyChangeEvent event ) { } private boolean init ( String [ ] commandLineArgs ) { } private void refreshFromLocal ( String [ ] commandLineArgs ) { } private void forceOpenPerspective ( String [ ] commandLineArgs ) { } private void initializeSingleClickOption ( ) { } private void initializeFonts ( ) { } private void initializeFont ( String fontKey , FontRegistry registry , IPreferenceStore store ) { } private void initializeProductImage ( ) { } public boolean isClosing ( ) { } public boolean isStarting ( ) { } protected WorkbenchWindow newWorkbenchWindow ( ) { } private void openFirstTimeWindow ( ) { } private int openPreviousWorkbenchState ( ) { } public IWorkbenchWindow openWorkbenchWindow ( IAdaptable input ) throws WorkbenchException { } public IWorkbenchWindow openWorkbenchWindow ( final String perspID , final IAdaptable input ) throws WorkbenchException { } private XMLMemento recordWorkbenchState ( ) { } public boolean restart ( ) { } private IStatus restoreState ( IMemento memento ) { } public IPluginDescriptor [ ] getEarlyActivatedPlugins ( ) { } protected void startPlugins ( ) { } public Object run ( Object arg ) { } protected void runEventLoop ( Window . IExceptionHandler handler ) { } private IStatus saveState ( IMemento memento ) { } private boolean saveWorkbenchState ( XMLMemento memento ) { } public void setInitializationData ( IConfigurationElement configElement , String propertyName , Object data ) { } public IWorkbenchPage showPerspective ( String perspectiveId , IWorkbenchWindow window ) throws WorkbenchException { } public IWorkbenchPage showPerspective ( String perspectiveId , IWorkbenchWindow window , IAdaptable input ) throws WorkbenchException { } private void shutdown ( ) { } public void refreshPluginActions ( String pluginId ) { } public IDecoratorManager getDecoratorManager ( ) { } protected final WorkbenchWindow getActivatedWindow ( ) { } protected final void setActivatedWindow ( WorkbenchWindow window ) { } private void updateBuildActions ( boolean autoBuildSetting ) { } }

Fix:
( ( WorkbenchWindow ) ( workbenchWindow ) ) . updateContextAndHandlerManager ( ) ;