DirectoryUrl (PsiDirectory directory) { Project project = directory.getProject(); final VirtualFile virtualFile = directory.getVirtualFile(); final Module module = ModuleUtil.findModuleForFile(virtualFile, project); return new DirectoryUrl(virtualFile.getUrl(), module != null ? module.getName() : null); }