private static @NotNull <T> MyBasePopupState<T> popupStateFromContext(@NotNull Context<T> context,
                                                                        @NotNull Consumer<? super T> onItemSelected,
                                                                        @Nullable T selectedItem) {
    MyBasePopupState<T> step = new MyBasePopupState<>(onItemSelected,
                                                      () -> context.getModel(),
                                                      () -> context.getRenderer()) {
      @Override
      public void canceled() {
        context.onPopupStepCancelled();
      }
    };

    if (selectedItem != null) {
      List<T> stepValues = step.getValues();
      step.setDefaultOptionIndex(stepValues.indexOf(selectedItem));
    }
    return step;
  }
private static @NotNull <T> MyBasePopupState<T> popupStateFromContext(@NotNull Context<T> context,
                                                                        @NotNull Consumer<? super T> onItemSelected,
                                                                        @Nullable T selectedItem)