Package org.eclipse.jdt.core.dom

Examples of org.eclipse.jdt.core.dom.TextElement


     * @param text comment text
     */
    public void addSourceComment(String text) {
        if (m_class instanceof AbstractTypeDeclaration) {
            Javadoc javadoc = getAST().newJavadoc();
            TextElement element = getAST().newTextElement();
            element.setText(text);
            TagElement tag = getAST().newTagElement();
            tag.fragments().add(element);
            javadoc.tags().add(tag);
            ((AbstractTypeDeclaration)m_class).setJavadoc(javadoc);
        } else {
View Full Code Here


     * @param decl
     */
    public void addJavaDoc(String doc, BodyDeclaration decl) {
        if (doc != null) {
            Javadoc javadoc = getAST().newJavadoc();
            TextElement element = getAST().newTextElement();
            element.setText(doc);
            TagElement tag = getAST().newTagElement();
            tag.fragments().add(element);
            javadoc.tags().add(tag);
            decl.setJavadoc(javadoc);
        }
View Full Code Here

     * @param text comment text, <code>null</code> value ignored
     */
    public void addSourceComment(String name, String text) {
        if (text != null) {
            AST ast = m_source.getAST();
            TextElement element = ast.newTextElement();
            element.setText(text);
            TagElement tag = ast.newTagElement();
            tag.setTagName(name);
            tag.fragments().add(element);
            Javadoc javadoc = m_declaration.getJavadoc();
            if (javadoc == null) {
View Full Code Here

                .getElementName()));
            unit.setPackage(packageDeclaration);
            TypeDeclaration type = ast.newTypeDeclaration();
            Javadoc comment = ast.newJavadoc();
            TagElement tag = ast.newTagElement();
            TextElement text = ast.newTextElement();
            text.setText("Generated class for method "
                + methodDec.getName());
            tag.fragments().add(text);
            comment.tags().add(tag);
            type.setJavadoc(comment);
            type.setInterface(false);
View Full Code Here

          // link up any references to model elements
          handleModelReferences(e, javaReference);
         
          result.add(e);
        } else if (o instanceof TextElement) {
          TextElement text = (TextElement) o;
          JavadocTextElement e = factory.createJavadocTextElement();
          e.setValue(text.getText());
          result.add(e);
        } else if (o instanceof MethodRef) {
          MethodRef ref = (MethodRef) o;
          JavaMethod method = getMethodFor(ref);
          if (method != null) {
View Full Code Here

        }

        // insert author tag if it doesn't exist.
        if(index > -1){
          TagElement authorTag = javadoc.getAST().newTagElement();
          TextElement authorText = javadoc.getAST().newTextElement();
          authorText.setText(author);
          authorTag.setTagName(TagElement.TAG_AUTHOR);

          @SuppressWarnings("unchecked")
          List<ASTNode> fragments = authorTag.fragments();
          fragments.add(authorText);
View Full Code Here

  {
    TagElement tag = javadoc.getAST().newTagElement();
    tag.setTagName(name);

    if(text != null){
      TextElement textElement = javadoc.getAST().newTextElement();
      textElement.setText(text);

      @SuppressWarnings("unchecked")
      List<ASTNode> fragments = tag.fragments();
      fragments.add(textElement);
    }
View Full Code Here

TOP

Related Classes of org.eclipse.jdt.core.dom.TextElement

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.