Buggy code:
public class WorkbenchContextSupport implements IWorkbenchContextSupport { private static final boolean DEBUG = Policy . DEBUG_CONTEXTS ; private static final boolean DEBUG_VERBOSE = Policy . DEBUG_CONTEXTS_VERBOSE ; private static final int DEBUG_STACK_LENGTH_TO_SHOW = 5 ; private Listener activationListener = new Listener ( ) { public void handleEvent ( Event event ) { } } ; private Shell activeShell ; private IWorkbenchSite activeWorkbenchSite ; private IWorkbenchWindow activeWorkbenchWindow ; private Map enabledSubmissionsByContextId = new HashMap ( ) ; private final WorkbenchKeyboard keyboard ; private volatile boolean keyFilterEnabled ; private IMutableContextManager mutableContextManager ; 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 IPerspectiveListener perspectiveListener = new IPerspectiveListener ( ) { public void perspectiveActivated ( IWorkbenchPage workbenchPage , IPerspectiveDescriptor perspectiveDescriptor ) { } public void perspectiveChanged ( IWorkbenchPage workbenchPage , IPerspectiveDescriptor perspectiveDescriptor , String changeId ) { } } ; private ProxyContextManager proxyContextManager ; private final Map registeredWindows = new WeakHashMap ( ) ; private Workbench workbench ; public WorkbenchContextSupport ( final Workbench workbenchToSupport ) { } public void addEnabledSubmissions ( List enabledSubmissions ) { } private final void checkWindowType ( final Shell newShell ) { } public IContextManager getContextManager ( ) { } public final WorkbenchKeyboard getKeyboard ( ) { } public boolean isKeyFilterEnabled ( ) { } private void processEnabledSubmissions ( boolean force ) { } public void processEnabledSubmissions ( boolean force , final Shell newActiveShell ) { IWorkbenchSite newActiveWorkbenchSite = null ; final IWorkbenchWindow newActiveWorkbenchWindow = workbench . getActiveWorkbenchWindow ( ) ; boolean update = false ; if ( ( activeShell ) != newActiveShell ) { activeShell = newActiveShell ; update = true ; } if ( ( activeWorkbenchWindow ) != newActiveWorkbenchWindow ) { if ( ( activeWorkbenchWindow ) != null ) { activeWorkbenchWindow . removePageListener ( pageListener ) ; activeWorkbenchWindow . removePerspectiveListener ( perspectiveListener ) ; activeWorkbenchWindow . getPartService ( ) . removePartListener ( partListener ) ; } if ( newActiveWorkbenchWindow != null ) { newActiveWorkbenchWindow . addPageListener ( pageListener ) ; newActiveWorkbenchWindow . addPerspectiveListener ( perspectiveListener ) ; newActiveWorkbenchWindow . getPartService ( ) . addPartListener ( partListener ) ; } activeWorkbenchWindow = newActiveWorkbenchWindow ; update = true ; } if ( newActiveWorkbenchWindow != null ) { IWorkbenchPage activeWorkbenchPage = newActiveWorkbenchWindow . getActivePage ( ) ; if ( activeWorkbenchPage != null ) { IWorkbenchPart activeWorkbenchPart = activeWorkbenchPage . getActivePart ( ) ; if ( activeWorkbenchPart != null ) newActiveWorkbenchSite = activeWorkbenchPart . getSite ( ) ; } } if ( ( force || update ) || ( ! ( Util . equals ( activeWorkbenchSite , newActiveWorkbenchSite ) ) ) ) { activeWorkbenchSite = newActiveWorkbenchSite ; final Set enabledContextIds = new HashSet ( ) ; for ( Iterator iterator = enabledSubmissionsByContextId . entrySet ( ) . iterator ( ) ; iterator . hasNext ( ) ; ) { final Map . Entry entry = ( ( Map . Entry ) ( iterator . next ( ) ) ) ; final String contextId = ( ( String ) ( entry . getKey ( ) ) ) ; final List enabledSubmissions = ( ( List ) ( entry . getValue ( ) ) ) ; for ( int i = 0 ; i < ( enabledSubmissions . size ( ) ) ; i ++ ) { EnabledSubmission enabledSubmission = ( ( EnabledSubmission ) ( enabledSubmissions . get ( i ) ) ) ; Shell activeShell2 = enabledSubmission . getActiveShell ( ) ; if ( ( activeShell2 != null ) && ( activeShell2 != newActiveShell ) ) continue ; <START_BUG> IWorkbenchSite activeWorkbenchSite2 = enabledSubmission . getActiveWorkbenchSite ( ) ; <END_BUG> if ( ( activeWorkbenchSite2 != null ) && ( activeWorkbenchSite2 != newActiveWorkbenchSite ) ) continue ; enabledContextIds . add ( contextId ) ; break ; } } Iterator contextIdItr = enabledContextIds . iterator ( ) ; boolean dialog = false ; boolean window = false ; while ( contextIdItr . hasNext ( ) ) { final String contextId = ( ( String ) ( contextIdItr . next ( ) ) ) ; if ( CONTEXT_ID_DIALOG . equals ( contextId ) ) { dialog = true ; continue ; } if ( CONTEXT_ID_WINDOW . equals ( contextId ) ) { window = true ; continue ; } } try { contextIdItr = enabledContextIds . iterator ( ) ; while ( contextIdItr . hasNext ( ) ) { String contextId = ( ( String ) ( contextIdItr . next ( ) ) ) ; IContext context = mutableContextManager . getContext ( contextId ) ; String parentId = context . getParentId ( ) ; while ( parentId != null ) { if ( CONTEXT_ID_DIALOG . equals ( parentId ) ) { if ( ! dialog ) { contextIdItr . remove ( ) ; } break ; } if ( CONTEXT_ID_WINDOW . equals ( parentId ) ) { if ( ! window ) { contextIdItr . remove ( ) ; } break ; } if ( CONTEXT_ID_DIALOG_AND_WINDOW . equals ( parentId ) ) { if ( ( ! window ) && ( ! dialog ) ) { contextIdItr . remove ( ) ; } break ; } context = mutableContextManager . getContext ( parentId ) ; parentId = context . getParentId ( ) ; } } } catch ( NotDefinedException e ) { if ( WorkbenchContextSupport . DEBUG ) { System . out . println ( ( ( "CONTEXTS<seq2seq4repair_space>>>><seq2seq4repair_space>NotDefinedException('" + ( e . getMessage ( ) ) ) + "')<seq2seq4repair_space>while<seq2seq4repair_space>filtering<seq2seq4repair_space>dialog//window<seq2seq4repair_space>contexts`" ) ) ; } }

Fix:
IWorkbenchSite activeWorkbenchSite2 = enabledSubmission . getActiveWorkbenchPartSite ( ) ;