PsiElement (final JavaResolveResult result) { final PsiElement elem = result.getElement(); if (elem != null) { if (PsiUtil.isJvmLocalVariable(elem)) { return PsiTreeUtil.getParentOfType(elem, PsiClass.class); } else { return result.getCurrentFileResolveScope(); } } return null; }