Deal with workspaces and shortcuts in Eclipse

September 12th, 2009 by ThierryWasyl Leave a reply »

Hello everyone,

Have You ever tried to define Your own shortcuts in Eclipse? Have You ever tried to share them between different workspaces? Yes ? Maybe You have noticed something “strange”… Lets take a look at this.

Eclipse is a very nice IDE which can be customized to fit your needs. For example, I like to define my own shortcut for generate getters and setters. Eclipse doesn’t provide a shortcut by default. But You can do it Yourself.
Go in the preferences pane and then type “keys” in the “type filter text” textbox and You should come here :
shortcuts

Well then You can see I typed “getter” in the “type filter text” in the center of the frame. Then I selected Generate Getters and Setters in order to define my own shotcut, which is done in the Binding text field. Just hit Apply or OK.

But now, try (or not if You don’t want to) to switch to another workspace and then go in the same window to see Your shortcut. You’ll notice that Your shortcut isn’t set anymore ! So that’s sad. Eclipse doesn’t share Your preferences between workspaces. Why ? I don’t know. So You may have to find a solution for this.

I found one. In the workspace You have defined all Your preferences, go to File > Export. Then, search for Preferences.
eclipsePreferences

Hit Next, choose the preferences to save (Keys preferences for the shortcuts), give the file where to save them and hit Finish.
In all other workspaces, just Import the preferences.
I don’t find that very easy. Imagine You change in one workspace a shortcut, You have to export and import in all others… Could be long.
But it’s a solution.

That’s it.
Enjoy and take care.

Advertisement

Leave a Reply