xetra11
12/28/2020, 7:11 PMonAppExit
So when shutting down I'd like to run logic to check if the current work project is saved. The typical "Do you wanna save your work before quit?".
private fun initializeEvents() {
AppManager.setEvents(
onAppExit = {
AppShutdownService().shutdown()
}
)
}
This is my code for that. AppShutdownService
actually calls a JFileChooser window if the user has not saved his/her project. The problem is that this does not mix well with the Runtime.shutdownHook cause it's bringing up a dialog etc.
Long story short - the whole thing does not work out. I am somewhat looking for a hook that runs BEFORE the actual exit occurs (if the user presses the X button)