Buggy code:
IWorkbenchPage activeWorkbenchPage = ( activeWorkbenchWindow != null ) ? activeWorkbenchWindow . getActivePage ( ) : null ; IActionService activeWorkbenchPageActionService = ( activeWorkbenchPage != null ) ? ( ( WorkbenchPage ) ( activeWorkbenchPage ) ) . getActionService ( ) : null ; IContextActivationService activeWorkbenchPageContextActivationService = ( activeWorkbenchPage != null ) ? ( ( WorkbenchPage ) ( activeWorkbenchPage ) ) . getContextActivationService ( ) : null ; IPartService activePartService = ( activeWorkbenchWindow != null ) ? activeWorkbenchWindow . getPartService ( ) : null ; IWorkbenchPart activeWorkbenchPart = ( activePartService != null ) ? activePartService . getActivePart ( ) : null ; IWorkbenchPartSite activeWorkbenchPartSite = ( activeWorkbenchPart != null ) ? activeWorkbenchPart . getSite ( ) : null ; IActionService activeWorkbenchPartActionService = ( activeWorkbenchPartSite != null ) ? ( ( PartSite ) ( activeWorkbenchPartSite ) ) . getActionService ( ) : null ; IContextActivationService activeWorkbenchPartContextActivationService = ( activeWorkbenchPartSite != null ) ? ( ( PartSite ) ( activeWorkbenchPartSite ) ) . getContextActivationService ( ) : null ; if ( activeWorkbenchWindow != ( this . activeWorkbenchWindow ) ) { if ( ( this . activeWorkbenchWindow ) != null ) { this . activeWorkbenchWindow . removePageListener ( pageListener ) ; this . activeWorkbenchWindow . getPartService ( ) . removePartListener ( partListener ) ; ( ( WorkbenchWindow ) ( this . activeWorkbenchWindow ) ) . getPerspectiveService ( ) . removePerspectiveListener ( internalPerspectiveListener ) ; } this . activeWorkbenchWindow = activeWorkbenchWindow ; if ( ( this . activeWorkbenchWindow ) != null ) { this . activeWorkbenchWindow . addPageListener ( pageListener ) ; this . activeWorkbenchWindow . getPartService ( ) . addPartListener ( partListener ) ; ( ( WorkbenchWindow ) ( this . activeWorkbenchWindow ) ) . getPerspectiveService ( ) . addPerspectiveListener ( internalPerspectiveListener ) ; } } if ( activeWorkbenchPageActionService != ( this . activeWorkbenchPageActionService ) ) { if ( ( this . activeWorkbenchPageActionService ) != null ) this . activeWorkbenchPageActionService . removeActionServiceListener ( actionServiceListener ) ; this . activeWorkbenchPage = activeWorkbenchPage ; this . activeWorkbenchPageActionService = activeWorkbenchPageActionService ; if ( ( this . activeWorkbenchPageActionService ) != null ) this . activeWorkbenchPageActionService . addActionServiceListener ( actionServiceListener ) ; } if ( activeWorkbenchPartActionService != ( this . activeWorkbenchPartActionService ) ) { if ( ( this . activeWorkbenchPartActionService ) != null ) this . activeWorkbenchPartActionService . removeActionServiceListener ( actionServiceListener ) ; this . activeWorkbenchPart = activeWorkbenchPart ; this . activeWorkbenchPartActionService = activeWorkbenchPartActionService ; if ( ( this . activeWorkbenchPartActionService ) != null ) this . activeWorkbenchPartActionService . addActionServiceListener ( actionServiceListener ) ; } SortedMap actionsById = new TreeMap ( ) ; actionsById . putAll ( getActionService ( ) . getActionsById ( ) ) ; if ( ( this . activeWorkbenchWindow ) != null ) { actionsById . putAll ( ( ( WorkbenchWindow ) ( this . activeWorkbenchWindow ) ) . getActionsForGlobalActions ( ) ) ; actionsById . putAll ( ( ( WorkbenchWindow ) ( this . activeWorkbenchWindow ) ) . getActionsForActionSets ( ) ) ; } if ( ( this . activeWorkbenchPageActionService ) != null ) actionsById . putAll ( this . activeWorkbenchPageActionService . getActionsById ( ) ) ; if ( ( this . activeWorkbenchPartActionService ) != null ) actionsById . putAll ( this . activeWorkbenchPartActionService . getActionsById ( ) ) ; ( ( org . eclipse . ui . internal . commands . CommandManager ) ( getCommandManager ( ) ) ) . setActionsById ( actionsById ) ; if ( activeWorkbenchPageContextActivationService != ( this . activeWorkbenchPageContextActivationService ) ) { if ( ( this . activeWorkbenchPageContextActivationService ) != null ) this . activeWorkbenchPageContextActivationService . removeContextActivationServiceListener ( contextActivationServiceListener ) ; this . activeWorkbenchPage = activeWorkbenchPage ; this . activeWorkbenchPageContextActivationService = activeWorkbenchPageContextActivationService ; if ( ( this . activeWorkbenchPageContextActivationService ) != null ) this . activeWorkbenchPageContextActivationService . addContextActivationServiceListener ( contextActivationServiceListener ) ; } if ( activeWorkbenchPartContextActivationService != ( this . activeWorkbenchPartContextActivationService ) ) { if ( ( this . activeWorkbenchPartContextActivationService ) != null ) this . activeWorkbenchPartContextActivationService . removeContextActivationServiceListener ( contextActivationServiceListener ) ; this . activeWorkbenchPart = activeWorkbenchPart ; this . activeWorkbenchPartContextActivationService = activeWorkbenchPartContextActivationService ; if ( ( this . activeWorkbenchPartContextActivationService ) != null ) this . activeWorkbenchPartContextActivationService . addContextActivationServiceListener ( contextActivationServiceListener ) ; } SortedSet activeContextIds = new TreeSet ( ) ; activeContextIds . addAll ( getContextActivationService ( ) . getActiveContextIds ( ) ) ; if ( ( this . activeWorkbenchPageContextActivationService ) != null ) activeContextIds . addAll ( this . activeWorkbenchPageContextActivationService . getActiveContextIds ( ) ) ; if ( ( this . activeWorkbenchPartContextActivationService ) != null ) activeContextIds . addAll ( this . activeWorkbenchPartContextActivationService . getActiveContextIds ( ) ) ; <START_BUG> ( ( org . eclipse . ui . internal . contexts . ContextManager ) ( getContextManager ( ) ) ) . setActiveContextIds ( activeContextIds ) ; <END_BUG> } 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 ( ) { }

Fix:
( ( org . eclipse . ui . internal . contexts . ContextManager ) ( getContextManager ( ) ) ) . setActiveContextIds ( new ArrayList ( activeContextIds ) ) ;