VirtualFile (Object object) { if (object instanceof PsiElement) { if (object instanceof PsiDirectory) return ((PsiDirectory)object).getVirtualFile(); final PsiFile containingFile = ((PsiElement)object).getContainingFile(); if (containingFile != null) { return containingFile.getVirtualFile(); } return null; } return object instanceof VirtualFile ? (VirtualFile)object : null; }