Example usage for org.eclipse.jdt.internal.formatter DefaultCodeFormatterOptions getEclipseDefaultSettings

List of usage examples for org.eclipse.jdt.internal.formatter DefaultCodeFormatterOptions getEclipseDefaultSettings

Introduction

In this page you can find the example usage for org.eclipse.jdt.internal.formatter DefaultCodeFormatterOptions getEclipseDefaultSettings.

Prototype

public static DefaultCodeFormatterOptions getEclipseDefaultSettings() 

Source Link

Usage

From source file:org.nabucco.framework.mda.model.java.file.JavaCodeFormatter.java

License:Open Source License

/**
 * Creates a code formatter with default formatter properties.
 * /*ww w. jav a  2  s . co  m*/
 * <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);
}