How to get javadoc of class in custom IntelliJ plugin

I'm building some custom IntelliJ plugin, in which I want to read the javadoc of a class. For example, 

 

/**
* Test Java Doc
* @link https://hub.jetbrains.com/
*/
public class Test {

private int a;

}

 

In above code, I want to extract the value of @link ( i.e. https://hub.jetbrains.com). I have added action under action-group EditorPopupMenu. 

 

Please help.

0
2 comments

`PsiDocComment.findTagsByName()`, then `PsiDocTag.getValueElement()` + `PsiDocTag.getDataElements()`.

The comment in your example does not conform to the specification, that's why the link is split into several PSI elements. You may use "Tools | View PSI Structure" action to visualize the element tree.

0
Avatar
Permanently deleted user
0

Please sign in to leave a comment.