boolean (@NotNull PsiElement e) { final VirtualFile file = e.getContainingFile().getVirtualFile(); if (file == null) return false; final ProjectFileIndex index = ProjectRootManager.getInstance(e.getProject()).getFileIndex(); return index.isInContent(file) || index.isInLibrary(file); }