The first thing you need to decide is: should you use the API or the SPI?
The API is intended for client modules which are already doing some useful computation, like for example the Audit module. It will analyze the user's source code and inform the user of problems. It may also as a side effect add Suggestions into the Suggestions Window for some of the problems it encounters. This is a typical API usage of the TaskList APIs.
The SPI is intended for client modules who want to provide suggestions to the Suggestions window, and these suggestions are unrelated to other tasks performed by the module. The SPI classes provide convenience classes for this, where common scenarios (like providing suggestions for the current document in the editor or the currently selected node in the IDE) are tracked automatically, and even the provider class itself is only created when the Suggestions Window itself is made visible.
There are three critical classes you should be aware of:
In addition to the above classes, there is also the concept of a SuggestionType. It does not have a corresponding class; SuggestionTypes are simply registered via the layer file. Each Suggestion is considered to have an associated SuggestionType. For example, the three suggestions
To use the TaskList APIs, you should add a dependency on the tasklist-api module in your manifest.mf file:
OpenIDE-Module-Module-Dependencies: org.netbeans.api.tasklist/1 > 1.0If you want your module to -require- that the Suggestions window module is available, you can also add this:
OpenIDE-Module-Requires: org.netbeans.api.tasklist.SuggestionManager
Proceed to either the API or SPI packages to get more information on how to add Suggestions to the Suggestions Window.