Monday, February 11, 2008

Filter Your 'Tasks View' in Eclipse Using Patterns in TODO

The Feature: Eclipse's Tasks is one of my favorite features in the IDE. You can set reminders right there in your source code and you can see all of them in the Tasks View of the IDE which you can dock it anywhere you want. A sample screenshot of the Tasks View can be seen below.





The Problem: As you can see from the sample screenshot that many people added their own TODOs and FIXMEs. Imagine this for a big project, this will be in hundreds. The point of adding TODOs and FIXMEs right in the source code is that it can be seen more often such that we will be constantly reminded about the unfinished. But when everybody adds, it becomes a problem to keep track of your own Tasks and we may start ignoring them like spam mail. Having control is the key to using this feature, just like e-mail.



The Solution: Fortunately there's a very simple solution to this problem with a little effort. You can create and configure filters, just like you can create filters for your e-mails in Gmail. On the Tasks View you will see the button using which you can create filters. See below:



The rest of the filter configuration work is simple. The Filters dialog pops up and it's very intuitive as what all you can do with it. I typically create filter that contains the string "(srikanths): " in its description. And when I write my TODOs and FIXMEs, I make sure I prefix them with that description. You can come up with your own standard within your team and follow that.



The tasks that I write in the code typically look like this:



// TODO(srikanths): Srikanth should come back to complete this.
// FIXME(srikanths): Srikanth should fix this ASAP or he is dead.






Happy coding!

Srikanth

8 comments:

Ben Margolin said...

Hmm, either this is missing from Ganymede, or the Mylyn plugin overrides it. This would be really nice, if I could figure out how to enable it in my Eclipse!

Ben Margolin said...

Oh, it does work, it's in view menu -> configure contents, and you need to ensure you change it to "on any element" if you want to match your name as you have indicated. Thanks for the screenshots, I probably wouldn't have figured out the correct setting for the radios without them!

Srikanth said...

Ben,

Glad you figured out!

I haven't touched Eclipse in a long time now, when I come back and don't find it, I'll ask you :P

Rob said...

Thanks Srikanth - I've been looking for this for ages. Ganymede has done a really good job of hiding the menu!

alynna said...

For anyone who was confused like me - the view menu is the little triangle near where the filter button should be in Ganymede.

Anonymous said...

I tried doing this and mostly it works. But for some reason there are a couple todos that aren't being found. They show up in the regular todo list but they don't show any of the text after "@todo".

I put "@todo(name) blah blah" but all that shows up in the tasks window is "@todo".

Stijn said...

"For anyone who was confused like me - the view menu is the little triangle near where the filter button should be in Ganymede."

Thanks, that was the missing piece of the puzzle for me! Found it now! :)

Anonymous said...

Does anyone know how to do these in a custom task view with filters (programmatically)

Post a Comment