示例#1
0
  @Override
  public void close() {
    if (!ok) return;

    super.close();
    gui.set(MainOptions.TEXTINDEX, textindex.isSelected());
    gui.set(MainOptions.ATTRINDEX, attrindex.isSelected());
    gui.set(MainOptions.TOKENINDEX, tokenindex.isSelected());
    gui.set(MainOptions.FTINDEX, ftindex.isSelected());
    general.setOptions();
    options.setOptions(null);
    for (final DialogIndex di : index) di.setOptions();
  }
示例#2
0
  @Override
  public void action(final Object comp) {
    final boolean valid = general.action(comp, true) && options.action();
    index[0].action(textindex.isSelected());
    index[1].action(attrindex.isSelected());
    index[2].action(tokenindex.isSelected());
    index[3].action(ftindex.isSelected());

    // ...must be located before remaining checks
    if (comp == general.browse || comp == general.input) dbName.setText(general.dbName);

    final String nm = dbName.getText().trim();
    ok = valid && !nm.isEmpty();

    String inf = valid ? ok ? null : ENTER_DB_NAME : RES_NOT_FOUND;
    Msg icon = Msg.ERROR;
    if (ok) {
      ok = Databases.validName(nm);
      if (ok) gui.gopts.set(GUIOptions.DBNAME, nm);

      if (!ok) {
        // name of database is invalid
        inf = Util.info(INVALID_X, NAME);
      } else if (general.input.getText().trim().isEmpty()) {
        // database will be empty
        inf = EMPTY_DB;
        icon = Msg.WARN;
      } else if (gui.context.databases.listDBs().contains(nm)) {
        // old database will be overwritten
        inf = OVERWRITE_DB;
        icon = Msg.WARN;
      }
    }

    general.info.setText(inf, icon);
    enableOK(buttons, B_OK, ok);
  }