VirtualFile (TreeItem<Pair<AbstractUrl, String>> item) { Pair<AbstractUrl, String> data = item.getData(); Object[] path = data.first.createPath(myProject); if (path != null && path.length == 1) { if (path[0] instanceof PsiFile) { VirtualFile virtualFile = ((PsiFile)path[0]).getVirtualFile(); if (virtualFile != null && !virtualFile.isDirectory()) { return virtualFile; } } if (path[0] instanceof File) { VirtualFile virtualFile = VfsUtil.findFileByIoFile((File)path[0], false); if (virtualFile != null && !virtualFile.isDirectory()) { return virtualFile; } } } return null; }