ScuflModelAction

A ScuflModelAction allows a button, such as “Add Nested Workflow”, to appear in the Advanced Model Explorer within the Design Perspective of Taverna 1.7.x Workbench.

A new button can be added to the Taverna 1.7.x Advanced Model Explorer by a class that implements the org.embl.ebi.escience.scuflui.actions.ScuflModelAction interface or extends org.embl.ebi.escience.scuflui.actions.ScuflModelActionSPI. If the class implements org.embl.ebi.escience.scuflui.actions.ScuflModelAction directly, then the name of the new class must be specified within a org.embl.ebi.escience.scuflui.actions.ScuflModelAction file within the appropriate resources/META-INF/services directory.

Example

org.embl.ebi.escience.scuflworkers.workflow.AddNestedWorkflowAction extends the org.embl.ebi.escience.scuflui.actions.ScuflModelActionSPI class.

public class AddNestedWorkflowAction extends ScuflModelActionSPI {

	private CreateNewNestedWorkflowAction createNew =
	new CreateNewNestedWorkflowAction();

	private OpenNestedWorkflowFromFileAction openFile =
	new OpenNestedWorkflowFromFileAction();

	private OpenNestedWorkflowFromURLAction openURL =
	new OpenNestedWorkflowFromURLAction();

	public AddNestedWorkflowAction() {
		putValue(SMALL_ICON, TavernaIcons.windowExplorer);
		putValue(NAME, "Add Nested Workflow");
		putValue(SHORT_DESCRIPTION, "Add Nested Workflow...");
	}

	public void actionPerformed(ActionEvent e) {
		JPopupMenu menu = new JPopupMenu("Add Nested Workflow");

		menu.add(new JMenuItem(createNew));

		menu.addSeparator();

		menu.add(new JMenuItem(openFile));

		menu.add(new JMenuItem(openURL));

		Component sourceComponent = (Component) e.getSource();
		menu.show(sourceComponent, 0, sourceComponent.getHeight());
	}

	public String getLabel() {
		return "New subworkflow";
	}
        ...
}