By: Eric P. Wittmann - paalin
PyDev Extension Points/Quick Fix
2005-10-22 14:17
I am trying to add some custom Eclipse functionality that will complement
PyDev. To this end I have created my own Eclipse Builder that creates
problem markers for certain things I am interested in in my code. Now, the
next step is to contribute marker resolutions for my markers. I have done
this, and they work when I right click from the Problems View.
Here's my problem: the PyDev editor does not have a Quick Fix feature,
sure I can't do the standard Ctrl-1 to bring up my list of resolutions. In
fact, it seems that Ctrl-1 is being used for Content Assists.
Now I see two approaches that I can take here but am looking for advice.
First, I could try to find some other way to contribute Quick Fix to the
PyDev editor. Second, I could hook into PyDev's pydev_ctrl_1
extension-point in order to be a participant.
Thoughts on the right way to do this?
-------------------------------------------------------------------------
By: Fabio Zadrozny - fabiozProject AdminAccepting Donations
RE: PyDev Extension Points/Quick Fix
2005-10-22 16:34
Hi Eric,
You definetely want to hook to the pydev_ctrl_1 extension (that's what is
was meant for).
Also, I'm curious about what custom things are you adding to pydev...
Cheers,
Fabio
-------------------------------------------------------------------------
By: Eric P. Wittmann - paalin
RE: PyDev Extension Points/Quick Fix
2005-10-22 18:03
Thanks Fabio. I figured that was the right way to go, just checking. I
actually started writing the post because I saw that the extension point
was there but that the schema for it was not. Then I realized that I could
probably check out the source code from CVS and get the schema that way,
but I was already about done with the post... Heh. I haven't tried
contributing to extension points provided by 3rd party plugins before, so
we'll see how it goes. :)
Well, I'm starting to really look at localizing our application and the
first step is externalizing the strings. I am basically adding custom
Eclipse extensions to approximate the Eclipse Java string externalization
support ($NON_NLS-n$ etc...). So I have a simple Builder to parse the .py
files looking for non-externalized (and non-unicode) string literals. I
add problem markers for strings I find and quick-fix resolvers for them.
-------------------------------------------------------------------------
By: Fabio Zadrozny - fabiozProject AdminAccepting Donations
RE: PyDev Extension Points/Quick Fix
2005-10-24 10:38
You could use the pydev_builder extension instead of the raw eclipse
bulder, its good points are:
if you want an AST you can get it without any cost
it only gathers files that are valid python files
it gives you the document (also without any cost, as it has to do it anyway).
the only bad point is that it may change (altough not much) its interface,
as I'm still not sure if its implementation will evolve or not, whereas
eclipse *should* give you more backwards support (I only intend to do it
after pydev reaches 1.0 -- which should not be too long from now).
Cheers,
Fabio
-------------------------------------------------------------------------
By: Eric P. Wittmann - paalin
RE: PyDev Extension Points/Quick Fix
2005-10-28 21:35
Ok so I'm looking at using the org.python.pydev.pydev_builder extension
point to hook into the pydev builder. This looks really nice from what I
can see. What I couldn't figure out quickly was the "if you want an AST
you can get it without any cost". What I want to be able to do is visit
some sort of generic Python AST and look for all String literals. Is this
possible and I just don't see it?
I'll move on to the Ctrl-1 extension point after this... :)
-------------------------------------------------------------------------
By: Fabio Zadrozny - fabiozProject AdminAccepting Donations
RE: PyDev Extension Points/Quick Fix
2005-10-31 10:16
Hi Eric,
What I meant by 'the AST is free' is that I generate it and store it in a
HashMap that is shared among all the visitors in the pydev builder.
You can take a look at org.python.pydev.builder.PyDevBuilderVisitor (your
class will have to be a subclass of it to integrate it in the builder).
After that, you can use getSourceModule() to get a AbstractModule (and
cast it to SourceModule -- with the generated AST).
After, to get all the Strings, You can use the EasyASTIteratorVisitor to
get the String literals.
Well, I think that this discussion should go to the pydev-code list (check
it in the homepage and subscribe). In this way, other developers might
also benefit from this discussion -- if you could post this thread there
after you subscribe it would be nice too.
Cheers,
Fabio
-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
Pydev-code mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pydev-code