瀏覽代碼

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'.

jellemdekker 6 年之前
父節點
當前提交
963a731202

+ 4 - 9
main/ui/src/main/java/org/cryptomator/ui/controllers/MainController.java

@@ -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()) {

+ 2 - 2
main/ui/src/main/java/org/cryptomator/ui/util/DialogBuilderUtil.java

@@ -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) {