Bug 112045 [CellEditors] ComboBoxCellEditor doesn't set items if creation of control is deferred
If the ComboBoxCellEditor is instantiated without creating the control the items are not set on the ComboBoxCellEditor on call to createControl(Composite parent). The following snippet displays the problem. public class ComboEditor { void run() { Display display = new Display(); Shell shell = new Shell(display); String[] items = new String[]{"Item 1", "Item 2", "Item 3"}; ComboBoxCellEditor editor = new ComboBoxCellEditor(); editor.setItems(items); editor.create(shell); //Uncomment to set items. // editor.setItems(items); editor.activate(); editor.getControl().setVisible(true); editor.getControl().setBounds(0, 0, 100, 20); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); } public static void main(String[] args) { new ComboEditor().run(); } }
bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ComboBoxCellEditor.java
private static final int defaultStyle = SWT.NONE;
    /**
     * Creates a new cell editor with no control and no  st of choices. Initially,
     * the cell editor has no cell validator.
     * 
     * @since 2.1
     * @see CellEditor#setStyle
     * @see CellEditor#create
     * @see ComboBoxCellEditor#setItems
     * @see CellEditor#dispose
     */
    public ComboBoxCellEditor() {
        setStyle(defaultStyle);
    }
    /**
     * Creates a new cell editor with a combo containing the given 
     * list of choices and parented under the given control. The cell
     * editor value is the zero-based index of the selected item.
     * Initially, the cell editor has no cell validator and
     * the first item in the list is selected. 
     *
     * @param parent the parent control
     * @param items the list of strings for the combo box
     */
    public ComboBoxCellEditor(Composite parent, String[] items) {
        this(parent, items, defaultStyle);
    }
    /**
     * Creates a new cell editor with a combo containing the given 
     * list of choices and parented under the given control. The cell