Search in sources :

Example 1 with ModulePath

use of com.intellij.openapi.module.impl.ModulePath in project intellij-community by JetBrains.

the class PathManagerEx method getCommunityModules.

private static synchronized Set<String> getCommunityModules() {
    if (ourCommunityModules != null) {
        return ourCommunityModules;
    }
    ourCommunityModules = new THashSet<>();
    File modulesXml = findFileUnderCommunityHome(Project.DIRECTORY_STORE_FOLDER + "/modules.xml");
    if (!modulesXml.exists()) {
        throw new IllegalStateException("Cannot obtain test data path: " + modulesXml.getAbsolutePath() + " not found");
    }
    try {
        Element element = JDomSerializationUtil.findComponent(JDOMUtil.load(modulesXml), ModuleManagerImpl.COMPONENT_NAME);
        assert element != null;
        for (ModulePath file : ModuleManagerImpl.getPathsToModuleFiles(element)) {
            ourCommunityModules.add(file.getModuleName());
        }
        return ourCommunityModules;
    } catch (JDOMException | IOException e) {
        throw new RuntimeException("Cannot read modules from " + modulesXml.getAbsolutePath(), e);
    }
}
Also used : ModulePath(com.intellij.openapi.module.impl.ModulePath) Element(org.jdom.Element) IOException(java.io.IOException) JDOMException(org.jdom.JDOMException) File(java.io.File)

Aggregations

ModulePath (com.intellij.openapi.module.impl.ModulePath)1 File (java.io.File)1 IOException (java.io.IOException)1 Element (org.jdom.Element)1 JDOMException (org.jdom.JDOMException)1