Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename "lookup fulltext" to "download fulltext" #5667

Merged
merged 1 commit into from
Nov 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions src/main/java/org/jabref/gui/BasePanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand All @@ -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) {
Expand All @@ -87,7 +87,7 @@ protected Map<BibEntry, Optional<URL>> 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);

Expand All @@ -100,17 +100,15 @@ private void downloadFullTexts(Map<BibEntry, Optional<URL>> downloads) {
Optional<URL> result = download.getValue();
if (result.isPresent()) {
Optional<Path> 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"))));
Expand All @@ -130,15 +128,14 @@ 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,
basePanel.getBibDatabaseContext(),
Globals.TASK_EXECUTOR,
dialogService,
JabRefPreferences.getInstance().getXMPPreferences(),
JabRefPreferences.getInstance().getFilePreferences(),
JabRefPreferences.getInstance().getFilePreferences(),
ExternalFileTypes.getInstance());

try {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/jabref/gui/keyboard/KeyBinding.java
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/l10n/JabRef_en.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down