Bug 184126

Summary: [Properties] doGetValue method of ExtendedComboBoxCellEditor needs to change.
Product: [Modeling] GMF-Runtime Reporter: Tao Weng <tweng>
Component: GeneralAssignee: Anthony Hunter <ahunter.eclipse>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: crevells, tanakas
Version: unspecifiedKeywords: contributed
Target Milestone: 2.0.1   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Tao Weng CLA 2007-04-25 17:01:04 EDT
Build ID: M20070212-1330

Steps To Reproduce:
I'm having refreshing issue with property view. After debugging a little bit, I found out that it was caused by doGetValue method of ExtendedComboBoxCellEditor.

Originally, the method looks like:
public Object doGetValue() {
    	    if (list != null && selection >= 0) {
    	        // Get the index into the list via this call to super.

    	        return selection < list.size() && selection >= 0 ? list.get(selection) : null;
    	    }
    	
    	    if (getStyle() == SWT.READ_ONLY && selection >= 0) 
                return new Integer(selection);
    	    
            if(selection < 0)
                return comboBox.getText();
            
            return comboBox.getItem(selection);
    	}


However, I feel that it should look like the following.
selection value has to be up-to-date in order to retrieve the correct value of the combo box. As such, 
selection = comboBox.getSelectionIndex(); should be called at the beginning of the method. Please fix this one as soon as possible cause it causes severe refreshing issue to Property pages.


public Object doGetValue() {
    	selection = comboBox.getSelectionIndex();
    	    if (list != null && selection >= 0) {
    	        // Get the index into the list via this call to super.

    	        return selection < list.size() && selection >= 0 ? list.get(selection) : null;
    	    }
    	
    	    if (getStyle() == SWT.READ_ONLY && selection >= 0) 
                return new Integer(selection);
    	    
            if(selection < 0)
                return comboBox.getText();
            
            return comboBox.getItem(selection);
    	}

More information:
Comment 1 Artem Tikhomirov CLA 2007-04-26 06:03:57 EDT
Reassigning to proper component
Comment 2 Cherie Revells CLA 2007-11-02 17:11:21 EDT
Contributed Tao's fix to 2.0.1 and 2.1.
Comment 3 Eclipse Webmaster CLA 2010-07-19 12:24:43 EDT
[GMF Restructure] Bug 319140 : product GMF and component
Runtime EMF was the original product and component for this bug