Added AppLifecycleListener.appWilExit API

This commit is contained in:
Vyacheslav Karpukhin
2016-10-21 00:18:23 +02:00
parent 8f232a9173
commit bc8f03f8ff
2 changed files with 8 additions and 1 deletions
@@ -55,6 +55,11 @@ public interface AppLifecycleListener {
*/
void appClosing();
/**
* Fired after all exit checks and after saving the settings. At this point the app is guaranteed to exit.
*/
default void appWillExit() { }
abstract class Adapter implements AppLifecycleListener {
@Override
public void appFrameCreated(String[] commandLineArgs, @NotNull Ref<Boolean> willOpenProject) { }
@@ -758,7 +758,8 @@ public class ApplicationImpl extends PlatformComponentManagerImpl implements App
return;
}
getMessageBus().syncPublisher(AppLifecycleListener.TOPIC).appClosing();
final AppLifecycleListener publisher = getMessageBus().syncPublisher(AppLifecycleListener.TOPIC);
publisher.appClosing();
myDisposeInProgress = true;
@@ -768,6 +769,7 @@ public class ApplicationImpl extends PlatformComponentManagerImpl implements App
saveSettings();
publisher.appWillExit();
boolean success = disposeSelf(!force);
if (!success || isUnitTestMode() || Boolean.getBoolean("idea.test.guimode")) {