Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 155820

Summary: Workaround for zoom combo toolbar dropdown displaying selection
Product: [Tools] GEF Reporter: Randy Hudson <hudsonr>
Component: GEF-Legacy GEF (MVC)Assignee: gef-inbox <gef-inbox>
Status: RESOLVED WORKSFORME QA Contact:
Severity: normal    
Priority: P3 CC: nyssen
Version: 3.1   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Randy Hudson CLA 2006-08-31 10:08:05 EDT
This is a workaround for bug 93938. I think GEF should consider this for 3.2.1 since it is very low risk and can be easily tested on each windowing system.

In my GEF-based application, I have other combos that behave similarly to the ZoomComboContributionItem. I seem to have found a workaround for the behavior described in bug 93938.

The workaround is to set the combo's text instead of setting the index that it should select.

In the following code:

private void refresh(boolean repopulateCombo) {
 ...
	if (index == -1 || forceSetText)
		combo.setText(zoom);
	else
		combo.select(index);
 ...
}

Change if statement to:
	if (index == -1 || forceSetText || !combo.isFocusControl())

If the user is not interacting with the Combo, the problematic method is avoided. If the user is doing something, the current behavior is preserved.

If this change was somehow bad, the only issue should be that the dropdown list would have the wrong selected item.

Anthony, please target 3.2.1 if you can test this on GTK, Motif, win32. I could test on Mac OS X.
Comment 1 Alexander Nyßen CLA 2014-08-09 03:41:52 EDT
As bug #93938 has been resolved, no need to apply this workaround any more. Resolving as WORKSFORME.