Package org.eclipse.jdt.core.dom

Examples of org.eclipse.jdt.core.dom.ASTVisitor


    final ASTParser parser = ASTParser.newParser(AST.JLS4);
    parser.setResolveBindings(true);
    parser.setSource(JavaCore.createCompilationUnitFrom(javaFile));
    final CompilationUnit cu = (CompilationUnit) parser.createAST(null);
    cu.accept(new ASTVisitor() {

      @Override
      public boolean visit(final ClassInstanceCreation node) {
        final ITypeBinding ntb = node.resolveTypeBinding();
        final ITypeBinding nttb = node.getType().resolveBinding();
View Full Code Here


    final ASTParser parser = ASTParser.newParser(AST.JLS4);
    parser.setResolveBindings(true);
    parser.setSource(JavaCore.createCompilationUnitFrom(javaFile));
    final CompilationUnit cu = (CompilationUnit) parser.createAST(null);
    cu.accept(new ASTVisitor() {

      @Override
      public boolean visit(final ClassInstanceCreation node) {
        ITypeBinding ntb = node.resolveTypeBinding();
        while (ntb != null) {
View Full Code Here

    attributeList = "";
    ASTParser parser = ASTParser.newParser(AST.JLS3);
    parser.setSource(ClassContent.toCharArray());
    parser.setKind(ASTParser.K_COMPILATION_UNIT);
    CompilationUnit cu = (CompilationUnit) parser.createAST(null);
    cu.accept(new ASTVisitor() {
      public boolean visit(FieldDeclaration node) {
        String attr_name = "";
        List list = node.fragments();
        for(int i=0; i<list.size(); i++){
          attr_name = list.get(i).toString();
View Full Code Here

  private void goThroughClass(String ClassContent) {
    ASTParser parser = ASTParser.newParser(AST.JLS3);
    parser.setSource(ClassContent.toCharArray());
    parser.setKind(ASTParser.K_COMPILATION_UNIT);
    final CompilationUnit cu = (CompilationUnit) parser.createAST(null);
    cu.accept(new ASTVisitor() {
      public boolean visit(VariableDeclarationFragment node) {
        SimpleName name = node.getName();
        addIfNotExist(name.toString(),propList);
        return false;
      }
View Full Code Here

   * Returns a collection of return statements withing @param methodDeclaration.
   * */
  public static Collection<ReturnStatement> findReturns(IProgressMonitor progressMonitor, MethodDeclaration methodDeclaration, JavaProject project) {
    progressMonitor.setTaskName("Looking for returns in " + methodDeclaration.getName());
    final Collection<ReturnStatement> returns = new ArrayList<ReturnStatement>();
    ASTVisitor finder = new ASTVisitor() {     
      public boolean visit(ReturnStatement node) {
        return returns.add(node);
      }
    };
   
View Full Code Here

    this.toClass = toClass;
    this.fromMethod = fromMethod;
  }

  public void modify(Block block) {
    block.accept(new ASTVisitor() {

      @SuppressWarnings("unchecked")
      @Override
      public boolean visit(MethodInvocation node) {
          IMethod invokedMethod = (IMethod) node.resolveMethodBinding().getJavaElement();
View Full Code Here

  private Block parseCode(String code) {
    return JDTUtils.parseBlock(code);
  }

  public void modify(Block block) {
    block.accept(new ASTVisitor() {

      @SuppressWarnings("unchecked")
      @Override
      public boolean visit(MethodInvocation node) {
          IMethod invokedMethod = (IMethod) node.resolveMethodBinding().getJavaElement();
View Full Code Here

    final MethodCall methodCall = new MethodCall();
    methodCall.setClassName(methodDeclaration.resolveBinding().getDeclaringClass().getQualifiedName());
    methodCall.setMethodName(methodDeclaration.getName().toString());
    methodCall.setCompilationUnit(getCompilationUnit(methodDeclaration).getElementName());
   
    methodDeclaration.accept(new ASTVisitor() {

      @Override
      public boolean visit(MethodInvocation node) {
        ITypeBinding declaringClass = node.resolveMethodBinding().getDeclaringClass();
       
View Full Code Here

        .getAtgAstManager()
        .getAtgAst()
        .getRoot()
        .accept(renameTokenAtgVisitor);
     
      ASTVisitor renameTokenJavaVisitor = new ASTVisitor() {
        @Override
        public boolean visit(SimpleName node) {
         
          if (node.resolveBinding() != null &&
            node.resolveBinding().getKind() == IBinding.METHOD &&
View Full Code Here

        .getRoot()
        .accept(renameTokenAtgVisitor);
     
      final String oldJavaName = "_" + info.getOldName();
      final String newJavaName = "_" + info.getNewName();
      ASTVisitor renameTokenJavaVisitor = new ASTVisitor() {
        @Override
        public boolean visit(SimpleName node) {
         
          if (node.resolveBinding() != null &&
            node.resolveBinding().getKind() == IBinding.VARIABLE &&
View Full Code Here

TOP

Related Classes of org.eclipse.jdt.core.dom.ASTVisitor

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.