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

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


  ISourceRange internalGetNewSelectionRange(ISourceRange oldSourceRange,
      ISourceReference sr, SelectionAnalyzer selAnalyzer)
      throws ModelException {
    if (oldSourceRange.getLength() == 0
        && selAnalyzer.getLastCoveringNode() != null) {
      ASTNode previousNode = PreviousNodeAnalyzer.perform(
          oldSourceRange.getOffset(),
          selAnalyzer.getLastCoveringNode());
      if (previousNode != null)
        return getSelectedNodeSourceRange(sr, previousNode);
    }
    ASTNode first = selAnalyzer.getFirstSelectedNode();
    if (first == null)
      return getLastCoveringNodeRange(oldSourceRange, sr, selAnalyzer);

    ASTNode parent = first.getParent();
    if (parent == null)
      return getLastCoveringNodeRange(oldSourceRange, sr, selAnalyzer);

    ASTNode previousNode = getPreviousNode(parent,
        selAnalyzer.getSelectedNodes()[0]);
    if (previousNode == parent)
      return getSelectedNodeSourceRange(sr, parent);

    int offset = previousNode.getStart();
    int end = oldSourceRange.getOffset() + oldSourceRange.getLength() - 1;
    return StructureSelectionAction.createSourceRange(offset, end);
  }
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

          Program program = ASTParser.newParser(reader,
              PHPVersion.PHP5,
              ProjectOptions.useShortTags((IProject) null))
              .createAST(new NullProgressMonitor());

          final ASTNode locateNode = Locator.locateNode(program,
              offset);
          Assert.assertTrue(
              desc
                  + " test fails. offset should locate an expression node was "
                  + locateNode.getClass().getName(),
              locateNode instanceof Expression);

          Expression expression = (Expression) locateNode;
          final boolean actualStaticScalar = expression
              .isStaticScalar();

          Assert.assertTrue(desc + " test fails. Expression"
              + locateNode.toString() + " should "
              + (!expectedStaticScalar ? "not" : "")
              + "be static scalar",
              actualStaticScalar == expectedStaticScalar);
        }
      });
View Full Code Here

    assertNotNull(program);

    // select the function declaration.
    int start = 115;
    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 = 50;
    ASTNode selectedNode = locateNode(program, start, 0);
    assertNotNull(selectedNode);

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

    assertNotNull(program);

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

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

    assertNotNull(program);

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

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

    assertNotNull(program);

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

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

    assertNotNull(program);

    // select 'echo $x'
    int start = 65;
    ASTNode selectedNode = locateNode(program, start, 0);
    assertNotNull(selectedNode);

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

    assertNotNull(program);

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

    assertEquals(PhpElementConciliator.CONCILIATOR_CONSTANT,
        PhpElementConciliator.concile(selectedNode));
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.