Пример #1
0
  private void DoDelete(Searcher chosenSearch) {
    Searcher s = chosenSearch;
    int[] rows = getPossibleRows();
    String prompt;

    if ((rows.length <= 1) && s != null) {
      if (rows.length == 1) s = (Searcher) _inTable.getValueAt(rows[0], -1);

      prompt =
          "<HTML><BODY>Are you sure you want to remove this search?<br><b>"
              + s.getName()
              + "</b></body></html>";
      //  Use the right parent!  FIXME -- mrs: 17-February-2003 23:53
      if (confirmDeletion(null, prompt)) {
        SearchManager.getInstance().deleteSearch(s);
      }
    } else {
      if (rows.length == 0) {
        JOptionPane.showMessageDialog(
            _inTable,
            "You must select what searches to delete first.",
            "No search",
            JOptionPane.INFORMATION_MESSAGE);
      } else {
        prompt = "Are you sure you want to remove all selected searches?";
        //  Use the right parent!  FIXME -- mrs: 17-February-2003 23:53
        if (confirmDeletion(null, prompt)) {
          ArrayList<Searcher> delList = new ArrayList<Searcher>();
          for (int row : rows) {
            s = (Searcher) _inTable.getValueAt(row, -1);
            delList.add(s);
          }
          for (Searcher del : delList) {
            SearchManager.getInstance().deleteSearch(del);
          }
        }
      }
    }
    changeTable();
  }