template - java code formatter eclipse




How import eclipse code style to intellij idea? (2)

Go to Eclipse's Preferences → Java → Code Style → Formatter and export the settings to an XML file via the Export All button (or Edit and then Export in dialog that opens up). Then open IntelliJ IDEA Settings → Code Style → Java, click Manage, and import that XML file by simply clicking Import.

As of IntelliJ IDEA 13, there is no possibility to import .settings/.prefs files directly.


Edit: IntelliJ can import the following Eclipse properties:

  • General
    • Right margin, Formatter on/off tags
    • Indentation
    • Indent size
    • Usage of ‘Tab’ character
    • Usage of Tab only for leading indentation (Smart Tabs)
    • Indent ‘case’ branches from ‘switch’
    • Indent class members
    • Keep comment at first column
  • Spaces (Java)
    • Before/after comma (as set for Eclipse method declaration parameters)
    • After comma in type arguments
    • Within array initializer braces
    • Within brackets (in array reference)
    • Within parentheses of: annotation, ‘for’, ‘if’, ‘catch’ ’while’, ’switch’, method, empty method, parenthesized expression, method call, type cast, ‘synchronized’
    • Before parentheses of: ‘try’, ‘for’, ’while’, ‘switch’, method, ’if’, ‘catch’, method, method call, ‘synchronized’.
    • After type cast
    • Around unary, assignment operators (if it’s set for ‘before’ and ‘after’ in Eclipse).
    • Before opening brace of: array initializer, ‘switch’
    • Before ‘?’ in conditional expression
    • Space before/after ‘:’ in conditional expression
    • Space around binary operators (a single Eclipse setting is mapped to multiple IntelliJ IDEA’s settings)
  • Blank lines
    • Around fields and methods
    • Before/after package
    • Before/after imports
    • Before method body
    • Keep blank lines in code (number of empty lines to preserve)
  • Wrapping
    • New line before: closing brace in array initializer, ‘else’ in ‘if’ statement, ‘finally’ and ‘catch’ in ‘try’ statement, binary operator (if wrapped)
    • New line after: opening brace in array initializer Special ‘else if’ treatment (compact ‘else if’)
    • Keep simple blocks in one line
    • Keep control statements in one line
    • Alignment of: array initializer expressions, arguments in method declarations and calls, field declarations, extends list, assignments, binary expressions, ‘throws’ clause, resources in ‘try’.
    • Brace style for: code blocks, methods and classes
  • JavaDoc
    • Enable JavaDoc formatting
    • Blank lines in JavaDoc

I have org.eclipse.jdt.core.prefs file, which contains eclipse code style, but I can import to intellij idea only xml files, it there any way import prefs file to intellij idea?






preferences