Exemplo n.º 1
0
  /**
   * Saves the index modifications.
   *
   * @param modal whether the progress dialog for the task must be modal or not.
   */
  private void saveIndex(boolean modal) {
    newModifyTask = null;
    if (!isModified()) {
      return;
    }

    List<LocalizableMessage> errors = getErrors();

    if (errors.isEmpty()) {
      ProgressDialog dlg =
          new ProgressDialog(
              Utilities.getFrame(this),
              Utilities.getFrame(this),
              INFO_CTRL_PANEL_MODIFYING_INDEX_TITLE.get(),
              getInfo());
      dlg.setModal(modal);
      newModifyTask = new ModifyIndexTask(getInfo(), dlg);
      for (Task task : getInfo().getTasks()) {
        task.canLaunch(newModifyTask, errors);
      }
      if (errors.isEmpty()) {
        String attributeName = index.getName();
        String backendName = index.getBackend().getBackendID();
        launchOperation(
            newModifyTask,
            INFO_CTRL_PANEL_MODIFYING_INDEX_SUMMARY.get(attributeName),
            INFO_CTRL_PANEL_MODIFYING_INDEX_COMPLETE.get(),
            INFO_CTRL_PANEL_MODIFYING_INDEX_SUCCESSFUL.get(attributeName, backendName),
            ERR_CTRL_PANEL_MODIFYING_INDEX_ERROR_SUMMARY.get(),
            ERR_CTRL_PANEL_MODIFYING_INDEX_ERROR_DETAILS.get(attributeName),
            null,
            dlg);
        saveChanges.setEnabled(false);
        dlg.setVisible(true);
      }
    }

    if (!errors.isEmpty()) {
      displayErrorDialog(errors);
    }
  }