XmlFile (Module module) { if (module == null) return null; if (!isOfType(module)) { for (final ContentEntry entry : ModuleRootManager.getInstance(module).getContentEntries()) { for (final SourceFolder folder : entry.getSourceFolders(JavaModuleSourceRootTypes.PRODUCTION)) { final VirtualFile file = folder.getFile(); if (file == null) continue; final String packagePrefix = folder.getPackagePrefix(); final String prefixPath = packagePrefix.isEmpty() ? "" : packagePrefix.replace('.', '/') + '/'; final String relativePath = prefixPath + PluginDescriptorConstants.PLUGIN_XML_PATH; final VirtualFile pluginXmlVF = file.findFileByRelativePath(relativePath); if (pluginXmlVF != null) { final PsiFile psiFile = PsiManager.getInstance(module.getProject()).findFile(pluginXmlVF); if (psiFile instanceof XmlFile) { return (XmlFile)psiFile; } } } } return null; } final PluginBuildConfiguration buildConfiguration = PluginBuildConfiguration.getInstance(module); if (buildConfiguration == null) return null; final ConfigFile configFile = buildConfiguration.getPluginXmlConfigFile(); return configFile != null ? configFile.getXmlFile() : null; }