Java Code Examples for org.eclipse.jdt.core.dom.TextElement#setText()
The following examples show how to use
org.eclipse.jdt.core.dom.TextElement#setText() .
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: 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 2
Source File: JavadocTagsSubProcessor.java From eclipse.jdt.ls with Eclipse Public License 2.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 3
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 4
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 5
Source File: ChangeSignatureProcessor.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
private TagElement createReturnTag() { TagElement returnNode= getASTRewrite().getAST().newTagElement(); returnNode.setTagName(TagElement.TAG_RETURN); TextElement textElement= getASTRewrite().getAST().newTextElement(); String text= StubUtility.getTodoTaskTag(fCuRewrite.getCu().getJavaProject()); if (text != null) textElement.setText(text); //TODO: use template with {@todo} ... returnNode.fragments().add(textElement); return returnNode; }
Example 6
Source File: ChangeSignatureProcessor.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
private TagElement createExceptionTag(String simpleName) { TagElement excptNode= getASTRewrite().getAST().newTagElement(); excptNode.setTagName(TagElement.TAG_THROWS); SimpleName nameNode= getASTRewrite().getAST().newSimpleName(simpleName); excptNode.fragments().add(nameNode); TextElement textElement= getASTRewrite().getAST().newTextElement(); String text= StubUtility.getTodoTaskTag(fCuRewrite.getCu().getJavaProject()); if (text != null) textElement.setText(text); //TODO: use template with {@todo} ... excptNode.fragments().add(textElement); return excptNode; }
Example 7
Source File: JavadocUtil.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
public static TagElement createParamTag(String parameterName, AST ast, IJavaProject javaProject) { TagElement paramNode= ast.newTagElement(); paramNode.setTagName(TagElement.TAG_PARAM); SimpleName simpleName= ast.newSimpleName(parameterName); paramNode.fragments().add(simpleName); TextElement textElement= ast.newTextElement(); String text= StubUtility.getTodoTaskTag(javaProject); if (text != null) textElement.setText(text); //TODO: use template with {@todo} ... paramNode.fragments().add(textElement); return paramNode; }
Example 8
Source File: JavadocTagsSubProcessor.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 4 votes |
private void insertTabStop(ASTRewrite rewriter, List<ASTNode> fragments, String linkedName) { TextElement textElement= rewriter.getAST().newTextElement(); textElement.setText(""); //$NON-NLS-1$ fragments.add(textElement); }
Example 9
Source File: JavadocTagsSubProcessor.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
private void insertTabStop(ASTRewrite rewriter, List<ASTNode> fragments, String linkedName) { TextElement textElement= rewriter.getAST().newTextElement(); textElement.setText(""); //$NON-NLS-1$ fragments.add(textElement); addLinkedPosition(rewriter.track(textElement), false, linkedName); }
Example 10
Source File: ChangeMethodSignatureProposal.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
private void insertTabStop(ASTRewrite rewriter, List<ASTNode> fragments, String linkedName) { TextElement textElement= rewriter.getAST().newTextElement(); textElement.setText(""); //$NON-NLS-1$ fragments.add(textElement); addLinkedPosition(rewriter.track(textElement), false, linkedName); }