Search in sources :

Example 6 with IdeaPlugin

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

the class PluginDescriptorChooser method findOrCreateExtensionsForEP.

@NotNull
public static Extensions findOrCreateExtensionsForEP(DomFileElement<IdeaPlugin> domFileElement, String epName) {
    final IdeaPlugin ideaPlugin = domFileElement.getRootElement();
    final List<Extensions> extensionsList = ideaPlugin.getExtensions();
    for (Extensions extensions : extensionsList) {
        if (extensions.getXmlTag() instanceof IncludedXmlTag) {
            continue;
        }
        String s = extensions.getDefaultExtensionNs().getStringValue();
        if (s != null && epName.startsWith(s)) {
            return extensions;
        }
    }
    Extensions extensions = ideaPlugin.addExtensions();
    final String epPrefix = StringUtil.getPackageName(epName);
    extensions.getDefaultExtensionNs().setStringValue(epPrefix);
    return extensions;
}
Also used : IdeaPlugin(org.jetbrains.idea.devkit.dom.IdeaPlugin) IncludedXmlTag(com.intellij.xml.util.IncludedXmlTag) Extensions(org.jetbrains.idea.devkit.dom.Extensions) NotNull(org.jetbrains.annotations.NotNull)

Example 7 with IdeaPlugin

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

the class ExtensionsImpl method getEpPrefix.

@NotNull
public String getEpPrefix() {
    String prefix = getDefaultExtensionNs().getStringValue();
    if (prefix == null) {
        final IdeaPlugin ideaPlugin = getParentOfType(IdeaPlugin.class, true);
        prefix = ideaPlugin == null ? null : StringUtil.notNullize(ideaPlugin.getPluginId(), DEFAULT_PREFIX);
    }
    if (prefix == null)
        prefix = getXmlns().getStringValue();
    return prefix != null ? prefix + "." : "";
}
Also used : IdeaPlugin(org.jetbrains.idea.devkit.dom.IdeaPlugin) NotNull(org.jetbrains.annotations.NotNull)

Example 8 with IdeaPlugin

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

the class IdeaPluginConverter method getAllPluginsWithoutSelf.

private static Collection<IdeaPlugin> getAllPluginsWithoutSelf(final ConvertContext context) {
    final IdeaPlugin self = context.getInvocationElement().getParentOfType(IdeaPlugin.class, true);
    if (self == null)
        return Collections.emptyList();
    final Collection<IdeaPlugin> plugins = getAllPlugins(context.getProject());
    return ContainerUtil.filter(plugins, plugin -> !Comparing.strEqual(self.getPluginId(), plugin.getPluginId()));
}
Also used : IdeaPlugin(org.jetbrains.idea.devkit.dom.IdeaPlugin)

Example 9 with IdeaPlugin

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

the class DescriptorUtil method getPluginId.

@Nullable
public static String getPluginId(Module plugin) {
    assert PluginModuleType.isOfType(plugin);
    final XmlFile pluginXml = PluginModuleType.getPluginXml(plugin);
    if (pluginXml == null) {
        return null;
    }
    final DomFileElement<IdeaPlugin> ideaPlugin = getIdeaPlugin(pluginXml);
    if (ideaPlugin == null) {
        return null;
    }
    return ideaPlugin.getRootElement().getPluginId();
}
Also used : XmlFile(com.intellij.psi.xml.XmlFile) IdeaPlugin(org.jetbrains.idea.devkit.dom.IdeaPlugin) Nullable(org.jetbrains.annotations.Nullable)

Aggregations

IdeaPlugin (org.jetbrains.idea.devkit.dom.IdeaPlugin)9 NotNull (org.jetbrains.annotations.NotNull)5 Module (com.intellij.openapi.module.Module)3 XmlFile (com.intellij.psi.xml.XmlFile)3 Nullable (org.jetbrains.annotations.Nullable)3 Extensions (org.jetbrains.idea.devkit.dom.Extensions)3 ModuleGrouper (com.intellij.openapi.module.ModuleGrouper)2 DomFileElement (com.intellij.util.xml.DomFileElement)2 IncludedXmlTag (com.intellij.xml.util.IncludedXmlTag)2 HintManager (com.intellij.codeInsight.hint.HintManager)1 AllIcons (com.intellij.icons.AllIcons)1 Editor (com.intellij.openapi.editor.Editor)1 ModuleUtilCore (com.intellij.openapi.module.ModuleUtilCore)1 PathReference (com.intellij.openapi.paths.PathReference)1 Project (com.intellij.openapi.project.Project)1 ProjectRootManager (com.intellij.openapi.roots.ProjectRootManager)1 ModulesAlphaComparator (com.intellij.openapi.roots.ui.configuration.ModulesAlphaComparator)1 JBPopupFactory (com.intellij.openapi.ui.popup.JBPopupFactory)1 ListSeparator (com.intellij.openapi.ui.popup.ListSeparator)1 PopupStep (com.intellij.openapi.ui.popup.PopupStep)1