VirtualFile (UElement initializerElement) { if (initializerElement == null) return null; final List<FileReference> refs = new ArrayList<>(); initializerElement.accept(new AbstractUastVisitor() { @Override public boolean visitLiteralExpression(@NotNull ULiteralExpression node) { PsiElement psi = UastLiteralUtils.getSourceInjectionHost(node); if (psi != null) { for (PsiReference ref : psi.getReferences()) { if (ref instanceof FileReference) { refs.add((FileReference)ref); } } } super.visitLiteralExpression(node); return true; } }); for (FileReference ref : refs) { final PsiFileSystemItem psiFileSystemItem = ref.resolve(); VirtualFile file = null; if (psiFileSystemItem == null) { final ResolveResult[] results = ref.multiResolve(false); for (ResolveResult result : results) { final PsiElement element = result.getElement(); if (element instanceof PsiBinaryFile) { file = ((PsiFile)element).getVirtualFile(); break; } } } else { file = psiFileSystemItem.getVirtualFile(); } if (file == null || file.isDirectory() || !isIconFileExtension(file.getExtension()) || file.getLength() > ICON_MAX_SIZE) { continue; } return file; } return null; }