I am looking for a simple way to report problems related to language elements to the user. I've read about LocalInspectionTool and am familiar with the ProblemDescriptor interface. However, for my purposes I require an API that would allow, given a PsiElement and a message, to report a problem directly, outside of the inspection context.
My plugin performs annotation processing of Java files. Annotation processors can report messages at various levels (error, warning, info) on program elements (e.g., on class fields). Therefore, I want to enhance my plugin to display the messages reported on program elements. You can see that I don't require a whole inspector, but rather an ability to report problems produced by an external tool (an annotation processor).
I've also come across the Annotator facility, but couldn't quite understand how it is used.
To sum up, I want to report messages on language elements and display them in the editor while controlling the following:
- The timing - report messages at any moment.
- The target - provide a PsiElement that needs to be highlighted and on which the message should appear.
- Removal of the reported message and highlighting.