Skip to content

Using ‘tasks’ in Eclipse

Update, 11/13/2009:  If you are looking for help with tasks using Mylyn (integrated into later versions of eclipse), you don’t want this post.  Instead, you’ll want to read and watch the resources here.  This post is all about simple text based code markers, not Mylyn’s implementation.

In Eclipse (version 3.2–one revision behind the current latest), I use a feature called ‘Tasks’. Using this feature, I can, anywhere in a file managed by Eclipse, put in a tag like ‘XXX’ and write a note to myself. It’s very handy because when I’m developing, I’ll often think of a problem or situation that I’d like my code to handle, but not have time to deal with it just then. I could add it to a bug tracker, or an excel spreadsheet, or write it down, but I find adding it to the source code works just as well. Then, I can use the ‘Tasks’ view in Eclipse to gather all of these notes at a later time, and deal with them one by one. I add it using this type of comment (for java–if I add the task in an XML file, I use XML comments):

//XXX need to revisit this class.

The way you include the tasks view in the java perspective is: go to the java perspective, then choose ‘Window’ from the menubar, then ‘Show View’ then ‘Tasks’. According to the help, Tasks are usually only shown in the ‘Resources’ perspective.

My one gripe with tasks is that it seems to be easy to create them, but darn hard to delete them. You can add new task tags via this path: ‘Window’ / ‘Preferences’ / ‘Web and XML’ / ‘Task Tags’, and use the ‘clean and redetect task tags’ button. This does appear to pick up new tasks (or tasks marked with tags that you’ve added), but doesn’t seem to remove tasks that are no longer marked in the source code (whether they are no longer marked because you removed them from the source code, or because you removed that task [TODO] tag from the list of task tag).

If you add a task via the mouse, you can remove it by right clicking on the checkbox. However, that doesn’t remove the task comment from the source file. Also, if you add a task via a comment, you cannot mark it done in the ‘Task’ view.

What I’d like is some synchronicity between the source file and the view. If I add a task in the source file, it should show up in the ‘Task’ view. If I then delete that line from the source file, I’d like the view to reflect that. If I mark it as completed in the view, then choose ‘Delete Completed tasks’ from the context menu, the line in the source file should be removed as well.

Am I missing something here? Am I using tasks incorrectly?

I looked through the Eclipse help, on google, and in the Eclipse newsgroups but did not find anything that helped. No mention of this issue in the release notes for version 3.3. Browsing around the buglist didn’t turn up anything that applied to what I want to do (via a quick scan).

I’ll probably file a bug sometime soon, but should really review all the entered bugs to see if someone else has my issue. In the meantime, I’ll just bleat a bit here.

[tags]eclipse,tasks view[/tags]

13 thoughts on “Using ‘tasks’ in Eclipse

  1. fimh says:

    yeah, i’ve got the same problem as you.

  2. Bastian says:

    Hi Dan,
    I’ve got the same problem in 3.4, did you find a solution?

  3. moore says:

    Hi Bastian,

    I have found no solution.

  4. Valentin Gjorgjioski says:

    Add comment

    //TODO do this later

    Save the file.
    It appears in task view.

    Remove the comment, save the file, it dissapears.

    Remember:
    Build project automatically must be enabled.
    Check filtering on tasks.
    Check Window->Preferences->Java->Compiler->Task Tags for which tags are used for tasks.

    That’s all.

  5. Reem says:

    I’m curious, are there any updates on this?

    Thanks.

  6. Jacob Singh says:

    I have another related problem:

    I want to filter my todos by directory or file. The task list shows me all @todo in all open projects, not useful. Especially when working on a framework with dozens of modules each with heaps of todos. I’ve got 1200 right now, which means I’ll never look at them 🙁

  7. Carl D says:

    To filter out the TODOs in frameworks or other code you don’t control, you can go to the Tasks list window, choose the “View Menu” control (next to the minimize and maximize buttons) and choose “Configure Contents” Here you can choose to display only TODOs in the same project or only under the current selected element or whatever. (This is in eclipse 3.5.1. Don’t know about other versions)

  8. Jules says:

    Valentin, thanks a lot for your comment!
    It appears the reason for my TODO tasks not appearing automatically on the Tasks view was in fact due to the Project/Build Automatically option not being enabled. Thanks!

  9. Ann says:

    Thanks for information!

  10. Ray Ray says:

    Thanks for the help.

    Here is how i did it:
    In the tasks window:
    1. click the down arrow
    2. Select ‘Configure Contents’
    3. Add your tag to the ‘Configurations’ list via ‘New…’ button.
    4. Click on the desired tag
    5. Select the ‘On any element in same project’ radio button.
    6. Click OK when done.

  11. moore says:

    Hi Ray,

    What version of eclipse are you running?

    Thanks!

    Dan

  12. Angela Watershoo says:

    I created some associated tasks in the editor and they don’t show in the task view. I’m looking at the solutions present so far but I need a bit more explanation, as there just isn’t enough description to go off.

    For example, I find the task tags preferences, ok. Then do what with it?

    Turn on build? How?

Comments are closed.