diff options
author | Mateusz Matela | 2019-08-14 21:07:20 +0000 |
---|---|---|
committer | Mateusz Matela | 2019-08-14 21:07:20 +0000 |
commit | bfcc7f5fdc65e15bba873c742cf55b3775854f71 (patch) | |
tree | b6701ccaf9254847fc1d14efdf92473f706d5c61 | |
parent | 04b7005ad97319d2784644a11a24a8c27e3ff358 (diff) | |
download | eclipse.jdt.core-bfcc7f5fdc65e15bba873c742cf55b3775854f71.tar.gz eclipse.jdt.core-bfcc7f5fdc65e15bba873c742cf55b3775854f71.tar.xz eclipse.jdt.core-bfcc7f5fdc65e15bba873c742cf55b3775854f71.zip |
Bug 214283 - [formatter] Blank lines option should consider a
virtual/interface method
The "blank lines between abstract methods" setting can be derived from
the "blank lines between methods" setting to save the hassle for people
using the tool with an older configuration
Change-Id: Ica77158abd580bf2d41ea4fb42544568f15ec173
Signed-off-by: Mateusz Matela <mateusz.matela@gmail.com>
-rw-r--r-- | org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/DefaultCodeFormatterOptions.java | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/DefaultCodeFormatterOptions.java b/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/DefaultCodeFormatterOptions.java index 2139264563..a51194dec2 100644 --- a/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/DefaultCodeFormatterOptions.java +++ b/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/DefaultCodeFormatterOptions.java @@ -2446,6 +2446,8 @@ public class DefaultCodeFormatterOptions { if (wrapWrapOuterExpressionsWhenNestedOption != null) { this.wrap_outer_expressions_when_nested = DefaultCodeFormatterConstants.TRUE.equals(wrapWrapOuterExpressionsWhenNestedOption); } + + setDerivableOptions(settings); } private int toInt(Object value, int defaultValue) { @@ -2740,6 +2742,17 @@ public class DefaultCodeFormatterOptions { } } + /** + * Handles new settings which may not be defined in an older profile, but are can be easily derived from other + * settings to keep the behavior consistent with previous versions. + */ + private void setDerivableOptions(Map<String, String> settings) { + if (!settings.containsKey(DefaultCodeFormatterConstants.FORMATTER_BLANK_LINES_BEFORE_ABSTRACT_METHOD)) { + setInt(settings, DefaultCodeFormatterConstants.FORMATTER_BLANK_LINES_BEFORE_METHOD, + v -> this.blank_lines_before_abstract_method = v); + } + } + public void setDefaultSettings() { this.alignment_for_arguments_in_allocation_expression = Alignment.M_COMPACT_SPLIT; this.alignment_for_arguments_in_annotation = Alignment.M_NO_ALIGNMENT; |