Example usage for org.eclipse.jdt.core JavaCore FORMATTER_TAB_SIZE

List of usage examples for org.eclipse.jdt.core JavaCore FORMATTER_TAB_SIZE

Introduction

In this page you can find the example usage for org.eclipse.jdt.core JavaCore FORMATTER_TAB_SIZE.

Prototype

String FORMATTER_TAB_SIZE

To view the source code for org.eclipse.jdt.core JavaCore FORMATTER_TAB_SIZE.

Click Source Link

Usage

From source file:com.jaxio.celerio.output.EclipseCodeFormatter.java

License:Apache License

@SuppressWarnings({ "unchecked", "deprecation" })
public void setFormatterSettings(List<Setting> settings) {

    // // change the option to wrap each enum constant on a new line
    // options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_ENUM_CONSTANTS,
    // DefaultCodeFormatterConstants.createAlignmentValue(true,
    // DefaultCodeFormatterConstants.WRAP_ONE_PER_LINE,
    // DefaultCodeFormatterConstants.INDENT_ON_COLUMN));
    ////from  w  ww  .  j av a2 s.com
    if (settings != null) {
        options = newHashMap();
        for (Setting s : settings) {
            options.put(s.getId(), s.getValue());
        }
    } else {
        options = DefaultCodeFormatterConstants.getEclipseDefaultSettings();

        options.put(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_8);
        options.put(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_1_8);
        options.put(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_8);

        options.put(JavaCore.FORMATTER_LINE_SPLIT, "160");
        options.put(JavaCore.FORMATTER_TAB_CHAR, JavaCore.SPACE);
        options.put(JavaCore.FORMATTER_TAB_SIZE, "4");
    }

    // instanciate the default code formatter with the given options
    codeFormatter = ToolFactory.createCodeFormatter(options);
}