Package org.eclipse.jdt.core.dom

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


    parser.setKind(ASTParser.K_COMPILATION_UNIT);
    parser.setProject(javaProject);
    parser.setSource(code.toCharArray());
    parser.setUnitName("/CrystalTest/" + qualifiedCompUnitName);
    parser.setResolveBindings(true);
    node = (CompilationUnit) parser.createAST(null);
   
    Message[] msgs = node.getMessages();
    if(msgs.length > 0) {
      StringBuffer errs = new StringBuffer();
      errs.append("Compiler problems for ");
View Full Code Here


        .getCompilationUnit();

    parser.setKind(ASTParser.K_COMPILATION_UNIT);
    parser.setSource(source);
    parser.setResolveBindings(true);
    node = (CompilationUnit) parser.createAST(null);

    return node;
  }

  static public boolean testAndCompareCFG(MethodDeclaration method)
View Full Code Here

    parser.setResolveBindings(true);
    // parser.setBindingsRecovery(true);
    parser.setSource(code.toCharArray());
    parser.setUnitName("Foo.java");
    // parser.setProject(JavaCore.create(null));
    node = (CompilationUnit) parser.createAST(null);

    for (IProblem problem : node.getProblems()) {
      System.out.println("Compile problem for " + subFolder + "_" + file);
      System.out.println(problem.getMessage());
    }
View Full Code Here

   * @param source
   */
  public void setSource(String source) {
    ASTParser parser = ASTParser.newParser(AST.JLS3);
    parser.setSource(source.toCharArray());
    resultCompilationUnit = (CompilationUnit) parser.createAST(null);
  }

  /**
   * Returns the source code of this item
   *
 
View Full Code Here

    parser.setSource(source.toCharArray());
    Map<?, ?> options = JavaCore.getOptions();
    JavaCore.setComplianceOptions(JavaCore.VERSION_1_6, options);
    parser.setCompilerOptions(options);
    try {
      resultCompilationUnit = (CompilationUnit) parser.createAST(null);
    } catch (Throwable e) {
      CrashReporter.reportException(e);
      logger.debug("Could not parse source");
    }
    String sourceInCpu = "";
View Full Code Here

            monitor.subTask("Insert adapter class");
            // Find out the name of the adapter
            ASTParser parser = ASTParser.newParser(AST.JLS3);
            parser.setSource(adapterCode.toCharArray());
            CompilationUnit astRoot = (CompilationUnit) parser
                .createAST(null);
            List<TypeDeclaration> typeList = astRoot.types();
            if (typeList != null && typeList.size() > 0) {
              TypeDeclaration adapterType = (TypeDeclaration) typeList
                  .get(0);
View Full Code Here

    ICompilationUnit cpu = target.getWorkingCopy(null);
    // creation of DOM/AST from an ICompilationUnit
    ASTParser parser = ASTParser.newParser(AST.JLS3);
    parser.setSource(cpu);
    CompilationUnit astRoot = (CompilationUnit) parser.createAST(null);

    StringBuffer signature = new StringBuffer();
    signature.append(methodDeclaration.getName().getFullyQualifiedName()
        + " ( ");
    for (Object param : methodDeclaration.parameters()) {
View Full Code Here

      ICompilationUnit icu = target.getWorkingCopy(null);

      // creation of DOM/AST from an ICompilationUnit
      ASTParser parser = ASTParser.newParser(AST.JLS3);
      parser.setSource(icu);
      CompilationUnit astRoot = (CompilationUnit) parser.createAST(null);

      StringBuffer signature = new StringBuffer();
      signature.append(typeDeclaration.getName().getFullyQualifiedName());

      typeDeclaration.setProperty("Signature", signature.toString());
View Full Code Here

            .getBoolean(PreferenceConstants.P_OVERWRITE_ON_INSERT);
        ICompilationUnit cpu = target.getWorkingCopy(null);
        // creation of DOM/AST from an ICompilationUnit
        ASTParser parser = ASTParser.newParser(AST.JLS3);
        parser.setSource(cpu);
        CompilationUnit astRoot = (CompilationUnit) parser
            .createAST(null);

        // creation of ASTRewrite
        astRoot.recordModifications();
        IMethod method = null;
View Full Code Here

        ASTParser parser = ASTParser.newParser(AST.JLS4);
        parser.setKind(ASTParser.K_COMPILATION_UNIT);
        parser.setSource(cunit);
        parser.setResolveBindings(true);
        return (CompilationUnit) parser.createAST(null);
    }

    /**
     * Create a marker on a Java Type
     *
 
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.