From 93b6c3ccc21d4ca4703b832f274bee202ceb8ddc Mon Sep 17 00:00:00 2001 From: Georgii Ustinov Date: Wed, 3 Jul 2024 12:08:33 +0300 Subject: [PATCH] [Java. Code Formatting] Split option to add blank lines for fields with/without annotations IDEA-110857 GitOrigin-RevId: 6ee23199e686c649439833df1223a12494be9d00 --- .../intellij/psi/codeStyle/JavaCodeStyleSettings.java | 1 + .../ide/JavaLanguageCodeStyleSettingsProvider.java | 9 +++++++++ java/openapi/resources/messages/JavaBundle.properties | 2 ++ 3 files changed, 12 insertions(+) diff --git a/java/java-frontback-impl/src/com/intellij/psi/codeStyle/JavaCodeStyleSettings.java b/java/java-frontback-impl/src/com/intellij/psi/codeStyle/JavaCodeStyleSettings.java index c3a8ed63f858..201c54365e05 100644 --- a/java/java-frontback-impl/src/com/intellij/psi/codeStyle/JavaCodeStyleSettings.java +++ b/java/java-frontback-impl/src/com/intellij/psi/codeStyle/JavaCodeStyleSettings.java @@ -123,6 +123,7 @@ public class JavaCodeStyleSettings extends CustomCodeStyleSettings implements Im public boolean ALIGN_MULTILINE_TEXT_BLOCKS = false; public int BLANK_LINES_AROUND_INITIALIZER = 1; + public int BLANK_LINES_AROUND_FIELD_WITH_ANNOTATIONS = 0; public static final int FULLY_QUALIFY_NAMES_IF_NOT_IMPORTED = 1; public static final int FULLY_QUALIFY_NAMES_ALWAYS = 2; diff --git a/java/java-impl/src/com/intellij/ide/JavaLanguageCodeStyleSettingsProvider.java b/java/java-impl/src/com/intellij/ide/JavaLanguageCodeStyleSettingsProvider.java index 9cff0cc7fb8d..4775e81b61eb 100644 --- a/java/java-impl/src/com/intellij/ide/JavaLanguageCodeStyleSettingsProvider.java +++ b/java/java-impl/src/com/intellij/ide/JavaLanguageCodeStyleSettingsProvider.java @@ -305,6 +305,15 @@ public final class JavaLanguageCodeStyleSettingsProvider extends LanguageCodeSty consumer.showCustomOption(JavaCodeStyleSettings.class, "BLANK_LINES_AROUND_INITIALIZER", JavaBundle.message("editbox.blanklines.around.initializer"), getInstance().BLANK_LINES); + + consumer.renameStandardOption( + "BLANK_LINES_AROUND_FIELD", + JavaBundle.message("editbox.blank.lines.field.without.annotations")); + + consumer.showCustomOption(JavaCodeStyleSettings.class, + "BLANK_LINES_AROUND_FIELD_WITH_ANNOTATIONS", + JavaBundle.message("editbox.blank.lines.field.with.annotations"), + getInstance().BLANK_LINES); } else if (settingsType == SettingsType.COMMENTER_SETTINGS) { consumer.showAllStandardOptions(); diff --git a/java/openapi/resources/messages/JavaBundle.properties b/java/openapi/resources/messages/JavaBundle.properties index 4cce9464d8db..17a6a4868c0b 100644 --- a/java/openapi/resources/messages/JavaBundle.properties +++ b/java/openapi/resources/messages/JavaBundle.properties @@ -220,6 +220,8 @@ dialog.title.testdatapath.file.generate=Generate files from class to @TestDataPa do.not.import.inner.classes.for=Exclude inner classes by short name: do.not.import.inner.classes.no.classes=No inner classes defined editbox.blanklines.around.initializer=Around initializer: +editbox.blank.lines.field.without.annotations=Around field without annotations: +editbox.blank.lines.field.with.annotations=Around field with annotations: editbox.class.count.to.use.import.with.star=Class count to use import with '*': editbox.names.count.to.use.static.import.with.star=Names count to use static import with '*': enum.not.allowed=Enum is not allowed