2007-11-05

Adding scripting commands to Bioclipse

Following up on my recent post on Scripting BioMoby in Bioclipse, I have created a new extension point to be able to hook in additions to the Rhino scripting language in Bioclipse with a namespace. Add an example extension like below to the plugin.xml of your plugin (example is from net.bioclipse.biomoby.ui):

<extension
point="net.bioclipse.rhino.scripting">
<ScriptContribution
class="net.bioclipse.biomoby.ui.scripts.MobyServiceScripting"
id="net.bioclipse.biomoby.ui.scripts.MobyServiceScripting"
namespace="moby">
</ScriptContribution>
</extension>


The class must implement IScriptProvider and namespace is the desired namespace you like to have (see examples below). An example is the class net.bioclipse.biomoby.ui.scripts.MobyServiceScripting:

public class MobyServiceScripting implements IScriptProvider{

public void showMessage(String title, String message) {
MessageDialog.openInformation(
getShell(),
title,
message);
}

}


Now it's possible to issue commands in Bioclipse like the following:

  moby.showMessage("wee", "how");


Very convenient in my opinion. This will be extensively used in the upcoming Bioclipse2, which currently is in design phase.

No comments:

Post a Comment