Set<VirtualFile> (RefEntity @NotNull [] refElements) { Set<VirtualFile> readOnlyFiles = new HashSet<>(); for (RefEntity refElement : refElements) { PsiElement psiElement = refElement instanceof RefElement ? ((RefElement)refElement).getPsiElement() : null; if (psiElement == null || psiElement.getContainingFile() == null) continue; readOnlyFiles.add(psiElement.getContainingFile().getVirtualFile()); } return readOnlyFiles; }