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:
- Open File > Settings
- Select Plugins from the left-hand pane
- Click Browse repositories…
- Type Eclipse code formatter to the search field
- Select the plugin from the list and click install on the right-hand pane
- Click Restart IntelliJ
A tutorial on IntelliJ plugins can be found here.
After installing the ECF plugin you need to set it to use the Eclipse code styles file of the ImageJ project:
- Download eclipse-preferences.epf
- Open Eclipse and follow these steps to import an
- Open Window > Preferences > Java > Code Style > Formatter
- Set Active Profile to ImageJ
- Click Export All… and save the XML file
- Open IntelliJ
- Open your project
- Open File > Settings > Eclipse Code Formatter
- Check the Use the Eclipse code formatter radio button
- Set Eclipse Java Formatter config file to the XML file you just created
- Set Java formatter profile to ImageJ
- Check Optimize Imports
- Set Import order to Manual configuration and write
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.