org.eclipse.jdt.core.dom.TagElement Java Examples
The following examples show how to use
org.eclipse.jdt.core.dom.TagElement.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JavadocTagsSubProcessor.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 6 votes |
public static TagElement findTag(Javadoc javadoc, String name, String arg) { List<TagElement> tags= javadoc.tags(); int nTags= tags.size(); for (int i= 0; i < nTags; i++) { TagElement curr= tags.get(i); if (name.equals(curr.getTagName())) { if (arg != null) { String argument= getArgument(curr); if (arg.equals(argument)) { return curr; } } else { return curr; } } } return null; }
Example #2
Source File: MethodLimitQuickfix.java From eclipse-cs with GNU Lesser General Public License v2.1 | 6 votes |
/** * {@inheritDoc} */ protected ASTVisitor handleGetCorrectingASTVisitor(final IRegion lineInfo, final int markerStartOffset) { return new ASTVisitor() { @SuppressWarnings("unchecked") public boolean visit(MethodDeclaration node) { Javadoc doc = node.getJavadoc(); if (doc == null) { doc = node.getAST().newJavadoc(); node.setJavadoc(doc); } TagElement newTag = node.getAST().newTagElement(); newTag.setTagName("TODO Added by MethodLimit Sample quickfix"); doc.tags().add(0, newTag); return true; } }; }
Example #3
Source File: JavadocContentAccess2.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
private void handleBlockTags(String title, List<TagElement> tags) { if (tags.isEmpty()) return; handleBlockTagTitle(title); for (Iterator<TagElement> iter= tags.iterator(); iter.hasNext(); ) { TagElement tag= iter.next(); fBuf.append(BlOCK_TAG_ENTRY_START); if (TagElement.TAG_SEE.equals(tag.getTagName())) { handleSeeTag(tag); } else { handleContentElements(tag.fragments()); } fBuf.append(BlOCK_TAG_ENTRY_END); } }
Example #4
Source File: XbaseHoverDocumentationProvider.java From xtext-eclipse with Eclipse Public License 2.0 | 6 votes |
protected boolean handleDocRoot(TagElement node) { if (!TagElement.TAG_DOCROOT.equals(node.getTagName())) return false; URI uri = EcoreUtil.getURI(context); if (uri.isPlatformResource()) { IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(uri.toPlatformString(true))); IPath fullPath = file.getFullPath(); IProject project = file.getProject(); if (project.exists() && project.isOpen()) { for (IContainer f : sourceFolderProvider.getSourceFolders(project)) { if (f.getFullPath().isPrefixOf(fullPath)) { IPath location = f.getLocation(); if (location != null) { buffer.append(location.toFile().toURI().toASCIIString()); return true; } } } } } return true; }
Example #5
Source File: XbaseHoverDocumentationProvider.java From xtext-eclipse with Eclipse Public License 2.0 | 6 votes |
protected void handleParameters(EObject object, List<TagElement> parameters, List<String> parameterNames) { if (parameters.size() == 0 && containsOnlyNull(parameterNames)) return; handleBlockTagTitle("Parameters:"); for (Iterator<TagElement> iter = parameters.iterator(); iter.hasNext();) { TagElement tag = iter.next(); buffer.append(BlOCK_TAG_ENTRY_START); handleParamTag(tag); buffer.append(BlOCK_TAG_ENTRY_END); } for (int i = 0; i < parameterNames.size(); i++) { String name = parameterNames.get(i); if (name != null) { buffer.append(BlOCK_TAG_ENTRY_START); buffer.append(PARAM_NAME_START); buffer.append(name); buffer.append(PARAM_NAME_END); buffer.append(BlOCK_TAG_ENTRY_END); } } }
Example #6
Source File: JavadocTagsSubProcessor.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 6 votes |
public static void getRemoveJavadocTagProposals(IInvocationContext context, IProblemLocationCore problem, Collection<ChangeCorrectionProposal> proposals) { ASTNode node= problem.getCoveringNode(context.getASTRoot()); while (node != null && !(node instanceof TagElement)) { node= node.getParent(); } if (node == null) { return; } ASTRewrite rewrite= ASTRewrite.create(node.getAST()); rewrite.remove(node, null); String label= CorrectionMessages.JavadocTagsSubProcessor_removetag_description; proposals.add(new ASTRewriteCorrectionProposal(label, CodeActionKind.QuickFix, context.getCompilationUnit(), rewrite, IProposalRelevance.REMOVE_TAG)); }
Example #7
Source File: XbaseHoverDocumentationProvider.java From xtext-eclipse with Eclipse Public License 2.0 | 6 votes |
protected void handleBlockTags(String title, List<TagElement> tags) { if (tags.isEmpty()) return; handleBlockTagTitle(title); for (Iterator<TagElement> iter = tags.iterator(); iter.hasNext();) { TagElement tag = iter.next(); buffer.append(BlOCK_TAG_ENTRY_START); if (TagElement.TAG_SEE.equals(tag.getTagName())) { handleSeeTag(tag); } else { @SuppressWarnings("unchecked") List<ASTNode> fragments = tag.fragments(); handleContentElements(fragments); } buffer.append(BlOCK_TAG_ENTRY_END); } }
Example #8
Source File: JavadocContentAccess2.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
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; }
Example #9
Source File: XbaseHoverDocumentationProvider.java From xtext-eclipse with Eclipse Public License 2.0 | 6 votes |
protected void handleExceptionTags(List<TagElement> tags, Map<String, URI> exceptionNamesToURI) { if (tags.size() == 0 && containsOnlyNull(exceptionNamesToURI.values())) return; handleBlockTagTitle("Throws:"); for (Iterator<TagElement> iter = tags.iterator(); iter.hasNext();) { TagElement tag = iter.next(); buffer.append(BlOCK_TAG_ENTRY_START); handleThrowsTag(tag); buffer.append(BlOCK_TAG_ENTRY_END); } for (int i = 0; i < exceptionNamesToURI.size(); i++) { String name = Lists.newArrayList(exceptionNamesToURI.keySet()).get(i); if (name != null && exceptionNamesToURI.get(name) != null) { buffer.append(BlOCK_TAG_ENTRY_START); buffer.append(createLinkWithLabel(XtextElementLinks.XTEXTDOC_SCHEME, exceptionNamesToURI.get(name), name)); buffer.append(BlOCK_TAG_ENTRY_END); } } }
Example #10
Source File: JavadocContentAccess2.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
CharSequence getMainDescription() { if (fMainDescription == null) { fMainDescription= new StringBuffer(); fBuf= fMainDescription; fLiteralContent= 0; List<TagElement> tags= fJavadoc.tags(); for (Iterator<TagElement> iter= tags.iterator(); iter.hasNext(); ) { TagElement tag= iter.next(); String tagName= tag.getTagName(); if (tagName == null) { handleContentElements(tag.fragments()); break; } } fBuf= null; } return fMainDescription.length() > 0 ? fMainDescription : null; }
Example #11
Source File: JavadocTagsSubProcessor.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 6 votes |
private static String getArgument(TagElement curr) { List<? extends ASTNode> fragments= curr.fragments(); if (!fragments.isEmpty()) { Object first= fragments.get(0); if (first instanceof Name) { return ASTNodes.getSimpleNameIdentifier((Name) first); } else if (first instanceof TextElement && TagElement.TAG_PARAM.equals(curr.getTagName())) { String text= ((TextElement) first).getText(); if ("<".equals(text) && fragments.size() >= 3) { //$NON-NLS-1$ Object second= fragments.get(1); Object third= fragments.get(2); if (second instanceof Name && third instanceof TextElement && ">".equals(((TextElement) third).getText())) { //$NON-NLS-1$ return '<' + ASTNodes.getSimpleNameIdentifier((Name) second) + '>'; } } else if (text.startsWith(String.valueOf('<')) && text.endsWith(String.valueOf('>')) && text.length() > 2) { return text.substring(1, text.length() - 1); } } } return null; }
Example #12
Source File: JavaDoc2HTMLTextReader.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
private void handleTag(String tag, String tagContent) { tagContent= tagContent.trim(); if (TagElement.TAG_PARAM.equals(tag)) fParameters.add(tagContent); else if (TagElement.TAG_RETURN.equals(tag)) fReturn= tagContent; else if (TagElement.TAG_EXCEPTION.equals(tag)) fExceptions.add(tagContent); else if (TagElement.TAG_THROWS.equals(tag)) fExceptions.add(tagContent); else if (TagElement.TAG_AUTHOR.equals(tag)) fAuthors.add(substituteQualification(tagContent)); else if (TagElement.TAG_SEE.equals(tag)) fSees.add(substituteQualification(tagContent)); else if (TagElement.TAG_SINCE.equals(tag)) fSince.add(substituteQualification(tagContent)); else if (tagContent != null) fRest.add(new Pair(tag, tagContent)); }
Example #13
Source File: DelegateCreator.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 6 votes |
private TagElement getDelegateJavadocTag(BodyDeclaration declaration) throws JavaModelException { Assert.isNotNull(declaration); String msg= RefactoringCoreMessages.DelegateCreator_use_member_instead; int firstParam= msg.indexOf("{0}"); //$NON-NLS-1$ Assert.isTrue(firstParam != -1); List<ASTNode> fragments= new ArrayList<>(); TextElement text= getAst().newTextElement(); text.setText(msg.substring(0, firstParam).trim()); fragments.add(text); fragments.add(createJavadocMemberReferenceTag(declaration, getAst())); text= getAst().newTextElement(); text.setText(msg.substring(firstParam + 3).trim()); fragments.add(text); final TagElement tag= getAst().newTagElement(); tag.setTagName(TagElement.TAG_DEPRECATED); tag.fragments().addAll(fragments); return tag; }
Example #14
Source File: JavadocContentAccess2.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
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); } } }
Example #15
Source File: JavaDoc2HTMLTextReader.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 6 votes |
private void handleTag(String tag, String tagContent) { tagContent= tagContent.trim(); if (TagElement.TAG_PARAM.equals(tag)) { fParameters.add(tagContent); } else if (TagElement.TAG_RETURN.equals(tag)) { fReturn= tagContent; } else if (TagElement.TAG_EXCEPTION.equals(tag)) { fExceptions.add(tagContent); } else if (TagElement.TAG_THROWS.equals(tag)) { fExceptions.add(tagContent); } else if (TagElement.TAG_AUTHOR.equals(tag)) { fAuthors.add(substituteQualification(tagContent)); } else if (TagElement.TAG_SEE.equals(tag)) { fSees.add(substituteQualification(tagContent)); } else if (TagElement.TAG_SINCE.equals(tag)) { fSince.add(substituteQualification(tagContent)); } else if (tagContent != null) { fRest.add(new Pair(tag, tagContent)); } }
Example #16
Source File: ImportReferencesCollector.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
@Override public boolean visit(TagElement node) { String tagName= node.getTagName(); List<? extends ASTNode> list= node.fragments(); int idx= 0; if (tagName != null && !list.isEmpty()) { Object first= list.get(0); if (first instanceof Name) { if ("@throws".equals(tagName) || "@exception".equals(tagName)) { //$NON-NLS-1$//$NON-NLS-2$ typeRefFound((Name) first); } else if ("@see".equals(tagName) || "@link".equals(tagName) || "@linkplain".equals(tagName)) { //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ Name name= (Name) first; possibleTypeRefFound(name); } idx++; } } for (int i= idx; i < list.size(); i++) { doVisitNode(list.get(i)); } return false; }
Example #17
Source File: JavadocContentAccess2.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 6 votes |
CharSequence getMainDescription() { if (fMainDescription == null) { fMainDescription = new StringBuffer(); fBuf = fMainDescription; fLiteralContent = 0; List<TagElement> tags = fJavadoc.tags(); for (Iterator<TagElement> iter = tags.iterator(); iter.hasNext();) { TagElement tag = iter.next(); String tagName = tag.getTagName(); if (tagName == null) { handleContentElements(tag.fragments()); break; } } fBuf = null; } return fMainDescription.length() > 0 ? fMainDescription : null; }
Example #18
Source File: JavadocTagsSubProcessor.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
private void insertAllMissingTypeTags(ASTRewrite rewriter, TypeDeclaration typeDecl) { AST ast= typeDecl.getAST(); Javadoc javadoc= typeDecl.getJavadoc(); ListRewrite tagsRewriter= rewriter.getListRewrite(javadoc, Javadoc.TAGS_PROPERTY); List<TypeParameter> typeParams= typeDecl.typeParameters(); for (int i= typeParams.size() - 1; i >= 0; i--) { TypeParameter decl= typeParams.get(i); String name= '<' + decl.getName().getIdentifier() + '>'; if (findTag(javadoc, TagElement.TAG_PARAM, name) == null) { TagElement newTag= ast.newTagElement(); newTag.setTagName(TagElement.TAG_PARAM); TextElement text= ast.newTextElement(); text.setText(name); newTag.fragments().add(text); insertTabStop(rewriter, newTag.fragments(), "typeParam" + i); //$NON-NLS-1$ insertTag(tagsRewriter, newTag, getPreviousTypeParamNames(typeParams, decl)); } } }
Example #19
Source File: JavadocContentAccess2.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 6 votes |
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; }
Example #20
Source File: UMLModelASTReader.java From RefactoringMiner with MIT License | 6 votes |
private UMLJavadoc generateJavadoc(BodyDeclaration bodyDeclaration) { UMLJavadoc doc = null; Javadoc javaDoc = bodyDeclaration.getJavadoc(); if(javaDoc != null) { doc = new UMLJavadoc(); List<TagElement> tags = javaDoc.tags(); for(TagElement tag : tags) { UMLTagElement tagElement = new UMLTagElement(tag.getTagName()); List fragments = tag.fragments(); for(Object docElement : fragments) { tagElement.addFragment(docElement.toString()); } doc.addTag(tagElement); } } return doc; }
Example #21
Source File: JavadocContentAccess2.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 6 votes |
private void handleBlockTags(String title, List<TagElement> tags) { if (tags.isEmpty()) { return; } handleBlockTagTitle(title); for (Iterator<TagElement> iter = tags.iterator(); iter.hasNext();) { TagElement tag = iter.next(); fBuf.append(BLOCK_TAG_START); fBuf.append(BlOCK_TAG_ENTRY_START); if (TagElement.TAG_SEE.equals(tag.getTagName())) { handleSeeTag(tag); } else { handleContentElements(tag.fragments()); } fBuf.append(BlOCK_TAG_ENTRY_END); fBuf.append(BLOCK_TAG_END); } fBuf.append(BlOCK_TAG_ENTRY_END); }
Example #22
Source File: JavadocContentAccess2.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 6 votes |
private void handleReturnTag(TagElement tag, CharSequence returnDescription) { if (tag == null && returnDescription == null) { return; } handleBlockTagTitle(JavaDoc2HTMLTextReader_returns_section); fBuf.append(BLOCK_TAG_START); fBuf.append(BlOCK_TAG_ENTRY_START); if (tag != null) { handleContentElements(tag.fragments()); } else { fBuf.append(returnDescription); } fBuf.append(BlOCK_TAG_ENTRY_END); fBuf.append(BLOCK_TAG_END); fBuf.append(BlOCK_TAG_ENTRY_END); }
Example #23
Source File: DelegateCreator.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
private TagElement getDelegateJavadocTag(BodyDeclaration declaration) throws JavaModelException { Assert.isNotNull(declaration); String msg= RefactoringCoreMessages.DelegateCreator_use_member_instead; int firstParam= msg.indexOf("{0}"); //$NON-NLS-1$ Assert.isTrue(firstParam != -1); List<ASTNode> fragments= new ArrayList<ASTNode>(); TextElement text= getAst().newTextElement(); text.setText(msg.substring(0, firstParam).trim()); fragments.add(text); fragments.add(createJavadocMemberReferenceTag(declaration, getAst())); text= getAst().newTextElement(); text.setText(msg.substring(firstParam + 3).trim()); fragments.add(text); final TagElement tag= getAst().newTagElement(); tag.setTagName(TagElement.TAG_DEPRECATED); tag.fragments().addAll(fragments); return tag; }
Example #24
Source File: ChangeMethodSignatureProposal.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 5 votes |
private TagElement insertThrowsTag(ListRewrite tagRewriter, List<Type> exceptions, int currentIndex, TagElement newTagElement) { HashSet<String> previousNames= new HashSet<>(); for (int n = 0; n < currentIndex; n++) { Type curr= exceptions.get(n); previousNames.add(ASTNodes.getTypeName(curr)); } JavadocTagsSubProcessor.insertTag(tagRewriter, newTagElement, previousNames); return newTagElement; }
Example #25
Source File: JavaASTFlattener.java From xtext-xtend with Eclipse Public License 2.0 | 5 votes |
@Override public boolean visit(final TagElement node) { boolean _isNested = node.isNested(); if (_isNested) { this.appendToBuffer("{"); } else { this.appendLineWrapToBuffer(); this.appendToBuffer(" * "); } boolean previousRequiresWhiteSpace = false; String _tagName = node.getTagName(); boolean _tripleNotEquals = (_tagName != null); if (_tripleNotEquals) { this.appendToBuffer(node.getTagName()); previousRequiresWhiteSpace = true; } boolean previousRequiresNewLine = false; for (Iterator<? extends ASTNode> it = node.fragments().iterator(); it.hasNext();) { { ASTNode e = it.next(); boolean currentIncludesWhiteSpace = (e instanceof TextElement); if ((previousRequiresNewLine && currentIncludesWhiteSpace)) { this.appendLineWrapToBuffer(); this.appendToBuffer(" * "); } previousRequiresNewLine = currentIncludesWhiteSpace; if ((previousRequiresWhiteSpace && (!currentIncludesWhiteSpace))) { this.appendSpaceToBuffer(); } e.accept(this); previousRequiresWhiteSpace = ((!currentIncludesWhiteSpace) && (!(e instanceof TagElement))); } } boolean _isNested_1 = node.isNested(); if (_isNested_1) { this.appendToBuffer("}"); } return false; }
Example #26
Source File: ModifierCorrectionSubProcessor.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
public static void addOverridingDeprecatedMethodProposal(IInvocationContext context, IProblemLocation problem, Collection<ICommandAccess> proposals) { ICompilationUnit cu= context.getCompilationUnit(); ASTNode selectedNode= problem.getCoveringNode(context.getASTRoot()); if (!(selectedNode instanceof MethodDeclaration)) { return; } boolean is50OrHigher= JavaModelUtil.is50OrHigher(cu.getJavaProject()); MethodDeclaration methodDecl= (MethodDeclaration) selectedNode; AST ast= methodDecl.getAST(); ASTRewrite rewrite= ASTRewrite.create(ast); if (is50OrHigher) { Annotation annot= ast.newMarkerAnnotation(); annot.setTypeName(ast.newName("Deprecated")); //$NON-NLS-1$ rewrite.getListRewrite(methodDecl, methodDecl.getModifiersProperty()).insertFirst(annot, null); } Javadoc javadoc= methodDecl.getJavadoc(); if (javadoc != null || !is50OrHigher) { if (!is50OrHigher) { javadoc= ast.newJavadoc(); rewrite.set(methodDecl, MethodDeclaration.JAVADOC_PROPERTY, javadoc, null); } TagElement newTag= ast.newTagElement(); newTag.setTagName(TagElement.TAG_DEPRECATED); JavadocTagsSubProcessor.insertTag(rewrite.getListRewrite(javadoc, Javadoc.TAGS_PROPERTY), newTag, null); } String label= CorrectionMessages.ModifierCorrectionSubProcessor_overrides_deprecated_description; Image image= JavaPluginImages.get(JavaPluginImages.IMG_CORRECTION_CHANGE); ASTRewriteCorrectionProposal proposal= new ASTRewriteCorrectionProposal(label, cu, rewrite, IProposalRelevance.OVERRIDES_DEPRECATED, image); proposals.add(proposal); }
Example #27
Source File: ChangeMethodSignatureProposal.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 5 votes |
private TagElement findThrowsTag(MethodDeclaration decl, Type exception) { Javadoc javadoc= decl.getJavadoc(); if (javadoc != null) { String name= ASTNodes.getTypeName(exception); return JavadocTagsSubProcessor.findThrowsTag(javadoc, name); } return null; }
Example #28
Source File: ChangeMethodSignatureProposal.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
private TagElement findParamTag(MethodDeclaration decl, SingleVariableDeclaration param) { Javadoc javadoc= decl.getJavadoc(); if (javadoc != null) { return JavadocTagsSubProcessor.findParamTag(javadoc, param.getName().getIdentifier()); } return null; }
Example #29
Source File: ASTVisitors.java From tassal with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Override public void preVisit(final ASTNode node) { // If node is a foldableType add node to foldableStack and // add fold to allFolds if (foldableTypes.contains(node.getNodeType())) { final FoldableNode fn = tree.new FoldableNode(node); // If node is also a javadoc, add its range to javadocFolds // along with first line of javadoc comment if (node.getNodeType() == ASTNode.JAVADOC) { final Javadoc jdoc = (Javadoc) node; String firstTagLine = ""; if (!jdoc.tags().isEmpty()) { // Handle empty comment final String firstTag = ((TagElement) jdoc.tags().get(0)).toString(); firstTagLine = firstTag.split("\n")[1].substring(2); // If tokenizing comments add javadoc tokens to tree if (tokenizeComments) fn.addTerms(tokenizeCommentString(firstTag)); } javadocFolds.put(fn.getRange(), firstTagLine); } foldableStack.push(fn); allFolds.add(fn.getRange()); } }
Example #30
Source File: RenamedElementAstMatcher.java From gwt-eclipse-plugin with Eclipse Public License 1.0 | 5 votes |
@Override public boolean match(TagElement node, Object other) { if (!(other instanceof TagElement)) { return false; } TagElement o = (TagElement) other; return (safeRenamedEquals(node.getTagName(), o.getTagName(), oldName, newName) && safeSubtreeListMatch(node.fragments(), o.fragments())); }