platform: add makeCurrentMessageDialogGoAway to the end of event queue

When we show message dialog on mac we use `SheetMessage`, that create dialog in three steps:
1. Create JDialog and calculate components size
2. Start animation calling `startAnimation`
3. When animation is finished set JDialog component to what it should be
The problem is: if we call `makeCurrentMessageDialogGoAway` using `UIUtil.invokeLaterIfNeeded` it will be invoked before animation stopped and won't find cancel button, which is the only way to close the dialog.
Force add event to the end of queue may fix this problem in some cases.
This commit is contained in:
Kirill Timofeev
2018-11-12 18:24:22 +03:00
parent 6ffb0069d6
commit f96de92eab
@@ -177,7 +177,8 @@ public class Messages {
@NotNull
public static Runnable createMessageDialogRemover(@Nullable Project project) {
Window projectWindow = project == null ? null : WindowManager.getInstance().suggestParentWindow(project);
return () -> UIUtil.invokeLaterIfNeeded(() -> makeCurrentMessageDialogGoAway(
//noinspection SSBasedInspection
return () -> SwingUtilities.invokeLater(() -> makeCurrentMessageDialogGoAway(
projectWindow != null ? projectWindow.getOwnedWindows() : Window.getWindows()));
}