1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-09 01:05:38 +02:00

fix for 138324. Don't process combo selection until there is a change.

This commit is contained in:
David McKnight 2006-05-23 17:06:24 +00:00
parent 1ba2f0216d
commit 4aeb4344c7

View file

@ -128,13 +128,15 @@ public class SystemComboBoxCellEditor extends CellEditor
// DKM - only process this when there is a selection change // DKM - only process this when there is a selection change
// fix for defect 138324 // fix for defect 138324
if (selection == comboBox.getSelectionIndex()) if (selection == comboBox.getSelectionIndex() && comboBox.getText().equals(comboBox.getItem(comboBox.getSelectionIndex())))
return; // no change return; // no change
// must set the selection before getting value // must set the selection before getting value
selection = comboBox.getSelectionIndex(); selection = comboBox.getSelectionIndex();
System.out.println("Inside widgetSelected. selection = " + selection); System.out.println("Inside widgetSelected. selection = " + selection);
Object newValue = doGetValue(); Object newValue = doGetValue();
boolean newValidState = isCorrect(newValue); boolean newValidState = isCorrect(newValue);
System.out.println("Inside widgetSelected. selection = " + selection + ", " + newValidState); System.out.println("Inside widgetSelected. selection = " + selection + ", " + newValidState);
if (newValidState) { if (newValidState) {
@ -193,9 +195,18 @@ public class SystemComboBoxCellEditor extends CellEditor
{ {
return; return;
} }
//Assert.isTrue(comboBox != null && (value instanceof Integer)); //Assert.isTrue(comboBox != null && (value instanceof Integer));
selection = ((Integer) value).intValue(); int newselection = ((Integer) value).intValue();
comboBox.select(selection); if (newselection != selection)
{
selection = newselection;
}
String curText = comboBox.getText();
if (!comboBox.getItem(selection).equals(curText))
{
comboBox.select(selection);
}
} }
/** /**
* Add the items to the combo box. * Add the items to the combo box.