Update site for more than plugins?

imagej

#1

Hi,

I’ve started experimenting with an Update Site as a method to distribute plugins to users, this seems to be a really good solution and is working well.

I wonder is it possible to use an update site to distribute other things? From my tests and searches it appears not?

Specifically, I would like to use the Update Site ‘model’ to distribute training material, such as small sample images and scripting templates (and have these then populate File>Open Samples and Templates>SubFolder in the built-in script editor).

The use case here is sitting with a user with ‘their’ copy of Fiji and adding our update site to give me access to training tools specific to our users needs.

At the moment we do this by having these resources (images and script templates) available via a download from another server. Logistically this creates issues though…

cheers,

Chris


#2

Yes, it’s possible to distribute image files and scripts, for example, but they need to be in the correct place. For the jars and plugins folders, the updater will only accept jar files.

The file structure is explained here:

and details can be found in the source code:

Specifically for script examples, small sample images and similar things, you might also want to package your material in a single jar file (into its resources folder). Take a look at the example-script-collection to see how this can be done:

This approach has the advantage that you can use Maven and git to manage dependencies and versions of your training material.


#3

Hi Jan,

Apologies for the delay in thanking you for the hints; your suggestions for packaging images and scripts (mostly ij macros). into a .jar and then distributing through an update site is working very nicely.

One thing I cannot figure out how to do though is to package a script in such a way that it is not executed, but rather loaded into the script editor. Is there any way (directly or indirectly) to load a macro (from a menu) without execution? I want to be able to package ‘learning’ scripts and macro code ‘snippets’ for teaching… I had a thought to package them as a text file in the jar, this works, but it would be great if it were loaded into the script editor.

many thanks again

Chris


#4

The script editor provides script templates in the Templates menu. The entries of this menu are populated at runtime with all scripts that are found in resources/script_templates/ folders inside jars available on the classpath.

So if you want to ship script examples with your jar, simply put them into the ./resources/script_templates folder, as illustrated e.g. in the imagej-legacy project:

I’ll try to add this to the example-script-collection when I find the time.