Skip to content

Commit

Permalink
Remove double stateManager.activeDatabaseProperty() (#9127)
Browse files Browse the repository at this point in the history
  • Loading branch information
koppor authored Sep 3, 2022
1 parent 852f5c7 commit 858e942
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/main/java/org/jabref/gui/JabRefFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -641,12 +641,7 @@ public void init() {
openDatabaseList = EasyBind.map(filteredTabs, tab -> ((LibraryTab) tab).getBibDatabaseContext());
EasyBind.bindContent(stateManager.getOpenDatabases(), openDatabaseList);

stateManager.activeDatabaseProperty().bind(
EasyBind.map(tabbedPane.getSelectionModel().selectedItemProperty(),
selectedTab -> Optional.ofNullable(selectedTab)
.filter(tab -> tab instanceof LibraryTab)
.map(tab -> (LibraryTab) tab)
.map(LibraryTab::getBibDatabaseContext)));
// the binding for stateManager.activeDatabaseProperty() is at org.jabref.gui.LibraryTab.onDatabaseLoadingSucceed

// Subscribe to the search
EasyBind.subscribe(stateManager.activeSearchQueryProperty(),
Expand All @@ -665,10 +660,11 @@ public void init() {
// Wait for the scene to be created, otherwise focusOwnerProperty is not provided
Platform.runLater(() -> stateManager.focusOwnerProperty().bind(
EasyBind.map(mainStage.getScene().focusOwnerProperty(), Optional::ofNullable)));

/*
* The following state listener makes sure focus is registered with the
* correct database when the user switches tabs. Without this,
* cut/paste/copy operations would some times occur in the wrong tab.
* cut/paste/copy operations would sometimes occur in the wrong tab.
*/
EasyBind.subscribe(tabbedPane.getSelectionModel().selectedItemProperty(), tab -> {
if (!(tab instanceof LibraryTab libraryTab)) {
Expand Down

0 comments on commit 858e942

Please sign in to comment.