Top Fields Constructors Methods
org.jabref.migrations

public Class PreferencesMigrations

extends Object
Class Inheritance
Imports
java.util.ArrayList, .Collections, .EnumSet, .HashMap, .LinkedHashSet, .List, .Map, .Optional, .Set, java.util.function.UnaryOperator, java.util.prefs.BackingStoreException, .Preferences, java.util.stream.Collectors, javafx.scene.control.TableColumn, org.jabref.gui.entryeditor.CommentsTab, .EntryEditor, org.jabref.gui.maintable.ColumnPreferences, .MainTableColumnModel, org.jabref.logic.citationkeypattern.GlobalCitationKeyPatterns, org.jabref.logic.cleanup.FieldFormatterCleanups, org.jabref.logic.shared.security.Password, org.jabref.logic.util.OS, org.jabref.model.entry.BibEntryTypesManager, org.jabref.model.entry.field.SpecialField, .StandardField, org.jabref.model.entry.types.EntryTypeFactory, org.jabref.model.strings.StringUtil, org.jabref.preferences.CleanupPreferences, .JabRefPreferences, com.github.javakeyring.Keyring, org.slf4j.Logger, .LoggerFactory

Field Summary

Modifier and TypeField and Description
private static final Logger

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
private static void
pack-priv static void
private static void
private static void
migrateFileImportPattern(String oldStylePattern, String newStylePattern, JabRefPreferences prefs, Preferences mainPrefsNode)

Migrate Import File Name and Directory name Patterns from versions <=4.0 to new BracketedPatterns

private static void
pack-priv static void
pack-priv static void
removeCommentsFromCustomEditorTabs(JabRefPreferences preferences)

The tab "Comments" is hard coded using CommentsTab since v5.10 (and thus hard-wired in EntryEditor#createTabs().

pack-priv static void
restoreVariablesForBackwardCompatibility(JabRefPreferences preferences)

In 5.0 the format of column names have changed.

public static void
runMigrations(JabRefPreferences preferences, BibEntryTypesManager entryTypesManager)

Perform checks and changes for users with a preference set from an older JabRef version.

private static void
upgradeCleanups(JabRefPreferences prefs)

In version 6.0 the formatting of the CleanUps preferences changed.

pack-priv static void
upgradeColumnPreferences(JabRefPreferences preferences)

The former preferences default of columns was a simple list of strings ("author;title;year;...").

private static void
upgradeFaultyEncodingStrings(JabRefPreferences prefs)

Added from Jabref 2.11 beta 4 onwards to fix wrong encoding names

pack-priv static void
private static void
private static void
upgradeLabelPatternToCitationKeyPattern(JabRefPreferences prefs, Preferences mainPrefsNode)

Migrate LabelPattern configuration from versions <=3.5 to new CitationKeyPatterns.

private static void
upgradePrefsToOrgJabRef(Preferences mainPrefsNode)

Migrate all preferences from net/sf/jabref to org/jabref

protected static void
upgradePreviewStyle(JabRefPreferences prefs)

Customizable preview style migrations

  • Since v5.0-alpha the custom preview layout shows the 'comment' field instead of the 'review' field (#4100).
  • Since v5.1 a marker enables markdown in comments (#6232).
  • Since v5.2 'bibtexkey' is rebranded as citationkey (#6875).
private static void
upgradeSortOrder(JabRefPreferences prefs)

Upgrade the sort order preferences for the current version The old preference is kept in case an old version of JabRef is used with these preferences, but it is only used when the new preference does not exist

private static void
upgradeStoredBibEntryTypes(JabRefPreferences prefs, Preferences mainPrefsNode, BibEntryTypesManager entryTypesManager)

Migrate all customized entry types from versions <=3.7

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

LOGGERback to summary
private static final Logger LOGGER

Constructor Detail

PreferencesMigrationsback to summary
private PreferencesMigrations()

Method Detail

addCrossRefRelatedFieldsForAutoCompleteback to summary
private static void addCrossRefRelatedFieldsForAutoComplete(JabRefPreferences prefs)
changeColumnVariableNamesFor51back to summary
pack-priv static void changeColumnVariableNamesFor51(JabRefPreferences preferences)
copyPrefsRecursivelyback to summary
private static void copyPrefsRecursively(Preferences from, Preferences to) throws BackingStoreException
migrateFileImportPatternback to summary
private static void migrateFileImportPattern(String oldStylePattern, String newStylePattern, JabRefPreferences prefs, Preferences mainPrefsNode)

Migrate Import File Name and Directory name Patterns from versions <=4.0 to new BracketedPatterns

migrateTypedKeyPrefsback to summary
private static void migrateTypedKeyPrefs(JabRefPreferences prefs, Preferences oldPatternPrefs) throws BackingStoreException
moveApiKeysToKeyringback to summary
pack-priv static void moveApiKeysToKeyring(JabRefPreferences preferences)
removeCommentsFromCustomEditorTabsback to summary
pack-priv static void removeCommentsFromCustomEditorTabs(JabRefPreferences preferences)

The tab "Comments" is hard coded using CommentsTab since v5.10 (and thus hard-wired in EntryEditor#createTabs(). Thus, the configuration ih the preferences is obsolete

restoreVariablesForBackwardCompatibilityback to summary
pack-priv static void restoreVariablesForBackwardCompatibility(JabRefPreferences preferences)

In 5.0 the format of column names have changed. That made newer versions of JabRef preferences incompatible with earlier versions of JabRef. As some complains came up, we decided to change the variable names and to clear the variable contents if they are unreadable, so former versions of JabRef would automatically create preferences they can deal with.

runMigrationsback to summary
public static void runMigrations(JabRefPreferences preferences, BibEntryTypesManager entryTypesManager)

Perform checks and changes for users with a preference set from an older JabRef version.

upgradeCleanupsback to summary
private static void upgradeCleanups(JabRefPreferences prefs)

In version 6.0 the formatting of the CleanUps preferences changed. Instead of using several keys that have have a variable name a single preference key is introduced containing just the active cleanup jobs. Also instead of a combined field for the field formatters and the enabled status of all of them, they are split for easier parsing.

Changes:

key value
CLEANUP - old format:
CleanUpCLEAN_UP_DOI enabled
CleanUpRENAME_PDF disabled
CleanUpMOVE_PDF enabled
...
 
CLEANUP_JOBS - new format:
CleanUpJobs CLEAN_UP_DOI;RENAME_PDF;MOVE_PDF
 
CLEANUP_FORMATTERS - old format:
CleanUpFormatters ENABLED\nfield[formatter,formatter...]\nfield[...]\nfield[...]...
 
CLEANUP_FORMATTERS - new format:
CleanUpFormattersEnabled TRUE
CleanUpFormatters field[formatter,formatter...]\nfield[...]\nfield[...]...
upgradeColumnPreferencesback to summary
pack-priv static void upgradeColumnPreferences(JabRefPreferences preferences)

The former preferences default of columns was a simple list of strings ("author;title;year;..."). Since 5.0 the preferences store the type of the column too, so that the formerly hardwired columns like the graphic groups column or the other icon columns can be reordered in the main table and behave like any other field column ("groups;linked_id;field:author;special:readstatus;extrafile:pdf;...").

Simple strings are by default parsed as a FieldColumn, so there is nothing to do there, but the formerly hard wired columns need to be added.

In 5.1 variable names in JabRefPreferences have changed to offer backward compatibility with pre 5.0 releases Pre 5.1: columnNames, columnWidths, columnSortTypes, columnSortOrder Since 5.1: mainTableColumnNames, mainTableColumnWidths, mainTableColumnSortTypes, mainTableColumnSortOrder

upgradeFaultyEncodingStringsback to summary
private static void upgradeFaultyEncodingStrings(JabRefPreferences prefs)

Added from Jabref 2.11 beta 4 onwards to fix wrong encoding names

upgradeImportFileAndDirePatternsback to summary
pack-priv static void upgradeImportFileAndDirePatterns(JabRefPreferences prefs, Preferences mainPrefsNode)
upgradeKeyBindingsToJavaFXback to summary
private static void upgradeKeyBindingsToJavaFX(JabRefPreferences prefs)
upgradeLabelPatternToCitationKeyPatternback to summary
private static void upgradeLabelPatternToCitationKeyPattern(JabRefPreferences prefs, Preferences mainPrefsNode)

Migrate LabelPattern configuration from versions <=3.5 to new CitationKeyPatterns.

Introduced in #1704

upgradePrefsToOrgJabRefback to summary
private static void upgradePrefsToOrgJabRef(Preferences mainPrefsNode)

Migrate all preferences from net/sf/jabref to org/jabref

upgradePreviewStyleback to summary
protected static void upgradePreviewStyle(JabRefPreferences prefs)

Customizable preview style migrations

  • Since v5.0-alpha the custom preview layout shows the 'comment' field instead of the 'review' field (#4100).
  • Since v5.1 a marker enables markdown in comments (#6232).
  • Since v5.2 'bibtexkey' is rebranded as citationkey (#6875).
upgradeSortOrderback to summary
private static void upgradeSortOrder(JabRefPreferences prefs)

Upgrade the sort order preferences for the current version The old preference is kept in case an old version of JabRef is used with these preferences, but it is only used when the new preference does not exist

upgradeStoredBibEntryTypesback to summary
private static void upgradeStoredBibEntryTypes(JabRefPreferences prefs, Preferences mainPrefsNode, BibEntryTypesManager entryTypesManager)

Migrate all customized entry types from versions <=3.7