### Eclipse Workspace Patch 1.0 #P org.eclipse.ui.workbench Index: Eclipse UI/org/eclipse/ui/internal/keys/NewKeysPreferencePage.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keys/NewKeysPreferencePage.java,v retrieving revision 1.34 diff -u -r1.34 NewKeysPreferencePage.java --- Eclipse UI/org/eclipse/ui/internal/keys/NewKeysPreferencePage.java 4 Apr 2007 18:46:46 -0000 1.34 +++ Eclipse UI/org/eclipse/ui/internal/keys/NewKeysPreferencePage.java 19 Apr 2007 19:01:33 -0000 @@ -282,6 +282,12 @@ * The number of columns being displayed. */ private static final int NUMBER_OF_COLUMNS = 5; + + private static final String UNDEFINED_COMMAND="Undefined Command"; //$NON-NLS-1$ + + private static final String UNAVAILABLE_CATEGORY="Unavailable Category"; //$NON-NLS-1$ + + private static final String UNDEFINED_CONTEXT="Undefined context"; //$NON-NLS-1$ /** * A resource manager for this preference page. @@ -387,7 +393,7 @@ return binding.getParameterizedCommand().getName(); } catch (final NotDefinedException e) { - return null; + return UNDEFINED_COMMAND; } case COLUMN_TRIGGER_SEQUENCE: return binding.getTriggerSequence().format(); @@ -397,7 +403,7 @@ return binding.getParameterizedCommand().getCommand().getCategory().getName(); } catch (NotDefinedException e) { // TODO Auto-generated catch block - return null; + return UNAVAILABLE_CATEGORY; } default: return null; @@ -407,7 +413,7 @@ try { return ((Category) value).getName(); } catch (final NotDefinedException e) { - return null; + return UNAVAILABLE_CATEGORY; } } @@ -420,7 +426,7 @@ return contextService.getContext((String) value) .getName(); } catch (final NotDefinedException e) { - return null; + return UNDEFINED_CONTEXT; } } @@ -430,7 +436,7 @@ try { return ((ParameterizedCommand) value).getName(); } catch (final NotDefinedException e) { - return null; + return UNDEFINED_COMMAND; } } if (columnIndex== COLUMN_TRIGGER_SEQUENCE) @@ -440,7 +446,7 @@ return ((ParameterizedCommand) value).getCommand().getCategory().getName(); } catch (NotDefinedException e) { // TODO Auto-generated catch block - return null; + return UNAVAILABLE_CATEGORY; } } return null; @@ -602,13 +608,17 @@ } } else { // (GROUPING_NONE_NAME.equals(selectedText)) + IBaseLabelProvider baseLabel = filteredTree.getViewer().getLabelProvider(); if (baseLabel instanceof ITableLabelProvider) { ITableLabelProvider tableProvider = (ITableLabelProvider) baseLabel; String e1p = tableProvider.getColumnText(a, sortColumn); String e2p = tableProvider.getColumnText(b, sortColumn); - int result = getComparator().compare(e1p, e2p); - return ascending ? result : (-1) * result; + if (e1p!=null && e2p!=null){ + int result = getComparator().compare(e1p, e2p); + return ascending ? result : (-1) * result; + + } } return super.compare(viewer, a, b); @@ -852,10 +862,13 @@ * The binding to be added; must not be null. */ private final void bindingAdd(final Binding binding) { + if (!(binding.getParameterizedCommand().getCommand().isDefined())) + return; + // Remember the parameterized command and context. markedParameterizedCommand = binding.getParameterizedCommand(); markedContextId = binding.getContextId(); - + // Update the preference page. update();