From cc40d05e44780cd52757e8afa0a917dce4f5a377 Mon Sep 17 00:00:00 2001 From: Marc Stammerjohann Date: Fri, 22 Dec 2017 12:53:53 +0100 Subject: [PATCH] #79: replace shortcut with CRTL + NUM --- .../ui/controllers/MainController.java | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/main/ui/src/main/java/org/cryptomator/ui/controllers/MainController.java b/main/ui/src/main/java/org/cryptomator/ui/controllers/MainController.java index 2b29d1281..ab001ec39 100644 --- a/main/ui/src/main/java/org/cryptomator/ui/controllers/MainController.java +++ b/main/ui/src/main/java/org/cryptomator/ui/controllers/MainController.java @@ -74,8 +74,6 @@ import javafx.scene.control.MenuItem; import javafx.scene.control.ToggleButton; import javafx.scene.image.Image; import javafx.scene.input.KeyCode; -import javafx.scene.input.KeyCodeCombination; -import javafx.scene.input.KeyCombination; import javafx.scene.input.KeyEvent; import javafx.scene.input.MouseEvent; import javafx.scene.layout.HBox; @@ -109,9 +107,6 @@ public class MainController implements ViewController { private final BooleanBinding isShowingSettings; private final Map unlockedVaults = new HashMap<>(); - private final KeyCombination keyCodeCombinationCtrlUp = new KeyCodeCombination(KeyCode.UP, KeyCombination.CONTROL_DOWN); - private final KeyCombination keyCodeCombinationCtrlDown = new KeyCodeCombination(KeyCode.DOWN, KeyCombination.CONTROL_DOWN); - private Subscription subs = Subscription.EMPTY; @Inject @@ -415,15 +410,10 @@ public class MainController implements ViewController { } private void didPressKeyOnRoot(KeyEvent event) { - if (keyCodeCombinationCtrlUp.match(event)) { + if (event.isControlDown() && event.getCode().isDigitKey()) { vaultList.getSelectionModel().select( - vaultList.getSelectionModel().getSelectedIndex() == 0 ? 0 - : vaultList.getSelectionModel().getSelectedIndex() - 1); - } else if (keyCodeCombinationCtrlDown.match(event)) { - vaultList.getSelectionModel().select( - vaultList.getSelectionModel().getSelectedIndex() == vaultList.getItems().size() - ? vaultList.getItems().size() - : vaultList.getSelectionModel().getSelectedIndex() + 1); + Integer.valueOf(event.getText()) == 0 ? + 10 : Integer.valueOf(event.getText()) - 1); } }