Best way to add warnings [message #718392] |
Wed, 24 August 2011 08:06 |
Eclipse User |
|
|
|
I'm currently trying to to add a custom warning to the Java Editor. Specifically I introduced a Javadoc tag which should be a hint that method is expected to be overridden and if a tagged method is final an appropriate warning should be generated. I'm developing on Eclipse Helios and Indigo.
Obviously there are 2 ways to implement that in general:
1. Contribute a builder
The problem here is, that my builder is never called unless I link it to a custom project nature and add that nature to the Java project. But that is not what I want to do. I'm interested in the Java project nature as the JDT Builder is.
2. Contribute a compilation participant
This seems to work well in the first place. I have implemented the reconcile() method and performed my checks on the CU working copy provided by the given context.
Generating the problem markers can obviously also be done in two ways:
2.1. Creating instances of CategorizedProblem and adding them using ReconcileContext.putProblems()
The problem here is that the problems are not being added to the problems view. Further I could not manage that the quick fixes for this warning appear by just hovering with mouse over the marked source code (for the IMarker approach below this works).
2.2. Creating actual IMarker instances using createMarker() on the resource of the given working copy
This causes me to remove all these markers manually before performing my checks which seems to be a little ugly. Further I observed a very strange behavior when more than one of the Javadoc tag warnings are generated. reconcile() is called again and again (likely because I have just added the markers) and so the warnings start to "blink".
So I guess I missed something very basical. Does anyone have any hints what is the best way to perform this task?
Thanks in advance
[Updated on: Wed, 24 August 2011 08:06] by Moderator Report message to a moderator
|
|
|
Powered by
FUDForum. Page generated in 0.02882 seconds