Bug 184126 - [Properties] doGetValue method of ExtendedComboBoxCellEditor needs to change.
Summary: [Properties] doGetValue method of ExtendedComboBoxCellEditor needs to change.
Status: RESOLVED FIXED
Alias: None
Product: GMF-Runtime
Classification: Modeling
Component: General (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 normal
Target Milestone: 2.0.1   Edit
Assignee: Anthony Hunter CLA
QA Contact:
URL:
Whiteboard:
Keywords: contributed
Depends on:
Blocks:
 
Reported: 2007-04-25 17:01 EDT by Tao Weng CLA
Modified: 2010-07-19 12:24 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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