Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
7b35786
refactor(RightClickMenu): pass libraryTab to createCopySubMenu
Jul 6, 2025
507c203
feat(ClipBoardManager): add static BibDatabaseContext field with gett…
Jul 6, 2025
327e8b3
refactor(ClipBoardManager): change sourceDatabaseContext to instance …
Jul 6, 2025
80a5dd8
feat(RightClickMenu): set sourceBibDatabaseContext from libraryTab
Jul 6, 2025
4a94235
feat: add LinkedFileTransferHelper#adjustLinkedFilesForTarget call to…
Jul 6, 2025
39e0484
feat(CopyTo): support file preferences in copy operations
Jul 6, 2025
2a58afb
feat(LinkedFileTransferHelper): add new helper class to support Entry…
Jul 6, 2025
4024b48
feat(LinkedFileTransferHelper): add helper to check reachability from…
Jul 7, 2025
87a064f
test(LinkedFileTransferHelperTest): add test cases for LinkedFileTran…
Jul 7, 2025
f864dc3
feat: adjust relative file paths after entry transfer between libraries
Jul 7, 2025
638bc91
feat(ImportHandler): clone entry in importEntryWithDuplicateCheck
Jul 12, 2025
593d36f
chore: update LinkedFileTransferHelper#adjustLinkedFilesForTarget cal…
Jul 12, 2025
f6cf22f
refactor: update LibraryTab#pasteEntry to copy with feedback
Jul 12, 2025
f53d4cc
feat(LinkedFileTransferHelper): enhance linked file adjustment and co…
Jul 12, 2025
d4871af
test(LinkedFileTransferHelperTest): add tests for all three scenarios
Jul 13, 2025
7385bd0
docs(requirements): add file transfer requirements specification
Jul 13, 2025
52fd290
chore: remove unnecessary comments and adjust filed.ms to increment t…
Jul 13, 2025
4b3011f
chore: replace Collection constructors with factories
Jul 13, 2025
2a9d039
chore: remove DisplayNames for test classes
Jul 13, 2025
646da11
chore: replace assertTrue with assertEquals
Jul 13, 2025
b06fbbc
refactor: change method signature to have boolean parameter last and …
Jul 13, 2025
3f03974
refactor: replace IOException with Exception in the throws clause and…
Jul 13, 2025
a85b157
refactor: remove unused import
Jul 13, 2025
a0dcacd
refactor: remove static modifier
Jul 13, 2025
0de8f52
fix: add messages for pasting entries in the properties file
Aug 1, 2025
9cc27f7
chore: use BibEntry copy constructor in LinkedFileTransferHelper for …
Aug 1, 2025
16bfa81
chore: align with style rules
Aug 1, 2025
a734930
fix: improve error logging and update assertions in LinkedFileTransfe…
Aug 1, 2025
2766ba9
fix: reorganize imports and improve code formatting in LinkedFileTran…
Aug 1, 2025
98b0a24
fix: rename filed.md to files.md for clarity
Aug 1, 2025
0309d35
docs: add requirement traceability comments to LinkedFileTransferHelper
Aug 1, 2025
ee18968
fix: replace file existence check with atomic copy and exception hand…
Aug 1, 2025
582c392
chore(LinkesFileTransferHelperTest): replace setters with withers
Aug 1, 2025
031f835
chore(LinkesFileTransferHelperTest): change back to setters
Aug 1, 2025
17d97b3
fix: reject null in setSourceBibDatabaseContext to enforce fail-fast
Aug 3, 2025
397efaf
test: update LinkedFileTransferHelperTest to use Set for returned ent…
Aug 3, 2025
f0e59a0
docs: clarify definition of "reachable" for linked files in file tran…
Aug 3, 2025
540fb72
chore: add line for separation
Aug 3, 2025
1e4e08c
refactor: remove requireNonNull
Aug 3, 2025
3863c2c
docs: update file transfer documentation for clarity and consistency
Aug 3, 2025
30c6ef5
refactor: streamline linked file adjustment by using ifPresent for so…
Aug 3, 2025
ac3cdd3
chore: move getSourceBibDatabaseContext method to improve code organi…
Aug 3, 2025
11d7dbe
chore: fix indentation in module-info.java after rebase
Aug 3, 2025
ae369d5
refactor: move clipboard context setting from RightClickMenu to EditA…
Aug 3, 2025
dd02975
test: refactor test to align with project standards
Aug 9, 2025
cd2cbf5
chore: change indents to 4 spaces to align with project standards
Aug 9, 2025
6e24f48
chore: change indents to 4 spaces to align with project standards in …
Aug 9, 2025
d862e20
Merge branch 'main' into fix/copy-linked-files-on-entry-transfer
koppor Aug 24, 2025
0e22f72
chore: use Optional without fully qualified class name
Aug 25, 2025
526a86e
Merge remote-tracking branch 'origin/fix/copy-linked-files-on-entry-t…
Aug 25, 2025
bc21d34
Merge main into fix/copy-linked-files-on-entry-transfer
Aug 25, 2025
857380d
chore: fix import order
Aug 25, 2025
9fd3881
refactor: improve exception handling in file path adjustment
Aug 26, 2025
140dc2d
refactor: add nonnull annotation to parameters
Aug 26, 2025
ab218d8
refactor: remove null check
Aug 26, 2025
b171636
fix: use shared ClipBoardManager in EditAction
Aug 9, 2025
08847d2
fix: remove unnecessry injector and adjust dropEntry to handle drag a…
Aug 27, 2025
76a7e16
chore: remove unused import
Aug 27, 2025
fe33a01
refactor: update dropEntry methods to include source BibDatabaseConte…
Aug 27, 2025
041c2df
refactor: remove databasecontext from FrameDndHandler again
Aug 27, 2025
d2de51d
refactor: remove unused imports
Aug 27, 2025
765b7f8
refactor: set databasecontext in FramDndHandler
Aug 27, 2025
9a11db1
refactor: streamline clipboard management and linked file adjustments
Aug 28, 2025
91e67fb
chore: remove unused import
Aug 28, 2025
ad9d623
chore: remove block in switch expression
Aug 28, 2025
2fa7951
Merge remote-tracking branch 'upstream/main' into fix/copy-linked-fil…
Aug 28, 2025
7330a9e
Feature: Add option to deactivate the new feature by adjusting the fi…
Aug 30, 2025
61dfd6c
chore: adjust test cases to enable file copy feature
Aug 30, 2025
f6544ea
chore: replace Collections#emptySet with Set#of to align with best pr…
Aug 30, 2025
49ae45c
Merge branch 'main' into fix/copy-linked-files-on-entry-transfer
UmutAkbayin Aug 30, 2025
6a99ffd
chore: remove unused import
Aug 30, 2025
59d8bc7
refactor: extract copyEntiresWithFeedback method to own utility class
Aug 31, 2025
49d9127
Merge remote-tracking branch 'upstream/main' into fix/copy-linked-fil…
Sep 3, 2025
3bdd340
chore: fix import order issues
Sep 3, 2025
e6e8454
chore: fix import order issues in LinkedFileTransferHelper
Sep 3, 2025
88e8506
chore: fix localization issues
Sep 3, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Note that this project **does not** adhere to [Semantic Versioning](https://semv

### Added

- We added the option in Preferences → Linked files → Attached files to adjust the path of attached files and copy them if needed when entries are copied to another library [#12267](https://github.com/JabRef/jabref/issues/12267)
- We fixed an issue where "Print preview" would throw a `NullPointerException` if no printers were available. [#13708](https://github.com/JabRef/jabref/issues/13708)
- We added the option to enable the language server in the preferences. [#13697](https://github.com/JabRef/jabref/pull/13697)
- We introduced an option in Preferences under (under Linked files -> Linked file name conventions) to automatically rename linked files when an entry data changes. [#11316](https://github.com/JabRef/jabref/issues/11316)
Expand Down
25 changes: 25 additions & 0 deletions docs/requirements/files.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# File Transfer Between Bib Entries

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe, add that in the following "reachable" denotes: reachable using a relative path not climbing up the directory structure?

Also that it respects all configured directories for files

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here’s my update to the description regarding file reachability:

“Reachable” means the linked file can be accessed via a relative path that does not climb up the directory structure (no .. segments beyond the root).
Also, this respects all configured directories for files as per JabRef’s settings (link).

According to this understanding, the implementation is aligned with these cases.

Does this match your understanding?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should move the "reachable" paragraph before the list of requirements. Reason: One often jumps directly to a requirement - and does NOT read the other requirements --> but the definition is put in another requiement.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

*Note:*
"Reachable" here denotes that the linked file can be accessed via a relative path that does **not** climb up the directory structure (i.e., no "`..`" segments beyond the root directory).
Additionally, this check respects all configured **directories for files** as defined in JabRef's file linking settings (see [directories for files](https://docs.jabref.org/finding-sorting-and-cleaning-entries/filelinks#directories-for-files)).

## File is reachable and should not be copied
`req~logic.externalfiles.file-transfer.reachable-no-copy~1`
When a linked file is reachable from the target context, the system must adjust the relative path in the target entry but must not copy the file again.

Needs: impl

## File is not reachable, but the path is the same
`req~logic.externalfiles.file-transfer.not-reachable-same-path~1`
When a linked file is not reachable from the target context, and the relative path in both source and target entry is the same, the file must be copied to the target context.

Needs: impl

## File is not reachable, and a different path is used
`req~logic.externalfiles.file-transfer.not-reachable-different-path~1`
When a linked file is not reachable from the target context, and the relative path differs between source and target entries, the file must be copied and the directory structure must be created to preserve the relative link.

Needs: impl

<!-- markdownlint-disable-file MD022 -->
14 changes: 14 additions & 0 deletions jabgui/src/main/java/org/jabref/gui/ClipBoardManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import java.awt.datatransfer.UnsupportedFlavorException;
import java.io.IOException;
import java.util.List;
import java.util.Optional;

import javafx.application.Platform;
import javafx.scene.control.TextInputControl;
Expand All @@ -18,12 +19,14 @@
import org.jabref.logic.bibtex.BibEntryWriter;
import org.jabref.logic.bibtex.FieldWriter;
import org.jabref.logic.preferences.CliPreferences;
import org.jabref.model.database.BibDatabaseContext;
import org.jabref.model.database.BibDatabaseMode;
import org.jabref.model.entry.BibEntry;
import org.jabref.model.entry.BibEntryTypesManager;
import org.jabref.model.entry.BibtexString;

import com.airhacks.afterburner.injection.Injector;
import org.jspecify.annotations.NonNull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand All @@ -32,8 +35,11 @@ public class ClipBoardManager {
private static final Logger LOGGER = LoggerFactory.getLogger(ClipBoardManager.class);

private static Clipboard clipboard;

private static java.awt.datatransfer.Clipboard primary;

private BibDatabaseContext sourceDatabaseContext;

public ClipBoardManager() {
this(Clipboard.getSystemClipboard(), Toolkit.getDefaultToolkit().getSystemSelection());
}
Expand Down Expand Up @@ -162,6 +168,14 @@ public void setContent(List<BibEntry> entries, BibEntryTypesManager entryTypesMa
setContent(builder.toString());
}

public Optional<BibDatabaseContext> getSourceBibDatabaseContext() {
return Optional.ofNullable(sourceDatabaseContext);
}

public void setSourceBibDatabaseContext(@NonNull BibDatabaseContext context) {
sourceDatabaseContext = context;
}

private String serializeEntries(List<BibEntry> entries, BibEntryTypesManager entryTypesManager) throws IOException {
CliPreferences preferences = Injector.instantiateModelOrService(CliPreferences.class);
// BibEntry is not Java serializable. Thus, we need to do the serialization manually
Expand Down
35 changes: 29 additions & 6 deletions jabgui/src/main/java/org/jabref/gui/LibraryTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import static org.jabref.gui.util.CopyUtil.copyEntriesWithFeedback;

/**
* Represents the ui area where the notifier pane, the library table and the entry editor are shown.
*/
Expand Down Expand Up @@ -810,6 +812,7 @@ public void insertEntries(final List<BibEntry> entries) {
}

public void copyEntry() {
clipBoardManager.setSourceBibDatabaseContext(this.getBibDatabaseContext());
int entriesCopied = doCopyEntry(getSelectedEntries());
if (entriesCopied >= 0) {
dialogService.notify(Localization.lang("Copied %0 entry(s)", entriesCopied));
Expand Down Expand Up @@ -838,17 +841,27 @@ private int doCopyEntry(List<BibEntry> selectedEntries) {
}

public void pasteEntry() {
List<BibEntry> entriesToAdd;
String content = ClipBoardManager.getContents();
entriesToAdd = importHandler.handleBibTeXData(content);
List<BibEntry> entriesToAdd = importHandler.handleBibTeXData(content);
if (entriesToAdd.isEmpty()) {
entriesToAdd = handleNonBibTeXStringData(content);
}
if (entriesToAdd.isEmpty()) {
return;
}

importHandler.importEntriesWithDuplicateCheck(bibDatabaseContext, entriesToAdd);
// Now, the BibEntries to add are known
// The definitive insertion needs to happen now.
BibDatabaseContext sourceBibDatabaseContext = clipBoardManager.getSourceBibDatabaseContext().orElse(null);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment before needs to be added

// Now, the BibEntries to add are known
// The definitive insertion needs to happen now.

copyEntriesWithFeedback(
sourceBibDatabaseContext,
entriesToAdd,
bibDatabaseContext,
Localization.lang("Pasted %0 entry(s) to %1"),
Localization.lang("Pasted %0 entry(s) to %1. %2 were skipped"),
dialogService,
preferences.getFilePreferences(),
importHandler
);
}

private List<BibEntry> handleNonBibTeXStringData(String data) {
Expand All @@ -866,11 +879,21 @@ private List<BibEntry> handleNonBibTeXStringData(String data) {
}
}

public void dropEntry(List<BibEntry> entriesToAdd) {
importHandler.importEntriesWithDuplicateCheck(bibDatabaseContext, entriesToAdd);
public void dropEntry(BibDatabaseContext sourceBibDatabaseContext, List<BibEntry> entriesToAdd) {
copyEntriesWithFeedback(
sourceBibDatabaseContext,
entriesToAdd,
bibDatabaseContext,
Localization.lang("Moved %0 entry(s) to %1"),
Localization.lang("Moved %0 entry(s) to %1. %2 were skipped"),
dialogService,
preferences.getFilePreferences(),
importHandler
);
}

public void cutEntry() {
clipBoardManager.setSourceBibDatabaseContext(this.getBibDatabaseContext());
int entriesCopied = doCopyEntry(getSelectedEntries());
int entriesDeleted = doDeleteEntry(StandardActions.CUT, mainTable.getSelectedEntries());

Expand Down
55 changes: 26 additions & 29 deletions jabgui/src/main/java/org/jabref/gui/edit/CopyTo.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
import org.jabref.gui.StateManager;
import org.jabref.gui.actions.ActionHelper;
import org.jabref.gui.actions.SimpleCommand;
import org.jabref.gui.externalfiles.EntryImportHandlerTracker;
import org.jabref.gui.externalfiles.ImportHandler;
import org.jabref.logic.FilePreferences;
import org.jabref.logic.l10n.Localization;
import org.jabref.model.database.BibDatabaseContext;
import org.jabref.model.entry.BibEntry;
Expand All @@ -18,26 +18,31 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import static org.jabref.gui.util.CopyUtil.copyEntriesWithFeedback;

public class CopyTo extends SimpleCommand {

private static final Logger LOGGER = LoggerFactory.getLogger(CopyTo.class);

private final DialogService dialogService;
private final StateManager stateManager;
private final CopyToPreferences copyToPreferences;
private final FilePreferences filePreferences;
private final ImportHandler importHandler;
private final BibDatabaseContext sourceDatabaseContext;
private final BibDatabaseContext targetDatabaseContext;

public CopyTo(DialogService dialogService,
StateManager stateManager,
CopyToPreferences copyToPreferences,
FilePreferences filePreferences,
ImportHandler importHandler,
BibDatabaseContext sourceDatabaseContext,
BibDatabaseContext targetDatabaseContext) {
this.dialogService = dialogService;
this.stateManager = stateManager;
this.copyToPreferences = copyToPreferences;
this.filePreferences = filePreferences;
this.importHandler = importHandler;
this.sourceDatabaseContext = sourceDatabaseContext;
this.targetDatabaseContext = targetDatabaseContext;
Expand Down Expand Up @@ -75,37 +80,29 @@ public void copyEntriesWithCrossRef(List<BibEntry> selectedEntries, BibDatabaseC
.flatMap(entry -> getCrossRefEntry(entry, sourceDatabaseContext).stream()).toList();
entriesToAdd.addAll(entriesWithCrossRef);

copyEntriesWithFeedback(entriesToAdd, targetDatabaseContext,
Localization.lang("Copied %0 entry(s) to %1, including cross-references"),
Localization.lang("Copied %0 entry(s) to %1. %2 were skipped including cross-references"));
copyEntriesWithFeedback(
sourceDatabaseContext,
entriesToAdd,
targetDatabaseContext,
Localization.lang("Copied %0 entry(s) to %1, including cross-references"),
Localization.lang("Copied %0 entry(s) to %1. %2 were skipped including cross-references"),
dialogService,
filePreferences,
importHandler
);
}

public void copyEntriesWithoutCrossRef(List<BibEntry> selectedEntries, BibDatabaseContext targetDatabaseContext) {
copyEntriesWithFeedback(selectedEntries, targetDatabaseContext,
Localization.lang("Copied %0 entry(s) to %1 without cross-references"),
Localization.lang("Copied %0 entry(s) to %1. %2 were skipped without cross-references"));
}

private void copyEntriesWithFeedback(List<BibEntry> entriesToAdd, BibDatabaseContext targetDatabaseContext, String successMessage, String partialMessage) {
EntryImportHandlerTracker tracker = new EntryImportHandlerTracker(entriesToAdd.size());
tracker.setOnFinish(() -> {
int importedCount = tracker.getImportedCount();
int skippedCount = tracker.getSkippedCount();

String targetName = targetDatabaseContext.getDatabasePath()
.map(path -> path.getFileName().toString())
.orElse(Localization.lang("target library"));

if (importedCount == entriesToAdd.size()) {
dialogService.notify(Localization.lang(successMessage, String.valueOf(importedCount), targetName));
} else if (importedCount == 0) {
dialogService.notify(Localization.lang("No entry was copied to %0", targetName));
} else {
dialogService.notify(Localization.lang(partialMessage, String.valueOf(importedCount), targetName, String.valueOf(skippedCount)));
}
});

importHandler.importEntriesWithDuplicateCheck(targetDatabaseContext, entriesToAdd, tracker);
copyEntriesWithFeedback(
sourceDatabaseContext,
selectedEntries,
targetDatabaseContext,
Localization.lang("Copied %0 entry(s) to %1, without cross-references"),
Localization.lang("Copied %0 entry(s) to %1. %2 were skipped without cross-references"),
dialogService,
filePreferences,
importHandler
);
}

public Optional<BibEntry> getCrossRefEntry(BibEntry bibEntryToCheck, BibDatabaseContext sourceDatabaseContext) {
Expand Down
3 changes: 2 additions & 1 deletion jabgui/src/main/java/org/jabref/gui/edit/EditAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ public class EditAction extends SimpleCommand {
private final StateManager stateManager;
private final UndoManager undoManager;

public EditAction(StandardActions action, Supplier<LibraryTab> tabSupplier, StateManager stateManager, UndoManager undoManager) {
public EditAction(StandardActions action, Supplier<LibraryTab> tabSupplier, StateManager stateManager,
UndoManager undoManager) {
this.action = action;
this.tabSupplier = tabSupplier;
this.stateManager = stateManager;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,20 @@ public void importEntryWithDuplicateCheck(BibDatabaseContext bibDatabaseContext,
importEntryWithDuplicateCheck(bibDatabaseContext, entry, BREAK, new EntryImportHandlerTracker());
}

/**
* Imports an entry into the database with duplicate checking and handling.
* Creates a copy of the entry for processing - the original entry parameter is not modified.
* The copied entry may be modified during cleanup and duplicate handling.
*
* @param bibDatabaseContext the database context to import into
* @param entry the entry to import (original will not be modified)
* @param decision the duplicate resolution strategy to apply
* @param tracker tracks the import status of the entry
*/
private void importEntryWithDuplicateCheck(BibDatabaseContext bibDatabaseContext, BibEntry entry, DuplicateResolverDialog.DuplicateResolverResult decision, EntryImportHandlerTracker tracker) {
BibEntry entryToInsert = cleanUpEntry(bibDatabaseContext, entry);
// The original entry should not be modified
BibEntry entryCopy = new BibEntry(entry);
BibEntry entryToInsert = cleanUpEntry(bibDatabaseContext, entryCopy);

BackgroundTask.wrap(() -> findDuplicate(bibDatabaseContext, entryToInsert))
.onFailure(e -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import org.jabref.gui.importer.actions.OpenDatabaseAction;
import org.jabref.logic.l10n.Localization;
import org.jabref.logic.util.io.FileUtil;
import org.jabref.model.database.BibDatabaseContext;
import org.jabref.model.entry.BibEntry;
import org.jabref.model.groups.GroupTreeNode;

Expand Down Expand Up @@ -106,7 +107,8 @@ private void onTabDragDropped(Node destinationTabNode, DragEvent tabDragEvent, T
if (hasEntries(dragboard)) {
List<BibEntry> entryCopies = stateManager.getLocalDragboard().getBibEntries().stream()
.map(BibEntry::new).toList();
destinationLibraryTab.dropEntry(entryCopies);
BibDatabaseContext sourceBibDatabaseContext = stateManager.getActiveDatabase().orElse(null);
destinationLibraryTab.dropEntry(sourceBibDatabaseContext, entryCopies);
} else if (hasGroups(dragboard)) {
dropGroups(dragboard, destinationLibraryTab);
}
Expand Down Expand Up @@ -213,7 +215,7 @@ private void copyGroupTreeNode(LibraryTab destinationLibraryTab, GroupTreeNode p
// add groupTreeNodeToCopy to the parent-- in the first run that will the source/main GroupTreeNode
GroupTreeNode copiedNode = parent.addSubgroup(groupTreeNodeToCopy.copyNode().getGroup());
// add all entries of a groupTreeNode to the new library.
destinationLibraryTab.dropEntry(groupTreeNodeToCopy.getEntriesInGroup(allEntries));
destinationLibraryTab.dropEntry(stateManager.getActiveDatabase().get(), groupTreeNodeToCopy.getEntriesInGroup(allEntries));
// List of all children of groupTreeNodeToCopy
List<GroupTreeNode> children = groupTreeNodeToCopy.getChildren();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ private static Menu createCopyToMenu(ActionFactory factory,
factory.createCustomMenuItem(
StandardActions.COPY_TO,
new CopyTo(dialogService, stateManager, preferences.getCopyToPreferences(),
importHandler, sourceDatabaseContext, targetDatabaseContext),
preferences.getFilePreferences(), importHandler, sourceDatabaseContext, targetDatabaseContext),
targetDatabaseName
)
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public class LinkedFilesTab extends AbstractPreferenceTabView<LinkedFilesTabView
@FXML private TextField fileDirectoryPattern;
@FXML private CheckBox confirmLinkedFileDelete;
@FXML private CheckBox moveToTrash;
@FXML private CheckBox adjustOrCopyLinkedFilesOnTransfer;

private final ControlsFxVisualizer validationVisualizer = new ControlsFxVisualizer();

Expand Down Expand Up @@ -81,6 +82,7 @@ public void initialize() {
confirmLinkedFileDelete.selectedProperty().bindBidirectional(viewModel.confirmLinkedFileDeleteProperty());
openFileExplorerInFilesDirectory.selectedProperty().bindBidirectional(viewModel.openFileExplorerInFilesDirectoryProperty());
openFileExplorerInLastDirectory.selectedProperty().bindBidirectional(viewModel.openFileExplorerInLastDirectoryProperty());
adjustOrCopyLinkedFilesOnTransfer.selectedProperty().bindBidirectional(viewModel.adjustOrCopyLinkedFilesOnTransferProperty());

ActionFactory actionFactory = new ActionFactory();
actionFactory.configureIconButton(StandardActions.HELP_REGEX_SEARCH, new HelpAction(HelpFile.REGEX_SEARCH, dialogService, preferences.getExternalApplicationsPreferences()), autolinkRegexHelp);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public class LinkedFilesTabViewModel implements PreferenceTabViewModel {
private final StringProperty fileDirectoryPatternProperty = new SimpleStringProperty();
private final BooleanProperty confirmLinkedFileDeleteProperty = new SimpleBooleanProperty();
private final BooleanProperty moveToTrashProperty = new SimpleBooleanProperty();
private final BooleanProperty adjustOrCopyLinkedFilesOnTransferProperty = new SimpleBooleanProperty();
private final BooleanProperty openFileExplorerInFilesDirectory = new SimpleBooleanProperty();
private final BooleanProperty openFileExplorerInLastDirectory = new SimpleBooleanProperty();

Expand Down Expand Up @@ -90,6 +91,7 @@ public void setValues() {
moveToTrashProperty.setValue(filePreferences.moveToTrash());
openFileExplorerInFilesDirectory.setValue(filePreferences.shouldOpenFileExplorerInFileDirectory());
openFileExplorerInLastDirectory.setValue(filePreferences.shouldOpenFileExplorerInLastUsedDirectory());
adjustOrCopyLinkedFilesOnTransferProperty.setValue(filePreferences.shouldAdjustOrCopyLinkedFilesOnTransfer());

// Autolink preferences
switch (autoLinkPreferences.getCitationKeyDependency()) {
Expand Down Expand Up @@ -125,6 +127,7 @@ public void storeSettings() {
autoLinkPreferences.setRegularExpression(autolinkRegexKeyProperty.getValue());
filePreferences.confirmDeleteLinkedFile(confirmLinkedFileDeleteProperty.getValue());
filePreferences.moveToTrash(moveToTrashProperty.getValue());
filePreferences.setAdjustOrCopyLinkedFilesOnTransfer(adjustOrCopyLinkedFilesOnTransferProperty.getValue());
}

ValidationStatus mainFileDirValidationStatus() {
Expand Down Expand Up @@ -206,6 +209,10 @@ public BooleanProperty moveToTrashProperty() {
return this.moveToTrashProperty;
}

public BooleanProperty adjustOrCopyLinkedFilesOnTransferProperty() {
return adjustOrCopyLinkedFilesOnTransferProperty;
}

public BooleanProperty openFileExplorerInFilesDirectoryProperty() {
return openFileExplorerInFilesDirectory;
}
Expand Down
Loading
Loading