List of usage examples for org.eclipse.jdt.internal.formatter DefaultCodeFormatter DefaultCodeFormatter
public DefaultCodeFormatter(DefaultCodeFormatterOptions defaultCodeFormatterOptions,
Map<String, String> options)
From source file:org.eclipse.objectteams.otdt.core.tests.formatter.FormatterTests.java
License:Open Source License
private void runTest(String packageName, String compilationUnitName) { DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions( DefaultCodeFormatterConstants.getEclipseDefaultSettings()); preferences.number_of_empty_lines_to_preserve = 0; DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences, this.currentProject.getOptions(false)); runTest(codeFormatter, packageName, compilationUnitName, CodeFormatter.K_COMPILATION_UNIT, 0); }
From source file:org.nabucco.framework.mda.model.java.file.JavaCodeFormatter.java
License:Open Source License
/** * Creates a code formatter with default formatter properties. * //from w w w. j a v a2s. c om * <ul> * <li>Source : 1.5</li> * <li>Compliance : 1.5</li> * <li>Target Platform : 1.5</li> * </ul> * * @return the default code formatter */ private CodeFormatter createDefaultCodeFormatter() { DefaultCodeFormatterOptions formatterOptions = DefaultCodeFormatterOptions.getEclipseDefaultSettings(); formatterOptions.page_width = MAX_LINE_WIDTH; @SuppressWarnings("unchecked") Map<String, Object> options = formatterOptions.getMap(); options.put("org.eclipse.jdt.core.compiler.compliance", 1.5); options.put("org.eclipse.jdt.core.compiler.codegen.targetPlatform", 1.5); options.put("org.eclipse.jdt.core.compiler.source", 1.5); return new DefaultCodeFormatter(formatterOptions, options); }