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

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


    int offset= textSelection.getOffset();
    int length= textSelection.getLength();
   
    NodeFinder finder= new NodeFinder(offset, length);
    fRoot.accept(finder);
    ASTNode covering= finder.getCoveringNode();
    if (covering != null) {
      fViewer.reveal(covering);
      fViewer.setSelection(new StructuredSelection(covering));
    }
  }
View Full Code Here


    String msg= "Find Declaring Node from Key";
    String key= askForKey(msg);
    if (key == null)
      return;
    // TODO : should look for the declaring node
    ASTNode node= null; // fRoot. findDeclaringNode(key);
    if (node != null) {
      fViewer.setSelection(new StructuredSelection(node), true);
    } else {
      MessageDialog.openError(
          getSite().getShell(),
View Full Code Here

        showAndLogError("An error occurred while calculating an AST View Label:\n" + label, exception); //$NON-NLS-1$
        return;
      }
    }
   
    ASTNode node= null;
    if (obj instanceof ASTNode) {
      node= (ASTNode) obj;
     
    } else if (obj instanceof NodeProperty) {
      Object val= ((NodeProperty) obj).getNode();
      if (val instanceof ASTNode) {
        node= (ASTNode) val;
      }
     
    } else if (obj instanceof Binding) {
     
      // TODO shou;d cpmplete the IBinding part
     
//      IBinding binding= ((Binding) obj).getBinding();
//      ASTNode declaring= fRoot.findDeclaringNode(binding);
//      if (declaring != null) {
//        fViewer.reveal(declaring);
//        fViewer.setSelection(new StructuredSelection(declaring));
//      } else {
//        fViewer.getTree().getDisplay().beep();
//      }
//      return;
     
    } else if (obj instanceof ProblemNode) {
      ProblemNode problemNode= (ProblemNode) obj;
      EditorUtility.selectInEditor(fEditor, problemNode.getOffset(), problemNode.getLength());
      return;
     
    } else if (obj instanceof PhpElement) {
      // TODO : complete this task for open in edtior
/*      ISourceModule phpElement= ((PhpElement) obj).getPhpElement();
      if (phpElement instanceof IPackageFragment) {
        ShowInPackageViewAction showInPackageViewAction= new ShowInPackageViewAction(getViewSite());
        showInPackageViewAction.run(phpElement);
      } else {
        try {
          IEditorPart editorPart= JavaUI.openInEditor(phpElement);
          if (editorPart != null)
            JavaUI.revealInEditor(editorPart, phpElement);
        } catch (PartInitException e) {
          showAndLogError("Could not open editor.", e); //$NON-NLS-1$
        } catch (JavaModelException e) {
          showAndLogError("Could not open editor.", e); //$NON-NLS-1$
        }
      }
*/      return;
    }
   
    if (node != null) {
      int offset= isTripleClick ? fRoot.getExtendedStartPosition(node) : node.getStart();
      int length= isTripleClick ? fRoot.getExtendedLength(node) : node.getLength();

      EditorUtility.selectInEditor(fEditor, offset, length);
    }
  }
View Full Code Here

    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)) {
        final IOccurrencesFinder finder = OccurrencesFinderFactory
View Full Code Here

      return fRed;
    if ((element instanceof ExceptionAttribute) && ((ExceptionAttribute) element).getException() != null)
      return fRed;
   
    if (element instanceof ASTNode) {
      ASTNode node= (ASTNode) element;
      if ((node.getFlags() & ASTNode.MALFORMED) != 0) {
        return fRed;
      }
      return fDarkGray;
    } else if (element instanceof Binding) {
      Binding binding= (Binding) element;
View Full Code Here

    return null;
  }
 
  private boolean isNotProperlyNested(Object element) {
    if (element instanceof ASTNode) {
      ASTNode node= (ASTNode) element;
      int start= node.getStart();
      int end= start + node.getLength();
     
      ASTNode parent= node.getParent();
      if (parent != null) {
        int parentstart= parent.getStart();
        int parentend= parentstart + parent.getLength();
       
        if (start < parentstart || end > parentend) {
          return true;
        }
      }
View Full Code Here

  /* (non-Javadoc)
   * @see org.eclipse.jface.viewers.IFontProvider#getFont(java.lang.Object)
   */
  public Font getFont(Object element) {
    if (element instanceof ASTNode) {
      ASTNode node= (ASTNode) element;
      if ((node.getFlags() & ASTNode.RECOVERED) != 0)
        return fAllocatedBoldItalic;
      else
        return fBold;
    }
    return null;
View Full Code Here

    project.build(IncrementalProjectBuilder.FULL_BUILD, null);

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

   * </ul>
   */
  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

   * @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

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.