diff --git a/CHANGELOG.md b/CHANGELOG.md index d67fc90cba2..98202f7f7b0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve ### Added +- We added a dropdown menu to let users change the library they want to import into during import.[#6177](https://github.com/JabRef/jabref/issues/6177) diff --git a/src/main/java/org/jabref/gui/LibraryTab.java b/src/main/java/org/jabref/gui/LibraryTab.java index c7fee3a26a0..ec6e301dd0f 100644 --- a/src/main/java/org/jabref/gui/LibraryTab.java +++ b/src/main/java/org/jabref/gui/LibraryTab.java @@ -349,7 +349,7 @@ public void updateTabTitle(boolean isChanged) { } // Unique path fragment - Optional uniquePathPart = FileUtil.getUniquePathFragment(collectAllDatabasePaths(), databasePath); + Optional uniquePathPart = FileUtil.getUniquePathDirectory(stateManager.collectAllDatabasePaths(), databasePath); uniquePathPart.ifPresent(part -> tabTitle.append(" \u2013 ").append(part)); } else { if (databaseLocation == DatabaseLocation.LOCAL) { @@ -380,16 +380,6 @@ public void updateTabTitle(boolean isChanged) { } } - private List collectAllDatabasePaths() { - List list = new ArrayList<>(); - stateManager.getOpenDatabases().stream() - .map(BibDatabaseContext::getDatabasePath) - .forEachOrdered(pathOptional -> pathOptional.ifPresentOrElse( - path -> list.add(path.toAbsolutePath().toString()), - () -> list.add(""))); - return list; - } - @Subscribe public void listen(BibDatabaseContextChangedEvent event) { this.changedProperty.setValue(true); diff --git a/src/main/java/org/jabref/gui/StateManager.java b/src/main/java/org/jabref/gui/StateManager.java index 9cab5af0169..d7c3a797d9c 100644 --- a/src/main/java/org/jabref/gui/StateManager.java +++ b/src/main/java/org/jabref/gui/StateManager.java @@ -1,5 +1,6 @@ package org.jabref.gui; +import java.util.ArrayList; import java.util.List; import java.util.Objects; import java.util.Optional; @@ -201,4 +202,14 @@ public LastAutomaticFieldEditorEdit getLastAutomaticFieldEditorEdit() { public void setLastAutomaticFieldEditorEdit(LastAutomaticFieldEditorEdit automaticFieldEditorEdit) { lastAutomaticFieldEditorEditProperty().set(automaticFieldEditorEdit); } + + public List collectAllDatabasePaths() { + List list = new ArrayList<>(); + getOpenDatabases().stream() + .map(BibDatabaseContext::getDatabasePath) + .forEachOrdered(pathOptional -> pathOptional.ifPresentOrElse( + path -> list.add(path.toAbsolutePath().toString()), + () -> list.add(""))); + return list; + } } diff --git a/src/main/java/org/jabref/gui/importer/ImportEntriesDialog.fxml b/src/main/java/org/jabref/gui/importer/ImportEntriesDialog.fxml index d27fdfc7f6c..c60b4a9ac1b 100644 --- a/src/main/java/org/jabref/gui/importer/ImportEntriesDialog.fxml +++ b/src/main/java/org/jabref/gui/importer/ImportEntriesDialog.fxml @@ -3,6 +3,7 @@ + @@ -11,6 +12,7 @@ + @@ -18,9 +20,17 @@