Search in sources :

Example 1 with Dependency

use of org.jetbrains.idea.devkit.dom.Dependency in project intellij-community by JetBrains.

the class RegistrationCheckerUtil method checkModule.

@Nullable
private static Set<PsiClass> checkModule(Module module, PsiClass psiClass, @Nullable Set<PsiClass> types, boolean includeActions) {
    final XmlFile pluginXml = PluginModuleType.getPluginXml(module);
    if (pluginXml == null)
        return null;
    final DomFileElement<IdeaPlugin> fileElement = DescriptorUtil.getIdeaPlugin(pluginXml);
    if (fileElement == null)
        return null;
    final String qualifiedName = psiClass.getQualifiedName();
    if (qualifiedName != null) {
        final RegistrationTypeFinder finder = new RegistrationTypeFinder(psiClass, types);
        // "main" plugin.xml
        processPluginXml(pluginXml, finder, includeActions);
        // <depends> plugin.xml files
        for (Dependency dependency : fileElement.getRootElement().getDependencies()) {
            final GenericAttributeValue<PathReference> configFileAttribute = dependency.getConfigFile();
            if (!DomUtil.hasXml(configFileAttribute))
                continue;
            final PathReference configFile = configFileAttribute.getValue();
            if (configFile != null) {
                final PsiElement resolve = configFile.resolve();
                if (!(resolve instanceof XmlFile))
                    continue;
                final XmlFile depPluginXml = (XmlFile) resolve;
                if (DescriptorUtil.isPluginXml(depPluginXml)) {
                    processPluginXml(depPluginXml, finder, includeActions);
                }
            }
        }
        types = finder.getTypes();
    }
    return types;
}
Also used : PathReference(com.intellij.openapi.paths.PathReference) XmlFile(com.intellij.psi.xml.XmlFile) IdeaPlugin(org.jetbrains.idea.devkit.dom.IdeaPlugin) Dependency(org.jetbrains.idea.devkit.dom.Dependency) Nullable(org.jetbrains.annotations.Nullable)

Aggregations

PathReference (com.intellij.openapi.paths.PathReference)1 XmlFile (com.intellij.psi.xml.XmlFile)1 Nullable (org.jetbrains.annotations.Nullable)1 Dependency (org.jetbrains.idea.devkit.dom.Dependency)1 IdeaPlugin (org.jetbrains.idea.devkit.dom.IdeaPlugin)1