diff --git a/src/main/java/org/jabref/gui/filelist/FileListDialogController.java b/src/main/java/org/jabref/gui/filelist/FileListDialogController.java index 6c82fa6f5aa..6b70e73f289 100644 --- a/src/main/java/org/jabref/gui/filelist/FileListDialogController.java +++ b/src/main/java/org/jabref/gui/filelist/FileListDialogController.java @@ -2,6 +2,7 @@ import java.nio.file.Path; import java.nio.file.Paths; +import java.util.List; import java.util.Optional; import javax.inject.Inject; @@ -18,6 +19,7 @@ import org.jabref.gui.StateManager; import org.jabref.gui.externalfiletype.ExternalFileType; import org.jabref.gui.util.FileDialogConfiguration; +import org.jabref.logic.util.io.FileUtil; import org.jabref.model.util.FileHelper; import org.jabref.preferences.JabRefPreferences; import org.jabref.preferences.PreferencesService; @@ -36,6 +38,7 @@ public class FileListDialogController extends AbstractController { + // Store the directory for next time: + Globals.prefs.put(JabRefPreferences.WORKING_DIRECTORY, newFile.toString()); + + // If the file is below the file directory, make the path relative: + List fileDirectories = this.stateManager.getActiveDatabase().get() + .getFileDirectoriesAsPaths(Globals.prefs.getFileDirectoryPreferences()); + newFile = FileUtil.shortenFileName(newFile, fileDirectories); + + tfLink.setText(newFile.toString()); + tfLink.requestFocus(); + }); } @FXML diff --git a/src/main/java/org/jabref/gui/filelist/FileListDialogViewModel.java b/src/main/java/org/jabref/gui/filelist/FileListDialogViewModel.java index 02c5614ca69..ecca0b00ecf 100644 --- a/src/main/java/org/jabref/gui/filelist/FileListDialogViewModel.java +++ b/src/main/java/org/jabref/gui/filelist/FileListDialogViewModel.java @@ -1,7 +1,23 @@ package org.jabref.gui.filelist; +import javafx.beans.property.ListProperty; +import javafx.beans.property.SimpleListProperty; +import javafx.beans.property.SimpleStringProperty; +import javafx.beans.property.StringProperty; +import javafx.collections.FXCollections; + import org.jabref.gui.AbstractViewModel; +import org.jabref.gui.externalfiletype.ExternalFileType; public class FileListDialogViewModel extends AbstractViewModel { + + private final StringProperty linkProperty = new SimpleStringProperty(); + private final StringProperty descriptionProperty = new SimpleStringProperty(); + private final ListProperty externalfilesTypes = new SimpleListProperty<>(FXCollections.emptyObservableList()); + + public FileListDialogViewModel() { + + + } // }