/** * {@inheritDoc} */ public TextEdit format(int kind, String source, IRegion[] regions, int indentationLevel, String lineSeparator) { if (!regionsSatisfiesPreconditions(regions, source.length())) { throw new IllegalArgumentException(); } this.codeSnippetParsingUtil = new CodeSnippetParsingUtil(); boolean includeComments = (kind & F_INCLUDE_COMMENTS) != 0; switch(kind & K_MASK) { case K_CLASS_BODY_DECLARATIONS : return formatClassBodyDeclarations(source, indentationLevel, lineSeparator, regions, includeComments); case K_COMPILATION_UNIT : return formatCompilationUnit(source, indentationLevel, lineSeparator, regions, includeComments); case K_EXPRESSION : return formatExpression(source, indentationLevel, lineSeparator, regions, includeComments); case K_STATEMENTS : return formatStatements(source, indentationLevel, lineSeparator, regions, includeComments); case K_UNKNOWN : return probeFormatting(source, indentationLevel, lineSeparator, regions, includeComments); case K_JAVA_DOC : case K_MULTI_LINE_COMMENT : case K_SINGLE_LINE_COMMENT : //https://bugs.eclipse.org/bugs/show_bug.cgi?id=204091 throw new IllegalArgumentException(); } return null; }
/** * {@inheritDoc} */ public TextEdit format(int kind, String source, IRegion[] regions, int indentationLevel, String lineSeparator) { if (!regionsSatisfiesPreconditions(regions, source.length())) { throw new IllegalArgumentException(); } this.codeSnippetParsingUtil = new CodeSnippetParsingUtil(); boolean includeComments = (kind & F_INCLUDE_COMMENTS) != 0; switch(kind & K_MASK) { case K_CLASS_BODY_DECLARATIONS : return formatClassBodyDeclarations(source, indentationLevel, lineSeparator, regions, includeComments); case K_COMPILATION_UNIT : return formatCompilationUnit(source, indentationLevel, lineSeparator, regions, includeComments); case K_EXPRESSION : return formatExpression(source, indentationLevel, lineSeparator, regions, includeComments); case K_STATEMENTS : return formatStatements(source, indentationLevel, lineSeparator, regions, includeComments); case K_UNKNOWN : return probeFormatting(source, indentationLevel, lineSeparator, regions, includeComments); case K_JAVA_DOC : case K_MULTI_LINE_COMMENT : case K_SINGLE_LINE_COMMENT : //https://bugs.eclipse.org/bugs/show_bug.cgi?id=204091 throw new IllegalArgumentException(); } return null; }
/** * {@inheritDoc} */ public TextEdit format(int kind, String source, IRegion[] regions, int indentationLevel, String lineSeparator) { if (!regionsSatisfiesPreconditions(regions, source.length())) { throw new IllegalArgumentException(); } this.codeSnippetParsingUtil = new CodeSnippetParsingUtil(); boolean includeComments = (kind & F_INCLUDE_COMMENTS) != 0; switch(kind & K_MASK) { case K_CLASS_BODY_DECLARATIONS : return formatClassBodyDeclarations(source, indentationLevel, lineSeparator, regions, includeComments); case K_COMPILATION_UNIT : return formatCompilationUnit(source, indentationLevel, lineSeparator, regions, includeComments); case K_EXPRESSION : return formatExpression(source, indentationLevel, lineSeparator, regions, includeComments); case K_STATEMENTS : return formatStatements(source, indentationLevel, lineSeparator, regions, includeComments); case K_UNKNOWN : return probeFormatting(source, indentationLevel, lineSeparator, regions, includeComments); case K_JAVA_DOC : case K_MULTI_LINE_COMMENT : case K_SINGLE_LINE_COMMENT : //https://bugs.eclipse.org/bugs/show_bug.cgi?id=204091 throw new IllegalArgumentException(); } return null; }