PsiParameterPattern (int index, ElementPattern pattern) { return with(new PatternConditionPlus<PsiParameter, PsiMethod>("ofMethod", pattern) { @Override public boolean processValues(PsiParameter t, ProcessingContext context, PairProcessor<? super PsiMethod, ? super ProcessingContext> processor) { PsiElement scope = t.getDeclarationScope(); if (!(scope instanceof PsiMethod)) return true; return processor.process((PsiMethod)scope, context); } @Override public boolean accepts(@NotNull final PsiParameter t, final ProcessingContext context) { if (!super.accepts(t, context)) return false; PsiMethod psiMethod = (PsiMethod)t.getDeclarationScope(); PsiParameter[] parameters = psiMethod.getParameterList().getParameters(); if (index < 0 || index >= parameters.length || !t.equals(parameters[index])) return false; return true; } }); }