PsiFile (@Nullable XSourcePosition position, Project project) { ApplicationManager.getApplication().assertReadAccessAllowed(); if (position != null) { VirtualFile file = position.getFile(); if (file.isValid()) { return PsiManager.getInstance(project).findFile(file); } } return null; }