void (XmlTagInjection other) { String name = myNameTextField.getText(); boolean useGenerated = myUseGeneratedName && Objects.equals(myOrigInjection.getDisplayName(), name); String newName = useGenerated || StringUtil.isEmptyOrSpaces(name) ? other.getGeneratedName() : name; other.setDisplayName(newName); }