From 63facd9d6a583ee6880f2774f7b65aa1ce888d81 Mon Sep 17 00:00:00 2001 From: Rustam Vishnyakov Date: Mon, 20 Jan 2014 17:49:05 +0400 Subject: [PATCH] More fixes for IDEA-115200 Eclipse code style import: Line Wrapping: some categories are not applied --- .../eclipse/importer/EclipseCodeStyleSchemeImporter.java | 8 ++++++++ .../idea/eclipse/importer/EclipseImportMap.properties | 4 ++-- .../idea/eclipse/importer/EclipseXmlProfileElements.java | 2 ++ .../eclipse/testData/import/settings/eclipse_exported.xml | 4 ++-- .../jetbrains/idea/eclipse/EclipseSettingsImportTest.java | 8 ++++++++ 5 files changed, 22 insertions(+), 4 deletions(-) diff --git a/plugins/eclipse/src/org/jetbrains/idea/eclipse/importer/EclipseCodeStyleSchemeImporter.java b/plugins/eclipse/src/org/jetbrains/idea/eclipse/importer/EclipseCodeStyleSchemeImporter.java index b5ebe62df692..3c128ce92ccc 100644 --- a/plugins/eclipse/src/org/jetbrains/idea/eclipse/importer/EclipseCodeStyleSchemeImporter.java +++ b/plugins/eclipse/src/org/jetbrains/idea/eclipse/importer/EclipseCodeStyleSchemeImporter.java @@ -330,6 +330,14 @@ public class EclipseCodeStyleSchemeImporter implements SchemeImporter -#org.eclipse.jdt.core.formatter.alignment_for_conditional_expression= +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=Java: 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: #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: 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= diff --git a/plugins/eclipse/src/org/jetbrains/idea/eclipse/importer/EclipseXmlProfileElements.java b/plugins/eclipse/src/org/jetbrains/idea/eclipse/importer/EclipseXmlProfileElements.java index 889c866867aa..40d9bd74b49f 100644 --- a/plugins/eclipse/src/org/jetbrains/idea/eclipse/importer/EclipseXmlProfileElements.java +++ b/plugins/eclipse/src/org/jetbrains/idea/eclipse/importer/EclipseXmlProfileElements.java @@ -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; diff --git a/plugins/eclipse/testData/import/settings/eclipse_exported.xml b/plugins/eclipse/testData/import/settings/eclipse_exported.xml index bc7ffd6b01c2..661c8d9a390c 100644 --- a/plugins/eclipse/testData/import/settings/eclipse_exported.xml +++ b/plugins/eclipse/testData/import/settings/eclipse_exported.xml @@ -28,7 +28,7 @@ - + @@ -63,7 +63,7 @@ - + diff --git a/plugins/eclipse/testSources/org/jetbrains/idea/eclipse/EclipseSettingsImportTest.java b/plugins/eclipse/testSources/org/jetbrains/idea/eclipse/EclipseSettingsImportTest.java index 90931d5e201a..9e3474eea351 100644 --- a/plugins/eclipse/testSources/org/jetbrains/idea/eclipse/EclipseSettingsImportTest.java +++ b/plugins/eclipse/testSources/org/jetbrains/idea/eclipse/EclipseSettingsImportTest.java @@ -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();