|
@@ -9,6 +9,33 @@
|
|
|
******************************************************************************/
|
|
|
package org.cryptomator.ui.controllers;
|
|
|
|
|
|
+import java.io.File;
|
|
|
+import java.io.IOException;
|
|
|
+import java.net.URL;
|
|
|
+import java.nio.file.Files;
|
|
|
+import java.nio.file.Path;
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+import java.util.Optional;
|
|
|
+
|
|
|
+import javax.inject.Inject;
|
|
|
+import javax.inject.Named;
|
|
|
+import javax.inject.Provider;
|
|
|
+import javax.inject.Singleton;
|
|
|
+
|
|
|
+import org.apache.commons.lang3.SystemUtils;
|
|
|
+import org.cryptomator.ui.controls.DirectoryListCell;
|
|
|
+import org.cryptomator.ui.model.Vault;
|
|
|
+import org.cryptomator.ui.model.VaultFactory;
|
|
|
+import org.cryptomator.ui.settings.Localization;
|
|
|
+import org.cryptomator.ui.settings.Settings;
|
|
|
+import org.cryptomator.ui.util.DialogBuilderUtil;
|
|
|
+import org.fxmisc.easybind.EasyBind;
|
|
|
+import org.fxmisc.easybind.monadic.MonadicBinding;
|
|
|
+import org.slf4j.Logger;
|
|
|
+import org.slf4j.LoggerFactory;
|
|
|
+
|
|
|
import dagger.Lazy;
|
|
|
import javafx.application.Platform;
|
|
|
import javafx.beans.binding.Binding;
|
|
@@ -23,35 +50,17 @@ import javafx.event.ActionEvent;
|
|
|
import javafx.fxml.FXML;
|
|
|
import javafx.geometry.Side;
|
|
|
import javafx.scene.Parent;
|
|
|
-import javafx.scene.control.*;
|
|
|
+import javafx.scene.control.Alert;
|
|
|
+import javafx.scene.control.Button;
|
|
|
+import javafx.scene.control.ButtonType;
|
|
|
+import javafx.scene.control.ContextMenu;
|
|
|
+import javafx.scene.control.ListCell;
|
|
|
+import javafx.scene.control.ListView;
|
|
|
+import javafx.scene.control.ToggleButton;
|
|
|
import javafx.scene.layout.HBox;
|
|
|
import javafx.scene.layout.Pane;
|
|
|
import javafx.stage.FileChooser;
|
|
|
import javafx.stage.Stage;
|
|
|
-import org.cryptomator.ui.controls.DirectoryListCell;
|
|
|
-import org.cryptomator.ui.model.Vault;
|
|
|
-import org.cryptomator.ui.model.VaultFactory;
|
|
|
-import org.cryptomator.ui.settings.Localization;
|
|
|
-import org.cryptomator.ui.settings.Settings;
|
|
|
-import org.cryptomator.ui.util.DialogBuilderUtil;
|
|
|
-import org.fxmisc.easybind.EasyBind;
|
|
|
-import org.fxmisc.easybind.monadic.MonadicBinding;
|
|
|
-import org.slf4j.Logger;
|
|
|
-import org.slf4j.LoggerFactory;
|
|
|
-
|
|
|
-import javax.inject.Inject;
|
|
|
-import javax.inject.Named;
|
|
|
-import javax.inject.Provider;
|
|
|
-import javax.inject.Singleton;
|
|
|
-import java.io.File;
|
|
|
-import java.io.IOException;
|
|
|
-import java.net.URL;
|
|
|
-import java.nio.file.Files;
|
|
|
-import java.nio.file.Path;
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
-import java.util.Optional;
|
|
|
|
|
|
@Singleton
|
|
|
public class MainController extends LocalizedFXMLViewController {
|
|
@@ -225,13 +234,14 @@ public class MainController extends LocalizedFXMLViewController {
|
|
|
|
|
|
@FXML
|
|
|
private void didClickRemoveSelectedEntry(ActionEvent e) {
|
|
|
- Dialog confirmDialog = DialogBuilderUtil.buildConfirmationDialog(
|
|
|
- localization.getString("main.directoryList.remove.confirmation.title"),
|
|
|
- localization.getString("main.directoryList.remove.confirmation.header"),
|
|
|
- localization.getString("main.directoryList.remove.confirmation.content")
|
|
|
- );
|
|
|
+ Alert confirmDialog = DialogBuilderUtil.buildConfirmationDialog(
|
|
|
+ localization.getString("main.directoryList.remove.confirmation.title"),
|
|
|
+ localization.getString("main.directoryList.remove.confirmation.header"),
|
|
|
+ localization.getString("main.directoryList.remove.confirmation.content"),
|
|
|
+ SystemUtils.IS_OS_MAC_OSX ? ButtonType.CANCEL : ButtonType.OK);
|
|
|
+
|
|
|
Optional<ButtonType> choice = confirmDialog.showAndWait();
|
|
|
- if (choice.get() == ButtonType.OK){
|
|
|
+ if (ButtonType.OK.equals(choice.get())) {
|
|
|
vaults.remove(selectedVault.get());
|
|
|
if (vaults.isEmpty()) {
|
|
|
activeController.set(welcomeController.get());
|