mirror of
https://github.com/cryptomator/cryptomator.git
synced 2026-05-17 10:11:27 +00:00
As per feedback on PR #690: redid line wrapping, refactored signature for dialog builder method to include a default button, and the default button for the graceful shutdown dialog is now 'Force shutdown'.
This commit is contained in:
@@ -217,16 +217,11 @@ public class MainController implements ViewController {
|
||||
private void gracefulShutdown() {
|
||||
vaults.filtered(Vault.NOT_LOCKED).forEach(Vault::prepareForShutdown);
|
||||
if (!vaults.filtered(Vault.NOT_LOCKED).isEmpty()) {
|
||||
ButtonType tryAgainButtonType = new ButtonType(
|
||||
localization.getString("main.gracefulShutdown.button.tryAgain"));
|
||||
ButtonType forceShutdownButtonType = new ButtonType(
|
||||
localization.getString("main.gracefulShutdown.button.forceShutdown"));
|
||||
ButtonType tryAgainButtonType = new ButtonType(localization.getString("main.gracefulShutdown.button.tryAgain"));
|
||||
ButtonType forceShutdownButtonType = new ButtonType(localization.getString("main.gracefulShutdown.button.forceShutdown"));
|
||||
Alert gracefulShutdownDialog = DialogBuilderUtil.buildGracefulShutdownDialog(
|
||||
localization.getString("main.gracefulShutdown.dialog.title"),
|
||||
localization.getString("main.gracefulShutdown.dialog.header"),
|
||||
localization.getString("main.gracefulShutdown.dialog.content"),
|
||||
tryAgainButtonType,
|
||||
forceShutdownButtonType);
|
||||
localization.getString("main.gracefulShutdown.dialog.title"), localization.getString("main.gracefulShutdown.dialog.header"), localization.getString("main.gracefulShutdown.dialog.content"),
|
||||
forceShutdownButtonType, forceShutdownButtonType, tryAgainButtonType);
|
||||
|
||||
Optional<ButtonType> choice = gracefulShutdownDialog.showAndWait();
|
||||
if (choice.isPresent()) {
|
||||
|
||||
@@ -38,8 +38,8 @@ public class DialogBuilderUtil {
|
||||
return buildDialog(title, header, content, Alert.AlertType.CONFIRMATION, defaultButton, ButtonType.YES, ButtonType.NO);
|
||||
}
|
||||
|
||||
public static Alert buildGracefulShutdownDialog(String title, String header, String content, ButtonType tryAgainButton, ButtonType forceShutdownButton) {
|
||||
return buildDialog(title, header, content, Alert.AlertType.WARNING, tryAgainButton, tryAgainButton, forceShutdownButton);
|
||||
public static Alert buildGracefulShutdownDialog(String title, String header, String content, ButtonType defaultButton, ButtonType... buttons) {
|
||||
return buildDialog(title, header, content, Alert.AlertType.WARNING, defaultButton, buttons);
|
||||
}
|
||||
|
||||
private static Alert buildDialog(String title, String header, String content, Alert.AlertType type, ButtonType defaultButton, ButtonType... buttons) {
|
||||
|
||||
Reference in New Issue
Block a user