show a window while MW is shutting down

This commit is contained in:
Zlatin Balevsky
2019-10-22 23:26:54 +01:00
parent 7ad677ead2
commit ffde6ac86f
6 changed files with 78 additions and 6 deletions

View File

@@ -49,7 +49,7 @@ class Initialize extends AbstractLifecycleHandler {
}
}
if (SystemTray.isSupported()) {
if (SystemTray.isSupported() && (SystemVersion.isMac() || SystemVersion.isWindows())) {
try {
def tray = SystemTray.getSystemTray()
def url = Initialize.class.getResource("/MuWire-32x32.png")
@@ -60,11 +60,17 @@ class Initialize extends AbstractLifecycleHandler {
def exit = new MenuItem("Exit")
exit.addActionListener({
application.getWindowManager().findWindow("main-frame").setVisible(false)
application.getWindowManager().findWindow("shutdown-window").setVisible(true)
Core core = application.getContext().get("core")
if (core != null)
core.shutdown()
if (core != null) {
Thread t = new Thread({
core.shutdown()
application.shutdown()
}as Runnable)
t.start()
}
tray.remove(trayIcon)
System.exit(0)
})
def showMW = {e ->