PsiFile (@NotNull PsiElement element) { PsiFile file = element.getContainingFile(); if (file == null) return null; PsiElement context = file.getContext(); if (context == null) { return file; } else { return getContextFile(context); } }