Self (final Class<? extends PsiReference> referenceClass) { return with(new PatternCondition<T>("withReference") { @Override public boolean accepts(final @NotNull T t, final ProcessingContext context) { for (final PsiReference reference : t.getReferences()) { if (referenceClass.isInstance(reference)) { return true; } } return false; } }); }