Thursday, January 29th, 2009

Task tags in Eclipse

I hope that you must be aware of the Tasks view in Eclipse. If not, Tasks view is nothing but a small TODO list manager inside the eclipse IDE itself. In the Tasks view window, you can add a new TODO task and you can also set the priority (high, normal, low) for that task.

Eclipse also has a feature wherein you can directly add a new task to the Tasks view without even coming to the Tasks view window. You can do this by using the Task tags. I.e. in your Java code file, you can add these Task tags with some description and Eclipse will automatically detect these task tags and the it will add a new task to the Tasks view. For example:


....
/* TODO Change system.out.print to logger.debug */
System.out.println("This is a secret message!");
....

Above code will make the Eclipse to add a new task with the description “Change system.out.print to logger.debug” and for TODO tasks, default priority will be Normal. Along with the description, the line number and the file name are also noted. So, when you double click this task on the Tasks view, it will directly take you to the above.

If you want, you can also add your own Task tags (like REMEMBER, BUG, etc) to Eclipse. To do this, open Window->Preferences and search for ‘Task tags’. There you can add new task tags and set their priorities too.

{ 6 comments… read them below or add one }

Eclipse user June 6, 2009 at 1:30 pm

Great tip, thanks! I didn’t know you could set low priority tasks with a custom task tag too, that’s really useful!

Reply

Veera June 6, 2009 at 1:36 pm

Yes. It’s possible in Eclipse.

Welcome to my blog!

Reply

Jeff December 7, 2010 at 7:17 pm

> Eclipse will automatically detect these task tags and the it will add a new task to the Tasks view

This doesn’t work for me. I have many TODO tags in my code, but my Tasks view is empty.

I am using Helios Service Release 1.

Do you have any idea how I can make this work?

Thanks!

Reply

Veera December 8, 2010 at 9:54 am

Hi Jeff,

Ideally the Task View window should be updated with the task tags. My suggestions on why it may not be working for you.

1. By default the task tags are *case sensitive*. So, if you have ‘todo’ instead of ‘TODO’, it won’t show up on the task view. So, try with both formats and see if its working (you can change this behavior by going to Windows -> Preferences -> Java -> Compiler -> Task Tags and un- checking the option Case sensitive task tag names.
2. Try closing and re-opening the task view panel (which might re-build the task tags index).
3. Also when you add a new task tag (from the Task tag dialog in preferences) the task tags index will be re-built. So try adding a new dummy task tag (which u can remove later) and see if the task tags are updated.

Hope this helps.

Reply

Dave February 16, 2011 at 9:59 pm

Hi,

My company has set up mylyn with a bugzilla repository for task tracking. I set up task queries and I can create and modify tasks etc.

However, I cannot see any //TODO tasks listed in my task list.

Anybody got any ideas how I might see all my local TODOs?

TIA.

Reply

Veera February 17, 2011 at 4:03 pm

Hi Dave,

The TODO tasks won’t appear in your MyLyn task list. You have to manually add the MyLyn tasks.

But, TODO task will be automatically shown in Eclipse built-in “Tasks” view. To see this, go to “Window -> Show view -> Others -> General -> Tasks”

Reply

Leave a Comment

{ 1 trackback }

Previous post:

Next post: