Example usage for org.eclipse.jdt.core.formatter DefaultCodeFormatterConstants FORMATTER_COMMENT_CLEAR_BLANK_LINES

List of usage examples for org.eclipse.jdt.core.formatter DefaultCodeFormatterConstants FORMATTER_COMMENT_CLEAR_BLANK_LINES

Introduction

In this page you can find the example usage for org.eclipse.jdt.core.formatter DefaultCodeFormatterConstants FORMATTER_COMMENT_CLEAR_BLANK_LINES.

Prototype

String FORMATTER_COMMENT_CLEAR_BLANK_LINES

To view the source code for org.eclipse.jdt.core.formatter DefaultCodeFormatterConstants FORMATTER_COMMENT_CLEAR_BLANK_LINES.

Click Source Link

Document

 FORMATTER / Option to control whether blank lines are cleared inside comments - option id:         "org.eclipse.jdt.core.formatter.comment.clear_blank_lines" - possible values:   { TRUE, FALSE } - default:           FALSE 

Usage

From source file:com.bsiag.eclipse.jdt.java.formatter.DefaultCodeFormatterOptions.java

License:Open Source License

/**
 * This method is used to handle deprecated preferences which might be replaced by
 * one or more preferences./*from   w  w w. j  a v a2s  .c o  m*/
 * Depending on deprecated option handling policy, set the new formatting option(s).
 * @param settings the given map
 * @deprecated
 */
private void setDeprecatedOptions(Map<String, String> settings) {
    // backward compatibility code
    final Object commentClearBlankLinesOption = settings
            .get(DefaultCodeFormatterConstants.FORMATTER_COMMENT_CLEAR_BLANK_LINES);
    if (commentClearBlankLinesOption != null) {
        this.comment_clear_blank_lines_in_javadoc_comment = DefaultCodeFormatterConstants.TRUE
                .equals(commentClearBlankLinesOption);
        this.comment_clear_blank_lines_in_block_comment = DefaultCodeFormatterConstants.TRUE
                .equals(commentClearBlankLinesOption);
    } else {
        final Object commentClearBlankLinesInJavadocCommentOption = settings
                .get(DefaultCodeFormatterConstants.FORMATTER_COMMENT_CLEAR_BLANK_LINES_IN_JAVADOC_COMMENT);
        if (commentClearBlankLinesInJavadocCommentOption != null) {
            this.comment_clear_blank_lines_in_javadoc_comment = DefaultCodeFormatterConstants.TRUE
                    .equals(commentClearBlankLinesInJavadocCommentOption);
        }
        final Object commentClearBlankLinesInBlockCommentOption = settings
                .get(DefaultCodeFormatterConstants.FORMATTER_COMMENT_CLEAR_BLANK_LINES_IN_BLOCK_COMMENT);
        if (commentClearBlankLinesInBlockCommentOption != null) {
            this.comment_clear_blank_lines_in_block_comment = DefaultCodeFormatterConstants.TRUE
                    .equals(commentClearBlankLinesInBlockCommentOption);
        }
    }

    // New line after annotations
    final Object insertNewLineAfterAnnotationOption = settings
            .get(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION);

    final Object insertNewLineAfterAnnotationOnMemberOption = settings
            .get(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_MEMBER);
    final Object insertNewLineAfterAnnotationOnTypeOption = settings
            .get(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_TYPE);
    final Object insertNewLineAfterAnnotationOnFieldOption = settings
            .get(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_FIELD);
    final Object insertNewLineAfterAnnotationOnMethodOption = settings
            .get(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_METHOD);
    final Object insertNewLineAfterAnnotationOnPackageOption = settings
            .get(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_PACKAGE);

    final Object insertNewLineAfterAnnotationOnParameterOption = settings
            .get(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_PARAMETER);
    final Object insertNewLineAfterAnnotationOnLocalVariableOption = settings
            .get(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_LOCAL_VARIABLE);

    if (insertNewLineAfterAnnotationOnTypeOption == null && insertNewLineAfterAnnotationOnFieldOption == null
            && insertNewLineAfterAnnotationOnMethodOption == null
            && insertNewLineAfterAnnotationOnPackageOption == null) {
        // if none of the new 3.7 options is used, fall back to the deprecated 3.4 option
        if (insertNewLineAfterAnnotationOnMemberOption != null) {
            boolean insert = JavaCore.INSERT.equals(insertNewLineAfterAnnotationOnMemberOption);
            this.insert_new_line_after_annotation_on_type = insert;
            this.insert_new_line_after_annotation_on_field = insert;
            this.insert_new_line_after_annotation_on_method = insert;
            this.insert_new_line_after_annotation_on_package = insert;

            // and use the other 3.4 options if available
            if (insertNewLineAfterAnnotationOnParameterOption != null) {
                this.insert_new_line_after_annotation_on_parameter = JavaCore.INSERT
                        .equals(insertNewLineAfterAnnotationOnParameterOption);
            }
            if (insertNewLineAfterAnnotationOnLocalVariableOption != null) {
                this.insert_new_line_after_annotation_on_local_variable = JavaCore.INSERT
                        .equals(insertNewLineAfterAnnotationOnLocalVariableOption);
            }

        } else if (insertNewLineAfterAnnotationOnParameterOption == null
                && insertNewLineAfterAnnotationOnLocalVariableOption == null) {
            // if none of the new 3.4 options is used, fall back to the deprecated 3.1 option
            if (insertNewLineAfterAnnotationOption != null) {
                boolean insert = JavaCore.INSERT.equals(insertNewLineAfterAnnotationOption);
                this.insert_new_line_after_annotation_on_type = insert;
                this.insert_new_line_after_annotation_on_field = insert;
                this.insert_new_line_after_annotation_on_method = insert;
                this.insert_new_line_after_annotation_on_package = insert;
                this.insert_new_line_after_annotation_on_parameter = insert;
                this.insert_new_line_after_annotation_on_local_variable = insert;
            }
        }
    } else { // otherwise use new 3.7 options if available
        if (insertNewLineAfterAnnotationOnTypeOption != null) {
            this.insert_new_line_after_annotation_on_type = JavaCore.INSERT
                    .equals(insertNewLineAfterAnnotationOnTypeOption);
        }
        if (insertNewLineAfterAnnotationOnFieldOption != null) {
            this.insert_new_line_after_annotation_on_field = JavaCore.INSERT
                    .equals(insertNewLineAfterAnnotationOnFieldOption);
        }
        if (insertNewLineAfterAnnotationOnMethodOption != null) {
            this.insert_new_line_after_annotation_on_method = JavaCore.INSERT
                    .equals(insertNewLineAfterAnnotationOnMethodOption);
        }
        if (insertNewLineAfterAnnotationOnPackageOption != null) {
            this.insert_new_line_after_annotation_on_package = JavaCore.INSERT
                    .equals(insertNewLineAfterAnnotationOnPackageOption);
        }
        // and the other 3.4 options if available
        if (insertNewLineAfterAnnotationOnParameterOption != null) {
            this.insert_new_line_after_annotation_on_parameter = JavaCore.INSERT
                    .equals(insertNewLineAfterAnnotationOnParameterOption);
        }
        if (insertNewLineAfterAnnotationOnLocalVariableOption != null) {
            this.insert_new_line_after_annotation_on_local_variable = JavaCore.INSERT
                    .equals(insertNewLineAfterAnnotationOnLocalVariableOption);
        }
    }
}