There are times while coding when I know I have to do something, but it will take some time, so I decide to leave it for later. To remember the tasks I left, I'm using Eclipse Tasks, by writing a comment in the source, starting with "TODO". Before committing anything to a source repository, I always check that I don't have any unfinished tasks.
The Tasks view can be displayed via Window->Show View->Tasks. It shows a list of tasks. The default settings shows various type of tasks, including those with the word "TODO" or "FIXME" in it. In our project, there are a lot of unwanted TODOs left in the source. They all show up in the Tasks view.
Using a TODO is inconvenient, because I can't easily tell which are mine. The solution is to use a filter. Instead of writing a comment with "TODO ...", I use a comment with "TODO CHRIS...". By setting a filter in the Tasks view, I can show only tasks containing "TODO CHRIS".
In Eclipse Helios Tasks view, click the View Menu (the icon shaped as an arrow pointing downwards). Select Configure Contents. Then press New... to make a new configuration. I set the scope to "On any element". I leave all the Completed, Priority and Types check boxes selected. Set the description to "contains" and "TODO CHRIS". This will include my comments. Finally, I check my configuration, set the "show results matching" to "Any enabled filter" and press OK. Voila ! All unwanted default tasks disappear, and only my own tasks are shown.
By the way, default Task Tags in Java comments can be configured in the Preferences, in Java->Compiler->Task Tags. Default tags include "FIXME", "TODO" and "XXX".
Nice, thanks for that.
ReplyDeleteReally nice, thank you. Very good tip about named TODO
ReplyDeleteThanks both of you
ReplyDeleteThanks for the tasks kuriqoo. Very helpful and rare. As a new developer I always wanted to use tasks but never got a good tutorial about it. Do check out my blog too.
ReplyDeleteHey I just found out that you have to rebuild your project before any new custom filters work.
ReplyDeleteI appreciate you posting this.
ReplyDelete