diff --git a/src/main/java/org/jabref/cli/ArgumentProcessor.java b/src/main/java/org/jabref/cli/ArgumentProcessor.java index bf9238be84b..b3bd9cf2603 100644 --- a/src/main/java/org/jabref/cli/ArgumentProcessor.java +++ b/src/main/java/org/jabref/cli/ArgumentProcessor.java @@ -38,6 +38,7 @@ import org.jabref.logic.importer.SearchBasedFetcher; import org.jabref.logic.importer.WebFetchers; import org.jabref.logic.importer.fileformat.BibtexParser; +import org.jabref.logic.journals.JournalAbbreviationRepository; import org.jabref.logic.l10n.Localization; import org.jabref.logic.net.URLDownload; import org.jabref.logic.search.DatabaseSearcher; @@ -167,8 +168,8 @@ private Optional importFile(Path file, String importFormat) { ImportFormatReader.UnknownFormatImport importResult = importFormatReader.importUnknownFormat(file, new DummyFileUpdateMonitor()); - System.out.println(Localization.lang("Format used") + ": " + importResult.format); - return Optional.of(importResult.parserResult); + System.out.println(Localization.lang("Format used") + ": " + importResult.format()); + return Optional.of(importResult.parserResult()); } } catch (ImportException ex) { System.err @@ -241,13 +242,14 @@ private List processArguments() { if (cli.isWriteMetadatatoPdf() || cli.isWriteXMPtoPdf() || cli.isEmbeddBibfileInPdf()) { if (!loaded.isEmpty()) { - writeMetadatatoPdf(loaded, + writeMetadataToPdf(loaded, cli.getWriteMetadatatoPdf(), preferencesService.getXmpPreferences(), preferencesService.getFilePreferences(), preferencesService.getLibraryPreferences().getDefaultBibDatabaseMode(), Globals.entryTypesManager, preferencesService.getFieldPreferences(), + Globals.journalAbbreviationRepository, cli.isWriteXMPtoPdf() || cli.isWriteMetadatatoPdf(), cli.isEmbeddBibfileInPdf() || cli.isWriteMetadatatoPdf()); } @@ -277,7 +279,16 @@ private List processArguments() { return loaded; } - private void writeMetadatatoPdf(List loaded, String filesAndCitekeys, XmpPreferences xmpPreferences, FilePreferences filePreferences, BibDatabaseMode databaseMode, BibEntryTypesManager entryTypesManager, FieldPreferences fieldPreferences, boolean writeXMP, boolean embeddBibfile) { + private void writeMetadataToPdf(List loaded, + String filesAndCitekeys, + XmpPreferences xmpPreferences, + FilePreferences filePreferences, + BibDatabaseMode databaseMode, + BibEntryTypesManager entryTypesManager, + FieldPreferences fieldPreferences, + JournalAbbreviationRepository abbreviationRepository, + boolean writeXMP, + boolean embeddBibfile) { if (loaded.isEmpty()) { LOGGER.error("The write xmp option depends on a valid import option."); return; @@ -291,7 +302,16 @@ private void writeMetadatatoPdf(List loaded, String filesAndCiteke if ("all".equals(filesAndCitekeys)) { for (BibEntry entry : dataBase.getEntries()) { - writeMetadatatoPDFsOfEntry(databaseContext, entry.getCitationKey().orElse(""), entry, filePreferences, xmpPdfExporter, embeddedBibFilePdfExporter, writeXMP, embeddBibfile); + writeMetadataToPDFsOfEntry( + databaseContext, + entry.getCitationKey().orElse(""), + entry, + filePreferences, + xmpPdfExporter, + embeddedBibFilePdfExporter, + abbreviationRepository, + writeXMP, + embeddBibfile); } return; } @@ -306,21 +326,47 @@ private void writeMetadatatoPdf(List loaded, String filesAndCiteke } } - writeMetadatatoPdfByCitekey(databaseContext, dataBase, citeKeys, filePreferences, xmpPdfExporter, embeddedBibFilePdfExporter, writeXMP, embeddBibfile); - writeMetadatatoPdfByFileNames(databaseContext, dataBase, pdfs, filePreferences, xmpPdfExporter, embeddedBibFilePdfExporter, writeXMP, embeddBibfile); + writeMetadataToPdfByCitekey( + databaseContext, + dataBase, + citeKeys, + filePreferences, + xmpPdfExporter, + embeddedBibFilePdfExporter, + abbreviationRepository, + writeXMP, + embeddBibfile); + writeMetadataToPdfByFileNames( + databaseContext, + dataBase, + pdfs, + filePreferences, + xmpPdfExporter, + embeddedBibFilePdfExporter, + abbreviationRepository, + writeXMP, + embeddBibfile); } - private void writeMetadatatoPDFsOfEntry(BibDatabaseContext databaseContext, String citeKey, BibEntry entry, FilePreferences filePreferences, XmpPdfExporter xmpPdfExporter, EmbeddedBibFilePdfExporter embeddedBibFilePdfExporter, boolean writeXMP, boolean embeddBibfile) { + private void writeMetadataToPDFsOfEntry(BibDatabaseContext databaseContext, + String citeKey, + BibEntry entry, + FilePreferences filePreferences, + XmpPdfExporter xmpPdfExporter, + EmbeddedBibFilePdfExporter embeddedBibFilePdfExporter, + JournalAbbreviationRepository abbreviationRepository, + boolean writeXMP, + boolean embeddBibfile) { try { if (writeXMP) { - if (xmpPdfExporter.exportToAllFilesOfEntry(databaseContext, filePreferences, entry, List.of(entry))) { + if (xmpPdfExporter.exportToAllFilesOfEntry(databaseContext, filePreferences, entry, List.of(entry), abbreviationRepository)) { System.out.printf("Successfully written XMP metadata on at least one linked file of %s%n", citeKey); } else { System.err.printf("Cannot write XMP metadata on any linked files of %s. Make sure there is at least one linked file and the path is correct.%n", citeKey); } } if (embeddBibfile) { - if (embeddedBibFilePdfExporter.exportToAllFilesOfEntry(databaseContext, filePreferences, entry, List.of(entry))) { + if (embeddedBibFilePdfExporter.exportToAllFilesOfEntry(databaseContext, filePreferences, entry, List.of(entry), abbreviationRepository)) { System.out.printf("Successfully embedded metadata on at least one linked file of %s%n", citeKey); } else { System.out.printf("Cannot embedd metadata on any linked files of %s. Make sure there is at least one linked file and the path is correct.%n", citeKey); @@ -331,7 +377,15 @@ private void writeMetadatatoPDFsOfEntry(BibDatabaseContext databaseContext, Stri } } - private void writeMetadatatoPdfByCitekey(BibDatabaseContext databaseContext, BibDatabase dataBase, List citeKeys, FilePreferences filePreferences, XmpPdfExporter xmpPdfExporter, EmbeddedBibFilePdfExporter embeddedBibFilePdfExporter, boolean writeXMP, boolean embeddBibfile) { + private void writeMetadataToPdfByCitekey(BibDatabaseContext databaseContext, + BibDatabase dataBase, + List citeKeys, + FilePreferences filePreferences, + XmpPdfExporter xmpPdfExporter, + EmbeddedBibFilePdfExporter embeddedBibFilePdfExporter, + JournalAbbreviationRepository abbreviationRepository, + boolean writeXMP, + boolean embeddBibfile) { for (String citeKey : citeKeys) { List bibEntryList = dataBase.getEntriesByCitationKey(citeKey); if (bibEntryList.isEmpty()) { @@ -339,12 +393,20 @@ private void writeMetadatatoPdfByCitekey(BibDatabaseContext databaseContext, Bib continue; } for (BibEntry entry : bibEntryList) { - writeMetadatatoPDFsOfEntry(databaseContext, citeKey, entry, filePreferences, xmpPdfExporter, embeddedBibFilePdfExporter, writeXMP, embeddBibfile); + writeMetadataToPDFsOfEntry(databaseContext, citeKey, entry, filePreferences, xmpPdfExporter, embeddedBibFilePdfExporter, abbreviationRepository, writeXMP, embeddBibfile); } } } - private void writeMetadatatoPdfByFileNames(BibDatabaseContext databaseContext, BibDatabase dataBase, List pdfs, FilePreferences filePreferences, XmpPdfExporter xmpPdfExporter, EmbeddedBibFilePdfExporter embeddedBibFilePdfExporter, boolean writeXMP, boolean embeddBibfile) { + private void writeMetadataToPdfByFileNames(BibDatabaseContext databaseContext, + BibDatabase dataBase, + List pdfs, + FilePreferences filePreferences, + XmpPdfExporter xmpPdfExporter, + EmbeddedBibFilePdfExporter embeddedBibFilePdfExporter, + JournalAbbreviationRepository abbreviationRepository, + boolean writeXMP, + boolean embeddBibfile) { for (String fileName : pdfs) { Path filePath = Path.of(fileName); if (!filePath.isAbsolute()) { @@ -353,14 +415,14 @@ private void writeMetadatatoPdfByFileNames(BibDatabaseContext databaseContext, B if (Files.exists(filePath)) { try { if (writeXMP) { - if (xmpPdfExporter.exportToFileByPath(databaseContext, dataBase, filePreferences, filePath)) { + if (xmpPdfExporter.exportToFileByPath(databaseContext, dataBase, filePreferences, filePath, abbreviationRepository)) { System.out.printf("Successfully written XMP metadata of at least one entry to %s%n", fileName); } else { System.out.printf("File %s is not linked to any entry in database.%n", fileName); } } if (embeddBibfile) { - if (embeddedBibFilePdfExporter.exportToFileByPath(databaseContext, dataBase, filePreferences, filePath)) { + if (embeddedBibFilePdfExporter.exportToFileByPath(databaseContext, dataBase, filePreferences, filePath, abbreviationRepository)) { System.out.printf("Successfully embedded XMP metadata of at least one entry to %s%n", fileName); } else { System.out.printf("File %s is not linked to any entry in database.%n", fileName); @@ -416,8 +478,7 @@ private boolean exportMatches(List loaded) { // export new database ExporterFactory exporterFactory = ExporterFactory.create( preferencesService, - Globals.entryTypesManager, - Globals.journalAbbreviationRepository); + Globals.entryTypesManager); Optional exporter = exporterFactory.getExporterByName(formatName); if (exporter.isEmpty()) { System.err.println(Localization.lang("Unknown export format") + ": " + formatName); @@ -425,7 +486,7 @@ private boolean exportMatches(List loaded) { // We have an TemplateExporter instance: try { System.out.println(Localization.lang("Exporting") + ": " + data[1]); - exporter.get().export(databaseContext, Path.of(data[1]), matches, Collections.emptyList()); + exporter.get().export(databaseContext, Path.of(data[1]), matches, Collections.emptyList(), Globals.journalAbbreviationRepository); } catch (Exception ex) { System.err.println(Localization.lang("Could not export file") + " '" + data[1] + "': " + Throwables.getStackTraceAsString(ex)); @@ -591,8 +652,7 @@ private void exportFile(List loaded, String[] data) { System.out.println(Localization.lang("Exporting") + ": " + data[0]); ExporterFactory exporterFactory = ExporterFactory.create( preferencesService, - Globals.entryTypesManager, - Globals.journalAbbreviationRepository); + Globals.entryTypesManager); Optional exporter = exporterFactory.getExporterByName(data[1]); if (exporter.isEmpty()) { System.err.println(Localization.lang("Unknown export format") + ": " + data[1]); @@ -603,7 +663,8 @@ private void exportFile(List loaded, String[] data) { pr.getDatabaseContext(), Path.of(data[0]), pr.getDatabaseContext().getDatabase().getEntries(), - fileDirForDatabase); + fileDirForDatabase, + Globals.journalAbbreviationRepository); } catch (Exception ex) { System.err.println(Localization.lang("Could not export file") + " '" + data[0] + "': " + Throwables.getStackTraceAsString(ex)); diff --git a/src/main/java/org/jabref/cli/JabRefCLI.java b/src/main/java/org/jabref/cli/JabRefCLI.java index ba8d169a947..484201b63ff 100644 --- a/src/main/java/org/jabref/cli/JabRefCLI.java +++ b/src/main/java/org/jabref/cli/JabRefCLI.java @@ -311,8 +311,7 @@ public static void printUsage(PreferencesService preferencesService) { ExporterFactory exporterFactory = ExporterFactory.create( preferencesService, - Globals.entryTypesManager, - Globals.journalAbbreviationRepository); + Globals.entryTypesManager); List> exportFormats = exporterFactory .getExporters().stream() .map(format -> new Pair<>(format.getName(), format.getId())) diff --git a/src/main/java/org/jabref/gui/JabRefFrame.java b/src/main/java/org/jabref/gui/JabRefFrame.java index 0b1d1065aa0..1d25f22bcd2 100644 --- a/src/main/java/org/jabref/gui/JabRefFrame.java +++ b/src/main/java/org/jabref/gui/JabRefFrame.java @@ -643,7 +643,7 @@ public void showLibraryTab(LibraryTab libraryTab) { } public void init() { - sidePane = new SidePane(prefs, taskExecutor, dialogService, stateManager, undoManager); + sidePane = new SidePane(prefs, Globals.journalAbbreviationRepository, taskExecutor, dialogService, stateManager, undoManager); tabbedPane = new TabPane(); tabbedPane.setTabDragPolicy(TabPane.TabDragPolicy.REORDER); @@ -808,12 +808,12 @@ private MenuBar createMenu() { factory.createMenuItem(StandardActions.COPY, new EditAction(StandardActions.COPY, this, stateManager)), factory.createSubMenu(StandardActions.COPY_MORE, - factory.createMenuItem(StandardActions.COPY_TITLE, new CopyMoreAction(StandardActions.COPY_TITLE, dialogService, stateManager, Globals.getClipboardManager(), prefs)), - factory.createMenuItem(StandardActions.COPY_KEY, new CopyMoreAction(StandardActions.COPY_KEY, dialogService, stateManager, Globals.getClipboardManager(), prefs)), - factory.createMenuItem(StandardActions.COPY_CITE_KEY, new CopyMoreAction(StandardActions.COPY_CITE_KEY, dialogService, stateManager, Globals.getClipboardManager(), prefs)), - factory.createMenuItem(StandardActions.COPY_KEY_AND_TITLE, new CopyMoreAction(StandardActions.COPY_KEY_AND_TITLE, dialogService, stateManager, Globals.getClipboardManager(), prefs)), - factory.createMenuItem(StandardActions.COPY_KEY_AND_LINK, new CopyMoreAction(StandardActions.COPY_KEY_AND_LINK, dialogService, stateManager, Globals.getClipboardManager(), prefs)), - factory.createMenuItem(StandardActions.COPY_CITATION_PREVIEW, new CopyCitationAction(CitationStyleOutputFormat.HTML, dialogService, stateManager, Globals.getClipboardManager(), Globals.TASK_EXECUTOR, prefs.getPreviewPreferences())), + factory.createMenuItem(StandardActions.COPY_TITLE, new CopyMoreAction(StandardActions.COPY_TITLE, dialogService, stateManager, Globals.getClipboardManager(), prefs, Globals.journalAbbreviationRepository)), + factory.createMenuItem(StandardActions.COPY_KEY, new CopyMoreAction(StandardActions.COPY_KEY, dialogService, stateManager, Globals.getClipboardManager(), prefs, Globals.journalAbbreviationRepository)), + factory.createMenuItem(StandardActions.COPY_CITE_KEY, new CopyMoreAction(StandardActions.COPY_CITE_KEY, dialogService, stateManager, Globals.getClipboardManager(), prefs, Globals.journalAbbreviationRepository)), + factory.createMenuItem(StandardActions.COPY_KEY_AND_TITLE, new CopyMoreAction(StandardActions.COPY_KEY_AND_TITLE, dialogService, stateManager, Globals.getClipboardManager(), prefs, Globals.journalAbbreviationRepository)), + factory.createMenuItem(StandardActions.COPY_KEY_AND_LINK, new CopyMoreAction(StandardActions.COPY_KEY_AND_LINK, dialogService, stateManager, Globals.getClipboardManager(), prefs, Globals.journalAbbreviationRepository)), + factory.createMenuItem(StandardActions.COPY_CITATION_PREVIEW, new CopyCitationAction(CitationStyleOutputFormat.HTML, dialogService, stateManager, Globals.getClipboardManager(), Globals.TASK_EXECUTOR, prefs, Globals.journalAbbreviationRepository)), factory.createMenuItem(StandardActions.EXPORT_SELECTED_TO_CLIPBOARD, new ExportToClipboardAction(dialogService, stateManager, Globals.getClipboardManager(), Globals.TASK_EXECUTOR, prefs))), factory.createMenuItem(StandardActions.PASTE, new EditAction(StandardActions.PASTE, this, stateManager)), diff --git a/src/main/java/org/jabref/gui/edit/CopyMoreAction.java b/src/main/java/org/jabref/gui/edit/CopyMoreAction.java index 2da415b3485..0f9bbe3c103 100644 --- a/src/main/java/org/jabref/gui/edit/CopyMoreAction.java +++ b/src/main/java/org/jabref/gui/edit/CopyMoreAction.java @@ -8,12 +8,12 @@ import org.jabref.gui.ClipBoardManager; import org.jabref.gui.DialogService; -import org.jabref.gui.Globals; import org.jabref.gui.JabRefDialogService; import org.jabref.gui.StateManager; import org.jabref.gui.actions.ActionHelper; import org.jabref.gui.actions.SimpleCommand; import org.jabref.gui.actions.StandardActions; +import org.jabref.logic.journals.JournalAbbreviationRepository; import org.jabref.logic.l10n.Localization; import org.jabref.logic.layout.Layout; import org.jabref.logic.layout.LayoutHelper; @@ -33,17 +33,20 @@ public class CopyMoreAction extends SimpleCommand { private final StateManager stateManager; private final ClipBoardManager clipBoardManager; private final PreferencesService preferencesService; + private final JournalAbbreviationRepository abbreviationRepository; public CopyMoreAction(StandardActions action, DialogService dialogService, StateManager stateManager, ClipBoardManager clipBoardManager, - PreferencesService preferencesService) { + PreferencesService preferencesService, + JournalAbbreviationRepository abbreviationRepository) { this.action = action; this.dialogService = dialogService; this.stateManager = stateManager; this.clipBoardManager = clipBoardManager; this.preferencesService = preferencesService; + this.abbreviationRepository = abbreviationRepository; this.executable.bind(ActionHelper.needsEntriesSelected(stateManager)); } @@ -192,7 +195,7 @@ private void copyKeyAndTitle() { StringReader layoutString = new StringReader("\\citationkey - \\begin{title}\\format[RemoveBrackets]{\\title}\\end{title}\n"); Layout layout; try { - layout = new LayoutHelper(layoutString, preferencesService.getLayoutFormatterPreferences(Globals.journalAbbreviationRepository)).getLayoutFromText(); + layout = new LayoutHelper(layoutString, preferencesService.getLayoutFormatterPreferences(), abbreviationRepository).getLayoutFromText(); } catch (IOException e) { LOGGER.info("Could not get layout.", e); return; diff --git a/src/main/java/org/jabref/gui/exporter/CreateModifyExporterDialogView.java b/src/main/java/org/jabref/gui/exporter/CreateModifyExporterDialogView.java index d1370c42575..5ad22042ddc 100644 --- a/src/main/java/org/jabref/gui/exporter/CreateModifyExporterDialogView.java +++ b/src/main/java/org/jabref/gui/exporter/CreateModifyExporterDialogView.java @@ -7,7 +7,6 @@ import org.jabref.gui.DialogService; import org.jabref.gui.util.BaseDialog; -import org.jabref.logic.journals.JournalAbbreviationRepository; import org.jabref.logic.l10n.Localization; import org.jabref.preferences.PreferencesService; @@ -16,7 +15,6 @@ public class CreateModifyExporterDialogView extends BaseDialog { - @Inject private JournalAbbreviationRepository repository; private final ExporterViewModel exporter; @FXML private TextField name; @FXML private TextField fileName; @@ -45,7 +43,7 @@ public CreateModifyExporterDialogView(ExporterViewModel exporter) { @FXML private void initialize() { - viewModel = new CreateModifyExporterDialogViewModel(exporter, dialogService, preferences, repository); + viewModel = new CreateModifyExporterDialogViewModel(exporter, dialogService, preferences); name.textProperty().bindBidirectional(viewModel.getName()); fileName.textProperty().bindBidirectional(viewModel.getLayoutFileName()); extension.textProperty().bindBidirectional(viewModel.getExtension()); diff --git a/src/main/java/org/jabref/gui/exporter/CreateModifyExporterDialogViewModel.java b/src/main/java/org/jabref/gui/exporter/CreateModifyExporterDialogViewModel.java index 2fae491983f..0fcc7b12fde 100644 --- a/src/main/java/org/jabref/gui/exporter/CreateModifyExporterDialogViewModel.java +++ b/src/main/java/org/jabref/gui/exporter/CreateModifyExporterDialogViewModel.java @@ -8,11 +8,8 @@ import org.jabref.gui.AbstractViewModel; import org.jabref.gui.DialogService; import org.jabref.gui.util.FileDialogConfiguration; -import org.jabref.logic.exporter.SaveConfiguration; import org.jabref.logic.exporter.TemplateExporter; -import org.jabref.logic.journals.JournalAbbreviationRepository; import org.jabref.logic.l10n.Localization; -import org.jabref.logic.layout.LayoutFormatterPreferences; import org.jabref.logic.util.StandardFileType; import org.jabref.preferences.PreferencesService; @@ -37,15 +34,11 @@ public class CreateModifyExporterDialogViewModel extends AbstractViewModel { private final StringProperty layoutFile = new SimpleStringProperty(""); private final StringProperty extension = new SimpleStringProperty(""); - private final JournalAbbreviationRepository repository; - public CreateModifyExporterDialogViewModel(ExporterViewModel exporter, DialogService dialogService, - PreferencesService preferences, - JournalAbbreviationRepository repository) { + PreferencesService preferences) { this.dialogService = dialogService; this.preferences = preferences; - this.repository = repository; // Set text of each of the boxes if (exporter != null) { @@ -69,14 +62,12 @@ public ExporterViewModel saveExporter() { } // Create a new exporter to be returned to ExportCustomizationDialogViewModel, which requested it - LayoutFormatterPreferences layoutPreferences = preferences.getLayoutFormatterPreferences(repository); - SaveConfiguration saveConfiguration = preferences.getExportConfiguration(); TemplateExporter format = new TemplateExporter( name.get(), layoutFile.get(), extension.get(), - layoutPreferences, - saveConfiguration); + preferences.getLayoutFormatterPreferences(), + preferences.getExportConfiguration()); format.setCustomExport(true); return new ExporterViewModel(format); } diff --git a/src/main/java/org/jabref/gui/exporter/ExportCommand.java b/src/main/java/org/jabref/gui/exporter/ExportCommand.java index 672615b6c2a..b120ba1aed2 100644 --- a/src/main/java/org/jabref/gui/exporter/ExportCommand.java +++ b/src/main/java/org/jabref/gui/exporter/ExportCommand.java @@ -70,8 +70,7 @@ public void execute() { // Get list of exporters and sort before adding to file dialog ExporterFactory exporterFactory = ExporterFactory.create( preferences, - Globals.entryTypesManager, - Globals.journalAbbreviationRepository); + Globals.entryTypesManager); List exporters = exporterFactory.getExporters().stream() .sorted(Comparator.comparing(Exporter::getName)) .collect(Collectors.toList()); @@ -120,7 +119,8 @@ private void export(Path file, FileChooser.ExtensionFilter selectedExtensionFilt format.export(stateManager.getActiveDatabase().get(), file, finEntries, - fileDirForDatabase); + fileDirForDatabase, + Globals.journalAbbreviationRepository); return null; // can not use BackgroundTask.wrap(Runnable) because Runnable.run() can't throw Exceptions }) .onSuccess(save -> { diff --git a/src/main/java/org/jabref/gui/exporter/ExportToClipboardAction.java b/src/main/java/org/jabref/gui/exporter/ExportToClipboardAction.java index 9ef046d4207..c0d2e2c7135 100644 --- a/src/main/java/org/jabref/gui/exporter/ExportToClipboardAction.java +++ b/src/main/java/org/jabref/gui/exporter/ExportToClipboardAction.java @@ -75,8 +75,7 @@ public void execute() { ExporterFactory exporterFactory = ExporterFactory.create( preferences, - Globals.entryTypesManager, - Globals.journalAbbreviationRepository); + Globals.entryTypesManager); List exporters = exporterFactory.getExporters().stream() .sorted(Comparator.comparing(Exporter::getName)) .filter(exporter -> SUPPORTED_FILETYPES.contains(exporter.getFileType())) @@ -118,7 +117,7 @@ private ExportResult exportToClipboard(Exporter exporter) throws Exception { entries.addAll(stateManager.getSelectedEntries()); // Write to file: - exporter.export(stateManager.getActiveDatabase().get(), tmp, entries, fileDirForDatabase); + exporter.export(stateManager.getActiveDatabase().get(), tmp, entries, fileDirForDatabase, Globals.journalAbbreviationRepository); // Read the file and put the contents on the clipboard: return new ExportResult(Files.readString(tmp), exporter.getFileType()); diff --git a/src/main/java/org/jabref/gui/exporter/WriteMetadataToPdfAction.java b/src/main/java/org/jabref/gui/exporter/WriteMetadataToPdfAction.java index eba71c64e59..44d1b56bf7c 100644 --- a/src/main/java/org/jabref/gui/exporter/WriteMetadataToPdfAction.java +++ b/src/main/java/org/jabref/gui/exporter/WriteMetadataToPdfAction.java @@ -21,6 +21,7 @@ import org.jabref.gui.DialogService; import org.jabref.gui.FXDialog; +import org.jabref.gui.Globals; import org.jabref.gui.StateManager; import org.jabref.gui.actions.SimpleCommand; import org.jabref.gui.util.BackgroundTask; @@ -196,7 +197,7 @@ synchronized private void writeMetadataToFile(Path file, BibEntry entry, BibData new XmpUtilWriter(xmpPreferences).writeXmp(file, entry, database); EmbeddedBibFilePdfExporter embeddedBibExporter = new EmbeddedBibFilePdfExporter(databaseContext.getMode(), entryTypesManager, fieldPreferences); - embeddedBibExporter.exportToFileByPath(databaseContext, database, filePreferences, file); + embeddedBibExporter.exportToFileByPath(databaseContext, database, filePreferences, file, Globals.journalAbbreviationRepository); } class OptionsDialog extends FXDialog { diff --git a/src/main/java/org/jabref/gui/externalfiles/ImportHandler.java b/src/main/java/org/jabref/gui/externalfiles/ImportHandler.java index b1741211be0..e8ec24a805a 100644 --- a/src/main/java/org/jabref/gui/externalfiles/ImportHandler.java +++ b/src/main/java/org/jabref/gui/externalfiles/ImportHandler.java @@ -313,7 +313,7 @@ private List tryImportFormats(String data) { preferencesService.getImportFormatPreferences(), fileUpdateMonitor); UnknownFormatImport unknownFormatImport = importFormatReader.importUnknownFormat(data); - return unknownFormatImport.parserResult.getDatabase().getEntries(); + return unknownFormatImport.parserResult().getDatabase().getEntries(); } catch (ImportException ex) { // ex is already localized dialogService.showErrorDialogAndWait(Localization.lang("Import error"), ex); return Collections.emptyList(); diff --git a/src/main/java/org/jabref/gui/fieldeditors/FieldEditors.java b/src/main/java/org/jabref/gui/fieldeditors/FieldEditors.java index 083c7717c9a..90a2b1b2f93 100644 --- a/src/main/java/org/jabref/gui/fieldeditors/FieldEditors.java +++ b/src/main/java/org/jabref/gui/fieldeditors/FieldEditors.java @@ -70,7 +70,7 @@ public static FieldEditorFX getForField(final Field field, } else if (field == StandardField.GROUPS) { return new GroupEditor(field, suggestionProvider, fieldCheckers, preferences, isMultiLine); } else if (fieldProperties.contains(FieldProperty.FILE_EDITOR)) { - return new LinkedFilesEditor(field, dialogService, databaseContext, taskExecutor, suggestionProvider, fieldCheckers, preferences); + return new LinkedFilesEditor(field, databaseContext, suggestionProvider, fieldCheckers); } else if (fieldProperties.contains(FieldProperty.YES_NO)) { return new OptionEditor<>(new YesNoEditorViewModel(field, suggestionProvider, fieldCheckers)); } else if (fieldProperties.contains(FieldProperty.MONTH)) { diff --git a/src/main/java/org/jabref/gui/fieldeditors/LinkedFilesEditor.fxml b/src/main/java/org/jabref/gui/fieldeditors/LinkedFilesEditor.fxml index 5f61cfd109c..f73bdc72290 100644 --- a/src/main/java/org/jabref/gui/fieldeditors/LinkedFilesEditor.fxml +++ b/src/main/java/org/jabref/gui/fieldeditors/LinkedFilesEditor.fxml @@ -23,8 +23,7 @@