private void initScheduleEditor(Schedule sched) throws CronParseException {
    DualModeScheduleEditor scheduleEditor = scheduleCreatorDialog.getScheduleEditor();

    scheduleEditor.setSubscriptionSchedule(sched.isSubscriptionSchedule());
    scheduleEditor.setName(sched.getJobName());
    scheduleEditor.setGroupName(sched.getJobGroup());
    scheduleEditor.setDescription(sched.getDescription());

    String repeatIntervalInMillisecs = sched.getRepeatInterval();
    if (sched.isCronSchedule()) {
      scheduleEditor.setCronString(sched.getCronString()); // throws CronParseException
    } else if (sched.isRepeatSchedule()) {
      long repeatIntervalInSecs =
          TimeUtil.millsecondsToSecs(Long.parseLong(repeatIntervalInMillisecs));
      if (0 == repeatIntervalInSecs) {
        // run once
        scheduleEditor.setScheduleType(ScheduleEditor.ScheduleType.RUN_ONCE);
      } else {
        // run multiple
        scheduleEditor.setRepeatInSecs((int) repeatIntervalInSecs);
      }
    } else {
      throw new RuntimeException(
          Messages.getString("illegalStateMissingCronAndRepeat")); // $NON-NLS-1$
    }

    String timePart = null;
    String strDate = sched.getStartDate();
    if (null != strDate) {
      Date startDate = TimeUtil.getDate(strDate);
      if (sched.isRepeatSchedule()) {
        timePart = TimeUtil.getTimePart(startDate);
        scheduleEditor.setStartTime(timePart);
        startDate = TimeUtil.zeroTimePart(startDate);
      }
      scheduleEditor.setStartDate(startDate);
    }
    //    scheduleEditor.getRunOnceEditor().setStartTime(strTime)
    //    scheduleEditor.getRunOnceEditor().setStartDate(strTime)

    strDate = sched.getEndDate();
    if (null != strDate) {
      scheduleEditor.setEndBy();
      Date endDate = TimeUtil.getDate(strDate);
      if (sched.isRepeatSchedule()) {
        endDate = TimeUtil.zeroTimePart(endDate);
      }
      scheduleEditor.setEndDate(endDate);
    } else {
      scheduleEditor.setNoEndDate();
    }
  }
  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();
    }
  }