Skip to content

Commit 9ec9cf4

Browse files
authored
Add SpecialFieldsPreferences reset handling in clear() and importPreferences()
- Added getSpecialFieldsPreferences().setAll() call in clear() method - Added getSpecialFieldsPreferencesFromBackingStore() helper method - Added reset handling in importPreferences() method Fixes #14409
1 parent 209f8e0 commit 9ec9cf4

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

jabgui/src/main/java/org/jabref/gui/preferences/JabRefGuiPreferences.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -414,6 +414,7 @@ public void clear() throws BackingStoreException {
414414

415415
getWorkspacePreferences().setAll(WorkspacePreferences.getDefault());
416416
getGuiPreferences().setAll(CoreGuiPreferences.getDefault());
417+
getSpecialFieldsPreferences().setAll(SpecialFieldsPreferences.getDefault());
417418
}
418419

419420
@Override
@@ -423,6 +424,7 @@ public void importPreferences(Path file) throws JabRefException {
423424
// in case of incomplete or corrupt xml fall back to current preferences
424425
getWorkspacePreferences().setAll(getWorkspacePreferencesFromBackingStore(getWorkspacePreferences()));
425426
getGuiPreferences().setAll(getCoreGuiPreferencesFromBackingStore(getGuiPreferences()));
427+
getSpecialFieldsPreferences().setAll(getSpecialFieldsPreferencesFromBackingStore(getSpecialFieldsPreferences()));
426428
}
427429

428430
// region EntryEditorPreferences
@@ -856,6 +858,11 @@ public SpecialFieldsPreferences getSpecialFieldsPreferences() {
856858
return specialFieldsPreferences;
857859
}
858860

861+
private SpecialFieldsPreferences getSpecialFieldsPreferencesFromBackingStore(SpecialFieldsPreferences defaults) {
862+
return new SpecialFieldsPreferences(
863+
getBoolean(SPECIALFIELDSENABLED, defaults.isSpecialFieldsEnabled()));
864+
}
865+
859866
// region Preview preferences
860867
public PreviewPreferences getPreviewPreferences() {
861868
if (previewPreferences != null) {

0 commit comments

Comments
 (0)