The principles of working with this API are straightforward. Begin by registering the task list in the layer file. Task lists are organized in groups, here I create a new one for mine:
<attr name="instanceCreate" methodvalue="org.netbeans.spi.tasklist.Task.createGroup"/>
<attr name="localizingBundle" stringvalue="org.yourorghere.mytasklist.Bundle"/>
<attr name="groupName" stringvalue="nb-tasklist-my"/>
<attr name="diplayNameKey" stringvalue="LBL_my_group"/>
<attr name="descriptionKey" stringvalue="HINT_my_group"/>
<attr name="iconKey" stringvalue="ICON_my"/>
<attr name="position" intvalue="50"/>
<attr name="instanceOf" stringvalue="org.netbeans.spi.tasklist.FileTaskScanner"/>
<attr name="instanceCreate" methodvalue="org.yourorghere.mytasklist.DemoTaskScanner.create"/>
Next, add a dependency on the Task List API and then extend FileTaskScanner. The list returned from FileTaskScanner.scan is what ends up in the Task List. (In this case I use an HTML parser to create the list.) You also need FileTaskScanner.create, which initializes the task list, as you can see from the layer entries above. Other methods include FileTaskScanner.attach, which is called when the Task List is opened, i.e., from the Window menu. By the time 6.0 is released, I plan on providing a full tutorial, which will cover the scenario shown above.
I imagine that this API could be pretty useful for NetBeans Platform applications. For example, there might be a special 'task' item that would be dragged onto the music sheet in the JFugue Music NotePad. Then, a new entry would be added in the Task List, so that you could go back afterwards, click on the line in the Task List, and then the related note would receive focus and the music sheet could scroll to that selected note. That's just one example where the (new!) ability to extend the Task List might be handy for NetBeans Platform developers. Again, one can see how a framework helps—there is no need to create a Task List yourself in your application. Just use the Task List API, at the end of which you provide a list of items to be added to the Task List, and then the NetBeans Platform takes care of everything else. I am now able to sort and organize the HREF attributes that are returned when I click the buttons on the left which, again, I did not need to create. One button lets me search within the current document, another for searching the main project, and the other for searching within all opened projects. The results are put into the Task List table, which I didn't need to create either, with the information magically organized into helpful columns.
Finally, here you see the group view in the Task List, to show you my new group in the context of one of the existing ones:
In other news. Rocket science is not brain surgeory!