Package org.eclipse.jdt.core.dom

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


    if (node == null) {
      throw new IllegalArgumentException();
    }

    StructuralPropertyDescriptor property;
    ASTNode parent;
    if (RewriteEventStore.isNewNode(node)) { // remove a new node, bug 164862
      PropertyLocation location= this.eventStore.getPropertyLocation(node, RewriteEventStore.NEW);
      if (location != null) {
        property= location.getProperty();
        parent= location.getParent();
View Full Code Here


    if (node == null) {
      throw new IllegalArgumentException();
    }

    StructuralPropertyDescriptor property;
    ASTNode parent;
    if (RewriteEventStore.isNewNode(node)) { // replace a new node, bug 164862
      PropertyLocation location= this.eventStore.getPropertyLocation(node, RewriteEventStore.NEW);
      if (location != null) {
        property= location.getProperty();
        parent= location.getParent();
View Full Code Here

   */
  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

    if (first == null || last == null) {
      throw new IllegalArgumentException();
    }

    NodeInfoStore nodeStore= this.rewriter.getNodeStore();
    ASTNode placeholder= nodeStore.newPlaceholderNode(first.getNodeType()); // revisit: could use list type
    if (placeholder == null) {
      throw new IllegalArgumentException("Creating a target node is not supported for nodes of type" + first.getClass().getName()); //$NON-NLS-1$
    }

    Block internalPlaceHolder= nodeStore.createCollapsePlaceholder();
View Full Code Here

          }
        }
      }
    }
    if (value instanceof ASTNode) {
      ASTNode node= (ASTNode) value;
      return new PropertyLocation(node.getParent(), node.getLocationInParent());
    }
    return null;
  }
View Full Code Here

  }

  private void revertListWithRanges(RewriteEvent[] childEvents, Set placeholders, List revertedChildren) {
    for (int i= 0; i < childEvents.length; i++) {
      RewriteEvent event= childEvents[i];
      ASTNode node= (ASTNode) event.getOriginalValue();
      if (placeholders.contains(node)) {
        RewriteEvent[] placeholderChildren= getListEvent(node, Block.STATEMENTS_PROPERTY, false).getChildren();
        revertListWithRanges(placeholderChildren, placeholders, revertedChildren);
      } else {
        revertedChildren.add(event);
View Full Code Here

    Iterator rangeInfoIterator= rangeInfos.iterator();
    NodeRangeInfo nextInfo= (NodeRangeInfo) rangeInfoIterator.next();

    for (int k= 0; k < childEvents.length; k++) {
      RewriteEvent event= childEvents[k];
      ASTNode node= (ASTNode) event.getOriginalValue();
      // check for ranges and add a placeholder for them
      while (nextInfo != null && node == nextInfo.getStartNode()) { // is this child the beginning of a range?
        nextInfo.updatePlaceholderSourceRanges(sourceRangeComputer);

        Block internalPlaceholder= nextInfo.getInternalPlaceholder();
View Full Code Here

        int extendedStart = astCU.getExtendedStartPosition(pkg);
        if (pkgStart != extendedStart) {
          // keep the comments associated with package declaration
          // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=247757
          String commentSource = cu.getSource().substring(extendedStart, pkgStart);
          ASTNode comment = rewriter.createStringPlaceholder(commentSource, ASTNode.PACKAGE_DECLARATION);
          rewriter.set(astCU, CompilationUnit.PACKAGE_PROPERTY, comment, null);
        } else {
          rewriter.set(astCU, CompilationUnit.PACKAGE_PROPERTY, null, null);
        }
      }
View Full Code Here

      ICompilationUnit ic = a.getCompilationUnit();
      CompilationUnit cu = (CompilationUnit) ic;

      ASTParser astParser = ASTParser.newParser(AST.JLS3);
      astParser.setSource(cu.getContents());
      ASTNode node = astParser.createAST(new NullProgressMonitor());

      ASTNode aNode = a
          .findNode((org.eclipse.jdt.core.dom.CompilationUnit) node);
      if (aNode instanceof NormalAnnotation) {
        NormalAnnotation aA = (NormalAnnotation) aNode;
        List values = aA.values();
        for (Object exp : values) {
View Full Code Here

TOP

Related Classes of 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.