diff options
author | Dmitry Jemerov <yole@jetbrains.com> | 2015-02-13 15:36:13 +0100 |
---|---|---|
committer | Dmitry Jemerov <yole@jetbrains.com> | 2015-02-13 15:36:13 +0100 |
commit | acb49b47437b1534b910e23927f8fddca26c69f3 (patch) | |
tree | c3a3d1bb80e8e3c58ba23eb8ae43aea716f5ede7 /src/Java | |
parent | 7697bed83f4f4c1e7b853e415053107e45d8aded (diff) | |
download | dokka-acb49b47437b1534b910e23927f8fddca26c69f3.tar.gz dokka-acb49b47437b1534b910e23927f8fddca26c69f3.tar.bz2 dokka-acb49b47437b1534b910e23927f8fddca26c69f3.zip |
process modifiers of Java elements
Diffstat (limited to 'src/Java')
-rw-r--r-- | src/Java/JavaDocumentationBuilder.kt | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/Java/JavaDocumentationBuilder.kt b/src/Java/JavaDocumentationBuilder.kt index c9379386..7443db06 100644 --- a/src/Java/JavaDocumentationBuilder.kt +++ b/src/Java/JavaDocumentationBuilder.kt @@ -11,6 +11,8 @@ import com.intellij.psi.PsiNamedElement import com.intellij.psi.PsiDocCommentOwner import com.intellij.psi.PsiClassType import com.intellij.psi.PsiPrimitiveType +import com.intellij.psi.PsiModifierListOwner +import com.intellij.psi.PsiModifier public class JavaDocumentationBuilder() { fun appendFile(file: PsiJavaFile, module: DocumentationModule) { @@ -31,6 +33,9 @@ public class JavaDocumentationBuilder() { fun DocumentationNode(element: PsiNamedElement, kind: Kind): DocumentationNode { val docComment = if (element is PsiDocCommentOwner) parseDocumentation(element.getDocComment()) else Content.Empty val node = DocumentationNode(element.getName() ?: "<anonymous>", docComment, kind) + if (element is PsiModifierListOwner) { + node.appendModifiers(element) + } return node } @@ -67,6 +72,19 @@ public class JavaDocumentationBuilder() { return node } + fun DocumentationNode.appendModifiers(element: PsiModifierListOwner) { + val modifierList = element.getModifierList() + if (modifierList == null) { + return + } + PsiModifier.MODIFIERS.forEach { + if (modifierList.hasExplicitModifier(it)) { + val modifierNode = DocumentationNode(it, Content.Empty, Kind.Modifier) + append(modifierNode, DocumentationReference.Kind.Detail) + } + } + } + fun DocumentationNode.appendType(psiType: PsiType?, kind: DocumentationNode.Kind = DocumentationNode.Kind.Type) { if (psiType == null) { return |