use of edu.stanford.bmir.protege.web.shared.mail.SetEmailAddressAction in project webprotege by protegeproject.
the class ChangeEmailAddressPresenter method showDialog.
private void showDialog(Optional<EmailAddress> emailAddress) {
final UserId userId = loggedInUserProvider.getCurrentUserId();
ChangeEmailAddressDialogController controller = new ChangeEmailAddressDialogController();
emailAddress.ifPresent(controller::setValue);
controller.setDialogButtonHandler(DialogButton.OK, (data, closer) -> {
if (data.isPresent()) {
dispatchServiceManager.execute(new SetEmailAddressAction(userId, data.get().getEmailAddress()), result -> {
if (result.getResult() == ADDRESS_ALREADY_EXISTS) {
MessageBox.showMessage("Address already taken", "The email address that you have specified is taken by another user. " + "Please specify a different email address.");
} else {
closer.hide();
}
});
} else {
MessageBox.showAlert("The specified email addresses do not match.");
}
});
WebProtegeDialog<Optional<EmailAddress>> dlg = new WebProtegeDialog<Optional<EmailAddress>>(controller);
dlg.setVisible(true);
}
Aggregations