ProjectBuilder: ASTParser does not resolve Bindings [message #1751381] |
Mon, 09 January 2017 15:28 |
Ralf S. Messages: 5 Registered: June 2015 |
Junior Member |
|
|
Hello,
I've created a plug-in that adds two builders to a Java project:
- Generator: This builder generate Java source code based on input from a XML-file. Mainly String constants with annotations.
- Validator: This builder parses Java files using the ASTParser and validates the usage of the generated constants based on the info in the annotations.
The Generator is run before the Java Builder and the Validator after it.
So a full build looks like this:
- Generator regenerates the Java source based on XML-input - Success
- Java-Builder recompiles source code (including newly generated java files) - Success
- Validator parses Java Source-Code - Error
The Problem with the Validator is, that it cannot resolve the bindings to the String constants in the newly generated source code ( from build step 1).
In despair I added a 2 seconds sleep to the Validator, before it starts to build the ASTs. Now it works as expected.
So the Validator has to wait for something, but I'm not sure what.
I then used the JobManager to check for background jobs running when the Validator is started. The most promising was "Updating workspace". When I do a Job.join() on that job (and deleting the 2 sec sleep) it also works. The join take between 800 to 1400 ms.
I have two problems with this solution:
- Im not sure this is the correct solution.
- I'm not happy with selecting the Job "Updating workspace" by name, as i couldn't identify which JobFamily it belongs to.
Any hints or ideas? Every help is appreciated!
Thanks,
Ralf
|
|
|
Powered by
FUDForum. Page generated in 0.03742 seconds