Buggy code:
private static final int RESTORE_CODE_OK = 0 ; private static final int RESTORE_CODE_RESET = 1 ; private static final int RESTORE_CODE_EXIT = 2 ; 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 ; private ListenerList windowListeners = new ListenerList ( ) ; private WorkbenchAdviser adviser ; private WorkbenchConfigurer workbenchConfigurer ; private Workbench ( Display display , WorkbenchAdviser adviser ) { } public static final Workbench getInstance ( ) { } public static final int createAndRunWorkbench ( Display display , WorkbenchAdviser adviser ) { } public static Display createDisplay ( ) { } public static WorkbenchTestable getWorkbenchTestable ( ) { } public WorkbenchActivitiesCommandsAndRoles workbenchActivitiesCommandsAndRoles = new WorkbenchActivitiesCommandsAndRoles ( this ) ; private IActivityManager activityManager ; ICommandManager commandManager ; private IRoleManager roleManager ; private WorkbenchActivityHelper activityHelper ; private volatile boolean keyFilterDisabled ; private final Object keyFilterMutex = new Object ( ) ; public IActivityManager getActivityManager ( ) { } public ICommandManager getCommandManager ( ) { } public IRoleManager getRoleManager ( ) { } private final HashSet activationServices = new HashSet ( ) ; private final IActivationService compositeActivationService = ActivationServiceFactory . getActivationService ( ) ; private final IActivationServiceListener activationServiceListener = new IActivationServiceListener ( ) { public void activationServiceChanged ( IActivationServiceEvent activationServiceEvent ) { } } ; public IActivationService getActivationService ( ) { } public IActivationService getCompositeActivationService ( ) { } public final void disableKeyFilter ( ) { } public final void enableKeyFilter ( ) { } public final boolean isKeyFilterEnabled ( ) { } 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 boolean busyClose ( final boolean force ) { } public boolean saveAllEditors ( boolean confirm ) { } 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 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 ( ) { } private boolean init ( ImageDescriptor windowImage , Display display ) { } private void initializeSingleClickOption ( ) { } private void initializeFonts ( ) { } private void installFont ( String fontKey , FontRegistry registry , IPreferenceStore store ) { } private void initializeImages ( ImageDescriptor windowImage ) { } private void initializeColors ( ) { } public boolean isClosing ( ) { } boolean isStarting ( ) { } private WorkbenchWindow newWorkbenchWindow ( ) { } private void forceOpenPerspective ( ) { } private void openFirstTimeWindow ( ) { } private int openPreviousWorkbenchState ( ) { <START_BUG> if ( ! ( getPreferenceStore ( ) . getBoolean ( SHOULD_SAVE_WORKBENCH_STATE ) ) ) { <END_BUG> return Workbench . RESTORE_CODE_RESET ; } final File stateFile = getWorkbenchStateFile ( ) ; if ( ! ( stateFile . exists ( ) ) ) return Workbench . RESTORE_CODE_RESET ; final int [ ] result = new int [ ] { Workbench . RESTORE_CODE_OK } ; Platform . run ( new SafeRunnable ( WorkbenchMessages . getString ( "ErrorReadingState" ) ) { public void run ( ) throws Exception { FileInputStream input = new FileInputStream ( stateFile ) ; BufferedReader reader = new BufferedReader ( new InputStreamReader ( input , "utf-8" ) ) ; IMemento memento = XMLMemento . createReadRoot ( reader ) ; String version = memento . getString ( TAG_VERSION ) ; boolean valid = false ; for ( int i = 0 ; i < ( Workbench . VERSION_STRING . length ) ; i ++ ) { if ( Workbench . VERSION_STRING [ i ] . equals ( version ) ) { valid = true ; break ; } } if ( ! valid ) { reader . close ( ) ; MessageDialog . openError ( ( ( Shell ) ( null ) ) , WorkbenchMessages . getString ( "Restoring_Problems" ) , WorkbenchMessages . getString ( "Invalid_workbench_state_ve" ) ) ; stateFile . delete ( ) ; result [ 0 ] = Workbench . RESTORE_CODE_RESET ; return ; } if ( Workbench . VERSION_STRING [ 0 ] . equals ( version ) ) { reader . close ( ) ; boolean ignoreSavedState = ( new MessageDialog ( null , WorkbenchMessages . getString ( "Workbench.incompatibleUIState" ) , null , WorkbenchMessages . getString ( "Workbench.incompatibleSavedStateVersion" ) , MessageDialog . WARNING , new String [ ] { org . eclipse . jface . dialogs . IDialogConstants . OK_LABEL , org . eclipse . jface . dialogs . IDialogConstants . CANCEL_LABEL } , 0 ) . open ( ) ) == 0 ; if ( ignoreSavedState ) { stateFile . delete ( ) ; result [ 0 ] = Workbench . RESTORE_CODE_RESET ; } else { result [ 0 ] = Workbench . RESTORE_CODE_EXIT ; } return ; } IStatus restoreResult = restoreState ( memento ) ; reader . close ( ) ; if ( ( restoreResult . getSeverity ( ) ) == ( IStatus . ERROR ) ) { ErrorDialog . openError ( null , WorkbenchMessages . getString ( "Workspace.problemsTitle" ) , WorkbenchMessages . getString ( "Workbench.problemsRestoringMsg" ) , restoreResult ) ; } }

Fix:
if ( ! ( getWorkbenchConfigurer ( ) . getSaveAndRestore ( ) ) ) {