void () { if (myNameEditData == null) { cancelEdit(); return; } String newName = myNameEditorField.getText(); String validationMessage = validateSchemeName(newName, myNameEditData.isProjectScheme); if (validationMessage != null) { mySchemesPanel.showInfo(validationMessage, MessageType.ERROR); } else { myNameEditData.nameConsumer.accept(newName); cancelEdit(); } }