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

Selected entry in search window selects entry in the main table #11010

Merged
merged 10 commits into from
Mar 21, 2024
9 changes: 0 additions & 9 deletions src/main/java/org/jabref/gui/JabRefFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -631,15 +631,6 @@ public LibraryTab getCurrentLibraryTab() {
return (LibraryTab) tabbedPane.getSelectionModel().getSelectedItem();
}

public void setCurrentTab(BibDatabaseContext databaseContext) {
for (LibraryTab libraryTab : getLibraryTabs()) {
if (libraryTab.getBibDatabaseContext() == databaseContext) {
tabbedPane.getSelectionModel().select(libraryTab);
return;
}
}
}

private ContextMenu createTabContextMenuFor(LibraryTab tab, KeyBindingRepository keyBindingRepository) {
ContextMenu contextMenu = new ContextMenu();
ActionFactory factory = new ActionFactory(keyBindingRepository);
Expand Down
2 changes: 0 additions & 2 deletions src/main/java/org/jabref/gui/LibraryTabContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ public interface LibraryTabContainer {

void addTab(BibDatabaseContext bibDatabaseContext, boolean raisePanel);

void setCurrentTab(BibDatabaseContext bibDatabaseContext);

/**
* Closes a designated libraryTab
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,10 @@ private void initialize() {
resultsTable.getSelectionModel().selectedItemProperty().addListener((obs, old, newValue) -> {
if (newValue != null) {
previewViewer.setEntry(newValue.getEntry());
libraryTabContainer.setCurrentTab(newValue.getBibDatabaseContext());
libraryTabContainer.getLibraryTabs().stream()
.filter(tab -> tab.getBibDatabaseContext() == newValue.getBibDatabaseContext())
LoayGhreeb marked this conversation as resolved.
Show resolved Hide resolved
.findFirst()
.ifPresent(libraryTabContainer::showLibraryTab);
stateManager.activeTabProperty().get().ifPresent(tab -> tab.clearAndSelect(newValue.getEntry()));
} else {
previewViewer.setEntry(old.getEntry());
Expand Down
Loading