On 10/15/06, Marco Bizzarri <marco.bizzarri@gmail.com> wrote:
Hi all.

pydev provides python scripting inside pydev. Is this scripting
available outside pydev?

I mean: if I develop a new plugin for Eclipse, is it possible to use
the python scripting abilities inside my plugin?


Hi Marco,

Yes, you should be able to use them without too much problem.

To use it, you'd have to do something like:

File[] dir = new File[]{scriptLocation}
IPythonInterpreter interpreter = JythonPlugin.newPythonInterpreter();
JythonPlugin.execAll(locals, "foo", interpreter, dir); //execute all the files that start with 'foo' that are located beneath the selected dir

You'd pass whatever you like as the locals (and use those variables in the script). In pydev I pass as locals the PyEditor and the command requested (such as initializing the editor, saving a file, closing, etc), so, when the editor is initalized, actions can be registered, etc.

Cheers,

Fabio