/** * Old API. Consider to use format2 (TextEdit) */ public static String format(ASTNode node, String string, int indentationLevel, int[] positions, String lineSeparator, Map options) { TextEdit edit= format2(node, string, indentationLevel, lineSeparator, options); if (edit == null) { //JavaPlugin.logErrorMessage("formatter failed to format (no edit returned). Will use unformatted text instead. node: " + node.getNodeType() + ", string: " + string); //$NON-NLS-1$ //$NON-NLS-2$ return string; } return getOldAPICompatibleResult(string, edit, indentationLevel, positions, lineSeparator, options); }
/** * Old API. Consider to use format2 (TextEdit) */ public static String format(int kind, String string, int offset, int length, int indentationLevel, int[] positions, String lineSeparator, Map options) { TextEdit edit= format2(kind, string, offset, length, indentationLevel, lineSeparator, options); if (edit == null) { //JavaPlugin.logErrorMessage("formatter failed to format (no edit returned). Will use unformatted text instead. kind: " + kind + ", string: " + string); //$NON-NLS-1$ //$NON-NLS-2$ return string.substring(offset, offset + length); } String formatted= getOldAPICompatibleResult(string, edit, indentationLevel, positions, lineSeparator, options); return formatted.substring(offset, formatted.length() - (string.length() - (offset + length))); }