diff --git a/src/main/java/org/jabref/gui/customentrytypes/CustomEntryTypeDialogViewModel.java b/src/main/java/org/jabref/gui/customentrytypes/CustomEntryTypeDialogViewModel.java index 74d6020ee2a..ab51c2f7390 100644 --- a/src/main/java/org/jabref/gui/customentrytypes/CustomEntryTypeDialogViewModel.java +++ b/src/main/java/org/jabref/gui/customentrytypes/CustomEntryTypeDialogViewModel.java @@ -129,20 +129,14 @@ public String toString() { public void addNewField() { Field field = newFieldToAdd.getValue(); FieldViewModel model = new FieldViewModel(field, true, FieldPriority.IMPORTANT); - - // create list with all the entry's fields ObservableList entryFields = this.selectedEntryType.getValue().fields(); - - // compare every entry field name with the user field name in order to find out if any of them has the same one. boolean fieldExists = entryFields.stream().anyMatch(fieldViewModel -> fieldViewModel.fieldName().getValue().equals(field.getDisplayName())); - // if the user field name isn't found inside the list, pass it to the entry as a new one. If that is not the case, show warning. if (!fieldExists) { this.selectedEntryType.getValue().addField(model); } else { dialogService.showWarningDialogAndWait(Localization.lang("Duplicate fields"), Localization.lang("Warning: You added field \"%0\" twice. Only one will be kept.", field.getDisplayName())); } - newFieldToAddProperty().setValue(null); } diff --git a/src/main/java/org/jabref/gui/customentrytypes/CustomizeEntryTypeDialogView.java b/src/main/java/org/jabref/gui/customentrytypes/CustomizeEntryTypeDialogView.java index dcc28253abf..c8563bb844a 100644 --- a/src/main/java/org/jabref/gui/customentrytypes/CustomizeEntryTypeDialogView.java +++ b/src/main/java/org/jabref/gui/customentrytypes/CustomizeEntryTypeDialogView.java @@ -48,8 +48,7 @@ public class CustomizeEntryTypeDialogView extends BaseDialog { private final BibDatabaseMode mode; private final BibEntryTypesManager entryTypesManager; - @FXML - private TableView entryTypes; + @FXML private TableView entryTypes; @FXML private TableColumn entryTypColumn; @FXML private TableColumn entryTypeActionsColumn; @FXML private TextField addNewEntryType;