From e9c5a54b8b7ea364175e8a4eb034b26f18e418df Mon Sep 17 00:00:00 2001 From: Oliver Kopp Date: Tue, 12 Mar 2024 15:13:36 +0100 Subject: [PATCH 1/4] Remove obsolete "Comments" tab configuration --- .../org/jabref/preferences/JabRefPreferences.java | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/main/java/org/jabref/preferences/JabRefPreferences.java b/src/main/java/org/jabref/preferences/JabRefPreferences.java index d4a9e64016c..1da58ce0989 100644 --- a/src/main/java/org/jabref/preferences/JabRefPreferences.java +++ b/src/main/java/org/jabref/preferences/JabRefPreferences.java @@ -22,6 +22,7 @@ import java.util.Map; import java.util.Objects; import java.util.Optional; +import java.util.SequencedMap; import java.util.Set; import java.util.TreeSet; import java.util.UUID; @@ -835,10 +836,6 @@ public void setLanguageDependentDefaultValues() { defaults.put(CUSTOM_TAB_FIELDS + "_def1", StandardField.ABSTRACT.getName()); defaults.put(CUSTOM_TAB_NAME + "_def1", Localization.lang("Abstract")); - // Entry editor tab 2: Comments Field - used for research comments, etc. - defaults.put(CUSTOM_TAB_FIELDS + "_def2", StandardField.COMMENT.getName()); - defaults.put(CUSTOM_TAB_NAME + "_def2", Localization.lang("Comments")); - defaults.put(EMAIL_SUBJECT, Localization.lang("References")); } @@ -1508,7 +1505,7 @@ private Map> getEntryEditorTabs() { List tabFields = getSeries(CUSTOM_TAB_FIELDS); if (tabNames.isEmpty() || (tabNames.size() != tabFields.size())) { - // Nothing set, so we use the default values + // Nothing set (or wrong configuration), then we use default values tabNames = getSeries(CUSTOM_TAB_NAME + "_def"); tabFields = getSeries(CUSTOM_TAB_FIELDS + "_def"); } @@ -1543,8 +1540,8 @@ private void storeEntryEditorTabs(Map> customTabs) { getEntryEditorTabs(); } - private Map> getDefaultEntryEditorTabs() { - Map> customTabsMap = new LinkedHashMap<>(); + private SequencedMap> getDefaultEntryEditorTabs() { + SequencedMap> customTabsMap = new LinkedHashMap<>(); int defNumber = 0; while (true) { From 1ec69e82935d93020aebe92b9519c0c1225cc873 Mon Sep 17 00:00:00 2001 From: Oliver Kopp Date: Tue, 12 Mar 2024 15:46:59 +0100 Subject: [PATCH 2/4] Fix typo --- src/main/java/org/jabref/migrations/PreferencesMigrations.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/jabref/migrations/PreferencesMigrations.java b/src/main/java/org/jabref/migrations/PreferencesMigrations.java index e9a673f4b3b..1aeb29c8e0e 100644 --- a/src/main/java/org/jabref/migrations/PreferencesMigrations.java +++ b/src/main/java/org/jabref/migrations/PreferencesMigrations.java @@ -57,7 +57,7 @@ public static void runMigrations(JabRefPreferences preferences, BibEntryTypesMan addCrossRefRelatedFieldsForAutoComplete(preferences); upgradePreviewStyle(preferences); // changeColumnVariableNamesFor51 needs to be run before upgradeColumnPre50Preferences to ensure - // backwardcompatibility, as it copies the old values to new variable names and keeps th old sored with the old + // backward compatibility, as it copies the old values to new variable names and keeps th old sored with the old // variable names. However, the variables from 5.0 need to be copied to the new variable name too. changeColumnVariableNamesFor51(preferences); upgradeColumnPreferences(preferences); From 93aee8d79049957b7c02c17763d92e716f8680dc Mon Sep 17 00:00:00 2001 From: Oliver Kopp Date: Tue, 12 Mar 2024 15:51:04 +0100 Subject: [PATCH 3/4] Add migration --- .../org/jabref/migrations/PreferencesMigrations.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/main/java/org/jabref/migrations/PreferencesMigrations.java b/src/main/java/org/jabref/migrations/PreferencesMigrations.java index 1aeb29c8e0e..e97e8be8d96 100644 --- a/src/main/java/org/jabref/migrations/PreferencesMigrations.java +++ b/src/main/java/org/jabref/migrations/PreferencesMigrations.java @@ -16,6 +16,8 @@ import javafx.scene.control.TableColumn; +import org.jabref.gui.entryeditor.CommentsTab; +import org.jabref.gui.entryeditor.EntryEditor; import org.jabref.gui.maintable.ColumnPreferences; import org.jabref.gui.maintable.MainTableColumnModel; import org.jabref.logic.citationkeypattern.GlobalCitationKeyPattern; @@ -64,6 +66,7 @@ public static void runMigrations(JabRefPreferences preferences, BibEntryTypesMan restoreVariablesForBackwardCompatibility(preferences); upgradeCleanups(preferences); moveApiKeysToKeyring(preferences); + removeCommentsFromCustomEditorTabs(preferences); } /** @@ -545,4 +548,12 @@ static void moveApiKeysToKeyring(JabRefPreferences preferences) { } } } + + /** + * The tab "Comments" is now hard coded using {@link CommentsTab} (and thus hard-wired in {@link EntryEditor#createTabs()}. + * Thus, the configuration ih the preferences is obsolete + */ + static void removeCommentsFromCustomEditorTabs(JabRefPreferences preferences) { + preferences.getEntryEditorPreferences().getEntryEditorTabs().remove("Comments"); + } } From c4e50ac7b0987c90ee759aca68453ad723269ba4 Mon Sep 17 00:00:00 2001 From: Carl Christian Snethlage <50491877+calixtus@users.noreply.github.com> Date: Tue, 12 Mar 2024 18:27:28 +0100 Subject: [PATCH 4/4] Add version info --- src/main/java/org/jabref/migrations/PreferencesMigrations.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/jabref/migrations/PreferencesMigrations.java b/src/main/java/org/jabref/migrations/PreferencesMigrations.java index e97e8be8d96..e9f30abc050 100644 --- a/src/main/java/org/jabref/migrations/PreferencesMigrations.java +++ b/src/main/java/org/jabref/migrations/PreferencesMigrations.java @@ -550,7 +550,7 @@ static void moveApiKeysToKeyring(JabRefPreferences preferences) { } /** - * The tab "Comments" is now hard coded using {@link CommentsTab} (and thus hard-wired in {@link EntryEditor#createTabs()}. + * The tab "Comments" is hard coded using {@link CommentsTab} since v5.10 (and thus hard-wired in {@link EntryEditor#createTabs()}. * Thus, the configuration ih the preferences is obsolete */ static void removeCommentsFromCustomEditorTabs(JabRefPreferences preferences) {