mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-24 15:10:44 +01:00
Shutdown correctly
This commit is contained in:
parent
008ae0ef52
commit
8160397361
2 changed files with 12 additions and 4 deletions
|
@ -84,7 +84,7 @@ public class BitSquareUI extends Application {
|
||||||
final Injector injector = Guice.createInjector(new BitSquareModule());
|
final Injector injector = Guice.createInjector(new BitSquareModule());
|
||||||
|
|
||||||
// currently there is not SystemTray support for java fx (planned for version 3) so we use the old AWT
|
// currently there is not SystemTray support for java fx (planned for version 3) so we use the old AWT
|
||||||
AWTSystemTray.createSystemTray(primaryStage, injector.getInstance(ActorSystem.class));
|
AWTSystemTray.createSystemTray(primaryStage, injector.getInstance(ActorSystem.class), this);
|
||||||
|
|
||||||
walletFacade = injector.getInstance(WalletFacade.class);
|
walletFacade = injector.getInstance(WalletFacade.class);
|
||||||
messageFacade = injector.getInstance(MessageFacade.class);
|
messageFacade = injector.getInstance(MessageFacade.class);
|
||||||
|
@ -146,7 +146,8 @@ public class BitSquareUI extends Application {
|
||||||
|
|
||||||
KeyCodeCombination keyCodeCombination = new KeyCodeCombination(KeyCode.W, KeyCombination.SHORTCUT_DOWN);
|
KeyCodeCombination keyCodeCombination = new KeyCodeCombination(KeyCode.W, KeyCombination.SHORTCUT_DOWN);
|
||||||
scene.setOnKeyReleased(keyEvent -> {
|
scene.setOnKeyReleased(keyEvent -> {
|
||||||
if (keyCodeCombination.match(keyEvent)) AWTSystemTray.setStageHidden();
|
if (keyCodeCombination.match(keyEvent))
|
||||||
|
AWTSystemTray.setStageHidden();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,7 @@ package io.bitsquare.gui;
|
||||||
|
|
||||||
|
|
||||||
import io.bitsquare.BitSquare;
|
import io.bitsquare.BitSquare;
|
||||||
|
import io.bitsquare.BitSquareUI;
|
||||||
import io.bitsquare.gui.util.ImageUtil;
|
import io.bitsquare.gui.util.ImageUtil;
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
|
@ -46,11 +47,13 @@ public class AWTSystemTray {
|
||||||
private static MenuItem showGuiItem;
|
private static MenuItem showGuiItem;
|
||||||
private static Stage stage;
|
private static Stage stage;
|
||||||
private static ActorSystem actorSystem;
|
private static ActorSystem actorSystem;
|
||||||
|
private static BitSquareUI application;
|
||||||
private static TrayIcon trayIcon;
|
private static TrayIcon trayIcon;
|
||||||
|
|
||||||
public static void createSystemTray(Stage stage, ActorSystem actorSystem) {
|
public static void createSystemTray(Stage stage, ActorSystem actorSystem, BitSquareUI application) {
|
||||||
AWTSystemTray.stage = stage;
|
AWTSystemTray.stage = stage;
|
||||||
AWTSystemTray.actorSystem = actorSystem;
|
AWTSystemTray.actorSystem = actorSystem;
|
||||||
|
AWTSystemTray.application = application;
|
||||||
|
|
||||||
if (SystemTray.isSupported()) {
|
if (SystemTray.isSupported()) {
|
||||||
// prevent exiting the app when the last window get closed
|
// prevent exiting the app when the last window get closed
|
||||||
|
@ -99,7 +102,11 @@ public class AWTSystemTray {
|
||||||
else
|
else
|
||||||
log.error(ex.getMessage());
|
log.error(ex.getMessage());
|
||||||
}
|
}
|
||||||
System.exit(0);
|
try {
|
||||||
|
application.stop();
|
||||||
|
} catch (Exception e1) {
|
||||||
|
e1.printStackTrace();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue