proper close

pull/24/head
Zlatin Balevsky 2019-10-23 08:48:53 +01:00
parent b6483ad0f4
commit 771f645df0
1 changed files with 16 additions and 11 deletions

View File

@ -86,7 +86,7 @@ class MainFrameView {
visible : bind { model.coreInitialized }) {
menuBar {
menu (text : "File") {
menuItem("Exit", actionPerformed : {application.shutdown()})
menuItem("Exit", actionPerformed : {closeApplication()})
}
menu (text : "Options") {
menuItem("Configuration", actionPerformed : {mvcGroup.createMVCGroup("Options")})
@ -456,16 +456,7 @@ class MainFrameView {
}
}
} else {
mainFrame.setVisible(false)
application.getWindowManager().findWindow("shutdown-window").setVisible(true)
Core core = application.getContext().get("core")
if (core != null) {
Thread t = new Thread({
core.shutdown()
application.shutdown()
}as Runnable)
t.start()
}
closeApplication()
}
}})
@ -930,4 +921,18 @@ class MainFrameView {
tree.setSelectionPaths(selectedPaths)
builder.getVariable("shared-files-table").model.fireTableDataChanged()
}
private void closeApplication() {
def mainFrame = builder.getVariable("main-frame")
mainFrame.setVisible(false)
application.getWindowManager().findWindow("shutdown-window").setVisible(true)
Core core = application.getContext().get("core")
if (core != null) {
Thread t = new Thread({
core.shutdown()
application.shutdown()
}as Runnable)
t.start()
}
}
}