Add log path to settings load error
Since they wouldn't be able to run the application to see the log path. Also make no the default option
This commit is contained in:
@ -25,6 +25,7 @@ import javafx.fxml.FXMLLoader;
|
|||||||
import javafx.fxml.Initializable;
|
import javafx.fxml.Initializable;
|
||||||
import javafx.scene.control.Alert;
|
import javafx.scene.control.Alert;
|
||||||
import javafx.scene.control.Alert.AlertType;
|
import javafx.scene.control.Alert.AlertType;
|
||||||
|
import javafx.scene.control.Button;
|
||||||
import javafx.scene.control.ButtonType;
|
import javafx.scene.control.ButtonType;
|
||||||
import javafx.scene.control.Label;
|
import javafx.scene.control.Label;
|
||||||
import javafx.scene.control.TextArea;
|
import javafx.scene.control.TextArea;
|
||||||
@ -183,9 +184,20 @@ public class MainController implements Initializable {
|
|||||||
|
|
||||||
Result<MainSettings, Exception> result = MainSettings.load();
|
Result<MainSettings, Exception> result = MainSettings.load();
|
||||||
if (!result.hasSuccess()) {
|
if (!result.hasSuccess()) {
|
||||||
Alert alert = new Alert(Alert.AlertType.ERROR, "Unable to load settings file. See log for details. Reinitialize settings? This may overwrite existing settings.", ButtonType.YES, ButtonType.NO);
|
String logPath = Main.getStatePath().resolve("main.log").toString();
|
||||||
|
String message = "Unable to load settings file. See log file at " + logPath + " for details. Reinitialize settings? This may overwrite existing settings.";
|
||||||
|
Alert alert = new Alert(Alert.AlertType.ERROR, message, ButtonType.NO, ButtonType.YES);
|
||||||
alert.setTitle("Settings load error");
|
alert.setTitle("Settings load error");
|
||||||
alert.setHeaderText(null);
|
alert.setHeaderText(null);
|
||||||
|
|
||||||
|
//Deactivate Defaultbehavior for yes-Button:
|
||||||
|
Button yesButton = (Button) alert.getDialogPane().lookupButton( ButtonType.YES );
|
||||||
|
yesButton.setDefaultButton( false );
|
||||||
|
|
||||||
|
//Activate Defaultbehavior for no-Button:
|
||||||
|
Button noButton = (Button) alert.getDialogPane().lookupButton( ButtonType.NO );
|
||||||
|
noButton.setDefaultButton( true );
|
||||||
|
|
||||||
Optional<ButtonType> promptResult = alert.showAndWait();
|
Optional<ButtonType> promptResult = alert.showAndWait();
|
||||||
|
|
||||||
if (!promptResult.isPresent()) {
|
if (!promptResult.isPresent()) {
|
||||||
|
Reference in New Issue
Block a user