use of com.intellij.psi.javadoc.PsiDocTag in project intellij-community by JetBrains.
the class MethodJavaDocHelper method getTagForParameter.
public PsiDocTag getTagForParameter(PsiParameter parameter) {
if (!myDoCorrectJavaDoc)
return null;
if (parameter == null)
return null;
final String name = parameter.getName();
final PsiDocTag[] paramTags = myDocComment.findTagsByName("param");
for (final PsiDocTag paramTag : paramTags) {
final PsiElement[] dataElements = paramTag.getDataElements();
if (dataElements.length > 0 && dataElements[0].getText().equals(name)) {
return paramTag;
}
}
return null;
}
use of com.intellij.psi.javadoc.PsiDocTag in project intellij-community by JetBrains.
the class ClsDocCommentImpl method appendMirrorText.
@Override
public void appendMirrorText(final int indentLevel, @NotNull final StringBuilder buffer) {
buffer.append("/**");
for (PsiDocTag tag : getTags()) {
goNextLine(indentLevel + 1, buffer);
buffer.append("* ");
buffer.append(tag.getText());
}
goNextLine(indentLevel + 1, buffer);
buffer.append("*/");
}
use of com.intellij.psi.javadoc.PsiDocTag in project markdown-doclet by Abnaxos.
the class DocCommentProcessor method generateUmlDiagrams.
/**
* Generates all PlantUML diagrams in the given `PsiDocComment`. It returns a Map of
* file names and the URLs where the image for that file has been saved to. Use this
* URL for the `<img>` tag.
*
* @param docComment The `PsiDocComment`.
*
* @return A map mapping the file names to the image URLs.
*
* @see TempFileManager#saveTempFile(byte[], String)
*/
private Map<String, URL> generateUmlDiagrams(PsiDocComment docComment) {
TempFileManager tempFiles = Plugin.tempFileManager();
Map<String, URL> urls = null;
for (PsiDocTag tag : docComment.getTags()) {
if (tag instanceof PsiInlineDocTag) {
continue;
} else if (tag.getName().equals("uml") || tag.getName().equals("startuml")) {
if (urls == null) {
urls = new HashMap<>();
}
String text = stripLead(tag.getText());
text = stripFirstWord(text)[1];
String[] stripped = stripFirstWord(text);
String fileName = stripped[0];
text = stripped[1];
String plantUml = "@startuml " + fileName + "\n" + "skinparam backgroundColor transparent\n" + text + "\n@enduml";
Plugin.print("UML Diagram Source", plantUml);
ByteArrayOutputStream image = new ByteArrayOutputStream();
try {
new SourceStringReader(plantUml).generateImage(image);
} catch (IOException e) {
LOG.error("Error generating UML", e, fileName, String.valueOf(docComment.toString()), String.valueOf(docComment.getContainingFile()));
}
try {
urls.put(fileName, tempFiles.saveTempFile(image.toByteArray(), "png"));
} catch (IOException e) {
LOG.error("Error generating UML", e, fileName, String.valueOf(docComment.toString()), String.valueOf(docComment.getContainingFile()));
}
}
}
return MoreObjects.firstNonNull(urls, Collections.<String, URL>emptyMap());
}
Aggregations