diff --git a/CHANGELOG.md b/CHANGELOG.md
index cbee02b9ff5..5419597820b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -40,6 +40,7 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve
- The export to MS Office XML now uses the month name for the field `Month` instead of the two digit number [forum#2685](https://discourse.jabref.org/t/export-month-as-text-not-number/2685)
- We reintroduced missing default keybindings for new entries. [#7346](https://github.com/JabRef/jabref/issues/7346) [#7439](https://github.com/JabRef/jabref/issues/7439)
- Lists of available fields are now sorted alphabetically. [#7716](https://github.com/JabRef/jabref/issues/7716)
+- We moved the select/collapse buttons in the unlinked files dialog into a context menu. [#7383](https://github.com/JabRef/jabref/issues/7383)
### Fixed
diff --git a/src/main/java/org/jabref/gui/actions/StandardActions.java b/src/main/java/org/jabref/gui/actions/StandardActions.java
index 7687ce82990..59d4be73162 100644
--- a/src/main/java/org/jabref/gui/actions/StandardActions.java
+++ b/src/main/java/org/jabref/gui/actions/StandardActions.java
@@ -118,6 +118,10 @@ public enum StandardActions implements Action {
NEXT_PREVIEW_STYLE(Localization.lang("Next preview style"), KeyBinding.NEXT_PREVIEW_LAYOUT),
PREVIOUS_PREVIEW_STYLE(Localization.lang("Previous preview style"), KeyBinding.PREVIOUS_PREVIEW_LAYOUT),
SELECT_ALL(Localization.lang("Select all"), KeyBinding.SELECT_ALL),
+ UNSELECT_ALL(Localization.lang("Unselect all")),
+
+ EXPAND_ALL(Localization.lang("Expand all")),
+ COLLAPSE_ALL(Localization.lang("Collapse all")),
NEW_ENTRY(Localization.lang("New entry"), IconTheme.JabRefIcons.ADD_ENTRY, KeyBinding.NEW_ENTRY),
NEW_ARTICLE(Localization.lang("New article"), IconTheme.JabRefIcons.ADD_ARTICLE),
diff --git a/src/main/java/org/jabref/gui/externalfiles/UnlinkedFilesDialog.fxml b/src/main/java/org/jabref/gui/externalfiles/UnlinkedFilesDialog.fxml
index bea10fcc9c3..1c7109f3504 100644
--- a/src/main/java/org/jabref/gui/externalfiles/UnlinkedFilesDialog.fxml
+++ b/src/main/java/org/jabref/gui/externalfiles/UnlinkedFilesDialog.fxml
@@ -14,9 +14,9 @@
-
+
@@ -28,16 +28,16 @@
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
-
+
-
+
-
+
-
+
-
-
-
+
+
+
@@ -87,24 +87,18 @@
-
-
-
-
-
-
-
-
-
-
+
+
+
+
diff --git a/src/main/java/org/jabref/gui/externalfiles/UnlinkedFilesDialogView.java b/src/main/java/org/jabref/gui/externalfiles/UnlinkedFilesDialogView.java
index bcbcbf0c07a..6b4696441df 100644
--- a/src/main/java/org/jabref/gui/externalfiles/UnlinkedFilesDialogView.java
+++ b/src/main/java/org/jabref/gui/externalfiles/UnlinkedFilesDialogView.java
@@ -14,6 +14,7 @@
import javafx.scene.control.ButtonType;
import javafx.scene.control.CheckBoxTreeItem;
import javafx.scene.control.ComboBox;
+import javafx.scene.control.ContextMenu;
import javafx.scene.control.Control;
import javafx.scene.control.Label;
import javafx.scene.control.ProgressIndicator;
@@ -27,6 +28,9 @@
import org.jabref.gui.DialogService;
import org.jabref.gui.StateManager;
+import org.jabref.gui.actions.ActionFactory;
+import org.jabref.gui.actions.SimpleCommand;
+import org.jabref.gui.actions.StandardActions;
import org.jabref.gui.externalfiletype.ExternalFileTypes;
import org.jabref.gui.icon.JabRefIcon;
import org.jabref.gui.util.BaseDialog;
@@ -150,6 +154,8 @@ private void initUnlinkedFilesList() {
fileNode -> fileNode.map(fileNodeViewModel -> new RecursiveTreeItem<>(fileNodeViewModel, FileNodeViewModel::getChildren))
.orElse(null)));
+ unlinkedFilesList.setContextMenu(createSearchContextMenu());
+
EasyBind.subscribe(unlinkedFilesList.rootProperty(), root -> {
if (root != null) {
((CheckBoxTreeItem) root).setSelected(true);
@@ -194,16 +200,6 @@ void browseFileDirectory() {
viewModel.browseFileDirectory();
}
- @FXML
- void collapseAll() {
- expandTree(unlinkedFilesList.getRoot(), false);
- }
-
- @FXML
- void expandAll() {
- expandTree(unlinkedFilesList.getRoot(), true);
- }
-
@FXML
void scanFiles() {
viewModel.startSearch();
@@ -214,16 +210,6 @@ void startImport() {
viewModel.startImport();
}
- @FXML
- void selectAll() {
- unlinkedFilesList.getCheckModel().checkAll();
- }
-
- @FXML
- void unselectAll() {
- unlinkedFilesList.getCheckModel().clearChecks();
- }
-
@FXML
void exportSelected() {
viewModel.startExport();
@@ -240,4 +226,37 @@ private void expandTree(TreeItem> item, boolean expand) {
}
}
}
+
+ private ContextMenu createSearchContextMenu() {
+ ContextMenu contextMenu = new ContextMenu();
+ ActionFactory factory = new ActionFactory(preferencesService.getKeyBindingRepository());
+
+ contextMenu.getItems().add(factory.createMenuItem(StandardActions.SELECT_ALL, new SearchContextAction(StandardActions.SELECT_ALL)));
+ contextMenu.getItems().add(factory.createMenuItem(StandardActions.UNSELECT_ALL, new SearchContextAction(StandardActions.UNSELECT_ALL)));
+ contextMenu.getItems().add(factory.createMenuItem(StandardActions.EXPAND_ALL, new SearchContextAction(StandardActions.EXPAND_ALL)));
+ contextMenu.getItems().add(factory.createMenuItem(StandardActions.COLLAPSE_ALL, new SearchContextAction(StandardActions.COLLAPSE_ALL)));
+
+ return contextMenu;
+ }
+
+ private class SearchContextAction extends SimpleCommand {
+
+ private final StandardActions command;
+
+ public SearchContextAction(StandardActions command) {
+ this.command = command;
+
+ this.executable.bind(unlinkedFilesList.rootProperty().isNotNull());
+ }
+
+ @Override
+ public void execute() {
+ switch (command) {
+ case SELECT_ALL -> unlinkedFilesList.getCheckModel().checkAll();
+ case UNSELECT_ALL -> unlinkedFilesList.getCheckModel().clearChecks();
+ case EXPAND_ALL -> expandTree(unlinkedFilesList.getRoot(), true);
+ case COLLAPSE_ALL -> expandTree(unlinkedFilesList.getRoot(), false);
+ }
+ }
+ }
}
diff --git a/src/main/resources/l10n/JabRef_en.properties b/src/main/resources/l10n/JabRef_en.properties
index b7eecd0639d..0d5281b27a2 100644
--- a/src/main/resources/l10n/JabRef_en.properties
+++ b/src/main/resources/l10n/JabRef_en.properties
@@ -1097,9 +1097,8 @@ Expand\ all=Expand all
Collapse\ all=Collapse all
Searches\ the\ selected\ directory\ for\ unlinked\ files.=Searches the selected directory for unlinked files.
Starts\ the\ import\ of\ BibTeX\ entries.=Starts the import of BibTeX entries.
-Start\ directory\:=Start directory:
-File\ type\:=File type:
-Currently\ unlinked\ files=Currently unlinked files
+Directory=Directory
+Search\ results=Search results
Import\ result=Import result
Searching\ file\ system...=Searching file system...
Citation\ key\ patterns=Citation key patterns