Buggy code:
public Object [ ] getChildren ( Object parentElement ) { } public Object [ ] getElements ( Object inputElement ) { } public Object getParent ( Object element ) { } public boolean hasChildren ( Object element ) { } public void inputChanged ( Viewer viewer , Object oldInput , Object newInput ) { } } private class TreeViewerCommandsLabelProvider extends LabelProvider { public String getText ( Object element ) { } } private Label labelActiveConfiguration ; private Combo comboActiveConfiguration ; private Label labelCommands ; private TreeViewer treeViewerCommands ; private Label labelSequencesForCommand ; private Table tableSequencesForCommand ; private Label labelSequence ; private Combo comboSequence ; private Label labelScope ; private Combo comboScope ; private Label labelConfiguration ; private Combo comboConfiguration ; private Button buttonChange ; private Label labelCommandsForSequence ; private Table tableCommandsForSequence ; private IWorkbench workbench ; private List categories ; private SortedMap categoriesById ; private SortedMap categoriesByName ; private List commands ; private SortedMap commandsById ; private SortedMap commandsByName ; private List scopes ; private SortedMap scopesById ; private SortedMap scopesByName ; private List coreActiveKeyConfigurations ; private List coreKeyBindings ; private List coreKeyConfigurations ; private List localActiveKeyConfigurations ; private List localKeyBindings ; private List localKeyConfigurations ; private List preferenceActiveKeyConfigurations ; private List preferenceKeyBindings ; private List preferenceKeyConfigurations ; private ActiveConfiguration activeKeyConfiguration ; private List activeKeyConfigurations ; private List keyConfigurations ; private SortedMap keyConfigurationsById ; private SortedMap keyConfigurationsByName ; private SortedMap tree ; private List commandRecords = new ArrayList ( ) ; private List keySequenceRecords = new ArrayList ( ) ; private SortedMap keySequencesByName ; public void init ( IWorkbench workbench ) { } public boolean performOk ( ) { } public void setVisible ( boolean visible ) { } protected Control createContents ( Composite parent ) { } protected IPreferenceStore doGetPreferenceStore ( ) { } protected void performDefaults ( ) { } private void copyFromUI ( ) { } private void copyToUI ( ) { } private Control createUI ( Composite parent ) { } private void selectedComboActiveKeyConfiguration ( ) { } private void doubleClickedTreeViewerCommands ( ) { } private void selectedTreeViewerCommands ( ) { } private void doubleClickedTableKeySequencesForCommand ( ) { } private void selectedTableKeySequencesForCommand ( ) { } private void modifiedComboKeySequence ( ) { } private void selectedComboKeySequence ( ) { } private void selectedComboScope ( ) { } private void selectedComboKeyConfiguration ( ) { } private void selectedButtonChange ( ) { } private void doubleClickedTableCommandsForKeySequence ( ) { } private void selectedTableCommandsForKeySequence ( ) { } private void update ( ) { Command command = null ; ISelection selection = treeViewerCommands . getSelection ( ) ; if ( ( selection instanceof IStructuredSelection ) && ( ! ( selection . isEmpty ( ) ) ) ) { Object object = ( ( IStructuredSelection ) ( selection ) ) . getFirstElement ( ) ; if ( object instanceof Command ) command = ( ( Command ) ( object ) ) ; } boolean commandSelected = command != null ; Sequence keySequence = getKeySequence ( ) ; <START_BUG> boolean validKeySequence = ( keySequence != null ) && ( ! ( keySequence . getStrokes ( ) . isEmpty ( ) ) ) ; <END_BUG> String scopeId = getScopeId ( ) ; boolean validScopeId = ( scopeId != null ) && ( ( scopesById . get ( scopeId ) ) != null ) ; String keyConfigurationId = getKeyConfigurationId ( ) ; boolean validKeyConfigurationId = ( keyConfigurationId != null ) && ( ( keyConfigurationsById . get ( keyConfigurationId ) ) != null ) ; labelSequencesForCommand . setEnabled ( commandSelected ) ; tableSequencesForCommand . setEnabled ( commandSelected ) ; labelSequence . setEnabled ( commandSelected ) ; comboSequence . setEnabled ( commandSelected ) ; labelScope . setEnabled ( commandSelected ) ; comboScope . setEnabled ( commandSelected ) ; labelConfiguration . setEnabled ( commandSelected ) ; comboConfiguration . setEnabled ( commandSelected ) ; buttonChange . setEnabled ( ( ( ( commandSelected && validKeySequence ) && validScopeId ) && validKeyConfigurationId ) ) ; labelCommandsForSequence . setEnabled ( validKeySequence ) ; tableCommandsForSequence . setEnabled ( validKeySequence ) ; if ( commandSelected ) { String text = MessageFormat . format ( Util . getString ( KeyPreferencePage . resourceBundle , "labelSequencesForCommand.selection" ) , new Object [ ] { ( '\'' + ( command . getName ( ) ) ) + '\'' } ) ; labelSequencesForCommand . setText ( text ) ; } else labelSequencesForCommand . setText ( Util . getString ( KeyPreferencePage . resourceBundle , "labelSequencesForCommand.noSelection" ) ) ; KeyPreferencePage . CommandRecord commandRecord = getSelectedCommandRecord ( ) ; if ( commandRecord == null ) buttonChange . setText ( Util . getString ( KeyPreferencePage . resourceBundle , "buttonChange.add" ) ) ; else { if ( ( ! ( commandRecord . customSet . isEmpty ( ) ) ) && ( ! ( commandRecord . defaultSet . isEmpty ( ) ) ) ) { buttonChange . setText ( Util . getString ( KeyPreferencePage . resourceBundle , "buttonChange.restore" ) ) ; } else buttonChange . setText ( Util . getString ( KeyPreferencePage . resourceBundle , "buttonChange.remove" ) ) ; } if ( validKeySequence ) { String text = MessageFormat . format ( Util . getString ( KeyPreferencePage . resourceBundle , "labelCommandsForSequence.selection" ) , new Object [ ] { ( '\'' + ( KeySupport . formatSequence ( keySequence , true ) ) ) + '\'' } ) ; labelCommandsForSequence . setText ( text ) ; } else labelCommandsForSequence . setText ( Util . getString ( KeyPreferencePage . resourceBundle , "labelCommandsForSequence.noSelection" ) ) ; } private void buildCommandRecords ( SortedMap tree , String command , List commandRecords ) { } private void buildSequenceRecords ( SortedMap tree , Sequence sequence , List sequenceRecords ) { } private void buildTableCommand ( ) { } private void buildTableKeySequence ( ) { } private void selectTableCommand ( String scopeId , String keyConfigurationId , Sequence keySequence ) { } private void selectTableKeySequence ( String scopeId , String keyConfigurationId ) { } private KeyPreferencePage . CommandRecord getSelectedCommandRecord ( ) { } private KeyPreferencePage . SequenceRecord getSelectedKeySequenceRecord ( ) { }

Fix:
boolean validKeySequence = ( keySequence != null ) && ( Manager . validateSequence ( keySequence ) ) ;