diff --git a/CHANGELOG.md b/CHANGELOG.md index 296ae63da2a..70d6ba53e58 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve - An SLR can now be started from the SLR itself. [#9131](https://github.com/JabRef/jabref/pull/9131), [koppor#601](https://github.com/koppor/jabref/issues/601) - Implement a new ISBN Fetcher ([doi-to-bibtex-converter.herokuapp.com](http://doi-to-bibtex-converter.herokuapp.com) as source). [#9145](https://github.com/JabRef/jabref/pull/9145) - We added support for the Ukrainian and Arabic languages. [#9236](https://github.com/JabRef/jabref/pull/9236), [#9243](https://github.com/JabRef/jabref/pull/9243) +- The default file directory of a library is used as default directory for [unlinked file lookup](https://docs.jabref.org/collect/findunlinkedfiles#link-the-pdfs-to-your-bib-library). [koppor#546](https://github.com/koppor/jabref/issues/546) ### Changed diff --git a/src/main/java/org/jabref/gui/externalfiles/UnlinkedFilesDialogView.java b/src/main/java/org/jabref/gui/externalfiles/UnlinkedFilesDialogView.java index 7202751ef5e..13ddbe4bd34 100644 --- a/src/main/java/org/jabref/gui/externalfiles/UnlinkedFilesDialogView.java +++ b/src/main/java/org/jabref/gui/externalfiles/UnlinkedFilesDialogView.java @@ -1,5 +1,7 @@ package org.jabref.gui.externalfiles; +import java.nio.file.Path; + import javax.swing.undo.UndoManager; import javafx.application.Platform; @@ -42,6 +44,7 @@ import org.jabref.gui.util.ViewModelTreeCellFactory; import org.jabref.logic.importer.ImportFormatReader; import org.jabref.logic.l10n.Localization; +import org.jabref.model.database.BibDatabaseContext; import org.jabref.model.util.FileUpdateMonitor; import org.jabref.preferences.PreferencesService; @@ -86,6 +89,8 @@ public class UnlinkedFilesDialogView extends BaseDialog { private final ControlsFxVisualizer validationVisualizer; private UnlinkedFilesDialogViewModel viewModel; + private BibDatabaseContext bibDatabaseContext; + public UnlinkedFilesDialogView() { this.validationVisualizer = new ControlsFxVisualizer(); @@ -109,6 +114,8 @@ public UnlinkedFilesDialogView() { private void initialize() { viewModel = new UnlinkedFilesDialogViewModel(dialogService, undoManager, fileUpdateMonitor, preferencesService, stateManager, taskExecutor, importFormatReader); + this.bibDatabaseContext = stateManager.getActiveDatabase().orElseThrow(() -> new NullPointerException("No active library")); + progressDisplay.progressProperty().bind(viewModel.progressValueProperty()); progressText.textProperty().bind(viewModel.progressTextProperty()); progressPane.managedProperty().bind(viewModel.taskActiveProperty()); @@ -160,6 +167,8 @@ private void initDirectorySelection() { fileSortCombo.setItems(viewModel.getSorters()); fileSortCombo.valueProperty().bindBidirectional(viewModel.selectedSortProperty()); fileSortCombo.getSelectionModel().selectFirst(); + + directoryPathField.setText(bibDatabaseContext.getFirstExistingFileDir(preferencesService.getFilePreferences()).map(Path::toString).orElse("")); } private void initUnlinkedFilesList() {