Package org.aspectj.org.eclipse.jdt.core.dom

Examples of org.aspectj.org.eclipse.jdt.core.dom.ASTNode


}
public ASTNode findNode(org.aspectj.org.eclipse.jdt.core.dom.CompilationUnit ast) {
  // For field declarations, a variable declaration fragment is returned
  // Return the FieldDeclaration instead
  // For enum constant declaration, we return the node directly
  ASTNode node = super.findNode(ast);
  if (node == null) return null;
  if (node.getNodeType() == ASTNode.ENUM_CONSTANT_DECLARATION) {
    return node;
  }
  return node.getParent();
}
View Full Code Here


    this.cuAST = parse(cu);
   
    AST ast = this.cuAST.getAST();
    ASTRewrite rewriter = ASTRewrite.create(ast);
    IDocument document = getDocument(cu);
    ASTNode child = generateElementAST(rewriter, document, cu);
    if (child != null) {
      ASTNode parent = ((JavaElement) getParentElement()).findNode(this.cuAST);
      if (parent == null)
        parent = this.cuAST;
      insertASTNode(rewriter, parent, child);
      apply(rewriter, document, cu.getJavaProject().getOptions(true));
    }
View Full Code Here

    if (propertyDescriptor instanceof ChildListPropertyDescriptor) {
      ChildListPropertyDescriptor childListPropertyDescriptor = (ChildListPropertyDescriptor) propertyDescriptor;
       ListRewrite rewrite = rewriter.getListRewrite(parent, childListPropertyDescriptor);
       switch (this.insertionPolicy) {
         case INSERT_BEFORE:
           ASTNode element = ((JavaElement) this.anchorElement).findNode(this.cuAST);
           if (childListPropertyDescriptor.getElementType().isAssignableFrom(element.getClass()))
             rewrite.insertBefore(child, element, null);
           else
             // case of an empty import list: the anchor element is the top level type and cannot be used in insertBefore as it is not the same type
             rewrite.insertLast(child, null);
           break;
         case INSERT_AFTER:
           element = ((JavaElement) this.anchorElement).findNode(this.cuAST);
           if (childListPropertyDescriptor.getElementType().isAssignableFrom(element.getClass()))
             rewrite.insertAfter(child, element, null);
           else
             // case of an empty import list: the anchor element is the top level type and cannot be used in insertAfter as it is not the same type
             rewrite.insertLast(child, null);
           break;
View Full Code Here

*/
public CreateTypeOperation(IJavaElement parentElement, String source, boolean force) {
  super(parentElement, source, force);
}
protected ASTNode generateElementAST(ASTRewrite rewriter, IDocument document, ICompilationUnit cu) throws JavaModelException {
  ASTNode node = super.generateElementAST(rewriter, document, cu);
  if (!(node instanceof AbstractTypeDeclaration))
    throw new JavaModelException(new JavaModelStatus(IJavaModelStatusConstants.INVALID_CONTENTS));
  return node;
}
View Full Code Here

    }
  }
  return this.parameterTypes;
}
protected ASTNode generateElementAST(ASTRewrite rewriter, IDocument document, ICompilationUnit cu) throws JavaModelException {
  ASTNode node = super.generateElementAST(rewriter, document, cu);
  if (node.getNodeType() != ASTNode.METHOD_DECLARATION)
    throw new JavaModelException(new JavaModelStatus(IJavaModelStatusConstants.INVALID_CONTENTS));
  return node;
}
View Full Code Here

  }
  public void setLeft(PointcutDesignator left) {
    if (left == null) {
      throw new IllegalArgumentException();
    }
    ASTNode oldChild = this.left;
    preReplaceChild(oldChild, left, LEFT_PROPERTY);
    this.left = left;
    postReplaceChild(oldChild, left, LEFT_PROPERTY);
  }
View Full Code Here

  }
  public void setRight(PointcutDesignator right) {
    if (right == null) {
      throw new IllegalArgumentException();
    }
    ASTNode oldChild = this.right;
    preReplaceChild(oldChild, right, RIGHT_PROPERTY);
    this.right = right;
    postReplaceChild(oldChild, right, RIGHT_PROPERTY);
  }
View Full Code Here

  }
  public void setBody(PointcutDesignator body) {
    if (body == null) {
      throw new IllegalArgumentException();
    }
    ASTNode oldChild = this.body;
    preReplaceChild(oldChild, body, BODY_PROPERTY);
    this.body = body;
    postReplaceChild(oldChild, body, BODY_PROPERTY);
  }
View Full Code Here

  }
  public void setBody(PointcutDesignator body) {
    if (body == null) {
      throw new IllegalArgumentException();
    }
    ASTNode oldChild = this.body;
    preReplaceChild(oldChild, body, BODY_PROPERTY);
    this.body = body;
    postReplaceChild(oldChild, body, BODY_PROPERTY);
  }
View Full Code Here

  }
  public void setBody(PointcutDesignator body) {
    if (body == null) {
      throw new IllegalArgumentException();
    }
    ASTNode oldChild = this.body;
    preReplaceChild(oldChild, body, BODY_PROPERTY);
    this.body = body;
    postReplaceChild(oldChild, body, BODY_PROPERTY);
  }
View Full Code Here

TOP

Related Classes of org.aspectj.org.eclipse.jdt.core.dom.ASTNode

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.