Edit page History

Eclipse code style profiles and IntelliJ

    This is a short guide on how to start using the Eclipse code style profile of ImageJ.

    Installing Eclipse code formatter plugin

    The first step is to install the Eclipse code formatter (ECF) plugin to your IntelliJ:

    1. Open File > Settings
    2. Select Plugins from the left-hand pane
    3. Click Browse repositories…
    4. Type Eclipse code formatter to the search field
    5. Select the plugin from the list and click install on the right-hand pane
    6. Click Restart IntelliJ

    A tutorial on IntelliJ plugins can be found here.

    Plugin setup

    After installing the ECF plugin you need to set it to use the Eclipse code styles file of the ImageJ project:

    1. Download eclipse-preferences.epf
    2. Open Eclipse and follow these steps to import an .epf file
    3. Open Window > Preferences > Java > Code Style > Formatter
    4. Set Active Profile to ImageJ
    5. Click Export All… and save the XML file
    6. Open IntelliJ
    7. Open your project
    8. Open File > Settings > Eclipse Code Formatter
    9. Check the Use the Eclipse code formatter radio button
    10. Set Eclipse Java Formatter config file to the XML file you just created
    11. Set Java formatter profile to ImageJ
    12. Check Optimize Imports
    13. Set Import order to Manual configuration and write com;io;java;javax;net;org;

    NB You can skip the first five steps if you use this XML file. Note that it is old and possibly out of date.

    More information on setting up the plugin can be found here.