Search in sources :

Example 6 with ExtensionPoint

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

the class ExtensionPointDocumentationProvider method generateDoc.

@Override
public String generateDoc(PsiElement element, @Nullable PsiElement originalElement) {
    ExtensionPoint extensionPoint = findExtensionPoint(element);
    if (extensionPoint == null)
        return null;
    final PsiClass epClass = getExtensionPointClass(extensionPoint);
    if (epClass != null) {
        StringBuilder sb = new StringBuilder();
        sb.append("<em>EP Definition</em><br/>");
        final String quickInfo = StringUtil.notNullize(getQuickNavigateInfo(element, originalElement));
        sb.append(quickInfo);
        sb.append("<br/>");
        sb.append("<br/>");
        sb.append("<em>EP Implementation</em>");
        sb.append(JavaDocumentationProvider.generateExternalJavadoc(epClass));
        return sb.toString();
    }
    return null;
}
Also used : ExtensionPoint(org.jetbrains.idea.devkit.dom.ExtensionPoint) PsiClass(com.intellij.psi.PsiClass)

Example 7 with ExtensionPoint

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

the class ExtensionPointDocumentationProvider method getQuickNavigateInfo.

@Override
public String getQuickNavigateInfo(PsiElement element, PsiElement originalElement) {
    ExtensionPoint extensionPoint = findExtensionPoint(element);
    if (extensionPoint == null)
        return null;
    final XmlFile epDeclarationFile = DomUtil.getFile(extensionPoint);
    final Module epModule = ModuleUtilCore.findModuleForFile(epDeclarationFile.getVirtualFile(), element.getProject());
    final String epPrefix = extensionPoint.getNamePrefix();
    final PsiClass epClass = getExtensionPointClass(extensionPoint);
    StringBuilder epClassText = new StringBuilder();
    if (epClass != null) {
        JavaDocInfoGenerator.generateType(epClassText, PsiTypesUtil.getClassType(epClass), epClass, true);
    } else {
        epClassText.append("<unknown>");
    }
    return (epModule == null ? "" : "[" + epModule.getName() + "]") + (epPrefix == null ? "" : " " + epPrefix) + "<br/>" + "<b>" + extensionPoint.getEffectiveName() + "</b>" + " (" + epDeclarationFile.getName() + ")<br/>" + epClassText.toString();
}
Also used : XmlFile(com.intellij.psi.xml.XmlFile) ExtensionPoint(org.jetbrains.idea.devkit.dom.ExtensionPoint) PsiClass(com.intellij.psi.PsiClass) Module(com.intellij.openapi.module.Module)

Aggregations

ExtensionPoint (org.jetbrains.idea.devkit.dom.ExtensionPoint)7 PsiClass (com.intellij.psi.PsiClass)3 DomElement (com.intellij.util.xml.DomElement)3 Extension (org.jetbrains.idea.devkit.dom.Extension)3 Nullable (org.jetbrains.annotations.Nullable)2 Module (com.intellij.openapi.module.Module)1 Project (com.intellij.openapi.project.Project)1 PsiElement (com.intellij.psi.PsiElement)1 PsiField (com.intellij.psi.PsiField)1 XmlElementVisitor (com.intellij.psi.XmlElementVisitor)1 GlobalSearchScope (com.intellij.psi.search.GlobalSearchScope)1 LocalSearchScope (com.intellij.psi.search.LocalSearchScope)1 XmlAttribute (com.intellij.psi.xml.XmlAttribute)1 XmlAttributeValue (com.intellij.psi.xml.XmlAttributeValue)1 XmlFile (com.intellij.psi.xml.XmlFile)1 XmlTag (com.intellij.psi.xml.XmlTag)1 DomFileElement (com.intellij.util.xml.DomFileElement)1 HashSet (java.util.HashSet)1 NotNull (org.jetbrains.annotations.NotNull)1 With (org.jetbrains.idea.devkit.dom.With)1