public CodeFormatter(Map options) { if (options == null) { this.options = JavaCore.getOptions(); } else { this.options = options; } }
public CodeFormatter(Map options) { if (options == null) { this.options = JavaCore.getOptions(); } else { this.options = options; } }
public CodeFormatter(Map options) { if (options == null) { this.options = JavaCore.getOptions(); } else { this.options = options; } }
protected void adjustSourceCompatibility(String value) { Hashtable map = JavaCore.getOptions(); map.put(JavaCore.COMPILER_SOURCE, value); JavaCore.setOptions(map); }
private static void setFormattingOptions(Map<String, String> options) { Map<String, String> defaultOptions = DefaultCodeFormatterOptions.getEclipseDefaultSettings().getMap(); defaultOptions.putAll(options); Hashtable<String, String> javaOptions = JavaCore.getOptions(); defaultOptions.entrySet().stream().filter(p -> p.getKey().startsWith(FORMATTER_OPTION_PREFIX)).forEach(p -> { javaOptions.put(p.getKey(), p.getValue()); }); JavaCore.setOptions(javaOptions); }
@Override public IFormattingContext createFormattingContext() { // it's ok to use instance preferences here as subclasses replace // with project dependent versions (see CompilationUnitEditor.AdaptedSourceViewer) IFormattingContext context= new JavaFormattingContext(); Map<String, String> map= new HashMap<>(JavaCore.getOptions()); context.setProperty(FormattingContextProperties.CONTEXT_PREFERENCES, map); return context; }
@Override public IFormattingContext createFormattingContext() { // it's ok to use instance preferences here as subclasses replace // with project dependent versions (see CompilationUnitEditor.AdaptedSourceViewer) IFormattingContext context= new JavaFormattingContext(); Map<String, String> map= new HashMap<>(JavaCore.getOptions()); context.setProperty(FormattingContextProperties.CONTEXT_PREFERENCES, map); return context; }
public IFormattingContext createFormattingContext() { // it's ok to use instance preferences here as subclasses replace // with project dependent versions (see CompilationUnitEditor.AdaptedSourceViewer) IFormattingContext context= new CommentFormattingContext(); Map map= new HashMap(JavaCore.getOptions()); context.setProperty(FormattingContextProperties.CONTEXT_PREFERENCES, map); return context; }
public ConversionBatch() { _parser = ASTParser.newParser(AST.JLS4); _parser.setKind(ASTParser.K_COMPILATION_UNIT); @SuppressWarnings("unchecked") Map<String, String> options = JavaCore.getOptions(); options.put(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_7); options.put(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_1_7); options.put(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_7); _parser.setCompilerOptions(options); }
public StandaloneConverter(Configuration configuration) { super(configuration); _parser = ASTParser.newParser(AST.JLS4); _parser.setKind(ASTParser.K_COMPILATION_UNIT); @SuppressWarnings("unchecked") Map<String, String> options = JavaCore.getOptions(); options.put(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_7); options.put(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_1_7); options.put(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_7); _parser.setCompilerOptions(options); }
public ASTRewriteFormatter(NodeInfoStore placeholders, RewriteEventStore eventStore, Map options, String lineDelimiter) { this.placeholders= placeholders; this.eventStore= eventStore; this.options= options == null ? JavaCore.getOptions() : (Map) new HashMap(options); this.options.put( DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_RESOURCES_IN_TRY, DefaultCodeFormatterConstants.createAlignmentValue(true, DefaultCodeFormatterConstants.WRAP_NEXT_PER_LINE, DefaultCodeFormatterConstants.INDENT_DEFAULT)); this.lineDelimiter= lineDelimiter; this.tabWidth= IndentManipulation.getTabWidth(options); this.indentWidth= IndentManipulation.getIndentWidth(options); }
/** * @since 2.9, */ public static Map<String, String> getJavaOptions(GenModel genModel) { IJavaProject javaProject = getJavaProject(genModel); Map<String, String> options = javaProject != null ? javaProject.getOptions(true) : JavaCore.getOptions(); return options; }
public ASTRewriteFormatter(NodeInfoStore placeholders, RewriteEventStore eventStore, Map options, String lineDelimiter) { this.placeholders= placeholders; this.eventStore= eventStore; this.options= options == null ? JavaCore.getOptions() : (Map) new HashMap(options); this.options.put( DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_RESOURCES_IN_TRY, DefaultCodeFormatterConstants.createAlignmentValue(true, DefaultCodeFormatterConstants.WRAP_NEXT_PER_LINE, DefaultCodeFormatterConstants.INDENT_DEFAULT)); this.lineDelimiter= lineDelimiter; this.tabWidth= IndentManipulation.getTabWidth(options); this.indentWidth= IndentManipulation.getIndentWidth(options); }
public ASTRewriteFormatter(NodeInfoStore placeholders, RewriteEventStore eventStore, Map options, String lineDelimiter) { this.placeholders= placeholders; this.eventStore= eventStore; this.options= options == null ? JavaCore.getOptions() : (Map) new HashMap(options); this.options.put( DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_RESOURCES_IN_TRY, DefaultCodeFormatterConstants.createAlignmentValue(true, DefaultCodeFormatterConstants.WRAP_NEXT_PER_LINE, DefaultCodeFormatterConstants.INDENT_DEFAULT)); this.lineDelimiter= lineDelimiter; this.tabWidth= IndentManipulation.getTabWidth(options); this.indentWidth= IndentManipulation.getIndentWidth(options); }
/** * Get the compiler options. * * @return the compiler options. */ public Map<String, String> getCompilerOptions() { final Map<String, String> options = getOptions(); final String v = javaSERelease.getMajorVersion() + "." + javaSERelease.getMinorVersion(); setComplianceOptions(v, options); return options; }
/** * @see IDOMFactory#createCompilationUnit(String, String) */ public IDOMCompilationUnit createCompilationUnit(ICompilationUnit compilationUnit) { initializeBuild(compilationUnit.getContents(), true, true); getParser(JavaCore.getOptions()).parseCompilationUnit(compilationUnit, false/*diet parse*/, null/*no progress*/); return super.createCompilationUnit(compilationUnit); } /**
/** * @see IDOMFactory#createCompilationUnit(String, String) */ public IDOMCompilationUnit createCompilationUnit(ICompilationUnit compilationUnit) { initializeBuild(compilationUnit.getContents(), true, true); getParser(JavaCore.getOptions()).parseCompilationUnit(compilationUnit, false/*diet parse*/, null/*no progress*/); return super.createCompilationUnit(compilationUnit); } /**
/** * @see IDOMFactory#createCompilationUnit(String, String) */ @Override public IDOMCompilationUnit createCompilationUnit(ICompilationUnit compilationUnit) { initializeBuild(compilationUnit.getContents(), true, true); getParser(JavaCore.getOptions()).parseCompilationUnit(compilationUnit, false/*diet parse*/, null/*no progress*/); return super.createCompilationUnit(compilationUnit); } /**
private Parser getParser() { if (this.parser == null) { this.compilerOptions = new CompilerOptions(JavaCore.getOptions()); ProblemReporter problemReporter = new ProblemReporter( DefaultErrorHandlingPolicies.proceedWithAllProblems(), this.compilerOptions, new DefaultProblemFactory()); this.parser = new Parser(problemReporter, true); } return this.parser; }
private Parser getParser() { if (this.parser == null) { this.compilerOptions = new CompilerOptions(JavaCore.getOptions()); ProblemReporter problemReporter = new ProblemReporter( DefaultErrorHandlingPolicies.proceedWithAllProblems(), this.compilerOptions, new DefaultProblemFactory()); this.parser = new Parser(problemReporter, true); } return this.parser; }