Search in sources :

Example 1 with UpgradePdfPsToFileCleanup

use of org.jabref.logic.cleanup.UpgradePdfPsToFileCleanup in project jabref by JabRef.

the class FileLinksUpgradeWarning method upgradePdfPsToFile.

/**
     * Collect file links from the given set of fields, and add them to the list contained in the field
     * GUIGlobals.FILE_FIELD.
     *
     * @param database The database to modify.
     * @param fields   The fields to find links in.
     * @return A CompoundEdit specifying the undo operation for the whole operation.
     */
private static NamedCompound upgradePdfPsToFile(BibDatabase database) {
    NamedCompound ce = new NamedCompound(Localization.lang("Move external links to 'file' field"));
    UpgradePdfPsToFileCleanup cleanupJob = new UpgradePdfPsToFileCleanup();
    for (BibEntry entry : database.getEntries()) {
        List<FieldChange> changes = cleanupJob.cleanup(entry);
        for (FieldChange change : changes) {
            ce.addEdit(new UndoableFieldChange(change));
        }
    }
    ce.end();
    return ce;
}
Also used : BibEntry(org.jabref.model.entry.BibEntry) NamedCompound(org.jabref.gui.undo.NamedCompound) FieldChange(org.jabref.model.FieldChange) UndoableFieldChange(org.jabref.gui.undo.UndoableFieldChange) UndoableFieldChange(org.jabref.gui.undo.UndoableFieldChange) UpgradePdfPsToFileCleanup(org.jabref.logic.cleanup.UpgradePdfPsToFileCleanup)

Aggregations

NamedCompound (org.jabref.gui.undo.NamedCompound)1 UndoableFieldChange (org.jabref.gui.undo.UndoableFieldChange)1 UpgradePdfPsToFileCleanup (org.jabref.logic.cleanup.UpgradePdfPsToFileCleanup)1 FieldChange (org.jabref.model.FieldChange)1 BibEntry (org.jabref.model.entry.BibEntry)1