From 295796f28e5ab4a2c293f5091da59a5559a7197e Mon Sep 17 00:00:00 2001 From: Anders Blomqvist Date: Thu, 29 Feb 2024 12:37:03 +0100 Subject: [PATCH] feat: include str const in copy #7 Signed-off-by: Anders Blomqvist --- .../java/org/jabref/gui/maintable/MainTable.java | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/jabref/gui/maintable/MainTable.java b/src/main/java/org/jabref/gui/maintable/MainTable.java index e778fa13425..acfa2100c9e 100644 --- a/src/main/java/org/jabref/gui/maintable/MainTable.java +++ b/src/main/java/org/jabref/gui/maintable/MainTable.java @@ -51,6 +51,7 @@ import org.jabref.model.database.event.EntriesAddedEvent; import org.jabref.model.entry.BibEntry; import org.jabref.model.entry.BibEntryTypesManager; +import org.jabref.model.entry.BibtexString; import org.jabref.model.util.FileUpdateMonitor; import org.jabref.preferences.PreferencesService; @@ -257,8 +258,14 @@ public void copy() { List selectedEntries = getSelectedEntries(); if (!selectedEntries.isEmpty()) { + List stringConstants = getStringValues(); + try { - clipBoardManager.setContent(selectedEntries, entryTypesManager); + if (!stringConstants.isEmpty()) { + clipBoardManager.setContent(selectedEntries, entryTypesManager, stringConstants); + } else { + clipBoardManager.setContent(selectedEntries, entryTypesManager); + } dialogService.notify(Localization.lang("Copied %0 entry(ies)", selectedEntries.size())); } catch (IOException e) { LOGGER.error("Error while copying selected entries to clipboard.", e); @@ -489,4 +496,11 @@ private Optional findEntry(BibEntry entry) { .filter(viewModel -> viewModel.getEntry().equals(entry)) .findFirst(); } + + private List getStringValues() { + return database.getDatabase() + .getStringValues() + .stream() + .toList(); + } }