List of usage examples for org.eclipse.jdt.core.formatter DefaultCodeFormatterConstants getJavaConventionsSettings
public static Map getJavaConventionsSettings()
From source file:com.bsiag.eclipse.jdt.java.formatter.DefaultCodeFormatter.java
License:Open Source License
public DefaultCodeFormatter() { this(new DefaultCodeFormatterOptions(DefaultCodeFormatterConstants.getJavaConventionsSettings()), null); }
From source file:com.bsiag.eclipse.jdt.java.formatter.DefaultCodeFormatter.java
License:Open Source License
private void initOptions(DefaultCodeFormatterOptions defaultCodeFormatterOptions, Map<String, String> options) { if (options != null) { this.originalOptions = new DefaultCodeFormatterOptions(options); this.workingOptions = new DefaultCodeFormatterOptions(options); this.oldCommentFormatOption = getOldCommentFormatOption(options); String compilerSource = options.get(CompilerOptions.OPTION_Source); this.sourceLevel = compilerSource != null ? compilerSource : CompilerOptions.VERSION_1_8; } else {/*from ww w.j ava 2 s. c om*/ Map<String, String> settings = DefaultCodeFormatterConstants.getJavaConventionsSettings(); this.originalOptions = new DefaultCodeFormatterOptions(settings); this.workingOptions = new DefaultCodeFormatterOptions(settings); this.oldCommentFormatOption = DefaultCodeFormatterConstants.TRUE; this.sourceLevel = CompilerOptions.VERSION_1_8; } if (defaultCodeFormatterOptions != null) { this.originalOptions.set(defaultCodeFormatterOptions.getMap()); this.workingOptions.set(defaultCodeFormatterOptions.getMap()); } }
From source file:de.markiewb.netbeans.plugins.eclipse.formatter.EclipseFormatter.java
License:Open Source License
private Map getFormattingOptions() { Map options = DefaultCodeFormatterConstants.getJavaConventionsSettings(); options.put(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_6); options.put(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_1_6); options.put(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_6); // For checking whether the Eclipse formatter works, // without needing an Eclipse formatter XML file: // options.put( // DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_ENUM_CONSTANTS, // DefaultCodeFormatterConstants.createAlignmentValue( // true, // DefaultCodeFormatterConstants.WRAP_ONE_PER_LINE, // DefaultCodeFormatterConstants.INDENT_ON_COLUMN)); return options; }