From 5768e983419b926626822327df2c11fd77eccc32 Mon Sep 17 00:00:00 2001
From: YifeiShi99 <51186185+YifeiShi99@users.noreply.github.com>
Date: Mon, 15 May 2023 21:00:37 -0700
Subject: [PATCH] implement request from issue #9863
---
CHANGELOG.md | 2 ++
src/main/java/org/jabref/gui/JabRefFrame.java | 4 ++++
src/main/java/org/jabref/gui/StateManager.java | 12 ++++++++++++
.../java/org/jabref/gui/groups/GroupTreeView.java | 3 +++
.../java/org/jabref/gui/keyboard/KeyBinding.java | 3 ++-
src/main/resources/l10n/JabRef_en.properties | 1 +
6 files changed, 24 insertions(+), 1 deletion(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index afadd1b8aad..c09da9cfd9f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -23,6 +23,7 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve
- We added the option to automatically download online files when a new entry is created from an existing ID (e.g. DOI). The option can be disabled in the preferences under "Import and Export" [#9756](https://github.com/JabRef/jabref/issues/9756)
- We added a new Integrity check for unscaped ampersands. [koppor#585](https://github.com/koppor/jabref/issues/585)
- We added the possibility to automatically fetch entries when an IBSN is pasted on the main table [#9864](https://github.com/JabRef/jabref/issues/9864)
+- We added key binding to focus on groups Shift + Tab [#9863](https://github.com/JabRef/jabref/issues/9863)
### Changed
@@ -52,6 +53,7 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve
- We moved the option to run JabRef in memory stick mode into the preferences dialog toolbar. [#9866](https://github.com/JabRef/jabref/pull/9866)
- In case the library contains empty entries, they are not written to disk. [#8645](https://github.com/JabRef/jabref/issues/8645)
- The formatter `remove_unicode_ligatures` is now called `replace_unicode_ligatures`. [#9890](https://github.com/JabRef/jabref/pull/9890)
+- The key binding to focus on entry table is changed to Tab [#9863](https://github.com/JabRef/jabref/issues/9863)
### Fixed
diff --git a/src/main/java/org/jabref/gui/JabRefFrame.java b/src/main/java/org/jabref/gui/JabRefFrame.java
index bd29adeb53f..6876cb9cec1 100644
--- a/src/main/java/org/jabref/gui/JabRefFrame.java
+++ b/src/main/java/org/jabref/gui/JabRefFrame.java
@@ -320,6 +320,10 @@ private void initKeyBindings() {
getCurrentLibraryTab().getMainTable().requestFocus();
event.consume();
break;
+ case FOCUS_GROUP_LIST:
+ this.stateManager.getGroupTree().requestFocus();
+ event.consume();
+ break;
case NEXT_LIBRARY:
tabbedPane.getSelectionModel().selectNext();
event.consume();
diff --git a/src/main/java/org/jabref/gui/StateManager.java b/src/main/java/org/jabref/gui/StateManager.java
index f1ff42c5785..9fabbe95433 100644
--- a/src/main/java/org/jabref/gui/StateManager.java
+++ b/src/main/java/org/jabref/gui/StateManager.java
@@ -19,9 +19,11 @@
import javafx.collections.ObservableMap;
import javafx.concurrent.Task;
import javafx.scene.Node;
+import javafx.scene.control.TreeTableView;
import javafx.util.Pair;
import org.jabref.gui.edit.automaticfiededitor.LastAutomaticFieldEditorEdit;
+import org.jabref.gui.groups.GroupNodeViewModel;
import org.jabref.gui.sidepane.SidePaneType;
import org.jabref.gui.util.BackgroundTask;
import org.jabref.gui.util.CustomLocalDragboard;
@@ -97,6 +99,8 @@ public OptionalObjectProperty activeSearchQueryProperty() {
return activeSearchQuery;
}
+ private TreeTableView groupTree;
+
public void setActiveSearchResultSize(BibDatabaseContext database, IntegerProperty resultSize) {
searchResultMap.put(database, resultSize);
}
@@ -235,4 +239,12 @@ public List getLastSearchHistory(int size) {
public void clearSearchHistory() {
searchHistory.clear();
}
+
+ public void setGroupTree(TreeTableView groupTree) {
+ this.groupTree = groupTree;
+ }
+
+ public TreeTableView getGroupTree() {
+ return this.groupTree;
+ }
}
diff --git a/src/main/java/org/jabref/gui/groups/GroupTreeView.java b/src/main/java/org/jabref/gui/groups/GroupTreeView.java
index cc298b32520..484fce0a003 100644
--- a/src/main/java/org/jabref/gui/groups/GroupTreeView.java
+++ b/src/main/java/org/jabref/gui/groups/GroupTreeView.java
@@ -251,6 +251,9 @@ private void initialize() {
// Filter text field
setupClearButtonField(searchField);
+
+ // set GroupTree in StateManger
+ this.stateManager.setGroupTree(this.groupTree);
}
private StackPane getArrowCell(GroupNodeViewModel viewModel) {
diff --git a/src/main/java/org/jabref/gui/keyboard/KeyBinding.java b/src/main/java/org/jabref/gui/keyboard/KeyBinding.java
index d8edbcc75a3..1b9927647b8 100644
--- a/src/main/java/org/jabref/gui/keyboard/KeyBinding.java
+++ b/src/main/java/org/jabref/gui/keyboard/KeyBinding.java
@@ -55,7 +55,8 @@ public enum KeyBinding {
FILE_LIST_EDITOR_MOVE_ENTRY_DOWN("File list editor, move entry down", Localization.lang("File list editor, move entry down"), "ctrl+DOWN", KeyBindingCategory.VIEW),
FILE_LIST_EDITOR_MOVE_ENTRY_UP("File list editor, move entry up", Localization.lang("File list editor, move entry up"), "ctrl+UP", KeyBindingCategory.VIEW),
FIND_UNLINKED_FILES("Search for unlinked local files", Localization.lang("Search for unlinked local files"), "shift+F7", KeyBindingCategory.QUALITY),
- FOCUS_ENTRY_TABLE("Focus entry table", Localization.lang("Focus entry table"), "alt+1", KeyBindingCategory.VIEW),
+ FOCUS_ENTRY_TABLE("Focus entry table", Localization.lang("Focus entry table"), "TAB", KeyBindingCategory.VIEW),
+ FOCUS_GROUP_LIST("Focus group list", Localization.lang("Focus group list"), "shift+TAB", KeyBindingCategory.VIEW),
HELP("Help", Localization.lang("Help"), "F1", KeyBindingCategory.FILE),
IMPORT_INTO_CURRENT_DATABASE("Import into current library", Localization.lang("Import into current library"), "ctrl+I", KeyBindingCategory.FILE),
IMPORT_INTO_NEW_DATABASE("Import into new library", Localization.lang("Import into new library"), "ctrl+alt+I", KeyBindingCategory.FILE),
diff --git a/src/main/resources/l10n/JabRef_en.properties b/src/main/resources/l10n/JabRef_en.properties
index 9f57b9dd104..d7f72c2b0d4 100644
--- a/src/main/resources/l10n/JabRef_en.properties
+++ b/src/main/resources/l10n/JabRef_en.properties
@@ -1367,6 +1367,7 @@ Entry\ editor,\ previous\ panel\ 2=Entry editor, previous panel 2
File\ list\ editor,\ move\ entry\ down=File list editor, move entry down
File\ list\ editor,\ move\ entry\ up=File list editor, move entry up
Focus\ entry\ table=Focus entry table
+Focus\ group\ list=Focus group list
Import\ into\ current\ library=Import into current library
Import\ into\ new\ library=Import into new library
New\ article=New article