From 830282a0614661505c73aec20662143abbea161c Mon Sep 17 00:00:00 2001 From: tomlin Date: Tue, 10 May 2022 16:03:23 -0700 Subject: [PATCH] fixes #8396 --- .../jabref/gui/entryeditor/DeprecatedFieldsTab.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/jabref/gui/entryeditor/DeprecatedFieldsTab.java b/src/main/java/org/jabref/gui/entryeditor/DeprecatedFieldsTab.java index d7bf6afab51..2beabdf1699 100644 --- a/src/main/java/org/jabref/gui/entryeditor/DeprecatedFieldsTab.java +++ b/src/main/java/org/jabref/gui/entryeditor/DeprecatedFieldsTab.java @@ -1,6 +1,7 @@ package org.jabref.gui.entryeditor; import java.util.Collections; +import java.util.HashSet; import java.util.Optional; import java.util.Set; @@ -53,7 +54,14 @@ public DeprecatedFieldsTab(BibDatabaseContext databaseContext, protected Set determineFieldsToShow(BibEntry entry) { Optional entryType = entryTypesManager.enrich(entry.getType(), databaseContext.getMode()); if (entryType.isPresent()) { - return entryType.get().getDeprecatedFields(); + Set validDeprecatedFields = new HashSet<>(); + for (Field field : entryType.get().getDeprecatedFields()) { + Optional fieldValue = entry.getField(field); + if (fieldValue.isPresent()) { + validDeprecatedFields.add(field); + } + } + return validDeprecatedFields; } else { // Entry type unknown -> treat all fields as required return Collections.emptySet();