Project: SWT
Bug 84535 TitleAreaDialog doesn't dismiss on <ENTER> if contains Combo(SWT.SIMPLE)
Reported: 2005-02-07 00:11:54 | Status: resolved fixed

A TitleAreaDialog that contains a Combo in SWT.SIMPLE mode no longer responds to pressing ENTER by activating the default OK button and closing the dialog. When the test code below is run, click the button "Press Me". On the dialog invoked, press <ENTER>. The dialog should close, but doesn't. Using 3.1M4. -------8<------ package com.yoogalu.priceservice.client.ui; import org.eclipse.jface.dialogs.TitleAreaDialog; import org.eclipse.swt.SWT; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.layout.FillLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Combo; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; public class DefaultButtonBugDemo { public static void main(String[] args) { Display display = new Display(); final Shell shell = new Shell(display); shell.setLayout(new FillLayout()); Button b = new Button(shell, SWT.NONE); b.setText("Press Me"); b.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { TitleAreaDialog dialog = new DefaultButtonBugDemo().new MyDialog(shell); dialog.setBlockOnOpen(true); dialog.open(); } }); shell.pack(); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); } public class MyDialog extends TitleAreaDialog { public MyDialog(Shell shell) { super(shell); } protected Control createDialogArea(Composite parent) { Composite composite = (Composite) super.createDialogArea(parent); Combo combo = new Combo(composite, SWT.SIMPLE); combo.setItems(new String[]{"ITEM1", "ITEM2"}); return composite; } } } ----------8<--------

Files changed in fix:
bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Combo.java