Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 304715
Collapse All | Expand All

(-)src/org/eclipse/emf/common/ui/celleditor/ExtendedComboBoxCellEditor.java (-3 / +14 lines)
Lines 1-7 Link Here
1
/**
1
/**
2
 * <copyright> 
2
 * <copyright> 
3
 *
3
 *
4
 * Copyright (c) 2002-2007 IBM Corporation and others.
4
 * Copyright (c) 2002-2010 IBM Corporation and others.
5
 * All rights reserved.   This program and the accompanying materials
5
 * All rights reserved.   This program and the accompanying materials
6
 * are made available under the terms of the Eclipse Public License v1.0
6
 * are made available under the terms of the Eclipse Public License v1.0
7
 * which accompanies this distribution, and is available at
7
 * which accompanies this distribution, and is available at
Lines 178-183 Link Here
178
  protected ILabelProvider labelProvider;
178
  protected ILabelProvider labelProvider;
179
179
180
  protected boolean sorted;
180
  protected boolean sorted;
181
  
182
  int selectionInOriginalList;
181
183
182
  public ExtendedComboBoxCellEditor(Composite composite, List<?> list, ILabelProvider labelProvider)
184
  public ExtendedComboBoxCellEditor(Composite composite, List<?> list, ILabelProvider labelProvider)
183
  {
185
  {
Lines 227-233 Link Here
227
    // Get the index into the list via this call to super.
229
    // Get the index into the list via this call to super.
228
    //
230
    //
229
    int index = (Integer)super.doGetValue();
231
    int index = (Integer)super.doGetValue();
230
    return index < list.size() && index >= 0 ? list.get((Integer)super.doGetValue()) : null;
232
    if (isActivated()) {
233
    	Object value = index < list.size() && index >= 0 ? list.get((Integer)super.doGetValue()) : null;
234
    	if (value != null) {
235
    		// remember this if the editor is asked for its value after list is wiped out
236
    		// (it's wiped out on deactivation)
237
    		selectionInOriginalList = originalList.indexOf(value);
238
    	}
239
    	return value;
240
    }
241
    return originalList.get(selectionInOriginalList);
231
  }
242
  }
232
243
233
  @Override
244
  @Override
Lines 238-244 Link Here
238
    int index = list.indexOf(value);
249
    int index = list.indexOf(value);
239
    if (index != -1)
250
    if (index != -1)
240
    {
251
    {
241
      super.doSetValue(list.indexOf(value));
252
      super.doSetValue(index);
242
    }
253
    }
243
  }
254
  }
244
255

Return to bug 304715