Verified Owner
Top Description Fields Constructors Methods
org.jabref.gui.maintable

public Class ExtractReferencesAction

extends SimpleCommand
Class Inheritance
Imports
java.nio.file.Path, java.util.Iterator, .List, .Optional, .StringJoiner, java.util.concurrent.Callable, java.util.regex.Matcher, .Pattern, org.jabref.gui.DialogService, .StateManager, org.jabref.gui.actions.ActionHelper, .SimpleCommand, org.jabref.gui.importer.ImportEntriesDialog, org.jabref.gui.util.UiTaskExecutor, org.jabref.logic.importer.ParserResult, org.jabref.logic.importer.fileformat.pdf.RuleBasedBibliographyPdfImporter, org.jabref.logic.importer.util.GrobidService, org.jabref.logic.l10n.Localization, org.jabref.logic.preferences.CliPreferences, org.jabref.logic.util.BackgroundTask, org.jabref.logic.util.io.FileUtil, org.jabref.model.database.BibDatabaseContext, org.jabref.model.entry.BibEntry, .LinkedFile, org.jabref.model.entry.field.StandardField, org.jabref.model.undo.UndoableFieldChange, org.jspecify.annotations.NonNull, .Nullable

SIDE EFFECT: Sets the "cites" field of the entry having the linked files

The mode is selected by the preferences whether to use Grobid or not.

Field Summary

Modifier and TypeField and Description
private static final Pattern
private final DialogService
private final BibEntry
private final int
private final CliPreferences
private final RuleBasedBibliographyPdfImporter
private final StateManager
Inherited from org.jabref.gui.actions.SimpleCommand:
statusMessage

Constructor Summary

AccessConstructor and Description
public
ExtractReferencesAction(DialogService dialogService, StateManager stateManager, CliPreferences preferences)

private
ExtractReferencesAction(@NonNull DialogService dialogService, @NonNull StateManager stateManager, @NonNull CliPreferences preferences, @Nullable BibEntry
the entry to handle (can be null)
entry
,
@Nullable LinkedFile
the linked file (can be null)
linkedFile
)

Can be used to bind the action on a context menu in the linked file view (future work)

Method Summary

Modifier and TypeMethod and Description
public void
private void
private void
extractReferences(BibDatabaseContext databaseContext, Iterator<Path> fileListIterator, ParserResult result, BibEntry currentEntry)

private static String
getCites(List<BibEntry> entries, BibEntry
used to create citation keys if the importer did not provide one from the imported entry
currentEntry
)

Creates the field content for the "cites" field.

private @NonNull Callable<ParserResult>
private Optional<Callable<ParserResult>>
Inherited from org.jabref.gui.actions.SimpleCommand:
getProgressprogressPropertysetExecutablestatusMessageProperty

Field Detail

COMMENT_NUMBER_PATTERNback to summary
private static final Pattern COMMENT_NUMBER_PATTERN
dialogServiceback to summary
private final DialogService dialogService
entryback to summary
private final BibEntry entry
FILES_LIMITback to summary
private final int FILES_LIMIT
preferencesback to summary
private final CliPreferences preferences
ruleBasedBibliographyPdfImporterback to summary
private final RuleBasedBibliographyPdfImporter ruleBasedBibliographyPdfImporter
stateManagerback to summary
private final StateManager stateManager

Constructor Detail

ExtractReferencesActionback to summary
public ExtractReferencesAction(DialogService dialogService, StateManager stateManager, CliPreferences preferences)
ExtractReferencesActionback to summary
private ExtractReferencesAction(@NonNull DialogService dialogService, @NonNull StateManager stateManager, @NonNull CliPreferences preferences, @Nullable BibEntry entry, @Nullable LinkedFile linkedFile)

Can be used to bind the action on a context menu in the linked file view (future work)

Parameters
entry:@Nullable BibEntry

the entry to handle (can be null)

linkedFile:@Nullable LinkedFile

the linked file (can be null)

Method Detail

executeback to summary
public void execute()
Annotations
@Override
extractReferencesback to summary
private void extractReferences()
extractReferencesback to summary
private void extractReferences(BibDatabaseContext databaseContext, Iterator<Path> fileListIterator, ParserResult result, BibEntry currentEntry)
getCitesback to summary
private static String getCites(List<BibEntry> entries, BibEntry currentEntry)

Creates the field content for the "cites" field. The field contains the citation keys of the imported entries.

Todo

Move this part to logic somehow

Parameters
currentEntry:BibEntry

used to create citation keys if the importer did not provide one from the imported entry

getParserResultCallableOfflineback to summary
private @NonNull Callable<ParserResult> getParserResultCallableOffline(BibDatabaseContext databaseContext, List<BibEntry> selectedEntries)
getParserResultCallableOnlineback to summary
private Optional<Callable<ParserResult>> getParserResultCallableOnline(BibDatabaseContext databaseContext, List<BibEntry> selectedEntries)