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

Jabref enhancer #4858

Closed
Closed
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
16 changes: 14 additions & 2 deletions src/main/java/org/jabref/logic/importer/OpenDatabase.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@
import java.util.List;

import org.jabref.logic.importer.fileformat.BibtexImporter;
import org.jabref.logic.importer.fileformat.PdfContentImporter;
import org.jabref.logic.l10n.Localization;
import org.jabref.logic.specialfields.SpecialFieldsUtils;
import org.jabref.migrations.ConvertLegacyExplicitGroups;
import org.jabref.migrations.ConvertMarkingToGroups;
import org.jabref.migrations.PostOpenMigration;
import org.jabref.model.database.BibDatabaseMode;
import org.jabref.model.entry.BibEntry;
import org.jabref.model.util.FileUpdateMonitor;

Expand Down Expand Up @@ -64,8 +66,18 @@ public static ParserResult loadDatabase(String name, ImportFormatPreferences imp
*/
public static ParserResult loadDatabase(File fileToOpen, ImportFormatPreferences importFormatPreferences, FileUpdateMonitor fileMonitor)
throws IOException {
ParserResult result = new BibtexImporter(importFormatPreferences, fileMonitor).importDatabase(fileToOpen.toPath(),
importFormatPreferences.getEncoding());

//pdf integration for getting the bibliography

ParserResult result;
if(fileToOpen.getName().endsWith(".pdf")){
result = new PdfContentImporter(importFormatPreferences).importDatabase(fileToOpen.toPath(),
importFormatPreferences.getEncoding());
} else{
result = new BibtexImporter(importFormatPreferences, fileMonitor).importDatabase(fileToOpen.toPath(),
importFormatPreferences.getEncoding());
}


if (importFormatPreferences.isKeywordSyncEnabled()) {
for (BibEntry entry : result.getDatabase().getEntries()) {
Expand Down