From d0d3d0b4fdef003a7622cee05dd3939132e94633 Mon Sep 17 00:00:00 2001 From: Tobias Diez Date: Sun, 24 Nov 2019 22:45:00 +0100 Subject: [PATCH] Rename "lookup fulltext" to "download fulltext" (#5667) Closes #3874 and surpasses #5216. --- src/main/java/org/jabref/gui/BasePanel.java | 4 +-- ...ction.java => DownloadFullTextAction.java} | 25 ++++++++----------- .../org/jabref/gui/keyboard/KeyBinding.java | 2 +- src/main/resources/l10n/JabRef_en.properties | 4 +-- 4 files changed, 16 insertions(+), 19 deletions(-) rename src/main/java/org/jabref/gui/externalfiles/{FindFullTextAction.java => DownloadFullTextAction.java} (92%) diff --git a/src/main/java/org/jabref/gui/BasePanel.java b/src/main/java/org/jabref/gui/BasePanel.java index ec5a32d541b..c0c9731f703 100644 --- a/src/main/java/org/jabref/gui/BasePanel.java +++ b/src/main/java/org/jabref/gui/BasePanel.java @@ -41,7 +41,7 @@ import org.jabref.gui.entryeditor.EntryEditor; import org.jabref.gui.exporter.SaveDatabaseAction; import org.jabref.gui.exporter.WriteXMPAction; -import org.jabref.gui.externalfiles.FindFullTextAction; +import org.jabref.gui.externalfiles.DownloadFullTextAction; import org.jabref.gui.externalfiletype.ExternalFileType; import org.jabref.gui.externalfiletype.ExternalFileTypes; import org.jabref.gui.importer.actions.AppendDatabaseAction; @@ -371,7 +371,7 @@ private void setupActions() { actions.put(Actions.ABBREVIATE_SHORTEST_UNIQUE, new AbbreviateAction(this, AbbreviationType.SHORTEST_UNIQUE)); actions.put(Actions.UNABBREVIATE, new UnabbreviateAction(this)); - actions.put(Actions.DOWNLOAD_FULL_TEXT, new FindFullTextAction(this)::execute); + actions.put(Actions.DOWNLOAD_FULL_TEXT, new DownloadFullTextAction(this)::execute); } /** diff --git a/src/main/java/org/jabref/gui/externalfiles/FindFullTextAction.java b/src/main/java/org/jabref/gui/externalfiles/DownloadFullTextAction.java similarity index 92% rename from src/main/java/org/jabref/gui/externalfiles/FindFullTextAction.java rename to src/main/java/org/jabref/gui/externalfiles/DownloadFullTextAction.java index 4e47d41b61d..ea8b661957c 100644 --- a/src/main/java/org/jabref/gui/externalfiles/FindFullTextAction.java +++ b/src/main/java/org/jabref/gui/externalfiles/DownloadFullTextAction.java @@ -30,16 +30,16 @@ /** * Try to download fulltext PDF for selected entry(ies) by following URL or DOI link. */ -public class FindFullTextAction extends SimpleCommand { +public class DownloadFullTextAction extends SimpleCommand { - private static final Logger LOGGER = LoggerFactory.getLogger(FindFullTextAction.class); + private static final Logger LOGGER = LoggerFactory.getLogger(DownloadFullTextAction.class); // The minimum number of selected entries to ask the user for confirmation private static final int WARNING_LIMIT = 5; private final BasePanel basePanel; private final DialogService dialogService; - public FindFullTextAction(BasePanel basePanel) { + public DownloadFullTextAction(BasePanel basePanel) { this.basePanel = basePanel; this.dialogService = basePanel.frame().getDialogService(); } @@ -54,14 +54,14 @@ public void execute() { if (basePanel.getSelectedEntries().size() >= WARNING_LIMIT) { boolean confirmDownload = dialogService.showConfirmationDialogAndWait( - Localization.lang("Look up full text documents"), + Localization.lang("Download full text documents"), Localization.lang( - "You are about to look up full text documents for %0 entries.", + "You are about to download full text documents for %0 entries.", String.valueOf(basePanel.getSelectedEntries().size())) + "\n" + Localization.lang("JabRef will send at least one request per entry to a publisher.") + "\n" + Localization.lang("Do you still want to continue?"), - Localization.lang("Look up full text documents"), + Localization.lang("Download full text documents"), Localization.lang("Cancel")); if (!confirmDownload) { @@ -87,7 +87,7 @@ protected Map> call() { findFullTextsTask.setOnSucceeded(value -> downloadFullTexts(findFullTextsTask.getValue())); dialogService.showProgressDialogAndWait( - Localization.lang("Look up full text documents"), + Localization.lang("Download full text documents"), Localization.lang("Looking for full text document..."), findFullTextsTask); @@ -100,17 +100,15 @@ private void downloadFullTexts(Map> downloads) { Optional result = download.getValue(); if (result.isPresent()) { Optional dir = basePanel.getBibDatabaseContext().getFirstExistingFileDir(Globals.prefs.getFilePreferences()); - - if (!dir.isPresent()) { - + if (dir.isEmpty()) { dialogService.showErrorDialogAndWait(Localization.lang("Directory not found"), Localization.lang("Main file directory not set!") + " " + Localization.lang("Preferences") + " -> " + Localization.lang("File")); return; } - //Download and link full text - addLinkedFileFromURL(result.get(), entry, dir.get()); + // Download and link full text + addLinkedFileFromURL(result.get(), entry, dir.get()); } else { dialogService.notify(Localization.lang("No full text document found for entry %0.", entry.getCiteKeyOptional().orElse(Localization.lang("undefined")))); @@ -130,7 +128,6 @@ private void addLinkedFileFromURL(URL url, BibEntry entry, Path targetDirectory) LinkedFile newLinkedFile = new LinkedFile(url, ""); if (!entry.getFiles().contains(newLinkedFile)) { - LinkedFileViewModel onlineFile = new LinkedFileViewModel( newLinkedFile, entry, @@ -138,7 +135,7 @@ private void addLinkedFileFromURL(URL url, BibEntry entry, Path targetDirectory) Globals.TASK_EXECUTOR, dialogService, JabRefPreferences.getInstance().getXMPPreferences(), - JabRefPreferences.getInstance().getFilePreferences(), + JabRefPreferences.getInstance().getFilePreferences(), ExternalFileTypes.getInstance()); try { diff --git a/src/main/java/org/jabref/gui/keyboard/KeyBinding.java b/src/main/java/org/jabref/gui/keyboard/KeyBinding.java index 41cdde8a12b..17d5e6aef88 100644 --- a/src/main/java/org/jabref/gui/keyboard/KeyBinding.java +++ b/src/main/java/org/jabref/gui/keyboard/KeyBinding.java @@ -26,7 +26,7 @@ public enum KeyBinding { DECREASE_TABLE_FONT_SIZE("Decrease table font size", Localization.lang("Decrease table font size"), "ctrl+MINUS", KeyBindingCategory.VIEW), DELETE_ENTRY("Delete entry", Localization.lang("Delete entry"), "DELETE", KeyBindingCategory.BIBTEX), DEFAULT_DIALOG_ACTION("Execute default action in dialog", Localization.lang("Execute default action in dialog"), "ctrl+ENTER", KeyBindingCategory.VIEW), - DOWNLOAD_FULL_TEXT("Look up full text documents", Localization.lang("Look up full text documents"), "alt+F7", KeyBindingCategory.QUALITY), + DOWNLOAD_FULL_TEXT("Download full text documents", Localization.lang("Download full text documents"), "alt+F7", KeyBindingCategory.QUALITY), EDIT_ENTRY("Edit entry", Localization.lang("Edit entry"), "ctrl+E", KeyBindingCategory.BIBTEX), EXPORT("Export", Localization.lang("Export"), "ctrl+alt+e", KeyBindingCategory.FILE), EXPORT_SELECTED("Export Selected", Localization.lang("Export selected entries"), "ctrl+shift+e", KeyBindingCategory.FILE), diff --git a/src/main/resources/l10n/JabRef_en.properties b/src/main/resources/l10n/JabRef_en.properties index c1eafb2c00d..086fdc698d9 100644 --- a/src/main/resources/l10n/JabRef_en.properties +++ b/src/main/resources/l10n/JabRef_en.properties @@ -1722,8 +1722,8 @@ See\ what\ has\ been\ changed\ in\ the\ JabRef\ versions=See what has been chang Referenced\ BibTeX\ key\ does\ not\ exist=Referenced BibTeX key does not exist Full\ text\ document\ for\ entry\ %0\ already\ linked.=Full text document for entry %0 already linked. Finished\ downloading\ full\ text\ document\ for\ entry\ %0.=Finished downloading full text document for entry %0. -Look\ up\ full\ text\ documents=Look up full text documents -You\ are\ about\ to\ look\ up\ full\ text\ documents\ for\ %0\ entries.=You are about to look up full text documents for %0 entries. +Download\ full\ text\ documents=Download full text documents +You\ are\ about\ to\ download\ full\ text\ documents\ for\ %0\ entries.=You are about to download full text documents for %0 entries. last\ four\ nonpunctuation\ characters\ should\ be\ numerals=last four nonpunctuation characters should be numerals Author=Author