Buggy code:
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 final Listener listener = new Listener ( ) { public void handleEvent ( Event event ) { } } ; private final ICommandManagerListener commandManagerListener = new ICommandManagerListener ( ) { public final void commandManagerChanged ( final ICommandManagerEvent commandManagerEvent ) { } } ; private final IContextManagerListener contextManagerListener = new IContextManagerListener ( ) { public final void contextManagerChanged ( final IContextManagerEvent contextManagerEvent ) { } } ; private IActionServiceListener actionServiceListener = new IActionServiceListener ( ) { public void actionServiceChanged ( IActionServiceEvent actionServiceEvent ) { } } ; private IContextActivationServiceListener contextActivationServiceListener = new IContextActivationServiceListener ( ) { public void contextActivationServiceChanged ( IContextActivationServiceEvent contextActivationServiceEvent ) { } } ; private IInternalPerspectiveListener internalPerspectiveListener = new IInternalPerspectiveListener ( ) { public void perspectiveActivated ( IWorkbenchPage workbenchPage , IPerspectiveDescriptor perspectiveDescriptor ) { } public void perspectiveChanged ( IWorkbenchPage workbenchPage , IPerspectiveDescriptor perspectiveDescriptor , String changeId ) { } public void perspectiveClosed ( IWorkbenchPage page , IPerspectiveDescriptor perspective ) { } public void perspectiveOpened ( IWorkbenchPage page , IPerspectiveDescriptor perspective ) { } } ; private IPageListener pageListener = new IPageListener ( ) { public void pageActivated ( IWorkbenchPage workbenchPage ) { } public void pageClosed ( IWorkbenchPage workbenchPage ) { } public void pageOpened ( IWorkbenchPage workbenchPage ) { } } ; private IPartListener partListener = new IPartListener ( ) { public void partActivated ( IWorkbenchPart workbenchPart ) { } public void partBroughtToTop ( IWorkbenchPart workbenchPart ) { } public void partClosed ( IWorkbenchPart workbenchPart ) { } public void partDeactivated ( IWorkbenchPart workbenchPart ) { } public void partOpened ( IWorkbenchPart workbenchPart ) { } } ; private IWindowListener windowListener = new IWindowListener ( ) { public void windowActivated ( IWorkbenchWindow workbenchWindow ) { } public void windowClosed ( IWorkbenchWindow workbenchWindow ) { } public void windowDeactivated ( IWorkbenchWindow workbenchWindow ) { } public void windowOpened ( IWorkbenchWindow workbenchWindow ) { } } ; private CommandManager commandManager ; private ContextManager contextManager ; private Map modeContributionItems = new HashMap ( 11 ) ; private IWorkbenchWindow activeWorkbenchWindow ; private IWorkbenchPage activeWorkbenchPage ; private IActionService activeWorkbenchPageActionService ; private IContextActivationService activeWorkbenchPageContextActivationService ; private IWorkbenchPart activeWorkbenchPart ; private IActionService activeWorkbenchPartActionService ; private IContextActivationService activeWorkbenchPartContextActivationService ; private IActionService actionService ; private IContextActivationService contextActivationService ; public IActionService getActionService ( ) { } public ICommandManager getCommandManager ( ) { } public IContextActivationService getContextActivationService ( ) { } public IContextManager getContextManager ( ) { } public final void disableKeyFilter ( ) { } public final void enableKeyFilter ( ) { } public String getName ( String commandId ) { } public Integer getAccelerator ( String commandId ) { } public String getAcceleratorText ( String commandId ) { } public final boolean inContext ( final String commandId ) { } public boolean press ( KeyStroke [ ] potentialKeyStrokes , Event event ) { } private final void updateModeLines ( final KeySequence mode ) { } public void updateActiveContextIds ( ) { } public void updateActiveWorkbenchWindowMenuManager ( ) { IWorkbenchWindow workbenchWindow = getActiveWorkbenchWindow ( ) ; <START_BUG> if ( workbenchWindow != null ) { <END_BUG> MenuManager menuManager = ( ( WorkbenchWindow ) ( workbenchWindow ) ) . getMenuManager ( ) ; menuManager . update ( TEXT ) ; } } void updateActiveCommandIdsAndActiveContextIds ( ) { } private void initializeCommandsAndContexts ( final Display display ) { } 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 ( ) { }

Fix:
if ( workbenchWindow instanceof WorkbenchWindow ) {