Skip to content
Open
Show file tree
Hide file tree
Changes from 62 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
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
43 changes: 38 additions & 5 deletions jabgui/src/main/java/org/jabref/gui/LibraryTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
import org.jabref.gui.dialogs.AutosaveUiManager;
import org.jabref.gui.exporter.SaveDatabaseAction;
import org.jabref.gui.externalfiles.AutoRenameFileOnEntryChange;
import org.jabref.gui.externalfiles.EntryImportHandlerTracker;
import org.jabref.gui.externalfiles.ImportHandler;
import org.jabref.gui.fieldeditors.LinkedFileViewModel;
import org.jabref.gui.importer.actions.OpenDatabaseAction;
Expand All @@ -61,6 +62,7 @@
import org.jabref.logic.ai.AiService;
import org.jabref.logic.citationstyle.CitationStyleCache;
import org.jabref.logic.command.CommandSelectionTab;
import org.jabref.logic.externalfiles.LinkedFileTransferHelper;
import org.jabref.logic.importer.FetcherClientException;
import org.jabref.logic.importer.FetcherException;
import org.jabref.logic.importer.FetcherServerException;
Expand Down Expand Up @@ -842,17 +844,48 @@ 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;
}
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(entriesToAdd, sourceBibDatabaseContext);
}

private void copyEntriesWithFeedback(List<BibEntry> entriesToAdd, BibDatabaseContext sourceBibDatabaseContext) {
Copy link
Member

Choose a reason for hiding this comment

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

@Nullable should be annotated

The method is a nearly 100% code duplication from org.jabref.gui.edit.CopyTo#copyEntriesWithFeedback

The version of org.jabref.gui.edit.CopyTo#copyEntriesWithFeedback is not that good, because the non-standard use of Localization.lang should at least be documented.

Move the method to package org.jabref.gui.util. You can create a class CopyUtil with a static method.

Copy link
Author

Choose a reason for hiding this comment

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

Thanks for the review. Just to clarify - this method is code that I reused from the existing org.jabref.gui.edit.CopyTo#copyEntriesWithFeedback method (originally implemented by another author]). I copied it because I needed the same functionality in my code.
Since this represents code duplication as you noted, should I still go ahead and refactor it into the org.jabref.gui.util.CopyUtil class as suggested? This would benefit both the original location and my usage, and I'm happy to do the refactoring work even though I wasn't the original author. Just asking, because I don't want to 'steal' the code.

Copy link
Member

Choose a reason for hiding this comment

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

There should be not a thing such as authorship for methods... The aim of the community is to have the code in a good state. We are in the open source world; there should be a step back from author ship - its not art what we do here, its engineering :)

Thus, please, go ahead with refactoring.

final List<BibEntry> finalEntriesToAdd = entriesToAdd;

EntryImportHandlerTracker tracker = new EntryImportHandlerTracker(finalEntriesToAdd.size());

tracker.setOnFinish(() -> {
int importedCount = tracker.getImportedCount();
int skippedCount = tracker.getSkippedCount();

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

if (importedCount == finalEntriesToAdd.size()) {
dialogService.notify(Localization.lang("Pasted %0 entry(s) to %1",
String.valueOf(importedCount), targetName));
Copy link
Member

Choose a reason for hiding this comment

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

Indent is off

} else if (importedCount == 0) {
dialogService.notify(Localization.lang("No entry was pasted to %0", targetName));
} else {
dialogService.notify(Localization.lang("Pasted %0 entry(s) to %1. %2 were skipped",
String.valueOf(importedCount), targetName, String.valueOf(skippedCount)));
}
if (sourceBibDatabaseContext != null) {
LinkedFileTransferHelper
.adjustLinkedFilesForTarget(sourceBibDatabaseContext,
bibDatabaseContext, preferences.getFilePreferences());
}
});

importHandler.importEntriesWithDuplicateCheck(bibDatabaseContext, entriesToAdd);
importHandler.importEntriesWithDuplicateCheck(bibDatabaseContext, finalEntriesToAdd, tracker);
}

private List<BibEntry> handleNonBibTeXStringData(String data) {
Expand All @@ -870,8 +903,8 @@ private List<BibEntry> handleNonBibTeXStringData(String data) {
}
}

public void dropEntry(List<BibEntry> entriesToAdd) {
importHandler.importEntriesWithDuplicateCheck(bibDatabaseContext, entriesToAdd);
public void dropEntry(List<BibEntry> entriesToAdd, BibDatabaseContext sourceBibDatabaseContext) {
copyEntriesWithFeedback(entriesToAdd, sourceBibDatabaseContext);
}

public void cutEntry() {
Expand Down
8 changes: 8 additions & 0 deletions jabgui/src/main/java/org/jabref/gui/edit/CopyTo.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
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.externalfiles.LinkedFileTransferHelper;
import org.jabref.logic.l10n.Localization;
import org.jabref.model.database.BibDatabaseContext;
import org.jabref.model.entry.BibEntry;
Expand All @@ -25,19 +27,22 @@ public class CopyTo extends SimpleCommand {
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 @@ -106,6 +111,9 @@ private void copyEntriesWithFeedback(List<BibEntry> entriesToAdd, BibDatabaseCon
});

importHandler.importEntriesWithDuplicateCheck(targetDatabaseContext, entriesToAdd, tracker);
tracker.setOnFinish(() -> LinkedFileTransferHelper
.adjustLinkedFilesForTarget(sourceDatabaseContext, targetDatabaseContext, filePreferences)
);
Copy link
Member

Choose a reason for hiding this comment

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

This is assuming that "importHandler" in the line before (!) executes asynchronously.

It overwrites the handler set in line 96.

Did you play around here?

Should we just remove lines 96 to 111?

Copy link
Author

Choose a reason for hiding this comment

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

I forgot to correct this like in LibraryTab. I think it could work inside the first handler.

}

public Optional<BibEntry> getCrossRefEntry(BibEntry bibEntryToCheck, BibDatabaseContext sourceDatabaseContext) {
Expand Down
16 changes: 13 additions & 3 deletions jabgui/src/main/java/org/jabref/gui/edit/EditAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import javafx.scene.control.TextInputControl;
import javafx.scene.web.WebView;

import org.jabref.gui.ClipBoardManager;
import org.jabref.gui.LibraryTab;
import org.jabref.gui.StateManager;
import org.jabref.gui.actions.ActionHelper;
Expand All @@ -29,12 +30,15 @@ public class EditAction extends SimpleCommand {
private final StandardActions action;
private final StateManager stateManager;
private final UndoManager undoManager;
private final ClipBoardManager clipBoardManager;

public EditAction(StandardActions action, Supplier<LibraryTab> tabSupplier, StateManager stateManager, UndoManager undoManager) {
public EditAction(StandardActions action, Supplier<LibraryTab> tabSupplier, StateManager stateManager,
UndoManager undoManager, ClipBoardManager clipBoardManager) {
this.action = action;
this.tabSupplier = tabSupplier;
this.stateManager = stateManager;
this.undoManager = undoManager;
this.clipBoardManager = clipBoardManager;

if (action == StandardActions.PASTE) {
this.executable.bind(ActionHelper.needsDatabase(stateManager));
Expand Down Expand Up @@ -77,8 +81,14 @@ public void execute() {
// Not sure what is selected -> copy/paste/cut selected entries except for Preview and CodeArea

switch (action) {
case COPY -> tabSupplier.get().copyEntry();
case CUT -> tabSupplier.get().cutEntry();
case COPY -> {
clipBoardManager.setSourceBibDatabaseContext(tabSupplier.get().getBibDatabaseContext());
Copy link
Member

Choose a reason for hiding this comment

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

This can be included in copyEntry

Copy link
Author

Choose a reason for hiding this comment

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

good point. done.

tabSupplier.get().copyEntry();
}
case CUT -> {
clipBoardManager.setSourceBibDatabaseContext(tabSupplier.get().getBibDatabaseContext());
Copy link
Member

Choose a reason for hiding this comment

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

This can be included in cutEntry

Copy link
Author

Choose a reason for hiding this comment

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

good point. done.

tabSupplier.get().cutEntry();
}
case PASTE -> tabSupplier.get().pasteEntry();
case DELETE_ENTRY -> tabSupplier.get().deleteEntry();
case UNDO -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ public void importEntryWithDuplicateCheck(BibDatabaseContext bibDatabaseContext,
}

private void importEntryWithDuplicateCheck(BibDatabaseContext bibDatabaseContext, BibEntry entry, DuplicateResolverDialog.DuplicateResolverResult decision, EntryImportHandlerTracker tracker) {
BibEntry entryToInsert = cleanUpEntry(bibDatabaseContext, entry);
BibEntry entryToInsert = new BibEntry(cleanUpEntry(bibDatabaseContext, entry));
Copy link
Member

Choose a reason for hiding this comment

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

Why do you create a copy here of the bib entry?

Copy link
Author

Choose a reason for hiding this comment

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

I create a copy here because importEntryWithDuplicateCheck doesn't create a deep copy - it uses the same BibEntry instance in both databases. Without this copy, when I later update the file links/paths in the imported entry, these modifications would also affect the original entry in the source database. Creating a copy ensures that path adjustments during import are isolated to the target database only.

This approach doesn't break any existing tests, but if you see a specific issue with creating a copy here or have a better solution in mind, I'm happy to refactor it.

Copy link
Member

Choose a reason for hiding this comment

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

Please add a short Java comemnt above. Maybe

// The original entry should not be modified

Please do the copy before cleanUpEntry - otherwise the source entry will be modified, too.


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(entryCopies, sourceBibDatabaseContext);
Copy link
Member

Choose a reason for hiding this comment

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

Swap the parameters to preserve the order source, target (aspects).

} 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(groupTreeNodeToCopy.getEntriesInGroup(allEntries), stateManager.getActiveDatabase().get());
// List of all children of groupTreeNodeToCopy
List<GroupTreeNode> children = groupTreeNodeToCopy.getChildren();

Expand Down
8 changes: 4 additions & 4 deletions jabgui/src/main/java/org/jabref/gui/frame/MainMenu.java
Original file line number Diff line number Diff line change
Expand Up @@ -206,10 +206,10 @@ private void createMenu() {

new SeparatorMenuItem(),

factory.createMenuItem(StandardActions.CUT, new EditAction(StandardActions.CUT, frame::getCurrentLibraryTab, stateManager, undoManager)),
factory.createMenuItem(StandardActions.COPY, new EditAction(StandardActions.COPY, frame::getCurrentLibraryTab, stateManager, undoManager)),
factory.createMenuItem(StandardActions.CUT, new EditAction(StandardActions.CUT, frame::getCurrentLibraryTab, stateManager, undoManager, clipBoardManager)),
factory.createMenuItem(StandardActions.COPY, new EditAction(StandardActions.COPY, frame::getCurrentLibraryTab, stateManager, undoManager, clipBoardManager)),
RightClickMenu.createCopySubMenu(factory, dialogService, stateManager, preferences, clipBoardManager, abbreviationRepository, taskExecutor),
factory.createMenuItem(StandardActions.PASTE, new EditAction(StandardActions.PASTE, frame::getCurrentLibraryTab, stateManager, undoManager)),
factory.createMenuItem(StandardActions.PASTE, new EditAction(StandardActions.PASTE, frame::getCurrentLibraryTab, stateManager, undoManager, clipBoardManager)),

new SeparatorMenuItem(),

Expand Down Expand Up @@ -248,7 +248,7 @@ private void createMenu() {
factory.createMenuItem(StandardActions.ADD_ENTRY, new NewEntryAction(false, frame::getCurrentLibraryTab, dialogService, preferences, stateManager)),
factory.createMenuItem(StandardActions.ADD_ENTRY_IDENTIFIER, new NewEntryAction(NewEntryDialogTab.ENTER_IDENTIFIER, frame::getCurrentLibraryTab, dialogService, preferences, stateManager)),
factory.createMenuItem(StandardActions.ADD_ENTRY_PLAINTEXT, new NewEntryAction(NewEntryDialogTab.INTERPRET_CITATIONS, frame::getCurrentLibraryTab, dialogService, preferences, stateManager)),
factory.createMenuItem(StandardActions.DELETE_ENTRY, new EditAction(StandardActions.DELETE_ENTRY, frame::getCurrentLibraryTab, stateManager, undoManager)),
factory.createMenuItem(StandardActions.DELETE_ENTRY, new EditAction(StandardActions.DELETE_ENTRY, frame::getCurrentLibraryTab, stateManager, undoManager, clipBoardManager)),

new SeparatorMenuItem(),

Expand Down
8 changes: 4 additions & 4 deletions jabgui/src/main/java/org/jabref/gui/frame/MainToolBar.java
Original file line number Diff line number Diff line change
Expand Up @@ -117,16 +117,16 @@ private void createToolBar() {
new HBox(
factory.createIconButton(StandardActions.ADD_ENTRY_IMMEDIATE, new NewEntryAction(true, frame::getCurrentLibraryTab, dialogService, preferences, stateManager)),
factory.createIconButton(StandardActions.ADD_ENTRY, new NewEntryAction(false, frame::getCurrentLibraryTab, dialogService, preferences, stateManager)),
factory.createIconButton(StandardActions.DELETE_ENTRY, new EditAction(StandardActions.DELETE_ENTRY, frame::getCurrentLibraryTab, stateManager, undoManager))),
factory.createIconButton(StandardActions.DELETE_ENTRY, new EditAction(StandardActions.DELETE_ENTRY, frame::getCurrentLibraryTab, stateManager, undoManager, clipBoardManager))),

new Separator(Orientation.VERTICAL),

new HBox(
factory.createIconButton(StandardActions.UNDO, new UndoAction(frame::getCurrentLibraryTab, undoManager, dialogService, stateManager)),
factory.createIconButton(StandardActions.REDO, new RedoAction(frame::getCurrentLibraryTab, undoManager, dialogService, stateManager)),
factory.createIconButton(StandardActions.CUT, new EditAction(StandardActions.CUT, frame::getCurrentLibraryTab, stateManager, undoManager)),
factory.createIconButton(StandardActions.COPY, new EditAction(StandardActions.COPY, frame::getCurrentLibraryTab, stateManager, undoManager)),
factory.createIconButton(StandardActions.PASTE, new EditAction(StandardActions.PASTE, frame::getCurrentLibraryTab, stateManager, undoManager))),
factory.createIconButton(StandardActions.CUT, new EditAction(StandardActions.CUT, frame::getCurrentLibraryTab, stateManager, undoManager, clipBoardManager)),
factory.createIconButton(StandardActions.COPY, new EditAction(StandardActions.COPY, frame::getCurrentLibraryTab, stateManager, undoManager, clipBoardManager)),
factory.createIconButton(StandardActions.PASTE, new EditAction(StandardActions.PASTE, frame::getCurrentLibraryTab, stateManager, undoManager, clipBoardManager))),

new Separator(Orientation.VERTICAL),

Expand Down
Loading
Loading