You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@taverna.apache.org by st...@apache.org on 2015/03/20 15:22:38 UTC

[24/51] [abbrv] [partial] incubator-taverna-workbench git commit: taverna-workbench-* -> taverna-*

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/52fd79dd/taverna-loop-ui/src/main/java/net/sf/taverna/t2/workbench/loop/comparisons/NotMatches.java
----------------------------------------------------------------------
diff --git a/taverna-loop-ui/src/main/java/net/sf/taverna/t2/workbench/loop/comparisons/NotMatches.java b/taverna-loop-ui/src/main/java/net/sf/taverna/t2/workbench/loop/comparisons/NotMatches.java
new file mode 100644
index 0000000..803d5d7
--- /dev/null
+++ b/taverna-loop-ui/src/main/java/net/sf/taverna/t2/workbench/loop/comparisons/NotMatches.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (C) 2008 The University of Manchester   
+ * 
+ *  Modifications to the initial code base are copyright of their
+ *  respective authors, or their employers as appropriate.
+ * 
+ *  This program is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public License
+ *  as published by the Free Software Foundation; either version 2.1 of
+ *  the License, or (at your option) any later version.
+ *    
+ *  This program is distributed in the hope that it will be useful, but
+ *  WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *    
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ ******************************************************************************/
+package net.sf.taverna.t2.workbench.loop.comparisons;
+
+public class NotMatches extends Comparison {
+
+	public String getId() {
+		return "NotMatches";
+	}
+
+	public String getName() {
+		return "does not match";
+	}
+
+	public String getScriptTemplate() {
+		return "${loopPort} = \"\" + ${port}.matches(${value});";
+	}
+
+	public String getValueType() {
+		return "regular expression";
+	}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/52fd79dd/taverna-loop-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.ui.menu.MenuComponent
----------------------------------------------------------------------
diff --git a/taverna-loop-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.ui.menu.MenuComponent b/taverna-loop-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.ui.menu.MenuComponent
new file mode 100644
index 0000000..1956a3f
--- /dev/null
+++ b/taverna-loop-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.ui.menu.MenuComponent
@@ -0,0 +1,3 @@
+net.sf.taverna.t2.workbench.loop.LoopConfigureMenuAction
+net.sf.taverna.t2.workbench.loop.LoopAddMenuAction
+net.sf.taverna.t2.workbench.loop.LoopRemoveMenuAction

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/52fd79dd/taverna-loop-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.ui.views.contextualviews.AddLayerFactorySPI
----------------------------------------------------------------------
diff --git a/taverna-loop-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.ui.views.contextualviews.AddLayerFactorySPI b/taverna-loop-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.ui.views.contextualviews.AddLayerFactorySPI
new file mode 100644
index 0000000..52eafc4
--- /dev/null
+++ b/taverna-loop-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.ui.views.contextualviews.AddLayerFactorySPI
@@ -0,0 +1 @@
+net.sf.taverna.t2.workbench.loop.AddLoopFactory

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/52fd79dd/taverna-loop-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory
----------------------------------------------------------------------
diff --git a/taverna-loop-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory b/taverna-loop-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory
new file mode 100644
index 0000000..9150066
--- /dev/null
+++ b/taverna-loop-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory
@@ -0,0 +1 @@
+net.sf.taverna.t2.workbench.loop.LoopContextualViewFactory

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/52fd79dd/taverna-loop-ui/src/main/resources/META-INF/spring/loop-ui-context-osgi.xml
----------------------------------------------------------------------
diff --git a/taverna-loop-ui/src/main/resources/META-INF/spring/loop-ui-context-osgi.xml b/taverna-loop-ui/src/main/resources/META-INF/spring/loop-ui-context-osgi.xml
new file mode 100644
index 0000000..4abb75f
--- /dev/null
+++ b/taverna-loop-ui/src/main/resources/META-INF/spring/loop-ui-context-osgi.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans:beans xmlns="http://www.springframework.org/schema/osgi" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xmlns:beans="http://www.springframework.org/schema/beans"
+	xsi:schemaLocation="http://www.springframework.org/schema/beans
+                      http://www.springframework.org/schema/beans/spring-beans.xsd
+                      http://www.springframework.org/schema/osgi
+                      http://www.springframework.org/schema/osgi/spring-osgi.xsd">
+
+	<service ref="AddLoopFactory" interface="net.sf.taverna.t2.workbench.ui.views.contextualviews.AddLayerFactorySPI" />
+
+	<service ref="LoopConfigureMenuAction" auto-export="interfaces" />
+	<service ref="LoopAddMenuAction" auto-export="interfaces" />
+	<service ref="LoopRemoveMenuAction" auto-export="interfaces" />
+
+	<service ref="LoopContextualViewFactory" interface="net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory" />
+
+	<reference id="editManager" interface="net.sf.taverna.t2.workbench.edits.EditManager" />
+	<reference id="fileManager" interface="net.sf.taverna.t2.workbench.file.FileManager" />
+    <reference id="selectionManager" interface="net.sf.taverna.t2.workbench.selection.SelectionManager" />
+    <reference id="applicationConfig" interface="uk.org.taverna.configuration.app.ApplicationConfiguration"/>
+</beans:beans>

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/52fd79dd/taverna-loop-ui/src/main/resources/META-INF/spring/loop-ui-context.xml
----------------------------------------------------------------------
diff --git a/taverna-loop-ui/src/main/resources/META-INF/spring/loop-ui-context.xml b/taverna-loop-ui/src/main/resources/META-INF/spring/loop-ui-context.xml
new file mode 100644
index 0000000..4c2133c
--- /dev/null
+++ b/taverna-loop-ui/src/main/resources/META-INF/spring/loop-ui-context.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://www.springframework.org/schema/beans
+                      http://www.springframework.org/schema/beans/spring-beans.xsd">
+
+	<bean id="AddLoopFactory" class="net.sf.taverna.t2.workbench.loop.AddLoopFactory">
+			<property name="editManager" ref="editManager" />
+			<property name="fileManager" ref="fileManager" />
+            <property name="selectionManager" ref="selectionManager" />
+            <property name="applicationConfig" ref="applicationConfig" />            
+	</bean>
+
+	<bean id="LoopConfigureMenuAction" class="net.sf.taverna.t2.workbench.loop.LoopConfigureMenuAction">
+			<property name="editManager" ref="editManager" />
+			<property name="fileManager" ref="fileManager" />
+	</bean>
+	<bean id="LoopAddMenuAction" class="net.sf.taverna.t2.workbench.loop.LoopAddMenuAction">
+			<property name="addLoopFactory">
+				<ref local="AddLoopFactory"/>
+			</property>
+	</bean>
+	<bean id="LoopRemoveMenuAction" class="net.sf.taverna.t2.workbench.loop.LoopRemoveMenuAction">
+			<property name="editManager" ref="editManager" />
+			<property name="fileManager" ref="fileManager" />
+	</bean>
+
+	<bean id="LoopContextualViewFactory" class="net.sf.taverna.t2.workbench.loop.LoopContextualViewFactory">
+			<property name="editManager" ref="editManager" />
+			<property name="fileManager" ref="fileManager" />
+	</bean>
+
+</beans>

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/52fd79dd/taverna-loop-ui/src/test/java/net/sf/taverna/t2/workbench/loop/ShowContextualView.java
----------------------------------------------------------------------
diff --git a/taverna-loop-ui/src/test/java/net/sf/taverna/t2/workbench/loop/ShowContextualView.java b/taverna-loop-ui/src/test/java/net/sf/taverna/t2/workbench/loop/ShowContextualView.java
new file mode 100644
index 0000000..3e3d121
--- /dev/null
+++ b/taverna-loop-ui/src/test/java/net/sf/taverna/t2/workbench/loop/ShowContextualView.java
@@ -0,0 +1,121 @@
+/*******************************************************************************
+ * Copyright (C) 2008 The University of Manchester
+ *
+ *  Modifications to the initial code base are copyright of their
+ *  respective authors, or their employers as appropriate.
+ *
+ *  This program is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public License
+ *  as published by the Free Software Foundation; either version 2.1 of
+ *  the License, or (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful, but
+ *  WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ ******************************************************************************/
+package net.sf.taverna.t2.workbench.loop;
+
+import java.awt.BorderLayout;
+import java.awt.Component;
+import java.awt.event.ActionEvent;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
+import javax.swing.AbstractAction;
+import javax.swing.JButton;
+import javax.swing.JFrame;
+import javax.swing.JPanel;
+
+import uk.org.taverna.scufl2.api.container.WorkflowBundle;
+import uk.org.taverna.scufl2.api.core.Processor;
+
+import net.sf.taverna.t2.workbench.edits.EditManager;
+import net.sf.taverna.t2.workbench.edits.impl.EditManagerImpl;
+import net.sf.taverna.t2.workbench.file.FileManager;
+import net.sf.taverna.t2.workbench.file.impl.FileManagerImpl;
+import net.sf.taverna.t2.workbench.selection.SelectionManager;
+import net.sf.taverna.t2.workbench.selection.impl.SelectionManagerImpl;
+import net.sf.taverna.t2.workbench.ui.views.contextualviews.impl.ContextualViewComponent;
+import net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactoryRegistry;
+import net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.impl.ContextualViewFactoryRegistryImpl;
+
+/**
+ * A standalone application to show contextual views
+ * <p>
+ * The application shows a JFrame containing a contextual view, together with
+ * buttons which will select items in the {@link SelectionManager} for a
+ * (rather) empty current dataflow.
+ *
+ * @author Stian Soiland-Reyes.
+ *
+ */
+public class ShowContextualView {
+
+	public static void main(String[] args) throws Exception {
+		EditManager editManager = new EditManagerImpl();
+		FileManager fileManager = new FileManagerImpl(editManager);
+		ContextualViewFactoryRegistry contextualViewFactoryRegistry = new ContextualViewFactoryRegistryImpl();
+		SelectionManagerImpl selectionMan = new SelectionManagerImpl();
+		selectionMan.setFileManager(fileManager);
+		selectionMan.setEditManager(editManager);
+		new ShowContextualView(editManager, fileManager,selectionMan, contextualViewFactoryRegistry).showFrame();
+	}
+
+	private SelectionManager selectionManager;
+	private FileManager fileManager;
+	private EditManager editManager;
+	private ContextualViewFactoryRegistry contextualViewFactoryRegistry;
+
+	private uk.org.taverna.scufl2.api.core.Processor processor;
+
+	private WorkflowBundle currentDataflow;
+
+	public ShowContextualView(EditManager editManager, FileManager fileManager, final SelectionManager selectionManager, ContextualViewFactoryRegistry contextualViewFactoryRegistry) {
+		this.editManager = editManager;
+		this.fileManager = fileManager;
+		this.selectionManager = selectionManager;
+		this.contextualViewFactoryRegistry = contextualViewFactoryRegistry;
+		currentDataflow = fileManager.newDataflow();
+		makeProcessor();
+
+	}
+
+	private void makeProcessor() {
+	    processor = new Processor(currentDataflow.getMainWorkflow(), "Hello");
+	}
+
+	private List getSelections() {
+		return Arrays.asList(processor, currentDataflow);
+	}
+
+	private Component makeSelectionButtons() {
+		JPanel buttons = new JPanel();
+		for (final Object selection : getSelections()) {
+			buttons.add(new JButton(new AbstractAction("" + selection) {
+				public void actionPerformed(ActionEvent e) {
+					selectionManager.getDataflowSelectionModel(
+							currentDataflow).setSelection(
+							Collections.<Object> singleton(selection));
+				}
+			}));
+		}
+		return buttons;
+	}
+
+	protected void showFrame() {
+		JFrame frame = new JFrame(getClass().getName());
+		ContextualViewComponent contextualViewComponent = new ContextualViewComponent(editManager, selectionManager, contextualViewFactoryRegistry);
+		frame.add(contextualViewComponent, BorderLayout.CENTER);
+
+		frame.add(makeSelectionButtons(), BorderLayout.NORTH);
+		frame.setSize(400, 400);
+		frame.setVisible(true);
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/52fd79dd/taverna-loop-ui/src/test/resources/log4j.properties
----------------------------------------------------------------------
diff --git a/taverna-loop-ui/src/test/resources/log4j.properties b/taverna-loop-ui/src/test/resources/log4j.properties
new file mode 100644
index 0000000..850ede3
--- /dev/null
+++ b/taverna-loop-ui/src/test/resources/log4j.properties
@@ -0,0 +1,10 @@
+log4j.rootLogger=WARN, CONSOLE
+log4j.logger.net.sf.taverna.t2=INFO
+#log4j.logger.net.sf.taverna.t2.ui=DEBUG
+
+#log4j.logger.org.apache.commons.httpclient=ERROR
+
+# Default output to console
+log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
+log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
+log4j.appender.CONSOLE.layout.ConversionPattern=%-5p %d{ISO8601} (%c:%L) - %m%n
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/52fd79dd/taverna-menu-api/pom.xml
----------------------------------------------------------------------
diff --git a/taverna-menu-api/pom.xml b/taverna-menu-api/pom.xml
new file mode 100644
index 0000000..ad0e3d5
--- /dev/null
+++ b/taverna-menu-api/pom.xml
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+	<modelVersion>4.0.0</modelVersion>
+	<parent>
+		<groupId>org.apache.taverna.workbench</groupId>
+		<artifactId>taverna-workbench</artifactId>
+		<version>3.1.0-incubating-SNAPSHOT</version>
+	</parent>
+	<artifactId>menu-api</artifactId>
+	<packaging>bundle</packaging>
+	<name>Menu generation API</name>
+	<description>An SPI system for building UI menus</description>
+
+	<dependencies>
+		<dependency>
+			<groupId>${project.parent.groupId}</groupId>
+			<artifactId>selection-api</artifactId>
+			<version>${project.version}</version>
+		</dependency>
+
+		<dependency>
+			<groupId>net.sf.taverna.t2.lang</groupId>
+			<artifactId>taverna-observer</artifactId>
+		</dependency>
+	</dependencies>
+</project>

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/52fd79dd/taverna-menu-api/src/main/java/net/sf/taverna/t2/ui/menu/AbstractContextualMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-menu-api/src/main/java/net/sf/taverna/t2/ui/menu/AbstractContextualMenuAction.java b/taverna-menu-api/src/main/java/net/sf/taverna/t2/ui/menu/AbstractContextualMenuAction.java
new file mode 100644
index 0000000..7209cae
--- /dev/null
+++ b/taverna-menu-api/src/main/java/net/sf/taverna/t2/ui/menu/AbstractContextualMenuAction.java
@@ -0,0 +1,64 @@
+/**********************************************************************
+ * Copyright (C) 2007-2009 The University of Manchester   
+ * 
+ *  Modifications to the initial code base are copyright of their
+ *  respective authors, or their employers as appropriate.
+ * 
+ *  This program is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public License
+ *  as published by the Free Software Foundation; either version 2.1 of
+ *  the License, or (at your option) any later version.
+ *    
+ *  This program is distributed in the hope that it will be useful, but
+ *  WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *    
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ **********************************************************************/
+package net.sf.taverna.t2.ui.menu;
+
+import java.net.URI;
+
+/**
+ * An {@link AbstractMenuAction} that is {@link ContextualMenuComponent} aware.
+ * The contextual selection can be retrieved from
+ * {@link #getContextualSelection()}.
+ * <p>
+ * The cached action will be flushed everytime the contextual selection changes,
+ * forcing a new call to {@link #createAction()} - given that
+ * {@link #isEnabled()} returns true.
+ * 
+ * @author Stian Soiland-Reyes
+ */
+public abstract class AbstractContextualMenuAction extends AbstractMenuAction
+		implements ContextualMenuComponent {
+
+	private ContextualSelection contextualSelection;
+
+	public AbstractContextualMenuAction(URI parentId, int positionHint) {
+		super(parentId, positionHint);
+	}
+
+	public AbstractContextualMenuAction(URI parentId, int positionHint, URI id) {
+		super(parentId, positionHint, id);
+	}
+
+	public ContextualSelection getContextualSelection() {
+		return contextualSelection;
+	}
+
+	@Override
+	public boolean isEnabled() {
+		return contextualSelection != null;
+	}
+
+	@Override
+	public void setContextualSelection(ContextualSelection contextualSelection) {
+		this.contextualSelection = contextualSelection;
+		// Force new createAction() call
+		action = null;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/52fd79dd/taverna-menu-api/src/main/java/net/sf/taverna/t2/ui/menu/AbstractMenu.java
----------------------------------------------------------------------
diff --git a/taverna-menu-api/src/main/java/net/sf/taverna/t2/ui/menu/AbstractMenu.java b/taverna-menu-api/src/main/java/net/sf/taverna/t2/ui/menu/AbstractMenu.java
new file mode 100644
index 0000000..07eb8d2
--- /dev/null
+++ b/taverna-menu-api/src/main/java/net/sf/taverna/t2/ui/menu/AbstractMenu.java
@@ -0,0 +1,123 @@
+/*******************************************************************************
+ * Copyright (C) 2007 The University of Manchester   
+ * 
+ *  Modifications to the initial code base are copyright of their
+ *  respective authors, or their employers as appropriate.
+ * 
+ *  This program is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public License
+ *  as published by the Free Software Foundation; either version 2.1 of
+ *  the License, or (at your option) any later version.
+ *    
+ *  This program is distributed in the hope that it will be useful, but
+ *  WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *    
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ ******************************************************************************/
+package net.sf.taverna.t2.ui.menu;
+
+import static net.sf.taverna.t2.ui.menu.MenuComponent.MenuType.menu;
+
+import java.net.URI;
+
+import javax.swing.Action;
+
+/**
+ * A {@link MenuComponent} of the type {@link MenuType#menu menu}.
+ * <p>
+ * Subclass to create an SPI implementation for the {@link MenuManager} of a
+ * menu. The definition of "menu" includes both the menu bar and sub menus. A
+ * menu can contain {@linkplain AbstractMenuAction actions},
+ * {@linkplain AbstractMenuToggle toggles} or {@linkplain AbstractMenuCustom
+ * custom components}, or any of the above grouped in a
+ * {@linkplain AbstractMenuSection section},
+ * {@linkplain AbstractMenuOptionGroup option group} or a
+ * {@linkplain AbstractMenu submenu}.
+ * <p>
+ * Menu components are linked together using URIs, avoiding the need for compile
+ * time dependencies between SPI implementations. To add components to a menu,
+ * use the {@link URI} identifying this menu as their parent id.
+ * <p>
+ * <strong>Note:</strong> To avoid conflicts with other plugins, use a unique
+ * URI root that is related to the Java package name, for instance
+ * <code>http://cs.university.ac.uk/myplugin/2008/menu</code>, and use hash
+ * identifiers for each menu item, for instance
+ * <code>http://cs.university.ac.uk/myplugin/2008/menu#run</code> for a "Run"
+ * item. Use flat URI namespaces, don't base a child's URI on the parent's URI,
+ * as this might make it difficult to relocate the parent menu.
+ * <p>
+ * You need to list the {@linkplain Class#getName() fully qualified class name}
+ * (for example <code>com.example.t2plugin.menu.MyMenu</code>) of the menu
+ * implementation in the SPI description resource file
+ * <code>/META-INF/services/net.sf.taverna.t2.ui.menu.MenuComponent</code> so
+ * that it can be discovered by the {@link MenuManager}. This requirement also
+ * applies to parent menu components (except {@link DefaultToolBar} and
+ * {@link DefaultMenuBar}, but ensure they are only listed once.
+ * 
+ * @author Stian Soiland-Reyes
+ */
+public abstract class AbstractMenu extends AbstractMenuItem {
+	/**
+	 * Construct a menu bar (does not have a parent). This menu bar can be built
+	 * and used through {@link MenuManager#createMenuBar(URI)}. There is a
+	 * default menu bar implementation in {@link DefaultMenuBar} that can be
+	 * built using {@link MenuManager#createMenuBar()}, but in case you need
+	 * several menu bars for different windows or modes, use this constructor.
+	 * 
+	 * @param id
+	 *            The {@link URI} to identify this menu bar. Use this as the
+	 *            parent ID for menu components to appear in this menu.
+	 */
+	public AbstractMenu(URI id) {
+		super(menu, (URI) null, id);
+	}
+
+	/**
+	 * Construct a submenu.
+	 * 
+	 * @param parentId
+	 *            The {@link URI} of the parent menu. The parent should be of
+	 *            type
+	 *            {@link net.sf.taverna.t2.ui.menu.MenuComponent.MenuType#menu}.
+	 * @param positionHint
+	 *            The position hint to determine the position of this submenu
+	 *            among its siblings in the parent menu. For extensibility, use
+	 *            BASIC style numbering such as 10, 20, etc.
+	 * @param id
+	 *            The {@link URI} to identify this menu bar. Use this as the
+	 *            parent ID for menu components to appear in this submenu.
+	 * @param label
+	 *            The label for presenting this sub-menu in the parent menu.
+	 */
+	public AbstractMenu(URI parentId, int positionHint, URI id, String label) {
+		this(parentId, positionHint, id, new DummyAction(label));
+	}
+
+	/**
+	 * Construct a submenu.
+	 * 
+	 * @param parentId
+	 *            The {@link URI} of the parent menu. The parent should be of
+	 *            type
+	 *            {@link net.sf.taverna.t2.ui.menu.MenuComponent.MenuType#menu}.
+	 * @param positionHint
+	 *            The position hint to determine the position of this submenu
+	 *            among its siblings in the parent menu. For extensibility, use
+	 *            BASIC style numbering such as 10, 20, etc.
+	 * @param id
+	 *            The {@link URI} to identify this menu bar. Use this as the
+	 *            parent ID for menu components to appear in this submenu.
+	 * @param action
+	 *            The action containing a label and icon for presenting this
+	 *            sub-menu in the parent menu.
+	 */
+	public AbstractMenu(URI parentId, int positionHint, URI id, Action action) {
+		super(menu, parentId, id);
+		this.action = action;
+		this.positionHint = positionHint;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/52fd79dd/taverna-menu-api/src/main/java/net/sf/taverna/t2/ui/menu/AbstractMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-menu-api/src/main/java/net/sf/taverna/t2/ui/menu/AbstractMenuAction.java b/taverna-menu-api/src/main/java/net/sf/taverna/t2/ui/menu/AbstractMenuAction.java
new file mode 100644
index 0000000..446a2ec
--- /dev/null
+++ b/taverna-menu-api/src/main/java/net/sf/taverna/t2/ui/menu/AbstractMenuAction.java
@@ -0,0 +1,135 @@
+/*******************************************************************************
+ * Copyright (C) 2007 The University of Manchester   
+ * 
+ *  Modifications to the initial code base are copyright of their
+ *  respective authors, or their employers as appropriate.
+ * 
+ *  This program is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public License
+ *  as published by the Free Software Foundation; either version 2.1 of
+ *  the License, or (at your option) any later version.
+ *    
+ *  This program is distributed in the hope that it will be useful, but
+ *  WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *    
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ ******************************************************************************/
+package net.sf.taverna.t2.ui.menu;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.net.URI;
+
+import javax.swing.AbstractAction;
+import javax.swing.Action;
+
+/**
+ * A {@link MenuComponent} of the type {@link MenuType#action action}.
+ * <p>
+ * Subclass to create an SPI implementation for the {@link MenuManager} of an
+ * action. An action is an item within a menu or toolbar that can be
+ * clicked/selected to invoke some action.
+ * <p>
+ * This action can have as an parent a {@linkplain AbstractMenu menu} or
+ * {@linkplain AbstractToolBar toolbar}, or grouped within an
+ * {@linkplain AbstractMenuSection section} or
+ * {@linkplain AbstractMenuOptionGroup option group}.
+ * <p>
+ * To define the {@link Action}, implement {@link #createAction()}. The action
+ * should provide both the label/icon (representation) and
+ * {@link ActionListener#actionPerformed(ActionEvent)}.
+ * <p>
+ * You need to list the {@linkplain Class#getName() fully qualified class name}
+ * (for example <code>com.example.t2plugin.menu.MyMenuAction</code>) of the menu
+ * action implementation in the SPI description resource file
+ * <code>/META-INF/services/net.sf.taverna.t2.ui.menu.MenuComponent</code> so
+ * that it can be discovered by the {@link MenuManager}. This requirement also
+ * applies to parent menu components (except {@link DefaultToolBar} and
+ * {@link DefaultMenuBar}, but ensure they are only listed once.
+ * 
+ * @author Stian Soiland-Reyes
+ */
+public abstract class AbstractMenuAction extends AbstractMenuItem {
+	/**
+	 * Construct a menu action to appear within the specified menu component.
+	 * 
+	 * @param parentId
+	 *            The {@link URI} of the parent menu component. The component
+	 *            should be a {@linkplain MenuComponent.MenuType#isParentType()
+	 *            parent type} and must have been registered separately as an
+	 *            SPI.
+	 * @param positionHint
+	 *            The position hint to determine the position of this action
+	 *            among its siblings in the parent menu, section or toolbar. For
+	 *            extensibility, use BASIC style numbering such as 10, 20, etc.
+	 *            (Note that position hints are local to each parent, so each
+	 *            {@linkplain AbstractMenuSection section} have their own
+	 *            position hint scheme.)
+	 */
+	public AbstractMenuAction(URI parentId, int positionHint) {
+		this(parentId, positionHint, null);
+	}
+
+	/**
+	 * Construct a menu action to appear within the specified menu component.
+	 * 
+	 * @param parentId
+	 *            The {@link URI} of the parent menu component. The component
+	 *            should be a {@linkplain MenuComponent.MenuType#isParentType()
+	 *            parent type} and must have been registered separately as an
+	 *            SPI.
+	 * @param positionHint
+	 *            The position hint to determine the position of this action
+	 *            among its siblings in the parent menu, section or toolbar. For
+	 *            extensibility, use BASIC style numbering such as 10, 20, etc.
+	 *            (Note that position hints are local to each parent, so each
+	 *            {@linkplain AbstractMenuSection section} have their own
+	 *            position hint scheme.)
+	 * @param id
+	 *            The {@link URI} to identify this action. Although no
+	 *            components can have an action as their parent, this URI can be
+	 *            used to retrieve the realisation of this component using
+	 *            {@link MenuManager#getComponentByURI(URI)}. This ID might also
+	 *            be registered as a help identifier with the help system.
+	 */
+	public AbstractMenuAction(URI parentId, int positionHint, URI id) {
+		super(MenuType.action, parentId, id);
+		this.positionHint = positionHint;
+	}
+
+	/**
+	 * Call {@link #createAction()} on first call, after that return cached
+	 * action.
+	 * 
+	 * @see #createAction()
+	 */
+	@Override
+	public synchronized Action getAction() {
+		if (action == null)
+			action = createAction();
+		return action;
+	}
+
+	/**
+	 * Create the {@link Action} that labels this menu action, in addition to
+	 * performing the desired action on
+	 * {@link ActionListener#actionPerformed(ActionEvent)}.
+	 * <p>
+	 * This method will be called by {@link #getAction()} on the first call.
+	 * Concurrent calls to <tt>getAction()</tt> will return the same action.
+	 * <p>
+	 * Implementations might use {@link AbstractAction} as a superclass for menu
+	 * actions. It is recommended to make the action a top level class so that
+	 * it can be used both within an {@link AbstractMenuAction} of a menu bar
+	 * and within an {@link AbstractMenuAction} of a tool bar.
+	 * 
+	 * @see #getAction()
+	 * @return A configured {@link Action} that should at least have a label or
+	 *         icon.
+	 */
+	protected abstract Action createAction();
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/52fd79dd/taverna-menu-api/src/main/java/net/sf/taverna/t2/ui/menu/AbstractMenuCustom.java
----------------------------------------------------------------------
diff --git a/taverna-menu-api/src/main/java/net/sf/taverna/t2/ui/menu/AbstractMenuCustom.java b/taverna-menu-api/src/main/java/net/sf/taverna/t2/ui/menu/AbstractMenuCustom.java
new file mode 100644
index 0000000..9a64130
--- /dev/null
+++ b/taverna-menu-api/src/main/java/net/sf/taverna/t2/ui/menu/AbstractMenuCustom.java
@@ -0,0 +1,144 @@
+/*******************************************************************************
+ * Copyright (C) 2007 The University of Manchester   
+ * 
+ *  Modifications to the initial code base are copyright of their
+ *  respective authors, or their employers as appropriate.
+ * 
+ *  This program is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public License
+ *  as published by the Free Software Foundation; either version 2.1 of
+ *  the License, or (at your option) any later version.
+ *    
+ *  This program is distributed in the hope that it will be useful, but
+ *  WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *    
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ ******************************************************************************/
+package net.sf.taverna.t2.ui.menu;
+
+import java.awt.Component;
+import java.net.URI;
+
+import javax.swing.JButton;
+import javax.swing.JMenu;
+import javax.swing.JMenuItem;
+
+/**
+ * A {@link MenuComponent} of the type {@link MenuType#custom}.
+ * <p>
+ * Subclass to create an SPI implementation for the {@link MenuManager} of a
+ * custom menu or toolbar {@link Component}, for instance a {@link JMenu},
+ * {@link JMenuItem} or {@link JButton}.
+ * <p>
+ * This type of component can be useful for adding third party components that
+ * are built using other menu systems, or to provide dynamic menus such as a
+ * list of open files. This is the recommended way to customise the menus,
+ * although it is also possible to modify the components returned using
+ * {@link MenuManager#getComponentByURI(URI)}, but as the components built by
+ * the menu manager might be refreshed by various actions forcing an update to
+ * the SPI registry, such as installing a plugin. By using a custom menu
+ * component it is possible to avoid these problems and to provide the
+ * {@link Component} to be inserted into the menu/toolbar as built by the
+ * {@link MenuManager}.
+ * <p>
+ * This component can have as an parent any menu component that
+ * {@linkplain MenuType#isParentType() is a parent type}. Note that although you
+ * can specify an {@link URI} to identify the custom component (to be used with
+ * {@link MenuManager#getComponentByURI(URI)} a custom component can't have
+ * children. Such children would have to be created manually and added to the
+ * component.
+ * <p>
+ * You need to list the {@linkplain Class#getName() fully qualified class name}
+ * (for example <code>com.example.t2plugin.menu.MyMenuAction</code>) of the menu
+ * action implementation in the SPI description resource file
+ * <code>/META-INF/services/net.sf.taverna.t2.ui.menu.MenuComponent</code> so
+ * that it can be discovered by the {@link MenuManager}. This requirement also
+ * applies to parent menu components (except {@link DefaultToolBar} and
+ * {@link DefaultMenuBar}, but ensure they are only listed once.
+ * 
+ * @author Stian Soiland-Reyes
+ */
+public abstract class AbstractMenuCustom extends AbstractMenuItem {
+	/**
+	 * Construct a menu action to appear within the specified menu component.
+	 * 
+	 * @param parentId
+	 *            The {@link URI} of the parent menu component. The component
+	 *            should be a {@link MenuType#isParentType() parent type} and
+	 *            must have been registered separately as an SPI.
+	 * @param positionHint
+	 *            The position hint to determine the position of this action
+	 *            among its siblings in the parent menu, section or toolbar. For
+	 *            extensibility, use BASIC style numbering such as 10, 20, etc.
+	 *            (Note that position hints are local to each parent, so each
+	 *            {@linkplain AbstractMenuSection section} have their own
+	 *            position hint scheme.)
+	 */
+	public AbstractMenuCustom(URI parentId, int positionHint) {
+		this(parentId, positionHint, null);
+	}
+
+	/**
+	 * Construct a menu action to appear within the specified menu component.
+	 * 
+	 * @param parentId
+	 *            The {@link URI} of the parent menu component. The component
+	 *            should be a {@linkplain MenuType#isParentType() parent type}
+	 *            and must have been registered separately as an SPI.
+	 * @param positionHint
+	 *            The position hint to determine the position of this action
+	 *            among its siblings in the parent menu, section or toolbar. For
+	 *            extensibility, use BASIC style numbering such as 10, 20, etc.
+	 *            (Note that position hints are local to each parent, so each
+	 *            {@linkplain AbstractMenuSection section} have their own
+	 *            position hint scheme.)
+	 * @param id
+	 *            The {@link URI} to identify this action. Although no
+	 *            components can have an action as their parent, this URI can be
+	 *            used to retrieve the realisation of this component using
+	 *            {@link MenuManager#getComponentByURI(URI)}. This ID might also
+	 *            be registered as a help identifier with the help system.
+	 */
+	public AbstractMenuCustom(URI parentId, int positionHint, URI id) {
+		super(MenuType.custom, parentId, id);
+		this.positionHint = positionHint;
+	}
+
+	/**
+	 * Create the {@link Component} that is to be added to the parent.
+	 * <p>
+	 * The component must be compatible with the parent realisation from the
+	 * {@link MenuManager}, for instance you can't add {@link JMenuItem}s to a
+	 * toolbar.
+	 * </p>
+	 * <p>
+	 * Note that the component might get assigned new parents if the
+	 * menues/toolbars are rebuilt by the {@link MenuManager} is refreshed,
+	 * although the menu manager will try to avoid a second call to
+	 * {@link #createCustomComponent()}.
+	 * </p>
+	 * 
+	 * @return A custom {@link Component} such as {@link JMenu},
+	 *         {@link JMenuItem} or {@link JButton} to be added to the parent
+	 *         menu component.
+	 */
+	protected abstract Component createCustomComponent();
+
+	/**
+	 * Return the custom component created using
+	 * {@link #createCustomComponent()} on first call, return cached instance on
+	 * later calls.
+	 * 
+	 * {@inheritDoc}
+	 */
+	@Override
+	public final synchronized Component getCustomComponent() {
+		if (customComponent == null)
+			customComponent = createCustomComponent();
+		return customComponent;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/52fd79dd/taverna-menu-api/src/main/java/net/sf/taverna/t2/ui/menu/AbstractMenuItem.java
----------------------------------------------------------------------
diff --git a/taverna-menu-api/src/main/java/net/sf/taverna/t2/ui/menu/AbstractMenuItem.java b/taverna-menu-api/src/main/java/net/sf/taverna/t2/ui/menu/AbstractMenuItem.java
new file mode 100644
index 0000000..63b6c78
--- /dev/null
+++ b/taverna-menu-api/src/main/java/net/sf/taverna/t2/ui/menu/AbstractMenuItem.java
@@ -0,0 +1,144 @@
+/*******************************************************************************
+ * Copyright (C) 2007 The University of Manchester   
+ * 
+ *  Modifications to the initial code base are copyright of their
+ *  respective authors, or their employers as appropriate.
+ * 
+ *  This program is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public License
+ *  as published by the Free Software Foundation; either version 2.1 of
+ *  the License, or (at your option) any later version.
+ *    
+ *  This program is distributed in the hope that it will be useful, but
+ *  WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *    
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ ******************************************************************************/
+package net.sf.taverna.t2.ui.menu;
+
+import java.awt.Component;
+import java.awt.event.ActionEvent;
+import java.net.URI;
+
+import javax.swing.AbstractAction;
+import javax.swing.Action;
+import javax.swing.Icon;
+
+/**
+ * An abstract implementation of {@link MenuComponent} that can be used by
+ * convenience to create menu component SPIs for the {@link MenuManager}.
+ * <p>
+ * Abstract subclasses of this class are specialised by their
+ * {@link net.sf.taverna.t2.ui.menu.MenuComponent.MenuType}. To create a menu,
+ * toolbar, section, action etc, create an SPI implementation by subclassing
+ * depending on the required type:
+ * </p>
+ * <dl>
+ * <dt> {@link net.sf.taverna.t2.ui.menu.MenuComponent.MenuType#menu}</dt>
+ * <dd>Subclass {@link AbstractMenu}</dd>
+ * 
+ * <dt> {@link net.sf.taverna.t2.ui.menu.MenuComponent.MenuType#toolBar}</dt>
+ * <dd>Subclass {@link AbstractToolBar}</dd>
+ * 
+ * <dt> {@link net.sf.taverna.t2.ui.menu.MenuComponent.MenuType#section}</dt>
+ * <dd>Subclass {@link AbstractMenuSection}</dd>
+ * 
+ * <dt> {@link net.sf.taverna.t2.ui.menu.MenuComponent.MenuType#action}</dt>
+ * <dd>Subclass {@link AbstractMenuAction}</dd>
+ * 
+ * <dt> {@link net.sf.taverna.t2.ui.menu.MenuComponent.MenuType#toggle}</dt>
+ * <dd>Subclass {@link AbstractMenuToggle}</dd>
+ * 
+ * <dt> {@link net.sf.taverna.t2.ui.menu.MenuComponent.MenuType#custom}</dt>
+ * <dd>Subclass {@link AbstractMenuCustom}</dd>
+ * 
+ * <dt> {@link net.sf.taverna.t2.ui.menu.MenuComponent.MenuType#optionGroup}</dt>
+ * <dd>Subclass {@link AbstractMenuOptionGroup}</dd>
+ * 
+ * </dl>
+ * <p>
+ * Note that you are not required to subclass any of these as long as your SPI
+ * implementations implement the {@link MenuComponent} interface. In all cases
+ * you are still required to list all your implementations, including
+ * intermediate menus and sections, in the SPI description resource file
+ * <code>/META-INF/services/net.sf.taverna.t2.ui.menu.MenuComponent</code>
+ * </p>
+ * 
+ * @author Stian Soiland-Reyes
+ * 
+ */
+public abstract class AbstractMenuItem implements MenuComponent {
+	/**
+	 * An {@link Action} that does not perform any action, but only contains a
+	 * name and icon. Used by {@link AbstractMenu} and others.
+	 * 
+	 * @author Stian Soiland-Reyes
+	 * 
+	 */
+	@SuppressWarnings("serial")
+	public static class DummyAction extends AbstractAction {
+		public DummyAction(String name) {
+			super(name);
+		}
+
+		public DummyAction(String name, Icon icon) {
+			super(name, icon);
+		}
+
+		@Override
+		public void actionPerformed(ActionEvent e) {
+		}
+	}
+
+	public AbstractMenuItem(MenuType type, URI parentId, URI id) {
+		this.type = type;
+		this.parentId = parentId;
+		this.id = id;
+	}
+
+	private final MenuType type;
+	private final URI parentId;
+	private final URI id;
+	protected int positionHint = 100;
+	protected Action action;
+	protected Component customComponent;
+
+	@Override
+	public Action getAction() {
+		return action;
+	}
+
+	@Override
+	public Component getCustomComponent() {
+		return customComponent;
+	}
+
+	@Override
+	public URI getId() {
+		return id;
+	}
+
+	@Override
+	public URI getParentId() {
+		return parentId;
+	}
+
+	@Override
+	public int getPositionHint() {
+		return positionHint;
+	}
+
+	@Override
+	public MenuType getType() {
+		return type;
+	}
+
+	@Override
+	public boolean isEnabled() {
+		return true;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/52fd79dd/taverna-menu-api/src/main/java/net/sf/taverna/t2/ui/menu/AbstractMenuOptionGroup.java
----------------------------------------------------------------------
diff --git a/taverna-menu-api/src/main/java/net/sf/taverna/t2/ui/menu/AbstractMenuOptionGroup.java b/taverna-menu-api/src/main/java/net/sf/taverna/t2/ui/menu/AbstractMenuOptionGroup.java
new file mode 100644
index 0000000..091cc23
--- /dev/null
+++ b/taverna-menu-api/src/main/java/net/sf/taverna/t2/ui/menu/AbstractMenuOptionGroup.java
@@ -0,0 +1,79 @@
+/*******************************************************************************
+ * Copyright (C) 2007 The University of Manchester   
+ * 
+ *  Modifications to the initial code base are copyright of their
+ *  respective authors, or their employers as appropriate.
+ * 
+ *  This program is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public License
+ *  as published by the Free Software Foundation; either version 2.1 of
+ *  the License, or (at your option) any later version.
+ *    
+ *  This program is distributed in the hope that it will be useful, but
+ *  WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *    
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ ******************************************************************************/
+package net.sf.taverna.t2.ui.menu;
+
+import java.net.URI;
+
+/**
+ * A {@link MenuComponent} of the type {@link MenuType#optionGroup}.
+ * <p>
+ * Subclass to create an SPI implementation for the {@link MenuManager} of an
+ * option group. An option group is similar to a
+ * {@linkplain AbstractMenuSection section}, but enforces that only one of the
+ * children are selected at any time.
+ * <p>
+ * Menu components are linked together using URIs, avoiding the need for compile
+ * time dependencies between SPI implementations. To add actions or toggles to
+ * an option group, use the {@link URI} identifying this section as their parent
+ * id.
+ * <p>
+ * <strong>Note:</strong> To avoid conflicts with other plugins, use a unique
+ * URI root that is related to the Java package name, for instance
+ * <code>http://cs.university.ac.uk/myplugin/2008/menu</code>, and use hash
+ * identifiers for each menu item, for instance
+ * <code>http://cs.university.ac.uk/myplugin/2008/menu#run</code> for a "Run"
+ * item. Use flat URI namespaces, don't base a child's URI on the parent's URI,
+ * as this might make it difficult to relocate the parent menu.
+ * <p>
+ * You need to list the {@linkplain Class#getName() fully qualified class name}
+ * (for example <code>com.example.t2plugin.menu.MyMenu</code>) of the option
+ * group implementation in the SPI description resource file
+ * <code>/META-INF/services/net.sf.taverna.t2.ui.menu.MenuComponent</code> so
+ * that it can be discovered by the {@link MenuManager}. This requirement also
+ * applies to parent menu components (except {@link DefaultToolBar} and
+ * {@link DefaultMenuBar}, but ensure they are only listed once.
+ * 
+ * @author Stian Soiland-Reyes
+ */
+public abstract class AbstractMenuOptionGroup extends AbstractMenuItem {
+	/**
+	 * Construct an option group.
+	 * 
+	 * @param parentId
+	 *            The {@link URI} of the parent menu component. The parent
+	 *            should be of type {@link MenuType#menu} or
+	 *            {@link MenuType#toolBar}.
+	 * @param positionHint
+	 *            The position hint to determine the position of this option
+	 *            group among its siblings in the parent menu. For
+	 *            extensibility, use BASIC style numbering such as 10, 20, etc.
+	 *            (Note that position hints are local to each parent, so each
+	 *            option group have their own position hint scheme for their
+	 *            children.)
+	 * @param id
+	 *            The {@link URI} to identify this option group. Use this as the
+	 *            parent ID for menu components to appear in this option group.
+	 */
+	public AbstractMenuOptionGroup(URI parentId, int positionHint, URI id) {
+		super(MenuType.optionGroup, parentId, id);
+		this.positionHint = positionHint;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/52fd79dd/taverna-menu-api/src/main/java/net/sf/taverna/t2/ui/menu/AbstractMenuSection.java
----------------------------------------------------------------------
diff --git a/taverna-menu-api/src/main/java/net/sf/taverna/t2/ui/menu/AbstractMenuSection.java b/taverna-menu-api/src/main/java/net/sf/taverna/t2/ui/menu/AbstractMenuSection.java
new file mode 100644
index 0000000..2e649e0
--- /dev/null
+++ b/taverna-menu-api/src/main/java/net/sf/taverna/t2/ui/menu/AbstractMenuSection.java
@@ -0,0 +1,113 @@
+/*******************************************************************************
+ * Copyright (C) 2007-2009 The University of Manchester   
+ * 
+ *  Modifications to the initial code base are copyright of their
+ *  respective authors, or their employers as appropriate.
+ * 
+ *  This program is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public License
+ *  as published by the Free Software Foundation; either version 2.1 of
+ *  the License, or (at your option) any later version.
+ *    
+ *  This program is distributed in the hope that it will be useful, but
+ *  WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *    
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ ******************************************************************************/
+package net.sf.taverna.t2.ui.menu;
+
+import java.awt.Color;
+import java.net.URI;
+
+import javax.swing.AbstractAction;
+import javax.swing.Action;
+
+/**
+ * A {@link MenuComponent} of the type {@link MenuType#section}.
+ * <p>
+ * Subclass to create an SPI implementation for the {@link MenuManager} of a
+ * section. A section is a part of a {@linkplain AbstractMenu menu} or
+ * {@linkplain AbstractToolBar toolbar} that group together
+ * {@linkplain AbstractMenuAction actions} or {@linkplain AbstractMenuToggle
+ * toggles}, and separates them from siblings using separators if needed.
+ * <p>
+ * Menu components are linked together using URIs, avoiding the need for compile
+ * time dependencies between SPI implementations. To add actions to a section,
+ * use the {@link URI} identifying this section as their parent id.
+ * <p>
+ * <strong>Note:</strong> To avoid conflicts with other plugins, use a unique
+ * URI root that is related to the Java package name, for instance
+ * <code>http://cs.university.ac.uk/myplugin/2008/menu</code>, and use hash
+ * identifiers for each menu item, for instance
+ * <code>http://cs.university.ac.uk/myplugin/2008/menu#run</code> for a "Run"
+ * item. Use flat URI namespaces, don't base a child's URI on the parent's URI,
+ * as this might make it difficult to relocate the parent menu.
+ * <p>
+ * You need to list the {@linkplain Class#getName() fully qualified class name}
+ * (for example <code>com.example.t2plugin.menu.MyMenu</code>) of the section
+ * implementation in the SPI description resource file
+ * <code>/META-INF/services/net.sf.taverna.t2.ui.menu.MenuComponent</code> so
+ * that it can be discovered by the {@link MenuManager}. This requirement also
+ * applies to parent menu components (except {@link DefaultToolBar} and
+ * {@link DefaultMenuBar}, but ensure they are only listed once.
+ * 
+ * @author Stian Soiland-Reyes
+ */
+public abstract class AbstractMenuSection extends AbstractMenuItem {
+	public static final String SECTION_COLOR = "sectionColor";
+
+	/**
+	 * Construct a menu section.
+	 * 
+	 * @param parentId
+	 *            The {@link URI} of the parent menu component. The parent
+	 *            should be of type {@link MenuType#menu} or
+	 *            {@link MenuType#toolBar}.
+	 * @param positionHint
+	 *            The position hint to determine the position of this section
+	 *            among its siblings in the parent menu. For extensibility, use
+	 *            BASIC style numbering such as 10, 20, etc. (Note that position
+	 *            hints are local to each parent, so each section have their own
+	 *            position hint scheme for their children.)
+	 * @param id
+	 *            The {@link URI} to identify this menu section. Use this as the
+	 *            parent ID for menu components to appear in this section.
+	 */
+	public AbstractMenuSection(URI parentId, int positionHint, URI id) {
+		super(MenuType.section, parentId, id);
+		this.positionHint = positionHint;
+	}
+
+	@Override
+	public synchronized Action getAction() {
+		if (action == null)
+			action = createAction();
+		return action;
+	}
+
+	/**
+	 * (Optionally) Create the {@link Action} that labels this section.
+	 * <p>
+	 * The actual action will be ignored, but the label and/or icon will be used
+	 * as a section header in the menu. If the property {@link #SECTION_COLOR}
+	 * has been defined in the action, that {@link Color} will be used to make
+	 * the section background.
+	 * <p>
+	 * The default implementation of this method returns <code>null</code>,
+	 * meaning that no section header will be created - instead a simple line
+	 * will separate this section from the items above (if needed).
+	 * <p>
+	 * Implementations might use {@link AbstractAction} as a superclass for menu
+	 * actions.
+	 * 
+	 * @return A configured {@link Action} that should at least have a label or
+	 *         icon.
+	 */
+	protected Action createAction() {
+		return null;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/52fd79dd/taverna-menu-api/src/main/java/net/sf/taverna/t2/ui/menu/AbstractMenuToggle.java
----------------------------------------------------------------------
diff --git a/taverna-menu-api/src/main/java/net/sf/taverna/t2/ui/menu/AbstractMenuToggle.java b/taverna-menu-api/src/main/java/net/sf/taverna/t2/ui/menu/AbstractMenuToggle.java
new file mode 100644
index 0000000..97e977d
--- /dev/null
+++ b/taverna-menu-api/src/main/java/net/sf/taverna/t2/ui/menu/AbstractMenuToggle.java
@@ -0,0 +1,132 @@
+/*******************************************************************************
+ * Copyright (C) 2007 The University of Manchester   
+ * 
+ *  Modifications to the initial code base are copyright of their
+ *  respective authors, or their employers as appropriate.
+ * 
+ *  This program is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public License
+ *  as published by the Free Software Foundation; either version 2.1 of
+ *  the License, or (at your option) any later version.
+ *    
+ *  This program is distributed in the hope that it will be useful, but
+ *  WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *    
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ ******************************************************************************/
+package net.sf.taverna.t2.ui.menu;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.net.URI;
+
+import javax.swing.AbstractAction;
+import javax.swing.Action;
+
+/**
+ * A {@link MenuComponent} of the type {@link MenuType#toggle}.
+ * <p>
+ * Subclass to create an SPI implementation for the {@link MenuManager} of an
+ * toggle action. A toggle is a menu item that can be turned on/off and are
+ * typically represented with a check box when they are enabled.
+ * <p>
+ * This action can have as an parent a {@linkplain AbstractMenu menu} or
+ * {@linkplain AbstractToolBar toolbar}, or grouped within a
+ * {@linkplain AbstractMenuSection section} or
+ * {@linkplain AbstractMenuOptionGroup option group}.
+ * <p>
+ * To define the {@link Action}, implement {@link #createAction()}. The action
+ * should provide both the label/icon (representation) and
+ * {@link ActionListener#actionPerformed(ActionEvent)}.
+ * <p>
+ * You need to list the {@linkplain Class#getName() fully qualified class name}
+ * (for example <code>com.example.t2plugin.menu.MyMenuAction</code>) of the menu
+ * action implementation in the SPI description resource file
+ * <code>/META-INF/services/net.sf.taverna.t2.ui.menu.MenuComponent</code> so
+ * that it can be discovered by the {@link MenuManager}. This requirement also
+ * applies to parent menu components (except {@link DefaultToolBar} and
+ * {@link DefaultMenuBar}, but ensure they are only listed once.
+ * 
+ * @author Stian Soiland-Reyes
+ */
+public abstract class AbstractMenuToggle extends AbstractMenuItem {
+	/**
+	 * Construct a toggle action to appear within the specified menu component.
+	 * 
+	 * @param parentId
+	 *            The {@link URI} of the parent menu component. The component
+	 *            should be a {@linkplain MenuType#isParentType() parent type}
+	 *            and must have been registered separately as an SPI.
+	 * @param positionHint
+	 *            The position hint to determine the position of this toggle
+	 *            action among its siblings in the parent menu, section or
+	 *            toolbar. For extensibility, use BASIC style numbering such as
+	 *            10, 20, etc. (Note that position hints are local to each
+	 *            parent, so each {@linkplain AbstractMenuSection section} have
+	 *            their own position hint scheme.)
+	 */
+	public AbstractMenuToggle(URI parentId, int positionHint) {
+		this(parentId, null, positionHint);
+	}
+
+	/**
+	 * Construct a toggle action to appear within the specified menu component.
+	 * 
+	 * @param parentId
+	 *            The {@link URI} of the parent menu component. The component
+	 *            should be a {@link MenuType#isParentType() parent type} and
+	 *            must have been registered separately as an SPI.
+	 * @param id
+	 *            The {@link URI} to identify this toggle action. Although no
+	 *            components can have an action as their parent, this URI can be
+	 *            used to retrieve the realisation of this component using
+	 *            {@link MenuManager#getComponentByURI(URI)}. This ID might also
+	 *            be registered as a help identifier with the help system.
+	 * @param positionHint
+	 *            The position hint to determine the position of this action
+	 *            among its siblings in the parent menu, section or toolbar. For
+	 *            extensibility, use BASIC style numbering such as 10, 20, etc.
+	 *            (Note that position hints are local to each parent, so each
+	 *            {@linkplain AbstractMenuSection section} have their own
+	 *            position hint scheme.)
+	 */
+	public AbstractMenuToggle(URI parentId, URI id, int positionHint) {
+		super(MenuType.toggle, parentId, id);
+		this.positionHint = positionHint;
+	}
+
+	/**
+	 * Call {@link #createAction()} on first call, after that return cached
+	 * action.
+	 * 
+	 * @see #createAction()
+	 * 
+	 *      {@inheritDoc}
+	 */
+	@Override
+	public synchronized Action getAction() {
+		if (action == null)
+			action = createAction();
+		return action;
+	}
+
+	/**
+	 * Create the {@link Action} that labels this toggle action, in addition to
+	 * performing the desired action on
+	 * {@link ActionListener#actionPerformed(ActionEvent)}.
+	 * <p>
+	 * Implementations might use {@link AbstractAction} as a superclass for menu
+	 * actions. It is recommended to make the action a top level class so that
+	 * it can be used both within an {@link AbstractMenuAction} of a menu bar
+	 * and within an {@link AbstractMenuAction} of a tool bar.
+	 * </p>
+	 * 
+	 * @return A configured {@link Action} that should at least have a label or
+	 *         icon.
+	 */
+	protected abstract Action createAction();
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/52fd79dd/taverna-menu-api/src/main/java/net/sf/taverna/t2/ui/menu/AbstractToolBar.java
----------------------------------------------------------------------
diff --git a/taverna-menu-api/src/main/java/net/sf/taverna/t2/ui/menu/AbstractToolBar.java b/taverna-menu-api/src/main/java/net/sf/taverna/t2/ui/menu/AbstractToolBar.java
new file mode 100644
index 0000000..234ea75
--- /dev/null
+++ b/taverna-menu-api/src/main/java/net/sf/taverna/t2/ui/menu/AbstractToolBar.java
@@ -0,0 +1,74 @@
+/*******************************************************************************
+ * Copyright (C) 2007 The University of Manchester   
+ * 
+ *  Modifications to the initial code base are copyright of their
+ *  respective authors, or their employers as appropriate.
+ * 
+ *  This program is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public License
+ *  as published by the Free Software Foundation; either version 2.1 of
+ *  the License, or (at your option) any later version.
+ *    
+ *  This program is distributed in the hope that it will be useful, but
+ *  WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *    
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ ******************************************************************************/
+package net.sf.taverna.t2.ui.menu;
+
+import java.net.URI;
+
+/**
+ * A {@link MenuComponent} of the type {@link MenuType#toolBar}.
+ * <p>
+ * Subclass to create an SPI implementation for the {@link MenuManager} of a
+ * toolbar. A toolbar can contain {@linkplain AbstractMenuAction actions},
+ * {@linkplain AbstractMenuToggle toggles} or {@linkplain AbstractMenuCustom
+ * custom components}, or any of the above grouped in a
+ * {@linkplain AbstractMenuSection section} or an
+ * {@linkplain AbstractMenuOptionGroup option group}.
+ * <p>
+ * The {@link DefaultToolBar default toolbar} can be used as a parent for items
+ * that are to be returned in the toolbar {@link MenuManager#createToolBar()},
+ * while toolbars from other instances of AbstractToolBar can be created using
+ * {@link MenuManager#createToolBar(URI)} specifying the URI of the toolbar's
+ * identifier.
+ * <p>
+ * Menu components are linked together using URIs, avoiding the need for compile
+ * time dependencies between SPI implementations. To add components to a
+ * toolbar, use the {@link URI} identifying this toolbar as their parent id.
+ * <p>
+ * <strong>Note:</strong> To avoid conflicts with other plugins, use a unique
+ * URI root that is related to the Java package name, for instance
+ * <code>http://cs.university.ac.uk/myplugin/2008/menu</code>, and use hash
+ * identifiers for each menu item, for instance
+ * <code>http://cs.university.ac.uk/myplugin/2008/menu#run</code> for a "Run"
+ * item. Use flat URI namespaces, don't base a child's URI on the parent's URI,
+ * as this might make it difficult to relocate the parent menu.
+ * <p>
+ * You need to list the {@linkplain Class#getName() fully qualified class name}
+ * (for example <code>com.example.t2plugin.menu.MyMenu</code>) of the toolbar
+ * implementation in the SPI description resource file
+ * <code>/META-INF/services/net.sf.taverna.t2.ui.menu.MenuComponent</code> so
+ * that it can be discovered by the {@link MenuManager}. This requirement also
+ * applies to parent menu components (except {@link DefaultToolBar} and
+ * {@link DefaultMenuBar}, but ensure they are only listed once.
+ * 
+ * @author Stian Soiland-Reyes
+ */
+public abstract class AbstractToolBar extends AbstractMenuItem {
+	/**
+	 * Construct a toolbar with the given {@link URI} as identifier.
+	 * 
+	 * @param id
+	 *            The {@link URI} to identify this toolbar. Use this as the
+	 *            parent ID for menu components to appear in this toolbar.
+	 */
+	public AbstractToolBar(URI id) {
+		super(MenuType.toolBar, null, id);
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/52fd79dd/taverna-menu-api/src/main/java/net/sf/taverna/t2/ui/menu/ContextualMenuComponent.java
----------------------------------------------------------------------
diff --git a/taverna-menu-api/src/main/java/net/sf/taverna/t2/ui/menu/ContextualMenuComponent.java b/taverna-menu-api/src/main/java/net/sf/taverna/t2/ui/menu/ContextualMenuComponent.java
new file mode 100644
index 0000000..080beb1
--- /dev/null
+++ b/taverna-menu-api/src/main/java/net/sf/taverna/t2/ui/menu/ContextualMenuComponent.java
@@ -0,0 +1,35 @@
+package net.sf.taverna.t2.ui.menu;
+
+import java.awt.Component;
+
+/**
+ * A contextual menu component.
+ * <p>
+ * A {@link MenuComponent} that also implements ContextualMenuComponent, when
+ * included in a menu tree rooted in the {@link DefaultContextualMenu} and
+ * retrieved using
+ * {@link MenuManager#createContextMenu(Object, Object, Component)}, will be
+ * {@linkplain #setContextualSelection(ContextualSelection) informed} before
+ * calls to {@link #isEnabled()} or {@link #getAction()}.
+ * <p>
+ * In this way the contextual menu item can be visible for only certain
+ * selections, and its action can be bound to the current selection.
+ * <p>
+ * Contextual menu components can be grouped by {@linkplain AbstractMenuSection
+ * sections} and {@linkplain AbstractMenu sub-menus}, or directly have the
+ * {@link DefaultContextualMenu} as the parent.
+ * 
+ * @see ContextualSelection
+ * @see DefaultContextualMenu
+ * @author Stian Soiland-Reyes
+ */
+public interface ContextualMenuComponent extends MenuComponent {
+	/**
+	 * Set the contextual selection, or <code>null</code> if there is no current
+	 * selection (if the menu item was not included in a contextual menu).
+	 * 
+	 * @param contextualSelection
+	 *            The contextual selection
+	 */
+	void setContextualSelection(ContextualSelection contextualSelection);
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/52fd79dd/taverna-menu-api/src/main/java/net/sf/taverna/t2/ui/menu/ContextualSelection.java
----------------------------------------------------------------------
diff --git a/taverna-menu-api/src/main/java/net/sf/taverna/t2/ui/menu/ContextualSelection.java b/taverna-menu-api/src/main/java/net/sf/taverna/t2/ui/menu/ContextualSelection.java
new file mode 100644
index 0000000..e94307e
--- /dev/null
+++ b/taverna-menu-api/src/main/java/net/sf/taverna/t2/ui/menu/ContextualSelection.java
@@ -0,0 +1,48 @@
+package net.sf.taverna.t2.ui.menu;
+
+import java.awt.Component;
+
+import javax.swing.JPopupMenu;
+
+import uk.org.taverna.scufl2.api.core.Workflow;
+
+/**
+ * A contextual selection as passed to a {@link ContextualMenuComponent}.
+ * 
+ * @author Stian Soiland-Reyes
+ */
+public class ContextualSelection {
+	private final Object parent;
+	private final Object selection;
+	private final Component relativeToComponent;
+
+	public ContextualSelection(Object parent, Object selection,
+			Component relativeToComponent) {
+		this.parent = parent;
+		this.selection = selection;
+		this.relativeToComponent = relativeToComponent;
+	}
+
+	/**
+	 * The parent object of the selected object, for instance a {@link Workflow}.
+	 */
+	public Object getParent() {
+		return parent;
+	}
+
+	/**
+	 * The selected object which actions in the contextual menu relate to, for
+	 * instance a Processor.
+	 */
+	public Object getSelection() {
+		return selection;
+	}
+
+	/**
+	 * A UI component which the returned {@link JPopupMenu} (and it's actions)
+	 * is to be relative to, for instance as a parent of pop-up dialogues.
+	 */
+	public Component getRelativeToComponent() {
+		return relativeToComponent;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/52fd79dd/taverna-menu-api/src/main/java/net/sf/taverna/t2/ui/menu/DefaultContextualMenu.java
----------------------------------------------------------------------
diff --git a/taverna-menu-api/src/main/java/net/sf/taverna/t2/ui/menu/DefaultContextualMenu.java b/taverna-menu-api/src/main/java/net/sf/taverna/t2/ui/menu/DefaultContextualMenu.java
new file mode 100644
index 0000000..0db13a7
--- /dev/null
+++ b/taverna-menu-api/src/main/java/net/sf/taverna/t2/ui/menu/DefaultContextualMenu.java
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * Copyright (C) 2007-2009 The University of Manchester   
+ * 
+ *  Modifications to the initial code base are copyright of their
+ *  respective authors, or their employers as appropriate.
+ * 
+ *  This program is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public License
+ *  as published by the Free Software Foundation; either version 2.1 of
+ *  the License, or (at your option) any later version.
+ *    
+ *  This program is distributed in the hope that it will be useful, but
+ *  WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *    
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ ******************************************************************************/
+package net.sf.taverna.t2.ui.menu;
+
+import java.net.URI;
+
+/**
+ * The default contextual menu, created using
+ * {@link MenuManager#createContextMenu(Object, Object, java.awt.Component)()}.
+ * <p>
+ * Items that are part of a contextual menu should also implement
+ * {@link ContextualMenuComponent}, the menu manager will then be able to tell
+ * the items what is the current selection for the contextual menu, so that the
+ * items can update their {@link MenuComponent#isEnabled()} (only visible for
+ * some selections) and {@link MenuComponent#getAction()} (the action needs the
+ * selected object).
+ * 
+ * @author Stian Soiland-Reyes
+ */
+public class DefaultContextualMenu extends AbstractMenu {
+	/**
+	 * The URI of a menu item representing the default menu bar. Menu items who
+	 * has this URI as their {@link #getParentId()} will be shown in the top
+	 * menu of the main application window.
+	 */
+	public static final URI DEFAULT_CONTEXT_MENU = URI
+			.create("http://taverna.sf.net/2008/t2workbench/menu#defaultContextMenu");
+
+	/**
+	 * Construct the default menu bar
+	 */
+	public DefaultContextualMenu() {
+		super(DEFAULT_CONTEXT_MENU);
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/52fd79dd/taverna-menu-api/src/main/java/net/sf/taverna/t2/ui/menu/DefaultMenuBar.java
----------------------------------------------------------------------
diff --git a/taverna-menu-api/src/main/java/net/sf/taverna/t2/ui/menu/DefaultMenuBar.java b/taverna-menu-api/src/main/java/net/sf/taverna/t2/ui/menu/DefaultMenuBar.java
new file mode 100644
index 0000000..8c5eab6
--- /dev/null
+++ b/taverna-menu-api/src/main/java/net/sf/taverna/t2/ui/menu/DefaultMenuBar.java
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * Copyright (C) 2007 The University of Manchester   
+ * 
+ *  Modifications to the initial code base are copyright of their
+ *  respective authors, or their employers as appropriate.
+ * 
+ *  This program is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public License
+ *  as published by the Free Software Foundation; either version 2.1 of
+ *  the License, or (at your option) any later version.
+ *    
+ *  This program is distributed in the hope that it will be useful, but
+ *  WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *    
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ ******************************************************************************/
+package net.sf.taverna.t2.ui.menu;
+
+import java.net.URI;
+
+/**
+ * The default {@link AbstractMenu menu bar} that appears in the main
+ * application window, created using {@link MenuManager#createMenuBar()}.
+ * Alternative menu bars can be created using
+ * {@link MenuManager#createMenuBar(URI)} - referring to the URI of another
+ * instance of {@link AbstractMenu}.
+ * 
+ * @author Stian Soiland-Reyes
+ */
+public class DefaultMenuBar extends AbstractMenu {
+	/**
+	 * The URI of a menu item representing the default menu bar. Menu items who
+	 * has this URI as their {@link #getParentId()} will be shown in the top
+	 * menu of the main application window.
+	 */
+	public static final URI DEFAULT_MENU_BAR = URI
+			.create("http://taverna.sf.net/2008/t2workbench/menu#defaultMenuBar");
+
+	/**
+	 * Construct the default menu bar
+	 * 
+	 */
+	public DefaultMenuBar() {
+		super(DEFAULT_MENU_BAR);
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/52fd79dd/taverna-menu-api/src/main/java/net/sf/taverna/t2/ui/menu/DefaultToolBar.java
----------------------------------------------------------------------
diff --git a/taverna-menu-api/src/main/java/net/sf/taverna/t2/ui/menu/DefaultToolBar.java b/taverna-menu-api/src/main/java/net/sf/taverna/t2/ui/menu/DefaultToolBar.java
new file mode 100644
index 0000000..302c37a
--- /dev/null
+++ b/taverna-menu-api/src/main/java/net/sf/taverna/t2/ui/menu/DefaultToolBar.java
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * Copyright (C) 2007 The University of Manchester   
+ * 
+ *  Modifications to the initial code base are copyright of their
+ *  respective authors, or their employers as appropriate.
+ * 
+ *  This program is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public License
+ *  as published by the Free Software Foundation; either version 2.1 of
+ *  the License, or (at your option) any later version.
+ *    
+ *  This program is distributed in the hope that it will be useful, but
+ *  WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *    
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ ******************************************************************************/
+package net.sf.taverna.t2.ui.menu;
+
+import java.net.URI;
+
+/**
+ * The default tool bar that will be shown by the main application window. Use
+ * {@link #DEFAULT_TOOL_BAR} as the {@link #getParentId()} for items that should
+ * appear in this toolbar. This toolbar can be created using
+ * {@link MenuManager#createToolBar()}
+ * <p>
+ * Separate toolbars can be made by subclassing {@link AbstractToolBar} and
+ * created by using {@link MenuManager#createToolBar(URI)}.
+ * 
+ * @author Stian Soiland-Reyes
+ */
+public class DefaultToolBar extends AbstractToolBar {
+	/**
+	 * The URI of a tool bar item representing the default tool bar. Items who
+	 * has this URI as their {@link #getParentId()} will be shown in the default
+	 * toolbar of the main application window.
+	 */
+	public static final URI DEFAULT_TOOL_BAR = URI
+			.create("http://taverna.sf.net/2008/t2workbench/menu#defaultToolBar");
+
+	/**
+	 * Construct the default toolbar.
+	 */
+	public DefaultToolBar() {
+		super(DEFAULT_TOOL_BAR);
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/52fd79dd/taverna-menu-api/src/main/java/net/sf/taverna/t2/ui/menu/DesignOnlyAction.java
----------------------------------------------------------------------
diff --git a/taverna-menu-api/src/main/java/net/sf/taverna/t2/ui/menu/DesignOnlyAction.java b/taverna-menu-api/src/main/java/net/sf/taverna/t2/ui/menu/DesignOnlyAction.java
new file mode 100644
index 0000000..7260fdf
--- /dev/null
+++ b/taverna-menu-api/src/main/java/net/sf/taverna/t2/ui/menu/DesignOnlyAction.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (C) 2007 The University of Manchester
+ *
+ *  Modifications to the initial code base are copyright of their
+ *  respective authors, or their employers as appropriate.
+ *
+ *  This program is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public License
+ *  as published by the Free Software Foundation; either version 2.1 of
+ *  the License, or (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful, but
+ *  WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ ******************************************************************************/
+package net.sf.taverna.t2.ui.menu;
+
+/**
+ * Marker interface for actions that are valid only when the design perspective
+ * is selected.
+ * 
+ * @author alanrw
+ * @author David Withers
+ */
+public interface DesignOnlyAction {
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/52fd79dd/taverna-menu-api/src/main/java/net/sf/taverna/t2/ui/menu/DesignOrResultsAction.java
----------------------------------------------------------------------
diff --git a/taverna-menu-api/src/main/java/net/sf/taverna/t2/ui/menu/DesignOrResultsAction.java b/taverna-menu-api/src/main/java/net/sf/taverna/t2/ui/menu/DesignOrResultsAction.java
new file mode 100644
index 0000000..26e6b62
--- /dev/null
+++ b/taverna-menu-api/src/main/java/net/sf/taverna/t2/ui/menu/DesignOrResultsAction.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (C) 2007 The University of Manchester
+ *
+ *  Modifications to the initial code base are copyright of their
+ *  respective authors, or their employers as appropriate.
+ *
+ *  This program is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public License
+ *  as published by the Free Software Foundation; either version 2.1 of
+ *  the License, or (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful, but
+ *  WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ ******************************************************************************/
+package net.sf.taverna.t2.ui.menu;
+
+/**
+ * Marker interface for actions that are valid the design or result perspectives
+ * are selected.
+ * 
+ * @author alanrw
+ * @author David Withers
+ */
+public interface DesignOrResultsAction {
+
+}