Buggy code:
public final class Workbench extends EventManager implements IWorkbench { private final class StartupProgressBundleListener implements SynchronousBundleListener { private final IProgressMonitor progressMonitor ; private final int maximumProgressCount ; private final List starting ; StartupProgressBundleListener ( IProgressMonitor progressMonitor , int maximumProgressCount ) { } public void bundleChanged ( BundleEvent event ) { } } public static final String EARLY_STARTUP_FAMILY = "earlyStartup" ; private static final String [ ] VERSION_STRING = new String [ ] { "0.046" , "2.0" } ; private static final String DEFAULT_WORKBENCH_STATE_FILENAME = "workbench.xml" ; private static Workbench instance ; private static WorkbenchTestable testableObject ; private Display display ; private WindowManager windowManager ; private WorkbenchWindow activatedWindow ; private EditorHistory editorHistory ; private boolean runEventLoop = true ; private boolean isStarting = true ; private boolean isClosing = false ; private int returnCode = PlatformUI . RETURN_UNSTARTABLE ; private WorkbenchAdvisor advisor ; private WorkbenchConfigurer workbenchConfigurer ; private ExtensionEventHandler extensionEventHandler ; private int largeUpdates = 0 ; private final ServiceLocator serviceLocator = new ServiceLocator ( ) ; private int progressCount = - 1 ; private WorkbenchWindow [ ] createdWindows ; private Workbench ( Display display , WorkbenchAdvisor advisor ) { } public static final Workbench getInstance ( ) { } public static final int createAndRunWorkbench ( Display display , WorkbenchAdvisor advisor ) { } public static Display createDisplay ( ) { } public static WorkbenchTestable getWorkbenchTestable ( ) { } public void addWindowListener ( IWindowListener l ) { } public void removeWindowListener ( IWindowListener l ) { } protected void fireWindowOpened ( final IWorkbenchWindow window ) { } protected void fireWindowClosed ( final IWorkbenchWindow window ) { } protected void fireWindowActivated ( final IWorkbenchWindow window ) { } protected void fireWindowDeactivated ( final IWorkbenchWindow window ) { } private boolean busyClose ( final boolean force ) { } public boolean saveAllEditors ( boolean confirm ) { final boolean finalConfirm = confirm ; final boolean [ ] result = new boolean [ 1 ] ; result [ 0 ] = true ; Platform . run ( new SafeRunnable ( WorkbenchMessages . ErrorClosing ) { public void run ( ) { ArrayList dirtyParts = new ArrayList ( ) ; ArrayList dirtyEditorsInput = new ArrayList ( ) ; IWorkbenchWindow [ ] windows = getWorkbenchWindows ( ) ; for ( int i = 0 ; i < ( windows . length ) ; i ++ ) { IWorkbenchPage [ ] pages = windows [ i ] . getPages ( ) ; for ( int j = 0 ; j < ( pages . length ) ; j ++ ) { WorkbenchPage page = ( ( WorkbenchPage ) ( pages [ j ] ) ) ; ISaveablePart [ ] parts = page . getDirtyParts ( ) ; for ( int k = 0 ; k < ( parts . length ) ; k ++ ) { ISaveablePart part = parts [ k ] ; if ( part . isSaveOnCloseNeeded ( ) ) { if ( part instanceof IEditorPart ) { IEditorPart editor = ( ( IEditorPart ) ( part ) ) ; if ( ! ( dirtyEditorsInput . contains ( editor . getEditorInput ( ) ) ) ) { dirtyParts . add ( editor ) ; dirtyEditorsInput . add ( editor . getEditorInput ( ) ) ; } } else { dirtyParts . add ( part ) ; } } } } } if ( ( dirtyParts . size ( ) ) > 0 ) { IWorkbenchWindow w = getActiveWorkbenchWindow ( ) ; if ( w == null ) w = windows [ 0 ] ; <START_BUG> result [ 0 ] = EditorManager . saveAll ( dirtyParts , finalConfirm , w ) ; <END_BUG> } } } ) ; return result [ 0 ] ; } private IWorkbenchWindow busyOpenWorkbenchWindow ( String perspID , IAdaptable input ) throws WorkbenchException { } public boolean close ( ) { } boolean close ( int returnCode , final boolean force ) { } public IWorkbenchWindow getActiveWorkbenchWindow ( ) { } protected EditorHistory getEditorHistory ( ) { } public IEditorRegistry getEditorRegistry ( ) { } private int getNewWindowNumber ( ) { } public IWorkbenchOperationSupport getOperationSupport ( ) { } public IPerspectiveRegistry getPerspectiveRegistry ( ) { } public PreferenceManager getPreferenceManager ( ) { } public IPreferenceStore getPreferenceStore ( ) { } public ISharedImages getSharedImages ( ) { } WindowManager getWindowManager ( ) { } private File getWorkbenchStateFile ( ) { } public int getWorkbenchWindowCount ( ) { } public IWorkbenchWindow [ ] getWorkbenchWindows ( ) { } public IWorkingSetManager getWorkingSetManager ( ) { } public ILocalWorkingSetManager createLocalWorkingSetManager ( ) { } private boolean init ( Display display ) { } private void initializeCommandResolver ( ) { } private void initializeApplicationColors ( ) { } private void initializeSingleClickOption ( ) { } private void initializeFonts ( ) { } private static void initializeImages ( ) { } private void uninitializeImages ( ) { } private void initializeColors ( ) { } public boolean isClosing ( ) { } private final void initializeDefaultServices ( ) { } public boolean isStarting ( ) { } private WorkbenchWindow newWorkbenchWindow ( ) { } private void forceOpenPerspective ( ) { } void openFirstTimeWindow ( ) { } private void runStartupWithProgress ( final int expectedProgressCount , final Runnable runnable ) { } private void doOpenFirstTimeWindow ( ) { } IStatus restoreState ( ) { } public IWorkbenchWindow openWorkbenchWindow ( IAdaptable input ) throws WorkbenchException { } public IWorkbenchWindow openWorkbenchWindow ( final String perspID , final IAdaptable input ) throws WorkbenchException { } IWorkbenchWindow restoreWorkbenchWindow ( IMemento memento ) throws WorkbenchException { } private XMLMemento recordWorkbenchState ( ) { } public boolean restart ( ) { } private IStatus restoreState ( final IMemento memento ) { } public String [ ] getEarlyActivatedPlugins ( ) { } public String [ ] getDisabledEarlyActivatedPlugins ( ) { } private void startPlugins ( ) { } private int runUI ( ) { } private void runEventLoop ( Window . IExceptionHandler handler , Display display ) { }

Fix:
result [ 0 ] = EditorManager . saveAll ( dirtyParts , finalConfirm , false , w ) ;