From 58073ce3ee63cf28f09d6de1f33f84e917083d4f Mon Sep 17 00:00:00 2001 From: Joeri Sykora Date: Mon, 16 Oct 2017 09:41:19 +0200 Subject: [PATCH 1/3] the dialog must be shown in the javafx app thread, because the library watching is done in a background thread --- .../scenebuilder/app/SceneBuilderApp.java | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/com/oracle/javafx/scenebuilder/app/SceneBuilderApp.java b/app/src/main/java/com/oracle/javafx/scenebuilder/app/SceneBuilderApp.java index 44641a5e1..1e57ad990 100644 --- a/app/src/main/java/com/oracle/javafx/scenebuilder/app/SceneBuilderApp.java +++ b/app/src/main/java/com/oracle/javafx/scenebuilder/app/SceneBuilderApp.java @@ -403,14 +403,16 @@ public void handleLaunch(List files) { } } if (shouldShowImportGluonJarAlert) { - SceneBuilderApp sceneBuilderApp = SceneBuilderApp.getSingleton(); - DocumentWindowController dwc = sceneBuilderApp.getFrontDocumentWindow(); - if (dwc == null) { - dwc = sceneBuilderApp.getDocumentWindowControllers().get(0); - } - ImportingGluonControlsAlert alert = new ImportingGluonControlsAlert(dwc.getStage()); - AppSettings.setWindowIcon(alert); - alert.showAndWait(); + Platform.runLater(() -> { + SceneBuilderApp sceneBuilderApp = SceneBuilderApp.getSingleton(); + DocumentWindowController dwc = sceneBuilderApp.getFrontDocumentWindow(); + if (dwc == null) { + dwc = sceneBuilderApp.getDocumentWindowControllers().get(0); + } + ImportingGluonControlsAlert alert = new ImportingGluonControlsAlert(dwc.getStage()); + AppSettings.setWindowIcon(alert); + alert.showAndWait(); + }); } updateImportedGluonJars(jarReports); }); From 0d6d5d5af12f4ebfac523ae14d5b4d93961001ee Mon Sep 17 00:00:00 2001 From: Joeri Sykora Date: Mon, 30 Oct 2017 10:56:54 +0100 Subject: [PATCH 2/3] initialize owner if alert to the stage of the welcome dialog if it is shown --- .../oracle/javafx/scenebuilder/app/SceneBuilderApp.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/oracle/javafx/scenebuilder/app/SceneBuilderApp.java b/app/src/main/java/com/oracle/javafx/scenebuilder/app/SceneBuilderApp.java index 1e57ad990..e0406d3d7 100644 --- a/app/src/main/java/com/oracle/javafx/scenebuilder/app/SceneBuilderApp.java +++ b/app/src/main/java/com/oracle/javafx/scenebuilder/app/SceneBuilderApp.java @@ -382,6 +382,8 @@ public void start(Stage stage) throws Exception { */ @Override public void handleLaunch(List files) { + boolean showWelcomeDialog = files.isEmpty(); + setApplicationUncaughtExceptionHandler(); MavenPreferences mavenPreferences = PreferencesController.getSingleton().getMavenPreferences(); @@ -411,6 +413,9 @@ public void handleLaunch(List files) { } ImportingGluonControlsAlert alert = new ImportingGluonControlsAlert(dwc.getStage()); AppSettings.setWindowIcon(alert); + if (showWelcomeDialog) { + alert.initOwner(WelcomeDialogWindowController.getInstance().getStage()); + } alert.showAndWait(); }); } @@ -423,7 +428,7 @@ public void handleLaunch(List files) { sendTrackingStartupInfo(); - if (files.isEmpty()) { + if (showWelcomeDialog) { // Creates an empty document final DocumentWindowController newWindow = makeNewWindow(); newWindow.updateWithDefaultContent(); From 1499ed638ec098b79365ee525fe04a66eaa82b06 Mon Sep 17 00:00:00 2001 From: Joeri Sykora Date: Mon, 30 Oct 2017 11:02:53 +0000 Subject: [PATCH 3/3] Close branch issue-149