Example usage for org.eclipse.jdt.core ICodeFormatter format

List of usage examples for org.eclipse.jdt.core ICodeFormatter format

Introduction

In this page you can find the example usage for org.eclipse.jdt.core ICodeFormatter format.

Prototype

String format(String string, int indentationLevel, int[] positions, String lineSeparator);

Source Link

Document

Formats the String sourceString, and returns a string containing the formatted version.

Usage

From source file:com.iw.plugins.spindle.util.Utils.java

License:Mozilla Public License

public static String formatJavaCode(String sourceString, int initialIndentationLevel, String lineDelim) {
    ICodeFormatter formatter = ToolFactory.createDefaultCodeFormatter(null);
    return formatter.format(sourceString, initialIndentationLevel, null, lineDelim) + lineDelim;
}