当前位置: 首页>>代码示例>>Java>>正文


Java JavaCore.getOptions方法代码示例

本文整理汇总了Java中org.eclipse.jdt.core.JavaCore.getOptions方法的典型用法代码示例。如果您正苦于以下问题:Java JavaCore.getOptions方法的具体用法?Java JavaCore.getOptions怎么用?Java JavaCore.getOptions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.jdt.core.JavaCore的用法示例。


在下文中一共展示了JavaCore.getOptions方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: parse

import org.eclipse.jdt.core.JavaCore; //导入方法依赖的package包/类
public void parse() throws ParseException {
    ASTParser parser = ASTParser.newParser(AST.JLS8);
    parser.setSource(source.toCharArray());
    Map<String, String> options = JavaCore.getOptions();
    options.put("org.eclipse.jdt.core.compiler.source", "1.8");
    parser.setCompilerOptions(options);
    parser.setKind(ASTParser.K_COMPILATION_UNIT);
    parser.setUnitName("Program.java");
    parser.setEnvironment(new String[] { classpath != null? classpath : "" },
            new String[] { "" }, new String[] { "UTF-8" }, true);
    parser.setResolveBindings(true);
    cu = (CompilationUnit) parser.createAST(null);

    List<IProblem> problems = Arrays.stream(cu.getProblems()).filter(p ->
                                        p.isError() &&
                                        p.getID() != IProblem.PublicClassMustMatchFileName && // we use "Program.java"
                                        p.getID() != IProblem.ParameterMismatch // Evidence varargs
                                    ).collect(Collectors.toList());
    if (problems.size() > 0)
        throw new ParseException(problems);
}
 
开发者ID:capergroup,项目名称:bayou,代码行数:22,代码来源:Parser.java

示例2: createCompilationUnitParser

import org.eclipse.jdt.core.JavaCore; //导入方法依赖的package包/类
private static ASTParser createCompilationUnitParser() {
  ASTParser parser = ASTParser.newParser(AST.JLS8);
  Map options = JavaCore.getOptions();
  JavaCore.setComplianceOptions(JavaCore.VERSION_1_8, options);
  parser.setCompilerOptions(options);
  parser.setKind(ASTParser.K_COMPILATION_UNIT);
  return parser;
}
 
开发者ID:bazelbuild,项目名称:BUILD_file_generator,代码行数:9,代码来源:ReferencedClassesParser.java

示例3: createProject

import org.eclipse.jdt.core.JavaCore; //导入方法依赖的package包/类
private synchronized IProject createProject(String projectName) {
  final IProject project = this.workspace.getRoot().getProject(projectName);

  Object cmpl = JavaCore.getOption(CompilerOptions.OPTION_Compliance);
  Object src  = JavaCore.getOption(CompilerOptions.OPTION_Source);
  Object tgt  = JavaCore.getOption(CompilerOptions.OPTION_TargetPlatform);

  try {
    IWorkspaceRunnable create = new IWorkspaceRunnable() {
      public void run(IProgressMonitor monitor) throws CoreException {
        project.create(null, null);
        project.open(null);
      }
    };
    this.workspace.run(create, null);
    this.projects.put(projectName, project);
    addBuilderSpecs(projectName);
  } catch (CoreException e) {
    handle(e);
  } finally {
    // restore workspace settings
    Hashtable options = JavaCore.getOptions();
    options.put(CompilerOptions.OPTION_Compliance,cmpl);
    options.put(CompilerOptions.OPTION_Source,src);
    options.put(CompilerOptions.OPTION_TargetPlatform,tgt);
    JavaCore.setOptions(options);
  }
  return project;
}
 
开发者ID:RuiChen08,项目名称:dacapobench,代码行数:30,代码来源:TestingEnvironment.java

示例4: buildAstParser

import org.eclipse.jdt.core.JavaCore; //导入方法依赖的package包/类
private static ASTParser buildAstParser(String[] sourceFolders) {
	ASTParser parser = ASTParser.newParser(AST.JLS8);
	parser.setKind(ASTParser.K_COMPILATION_UNIT);
	Map options = JavaCore.getOptions();
	JavaCore.setComplianceOptions(JavaCore.VERSION_1_8, options);
	parser.setCompilerOptions(options);
	parser.setResolveBindings(true);
	parser.setBindingsRecovery(true);
	parser.setEnvironment(new String[0], sourceFolders, null, true);
	// parser.setEnvironment(new String[0], new String[]{"tmp\\refactoring-toy-example\\src"}, null, false);
	return parser;
}
 
开发者ID:aserg-ufmg,项目名称:RefDiff,代码行数:13,代码来源:SDModelBuilder.java

示例5: buildAstParser

import org.eclipse.jdt.core.JavaCore; //导入方法依赖的package包/类
private static ASTParser buildAstParser(String[] sourceFolders) {
	ASTParser parser = ASTParser.newParser(AST.JLS8);
	parser.setKind(ASTParser.K_COMPILATION_UNIT);
	Map options = JavaCore.getOptions();
	JavaCore.setComplianceOptions(JavaCore.VERSION_1_8, options);
	parser.setCompilerOptions(options);
	parser.setResolveBindings(true);
	parser.setBindingsRecovery(true);
	parser.setEnvironment(new String[0], sourceFolders, null, true);
	//parser.setEnvironment(new String[0], new String[]{"tmp\\refactoring-toy-example\\src"}, null, false);
	return parser;
}
 
开发者ID:aserg-ufmg,项目名称:RefDiff,代码行数:13,代码来源:SDModelBuilder.java

示例6: JavaSourceParser

import org.eclipse.jdt.core.JavaCore; //导入方法依赖的package包/类
private JavaSourceParser(String source, String className) {
	this.source = source.toCharArray();
	parser = ASTParser.newParser(AST.JLS8);
	parser.setResolveBindings(true);
	parser.setKind(ASTParser.K_COMPILATION_UNIT);		
	parser.setEnvironment(null, new String[] {}, new String[] {}, true);
	parser.setUnitName(className);
	parser.setSource(this.source);
	Map<String, String> options = JavaCore.getOptions();
	options.put(JavaCore.COMPILER_DOC_COMMENT_SUPPORT, JavaCore.ENABLED);
	parser.setCompilerOptions(options);
}
 
开发者ID:andre-santos-pt,项目名称:pandionj,代码行数:13,代码来源:JavaSourceParser.java

示例7: parse

import org.eclipse.jdt.core.JavaCore; //导入方法依赖的package包/类
/**
 * Parse the code and generate the JSON in outJ
 *
 * @param source String to parses
 * @return CompilationUnit of the AST
 * @throws IOException if anything related to I/O or Json generation failed
 */
public CompilationUnit parse(final String source) throws IOException {
    parser.setSource(source.toCharArray());
    Map options = JavaCore.getOptions();
    JavaCore.setComplianceOptions(JavaCore.VERSION_1_8, options);
    parser.setCompilerOptions(options);
    return (CompilationUnit) parser.createAST(null);
}
 
开发者ID:bblfsh,项目名称:java-driver,代码行数:15,代码来源:EclipseParser.java


注:本文中的org.eclipse.jdt.core.JavaCore.getOptions方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。