Package org.eclipse.jdt.internal.core.builder

Examples of org.eclipse.jdt.internal.core.builder.NameEnvironment


  public byte[] compile(final String str, IJavaProject prj) {
    Map prjOptions = prj.getOptions(true);

    CompilerOptions options = new CompilerOptions(prjOptions);

    INameEnvironment environment = new NameEnvironment(prj);
    IErrorHandlingPolicy policy = new IErrorHandlingPolicy() {

     
      public boolean stopOnFirstError() {
        return false;
      }

     
      public boolean proceedOnErrors() {
        return true;
      }
    };

    ICompilerRequestor requestor = new ICompilerRequestor() {

     
      public void acceptResult(CompilationResult result) {
        ClassFile[] classFiles = result.getClassFiles();
        for (ClassFile f : classFiles) {
          resultBytes = f.getBytes();
          break;
        }
      }
    };
    IProblemFactory problemFactory = new DefaultProblemFactory();
    Compiler c = new Compiler(environment, policy, options, requestor,
        problemFactory);
    c.compile(new ICompilationUnit[] { new Unit(str) });
    environment.cleanup();
    return resultBytes;
  }
View Full Code Here


  public CategorizedProblem[] validate(final String str, IJavaProject prj) {
    Map prjOptions = prj.getOptions(true);

    CompilerOptions options = new CompilerOptions(prjOptions);

    INameEnvironment environment = new NameEnvironment(prj);
    IErrorHandlingPolicy policy = new IErrorHandlingPolicy() {

     
      public boolean stopOnFirstError() {
        return false;
      }

     
      public boolean proceedOnErrors() {
        return true;
      }
    };
   
    ICompilerRequestor requestor = new ICompilerRequestor() {

     
      public void acceptResult(CompilationResult result) {
        ClassFile[] classFiles = result.getClassFiles();
        for (ClassFile f : classFiles) {
          resultBytes = f.getBytes();
          break;
        }
        problems=result.getAllProblems();
      }
    };
    IProblemFactory problemFactory = new DefaultProblemFactory();
    Compiler c = new Compiler(environment, policy, options, requestor,
        problemFactory);
    c.compile(new ICompilationUnit[] { new Unit(str) });
    environment.cleanup();
    return problems;
  }
View Full Code Here

}
/**
* Returns a name environment for the last built state.
*/
protected INameEnvironment getBuildNameEnvironment() {
  return new NameEnvironment(getProject());
}
View Full Code Here

}
/**
* Returns a name environment for the last built state.
*/
protected INameEnvironment getBuildNameEnvironment() {
  return new NameEnvironment(getProject());
}
View Full Code Here

TOP

Related Classes of org.eclipse.jdt.internal.core.builder.NameEnvironment

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.