Tweaking Eclipse

I use Eclipse almost every day at work for Java development. It isn't the best piece of software out there but it mostly works, has a plethora of features and you can't beat the price!

I do have to make several changes to the default settings to make Eclipse work according to my tastes. However, these changes are linked to a workspace and thus, every time that I create a new workspace, I have to remember the tweaks and re-do them.

So here's my attempt at listing them all out so I have a quick reference the next time I need to setup Eclipse.

Installation

Head to eclipse.org/downloads/ and get the relevant Eclipse bundle. The Eclipse IDE for Java Developers is what would generally suit me as a core Java developer. However, I find this bundle to contain unnecessary features (integrated CVS client, really?!) and prefer building up from a base installation starting with just the Eclipse Platform Runtime Binary. Unfortunately, the Eclipse folks keep re-organizing their site and each time, I've to hunt for the download location for the platform binary package. A bit of web searching should help here.

Once you've installed just the base Eclipse platform runtime, you can add the relevant plugins from within Eclipse. Go to Help > Install New Software or Help > Eclipse Marketplace and search for the required features.

My current list of plugins:

  • Eclipse Java Development Tools
  • Eclipse Color Theme
  • ExploreFS
  • Perforce SCM Support
  • Vrapper (Vim Emulator)

Startup

Eclipse is a memory hog. It is unlikely that the default memory settings will give you a decent experience so it is best to change them. Edit the eclipse.ini file (lives next to eclipse.exe) as follows:

-startup
plugins/org.eclipse.equinox.launcher_1.1.1.R36x_v20101122_1400.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.2.R36x_v20101222
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
--launcher.defaultAction
openFile
-vmargs
-Xms40m
-Xmx512m

The first few lines should already be present in the file. Add the memory related args with values suited to your development machine.

Configuration

Finally, time to tweak some preferences. These need to be set for each new workspace that you create.

Open the Window > Preferences dialog and change the following:

  • General > Appearance:
    Uncheck Enable animations
  • General > Editors > Text Editors:
    Set Display tab width to 4; Check Insert spaces for tabs
  • General > Editors > Text Editors > Spelling:
    Uncheck Enable spell checking
  • General > Startup and Shutdown:
    Uncheck Mylyn Tasks UI
  • General > Workspace:
    Set Text file encoding to UTF-8; Set New text file line delimiter to Unix
  • General > Compare/Patch > General:
    Uncheck Open structure compare automatically; Check Ignore white space
  • General > Compare/Patch > Text Compare:
    Uncheck Connect ranges with single line
  • Java > Code Style > Formatter:
    Download Android's code style profile and Import it here
  • Java > Editor > Content Assist > Advanced:
    Check only the following proposals in both sections: Java Non-Type Proposals, Java Proposals, Java Type Proposals and Template Proposals
  • Java > Editor > Content Assist > Favorites:
    Add New Type org.junit.Assert
  • Java > Installed JREs:
    Add a new JDK by pointing to the install directory; Add -server to the Default VM Arguments; Use Add External JARs to add tools.jar to the default libraries.
  • Team > Perforce:
    Check Use "move" command during refactoring operations

Ideally, you should be able to File > Export > General > Preferences from one workspace and then File > Import > General > Preferences into a new workspace. But it takes only a couple of minutes to make the above config changes and I don't have to worry that Eclipse screwed up something else under the covers. :-)


Markdown formatting supported