diff --git a/src/main/java/org/jabref/migrations/PreferencesMigrations.java b/src/main/java/org/jabref/migrations/PreferencesMigrations.java index e9a673f4b3b..e9f30abc050 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; @@ -57,13 +59,14 @@ 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); restoreVariablesForBackwardCompatibility(preferences); upgradeCleanups(preferences); moveApiKeysToKeyring(preferences); + removeCommentsFromCustomEditorTabs(preferences); } /** @@ -545,4 +548,12 @@ static void moveApiKeysToKeyring(JabRefPreferences preferences) { } } } + + /** + * 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) { + preferences.getEntryEditorPreferences().getEntryEditorTabs().remove("Comments"); + } } 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) {