Collection<FileTargetContext> (@NotNull Project project, @NotNull VirtualFile file, boolean isAbsoluteReference) { List<PsiFileSystemItem> contexts; if (isAbsoluteReference) { ProjectFileIndex index = ProjectRootManager.getInstance(project).getFileIndex(); Module module = index.getModuleForFile(file); if (module == null) return emptyList(); contexts = getContextsForModule(module, "", module.getModuleWithDependenciesScope()); } else { contexts = getContexts(project, file, true); } List<FileTargetContext> fileTargetContexts = new ArrayList<>(); for (PsiFileSystemItem context : contexts) { if (context instanceof VirtualPsiDirectory virtual) { fileTargetContexts.add(new FileTargetContext(virtual.getRoot(), virtual.getPathToCreate())); } else { fileTargetContexts.add(new FileTargetContext(context)); } } return prepareTargetContexts(project, file, fileTargetContexts); }