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

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


    assertNotNull(program);

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

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


    Program program = createProgram(file);

    assertNotNull(program);

    int start = 67;
    ASTNode selectedNode = locateNode(program, start, 0);
    assertNotNull(selectedNode);

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

    assertNotNull(program);

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

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

    assertNotNull(program);

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

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

    assertNotNull(program);

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

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

    assertNotNull(program);

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

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

    AST astRoot = program.getAST();
    ASTRewrite rewrite = ASTRewrite.create(astRoot);
    Block block = blocks.get(0);
    ListRewrite listRewrite = rewrite.getListRewrite(block,
        Block.STATEMENTS_PROPERTY);
    ASTNode placeHolder = rewrite.createStringPlaceholder("//mycomment",
        ASTNode.COMMENT);
    listRewrite.insertFirst(placeHolder, null);

    TextEdit textEdits = rewrite.rewriteAST(document, null);
    textEdits.apply(document);
View Full Code Here

  public ISourceRange internalGetNewSelectionRange(
      ISourceRange oldSourceRange, ISourceReference sr,
      SelectionAnalyzer selAnalyzer) throws ModelException {
    if (oldSourceRange.getLength() == 0
        && selAnalyzer.getLastCoveringNode() != null) {
      ASTNode previousNode = NextNodeAnalyzer.perform(
          oldSourceRange.getOffset(),
          selAnalyzer.getLastCoveringNode());
      if (previousNode != null)
        return getSelectedNodeSourceRange(sr, previousNode);
    }
View Full Code Here

  @Override
  ISourceRange internalGetNewSelectionRange(ISourceRange oldSourceRange,
      ISourceReference sr, SelectionAnalyzer selAnalyzer)
      throws ModelException {
    ASTNode first = selAnalyzer.getFirstSelectedNode();
    if (first == null || first.getParent() == null)
      return getLastCoveringNodeRange(oldSourceRange, sr, selAnalyzer);

    return getSelectedNodeSourceRange(sr, first.getParent());
  }
View Full Code Here

      length = 1;
    return new SourceRange(Math.max(0, offset), length);
  }

  static ASTNode[] getSiblingNodes(ASTNode node) {
    ASTNode parent = node.getParent();
    StructuralPropertyDescriptor locationInParent = node
        .getLocationInParent();
    if (locationInParent.isChildListProperty()) {
      List<? extends ASTNode> siblings = (List<? extends ASTNode>) parent
          .getStructuralProperty(locationInParent);
      return siblings.toArray(new ASTNode[siblings.size()]);
    }
    return null;
  }
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.