Buggy code:
public class WorkbenchCommandSupport implements IWorkbenchCommandSupport { private static final boolean DEBUG = Policy . DEBUG_HANDLERS ; private static final boolean DEBUG_VERBOSE = ( Policy . DEBUG_HANDLERS ) && ( Policy . DEBUG_HANDLERS_VERBOSE ) ; private static final String DEBUG_VERBOSE_COMMAND_ID = Policy . DEBUG_HANDLERS_VERBOSE_COMMAND_ID ; private Listener activationListener = new Listener ( ) { public void handleEvent ( Event event ) { } } ; private Shell activeShell ; private IWorkbenchSite activeWorkbenchSite ; private IWorkbenchWindow activeWorkbenchWindow ; private Map handlerSubmissionsByCommandId = new HashMap ( ) ; private ICommandManager mutableCommandManager ; 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 Workbench workbench ; public WorkbenchCommandSupport ( final Workbench workbenchToSupport ) { } public void addHandlerSubmissions ( List handlerSubmissions ) { } public void deregisterFromKeyBindings ( Shell shell ) { } public ICommandManager getCommandManager ( ) { } public final boolean isKeyFilterEnabled ( ) { } private void processHandlerSubmissions ( boolean force ) { } public void processHandlerSubmissions ( boolean force , final Shell newActiveShell ) { IWorkbenchSite newWorkbenchSite = null ; IWorkbenchWindow newWorkbenchWindow = workbench . getActiveWorkbenchWindow ( ) ; boolean update = false ; if ( ( activeShell ) != newActiveShell ) { activeShell = newActiveShell ; update = true ; } if ( ( activeWorkbenchWindow ) != newWorkbenchWindow ) { if ( ( activeWorkbenchWindow ) != null ) { activeWorkbenchWindow . removePageListener ( pageListener ) ; activeWorkbenchWindow . removePerspectiveListener ( perspectiveListener ) ; activeWorkbenchWindow . getPartService ( ) . removePartListener ( partListener ) ; } if ( newWorkbenchWindow != null ) { newWorkbenchWindow . addPageListener ( pageListener ) ; newWorkbenchWindow . addPerspectiveListener ( perspectiveListener ) ; newWorkbenchWindow . getPartService ( ) . addPartListener ( partListener ) ; } activeWorkbenchWindow = newWorkbenchWindow ; update = true ; } <START_BUG> if ( ( newWorkbenchWindow != null ) && ( newWorkbenchWindow . getShell ( ) . equals ( newActiveShell ) ) ) { <END_BUG> IWorkbenchPage activeWorkbenchPage = newWorkbenchWindow . getActivePage ( ) ; if ( activeWorkbenchPage != null ) { IWorkbenchPart activeWorkbenchPart = activeWorkbenchPage . getActivePart ( ) ; if ( activeWorkbenchPart != null ) { newWorkbenchSite = activeWorkbenchPart . getSite ( ) ; } } } else { newWorkbenchSite = null ; } if ( ( force || update ) || ( ! ( Util . equals ( activeWorkbenchSite , newWorkbenchSite ) ) ) ) { activeWorkbenchSite = newWorkbenchSite ; Map handlersByCommandId = new HashMap ( ) ; for ( Iterator iterator = handlerSubmissionsByCommandId . entrySet ( ) . iterator ( ) ; iterator . hasNext ( ) ; ) { Map . Entry entry = ( ( Map . Entry ) ( iterator . next ( ) ) ) ; String commandId = ( ( String ) ( entry . getKey ( ) ) ) ; List handlerSubmissions = ( ( List ) ( entry . getValue ( ) ) ) ; Iterator submissionItr = handlerSubmissions . iterator ( ) ; HandlerSubmission bestHandlerSubmission = null ; boolean conflict = false ; while ( submissionItr . hasNext ( ) ) { HandlerSubmission handlerSubmission = ( ( HandlerSubmission ) ( submissionItr . next ( ) ) ) ; IWorkbenchSite activeWorkbenchSite2 = handlerSubmission . getActiveWorkbenchSite ( ) ; if ( ( activeWorkbenchSite2 != null ) && ( activeWorkbenchSite2 != newWorkbenchSite ) ) continue ; IWorkbenchWindow activeWorkbenchWindow2 = handlerSubmission . getActiveWorkbenchWindow ( ) ; if ( ( activeWorkbenchWindow2 != null ) && ( ( activeWorkbenchWindow2 != newWorkbenchWindow ) || ( ( activeWorkbenchWindow2 . getShell ( ) ) != ( activeShell ) ) ) ) continue ; Shell activeShell2 = handlerSubmission . getActiveShell ( ) ; if ( ( activeShell2 != null ) && ( activeShell2 != ( activeShell ) ) ) continue ; if ( bestHandlerSubmission == null ) bestHandlerSubmission = handlerSubmission ; else { int compareTo = Util . compare ( activeWorkbenchSite2 , bestHandlerSubmission . getActiveWorkbenchSite ( ) ) ; if ( compareTo == 0 ) { compareTo = Util . compare ( activeWorkbenchWindow2 , bestHandlerSubmission . getActiveWorkbenchWindow ( ) ) ; if ( compareTo == 0 ) compareTo = Util . compare ( activeShell2 , bestHandlerSubmission . getActiveShell ( ) ) ; if ( compareTo == 0 ) compareTo = Util . compare ( ( - ( handlerSubmission . getPriority ( ) ) ) , ( - ( bestHandlerSubmission . getPriority ( ) ) ) ) ; } if ( compareTo > 0 ) { if ( ( WorkbenchCommandSupport . DEBUG_VERBOSE ) && ( ( ( WorkbenchCommandSupport . DEBUG_VERBOSE_COMMAND_ID ) == null ) || ( WorkbenchCommandSupport . DEBUG_VERBOSE_COMMAND_ID . equals ( commandId ) ) ) ) { System . out . println ( ( "HANDLERS<seq2seq4repair_space>>>><seq2seq4repair_space>Resolved<seq2seq4repair_space>conflict<seq2seq4repair_space>detected<seq2seq4repair_space>for<seq2seq4repair_space>" + bestHandlerSubmission ) ) ; } conflict = false ; bestHandlerSubmission = handlerSubmission ; } else if ( ( compareTo == 0 ) && ( ( bestHandlerSubmission . getHandler ( ) ) != ( handlerSubmission . getHandler ( ) ) ) ) { if ( WorkbenchCommandSupport . DEBUG ) { System . out . println ( ( "HANDLERS<seq2seq4repair_space>>>><seq2seq4repair_space>Unresolved<seq2seq4repair_space>conflict<seq2seq4repair_space>detected<seq2seq4repair_space>for<seq2seq4repair_space>" + commandId ) ) ; } conflict = true ; }

Fix:
if ( ( newWorkbenchWindow != null ) && ( ( newWorkbenchWindow . getShell ( ) ) == newActiveShell ) ) {