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 = 26;
    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 = 27;
    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 = 20;
    ASTNode selectedNode = locateNode(program, start, 0);
    assertNotNull(selectedNode);

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

        (ISourceModule) source);
    return newParser.createAST(null);
  }

  protected ASTNode locateNode(Program program, int start, int end) {
    ASTNode locateNode = NodeFinder.perform(program, start, end);
    return locateNode;
  }
View Full Code Here

  }

  public void performMatching(String matchingStr, String notMatchingStr)
      throws Exception {

    ASTNode node = getAstNode(matchingStr);
    ASTNode notMatchingNode = getAstNode(notMatchingStr);

    Assert.assertTrue(node.subtreeMatch(new PHPASTMatcher(), node));
    Assert.assertFalse(node.subtreeMatch(new PHPASTMatcher(),
        notMatchingNode));
View Full Code Here

    IModelElement element = null;
    try {
      Program ast = SharedASTProvider.getAST(sourceModule,
          SharedASTProvider.WAIT_NO, null);
      if (ast != null) {
        ASTNode selectedNode = NodeFinder.perform(ast, offset, length);
        if (selectedNode != null
            && selectedNode.getType() == ASTNode.IDENTIFIER) {
          IBinding binding = ((Identifier) selectedNode)
              .resolveBinding();
          if (binding != null) {
            element = binding.getPHPElement();
          }
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

    IModelElement element = null;
    try {
      Program ast = SharedASTProvider.getAST(sourceModule,
          SharedASTProvider.WAIT_NO, null);
      if (ast != null) {
        ASTNode selectedNode = NodeFinder.perform(ast, offset, length);
        if (selectedNode.getType() == ASTNode.IDENTIFIER) {
          element = ((Identifier) selectedNode).resolveBinding()
              .getPHPElement();
        }
      }
    } catch (Exception e) {
View Full Code Here

      resetView(root);
      if (root == null) {
        setContentDescription("AST could not be created."); //$NON-NLS-1$
        return null;
      }
      ASTNode node= NodeFinder.perform(root, offset, length);
      if (node != null) {
        fViewer.getTree().setRedraw(false);
        try {
          fASTLabelProvider.setSelectedRange(node.getStart(), node.getLength());
          fViewer.setSelection(new StructuredSelection(node), true);
        } finally {
          fViewer.getTree().setRedraw(true);
        }
      }
View Full Code Here

    refreshASTSettingsActions();
  }
 

  private void refreshAST() throws CoreException {
    ASTNode node= getASTNodeNearSelection((IStructuredSelection) fViewer.getSelection());
    int offset= 0;
    int length= 0;
    if (node != null) {
      offset= node.getStart();
      length= node.getLength();
    }

    internalSetInput(fSourceRoot, offset, length, getCurrentASTLevel());
  }
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.