VirtualFile (final PsiElement element) { final XmlTag xmlTag = PsiTreeUtil.getParentOfType(element, XmlTag.class); if (xmlTag == null) { return null; } final AntDomElement antElement = AntSupport.getAntDomElement(xmlTag); if (antElement == null) { return null; } final AntDomProject antProject = antElement.getAntProject(); if (antProject == null) { return null; } final AntInstallation installation = antProject.getAntInstallation(); if (installation == null) { return null; // not configured properly and bundled installation missing } final String antHomeDir = AntInstallation.HOME_DIR.get(installation.getProperties()); if (antHomeDir == null) { return null; } @NonNls String path = antHomeDir + "/docs/manual"; String url; if (new File(path).exists()) { url = VirtualFileManager.constructUrl(LocalFileSystem.PROTOCOL, FileUtil.toSystemIndependentName(path)); } else { path = antHomeDir + "/docs.zip"; if (new File(path).exists()) { url = VirtualFileManager.constructUrl(JarFileSystem.PROTOCOL, FileUtil.toSystemIndependentName(path) + JarFileSystem.JAR_SEPARATOR + "docs/manual"); } else { return null; } } final VirtualFile documentationRoot = VirtualFileManager.getInstance().findFileByUrl(url); if (documentationRoot == null) { return null; } return getHelpFile(antElement, documentationRoot); }