@Override
  public final void expand(@NotNull PsiElement context, @NotNull final Editor editor) {
    List<PsiElement> expressions = mySelector.getExpressions(context,
                                                             editor.getDocument(),
                                                             editor.getCaretModel().getOffset());

    if (expressions.isEmpty()) {
      PostfixTemplatesUtils.showErrorHint(context.getProject(), editor);
      return;
    }

    if (expressions.size() == 1) {
      prepareAndExpandForChooseExpression(expressions.get(0), editor);
      return;
    }

    if (ApplicationManager.getApplication().isUnitTestMode()) {
      PsiElement item = ContainerUtil.getFirstItem(expressions);
      assert item != null;
      prepareAndExpandForChooseExpression(item, editor);
      return;
    }

    IntroduceTargetChooser.showChooser(
      editor, expressions,
      new Pass<>() {
        @Override
        public void pass(@NotNull final PsiElement e) {
          prepareAndExpandForChooseExpression(e, editor);
        }
      },
      mySelector.getRenderer(),
      CodeInsightBundle.message("dialog.title.expressions"), 0, ScopeHighlighter.NATURAL_RANGER
    );
  }
@Override
  public final void expand(@NotNull PsiElement context, @NotNull final Editor editor)