소스 검색

#79: replace shortcut with CRTL + NUM

Marc Stammerjohann 7 년 전
부모
커밋
cc40d05e44
1개의 변경된 파일3개의 추가작업 그리고 13개의 파일을 삭제
  1. 3 13
      main/ui/src/main/java/org/cryptomator/ui/controllers/MainController.java

+ 3 - 13
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<Vault, UnlockedController> 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)) {
-			vaultList.getSelectionModel().select(
-					vaultList.getSelectionModel().getSelectedIndex() == 0 ? 0
-							: vaultList.getSelectionModel().getSelectedIndex() - 1);
-		} else if (keyCodeCombinationCtrlDown.match(event)) {
+		if (event.isControlDown() && event.getCode().isDigitKey()) {
 			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);
 		}
 	}