PostfixTemplateExpressionSelector (@Nullable Condition<? super PsiElement> additionalFilter) { return new PostfixTemplateExpressionSelectorBase(additionalFilter) { @Override protected List<PsiElement> getNonFilteredExpressions(@NotNull PsiElement context, @NotNull Document document, int offset) { return new ArrayList<>(CommonJavaRefactoringUtil.collectExpressions(context.getContainingFile(), document, Math.max(offset - 1, 0), false)); } @NotNull @Override public List<PsiElement> getExpressions(@NotNull PsiElement context, @NotNull Document document, int offset) { if (DumbService.getInstance(context.getProject()).isDumb()) return Collections.emptyList(); List<PsiElement> expressions = super.getExpressions(context, document, offset); if (!expressions.isEmpty()) return expressions; return ContainerUtil.filter(ContainerUtil.<PsiElement>createMaybeSingletonList(getTopmostExpression(context)), getFilters(offset)); } @NotNull @Override public Function<PsiElement, String> getRenderer() { return JavaPostfixTemplatesUtils.getRenderer(); } }; }