Package org.eclipse.jdt.core.dom

Examples of org.eclipse.jdt.core.dom.ASTParser.createAST()


  }
  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


        ASTParser parser = ASTParser.newParser(AST.JLS3); // FIXME
        parser.setCompilerOptions(options.getMap());
        parser.setSource(unit.getBuffer().getCharacters());
        parser.setKind(ASTParser.K_COMPILATION_UNIT);
        parser.setResolveBindings(false);
        CompilationUnit result = (CompilationUnit) parser.createAST(null);

        return result; //AST.parseCompilationUnit(unit, false);
    }

    /** Get the file containing the transformed code for preview.
View Full Code Here

    public static CompilationUnit parse(char[] source)
            throws ASTMalformedException {
        ASTParser parser = ASTParser.newParser(DEFAULT_LANGUAGE_SPECIFICATION);
        parser.setSource(source);

        CompilationUnit ast = (CompilationUnit) parser.createAST(null);

        if ((ast.getFlags() & ASTNode.MALFORMED) != 0) {
            throw new ASTMalformedException();
        }
View Full Code Here

  static CompilationUnit retrieveCompilationUnit(ICompilationUnit unit) {
    CompilationUnit cu = (CompilationUnit) parserMap.get(unit);
    if (cu == null) {
      ASTParser parser = ASTParser.newParser(AST.JLS3);
      parser.setSource(unit);
      cu = (CompilationUnit) parser.createAST(null);

      parserMap.put(unit, cu);
    }

    return cu;
View Full Code Here

    parser.setKind(ASTParser.K_STATEMENTS);

    parser.setSource(source);
    parser.setResolveBindings(true);

    Block val = (Block) parser.createAST(null);
    return val;
  }

}
View Full Code Here

   
    ASTParser parser = ASTParser.newParser(AST.JLS3);
    parser.setKind(ASTParser.K_COMPILATION_UNIT);
    parser.setSource(compilationUnit);
    parser.setResolveBindings(true);
    CompilationUnit cu = (CompilationUnit) parser.createAST(null);
    cu.recordModifications();
   
    cache.put(compilationUnit, cu);
    return cu;
  }
View Full Code Here

    ASTParser parser = ASTParser.newParser(AST.JLS3);
    parser.setSource(javaFile.toString().toCharArray());
    parser.setProject(JavaCore.create(editorFile.getProject()));
    parser.setUnitName("Parser.java");
    parser.setResolveBindings(true);
    ast = (CompilationUnit) parser.createAST(null);
  }

  /**
   * @param offset
   *            the position in the PARSER_CODE Partitin of the atg file
View Full Code Here

            parser.setSource(c);
            parser.setResolveBindings(true);
         
            CompilationUnit compilationUnit = null;
            try{
              compilationUnit = (CompilationUnit) parser.createAST(null);
            } catch (Exception e){
              throw new RuntimeException("Exception encountered during JDT parse of " + getName(c) + ":\n" + e);
            }
            String fileName = c.getUnderlyingResource().getName();
            TypeClosureVisitor visitor = new TypeClosureVisitor(analysis, compilationUnit, fileName);
View Full Code Here

        if (runTest){
          for (int k = 0; k < compilationUnits.length; ++k) {
            parser.setSource(compilationUnits[k]);
            parser.setResolveBindings(true);
            CompilationUnit compilationUnit = (CompilationUnit) parser.createAST(null);
           
            String fileName = compilationUnits[k].getUnderlyingResource().getName();
            TestVisitor visitor = new TestVisitor(compilationUnit, fileName, analysis);
            compilationUnit.accept(visitor);
          }
View Full Code Here

          //and creates constraints between types and supertypes
          debug("Beginning Declaration Visitor");
          for (int k = 0; k < compilationUnits.length; ++k) {
            parser.setSource(compilationUnits[k]);
            parser.setResolveBindings(true);
            CompilationUnit compilationUnit = (CompilationUnit) parser.createAST(null);
           
            String fileName = compilationUnits[k].getUnderlyingResource().getName();
            debug("  "  + fileName);
            DeclarationVisitor visitor = new DeclarationVisitor(compilationUnit, fileName, analysis, originalSet.contains(compilationUnits[k]));
            compilationUnit.accept(visitor);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.