Package org.eclipse.php.internal.core.ast.nodes

Examples of org.eclipse.php.internal.core.ast.nodes.ASTNode


    assertNotNull(program);

    // select the function declaration.
    int start = 6;
    ASTNode selectedNode = locateNode(program, start, 0);
    assertNotNull(selectedNode);

    assertEquals(PhpElementConciliator.CONCILIATOR_CONSTANT,
        PhpElementConciliator.concile(selectedNode));
View Full Code Here


    assertNotNull(program);

    // select the function declaration.
    int start = 6;
    ASTNode selectedNode = locateNode(program, start, 0);
    assertNotNull(selectedNode);

    assertEquals(PhpElementConciliator.CONCILIATOR_CONSTANT,
        PhpElementConciliator.concile(selectedNode));
  }
View Full Code Here

    assertNotNull(program);

    // select the function declaration.
    int start = 8;
    ASTNode selectedNode = locateNode(program, start, 0);
    selectedNode = selectedNode.getParent();
    assertNotNull(selectedNode);

    assertTrue(selectedNode instanceof TypeDeclaration);

    assertTrue(PhpElementConciliator.classMemeberAlreadyExists(
View Full Code Here

    Program program = createProgram(file);

    assertNotNull(program);

    int start = 21;
    ASTNode selectedNode = locateNode(program, start, 0);
    selectedNode = selectedNode.getParent();
    assertNotNull(selectedNode);

    PhpElementConciliator.localVariableAlreadyExists(
        (FunctionDeclaration) selectedNode, "x");
  }
View Full Code Here

   *            being rewritten
   * @return the exact source range in the compilation unit being rewritten
   *         that should be replaced (or deleted)
   */
  public SourceRange computeSourceRange(ASTNode node) {
    ASTNode root = node.getProgramRoot();
    if (root instanceof Program) {
      Program cu = (Program) root;
      return new SourceRange(cu.getExtendedStartPosition(node), cu
          .getExtendedLength(node));
    }
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

   * @since 2.1
   */
  public static ASTNode perform(ASTNode root, int start, int length) {
    NodeFinder finder = new NodeFinder(start, length);
    root.accept(finder);
    ASTNode result = finder.getCoveredNode();
    if (result == null || result.getStart() != start
        || result.getLength() != length) {
      return finder.getCoveringNode();
    }
    return result;
  }
View Full Code Here

  }

  public IRegion getSelectedNodeRange() {
    if (fSelectedNodes == null || fSelectedNodes.isEmpty())
      return null;
    ASTNode firstNode = fSelectedNodes.get(0);
    ASTNode lastNode = fSelectedNodes.get(fSelectedNodes.size() - 1);
    int start = firstNode.getStart();
    return new Region(start, lastNode.getStart() + lastNode.getLength()
        - start);
  }
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);
View Full Code Here

TOP

Related Classes of org.eclipse.php.internal.core.ast.nodes.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.