package util;

import javafx.scene.control.Alert;
import javafx.scene.control.ButtonType;

import java.util.Optional;

public final class DialogMessage {

    private DialogMessage() {
    }

    public static void showErrorDialog(String header, String message) {
        Alert alert = new Alert(Alert.AlertType.ERROR);
        alert.setHeaderText(header);
        alert.setContentText(message);
        alert.showAndWait();
    }

    public static boolean showYesNoWarningDialog(String title, String header, String message,
                                                 String yesButtonLabel, String noButtonLabel) {

        Alert alert = new Alert(Alert.AlertType.WARNING);
        alert.setTitle(title);
        alert.setHeaderText(header);
        alert.setContentText(message);

        ButtonType yesButton = new ButtonType(yesButtonLabel);
        ButtonType noButton = new ButtonType(noButtonLabel);
        alert.getButtonTypes().setAll(yesButton, noButton);

        Optional<ButtonType> result = alert.showAndWait();

        return result.get().equals(yesButton);
    }

    public static boolean showYesNoConfirmationDialog(String title, String header, String message,
                                                 String yesButtonLabel, String noButtonLabel) {

        Alert alert = new Alert(Alert.AlertType.CONFIRMATION);
        alert.setTitle(title);
        alert.setHeaderText(header);
        alert.setContentText(message);

        ButtonType yesButton = new ButtonType(yesButtonLabel);
        ButtonType noButton = new ButtonType(noButtonLabel);
        alert.getButtonTypes().setAll(yesButton, noButton);

        Optional<ButtonType> result = alert.showAndWait();

        return result.get().equals(yesButton);
    }

    public static void showInformationDialog(String header, String message) {
        Alert alert = new Alert(Alert.AlertType.INFORMATION);
        alert.setHeaderText(header);
        alert.setContentText(message);
        alert.showAndWait();
    }
}

@@ -43,16 +43,55 @@
 .Alert;%0A
+import javafx.scene.control.ButtonBar;%0A
 import j
@@ -122,16 +122,16 @@
 onType;%0A
-
 %0Aimport 
@@ -873,32 +873,58 @@
 e(yesButtonLabel
+, ButtonBar.ButtonData.YES
 );%0A        Butto
@@ -960,32 +960,57 @@
 pe(noButtonLabel
+, ButtonBar.ButtonData.NO
 );%0A        alert
@@ -1590,32 +1590,58 @@
 e(yesButtonLabel
+, ButtonBar.ButtonData.YES
 );%0A        Butto
@@ -1685,16 +1685,41 @@
 tonLabel
+, ButtonBar.ButtonData.NO
 );%0A     

Fix `DialogMessage` Yes/No dialogs' close buttons not working