Community
Participate
Working Groups
Created attachment 260224 [details] EntryPoint for reproducing error. Dears, in some cases the default OK, Cancel button of a custom JFace dialog or MessageDialog (not 100% sure it's only JFace dialog related) don't react, leaving the dialog open. The dialog can only be closed by using the X button in the title bar. This only happens once per session. And not all the time. In attachment is the code to reproduce it. The steps to reproduce are : - surfing to entrypoint - clicking button => dialog opens - pressing ok : this works. - altering code (fe btn.setText("Pushing second load") ); - refreshing browser - clicking button => dialog opens - pressing ok : dialog stays open. While debugging I found the following difference between working and not working in EventUtil.isShellAccessible Working : parameter shell == shell.getDisplay.getActiveShell() not working : parameter shell != shell.getDisplay.getActiveShell() Kind Regards
Changing the style bit of shell to SWT.PRIMARY_MODAL seems to resolve this final Shell shell = new Shell(display, SWT.PRIMARY_MODAL);
I'm looking into the issue right now... will let you know about the results.
The problem in your code is the Shell resize event listener. In this listener you set the maximized state to the shell again and again which indirectly set the active shell back to dialog parent shell. Thus, dialog shell is no longer active and buttons can't be clicked. In RAP, because of text-size-determination, all shells are temporary resized (enlarge than reduced to original size) when some text chages. It's not a good idea to set the maximized state in these temporary resize events.
.... why do you set the maximized state in display/shell resize listener?
When the user resizes the browser, we want to relayout the shell and utilize the full available screen. If I remove setMaximized(true) from the shell resize listener, but leave it in the display resize listener then it still resizes nicely and the dialog buttons react fine.
When you resize the browser the maximized shell will stay maximized (utilize the full available screen) without a need to set the maximized state again in resize listener. The workaround for the issue is simply to remove the setMaximized method call in both (display and shell) resize listeners.
When I remove both setMaximized statements the shell doesn't resize when the browser is enlarged. Tested in Chrome (48.0.2564.116 m), FF (44.0.2), Edge, IE (11). Instead of the white background I see a gray background of the part that is expanded. When the setMaximized stays in the display resize event then the shell will expand and wil use the entire space in the browser.
(In reply to comment #7) > When I remove both setMaximized statements the shell doesn't resize when the > browser is enlarged. Don't set the location to (0,0) or set it before the miximized state. Setting the location (bounds) will reset shell maximized state.
Your code shoud work fine without setting the shell location and maximized state in display/shell resize listeners.
Indeed, when changing the code in following way: - shell.setLocation(0, 0) before shell.setMaximized - remove shell.setMaximized from resize listeners of display and shell the dialog buttons still react and the shell resizes to the size of the browser. tx!
For completeness you don't need to set the location, it's (0,0) by default. I think both resize listeners are also not needed, the layout will be performed.
Indeed, I removed the set location + the resizelisteners and the layout is performed.