Packages and Calling Plugins from within Plugins

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Packages and Calling Plugins from within Plugins

austincb
Is it possible to make a set of plugins part of a package? Or do I need
to modify the source code and recompile the entire program to do that?

I'm trying to call a set of plugins (in a certain order), and wish to
share data from one to the next. I've started just using temporary
output text files, but is there a better way to do this?

Thanks,

-Austin
Reply | Threaded
Open this post in threaded view
|

Re: Packages and Calling Plugins from within Plugins

dscho
Hi,

On Mon, 18 Dec 2006, austincb wrote:

> Is it possible to make a set of plugins part of a package? Or do I need to
> modify the source code and recompile the entire program to do that?

If you are talking about packaging plugins, see

        http://rsb.info.nih.gov/ij/plugins/jar-demo.html

> I'm trying to call a set of plugins (in a certain order), and wish to share
> data from one to the next. I've started just using temporary output text
> files, but is there a better way to do this?

Ah! That is different. You can do that with static member variables,
although that is rather messy (even if it is cleaner than temporary
files).

The best way would be to combine the plugins in a "super-plugin", which
not only calls the plugins one by one, but also has access to their
(non-static) member variables holding the results.

Hth,
Dscho
Reply | Threaded
Open this post in threaded view
|

Re: Packages and Calling Plugins from within Plugins

Albert Cardona
In reply to this post by austincb
Hi Austin,

Yes it is possible to call plugins from other plugins.

If their .class files are in the classpath, just create a new instance
such as:

PlugIn pl = new Whatever_Plugin();
pl.run(the_args_here);

If their .class files are NOT in the classpath, you can search for them
in a loop starting at the path given to you by the
ij.Menus.getPluginsPath() method, and then load the class with a
ClassLoader and invoke the constructor.

If you'd rather modify the .java source files instead, then group them
all in a folder and give each a package name such as package
my_folder_name;  (note the package name has to be the same as the folder
name).

There are many ways to do what you want. Depending upon your expertise
and convenience or flexibility requirements, choose.

Albert