Home » Language IDEs » Java Development Tools (JDT) » Adding a new type of "problem" - newbie, very lost
| Adding a new type of "problem" - newbie, very lost [message #226232] |
Mon, 20 March 2006 21:20  |
Eclipse User |
|
|
|
Originally posted by: stuart.a.ballard.gmail.com
I'm brand new to eclipse plugin development and I'm afraid I'm lost.
What I'm trying to do is write a plugin which scans all the Java code in a
project for a particular pattern and reports it in the Tasks pane along
with other warnings and errors. Eventually I'd also like to add some Quick
Fixes, but I'd be happy with anything at all at this point. I've been
struggling through the documentation for several hours trying to figure
out how to do what I need and I think I understand a few pieces of the
puzzle, but not how to fit them together.
It seems that what I need to do is create a new type of "Marker" that
subclasses from the Problem type, and somehow I have to arrange for these
to get created. I've found sample code for declaring my problem type, I've
found code for how to traverse an AST which would be sufficient to do the
analysis I need to do to identify whether a particular method should be
marked as having this Problem. What I can't figure out is how to actually
hook up any code to do this analysis so that it will actually get called.
Since the JDT/compiler is already doing all the necessary steps to figure
out when a source file needs to be rescanned and the AST rebuilt, and when
it has to re-traverse the entire project on a rebuild, it seems like I
ought to be able to hook into something which would just tell me "ok,
here's a Java file that I've parsed and have an AST for, go do your
analysis". But I can't find any such extension point.
I created a project using the "Plugin project" template, which gave me a
minimal class to implement a plugin, but not really any hint as to where I
should start writing my own code. And even if I could find that, it seems
I'd need to know what Extension Point I want to hook onto, and I don't...
Sorry for what I'm sure is a very stupid question. The docs certainly seem
comprehensive - I seem to have read an awful lot - I just can't figure out
how it all fits together and applies to what I want to accomplish.
Thanks,
Stuart.
|
|
| | |
| Re: Adding a new type of "problem" - newbie, very lost [message #226293 is a reply to message #226286] |
Wed, 22 March 2006 01:10   |
Eclipse User |
|
|
|
Originally posted by: onlinenews.emanuelgreisen.dk
Yeah, I see it. It sounds like a good plugin you are developing. If its
any help I am working on a Mustang (java1.6) builder. This is working
now, and it compiles all JAVA-files and reports errors to the
"problems"-tab. You can make an incremental builder by creating a
plugin-project (PDE) and select the "Incremental Builder" template. This
will give you a simple builder that checks the syntax of XML-files, but
can easily be changed to only read JAVA-files. The good thing is it does
all the iteration, you just have to change it from scanning XML files to
scanning JAVA-files. And it shows how to add Markers to the problem tab.
How you should parse them (maybe you could use Eclipse to do this for
you) I don't know, except for either doing some hack-parsing or writing
a real lexer/parser pair.
../Emanuel
Stuart Ballard wrote:
> I'm afraid that's nowhere near sufficient for what I'm trying to
> achieve. In fact, if I had a single keyword sitting in a comment in each
> of the locations I'm looking for, I wouldn't need this plugin at all.
>
> Let me give some examples of the kinds of things my plugin needs to
> identify.
>
> Methods with a body that doesn't contain any statements.
> Methods where the first statement in the body is "throw".
> Methods where the first statement in the body is "return" and the value
> is a hardcoded constant, including null.
> Methods where the first statement in the body is "return" and the value
> is the result of calling the superclass implementaion of the same method
> with the same arguments.
> Methods that return void and the only statement in the body is a call to
> the superclass implementation of the same method with the same arguments.
>
> Then I need to be able to filter these results further based on the
> presence or absence of a particular exception in their throws clauses
> and the contents of comments in their bodies. And offer "quick fix"
> options that involve adding to the throws clause or adding comments in
> the body.
>
> See why I need a plugin now? ;)
>
> Thanks for the tip though,
> Stuart.
>
|
|
| | | | | |
| Re: Adding a new type of "problem" - newbie, very lost [message #226438 is a reply to message #226337] |
Thu, 23 March 2006 20:36   |
Eclipse User |
|
|
|
Originally posted by: stuart.a.ballard.gmail.com
Hmm... after a couple of days my "wow wow wow" has degenerated into "Grr,
how do I even install this thing?!?".
The tutorial specifically talks about version 4.2 and that's the latest
download on http://www.eclipse.org/tptp, but the documentation on that
same site only lists the dependencies for 4.1 which clearly aren't right
(as my installation lists almost everything tptp-related in the
configuration status window as being broken with missing dependencies -
and doesn't think to tell me what dependencies are actually *missing* as
opposed to being installed but having their own dependencies missing, so
unless I feel like spending a few hours with pen and paper writing down
each dependency and seeing if it's fulfilled or not, it's no help at all
tracking down what I need).
So since you seem to have the ear of the TPTP developers, can I make a
suggestion that it would be REALLY helpful to have a download that
includes all the dependencies in a single zip.
Failing that, having the homepage link to the documentation for the
*current* version would be nice too.
I'm getting close to just giving up and using CheckStyle which, while it's
not so close to what I want, I at least feel like I have a hope of getting
installed. And if someone as excited as I was is ready to give up
altogether, what chance do you have of turning someone who's just mildly
interested into a user?
Sorry to rant like this, it's just very frustrating to be on the brink of
something so cool, but unable to actually use it...
Thanks for your help anyway!
Stuart.
|
|
| |
| Re: Adding a new type of "problem" - newbie, very lost [message #226493 is a reply to message #226466] |
Fri, 24 March 2006 13:59   |
Eclipse User |
|
|
|
You're right about the dependencies being "hidden at the bottom of the
(very long) download page" ... and you're right about it being easy to
be led astray (I recently bugzilla-ed the "Installation Guide" pointing
back to the wrong download page's dependencies... that threw a lot of
people off for a while.)
I'll have to let Steve respond as to just what is working with prior
versions (the tutorial on the TPTP documentation page does say it was
"introduced in TPTP 4.1"), but yes, again you're right that the current
stuff is TPTP 4.2M5, which works with Eclipse 3.2M5a (with heavy
emphasis on the *a* part), and EMF/XSD 2.2M5. All these "M5"s are the
"Callisto train" ... the effort to have a one-stop location for all your
download needs.
Even if your needs require that you do your "real work" in some more
stable version of Eclipse, it's really not difficult to maintain more
than one Eclipse installation that is completely separate from the
others, and you could use it (1) to do your static analysis, and (2) to
pre-test the Callisto release to see if you're going to have problems
migrating to the new release.
I have about 6 different versions/environments set up on my system for
widely different needs.
--
RDS
Randy D. Smith randy (dot) d (dot) smith (at) intel (dot) com
Eclipse TPTP Committer, Platform Proj (data collection/agent controller)
Stuart Ballard wrote:
> Ah, I think I figured it out. The dependencies are hidden at the bottom
> of the (very long) download page - and one of the dependencies is an
> Eclipse SDK version that's newer than the current stable release, is
> that right?
>
> Any idea whether that tutorial might still apply on a version of TPTP
> that works with the released Eclipse version, and if so, what version of
> TPTP that would be? 4.1?
>
|
|
|
| Re: Adding a new type of "problem" - newbie, very lost [message #226603 is a reply to message #226493] |
Mon, 27 March 2006 15:42   |
Eclipse User |
|
|
|
You only have 6 Eclipse builds, Randy? Lucky you :-)
Stuart, for the static analysis portion of TPTP the requirements are
minimal. In fact all you really need is the TPTP 4.2 Platform piece. You
don't have to worry about RAC, or EMF or anything else listed as a TPTP
requirements. I don't recommend this, but you can extract just the
org.eclipse.tptp.platform.analysis.* plugins from the platform download and
drop those into your plugins directory.
As far as version support, you need Eclipse 3.2M4 or better, and get current
development build of the TPTP 4.2 platform plugin. Note you can get older
TPTP 4.2 builds (like the last stable one) but you will find the newer code
has several bug fixes you're going to want and by tomorrow or the day after
there will be some more fixes.
Steve
"Randy D. Smith" <randy.d.smith@intel.com> wrote in message
news:e01fhm$243$1@utils.eclipse.org...
> You're right about the dependencies being "hidden at the bottom of the
> (very long) download page" ... and you're right about it being easy to
> be led astray (I recently bugzilla-ed the "Installation Guide" pointing
> back to the wrong download page's dependencies... that threw a lot of
> people off for a while.)
>
> I'll have to let Steve respond as to just what is working with prior
> versions (the tutorial on the TPTP documentation page does say it was
> "introduced in TPTP 4.1"), but yes, again you're right that the current
> stuff is TPTP 4.2M5, which works with Eclipse 3.2M5a (with heavy
> emphasis on the *a* part), and EMF/XSD 2.2M5. All these "M5"s are the
> "Callisto train" ... the effort to have a one-stop location for all your
> download needs.
>
> Even if your needs require that you do your "real work" in some more
> stable version of Eclipse, it's really not difficult to maintain more
> than one Eclipse installation that is completely separate from the
> others, and you could use it (1) to do your static analysis, and (2) to
> pre-test the Callisto release to see if you're going to have problems
> migrating to the new release.
>
> I have about 6 different versions/environments set up on my system for
> widely different needs.
> --
> RDS
>
> Randy D. Smith randy (dot) d (dot) smith (at) intel (dot) com
> Eclipse TPTP Committer, Platform Proj (data collection/agent controller)
>
>
> Stuart Ballard wrote:
> > Ah, I think I figured it out. The dependencies are hidden at the bottom
> > of the (very long) download page - and one of the dependencies is an
> > Eclipse SDK version that's newer than the current stable release, is
> > that right?
> >
> > Any idea whether that tutorial might still apply on a version of TPTP
> > that works with the released Eclipse version, and if so, what version of
> > TPTP that would be? 4.1?
> >
|
|
|
| Re: Adding a new type of "problem" - newbie, very lost [message #226682 is a reply to message #226603] |
Tue, 28 March 2006 10:14  |
Eclipse User |
|
|
|
Originally posted by: stuart.a.ballard.gmail.com
Thanks, I got it working with Eclipse 3.2m5 and TPTP 4.2m5. I haven't
encountered any problems yet that would push me towards the latest
development builds. I have a couple of questions about the best way to
write my rules, but I'll post those in the TPTP newsgroup :)
Thanks again!
Stuart.
|
|
|
Goto Forum:
Current Time: Fri Nov 07 00:34:09 EST 2025
Powered by FUDForum. Page generated in 0.07142 seconds
|