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:36 UTC

[22/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-menu-impl/src/main/java/net/sf/taverna/t2/workbench/ui/impl/menu/ViewShowMenuSection.java
----------------------------------------------------------------------
diff --git a/taverna-menu-impl/src/main/java/net/sf/taverna/t2/workbench/ui/impl/menu/ViewShowMenuSection.java b/taverna-menu-impl/src/main/java/net/sf/taverna/t2/workbench/ui/impl/menu/ViewShowMenuSection.java
new file mode 100644
index 0000000..2df05e5
--- /dev/null
+++ b/taverna-menu-impl/src/main/java/net/sf/taverna/t2/workbench/ui/impl/menu/ViewShowMenuSection.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * 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.workbench.ui.impl.menu;
+
+import java.net.URI;
+
+import net.sf.taverna.t2.ui.menu.AbstractMenuSection;
+
+/**
+ * @author Alex Nenadic
+ * @author Alan R Williams
+ */
+public class ViewShowMenuSection extends AbstractMenuSection {
+	public static final URI DIAGRAM_MENU = URI
+			.create("http://taverna.sf.net/2008/t2workbench/menu#diagram");
+	public static final URI VIEW_SHOW_MENU_SECTION = URI
+			.create("http://taverna.sf.net/2008/t2workbench/menu#viewShowMenuSection");
+
+	public ViewShowMenuSection() {
+		super(DIAGRAM_MENU, 10, VIEW_SHOW_MENU_SECTION);
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/52fd79dd/taverna-menu-impl/src/main/resources/META-INF/services/net.sf.taverna.t2.ui.menu.MenuManager
----------------------------------------------------------------------
diff --git a/taverna-menu-impl/src/main/resources/META-INF/services/net.sf.taverna.t2.ui.menu.MenuManager b/taverna-menu-impl/src/main/resources/META-INF/services/net.sf.taverna.t2.ui.menu.MenuManager
new file mode 100644
index 0000000..3b06fd9
--- /dev/null
+++ b/taverna-menu-impl/src/main/resources/META-INF/services/net.sf.taverna.t2.ui.menu.MenuManager
@@ -0,0 +1 @@
+net.sf.taverna.t2.ui.menu.impl.MenuManagerImpl
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/52fd79dd/taverna-menu-impl/src/main/resources/META-INF/spring/menu-impl-context-osgi.xml
----------------------------------------------------------------------
diff --git a/taverna-menu-impl/src/main/resources/META-INF/spring/menu-impl-context-osgi.xml b/taverna-menu-impl/src/main/resources/META-INF/spring/menu-impl-context-osgi.xml
new file mode 100644
index 0000000..3a1eadf
--- /dev/null
+++ b/taverna-menu-impl/src/main/resources/META-INF/spring/menu-impl-context-osgi.xml
@@ -0,0 +1,26 @@
+<?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="MenuManagerImpl" interface="net.sf.taverna.t2.ui.menu.MenuManager" />
+
+	<service ref="FileMenu" auto-export="interfaces" />
+	<service ref="EditMenu" auto-export="interfaces" />
+	<service ref="AdvancedMenu" auto-export="interfaces" />
+	<service ref="HelpMenu" auto-export="interfaces" />
+	<service ref="OnlineHelpMenuAction" auto-export="interfaces" />
+	<service ref="FeedbackMenuAction" auto-export="interfaces" />
+	<service ref="ShowLogsAndDataMenuAction" auto-export="interfaces" />
+
+	<reference id="applicationConfiguration" interface="uk.org.taverna.configuration.app.ApplicationConfiguration" />
+	<reference id="selectionManager" interface="net.sf.taverna.t2.workbench.selection.SelectionManager" />
+
+	<list id="menuComponents" interface="net.sf.taverna.t2.ui.menu.MenuComponent" cardinality="0..N" greedy-proxying="true">
+		<listener ref="MenuManagerImpl" bind-method="update" unbind-method="update" />
+	</list>
+
+</beans:beans>

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/52fd79dd/taverna-menu-impl/src/main/resources/META-INF/spring/menu-impl-context.xml
----------------------------------------------------------------------
diff --git a/taverna-menu-impl/src/main/resources/META-INF/spring/menu-impl-context.xml b/taverna-menu-impl/src/main/resources/META-INF/spring/menu-impl-context.xml
new file mode 100644
index 0000000..62fd24e
--- /dev/null
+++ b/taverna-menu-impl/src/main/resources/META-INF/spring/menu-impl-context.xml
@@ -0,0 +1,25 @@
+<?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="MenuManagerImpl" class="net.sf.taverna.t2.ui.menu.impl.MenuManagerImpl">
+		<property name="menuComponents" ref="menuComponents" />
+		<property name="selectionManager" ref="selectionManager" />
+	</bean>
+
+	<bean id="FileMenu" class="net.sf.taverna.t2.workbench.ui.impl.menu.FileMenu" />
+	<bean id="EditMenu" class="net.sf.taverna.t2.workbench.ui.impl.menu.EditMenu" />
+	<bean id="AdvancedMenu" class="net.sf.taverna.t2.workbench.ui.impl.menu.AdvancedMenu" />
+	<bean id="HelpMenu" class="net.sf.taverna.t2.workbench.ui.impl.menu.HelpMenu" />
+	<bean id="OnlineHelpMenuAction"
+		class="net.sf.taverna.t2.workbench.ui.impl.menu.OnlineHelpMenuAction" />
+	<bean id="FeedbackMenuAction"
+		class="net.sf.taverna.t2.workbench.ui.impl.menu.FeedbackMenuAction" />
+	<bean id="ShowLogsAndDataMenuAction"
+		class="net.sf.taverna.t2.workbench.ui.impl.menu.ShowLogsAndDataMenuAction">
+		<property name="applicationConfiguration" ref="applicationConfiguration" />
+	</bean>
+
+</beans>

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/52fd79dd/taverna-menu-items/pom.xml
----------------------------------------------------------------------
diff --git a/taverna-menu-items/pom.xml b/taverna-menu-items/pom.xml
new file mode 100644
index 0000000..07566e2
--- /dev/null
+++ b/taverna-menu-items/pom.xml
@@ -0,0 +1,88 @@
+<?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-items</artifactId>
+	<packaging>bundle</packaging>
+	<name>Additional menu items</name>
+	<dependencies>
+		<dependency>
+			<groupId>${project.parent.groupId}</groupId>
+			<artifactId>menu-api</artifactId>
+			<version>${project.parent.version}</version>
+		</dependency>
+		<dependency>
+			<groupId>${project.parent.groupId}</groupId>
+			<artifactId>report-api</artifactId>
+			<version>${project.parent.version}</version>
+		</dependency>
+		<dependency>
+			<groupId>${project.parent.groupId}</groupId>
+			<artifactId>selection-api</artifactId>
+			<version>${project.parent.version}</version>
+		</dependency>
+		<dependency>
+			<groupId>${project.parent.groupId}</groupId>
+			<artifactId>workbench-api</artifactId>
+			<version>${project.parent.version}</version>
+		</dependency>
+		<dependency>
+			<groupId>${project.parent.groupId}</groupId>
+			<artifactId>design-ui</artifactId>
+			<version>${project.parent.version}</version>
+		</dependency>
+		<dependency>
+			<groupId>${project.parent.groupId}</groupId>
+			<artifactId>graph-view</artifactId>
+			<version>${project.parent.version}</version>
+		</dependency>
+		<dependency>
+			<groupId>${project.parent.groupId}</groupId>
+			<artifactId>workflow-view</artifactId>
+			<version>${project.parent.version}</version>
+		</dependency>
+		<dependency>
+			<groupId>net.sf.taverna.t2.lang</groupId>
+			<artifactId>ui</artifactId>
+			<version>${t2.lang.version}</version>
+		</dependency>
+		<dependency>
+			<groupId>uk.org.taverna.commons</groupId>
+			<artifactId>taverna-services-api</artifactId>
+			<version>0.1.0-SNAPSHOT</version>
+		</dependency>
+
+		<dependency>
+			<groupId>net.sf.taverna.t2.ui-activities</groupId>
+			<artifactId>stringconstant-activity-ui</artifactId>
+			<version>${t2.ui.activities.version}</version>
+		</dependency>
+		<!-- TODO remove dependencies on implementations -->
+		<dependency>
+			<groupId>${project.parent.groupId}</groupId>
+			<artifactId>contextual-views-impl</artifactId>
+			<version>${project.parent.version}</version>
+		</dependency>
+	</dependencies>
+</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/52fd79dd/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/activityport/AbstractConnectPortMenuActions.java
----------------------------------------------------------------------
diff --git a/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/activityport/AbstractConnectPortMenuActions.java b/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/activityport/AbstractConnectPortMenuActions.java
new file mode 100644
index 0000000..2bbed5b
--- /dev/null
+++ b/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/activityport/AbstractConnectPortMenuActions.java
@@ -0,0 +1,268 @@
+package net.sf.taverna.t2.ui.menu.items.activityport;
+
+import java.awt.Color;
+import java.awt.Component;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.swing.Action;
+import javax.swing.Icon;
+import javax.swing.JMenu;
+import javax.swing.JMenuItem;
+
+import uk.org.taverna.scufl2.api.activity.Activity;
+import uk.org.taverna.scufl2.api.common.NamedSet;
+import uk.org.taverna.scufl2.api.common.Scufl2Tools;
+import uk.org.taverna.scufl2.api.core.Processor;
+import uk.org.taverna.scufl2.api.core.Workflow;
+import uk.org.taverna.scufl2.api.port.InputPort;
+import uk.org.taverna.scufl2.api.port.InputProcessorPort;
+import uk.org.taverna.scufl2.api.port.InputWorkflowPort;
+import uk.org.taverna.scufl2.api.port.OutputProcessorPort;
+import uk.org.taverna.scufl2.api.port.OutputWorkflowPort;
+import uk.org.taverna.scufl2.api.port.Port;
+import uk.org.taverna.scufl2.api.port.ProcessorPort;
+import uk.org.taverna.scufl2.api.port.ReceiverPort;
+import uk.org.taverna.scufl2.api.port.SenderPort;
+import uk.org.taverna.scufl2.api.port.WorkflowPort;
+import uk.org.taverna.scufl2.api.profiles.Profile;
+
+import net.sf.taverna.t2.lang.ui.ShadedLabel;
+import net.sf.taverna.t2.ui.menu.AbstractMenuCustom;
+import net.sf.taverna.t2.ui.menu.ContextualMenuComponent;
+import net.sf.taverna.t2.ui.menu.ContextualSelection;
+import net.sf.taverna.t2.ui.menu.MenuManager;
+import net.sf.taverna.t2.ui.menu.MenuManager.ComponentFactory;
+import net.sf.taverna.t2.workbench.activityicons.ActivityIconManager;
+import net.sf.taverna.t2.workbench.configuration.colour.ColourManager;
+import net.sf.taverna.t2.workbench.configuration.workbench.WorkbenchConfiguration;
+import net.sf.taverna.t2.workbench.edits.EditManager;
+import net.sf.taverna.t2.workbench.icons.WorkbenchIcons;
+
+public abstract class AbstractConnectPortMenuActions extends AbstractMenuCustom
+		implements ContextualMenuComponent {
+
+	protected ActivityIconManager activityIconManager;
+	protected ContextualSelection contextualSelection;
+	protected MenuManager menuManager;
+	protected WorkbenchConfiguration workbenchConfiguration;
+	protected ColourManager colourManager;
+	private EditManager editManager;
+
+	public static final String CONNECT_AS_INPUT_TO = "Connect as input to...";
+	public static final String CONNECT_WITH_OUTPUT_FROM = "Connect with output from...";
+
+	public static final String SERVICE_INPUT_PORTS = "Service input ports";
+	public static final String SERVICE_OUTPUT_PORTS = "Service output ports";
+
+	public static final String NEW_WORKFLOW_INPUT_PORT = "New workflow input port...";
+	public static final String NEW_WORKFLOW_OUTPUT_PORT = "New workflow output port...";
+
+	public static final String WORKFLOW_INPUT_PORTS = "Workflow input ports";
+	public static final String WORKFLOW_OUTPUT_PORTS = "Workflow output ports";
+
+	public static final String SERVICES = "Services";
+
+	private Scufl2Tools scufl2Tools  = new Scufl2Tools();
+
+	public AbstractConnectPortMenuActions(URI parentId, int positionHint) {
+		super(parentId, positionHint);
+	}
+
+	public ContextualSelection getContextualSelection() {
+		return contextualSelection;
+	}
+
+	public void setContextualSelection(ContextualSelection contextualSelection) {
+		this.contextualSelection = contextualSelection;
+		this.customComponent = null;
+	}
+
+	@Override
+	protected Component createCustomComponent() {
+		Workflow workflow = (Workflow) getContextualSelection().getParent();
+		Profile profile = workflow.getParent().getMainProfile();
+		Port port = getSelectedPort();
+		// Component component =
+		// getContextualSelection().getRelativeToComponent();
+
+		String label;
+		if (port instanceof ReceiverPort) {
+			label = CONNECT_WITH_OUTPUT_FROM;
+		} else {
+			label = CONNECT_AS_INPUT_TO;
+		}
+		JMenu connectMenu = new JMenu(new DummyAction(label,
+				WorkbenchIcons.datalinkIcon));
+		addPortMenuItems(workflow, port, connectMenu);
+		addProcessorMenuItems(workflow, profile, port, connectMenu);
+		return connectMenu;
+	}
+
+	private Port getSelectedPort() {
+		Port port = (Port) getContextualSelection().getSelection();
+		return port;
+	}
+
+	protected void addPortMenuItems(Workflow workflow, Port port, JMenu connectMenu) {
+		Color workflowPortColour = colourManager.getPreferredColour(WorkflowPort.class.getCanonicalName());
+
+		boolean addedPorts = false;
+		if (port instanceof SenderPort) {
+			connectMenu.add(new ShadedLabel(WORKFLOW_OUTPUT_PORTS, workflowPortColour));
+			for (OutputWorkflowPort outputWorkflowPort : workflow.getOutputPorts()) {
+				ConnectPortsAction connectPortsAction =
+						new ConnectPortsAction(workflow, (SenderPort) port, outputWorkflowPort, editManager);
+				connectPortsAction.putValue(Action.SMALL_ICON, WorkbenchIcons.outputIcon);
+				connectPortsAction.putValue(Action.NAME, outputWorkflowPort.getName());
+				connectMenu.add(new JMenuItem(connectPortsAction));
+				addedPorts = true;
+			}
+		} else if (port instanceof ReceiverPort) {
+			connectMenu.add(new ShadedLabel(WORKFLOW_INPUT_PORTS, workflowPortColour));
+			for (InputWorkflowPort inputWorkflowPort : workflow.getInputPorts()) {
+				ConnectPortsAction connectPortsAction =
+						new ConnectPortsAction(workflow, inputWorkflowPort, (ReceiverPort) port, editManager);
+				connectPortsAction.putValue(Action.SMALL_ICON, WorkbenchIcons.inputIcon);
+				connectPortsAction.putValue(Action.NAME, inputWorkflowPort.getName());
+				connectMenu.add(new JMenuItem(connectPortsAction));
+				addedPorts = true;
+			}
+		}
+		if (addedPorts) {
+			connectMenu.addSeparator();
+		}
+		CreateAndConnectDataflowPortAction newDataflowPortAction = new CreateAndConnectDataflowPortAction(
+				workflow, port, getSuggestedName(port), contextualSelection.getRelativeToComponent(), editManager);
+
+		if (port instanceof ReceiverPort) {
+			newDataflowPortAction.putValue(Action.NAME, NEW_WORKFLOW_INPUT_PORT);
+		} else if (port instanceof SenderPort) {
+			newDataflowPortAction.putValue(Action.NAME, NEW_WORKFLOW_OUTPUT_PORT);
+		}
+		newDataflowPortAction.putValue(Action.SMALL_ICON, WorkbenchIcons.newIcon);
+		connectMenu.add(new JMenuItem(newDataflowPortAction));
+	}
+
+	/**
+	 * @param port
+	 * @return
+	 */
+	private String getSuggestedName(Port port) {
+		String suggestedName;
+		if (port instanceof ProcessorPort) {
+			suggestedName = ((ProcessorPort) port).getParent().getName() + "_" + port.getName();
+		} else {
+			suggestedName = port.getName();
+		}
+		return suggestedName;
+	}
+
+	protected void addProcessorMenuItems(Workflow dataflow, Profile profile,
+			final Port targetPort, JMenu connectMenu) {
+		final Set<Processor> processors = findProcessors(dataflow, targetPort);
+		if (processors.isEmpty()) {
+			return;
+		}
+		connectMenu.add(new ShadedLabel(SERVICES, colourManager.getPreferredColour(Processor.class.getCanonicalName())));
+
+		List<JMenuItem> menuItems = new ArrayList<JMenuItem>();
+		for (Processor processor : processors) {
+			Activity activity = scufl2Tools.processorBindingForProcessor(processor, profile).getBoundActivity();
+			Icon icon = activityIconManager.iconForActivity(activity);
+			final Color processorPortColour = colourManager.getPreferredColour(ProcessorPort.class.getCanonicalName());
+
+			JMenu processorMenu = new JMenu(new DummyAction(processor.getName(), icon));
+			List<JMenuItem> processorMenuItems = new ArrayList<JMenuItem>();
+			if (targetPort instanceof ReceiverPort) {
+				processorMenu.add(new ShadedLabel(SERVICE_OUTPUT_PORTS,
+						processorPortColour));
+				menuItems.add(processorMenu);
+				for (OutputProcessorPort outputProcessorPort : processor.getOutputPorts()) {
+					ConnectPortsAction connectPortsAction = new ConnectPortsAction(dataflow,
+							outputProcessorPort, (ReceiverPort) targetPort, editManager);
+					connectPortsAction.putValue(Action.SMALL_ICON,
+							WorkbenchIcons.outputPortIcon);
+					connectPortsAction.putValue(Action.NAME, outputProcessorPort.getName());
+					processorMenuItems.add(new JMenuItem(connectPortsAction));
+				}
+			} else if (targetPort instanceof SenderPort) {
+				processorMenu.add(new ShadedLabel(SERVICE_INPUT_PORTS,
+						processorPortColour));
+				menuItems.add(processorMenu);
+				for (InputProcessorPort inputProcessorPort : processor.getInputPorts()) {
+					ConnectPortsAction connectPortsAction = new ConnectPortsAction(dataflow,
+							(SenderPort) targetPort, inputProcessorPort, editManager);
+					connectPortsAction.putValue(Action.SMALL_ICON,
+							WorkbenchIcons.inputPortIcon);
+					connectPortsAction.putValue(Action.NAME, inputProcessorPort.getName());
+					processorMenuItems.add(new JMenuItem(connectPortsAction));
+				}
+			}
+
+			menuManager.addMenuItemsWithExpansion(processorMenuItems,
+					processorMenu, workbenchConfiguration.getMaxMenuItems(),
+					new ComponentFactory() {
+						public Component makeComponent() {
+							if (targetPort instanceof InputPort) {
+								return new ShadedLabel(SERVICE_OUTPUT_PORTS, processorPortColour);
+							} else {
+								return new ShadedLabel(SERVICE_INPUT_PORTS, processorPortColour);
+							}
+						}
+					});
+		}
+		menuManager.addMenuItemsWithExpansion(menuItems, connectMenu,
+				workbenchConfiguration.getMaxMenuItems(),
+				new ComponentFactory() {
+					public Component makeComponent() {
+						return new ShadedLabel(SERVICES, colourManager
+								.getPreferredColour(Processor.class
+										.getCanonicalName()));
+					}
+				});
+	}
+
+	protected Set<Processor> findProcessors(Workflow dataflow, Port targetPort) {
+		Set<Processor> possibleProcessors = new HashSet<Processor>();
+		if (targetPort instanceof InputProcessorPort) {
+			InputProcessorPort inputProcessorPort = (InputProcessorPort) targetPort;
+			possibleProcessors = scufl2Tools.possibleUpStreamProcessors(dataflow, inputProcessorPort.getParent());
+		} else if (targetPort instanceof OutputProcessorPort) {
+			OutputProcessorPort outputProcessorPort = (OutputProcessorPort) targetPort;
+			possibleProcessors = scufl2Tools.possibleDownStreamProcessors(dataflow, outputProcessorPort.getParent());
+		} else {
+			// Probably a dataflow port, everything is allowed
+			possibleProcessors = dataflow.getProcessors();
+		}
+		return possibleProcessors;
+	}
+
+	public void setEditManager(EditManager editManager) {
+		this.editManager = editManager;
+	}
+
+	public void setMenuManager(MenuManager menuManager) {
+		this.menuManager = menuManager;
+	}
+
+	public void setActivityIconManager(ActivityIconManager activityIconManager) {
+		this.activityIconManager = activityIconManager;
+	}
+
+	public void setWorkbenchConfiguration(WorkbenchConfiguration workbenchConfiguration) {
+		this.workbenchConfiguration = workbenchConfiguration;
+	}
+
+	public void setColourManager(ColourManager colourManager) {
+		this.colourManager = colourManager;
+	}
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/52fd79dd/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/activityport/ActivityInputPortSection.java
----------------------------------------------------------------------
diff --git a/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/activityport/ActivityInputPortSection.java b/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/activityport/ActivityInputPortSection.java
new file mode 100644
index 0000000..89414d6
--- /dev/null
+++ b/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/activityport/ActivityInputPortSection.java
@@ -0,0 +1,67 @@
+/**********************************************************************
+ * 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.items.activityport;
+
+import java.net.URI;
+
+import javax.swing.Action;
+
+import net.sf.taverna.t2.ui.menu.AbstractMenuSection;
+import net.sf.taverna.t2.ui.menu.ContextualMenuComponent;
+import net.sf.taverna.t2.ui.menu.ContextualSelection;
+import net.sf.taverna.t2.ui.menu.DefaultContextualMenu;
+import uk.org.taverna.scufl2.api.port.InputProcessorPort;
+
+public class ActivityInputPortSection extends AbstractMenuSection implements
+		ContextualMenuComponent {
+
+	private static final String ACTIVITY_INPUT_PORT = "Service input port: ";
+	public static final URI activityInputPortSection = URI
+			.create("http://taverna.sf.net/2009/contextMenu/activityInputPort");
+	private ContextualSelection contextualSelection;
+
+	public ActivityInputPortSection() {
+		super(DefaultContextualMenu.DEFAULT_CONTEXT_MENU, 10,
+				activityInputPortSection);
+	}
+
+	public ContextualSelection getContextualSelection() {
+		return contextualSelection;
+	}
+
+	@Override
+	public boolean isEnabled() {
+		return getContextualSelection().getSelection() instanceof InputProcessorPort;
+	}
+
+	public void setContextualSelection(ContextualSelection contextualSelection) {
+		this.contextualSelection = contextualSelection;
+		this.action = null;
+	}
+
+	@Override
+	protected Action createAction() {
+		InputProcessorPort port = (InputProcessorPort) getContextualSelection().getSelection();
+		String name = ACTIVITY_INPUT_PORT + port.getName();
+		return new DummyAction(name);
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/52fd79dd/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/activityport/ActivityOutputPortSection.java
----------------------------------------------------------------------
diff --git a/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/activityport/ActivityOutputPortSection.java b/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/activityport/ActivityOutputPortSection.java
new file mode 100644
index 0000000..b26cff9
--- /dev/null
+++ b/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/activityport/ActivityOutputPortSection.java
@@ -0,0 +1,67 @@
+/**********************************************************************
+ * 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.items.activityport;
+
+import java.net.URI;
+
+import javax.swing.Action;
+
+import net.sf.taverna.t2.ui.menu.AbstractMenuSection;
+import net.sf.taverna.t2.ui.menu.ContextualMenuComponent;
+import net.sf.taverna.t2.ui.menu.ContextualSelection;
+import net.sf.taverna.t2.ui.menu.DefaultContextualMenu;
+import uk.org.taverna.scufl2.api.port.OutputProcessorPort;
+
+public class ActivityOutputPortSection extends AbstractMenuSection implements
+		ContextualMenuComponent {
+
+	private static final String ACTIVITY_OUTPUT_PORT = "Service output port: ";
+	public static final URI activityOutputPortSection = URI
+			.create("http://taverna.sf.net/2009/contextMenu/activityOutputPort");
+	private ContextualSelection contextualSelection;
+
+	public ActivityOutputPortSection() {
+		super(DefaultContextualMenu.DEFAULT_CONTEXT_MENU, 10,
+				activityOutputPortSection);
+	}
+
+	public ContextualSelection getContextualSelection() {
+		return contextualSelection;
+	}
+
+	@Override
+	public boolean isEnabled() {
+		return getContextualSelection().getSelection() instanceof OutputProcessorPort;
+	}
+
+	public void setContextualSelection(ContextualSelection contextualSelection) {
+		this.contextualSelection = contextualSelection;
+		this.action = null;
+	}
+
+	@Override
+	protected Action createAction() {
+		OutputProcessorPort port = (OutputProcessorPort) getContextualSelection().getSelection();
+		String name = ACTIVITY_OUTPUT_PORT + port.getName();
+		return new DummyAction(name);
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/52fd79dd/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/activityport/AddInputPortDefaultValueAction.java
----------------------------------------------------------------------
diff --git a/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/activityport/AddInputPortDefaultValueAction.java b/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/activityport/AddInputPortDefaultValueAction.java
new file mode 100644
index 0000000..414ffac
--- /dev/null
+++ b/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/activityport/AddInputPortDefaultValueAction.java
@@ -0,0 +1,150 @@
+/*******************************************************************************
+ * 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.items.activityport;
+
+import java.awt.Component;
+import java.awt.event.ActionEvent;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.swing.JOptionPane;
+
+import net.sf.taverna.t2.activities.stringconstant.views.StringConstantConfigView;
+import net.sf.taverna.t2.workbench.design.actions.DataflowEditAction;
+import net.sf.taverna.t2.workbench.edits.CompoundEdit;
+import net.sf.taverna.t2.workbench.edits.Edit;
+import net.sf.taverna.t2.workbench.edits.EditException;
+import net.sf.taverna.t2.workbench.edits.EditManager;
+import net.sf.taverna.t2.workbench.icons.WorkbenchIcons;
+import net.sf.taverna.t2.workbench.selection.SelectionManager;
+import net.sf.taverna.t2.workflow.edits.AddChildEdit;
+import net.sf.taverna.t2.workflow.edits.AddDataLinkEdit;
+import net.sf.taverna.t2.workflow.edits.AddProcessorEdit;
+
+import org.apache.log4j.Logger;
+
+import uk.org.taverna.commons.services.ServiceRegistry;
+import uk.org.taverna.scufl2.api.activity.Activity;
+import uk.org.taverna.scufl2.api.configurations.Configuration;
+import uk.org.taverna.scufl2.api.core.DataLink;
+import uk.org.taverna.scufl2.api.core.Processor;
+import uk.org.taverna.scufl2.api.core.Workflow;
+import uk.org.taverna.scufl2.api.iterationstrategy.CrossProduct;
+import uk.org.taverna.scufl2.api.port.InputProcessorPort;
+import uk.org.taverna.scufl2.api.port.OutputActivityPort;
+import uk.org.taverna.scufl2.api.port.OutputProcessorPort;
+import uk.org.taverna.scufl2.api.profiles.ProcessorBinding;
+import uk.org.taverna.scufl2.api.profiles.ProcessorOutputPortBinding;
+import uk.org.taverna.scufl2.api.profiles.Profile;
+
+/**
+ * Action for adding a default value to an input port of a processor.
+ *
+ * @author Alex Nenadic
+ */
+@SuppressWarnings("serial")
+public class AddInputPortDefaultValueAction extends DataflowEditAction {
+
+	private static Logger logger = Logger.getLogger(AddInputPortDefaultValueAction.class);
+
+	private static final URI STRING_CONSTANT = URI
+			.create("http://ns.taverna.org.uk/2010/activity/constant");
+
+	private InputProcessorPort inputPort;
+
+	private final ServiceRegistry serviceRegistry;
+
+	public AddInputPortDefaultValueAction(Workflow workflow, InputProcessorPort inputPort,
+			Component component, EditManager editManager, SelectionManager selectionManager,
+			ServiceRegistry serviceRegistry) {
+		super(workflow, component, editManager, selectionManager);
+		this.inputPort = inputPort;
+		this.serviceRegistry = serviceRegistry;
+		putValue(SMALL_ICON, WorkbenchIcons.inputValueIcon);
+		putValue(NAME, "Set constant value");
+	}
+
+	public void actionPerformed(ActionEvent e) {
+		try {
+			Activity activity = new Activity();
+			activity.setType(STRING_CONSTANT);
+			Configuration configuration = new Configuration();
+			configuration.setType(STRING_CONSTANT.resolve("#Config"));
+			configuration.getJsonAsObjectNode().put("string", "");
+			configuration.setConfigures(activity);
+
+			StringConstantConfigView configView = new StringConstantConfigView(activity,
+					configuration, serviceRegistry);
+
+			int answer = JOptionPane.showConfirmDialog(component, configView,
+					"Text constant value", JOptionPane.OK_CANCEL_OPTION);
+			if (answer != JOptionPane.CANCEL_OPTION) {
+
+				configView.noteConfiguration();
+				configuration.setJson(configView.getJson());
+
+				Profile profile = selectionManager.getSelectedProfile();
+
+				Processor processor = new Processor();
+				processor.setName(inputPort.getName() + "_value");
+
+				CrossProduct crossProduct = new CrossProduct();
+				crossProduct.setParent(processor.getIterationStrategyStack());
+
+				ProcessorBinding processorBinding = new ProcessorBinding();
+				processorBinding.setBoundProcessor(processor);
+				processorBinding.setBoundActivity(activity);
+
+				// create activity port
+				OutputActivityPort activityPort = new OutputActivityPort(activity, "value");
+				activityPort.setDepth(0);
+				activityPort.setGranularDepth(0);
+				// create processor port
+				OutputProcessorPort processorPort = new OutputProcessorPort(processor,
+						activityPort.getName());
+				processorPort.setDepth(0);
+				processorPort.setGranularDepth(0);
+				// add a new port binding
+				new ProcessorOutputPortBinding(processorBinding, activityPort, processorPort);
+
+				// Add a data link between the string constant processor's output port
+				// and the processor containing the passed inputPort.
+				DataLink datalink = new DataLink();
+				datalink.setReceivesFrom(processorPort);
+				datalink.setSendsTo(inputPort);
+
+				List<Edit<?>> editList = new ArrayList<Edit<?>>();
+				editList.add(new AddChildEdit<Profile>(profile, activity));
+				editList.add(new AddChildEdit<Profile>(profile, configuration));
+				editList.add(new AddChildEdit<Profile>(profile, processorBinding));
+				editList.add(new AddProcessorEdit(dataflow, processor));
+				editList.add(new AddDataLinkEdit(dataflow, datalink));
+
+				editManager.doDataflowEdit(dataflow.getParent(), new CompoundEdit(editList));
+
+			}
+		} catch (EditException ex) {
+			logger.error("Adding default value for input port failed", ex);
+		}
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/52fd79dd/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/activityport/ConnectInputPortMenuActions.java
----------------------------------------------------------------------
diff --git a/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/activityport/ConnectInputPortMenuActions.java b/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/activityport/ConnectInputPortMenuActions.java
new file mode 100644
index 0000000..f22ebbc
--- /dev/null
+++ b/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/activityport/ConnectInputPortMenuActions.java
@@ -0,0 +1,41 @@
+/**********************************************************************
+ * 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.items.activityport;
+
+import net.sf.taverna.t2.ui.menu.ContextualMenuComponent;
+import uk.org.taverna.scufl2.api.core.Workflow;
+import uk.org.taverna.scufl2.api.port.InputProcessorPort;
+
+public class ConnectInputPortMenuActions extends AbstractConnectPortMenuActions
+		implements ContextualMenuComponent {
+
+	public ConnectInputPortMenuActions() {
+		super(ActivityInputPortSection.activityInputPortSection, 20);
+	}
+
+	@Override
+	public boolean isEnabled() {
+		return super.isEnabled()
+				&& getContextualSelection().getSelection() instanceof InputProcessorPort
+				&& getContextualSelection().getParent() instanceof Workflow;
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/52fd79dd/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/activityport/ConnectOutputPortMenuActions.java
----------------------------------------------------------------------
diff --git a/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/activityport/ConnectOutputPortMenuActions.java b/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/activityport/ConnectOutputPortMenuActions.java
new file mode 100644
index 0000000..2bb3ec0
--- /dev/null
+++ b/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/activityport/ConnectOutputPortMenuActions.java
@@ -0,0 +1,41 @@
+/**********************************************************************
+ * 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.items.activityport;
+
+import uk.org.taverna.scufl2.api.core.Workflow;
+import uk.org.taverna.scufl2.api.port.OutputProcessorPort;
+
+
+public class ConnectOutputPortMenuActions extends AbstractConnectPortMenuActions  {
+
+	public ConnectOutputPortMenuActions() {
+		super(ActivityOutputPortSection.activityOutputPortSection, 20);
+	}
+
+	@Override
+	public boolean isEnabled() {
+		return super.isEnabled()
+				&& getContextualSelection().getSelection() instanceof OutputProcessorPort
+				&& getContextualSelection().getParent() instanceof Workflow;
+	}
+
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/52fd79dd/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/activityport/ConnectPortsAction.java
----------------------------------------------------------------------
diff --git a/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/activityport/ConnectPortsAction.java b/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/activityport/ConnectPortsAction.java
new file mode 100644
index 0000000..f10fedf
--- /dev/null
+++ b/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/activityport/ConnectPortsAction.java
@@ -0,0 +1,68 @@
+/**********************************************************************
+ * 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.items.activityport;
+
+import java.awt.event.ActionEvent;
+
+import javax.swing.AbstractAction;
+
+import net.sf.taverna.t2.workbench.edits.Edit;
+import net.sf.taverna.t2.workbench.edits.EditException;
+import net.sf.taverna.t2.workbench.edits.EditManager;
+import net.sf.taverna.t2.workflow.edits.AddDataLinkEdit;
+
+import org.apache.log4j.Logger;
+
+import uk.org.taverna.scufl2.api.core.DataLink;
+import uk.org.taverna.scufl2.api.core.Workflow;
+import uk.org.taverna.scufl2.api.port.ReceiverPort;
+import uk.org.taverna.scufl2.api.port.SenderPort;
+
+@SuppressWarnings("serial")
+public class ConnectPortsAction extends AbstractAction {
+	private static Logger logger = Logger.getLogger(ConnectPortsAction.class);
+	private final Workflow workflow;
+	private final ReceiverPort receiverPort;
+	private final SenderPort senderPort;
+	private final EditManager editManager;
+
+	public ConnectPortsAction(Workflow workflow,
+			SenderPort senderPort, ReceiverPort receiverPort, EditManager editManager) {
+		super("Connect " + senderPort.getName() + " to " + receiverPort.getName());
+		this.workflow = workflow;
+		this.receiverPort = receiverPort;
+		this.senderPort = senderPort;
+		this.editManager = editManager;
+	}
+
+	public void actionPerformed(ActionEvent e) {
+		DataLink dataLink = new DataLink();
+		dataLink.setReceivesFrom(senderPort);
+		dataLink.setSendsTo(receiverPort);
+		Edit<Workflow> edit = new AddDataLinkEdit(workflow, dataLink);
+		try {
+			editManager.doDataflowEdit(workflow.getParent(), edit);
+		} catch (EditException ex) {
+			logger.warn("Can't create connection between " + senderPort
+					+ " and " + receiverPort, ex);
+		}
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/52fd79dd/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/activityport/CreateAndConnectDataflowPortAction.java
----------------------------------------------------------------------
diff --git a/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/activityport/CreateAndConnectDataflowPortAction.java b/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/activityport/CreateAndConnectDataflowPortAction.java
new file mode 100644
index 0000000..534f4ca
--- /dev/null
+++ b/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/activityport/CreateAndConnectDataflowPortAction.java
@@ -0,0 +1,226 @@
+/**********************************************************************
+ * 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.items.activityport;
+
+import java.awt.Component;
+import java.awt.Dimension;
+import java.awt.event.ActionEvent;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import javax.swing.AbstractAction;
+
+import net.sf.taverna.t2.lang.ui.ValidatingUserInputDialog;
+import net.sf.taverna.t2.workbench.design.ui.DataflowInputPortPanel;
+import net.sf.taverna.t2.workbench.design.ui.DataflowOutputPortPanel;
+import net.sf.taverna.t2.workbench.edits.CompoundEdit;
+import net.sf.taverna.t2.workbench.edits.Edit;
+import net.sf.taverna.t2.workbench.edits.EditException;
+import net.sf.taverna.t2.workbench.edits.EditManager;
+import net.sf.taverna.t2.workflow.edits.AddChildEdit;
+import net.sf.taverna.t2.workflow.edits.AddDataLinkEdit;
+import net.sf.taverna.t2.workflow.edits.AddWorkflowInputPortEdit;
+import net.sf.taverna.t2.workflow.edits.AddWorkflowOutputPortEdit;
+
+import org.apache.log4j.Logger;
+
+import uk.org.taverna.scufl2.api.core.DataLink;
+import uk.org.taverna.scufl2.api.core.Workflow;
+import uk.org.taverna.scufl2.api.port.DepthPort;
+import uk.org.taverna.scufl2.api.port.InputPort;
+import uk.org.taverna.scufl2.api.port.InputWorkflowPort;
+import uk.org.taverna.scufl2.api.port.OutputPort;
+import uk.org.taverna.scufl2.api.port.OutputWorkflowPort;
+import uk.org.taverna.scufl2.api.port.Port;
+import uk.org.taverna.scufl2.api.port.ReceiverPort;
+import uk.org.taverna.scufl2.api.port.SenderPort;
+
+/**
+ * Action to create a dataflow input/output port and connect it to the specified
+ * processor/activity output/input port.
+ * <p>
+ * The created dataflow port name will be taken from the name of the provided
+ * port.
+ *
+ * @author Stian Soiland-Reyes
+ *
+ */
+@SuppressWarnings("serial")
+public class CreateAndConnectDataflowPortAction extends AbstractAction {
+
+	private static final String VALID_PORT_NAME_REGEX = "[\\p{L}\\p{Digit}_.]+";
+	private static final Dimension INPUT_PORT_DIALOGUE_SIZE = new Dimension(400, 250);
+	private static final Dimension OUTPUT_PORT_DIALOGUE_SIZE = new Dimension(400, 200);
+
+	private static final String INVALID_WORKFLOW_OUTPUT_PORT_NAME = "Invalid workflow output port name.";
+	private static final String DUPLICATE_WORKFLOW_OUTPUT_PORT_NAME = "Duplicate workflow output port name.";
+	private static final String SET_THE_WORKFLOW_OUTPUT_PORT_NAME = "Set the workflow output port name.";
+	private static final String ADD_WORKFLOW_OUTPUT_PORT = "Add workflow output port";
+	private static final String SET_THE_INPUT_PORT_LIST_DEPTH = "Set the input port list depth.";
+	private static final String SET_THE_INPUT_PORT_TYPE = "Set the input port type.";
+	private static final String INVALID_WORKFLOW_INPUT_PORT_NAME = "Invalid workflow input port name.";
+	private static final String DUPLICATE_WORKFLOW_INPUT_PORT_NAME = "Duplicate workflow input port name.";
+	private static final String SET_THE_WORKFLOW_INPUT_PORT_NAME = "Set the workflow input port name.";
+	private static final String ADD_WORKFLOW_INPUT_PORT = "Add workflow input port";
+	private static Logger logger = Logger.getLogger(CreateAndConnectDataflowPortAction.class);
+	private final Workflow workflow;
+
+	private final Port port;
+	private final String suggestedName;
+	private final Component parentComponent;
+	private final EditManager editManager;
+
+	/**
+	 * Action for creating a Workflow input/output port and linking it to the
+	 * specified port.
+	 * <p>
+	 * If the provided port is an InputPort then a
+	 * Workflow OutputPort will be created and linked. Vice versa, if the
+	 * provided port is an OutputPort, a Workflow InputPort will be created.
+	 *
+	 * @param workflow
+	 *            Workflow where to create the Workflow input/output port
+	 * @param port
+	 *            Existing Processor port to connect to
+	 * @param suggestedName
+	 *            suggested port name
+	 * @param parentComponent
+	 *            Component to be parent of any pop-ups
+	 */
+	public CreateAndConnectDataflowPortAction(Workflow workflow, Port port,
+			String suggestedName, Component parentComponent, EditManager editManager) {
+		super("Connect to new workflow port");
+		this.workflow = workflow;
+		this.port = port;
+		this.suggestedName = suggestedName;
+		this.parentComponent = parentComponent;
+		this.editManager = editManager;
+		if (!(port instanceof InputPort || port instanceof OutputPort)) {
+			throw new IllegalArgumentException("Port " + port
+					+ " must be either an InputPort or OutputPort");
+		}
+	}
+
+	public void actionPerformed(ActionEvent e) {
+		if (port instanceof ReceiverPort) {
+			InputWorkflowPort inputWorkflowPort = new InputWorkflowPort();
+			inputWorkflowPort.setName(suggestedName);
+			workflow.getInputPorts().addWithUniqueName(inputWorkflowPort);
+			workflow.getInputPorts().remove(inputWorkflowPort);
+			if (port instanceof DepthPort) {
+				inputWorkflowPort.setDepth(((DepthPort) port).getDepth());
+			} else {
+				inputWorkflowPort.setDepth(0);
+			}
+			showDialogue(inputWorkflowPort);
+
+		} else if (port instanceof SenderPort) {
+			OutputWorkflowPort outputWorkflowPort = new OutputWorkflowPort();
+			outputWorkflowPort.setName(suggestedName);
+			workflow.getOutputPorts().addWithUniqueName(outputWorkflowPort);
+			workflow.getOutputPorts().remove(outputWorkflowPort);
+			showDialogue(outputWorkflowPort);
+		} else {
+			throw new IllegalStateException("Port " + port
+					+ " must be either an InputPort or OutputPort");
+		}
+
+	}
+
+	protected void showDialogue(InputWorkflowPort portTemplate) {
+		Set<String> usedInputPorts = new HashSet<String>();
+		for (InputWorkflowPort usedInputPort : workflow.getInputPorts()) {
+			usedInputPorts.add(usedInputPort.getName());
+		}
+		DataflowInputPortPanel inputPanel = new DataflowInputPortPanel();
+
+		ValidatingUserInputDialog vuid = new ValidatingUserInputDialog(
+				ADD_WORKFLOW_INPUT_PORT, inputPanel);
+		vuid.addTextComponentValidation(inputPanel.getPortNameField(),
+				SET_THE_WORKFLOW_INPUT_PORT_NAME, usedInputPorts,
+				DUPLICATE_WORKFLOW_INPUT_PORT_NAME, VALID_PORT_NAME_REGEX,
+				INVALID_WORKFLOW_INPUT_PORT_NAME);
+		vuid.addMessageComponent(inputPanel.getSingleValueButton(),
+				SET_THE_INPUT_PORT_TYPE);
+		vuid.addMessageComponent(inputPanel.getListValueButton(),
+				SET_THE_INPUT_PORT_LIST_DEPTH);
+		vuid.setSize(INPUT_PORT_DIALOGUE_SIZE);
+
+		inputPanel.setPortName(portTemplate.getName());
+		inputPanel.setPortDepth(portTemplate.getDepth());
+
+		if (vuid.show(parentComponent)) {
+			InputWorkflowPort inputWorkflowPort = new InputWorkflowPort();
+			inputWorkflowPort.setName(inputPanel.getPortName());
+			inputWorkflowPort.setDepth(inputPanel.getPortDepth());
+			List<Edit<?>> editList = new ArrayList<Edit<?>>();
+			editList.add(new AddWorkflowInputPortEdit(workflow, inputWorkflowPort));
+			DataLink dataLink = new DataLink();
+			dataLink.setReceivesFrom(inputWorkflowPort);
+			dataLink.setSendsTo((ReceiverPort) port);
+			editList.add(new AddDataLinkEdit(workflow, dataLink));
+			try {
+				CompoundEdit compoundEdit = new CompoundEdit(editList);
+				editManager.doDataflowEdit(workflow.getParent(), compoundEdit);
+			} catch (EditException ex) {
+				logger.warn("Can't create or connect new input port", ex);
+			}
+
+		}
+	}
+
+	protected void showDialogue(OutputWorkflowPort portTemplate) {
+		Set<String> usedOutputPorts = new HashSet<String>();
+		for (OutputWorkflowPort usedInputPort : workflow.getOutputPorts()) {
+			usedOutputPorts.add(usedInputPort.getName());
+		}
+		DataflowOutputPortPanel outputPanel = new DataflowOutputPortPanel();
+
+		ValidatingUserInputDialog vuid = new ValidatingUserInputDialog(
+				ADD_WORKFLOW_OUTPUT_PORT, outputPanel);
+		vuid.addTextComponentValidation(outputPanel.getPortNameField(),
+				SET_THE_WORKFLOW_OUTPUT_PORT_NAME, usedOutputPorts,
+				DUPLICATE_WORKFLOW_OUTPUT_PORT_NAME,
+				VALID_PORT_NAME_REGEX, INVALID_WORKFLOW_OUTPUT_PORT_NAME);
+		vuid.setSize(OUTPUT_PORT_DIALOGUE_SIZE);
+		outputPanel.setPortName(portTemplate.getName());
+
+		if (vuid.show(parentComponent)) {
+			OutputWorkflowPort outputWorkflowPort = new OutputWorkflowPort();
+			outputWorkflowPort.setName(outputPanel.getPortName());
+			List<Edit<?>> editList = new ArrayList<Edit<?>>();
+			editList.add(new AddWorkflowOutputPortEdit(workflow, outputWorkflowPort));
+			DataLink dataLink = new DataLink();
+			dataLink.setReceivesFrom((SenderPort) port);
+			dataLink.setSendsTo(outputWorkflowPort);
+			editList.add(new AddDataLinkEdit(workflow, dataLink));
+			try {
+				CompoundEdit compoundEdit = new CompoundEdit(editList);
+				editManager.doDataflowEdit(workflow.getParent(), compoundEdit);
+			} catch (EditException ex) {
+				logger.warn("Can't create or connect new workflow output port", ex);
+			}
+		}
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/52fd79dd/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/activityport/SetConstantInputPortValueMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/activityport/SetConstantInputPortValueMenuAction.java b/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/activityport/SetConstantInputPortValueMenuAction.java
new file mode 100644
index 0000000..30a91c6
--- /dev/null
+++ b/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/activityport/SetConstantInputPortValueMenuAction.java
@@ -0,0 +1,73 @@
+/**********************************************************************
+ * 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.items.activityport;
+
+import javax.swing.Action;
+
+import net.sf.taverna.t2.ui.menu.AbstractContextualMenuAction;
+import net.sf.taverna.t2.workbench.edits.EditManager;
+import net.sf.taverna.t2.workbench.selection.SelectionManager;
+import uk.org.taverna.commons.services.ServiceRegistry;
+import uk.org.taverna.scufl2.api.core.Workflow;
+import uk.org.taverna.scufl2.api.port.InputProcessorPort;
+
+public class SetConstantInputPortValueMenuAction extends AbstractContextualMenuAction {
+
+	private EditManager editManager;
+	private SelectionManager selectionManager;
+	private ServiceRegistry serviceRegistry;
+
+	public SetConstantInputPortValueMenuAction() {
+		super(ActivityInputPortSection.activityInputPortSection, 10);
+	}
+
+	@Override
+	public synchronized Action getAction() {
+		SetDefaultInputPortValueAction action = (SetDefaultInputPortValueAction) super.getAction();
+		action.updateStatus();
+		return action;
+	}
+
+	@Override
+	public boolean isEnabled() {
+		return super.isEnabled()
+				&& getContextualSelection().getSelection() instanceof InputProcessorPort
+				&& getContextualSelection().getParent() instanceof Workflow;
+	}
+
+	@Override
+	protected Action createAction() {
+		return new SetDefaultInputPortValueAction(editManager, selectionManager, serviceRegistry);
+	}
+
+	public void setEditManager(EditManager editManager) {
+		this.editManager = editManager;
+	}
+
+	public void setSelectionManager(SelectionManager selectionManager) {
+		this.selectionManager = selectionManager;
+	}
+
+	public void setServiceRegistry(ServiceRegistry serviceRegistry) {
+		this.serviceRegistry = serviceRegistry;
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/52fd79dd/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/activityport/SetDefaultInputPortValueAction.java
----------------------------------------------------------------------
diff --git a/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/activityport/SetDefaultInputPortValueAction.java b/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/activityport/SetDefaultInputPortValueAction.java
new file mode 100644
index 0000000..302aaf6
--- /dev/null
+++ b/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/activityport/SetDefaultInputPortValueAction.java
@@ -0,0 +1,171 @@
+/*******************************************************************************
+ * 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.items.activityport;
+
+import java.awt.event.ActionEvent;
+import java.util.Set;
+
+import javax.swing.AbstractAction;
+import javax.swing.JOptionPane;
+
+import net.sf.taverna.t2.lang.observer.Observable;
+import net.sf.taverna.t2.lang.observer.Observer;
+import net.sf.taverna.t2.lang.observer.SwingAwareObserver;
+import net.sf.taverna.t2.workbench.edits.EditManager;
+import net.sf.taverna.t2.workbench.icons.WorkbenchIcons;
+import net.sf.taverna.t2.workbench.selection.DataflowSelectionModel;
+import net.sf.taverna.t2.workbench.selection.SelectionManager;
+import net.sf.taverna.t2.workbench.selection.events.DataflowSelectionMessage;
+import net.sf.taverna.t2.workbench.selection.events.PerspectiveSelectionEvent;
+import net.sf.taverna.t2.workbench.selection.events.SelectionManagerEvent;
+import net.sf.taverna.t2.workbench.selection.events.WorkflowBundleSelectionEvent;
+import uk.org.taverna.commons.services.ServiceRegistry;
+import uk.org.taverna.scufl2.api.common.Scufl2Tools;
+import uk.org.taverna.scufl2.api.container.WorkflowBundle;
+import uk.org.taverna.scufl2.api.port.InputProcessorPort;
+
+/**
+ * An action that sets a default value to a processor's input port, in case
+ * the input port is selected on the Graph View.
+ *
+ * @author Alex Nenadic
+ */
+@SuppressWarnings("serial")
+public class SetDefaultInputPortValueAction extends AbstractAction {
+
+	/* Current workflow's selection model event observer. */
+	private Observer<DataflowSelectionMessage> workflowSelectionObserver = new DataflowSelectionObserver();
+
+	private final EditManager editManager;
+	private final SelectionManager selectionManager;
+	private final ServiceRegistry serviceRegistry;
+
+	private Scufl2Tools scufl2Tools = new Scufl2Tools();
+
+	public SetDefaultInputPortValueAction(EditManager editManager,
+			SelectionManager selectionManager, ServiceRegistry serviceRegistry) {
+		super();
+		this.editManager = editManager;
+		this.selectionManager = selectionManager;
+		this.serviceRegistry = serviceRegistry;
+		putValue(SMALL_ICON, WorkbenchIcons.inputValueIcon);
+		putValue(NAME, "Constant value");
+		putValue(SHORT_DESCRIPTION, "Add a constant value for an input port");
+		setEnabled(false);
+
+		selectionManager.addObserver(new SelectionManagerObserver());
+
+	}
+
+	public void actionPerformed(ActionEvent e) {
+		WorkflowBundle workflowBundle = selectionManager.getSelectedWorkflowBundle();
+		DataflowSelectionModel dataFlowSelectionModel = selectionManager
+				.getDataflowSelectionModel(workflowBundle);
+		// Get selected port
+		Set<Object> selectedWFComponents = dataFlowSelectionModel.getSelection();
+		if (selectedWFComponents.size() > 1) {
+			JOptionPane.showMessageDialog(null,
+					"Only one workflow component should be selected for this action.", "Warning",
+					JOptionPane.WARNING_MESSAGE);
+		} else {
+			Object selectedWFComponent = selectedWFComponents.toArray()[0];
+			if (selectedWFComponent instanceof InputProcessorPort) {
+				new AddInputPortDefaultValueAction(workflowBundle.getMainWorkflow(),
+						(InputProcessorPort) selectedWFComponent, null, editManager,
+						selectionManager, serviceRegistry).actionPerformed(e);
+			}
+		}
+	}
+
+	/**
+	 * Check if action should be enabled or disabled and update its status.
+	 */
+	public void updateStatus() {
+		WorkflowBundle workflowBundle = selectionManager.getSelectedWorkflowBundle();
+		DataflowSelectionModel selectionModel = selectionManager
+				.getDataflowSelectionModel(workflowBundle);
+
+		// List of all selected objects in the graph view
+		Set<Object> selection = selectionModel.getSelection();
+
+		if (selection.isEmpty()) {
+			setEnabled(false);
+		} else {
+			// Take the first selected item - we only support single selections anyway
+			Object selected = selection.toArray()[0];
+			if (selected instanceof InputProcessorPort) {
+				// If this input port is not already connected to something - enable the button
+				setEnabled(scufl2Tools.datalinksTo((InputProcessorPort) selected).isEmpty());
+			}
+		}
+	}
+
+	/**
+	 * Observes events on workflow Selection Manager, i.e. when a workflow
+	 * node is selected in the graph view, and enables/disables this action accordingly.
+	 */
+	private final class DataflowSelectionObserver implements Observer<DataflowSelectionMessage> {
+
+		public void notify(Observable<DataflowSelectionMessage> sender,
+				DataflowSelectionMessage message) throws Exception {
+			updateStatus();
+		}
+	}
+
+	private final class SelectionManagerObserver extends SwingAwareObserver<SelectionManagerEvent> {
+
+		private static final String DESIGN_PERSPECTIVE_ID = "net.sf.taverna.t2.ui.perspectives.design.DesignPerspective";
+
+		@Override
+		public void notifySwing(Observable<SelectionManagerEvent> sender,
+				SelectionManagerEvent message) {
+			if (message instanceof WorkflowBundleSelectionEvent) {
+				WorkflowBundleSelectionEvent workflowBundleSelectionEvent = (WorkflowBundleSelectionEvent) message;
+				WorkflowBundle oldFlow = workflowBundleSelectionEvent
+						.getPreviouslySelectedWorkflowBundle();
+				WorkflowBundle newFlow = workflowBundleSelectionEvent.getSelectedWorkflowBundle();
+				// Update the buttons status as current dataflow has changed
+				updateStatus();
+
+				// Remove the workflow selection model listener from the previous (if any)
+				// and add to the new workflow (if any)
+				if (oldFlow != null) {
+					selectionManager.getDataflowSelectionModel(oldFlow).removeObserver(
+							workflowSelectionObserver);
+				}
+
+				if (newFlow != null) {
+					selectionManager.getDataflowSelectionModel(newFlow).addObserver(
+							workflowSelectionObserver);
+				}
+			} else if (message instanceof PerspectiveSelectionEvent) {
+				PerspectiveSelectionEvent perspectiveSelectionEvent = (PerspectiveSelectionEvent) message;
+				if (DESIGN_PERSPECTIVE_ID.equals(perspectiveSelectionEvent.getSelectedPerspective().getID())) {
+					updateStatus();
+				} else {
+					setEnabled(false);
+				}
+			}
+		}
+
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/52fd79dd/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/annotated/AnnotatedConfigureMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/annotated/AnnotatedConfigureMenuAction.java b/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/annotated/AnnotatedConfigureMenuAction.java
new file mode 100644
index 0000000..7933940
--- /dev/null
+++ b/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/annotated/AnnotatedConfigureMenuAction.java
@@ -0,0 +1,77 @@
+/**********************************************************************
+ * 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.items.annotated;
+
+import java.awt.event.ActionEvent;
+import java.util.List;
+
+import javax.swing.AbstractAction;
+import javax.swing.Action;
+import javax.swing.JOptionPane;
+
+import net.sf.taverna.t2.annotation.Annotated;
+import net.sf.taverna.t2.annotation.AnnotationBeanSPI;
+import net.sf.taverna.t2.ui.menu.AbstractContextualMenuAction;
+import net.sf.taverna.t2.ui.menu.items.contextualviews.ConfigureSection;
+import net.sf.taverna.t2.workbench.edits.EditManager;
+import net.sf.taverna.t2.workbench.selection.SelectionManager;
+import net.sf.taverna.t2.workbench.ui.views.contextualviews.annotated.AnnotatedContextualView;
+
+public class AnnotatedConfigureMenuAction extends AbstractContextualMenuAction {
+	private static final String ANNOTATE = "Annotate...";
+	private EditManager editManager;
+	private SelectionManager selectionManager;
+	private List<AnnotationBeanSPI> annotationBeans;
+
+	public AnnotatedConfigureMenuAction() {
+		super(ConfigureSection.configureSection, 40);
+	}
+
+	@Override
+	public boolean isEnabled() {
+		return super.isEnabled() && (getContextualSelection().getSelection() instanceof Annotated);
+	}
+
+	@SuppressWarnings("serial")
+	@Override
+	protected Action createAction() {
+		return new AbstractAction(ANNOTATE) {
+			public void actionPerformed(ActionEvent e) {
+				AnnotatedContextualView view = new AnnotatedContextualView((Annotated) getContextualSelection().getSelection(),
+						editManager, selectionManager, annotationBeans);
+				JOptionPane.showMessageDialog(null, view.getMainFrame(), "Annotation", JOptionPane.PLAIN_MESSAGE);
+			}
+		};
+	}
+
+	public void setEditManager(EditManager editManager) {
+		this.editManager = editManager;
+	}
+
+	public void setAnnotationBeans(List<AnnotationBeanSPI> annotationBeans) {
+		this.annotationBeans = annotationBeans;
+	}
+
+	public void setSelectionManager(SelectionManager selectionManager) {
+		this.selectionManager = selectionManager;
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/52fd79dd/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/contextualviews/ConfigureRunningContextualMenuSection.java
----------------------------------------------------------------------
diff --git a/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/contextualviews/ConfigureRunningContextualMenuSection.java b/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/contextualviews/ConfigureRunningContextualMenuSection.java
new file mode 100644
index 0000000..9c459e2
--- /dev/null
+++ b/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/contextualviews/ConfigureRunningContextualMenuSection.java
@@ -0,0 +1,50 @@
+/**********************************************************************
+ * 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.items.contextualviews;
+
+import java.net.URI;
+
+import net.sf.taverna.t2.ui.menu.AbstractMenu;
+import net.sf.taverna.t2.ui.menu.ContextualMenuComponent;
+import net.sf.taverna.t2.ui.menu.ContextualSelection;
+
+public class ConfigureRunningContextualMenuSection extends AbstractMenu
+implements ContextualMenuComponent {
+	public static final String CONFIGURE_RUNNING = "Configure running";
+	public static final URI configureRunningSection = URI
+	.create("http://taverna.sf.net/2009/contextMenu/configureRunning");
+	private ContextualSelection contextualSelection;
+
+	public ConfigureRunningContextualMenuSection() {
+		super(ConfigureSection.configureSection, 45, configureRunningSection, CONFIGURE_RUNNING);
+	}
+
+	@Override
+	public boolean isEnabled() {
+		return true;
+//		return super.isEnabled() && contextualSelection instanceof Processor;
+	}
+	
+	public void setContextualSelection(ContextualSelection contextualSelection) {
+		this.contextualSelection = contextualSelection;
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/52fd79dd/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/contextualviews/ConfigureSection.java
----------------------------------------------------------------------
diff --git a/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/contextualviews/ConfigureSection.java b/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/contextualviews/ConfigureSection.java
new file mode 100644
index 0000000..0f1a17f
--- /dev/null
+++ b/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/contextualviews/ConfigureSection.java
@@ -0,0 +1,61 @@
+/**********************************************************************
+ * 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.items.contextualviews;
+
+import java.net.URI;
+
+import net.sf.taverna.t2.ui.menu.AbstractMenuSection;
+import net.sf.taverna.t2.ui.menu.ContextualMenuComponent;
+import net.sf.taverna.t2.ui.menu.ContextualSelection;
+
+/**
+ * Menu section containing the actions to add service templates, i.e. activities
+ * than are not readily runnable but need to be configured first. The actual actions that
+ * go into this menu can be found in the ui modules for the activities.
+ *
+ * @author Alex Nenadic
+ *
+ */
+public class ConfigureSection extends AbstractMenuSection
+		implements ContextualMenuComponent {
+
+	public static final URI configureSection = URI
+			.create("http://taverna.sf.net/2009/contextMenu/configure");
+	private ContextualSelection contextualSelection;
+
+	public ConfigureSection() {
+		super(EditSection.editSection, 100, configureSection);
+	}
+
+	public ContextualSelection getContextualSelection() {
+		return contextualSelection;
+	}
+
+	@Override
+	public boolean isEnabled() {
+		Object selection = getContextualSelection().getSelection();
+		return super.isEnabled();
+	}
+
+	public void setContextualSelection(ContextualSelection contextualSelection) {
+		this.contextualSelection = contextualSelection;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/52fd79dd/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/contextualviews/EditSection.java
----------------------------------------------------------------------
diff --git a/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/contextualviews/EditSection.java b/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/contextualviews/EditSection.java
new file mode 100644
index 0000000..d23ec6e
--- /dev/null
+++ b/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/contextualviews/EditSection.java
@@ -0,0 +1,73 @@
+/**********************************************************************
+ * 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.items.contextualviews;
+
+import java.net.URI;
+
+import javax.swing.Action;
+
+import net.sf.taverna.t2.lang.ui.ShadedLabel;
+import net.sf.taverna.t2.ui.menu.AbstractMenuSection;
+import net.sf.taverna.t2.ui.menu.ContextualMenuComponent;
+import net.sf.taverna.t2.ui.menu.ContextualSelection;
+import net.sf.taverna.t2.ui.menu.DefaultContextualMenu;
+
+/**
+ * Menu section containing the actions to add service templates, i.e. activities
+ * than are not readily runnable but need to be configured first. The actual actions that
+ * go into this menu can be found in the ui modules for the activities.
+ *
+ * @author Alex Nenadic
+ *
+ */
+public class EditSection extends AbstractMenuSection
+		implements ContextualMenuComponent {
+
+	private static final String EDIT = "Edit";
+	public static final URI editSection = URI
+			.create("http://taverna.sf.net/2009/contextMenu/edit");
+	private ContextualSelection contextualSelection;
+
+	public EditSection() {
+		super(DefaultContextualMenu.DEFAULT_CONTEXT_MENU, 10, editSection);
+	}
+
+	public ContextualSelection getContextualSelection() {
+		return contextualSelection;
+	}
+
+	@Override
+	public boolean isEnabled() {
+		return super.isEnabled();
+	}
+
+	public void setContextualSelection(ContextualSelection contextualSelection) {
+		this.contextualSelection = contextualSelection;
+	}
+
+	@Override
+	protected Action createAction() {
+		DummyAction action = new DummyAction(EDIT);
+		// Set the colour for the section
+		action.putValue(AbstractMenuSection.SECTION_COLOR, ShadedLabel.ORANGE);
+		return action;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/52fd79dd/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/contextualviews/InsertSection.java
----------------------------------------------------------------------
diff --git a/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/contextualviews/InsertSection.java b/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/contextualviews/InsertSection.java
new file mode 100644
index 0000000..c1e21f6
--- /dev/null
+++ b/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/contextualviews/InsertSection.java
@@ -0,0 +1,63 @@
+/**********************************************************************
+ * 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.items.contextualviews;
+
+import java.net.URI;
+
+import javax.swing.Action;
+
+import net.sf.taverna.t2.ui.menu.AbstractMenuSection;
+import net.sf.taverna.t2.ui.menu.ContextualMenuComponent;
+import net.sf.taverna.t2.ui.menu.ContextualSelection;
+import net.sf.taverna.t2.ui.menu.DefaultContextualMenu;
+import uk.org.taverna.scufl2.api.core.Workflow;
+
+public class InsertSection extends AbstractMenuSection implements
+		ContextualMenuComponent {
+
+	private static final String INSERT = "Insert";
+	public static final URI insertSection = URI
+			.create("http://taverna.sf.net/2009/contextMenu/insert");
+	private ContextualSelection contextualSelection;
+
+	public InsertSection() {
+		super(DefaultContextualMenu.DEFAULT_CONTEXT_MENU, 20, insertSection);
+	}
+
+	public ContextualSelection getContextualSelection() {
+		return contextualSelection;
+	}
+
+	@Override
+	public boolean isEnabled() {
+		return super.isEnabled()
+				&& getContextualSelection().getSelection() instanceof Workflow;
+	}
+
+	public void setContextualSelection(ContextualSelection contextualSelection) {
+		this.contextualSelection = contextualSelection;
+	}
+
+	@Override
+	protected Action createAction() {
+		return new DummyAction(INSERT);
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/52fd79dd/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/contextualviews/PasteMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/contextualviews/PasteMenuAction.java b/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/contextualviews/PasteMenuAction.java
new file mode 100644
index 0000000..8f9b1f9
--- /dev/null
+++ b/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/contextualviews/PasteMenuAction.java
@@ -0,0 +1,74 @@
+/**********************************************************************
+ * 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.items.contextualviews;
+
+import java.net.URI;
+
+import javax.swing.Action;
+
+import net.sf.taverna.t2.ui.menu.AbstractContextualMenuAction;
+import net.sf.taverna.t2.ui.menu.MenuManager;
+import net.sf.taverna.t2.workbench.edits.EditManager;
+import net.sf.taverna.t2.workbench.selection.SelectionManager;
+import net.sf.taverna.t2.workbench.ui.actions.PasteGraphComponentAction;
+import uk.org.taverna.commons.services.ServiceRegistry;
+import uk.org.taverna.scufl2.api.core.Workflow;
+
+public class PasteMenuAction extends AbstractContextualMenuAction {
+
+	private static final URI PASTE_SERVICE_URI = URI
+	.create("http://taverna.sf.net/2008/t2workbench/paste#pasteServiceComponent");
+
+	private EditManager editManager;
+	private MenuManager menuManager;
+	private SelectionManager selectionManager;
+	private ServiceRegistry serviceRegistry;
+
+	public PasteMenuAction() {
+		super(EditSection.editSection, 20, PASTE_SERVICE_URI);
+	}
+
+	@Override
+	protected Action createAction() {
+		return PasteGraphComponentAction.getInstance(editManager, menuManager, selectionManager, serviceRegistry);
+	}
+
+	public boolean isEnabled() {
+		return super.isEnabled() && (getContextualSelection().getSelection() instanceof Workflow);
+	}
+
+	public void setEditManager(EditManager editManager) {
+		this.editManager = editManager;
+	}
+
+	public void setMenuManager(MenuManager menuManager) {
+		this.menuManager = menuManager;
+	}
+
+	public void setSelectionManager(SelectionManager selectionManager) {
+		this.selectionManager = selectionManager;
+	}
+
+	public void setServiceRegistry(ServiceRegistry serviceRegistry) {
+		this.serviceRegistry = serviceRegistry;
+	}
+
+}