private void watchlistimportButtonActionPerformed(
      java.awt.event.ActionEvent evt) {// GEN-FIRST:event_watchlistimportButtonActionPerformed
    JFileChooser importChooser = new JFileChooser();
    int returnval = importChooser.showOpenDialog(this);
    if (returnval == JFileChooser.APPROVE_OPTION) {
      try {
        File watchlistFile = new File("" + importChooser.getSelectedFile());
        FileInputStream watchimport = new FileInputStream(watchlistFile);
        BufferedInputStream bis = new BufferedInputStream(watchimport);
        String watchlist = new String("");
        String proj = (String) JOptionPane.showInputDialog(this,
            "Enter project, e.g. en.wikipedia\nor hit enter to use "
                + defaultProjectField.getText(), "Project name",
            JOptionPane.PLAIN_MESSAGE);
        if (proj.length() < 5)
          proj = defaultProjectField.getText();
        if (proj.substring(proj.length() - 4).equals(".org"))
          proj = proj.substring(0, proj.length() - 4);

        i = bis.available();
        while (i > 0) {
          byte b[] = new byte[i];
          bis.read(b);
          watchlist = new String(watchlist + new String(b));
          i = bis.available();
        }

        //Pattern p = Pattern.compile("titles\\u005B\\u005D['\"] value=\"([^\"]*)\"");
        Pattern p = Pattern.compile("<input\\s+name=['\"]titles\\u005B\\u005D['\"] ([^>]*)>");
        Pattern p2 = Pattern.compile("value=\"([^\"]*)\"");
        Matcher m = p.matcher(watchlist);

        while (m.find()) {
          Matcher m2 = p2.matcher(m.group(1));
          if (m2.find()) {
            if (!config.watchlistModel.contains(m2.group(1) + "#" + proj))
              config.watchlistModel.addElement(m2.group(1) + "#" + proj);
          }
        }
        watchlistList.clearSelection();
        watchimport.close();
        bis.close();

      } catch (Exception ex) {
      }
    }

  }