mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-07-25 16:05:28 -04:00
Remove static access to BitsquareUI#getPrimaryStage
- Bind BitsquareUI#start's primaryStage for DI - Statically inject primaryStage directly into Help and Popups
This commit is contained in:
parent
f6368754b9
commit
6f27c5ce29
9 changed files with 54 additions and 43 deletions
|
@ -35,13 +35,15 @@ import org.junit.Test;
|
|||
public class ViewLoaderTest {
|
||||
|
||||
public static class TestApp extends Application {
|
||||
static Stage primaryStage;
|
||||
@Override
|
||||
public void start(Stage primaryStage) throws Exception {
|
||||
TestApp.primaryStage = primaryStage;
|
||||
}
|
||||
}
|
||||
|
||||
@BeforeClass
|
||||
public static void initJavaFX() {
|
||||
public static void initJavaFX() throws InterruptedException {
|
||||
Thread t = new Thread("JavaFX Init Thread") {
|
||||
public void run() {
|
||||
Application.launch(TestApp.class);
|
||||
|
@ -49,12 +51,14 @@ public class ViewLoaderTest {
|
|||
};
|
||||
t.setDaemon(true);
|
||||
t.start();
|
||||
while (TestApp.primaryStage == null)
|
||||
Thread.sleep(10);
|
||||
}
|
||||
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
Injector injector = Guice.createInjector(new BitsquareModule());
|
||||
Injector injector = Guice.createInjector(new BitsquareModule(TestApp.primaryStage));
|
||||
ViewLoader.setInjector(injector);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue