PsiMethodCallPattern (final ElementPattern<? extends PsiMethod> method) { final PsiNamePatternCondition nameCondition = ContainerUtil.findInstance(method.getCondition().getConditions(), PsiNamePatternCondition.class); return new PsiMethodCallPattern().and(this).with(new PatternCondition<PsiMethodCallExpression>("methodCall") { @Override public boolean accepts(@NotNull PsiMethodCallExpression callExpression, ProcessingContext context) { PsiReferenceExpression methodExpression = callExpression.getMethodExpression(); if (nameCondition != null && !nameCondition.getNamePattern().accepts(methodExpression.getReferenceName())) { return false; } for (JavaResolveResult result : methodExpression.multiResolve(true)) { if (method.accepts(result.getElement(), context)) { return true; } } return false; } }); }