use of org.eclipse.jdt.core.dom.TagElement in project che by eclipse.
the class JavadocContentAccess2 method getReturnDescription.
CharSequence getReturnDescription() {
if (fReturnDescription == null) {
fReturnDescription = new StringBuffer();
fBuf = fReturnDescription;
fLiteralContent = 0;
List<TagElement> tags = fJavadoc.tags();
for (Iterator<TagElement> iter = tags.iterator(); iter.hasNext(); ) {
TagElement tag = iter.next();
String tagName = tag.getTagName();
if (TagElement.TAG_RETURN.equals(tagName)) {
handleContentElements(tag.fragments());
break;
}
}
fBuf = null;
}
return fReturnDescription.length() > 0 ? fReturnDescription : null;
}
use of org.eclipse.jdt.core.dom.TagElement in project che by eclipse.
the class JavadocContentAccess2 method handleParameterTags.
private void handleParameterTags(List<TagElement> tags, List<String> parameterNames, CharSequence[] parameterDescriptions) {
if (tags.size() == 0 && containsOnlyNull(parameterNames))
return;
handleBlockTagTitle(JavaDocMessages.JavaDoc2HTMLTextReader_parameters_section);
for (Iterator<TagElement> iter = tags.iterator(); iter.hasNext(); ) {
TagElement tag = iter.next();
fBuf.append(BlOCK_TAG_ENTRY_START);
handleParamTag(tag);
fBuf.append(BlOCK_TAG_ENTRY_END);
}
for (int i = 0; i < parameterDescriptions.length; i++) {
CharSequence description = parameterDescriptions[i];
String name = parameterNames.get(i);
if (name != null) {
fBuf.append(BlOCK_TAG_ENTRY_START);
fBuf.append(PARAM_NAME_START);
fBuf.append(name);
fBuf.append(PARAM_NAME_END);
if (description != null)
fBuf.append(description);
fBuf.append(BlOCK_TAG_ENTRY_END);
}
}
}
use of org.eclipse.jdt.core.dom.TagElement in project che by eclipse.
the class JavadocContentAccess2 method handleExceptionTags.
private void handleExceptionTags(List<TagElement> tags, List<String> exceptionNames, CharSequence[] exceptionDescriptions) {
if (tags.size() == 0 && containsOnlyNull(exceptionNames))
return;
handleBlockTagTitle(JavaDocMessages.JavaDoc2HTMLTextReader_throws_section);
for (Iterator<TagElement> iter = tags.iterator(); iter.hasNext(); ) {
TagElement tag = iter.next();
fBuf.append(BlOCK_TAG_ENTRY_START);
handleThrowsTag(tag);
fBuf.append(BlOCK_TAG_ENTRY_END);
}
for (int i = 0; i < exceptionDescriptions.length; i++) {
CharSequence description = exceptionDescriptions[i];
String name = exceptionNames.get(i);
if (name != null) {
fBuf.append(BlOCK_TAG_ENTRY_START);
handleLink(Collections.singletonList(fJavadoc.getAST().newSimpleName(name)));
if (description != null) {
fBuf.append(JavaElementLabels.CONCAT_STRING);
fBuf.append(description);
}
fBuf.append(BlOCK_TAG_ENTRY_END);
}
}
}
use of org.eclipse.jdt.core.dom.TagElement in project che by eclipse.
the class JavadocContentAccess2 method getInheritedParamDescription.
CharSequence getInheritedParamDescription(int paramIndex) throws JavaModelException {
if (fMethod != null) {
String[] parameterNames = fMethod.getParameterNames();
if (fParamDescriptions == null) {
fParamDescriptions = new StringBuffer[parameterNames.length];
} else {
StringBuffer description = fParamDescriptions[paramIndex];
if (description != null) {
return description.length() > 0 ? description : null;
}
}
StringBuffer description = new StringBuffer();
fParamDescriptions[paramIndex] = description;
fBuf = description;
fLiteralContent = 0;
String paramName = parameterNames[paramIndex];
List<TagElement> tags = fJavadoc.tags();
for (Iterator<TagElement> iter = tags.iterator(); iter.hasNext(); ) {
TagElement tag = iter.next();
String tagName = tag.getTagName();
if (TagElement.TAG_PARAM.equals(tagName)) {
List<? extends ASTNode> fragments = tag.fragments();
if (fragments.size() > 0) {
Object first = fragments.get(0);
if (first instanceof SimpleName) {
String name = ((SimpleName) first).getIdentifier();
if (name.equals(paramName)) {
handleContentElements(fragments.subList(1, fragments.size()));
break;
}
}
}
}
}
fBuf = null;
return description.length() > 0 ? description : null;
}
return null;
}
use of org.eclipse.jdt.core.dom.TagElement in project che by eclipse.
the class JavadocContentAccess2 method getExceptionDescription.
CharSequence getExceptionDescription(String simpleName) {
if (fMethod != null) {
if (fExceptionDescriptions == null) {
fExceptionDescriptions = new HashMap<String, StringBuffer>();
} else {
StringBuffer description = fExceptionDescriptions.get(simpleName);
if (description != null) {
return description.length() > 0 ? description : null;
}
}
StringBuffer description = new StringBuffer();
fExceptionDescriptions.put(simpleName, description);
fBuf = description;
fLiteralContent = 0;
List<TagElement> tags = fJavadoc.tags();
for (Iterator<TagElement> iter = tags.iterator(); iter.hasNext(); ) {
TagElement tag = iter.next();
String tagName = tag.getTagName();
if (TagElement.TAG_THROWS.equals(tagName) || TagElement.TAG_EXCEPTION.equals(tagName)) {
List<? extends ASTNode> fragments = tag.fragments();
if (fragments.size() > 0) {
Object first = fragments.get(0);
if (first instanceof Name) {
String name = ASTNodes.getSimpleNameIdentifier((Name) first);
if (name.equals(simpleName)) {
if (fragments.size() > 1)
handleContentElements(fragments.subList(1, fragments.size()));
break;
}
}
}
}
}
fBuf = null;
return description.length() > 0 ? description : null;
}
return null;
}
Aggregations