Buggy code:
public void removePerspectiveListener ( org . eclipse . ui . IPerspectiveListener l ) { } void removePerspectiveShortcut ( IPerspectiveDescriptor perspective , WorkbenchPage page ) { } private IStatus unableToRestorePage ( IMemento pageMem ) { } public IStatus restoreState ( IMemento memento , IPerspectiveDescriptor activeDescriptor ) { } public void run ( boolean fork , boolean cancelable , IRunnableWithProgress runnable ) throws InterruptedException , InvocationTargetException { } private boolean saveAllPages ( boolean bConfirm ) { } public IStatus saveState ( IMemento memento ) { } void selectPerspectiveShortcut ( IPerspectiveDescriptor perspective , WorkbenchPage page , boolean selected ) { } public void setActivePage ( final IWorkbenchPage in ) { } public void setShowShortcutBar ( boolean show ) { } public void setShowStatusLine ( boolean show ) { } public void setShowToolBar ( boolean show ) { } private void showShortcutBarPopup ( MouseEvent e ) { Point pt = new Point ( e . x , e . y ) ; ToolBar toolBar = shortcutBar . getControl ( ) ; ToolItem toolItem = toolBar . getItem ( pt ) ; if ( toolItem == null ) return ; Object data = toolItem . getData ( ) ; if ( data instanceof ShowFastViewContribution ) { if ( ( fastViewBarMenu ) == null ) { Menu menu = new Menu ( toolBar ) ; MenuItem closeItem = new MenuItem ( menu , SWT . NONE ) ; closeItem . setText ( WorkbenchMessages . getString ( "WorkbenchWindow.close" ) ) ; closeItem . addSelectionListener ( new SelectionAdapter ( ) { public void widgetSelected ( SelectionEvent e ) { ToolItem toolItem = ( ( ToolItem ) ( fastViewBarMenu . getData ( ) ) ) ; if ( ( toolItem != null ) && ( ! ( toolItem . isDisposed ( ) ) ) ) { IViewReference ref = ( ( IViewReference ) ( toolItem . getData ( FAST_VIEW ) ) ) ; getActiveWorkbenchPage ( ) . hideView ( ref ) ; } } } ) ; restoreItem = new MenuItem ( menu , SWT . CHECK ) ; restoreItem . setText ( WorkbenchMessages . getString ( "WorkbenchWindow.restore" ) ) ; restoreItem . addSelectionListener ( new SelectionAdapter ( ) { public void widgetSelected ( SelectionEvent e ) { ToolItem toolItem = ( ( ToolItem ) ( fastViewBarMenu . getData ( ) ) ) ; if ( ( toolItem != null ) && ( ! ( toolItem . isDisposed ( ) ) ) ) { IViewReference ref = ( ( IViewReference ) ( toolItem . getData ( FAST_VIEW ) ) ) ; getActiveWorkbenchPage ( ) . removeFastView ( ref ) ; } } } ) ; fastViewBarMenu = menu ; } restoreItem . setSelection ( true ) ; fastViewBarMenu . setData ( toolItem ) ; if ( ( fastViewBarMenu ) != null ) { pt = toolBar . toDisplay ( pt ) ; fastViewBarMenu . setLocation ( pt . x , pt . y ) ; fastViewBarMenu . setVisible ( true ) ; } } if ( ! ( data instanceof ActionContributionItem ) ) return ; IAction action = ( ( ActionContributionItem ) ( data ) ) . getAction ( ) ; if ( action instanceof SetPagePerspectiveAction ) { if ( ( perspectiveBarMenu ) == null ) { Menu menu = new Menu ( toolBar ) ; MenuItem menuItem = new MenuItem ( menu , SWT . NONE ) ; menuItem . setText ( WorkbenchMessages . getString ( "WorkbenchWindow.close" ) ) ; menuItem . addSelectionListener ( new SelectionAdapter ( ) { public void widgetSelected ( SelectionEvent e ) { ToolItem toolItem = ( ( ToolItem ) ( perspectiveBarMenu . getData ( ) ) ) ; if ( ( toolItem != null ) && ( ! ( toolItem . isDisposed ( ) ) ) ) { ActionContributionItem item = ( ( ActionContributionItem ) ( toolItem . getData ( ) ) ) ; SetPagePerspectiveAction action = ( ( SetPagePerspectiveAction ) ( item . getAction ( ) ) ) ; action . getPage ( ) . closePerspective ( action . getPerspective ( ) , true ) ; } } } ) ; menuItem = new MenuItem ( menu , SWT . NONE ) ; menuItem . setText ( WorkbenchMessages . getString ( "WorkbenchWindow.closeAll" ) ) ; menuItem . addSelectionListener ( new SelectionAdapter ( ) { public void widgetSelected ( SelectionEvent e ) { ToolItem toolItem = ( ( ToolItem ) ( perspectiveBarMenu . getData ( ) ) ) ; if ( ( toolItem != null ) && ( ! ( toolItem . isDisposed ( ) ) ) ) { ActionContributionItem item = ( ( ActionContributionItem ) ( toolItem . getData ( ) ) ) ; SetPagePerspectiveAction action = ( ( SetPagePerspectiveAction ) ( item . getAction ( ) ) ) ; <START_BUG> action . getPage ( ) . close ( ) ; <END_BUG> } } } ) ; perspectiveBarMenu = menu ; } perspectiveBarMenu . setData ( toolItem ) ; if ( ( perspectiveBarMenu ) != null ) { pt = toolBar . toDisplay ( pt ) ; perspectiveBarMenu . setLocation ( pt . x , pt . y ) ; perspectiveBarMenu . setVisible ( true ) ; } } } protected boolean toolBarChildrenExist ( ) { } private void trackShellActivation ( Shell shell ) { } public void updateActionBars ( ) { } public void updateActionSets ( ) { } void updatePerspectiveShortcut ( IPerspectiveDescriptor oldDesc , IPerspectiveDescriptor newDesc , WorkbenchPage page ) { } public void updateBarVisibility ( ) { } public void updateTitle ( ) { } class PageList { private List pageList ; private List pageStack ; private Object active ; public PageList ( ) { } public boolean add ( Object object ) { } public Iterator iterator ( ) { } public boolean contains ( Object object ) { } public boolean remove ( Object object ) { } public boolean isEmpty ( ) { } public IWorkbenchPage [ ] getPages ( ) { } public void setActive ( Object page ) { }

Fix:
action . getPage ( ) . closeAllPerspectives ( ) ;