remove keyboard shortcut+pageup/pagedown to switch tabs already added by default

This commit is contained in:
Craig Raw 2023-11-08 15:22:39 +02:00
parent 218e751333
commit 36c2181a7f

View file

@ -414,7 +414,7 @@ public class AppController implements Initializable {
org.controlsfx.tools.Platform platform = org.controlsfx.tools.Platform.getCurrent();
if(platform == org.controlsfx.tools.Platform.OSX) {
tabs.getScene().addEventFilter(KeyEvent.KEY_PRESSED, event -> {
if(event.isShortcutDown() && event.isAltDown()) {
if(event.isShortcutDown() && event.isAltDown() && (event.getCode() == KeyCode.LEFT || event.getCode() == KeyCode.RIGHT)) {
int currentIndex = tabs.getSelectionModel().getSelectedIndex();
if(event.getCode() == KeyCode.LEFT && currentIndex > 0) {
tabs.getSelectionModel().select(currentIndex - 1);
@ -423,17 +423,6 @@ public class AppController implements Initializable {
}
}
});
} else {
tabs.getScene().addEventFilter(KeyEvent.KEY_PRESSED, event -> {
if(event.isShortcutDown()) {
int currentIndex = tabs.getSelectionModel().getSelectedIndex();
if(event.getCode() == KeyCode.PAGE_UP && currentIndex > 0) {
tabs.getSelectionModel().select(currentIndex - 1);
} else if(event.getCode() == KeyCode.PAGE_DOWN && currentIndex < tabs.getTabs().size() - 1) {
tabs.getSelectionModel().select(currentIndex + 1);
}
}
});
}
}