PsiMatcherExpression (@NotNull final String name) { return new PsiMatcherExpression() { @Override public Boolean match(PsiElement element) { if (element instanceof PsiNamedElement && name.equals(((PsiNamedElement) element).getName())) return Boolean.TRUE; return Boolean.FALSE; } }; }