Using Bookmarks in Eclipse

When we are writing programs it is important to keep track of important locations in the code. Using Bookmarks are the easiest way to do it. But in Eclipse that feature is some what hidden. By default there is no shortcut for that as well.

To add a Bookmark chose the code fragment you want to bookmark and from Edit menu select Add Bookmark. Once the bookmark is added there will be a small blue rectangle in the left hand side of the code window and a green rectangle in right had side of the code window. To view all the bookmarks that you added you have to bring in the Bookmarks view. Select Window > Show View > Other… from the main menu. Type "bookmark" in the filter box of the Show View Dialog box and select Bookmarks view.

Eclipse Show Views

 Eclipse Bookmarks Vie

To make the process of adding bookmarks easy you can create a shortcut key combination for it. To do that choose Window > Preferences from the main menu, which brings up the Preferences dialog. Then type in “key” in the filter box, which takes you to General>Keys. Then selects the Modify tab. Select “Edit” from the Category drop-down. Then choose “Add Bookmark” from the Name drop-down. Then click in the Key Sequence > Name text box. Then hold down the keys you want to use for your keyboard shortcut. I selected Alt+B for this. You can selects any unassigned key combination for this. Finally click Add.

Now you can use this shortcut to add bookmarks very easily. Cool isn't it?..............

 

Reader Comments

Is there any way of storing the bookmark as meta-information with the project. This way it can be shared amongst a team.

I am using eclipse for at least 4 years and I finally search on how to use bookmark. Google send me to your article. Your short article is well written.

An Phong Do
www.solabs.com

Thanks for the article, it really helped me alot ;)

thanks for the article, it really helped me alot;)

Can you add shortcuts to specific bookmarks? for example ctrl+1 etc...

Thanks for the to the point article. Reading this is saving me a lot of time :)

Thanks for this article!
My question is if the piece of code I bookmarked gets deleted by a fellow developer later on, what happens to my bookmark, it's gone also, or I can still find it but it's not linked to any code?

This was helpful..! Was using the hard way before, and i never knew that we can change the keys for the shortcut in eclipse..

This is really helpful!Thank you.

Thank you for the life saving article!