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

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


   */
  public final ASTNode createStringPlaceholder(String code, int nodeType) {
    if (code == null) {
      throw new IllegalArgumentException();
    }
    ASTNode placeholder= getNodeStore().newPlaceholderNode(nodeType);
    if (placeholder == null) {
      throw new IllegalArgumentException("String placeholder is not supported for type" + nodeType); //$NON-NLS-1$
    }
   
    getNodeStore().markAsStringPlaceholder(placeholder, code);
View Full Code Here


    }
    validateIsExistingNode(node);
    validateIsCorrectAST(node);
    CopySourceInfo info= getRewriteEventStore().markAsCopySource(node.getParent(), node.getLocationInParent(), node, isMove);
 
    ASTNode placeholder= getNodeStore().newPlaceholderNode(node.getNodeType());
    if (placeholder == null) {
      throw new IllegalArgumentException("Creating a target node is not supported for nodes of type" + node.getClass().getName()); //$NON-NLS-1$
    }
    getNodeStore().markAsCopyTarget(placeholder, info);
   
View Full Code Here

*/
public CreateInitializerOperation(IType parentElement, String source) {
  super(parentElement, source, false);
}
protected ASTNode generateElementAST(ASTRewrite rewriter, IDocument document, ICompilationUnit cu) throws JavaModelException {
  ASTNode node = super.generateElementAST(rewriter, document, cu);
  if (node.getNodeType() != ASTNode.INITIALIZER)
    throw new JavaModelException(new JavaModelStatus(IJavaModelStatusConstants.INVALID_CONTENTS));
  return node;
}
View Full Code Here

        final List myCopy = new ArrayList();
        myCopy.addAll(elements);
        Collections.sort(myCopy, SortElementsOperation.this.comparator);
       
        for (int i = 0; i < elements.size(); i++) {
          ASTNode oldNode= (ASTNode) elements.get(i);
          ASTNode newNode= (ASTNode) myCopy.get(i);
          if (oldNode != newNode) {
            listRewrite.replace(oldNode, rewriter.createMoveTarget(newNode), group);
            hasChanges[0]= true;
          }
        }
View Full Code Here

    if (this.listEntries == null) {
      // create if not yet existing
      int nNodes= this.originalNodes.size();
      this.listEntries= new ArrayList(nNodes * 2);
      for (int i= 0; i < nNodes; i++) {
        ASTNode node= (ASTNode) this.originalNodes.get(i);
        // all nodes unchanged
        this.listEntries.add(new NodeRewriteEvent(node, node));
      }
    }
    return this.listEntries;
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

  private void deleteElement(IJavaElement elementToRemove, ICompilationUnit cu) throws JavaModelException {
    // ensure cu is consistent (noop if already consistent)
    cu.makeConsistent(this.progressMonitor);
    this.parser.setSource(cu);
    CompilationUnit astCU = (CompilationUnit) this.parser.createAST(this.progressMonitor);
    ASTNode node = ((JavaElement) elementToRemove).findNode(astCU);
    if (node == null)
      Assert.isTrue(false, "Failed to locate " + elementToRemove.getElementName() + " in " + cu.getElementName()); //$NON-NLS-1$//$NON-NLS-2$
    IDocument document = getDocument(cu);
    AST ast = astCU.getAST();
    ASTRewrite rewriter = ASTRewrite.create(ast);
View Full Code Here

   * @param nodeType Type of the node to create. Use the type constants in {@link NodeInfoStore}.
   * @return Returns a place holder node.
   */
  public final ASTNode newPlaceholderNode(int nodeType) {
      try {
        ASTNode node= this.ast.createInstance(nodeType);
        switch (node.getNodeType()) {
        case ASTNode.FIELD_DECLARATION:
            ((FieldDeclaration) node).fragments().add(this.ast.newVariableDeclarationFragment());
            break;
        case ASTNode.MODIFIER:
            ((Modifier) node).setKeyword(Modifier.ModifierKeyword.ABSTRACT_KEYWORD);
View Full Code Here

      this.foundBinding = node.resolveBinding();
    return true;
  }
 
  public boolean visit(AnonymousClassDeclaration node) {
    ASTNode name;
    ASTNode parent = node.getParent();
    switch (parent.getNodeType()) {
      case ASTNode.CLASS_INSTANCE_CREATION:
        name = ((ClassInstanceCreation) parent).getType();
        break;
      case ASTNode.ENUM_CONSTANT_DECLARATION:
        name = ((EnumConstantDeclaration) parent).getName();
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.