public void actionPerformed(ActionEvent e) {
    Object source = e.getSource();

    if (source == okButton) {
      dispose();

      // Starts copying files
      ProgressDialog progressDialog =
          new ProgressDialog(mainFrame, Translator.get("progress_dialog.processing_files"));
      ChangeFileAttributesJob job =
          new ChangeFileAttributesJob(
              progressDialog, mainFrame, files, getPermInt(), recurseDirCheckBox.isSelected());
      progressDialog.start(job);
    } else if (source == cancelButton) {
      dispose();
    }
  }
  @Override
  public void actionPerformed(ActionEvent e) {
    if (e.getSource() == addEditButton) {
      if (serverName.getText().isEmpty()
          || serverHost.getText().isEmpty()
          || serverPort.getText().isEmpty()) {
        JOptionPane.showMessageDialog(
            App.settings.getParent(),
            Language.INSTANCE.localize("tools" + "" + ".serverchecker.notallfields"),
            Language.INSTANCE.localize("common.error"),
            JOptionPane.ERROR_MESSAGE);
      } else if (!isValidPort()) {
        JOptionPane.showMessageDialog(
            App.settings.getParent(),
            Language.INSTANCE.localize("settings" + "" + ".proxyportinvalid"),
            Language.INSTANCE.localize("common.error"),
            JOptionPane.ERROR_MESSAGE);
      } else {
        String name = serverName.getText();
        final String host = serverHost.getText();
        final int port = Integer.parseInt(serverPort.getText().replaceAll("[^0-9]", ""));
        QueryVersion qv = null;

        final ProgressDialog dialog =
            new ProgressDialog(
                Language.INSTANCE.localize("tools.serverchecker" + "" + ".checkingserver"),
                0,
                Language.INSTANCE.localize("tools.serverchecker.checkingserver"),
                "Cancelled Server Check!");
        dialog.addThread(
            new Thread() {
              @Override
              public void run() {
                dialog.setReturnValue(MCQuery.getMinecraftServerQueryVersion(host, port));
                dialog.close();
              }
            });
        dialog.start();

        if (dialog.getReturnValue() != null) {
          qv = (QueryVersion) dialog.getReturnValue();
        }

        if (qv == null) {
          JOptionPane.showMessageDialog(
              App.settings.getParent(),
              Language.INSTANCE.localize("tools" + "" + ".serverchecker.couldntconnect"),
              Language.INSTANCE.localize("common.error"),
              JOptionPane.ERROR_MESSAGE);
        } else {
          App.TOASTER.pop(
              Language.INSTANCE.localize(
                  (this.serverEditing == null
                      ? "tools" + "" + ".serverchecker.serveradded"
                      : "tools.serverchecker.serveredited")));
          if (this.serverEditing == null) {
            App.settings.addCheckingServer(new MinecraftServer(name, host, port, qv));
          } else {
            this.serverEditing.setName(name);
            this.serverEditing.setHost(host);
            this.serverEditing.setPort(port);
            this.serverEditing.setQueryVersion(qv);
            App.settings.saveCheckingServers();
          }
          close();
        }
      }
    } else if (e.getSource() == closeButton) {
      close();
    }
  }