Blog Archives

Code Formatter Eclipse

Today I had the problem, that I had installed a new Eclipse on my workstation, but I forgot the code style configuration at home. I tried to connect per SSH, but I have no X server on the machine at home. So I cannot run Eclipse to export the configuration as XML. But there is a simple solution for that, copy the information from the right configuration file.

You can find the formatter profiles in the file

/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.ui.prefs

There is a very long line starting with org.eclipse.jdt.ui.formatterprofiles, which you can copy to your local installation. Close your Eclipse and restart it after the change and you will find the new formatter in the drop-down-list within the preferences.

The better way would be to export the formatter definitions as XML within Eclipse and check-in the file into your Subversion/Git.