Use of JavaScript importClass to load own plugin class.

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

Use of JavaScript importClass to load own plugin class.

Jean-Christophe Taveau
Hi all,

I tried (unsuccessfully) to import a plugin class with the importClass
function in JavaScript. There was post about that problem in 2010 (with a
workaround in JavaScriptEvaluator to include classLoader() ). Is it solved?
or is there another way to import such a plugin class?

Thanking you in advance. Jean-Christophe Taveau.

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Use of JavaScript importClass to load own plugin class.

dscho
Hi Jean-Christophe,

On Fri, 16 Nov 2012, Jean-Christophe Taveau wrote:

> I tried (unsuccessfully) to import a plugin class with the importClass
> function in JavaScript. There was post about that problem in 2010 (with
> a workaround in JavaScriptEvaluator to include classLoader() ). Is it
> solved?  or is there another way to import such a plugin class?

It would be good if you could paste your exact code and the exact error
message. Everything would send people on wild goose-chases that are most
likely just a waste of both their and your time.

Ciao,
Johannes

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Use of JavaScript importClass to load own plugin class.

Jean-Christophe Taveau
Here is the code, I get the following message
sun.org.mozilla.javascript.EcmaError: ReferenceError: "Test_Plugin" n'est
pas défini (<Unknown source>#1) in <Unknown source> at line number 1

"n''est pas défini" means "is not defined"

I tried several combinations of import but can't figure out how to import
such a class located in the plugins directory (or subdirectory).

Thanking you in advance, Jean-Christophe.


test.js
=================
importClass(Test_Plugin);

var test = new Test_Plugin();
test.run("many options");
=================


Test_Plugin.java
=================
import ij.plugin.PlugIn;
import ij.IJ;

public class Test_Plugin implements PlugIn {

    public Test_Plugin() {
        IJ.log("Constructor");
    }

    public void run(String options) {
        IJ.log("run" + options);
    }
}
==================


2012/11/16 Johannes Schindelin <[hidden email]>

> Hi Jean-Christophe,
>
> On Fri, 16 Nov 2012, Jean-Christophe Taveau wrote:
>
> > I tried (unsuccessfully) to import a plugin class with the importClass
> > function in JavaScript. There was post about that problem in 2010 (with
> > a workaround in JavaScriptEvaluator to include classLoader() ). Is it
> > solved?  or is there another way to import such a plugin class?
>
> It would be good if you could paste your exact code and the exact error
> message. Everything would send people on wild goose-chases that are most
> likely just a waste of both their and your time.
>
> Ciao,
> Johannes
>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Use of JavaScript importClass to load own plugin class.

Rasband, Wayne (NIH/NIMH) [E]
On Nov 18, 2012, at 9:51 AM, Jean-Christophe Taveau wrote:

> Here is the code, I get the following message
> sun.org.mozilla.javascript.EcmaError: ReferenceError: "Test_Plugin" n'est
> pas défini (<Unknown source>#1) in <Unknown source> at line number 1
>
> "n''est pas défini" means "is not defined"
>
> I tried several combinations of import but can't figure out how to import
> such a class located in the plugins directory (or subdirectory).
>
> Thanking you in advance, Jean-Christophe.

This works without any imports.

   IJ.runPlugIn("Test_Plugin", "many options");

-wayne


> test.js
> =================
> importClass(Test_Plugin);
>
> var test = new Test_Plugin();
> test.run("many options");
> =================
>
>
> Test_Plugin.java
> =================
> import ij.plugin.PlugIn;
> import ij.IJ;
>
> public class Test_Plugin implements PlugIn {
>
>    public Test_Plugin() {
>        IJ.log("Constructor");
>    }
>
>    public void run(String options) {
>        IJ.log("run" + options);
>    }
> }
> ==================
>
>
> 2012/11/16 Johannes Schindelin <[hidden email]>
>
>> Hi Jean-Christophe,
>>
>> On Fri, 16 Nov 2012, Jean-Christophe Taveau wrote:
>>
>>> I tried (unsuccessfully) to import a plugin class with the importClass
>>> function in JavaScript. There was post about that problem in 2010 (with
>>> a workaround in JavaScriptEvaluator to include classLoader() ). Is it
>>> solved?  or is there another way to import such a plugin class?
>>
>> It would be good if you could paste your exact code and the exact error
>> message. Everything would send people on wild goose-chases that are most
>> likely just a waste of both their and your time.
>>
>> Ciao,
>> Johannes
>>
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Use of JavaScript importClass to load own plugin class.

Jean-Christophe Taveau
I really simplified my test plugin to show the problem. But, actually, I'm
developing a plugin which displays a hardware-accelerated window (with
lwjgl or jogamp) and I want to interact with it in JavaScript (a fast way
for prototyping). Here is the kind of script I want to write:

var win3D = new Window3D_Plugin();
win3D.setGeometry(array_of_graphics_primitives);
win3D.show();
etc...

In conclusion, I would like to know how to import such a plugin class.

Thanking you in advance. Jean-Christophe.

PS: In my actual plugin version, I use the ResultsTable for storing the
graphics primitives but it isn't very convenient and then use the
IJ.run("...") to run my window3D.



2012/11/19 Rasband, Wayne (NIH/NIMH) [E] <[hidden email]>

> On Nov 18, 2012, at 9:51 AM, Jean-Christophe Taveau wrote:
>
> > Here is the code, I get the following message
> > sun.org.mozilla.javascript.EcmaError: ReferenceError: "Test_Plugin" n'est
> > pas défini (<Unknown source>#1) in <Unknown source> at line number 1
> >
> > "n''est pas défini" means "is not defined"
> >
> > I tried several combinations of import but can't figure out how to import
> > such a class located in the plugins directory (or subdirectory).
> >
> > Thanking you in advance, Jean-Christophe.
>
> This works without any imports.
>
>    IJ.runPlugIn("Test_Plugin", "many options");
>
> -wayne
>
>
> > test.js
> > =================
> > importClass(Test_Plugin);
> >
> > var test = new Test_Plugin();
> > test.run("many options");
> > =================
> >
> >
> > Test_Plugin.java
> > =================
> > import ij.plugin.PlugIn;
> > import ij.IJ;
> >
> > public class Test_Plugin implements PlugIn {
> >
> >    public Test_Plugin() {
> >        IJ.log("Constructor");
> >    }
> >
> >    public void run(String options) {
> >        IJ.log("run" + options);
> >    }
> > }
> > ==================
> >
> >
> > 2012/11/16 Johannes Schindelin <[hidden email]>
> >
> >> Hi Jean-Christophe,
> >>
> >> On Fri, 16 Nov 2012, Jean-Christophe Taveau wrote:
> >>
> >>> I tried (unsuccessfully) to import a plugin class with the importClass
> >>> function in JavaScript. There was post about that problem in 2010 (with
> >>> a workaround in JavaScriptEvaluator to include classLoader() ). Is it
> >>> solved?  or is there another way to import such a plugin class?
> >>
> >> It would be good if you could paste your exact code and the exact error
> >> message. Everything would send people on wild goose-chases that are most
> >> likely just a waste of both their and your time.
> >>
> >> Ciao,
> >> Johannes
> >>
> >
> > --
> > ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Off-topic: documentation/reporting tools

Thomas Eschner
Dear all,

I am sorry for asking off-topic questions, but, please, give me a hint at your favorite non-proprietary documentation/reporting tool.

To me, MicroManager and Omero seem great when it comes to aquiring and organizing images and related information, but documentation/reporting is not the focus. Googling and asking around did not anwer my question so far: What good tools are out there?

Thank you,
Thomas

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Use of JavaScript importClass to load own plugin class.

Kota Miura
In reply to this post by Jean-Christophe Taveau
Hi Jean-Christophe,

in your .js code, it should be

importClass(Packages.Test_Plugin);

not

importClass(Test_Plugin);


Cheers,
Kota

On Mon, Nov 19, 2012 at 9:26 AM, Jean-Christophe Taveau <
[hidden email]> wrote:

> I really simplified my test plugin to show the problem. But, actually, I'm
> developing a plugin which displays a hardware-accelerated window (with
> lwjgl or jogamp) and I want to interact with it in JavaScript (a fast way
> for prototyping). Here is the kind of script I want to write:
>
> var win3D = new Window3D_Plugin();
> win3D.setGeometry(array_of_graphics_primitives);
> win3D.show();
> etc...
>
> In conclusion, I would like to know how to import such a plugin class.
>
> Thanking you in advance. Jean-Christophe.
>
> PS: In my actual plugin version, I use the ResultsTable for storing the
> graphics primitives but it isn't very convenient and then use the
> IJ.run("...") to run my window3D.
>
>
>
> 2012/11/19 Rasband, Wayne (NIH/NIMH) [E] <[hidden email]>
>
> > On Nov 18, 2012, at 9:51 AM, Jean-Christophe Taveau wrote:
> >
> > > Here is the code, I get the following message
> > > sun.org.mozilla.javascript.EcmaError: ReferenceError: "Test_Plugin"
> n'est
> > > pas défini (<Unknown source>#1) in <Unknown source> at line number 1
> > >
> > > "n''est pas défini" means "is not defined"
> > >
> > > I tried several combinations of import but can't figure out how to
> import
> > > such a class located in the plugins directory (or subdirectory).
> > >
> > > Thanking you in advance, Jean-Christophe.
> >
> > This works without any imports.
> >
> >    IJ.runPlugIn("Test_Plugin", "many options");
> >
> > -wayne
> >
> >
> > > test.js
> > > =================
> > > importClass(Test_Plugin);
> > >
> > > var test = new Test_Plugin();
> > > test.run("many options");
> > > =================
> > >
> > >
> > > Test_Plugin.java
> > > =================
> > > import ij.plugin.PlugIn;
> > > import ij.IJ;
> > >
> > > public class Test_Plugin implements PlugIn {
> > >
> > >    public Test_Plugin() {
> > >        IJ.log("Constructor");
> > >    }
> > >
> > >    public void run(String options) {
> > >        IJ.log("run" + options);
> > >    }
> > > }
> > > ==================
> > >
> > >
> > > 2012/11/16 Johannes Schindelin <[hidden email]>
> > >
> > >> Hi Jean-Christophe,
> > >>
> > >> On Fri, 16 Nov 2012, Jean-Christophe Taveau wrote:
> > >>
> > >>> I tried (unsuccessfully) to import a plugin class with the
> importClass
> > >>> function in JavaScript. There was post about that problem in 2010
> (with
> > >>> a workaround in JavaScriptEvaluator to include classLoader() ). Is it
> > >>> solved?  or is there another way to import such a plugin class?
> > >>
> > >> It would be good if you could paste your exact code and the exact
> error
> > >> message. Everything would send people on wild goose-chases that are
> most
> > >> likely just a waste of both their and your time.
> > >>
> > >> Ciao,
> > >> Johannes
> > >>
> > >
> > > --
> > > ImageJ mailing list: http://imagej.nih.gov/ij/list.html
> >
> > --
> > ImageJ mailing list: http://imagej.nih.gov/ij/list.html
> >
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>



--

-------------------------------------------------------------*Dr. Kota Miura*

Scientist & IT Engineer
Centre for Molecular and Cellular Imaging,
European Molecular Biology Laboratory
Meyerhofstr. 1
69117 Heidelberg
GERMANY

Tel +49 6221 387 404

Mobile +49 160 95001177

Fax +49 6221 387 512

http://cmci.embl.de
-------------------------------------------------------------

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Use of JavaScript importClass to load own plugin class.

Jean-Christophe Taveau
I tried and interestingly, got another error message:

sun.org.mozilla.javascript.EvaluatorException: La fonction importClass doit
être appelée avec une classe et non avec "[JavaPackage Test_Plugin]"
(<Unknown source>#1) in <Unknown source> at line number 1

I translate "The function importClass must be called with a class and not
with "[JavaPackage Test_Plugin]"

Any idea?

Jean-christophe.


2012/11/19 Kota Miura <[hidden email]>

> Hi Jean-Christophe,
>
> in your .js code, it should be
>
> importClass(Packages.Test_Plugin);
>
> not
>
> importClass(Test_Plugin);
>
>
> Cheers,
> Kota
>
> On Mon, Nov 19, 2012 at 9:26 AM, Jean-Christophe Taveau <
> [hidden email]> wrote:
>
> > I really simplified my test plugin to show the problem. But, actually,
> I'm
> > developing a plugin which displays a hardware-accelerated window (with
> > lwjgl or jogamp) and I want to interact with it in JavaScript (a fast way
> > for prototyping). Here is the kind of script I want to write:
> >
> > var win3D = new Window3D_Plugin();
> > win3D.setGeometry(array_of_graphics_primitives);
> > win3D.show();
> > etc...
> >
> > In conclusion, I would like to know how to import such a plugin class.
> >
> > Thanking you in advance. Jean-Christophe.
> >
> > PS: In my actual plugin version, I use the ResultsTable for storing the
> > graphics primitives but it isn't very convenient and then use the
> > IJ.run("...") to run my window3D.
> >
> >
> >
> > 2012/11/19 Rasband, Wayne (NIH/NIMH) [E] <[hidden email]>
> >
> > > On Nov 18, 2012, at 9:51 AM, Jean-Christophe Taveau wrote:
> > >
> > > > Here is the code, I get the following message
> > > > sun.org.mozilla.javascript.EcmaError: ReferenceError: "Test_Plugin"
> > n'est
> > > > pas défini (<Unknown source>#1) in <Unknown source> at line number 1
> > > >
> > > > "n''est pas défini" means "is not defined"
> > > >
> > > > I tried several combinations of import but can't figure out how to
> > import
> > > > such a class located in the plugins directory (or subdirectory).
> > > >
> > > > Thanking you in advance, Jean-Christophe.
> > >
> > > This works without any imports.
> > >
> > >    IJ.runPlugIn("Test_Plugin", "many options");
> > >
> > > -wayne
> > >
> > >
> > > > test.js
> > > > =================
> > > > importClass(Test_Plugin);
> > > >
> > > > var test = new Test_Plugin();
> > > > test.run("many options");
> > > > =================
> > > >
> > > >
> > > > Test_Plugin.java
> > > > =================
> > > > import ij.plugin.PlugIn;
> > > > import ij.IJ;
> > > >
> > > > public class Test_Plugin implements PlugIn {
> > > >
> > > >    public Test_Plugin() {
> > > >        IJ.log("Constructor");
> > > >    }
> > > >
> > > >    public void run(String options) {
> > > >        IJ.log("run" + options);
> > > >    }
> > > > }
> > > > ==================
> > > >
> > > >
> > > > 2012/11/16 Johannes Schindelin <[hidden email]>
> > > >
> > > >> Hi Jean-Christophe,
> > > >>
> > > >> On Fri, 16 Nov 2012, Jean-Christophe Taveau wrote:
> > > >>
> > > >>> I tried (unsuccessfully) to import a plugin class with the
> > importClass
> > > >>> function in JavaScript. There was post about that problem in 2010
> > (with
> > > >>> a workaround in JavaScriptEvaluator to include classLoader() ). Is
> it
> > > >>> solved?  or is there another way to import such a plugin class?
> > > >>
> > > >> It would be good if you could paste your exact code and the exact
> > error
> > > >> message. Everything would send people on wild goose-chases that are
> > most
> > > >> likely just a waste of both their and your time.
> > > >>
> > > >> Ciao,
> > > >> Johannes
> > > >>
> > > >
> > > > --
> > > > ImageJ mailing list: http://imagej.nih.gov/ij/list.html
> > >
> > > --
> > > ImageJ mailing list: http://imagej.nih.gov/ij/list.html
> > >
> >
> > --
> > ImageJ mailing list: http://imagej.nih.gov/ij/list.html
> >
>
>
>
> --
>
> -------------------------------------------------------------*Dr. Kota
> Miura*
>
> Scientist & IT Engineer
> Centre for Molecular and Cellular Imaging,
> European Molecular Biology Laboratory
> Meyerhofstr. 1
> 69117 Heidelberg
> GERMANY
>
> Tel +49 6221 387 404
>
> Mobile +49 160 95001177
>
> Fax +49 6221 387 512
>
> http://cmci.embl.de
> -------------------------------------------------------------
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Use of JavaScript importClass to load own plugin class.

Kota Miura
Hi Jean-Christoph,

could you put your jar file (with your code) somewhere reachable?

Cheers,
Kota

On Mon, Nov 19, 2012 at 10:39 AM, Jean-Christophe Taveau <
[hidden email]> wrote:

> I tried and interestingly, got another error message:
>
> sun.org.mozilla.javascript.EvaluatorException: La fonction importClass
> doit être appelée avec une classe et non avec "[JavaPackage Test_Plugin]"
> (<Unknown source>#1) in <Unknown source> at line number 1
>
> I translate "The function importClass must be called with a class and not
> with "[JavaPackage Test_Plugin]"
>
> Any idea?
>
> Jean-christophe.
>
>
> 2012/11/19 Kota Miura <[hidden email]>
>
>> Hi Jean-Christophe,
>>
>> in your .js code, it should be
>>
>> importClass(Packages.Test_Plugin);
>>
>> not
>>
>> importClass(Test_Plugin);
>>
>>
>> Cheers,
>> Kota
>>
>> On Mon, Nov 19, 2012 at 9:26 AM, Jean-Christophe Taveau <
>> [hidden email]> wrote:
>>
>> > I really simplified my test plugin to show the problem. But, actually,
>> I'm
>> > developing a plugin which displays a hardware-accelerated window (with
>> > lwjgl or jogamp) and I want to interact with it in JavaScript (a fast
>> way
>> > for prototyping). Here is the kind of script I want to write:
>> >
>> > var win3D = new Window3D_Plugin();
>> > win3D.setGeometry(array_of_graphics_primitives);
>> > win3D.show();
>> > etc...
>> >
>> > In conclusion, I would like to know how to import such a plugin class.
>> >
>> > Thanking you in advance. Jean-Christophe.
>> >
>> > PS: In my actual plugin version, I use the ResultsTable for storing the
>> > graphics primitives but it isn't very convenient and then use the
>> > IJ.run("...") to run my window3D.
>> >
>> >
>> >
>> > 2012/11/19 Rasband, Wayne (NIH/NIMH) [E] <[hidden email]>
>> >
>> > > On Nov 18, 2012, at 9:51 AM, Jean-Christophe Taveau wrote:
>> > >
>> > > > Here is the code, I get the following message
>> > > > sun.org.mozilla.javascript.EcmaError: ReferenceError: "Test_Plugin"
>> > n'est
>> > > > pas défini (<Unknown source>#1) in <Unknown source> at line number 1
>> > > >
>> > > > "n''est pas défini" means "is not defined"
>> > > >
>> > > > I tried several combinations of import but can't figure out how to
>> > import
>> > > > such a class located in the plugins directory (or subdirectory).
>> > > >
>> > > > Thanking you in advance, Jean-Christophe.
>> > >
>> > > This works without any imports.
>> > >
>> > >    IJ.runPlugIn("Test_Plugin", "many options");
>> > >
>> > > -wayne
>> > >
>> > >
>> > > > test.js
>> > > > =================
>> > > > importClass(Test_Plugin);
>> > > >
>> > > > var test = new Test_Plugin();
>> > > > test.run("many options");
>> > > > =================
>> > > >
>> > > >
>> > > > Test_Plugin.java
>> > > > =================
>> > > > import ij.plugin.PlugIn;
>> > > > import ij.IJ;
>> > > >
>> > > > public class Test_Plugin implements PlugIn {
>> > > >
>> > > >    public Test_Plugin() {
>> > > >        IJ.log("Constructor");
>> > > >    }
>> > > >
>> > > >    public void run(String options) {
>> > > >        IJ.log("run" + options);
>> > > >    }
>> > > > }
>> > > > ==================
>> > > >
>> > > >
>> > > > 2012/11/16 Johannes Schindelin <[hidden email]>
>> > > >
>> > > >> Hi Jean-Christophe,
>> > > >>
>> > > >> On Fri, 16 Nov 2012, Jean-Christophe Taveau wrote:
>> > > >>
>> > > >>> I tried (unsuccessfully) to import a plugin class with the
>> > importClass
>> > > >>> function in JavaScript. There was post about that problem in 2010
>> > (with
>> > > >>> a workaround in JavaScriptEvaluator to include classLoader() ).
>> Is it
>> > > >>> solved?  or is there another way to import such a plugin class?
>> > > >>
>> > > >> It would be good if you could paste your exact code and the exact
>> > error
>> > > >> message. Everything would send people on wild goose-chases that are
>> > most
>> > > >> likely just a waste of both their and your time.
>> > > >>
>> > > >> Ciao,
>> > > >> Johannes
>> > > >>
>> > > >
>> > > > --
>> > > > ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>> > >
>> > > --
>> > > ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>> > >
>> >
>> > --
>> > ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>> >
>>
>>
>>
>> --
>>
>


--

-------------------------------------------------------------*Dr. Kota Miura*

Scientist & IT Engineer
Centre for Molecular and Cellular Imaging,
European Molecular Biology Laboratory
Meyerhofstr. 1
69117 Heidelberg
GERMANY

Tel +49 6221 387 404

Mobile +49 160 95001177

Fax +49 6221 387 512

http://cmci.embl.de
-------------------------------------------------------------

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Use of JavaScript importClass to load own plugin class.

Rasband, Wayne (NIH/NIMH) [E]
In reply to this post by Jean-Christophe Taveau
On Nov 19, 2012, at 3:26 AM, Jean-Christophe Taveau wrote:

> I really simplified my test plugin to show the problem. But, actually, I'm
> developing a plugin which displays a hardware-accelerated window (with
> lwjgl or jogamp) and I want to interact with it in JavaScript (a fast way
> for prototyping). Here is the kind of script I want to write:
>
> var win3D = new Window3D_Plugin();
> win3D.setGeometry(array_of_graphics_primitives);
> win3D.show();
> etc...
>
> In conclusion, I would like to know how to import such a plugin class.

You can use ImageJ's PluginClassLoader to load the plugin class. Here is an example:

   loader = IJ.getClassLoader();
   test_plugin = loader.loadClass("Test_Plugin").newInstance();
   test_plugin.run("many options");

-wayne

> PS: In my actual plugin version, I use the ResultsTable for storing the
> graphics primitives but it isn't very convenient and then use the
> IJ.run("...") to run my window3D.
>
>
>
> 2012/11/19 Rasband, Wayne (NIH/NIMH) [E] <[hidden email]>
>
>> On Nov 18, 2012, at 9:51 AM, Jean-Christophe Taveau wrote:
>>
>>> Here is the code, I get the following message
>>> sun.org.mozilla.javascript.EcmaError: ReferenceError: "Test_Plugin" n'est
>>> pas défini (<Unknown source>#1) in <Unknown source> at line number 1
>>>
>>> "n''est pas défini" means "is not defined"
>>>
>>> I tried several combinations of import but can't figure out how to import
>>> such a class located in the plugins directory (or subdirectory).
>>>
>>> Thanking you in advance, Jean-Christophe.
>>
>> This works without any imports.
>>
>>   IJ.runPlugIn("Test_Plugin", "many options");
>>
>> -wayne
>>
>>
>>> test.js
>>> =================
>>> importClass(Test_Plugin);
>>>
>>> var test = new Test_Plugin();
>>> test.run("many options");
>>> =================
>>>
>>>
>>> Test_Plugin.java
>>> =================
>>> import ij.plugin.PlugIn;
>>> import ij.IJ;
>>>
>>> public class Test_Plugin implements PlugIn {
>>>
>>>   public Test_Plugin() {
>>>       IJ.log("Constructor");
>>>   }
>>>
>>>   public void run(String options) {
>>>       IJ.log("run" + options);
>>>   }
>>> }
>>> ==================
>>>
>>>
>>> 2012/11/16 Johannes Schindelin <[hidden email]>
>>>
>>>> Hi Jean-Christophe,
>>>>
>>>> On Fri, 16 Nov 2012, Jean-Christophe Taveau wrote:
>>>>
>>>>> I tried (unsuccessfully) to import a plugin class with the importClass
>>>>> function in JavaScript. There was post about that problem in 2010 (with
>>>>> a workaround in JavaScriptEvaluator to include classLoader() ). Is it
>>>>> solved?  or is there another way to import such a plugin class?
>>>>
>>>> It would be good if you could paste your exact code and the exact error
>>>> message. Everything would send people on wild goose-chases that are most
>>>> likely just a waste of both their and your time.
>>>>
>>>> Ciao,
>>>> Johannes
>>>>
>>>
>>> --
>>> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>>
>> --
>> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>>
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Use of JavaScript importClass to load own plugin class.

Jean-Christophe Taveau
That works.

Thanks a lot!! Jean-Christophe

2012/11/19 Rasband, Wayne (NIH/NIMH) [E] <[hidden email]>

> On Nov 19, 2012, at 3:26 AM, Jean-Christophe Taveau wrote:
>
> > I really simplified my test plugin to show the problem. But, actually,
> I'm
> > developing a plugin which displays a hardware-accelerated window (with
> > lwjgl or jogamp) and I want to interact with it in JavaScript (a fast way
> > for prototyping). Here is the kind of script I want to write:
> >
> > var win3D = new Window3D_Plugin();
> > win3D.setGeometry(array_of_graphics_primitives);
> > win3D.show();
> > etc...
> >
> > In conclusion, I would like to know how to import such a plugin class.
>
> You can use ImageJ's PluginClassLoader to load the plugin class. Here is
> an example:
>
>    loader = IJ.getClassLoader();
>    test_plugin = loader.loadClass("Test_Plugin").newInstance();
>    test_plugin.run("many options");
>
> -wayne
>
> > PS: In my actual plugin version, I use the ResultsTable for storing the
> > graphics primitives but it isn't very convenient and then use the
> > IJ.run("...") to run my window3D.
> >
> >
> >
> > 2012/11/19 Rasband, Wayne (NIH/NIMH) [E] <[hidden email]>
> >
> >> On Nov 18, 2012, at 9:51 AM, Jean-Christophe Taveau wrote:
> >>
> >>> Here is the code, I get the following message
> >>> sun.org.mozilla.javascript.EcmaError: ReferenceError: "Test_Plugin"
> n'est
> >>> pas défini (<Unknown source>#1) in <Unknown source> at line number 1
> >>>
> >>> "n''est pas défini" means "is not defined"
> >>>
> >>> I tried several combinations of import but can't figure out how to
> import
> >>> such a class located in the plugins directory (or subdirectory).
> >>>
> >>> Thanking you in advance, Jean-Christophe.
> >>
> >> This works without any imports.
> >>
> >>   IJ.runPlugIn("Test_Plugin", "many options");
> >>
> >> -wayne
> >>
> >>
> >>> test.js
> >>> =================
> >>> importClass(Test_Plugin);
> >>>
> >>> var test = new Test_Plugin();
> >>> test.run("many options");
> >>> =================
> >>>
> >>>
> >>> Test_Plugin.java
> >>> =================
> >>> import ij.plugin.PlugIn;
> >>> import ij.IJ;
> >>>
> >>> public class Test_Plugin implements PlugIn {
> >>>
> >>>   public Test_Plugin() {
> >>>       IJ.log("Constructor");
> >>>   }
> >>>
> >>>   public void run(String options) {
> >>>       IJ.log("run" + options);
> >>>   }
> >>> }
> >>> ==================
> >>>
> >>>
> >>> 2012/11/16 Johannes Schindelin <[hidden email]>
> >>>
> >>>> Hi Jean-Christophe,
> >>>>
> >>>> On Fri, 16 Nov 2012, Jean-Christophe Taveau wrote:
> >>>>
> >>>>> I tried (unsuccessfully) to import a plugin class with the
> importClass
> >>>>> function in JavaScript. There was post about that problem in 2010
> (with
> >>>>> a workaround in JavaScriptEvaluator to include classLoader() ). Is it
> >>>>> solved?  or is there another way to import such a plugin class?
> >>>>
> >>>> It would be good if you could paste your exact code and the exact
> error
> >>>> message. Everything would send people on wild goose-chases that are
> most
> >>>> likely just a waste of both their and your time.
> >>>>
> >>>> Ciao,
> >>>> Johannes
> >>>>
> >>>
> >>> --
> >>> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
> >>
> >> --
> >> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
> >>
> >
> > --
> > ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Off-topic: documentation/reporting tools

ctrueden
In reply to this post by Thomas Eschner
Hi Thomas,

> give me a hint at your favorite non-proprietary
> documentation/reporting tool.

Sorry for asking a stupid question, but what is a "documentation/reporting
tool"? Is there a particular discipline from which those terms originate?

-Curtis


On Mon, Nov 19, 2012 at 2:57 AM, Thomas Eschner <[hidden email]>wrote:

> Dear all,
>
> I am sorry for asking off-topic questions, but, please, give me a hint at
> your favorite non-proprietary documentation/reporting tool.
>
> To me, MicroManager and Omero seem great when it comes to aquiring and
> organizing images and related information, but documentation/reporting is
> not the focus. Googling and asking around did not anwer my question so far:
> What good tools are out there?
>
> Thank you,
> Thomas
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html