}
for (String field : entry.getAllFields()){
if (BibtexFields.isDisplayableField(field.toString())) {
if (nu.getField(field.toString()) == null) {
compound.addEdit(new UndoableFieldChange(entry, field.toString(), entry
.getField(field.toString()), null));
entry.clearField(field.toString());
anyChanged = true;
}
}
}
// Then set all fields that have been set by the user.
for (String field : nu.getAllFields()){
if (entry.getField(field.toString()) != nu.getField(field.toString())) {
String toSet = nu.getField(field.toString());
// Test if the field is legally set.
(new LatexFieldFormatter()).format(toSet, field.toString());
compound.addEdit(new UndoableFieldChange(entry, field.toString(), entry
.getField(field.toString()), toSet));
entry.setField(field.toString(), toSet);
anyChanged = true;
}
}