List of usage examples for org.eclipse.jdt.core.dom TagElement TAG_LINK
String TAG_LINK
To view the source code for org.eclipse.jdt.core.dom TagElement TAG_LINK.
Click Source Link
From source file:at.bestsolution.fxide.jdt.text.javadoc.JavaDoc2HTMLTextReader.java
License:Open Source License
private String printBlockTag(String tag, String tagContent) { if (TagElement.TAG_LINK.equals(tag) || TagElement.TAG_LINKPLAIN.equals(tag)) { char[] contentChars = tagContent.toCharArray(); boolean inParentheses = false; int labelStart = 0; for (int i = 0; i < contentChars.length; i++) { char nextChar = contentChars[i]; // tagContent always has a leading space if (i == 0 && Character.isWhitespace(nextChar)) { labelStart = 1;/* w ww . j a va 2 s . co m*/ continue; } if (nextChar == '(') { inParentheses = true; continue; } if (nextChar == ')') { inParentheses = false; continue; } // Stop at first whitespace that is not in parentheses if (!inParentheses && Character.isWhitespace(nextChar)) { labelStart = i + 1; break; } } if (TagElement.TAG_LINK.equals(tag)) return "<code>" + substituteQualification(tagContent.substring(labelStart)) + "</code>"; //$NON-NLS-1$//$NON-NLS-2$ else return substituteQualification(tagContent.substring(labelStart)); } else if (TagElement.TAG_LITERAL.equals(tag)) { return printLiteral(tagContent); } else if (TagElement.TAG_CODE.equals(tag)) { return "<code>" + printLiteral(tagContent) + "</code>"; //$NON-NLS-1$//$NON-NLS-2$ } // If something went wrong at least replace the {} with the content return substituteQualification(tagContent); }
From source file:at.bestsolution.fxide.jdt.text.javadoc.JavadocContentAccess2.java
License:Open Source License
private void handleInlineTagElement(TagElement node) { String name = node.getTagName(); if (TagElement.TAG_VALUE.equals(name) && handleValueTag(node)) return;/*from w ww. j a v a2 s . c o m*/ boolean isLink = TagElement.TAG_LINK.equals(name); boolean isLinkplain = TagElement.TAG_LINKPLAIN.equals(name); boolean isCode = TagElement.TAG_CODE.equals(name); boolean isLiteral = TagElement.TAG_LITERAL.equals(name); if (isLiteral || isCode) fLiteralContent++; if (isLink || isCode) fBuf.append("<code>"); //$NON-NLS-1$ if (isLink || isLinkplain) handleLink(node.fragments()); else if (isCode || isLiteral) handleContentElements(node.fragments(), true); else if (handleInheritDoc(node)) { // handled } else if (handleDocRoot(node)) { // handled } else { //print uninterpreted source {@tagname ...} for unknown tags int start = node.getStartPosition(); String text = fSource.substring(start, start + node.getLength()); fBuf.append(removeDocLineIntros(text)); } if (isLink || isCode) fBuf.append("</code>"); //$NON-NLS-1$ if (isLiteral || isCode) fLiteralContent--; }
From source file:com.servoy.eclipse.docgenerator.generators.DocumentationDataDistilled.java
License:Open Source License
public DocumentationDataDistilled(IMemberMetaModel memberMM, TypeMetaModel typeMM, JavadocMetaModel jdoc, MetaModelHolder holder) {/*from w ww. j av a 2s . c o m*/ Set<DocumentationWarning> warnings = memberMM.getWarnings(); String location = memberMM.getFullSignature(); boolean clean = true; ClientSupport typeCsp = typeMM.getServoyClientSupport(holder); ClientSupport csp = typeCsp == null ? ClientSupport.Default : typeCsp; texts = new ArrayList<Pair<ClientSupport, String>>(); summaries = new ArrayList<Pair<ClientSupport, String>>(); String descriptionText = ExtractorUtil.grabExactlyOne(JavadocMetaModel.TEXT_TAG, clean, jdoc, warnings, location); String mobileDescriptionText = ExtractorUtil.grabExactlyOne(TAG_MOBILEDESCRIPTION, clean, jdoc, warnings, location); List<Pair<ClientSupport, String>> txts = new ArrayList<Pair<ClientSupport, String>>(); if (mobileDescriptionText != null && mobileDescriptionText.trim().length() > 0) { txts.add(new Pair<ClientSupport, String>(ClientSupport.mc, mobileDescriptionText.trim())); csp = csp.remove(ClientSupport.mc); } if (descriptionText != null && descriptionText.trim().length() > 0) { txts.add(new Pair<ClientSupport, String>(csp, descriptionText)); } setTexts(txts); String sample = ExtractorUtil.grabExactlyOne(TAG_SAMPLE, clean, jdoc, warnings, location); String mSample = ExtractorUtil.grabExactlyOne(TAG_MOBILESAMPLE, clean, jdoc, warnings, location); ClientSupport aux = typeCsp == null ? ClientSupport.Default : typeCsp; if (mSample != null && mSample.trim().length() > 0) { // add back the "*/" mSample = Pattern.compile("\\*/").matcher(mSample).replaceAll("*/"); addSample(ClientSupport.mc, mSample); aux = aux.remove(ClientSupport.mc); } if (sample != null && sample.trim().length() > 0) { // add back the "*/" sample = Pattern.compile("\\*/").matcher(sample).replaceAll("*/"); addSample(aux, sample); } deprecatedText = ExtractorUtil.grabExactlyOne(TagElement.TAG_DEPRECATED, clean, jdoc, warnings, location); ret = ExtractorUtil.grabExactlyOne(TagElement.TAG_RETURN, clean, jdoc, warnings, location); since = ExtractorUtil.grabExactlyOne(TagElement.TAG_SINCE, clean, jdoc, warnings, location); until = ExtractorUtil.grabExactlyOne(TAG_UNTIL, clean, jdoc, warnings, location); sameAs = ExtractorUtil.grabReference(TAG_SAMEAS, jdoc, warnings, location); if (sameAs != null) { sameAs.setEnclosingType(typeMM.getName().getQualifiedName()); } cloneSample = ExtractorUtil.grabReference(TAG_SAMPLE_AS, jdoc, warnings, location); if (cloneSample != null) { cloneSample.setEnclosingType(typeMM.getName().getQualifiedName()); } cloneDescription = ExtractorUtil.grabReference(TAG_CLONEDESC, jdoc, warnings, location); if (cloneDescription != null) { cloneDescription.setEnclosingType(typeMM.getName().getQualifiedName()); } JavadocTagPart specialTag = ExtractorUtil.grabFirstTag(TAG_SPECIAL, jdoc, true, warnings, location); if (specialTag != null) { special = true; } JavadocTagPart simplifiedSignatureTag = ExtractorUtil.grabFirstTag(TAG_SIMPLIFIEDSIGNATURE, jdoc, true, warnings, location); if (simplifiedSignatureTag != null) { simplifiedSignature = true; } JavadocTagPart staticCallTag = ExtractorUtil.grabFirstTag(TAG_STATICCALL, jdoc, true, warnings, location); if (staticCallTag != null) { staticCall = true; } List<JavadocTagPart> paramTags = jdoc.findTags(TagElement.TAG_PARAM); for (JavadocTagPart paramTag : paramTags) { String paramText = paramTag.getAsString(clean); paramText = paramText.trim(); StringTokenizer st = new StringTokenizer(paramText); if (st.hasMoreTokens()) { String paramName = st.nextToken(); boolean isOptional = false; String paramDescription = null; if (st.hasMoreTokens()) { String maybeOptional = st.nextToken(); if (maybeOptional.equals(FLAG_OPTIONAL)) { isOptional = true; int idx = paramText.indexOf(FLAG_OPTIONAL); paramDescription = paramText.substring(idx + FLAG_OPTIONAL.length()).trim(); } else { paramDescription = paramText.substring(paramName.length()).trim(); } } if (paramDescription == null) { paramDescription = ""; warnings.add(new DocumentationWarning(WarningType.ParamTagWithoutContent, location, TagElement.TAG_PARAM + " tag without text: '" + paramName + "'.")); } DocumentedParameterData parData = new DocumentedParameterData(paramName, isOptional, paramDescription); parameters.add(parData); } else { warnings.add(new DocumentationWarning(WarningType.EmptyTag, location, "Empty " + TagElement.TAG_PARAM + " tag.")); } } List<JavadocTagPart> linkTags = jdoc.findTags(TagElement.TAG_LINK); for (JavadocTagPart linkTag : linkTags) { String linkText = linkTag.getAsString(clean).trim(); int idx = linkText.indexOf(' '); if (idx >= 0) { linkText = linkText.substring(0, idx); } links.add(linkText); } }
From source file:org.eclipse.xtext.xbase.ui.hover.XbaseHoverDocumentationProvider.java
License:Open Source License
protected void handleInlineTagElement(TagElement node) { String name = node.getTagName(); if (TagElement.TAG_VALUE.equals(name) && handleValueTag(node)) return;// w w w. j ava2 s . c om boolean isLink = TagElement.TAG_LINK.equals(name); boolean isLinkplain = TagElement.TAG_LINKPLAIN.equals(name); boolean isCode = TagElement.TAG_CODE.equals(name); boolean isLiteral = TagElement.TAG_LITERAL.equals(name); if (isLiteral || isCode) fLiteralContent++; if (isLink || isCode) buffer.append("<code>"); //$NON-NLS-1$ if (isLink || isLinkplain) handleLink(node.fragments()); else if (isCode || isLiteral) { @SuppressWarnings("unchecked") List<ASTNode> fragments = node.fragments(); handleContentElements(fragments, true); } else if (handleInheritDoc(node)) { // handled } else if (handleDocRoot(node)) { // handled } else { //print uninterpreted source {@tagname ...} for unknown tags int start = node.getStartPosition(); String text = rawJavaDoc.substring(start, start + node.getLength()); buffer.append(removeDocLineIntros(text)); } if (isLink || isCode) buffer.append("</code>"); //$NON-NLS-1$ if (isLiteral || isCode) fLiteralContent--; }
From source file:org.jboss.tools.vscode.javadoc.internal.JavaDoc2MarkdownTextReader.java
License:Open Source License
private String printBlockTag(String tag, String tagContent) { if (TagElement.TAG_LINK.equals(tag) || TagElement.TAG_LINKPLAIN.equals(tag)) { char[] contentChars = tagContent.toCharArray(); boolean inParentheses = false; int labelStart = 0; for (int i = 0; i < contentChars.length; i++) { char nextChar = contentChars[i]; // tagContent always has a leading space if (i == 0 && Character.isWhitespace(nextChar)) { labelStart = 1;/*from w ww . ja va 2s. c o m*/ continue; } if (nextChar == '(') { inParentheses = true; continue; } if (nextChar == ')') { inParentheses = false; continue; } // Stop at first whitespace that is not in parentheses if (!inParentheses && Character.isWhitespace(nextChar)) { labelStart = i + 1; break; } } if (TagElement.TAG_LINK.equals(tag)) return "`" + substituteQualification(tagContent.substring(labelStart)) + "`"; //$NON-NLS-1$//$NON-NLS-2$ else return substituteQualification(tagContent.substring(labelStart)); } else if (TagElement.TAG_LITERAL.equals(tag)) { return printLiteral(tagContent); } else if (TagElement.TAG_CODE.equals(tag)) { return "`" + printLiteral(tagContent) + "`"; //$NON-NLS-1$//$NON-NLS-2$ } // If something went wrong at least replace the {} with the content return substituteQualification(tagContent); }
From source file:sharpen.core.CSharpBuilder.java
License:Open Source License
private CSDocNode mapTagElement(TagElement element) { String tagName = element.getTagName(); if (TagElement.TAG_PARAM.equals(tagName)) { return mapTagParam(element); } else if (TagElement.TAG_RETURN.equals(tagName)) { return createTagNode("returns", element); } else if (TagElement.TAG_LINK.equals(tagName)) { return mapTagLink(element); } else if (TagElement.TAG_THROWS.equals(tagName)) { return mapTagThrows(element); } else if (TagElement.TAG_SEE.equals(tagName)) { return mapTagWithCRef("seealso", element); }// w w w . j a v a 2s .c o m return createTagNode(tagName.substring(1), element); }