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

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


   * @see #createBefore(IJavaElement)
   */
  protected void insertASTNode(ASTRewrite rewriter, ASTNode parent, ASTNode child) throws JavaModelException {
    StructuralPropertyDescriptor propertyDescriptor = getChildPropertyDescriptor(parent);
    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

TOP

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

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.