Bug 60462 [CellEditors] applyEditorValueAndDeactivate() in ComboBoxCellEditor gets index exception.
The problem is in this method. See line marked with "@ERROR" below. private void applyEditorValueAndDeactivate() { selection = comboBox.getSelectionIndex(); Object newValue = doGetValue(); markDirty(); boolean isValid = isCorrect(newValue); setValueValid(isValid); if (!isValid) { //@ERROR //THIS LINE CAUSES AN ERROR. IT ASSUMES SOMETHING IS SELECTED. IN EDIT //MODE, THIS IS NOT TRUE IF I JUST TYPE SOMETHING INTO THE CELL EDITOR. //IN THIS CASE, selection IS AN INVALID INDEX. setErrorMessage( MessageFormat.format(getErrorMessage(), new Object[] {items[selection]})); } fireApplyEditorValue(); deactivate(); }
bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ComboBoxCellEditor.java
}
        });
        comboBox.addTraverseListener(new TraverseListener() {
            public void keyTraversed(TraverseEvent e) {
                if (e.detail == SWT.TRAVERSE_ESCAPE
                        || e.detail == SWT.TRAVERSE_RETURN) {
                    e.doit = false;
                }
            }
        });
        comboBox.addFocusListener(new FocusAdapter() {
            public void focusLost(FocusEvent e) {
                ComboBoxCellEditor.this.focusLost();
            }
        });
        return comboBox;
    }
    /**
     * The <code>ComboBoxCellEditor</code> implementation of
     * this <code>CellEditor</code> framework method returns
     * the zero-based index of the current selection.
     *
     * @return the zero-based index of the current selection wrapped
     *  as an <code>Integer</code>
     */
    protected Object doGetValue() {
        return new Integer(selection);
    }
    /* (non-Javadoc)
     * Method declared on CellEditor.