Skip to content

Commit

Permalink
Merge branch 'master' of git://github.com/PedroPerozin/jabref into fi…
Browse files Browse the repository at this point in the history
…xlookupfulltext

* 'master' of git://github.com/PedroPerozin/jabref:
  Change variable name Issue#3874
  Fix import order Issue #3874
  Fix checkstyle Issue #3874
  Fix travis
  Fix issue #3874
  • Loading branch information
Siedlerchr committed Aug 24, 2019
2 parents 4477a13 + 88118f4 commit 33fb6c5
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/main/java/org/jabref/gui/externalfiles/FindFullTextAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import java.net.MalformedURLException;
import java.net.URL;
import java.nio.file.Path;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.concurrent.ConcurrentHashMap;
Expand All @@ -16,6 +17,7 @@
import org.jabref.gui.externalfiletype.ExternalFileTypes;
import org.jabref.gui.fieldeditors.LinkedFileViewModel;
import org.jabref.gui.fieldeditors.LinkedFilesEditorViewModel;
import org.jabref.gui.undo.NamedCompound;
import org.jabref.gui.util.BackgroundTask;
import org.jabref.logic.importer.FulltextFetchers;
import org.jabref.logic.l10n.Localization;
Expand Down Expand Up @@ -70,14 +72,20 @@ public void execute() {
}
}

Task<Map<BibEntry, Optional<URL>>> findFullTextsTask = new Task<Map<BibEntry, Optional<URL>>>() {
Task<Map<BibEntry, Optional<URL>>> findFullTextsTask = new Task<Map<BibEntry, Optional<URL>>>() {
@Override
protected Map<BibEntry, Optional<URL>> call() {
Map<BibEntry, Optional<URL>> downloads = new ConcurrentHashMap<>();
int count = 0;
AutoSetFileLinksUtil util = new AutoSetFileLinksUtil(basePanel.getBibDatabaseContext(), Globals.prefs.getFilePreferences(), Globals.prefs.getAutoLinkPreferences(), ExternalFileTypes.getInstance());
util.linkAssociatedFiles(basePanel.getSelectedEntries(), new NamedCompound(""));

for (BibEntry entry : basePanel.getSelectedEntries()) {
FulltextFetchers fetchers = new FulltextFetchers(Globals.prefs.getImportFormatPreferences());
downloads.put(entry, fetchers.findFullTextPDF(entry));
List<LinkedFile> fileList = entry.getFiles();
if (fileList.isEmpty()) {
FulltextFetchers fetchers = new FulltextFetchers(Globals.prefs.getImportFormatPreferences());
downloads.put(entry, fetchers.findFullTextPDF(entry));
}
updateProgress(++count, basePanel.getSelectedEntries().size());
}
return downloads;
Expand Down

0 comments on commit 33fb6c5

Please sign in to comment.