mirror of https://github.com/zlatinb/muwire
proper shutdown if core isn't created yet
parent
c038846ff3
commit
5e23c1b823
|
@ -47,14 +47,12 @@ class Ready extends AbstractLifecycleHandler {
|
|||
def home = new File(application.getContext().getAsString("muwire-home"))
|
||||
def props = new Properties()
|
||||
def propsFile = new File(home, "MuWire.properties")
|
||||
if (propsFile.exists()) {
|
||||
if (propsFile.exists() && propsFile.length() > 0) {
|
||||
log.info("loading existing props file")
|
||||
propsFile.withReader("UTF-8", {
|
||||
props.load(it)
|
||||
})
|
||||
props = new MuWireSettings(props)
|
||||
if (props.incompleteLocation == null)
|
||||
props.incompleteLocation = new File(home, "incompletes")
|
||||
|
||||
if (System.getProperties().containsKey("disableUpdates"))
|
||||
props.disableUpdates = Boolean.valueOf(System.getProperty("disableUpdates"))
|
||||
|
@ -125,7 +123,7 @@ class Ready extends AbstractLifecycleHandler {
|
|||
|
||||
JOptionPane.showMessageDialog(null, trans(key),
|
||||
trans("CORE_INIT_ERROR_HEADER"), JOptionPane.WARNING_MESSAGE)
|
||||
System.exit(0)
|
||||
application.shutdown()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2236,7 +2236,20 @@ class MainFrameView {
|
|||
}
|
||||
|
||||
void closeApplication() {
|
||||
application.getWindowManager().findWindow("shutdown-window")?.setVisible(true)
|
||||
JFrame mainFrame = builder.getVariable("main-frame")
|
||||
mainFrame.setVisible(false)
|
||||
|
||||
Core core = application.getContext().get("core")
|
||||
if (core == null) {
|
||||
// save UI settings so language dialog does not appear again
|
||||
if (settings != null) {
|
||||
File uiPropsFile = new File(application.context.getAsString("muwire-home"), "gui.properties")
|
||||
uiPropsFile.withOutputStream {settings.write(it)}
|
||||
}
|
||||
application.shutdown()
|
||||
return
|
||||
}
|
||||
|
||||
def tabbedPane = builder.getVariable("result-tabs")
|
||||
settings.openTabs.clear()
|
||||
|
@ -2246,20 +2259,16 @@ class MainFrameView {
|
|||
settings.openTabs.removeAll(model.browses)
|
||||
settings.openTabs.removeAll(model.collections)
|
||||
|
||||
JFrame mainFrame = builder.getVariable("main-frame")
|
||||
settings.mainFrameX = mainFrame.getSize().width
|
||||
settings.mainFrameY = mainFrame.getSize().height
|
||||
mainFrame.setVisible(false)
|
||||
application.getWindowManager().findWindow("shutdown-window")?.setVisible(true)
|
||||
if (core != null) {
|
||||
Thread t = new Thread({
|
||||
core.shutdown()
|
||||
application.shutdown()
|
||||
}as Runnable)
|
||||
t.start()
|
||||
File uiPropsFile = new File(core.home, "gui.properties")
|
||||
uiPropsFile.withOutputStream { settings.write(it) }
|
||||
}
|
||||
File uiPropsFile = new File(core.home, "gui.properties")
|
||||
uiPropsFile.withOutputStream { settings.write(it) }
|
||||
|
||||
Thread t = new Thread({
|
||||
core.shutdown()
|
||||
application.shutdown()
|
||||
}as Runnable)
|
||||
t.start()
|
||||
}
|
||||
|
||||
private class ResultTabsChangeListener implements ChangeListener {
|
||||
|
|
Loading…
Reference in New Issue