private static void makeCurrentMessageDialogGoAway(Window @NotNull [] checkWindows) {
    for (Window w : checkWindows) {
      JDialog dialog = w instanceof JDialog ? (JDialog)w : null;
      if (dialog == null || !dialog.isModal()) {
        continue;
      }
      JButton cancelButton = UIUtil.uiTraverser(dialog.getRootPane())
        .filter(JButton.class)
        .filter(b -> CommonBundle.getCancelButtonText().equals(b.getText()))
        .first();
      if (cancelButton != null) {
        cancelButton.doClick();
      }
    }
  }
private static void makeCurrentMessageDialogGoAway(Window @NotNull [] checkWindows)