public static <T> T create(@Nullable Component parent, Function<Dialog, T> forDialog, Function<@Nullable Frame, T> forFrame) {
    var owner = findOwner(parent);

    if (owner instanceof Dialog dialog) {
      return forDialog.apply(dialog);
    }

    if (owner instanceof IdeFrame.Child childFrame) {
      owner = WindowManager.getInstance().getFrame(childFrame.getProject());
    }

    return forFrame.apply((Frame)owner);
  }
public static <T> T create(@Nullable Component parent, Function<Dialog, T> forDialog, Function<@Nullable Frame, T> forFrame)