Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Search floating mode #11510

Merged
merged 65 commits into from
Aug 4, 2024
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
33fde54
Search/Groups floating mode
LoayGhreeb Jul 16, 2024
8d54d0d
Hide search rank column
LoayGhreeb Jul 16, 2024
b441fe5
Update query listener from global to library-specific
LoayGhreeb Jul 17, 2024
0485cd5
Update selected groups listener from global to library-specific
LoayGhreeb Jul 17, 2024
94c8de1
Move table-row CSS classes to Base.css
LoayGhreeb Jul 17, 2024
e3c1c0b
Adapt tests
LoayGhreeb Jul 17, 2024
212df75
Update JabRef_en.properties
LoayGhreeb Jul 17, 2024
37fc247
CHANGELOG
LoayGhreeb Jul 17, 2024
21c834a
Fix jumpToSearchKey
LoayGhreeb Jul 17, 2024
3e2b65f
Add shortcut to scroll to the next/prev rank
LoayGhreeb Jul 17, 2024
26af9f0
Localization
LoayGhreeb Jul 17, 2024
da05a82
Fix scroll shortcut to handle rank gaps
LoayGhreeb Jul 19, 2024
9867c97
OpenRewrite
LoayGhreeb Jul 19, 2024
598b624
Add temporary MappedBackedList implementation
LoayGhreeb Jul 22, 2024
4abcfc7
Use constants for rank values
LoayGhreeb Jul 22, 2024
564de70
Update rank colors
LoayGhreeb Jul 22, 2024
f1b5f55
Merge branch 'main' into floating-mode
LoayGhreeb Jul 22, 2024
93dcd92
Add CustomFilteredList
LoayGhreeb Jul 24, 2024
b66b4a9
Improve group switching and search performance
LoayGhreeb Jul 24, 2024
1582fb0
OpenRewrite
LoayGhreeb Jul 24, 2024
a4cba3e
Fix NPE
LoayGhreeb Jul 24, 2024
1ff7afb
Fix NPE
LoayGhreeb Jul 24, 2024
0c2a23b
Create a list of observables
LoayGhreeb Jul 24, 2024
bde0b64
refilter the list after updateVisibility
LoayGhreeb Jul 24, 2024
3a7611b
Add onUpdateCallback to the CustomFilteredList
LoayGhreeb Jul 24, 2024
800fc02
Merge branch 'main' into floating-mode
LoayGhreeb Jul 24, 2024
2efc74d
iterate over updated range
LoayGhreeb Jul 26, 2024
8fd600d
Merge branch 'main' into floating-mode
LoayGhreeb Jul 26, 2024
32f16ed
Merge branch 'main' into floating-mode
LoayGhreeb Jul 26, 2024
ab7e19f
Rename onUpdateCallback to onUpdate
LoayGhreeb Jul 26, 2024
9c5ba79
Merge branch 'main' into floating-mode
LoayGhreeb Jul 28, 2024
be04ce9
Register events to the row
LoayGhreeb Jul 29, 2024
cfe930a
Update matches in the background
LoayGhreeb Jul 29, 2024
7e5b106
Merge branch 'main' into floating-mode
LoayGhreeb Jul 29, 2024
b87be0b
Merge branch 'main' into floating-mode
LoayGhreeb Jul 29, 2024
b846805
Delete MappedBackedList.java
LoayGhreeb Jul 29, 2024
2330ed6
Update matches in the background for global search
LoayGhreeb Jul 29, 2024
c1d7e27
Pass properties to MainTableDataModel instead of LibraryTab
LoayGhreeb Jul 31, 2024
4608d0c
Remove search rank column from the preferences
LoayGhreeb Aug 1, 2024
e0f8b08
Merge branch 'main' into floating-mode
LoayGhreeb Aug 1, 2024
f15acdb
Add SearchRank enum
LoayGhreeb Aug 2, 2024
296622b
EnumSet constructor
LoayGhreeb Aug 2, 2024
108a39e
Remove int value from SearchRank enum
LoayGhreeb Aug 2, 2024
28614df
Merge branch 'main' into floating-mode
LoayGhreeb Aug 2, 2024
5c45007
Move SearchRank enum to search package
LoayGhreeb Aug 4, 2024
c62809f
Remove FILTERING_SEARCH from search flags
LoayGhreeb Aug 4, 2024
9f6c846
Merge branch 'main' into floating-mode
LoayGhreeb Aug 4, 2024
69e035b
Remove KEEP_SEARCH_STRING from search flags
LoayGhreeb Aug 4, 2024
1313928
Fix SearchPreferences constructor
calixtus Aug 4, 2024
738d03c
Move comment up
calixtus Aug 4, 2024
ce71705
Rename SearchRank to MatchCategory
LoayGhreeb Aug 4, 2024
5eff567
Update src/main/java/org/jabref/gui/util/CustomFilteredList.java
LoayGhreeb Aug 4, 2024
46c2484
Update src/main/java/org/jabref/gui/util/CustomFilteredList.java
LoayGhreeb Aug 4, 2024
656e8fd
Update CustomFilteredList.java
LoayGhreeb Aug 4, 2024
e2c3a7a
Update PreferencesMigrations.java
LoayGhreeb Aug 4, 2024
e3c492e
Replace CustomFilteredList.java with reflection
calixtus Aug 4, 2024
be88666
Merge remote-tracking branch 'upstream/floating-mode' into floating-mode
calixtus Aug 4, 2024
e340a15
Merge branch 'main' into floating-mode
calixtus Aug 4, 2024
fab86b7
Minor stylistic fixes
koppor Aug 4, 2024
240d0fc
Fix reflection
calixtus Aug 4, 2024
d1b5450
Merge remote-tracking branch 'upstream/floating-mode' into floating-mode
calixtus Aug 4, 2024
c6cbeb5
Correct typo
LoayGhreeb Aug 4, 2024
50ae791
Fix typo
koppor Aug 4, 2024
b289c91
Fix unit tests
LoayGhreeb Aug 4, 2024
3ca41b4
CHANGELOG
LoayGhreeb Aug 4, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ Note that this project **does not** adhere to [Semantic Versioning](https://semv
- We added support for selecting and using CSL Styles in JabRef's OpenOffice/LibreOffice integration for inserting bibliographic and in-text citations into a document. [#2146](https://github.com/JabRef/jabref/issues/2146), [#8893](https://github.com/JabRef/jabref/issues/8893)
- Added minimal support for [biblatex data annotation](https://mirrors.ctan.org/macros/latex/contrib/biblatex/doc/biblatex.pdf#subsection.3.7) fields in .layout files. [#11505](https://github.com/JabRef/jabref/issues/11505)
- Added saving of selected options in the [Lookup -> Search for unlinked local files dialog](https://docs.jabref.org/collect/findunlinkedfiles#link-the-pdfs-to-your-bib-library). [#11439](https://github.com/JabRef/jabref/issues/11439)
- We added a toggle button to invert the selected groups. [#9073](https://github.com/JabRef/jabref/issues/9073)
- We reintroduced the floating search in the main table. [#4237](https://github.com/JabRef/jabref/issues/4237)

### Changed

Expand Down
15 changes: 15 additions & 0 deletions src/main/java/org/jabref/gui/Base.css
Original file line number Diff line number Diff line change
Expand Up @@ -648,6 +648,21 @@ TextFlow > .tooltip-text-monospaced {
-fx-padding: 0 .5 0 .5;
}

.table-row-cell:matching-search-and-groups {
}

.table-row-cell:matching-search-not-groups {
-fx-background-color: lightgray;
}

.table-row-cell:matching-groups-not-search {
-fx-background-color: darkgray;
}

.table-row-cell:not-matching-search-and-groups {
-fx-opacity: 50%;
}

.table-row-cell:hover,
.tree-table-row-cell:hover {
-fx-background-color: -jr-hover;
Expand Down
57 changes: 34 additions & 23 deletions src/main/java/org/jabref/gui/LibraryTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@
import javafx.animation.PauseTransition;
import javafx.application.Platform;
import javafx.beans.property.BooleanProperty;
import javafx.beans.property.IntegerProperty;
import javafx.beans.property.ListProperty;
import javafx.beans.property.SimpleBooleanProperty;
import javafx.beans.property.SimpleIntegerProperty;
import javafx.beans.property.SimpleListProperty;
import javafx.beans.value.ObservableBooleanValue;
import javafx.collections.ListChangeListener;
import javafx.event.Event;
Expand Down Expand Up @@ -58,6 +62,7 @@
import org.jabref.gui.undo.UndoableInsertEntries;
import org.jabref.gui.undo.UndoableRemoveEntries;
import org.jabref.gui.util.BackgroundTask;
import org.jabref.gui.util.OptionalObjectProperty;
import org.jabref.gui.util.TaskExecutor;
import org.jabref.gui.util.UiTaskExecutor;
import org.jabref.logic.citationstyle.CitationStyleCache;
Expand Down Expand Up @@ -88,6 +93,7 @@
import org.jabref.model.entry.field.Field;
import org.jabref.model.entry.field.FieldFactory;
import org.jabref.model.entry.field.StandardField;
import org.jabref.model.groups.GroupTreeNode;
import org.jabref.model.util.DirectoryMonitor;
import org.jabref.model.util.DirectoryMonitorManager;
import org.jabref.model.util.FileUpdateMonitor;
Expand Down Expand Up @@ -149,8 +155,9 @@ private enum PanelMode { MAIN_TABLE, MAIN_TABLE_AND_ENTRY_EDITOR }
@SuppressWarnings({"FieldCanBeLocal"})
private Subscription dividerPositionSubscription;

// the query the user searches when this BasePanel is active
private Optional<SearchQuery> currentSearchQuery = Optional.empty();
private ListProperty<GroupTreeNode> selectedGroupsProperty;
private final OptionalObjectProperty<SearchQuery> searchQueryProperty = OptionalObjectProperty.empty();
private final IntegerProperty resultSize = new SimpleIntegerProperty(0);

private Optional<DatabaseChangeMonitor> changeMonitor = Optional.empty();

Expand All @@ -162,15 +169,15 @@ private enum PanelMode { MAIN_TABLE, MAIN_TABLE_AND_ENTRY_EDITOR }
private final DirectoryMonitorManager directoryMonitorManager;

private LibraryTab(BibDatabaseContext bibDatabaseContext,
LibraryTabContainer tabContainer,
DialogService dialogService,
PreferencesService preferencesService,
StateManager stateManager,
FileUpdateMonitor fileUpdateMonitor,
BibEntryTypesManager entryTypesManager,
CountingUndoManager undoManager,
ClipBoardManager clipBoardManager,
TaskExecutor taskExecutor) {
LibraryTabContainer tabContainer,
DialogService dialogService,
PreferencesService preferencesService,
StateManager stateManager,
FileUpdateMonitor fileUpdateMonitor,
BibEntryTypesManager entryTypesManager,
CountingUndoManager undoManager,
ClipBoardManager clipBoardManager,
TaskExecutor taskExecutor) {
this.tabContainer = Objects.requireNonNull(tabContainer);
this.bibDatabaseContext = Objects.requireNonNull(bibDatabaseContext);
this.undoManager = undoManager;
Expand All @@ -187,7 +194,8 @@ private LibraryTab(BibDatabaseContext bibDatabaseContext,
bibDatabaseContext.getDatabase().registerListener(this);
bibDatabaseContext.getMetaData().registerListener(this);

this.tableModel = new MainTableDataModel(getBibDatabaseContext(), preferencesService, stateManager);
this.selectedGroupsProperty = new SimpleListProperty<>(stateManager.getSelectedGroups(bibDatabaseContext));
this.tableModel = new MainTableDataModel(getBibDatabaseContext(), preferencesService, stateManager, this);

citationStyleCache = new CitationStyleCache(bibDatabaseContext);
annotationCache = new FileAnnotationCache(bibDatabaseContext, preferencesService.getFilePreferences());
Expand Down Expand Up @@ -318,7 +326,10 @@ private void setDatabaseContext(BibDatabaseContext bibDatabaseContext) {
bibDatabaseContext.getDatabase().registerListener(this);
bibDatabaseContext.getMetaData().registerListener(this);

this.tableModel = new MainTableDataModel(getBibDatabaseContext(), preferencesService, stateManager);
this.tableModel.unregisterListeners();
this.selectedGroupsProperty = new SimpleListProperty<>(stateManager.getSelectedGroups(bibDatabaseContext));
this.tableModel = new MainTableDataModel(getBibDatabaseContext(), preferencesService, stateManager, this);

citationStyleCache = new CitationStyleCache(bibDatabaseContext);
annotationCache = new FileAnnotationCache(bibDatabaseContext, preferencesService.getFilePreferences());

Expand Down Expand Up @@ -396,7 +407,7 @@ public void updateTabTitle(boolean isChanged) {
toolTipText.append(databasePath.toAbsolutePath());

if (databaseLocation == DatabaseLocation.SHARED) {
tabTitle.append(" \u2013 ");
tabTitle.append(" ");
LoayGhreeb marked this conversation as resolved.
Show resolved Hide resolved
addSharedDbInformation(tabTitle, bibDatabaseContext);
toolTipText.append(' ');
addSharedDbInformation(toolTipText, bibDatabaseContext);
Expand Down Expand Up @@ -880,6 +891,9 @@ private void onClosed(Event event) {
LOGGER.error("Problem when shutting down backup manager", e);
}

if (tableModel != null) {
tableModel.unregisterListeners();
}
// clean up the groups map
stateManager.clearSelectedGroups(bibDatabaseContext);
}
Expand Down Expand Up @@ -921,19 +935,16 @@ public MainTable getMainTable() {
return mainTable;
}

public Optional<SearchQuery> getCurrentSearchQuery() {
return currentSearchQuery;
public ListProperty<GroupTreeNode> selectedGroupsPropertyProperty() {
return selectedGroupsProperty;
}

/**
* Set the query the user currently searches while this basepanel is active
*/
public void setCurrentSearchQuery(Optional<SearchQuery> currentSearchQuery) {
this.currentSearchQuery = currentSearchQuery;
public OptionalObjectProperty<SearchQuery> searchQueryProperty() {
return searchQueryProperty;
}

public CitationStyleCache getCitationStyleCache() {
return citationStyleCache;
public IntegerProperty resultSizeProperty() {
return resultSize;
}

public FileAnnotationCache getAnnotationCache() {
Expand Down
72 changes: 11 additions & 61 deletions src/main/java/org/jabref/gui/StateManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,8 @@
import java.util.Optional;

import javafx.beans.Observable;
import javafx.beans.binding.Bindings;
import javafx.beans.property.IntegerProperty;
import javafx.beans.property.ObjectProperty;
import javafx.beans.property.ReadOnlyListProperty;
import javafx.beans.property.ReadOnlyListWrapper;
import javafx.beans.property.SimpleIntegerProperty;
import javafx.beans.property.SimpleObjectProperty;
import javafx.collections.FXCollections;
Expand All @@ -21,6 +18,7 @@
import javafx.util.Pair;

import org.jabref.gui.edit.automaticfiededitor.LastAutomaticFieldEditorEdit;
import org.jabref.gui.search.SearchType;
import org.jabref.gui.sidepane.SidePaneType;
import org.jabref.gui.util.BackgroundTask;
import org.jabref.gui.util.CustomLocalDragboard;
Expand Down Expand Up @@ -55,29 +53,22 @@ public class StateManager {
private final ObservableList<BibDatabaseContext> openDatabases = FXCollections.observableArrayList();
private final OptionalObjectProperty<BibDatabaseContext> activeDatabase = OptionalObjectProperty.empty();
private final OptionalObjectProperty<LibraryTab> activeTab = OptionalObjectProperty.empty();
private final ReadOnlyListWrapper<GroupTreeNode> activeGroups = new ReadOnlyListWrapper<>(FXCollections.observableArrayList());
private final ObservableList<BibEntry> selectedEntries = FXCollections.observableArrayList();
private final ObservableMap<String, ObservableList<GroupTreeNode>> selectedGroups = FXCollections.observableHashMap();
private final OptionalObjectProperty<SearchQuery> activeSearchQuery = OptionalObjectProperty.empty();
private final OptionalObjectProperty<SearchQuery> activeGlobalSearchQuery = OptionalObjectProperty.empty();
private final IntegerProperty searchResultSize = new SimpleIntegerProperty(0);
private final IntegerProperty globalSearchResultSize = new SimpleIntegerProperty(0);
private final ObservableMap<String, IntegerProperty> searchResultMap = FXCollections.observableHashMap();
private final OptionalObjectProperty<Node> focusOwner = OptionalObjectProperty.empty();
private final ObservableList<Pair<BackgroundTask<?>, Task<?>>> backgroundTasks = FXCollections.observableArrayList(task -> new Observable[] {task.getValue().progressProperty(), task.getValue().runningProperty()});
private final EasyBinding<Boolean> anyTaskRunning = EasyBind.reduce(backgroundTasks, tasks -> tasks.map(Pair::getValue).anyMatch(Task::isRunning));
private final EasyBinding<Boolean> anyTasksThatWillNotBeRecoveredRunning = EasyBind.reduce(backgroundTasks, tasks -> tasks.anyMatch(task -> !task.getKey().willBeRecoveredAutomatically() && task.getValue().isRunning()));
private final EasyBinding<Double> tasksProgress = EasyBind.reduce(backgroundTasks, tasks -> tasks.map(Pair::getValue).filter(Task::isRunning).mapToDouble(Task::getProgress).average().orElse(1));
private final ObservableMap<String, DialogWindowState> dialogWindowStates = FXCollections.observableHashMap();
private final ObservableList<SidePaneType> visibleSidePanes = FXCollections.observableArrayList();

private final ObjectProperty<LastAutomaticFieldEditorEdit> lastAutomaticFieldEditorEdit = new SimpleObjectProperty<>();

private final ObservableList<String> searchHistory = FXCollections.observableArrayList();

public StateManager() {
activeGroups.bind(Bindings.valueAt(selectedGroups, activeDatabase.orElseOpt(null).map(BibDatabaseContext::getUid)));
}

public ObservableList<SidePaneType> getVisibleSidePaneComponents() {
return visibleSidePanes;
}
Expand All @@ -98,36 +89,12 @@ public OptionalObjectProperty<LibraryTab> activeTabProperty() {
return activeTab;
}

public OptionalObjectProperty<SearchQuery> activeSearchQueryProperty() {
return activeSearchQuery;
}

public void setActiveSearchResultSize(BibDatabaseContext database, IntegerProperty resultSize) {
searchResultMap.put(database.getUid(), resultSize);
}

public IntegerProperty getSearchResultSize() {
return searchResultMap.getOrDefault(activeDatabase.getValue().orElse(new BibDatabaseContext()).getUid(), new SimpleIntegerProperty(0));
}

public OptionalObjectProperty<SearchQuery> activeGlobalSearchQueryProperty() {
return activeGlobalSearchQuery;
}

public IntegerProperty getGlobalSearchResultSize() {
return globalSearchResultSize;
public OptionalObjectProperty<SearchQuery> activeSearchQuery(SearchType type) {
return type == SearchType.NORMAL_SEARCH ? activeSearchQuery : activeGlobalSearchQuery;
}

public IntegerProperty getSearchResultSize(OptionalObjectProperty<SearchQuery> searchQueryProperty) {
if (searchQueryProperty.equals(activeSearchQuery)) {
return getSearchResultSize();
} else {
return getGlobalSearchResultSize();
}
}

public ReadOnlyListProperty<GroupTreeNode> activeGroupProperty() {
return activeGroups.getReadOnlyProperty();
public IntegerProperty searchResultSize(SearchType type) {
return type == SearchType.NORMAL_SEARCH ? searchResultSize : globalSearchResultSize;
}

public ObservableList<BibEntry> getSelectedEntries() {
Expand All @@ -138,18 +105,17 @@ public void setSelectedEntries(List<BibEntry> newSelectedEntries) {
selectedEntries.setAll(newSelectedEntries);
}

public void setSelectedGroups(BibDatabaseContext database, List<GroupTreeNode> newSelectedGroups) {
public void setSelectedGroups(BibDatabaseContext context, List<GroupTreeNode> newSelectedGroups) {
Objects.requireNonNull(newSelectedGroups);
selectedGroups.put(database.getUid(), FXCollections.observableArrayList(newSelectedGroups));
selectedGroups.computeIfAbsent(context.getUid(), k -> FXCollections.observableArrayList()).setAll(newSelectedGroups);
}

public ObservableList<GroupTreeNode> getSelectedGroups(BibDatabaseContext context) {
ObservableList<GroupTreeNode> selectedGroupsForDatabase = selectedGroups.get(context.getUid());
return selectedGroupsForDatabase != null ? selectedGroupsForDatabase : FXCollections.observableArrayList();
return selectedGroups.computeIfAbsent(context.getUid(), k -> FXCollections.observableArrayList());
}

public void clearSelectedGroups(BibDatabaseContext database) {
selectedGroups.remove(database.getUid());
public void clearSelectedGroups(BibDatabaseContext context) {
selectedGroups.computeIfAbsent(context.getUid(), k -> FXCollections.observableArrayList()).clear();
}

public Optional<BibDatabaseContext> getActiveDatabase() {
Expand All @@ -165,18 +131,6 @@ public void setActiveDatabase(BibDatabaseContext database) {
}
}

public void clearSearchQuery() {
activeSearchQuery.setValue(Optional.empty());
}

public void setSearchQuery(OptionalObjectProperty<SearchQuery> searchQueryProperty, SearchQuery query) {
searchQueryProperty.setValue(Optional.of(query));
}

public void clearSearchQuery(OptionalObjectProperty<SearchQuery> searchQueryProperty) {
searchQueryProperty.setValue(Optional.empty());
}

public OptionalObjectProperty<Node> focusOwnerProperty() {
return focusOwner;
}
Expand Down Expand Up @@ -217,10 +171,6 @@ public ObjectProperty<LastAutomaticFieldEditorEdit> lastAutomaticFieldEditorEdit
return lastAutomaticFieldEditorEdit;
}

public LastAutomaticFieldEditorEdit getLastAutomaticFieldEditorEdit() {
return lastAutomaticFieldEditorEditProperty().get();
}

public void setLastAutomaticFieldEditorEdit(LastAutomaticFieldEditorEdit automaticFieldEditorEdit) {
lastAutomaticFieldEditorEditProperty().set(automaticFieldEditorEdit);
}
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/org/jabref/gui/entryeditor/EntryEditor.java
Original file line number Diff line number Diff line change
Expand Up @@ -297,12 +297,12 @@ private List<EntryEditorTab> createTabs() {
preferencesService.getImportFormatPreferences(),
fileMonitor,
dialogService,
stateManager,
bibEntryTypesManager,
keyBindingRepository);
keyBindingRepository,
libraryTab.searchQueryProperty());
tabs.add(sourceTab);
tabs.add(new LatexCitationsTab(databaseContext, preferencesService, dialogService, directoryMonitorManager));
tabs.add(new FulltextSearchResultsTab(stateManager, preferencesService, dialogService, taskExecutor));
tabs.add(new FulltextSearchResultsTab(stateManager, preferencesService, dialogService, taskExecutor, libraryTab.searchQueryProperty()));

return tabs;
}
Expand Down
13 changes: 4 additions & 9 deletions src/main/java/org/jabref/gui/entryeditor/SourceTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import javafx.scene.input.KeyEvent;

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;
Expand All @@ -32,6 +31,7 @@
import org.jabref.gui.undo.NamedCompound;
import org.jabref.gui.undo.UndoableChangeType;
import org.jabref.gui.undo.UndoableFieldChange;
import org.jabref.gui.util.OptionalObjectProperty;
import org.jabref.gui.util.UiTaskExecutor;
import org.jabref.logic.bibtex.BibEntryWriter;
import org.jabref.logic.bibtex.FieldPreferences;
Expand Down Expand Up @@ -104,9 +104,9 @@ public SourceTab(BibDatabaseContext bibDatabaseContext,
ImportFormatPreferences importFormatPreferences,
FileUpdateMonitor fileMonitor,
DialogService dialogService,
StateManager stateManager,
BibEntryTypesManager entryTypesManager,
KeyBindingRepository keyBindingRepository) {
KeyBindingRepository keyBindingRepository,
OptionalObjectProperty<SearchQuery> searchQueryProperty) {
this.mode = bibDatabaseContext.getMode();
this.setText(Localization.lang("%0 source", mode.getFormattedName()));
this.setTooltip(new Tooltip(Localization.lang("Show/edit %0 source", mode.getFormattedName())));
Expand All @@ -119,12 +119,7 @@ public SourceTab(BibDatabaseContext bibDatabaseContext,
this.entryTypesManager = entryTypesManager;
this.keyBindingRepository = keyBindingRepository;

stateManager.activeSearchQueryProperty().addListener((observable, oldValue, newValue) -> {
searchHighlightPattern = newValue.flatMap(SearchQuery::getPatternForWords);
highlightSearchPattern();
});

stateManager.activeGlobalSearchQueryProperty().addListener((observable, oldValue, newValue) -> {
searchQueryProperty.addListener((observable, oldValue, newValue) -> {
searchHighlightPattern = newValue.flatMap(SearchQuery::getPatternForWords);
highlightSearchPattern();
});
Expand Down
Loading