boolean (PsiElement position) { PsiElement type = PsiTreeUtil.getParentOfType(position, PsiTypeElement.class); if (type != null && type.getTextRange().getStartOffset() == position.getTextRange().getStartOffset()) { PsiElement parent = type.getParent(); if (parent instanceof PsiVariable) parent = parent.getParent(); return parent instanceof PsiCatchSection || parent instanceof PsiResourceList; } return psiElement().insideStarting(psiElement(PsiResourceExpression.class)).accepts(position); }