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

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


    try {
      OccurrenceLocation[] occurrences = fFinder.getOccurrences();
      if (occurrences != null) {
        HashMap lineMap = new HashMap();
        Program astRoot = fFinder.getASTRoot();
        ArrayList resultingMatches = new ArrayList();

        for (int i = 0; i < occurrences.length; i++) {
          OccurrenceLocation loc = occurrences[i];
View Full Code Here


    testFile.create(new ByteArrayInputStream(data.getBytes()), true, null);
    project.refreshLocal(IResource.DEPTH_ONE, null);
    project.build(IncrementalProjectBuilder.INCREMENTAL_BUILD, null);

    PHPCoreTests.waitForIndexer();
    final Program astRoot = Util.createProgramFromSource(testFile);

    assertNotNull(astRoot);
    // ASTNode selectedNode = NodeFinder.perform(astRoot, offset, 0);
    final int finalOffset = offset;
    perfMonitor.execute("PerformanceTests.testPhpElementConciliator" + "_"
View Full Code Here

      if (monitor.isCanceled()) {
        return Status.CANCEL_STATUS;
      }
      // create AST
      try {
        Program astRoot = SharedASTProvider.getAST(input,
            SharedASTProvider.WAIT_ACTIVE_ONLY, monitor);

        if (astRoot != null && !monitor.isCanceled()) {
          Object[] listeners;
          synchronized (PartListenerGroup.this) {
View Full Code Here

   */
  protected IModelElement getSelectionModelElement(int offset, int length,
      ISourceModule sourceModule) {
    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()
View Full Code Here

      throws ModelException, IOException {
    if (input.getSourceRange() == null) {
      return "SearchMessages.FindOccurrencesEngine_noSource_text"; //$NON-NLS-1$
    }

    final Program root = SharedASTProvider.getAST(input,
        SharedASTProvider.WAIT_YES, null);
    if (root == null) {
      return "SearchMessages.FindOccurrencesEngine_cannotParse_text"; //$NON-NLS-1$
    }
    return run(root, offset, length);
View Full Code Here

    if (input.getBuffer() == null) {
      throw new CoreException(getErrorStatus("Input has no buffer", null)); //$NON-NLS-1$
    }
   
    try {
      Program root= createAST(input, astLevel, offset);
      resetView(root);
      if (root == null) {
        setContentDescription("AST could not be created."); //$NON-NLS-1$
        return null;
      }
View Full Code Here

  }
 
  private Program createAST(ISourceModule input, String astLevel, int offset) throws Exception {
    long startTime;
    long endTime;
    Program root = null;
   
    if ((getCurrentInputKind() == ASTInputKindAction.USE_RECONCILE)) {
      final IProblemRequestor problemRequestor= new IProblemRequestor() { //strange: don't get bindings when supplying null as problemRequestor
        public void acceptProblem(IProblem problem) {/*not interested*/}
        public void beginReporting() {/*not interested*/}
 
View Full Code Here

      if (isSetInPreferences()) {
        ISourceModule cu = getCompilationUnit();
        if (cu != null) {
          installSelectionListener();
          Point point = fViewer.getSelectedRange();
          Program astRoot = null;
          try {
            astRoot = SharedASTProvider.getAST(cu,
                SharedASTProvider.WAIT_ACTIVE_ONLY, null);
          } catch (ModelException e) {
            PHPUiPlugin.log(e);
View Full Code Here

    if (editorElement != null) {
      ISourceModule sourceModule = ((ModelElement) editorElement)
          .getSourceModule();
      ASTParser parser = ASTParser.newParser(sourceModule);

      Program program;
      try {
        program = parser.createAST(null);
        program.recordModifications();

        AST ast = program.getAST();
        IDocument document = ((PHPStructuredEditor) targetEditor)
            .getDocument();
        for (int i = 0; i < fileNames.length; ++i) {

          // resolve the relative path from include path
          String relativeLocationFromIncludePath = getFileName(
              fileNames[i], sourceModule);

          if (relativeLocationFromIncludePath != null) {
            Include include = ast.newInclude(ast.newScalar("'" //$NON-NLS-1$
                + relativeLocationFromIncludePath.toString()
                + "'"), Include.IT_REQUIRE_ONCE); //$NON-NLS-1$
            program.statements().add(i,
                ast.newExpressionStatement(include));
            TextEdit edits = program.rewrite(document, null);
            edits.apply(document);
          }

        }
View Full Code Here

    testFile.create(new ByteArrayInputStream(data.getBytes()), true, null);
    project.refreshLocal(IResource.DEPTH_ONE, null);
    project.build(IncrementalProjectBuilder.INCREMENTAL_BUILD, null);

    PHPCoreTests.waitForIndexer();
    Program astRoot = Util.createProgramFromSource(testFile);
    ASTNode selectedNode = NodeFinder.perform(astRoot, offset, 0);
    if (selectedNode != null
        && (selectedNode instanceof Identifier || (isScalarButNotInString(selectedNode)))) {
      int type = PhpElementConciliator.concile(selectedNode);
      if (markOccurrencesOfType(type)) {
View Full Code Here

TOP

Related Classes of org.eclipse.php.internal.core.ast.nodes.Program

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.