This is an archive of the old MediaWiki-based ImageJ wiki. The current website can be found at imagej.net.

Eclipse code style profiles and IntelliJ

Development
Topics
Overview
Philosophy
Architecture
Source code
Project management
Coding style
Debugging
Tools
GitHub
Git
Maven
IDEs
Travis
AppVeyor
Dotfiles
Guides
Writing plugins
ImageJ Ops
Contributing to a plugin
Distributing your plugins
Development lifecycle
Building a POM
Developing with Eclipse
Hands-on debugging
Adding new ops
Adding new formats
Using native libraries
Tips for developers
Tips for C++ developers
ImageJ 1.x plugins
Versioning
Logging
Uber-JARs


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.