Easy ways to identify different branches when using Eclipse

When working on different branches in Eclipse, you’ll often find yourself wondering if you’re working in the right workspace for the right branch. This is especially an issue if you have multiple Eclipse instances open and you’re working on different branches of the same codebase, eg. dev, fix, release and feature branches.

There are a number of features in Eclipse that can help you distinguish which window belongs to which branch, including naming your workspace, naming perspectives and colouring your window.

Most features don’t show you the actual branch (ie. its name as it exists in the SCM) but they enable you to manually mark a workspace as belonging to a branch.

Continue reading

Share Eclipse perspective layouts across multiple workspaces

Once you’ve configured Eclipse preferences to your heart’s content, you’ll often want to share those preferences across multiple workspaces. Now normally you can go to File > Export > General > Preferences to save your preferences to a properties file which you can then import into the other workspace. This will share settings such as your customised keyboard shortcuts, formatting, repository settings, etc.

But, for some reason, Eclipse doesn’t save perspective/window layouts, such as which views are open and where they are placed in the perspective. So you’ll find yourself spending another half hour configuring the window to the way you like it. After the 3rd workspace you need to create, this becomes frustrating and just wastes time.

Fortunately there are ways to save and restore these settings automatically. The first is to save the perspective into the preferences (currently only works in Eclipse 3, to be fixed in Eclipse 4) and the other is to use Eclipse’s Copy Settings feature when opening the other workspace. I prefer the first option, but I’ll mention the second option and when to use the one over the other.

Continue reading

Split and view the same editor side by side in Eclipse

At some point you’ll want to view the same class or file side by side. You may want to follow related code in different parts of the class or need some code constantly available as reference to change some other part of the class.

Eclipse allows you to split an editor and move it to anywhere in the editor area in the same window, including next to the original editor. Changes made in the one editor are reflected in the other. The feature isn’t very obviously named, but it is easy to use.

Continue reading

Use Fast Views to maximise screen space

As a developer, the main area on my screen is the editor, the place where the code is. To work better and faster, I want this space to be as big as possible.

The default Java perspective in Eclipse comes with a number of views that surround the editors. This gives the editors less space, which means I need to do a lot more work to get my coding done, eg. more scrolling, paging, etc.

Eclipse helps out with a feature called Fast Views, a way to make views smaller so they take up less space. It’s the first thing I do to a new workspace (if I don’t have my workspace preferences handy) and I’d recommend it to anyone struggling with small monitors or stuck with just one monitor.

Continue reading