| Eclipse custom errors [message #514969] |
Wed, 17 February 2010 06:26  |
No real name Messages: 18 Registered: February 2010 |
Junior Member |
|
|
Hello all,
Im working on a plugin for eclipse, and i want to be able to make custom errors for, for example, annotations that are misplaced.
So basically i want to see the error in the problem view in eclipse, now ive been looking around on how to do that, and i have found out i need at least the IProblem interface for creating the errors. The thing i need is how do i check my code for wrong annotations so i can create the appropriate error? Ive been looking into the eclipse compiler but i cant seem to find out how it works.
Anybody have some proper information about how the eclipse compiler works and how i can use it to detect my own custom errors?
Thanks in advance,
Michiel
|
|
|
|
| Re: Eclipse custom errors [message #515023 is a reply to message #514995] |
Wed, 17 February 2010 09:08   |
No real name Messages: 18 Registered: February 2010 |
Junior Member |
|
|
uuh yeah im talking about java, i just need to know which classes i can use for checking code on the fly and how to add my own code checks to them. Like say if an annotation can only be placed on a getter and not on a setter, there should appear a warning or error message when this annotation is set to a setter.
Like code quality checkers do, just put error/warning messages in the problem view of eclipse, only i dont know if they use custom errors and warnings or the build in static ones in IProblem interface. I want to make custom ones.
[Edit] Uh one more thing, im looking into eclipse.jdt.core to try and find it out, but im not sure if im looking in the right spot
Greetz
[Updated on: Wed, 17 February 2010 09:12] Report message to a moderator
|
|
|
|
| Re: Eclipse custom errors [message #515050 is a reply to message #515031] |
Wed, 17 February 2010 10:08   |
No real name Messages: 18 Registered: February 2010 |
Junior Member |
|
|
Hi Dani,
thanks for the answer, ive looked into the CompilationParticipant but i still dont quite get the entire picture. I guess i need to use the reconcile function and put the problems to the ReconcileContext. The problems i can put in there are CategorizedProblems this implements the IProblem interface i talked on earlier. But, the IProblem should be generated by the compiler, how do i make those things custom? I read some about Markers, that might be of help, but i still dont get the whole picture 
Is it even possible to create my own problems using this thing or can i only change existing problems?
May be you can clarify some things for me?
Greetz and already thanks in advance!
[Updated on: Wed, 17 February 2010 10:09] Report message to a moderator
|
|
|
|
|
|
|
|
| Re: Eclipse custom errors [message #515217 is a reply to message #514969] |
Thu, 18 February 2010 03:46   |
No real name Messages: 18 Registered: February 2010 |
Junior Member |
|
|
Bump, still dont have the answer, lemme try and explain it once more 
What i want is to make my own custom problems, get them detected by the compiler and show them in the problems view. Now the custom errors can be anything like a misplaced annotation (I have some that throw runtime errors when misplaced, but code gets compiled).
I somehow need the compiler to check for these custom errors, thing is i dont know how to:
a: Create the general errors (Thats in setting the message and stuff, the icon).
b: How to analyze the code finding the errors and fill in things like line number, filename and stuff.
Does anybody have a simple example of how to do this?
I have done some research but i just cant tie the ends together, or im looking in the wrong spot. As you can read in my previous posts.
Ive checked some open source code analyzers but that didnt quite work, most of the code is hidden in jars.
Greetz
[Updated on: Thu, 18 February 2010 03:47] Report message to a moderator
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.11232 seconds