Bug 112045 - [CellEditors] ComboBoxCellEditor doesn't set items if creation of control is deferred
Summary: [CellEditors] ComboBoxCellEditor doesn't set items if creation of control is ...
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.1.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.3   Edit
Assignee: Eric Moffatt CLA
QA Contact:
URL:
Whiteboard:
Keywords: contributed
Depends on:
Blocks:
 
Reported: 2005-10-09 01:06 EDT by Brad Reynolds CLA
Modified: 2008-02-05 15:38 EST (History)
3 users (show)

See Also:


Attachments
My solution : I added populateComboBoxItems(); into createControl(Composite parent) (9.37 KB, text/java)
2006-05-12 11:59 EDT, Krzysztof Michalski CLA
no flags Details
My proposition (803 bytes, patch)
2006-05-16 09:58 EDT, Krzysztof Michalski CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Brad Reynolds CLA 2005-10-09 01:06:50 EDT
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();
	}
}
Comment 1 Krzysztof Michalski CLA 2006-05-12 11:59:01 EDT
Created attachment 41326 [details]
My solution : I added populateComboBoxItems(); into createControl(Composite parent) 

Inside ComboBoxCellEditor class in createControl(Composite parent) method I added method to populate combobox items. Solution in attrachement.
Comment 2 Eric Moffatt CLA 2006-05-15 16:24:28 EDT
Krzysztof, can you turn this into a patch so I can use the compare editor to see what's been chaged? Thanks.
Comment 3 Krzysztof Michalski CLA 2006-05-16 09:58:41 EDT
Created attachment 41587 [details]
My proposition

I attach a patch file.
Comment 4 Eric Moffatt CLA 2006-05-23 14:02:25 EDT
Krzysztof, just checked this on RC5 and it looks good...I'll mark as 3.3 and apply the patch once 3.2 goes out.

Thanks
Comment 5 Eric Moffatt CLA 2006-06-19 10:07:41 EDT
Fixed in >20060619.
Comment 6 Eric Moffatt CLA 2008-02-05 15:38:39 EST
Verified (visually) in I20080205-0010.