WorkbenchFX
WorkbenchFX copied to clipboard
How to pause execution until a dialog is closed?
I'm trying to add an exit confirmation but it just falls through, the dialog is never shown.
mStage.addEventFilter(WindowEvent.WINDOW_CLOSE_REQUEST, windowEvent -> {
if (true) {//TODO Add condition
var dialog = WorkbenchDialog.builder("title", "message", WorkbenchDialog.Type.CONFIRMATION).onResult(buttonType -> {
if (buttonType.getButtonData() != ButtonBar.ButtonData.YES) {
windowEvent.consume();
}
}).blocking(true).build();
mWorkbench.showDialog(dialog);
}
});
For this simple test the result is 132, what I want it to be 123.
System.out.println("1");
mWorkbench.showConfirmationDialog(
"Continue without saving?",
"Are you sure you want to continue without saving"
+ "your document?",
buttonType -> { // Proceed and validate the result
System.out.println("2");
});
System.out.println("3");
Just speculating here but are there any (overlay transition) listeners or something I could connect a CountDownLatch to?