Package org.eclipse.jdt.internal.formatter

Examples of org.eclipse.jdt.internal.formatter.DefaultCodeFormatter.format()


    newOptions.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_ARRAY_INITIALIZER, JavaCore.INSERT);
    newOptions.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_BRACE_IN_ARRAY_INITIALIZER, JavaCore.INSERT);
    newOptions.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_BRACE_IN_ARRAY_INITIALIZER, JavaCore.INSERT);

    DefaultCodeFormatter defaultCodeFormatter = new DefaultCodeFormatter(newOptions);
    TextEdit textEdit = defaultCodeFormatter.format(org.eclipse.jdt.core.formatter.CodeFormatter.K_UNKNOWN, string, 0, string.length(), indentLevel, lineSeparator);
    if (positions != null && textEdit != null) {
      // update positions
      TextEdit[] edits = textEdit.getChildren();
      int textEditSize = edits.length;
      int editsIndex = 0;
View Full Code Here


        IndentManipulation.isLineDelimiterChar(buffer.getChar(offset + length)))
    {
      length++;
    }

    TextEdit edits = formatter.format(kind, contents, offset, length, 0, delimiter);
    if (edits != null) {
      int oldLength = contents.length();
      Document document = new Document(contents);
      edits.apply(document);
View Full Code Here

    newOptions.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_ARRAY_INITIALIZER, JavaCore.INSERT);
    newOptions.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_BRACE_IN_ARRAY_INITIALIZER, JavaCore.INSERT);
    newOptions.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_BRACE_IN_ARRAY_INITIALIZER, JavaCore.INSERT);

    DefaultCodeFormatter defaultCodeFormatter = new DefaultCodeFormatter(newOptions);
    TextEdit textEdit = defaultCodeFormatter.format(org.eclipse.jdt.core.formatter.CodeFormatter.K_UNKNOWN, string, 0, string.length(), indentLevel, lineSeparator);
    if (positions != null && textEdit != null) {
      // update positions
      TextEdit[] edits = textEdit.getChildren();
      int textEditSize = edits.length;
      int editsIndex = 0;
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.