WindowManager checkModificationsAndCloseAll does not support Window.Committable #854

This commit is contained in:
Yuriy Artamonov 2018-05-18 12:24:02 +04:00
parent efb033b531
commit 264edb8f6f
2 changed files with 14 additions and 4 deletions

View File

@ -1878,7 +1878,7 @@ public class DesktopWindowManager extends WindowManager {
addShortcuts(window, openType);
}
public void checkModificationsAndCloseAll(final Runnable runIfOk, final @Nullable Runnable runIfCancel) {
public void checkModificationsAndCloseAll(Runnable runIfOk, @Nullable Runnable runIfCancel) {
boolean modified = false;
for (Window window : getOpenWindows()) {
if (!disableSavingScreenHistory) {
@ -1896,7 +1896,12 @@ public class DesktopWindowManager extends WindowManager {
recursiveFramesClose = false;
}
if (window.getDsContext() != null && window.getDsContext().isModified()) {
if (window instanceof WrappedWindow
&& ((WrappedWindow) window).getWrapper() instanceof Window.Committable) {
WrappedWindow wrappedWindow = (WrappedWindow) window;
modified = ((Window.Committable) wrappedWindow.getWrapper()).isModified();
} else if (window.getDsContext() != null
&& window.getDsContext().isModified()) {
modified = true;
}
}

View File

@ -898,7 +898,7 @@ public class WebWindowManager extends WindowManager {
* @param runIfOk a closure to run after all screens are closed
* @param runIfCancel a closure to run if there were modifications and a user canceled the operation
*/
public void checkModificationsAndCloseAll(final Runnable runIfOk, final @Nullable Runnable runIfCancel) {
public void checkModificationsAndCloseAll(Runnable runIfOk, @Nullable Runnable runIfCancel) {
boolean modified = false;
for (Window window : getOpenWindows()) {
if (!disableSavingScreenHistory) {
@ -911,7 +911,12 @@ public class WebWindowManager extends WindowManager {
window.saveSettings();
}
if (window.getDsContext() != null && window.getDsContext().isModified()) {
if (window instanceof WrappedWindow
&& ((WrappedWindow) window).getWrapper() instanceof Window.Committable) {
WrappedWindow wrappedWindow = (WrappedWindow) window;
modified = ((Window.Committable) wrappedWindow.getWrapper()).isModified();
} else if (window.getDsContext() != null
&& window.getDsContext().isModified()) {
modified = true;
}
}