PsiFileSystemItem (PsiFileSystemItem fileSystemItem) { final VirtualFile file = fileSystemItem.getVirtualFile(); if (file != null && !file.isDirectory()) { final PsiManager psiManager = fileSystemItem.getManager(); if (psiManager != null) { final PsiFile psiFile = psiManager.findFile(file); if (psiFile != null) { fileSystemItem = psiFile; } } } return fileSystemItem; }