From c1cb2d71c69fdeb00d778e08f9ad8b44f8b7350c Mon Sep 17 00:00:00 2001 From: Songxuan Li Date: Fri, 10 Nov 2023 08:52:57 +1100 Subject: [PATCH] replace "SearchAll" in web search by "Search Selected" (#10611) * replace "SearchAll" in web search by "Search Selected" see:https://github.com/JabRef/jabref/issues/10556 Implemented "Search Selected". Enabled configuring the catalogs to be searched. Updated menu and other corresponding UI Updated corresponding tests * Fix Markdown and Checkstyle * Fix Checkstyle * Fix code style * Fix code styles * refactoring * Update WebSearchPaneViewModel.java Remove whitespace --------- Co-authored-by: Siedlerchr Co-authored-by: Carl Christian Snethlage <50491877+calixtus@users.noreply.github.com> --- CHANGELOG.md | 1 + .../fetcher/WebSearchPaneViewModel.java | 6 +-- .../protectedterms/ProtectedTermsTab.java | 5 ++- .../preferences/websearch/WebSearchTab.fxml | 21 ++++++++++ .../preferences/websearch/WebSearchTab.java | 30 +++++++++++++++ .../websearch/WebSearchTabViewModel.java | 38 +++++++++++++++++-- .../logic/importer/ImporterPreferences.java | 17 ++++++++- .../jabref/logic/importer/WebFetchers.java | 19 +++++++++- .../fetcher/CompositeSearchBasedFetcher.java | 19 ++++++---- .../jabref/preferences/JabRefPreferences.java | 17 +++++++-- src/main/resources/l10n/JabRef_en.properties | 2 + .../ManageStudyDefinitionViewModelTest.java | 2 +- .../StudyCatalogToFetcherConverterTest.java | 2 +- .../logic/importer/WebFetchersTest.java | 2 +- .../CompositeSearchBasedFetcherTest.java | 10 +++-- 15 files changed, 160 insertions(+), 31 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index de1eec76af0..af1a81a5da6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ Note that this project **does not** adhere to [Semantic Versioning](https://semv - We moved the location of the 'Open only one instance of JabRef' preference option from "Network" to "General". [#9306](https://github.com/JabRef/jabref/issues/9306) - The two previews in the change resolver dialog now have their scrollbars synchronized. [#9576](https://github.com/JabRef/jabref/issues/9576). - We changed the setting of the keyword separator to accept a single character only. [#177](https://github.com/koppor/jabref/issues/177) +- We replaced "SearchAll" in Web Search by "Search Selected". [#10556](https://github.com/JabRef/jabref/issues/10556) - Short DOI formatter now checks, if the value is already formatted. If so, it returns the value instead of calling the ShortDOIService again. [#10589](https://github.com/JabRef/jabref/issues/10589) - We upgraded to JavaFX 21.0.1. As a consequence JabRef requires now macOS 11 or later and GTK 3.8 or later on Linux [10627](https://github.com/JabRef/jabref/pull/10627). diff --git a/src/main/java/org/jabref/gui/importer/fetcher/WebSearchPaneViewModel.java b/src/main/java/org/jabref/gui/importer/fetcher/WebSearchPaneViewModel.java index 5634e4e7450..985bede5b5a 100644 --- a/src/main/java/org/jabref/gui/importer/fetcher/WebSearchPaneViewModel.java +++ b/src/main/java/org/jabref/gui/importer/fetcher/WebSearchPaneViewModel.java @@ -1,7 +1,6 @@ package org.jabref.gui.importer.fetcher; import java.util.Map; -import java.util.SortedSet; import java.util.concurrent.Callable; import javafx.beans.property.ListProperty; @@ -57,10 +56,9 @@ public WebSearchPaneViewModel(PreferencesService preferencesService, DialogServi this.stateManager = stateManager; this.preferencesService = preferencesService; - SortedSet allFetchers = WebFetchers.getSearchBasedFetchers( + fetchers.setAll(WebFetchers.getSearchBasedFetchers( preferencesService.getImportFormatPreferences(), - preferencesService.getImporterPreferences()); - fetchers.setAll(allFetchers); + preferencesService.getImporterPreferences())); // Choose last-selected fetcher as default SidePanePreferences sidePanePreferences = preferencesService.getSidePanePreferences(); diff --git a/src/main/java/org/jabref/gui/preferences/protectedterms/ProtectedTermsTab.java b/src/main/java/org/jabref/gui/preferences/protectedterms/ProtectedTermsTab.java index c5d1aa5b2c5..3695201ca61 100644 --- a/src/main/java/org/jabref/gui/preferences/protectedterms/ProtectedTermsTab.java +++ b/src/main/java/org/jabref/gui/preferences/protectedterms/ProtectedTermsTab.java @@ -7,11 +7,11 @@ import javafx.scene.control.TableView; import javafx.scene.control.cell.CheckBoxTableCell; -import org.jabref.gui.Globals; import org.jabref.gui.actions.ActionFactory; import org.jabref.gui.actions.SimpleCommand; import org.jabref.gui.actions.StandardActions; import org.jabref.gui.icon.IconTheme; +import org.jabref.gui.keyboard.KeyBindingRepository; import org.jabref.gui.preferences.AbstractPreferenceTabView; import org.jabref.gui.preferences.PreferencesTab; import org.jabref.gui.util.BindingsHelper; @@ -36,6 +36,7 @@ public class ProtectedTermsTab extends AbstractPreferenceTabView filesTableDeleteColumn; @Inject private ProtectedTermsLoader termsLoader; + @Inject private KeyBindingRepository keyBindingRepository; public ProtectedTermsTab() { ViewLoader.view(this) @@ -87,7 +88,7 @@ public void initialize() { } private ContextMenu createContextMenu(ProtectedTermsListItemModel file) { - ActionFactory factory = new ActionFactory(Globals.getKeyPrefs()); + ActionFactory factory = new ActionFactory(keyBindingRepository); ContextMenu contextMenu = new ContextMenu(); contextMenu.getItems().addAll( factory.createMenuItem(StandardActions.EDIT_LIST, new ProtectedTermsTab.ContextAction(StandardActions.EDIT_LIST, file)), diff --git a/src/main/java/org/jabref/gui/preferences/websearch/WebSearchTab.fxml b/src/main/java/org/jabref/gui/preferences/websearch/WebSearchTab.fxml index 6bd19f653ca..06ee5a0e0dd 100644 --- a/src/main/java/org/jabref/gui/preferences/websearch/WebSearchTab.fxml +++ b/src/main/java/org/jabref/gui/preferences/websearch/WebSearchTab.fxml @@ -5,6 +5,8 @@ + + @@ -25,6 +27,25 @@ +