private boolean createRole() {
    if (getRoleName().trim().length() == 0) {
      messageDialog.setMessage(Messages.getString("invalidRoleName")); // $NON-NLS-1$
      messageDialog.center();
    } else {
      ProxyPentahoRole role = getRole();
      if (role != null) {
        AsyncCallback<Boolean> callback =
            new AsyncCallback<Boolean>() {
              public void onSuccess(Boolean result) {
                okBtn.setEnabled(true);
                cancelBtn.setEnabled(true);
                roleCreated = true;
                hide();
              }

              public void onFailure(Throwable caught) {
                messageDialog.setText(ExceptionParser.getErrorHeader(caught.getMessage()));
                messageDialog.setMessage(
                    ExceptionParser.getErrorMessage(
                        caught.getMessage(),
                        Messages.getString("errorCreatingRole"))); // $NON-NLS-1$
                messageDialog.center();
                okBtn.setEnabled(true);
                cancelBtn.setEnabled(true);
              }
            };
        okBtn.setEnabled(false);
        cancelBtn.setEnabled(false);
        UserAndRoleMgmtService.instance().createRole(role, callback);
      }
    }
    return roleCreated;
  }
  private void handleUpdateSchedule() {
    final SchedulerToolbarController localThis = this;

    scheduleCreatorDialog.setTitle(Messages.getString("scheduleEditor")); // $NON-NLS-1$
    final List<Schedule> scheduleList = schedulesListCtrl.getSelectedSchedules();
    if (!loadingInitialized) {
      scheduleCreatorDialog.setOkBtnEnabled(false);
    }
    scheduleCreatorDialog.setOnOkHandler(
        new ICallback<MessageDialog>() {
          public void onHandle(MessageDialog d) {
            localThis.updateScheduleWithNewScheduleType();
          }
        });
    this.scheduleCreatorDialog.setOnValidateHandler(
        new IResponseCallback<MessageDialog, Boolean>() {
          public Boolean onHandle(MessageDialog schedDlg) {
            return isUpdateScheduleCreatorDialogValid();
          }
        });
    // the update button should be enabled/disabled to guarantee that one and only one schedule is
    // selected
    assert scheduleList.size() == 1
        : "When clicking update, exactly one schedule should be selected."; //$NON-NLS-1$

    Schedule sched = scheduleList.get(0);
    try {
      initScheduleCreatorDialog(sched);
      scheduleCreatorDialog.center();
      scheduleCreatorDialog.getScheduleEditor().setFocus();
    } catch (CronParseException e) {
      final MessageDialog errorDialog =
          new MessageDialog(
              Messages.getString("error"), // $NON-NLS-1$
              Messages.getString(
                  "invalidCronInInitOfRecurrenceDialog",
                  sched.getCronString(),
                  e.getMessage())); // $NON-NLS-1$
      errorDialog.setOnOkHandler(
          new ICallback<MessageDialog>() {
            public void onHandle(MessageDialog messageDialog) {
              errorDialog.hide();
              scheduleCreatorDialog.center();
            }
          });
      errorDialog.center();
    }
  }