Skip to content

Commit af14ce0

Browse files
migrate formatting (#299)
1 parent fad2302 commit af14ce0

File tree

3 files changed

+137
-0
lines changed

3 files changed

+137
-0
lines changed

ide/IntelliJ_Migration_Guide.md

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# 🚀 Migration Guide: From Eclipse Formatter Plugin to IntelliJ Native Formatting
2+
3+
This guide helps you transition from the Eclipse Code Formatter plugin to IntelliJ's native formatting system using a shared IntelliJ XML configuration.
4+
5+
---
6+
7+
## ✅ Step 1: Remove the Eclipse Code Formatter Plugin
8+
9+
1. Open IntelliJ IDEA.
10+
2. Go to: `Settings (Preferences on macOS) → Plugins`
11+
3. Search for: `Adapter for Eclipse Code Formatter`
12+
4. Click the down arrow next to Disable and select **"Uninstall"**
13+
5. **Restart IntelliJ** to apply changes.
14+
15+
---
16+
17+
## ✅ Step 2: Import the IntelliJ Code Style XML
18+
19+
1. Go to: `Settings → Editor → Code Style`
20+
2. Click the gear icon ⚙️ next to the scheme dropdown.
21+
3. Select: `Import Scheme → IntelliJ IDEA code style XML`
22+
4. Choose the provided XML file (e.g., `mta_formatter_java.xml`)
23+
5. Click **OK**
24+
25+
---
26+
27+
## ✅ Step 3: Restore IntelliJ Default Import Order
28+
29+
1. Navigate to: `Settings → Editor → Code Style → Java → Imports`
30+
2. In the **Import Layout** section your order should look like the following:
31+
![alt text](image.png)
32+
3. Click **Apply** and **OK**
33+
34+
---
35+
36+
## ✅ Step 4: Enable Auto-Formatting and Import Optimization on Save
37+
38+
1. Navigate to: `Settings → Tools → Actions on Save`
39+
2. Enable:
40+
- ✅ Reformat code
41+
- ✅ Optimize imports
42+
- ✅ (Optional) Run code cleanup
43+
44+
---
45+
46+
## ✅ Step 5: Enable "Optimize Imports on the Fly"
47+
48+
1. Go to: `Settings → Editor → General → Auto Import`
49+
2. For Java:
50+
- ✅ Optimize imports on the fly
51+
- ✅ Add unambiguous imports on the fly
52+
53+
---
54+
55+
## ✅ Step 6: (Optional) Enable Auto-Save
56+
57+
1. Navigate to: `Settings → Appearance & Behavior → System Settings`
58+
2. Enable:
59+
- ✅ Save files on frame deactivation
60+
- ✅ Save files automatically if application is idle
61+
62+
---
63+
64+
## ✅ Step 7: Verify Setup
65+
66+
1. Open a `.java` file.
67+
2. Modify and save (or switch windows) or execute a manual formatting and imports optimisation.
68+
3. IntelliJ should:
69+
- Format the code the same way as with the old formatter
70+
- Optimize and sort imports most likely will change the file as the legacy code was following different import order
71+
72+
---
73+
74+
## ✅ Benefits
75+
76+
- Removes plugin dependency
77+
- Ensures consistent formatting and import order
78+
- Uses IntelliJ-native tooling for better performance
79+
80+
---
81+
82+
🎉 You’re all set to work with clean, consistent, and modern Java formatting in IntelliJ IDEA!

ide/image.png

31.1 KB
Loading

ide/mta_formatter_java.xml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
<code_scheme name="mta_formatter_java" version="173">
2+
<option name="RIGHT_MARGIN" value="140" />
3+
<JavaCodeStyleSettings>
4+
<option name="SPACE_AFTER_CLOSING_ANGLE_BRACKET_IN_TYPE_ARGUMENT" value="true" />
5+
<option name="CLASS_COUNT_TO_USE_IMPORT_ON_DEMAND" value="99999" />
6+
<option name="NAMES_COUNT_TO_USE_IMPORT_ON_DEMAND" value="99999" />
7+
<option name="ALIGN_TYPES_IN_MULTI_CATCH" value="false" />
8+
<option name="JD_ALIGN_PARAM_COMMENTS" value="false" />
9+
<option name="JD_ALIGN_EXCEPTION_COMMENTS" value="false" />
10+
<option name="JD_P_AT_EMPTY_LINES" value="false" />
11+
<option name="JD_DO_NOT_WRAP_ONE_LINE_COMMENTS" value="true" />
12+
</JavaCodeStyleSettings>
13+
<editorconfig>
14+
<option name="ENABLED" value="false" />
15+
</editorconfig>
16+
<codeStyleSettings language="JAVA">
17+
<option name="RIGHT_MARGIN" value="140" />
18+
<option name="KEEP_LINE_BREAKS" value="true" />
19+
<option name="KEEP_FIRST_COLUMN_COMMENT" value="false" />
20+
<option name="KEEP_CONTROL_STATEMENT_IN_ONE_LINE" value="false" />
21+
<option name="KEEP_BLANK_LINES_IN_DECLARATIONS" value="1" />
22+
<option name="KEEP_BLANK_LINES_IN_CODE" value="1" />
23+
<option name="KEEP_BLANK_LINES_BETWEEN_PACKAGE_DECLARATION_AND_HEADER" value="1" />
24+
<option name="KEEP_BLANK_LINES_BEFORE_RBRACE" value="1" />
25+
<option name="ALIGN_MULTILINE_CHAINED_METHODS" value="true" />
26+
<option name="ALIGN_MULTILINE_PARAMETERS_IN_CALLS" value="true" />
27+
<option name="ALIGN_MULTILINE_RESOURCES" value="false" />
28+
<option name="ALIGN_MULTILINE_FOR" value="false" />
29+
<option name="SPACE_WITHIN_ARRAY_INITIALIZER_BRACES" value="true" />
30+
<option name="SPACE_BEFORE_ARRAY_INITIALIZER_LBRACE" value="true" />
31+
<option name="CALL_PARAMETERS_WRAP" value="1" />
32+
<option name="METHOD_PARAMETERS_WRAP" value="1" />
33+
<option name="RESOURCE_LIST_WRAP" value="5" />
34+
<option name="EXTENDS_LIST_WRAP" value="1" />
35+
<option name="THROWS_LIST_WRAP" value="1" />
36+
<option name="EXTENDS_KEYWORD_WRAP" value="1" />
37+
<option name="THROWS_KEYWORD_WRAP" value="1" />
38+
<option name="METHOD_CALL_CHAIN_WRAP" value="2" />
39+
<option name="BINARY_OPERATION_WRAP" value="1" />
40+
<option name="BINARY_OPERATION_SIGN_ON_NEXT_LINE" value="true" />
41+
<option name="TERNARY_OPERATION_WRAP" value="5" />
42+
<option name="TERNARY_OPERATION_SIGNS_ON_NEXT_LINE" value="true" />
43+
<option name="ARRAY_INITIALIZER_WRAP" value="1" />
44+
<option name="WRAP_COMMENTS" value="true" />
45+
<option name="METHOD_ANNOTATION_WRAP" value="2" />
46+
<option name="CLASS_ANNOTATION_WRAP" value="2" />
47+
<option name="FIELD_ANNOTATION_WRAP" value="2" />
48+
<option name="USE_TAB_CHARACTER" value="false" />
49+
<indentOptions>
50+
<option name="INDENT_SIZE" value="4" />
51+
<option name="CONTINUATION_INDENT_SIZE" value="4" />
52+
<option name="TAB_SIZE" value="4" />
53+
</indentOptions>
54+
</codeStyleSettings>
55+
</code_scheme>

0 commit comments

Comments
 (0)