diff --git a/CHANGELOG.md b/CHANGELOG.md index 9242ea95653..992f0055839 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -34,6 +34,11 @@ Note that this project **does not** adhere to [Semantic Versioning](https://semv ### Removed +- We removed duplicate filtering and sorting operations in the MainTable when editing BibEntries. [#10619](https://github.com/JabRef/jabref/pull/10619) + + + + ## [5.11] – 2023-10-22 ### Added diff --git a/src/main/java/org/jabref/gui/LibraryTab.java b/src/main/java/org/jabref/gui/LibraryTab.java index fc4880d2562..137a9548678 100644 --- a/src/main/java/org/jabref/gui/LibraryTab.java +++ b/src/main/java/org/jabref/gui/LibraryTab.java @@ -66,7 +66,6 @@ import org.jabref.model.entry.BibEntryTypesManager; import org.jabref.model.entry.LinkedFile; import org.jabref.model.entry.event.EntriesEventSource; -import org.jabref.model.entry.event.EntryChangedEvent; import org.jabref.model.entry.event.FieldChangedEvent; import org.jabref.model.entry.field.Field; import org.jabref.model.entry.field.FieldFactory; @@ -156,7 +155,6 @@ public LibraryTab(BibDatabaseContext bibDatabaseContext, setupMainPanel(); setupAutoCompletion(); - this.getDatabase().registerListener(new SearchListener()); this.getDatabase().registerListener(new IndexUpdateListener()); this.getDatabase().registerListener(new EntriesRemovedListener()); @@ -277,7 +275,6 @@ public void feedData(BibDatabaseContext bibDatabaseContextFromParserResult) { setupMainPanel(); setupAutoCompletion(); - this.getDatabase().registerListener(new SearchListener()); this.getDatabase().registerListener(new EntriesRemovedListener()); // ensure that at each addition of a new entry, the entry is added to the groups interface @@ -918,28 +915,6 @@ public void listen(EntriesRemovedEvent entriesRemovedEvent) { } } - /** - * Ensures that the results of the current search are updated when a new entry is inserted into the database Actual methods for performing search must run in javafx thread - */ - private class SearchListener { - - @Subscribe - public void listen(EntriesAddedEvent addedEntryEvent) { - DefaultTaskExecutor.runInJavaFXThread(() -> frame.getGlobalSearchBar().performSearch()); - } - - @Subscribe - public void listen(EntryChangedEvent entryChangedEvent) { - DefaultTaskExecutor.runInJavaFXThread(() -> frame.getGlobalSearchBar().performSearch()); - } - - @Subscribe - public void listen(EntriesRemovedEvent removedEntriesEvent) { - // IMO only used to update the status (found X entries) - DefaultTaskExecutor.runInJavaFXThread(() -> frame.getGlobalSearchBar().performSearch()); - } - } - private class IndexUpdateListener { @Subscribe diff --git a/src/main/java/org/jabref/gui/search/GlobalSearchBar.java b/src/main/java/org/jabref/gui/search/GlobalSearchBar.java index 34ac62b9de0..e419c97b827 100644 --- a/src/main/java/org/jabref/gui/search/GlobalSearchBar.java +++ b/src/main/java/org/jabref/gui/search/GlobalSearchBar.java @@ -201,7 +201,7 @@ public GlobalSearchBar(JabRefFrame frame, StateManager stateManager, Preferences this.setSpacing(4.0); this.setAlignment(Pos.CENTER_LEFT); - Timer searchTask = FxTimer.create(Duration.ofMillis(SEARCH_DELAY), this::performSearch); + Timer searchTask = FxTimer.create(Duration.ofMillis(SEARCH_DELAY), this::updateSearchQuery); BindingsHelper.bindBidirectional( stateManager.activeSearchQueryProperty(), searchField.textProperty(), @@ -238,7 +238,7 @@ private void initSearchModifierButtons() { initSearchModifierButton(regularExpressionButton); regularExpressionButton.setOnAction(event -> { searchPreferences.setSearchFlag(SearchRules.SearchFlags.REGULAR_EXPRESSION, regularExpressionButton.isSelected()); - performSearch(); + updateSearchQuery(); }); caseSensitiveButton.setSelected(searchPreferences.isCaseSensitive()); @@ -246,7 +246,7 @@ private void initSearchModifierButtons() { initSearchModifierButton(caseSensitiveButton); caseSensitiveButton.setOnAction(event -> { searchPreferences.setSearchFlag(SearchRules.SearchFlags.CASE_SENSITIVE, caseSensitiveButton.isSelected()); - performSearch(); + updateSearchQuery(); }); fulltextButton.setSelected(searchPreferences.isFulltext()); @@ -254,7 +254,7 @@ private void initSearchModifierButtons() { initSearchModifierButton(fulltextButton); fulltextButton.setOnAction(event -> { searchPreferences.setSearchFlag(SearchRules.SearchFlags.FULLTEXT, fulltextButton.isSelected()); - performSearch(); + updateSearchQuery(); }); keepSearchString.setSelected(searchPreferences.shouldKeepSearchString()); @@ -262,7 +262,7 @@ private void initSearchModifierButtons() { initSearchModifierButton(keepSearchString); keepSearchString.setOnAction(evt -> { searchPreferences.setSearchFlag(SearchRules.SearchFlags.KEEP_SEARCH_STRING, keepSearchString.isSelected()); - performSearch(); + updateSearchQuery(); }); openGlobalSearchButton.disableProperty().bindBidirectional(globalSearchActive); @@ -271,7 +271,7 @@ private void initSearchModifierButtons() { openGlobalSearchButton.setOnAction(evt -> { globalSearchActive.setValue(true); globalSearchResultDialog = new GlobalSearchResultDialog(undoManager); - performSearch(); + updateSearchQuery(); dialogService.showCustomDialogAndWait(globalSearchResultDialog); globalSearchActive.setValue(false); }); @@ -298,9 +298,9 @@ public void focus() { searchField.selectAll(); } - public void performSearch() { + public void updateSearchQuery() { LOGGER.debug("Flags: {}", searchPreferences.getSearchFlags()); - LOGGER.debug("Run search {}", searchField.getText()); + LOGGER.debug("Updated search query: {}", searchField.getText()); // An empty search field should cause the search to be cleared. if (searchField.getText().isEmpty()) {