Project: SWT
Bug 229680 PRIMARY_MODAL Shell can make other Shell lose its menubar
Reported: 2008-04-30 13:24:14 | Status: resolved fixed

- run the snippet below - note that the main Shell has menubar item "Menu" - push its Button to create a PRIMARY_MODAL child Shell - click away to some other running app - click back on the _original_ Shell (not the child Shell) - close the PRIMARY_MODAL child Shell - now the original Shell is all that's left, but its menubar item is not shown public static void main(String[] args) { final Display display = new Display(); final Shell shell = new Shell(display); shell.setLayout(new GridLayout()); Button b = new Button(shell, SWT.PUSH); b.setText("Open dialog"); b.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { Shell dialog = new Shell(shell, SWT.PRIMARY_MODAL | SWT.SHELL_TRIM); dialog.setSize(100, 50); dialog.open(); } }); Menu bar = new Menu(shell, SWT.BAR); shell.setMenuBar(bar); new MenuItem(bar, SWT.CASCADE).setText("Menu"); shell.pack(); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }

Files changed in fix:
bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Shell.java