More fixes for IDEA-115200 Eclipse code style import: Line Wrapping: some categories are not applied

This commit is contained in:
Rustam Vishnyakov
2014-01-20 17:50:39 +04:00
parent 2cc69e5324
commit 63facd9d6a
5 changed files with 22 additions and 4 deletions
@@ -330,6 +330,14 @@ public class EclipseCodeStyleSchemeImporter implements SchemeImporter<CodeStyleS
settings.RESOURCE_LIST_LPAREN_ON_NEXT_LINE = decoder.isFirstElementWrapped();
return true;
}
else if (OPTION_ALIGN_CHAINED_CALLS.equals(key)) {
settings.METHOD_CALL_CHAIN_WRAP = decoder.getWrapType();
settings.ALIGN_MULTILINE_CHAINED_METHODS = decoder.isAlignmentOn();
}
else if (OPTION_ALIGN_CONDITIONALS.equals(key)) {
settings.TERNARY_OPERATION_WRAP = decoder.getWrapType();
settings.ALIGN_MULTILINE_TERNARY_OPERATION = decoder.isAlignmentOn();
}
return false;
}
}
@@ -35,7 +35,7 @@ org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=Java:
#org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=
#org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=
org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=Java:<Programmatic>
#org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=
org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=Java:<Programmatic>
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=Java:SPACE_BEFORE_FOR_PARENTHESES
org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=Java:<Programmatic>
#org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=
@@ -69,7 +69,7 @@ org.eclipse.jdt.core.formatter.align_type_members_on_columns=Java:ALIGN_GROUP_FI
#org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=Java:SPACE_WITHIN_FOR_PARENTHESES
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=Java:SPACE_BEFORE_METHOD_PARENTHESES
#org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=
org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=Java:<Programmatic>
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=Java:SPACE_WITHIN_SWITCH_PARENTHESES
org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=Java:SPACE_AROUND_UNARY_OPERATOR
#org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=
@@ -60,6 +60,8 @@ public interface EclipseXmlProfileElements {
String OPTION_ALIGN_THROWS_IN_METHOD_DECL = "org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration";
String OPTION_ALIGN_RESOURCES_IN_TRY = "org.eclipse.jdt.core.formatter.alignment_for_resources_in_try";
String OPTION_ALIGN_METHOD_DECL = "org.eclipse.jdt.core.formatter.alignment_for_method_declaration";
String OPTION_ALIGN_CHAINED_CALLS = "org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation";
String OPTION_ALIGN_CONDITIONALS = "org.eclipse.jdt.core.formatter.alignment_for_conditional_expression";
int WRAP_MASK = 0x70;
@@ -28,7 +28,7 @@
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_multiple_fields" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer" value="34"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_conditional_expression" value="80"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_conditional_expression" value="18"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_binary_operator" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard" value="do not insert"/>
@@ -63,7 +63,7 @@
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation" value="50"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_unary_operator" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case" value="insert"/>
@@ -115,6 +115,10 @@ public class EclipseSettingsImportTest extends PlatformTestCase {
javaSettings.ALIGN_MULTILINE_RESOURCES = true;
javaSettings.RESOURCE_LIST_WRAP = CommonCodeStyleSettings.DO_NOT_WRAP;
javaSettings.RESOURCE_LIST_LPAREN_ON_NEXT_LINE = true;
javaSettings.METHOD_CALL_CHAIN_WRAP = CommonCodeStyleSettings.DO_NOT_WRAP;
javaSettings.ALIGN_MULTILINE_CHAINED_METHODS = false;
javaSettings.TERNARY_OPERATION_WRAP = CommonCodeStyleSettings.DO_NOT_WRAP;
javaSettings.ALIGN_MULTILINE_TERNARY_OPERATION = false;
indentOptions.USE_TAB_CHARACTER = false;
indentOptions.SMART_TABS = false;
indentOptions.TAB_SIZE = 3;
@@ -209,6 +213,10 @@ public class EclipseSettingsImportTest extends PlatformTestCase {
assertFalse(javaSettings.ALIGN_MULTILINE_RESOURCES);
assertEquals(CommonCodeStyleSettings.WRAP_AS_NEEDED, javaSettings.RESOURCE_LIST_WRAP);
assertFalse(javaSettings.RESOURCE_LIST_LPAREN_ON_NEXT_LINE);
assertEquals(CommonCodeStyleSettings.WRAP_ON_EVERY_ITEM | CommonCodeStyleSettings.WRAP_AS_NEEDED, javaSettings.METHOD_CALL_CHAIN_WRAP);
assertTrue(javaSettings.ALIGN_MULTILINE_CHAINED_METHODS);
assertEquals(CommonCodeStyleSettings.WRAP_AS_NEEDED, javaSettings.TERNARY_OPERATION_WRAP);
assertTrue(javaSettings.ALIGN_MULTILINE_TERNARY_OPERATION);
}
finally {
inputStream.close();