public static void stopFocusedEditing(@NotNull Window window) {
    Component focusOwner = FocusManager.getCurrentManager().getFocusOwner();
    if (focusOwner == null || !SwingUtilities.isDescendingFrom(focusOwner, window)) {
      return;
    }
    if (focusOwner instanceof JFormattedTextField) {
      try {
        ((JFormattedTextField)focusOwner).commitEdit();
      }
      catch (ParseException ignored) {
      }
    }
    Object obj = focusOwner.getParent();
    if (obj instanceof JTable) {
      TableUtil.stopEditing((JTable)obj);
    }
    Object obj1 = focusOwner.getParent();
    if (obj1 instanceof JTree) {
      ((JTree)obj1).stopEditing();
    }
  }
public static void stopFocusedEditing(@NotNull Window window)