You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@taverna.apache.org by re...@apache.org on 2015/03/26 19:51:50 UTC

[01/51] [partial] incubator-taverna-workbench git commit: all packages are moved to org.apache.taverna.*

Repository: incubator-taverna-workbench
Updated Branches:
  refs/heads/master ed0a8e1fe -> a9a52bd52


http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/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
deleted file mode 100644
index cdbb16e..0000000
--- a/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/contextualviews/InsertSection.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/**********************************************************************
- * 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 org.apache.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);
-	}
-}


[44/51] [partial] incubator-taverna-workbench git commit: all packages are moved to org.apache.taverna.*

Posted by re...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-ui/src/main/java/org/apache/taverna/workbench/ui/servicepanel/tree/TreePanel.java
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-ui/src/main/java/org/apache/taverna/workbench/ui/servicepanel/tree/TreePanel.java b/taverna-activity-palette-ui/src/main/java/org/apache/taverna/workbench/ui/servicepanel/tree/TreePanel.java
new file mode 100644
index 0000000..4fcc6cf
--- /dev/null
+++ b/taverna-activity-palette-ui/src/main/java/org/apache/taverna/workbench/ui/servicepanel/tree/TreePanel.java
@@ -0,0 +1,370 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.servicepanel.tree;
+
+import static java.awt.BorderLayout.CENTER;
+import static java.awt.BorderLayout.NORTH;
+import static java.awt.BorderLayout.WEST;
+import static java.awt.Color.GRAY;
+import static java.awt.GridBagConstraints.HORIZONTAL;
+import static java.awt.GridBagConstraints.NONE;
+import static javax.swing.SwingUtilities.invokeLater;
+import static org.apache.taverna.lang.ui.EdgeLineBorder.TOP;
+
+import java.awt.BorderLayout;
+import java.awt.Component;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.KeyAdapter;
+import java.awt.event.KeyEvent;
+import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.Timer;
+import java.util.TimerTask;
+
+import javax.swing.JButton;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTextField;
+import javax.swing.JTree;
+import javax.swing.border.CompoundBorder;
+import javax.swing.border.EmptyBorder;
+import javax.swing.event.TreeExpansionEvent;
+import javax.swing.event.TreeExpansionListener;
+import javax.swing.tree.TreeCellRenderer;
+import javax.swing.tree.TreePath;
+
+import org.apache.taverna.lang.ui.EdgeLineBorder;
+
+import org.apache.log4j.Logger;
+
+@SuppressWarnings("serial")
+public abstract class TreePanel extends JPanel {
+	private static int MAX_EXPANSION = 100;
+	private static final int SEARCH_WIDTH = 15;
+	private static Logger logger = Logger.getLogger(TreePanel.class);
+
+	protected Set<List<Object>> expandedPaths = new HashSet<>();
+	protected FilterTreeModel filterTreeModel;
+	protected JTextField searchField = new JTextField(SEARCH_WIDTH);
+	protected JTree tree = new JTree();
+	protected JScrollPane treeScrollPane;
+
+	private String availableObjectsString = "";
+	private String matchingObjectsString = "";
+	private String noMatchingObjectsString = "";
+
+	private TreeExpandCollapseListener treeExpandListener = new TreeExpandCollapseListener();
+	private Object filterLock = new Object();
+
+	public TreePanel(FilterTreeModel treeModel) {
+		filterTreeModel = treeModel;
+	}
+
+	public void expandTreePaths() throws InterruptedException,
+			InvocationTargetException {
+//		Filter appliedFilter = filterTreeModel.getCurrentFilter();
+//		if (appliedFilter == null) {
+			for (int i = 0; (i < tree.getRowCount()) && (i < MAX_EXPANSION); i++)
+				tree.expandRow(i);
+//		} else {
+//			boolean rowsFinished = false;
+//			for (int i = 0; (!appliedFilter.isSuperseded()) && (!rowsFinished)
+//					&& (i < MAX_EXPANSION); i++) {
+//				TreePath tp = tree.getPathForRow(i);
+//				if (tp == null) {
+//					rowsFinished = true;
+//				} else {
+//					if (!appliedFilter.pass((DefaultMutableTreeNode) tp
+//							.getLastPathComponent())) {
+//						tree.expandRow(i);
+//					}
+//				}
+//			}
+//		}
+	}
+
+	public void expandAll(FilterTreeNode node, boolean expand) {
+        @SuppressWarnings("unused")
+		FilterTreeNode root = (FilterTreeNode) tree.getModel().getRoot();
+
+        // Traverse tree from root
+        expandAll(new TreePath(node.getPath()), expand);
+    }
+
+    @SuppressWarnings("rawtypes")
+	private void expandAll(TreePath parent, boolean expand) {
+        // Traverse children
+        FilterTreeNode node = (FilterTreeNode) parent.getLastPathComponent();
+        if (node.getChildCount() >= 0)
+            for (Enumeration e=node.children(); e.hasMoreElements(); ) {
+                FilterTreeNode n = (FilterTreeNode) e.nextElement();
+                TreePath path = parent.pathByAddingChild(n);
+                expandAll(path, expand);
+            }
+
+        // Expansion or collapse must be done bottom-up
+        if (expand)
+            tree.expandPath(parent);
+        else
+            tree.collapsePath(parent);
+    }
+
+	protected void initialize() {
+		setLayout(new BorderLayout());
+		treeScrollPane = new JScrollPane(tree);
+		tree.setModel(filterTreeModel);
+		tree.addTreeExpansionListener(treeExpandListener);
+		tree.setCellRenderer(createCellRenderer());
+		tree.setSelectionModel(new FilterTreeSelectionModel());
+
+		JPanel topPanel = new JPanel();
+		topPanel.setBorder(new CompoundBorder(new EdgeLineBorder(TOP, GRAY), new EmptyBorder(10, 5, 0, 5)));
+		topPanel.setLayout(new GridBagLayout());
+		GridBagConstraints c = new GridBagConstraints();
+
+		JLabel filterLabel = new JLabel("Filter:  ");
+		c.fill = NONE;
+		c.gridx = 0;
+		c.gridy = 0;
+		c.weightx = 0.0;
+		c.anchor = GridBagConstraints.LINE_START;
+		topPanel.add(filterLabel, c);
+
+		c.fill = HORIZONTAL;
+		c.gridx = 1;
+		c.gridy = 0;
+		c.weightx = 1.0;
+		topPanel.add(searchField, c);
+
+
+		c.fill = NONE;
+		c.gridx = 2;
+		c.gridy = 0;
+		c.weightx = 0.0;
+		final JButton clearButton = new JButton("Clear");
+		clearButton.addActionListener(new ActionListener() {
+			@Override
+			public void actionPerformed(ActionEvent e) {
+				searchField.setText("");
+				invokeLater(new RunFilter());
+				clearButton.getParent().requestFocusInWindow();// so that the button does not stay focused after it is clicked on and did its action
+			}
+		});
+		topPanel.add(clearButton, c);
+
+		c.gridx = 3;
+		c.weightx = 0.2;
+		topPanel.add(new JPanel(), c);
+
+		JPanel topExtraPanel = new JPanel(new BorderLayout());
+
+		topExtraPanel.add(topPanel, NORTH);
+
+		Component extraComponent = createExtraComponent();
+		if (extraComponent != null) {
+			JPanel extraPanel  = new JPanel();
+			extraPanel.setLayout(new BorderLayout());
+			extraPanel.add(extraComponent, WEST);
+			topExtraPanel.add(extraPanel, CENTER);
+		}
+
+		add(topExtraPanel, NORTH);
+		add(treeScrollPane, CENTER);
+
+		searchField.addKeyListener(new SearchFieldKeyAdapter());
+	}
+
+	protected Component createExtraComponent() {
+		return null;
+	}
+
+	protected TreeCellRenderer createCellRenderer() {
+		return new FilterTreeCellRenderer();
+	}
+
+	public void runFilter() throws InterruptedException,
+			InvocationTargetException {
+		/*
+		 * Special lock object, don't do a synchronized model, as the lock on
+		 * JComponent might deadlock when painting the panel - see comments at
+		 * http://www.mygrid.org.uk/dev/issues/browse/T2-1438
+		 */
+		synchronized (filterLock) {
+			tree.removeTreeExpansionListener(treeExpandListener);
+			String text = searchField.getText();
+			FilterTreeNode root = (FilterTreeNode) tree.getModel().getRoot();
+			if (text.isEmpty()) {
+				setFilter(null);
+				root.setUserObject(getAvailableObjectsString());
+				filterTreeModel.nodeChanged(root);
+				for (List<Object> tp : expandedPaths) {
+	//				for (int i = 0; i < tp.length; i++)
+	//					logger.info("Trying to expand " + tp[i]);
+					tree.expandPath(filterTreeModel.getTreePathForObjectPath(tp));
+				}
+			} else {
+				setFilter(createFilter(text));
+				root.setUserObject(root.getChildCount() > 0 ? getMatchingObjectsString()
+						: getNoMatchingObjectsString());
+				filterTreeModel.nodeChanged(root);
+				expandTreePaths();
+			}
+			tree.addTreeExpansionListener(treeExpandListener);
+		}
+	}
+
+	/**
+	 * @return the availableObjectsString
+	 */
+	public String getAvailableObjectsString() {
+		return availableObjectsString;
+	}
+
+	/**
+	 * @param availableObjectsString the availableObjectsString to set
+	 */
+	public void setAvailableObjectsString(String availableObjectsString) {
+		this.availableObjectsString = availableObjectsString;
+	}
+
+	/**
+	 * @return the matchingObjectsString
+	 */
+	public String getMatchingObjectsString() {
+		return matchingObjectsString;
+	}
+
+	/**
+	 * @param matchingObjectsString the matchingObjectsString to set
+	 */
+	public void setMatchingObjectsString(String matchingObjectsString) {
+		this.matchingObjectsString = matchingObjectsString;
+	}
+
+	/**
+	 * @return the noMatchingObjectsString
+	 */
+	public String getNoMatchingObjectsString() {
+		return noMatchingObjectsString;
+	}
+
+	/**
+	 * @param noMatchingObjectsString the noMatchingObjectsString to set
+	 */
+	public void setNoMatchingObjectsString(String noMatchingObjectsString) {
+		this.noMatchingObjectsString = noMatchingObjectsString;
+	}
+
+	public Filter createFilter(String text) {
+		return new MyFilter(text);
+	}
+
+	public void setFilter(Filter filter) {
+		if (tree.getCellRenderer() instanceof FilterTreeCellRenderer)
+			((FilterTreeCellRenderer)tree.getCellRenderer()).setFilter(filter);
+		filterTreeModel.setFilter(filter);
+	}
+
+	protected class ExpandRowRunnable implements Runnable {
+		int rowNumber;
+
+		public ExpandRowRunnable(int rowNumber) {
+			this.rowNumber = rowNumber;
+		}
+
+		@Override
+		public void run() {
+			tree.expandRow(rowNumber);
+		}
+	}
+
+	protected class RunFilter implements Runnable {
+		@Override
+		public void run() {
+			Filter oldFilter = filterTreeModel.getCurrentFilter();
+			if (oldFilter != null)
+				oldFilter.setSuperseded(true);
+			try {
+				runFilter();
+			} catch (InterruptedException e) {
+				Thread.interrupted();
+			} catch (InvocationTargetException e) {
+				logger.error("", e);
+			}
+		}
+	}
+
+	protected class SearchFieldKeyAdapter extends KeyAdapter {
+		private final Runnable runFilterRunnable;
+		Timer timer = new Timer("Search field timer", true);
+
+		private SearchFieldKeyAdapter() {
+			this.runFilterRunnable = new RunFilter();
+		}
+
+		@Override
+		public void keyReleased(KeyEvent e) {
+			timer.cancel();
+			timer = new Timer();
+			timer.schedule(new TimerTask() {
+				@Override
+				public void run() {
+					invokeLater(runFilterRunnable);
+				}
+			}, 500);
+		}
+	}
+
+	private void noteExpansions() {
+		expandedPaths.clear();
+		TreePath rootPath = new TreePath(filterTreeModel.getRoot());
+		for (Enumeration<TreePath> e = tree.getExpandedDescendants(rootPath); e.hasMoreElements();) {
+			List<Object> userObjects = new ArrayList<>();
+			Object[] expandedPath = e.nextElement().getPath();
+			for (int i = 0; i < expandedPath.length; i++) {
+				FilterTreeNode node = (FilterTreeNode) expandedPath[i];
+//				logger.info("The object in the path is a " + expandedPath[i].getClass());
+				userObjects.add(node.getUserObject());
+//				logger.info("Added " + node.getUserObject() + " to path");
+			}
+			expandedPaths.add(userObjects);
+		}
+	}
+	
+	protected class TreeExpandCollapseListener implements TreeExpansionListener {
+		@Override
+		public void treeCollapsed(TreeExpansionEvent event) {
+			noteExpansions();
+		}
+
+		@Override
+		public void treeExpanded(TreeExpansionEvent event) {
+			noteExpansions();
+		}
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.ui.zaria.UIComponentFactorySPI
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.ui.zaria.UIComponentFactorySPI b/taverna-activity-palette-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.ui.zaria.UIComponentFactorySPI
deleted file mode 100644
index bb87331..0000000
--- a/taverna-activity-palette-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.ui.zaria.UIComponentFactorySPI
+++ /dev/null
@@ -1 +0,0 @@
-net.sf.taverna.t2.workbench.ui.servicepanel.ServicePanelComponentFactory
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-ui/src/main/resources/META-INF/services/org.apache.taverna.workbench.ui.zaria.UIComponentFactorySPI
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-ui/src/main/resources/META-INF/services/org.apache.taverna.workbench.ui.zaria.UIComponentFactorySPI b/taverna-activity-palette-ui/src/main/resources/META-INF/services/org.apache.taverna.workbench.ui.zaria.UIComponentFactorySPI
new file mode 100644
index 0000000..a914820
--- /dev/null
+++ b/taverna-activity-palette-ui/src/main/resources/META-INF/services/org.apache.taverna.workbench.ui.zaria.UIComponentFactorySPI
@@ -0,0 +1 @@
+org.apache.taverna.workbench.ui.servicepanel.ServicePanelComponentFactory
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-ui/src/main/resources/META-INF/spring/activity-palette-ui-context-osgi.xml
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-ui/src/main/resources/META-INF/spring/activity-palette-ui-context-osgi.xml b/taverna-activity-palette-ui/src/main/resources/META-INF/spring/activity-palette-ui-context-osgi.xml
index 2d96b28..73e3fbe 100644
--- a/taverna-activity-palette-ui/src/main/resources/META-INF/spring/activity-palette-ui-context-osgi.xml
+++ b/taverna-activity-palette-ui/src/main/resources/META-INF/spring/activity-palette-ui-context-osgi.xml
@@ -8,13 +8,13 @@
 
 	<service ref="ServiceDescriptionConfigUIFactory" interface="uk.org.taverna.configuration.ConfigurationUIFactory" />
 
-	<service ref="ServicePanelComponentFactory" interface="net.sf.taverna.t2.workbench.ui.zaria.UIComponentFactorySPI" />
+	<service ref="ServicePanelComponentFactory" interface="org.apache.taverna.workbench.ui.zaria.UIComponentFactorySPI" />
 
-	<reference id="editManager" interface="net.sf.taverna.t2.workbench.edits.EditManager" />
-	<reference id="menuManager" interface="net.sf.taverna.t2.ui.menu.MenuManager" />
-	<reference id="selectionManager" interface="net.sf.taverna.t2.workbench.selection.SelectionManager" />
-	<reference id="serviceDescriptionRegistry" interface="net.sf.taverna.t2.servicedescriptions.ServiceDescriptionRegistry"/>
-	<reference id="serviceDescriptionsConfiguration" interface="net.sf.taverna.t2.servicedescriptions.ServiceDescriptionsConfiguration"/>
+	<reference id="editManager" interface="org.apache.taverna.workbench.edits.EditManager" />
+	<reference id="menuManager" interface="org.apache.taverna.ui.menu.MenuManager" />
+	<reference id="selectionManager" interface="org.apache.taverna.workbench.selection.SelectionManager" />
+	<reference id="serviceDescriptionRegistry" interface="org.apache.taverna.servicedescriptions.ServiceDescriptionRegistry"/>
+	<reference id="serviceDescriptionsConfiguration" interface="org.apache.taverna.servicedescriptions.ServiceDescriptionsConfiguration"/>
 	<reference id="serviceRegistry" interface="uk.org.taverna.commons.services.ServiceRegistry" />
 
 </beans:beans>

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-ui/src/main/resources/META-INF/spring/activity-palette-ui-context.xml
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-ui/src/main/resources/META-INF/spring/activity-palette-ui-context.xml b/taverna-activity-palette-ui/src/main/resources/META-INF/spring/activity-palette-ui-context.xml
index f0a11c1..fdb40db 100644
--- a/taverna-activity-palette-ui/src/main/resources/META-INF/spring/activity-palette-ui-context.xml
+++ b/taverna-activity-palette-ui/src/main/resources/META-INF/spring/activity-palette-ui-context.xml
@@ -5,13 +5,13 @@
                       http://www.springframework.org/schema/beans/spring-beans.xsd">
 
 	<bean id="ServiceDescriptionConfigUIFactory"
-		class="net.sf.taverna.t2.workbench.ui.servicepanel.config.ServiceDescriptionConfigUIFactory">
+		class="org.apache.taverna.workbench.ui.servicepanel.config.ServiceDescriptionConfigUIFactory">
 		<property name="serviceDescriptionRegistry" ref="serviceDescriptionRegistry" />
 		<property name="serviceDescriptionsConfiguration" ref="serviceDescriptionsConfiguration" />
 	</bean>
 
 	<bean id="ServicePanelComponentFactory"
-		class="net.sf.taverna.t2.workbench.ui.servicepanel.ServicePanelComponentFactory">
+		class="org.apache.taverna.workbench.ui.servicepanel.ServicePanelComponentFactory">
 		<property name="editManager" ref="editManager" />
 		<property name="menuManager" ref="menuManager" />
 		<property name="selectionManager" ref="selectionManager" />

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-tools/src/main/java/net/sf/taverna/t2/workbench/activitytools/AbstractConfigureActivityMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-activity-tools/src/main/java/net/sf/taverna/t2/workbench/activitytools/AbstractConfigureActivityMenuAction.java b/taverna-activity-tools/src/main/java/net/sf/taverna/t2/workbench/activitytools/AbstractConfigureActivityMenuAction.java
deleted file mode 100644
index 8ca91e8..0000000
--- a/taverna-activity-tools/src/main/java/net/sf/taverna/t2/workbench/activitytools/AbstractConfigureActivityMenuAction.java
+++ /dev/null
@@ -1,64 +0,0 @@
-package net.sf.taverna.t2.workbench.activitytools;
-
-import static javax.swing.Action.NAME;
-
-import java.awt.Frame;
-import java.net.URI;
-
-import javax.swing.Action;
-
-import org.apache.taverna.scufl2.api.activity.Activity;
-import org.apache.taverna.scufl2.api.common.Scufl2Tools;
-import org.apache.taverna.scufl2.api.core.Processor;
-import org.apache.taverna.scufl2.api.profiles.ProcessorBinding;
-import org.apache.taverna.scufl2.api.profiles.Profile;
-import net.sf.taverna.t2.ui.menu.AbstractContextualMenuAction;
-import net.sf.taverna.t2.workbench.ui.Utils;
-
-public abstract class AbstractConfigureActivityMenuAction extends AbstractContextualMenuAction {
-	private static final URI configureSection = URI
-			.create("http://taverna.sf.net/2009/contextMenu/configure");
-
-	protected Scufl2Tools scufl2Tools = new Scufl2Tools();
-	protected final URI activityType;
-
-	public AbstractConfigureActivityMenuAction(URI activityType) {
-		super(configureSection, 50);
-		this.activityType = activityType;
-	}
-
-	@Override
-	public boolean isEnabled() {
-		return super.isEnabled() && findActivity() != null;
-	}
-
-	protected Activity findActivity() {
-		if (getContextualSelection() == null)
-			return null;
-		Object selection = getContextualSelection().getSelection();
-		if (selection instanceof Activity) {
-			Activity activity = (Activity) selection;
-			if (activity.getType().equals(activityType))
-				return activity;
-		}
-		if (selection instanceof Processor) {
-			Processor processor = (Processor) selection;
-			Profile profile = processor.getParent().getParent().getMainProfile();
-			for (ProcessorBinding processorBinding : scufl2Tools.processorBindingsForProcessor(processor, profile))
-				if (processorBinding.getBoundActivity().getType().equals(activityType))
-					return processorBinding.getBoundActivity();
-		}
-		return null;
-	}
-
-	protected Frame getParentFrame() {
-		return Utils.getParentFrame(getContextualSelection()
-				.getRelativeToComponent());
-	}
-
-	protected void addMenuDots(Action configAction) {
-		String oldName = (String) configAction.getValue(NAME);
-		if (!oldName.endsWith(".."))
-			configAction.putValue(NAME, oldName + "...");
-	}
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-tools/src/main/java/org/apache/taverna/workbench/activitytools/AbstractConfigureActivityMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-activity-tools/src/main/java/org/apache/taverna/workbench/activitytools/AbstractConfigureActivityMenuAction.java b/taverna-activity-tools/src/main/java/org/apache/taverna/workbench/activitytools/AbstractConfigureActivityMenuAction.java
new file mode 100644
index 0000000..a3660cf
--- /dev/null
+++ b/taverna-activity-tools/src/main/java/org/apache/taverna/workbench/activitytools/AbstractConfigureActivityMenuAction.java
@@ -0,0 +1,83 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.activitytools;
+
+import static javax.swing.Action.NAME;
+
+import java.awt.Frame;
+import java.net.URI;
+
+import javax.swing.Action;
+
+import org.apache.taverna.scufl2.api.activity.Activity;
+import org.apache.taverna.scufl2.api.common.Scufl2Tools;
+import org.apache.taverna.scufl2.api.core.Processor;
+import org.apache.taverna.scufl2.api.profiles.ProcessorBinding;
+import org.apache.taverna.scufl2.api.profiles.Profile;
+import org.apache.taverna.ui.menu.AbstractContextualMenuAction;
+import org.apache.taverna.workbench.ui.Utils;
+
+public abstract class AbstractConfigureActivityMenuAction extends AbstractContextualMenuAction {
+	private static final URI configureSection = URI
+			.create("http://taverna.sf.net/2009/contextMenu/configure");
+
+	protected Scufl2Tools scufl2Tools = new Scufl2Tools();
+	protected final URI activityType;
+
+	public AbstractConfigureActivityMenuAction(URI activityType) {
+		super(configureSection, 50);
+		this.activityType = activityType;
+	}
+
+	@Override
+	public boolean isEnabled() {
+		return super.isEnabled() && findActivity() != null;
+	}
+
+	protected Activity findActivity() {
+		if (getContextualSelection() == null)
+			return null;
+		Object selection = getContextualSelection().getSelection();
+		if (selection instanceof Activity) {
+			Activity activity = (Activity) selection;
+			if (activity.getType().equals(activityType))
+				return activity;
+		}
+		if (selection instanceof Processor) {
+			Processor processor = (Processor) selection;
+			Profile profile = processor.getParent().getParent().getMainProfile();
+			for (ProcessorBinding processorBinding : scufl2Tools.processorBindingsForProcessor(processor, profile))
+				if (processorBinding.getBoundActivity().getType().equals(activityType))
+					return processorBinding.getBoundActivity();
+		}
+		return null;
+	}
+
+	protected Frame getParentFrame() {
+		return Utils.getParentFrame(getContextualSelection()
+				.getRelativeToComponent());
+	}
+
+	protected void addMenuDots(Action configAction) {
+		String oldName = (String) configAction.getValue(NAME);
+		if (!oldName.endsWith(".."))
+			configAction.putValue(NAME, oldName + "...");
+	}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-beaninfo/src/main/java/net/sf/taverna/t2/lang/beans/PropertyAnnotated.java
----------------------------------------------------------------------
diff --git a/taverna-beaninfo/src/main/java/net/sf/taverna/t2/lang/beans/PropertyAnnotated.java b/taverna-beaninfo/src/main/java/net/sf/taverna/t2/lang/beans/PropertyAnnotated.java
deleted file mode 100644
index aa59e68..0000000
--- a/taverna-beaninfo/src/main/java/net/sf/taverna/t2/lang/beans/PropertyAnnotated.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/**********************************************************************
- * Copyright (C) 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.lang.beans;
-
-import java.beans.BeanInfo;
-import java.beans.Introspector;
-import java.beans.PropertyDescriptor;
-import java.beans.SimpleBeanInfo;
-
-/**
- * A {@link BeanInfo} that includes {@link PropertyDescriptor}s from methods
- * annotated using {@link PropertyAnnotation}.
- * <p>
- * The bean info from the PropertyAnnotation will then be available through
- * Java's {@link Introspector}, and allows you to specify details such as
- * {@link PropertyAnnotation#displayName()} and
- * {@link PropertyAnnotation#hidden()} for the properties of a Java Bean.
- * <p>
- * This class can either be used as a superclass for the classes containing
- * property annotated methods, or put in a neighbouring BeanInfo class.
- * <p>
- * For instance, if your class is called DescribedClass and has methods
- * annotated using {@link PropertyAnnotation}, either let DescribedClass
- * subclass {@link PropertyAnnotated}, or make a neighbouring {@link BeanInfo}
- * class called DescribedClassBeanInfo, which should subclass
- * {@link PropertyAnnotated}.
- * 
- * 
- * @author Stian Soiland-Reyes
- * 
- */
-public class PropertyAnnotated extends SimpleBeanInfo {
-
-	private static PropertyAnnotationExtractor extractor = new PropertyAnnotationExtractor();
-
-	/**
-	 * {@inheritDoc}
-	 */
-	@Override
-	public PropertyDescriptor[] getPropertyDescriptors() {
-		return extractor.getPropertyDescriptors(getDescribedClass());
-	}
-
-	/**
-	 * The class that is being described. By default this returns
-	 * {@link #getClass()} so that {@link PropertyAnnotated} can be used as a
-	 * superclass, but if instead the DescribedClassBeanInfo pattern is used,
-	 * subclass PropertyAnnotated in each BeanInfo class, and override this
-	 * method to return the described class. (DescribedClass in this example)
-	 * 
-	 */
-	public Class<?> getDescribedClass() {
-		return getClass();
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-beaninfo/src/main/java/net/sf/taverna/t2/lang/beans/PropertyAnnotation.java
----------------------------------------------------------------------
diff --git a/taverna-beaninfo/src/main/java/net/sf/taverna/t2/lang/beans/PropertyAnnotation.java b/taverna-beaninfo/src/main/java/net/sf/taverna/t2/lang/beans/PropertyAnnotation.java
deleted file mode 100644
index 5923a21..0000000
--- a/taverna-beaninfo/src/main/java/net/sf/taverna/t2/lang/beans/PropertyAnnotation.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/**********************************************************************
- * Copyright (C) 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.lang.beans;
-
-import java.beans.Introspector;
-import java.beans.PropertyDescriptor;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * An annotation of a Java bean style property method, ie. a getXX() or setXX()
- * method.
- * <p>
- * The annotations allow the method to better describe properties such as
- * {@link #displayName()}, {@link #shortDescription()} and {@link #hidden()}.
- * <p>
- * The annotations can be retrieved as {@link PropertyDescriptor} using
- * {@link PropertyAnnotationExtractor}, or if {@link PropertyAnnotated} has been
- * used (recommended), through Java's BeanInfo support, such as using
- * {@link Introspector}.
- * <p>
- * Annotations can be applied to interfaces or classes, abstract and normal 
- * methods, as long as they confirm with the Java bean conventions. Annotations 
- * will be inherited, so overriding methods don't need to reapply the annotations,
- * although they can if they want to override.
- * <p>
- * It is recommended that classes using these annotations either subclass
- * {@link PropertyAnnotated} or have a neighbouring BeanInfo class that
- * subclasses PropertyAnnotated.
- * <p>
- * Example usage:
- * 
- * <pre>
- * 	public interface MyBean {
- *		// Annotation for the property called "name". displayName: Title
- *		// of the property shown in UI instead of "name".
- *		&#064;PropertyAnnotation(displayName = "Full name")
- *		public String getName();
- *
- *		// Second annotation for the write-method of the same property called
- *		// "name". Both displayName and shortDescription will be set on the
- *		// property descriptor.
- *		&#064;PropertyAnnotation(shortDescription = "The name of the person")
- *		public void setName(String name);
- *
- *		// Boolean read method for the property "married", two annotations.
- *		// expert: Only shown in UI under "advanced" views.
- *		&#064;PropertyAnnotation(expert = true, shortDescription = "Marital status")
- *		public boolean isMarried();
- *
- *		// Write-method for the "married" property, no new annotations, but will
- *		// get the ones from {&#064;link #isMarried()}.
- *		public void setMarried(boolean married);
- *
- *		// Write-only method, hidden (not shown in UIs).
- *		&#064;PropertyAnnotation(hidden = true)
- *		public void setID(String id);
- *
- *		// Read-only method, no annotations, defaults will be used.
- *		public void getTelephoneNumber(String number);
- *	}
- * </pre>
- * 
- * @see PropertyAnnotated
- * @author Stian Soiland-Reyes
- * 
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Target( { ElementType.METHOD })
-public @interface PropertyAnnotation {
-
-	/**
-	 * A unique string that means the default should be used
-	 */
-	public static String DEFAULT = "Default_8930B86A-50C0-4859-9B6F-DD034B3C5C1E";
-
-	String displayName() default DEFAULT;
-
-	String name() default DEFAULT;
-
-	String shortDescription() default DEFAULT;
-
-	boolean expert() default false;
-
-	boolean hidden() default false;
-
-	boolean preferred() default false;
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-beaninfo/src/main/java/net/sf/taverna/t2/lang/beans/PropertyAnnotationExtractor.java
----------------------------------------------------------------------
diff --git a/taverna-beaninfo/src/main/java/net/sf/taverna/t2/lang/beans/PropertyAnnotationExtractor.java b/taverna-beaninfo/src/main/java/net/sf/taverna/t2/lang/beans/PropertyAnnotationExtractor.java
deleted file mode 100644
index 4524822..0000000
--- a/taverna-beaninfo/src/main/java/net/sf/taverna/t2/lang/beans/PropertyAnnotationExtractor.java
+++ /dev/null
@@ -1,202 +0,0 @@
-/**********************************************************************
- * Copyright (C) 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.lang.beans;
-
-import java.beans.IntrospectionException;
-import java.beans.PropertyDescriptor;
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.WeakHashMap;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-/**
- * A utility class for extracting {@link PropertyDescriptor}s from a class which
- * methods have been described using {@link PropertyAnnotation}.
- * 
- * @author Stian Soiland-Reyes
- * 
- */
-public class PropertyAnnotationExtractor {
-
-	protected static Pattern methodPattern = Pattern
-			.compile("(get|is|set)(.+)");
-
-	protected WeakHashMap<Class<?>, List<Method>> allMethodsCache = new WeakHashMap<Class<?>, List<Method>>();
-
-	protected WeakHashMap<Class<?>, PropertyDescriptor[]> propertyDescriptorsCache = new WeakHashMap<Class<?>, PropertyDescriptor[]>();
-
-	@SuppressWarnings("unchecked")
-	protected List<Class> ignoreClasses = Arrays.<Class>asList(Class.class, Object.class, PropertyAnnotated.class);
-	
-	/**
-	 * Find PropertyDescriptors for the given bean class based on descriptions
-	 * using {@link PropertyAnnotation}s.
-	 * <p>
-	 * Annotations will be inherited from interfaces and superclasses.
-	 * 
-	 * @param beanClass
-	 * @return Array of {@link PropertyDescriptor}
-	 */
-	public PropertyDescriptor[] getPropertyDescriptors(Class<?> beanClass) {
-		PropertyDescriptor[] cached = propertyDescriptorsCache.get(beanClass);
-		if (cached != null) {
-			return cached;
-		}
-
-		Map<String, PropertyDescriptor> descriptors = new HashMap<String, PropertyDescriptor>();
-
-		for (Method method : allMethods(beanClass)) {
-			PropertyAnnotation annotation = method
-					.getAnnotation(PropertyAnnotation.class);
-			Matcher methodMatcher = methodPattern.matcher(method.getName());
-			if (!methodMatcher.matches() && annotation == null) {
-				continue;
-			}
-			
-			String name = PropertyAnnotation.DEFAULT;
-			if (annotation != null) {
-				annotation.name();
-			}
-			if (name.equals(PropertyAnnotation.DEFAULT)) {
-				name = methodMatcher.group(2);
-				if (name.length() < 1) {
-					continue;
-				}
-				// decapitalize first letter
-				name = name.substring(0, 1).toLowerCase() + name.substring(1);
-			}
-			Method writeMethod = null;
-			Method readMethod = null;
-			if (methodMatcher.group(1).equals("set")) {
-				writeMethod = method;
-				if (writeMethod.getParameterTypes().length != 1) {
-					continue;
-				}
-			} else {
-				readMethod = method;
-				if (readMethod.getParameterTypes().length != 0) {
-					continue;
-				}
-			}
-
-			PropertyDescriptor descriptor = descriptors.get(name);
-			try {
-				if (descriptor == null) {
-					descriptor = new PropertyDescriptor(name, readMethod,
-							writeMethod);
-					descriptors.put(name, descriptor);
-				}
-				// Set the one we just found
-				if (readMethod != null) {
-					descriptor.setReadMethod(readMethod);
-				}
-				if (writeMethod != null) {
-					descriptor.setWriteMethod(writeMethod);
-				}
-			} catch (IntrospectionException ex) {
-				throw new RuntimeException("Can't inspect property " + name
-						+ " using method " + method, ex);
-			}
-			if (annotation != null) {
-				descriptor.setExpert(annotation.expert());
-				descriptor.setHidden(annotation.hidden());
-				descriptor.setPreferred(annotation.preferred());
-				if (!annotation.displayName()
-						.equals(PropertyAnnotation.DEFAULT)) {
-					descriptor.setDisplayName(annotation.displayName());
-				}
-				if (!annotation.shortDescription().equals(
-						PropertyAnnotation.DEFAULT)) {
-					descriptor.setShortDescription(annotation
-							.shortDescription());
-				}
-			}
-		}
-		cached = descriptors.values().toArray(
-				new PropertyDescriptor[descriptors.size()]);
-		propertyDescriptorsCache.put(beanClass, cached);
-		return cached;
-	}
-
-	/**
-	 * Find all {@link Method}s defined in the class, all its superclasses and
-	 * interfaces. This might include methods that override each other.
-	 * <p>
-	 * The list contains first the methods from each of the class's interfaces
-	 * (and the methods they inherit from their interfaces), then recurses for
-	 * the subclass of this class (including any additional interfaces used in
-	 * the superclasses), before finally adding methods declared in the given
-	 * class.
-	 * <p>
-	 * This can be useful to find annotations given to methods that have been
-	 * overridden in subclasses.
-	 * 
-	 * @param theClass
-	 * @return
-	 */
-	@SuppressWarnings("unchecked")
-	protected List<Method> allMethods(Class<?> theClass) {
-		List<Method> methods = allMethodsCache.get(theClass);
-		if (methods == null) {
-			methods = new ArrayList<Method>();
-			allMethods(theClass, new HashSet<Class>(ignoreClasses), methods);
-			allMethodsCache.put(theClass, methods);
-		}
-		return methods;
-	}
-
-	@SuppressWarnings("unchecked")
-	protected void allMethods(Class<?> theClass, Set<Class> visitedClasses,
-			List<Method> foundMethods) {
-		if (theClass == null || theClass == Object.class
-				|| theClass == Class.class || !visitedClasses.add(theClass)) {
-			// Top class or already visted
-			return;
-		}
-		// Let's first dig down into our interfaces
-		for (Class anInterface : theClass.getInterfaces()) {
-			allMethods(anInterface, visitedClasses, foundMethods);
-		}
-		// And our superclasses
-		allMethods(theClass.getSuperclass(), visitedClasses, foundMethods);
-		// Before we find any methods only declared in this class
-		// (parent methods are already earlier in the list -
-		// note that the new methods might override earlier methods)
-		for (Method method : theClass.getDeclaredMethods()) {
-			int methodModifiers = method.getModifiers();
-			if (!Modifier.isPublic(methodModifiers)
-					|| Modifier.isStatic(methodModifiers)) {
-				continue;
-			}
-			assert !foundMethods.contains(method) : "Method discovered twice: "
-					+ method;
-			foundMethods.add(method);
-		}
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-beaninfo/src/main/java/org/apache/taverna/lang/beans/PropertyAnnotated.java
----------------------------------------------------------------------
diff --git a/taverna-beaninfo/src/main/java/org/apache/taverna/lang/beans/PropertyAnnotated.java b/taverna-beaninfo/src/main/java/org/apache/taverna/lang/beans/PropertyAnnotated.java
new file mode 100644
index 0000000..65febbc
--- /dev/null
+++ b/taverna-beaninfo/src/main/java/org/apache/taverna/lang/beans/PropertyAnnotated.java
@@ -0,0 +1,73 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.lang.beans;
+
+import java.beans.BeanInfo;
+import java.beans.Introspector;
+import java.beans.PropertyDescriptor;
+import java.beans.SimpleBeanInfo;
+
+/**
+ * A {@link BeanInfo} that includes {@link PropertyDescriptor}s from methods
+ * annotated using {@link PropertyAnnotation}.
+ * <p>
+ * The bean info from the PropertyAnnotation will then be available through
+ * Java's {@link Introspector}, and allows you to specify details such as
+ * {@link PropertyAnnotation#displayName()} and
+ * {@link PropertyAnnotation#hidden()} for the properties of a Java Bean.
+ * <p>
+ * This class can either be used as a superclass for the classes containing
+ * property annotated methods, or put in a neighbouring BeanInfo class.
+ * <p>
+ * For instance, if your class is called DescribedClass and has methods
+ * annotated using {@link PropertyAnnotation}, either let DescribedClass
+ * subclass {@link PropertyAnnotated}, or make a neighbouring {@link BeanInfo}
+ * class called DescribedClassBeanInfo, which should subclass
+ * {@link PropertyAnnotated}.
+ * 
+ * 
+ * @author Stian Soiland-Reyes
+ * 
+ */
+public class PropertyAnnotated extends SimpleBeanInfo {
+
+	private static PropertyAnnotationExtractor extractor = new PropertyAnnotationExtractor();
+
+	/**
+	 * {@inheritDoc}
+	 */
+	@Override
+	public PropertyDescriptor[] getPropertyDescriptors() {
+		return extractor.getPropertyDescriptors(getDescribedClass());
+	}
+
+	/**
+	 * The class that is being described. By default this returns
+	 * {@link #getClass()} so that {@link PropertyAnnotated} can be used as a
+	 * superclass, but if instead the DescribedClassBeanInfo pattern is used,
+	 * subclass PropertyAnnotated in each BeanInfo class, and override this
+	 * method to return the described class. (DescribedClass in this example)
+	 * 
+	 */
+	public Class<?> getDescribedClass() {
+		return getClass();
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-beaninfo/src/main/java/org/apache/taverna/lang/beans/PropertyAnnotation.java
----------------------------------------------------------------------
diff --git a/taverna-beaninfo/src/main/java/org/apache/taverna/lang/beans/PropertyAnnotation.java b/taverna-beaninfo/src/main/java/org/apache/taverna/lang/beans/PropertyAnnotation.java
new file mode 100644
index 0000000..06480fc
--- /dev/null
+++ b/taverna-beaninfo/src/main/java/org/apache/taverna/lang/beans/PropertyAnnotation.java
@@ -0,0 +1,108 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.lang.beans;
+
+import java.beans.Introspector;
+import java.beans.PropertyDescriptor;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * An annotation of a Java bean style property method, ie. a getXX() or setXX()
+ * method.
+ * <p>
+ * The annotations allow the method to better describe properties such as
+ * {@link #displayName()}, {@link #shortDescription()} and {@link #hidden()}.
+ * <p>
+ * The annotations can be retrieved as {@link PropertyDescriptor} using
+ * {@link PropertyAnnotationExtractor}, or if {@link PropertyAnnotated} has been
+ * used (recommended), through Java's BeanInfo support, such as using
+ * {@link Introspector}.
+ * <p>
+ * Annotations can be applied to interfaces or classes, abstract and normal 
+ * methods, as long as they confirm with the Java bean conventions. Annotations 
+ * will be inherited, so overriding methods don't need to reapply the annotations,
+ * although they can if they want to override.
+ * <p>
+ * It is recommended that classes using these annotations either subclass
+ * {@link PropertyAnnotated} or have a neighbouring BeanInfo class that
+ * subclasses PropertyAnnotated.
+ * <p>
+ * Example usage:
+ * 
+ * <pre>
+ * 	public interface MyBean {
+ *		// Annotation for the property called "name". displayName: Title
+ *		// of the property shown in UI instead of "name".
+ *		&#064;PropertyAnnotation(displayName = "Full name")
+ *		public String getName();
+ *
+ *		// Second annotation for the write-method of the same property called
+ *		// "name". Both displayName and shortDescription will be set on the
+ *		// property descriptor.
+ *		&#064;PropertyAnnotation(shortDescription = "The name of the person")
+ *		public void setName(String name);
+ *
+ *		// Boolean read method for the property "married", two annotations.
+ *		// expert: Only shown in UI under "advanced" views.
+ *		&#064;PropertyAnnotation(expert = true, shortDescription = "Marital status")
+ *		public boolean isMarried();
+ *
+ *		// Write-method for the "married" property, no new annotations, but will
+ *		// get the ones from {&#064;link #isMarried()}.
+ *		public void setMarried(boolean married);
+ *
+ *		// Write-only method, hidden (not shown in UIs).
+ *		&#064;PropertyAnnotation(hidden = true)
+ *		public void setID(String id);
+ *
+ *		// Read-only method, no annotations, defaults will be used.
+ *		public void getTelephoneNumber(String number);
+ *	}
+ * </pre>
+ * 
+ * @see PropertyAnnotated
+ * @author Stian Soiland-Reyes
+ * 
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target( { ElementType.METHOD })
+public @interface PropertyAnnotation {
+
+	/**
+	 * A unique string that means the default should be used
+	 */
+	public static String DEFAULT = "Default_8930B86A-50C0-4859-9B6F-DD034B3C5C1E";
+
+	String displayName() default DEFAULT;
+
+	String name() default DEFAULT;
+
+	String shortDescription() default DEFAULT;
+
+	boolean expert() default false;
+
+	boolean hidden() default false;
+
+	boolean preferred() default false;
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-beaninfo/src/main/java/org/apache/taverna/lang/beans/PropertyAnnotationExtractor.java
----------------------------------------------------------------------
diff --git a/taverna-beaninfo/src/main/java/org/apache/taverna/lang/beans/PropertyAnnotationExtractor.java b/taverna-beaninfo/src/main/java/org/apache/taverna/lang/beans/PropertyAnnotationExtractor.java
new file mode 100644
index 0000000..3b640ca
--- /dev/null
+++ b/taverna-beaninfo/src/main/java/org/apache/taverna/lang/beans/PropertyAnnotationExtractor.java
@@ -0,0 +1,201 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.lang.beans;
+
+import java.beans.IntrospectionException;
+import java.beans.PropertyDescriptor;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.WeakHashMap;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * A utility class for extracting {@link PropertyDescriptor}s from a class which
+ * methods have been described using {@link PropertyAnnotation}.
+ * 
+ * @author Stian Soiland-Reyes
+ * 
+ */
+public class PropertyAnnotationExtractor {
+
+	protected static Pattern methodPattern = Pattern
+			.compile("(get|is|set)(.+)");
+
+	protected WeakHashMap<Class<?>, List<Method>> allMethodsCache = new WeakHashMap<Class<?>, List<Method>>();
+
+	protected WeakHashMap<Class<?>, PropertyDescriptor[]> propertyDescriptorsCache = new WeakHashMap<Class<?>, PropertyDescriptor[]>();
+
+	@SuppressWarnings("unchecked")
+	protected List<Class> ignoreClasses = Arrays.<Class>asList(Class.class, Object.class, PropertyAnnotated.class);
+	
+	/**
+	 * Find PropertyDescriptors for the given bean class based on descriptions
+	 * using {@link PropertyAnnotation}s.
+	 * <p>
+	 * Annotations will be inherited from interfaces and superclasses.
+	 * 
+	 * @param beanClass
+	 * @return Array of {@link PropertyDescriptor}
+	 */
+	public PropertyDescriptor[] getPropertyDescriptors(Class<?> beanClass) {
+		PropertyDescriptor[] cached = propertyDescriptorsCache.get(beanClass);
+		if (cached != null) {
+			return cached;
+		}
+
+		Map<String, PropertyDescriptor> descriptors = new HashMap<String, PropertyDescriptor>();
+
+		for (Method method : allMethods(beanClass)) {
+			PropertyAnnotation annotation = method
+					.getAnnotation(PropertyAnnotation.class);
+			Matcher methodMatcher = methodPattern.matcher(method.getName());
+			if (!methodMatcher.matches() && annotation == null) {
+				continue;
+			}
+			
+			String name = PropertyAnnotation.DEFAULT;
+			if (annotation != null) {
+				annotation.name();
+			}
+			if (name.equals(PropertyAnnotation.DEFAULT)) {
+				name = methodMatcher.group(2);
+				if (name.length() < 1) {
+					continue;
+				}
+				// decapitalize first letter
+				name = name.substring(0, 1).toLowerCase() + name.substring(1);
+			}
+			Method writeMethod = null;
+			Method readMethod = null;
+			if (methodMatcher.group(1).equals("set")) {
+				writeMethod = method;
+				if (writeMethod.getParameterTypes().length != 1) {
+					continue;
+				}
+			} else {
+				readMethod = method;
+				if (readMethod.getParameterTypes().length != 0) {
+					continue;
+				}
+			}
+
+			PropertyDescriptor descriptor = descriptors.get(name);
+			try {
+				if (descriptor == null) {
+					descriptor = new PropertyDescriptor(name, readMethod,
+							writeMethod);
+					descriptors.put(name, descriptor);
+				}
+				// Set the one we just found
+				if (readMethod != null) {
+					descriptor.setReadMethod(readMethod);
+				}
+				if (writeMethod != null) {
+					descriptor.setWriteMethod(writeMethod);
+				}
+			} catch (IntrospectionException ex) {
+				throw new RuntimeException("Can't inspect property " + name
+						+ " using method " + method, ex);
+			}
+			if (annotation != null) {
+				descriptor.setExpert(annotation.expert());
+				descriptor.setHidden(annotation.hidden());
+				descriptor.setPreferred(annotation.preferred());
+				if (!annotation.displayName()
+						.equals(PropertyAnnotation.DEFAULT)) {
+					descriptor.setDisplayName(annotation.displayName());
+				}
+				if (!annotation.shortDescription().equals(
+						PropertyAnnotation.DEFAULT)) {
+					descriptor.setShortDescription(annotation
+							.shortDescription());
+				}
+			}
+		}
+		cached = descriptors.values().toArray(
+				new PropertyDescriptor[descriptors.size()]);
+		propertyDescriptorsCache.put(beanClass, cached);
+		return cached;
+	}
+
+	/**
+	 * Find all {@link Method}s defined in the class, all its superclasses and
+	 * interfaces. This might include methods that override each other.
+	 * <p>
+	 * The list contains first the methods from each of the class's interfaces
+	 * (and the methods they inherit from their interfaces), then recurses for
+	 * the subclass of this class (including any additional interfaces used in
+	 * the superclasses), before finally adding methods declared in the given
+	 * class.
+	 * <p>
+	 * This can be useful to find annotations given to methods that have been
+	 * overridden in subclasses.
+	 * 
+	 * @param theClass
+	 * @return
+	 */
+	@SuppressWarnings("unchecked")
+	protected List<Method> allMethods(Class<?> theClass) {
+		List<Method> methods = allMethodsCache.get(theClass);
+		if (methods == null) {
+			methods = new ArrayList<Method>();
+			allMethods(theClass, new HashSet<Class>(ignoreClasses), methods);
+			allMethodsCache.put(theClass, methods);
+		}
+		return methods;
+	}
+
+	@SuppressWarnings("unchecked")
+	protected void allMethods(Class<?> theClass, Set<Class> visitedClasses,
+			List<Method> foundMethods) {
+		if (theClass == null || theClass == Object.class
+				|| theClass == Class.class || !visitedClasses.add(theClass)) {
+			// Top class or already visted
+			return;
+		}
+		// Let's first dig down into our interfaces
+		for (Class anInterface : theClass.getInterfaces()) {
+			allMethods(anInterface, visitedClasses, foundMethods);
+		}
+		// And our superclasses
+		allMethods(theClass.getSuperclass(), visitedClasses, foundMethods);
+		// Before we find any methods only declared in this class
+		// (parent methods are already earlier in the list -
+		// note that the new methods might override earlier methods)
+		for (Method method : theClass.getDeclaredMethods()) {
+			int methodModifiers = method.getModifiers();
+			if (!Modifier.isPublic(methodModifiers)
+					|| Modifier.isStatic(methodModifiers)) {
+				continue;
+			}
+			assert !foundMethods.contains(method) : "Method discovered twice: "
+					+ method;
+			foundMethods.add(method);
+		}
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-configuration-api/src/main/java/net/sf/taverna/t2/workbench/configuration/colour/ColourManager.java
----------------------------------------------------------------------
diff --git a/taverna-configuration-api/src/main/java/net/sf/taverna/t2/workbench/configuration/colour/ColourManager.java b/taverna-configuration-api/src/main/java/net/sf/taverna/t2/workbench/configuration/colour/ColourManager.java
deleted file mode 100644
index 4d5356f..0000000
--- a/taverna-configuration-api/src/main/java/net/sf/taverna/t2/workbench/configuration/colour/ColourManager.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2011 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.configuration.colour;
-
-import java.awt.Color;
-
-import uk.org.taverna.configuration.Configurable;
-
-/**
- * @author David Withers
- */
-public interface ColourManager extends Configurable {
-	/**
-	 * Builds a Color that has been configured and associated with the given
-	 * String (usually an object type).
-	 * 
-	 * @return the associated Color, or if nothing is associated returns
-	 *         {@link Color#WHITE}.
-	 */
-	Color getPreferredColour(String itemKey);
-
-	void setPreferredColour(String itemKey, Color colour);
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-configuration-api/src/main/java/net/sf/taverna/t2/workbench/configuration/mimetype/MimeTypeManager.java
----------------------------------------------------------------------
diff --git a/taverna-configuration-api/src/main/java/net/sf/taverna/t2/workbench/configuration/mimetype/MimeTypeManager.java b/taverna-configuration-api/src/main/java/net/sf/taverna/t2/workbench/configuration/mimetype/MimeTypeManager.java
deleted file mode 100644
index f0ae0d3..0000000
--- a/taverna-configuration-api/src/main/java/net/sf/taverna/t2/workbench/configuration/mimetype/MimeTypeManager.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*******************************************************************************
- * 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.configuration.mimetype;
-
-import java.util.Map;
-
-import uk.org.taverna.configuration.Configurable;
-
-public interface MimeTypeManager extends Configurable {
-	@Override
-	String getCategory();
-
-	@Override
-	Map<String, String> getDefaultPropertyMap();
-
-	@Override
-	String getUUID();
-
-	@Override
-	String getDisplayName();
-
-	@Override
-	String getFilePrefix();
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-configuration-api/src/main/java/net/sf/taverna/t2/workbench/configuration/workbench/WorkbenchConfiguration.java
----------------------------------------------------------------------
diff --git a/taverna-configuration-api/src/main/java/net/sf/taverna/t2/workbench/configuration/workbench/WorkbenchConfiguration.java b/taverna-configuration-api/src/main/java/net/sf/taverna/t2/workbench/configuration/workbench/WorkbenchConfiguration.java
deleted file mode 100644
index 461ba5c..0000000
--- a/taverna-configuration-api/src/main/java/net/sf/taverna/t2/workbench/configuration/workbench/WorkbenchConfiguration.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2011 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.configuration.workbench;
-
-import uk.org.taverna.configuration.Configurable;
-
-/**
- * @author David Withers
- */
-public interface WorkbenchConfiguration extends Configurable {
-	boolean getCaptureConsole();
-
-	void setCaptureConsole(boolean captureConsole);
-
-	boolean getWarnInternalErrors();
-
-	void setWarnInternalErrors(boolean warnInternalErrors);
-
-	int getMaxMenuItems();
-
-	void setMaxMenuItems(int maxMenuItems);
-
-	String getDotLocation();
-
-	void setDotLocation(String dotLocation);
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-configuration-api/src/main/java/net/sf/taverna/t2/workbench/configuration/workbench/ui/T2ConfigurationFrame.java
----------------------------------------------------------------------
diff --git a/taverna-configuration-api/src/main/java/net/sf/taverna/t2/workbench/configuration/workbench/ui/T2ConfigurationFrame.java b/taverna-configuration-api/src/main/java/net/sf/taverna/t2/workbench/configuration/workbench/ui/T2ConfigurationFrame.java
deleted file mode 100644
index 577484f..0000000
--- a/taverna-configuration-api/src/main/java/net/sf/taverna/t2/workbench/configuration/workbench/ui/T2ConfigurationFrame.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2013 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.configuration.workbench.ui;
-
-/**
- * @author David Withers
- */
-public interface T2ConfigurationFrame {
-	void showFrame();
-
-	void showConfiguration(String name);
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-configuration-api/src/main/java/org/apache/taverna/workbench/configuration/colour/ColourManager.java
----------------------------------------------------------------------
diff --git a/taverna-configuration-api/src/main/java/org/apache/taverna/workbench/configuration/colour/ColourManager.java b/taverna-configuration-api/src/main/java/org/apache/taverna/workbench/configuration/colour/ColourManager.java
new file mode 100644
index 0000000..b471722
--- /dev/null
+++ b/taverna-configuration-api/src/main/java/org/apache/taverna/workbench/configuration/colour/ColourManager.java
@@ -0,0 +1,40 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.configuration.colour;
+
+import java.awt.Color;
+
+import uk.org.taverna.configuration.Configurable;
+
+/**
+ * @author David Withers
+ */
+public interface ColourManager extends Configurable {
+	/**
+	 * Builds a Color that has been configured and associated with the given
+	 * String (usually an object type).
+	 * 
+	 * @return the associated Color, or if nothing is associated returns
+	 *         {@link Color#WHITE}.
+	 */
+	Color getPreferredColour(String itemKey);
+
+	void setPreferredColour(String itemKey, Color colour);
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-configuration-api/src/main/java/org/apache/taverna/workbench/configuration/mimetype/MimeTypeManager.java
----------------------------------------------------------------------
diff --git a/taverna-configuration-api/src/main/java/org/apache/taverna/workbench/configuration/mimetype/MimeTypeManager.java b/taverna-configuration-api/src/main/java/org/apache/taverna/workbench/configuration/mimetype/MimeTypeManager.java
new file mode 100644
index 0000000..9d3a86b
--- /dev/null
+++ b/taverna-configuration-api/src/main/java/org/apache/taverna/workbench/configuration/mimetype/MimeTypeManager.java
@@ -0,0 +1,41 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.configuration.mimetype;
+
+import java.util.Map;
+
+import uk.org.taverna.configuration.Configurable;
+
+public interface MimeTypeManager extends Configurable {
+	@Override
+	String getCategory();
+
+	@Override
+	Map<String, String> getDefaultPropertyMap();
+
+	@Override
+	String getUUID();
+
+	@Override
+	String getDisplayName();
+
+	@Override
+	String getFilePrefix();
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-configuration-api/src/main/java/org/apache/taverna/workbench/configuration/workbench/WorkbenchConfiguration.java
----------------------------------------------------------------------
diff --git a/taverna-configuration-api/src/main/java/org/apache/taverna/workbench/configuration/workbench/WorkbenchConfiguration.java b/taverna-configuration-api/src/main/java/org/apache/taverna/workbench/configuration/workbench/WorkbenchConfiguration.java
new file mode 100644
index 0000000..9678812
--- /dev/null
+++ b/taverna-configuration-api/src/main/java/org/apache/taverna/workbench/configuration/workbench/WorkbenchConfiguration.java
@@ -0,0 +1,43 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.configuration.workbench;
+
+import uk.org.taverna.configuration.Configurable;
+
+/**
+ * @author David Withers
+ */
+public interface WorkbenchConfiguration extends Configurable {
+	boolean getCaptureConsole();
+
+	void setCaptureConsole(boolean captureConsole);
+
+	boolean getWarnInternalErrors();
+
+	void setWarnInternalErrors(boolean warnInternalErrors);
+
+	int getMaxMenuItems();
+
+	void setMaxMenuItems(int maxMenuItems);
+
+	String getDotLocation();
+
+	void setDotLocation(String dotLocation);
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-configuration-api/src/main/java/org/apache/taverna/workbench/configuration/workbench/ui/T2ConfigurationFrame.java
----------------------------------------------------------------------
diff --git a/taverna-configuration-api/src/main/java/org/apache/taverna/workbench/configuration/workbench/ui/T2ConfigurationFrame.java b/taverna-configuration-api/src/main/java/org/apache/taverna/workbench/configuration/workbench/ui/T2ConfigurationFrame.java
new file mode 100644
index 0000000..7defd40
--- /dev/null
+++ b/taverna-configuration-api/src/main/java/org/apache/taverna/workbench/configuration/workbench/ui/T2ConfigurationFrame.java
@@ -0,0 +1,29 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.configuration.workbench.ui;
+
+/**
+ * @author David Withers
+ */
+public interface T2ConfigurationFrame {
+	void showFrame();
+
+	void showConfiguration(String name);
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-configuration-impl/src/main/java/net/sf/taverna/t2/workbench/ui/impl/configuration/WorkbenchConfigurationImpl.java
----------------------------------------------------------------------
diff --git a/taverna-configuration-impl/src/main/java/net/sf/taverna/t2/workbench/ui/impl/configuration/WorkbenchConfigurationImpl.java b/taverna-configuration-impl/src/main/java/net/sf/taverna/t2/workbench/ui/impl/configuration/WorkbenchConfigurationImpl.java
deleted file mode 100644
index 0e63a4a..0000000
--- a/taverna-configuration-impl/src/main/java/net/sf/taverna/t2/workbench/ui/impl/configuration/WorkbenchConfigurationImpl.java
+++ /dev/null
@@ -1,210 +0,0 @@
-/*******************************************************************************
- * 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.configuration;
-
-import java.io.File;
-import java.util.HashMap;
-import java.util.Map;
-
-import net.sf.taverna.t2.workbench.configuration.workbench.WorkbenchConfiguration;
-
-import org.apache.log4j.Logger;
-
-import uk.org.taverna.configuration.AbstractConfigurable;
-import uk.org.taverna.configuration.ConfigurationManager;
-import uk.org.taverna.configuration.app.ApplicationConfiguration;
-
-/**
- * An implementation of Configurable for general Workbench configuration
- * properties
- * 
- * @author Stuart Owen
- * @author Stian Soiland-Reyes
- */
-public class WorkbenchConfigurationImpl extends AbstractConfigurable implements
-		WorkbenchConfiguration {
-	private static Logger logger = Logger
-			.getLogger(WorkbenchConfiguration.class);
-	private static final int DEFAULT_MAX_MENU_ITEMS = 20;
-	public static final String TAVERNA_DOTLOCATION = "taverna.dotlocation";
-	public static final String MAX_MENU_ITEMS = "taverna.maxmenuitems";
-	public static final String WARN_INTERNAL_ERRORS = "taverna.warninternal";
-	public static final String CAPTURE_CONSOLE = "taverna.captureconsole";
-	private static final String BIN = "bin";
-	private static final String BUNDLE_CONTENTS = "Contents";
-	private static final String BUNDLE_MAC_OS = "MacOS";
-	private static final String DOT_EXE = "dot.exe";
-	private static final String DOT_FALLBACK = "dot";
-	public static String uuid = "c14856f0-5967-11dd-ae16-0800200c9a66";
-	private static final String MAC_OS_X = "Mac OS X";
-	private static final String WIN32I386 = "win32i386";
-	private static final String WINDOWS = "Windows";
-
-	private ApplicationConfiguration applicationConfiguration;
-
-	/**
-	 * Constructs a new <code>WorkbenchConfigurationImpl</code>.
-	 * 
-	 * @param configurationManager
-	 */
-	public WorkbenchConfigurationImpl(ConfigurationManager configurationManager) {
-		super(configurationManager);
-	}
-
-	Map<String, String> defaultWorkbenchProperties = null;
-	Map<String, String> workbenchProperties = new HashMap<String, String>();
-
-	@Override
-	public String getCategory() {
-		return "general";
-	}
-
-	@Override
-	public Map<String, String> getDefaultPropertyMap() {
-		if (defaultWorkbenchProperties == null) {
-			defaultWorkbenchProperties = new HashMap<>();
-			String dotLocation = System.getProperty(TAVERNA_DOTLOCATION) != null ? System
-					.getProperty(TAVERNA_DOTLOCATION) : getDefaultDotLocation();
-			if (dotLocation != null)
-				defaultWorkbenchProperties
-						.put(TAVERNA_DOTLOCATION, dotLocation);
-			defaultWorkbenchProperties.put(MAX_MENU_ITEMS,
-					Integer.toString(DEFAULT_MAX_MENU_ITEMS));
-			defaultWorkbenchProperties.put(WARN_INTERNAL_ERRORS,
-					Boolean.FALSE.toString());
-			defaultWorkbenchProperties.put(CAPTURE_CONSOLE,
-					Boolean.TRUE.toString());
-		}
-		return defaultWorkbenchProperties;
-	}
-
-	@Override
-	public String getDisplayName() {
-		return "Workbench";
-	}
-
-	@Override
-	public String getFilePrefix() {
-		return "Workbench";
-	}
-
-	@Override
-	public String getUUID() {
-		return uuid;
-	}
-
-	@Override
-	public boolean getWarnInternalErrors() {
-		String property = getProperty(WARN_INTERNAL_ERRORS);
-		return Boolean.parseBoolean(property);
-	}
-
-	@Override
-	public boolean getCaptureConsole() {
-		String property = getProperty(CAPTURE_CONSOLE);
-		return Boolean.parseBoolean(property);
-	}
-
-	@Override
-	public void setWarnInternalErrors(boolean warnInternalErrors) {
-		setProperty(WARN_INTERNAL_ERRORS, Boolean.toString(warnInternalErrors));
-	}
-
-	@Override
-	public void setCaptureConsole(boolean captureConsole) {
-		setProperty(CAPTURE_CONSOLE, Boolean.toString(captureConsole));
-	}
-
-	@Override
-	public void setMaxMenuItems(int maxMenuItems) {
-		if (maxMenuItems < 2)
-			throw new IllegalArgumentException(
-					"Maximum menu items must be at least 2");
-		setProperty(MAX_MENU_ITEMS, Integer.toString(maxMenuItems));
-	}
-
-	@Override
-	public int getMaxMenuItems() {
-		String property = getProperty(MAX_MENU_ITEMS);
-		try {
-			int maxMenuItems = Integer.parseInt(property);
-			if (maxMenuItems >= 2)
-				return maxMenuItems;
-			logger.warn(MAX_MENU_ITEMS + " can't be less than 2");
-		} catch (NumberFormatException ex) {
-			logger.warn("Invalid number for " + MAX_MENU_ITEMS + ": "
-					+ property);
-		}
-		// We'll return the default instead
-		return DEFAULT_MAX_MENU_ITEMS;
-	}
-
-	@Override
-	public String getDotLocation() {
-		return getProperty(TAVERNA_DOTLOCATION);
-	}
-
-	@Override
-	public void setDotLocation(String dotLocation) {
-		setProperty(TAVERNA_DOTLOCATION, dotLocation);
-	}
-
-	private String getDefaultDotLocation() {
-		if (applicationConfiguration == null)
-			return null;
-		File startupDir = applicationConfiguration.getStartupDir();
-		if (startupDir == null)
-			return DOT_FALLBACK;
-
-		String os = System.getProperty("os.name");
-		if (os.equals(MAC_OS_X))
-			if (startupDir.getParentFile() != null) {
-				File contentsDir = startupDir.getParentFile().getParentFile();
-				if (contentsDir != null
-						&& contentsDir.getName().equalsIgnoreCase(
-								BUNDLE_CONTENTS)) {
-					File dot = new File(new File(contentsDir, BUNDLE_MAC_OS),
-							DOT_FALLBACK);
-					if (dot.exists())
-						return dot.getAbsolutePath();
-				}
-			} else if (os.startsWith(WINDOWS)) {
-				File binWin386Dir = new File(new File(startupDir, BIN),
-						WIN32I386);
-				File dot = new File(binWin386Dir, DOT_EXE);
-				if (dot.exists())
-					return dot.getAbsolutePath();
-			}
-		return DOT_FALLBACK;
-	}
-
-	/**
-	 * Sets the applicationConfiguration.
-	 * 
-	 * @param applicationConfiguration
-	 *            the new value of applicationConfiguration
-	 */
-	public void setApplicationConfiguration(
-			ApplicationConfiguration applicationConfiguration) {
-		this.applicationConfiguration = applicationConfiguration;
-		defaultWorkbenchProperties = null;
-	}
-}


[15/51] [partial] incubator-taverna-workbench git commit: all packages are moved to org.apache.taverna.*

Posted by re...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-graph-model/src/main/java/net/sf/taverna/t2/workbench/models/graph/svg/SVGUtil.java
----------------------------------------------------------------------
diff --git a/taverna-graph-model/src/main/java/net/sf/taverna/t2/workbench/models/graph/svg/SVGUtil.java b/taverna-graph-model/src/main/java/net/sf/taverna/t2/workbench/models/graph/svg/SVGUtil.java
deleted file mode 100644
index f2e4247..0000000
--- a/taverna-graph-model/src/main/java/net/sf/taverna/t2/workbench/models/graph/svg/SVGUtil.java
+++ /dev/null
@@ -1,477 +0,0 @@
-/*******************************************************************************
- * 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.models.graph.svg;
-
-import static java.lang.Float.parseFloat;
-import static java.lang.Math.PI;
-import static java.lang.Math.atan2;
-import static org.apache.batik.dom.svg.SVGDOMImplementation.getDOMImplementation;
-import static org.apache.batik.util.SMILConstants.SMIL_ATTRIBUTE_NAME_ATTRIBUTE;
-import static org.apache.batik.util.SMILConstants.SMIL_DUR_ATTRIBUTE;
-import static org.apache.batik.util.SMILConstants.SMIL_FILL_ATTRIBUTE;
-import static org.apache.batik.util.SMILConstants.SMIL_FREEZE_VALUE;
-import static org.apache.batik.util.SMILConstants.SMIL_FROM_ATTRIBUTE;
-import static org.apache.batik.util.SMILConstants.SMIL_TO_ATTRIBUTE;
-import static org.apache.batik.util.SVGConstants.SVG_TYPE_ATTRIBUTE;
-import static org.apache.batik.util.SVGConstants.SVG_X1_ATTRIBUTE;
-import static org.apache.batik.util.SVGConstants.SVG_X2_ATTRIBUTE;
-import static org.apache.batik.util.SVGConstants.SVG_Y1_ATTRIBUTE;
-import static org.apache.batik.util.SVGConstants.SVG_Y2_ATTRIBUTE;
-import static org.apache.batik.util.XMLResourceDescriptor.getXMLParserClassName;
-
-import java.awt.Color;
-import java.awt.Point;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.io.StringReader;
-import java.util.List;
-
-import net.sf.taverna.t2.lang.io.StreamDevourer;
-import net.sf.taverna.t2.workbench.configuration.workbench.WorkbenchConfiguration;
-import net.sf.taverna.t2.workbench.models.graph.GraphShapeElement.Shape;
-
-import org.apache.batik.dom.svg.SAXSVGDocumentFactory;
-import org.apache.batik.dom.svg.SVGDOMImplementation;
-import org.apache.batik.dom.svg.SVGOMAnimationElement;
-import org.apache.batik.dom.svg.SVGOMPoint;
-import org.apache.log4j.Logger;
-import org.w3c.dom.DOMImplementation;
-import org.w3c.dom.Element;
-import org.w3c.dom.svg.SVGDocument;
-import org.w3c.dom.svg.SVGElement;
-import org.w3c.dom.svg.SVGLocatable;
-import org.w3c.dom.svg.SVGMatrix;
-//import org.apache.batik.transcoder.TranscoderException;
-//import org.apache.batik.transcoder.svg2svg.PrettyPrinter;
-
-/**
- * Utility methods.
- *
- * @author David Withers
- */
-public class SVGUtil {
-	private static final String C = "C";
-	private static final String M = "M";
-	private static final String SPACE = " ";
-	private static final String COMMA = ",";
-	public static final String svgNS = SVGDOMImplementation.SVG_NAMESPACE_URI;
-	private static final String SVG = "svg";
-	private static final Logger logger = Logger.getLogger(SVGUtil.class);
-
-	private static SAXSVGDocumentFactory docFactory;
-
-	static {
-		String parser = getXMLParserClassName();
-		logger.info("Using XML parser " + parser);
-		docFactory = new SAXSVGDocumentFactory(parser);
-	}
-
-	/**
-	 * Creates a new SVGDocument.
-	 * 
-	 * @return a new SVGDocument
-	 */
-	public static SVGDocument createSVGDocument() {
-		DOMImplementation impl = getDOMImplementation();
-		return (SVGDocument) impl.createDocument(svgNS, SVG, null);
-	}
-
-	/**
-	 * Converts a point in screen coordinates to a point in document
-	 * coordinates.
-	 * 
-	 * @param locatable
-	 * @param screenPoint
-	 *            the point in screen coordinates
-	 * @return the point in document coordinates
-	 */
-	public static SVGOMPoint screenToDocument(SVGLocatable locatable,
-			SVGOMPoint screenPoint) {
-		SVGMatrix mat = ((SVGLocatable) locatable.getFarthestViewportElement())
-				.getScreenCTM().inverse();
-		return (SVGOMPoint) screenPoint.matrixTransform(mat);
-	}
-
-	/**
-	 * Writes SVG to the console. For debugging only.
-	 *
-	 * @param svgDocument
-	 *            the document to output
-	 */
-//	public static void writeSVG(SVGDocument svgDocument) {
-//		writeSVG(svgDocument, new OutputStreamWriter(System.out));
-//	}
-
-	/**
-	 * Writes SVG to an output stream.
-	 *
-	 * @param svgDocument
-	 *            the document to output
-	 * @param writer
-	 *            the stream to write the document to
-	 */
-//	public static void writeSVG(SVGDocument svgDocument, Writer writer) {
-//		StringWriter sw = new StringWriter();
-//		try {
-//			Transformer transformer = TransformerFactory.newInstance().newTransformer();
-//			Source src = new DOMSource(svgDocument.getDocumentElement());
-//			transformer.transform(src, new StreamResult(sw));
-//
-//			PrettyPrinter pp = new PrettyPrinter();
-//			pp.print(new StringReader(sw.toString()), writer);
-//		} catch (TransformerException | TranscoderException | IOException e) {
-//			e.printStackTrace(new PrintWriter(writer));
-//		}
-//	}
-
-	/**
-	 * Generates an SVGDocument from DOT text by calling out to GraphViz.
-	 * 
-	 * @param dotText
-	 * @return an SVGDocument
-	 * @throws IOException
-	 */
-	public static SVGDocument getSVG(String dotText,
-			WorkbenchConfiguration workbenchConfiguration) throws IOException {
-		String dotLocation = (String) workbenchConfiguration
-				.getProperty("taverna.dotlocation");
-		if (dotLocation == null)
-			dotLocation = "dot";
-		logger.debug("Invoking dot...");
-		Process dotProcess = exec(dotLocation, "-Tsvg");
-		StreamDevourer devourer = new StreamDevourer(
-				dotProcess.getInputStream());
-		devourer.start();
-		try (PrintWriter out = new PrintWriter(dotProcess.getOutputStream(),
-				true)) {
-			out.print(dotText);
-			out.flush();
-		}
-
-		String svgText = devourer.blockOnOutput();
-		/*
-		 * Avoid TAV-424, replace buggy SVG outputted by "modern" GraphViz
-		 * versions. http://www.graphviz.org/bugs/b1075.html
-		 * 
-		 * Contributed by Marko Ullgren
-		 */
-		svgText = svgText.replaceAll("font-weight:regular",
-				"font-weight:normal");
-		logger.info(svgText);
-		// Fake URI, just used for internal references like #fish
-		return docFactory.createSVGDocument(
-				"http://taverna.sf.net/diagram/generated.svg",
-				new StringReader(svgText));
-	}
-
-	/**
-	 * Generates DOT text with layout information from DOT text by calling out
-	 * to GraphViz.
-	 * 
-	 * @param dotText
-	 *            dot text
-	 * @return dot text with layout information
-	 * @throws IOException
-	 */
-	public static String getDot(String dotText,
-			WorkbenchConfiguration workbenchConfiguration) throws IOException {
-		String dotLocation = (String) workbenchConfiguration
-				.getProperty("taverna.dotlocation");
-		if (dotLocation == null)
-			dotLocation = "dot";
-		logger.debug("Invoking dot...");
-		Process dotProcess = exec(dotLocation, "-Tdot", "-Glp=0,0");
-		StreamDevourer devourer = new StreamDevourer(
-				dotProcess.getInputStream());
-		devourer.start();
-		try (PrintWriter out = new PrintWriter(dotProcess.getOutputStream(),
-				true)) {
-			out.print(dotText);
-			out.flush();
-		}
-
-		String dot = devourer.blockOnOutput();
-		// logger.info(dot);
-		return dot;
-	}
-
-	private static Process exec(String...args) throws IOException {
-		Process p = Runtime.getRuntime().exec(args);
-		/*
-		 * Must create an error devourer otherwise stderr fills up and the
-		 * process stalls!
-		 */
-		new StreamDevourer(p.getErrorStream()).start();
-		return p;
-	}
-
-	/**
-	 * Returns the hex value for a <code>Color</code>. If color is null "none"
-	 * is returned.
-	 *
-	 * @param color
-	 *            the <code>Color</code> to convert to hex code
-	 * @return the hex value
-	 */
-	public static String getHexValue(Color color) {
-		if (color == null)
-			return "none";
-
-		return String.format("#%02x%02x%02x", color.getRed(), color.getGreen(),
-				color.getBlue());
-	}
-
-	/**
-	 * Calculates the angle to rotate an arrow head to be placed on the end of a
-	 * line.
-	 *
-	 * @param line
-	 *            the line to calculate the arrow head angle from
-	 * @return the angle to rotate an arrow head
-	 */
-	public static double calculateAngle(Element line) {
-		float x1 = parseFloat(line.getAttribute(SVG_X1_ATTRIBUTE));
-		float y1 = parseFloat(line.getAttribute(SVG_Y1_ATTRIBUTE));
-		float x2 = parseFloat(line.getAttribute(SVG_X2_ATTRIBUTE));
-		float y2 = parseFloat(line.getAttribute(SVG_Y2_ATTRIBUTE));
-		return calculateAngle(x1, y1, x2, y2);
-	}
-
-	/**
-	 * Calculates the angle to rotate an arrow head to be placed on the end of a
-	 * line.
-	 *
-	 * @param pointList
-	 *            the list of <code>Point</code>s to calculate the arrow head
-	 *            angle from
-	 * @return the angle to rotate an arrow head
-	 */
-	public static double calculateAngle(List<Point> pointList) {
-		double angle = 0d;
-		if (pointList.size() > 1) {
-			int listSize = pointList.size();
-			Point a = pointList.get(listSize - 2);
-			Point b = pointList.get(listSize - 1);
-			/*
-			 * dot sometimes generates paths with the same point repeated at the
-			 * end of the path, so move back along the path until two different
-			 * points are found
-			 */
-			while (a.equals(b) && listSize > 2) {
-				b = a;
-				a = pointList.get(--listSize - 2);
-			}
-			angle = calculateAngle(a.x, a.y, b.x, b.y);
-		}
-		return angle;
-	}
-
-	/**
-	 * Calculates the angle to rotate an arrow head to be placed on the end of a
-	 * line.
-	 * 
-	 * @param x1
-	 *            the x coordinate of the start of the line
-	 * @param y1
-	 *            the y coordinate of the start of the line
-	 * @param x2
-	 *            the x coordinate of the end of the line
-	 * @param y2
-	 *            the y coordinate of the end of the line
-	 * @return the angle to rotate an arrow head
-	 */
-	public static double calculateAngle(float x1, float y1, float x2, float y2) {
-		return atan2(y2 - y1, x2 - x1) * 180 / PI;
-	}
-
-	/**
-	 * Calculates the points that make up the polygon for the specified
-	 * {@link Shape}.
-	 *
-	 * @param shape
-	 *            the <code>Shape</code> to calculate points for
-	 * @param width
-	 *            the width of the <code>Shape</code>
-	 * @param height
-	 *            the height of the <code>Shape</code>
-	 * @return the points that make up the polygon for the specified
-	 *         <code>Shape</code>
-	 */
-	public static String calculatePoints(Shape shape, int width, int height) {
-		StringBuilder sb = new StringBuilder();
-		switch (shape) {
-		case BOX:
-		case RECORD:
-			addPoint(sb, 0, 0);
-			addPoint(sb, width, 0);
-			addPoint(sb, width, height);
-			addPoint(sb, 0, height);
-			break;
-		case HOUSE:
-			addPoint(sb, width / 2f, 0);
-			addPoint(sb, width, height / 3f);
-			addPoint(sb, width, height - 3);
-			addPoint(sb, 0, height - 3);
-			addPoint(sb, 0, height / 3f);
-			break;
-		case INVHOUSE:
-			addPoint(sb, 0, 3);
-			addPoint(sb, width, 3);
-			addPoint(sb, width, height / 3f * 2f);
-			addPoint(sb, width / 2f, height);
-			addPoint(sb, 0, height / 3f * 2f);
-			break;
-		case TRIANGLE:
-			addPoint(sb, width / 2f, 0);
-			addPoint(sb, width, height);
-			addPoint(sb, 0, height);
-			break;
-		case INVTRIANGLE:
-			addPoint(sb, 0, 0);
-			addPoint(sb, width, 0);
-			addPoint(sb, width / 2f, height);
-			break;
-		default:
-			// Nothing to do for the others
-			break;
-		}
-		return sb.toString();
-	}
-
-	/**
-	 * Appends x y coordinates to a <code>StringBuilder</code> in the format
-	 * "x,y ".
-	 * 
-	 * @param stringBuilder
-	 *            the <code>StringBuilder</code> to append the point to
-	 * @param x
-	 *            the x coordinate
-	 * @param y
-	 *            the y coordinate
-	 */
-	public static void addPoint(StringBuilder stringBuilder, float x, float y) {
-		stringBuilder.append(x).append(COMMA).append(y).append(SPACE);
-	}
-
-	/**
-	 * Converts a list of points into a string format for a cubic Bezier curve.
-	 *
-	 * For example, "M100,200 C100,100 250,100 250,200". See
-	 * http://www.w3.org/TR/SVG11/paths.html#PathDataCubicBezierCommands.
-	 *
-	 * @param pointList
-	 *            a list of points that describes a cubic Bezier curve
-	 * @return a string that describes a cubic Bezier curve
-	 */
-	public static String getPath(List<Point> pointList) {
-		StringBuilder sb = new StringBuilder();
-		if (pointList != null && pointList.size() > 1) {
-			Point firstPoint = pointList.get(0);
-			sb.append(M).append(firstPoint.x).append(COMMA)
-					.append(firstPoint.y);
-			sb.append(SPACE);
-			Point secontPoint = pointList.get(1);
-			sb.append(C).append(secontPoint.x).append(COMMA)
-					.append(secontPoint.y);
-			for (int i = 2; i < pointList.size(); i++) {
-				Point point = pointList.get(i);
-				sb.append(SPACE).append(point.x).append(COMMA).append(point.y);
-			}
-		}
-		return sb.toString();
-	}
-
-	/**
-	 * Creates an animation element.
-	 *
-	 * @param graphController
-	 *            the SVGGraphController to use to create the animation element
-	 * @param elementType
-	 *            the type of animation element to create
-	 * @param attribute
-	 *            the attribute that the animation should affect
-	 * @param transformType
-	 *            the type of transform - use null not creating a transform
-	 *            animation
-	 * @return an new animation element
-	 */
-	public static SVGOMAnimationElement createAnimationElement(
-			SVGGraphController graphController, String elementType,
-			String attribute, String transformType) {
-		SVGOMAnimationElement animationElement = (SVGOMAnimationElement) graphController
-				.createElement(elementType);
-		animationElement.setAttribute(SMIL_ATTRIBUTE_NAME_ATTRIBUTE, attribute);
-		if (transformType != null)
-			animationElement.setAttribute(SVG_TYPE_ATTRIBUTE, transformType);
-		animationElement.setAttribute(SMIL_FILL_ATTRIBUTE, SMIL_FREEZE_VALUE);
-		return animationElement;
-	}
-
-	/**
-	 * Adds an animation to the SVG element and starts the animation.
-	 *
-	 * @param animate
-	 *            that animation element
-	 * @param element
-	 *            the element to animate
-	 * @param duration
-	 *            the duration of the animation in milliseconds
-	 * @param from
-	 *            the starting point for the animation, can be null
-	 * @param to
-	 *            the end point for the animation, cannot be null
-	 */
-	public static void animate(SVGOMAnimationElement animate, SVGElement element, int duration,
-			String from, String to) {
-		animate.setAttribute(SMIL_DUR_ATTRIBUTE, duration + "ms");
-		if (from != null)
-			animate.setAttribute(SMIL_FROM_ATTRIBUTE, from);
-		animate.setAttribute(SMIL_TO_ATTRIBUTE, to);
-		element.appendChild(animate);
-		try {
-			animate.beginElement();
-		} catch (NullPointerException e) {
-		}
-	}
-
-	/**
-	 * Adjusts the length of <code>pointList</code> by adding or removing points
-	 * to make the length equal to <code>size</code>. If <code>pointList</code>
-	 * is shorter than <code>size</code> the last point is repeated. If
-	 * <code>pointList</code> is longer than <code>size</code> points at the end
-	 * of the list are removed.
-	 *
-	 * @param pointList
-	 *            the path to adjust
-	 * @param size
-	 *            the required size for <code>pointList</code>
-	 */
-	public static void adjustPathLength(List<Point> pointList, int size) {
-		if (pointList.size() < size) {
-			Point lastPoint = pointList.get(pointList.size() - 1);
-			for (int i = pointList.size(); i < size; i++)
-				pointList.add(lastPoint);
-		} else if (pointList.size() > size) {
-			for (int i = pointList.size(); i > size; i--)
-				pointList.remove(i - 1);
-		}
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-graph-model/src/main/java/net/sf/taverna/t2/workbench/models/graph/svg/event/SVGEventListener.java
----------------------------------------------------------------------
diff --git a/taverna-graph-model/src/main/java/net/sf/taverna/t2/workbench/models/graph/svg/event/SVGEventListener.java b/taverna-graph-model/src/main/java/net/sf/taverna/t2/workbench/models/graph/svg/event/SVGEventListener.java
deleted file mode 100644
index 95b4181..0000000
--- a/taverna-graph-model/src/main/java/net/sf/taverna/t2/workbench/models/graph/svg/event/SVGEventListener.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*******************************************************************************
- * 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.models.graph.svg.event;
-
-import static net.sf.taverna.t2.workbench.models.graph.svg.SVGUtil.screenToDocument;
-import net.sf.taverna.t2.workbench.models.graph.GraphElement;
-
-import org.apache.batik.dom.svg.SVGOMPoint;
-import org.w3c.dom.events.Event;
-import org.w3c.dom.events.EventListener;
-import org.w3c.dom.events.MouseEvent;
-import org.w3c.dom.svg.SVGLocatable;
-
-/**
- * Abstract superclass for SVG event listeners.
- * 
- * @author David Withers
- */
-public abstract class SVGEventListener implements EventListener {
-	protected GraphElement graphElement;
-
-	public SVGEventListener(GraphElement graphElement) {
-		this.graphElement = graphElement;
-	}
-
-	protected abstract void event(SVGOMPoint point, MouseEvent evt);
-
-	@Override
-	public final void handleEvent(Event evt) {
-		if (evt instanceof MouseEvent) {
-			MouseEvent me = (MouseEvent) evt;
-			SVGOMPoint point = screenToDocument((SVGLocatable) me.getTarget(),
-					new SVGOMPoint(me.getClientX(), me.getClientY()));
-			event(point, me);
-			evt.stopPropagation();
-		}
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-graph-model/src/main/java/net/sf/taverna/t2/workbench/models/graph/svg/event/SVGMouseClickEventListener.java
----------------------------------------------------------------------
diff --git a/taverna-graph-model/src/main/java/net/sf/taverna/t2/workbench/models/graph/svg/event/SVGMouseClickEventListener.java b/taverna-graph-model/src/main/java/net/sf/taverna/t2/workbench/models/graph/svg/event/SVGMouseClickEventListener.java
deleted file mode 100644
index 0c13be3..0000000
--- a/taverna-graph-model/src/main/java/net/sf/taverna/t2/workbench/models/graph/svg/event/SVGMouseClickEventListener.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*******************************************************************************
- * 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.models.graph.svg.event;
-
-import net.sf.taverna.t2.workbench.models.graph.GraphElement;
-
-import org.apache.batik.dom.svg.SVGOMPoint;
-import org.w3c.dom.events.MouseEvent;
-
-/**
- * SVG event listener for handling mouse click events.
- * 
- * @author David Withers
- */
-public class SVGMouseClickEventListener extends SVGEventListener {
-	public SVGMouseClickEventListener(GraphElement graphElement) {
-		super(graphElement);
-	}
-
-	@Override
-	protected void event(SVGOMPoint point, MouseEvent evt) {
-		graphElement.getEventManager().mouseClicked(graphElement,
-				evt.getButton(), evt.getAltKey(), evt.getCtrlKey(),
-				evt.getMetaKey(), (int) point.getX(), (int) point.getY(),
-				evt.getScreenX(), evt.getScreenY());
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-graph-model/src/main/java/net/sf/taverna/t2/workbench/models/graph/svg/event/SVGMouseDownEventListener.java
----------------------------------------------------------------------
diff --git a/taverna-graph-model/src/main/java/net/sf/taverna/t2/workbench/models/graph/svg/event/SVGMouseDownEventListener.java b/taverna-graph-model/src/main/java/net/sf/taverna/t2/workbench/models/graph/svg/event/SVGMouseDownEventListener.java
deleted file mode 100644
index bd69506..0000000
--- a/taverna-graph-model/src/main/java/net/sf/taverna/t2/workbench/models/graph/svg/event/SVGMouseDownEventListener.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*******************************************************************************
- * 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.models.graph.svg.event;
-
-import net.sf.taverna.t2.workbench.models.graph.GraphElement;
-
-import org.apache.batik.dom.svg.SVGOMPoint;
-import org.w3c.dom.events.MouseEvent;
-
-/**
- * SVG event listener for handling mouse button down events.
- * 
- * @author David Withers
- */
-public class SVGMouseDownEventListener extends SVGEventListener {
-	public SVGMouseDownEventListener(GraphElement graphElement) {
-		super(graphElement);
-	}
-
-	@Override
-	protected void event(SVGOMPoint point, MouseEvent evt) {
-		graphElement.getEventManager().mouseDown(graphElement, evt.getButton(),
-				evt.getAltKey(), evt.getCtrlKey(), evt.getMetaKey(),
-				(int) point.getX(), (int) point.getY(), evt.getScreenX(),
-				evt.getScreenY());
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-graph-model/src/main/java/net/sf/taverna/t2/workbench/models/graph/svg/event/SVGMouseMovedEventListener.java
----------------------------------------------------------------------
diff --git a/taverna-graph-model/src/main/java/net/sf/taverna/t2/workbench/models/graph/svg/event/SVGMouseMovedEventListener.java b/taverna-graph-model/src/main/java/net/sf/taverna/t2/workbench/models/graph/svg/event/SVGMouseMovedEventListener.java
deleted file mode 100644
index 6ae5d50..0000000
--- a/taverna-graph-model/src/main/java/net/sf/taverna/t2/workbench/models/graph/svg/event/SVGMouseMovedEventListener.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*******************************************************************************
- * 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.models.graph.svg.event;
-
-import net.sf.taverna.t2.workbench.models.graph.GraphElement;
-
-import org.apache.batik.dom.svg.SVGOMPoint;
-import org.w3c.dom.events.MouseEvent;
-
-/**
- * SVG event listener for handling mouse movement events.
- * 
- * @author David Withers
- */
-public class SVGMouseMovedEventListener extends SVGEventListener {
-	public SVGMouseMovedEventListener(GraphElement graphElement) {
-		super(graphElement);
-	}
-
-	@Override
-	protected void event(SVGOMPoint point, MouseEvent mouseEvent) {
-		graphElement.getEventManager().mouseMoved(graphElement,
-				mouseEvent.getButton(), mouseEvent.getAltKey(),
-				mouseEvent.getCtrlKey(), mouseEvent.getMetaKey(),
-				(int) point.getX(), (int) point.getY(),
-				mouseEvent.getScreenX(), mouseEvent.getScreenY());
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-graph-model/src/main/java/net/sf/taverna/t2/workbench/models/graph/svg/event/SVGMouseOutEventListener.java
----------------------------------------------------------------------
diff --git a/taverna-graph-model/src/main/java/net/sf/taverna/t2/workbench/models/graph/svg/event/SVGMouseOutEventListener.java b/taverna-graph-model/src/main/java/net/sf/taverna/t2/workbench/models/graph/svg/event/SVGMouseOutEventListener.java
deleted file mode 100644
index 32714a6..0000000
--- a/taverna-graph-model/src/main/java/net/sf/taverna/t2/workbench/models/graph/svg/event/SVGMouseOutEventListener.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*******************************************************************************
- * 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.models.graph.svg.event;
-
-import net.sf.taverna.t2.workbench.models.graph.GraphElement;
-
-import org.apache.batik.dom.svg.SVGOMPoint;
-import org.w3c.dom.events.MouseEvent;
-
-/**
- * SVG event listener for handling mouse button up events.
- * 
- * @author David Withers
- */
-public class SVGMouseOutEventListener extends SVGEventListener {
-	public SVGMouseOutEventListener(GraphElement graphElement) {
-		super(graphElement);
-	}
-
-	@Override
-	protected void event(SVGOMPoint point, MouseEvent mouseEvent) {
-		graphElement.getEventManager().mouseOut(graphElement,
-				mouseEvent.getButton(), mouseEvent.getAltKey(),
-				mouseEvent.getCtrlKey(), mouseEvent.getMetaKey(),
-				(int) point.getX(), (int) point.getY(),
-				mouseEvent.getScreenX(), mouseEvent.getScreenY());
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-graph-model/src/main/java/net/sf/taverna/t2/workbench/models/graph/svg/event/SVGMouseOverEventListener.java
----------------------------------------------------------------------
diff --git a/taverna-graph-model/src/main/java/net/sf/taverna/t2/workbench/models/graph/svg/event/SVGMouseOverEventListener.java b/taverna-graph-model/src/main/java/net/sf/taverna/t2/workbench/models/graph/svg/event/SVGMouseOverEventListener.java
deleted file mode 100644
index 1c5f9a4..0000000
--- a/taverna-graph-model/src/main/java/net/sf/taverna/t2/workbench/models/graph/svg/event/SVGMouseOverEventListener.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*******************************************************************************
- * 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.models.graph.svg.event;
-
-import net.sf.taverna.t2.workbench.models.graph.GraphElement;
-
-import org.apache.batik.dom.svg.SVGOMPoint;
-import org.w3c.dom.events.MouseEvent;
-
-/**
- * SVG event listener for handling mouse button up events.
- * 
- * @author David Withers
- */
-public class SVGMouseOverEventListener extends SVGEventListener {
-	public SVGMouseOverEventListener(GraphElement graphElement) {
-		super(graphElement);
-	}
-
-	@Override
-	protected void event(SVGOMPoint point, MouseEvent mouseEvent) {
-		graphElement.getEventManager().mouseOver(graphElement,
-				mouseEvent.getButton(), mouseEvent.getAltKey(),
-				mouseEvent.getCtrlKey(), mouseEvent.getMetaKey(),
-				(int) point.getX(), (int) point.getY(),
-				mouseEvent.getScreenX(), mouseEvent.getScreenY());
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-graph-model/src/main/java/net/sf/taverna/t2/workbench/models/graph/svg/event/SVGMouseUpEventListener.java
----------------------------------------------------------------------
diff --git a/taverna-graph-model/src/main/java/net/sf/taverna/t2/workbench/models/graph/svg/event/SVGMouseUpEventListener.java b/taverna-graph-model/src/main/java/net/sf/taverna/t2/workbench/models/graph/svg/event/SVGMouseUpEventListener.java
deleted file mode 100644
index 492ecc2..0000000
--- a/taverna-graph-model/src/main/java/net/sf/taverna/t2/workbench/models/graph/svg/event/SVGMouseUpEventListener.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*******************************************************************************
- * 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.models.graph.svg.event;
-
-import net.sf.taverna.t2.workbench.models.graph.GraphElement;
-
-import org.apache.batik.dom.svg.SVGOMPoint;
-import org.w3c.dom.events.MouseEvent;
-
-/**
- * SVG event listener for handling mouse button up events.
- * 
- * @author David Withers
- */
-public class SVGMouseUpEventListener extends SVGEventListener {
-	public SVGMouseUpEventListener(GraphElement graphElement) {
-		super(graphElement);
-	}
-
-	@Override
-	protected void event(SVGOMPoint point, MouseEvent mouseEvent) {
-		graphElement.getEventManager().mouseUp(graphElement,
-				mouseEvent.getButton(), mouseEvent.getAltKey(),
-				mouseEvent.getCtrlKey(), mouseEvent.getMetaKey(),
-				(int) point.getX(), (int) point.getY(),
-				mouseEvent.getScreenX(), mouseEvent.getScreenY());
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-graph-model/src/main/java/org/apache/taverna/workbench/models/graph/DefaultGraphEventManager.java
----------------------------------------------------------------------
diff --git a/taverna-graph-model/src/main/java/org/apache/taverna/workbench/models/graph/DefaultGraphEventManager.java b/taverna-graph-model/src/main/java/org/apache/taverna/workbench/models/graph/DefaultGraphEventManager.java
new file mode 100644
index 0000000..b188acb
--- /dev/null
+++ b/taverna-graph-model/src/main/java/org/apache/taverna/workbench/models/graph/DefaultGraphEventManager.java
@@ -0,0 +1,271 @@
+/*******************************************************************************
+ * 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 org.apache.taverna.workbench.models.graph;
+
+import static javax.swing.SwingUtilities.convertPointFromScreen;
+import static javax.swing.SwingUtilities.invokeLater;
+import static org.apache.taverna.workbench.models.graph.GraphController.PortStyle.ALL;
+import static org.apache.taverna.workbench.models.graph.GraphController.PortStyle.NONE;
+
+import java.awt.Component;
+import java.awt.Point;
+import java.awt.event.ActionEvent;
+import java.net.URI;
+import java.util.List;
+
+import javax.swing.AbstractAction;
+import javax.swing.JMenu;
+import javax.swing.JMenuItem;
+import javax.swing.JPopupMenu;
+
+import org.apache.taverna.ui.menu.MenuManager;
+import org.apache.taverna.scufl2.api.activity.Activity;
+import org.apache.taverna.scufl2.api.common.Scufl2Tools;
+import org.apache.taverna.scufl2.api.core.Processor;
+import org.apache.taverna.scufl2.api.profiles.ProcessorBinding;
+
+/**
+ * Manager for handling UI events on GraphElements.
+ *
+ * @author David Withers
+ */
+public class DefaultGraphEventManager implements GraphEventManager {
+	private static final URI NESTED_WORKFLOW_URI = URI
+			.create("http://ns.taverna.org.uk/2010/activity/nested-workflow");
+
+	private GraphController graphController;
+	private Component component;
+	private JPopupMenu menu;
+	private MenuManager menuManager;
+
+	private Scufl2Tools scufl2Tools = new Scufl2Tools();
+
+	/**
+	 * Constructs a new instance of GraphEventManager.
+	 *
+	 * @param graphController
+	 * @param component
+	 *            component to use when displaying popup menus
+	 */
+	public DefaultGraphEventManager(GraphController graphController, Component component,
+			MenuManager menuManager) {
+		this.graphController = graphController;
+		this.component = component;
+		this.menuManager = menuManager;
+	}
+
+	@Override
+	public void mouseClicked(final GraphElement graphElement, short button, boolean altKey,
+			boolean ctrlKey, boolean metaKey, final int x, final int y, int screenX, int screenY) {
+		Object dataflowObject = graphElement.getWorkflowBean();
+
+		// For both left and right click - add to selection model
+		if (graphController.getDataflowSelectionModel() != null)
+			graphController.getDataflowSelectionModel().addSelection(dataflowObject);
+
+		if ((button != 2) && !ctrlKey)return;
+
+		// If this was a right click - show a pop-up as well
+		if (dataflowObject == null)
+			menu = menuManager.createContextMenu(graphController.getWorkflow(),
+					graphController.getWorkflow(), component);
+		else {
+			menu = menuManager.createContextMenu(graphController.getWorkflow(),
+					dataflowObject, component);
+			if (dataflowObject instanceof Processor) {
+				final Processor processor = (Processor) dataflowObject;
+				ProcessorBinding processorBinding = scufl2Tools
+						.processorBindingForProcessor(processor,
+								graphController.getProfile());
+				final Activity activity = processorBinding.getBoundActivity();
+				if (menu == null)
+					menu = new JPopupMenu();
+				if (graphElement instanceof GraphNode) {
+					defineMenuForGraphElement(graphElement, x, y, processor,
+							activity);
+				} else if (graphElement instanceof Graph) {
+					defineMenuForGraphBackground(activity);
+				}
+			}
+		}
+
+		if (menu != null) {
+			final Point p = new Point(screenX, screenY);
+			convertPointFromScreen(p, component);
+			invokeLater(new Runnable() {
+				@Override
+				public void run() {
+					menu.show(component, p.x, p.y);
+				}
+			});
+		}
+	}
+
+	@SuppressWarnings("serial")
+	private void defineMenuForGraphBackground(final Activity activity) {
+		if (activity.getType().equals(NESTED_WORKFLOW_URI)) {
+			menu.addSeparator();
+			menu.add(new JMenuItem(new AbstractAction("Hide nested workflow") {
+				@Override
+				public void actionPerformed(ActionEvent ev) {
+					graphController.setExpandNestedDataflow(activity, false);
+					graphController.redraw();
+				}
+			}));
+		}
+	}
+
+	@SuppressWarnings("serial")
+	private void defineMenuForGraphElement(final GraphElement graphElement,
+			final int x, final int y, final Processor processor,
+			final Activity activity) {
+		if (graphController.getPortStyle(processor).equals(NONE)) {
+			menu.addSeparator();
+			menu.add(new JMenuItem(new AbstractAction("Show ports") {
+				@Override
+				public void actionPerformed(ActionEvent ev) {
+					graphController.setPortStyle(processor, ALL);
+					graphController.redraw();
+				}
+			}));
+		} else if (graphController.getPortStyle(processor).equals(ALL)) {
+			menu.addSeparator();
+			menu.add(new JMenuItem(new AbstractAction("Hide ports") {
+				@Override
+				public void actionPerformed(ActionEvent arg0) {
+					graphController.setPortStyle(processor, NONE);
+					graphController.redraw();
+				}
+			}));
+		}
+
+		if (activity.getType().equals(NESTED_WORKFLOW_URI)) {
+			menu.addSeparator();
+			menu.add(new JMenuItem(new AbstractAction("Show nested workflow") {
+				@Override
+				public void actionPerformed(ActionEvent arg0) {
+					graphController.setExpandNestedDataflow(activity, true);
+					graphController.redraw();
+				}
+			}));
+		}
+
+		menu.addSeparator();
+
+		GraphNode graphNode = (GraphNode) graphElement;
+
+		List<GraphNode> sourceNodes = graphNode.getSourceNodes();
+		if (sourceNodes.size() == 1) {
+			final GraphNode sourceNode = sourceNodes.get(0);
+			if (sourceNode.getLabel() != null) {
+				menu.add(new JMenuItem(new AbstractAction("Link from output '"
+						+ sourceNode.getLabel() + "'") {
+					@Override
+					public void actionPerformed(ActionEvent arg0) {
+						graphController.startEdgeCreation(sourceNode,
+								new Point(x, y));
+					}
+				}));
+			}
+		} else if (sourceNodes.size() > 0) {
+			JMenu linkMenu = new JMenu("Link from output...");
+			menu.add(linkMenu);
+			for (final GraphNode sourceNode : sourceNodes) {
+				linkMenu.add(new JMenuItem(new AbstractAction(sourceNode
+						.getLabel()) {
+					@Override
+					public void actionPerformed(ActionEvent arg0) {
+						graphController.startEdgeCreation(sourceNode,
+								new Point(x, y));
+					}
+				}));
+			}
+		}
+
+		List<GraphNode> sinkNodes = graphNode.getSinkNodes();
+		if (sinkNodes.size() == 1) {
+			final GraphNode sinkNode = sinkNodes.get(0);
+			if (sinkNode.getLabel() != null) {
+				menu.add(new JMenuItem(new AbstractAction("Link to input '"
+						+ sinkNode.getLabel() + "'") {
+					@Override
+					public void actionPerformed(ActionEvent arg0) {
+						graphController.startEdgeCreation(sinkNode, new Point(
+								x, y));
+					}
+				}));
+			}
+		} else if (sinkNodes.size() > 0) {
+			JMenu linkMenu = new JMenu("Link to input...");
+			menu.add(linkMenu);
+			for (final GraphNode sinkNode : sinkNodes) {
+				linkMenu.add(new JMenuItem(new AbstractAction(sinkNode
+						.getLabel()) {
+					@Override
+					public void actionPerformed(ActionEvent arg0) {
+						graphController.startEdgeCreation(sinkNode, new Point(
+								x, y));
+					}
+				}));
+			}
+		}
+	}
+
+	@Override
+	public void mouseDown(GraphElement graphElement, short button,
+			boolean altKey, boolean ctrlKey, boolean metaKey, int x, int y,
+			int screenX, int screenY) {
+		if (button == 0)
+			graphController.startEdgeCreation(graphElement, new Point(x, y));
+	}
+
+	@Override
+	public void mouseUp(GraphElement graphElement, short button,
+			boolean altKey, boolean ctrlKey, boolean metaKey, final int x,
+			final int y, int screenX, int screenY) {
+		if (button == 0)
+			graphController.stopEdgeCreation(graphElement, new Point(screenX,
+					screenY));
+	}
+
+	@Override
+	public void mouseMoved(GraphElement graphElement, short button,
+			boolean altKey, boolean ctrlKey, boolean metaKey, int x, int y,
+			int screenX, int screenY) {
+		graphController.moveEdgeCreationTarget(graphElement, new Point(x, y));
+	}
+
+	@Override
+	public void mouseOver(GraphElement graphElement, short button,
+			boolean altKey, boolean ctrlKey, boolean metaKey, int x, int y,
+			int screenX, int screenY) {
+		if (graphElement.getWorkflowBean() != null)
+			graphElement.setActive(true);
+	}
+
+	@Override
+	public void mouseOut(GraphElement graphElement, short button,
+			boolean altKey, boolean ctrlKey, boolean metaKey, int x, int y,
+			int screenX, int screenY) {
+		if (graphElement.getWorkflowBean() != null)
+			graphElement.setActive(false);
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-graph-model/src/main/java/org/apache/taverna/workbench/models/graph/DotWriter.java
----------------------------------------------------------------------
diff --git a/taverna-graph-model/src/main/java/org/apache/taverna/workbench/models/graph/DotWriter.java b/taverna-graph-model/src/main/java/org/apache/taverna/workbench/models/graph/DotWriter.java
new file mode 100644
index 0000000..280b5fa
--- /dev/null
+++ b/taverna-graph-model/src/main/java/org/apache/taverna/workbench/models/graph/DotWriter.java
@@ -0,0 +1,253 @@
+/*******************************************************************************
+ * 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 org.apache.taverna.workbench.models.graph;
+
+import static java.lang.String.format;
+import static org.apache.taverna.workbench.models.graph.Graph.Alignment.HORIZONTAL;
+import static org.apache.taverna.workbench.models.graph.Graph.Alignment.VERTICAL;
+import static org.apache.taverna.workbench.models.graph.GraphElement.LineStyle.NONE;
+import static org.apache.taverna.workbench.models.graph.GraphShapeElement.Shape.RECORD;
+
+import java.awt.Color;
+import java.io.IOException;
+import java.io.Writer;
+import java.util.List;
+
+import org.apache.taverna.workbench.models.graph.Graph.Alignment;
+
+/**
+ * Writer for creating a graphical representation of a Graph in the DOT language.
+ * 
+ * @author David Withers
+ */
+public class DotWriter {
+	private static final String EOL = System.getProperty("line.separator");
+
+	private Writer writer;
+
+	/**
+	 * Constructs a new instance of DotWriter.
+	 *
+	 * @param writer
+	 */
+	public DotWriter(Writer writer) {
+		this.writer = writer;
+	}
+
+	/**
+	 * Writes a graphical representation of a Graph in the DOT language to a Writer.
+	 * 
+	 * @param graph
+	 * @throws IOException
+	 */
+	public void writeGraph(Graph graph) throws IOException {
+		writeLine("digraph \"" + graph.getId() + "\" {");
+
+		// Overall graph style
+		writeLine(" graph [");
+		writeLine("  bgcolor=\"" + getHexValue(graph.getFillColor()) + "\"");
+		writeLine("  color=\"black\"");
+		writeLine("  fontsize=\"10\"");
+		writeLine("  labeljust=\"left\"");
+		writeLine("  clusterrank=\"local\"");
+		writeLine("  ranksep=\"0.22\"");
+		writeLine("  nodesep=\"0.05\"");
+		// Set left to right view if alignment is horizontal
+		if (graph.getAlignment().equals(HORIZONTAL))
+			writeLine("  rankdir=\"LR\"");
+		writeLine(" ]");
+
+		// Overall node style
+		writeLine(" node [");
+		writeLine("  fontname=\"Helvetica\"");
+		writeLine("  fontsize=\"10\"");
+		writeLine("  fontcolor=\"black\"");
+		writeLine("  shape=\"record\"");
+		writeLine("  height=\"0\"");
+		writeLine("  width=\"0\"");
+		writeLine("  color=\"black\"");
+		writeLine("  fillcolor=\"lightgoldenrodyellow\"");
+		writeLine("  style=\"filled\"");
+		writeLine(" ];");
+
+		// Overall edge style
+		writeLine(" edge [");
+		writeLine("  fontname=\"Helvetica\"");
+		writeLine("  fontsize=\"8\"");
+		writeLine("  fontcolor=\"black\"");
+		writeLine("  color=\"black\"");
+		writeLine(" ];");
+
+		for (GraphNode node : graph.getNodes()) {
+			if (node.isExpanded())
+				writeSubGraph(node.getGraph(), " ");
+			else
+				writeNode(node, graph.getAlignment(), " ");
+		}
+
+		for (Graph subGraph : graph.getSubgraphs())
+			writeSubGraph(subGraph, " ");
+
+		for (GraphEdge edge : graph.getEdges())
+			writeEdges(edge, graph.getAlignment(), " ");
+
+		writeLine("}");
+	}
+
+	private void writeSubGraph(Graph graph, String indent) throws IOException {
+		writeLine(format("%ssubgraph \"cluster_%s\" {", indent, graph.getId()));
+		writeLine(format("%s rank=\"same\"", indent));
+
+		StringBuilder style = new StringBuilder();
+		if (graph.getFillColor() != null) {
+			writeLine(format("%s fillcolor=\"%s\"", indent,
+					getHexValue(graph.getFillColor())));
+			style.append("filled");
+		}
+		if (graph.getLineStyle() != null) {
+			style.append(style.length() == 0 ? "" : ",");
+			if (graph.getLineStyle().equals(NONE))
+				style.append("invis");
+			else
+				style.append(graph.getLineStyle().toString().toLowerCase());
+		}
+		writeLine(format("%s style=\"%s\"", indent, style));
+
+		if (graph.getLabel() != null)
+			writeLine(format("%s label=\"%s\"", indent, graph.getLabel()));
+
+		for(GraphNode node : graph.getNodes()) {
+			if (node.isExpanded())
+				writeSubGraph(node.getGraph(), indent + " ");
+			else
+				writeNode(node, graph.getAlignment(), indent + " ");
+		}
+
+		for (Graph subGraph : graph.getSubgraphs())
+			writeSubGraph(subGraph, indent + " ");
+
+		for (GraphEdge edge : graph.getEdges())
+			writeEdges(edge, graph.getAlignment(), indent + " ");
+
+		writeLine(indent + "}");
+	}
+
+	private void writeEdges(GraphEdge edge, Alignment alignment, String indent) throws IOException {
+		GraphNode source = edge.getSource();
+		GraphNode sink = edge.getSink();
+		String sourceId = "\"" + source.getId() + "\"";
+		String sinkId = "\"" + sink.getId() + "\"";
+		
+		if (source.getParent() instanceof GraphNode) {
+			GraphNode parent = (GraphNode) source.getParent();
+			sourceId = "\"" + parent.getId() + "\":" + sourceId;
+		}
+		if (sink.getParent() instanceof GraphNode) {
+			GraphNode parent = (GraphNode) sink.getParent();
+			sinkId = "\"" + parent.getId() + "\":" + sinkId;
+		}
+		/*
+		 * the compass point is required with newer versions of dot (e.g.
+		 * 2.26.3) but is not compatible with older versions (e.g. 1.3)
+		 */
+		if (alignment.equals(HORIZONTAL)) {
+			sourceId = sourceId + ":e";
+			sinkId = sinkId + ":w";
+		} else {
+			sourceId = sourceId + ":s";
+			sinkId = sinkId + ":n";			
+		}
+		writeLine(format("%s%s -> %s [", indent, sourceId, sinkId));
+		writeLine(format("%s arrowhead=\"%s\"", indent, edge
+				.getArrowHeadStyle().toString().toLowerCase()));
+		writeLine(format("%s, arrowtail=\"%s\"", indent, edge
+				.getArrowTailStyle().toString().toLowerCase()));
+		if (edge.getColor() != null)
+			writeLine(format("%s color=\"%s\"", indent,
+					getHexValue(edge.getColor())));
+		writeLine(format("%s]", indent));
+	}
+
+	private void writeNode(GraphNode node, Alignment alignment, String indent) throws IOException {
+		writeLine(format("%s\"%s\" [", indent, node.getId()));
+
+		StringBuilder style = new StringBuilder();
+		if (node.getFillColor() != null) {
+			writeLine(format("%s fillcolor=\"%s\"", indent,
+					getHexValue(node.getFillColor())));
+			style.append("filled");
+		}
+		if (node.getLineStyle() != null) {
+			style.append(style.length() == 0 ? "" : ",");
+			style.append(node.getLineStyle().toString().toLowerCase());
+		}
+		writeLine(format("%s style=\"%s\"", indent, style));
+
+		writeLine(format("%s shape=\"%s\"", indent, node.getShape().toString().toLowerCase()));
+		writeLine(format("%s width=\"%s\"", indent, node.getWidth() / 72f));
+		writeLine(format("%s height=\"%s\"", indent, node.getHeight() / 72f));
+
+		if (node.getShape().equals(RECORD)) {
+			StringBuilder labelString = new StringBuilder();
+			if (alignment.equals(VERTICAL)) {
+				labelString.append("{{");
+				addNodeLabels(node.getSinkNodes(), labelString);
+				labelString.append("}|").append(node.getLabel()).append("|{");
+				addNodeLabels(node.getSourceNodes(), labelString);
+				labelString.append("}}");
+			} else {
+				labelString.append(node.getLabel()).append("|{{");
+				addNodeLabels(node.getSinkNodes(), labelString);
+				labelString.append("}|{");
+				addNodeLabels(node.getSourceNodes(), labelString);
+				labelString.append("}}");
+			}
+			writeLine(format("%s label=\"%s\"", indent, labelString));
+		} else {
+			writeLine(format("%s label=\"%s\"", indent, node.getLabel()));
+		}
+
+		writeLine(format("%s];", indent));
+	}
+
+	private void addNodeLabels(List<GraphNode> nodes, StringBuilder labelString) {
+		String sep = "";
+		for (GraphNode node : nodes)
+			if (node.getLabel() != null) {
+				labelString.append(sep);
+				labelString.append("<");
+				labelString.append(node.getId());
+				labelString.append(">");
+				labelString.append(node.getLabel());
+				sep = "|";
+			}
+	}
+
+	private String getHexValue(Color color) {
+		return format("#%02x%02x%02x", color.getRed(), color.getGreen(),
+				color.getBlue());
+	}
+
+	private void writeLine(String line) throws IOException {
+		writer.write(line);
+		writer.write(EOL);
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-graph-model/src/main/java/org/apache/taverna/workbench/models/graph/Graph.java
----------------------------------------------------------------------
diff --git a/taverna-graph-model/src/main/java/org/apache/taverna/workbench/models/graph/Graph.java b/taverna-graph-model/src/main/java/org/apache/taverna/workbench/models/graph/Graph.java
new file mode 100644
index 0000000..57160be
--- /dev/null
+++ b/taverna-graph-model/src/main/java/org/apache/taverna/workbench/models/graph/Graph.java
@@ -0,0 +1,165 @@
+/*******************************************************************************
+ * 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 org.apache.taverna.workbench.models.graph;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * A graph model of a dataflow.
+ * 
+ * @author David Withers
+ */
+public class Graph extends GraphShapeElement {
+	public enum Alignment {
+		HORIZONTAL, VERTICAL
+	}
+
+	private List<GraphNode> nodes = new ArrayList<>();
+	private Set<GraphEdge> edges = new HashSet<>();
+	private Set<Graph> subgraphs = new HashSet<>();
+	private Alignment alignment = Alignment.VERTICAL;
+
+	/**
+	 * Constructs a Graph that uses the specified GraphEventManager to handle
+	 * any user generated events on GraphElements.
+	 * 
+	 * @param eventManager
+	 */
+	public Graph(GraphController graphController) {
+		super(graphController);
+	}
+
+	/**
+	 * Adds an edge to the Graph and sets its parent to be this Graph.
+	 * 
+	 * @param edge
+	 *            the edge to add
+	 */
+	public void addEdge(GraphEdge edge) {
+		edge.setParent(this);
+		edges.add(edge);
+	}
+
+	/**
+	 * Adds a node to the Graph and sets its parent to be this Graph.
+	 * 
+	 * @param node
+	 *            the node to add
+	 */
+	public void addNode(GraphNode node) {
+		node.setParent(this);
+		nodes.add(node);
+	}
+
+	/**
+	 * Adds a subgraph to the Graph and sets its parent to be this Graph.
+	 * 
+	 * @param subgraph
+	 *            the subgraph to add
+	 */
+	public void addSubgraph(Graph subgraph) {
+		subgraph.setParent(this);
+		subgraphs.add(subgraph);
+	}
+
+	/**
+	 * Returns the alignment of the Graph.
+	 * 
+	 * @return the alignment of the Graph
+	 */
+	public Alignment getAlignment() {
+		return alignment;
+	}
+
+	/**
+	 * Returns the edges contained in the Graph.
+	 * 
+	 * @return the edges contained in the Graph
+	 */
+	public Set<GraphEdge> getEdges() {
+		return Collections.unmodifiableSet(edges);
+	}
+
+	/**
+	 * Returns the nodes contained in the Graph.
+	 * 
+	 * @return the nodes contained in the Graph
+	 */
+	public List<GraphNode> getNodes() {
+		return Collections.unmodifiableList(nodes);
+	}
+
+	/**
+	 * Returns the subgraphs contained in the Graph.
+	 * 
+	 * @return the subgraphs contained in the Graph
+	 */
+	public Set<Graph> getSubgraphs() {
+		return Collections.unmodifiableSet(subgraphs);
+	}
+
+	/**
+	 * Removes an edge from the Graph.
+	 * 
+	 * @param edge
+	 *            the edge to remove
+	 * @return true if the edge is removed from the Graph
+	 */
+	public boolean removeEdge(GraphEdge edge) {
+		return edges.remove(edge);
+	}
+
+	/**
+	 * Removes a node from the Graph.
+	 * 
+	 * @param node
+	 *            the node to remove
+	 * @return true if the node is removed from the Graph
+	 */
+	public boolean removeNode(GraphNode node) {
+		return nodes.remove(node);
+	}
+
+	/**
+	 * Removes a subgraph from the Graph.
+	 * 
+	 * @param subgraph
+	 *            the subgraph to remove
+	 * @return true if the subgraph is removed from the Graph
+	 */
+	public boolean removeSubgraph(Graph subgraph) {
+		return subgraphs.remove(subgraph);
+	}
+
+	/**
+	 * Sets the alignment of the Graph.
+	 * 
+	 * @param alignment
+	 *            the new alignment
+	 */
+	public void setAlignment(Alignment alignment) {
+		this.alignment = alignment;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-graph-model/src/main/java/org/apache/taverna/workbench/models/graph/GraphColorManager.java
----------------------------------------------------------------------
diff --git a/taverna-graph-model/src/main/java/org/apache/taverna/workbench/models/graph/GraphColorManager.java b/taverna-graph-model/src/main/java/org/apache/taverna/workbench/models/graph/GraphColorManager.java
new file mode 100644
index 0000000..23edec4
--- /dev/null
+++ b/taverna-graph-model/src/main/java/org/apache/taverna/workbench/models/graph/GraphColorManager.java
@@ -0,0 +1,75 @@
+/*******************************************************************************
+ * 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 org.apache.taverna.workbench.models.graph;
+
+import java.awt.Color;
+import java.lang.reflect.InvocationTargetException;
+
+import org.apache.taverna.workbench.configuration.colour.ColourManager;
+
+import org.apache.commons.beanutils.PropertyUtils;
+
+import org.apache.taverna.scufl2.api.activity.Activity;
+
+/**
+ * Manages the colour of elements in a graph.
+ *
+ * @author David Withers
+ * @author Start Owen
+ */
+public class GraphColorManager {
+	private static final String BEANSHELL = "http://ns.taverna.org.uk/2010/activity/beanshell";
+	private static final String LOCALWORKER = "http://ns.taverna.org.uk/2010/activity/localworker";
+
+	private static Color[] subGraphFillColors = new Color[] {
+			Color.decode("#ffffff"), Color.decode("#f0f8ff"),
+			Color.decode("#faebd7"), Color.decode("#f5f5dc") };
+
+	/**
+	 * Returns the colour associated with the Activity.
+	 *
+	 * For unknown activities Color.WHITE is returned.
+	 *
+	 * For {@link LocalworkerActivity} which have been user configured use the
+	 * BeanshellActivity colour
+	 *
+	 * @return the colour associated with the Activity
+	 */
+	public static Color getFillColor(Activity activity, ColourManager colourManager) {
+		try {
+			if (activity.getType().equals(LOCALWORKER)) {
+				// To avoid compile time dependency - read isAltered property as bean
+				if (Boolean.TRUE.equals(PropertyUtils.getProperty(activity, "altered"))) {
+					Color colour = colourManager.getPreferredColour(BEANSHELL);
+					return colour;
+				}
+			}
+		} catch (IllegalAccessException | InvocationTargetException
+				| NoSuchMethodException e) {
+		}
+		Color colour = colourManager.getPreferredColour(activity.getType().toASCIIString());
+		return colour;
+	}
+
+	public static Color getSubGraphFillColor(int depth) {
+		return subGraphFillColors[depth % subGraphFillColors.length];
+	}
+}


[05/51] [partial] incubator-taverna-workbench git commit: all packages are moved to org.apache.taverna.*

Posted by re...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/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
deleted file mode 100644
index 234ea75..0000000
--- a/taverna-menu-api/src/main/java/net/sf/taverna/t2/ui/menu/AbstractToolBar.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*******************************************************************************
- * 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/a9a52bd5/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
deleted file mode 100644
index 080beb1..0000000
--- a/taverna-menu-api/src/main/java/net/sf/taverna/t2/ui/menu/ContextualMenuComponent.java
+++ /dev/null
@@ -1,35 +0,0 @@
-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/a9a52bd5/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
deleted file mode 100644
index 318ef42..0000000
--- a/taverna-menu-api/src/main/java/net/sf/taverna/t2/ui/menu/ContextualSelection.java
+++ /dev/null
@@ -1,48 +0,0 @@
-package net.sf.taverna.t2.ui.menu;
-
-import java.awt.Component;
-
-import javax.swing.JPopupMenu;
-
-import org.apache.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/a9a52bd5/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
deleted file mode 100644
index 0db13a7..0000000
--- a/taverna-menu-api/src/main/java/net/sf/taverna/t2/ui/menu/DefaultContextualMenu.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*******************************************************************************
- * 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/a9a52bd5/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
deleted file mode 100644
index 8c5eab6..0000000
--- a/taverna-menu-api/src/main/java/net/sf/taverna/t2/ui/menu/DefaultMenuBar.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*******************************************************************************
- * 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/a9a52bd5/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
deleted file mode 100644
index 302c37a..0000000
--- a/taverna-menu-api/src/main/java/net/sf/taverna/t2/ui/menu/DefaultToolBar.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * 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/a9a52bd5/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
deleted file mode 100644
index 7260fdf..0000000
--- a/taverna-menu-api/src/main/java/net/sf/taverna/t2/ui/menu/DesignOnlyAction.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * 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/a9a52bd5/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
deleted file mode 100644
index 26e6b62..0000000
--- a/taverna-menu-api/src/main/java/net/sf/taverna/t2/ui/menu/DesignOrResultsAction.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * 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 {
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-menu-api/src/main/java/net/sf/taverna/t2/ui/menu/MenuComponent.java
----------------------------------------------------------------------
diff --git a/taverna-menu-api/src/main/java/net/sf/taverna/t2/ui/menu/MenuComponent.java b/taverna-menu-api/src/main/java/net/sf/taverna/t2/ui/menu/MenuComponent.java
deleted file mode 100644
index 5bc91c4..0000000
--- a/taverna-menu-api/src/main/java/net/sf/taverna/t2/ui/menu/MenuComponent.java
+++ /dev/null
@@ -1,277 +0,0 @@
-/*******************************************************************************
- * 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.awt.event.ActionListener;
-import java.net.URI;
-import java.util.HashSet;
-import java.util.Set;
-
-import javax.swing.Action;
-import javax.swing.ButtonGroup;
-import javax.swing.JCheckBox;
-import javax.swing.JMenu;
-import javax.swing.JToolBar;
-import javax.swing.MenuElement;
-
-/**
- * A menu component, including sub menus, toolbars, and menu items.
- * <p>
- * This is an {@link net.sf.taverna.t2.spi.SPIRegistry SPI}, and implementations
- * should list their fully qualified classnames in
- * <tt>META-INF/services/net.sf.taverna.t2.ui.menu.MenuComponent</tt> to be
- * discovered by the {@link MenuManager}.
- * 
- * @author Stian Soiland-Reyes
- * @author David Withers
- */
-public interface MenuComponent {
-	/**
-	 * The {@link Action} describing this menu item, used for creating the UI
-	 * representation of this item.
-	 * <p>
-	 * As a minimum the action should contain a name, and optionally an icon, a
-	 * description and a keyboard shortcut. For {@linkplain MenuType#action
-	 * actions} and {@linkplain MenuType#toggle toggles} the {@link Action}'s
-	 * {@link ActionListener#actionPerformed(ActionEvent)} method is called when
-	 * the item is clicked/selected.
-	 * <p>
-	 * This action is ignored and should be <code>null</code> for items of type
-	 * {@link MenuType#optionGroup} and {@link MenuType#custom}. The action is
-	 * optional for {@linkplain MenuType#toolBar toolbars} and
-	 * {@linkplain MenuType#section sections}, where the action's name would be
-	 * used as a label.
-	 * 
-	 * @return The {@link Action} describing this menu item, or
-	 *         <code>null</code> if the {@link #getType()} is
-	 *         {@link MenuType#section}, {@link MenuType#optionGroup} or
-	 *         {@link MenuType#custom}.
-	 */
-	public Action getAction();
-
-	/**
-	 * Get a custom {@link Component} to be inserted into the parent
-	 * menu/toolbar.
-	 * <p>
-	 * Used instead of creating menu elements from the {@link #getAction()} if
-	 * the {@link #getType()} is {@link MenuType#custom}. This can be used to
-	 * include dynamic menus.
-	 * <p>
-	 * This value is ignored and should be <code>null</code> for all other types
-	 * except {@link MenuType#custom}.
-	 * 
-	 * @return A {@link Component} to be inserted into the parent menu/toolbar.
-	 */
-	public Component getCustomComponent();
-
-	/**
-	 * The {@link URI} to identify this menu item.
-	 * <p>
-	 * This identifier can be used with other menu item's {@link #getParentId()}
-	 * if this item has a {@link #getType()} of {@link MenuType#menu},
-	 * {@link MenuType#toolBar}, {@link MenuType#section} or
-	 * {@link MenuType#optionGroup}.
-	 * <p>
-	 * Leaf menu items of {@link #getType()} {@link MenuType#toggle},
-	 * {@link MenuType#custom} and {@link MenuType#action} don't need an
-	 * identifier as they can't have children, and may return <code>null</code>
-	 * instead. However, a valid identifier might be used to look up the
-	 * MenuItem with {@link MenuManager#getComponentByURI(URI)}
-	 * <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.
-	 * 
-	 * @return The {@link URI} to identify this menu item.
-	 */
-	public URI getId();
-
-	/**
-	 * The {@link URI} of the parent menu item, as returned by the parent's
-	 * {@link #getId()}.
-	 * <p>
-	 * If this is the {@link DefaultMenuBar#DEFAULT_MENU_BAR}, then this menu
-	 * item will be one of the top level menus of the main application window,
-	 * like "File" or "Edit", and must have {@link #getType()}
-	 * {@link MenuType#menu}.
-	 * <p>
-	 * This value should be <code>null</code> if this item is of
-	 * {@link #getType()} {@link MenuType#toolBar}, and could be
-	 * <code>null</code> if this is an independent root menu of type
-	 * {@link MenuType#menu} (to be used outside the main window).
-	 * <p>
-	 * <strong>Note:</strong> To avoid compile time and runtime dependency on
-	 * the parent menu item, always construct this URI directly using
-	 * {@link URI#create(String)}.
-	 * 
-	 * @return The {@link URI} of the parent menu item.
-	 */
-	public URI getParentId();
-
-	/**
-	 * A hint on how to position this item below the parent.
-	 * <p>
-	 * Menu items within the same parent menu/group/toolBar are ordered
-	 * according to this position hint. If several items have the same position
-	 * hint, their internal order is undefined, although generally it will be
-	 * the order in which they were loaded.
-	 * <p>
-	 * <strong>Tip:</strong> Number the position hints in BASIC style, such as
-	 * 10, 20, etc. so that plugins can use position hint such as 19 or 21 to be
-	 * immediately before or after your item.
-	 * 
-	 * @return A position hint
-	 */
-	public int getPositionHint();
-
-	/**
-	 * The {@link MenuType type} of menu item.
-	 * <p>
-	 * In the simple case of a "File -> New" menu structure, the "File" menu
-	 * item has a type of {@link MenuType#menu}, while the "New" has a type of
-	 * {@link MenuType#action}.
-	 * <p>
-	 * The menu item can only have children (i.e., items with
-	 * {@link #getParentId()} equalling to this item's {@link #getId()}) if the
-	 * type is not a leaf type, i.e., not {@link MenuType#toggle} or
-	 * {@link MenuType#action}.
-	 * 
-	 * @return A {@link MenuType} to specify the role of this menu item.
-	 */
-	public MenuType getType();
-
-	/**
-	 * True if this menu component is to be included in the menu/toolbar.
-	 * 
-	 * @return True is this menu component is to be included
-	 */
-	public boolean isEnabled();
-
-	/**
-	 * The type of menu item, such as {@link #action}, {@link #menu} or
-	 * {@link #toolBar}.
-	 * <p>
-	 * Some types are {@linkplain #isParentType() parent types} - that means
-	 * URIs to menu components of that type can be used as a
-	 * {@linkplain MenuComponent#getParentId() parent id}.
-	 * 
-	 * @author Stian Soiland-Reyes
-	 * 
-	 */
-	public static enum MenuType {
-		/**
-		 * A normal {@link Action} as part of a {@link #menu}, {@link #toolBar},
-		 * {@link #section} or {@link #optionGroup}. Such menu items are leaf
-		 * nodes, which no {@link MenuComponent}s can have this as it's
-		 * {@link MenuComponent#getParentId()}. The action's
-		 * {@link ActionListener#actionPerformed(ActionEvent)} will be called
-		 * when choosing/clicking the menu item from the menu or toolBar.
-		 */
-		action,
-		/**
-		 * Provide a customised {@link MenuElement} from
-		 * {@link MenuComponent#getCustomComponent()} that is to be used instead
-		 * of creating an element from {@link MenuComponent#getAction()}.
-		 */
-		custom,
-		/**
-		 * A group containing mutually exclusive choices (as {@link #action}s),
-		 * to be grouped in a {@link ButtonGroup}, separated using
-		 * {@link JMenu#addSeparator()} or {@link JToolBar#addSeparator()} when
-		 * needed. The {@link MenuComponent#getAction()} is ignored and should
-		 * be <code>null</code>.
-		 */
-		optionGroup,
-		/**
-		 * A section of menu items within {@link #menu} or {@link #toolBar}.
-		 * Sections are separated using {@link JMenu#addSeparator()} or
-		 * {@link JToolBar#addSeparator()} when needed. The
-		 * {@link MenuComponent#getAction()} is ignored and should be
-		 * <code>null</code>.
-		 */
-		section,
-		/**
-		 * A (sub)menu that contain other menu items, including deeper
-		 * {@link #menu}s. The {@link Action} from
-		 * {@link MenuComponent#getAction()} is used to find the name, icon,
-		 * etc., for the sub-menu, while its
-		 * {@link ActionListener#actionPerformed(ActionEvent)} method is
-		 * ignored. The {@link DefaultMenuBar} is the default top level menu,
-		 * although others can be created with <code>null</code> as their
-		 * parent.
-		 */
-		menu,
-		/**
-		 * A boolean toggle action, the action will be shown as a
-		 * {@link JCheckBox} on a menu or toolBar. Such menu items are leaf
-		 * nodes, which no {@link MenuComponent}s can have this as it's
-		 * {@link MenuComponent#getParentId()}. The action's
-		 * {@link ActionListener#actionPerformed(ActionEvent)} will be called
-		 * when toggling the action.
-		 */
-		toggle,
-		/**
-		 * A toolBar containing {@link #optionGroup}s, {@link #toggle}s or
-		 * {@link #action}s. The toolBar can be shown as a {@link JToolBar}. The
-		 * {@link MenuComponent#getAction()} and
-		 * {@link MenuComponent#getParentId()} are ignored and should be
-		 * <code>null</code>.
-		 */
-		toolBar;
-
-		private static final Set<MenuType> parentTypes = defineParentTypes();
-
-		/**
-		 * True if the menu type is a parent type such as {@link #optionGroup},
-		 * {@link #section}, {@link #menu} or {@link #toolBar}. If the type of a
-		 * menu component is a a parent type it can (should) have children,
-		 * i.e., the children has a {@link MenuComponent#getParentId()} that
-		 * equals the parent's {@link MenuComponent#getId()}.
-		 * 
-		 * @return True if the menu type is a parent type.
-		 */
-		public boolean isParentType() {
-			return parentTypes.contains(this);
-		}
-
-		/**
-		 * Create the set of {@link MenuType}s that {@link #isParentType()}
-		 * would return <code>true</code> for.
-		 * 
-		 * @return A {@link Set} of {@link MenuType}s.
-		 */
-		private static Set<MenuType> defineParentTypes() {
-			HashSet<MenuType> types = new HashSet<>();
-			types.add(optionGroup);
-			types.add(section);
-			types.add(menu);
-			types.add(toolBar);
-			return types;
-		}
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-menu-api/src/main/java/net/sf/taverna/t2/ui/menu/MenuManager.java
----------------------------------------------------------------------
diff --git a/taverna-menu-api/src/main/java/net/sf/taverna/t2/ui/menu/MenuManager.java b/taverna-menu-api/src/main/java/net/sf/taverna/t2/ui/menu/MenuManager.java
deleted file mode 100644
index f86e0e0..0000000
--- a/taverna-menu-api/src/main/java/net/sf/taverna/t2/ui/menu/MenuManager.java
+++ /dev/null
@@ -1,339 +0,0 @@
-/*******************************************************************************
- * 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.lang.ref.WeakReference;
-import java.net.URI;
-import java.util.List;
-
-import javax.swing.JLabel;
-import javax.swing.JMenu;
-import javax.swing.JMenuBar;
-import javax.swing.JMenuItem;
-import javax.swing.JPopupMenu;
-import javax.swing.JToolBar;
-
-import org.apache.taverna.scufl2.api.core.Workflow;
-import org.apache.taverna.lang.observer.Observable;
-import org.apache.taverna.lang.observer.Observer;
-import net.sf.taverna.t2.ui.menu.MenuComponent.MenuType;
-import net.sf.taverna.t2.ui.menu.MenuManager.MenuManagerEvent;
-
-/**
- * Create {@link JMenuBar}s and {@link JToolBar}s based on SPI instances of
- * {@link MenuComponent}.
- * <p>
- * Elements of menus are discovered automatically using an {@link SPIRegistry}.
- * The elements specify their internal relationship through
- * {@link MenuComponent#getParentId()} and
- * {@link MenuComponent#getPositionHint()}. {@link MenuComponent#getType()}
- * specifies how the component is to be rendered or grouped.
- * <p>
- * The menu manager is {@link Observable}, you can
- * {@linkplain #addObserver(Observer) add an observer} to be notified when the
- * menus have changed, i.e. when {@link #update()} has been called, for instance
- * when the {@link SPIRegistry} (which the menu manager observes) has been
- * updated due to a plugin installation.
- * <p>
- * {@link #createMenuBar()} creates the default menu bar, ie. the menu bar
- * containing all the items with {@link DefaultMenuBar#DEFAULT_MENU_BAR} as
- * their parent. Alternate menu bars can be created using
- * {@link #createMenuBar(URI)}.
- * <p>
- * Similary {@link #createToolBar()} creates the default tool bar, containing
- * the items that has {@link DefaultToolBar#DEFAULT_TOOL_BAR} as their parent.
- * Alternate toolbars can be created using {@link #createToolBar(URI)}.
- * <p>
- * The menu manager keeps weak references to the created (published) menu bars
- * and tool bars, and will attempt to update them when {@link #update()} is
- * called.
- * <p>
- * See the package level documentation for more information about how to specify
- * menu elements.
- * 
- * @author Stian Soiland-Reyes
- */
-public interface MenuManager extends Observable<MenuManagerEvent> {
-	/**
-	 * Add the items from the list of menu items to the parent menu with
-	 * expansion sub-menus if needed.
-	 * <p>
-	 * If the list contains more than <tt>maxItemsInMenu</tt> items, a series of
-	 * sub-menus will be created and added to the parentMenu instead, each
-	 * containing a maximum of <tt>maxItemsInMenu</tt> items. (Note that if
-	 * menuItems contains more than <tt>maxItemsInMenu*maxItemsInMenu</tt>
-	 * items, there might be more than <tt>maxItemsInMenu</tt> sub-menus added
-	 * to the parent).
-	 * <p>
-	 * The sub-menus are titled according to the {@link JMenuItem#getText()} of
-	 * the first and last menu item it contains - assuming that they are already
-	 * sorted.
-	 * <p>
-	 * The optional {@link ComponentFactory} headerItemFactory, if not
-	 * <code>null</code>, will be invoked to create a header item that will be
-	 * inserted on top of the sub-menus. This item does not count towards
-	 * <tt>maxItemsInMenu</tt>.
-	 * <p>
-	 * Note that this is a utility method that does not mandate the use of the
-	 * {@link MenuManager} structure for the menu.
-	 * 
-	 * @param menuItems
-	 *            {@link JMenuItem}s to be inserted
-	 * @param parentMenu
-	 *            Menu to insert items to
-	 * @param maxItemsInMenu
-	 *            Maximum number of items in parent menu or created sub-menus
-	 * @param headerItemFactory
-	 *            If not <code>null</code>, a {@link ComponentFactory} to create
-	 *            a header item to insert at top of created sub-menus
-	 */
-	abstract void addMenuItemsWithExpansion(List<JMenuItem> menuItems,
-			JMenu parentMenu, int maxItemsInMenu,
-			ComponentFactory headerItemFactory);
-
-	/**
-	 * Create a contextual menu for a selected object.
-	 * <p>
-	 * Items for the contextual menues are discovered in a similar to fashion as
-	 * with {@link #createMenuBar()}, but using {@link DefaultContextualMenu} as
-	 * the root.
-	 * <p>
-	 * Additionally, items implementing {@link ContextualMenuComponent} will be
-	 * {@linkplain ContextualMenuComponent#setContextualSelection(Object, Object, Component)
-	 * informed} about what is the current selection, as passed to this method.
-	 * <p>
-	 * Thus, the items can choose if they want to be
-	 * {@link MenuComponent#isEnabled() visible} or not for a given selection,
-	 * and return an action that is bound it to the selection.
-	 * 
-	 * @param parent
-	 *            The parent object of the selected object, for instance a
-	 *            {@link Workflow}.
-	 * @param selection
-	 *            The selected object which actions in the contextual menu
-	 *            relate to, for instance a {@link Processor}
-	 * @param relativeToComponent
-	 *            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.
-	 * @return An empty or populated {@link JPopupMenu} depending on the
-	 *         selected objects.
-	 */
-	abstract JPopupMenu createContextMenu(Object parent, Object selection,
-			Component relativeToComponent);
-
-	/**
-	 * Create the {@link JMenuBar} containing menu elements defining
-	 * {@link DefaultMenuBar#DEFAULT_MENU_BAR} as their
-	 * {@linkplain MenuComponent#getParentId() parent}.
-	 * <p>
-	 * A {@linkplain WeakReference weak reference} is kept in the menu manager
-	 * to update the menubar if {@link #update()} is called (manually or
-	 * automatically when the SPI is updated).
-	 * 
-	 * @return A {@link JMenuBar} populated with the items belonging to the
-	 *         default menu bar
-	 */
-	abstract JMenuBar createMenuBar();
-
-	/**
-	 * Create the {@link JMenuBar} containing menu elements defining the given
-	 * <code>id</code> as their {@linkplain MenuComponent#getParentId() parent}.
-	 * <p>
-	 * Note that the parent itself also needs to exist as a registered SPI
-	 * instance og {@link MenuComponent#getType()} equal to
-	 * {@link MenuType#menu}, for instance by subclassing {@link AbstractMenu}.
-	 * <p>
-	 * A {@linkplain WeakReference weak reference} is kept in the menu manager
-	 * to update the menubar if {@link #update()} is called (manually or
-	 * automatically when the SPI is updated).
-	 * 
-	 * @param id
-	 *            The {@link URI} identifying the menu bar
-	 * @return A {@link JMenuBar} populated with the items belonging to the
-	 *         given parent id.
-	 */
-	abstract JMenuBar createMenuBar(URI id);
-
-	/**
-	 * Create the {@link JToolBar} containing elements defining
-	 * {@link DefaultToolBar#DEFAULT_TOOL_BAR} as their
-	 * {@linkplain MenuComponent#getParentId() parent}.
-	 * <p>
-	 * A {@linkplain WeakReference weak reference} is kept in the menu manager
-	 * to update the toolbar if {@link #update()} is called (manually or
-	 * automatically when the SPI is updated).
-	 * 
-	 * @return A {@link JToolBar} populated with the items belonging to the
-	 *         default tool bar
-	 */
-	abstract JToolBar createToolBar();
-
-	/**
-	 * Create the {@link JToolBar} containing menu elements defining the given
-	 * <code>id</code> as their {@linkplain MenuComponent#getParentId() parent}.
-	 * <p>
-	 * Note that the parent itself also needs to exist as a registered SPI
-	 * instance of {@link MenuComponent#getType()} equal to
-	 * {@link MenuType#toolBar}, for instance by subclassing
-	 * {@link AbstractToolBar}.
-	 * <p>
-	 * A {@linkplain WeakReference weak reference} is kept in the menu manager
-	 * to update the toolbar if {@link #update()} is called (manually or
-	 * automatically when the SPI is updated).
-	 * 
-	 * @param id
-	 *            The {@link URI} identifying the tool bar
-	 * @return A {@link JToolBar} populated with the items belonging to the
-	 *         given parent id.
-	 */
-	abstract JToolBar createToolBar(URI id);
-
-	/**
-	 * Get a menu item identified by the given URI.
-	 * <p>
-	 * Return the UI {@link Component} last created for a {@link MenuComponent},
-	 * through {@link #createMenuBar()}, {@link #createMenuBar(URI)},
-	 * {@link #createToolBar()} or {@link #createToolBar(URI)}.
-	 * <p>
-	 * For instance, if {@link #createMenuBar()} created a menu bar containing a
-	 * "File" menu with {@link MenuComponent#getId() getId()} ==
-	 * <code>http://example.com/menu#file</code>, calling:
-	 * 
-	 * <pre>
-	 * Component fileMenu = getComponentByURI(URI
-	 * 		.create(&quot;http://example.com/menu#file&quot;));
-	 * </pre>
-	 * 
-	 * would return the {@link JMenu} last created for "File". Note that "last
-	 * created" could mean both the last call to {@link #createMenuBar()} and
-	 * last call to {@link #update()} - which could have happened because the
-	 * SPI registry was updated. To be notified when
-	 * {@link #getComponentByURI(URI)} might return a new Component because the
-	 * menues have been reconstructed, {@linkplain #addObserver(Observer) add an
-	 * observer} to the MenuManager.
-	 * <p>
-	 * If the URI is unknown, has not yet been rendered as a {@link Component},
-	 * or the Component is no longer in use outside the menu manager's
-	 * {@linkplain WeakReference weak references}, <code>null</code> is returned
-	 * instead.
-	 * 
-	 * @see #getURIByComponent(Component)
-	 * @param id
-	 *            {@link URI} of menu item as returned by
-	 *            {@link MenuComponent#getId()}
-	 * @return {@link Component} as previously generated by
-	 *         {@link #createMenuBar()}/{@link #createToolBar()}, or
-	 *         <code>null</code> if the URI is unknown, or if the
-	 *         {@link Component} no longer exists.
-	 */
-	public abstract Component getComponentByURI(URI id);
-
-	/**
-	 * Get the URI of the {@link MenuComponent} this menu/toolbar
-	 * {@link Component} was created from.
-	 * <p>
-	 * If the component was created by the MenuManager, through
-	 * {@link #createMenuBar()}, {@link #createMenuBar(URI)},
-	 * {@link #createToolBar()} or {@link #createToolBar(URI)}, the URI
-	 * identifying the defining {@link MenuComponent} is returned. This will be
-	 * the same URI as returned by {@link MenuComponent#getId()}.
-	 * <p>
-	 * Note that if {@link #update()} has been invoked, the {@link MenuManager}
-	 * might have rebuilt the menu structure and replaced the components since
-	 * the given <code>component</code> was created. The newest
-	 * {@link Component} for the given URI can be retrieved using
-	 * {@link #getComponentByURI(URI)}.
-	 * <p>
-	 * If the component is unknown, <code>null</code> is returned instead.
-	 * 
-	 * @see #getComponentByURI(URI)
-	 * @param component
-	 *            {@link Component} that was previously created by the
-	 *            {@link MenuManager}
-	 * @return {@link URI} identifying the menu component, as returned by
-	 *         {@link MenuComponent#getId()}, or <code>null</code> if the
-	 *         component is unknown.
-	 */
-	abstract URI getURIByComponent(Component component);
-
-	/**
-	 * Update and rebuild the menu structure.
-	 * <p>
-	 * Rebuild menu structure as defined by the {@link MenuComponent}s retrieved
-	 * from the MenuComponent {@link SPIRegistry}.
-	 * <p>
-	 * Rebuilds previously published menubars and toolbars created with
-	 * {@link #createMenuBar()}, {@link #createMenuBar(URI)},
-	 * {@link #createToolBar()} and {@link #createToolBar(URI)}. Note that the
-	 * rebuild will do a removeAll() on the menubar/toolbar, so all components
-	 * will be reconstructed. You can use {@link #getComponentByURI(URI)} to
-	 * look up individual components within the menu and toolbars.
-	 * <p>
-	 * Note that the menu manager is observing the {@link SPIRegistry}, so if a
-	 * plugin gets installed and the SPI registry is updated, this update method
-	 * will be called by the SPI registry observer.
-	 * <p>
-	 * If there are several concurrent calls to {@link #update()}, the calls
-	 * from the other thread will return immediately, while the first thread to
-	 * get the synchronization lock on the menu manager will do the actual
-	 * update. If you want to ensure that {@link #update()} does not return
-	 * before the update has been performed fully, synchronize on the menu
-	 * manager:
-	 * 
-	 * <pre>
-	 * MenuManager menuManager = MenuManager.getInstance();
-	 * synchronized (menuManager) {
-	 * 	menuManager.update();
-	 * }
-	 * doSomethingAfterUpdateFinished();
-	 * </pre>
-	 */
-	abstract void update();
-
-	/**
-	 * Abstract class for events sent to {@linkplain Observer observers} of the
-	 * menu manager.
-	 * 
-	 * @see UpdatedMenuManagerEvent
-	 * @author Stian Soiland-Reyes
-	 */
-	static abstract class MenuManagerEvent {
-	}
-
-	/**
-	 * Event sent to observers registered by
-	 * {@link MenuManager#addObserver(Observer)} when the menus have been
-	 * updated, i.e. when {@link MenuManager#update()} has been called.
-	 */
-	static class UpdatedMenuManagerEvent extends MenuManagerEvent {
-	}
-
-	/**
-	 * A factory for making {@link Component}s, in particular for making headers
-	 * (like {@link JLabel}s) for
-	 * {@link MenuManager#addMenuItemsWithExpansion(List, JMenu, int, ComponentFactory)}
-	 */
-	interface ComponentFactory {
-		public Component makeComponent();
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-menu-api/src/main/java/net/sf/taverna/t2/ui/menu/package-info.java
----------------------------------------------------------------------
diff --git a/taverna-menu-api/src/main/java/net/sf/taverna/t2/ui/menu/package-info.java b/taverna-menu-api/src/main/java/net/sf/taverna/t2/ui/menu/package-info.java
deleted file mode 100644
index 4c86db5..0000000
--- a/taverna-menu-api/src/main/java/net/sf/taverna/t2/ui/menu/package-info.java
+++ /dev/null
@@ -1,141 +0,0 @@
-/*******************************************************************************
- * 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
- ******************************************************************************/
-/**
- * An {@link net.sf.taverna.t2.spi.SPIRegistry SPI} based system for creating
- * {@link javax.swing.JMenuBar menues} and {@link javax.swing.JToolBar toolbars}.
- * <p>
- * Each element of a menu and/or toolbar is created by making an SPI
- * implementation class of {@link net.sf.taverna.t2.ui.menu.MenuComponent} and listing the fully qualified
- * class name in the SPI description resource file
- * <code>/META-INF/services/net.sf.taverna.t2.ui.menu.MenuComponent</code>
- * </p>
- * <p>
- * The {@link net.sf.taverna.t2.ui.menu.MenuManager} discovers all menu components using an SPI registry,
- * and builds the {@link javax.swing.JMenuBar menu bar} using
- * {@link net.sf.taverna.t2.ui.menu.MenuManager#createMenuBar()} or the
- * {@link javax.swing.JToolBar toolbar} using
- * {@link net.sf.taverna.t2.ui.menu.MenuManager#createToolBar()}.
- * </p>
- * <p>
- * This allows plugins to provide actions (menu items) and submenues that can be
- * inserted at any points in the generated menu. All parts of the menues are
- * described through a parent/child relationship using
- * {@link net.sf.taverna.t2.ui.menu.MenuComponent#getId()} and {@link net.sf.taverna.t2.ui.menu.MenuComponent#getParentId()}. The
- * components are identified using {@link java.net.URI}s to avoid compile time
- * dependencies, so a plugin can for instance add something to the existing
- * "Edit" menu without depending on the actual implementation of the
- * {@link net.sf.taverna.t2.ui.menu.MenuComponent} describing "Edit", as long as it refers to the same
- * URI. The use of URIs instead of pure strings is to encourage the use of
- * unique identifiers, for instance plugins should use an URI base that is
- * derived from their package name to avoid collision with other plugins.
- * </p>
- * <p>
- * A set of abstract classes, with a common parent {@link net.sf.taverna.t2.ui.menu.AbstractMenuItem},
- * make it more convenient to create simple SPI implementations. Two default top
- * level implementations {@link net.sf.taverna.t2.ui.menu.DefaultMenuBar} and {@link net.sf.taverna.t2.ui.menu.DefaultToolBar} can
- * be used as parents for items that are to be included in
- * {@link net.sf.taverna.t2.ui.menu.MenuManager#createMenuBar()} and {@link net.sf.taverna.t2.ui.menu.MenuManager#createToolBar()},
- * but it's possible to have other parents - such menu trees would have to be
- * created by providing the URI of the top level parent to
- * {@link net.sf.taverna.t2.ui.menu.MenuManager#createMenuBar(URI)} or
- * {@link net.sf.taverna.t2.ui.menu.MenuManager#createToolBar(URI)}.
- * </p> 
- * <p>
- * In the simplest form a menu structure can be built by subclassing
- * {@link net.sf.taverna.t2.ui.menu.AbstractMenu} and {@link net.sf.taverna.t2.ui.menu.AbstractMenuAction}, but more complex menus
- * can be built by including submenus (AbstractMenu with an AbstractMenu as a
- * parent), grouping similar actions in a {@link net.sf.taverna.t2.ui.menu.AbstractMenuSection section},
- * or making {@link net.sf.taverna.t2.ui.menu.AbstractMenuToggle toggle actions} and
- * {@link net.sf.taverna.t2.ui.menu.AbstractMenuOptionGroup option groups}. You can add arbitrary "real"
- * {@link javax.swing.JMenuBar} / {@link javax.swing.JToolBar} compatible items
- * (such as {@link javax.swing.JMenu}s, {@link javax.swing.JMenuItem}s and
- * {@link javax.swing.JButton}s) using
- * {@link net.sf.taverna.t2.ui.menu.AbstractMenuCustom custom menu items}.
- * </p>
- * 
- * <p>
- * Example showing how <code>File-&gt;Open</code> could be implemented using
- * two SPI implementations net.sf.taverna.t2.ui.perspectives.hello.FileMenu and
- * net.sf.taverna.t2.ui.perspectives.hello.FileOpenAction:
- * </p>
- * 
- * <pre>
- * package net.sf.taverna.t2.ui.perspectives.hello;
- * 
- * import java.net.URI;
- * 
- * import net.sf.taverna.t2.ui.menu.AbstractMenu;
- * import net.sf.taverna.t2.ui.menu.DefaultMenuBar;
- * 
- * public class FileMenu extends AbstractMenu {
- * 
- * 	private static final URI FILE_URI = URI
- * 			.create(&quot;http://taverna.sf.net/2008/t2workbench/test#file&quot;);
- * 
- * 	public FileMenu() {
- * 		super(DefaultMenuBar.DEFAULT_MENU_BAR, 10, FILE_URI, &quot;File&quot;);
- * 	}
- * 
- * }
- * </pre>
- * <pre>
- * package net.sf.taverna.t2.ui.perspectives.hello;
- * 
- * import java.awt.event.ActionEvent;
- * import java.net.URI;
- * 
- * import javax.swing.AbstractAction;
- * import javax.swing.Action;
- * import javax.swing.JOptionPane;
- * 
- * import net.sf.taverna.t2.ui.menu.AbstractMenuAction;
- * 
- * public class FileOpenAction extends AbstractMenuAction {
- *     public FileOpenAction() {
- *         super(URI.create(&quot;http://taverna.sf.net/2008/t2workbench/test#file&quot;),
- *                 20);
- *     }
- * 
- *     &#064;Override
- *     public Action createAction() {
- *         return new AbstractAction(&quot;Open&quot;) {
- *             public void actionPerformed(ActionEvent arg0) {
- *                 JOptionPane.showMessageDialog(null, &quot;Open&quot;);
- *             }
- *         };
- *     }
- * }
- * </pre>
- * 
- * <p>
- * The implementation of the {@link net.sf.taverna.t2.ui.menu.MenuManager} itself is discovered by an
- * internal SPI registry through {@link net.sf.taverna.t2.ui.menu.MenuManager#getInstance()}. The menu
- * manager is observing the SPI registry, so that any updates to the registry
- * from installing plugins etc. are reflected in an automatic rebuild of the
- * menus. This update can also be triggered manually by calling
- * {@link net.sf.taverna.t2.ui.menu.MenuManager#update()}.
- * </p>
- * 
- * @author Stian Soiland-Reyes
- * 
- */
-package net.sf.taverna.t2.ui.menu;
-

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-menu-api/src/main/java/org/apache/taverna/ui/menu/AbstractContextualMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-menu-api/src/main/java/org/apache/taverna/ui/menu/AbstractContextualMenuAction.java b/taverna-menu-api/src/main/java/org/apache/taverna/ui/menu/AbstractContextualMenuAction.java
new file mode 100644
index 0000000..41de5ec
--- /dev/null
+++ b/taverna-menu-api/src/main/java/org/apache/taverna/ui/menu/AbstractContextualMenuAction.java
@@ -0,0 +1,63 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.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/a9a52bd5/taverna-menu-api/src/main/java/org/apache/taverna/ui/menu/AbstractMenu.java
----------------------------------------------------------------------
diff --git a/taverna-menu-api/src/main/java/org/apache/taverna/ui/menu/AbstractMenu.java b/taverna-menu-api/src/main/java/org/apache/taverna/ui/menu/AbstractMenu.java
new file mode 100644
index 0000000..1694839
--- /dev/null
+++ b/taverna-menu-api/src/main/java/org/apache/taverna/ui/menu/AbstractMenu.java
@@ -0,0 +1,122 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.ui.menu;
+
+import static org.apache.taverna.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/a9a52bd5/taverna-menu-api/src/main/java/org/apache/taverna/ui/menu/AbstractMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-menu-api/src/main/java/org/apache/taverna/ui/menu/AbstractMenuAction.java b/taverna-menu-api/src/main/java/org/apache/taverna/ui/menu/AbstractMenuAction.java
new file mode 100644
index 0000000..45a6c89
--- /dev/null
+++ b/taverna-menu-api/src/main/java/org/apache/taverna/ui/menu/AbstractMenuAction.java
@@ -0,0 +1,134 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.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/a9a52bd5/taverna-menu-api/src/main/java/org/apache/taverna/ui/menu/AbstractMenuCustom.java
----------------------------------------------------------------------
diff --git a/taverna-menu-api/src/main/java/org/apache/taverna/ui/menu/AbstractMenuCustom.java b/taverna-menu-api/src/main/java/org/apache/taverna/ui/menu/AbstractMenuCustom.java
new file mode 100644
index 0000000..8c77976
--- /dev/null
+++ b/taverna-menu-api/src/main/java/org/apache/taverna/ui/menu/AbstractMenuCustom.java
@@ -0,0 +1,143 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.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/a9a52bd5/taverna-menu-api/src/main/java/org/apache/taverna/ui/menu/AbstractMenuItem.java
----------------------------------------------------------------------
diff --git a/taverna-menu-api/src/main/java/org/apache/taverna/ui/menu/AbstractMenuItem.java b/taverna-menu-api/src/main/java/org/apache/taverna/ui/menu/AbstractMenuItem.java
new file mode 100644
index 0000000..2980a70
--- /dev/null
+++ b/taverna-menu-api/src/main/java/org/apache/taverna/ui/menu/AbstractMenuItem.java
@@ -0,0 +1,143 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.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/a9a52bd5/taverna-menu-api/src/main/java/org/apache/taverna/ui/menu/AbstractMenuOptionGroup.java
----------------------------------------------------------------------
diff --git a/taverna-menu-api/src/main/java/org/apache/taverna/ui/menu/AbstractMenuOptionGroup.java b/taverna-menu-api/src/main/java/org/apache/taverna/ui/menu/AbstractMenuOptionGroup.java
new file mode 100644
index 0000000..067ed5e
--- /dev/null
+++ b/taverna-menu-api/src/main/java/org/apache/taverna/ui/menu/AbstractMenuOptionGroup.java
@@ -0,0 +1,78 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.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;
+	}
+}


[47/51] [partial] incubator-taverna-workbench git commit: all packages are moved to org.apache.taverna.*

Posted by re...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-ui/src/main/java/net/sf/taverna/t2/workbench/ui/servicepanel/ServicePanel.java
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-ui/src/main/java/net/sf/taverna/t2/workbench/ui/servicepanel/ServicePanel.java b/taverna-activity-palette-ui/src/main/java/net/sf/taverna/t2/workbench/ui/servicepanel/ServicePanel.java
deleted file mode 100644
index 616b574..0000000
--- a/taverna-activity-palette-ui/src/main/java/net/sf/taverna/t2/workbench/ui/servicepanel/ServicePanel.java
+++ /dev/null
@@ -1,411 +0,0 @@
-/*******************************************************************************
- * 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.workbench.ui.servicepanel;
-
-import static javax.swing.JOptionPane.ERROR_MESSAGE;
-import static javax.swing.JOptionPane.showMessageDialog;
-import static javax.swing.SwingUtilities.invokeLater;
-import static net.sf.taverna.t2.servicedescriptions.ServiceDescription.LOCAL_SERVICES;
-import static net.sf.taverna.t2.servicedescriptions.ServiceDescription.SERVICE_TEMPLATES;
-
-import java.awt.BorderLayout;
-import java.lang.reflect.InvocationTargetException;
-import java.util.Comparator;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-import java.util.Timer;
-import java.util.TimerTask;
-import java.util.TreeMap;
-import java.util.TreeSet;
-
-import javax.swing.ImageIcon;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-
-import org.apache.taverna.lang.observer.Observable;
-import org.apache.taverna.lang.observer.Observer;
-import net.sf.taverna.t2.servicedescriptions.ServiceDescription;
-import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionProvider;
-import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionRegistry;
-import net.sf.taverna.t2.servicedescriptions.events.AbstractProviderEvent;
-import net.sf.taverna.t2.servicedescriptions.events.AbstractProviderNotification;
-import net.sf.taverna.t2.servicedescriptions.events.PartialServiceDescriptionsNotification;
-import net.sf.taverna.t2.servicedescriptions.events.ProviderErrorNotification;
-import net.sf.taverna.t2.servicedescriptions.events.RemovedProviderEvent;
-import net.sf.taverna.t2.servicedescriptions.events.ServiceDescriptionProvidedEvent;
-import net.sf.taverna.t2.servicedescriptions.events.ServiceDescriptionRegistryEvent;
-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.servicepanel.tree.FilterTreeModel;
-import net.sf.taverna.t2.workbench.ui.servicepanel.tree.FilterTreeNode;
-import net.sf.taverna.t2.workbench.ui.zaria.UIComponentSPI;
-
-import org.apache.log4j.Logger;
-
-import org.apache.taverna.commons.services.ServiceRegistry;
-
-/**
- * A panel of available services
- *
- * @author Stian Soiland-Reyes
- */
-@SuppressWarnings("serial")
-public class ServicePanel extends JPanel implements UIComponentSPI {
-	private static Logger logger = Logger.getLogger(ServicePanel.class);
-	private static final int INITIAL_BLANK_OUT_COUNTER = 2;
-	public static final String AVAILABLE_SERVICES = "Available services";
-	public static final String MATCHING_SERVIES = "Matching services";
-	public static final String NO_MATCHING_SERVICES = "No matching services";
-	public static final String MOBY_OBJECTS = "MOBY Objects";
-	/**
-	 * A Comparable constant to be used with buildPathMap
-	 */
-	private static final String SERVICES = "4DA84170-7746-4817-8C2E-E29AF8B2984D";
-	private static final int STATUS_LINE_MESSAGE_MS = 600;
-	private static ServicePathElementComparator servicePathElementComparator = new ServicePathElementComparator();
-
-	public int blankOutCounter = 0;
-	private TreeUpdaterThread updaterThread;
-	private RootFilterTreeNode root = new RootFilterTreeNode(AVAILABLE_SERVICES);
-	private ServiceTreePanel serviceTreePanel;
-	private JLabel statusLine;
-	private FilterTreeModel treeModel;
-	protected Timer statusUpdateTimer;
-
-	private final ServiceDescriptionRegistry serviceDescriptionRegistry;
-	protected final ServiceDescriptionRegistryObserver serviceDescriptionRegistryObserver = new ServiceDescriptionRegistryObserver();
-	protected final Object updateLock = new Object();
-	private final EditManager editManager;
-	private final MenuManager menuManager;
-	private final SelectionManager selectionManager;
-	private final ServiceRegistry serviceRegistry;
-
-	public ServicePanel(ServiceDescriptionRegistry serviceDescriptionRegistry,
-			EditManager editManager, MenuManager menuManager,
-			SelectionManager selectionManager, ServiceRegistry serviceRegistry) {
-		this.serviceDescriptionRegistry = serviceDescriptionRegistry;
-		this.editManager = editManager;
-		this.menuManager = menuManager;
-		this.selectionManager = selectionManager;
-		this.serviceRegistry = serviceRegistry;
-		serviceDescriptionRegistry.addObserver(serviceDescriptionRegistryObserver);
-		initialise();
-	}
-
-	@Override
-	public ImageIcon getIcon() {
-		return null;
-	}
-
-	@Override
-	public String getName() {
-		return "Service panel";
-	}
-
-	@Override
-	public void onDisplay() {
-	}
-
-	@Override
-	public void onDispose() {
-	}
-
-	public void providerStatus(ServiceDescriptionProvider provider, String message) {
-		logger.info(message + " " + provider);
-		final String htmlMessage = "<small>" + message + " [" + provider + "]</small>";
-
-		invokeLater(new Runnable() {
-			@Override
-			public void run() {
-				blankOutCounter = INITIAL_BLANK_OUT_COUNTER;
-				statusLine.setText("<html>" + htmlMessage + "</html>");
-				statusLine.setVisible(true);
-			}
-		});
-	}
-
-	protected void initialise() {
-		removeAll();
-		setLayout(new BorderLayout());
-		treeModel = new FilterTreeModel(root);
-		serviceTreePanel = new ServiceTreePanel(treeModel, serviceDescriptionRegistry, editManager, menuManager, selectionManager, serviceRegistry);
-		serviceTreePanel.setAvailableObjectsString(AVAILABLE_SERVICES);
-		serviceTreePanel.setMatchingObjectsString(MATCHING_SERVIES);
-		serviceTreePanel.setNoMatchingObjectsString(NO_MATCHING_SERVICES);
-		add(serviceTreePanel);
-		statusLine = new JLabel();
-		add(statusLine, BorderLayout.SOUTH);
-		if (statusUpdateTimer != null)
-			statusUpdateTimer.cancel();
-		statusUpdateTimer = new Timer("Clear status line", true);
-		statusUpdateTimer
-				.scheduleAtFixedRate(new UpdateStatusLineTask(), 0, STATUS_LINE_MESSAGE_MS);
-		updateTree();
-	}
-
-	protected void updateTree() {
-		synchronized (updateLock) {
-			if (updaterThread != null && updaterThread.isAlive()) {
-				return;
-			}
-			updaterThread = new TreeUpdaterThread();
-			updaterThread.start();
-		}
-	}
-
-	protected static class ServicePathElementComparator implements Comparator<Object> {
-		@Override
-		public int compare(Object o1, Object o2) {
-			if ((o1 instanceof String) && (o2 instanceof String)) {
-				if (o1.equals(SERVICE_TEMPLATES))
-					return -1;
-				else if (o2.equals(SERVICE_TEMPLATES))
-					return 1;
-				if (o1.equals(LOCAL_SERVICES))
-					return -1;
-				else if (o2.equals(LOCAL_SERVICES))
-					return 1;
-				if (o1.equals(MOBY_OBJECTS))
-					return -1;
-				else if (o2.equals(MOBY_OBJECTS))
-					return 1;
-			}
-			return o1.toString().compareToIgnoreCase(o2.toString());
-		}
-	}
-
-	@SuppressWarnings({ "rawtypes", "unchecked" })
-	//FIXME this class is type-disastrous! Really bad.
-	public class TreeUpdaterThread extends Thread {
-		private boolean aborting = false;
-
-		private TreeUpdaterThread() {
-			super("Updating service panel");
-			setDaemon(true);
-		}
-
-		public void abort() {
-			aborting = true;
-			interrupt();
-		}
-
-		@Override
-		public void run() {
-			Map<Comparable, Map> pathMap = buildPathMap();
-			populateChildren(root, pathMap);
-			invokeLater(new Runnable() {
-				@Override
-				public void run() {
-					try {
-						serviceTreePanel.runFilter();
-					} catch (InterruptedException | InvocationTargetException e) {
-						logger.error("failed to filter", e);
-					}
-				}
-			});
-		}
-
-		protected Map<Comparable, Map> buildPathMap() {
-			Map<Comparable, Map> paths = new TreeMap<>();
-			for (ServiceDescription serviceDescription : serviceDescriptionRegistry
-					.getServiceDescriptions()) {
-				if (aborting)
-					return paths;
-				Map currentPath = paths;
-				for (Object pathElem : serviceDescription.getPath()) {
-					Map pathEntry = (Map) currentPath.get(pathElem);
-					if (pathEntry == null) {
-						pathEntry = new TreeMap();
-						currentPath.put(pathElem, pathEntry);
-					}
-					currentPath = pathEntry;
-				}
-				TreeMap<String, Set<ServiceDescription>> services = (TreeMap) currentPath
-						.get(SERVICES);
-				if (services == null) {
-					services = new TreeMap<>();
-					currentPath.put(SERVICES, services);
-				}
-				String serviceDescriptionName = serviceDescription.getName();
-				if (!services.containsKey(serviceDescriptionName)) {
-					Set<ServiceDescription> serviceSet = new HashSet<>();
-					services.put(serviceDescriptionName, serviceSet);
-				}
-				services.get(serviceDescriptionName).add(serviceDescription);
-			}
-			return paths;
-		}
-
-		protected void populateChildren(FilterTreeNode node, Map pathMap) {
-			if (aborting)
-				return;
-			if (node == root) {
-				// Clear top root
-				invokeLater(new Runnable() {
-					@Override
-					public void run() {
-						if (aborting)
-							return;
-						serviceTreePanel.setFilter(null);
-						root.removeAllChildren();
-					}
-				});
-			}
-
-			Set<Comparable> paths = new TreeSet<>(servicePathElementComparator);
-			Map<String, Set<ServiceDescription>> services = (Map) pathMap
-					.get(SERVICES);
-			if (services == null)
-				services = new TreeMap<>();
-			paths.addAll(pathMap.keySet());
-			paths.addAll(services.keySet());
-
-			for (Comparable pathElement : paths) {
-				if (aborting)
-					return;
-				if (pathElement.equals(SERVICES))
-					continue;
-				Set<FilterTreeNode> childNodes = new HashSet<>();
-				if (services.containsKey(pathElement)) {
-					for (ServiceDescription sd : services.get(pathElement))
-						childNodes.add(new ServiceFilterTreeNode(sd));
-				} else
-					childNodes.add(new PathElementFilterTreeNode((String) pathElement));
-				invokeLater(new AddNodeRunnable(node, childNodes));
-				if ((pathMap.containsKey(pathElement)) && !childNodes.isEmpty())
-					populateChildren(childNodes.iterator().next(), (Map) pathMap.get(pathElement));
-			}
-			// if (!services.isEmpty()) {
-			// Collections.sort(services, serviceComparator);
-			// for (String serviceName : services.keySet()) {
-			// if (aborting) {
-			// return;
-			// }
-			// if (pathMap.containsKey(serviceName)) {
-			// continue;
-			// }
-			// SwingUtilities.invokeLater(new AddNodeRunnable(node,
-			// new ServiceFilterTreeNode(services.get(serviceName))));
-			// }
-			// }
-		}
-
-		public class AddNodeRunnable implements Runnable {
-			private final Set<FilterTreeNode> nodes;
-			private final FilterTreeNode root;
-
-			public AddNodeRunnable(FilterTreeNode root, Set<FilterTreeNode> nodes) {
-				this.root = root;
-				this.nodes = nodes;
-			}
-
-			@Override
-			public void run() {
-				if (aborting)
-					return;
-				for (FilterTreeNode n : nodes)
-					root.add(n);
-			}
-		}
-	}
-
-	public static class RemoveNodeRunnable implements Runnable {
-		private final FilterTreeNode root;
-
-		public RemoveNodeRunnable(FilterTreeNode root) {
-			this.root = root;
-		}
-
-		@Override
-		public void run() {
-			root.removeFromParent();
-		}
-	}
-
-	private final class ServiceDescriptionRegistryObserver implements
-			Observer<ServiceDescriptionRegistryEvent> {
-		Set<ServiceDescriptionProvider> alreadyComplainedAbout = new HashSet<>();
-
-		@Override
-		public void notify(Observable<ServiceDescriptionRegistryEvent> sender,
-				ServiceDescriptionRegistryEvent message) throws Exception {
-			if (message instanceof ProviderErrorNotification)
-				reportServiceProviderError((ProviderErrorNotification) message);
-			else if (message instanceof ServiceDescriptionProvidedEvent
-					|| message instanceof RemovedProviderEvent) {
-				AbstractProviderEvent ape = (AbstractProviderEvent) message;
-				alreadyComplainedAbout.remove(ape.getProvider());
-			}
-
-			if (message instanceof AbstractProviderNotification) {
-				AbstractProviderNotification abstractProviderNotification = (AbstractProviderNotification) message;
-				providerStatus(abstractProviderNotification.getProvider(),
-						abstractProviderNotification.getMessage());
-			}
-			if (message instanceof PartialServiceDescriptionsNotification)
-				/*
-				 * TODO: Support other events and only update relevant parts of
-				 * tree, or at least select the recently added provider
-				 */
-				updateTree();
-			else if (message instanceof RemovedProviderEvent)
-				updateTree();
-		}
-
-		private void reportServiceProviderError(
-				final ProviderErrorNotification pen) {
-			ServiceDescriptionProvider provider = pen.getProvider();
-			if (serviceDescriptionRegistry
-					.getDefaultServiceDescriptionProviders().contains(provider))
-				return;
-			if (alreadyComplainedAbout.contains(provider))
-				return;
-
-			alreadyComplainedAbout.add(provider);
-			invokeLater(new Runnable() {
-				@Override
-				public void run() {
-					showMessageDialog(ServicePanel.this, pen.getMessage()
-							+ "\n" + pen.getProvider(), "Import service error",
-							ERROR_MESSAGE);
-				}
-			});
-		}
-	}
-
-	private final class UpdateStatusLineTask extends TimerTask {
-		@Override
-		public void run() {
-			if (blankOutCounter < 0 || blankOutCounter-- > 0)
-				// Only clear it once
-				return;
-			invokeLater(new Runnable() {
-				@Override
-				public void run() {
-					if (blankOutCounter < 0)
-						statusLine.setVisible(false);
-				}
-			});
-		}
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-ui/src/main/java/net/sf/taverna/t2/workbench/ui/servicepanel/ServicePanelComponentFactory.java
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-ui/src/main/java/net/sf/taverna/t2/workbench/ui/servicepanel/ServicePanelComponentFactory.java b/taverna-activity-palette-ui/src/main/java/net/sf/taverna/t2/workbench/ui/servicepanel/ServicePanelComponentFactory.java
deleted file mode 100644
index f720a16..0000000
--- a/taverna-activity-palette-ui/src/main/java/net/sf/taverna/t2/workbench/ui/servicepanel/ServicePanelComponentFactory.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 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.workbench.ui.servicepanel;
-
-import javax.swing.ImageIcon;
-
-import org.apache.taverna.commons.services.ServiceRegistry;
-
-import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionRegistry;
-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.zaria.UIComponentFactorySPI;
-import net.sf.taverna.t2.workbench.ui.zaria.UIComponentSPI;
-
-/**
- * Service panel factory
- * 
- * @author Stian Soiland-Reyes
- */
-public class ServicePanelComponentFactory implements UIComponentFactorySPI {
-	private ServiceDescriptionRegistry serviceDescriptionRegistry;
-	private EditManager editManager;
-	private MenuManager menuManager;
-	private SelectionManager selectionManager;
-	private ServiceRegistry serviceRegistry;
-
-	@Override
-	public UIComponentSPI getComponent() {
-		return new ServicePanel(serviceDescriptionRegistry, editManager,
-				menuManager, selectionManager, serviceRegistry);
-	}
-
-	@Override
-	public ImageIcon getIcon() {
-		return null;
-	}
-
-	@Override
-	public String getName() {
-		return "Service panel";
-	}
-
-	public void setServiceDescriptionRegistry(
-			ServiceDescriptionRegistry serviceDescriptionRegistry) {
-		this.serviceDescriptionRegistry = serviceDescriptionRegistry;
-	}
-
-	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;
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-ui/src/main/java/net/sf/taverna/t2/workbench/ui/servicepanel/ServiceTreeCellRenderer.java
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-ui/src/main/java/net/sf/taverna/t2/workbench/ui/servicepanel/ServiceTreeCellRenderer.java b/taverna-activity-palette-ui/src/main/java/net/sf/taverna/t2/workbench/ui/servicepanel/ServiceTreeCellRenderer.java
deleted file mode 100644
index 4b7388d..0000000
--- a/taverna-activity-palette-ui/src/main/java/net/sf/taverna/t2/workbench/ui/servicepanel/ServiceTreeCellRenderer.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*******************************************************************************
- * 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.servicepanel;
-
-import static net.sf.taverna.t2.workbench.activityicons.DefaultActivityIcon.getDefaultIcon;
-
-import java.awt.Component;
-
-import javax.swing.Icon;
-import javax.swing.JTree;
-
-import net.sf.taverna.t2.servicedescriptions.ServiceDescription;
-import net.sf.taverna.t2.workbench.ui.servicepanel.tree.FilterTreeCellRenderer;
-import net.sf.taverna.t2.workbench.ui.servicepanel.tree.FilterTreeNode;
-
-@SuppressWarnings("serial")
-public class ServiceTreeCellRenderer extends FilterTreeCellRenderer {
-	@Override
-	public Component getTreeCellRendererComponent(JTree tree, Object value,
-			boolean sel, boolean expanded, boolean leaf, int row,
-			boolean hasFocus) {
-		Component result = super.getTreeCellRendererComponent(tree, value, sel,
-				expanded, leaf, row, hasFocus);
-		if (result instanceof ServiceTreeCellRenderer
-				&& value instanceof FilterTreeNode
-				&& ((FilterTreeNode) value).getUserObject() instanceof ServiceDescription)
-			prettifyServiceTreeCell((ServiceTreeCellRenderer) result,
-					(ServiceDescription) ((FilterTreeNode) value)
-							.getUserObject());
-		else {
-			// Commented out - these are ugly, use the default folder icons instead
-			/*
-			 * if (expanded) { ((ServiceTreeCellRenderer) result)
-			 * .setIcon(WorkbenchIcons.folderOpenIcon); } else {
-			 * ((ServiceTreeCellRenderer) result)
-			 * .setIcon(WorkbenchIcons.folderClosedIcon); }
-			 */
-		}
-		return result;
-	}
-
-	private void prettifyServiceTreeCell(ServiceTreeCellRenderer renderer,
-			ServiceDescription item) {
-		String name = item.getName();
-		if (getFilter() != null)
-			name = getFilter().filterRepresentation(name);
-		// serviceTreeCellRenderer.setForeground(Color.red);
-		String displayName = name;
-
-		String textualDescription = item.getDescription();
-		if (textualDescription != null && !textualDescription.isEmpty())
-			displayName = displayName + " - " + textualDescription;
-		renderer.setText(displayName);
-
-		Icon activityIcon = item.getIcon();
-		renderer.setIcon(activityIcon != null ? activityIcon
-				: getDefaultIcon());
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-ui/src/main/java/net/sf/taverna/t2/workbench/ui/servicepanel/ServiceTreeClickListener.java
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-ui/src/main/java/net/sf/taverna/t2/workbench/ui/servicepanel/ServiceTreeClickListener.java b/taverna-activity-palette-ui/src/main/java/net/sf/taverna/t2/workbench/ui/servicepanel/ServiceTreeClickListener.java
deleted file mode 100644
index ff44a2e..0000000
--- a/taverna-activity-palette-ui/src/main/java/net/sf/taverna/t2/workbench/ui/servicepanel/ServiceTreeClickListener.java
+++ /dev/null
@@ -1,252 +0,0 @@
-/*******************************************************************************
- * 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.servicepanel;
-
-import static java.awt.Color.RED;
-import static javax.swing.SwingUtilities.invokeLater;
-import static net.sf.taverna.t2.lang.ui.ShadedLabel.BLUE;
-import static net.sf.taverna.t2.lang.ui.ShadedLabel.GREEN;
-import static net.sf.taverna.t2.lang.ui.ShadedLabel.ORANGE;
-import static net.sf.taverna.t2.lang.ui.ShadedLabel.halfShade;
-import static net.sf.taverna.t2.workbench.icons.WorkbenchIcons.minusIcon;
-import static net.sf.taverna.t2.workbench.icons.WorkbenchIcons.plusIcon;
-
-import java.awt.event.ActionEvent;
-import java.awt.event.MouseAdapter;
-import java.awt.event.MouseEvent;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeMap;
-
-import javax.swing.AbstractAction;
-import javax.swing.JMenuItem;
-import javax.swing.JPopupMenu;
-import javax.swing.JTree;
-import javax.swing.tree.TreePath;
-
-import net.sf.taverna.t2.lang.ui.ShadedLabel;
-import net.sf.taverna.t2.servicedescriptions.ConfigurableServiceProvider;
-import net.sf.taverna.t2.servicedescriptions.ServiceDescription;
-import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionProvider;
-import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionRegistry;
-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.servicepanel.actions.ExportServiceDescriptionsAction;
-import net.sf.taverna.t2.workbench.ui.servicepanel.actions.ImportServiceDescriptionsFromFileAction;
-import net.sf.taverna.t2.workbench.ui.servicepanel.actions.ImportServiceDescriptionsFromURLAction;
-import net.sf.taverna.t2.workbench.ui.servicepanel.actions.RemoveDefaultServicesAction;
-import net.sf.taverna.t2.workbench.ui.servicepanel.actions.RemoveUserServicesAction;
-import net.sf.taverna.t2.workbench.ui.servicepanel.actions.RestoreDefaultServicesAction;
-import net.sf.taverna.t2.workbench.ui.servicepanel.tree.FilterTreeNode;
-import net.sf.taverna.t2.workbench.ui.servicepanel.tree.FilterTreeSelectionModel;
-import net.sf.taverna.t2.workbench.ui.servicepanel.tree.TreePanel;
-import net.sf.taverna.t2.workbench.ui.workflowview.WorkflowView;
-
-import org.apache.log4j.Logger;
-
-import org.apache.taverna.commons.services.ServiceRegistry;
-
-/**
- * @author alanrw
- */
-public class ServiceTreeClickListener extends MouseAdapter {
-	private static Logger logger = Logger.getLogger(ServiceTreeClickListener.class);
-
-	private JTree tree;
-	private TreePanel panel;
-	private final ServiceDescriptionRegistry serviceDescriptionRegistry;
-	private final EditManager editManager;
-	private final MenuManager menuManager;
-	private final SelectionManager selectionManager;
-	private final ServiceRegistry serviceRegistry;
-
-	public ServiceTreeClickListener(JTree tree, TreePanel panel,
-			ServiceDescriptionRegistry serviceDescriptionRegistry, EditManager editManager,
-			MenuManager menuManager, SelectionManager selectionManager, ServiceRegistry serviceRegistry) {
-		this.tree = tree;
-		this.panel = panel;
-		this.serviceDescriptionRegistry = serviceDescriptionRegistry;
-		this.editManager = editManager;
-		this.menuManager = menuManager;
-		this.selectionManager = selectionManager;
-		this.serviceRegistry = serviceRegistry;
-	}
-
-	@SuppressWarnings("serial")
-	private void handleMouseEvent(MouseEvent evt) {
-		FilterTreeSelectionModel selectionModel = (FilterTreeSelectionModel) tree
-				.getSelectionModel();
-		// Discover the tree row that was clicked on
-		int selRow = tree.getRowForLocation(evt.getX(), evt.getY());
-		if (selRow == -1)
-			return;
-
-		// Get the selection path for the row
-		TreePath selectionPath = tree
-				.getPathForLocation(evt.getX(), evt.getY());
-		if (selectionPath == null)
-			return;
-
-		// Get the selected node
-		final FilterTreeNode selectedNode = (FilterTreeNode) selectionPath
-				.getLastPathComponent();
-
-		selectionModel.clearSelection();
-		selectionModel.mySetSelectionPath(selectionPath);
-
-		if (evt.isPopupTrigger()) {
-			JPopupMenu menu = new JPopupMenu();
-			Object selectedObject = selectedNode.getUserObject();
-			logger.info(selectedObject.getClass().getName());
-			if (!(selectedObject instanceof ServiceDescription)) {
-				menu.add(new ShadedLabel("Tree", BLUE));
-				menu.add(new JMenuItem(new AbstractAction("Expand all",
-						plusIcon) {
-					@Override
-					public void actionPerformed(ActionEvent evt) {
-						invokeLater(new Runnable() {
-							@Override
-							public void run() {
-								panel.expandAll(selectedNode, true);
-							}
-						});
-					}
-				}));
-				menu.add(new JMenuItem(new AbstractAction("Collapse all",
-						minusIcon) {
-					@Override
-					public void actionPerformed(ActionEvent evt) {
-						invokeLater(new Runnable() {
-							@Override
-							public void run() {
-								panel.expandAll(selectedNode, false);
-							}
-						});
-					}
-				}));
-			}
-
-			if (selectedObject instanceof ServiceDescription) {
-				final ServiceDescription sd = (ServiceDescription) selectedObject;
-				menu.add(new ShadedLabel(sd.getName(), ORANGE));
-				menu.add(new AbstractAction("Add to workflow") {
-					@Override
-					public void actionPerformed(ActionEvent e) {
-						WorkflowView.importServiceDescription(sd, false, editManager,
-								menuManager, selectionManager, serviceRegistry);
-					}
-				});
-				menu.add(new AbstractAction("Add to workflow with name...") {
-					@Override
-					public void actionPerformed(ActionEvent e) {
-						WorkflowView.importServiceDescription(sd, true, editManager,
-								menuManager, selectionManager, serviceRegistry);
-					}
-				});
-			}
-
-			Map<String, ServiceDescriptionProvider> nameMap = getServiceDescriptionProviderMap(selectedNode);
-
-			boolean first = true;
-			for (String name : nameMap.keySet()) {
-				final ServiceDescriptionProvider sdp = nameMap.get(name);
-				if (!(sdp instanceof ConfigurableServiceProvider))
-					continue;
-				if (first) {
-					menu.add(new ShadedLabel(
-							"Remove individual service provider", GREEN));
-					first = false;
-				}
-				menu.add(new AbstractAction(name) {
-					@Override
-					public void actionPerformed(ActionEvent e) {
-						serviceDescriptionRegistry
-								.removeServiceDescriptionProvider(sdp);
-					}
-				});
-			}
-
-			if (selectedNode.isRoot()) { // Root "Available services"
-				menu.add(new ShadedLabel("Default and added service providers",
-						ORANGE));
-				menu.add(new RemoveUserServicesAction(
-						serviceDescriptionRegistry));
-				menu.add(new RemoveDefaultServicesAction(
-						serviceDescriptionRegistry));
-				menu.add(new RestoreDefaultServicesAction(
-						serviceDescriptionRegistry));
-
-				menu.add(new ShadedLabel("Import/export services", halfShade(RED)));
-				menu.add(new ImportServiceDescriptionsFromFileAction(
-						serviceDescriptionRegistry));
-				menu.add(new ImportServiceDescriptionsFromURLAction(
-						serviceDescriptionRegistry));
-				menu.add(new ExportServiceDescriptionsAction(
-						serviceDescriptionRegistry));
-			}
-
-			menu.show(evt.getComponent(), evt.getX(), evt.getY());
-		}
-	}
-
-	private Map<String, ServiceDescriptionProvider> getServiceDescriptionProviderMap(
-			FilterTreeNode selectedNode) {
-		Set<ServiceDescriptionProvider> providers;
-
-		if (selectedNode.isRoot())
-			providers = serviceDescriptionRegistry
-					.getServiceDescriptionProviders();
-		else {
-			providers = new HashSet<>();
-			for (FilterTreeNode leaf : selectedNode.getLeaves()) {
-				if (!leaf.isLeaf())
-					logger.info("Not a leaf");
-				if (!(leaf.getUserObject() instanceof ServiceDescription)) {
-					logger.info(leaf.getUserObject().getClass()
-							.getCanonicalName());
-					logger.info(leaf.getUserObject().toString());
-					continue;
-				}
-				providers
-						.addAll(serviceDescriptionRegistry
-								.getServiceDescriptionProviders((ServiceDescription) leaf
-										.getUserObject()));
-			}
-		}
-
-		TreeMap<String, ServiceDescriptionProvider> nameMap = new TreeMap<>();
-		for (ServiceDescriptionProvider sdp : providers)
-			nameMap.put(sdp.toString(), sdp);
-		return nameMap;
-	}
-
-	@Override
-	public void mousePressed(MouseEvent evt) {
-		handleMouseEvent(evt);
-	}
-
-	@Override
-	public void mouseReleased(MouseEvent evt) {
-		handleMouseEvent(evt);
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-ui/src/main/java/net/sf/taverna/t2/workbench/ui/servicepanel/ServiceTreePanel.java
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-ui/src/main/java/net/sf/taverna/t2/workbench/ui/servicepanel/ServiceTreePanel.java b/taverna-activity-palette-ui/src/main/java/net/sf/taverna/t2/workbench/ui/servicepanel/ServiceTreePanel.java
deleted file mode 100644
index 35c143b..0000000
--- a/taverna-activity-palette-ui/src/main/java/net/sf/taverna/t2/workbench/ui/servicepanel/ServiceTreePanel.java
+++ /dev/null
@@ -1,176 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.workbench.ui.servicepanel;
-
-import static java.awt.datatransfer.DataFlavor.javaJVMLocalObjectMimeType;
-import static javax.swing.SwingUtilities.invokeLater;
-
-import java.awt.Component;
-import java.awt.FlowLayout;
-import java.awt.datatransfer.DataFlavor;
-import java.awt.datatransfer.Transferable;
-import java.awt.datatransfer.UnsupportedFlavorException;
-import java.io.IOException;
-
-import javax.swing.JComponent;
-import javax.swing.JPanel;
-import javax.swing.TransferHandler;
-import javax.swing.event.TreeExpansionEvent;
-import javax.swing.event.TreeWillExpandListener;
-import javax.swing.tree.ExpandVetoException;
-import javax.swing.tree.TreeCellRenderer;
-import javax.swing.tree.TreePath;
-
-import net.sf.taverna.t2.servicedescriptions.ServiceDescription;
-import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionRegistry;
-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.servicepanel.menu.AddServiceProviderMenu;
-import net.sf.taverna.t2.workbench.ui.servicepanel.tree.Filter;
-import net.sf.taverna.t2.workbench.ui.servicepanel.tree.FilterTreeModel;
-import net.sf.taverna.t2.workbench.ui.servicepanel.tree.FilterTreeNode;
-import net.sf.taverna.t2.workbench.ui.servicepanel.tree.TreePanel;
-
-import org.apache.log4j.Logger;
-
-import org.apache.taverna.commons.services.ServiceRegistry;
-
-public class ServiceTreePanel extends TreePanel {
-	private static final long serialVersionUID = 6611462684296693909L;
-	private static Logger logger = Logger.getLogger(ServiceTreePanel.class);
-
-	private final ServiceDescriptionRegistry serviceDescriptionRegistry;
-	private final EditManager editManager;
-	private final MenuManager menuManager;
-	private final SelectionManager selectionManager;
-	private final ServiceRegistry serviceRegistry;
-
-	public ServiceTreePanel(FilterTreeModel treeModel,
-			ServiceDescriptionRegistry serviceDescriptionRegistry, EditManager editManager,
-			MenuManager menuManager, SelectionManager selectionManager, ServiceRegistry serviceRegistry) {
-		super(treeModel);
-		this.serviceDescriptionRegistry = serviceDescriptionRegistry;
-		this.editManager = editManager;
-		this.menuManager = menuManager;
-		this.selectionManager = selectionManager;
-		this.serviceRegistry = serviceRegistry;
-		initialize();
-	}
-
-	@Override
-	protected void initialize() {
-		super.initialize();
-		tree.setDragEnabled(true);
-		tree.setTransferHandler(new ServiceTransferHandler());
-		tree.addTreeWillExpandListener(new AvoidRootCollapse());
-		tree.expandRow(0);
-
-		invokeLater(new Runnable() {
-			@Override
-			public void run() {
-				tree.addMouseListener(new ServiceTreeClickListener(tree,
-						ServiceTreePanel.this, serviceDescriptionRegistry,
-						editManager, menuManager, selectionManager,
-						serviceRegistry));
-			}
-		});
-	}
-
-	@Override
-	protected Component createExtraComponent() {
-		JComponent buttonPanel = new JPanel(new FlowLayout());
-		buttonPanel.add(new AddServiceProviderMenu(serviceDescriptionRegistry));
-		// buttonPanel.add(new JButton(new RefreshProviderRegistryAction()));
-		return buttonPanel;
-	}
-
-	@Override
-	public Filter createFilter(String text) {
-		return new ServiceFilter(text, filterTreeModel.getRoot());
-	}
-
-	@Override
-	protected TreeCellRenderer createCellRenderer() {
-		return new ServiceTreeCellRenderer();
-	}
-
-	public static class AvoidRootCollapse implements TreeWillExpandListener {
-		@Override
-		public void treeWillCollapse(TreeExpansionEvent event) throws ExpandVetoException {
-			if (event.getPath().getPathCount() == 1)
-				throw new ExpandVetoException(event, "Can't collapse root");
-		}
-
-		@Override
-		public void treeWillExpand(TreeExpansionEvent event) throws ExpandVetoException {
-		}
-	}
-
-	private final class ServiceTransferHandler extends TransferHandler {
-		private static final long serialVersionUID = 4347965626386951176L;
-
-		/**
-		 * Triggered when a node ie. an {@link ActivityItem} is dragged out of
-		 * the tree. Figures out what node it is being dragged and then starts a
-		 * drag action with it
-		 */
-		@Override
-		protected Transferable createTransferable(JComponent c) {
-			TreePath selectionPath = tree.getSelectionPath();
-			if (selectionPath == null)
-				return null;
-			FilterTreeNode lastPathComponent = (FilterTreeNode) selectionPath
-					.getLastPathComponent();
-			if (!(lastPathComponent.getUserObject() instanceof ServiceDescription))
-				return null;
-			final ServiceDescription serviceDescription = (ServiceDescription) lastPathComponent
-					.getUserObject();
-
-			return new Transferable() {
-				@Override
-				public Object getTransferData(DataFlavor flavor)
-						throws UnsupportedFlavorException, IOException {
-					return serviceDescription;
-				}
-
-				@Override
-				public DataFlavor[] getTransferDataFlavors() {
-					DataFlavor[] flavors = new DataFlavor[1];
-					try {
-						flavors[0] = getFlavorForClass(ServiceDescription.class);
-					} catch (ClassNotFoundException e) {
-						logger.error("Error casting Dataflavor", e);
-						flavors[0] = null;
-					}
-					return flavors;
-				}
-
-				@Override
-				public boolean isDataFlavorSupported(DataFlavor flavor) {
-					DataFlavor thisFlavor = null;
-					try {
-						thisFlavor = getFlavorForClass(ServiceDescription.class);
-					} catch (ClassNotFoundException e) {
-						logger.error("Error casting Dataflavor", e);
-					}
-					return flavor.equals(thisFlavor);
-				}
-			};
-		}
-
-		@Override
-		public int getSourceActions(JComponent c) {
-			return COPY_OR_MOVE;
-		}
-	}
-
-	private DataFlavor getFlavorForClass(Class<?> clazz)
-			throws ClassNotFoundException {
-		String name = clazz.getName();
-		return new DataFlavor(javaJVMLocalObjectMimeType + ";class=" + clazz,
-				name.substring(name.lastIndexOf('.') + 1),
-				clazz.getClassLoader());
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-ui/src/main/java/net/sf/taverna/t2/workbench/ui/servicepanel/actions/AddServiceProviderAction.java
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-ui/src/main/java/net/sf/taverna/t2/workbench/ui/servicepanel/actions/AddServiceProviderAction.java b/taverna-activity-palette-ui/src/main/java/net/sf/taverna/t2/workbench/ui/servicepanel/actions/AddServiceProviderAction.java
deleted file mode 100644
index 4568327..0000000
--- a/taverna-activity-palette-ui/src/main/java/net/sf/taverna/t2/workbench/ui/servicepanel/actions/AddServiceProviderAction.java
+++ /dev/null
@@ -1,256 +0,0 @@
-/*******************************************************************************
- * 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.servicepanel.actions;
-
-import static java.awt.BorderLayout.CENTER;
-import static java.awt.BorderLayout.NORTH;
-import static java.awt.BorderLayout.SOUTH;
-import static java.awt.BorderLayout.WEST;
-import static java.awt.event.KeyEvent.VK_ENTER;
-import static javax.swing.JOptionPane.ERROR_MESSAGE;
-import static javax.swing.JOptionPane.showMessageDialog;
-import static net.sf.taverna.t2.workbench.MainWindow.getMainWindow;
-import static org.apache.commons.beanutils.PropertyUtils.getPropertyDescriptors;
-import static org.apache.log4j.Logger.getLogger;
-
-import java.awt.BorderLayout;
-import java.awt.Component;
-import java.awt.event.ActionEvent;
-import java.awt.event.KeyAdapter;
-import java.awt.event.KeyEvent;
-import java.beans.PropertyDescriptor;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.swing.AbstractAction;
-import javax.swing.JButton;
-import javax.swing.JDialog;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-
-import org.apache.taverna.lang.observer.Observable;
-import org.apache.taverna.lang.observer.Observer;
-import net.sf.taverna.t2.lang.uibuilder.UIBuilder;
-import net.sf.taverna.t2.servicedescriptions.ConfigurableServiceProvider;
-import net.sf.taverna.t2.servicedescriptions.CustomizedConfigurePanelProvider;
-import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionRegistry;
-import net.sf.taverna.t2.servicedescriptions.CustomizedConfigurePanelProvider.CustomizedConfigureCallBack;
-import net.sf.taverna.t2.servicedescriptions.events.ProviderErrorNotification;
-import net.sf.taverna.t2.servicedescriptions.events.ServiceDescriptionProvidedEvent;
-import net.sf.taverna.t2.servicedescriptions.events.ServiceDescriptionRegistryEvent;
-import net.sf.taverna.t2.workbench.helper.HelpEnabledDialog;
-
-import org.apache.log4j.Logger;
-
-import org.apache.taverna.scufl2.api.configurations.Configuration;
-
-/**
- * Action for adding a service provider
- * 
- * @author Stian Soiland-Reyes
- * @author Alan R Williams
- */
-@SuppressWarnings("serial")
-public class AddServiceProviderAction extends AbstractAction {
-	private static Logger logger = getLogger(AddServiceProviderAction.class);
-
-	// protected static Dimension DIALOG_SIZE = new Dimension(400, 300);
-
-	private ServiceDescriptionRegistry serviceDescriptionRegistry;
-
-	private final ConfigurableServiceProvider confProvider;
-	private final Component owner;
-
-	public AddServiceProviderAction(ConfigurableServiceProvider confProvider,
-			Component owner) {
-		super(confProvider.getName() + "...", confProvider.getIcon());
-		this.confProvider = confProvider;
-		this.owner = owner;
-	}
-
-	@Override
-	public void actionPerformed(ActionEvent e) {
-		if (confProvider instanceof CustomizedConfigurePanelProvider) {
-			final CustomizedConfigurePanelProvider provider = (CustomizedConfigurePanelProvider) confProvider;
-			provider.createCustomizedConfigurePanel(new CustomizedConfigureCallBack() {
-				@Override
-				public Configuration getTemplateConfig() {
-					return (Configuration) provider.getConfiguration().clone();
-				}
-
-				@Override
-				public ServiceDescriptionRegistry getServiceDescriptionRegistry() {
-					return AddServiceProviderAction.this.getServiceDescriptionRegistry();
-				}
-
-				@Override
-				public void newProviderConfiguration(Configuration providerConfig) {
-					addNewProvider(providerConfig);
-				}
-			});
-			return;
-		}
-
-		Configuration configuration;
-		try {
-			configuration = (Configuration) confProvider.getConfiguration().clone();
-		} catch (Exception ex) {
-			throw new RuntimeException("Can't clone configuration bean", ex);
-		}
-		JPanel buildEditor = buildEditor(configuration);
-		String title = "Add " + confProvider.getName();
-		JDialog dialog = new HelpEnabledDialog(getMainWindow(), title, true, null);
-		JPanel iconPanel = new JPanel();
-		iconPanel.add(new JLabel(confProvider.getIcon()), NORTH);
-		dialog.add(iconPanel, WEST);
-		dialog.add(buildEditor, CENTER);
-		JPanel buttonPanel = new JPanel(new BorderLayout());
-		final AddProviderAction addProviderAction = new AddProviderAction(configuration,
-				dialog);
-		JButton addProviderButton = new JButton(addProviderAction);
-		buttonPanel.add(addProviderButton, WEST);
-		
-		dialog.add(buttonPanel, SOUTH);
-	    // When user presses "Return" key fire the action on the "Add" button
-		addProviderButton.addKeyListener(new KeyAdapter() {
-			@Override
-			public void keyPressed(KeyEvent evt) {
-				if (evt.getKeyCode() == VK_ENTER)
-					addProviderAction.actionPerformed(null);
-			}
-		});
-		dialog.getRootPane().setDefaultButton(addProviderButton);
-		
-		// dialog.setSize(buttonPanel.getPreferredSize());
-		dialog.pack();
-		dialog.setLocationRelativeTo(owner);
-//		dialog.setLocation(owner.getLocationOnScreen().x + owner.getWidth(),
-//				owner.getLocationOnScreen().y + owner.getHeight());
-		dialog.setVisible(true);
-	}
-
-	protected void addNewProvider(Configuration configurationBean) {
-		ConfigurableServiceProvider cloned = (ConfigurableServiceProvider) confProvider
-				.newInstance();
-		try {
-			cloned.configure(configurationBean);
-			getServiceDescriptionRegistry().addObserver(
-					new CheckAddedCorrectlyObserver(cloned));
-			getServiceDescriptionRegistry().addServiceDescriptionProvider(
-					cloned);
-		} catch (Exception ex) {
-			logger.warn("Can't configure provider " + cloned + " using "
-					+ configurationBean, ex);
-			showMessageDialog(owner, "Can't configure service provider "
-					+ cloned.getName(), "Can't add service provider",
-					ERROR_MESSAGE);
-		}
-	}
-
-	private PropertyDescriptor[] getProperties(Configuration configuration) {
-		// FIXME This is *so* wrong!
-		try {
-			return getPropertyDescriptors(configuration);
-		} catch (Exception ex) {
-			throw new RuntimeException("Can't inspect configuration bean", ex);
-		}
-	}
-
-	// TODO This is probably not right
-	protected JPanel buildEditor(Configuration configuration) {
-		List<String> uiBuilderConfig = new ArrayList<>();
-		int lastPreferred = 0;
-		for (PropertyDescriptor property : getProperties(configuration)) {
-			if (property.isHidden() || property.isExpert())
-				// TODO: Add support for expert properties
-				continue;
-			String propertySpec = property.getName() + ":name="
-					+ property.getDisplayName();
-			if (property.isPreferred())
-				// Add it to the front
-				uiBuilderConfig.add(lastPreferred++, propertySpec);
-			else
-				uiBuilderConfig.add(propertySpec);
-		}
-
-		return UIBuilder.buildEditor(configuration, uiBuilderConfig
-				.toArray(new String[0]));
-	}
-
-	public void setServiceDescriptionRegistry(
-			ServiceDescriptionRegistry serviceDescriptionRegistry) {
-		this.serviceDescriptionRegistry = serviceDescriptionRegistry;
-	}
-
-	public ServiceDescriptionRegistry getServiceDescriptionRegistry() {
-		return serviceDescriptionRegistry;
-	}
-
-	public class AddProviderAction extends AbstractAction {
-		private final Configuration configurationBean;
-		private final JDialog dialog;
-
-		private AddProviderAction(Configuration configurationBean, JDialog dialog) {
-			super("Add");
-			this.configurationBean = configurationBean;
-			this.dialog = dialog;
-		}
-
-		@Override
-		public void actionPerformed(ActionEvent e) {
-			addNewProvider(configurationBean);
-			dialog.setVisible(false);
-		}
-	}
-
-	public class CheckAddedCorrectlyObserver implements
-			Observer<ServiceDescriptionRegistryEvent> {
-		private final ConfigurableServiceProvider provider;
-
-		private CheckAddedCorrectlyObserver(ConfigurableServiceProvider provider) {
-			this.provider = provider;
-		}
-
-		@Override
-		public void notify(Observable<ServiceDescriptionRegistryEvent> sender,
-				ServiceDescriptionRegistryEvent message) throws Exception {
-			if (message instanceof ProviderErrorNotification)
-				notify((ProviderErrorNotification) message);
-			else if (message instanceof ServiceDescriptionProvidedEvent)
-				notify((ServiceDescriptionProvidedEvent) message);
-		}
-
-		private void notify(ServiceDescriptionProvidedEvent providedMsg) {
-			if (providedMsg.getProvider() == provider)
-				getServiceDescriptionRegistry().removeObserver(this);
-		}
-
-		private void notify(ProviderErrorNotification errorMsg) {
-			if (errorMsg.getProvider() != provider)
-				return;
-			getServiceDescriptionRegistry().removeObserver(this);
-			getServiceDescriptionRegistry().removeServiceDescriptionProvider(
-					provider);
-//			showMessageDialog(owner, errorMsg.getMessage(),
-//					"Can't add provider " + provider, ERROR_MESSAGE);
-		}
-	}
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-ui/src/main/java/net/sf/taverna/t2/workbench/ui/servicepanel/actions/ExportServiceDescriptionsAction.java
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-ui/src/main/java/net/sf/taverna/t2/workbench/ui/servicepanel/actions/ExportServiceDescriptionsAction.java b/taverna-activity-palette-ui/src/main/java/net/sf/taverna/t2/workbench/ui/servicepanel/actions/ExportServiceDescriptionsAction.java
deleted file mode 100644
index 990e429..0000000
--- a/taverna-activity-palette-ui/src/main/java/net/sf/taverna/t2/workbench/ui/servicepanel/actions/ExportServiceDescriptionsAction.java
+++ /dev/null
@@ -1,155 +0,0 @@
-/*******************************************************************************
- * 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.servicepanel.actions;
-
-import static javax.swing.JFileChooser.APPROVE_OPTION;
-import static javax.swing.JOptionPane.ERROR_MESSAGE;
-import static javax.swing.JOptionPane.NO_OPTION;
-import static javax.swing.JOptionPane.YES_NO_CANCEL_OPTION;
-import static javax.swing.JOptionPane.YES_OPTION;
-import static javax.swing.JOptionPane.showConfirmDialog;
-import static javax.swing.JOptionPane.showMessageDialog;
-
-import java.awt.event.ActionEvent;
-import java.io.File;
-import java.util.prefs.Preferences;
-
-import javax.swing.AbstractAction;
-import javax.swing.JButton;
-import javax.swing.JComponent;
-import javax.swing.JFileChooser;
-import javax.swing.filechooser.FileFilter;
-
-import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionRegistry;
-
-import org.apache.log4j.Logger;
-
-/**
- * Action to export the current service descritpions from the Service
- * Registry to an xml file.
- *
- * @author Alex Nenadic
- */
-//FIXME this file assumes we're writing out as XML
-@SuppressWarnings("serial")
-public class ExportServiceDescriptionsAction extends AbstractAction {
-	private static final String EXTENSION = ".xml";
-	private static final String EXPORT_SERVICES = "Export services to file";
-	private static final String SERVICE_EXPORT_DIR_PROPERTY = "serviceExportDir";
-	private Logger logger = Logger.getLogger(ExportServiceDescriptionsAction.class);
-	private final ServiceDescriptionRegistry serviceDescriptionRegistry;
-
-	public ExportServiceDescriptionsAction(ServiceDescriptionRegistry serviceDescriptionRegistry) {
-		super(EXPORT_SERVICES);
-		this.serviceDescriptionRegistry = serviceDescriptionRegistry;
-	}
-
-	public static final boolean INHIBIT = true;
-
-	@Override
-	public void actionPerformed(ActionEvent e) {
-		JComponent parentComponent = null;
-		if (e.getSource() instanceof JComponent)
-			parentComponent = (JComponent) e.getSource();
-
-		if (INHIBIT) {
-			showMessageDialog(parentComponent,
-					"Operation not currently working correctly",
-					"Not Implemented", ERROR_MESSAGE);
-			return;
-		}
-
-		JFileChooser fileChooser = new JFileChooser();
-		Preferences prefs = Preferences.userNodeForPackage(getClass());
-		String curDir = prefs.get(SERVICE_EXPORT_DIR_PROPERTY,
-				System.getProperty("user.home"));
-		fileChooser.setDialogTitle("Select file to export services to");
-
-		fileChooser.setFileFilter(new FileFilter() {
-			@Override
-			public boolean accept(File f) {
-				return f.isDirectory()
-						|| f.getName().toLowerCase().endsWith(EXTENSION);
-			}
-
-			@Override
-			public String getDescription() {
-				return ".xml files";
-			}
-		});
-
-		fileChooser.setCurrentDirectory(new File(curDir));
-
-		boolean tryAgain = true;
-		while (tryAgain) {
-			tryAgain = false;
-			int returnVal = fileChooser.showSaveDialog(parentComponent);
-			if (returnVal == APPROVE_OPTION) {
-				prefs.put(SERVICE_EXPORT_DIR_PROPERTY, fileChooser.getCurrentDirectory()
-						.toString());
-				File file = fileChooser.getSelectedFile();
-				if (!file.getName().toLowerCase().endsWith(EXTENSION)) {
-					String newName = file.getName() + EXTENSION;
-					file = new File(file.getParentFile(), newName);
-				}
-
-				try {
-					if (file.exists()) {
-						String msg = "Are you sure you want to overwrite existing file "
-								+ file + "?";
-						int ret = showConfirmDialog(parentComponent, msg,
-								"File already exists", YES_NO_CANCEL_OPTION);
-						if (ret == NO_OPTION) {
-							tryAgain = true;
-							continue;
-						} else if (ret != YES_OPTION) {
-							logger.info("Service descriptions export: aborted overwrite of "
-									+ file.getAbsolutePath());
-							break;
-						}
-					}
-					exportServiceDescriptions(file);
-					break;
-				} catch (Exception ex) {
-					logger.error("Service descriptions export: failed to export services to "
-							+ file.getAbsolutePath(), ex);
-					showMessageDialog(
-							parentComponent,
-							"Failed to export services to "
-									+ file.getAbsolutePath(), "Error",
-							ERROR_MESSAGE);
-					break;
-				}
-			}
-		}
-
-		if (parentComponent instanceof JButton)
-			// lose the focus from the button after performing the action
-			parentComponent.requestFocusInWindow();
-	}
-
-	private void exportServiceDescriptions(File file) {
-		// TODO: Open in separate thread to avoid hanging UI
-		serviceDescriptionRegistry.exportCurrentServiceDescriptions(file);
-		logger.info("Service descriptions export: saved to file "
-				+ file.getAbsolutePath());
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-ui/src/main/java/net/sf/taverna/t2/workbench/ui/servicepanel/actions/ImportServiceDescriptionsFromFileAction.java
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-ui/src/main/java/net/sf/taverna/t2/workbench/ui/servicepanel/actions/ImportServiceDescriptionsFromFileAction.java b/taverna-activity-palette-ui/src/main/java/net/sf/taverna/t2/workbench/ui/servicepanel/actions/ImportServiceDescriptionsFromFileAction.java
deleted file mode 100644
index 1542583..0000000
--- a/taverna-activity-palette-ui/src/main/java/net/sf/taverna/t2/workbench/ui/servicepanel/actions/ImportServiceDescriptionsFromFileAction.java
+++ /dev/null
@@ -1,158 +0,0 @@
-/*******************************************************************************
- * 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.servicepanel.actions;
-
-import static javax.swing.JFileChooser.APPROVE_OPTION;
-import static javax.swing.JOptionPane.CANCEL_OPTION;
-import static javax.swing.JOptionPane.ERROR_MESSAGE;
-import static javax.swing.JOptionPane.QUESTION_MESSAGE;
-import static javax.swing.JOptionPane.YES_NO_CANCEL_OPTION;
-import static javax.swing.JOptionPane.YES_OPTION;
-import static javax.swing.JOptionPane.showMessageDialog;
-import static javax.swing.JOptionPane.showOptionDialog;
-
-import java.awt.event.ActionEvent;
-import java.io.File;
-import java.util.HashSet;
-import java.util.prefs.Preferences;
-
-import javax.swing.AbstractAction;
-import javax.swing.JButton;
-import javax.swing.JComponent;
-import javax.swing.JFileChooser;
-import javax.swing.filechooser.FileFilter;
-
-import org.apache.log4j.Logger;
-
-import net.sf.taverna.t2.servicedescriptions.ConfigurableServiceProvider;
-import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionProvider;
-import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionRegistry;
-
-/**
- * Action to import a list of service descriptions from an xml file
- * into the Service Registry. Users have an option to completely
- * replace the current services or just add the ones from the file
- * to the current services.
- *
- * @author Alex Nenadic
- */
-//FIXME this file assumes we're writing out as XML
-@SuppressWarnings("serial")
-public class ImportServiceDescriptionsFromFileAction extends AbstractAction{
-	private static final String EXTENSION = ".xml";
-	private static final String IMPORT_SERVICES = "Import services from file";
-	private static final String SERVICE_IMPORT_DIR_PROPERTY = "serviceImportDir";
-	private static final Logger logger = Logger.getLogger(ExportServiceDescriptionsAction.class);
-
-	private final ServiceDescriptionRegistry serviceDescriptionRegistry;
-
-	public ImportServiceDescriptionsFromFileAction(
-			ServiceDescriptionRegistry serviceDescriptionRegistry) {
-		super(IMPORT_SERVICES);
-		this.serviceDescriptionRegistry = serviceDescriptionRegistry;
-	}
-
-	private static final Object[] CHOICES = { "Add to current services",
-			"Replace current services", "Cancel" };
-
-	@Override
-	public void actionPerformed(ActionEvent e) {
-		JComponent parentComponent = null;
-		if (e.getSource() instanceof JComponent)
-			parentComponent = (JComponent) e.getSource();
-
-		if (ExportServiceDescriptionsAction.INHIBIT) {
-			showMessageDialog(parentComponent,
-					"Operation not currently working correctly",
-					"Not Implemented", ERROR_MESSAGE);
-			return;
-		}
-
-		int choice = showOptionDialog(
-				parentComponent,
-				"Do you want to add the imported services to the current ones or replace the current ones?",
-				"Import services", YES_NO_CANCEL_OPTION, QUESTION_MESSAGE,
-				null, CHOICES, CHOICES[0]);
-
-		if (choice != CANCEL_OPTION) {
-			JFileChooser fileChooser = new JFileChooser();
-			Preferences prefs = Preferences.userNodeForPackage(getClass());
-			String curDir = prefs.get(SERVICE_IMPORT_DIR_PROPERTY, System.getProperty("user.home"));
-
-			fileChooser.setDialogTitle("Select file to import services from");
-
-			fileChooser.setFileFilter(new FileFilter() {
-				@Override
-				public boolean accept(File f) {
-					return f.isDirectory()
-							|| f.getName().toLowerCase().endsWith(EXTENSION);
-				}
-
-				@Override
-				public String getDescription() {
-					return EXTENSION + " files";
-				}
-			});
-
-			fileChooser.setCurrentDirectory(new File(curDir));
-
-			if (fileChooser.showOpenDialog(parentComponent) == APPROVE_OPTION) {
-				prefs.put(SERVICE_IMPORT_DIR_PROPERTY, fileChooser
-						.getCurrentDirectory().toString());
-				File file = fileChooser.getSelectedFile();
-
-				try {
-					// Did user want to replace or add services?
-					importServices(file, choice == YES_OPTION);
-				} catch (Exception ex) {
-					logger.error(
-							"Service descriptions import: failed to import services from "
-									+ file.getAbsolutePath(), ex);
-					showMessageDialog(parentComponent,
-							"Failed to import services from " + file.getAbsolutePath(), "Error",
-							ERROR_MESSAGE);
-				}
-			}
-		}
-
-		if (parentComponent instanceof JButton)
-			// lose the focus from the button after performing the action
-			parentComponent.requestFocusInWindow();
-	}
-
-	private void importServices(final File file, final boolean addToCurrent)
-			throws Exception {
-		// TODO: Open in separate thread to avoid hanging UI
-
-		if (!addToCurrent)
-			for (ServiceDescriptionProvider provider : new HashSet<>(
-					serviceDescriptionRegistry.getServiceDescriptionProviders()))
-				// remove all configurable service providers
-				if (provider instanceof ConfigurableServiceProvider)
-					serviceDescriptionRegistry
-							.removeServiceDescriptionProvider(provider);
-
-		// import all providers from the file
-		serviceDescriptionRegistry.loadServiceProviders(file);
-		serviceDescriptionRegistry.saveServiceDescriptions();
-	}
-}
-

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-ui/src/main/java/net/sf/taverna/t2/workbench/ui/servicepanel/actions/ImportServiceDescriptionsFromURLAction.java
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-ui/src/main/java/net/sf/taverna/t2/workbench/ui/servicepanel/actions/ImportServiceDescriptionsFromURLAction.java b/taverna-activity-palette-ui/src/main/java/net/sf/taverna/t2/workbench/ui/servicepanel/actions/ImportServiceDescriptionsFromURLAction.java
deleted file mode 100644
index 0dbbe25..0000000
--- a/taverna-activity-palette-ui/src/main/java/net/sf/taverna/t2/workbench/ui/servicepanel/actions/ImportServiceDescriptionsFromURLAction.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*******************************************************************************
- * 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.servicepanel.actions;
-
-import static javax.swing.JOptionPane.CANCEL_OPTION;
-import static javax.swing.JOptionPane.ERROR_MESSAGE;
-import static javax.swing.JOptionPane.QUESTION_MESSAGE;
-import static javax.swing.JOptionPane.YES_NO_CANCEL_OPTION;
-import static javax.swing.JOptionPane.YES_OPTION;
-import static javax.swing.JOptionPane.showInputDialog;
-import static javax.swing.JOptionPane.showMessageDialog;
-import static javax.swing.JOptionPane.showOptionDialog;
-
-import java.awt.event.ActionEvent;
-import java.net.URL;
-import java.util.HashSet;
-
-import javax.swing.AbstractAction;
-import javax.swing.JButton;
-import javax.swing.JComponent;
-
-import net.sf.taverna.t2.servicedescriptions.ConfigurableServiceProvider;
-import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionProvider;
-import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionRegistry;
-
-import org.apache.log4j.Logger;
-
-/**
- * Action to import a list of service descriptions from an URL pointing
- * to an xml file into the Service Registry. Users have an option to
- * completely replace the current services or just add the ones from the
- * file to the current services.
- *
- * @author Alex Nenadic
- */
-@SuppressWarnings("serial")
-public class ImportServiceDescriptionsFromURLAction extends AbstractAction{
-	private static final String IMPORT_SERVICES_FROM_URL = "Import services from URL";
-	private static final Logger logger = Logger.getLogger(ExportServiceDescriptionsAction.class);
-
-	private final ServiceDescriptionRegistry serviceDescriptionRegistry;
-
-	public ImportServiceDescriptionsFromURLAction(ServiceDescriptionRegistry serviceDescriptionRegistry) {
-		super(IMPORT_SERVICES_FROM_URL);
-		this.serviceDescriptionRegistry = serviceDescriptionRegistry;
-	}
-
-	private static final Object[] CHOICES = { "Add to current services",
-			"Replace current services", "Cancel" };
-
-	@Override
-	public void actionPerformed(ActionEvent e) {
-		JComponent parentComponent = null;
-		if (e.getSource() instanceof JComponent)
-			parentComponent = (JComponent) e.getSource();
-
-		if (ExportServiceDescriptionsAction.INHIBIT) {
-			showMessageDialog(parentComponent,
-					"Operation not currently working correctly",
-					"Not Implemented", ERROR_MESSAGE);
-			return;
-		}
-
-		int choice = showOptionDialog(
-				parentComponent,
-				"Do you want to add the imported services to the current ones or replace the current ones?",
-				"Import services", YES_NO_CANCEL_OPTION, QUESTION_MESSAGE,
-				null, CHOICES, CHOICES[0]);
-
-		if (choice != CANCEL_OPTION) {
-			final String urlString = (String) showInputDialog(parentComponent,
-					"Enter the URL of the service descriptions file to import",
-					"Service Descriptions URL", QUESTION_MESSAGE, null, null,
-					"http://");
-			try {
-				if (urlString != null && !urlString.isEmpty())
-					// Did user want to replace or add services?
-					importServices(urlString, choice == YES_OPTION);
-			} catch (Exception ex) {
-				logger.error(
-						"Service descriptions import: failed to import services from "
-								+ urlString, ex);
-				showMessageDialog(parentComponent,
-						"Failed to import services from " + urlString, "Error",
-						ERROR_MESSAGE);
-			}
-		}
-
-		if (parentComponent instanceof JButton)
-			// lose the focus from the button after performing the action
-			parentComponent.requestFocusInWindow();
-	}
-
-	private void importServices(final String urlString, final boolean addToCurrent)
-			throws Exception {
-		// TODO: Open in separate thread to avoid hanging UI
-		URL url = new URL(urlString);
-
-		if (!addToCurrent)
-			for (ServiceDescriptionProvider provider : new HashSet<>(
-					serviceDescriptionRegistry.getServiceDescriptionProviders()))
-				// remove all configurable service providers
-				if (provider instanceof ConfigurableServiceProvider)
-					serviceDescriptionRegistry
-							.removeServiceDescriptionProvider(provider);
-
-		// import all providers from the URL
-		serviceDescriptionRegistry.loadServiceProviders(url);
-		serviceDescriptionRegistry.saveServiceDescriptions();
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-ui/src/main/java/net/sf/taverna/t2/workbench/ui/servicepanel/actions/RefreshProviderRegistryAction.java
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-ui/src/main/java/net/sf/taverna/t2/workbench/ui/servicepanel/actions/RefreshProviderRegistryAction.java b/taverna-activity-palette-ui/src/main/java/net/sf/taverna/t2/workbench/ui/servicepanel/actions/RefreshProviderRegistryAction.java
deleted file mode 100644
index 9c4c84b..0000000
--- a/taverna-activity-palette-ui/src/main/java/net/sf/taverna/t2/workbench/ui/servicepanel/actions/RefreshProviderRegistryAction.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*******************************************************************************
- * 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.servicepanel.actions;
-
-import java.awt.event.ActionEvent;
-
-import javax.swing.AbstractAction;
-
-import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionRegistry;
-
-/**
- * Action for refreshing the service provider registry.
- * <p>
- * This would typically re-parse WSDLs, etc.
- * 
- * @see ServiceDescriptionRegistry#refresh()
- * @author Stian Soiland-Reyes
- */
-@SuppressWarnings("serial")
-public class RefreshProviderRegistryAction extends AbstractAction {
-	private static final String REFRESH = "Reload services";
-	private final ServiceDescriptionRegistry serviceDescriptionRegistry;
-
-	public RefreshProviderRegistryAction(
-			ServiceDescriptionRegistry serviceDescriptionRegistry) {
-		super(REFRESH);
-		this.serviceDescriptionRegistry = serviceDescriptionRegistry;
-	}
-
-	@Override
-	public void actionPerformed(ActionEvent e) {
-		serviceDescriptionRegistry.refresh();
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-ui/src/main/java/net/sf/taverna/t2/workbench/ui/servicepanel/actions/RemoveDefaultServicesAction.java
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-ui/src/main/java/net/sf/taverna/t2/workbench/ui/servicepanel/actions/RemoveDefaultServicesAction.java b/taverna-activity-palette-ui/src/main/java/net/sf/taverna/t2/workbench/ui/servicepanel/actions/RemoveDefaultServicesAction.java
deleted file mode 100644
index b6ba606..0000000
--- a/taverna-activity-palette-ui/src/main/java/net/sf/taverna/t2/workbench/ui/servicepanel/actions/RemoveDefaultServicesAction.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * 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.servicepanel.actions;
-
-import java.awt.event.ActionEvent;
-
-import javax.swing.AbstractAction;
-
-import net.sf.taverna.t2.servicedescriptions.ConfigurableServiceProvider;
-import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionProvider;
-import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionRegistry;
-
-@SuppressWarnings("serial")
-public class RemoveDefaultServicesAction extends AbstractAction {
-	private final ServiceDescriptionRegistry serviceDescriptionRegistry;
-
-	public RemoveDefaultServicesAction(
-			ServiceDescriptionRegistry serviceDescriptionRegistry) {
-		super("Remove default service providers");
-		this.serviceDescriptionRegistry = serviceDescriptionRegistry;
-	}
-
-	@Override
-	public void actionPerformed(ActionEvent e) {
-		for (ServiceDescriptionProvider provider : serviceDescriptionRegistry
-				.getDefaultServiceDescriptionProviders()) {
-			if (!(provider instanceof ConfigurableServiceProvider))
-				continue;
-			serviceDescriptionRegistry
-					.removeServiceDescriptionProvider(provider);
-		}
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-ui/src/main/java/net/sf/taverna/t2/workbench/ui/servicepanel/actions/RemoveUserServicesAction.java
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-ui/src/main/java/net/sf/taverna/t2/workbench/ui/servicepanel/actions/RemoveUserServicesAction.java b/taverna-activity-palette-ui/src/main/java/net/sf/taverna/t2/workbench/ui/servicepanel/actions/RemoveUserServicesAction.java
deleted file mode 100644
index bf0a771..0000000
--- a/taverna-activity-palette-ui/src/main/java/net/sf/taverna/t2/workbench/ui/servicepanel/actions/RemoveUserServicesAction.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*******************************************************************************
- * 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.servicepanel.actions;
-
-import static javax.swing.JOptionPane.YES_NO_OPTION;
-import static javax.swing.JOptionPane.YES_OPTION;
-import static javax.swing.JOptionPane.showConfirmDialog;
-
-import java.awt.event.ActionEvent;
-
-import javax.swing.AbstractAction;
-import javax.swing.JLabel;
-
-import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionProvider;
-import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionRegistry;
-
-@SuppressWarnings("serial")
-public class RemoveUserServicesAction extends AbstractAction {
-	private static final String CONFIRM_MESSAGE = "You are about to remove all services you have added. <br>"
-			+ "Are you <b>really</b> sure you want to do this?";
-	private final ServiceDescriptionRegistry serviceDescriptionRegistry;
-
-	public RemoveUserServicesAction(
-			ServiceDescriptionRegistry serviceDescriptionRegistry) {
-		super("Remove all user added service providers");
-		this.serviceDescriptionRegistry = serviceDescriptionRegistry;
-	}
-
-	@Override
-	public void actionPerformed(ActionEvent e) {
-		int option = showConfirmDialog(null, new JLabel("<html><body>"
-				+ CONFIRM_MESSAGE + "</body></html>"),
-				"Confirm service deletion", YES_NO_OPTION);
-
-		if (option == YES_OPTION)
-			for (ServiceDescriptionProvider provider : serviceDescriptionRegistry
-					.getUserAddedServiceProviders())
-				serviceDescriptionRegistry
-						.removeServiceDescriptionProvider(provider);
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-ui/src/main/java/net/sf/taverna/t2/workbench/ui/servicepanel/actions/RestoreDefaultServicesAction.java
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-ui/src/main/java/net/sf/taverna/t2/workbench/ui/servicepanel/actions/RestoreDefaultServicesAction.java b/taverna-activity-palette-ui/src/main/java/net/sf/taverna/t2/workbench/ui/servicepanel/actions/RestoreDefaultServicesAction.java
deleted file mode 100644
index c7071ed..0000000
--- a/taverna-activity-palette-ui/src/main/java/net/sf/taverna/t2/workbench/ui/servicepanel/actions/RestoreDefaultServicesAction.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*******************************************************************************
- * 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.servicepanel.actions;
-
-import java.awt.event.ActionEvent;
-
-import javax.swing.AbstractAction;
-
-import net.sf.taverna.t2.servicedescriptions.ConfigurableServiceProvider;
-import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionProvider;
-import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionRegistry;
-
-@SuppressWarnings("serial")
-public class RestoreDefaultServicesAction extends AbstractAction {
-	private final ServiceDescriptionRegistry serviceDescriptionRegistry;
-
-	public RestoreDefaultServicesAction(
-			ServiceDescriptionRegistry serviceDescriptionRegistry) {
-		super("Restore default service providers");
-		this.serviceDescriptionRegistry = serviceDescriptionRegistry;
-	}
-
-	@Override
-	public void actionPerformed(ActionEvent e) {
-		for (ServiceDescriptionProvider provider : serviceDescriptionRegistry
-				.getDefaultServiceDescriptionProviders()) {
-			if (!(provider instanceof ConfigurableServiceProvider))
-				continue;
-			serviceDescriptionRegistry.addServiceDescriptionProvider(provider);
-		}
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-ui/src/main/java/net/sf/taverna/t2/workbench/ui/servicepanel/config/ServiceDescriptionConfigPanel.java
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-ui/src/main/java/net/sf/taverna/t2/workbench/ui/servicepanel/config/ServiceDescriptionConfigPanel.java b/taverna-activity-palette-ui/src/main/java/net/sf/taverna/t2/workbench/ui/servicepanel/config/ServiceDescriptionConfigPanel.java
deleted file mode 100644
index f666877..0000000
--- a/taverna-activity-palette-ui/src/main/java/net/sf/taverna/t2/workbench/ui/servicepanel/config/ServiceDescriptionConfigPanel.java
+++ /dev/null
@@ -1,181 +0,0 @@
-/*******************************************************************************
- * 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.servicepanel.config;
-
-import static java.awt.GridBagConstraints.HORIZONTAL;
-import static java.awt.GridBagConstraints.NONE;
-import static java.awt.GridBagConstraints.WEST;
-
-import java.awt.GridBagConstraints;
-import java.awt.GridBagLayout;
-import java.awt.Insets;
-import java.awt.event.ActionEvent;
-
-import javax.swing.AbstractAction;
-import javax.swing.JButton;
-import javax.swing.JCheckBox;
-import javax.swing.JPanel;
-import javax.swing.JTextArea;
-import javax.swing.border.EmptyBorder;
-
-import net.sf.taverna.t2.servicedescriptions.ConfigurableServiceProvider;
-import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionProvider;
-import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionRegistry;
-import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionsConfiguration;
-import net.sf.taverna.t2.workbench.helper.Helper;
-
-@SuppressWarnings("serial")
-public class ServiceDescriptionConfigPanel extends JPanel {
-	private static final String REMOVE_PERMANENTLY = "Allow permanent removal of default service providers";
-	private static final String INCLUDE_DEFAULTS = "Include default service providers";
-
-	private final ServiceDescriptionsConfiguration config;
-	private JCheckBox includeDefaults;
-	private JCheckBox removePermanently;
-	private final ServiceDescriptionRegistry serviceDescRegistry;
-
-	public ServiceDescriptionConfigPanel(ServiceDescriptionsConfiguration config,
-			ServiceDescriptionRegistry serviceDescRegistry) {
-		super(new GridBagLayout());
-		this.config = config;
-		this.serviceDescRegistry = serviceDescRegistry;
-		initialize();
-	}
-
-	private void initialize() {
-		removeAll();
-
-		GridBagConstraints gbc = new GridBagConstraints();
-
-		// Title describing what kind of settings we are configuring here
-		JTextArea descriptionText = new JTextArea(
-				"Configure behaviour of default service providers in Service Panel");
-        descriptionText.setLineWrap(true);
-        descriptionText.setWrapStyleWord(true);
-        descriptionText.setEditable(false);
-        descriptionText.setFocusable(false);
-        descriptionText.setBorder(new EmptyBorder(10, 10, 10, 10));
-		gbc.gridx = 0;
-		gbc.gridy = 0;
-		gbc.anchor = WEST;
-		gbc.fill = HORIZONTAL;
-		add(descriptionText, gbc);
-
-		includeDefaults = new JCheckBox(INCLUDE_DEFAULTS);
-		gbc.gridx = 0;
-		gbc.gridy = 1;
-		gbc.anchor = WEST;
-		gbc.fill = NONE;
-        gbc.insets = new Insets(10, 0, 0, 0);
-		add(includeDefaults, gbc);
-
-		removePermanently = new JCheckBox(REMOVE_PERMANENTLY);
-		gbc.gridx = 0;
-		gbc.gridy = 2;
-        gbc.insets = new Insets(0, 0, 0, 0);
-		add(removePermanently, gbc);
-
-		// Filler
-		gbc.gridx = 0;
-		gbc.gridy = 3;
-		gbc.weighty = 1;
-		gbc.weightx = 1;
-		gbc.fill = GridBagConstraints.BOTH;
-        gbc.insets = new Insets(10, 0, 0, 0);
-		add(createButtonPanel(), gbc);
-
-		setFields(config);
-	}
-
-	/**
-	 * Create the panel to contain the buttons
-	 *
-	 * @return
-	 */
-	private JPanel createButtonPanel() {
-		final JPanel panel = new JPanel();
-
-		/**
-		 * The helpButton shows help about the current component
-		 */
-		JButton helpButton = new JButton(new AbstractAction("Help") {
-			@Override
-			public void actionPerformed(ActionEvent arg0) {
-				Helper.showHelp(panel);
-			}
-		});
-		panel.add(helpButton);
-
-		/**
-		 * The resetButton changes the property values shown to those
-		 * corresponding to the configuration currently applied.
-		 */
-		JButton resetButton = new JButton(new AbstractAction("Reset") {
-			@Override
-			public void actionPerformed(ActionEvent arg0) {
-				setFields(config);
-			}
-		});
-		panel.add(resetButton);
-
-		/**
-		 * The applyButton applies the shown field values to the
-		 * {@link HttpProxyConfiguration} and saves them for future.
-		 */
-		JButton applyButton = new JButton(new AbstractAction("Apply") {
-			@Override
-			public void actionPerformed(ActionEvent arg0) {
-				applySettings();
-				setFields(config);
-			}
-		});
-		panel.add(applyButton);
-
-		return panel;
-	}
-
-	protected void applySettings() {
-		// Include default service providers
-		config.setIncludeDefaults(includeDefaults.isSelected());
-		for (ServiceDescriptionProvider provider : serviceDescRegistry
-				.getDefaultServiceDescriptionProviders()) {
-			if (! (provider instanceof ConfigurableServiceProvider))
-				continue;
-			if (config.isIncludeDefaults())
-				serviceDescRegistry.addServiceDescriptionProvider(provider);
-			else
-				serviceDescRegistry.removeServiceDescriptionProvider(provider);
-		}
-
-		// Allow permanent removal of default service providers
-		config.setRemovePermanently(removePermanently.isSelected());
-	}
-
-	/**
-	 * Set the shown configuration field values to those currently in use
-	 * (i.e. last saved configuration).
-	 *
-	 */
-	private void setFields(ServiceDescriptionsConfiguration configurable) {
-		includeDefaults.setSelected(configurable.isIncludeDefaults());
-		removePermanently.setSelected(configurable.isRemovePermanently());
-	}
-}


[08/51] [partial] incubator-taverna-workbench git commit: all packages are moved to org.apache.taverna.*

Posted by re...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-iteration-strategy-ui/src/main/java/org/apache/taverna/workbench/iterationstrategy/editor/IterationStrategyEditorControl.java
----------------------------------------------------------------------
diff --git a/taverna-iteration-strategy-ui/src/main/java/org/apache/taverna/workbench/iterationstrategy/editor/IterationStrategyEditorControl.java b/taverna-iteration-strategy-ui/src/main/java/org/apache/taverna/workbench/iterationstrategy/editor/IterationStrategyEditorControl.java
new file mode 100644
index 0000000..df5e078
--- /dev/null
+++ b/taverna-iteration-strategy-ui/src/main/java/org/apache/taverna/workbench/iterationstrategy/editor/IterationStrategyEditorControl.java
@@ -0,0 +1,439 @@
+/*******************************************************************************
+ * 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
+ ******************************************************************************/
+/**
+ * This file is a component of the Taverna project,
+ * and is licensed under the GNU LGPL.
+ * Copyright Tom Oinn, EMBL-EBI
+ */
+package org.apache.taverna.workbench.iterationstrategy.editor;
+
+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 javax.swing.Action;
+import javax.swing.BoxLayout;
+import javax.swing.ImageIcon;
+import javax.swing.JButton;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JToolBar;
+import javax.swing.SwingConstants;
+import javax.swing.event.TreeSelectionEvent;
+import javax.swing.event.TreeSelectionListener;
+import javax.swing.tree.DefaultTreeModel;
+import javax.swing.tree.TreeNode;
+import javax.swing.tree.TreePath;
+
+import org.apache.taverna.workbench.icons.WorkbenchIcons;
+import org.apache.taverna.workbench.iterationstrategy.IterationStrategyIcons;
+import org.apache.taverna.workflowmodel.processor.iteration.CrossProduct;
+import org.apache.taverna.workflowmodel.processor.iteration.DotProduct;
+import org.apache.taverna.workflowmodel.processor.iteration.IterationStrategy;
+import org.apache.taverna.workflowmodel.processor.iteration.IterationStrategyNode;
+import org.apache.taverna.workflowmodel.processor.iteration.TerminalNode;
+
+import org.apache.log4j.Logger;
+
+/**
+ * A control panel for the iteration tree editor allowing the user to manipulate
+ * the tree, removing and adding nodes into the tree based on the context.
+ * 
+ * @author Tom Oinn
+ * @author Stian Soiland-Reyes
+ * 
+ */
+@SuppressWarnings("serial")
+public class IterationStrategyEditorControl extends JPanel {
+
+	protected static Set<IterationStrategyNode> descendentsOfNode(
+			IterationStrategyNode node) {
+		Set<IterationStrategyNode> descendants = new HashSet<IterationStrategyNode>();
+		Set<IterationStrategyNode> nodesToVisit = new HashSet<IterationStrategyNode>();
+		Set<IterationStrategyNode> visitedNodes = new HashSet<IterationStrategyNode>();
+
+		// Note: Not added to descendants
+		nodesToVisit.add(node);
+		while (!nodesToVisit.isEmpty()) {
+			// pick the first one
+			IterationStrategyNode visiting = nodesToVisit.iterator().next();
+			visitedNodes.add(visiting);
+			nodesToVisit.remove(visiting);
+
+			// Find new and interesting children
+			List<IterationStrategyNode> children = visiting.getChildren();
+			Set<IterationStrategyNode> newNodes = new HashSet<IterationStrategyNode>(
+					children);
+			newNodes.removeAll(visitedNodes);
+
+			descendants.addAll(newNodes);
+			nodesToVisit.addAll(newNodes);
+		}
+		return descendants;
+	}
+
+	private static Logger logger = Logger
+			.getLogger(IterationStrategyEditorControl.class);
+
+	private IterationStrategyNode selectedNode = null;
+
+	private IterationStrategyTree tree;
+
+	protected AddCrossAction addCross = new AddCrossAction();
+	protected AddDotAction addDot = new AddDotAction();
+	protected ChangeAction change = new ChangeAction();
+	protected NormalizeAction normalize = new NormalizeAction();
+	protected RemoveAction remove = new RemoveAction();
+	protected MoveUpAction moveUp = new MoveUpAction();
+
+	//private static final int ICON_SIZE = 15;
+
+	protected ImageIcon arrowUpIcon = WorkbenchIcons.upArrowIcon;
+	protected ImageIcon arrowDownIcon = WorkbenchIcons.downArrowIcon;
+	//protected ImageIcon arrowLeft = WorkbenchIcons.leftArrowIcon;
+	//protected ImageIcon arrowRight = WorkbenchIcons.rightArrowIcon;
+	protected ImageIcon normalizeIcon = WorkbenchIcons.normalizeIcon;
+
+	private final IterationStrategy strategy;
+
+	/**
+	 * Create a new panel from the supplied iteration strategy
+	 */
+	public IterationStrategyEditorControl(IterationStrategy strategy) {
+
+		this.strategy = strategy;
+		setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS));
+
+		// Create the components
+		tree = new IterationStrategyEditor(strategy);
+
+		JButton addCrossButton = new JButton(addCross);
+		addCrossButton.setHorizontalAlignment(SwingConstants.LEFT);
+		JButton addDotButton = new JButton(addDot);
+		addDotButton.setHorizontalAlignment(SwingConstants.LEFT);
+		JButton normalizeButton = new JButton(normalize);
+		normalizeButton.setHorizontalAlignment(SwingConstants.LEFT);
+		normalizeButton.setIcon(normalizeIcon);
+		JButton removeButton = new JButton(remove);
+		removeButton.setHorizontalAlignment(SwingConstants.LEFT);
+		JButton changeButton = new JButton(change);
+		changeButton.setHorizontalAlignment(SwingConstants.LEFT);
+
+		JButton moveUpButton = new JButton(moveUp);
+		moveUpButton.setIcon(arrowUpIcon);
+		moveUpButton.setHorizontalAlignment(SwingConstants.LEFT);
+
+		// Set the default enabled state to off on all buttons other than the
+		// normalizeButton
+		// one.
+		disableButtons();
+
+		// Create a layout with the tree on the right and the buttons in a grid
+		// layout on the left
+		JToolBar toolbar = new JToolBar();
+		toolbar.setFloatable(false);
+		toolbar.setRollover(true);
+		// toolbar.setLayout(new GridLayout(2,2));
+		toolbar.add(normalizeButton);
+		toolbar.add(addCrossButton);
+		toolbar.add(addDotButton);
+		toolbar.add(removeButton);
+		toolbar.add(changeButton);
+		toolbar.add(moveUpButton);
+
+		toolbar.setAlignmentX(LEFT_ALIGNMENT);
+
+		// Listen to tree selection events and enable buttons appropriately
+		tree.addTreeSelectionListener(new ButtonEnabler());
+
+		// Add components to the control panel
+		add(toolbar);
+		JScrollPane treePane = new JScrollPane(tree);
+		//treePane.setPreferredSize(new Dimension(0, 0));
+		add(treePane);
+	}
+
+	public void setIterationStrategy(IterationStrategy iterationStrategy) {
+		tree.setIterationStrategy(iterationStrategy);
+		disableButtons();
+		selectNode(null);
+	}
+
+	private void disableButtons() {
+		remove.setEnabled(false);
+		addCross.setEnabled(false);
+		addDot.setEnabled(false);
+		change.setEnabled(false);
+	}
+
+	private IterationStrategyNode findRoot() {
+		IterationStrategyNode root = (IterationStrategyNode) tree.getModel()
+				.getRoot();
+		if (root.getChildCount() > 0) {
+			return root.getChildAt(0);
+		}
+		return root;
+	}
+
+	protected void selectNode(TreeNode newNode) {
+		DefaultTreeModel model = tree.getModel();
+		if (newNode == null) {
+			newNode = (TreeNode) model.getRoot();
+		}
+		TreeNode[] pathToRoot = model.getPathToRoot(newNode);
+		tree.setSelectionPath(new TreePath(pathToRoot));
+	}
+
+	/**
+	 * Add a cross product node as a child of the selected node
+	 */
+	protected class AddCrossAction extends AbstractAction {
+
+		public AddCrossAction() {
+			super("Add Cross", IterationStrategyIcons.joinIteratorIcon);
+		}
+
+		public void actionPerformed(ActionEvent e) {
+			CrossProduct newNode = new CrossProduct();
+			newNode.setParent(selectedNode);
+			tree.refreshModel();
+		}
+	}
+
+	/**
+	 * Add a dot product node as a child of the selected node
+	 * 
+	 * @author Stian Soiland-Reyes
+	 * 
+	 */
+	protected class AddDotAction extends AbstractAction {
+
+		public AddDotAction() {
+			super("Add Dot", IterationStrategyIcons.lockStepIteratorIcon);
+		}
+
+		public void actionPerformed(ActionEvent e) {
+			DotProduct newNode = new DotProduct();
+			newNode.setParent(selectedNode);
+			tree.refreshModel();
+		}
+	}
+
+	protected class ButtonEnabler implements TreeSelectionListener {
+		public void valueChanged(TreeSelectionEvent e) {
+			TreePath selectedPath = e.getPath();
+			IterationStrategyNode selectedObject = (IterationStrategyNode) selectedPath
+					.getLastPathComponent();
+			selectedNode = selectedObject;
+			if (selectedObject instanceof CrossProduct
+					|| selectedObject instanceof DotProduct) {
+				if ((selectedObject.getParent() == null) || (selectedObject.getParent() instanceof TerminalNode)) {
+					remove.setEnabled(false);
+				} else {
+					remove.setEnabled(true);
+				}
+				if (selectedObject instanceof CrossProduct) {
+					change.putValue(Action.NAME, "Change to Dot Product");
+					change.putValue(Action.SMALL_ICON,
+							IterationStrategyIcons.lockStepIteratorIcon);
+				} else {
+					change.putValue(Action.NAME, "Change to Cross Product");
+					change.putValue(Action.SMALL_ICON,
+							IterationStrategyIcons.joinIteratorIcon);
+				}
+				addCross.setEnabled(true);
+				addDot.setEnabled(true);
+				change.setEnabled(true);
+			} else {
+				// Top- or leaf node
+				remove.setEnabled(false);
+				addCross.setEnabled(false);
+				addDot.setEnabled(false);
+				change.setEnabled(false);
+			}
+		}
+	}
+
+	/**
+	 * Add a cross product node as a child of the selected node
+	 */
+	protected class ChangeAction extends AbstractAction {
+
+		public ChangeAction() {
+			super("Switch to...", IterationStrategyIcons.joinIteratorIcon);
+		}
+
+		public void actionPerformed(ActionEvent e) {
+			IterationStrategyNode newNode;
+			if (selectedNode instanceof CrossProduct) {
+				newNode = new DotProduct();
+			} else {
+				newNode = new CrossProduct();
+			}
+
+			List<IterationStrategyNode> children = new ArrayList<IterationStrategyNode>(
+					selectedNode.getChildren());
+			for (IterationStrategyNode child : children) {
+				child.setParent(newNode);
+			}
+
+			DefaultTreeModel model = tree.getModel();
+			if (selectedNode.getParent() == null) {
+				model.setRoot(newNode);
+				tree.refreshModel();
+				newNode.setParent(null);
+			} else {
+				IterationStrategyNode parent = selectedNode.getParent();
+				int index = parent.getIndex(selectedNode);
+				selectedNode.setParent(null);
+				parent.insert(newNode, index);
+				tree.refreshModel();
+			}
+
+			selectNode(newNode);
+		}
+
+	}
+
+	/**
+	 * Normalize the tree when the button is pressed
+	 * 
+	 */
+	protected class NormalizeAction extends AbstractAction {
+		public NormalizeAction() {
+			super("Normalize", normalizeIcon);
+		}
+
+		public void actionPerformed(ActionEvent e) {
+			strategy.normalize();
+			// Expand all the nodes in the tree
+			//DefaultTreeModel model = tree.getModel();
+			tree.refreshModel();
+		}
+	}
+
+	/**
+	 * Remove the selected node, moving any descendant leaf nodes to the parent
+	 * to prevent them getting lost
+	 */
+	protected class RemoveAction extends AbstractAction {
+		public RemoveAction() {
+			super("Remove node", WorkbenchIcons.deleteIcon);
+		}
+
+		public void actionPerformed(ActionEvent e) {
+			IterationStrategyNode nodeToBeRemoved = selectedNode;
+
+			//DefaultTreeModel model = tree.getModel();
+
+			// Now removeButton the candidate nodes from their parents and
+			// put them back into the root node
+			IterationStrategyNode root = findRoot();
+			if (root == selectedNode) {
+				return;
+			}
+			IterationStrategyNode oldParent = nodeToBeRemoved.getParent();
+
+			for (IterationStrategyNode nodeToMove : descendentsOfNode(nodeToBeRemoved)) {
+				nodeToMove.setParent(oldParent);
+			}
+			nodeToBeRemoved.setParent(null);
+			tree.refreshModel();
+			// Disable the various buttons, as the current selection
+			// is now invalid.
+			remove.setEnabled(false);
+			addCross.setEnabled(false);
+			addDot.setEnabled(false);
+			change.setEnabled(false);
+			selectNode(oldParent);
+		}
+	}
+
+	protected class MoveUpAction extends AbstractAction {
+
+		public MoveUpAction() {
+			super("Move up", arrowUpIcon);
+		}
+
+		public void actionPerformed(ActionEvent e) {
+			//DefaultTreeModel model = tree.getModel();
+
+			IterationStrategyNode aboveNode = aboveSelectedNode();
+			if ((aboveNode == null) || ((aboveNode instanceof TerminalNode) && (aboveNode.getChildCount() > 0))) {
+				logger.warn("Can't move above top");
+				return;
+			}
+			IterationStrategyNode selectedParent = selectedNode.getParent();
+			IterationStrategyNode aboveParent = aboveNode.getParent();
+			if (selectedParent != null && selectedParent.equals(aboveParent)) {
+				// Siblings
+				int aboveChildIndex = selectedParent.getIndex(aboveNode);
+				selectedParent.insert(selectedNode, aboveChildIndex);
+				tree.refreshModel();
+				selectNode(selectedNode);
+			} else if (aboveNode.equals(selectedParent)) {
+				if (aboveParent instanceof TerminalNode
+						&& selectedNode.getAllowsChildren()) {
+					aboveNode.setParent(selectedNode);
+					selectedNode.setParent(aboveParent);
+					tree.refreshModel();
+					selectNode(selectedNode);
+				} else if (!(aboveParent instanceof TerminalNode)){
+					int aboveChildIndex = aboveParent.getIndex(aboveNode);
+					aboveParent.insert(selectedNode, aboveChildIndex);
+					tree.refreshModel();
+					selectNode(selectedNode);
+				}
+			} else {
+
+			}
+
+		}
+
+	}
+
+	protected IterationStrategyNode belowSelectedNode() {
+		return offsetFromSelectedNode(1);
+	}
+
+	protected IterationStrategyNode offsetFromSelectedNode(int offset) {
+		int currentRow = tree.getRowForPath(tree.getSelectionPath());
+		int offsetRow = currentRow + offset;
+		TreePath offsetPath = tree.getPathForRow(offsetRow);
+		if (offsetPath == null) {
+			return null;
+		}
+		IterationStrategyNode offsetNode = (IterationStrategyNode) offsetPath
+				.getLastPathComponent();
+		if (offsetNode == tree.getModel().getRoot()) {
+			return null;
+		}
+		return offsetNode;
+	}
+
+	protected IterationStrategyNode aboveSelectedNode() {
+		return offsetFromSelectedNode(-1);
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-iteration-strategy-ui/src/main/java/org/apache/taverna/workbench/iterationstrategy/editor/IterationStrategyTree.java
----------------------------------------------------------------------
diff --git a/taverna-iteration-strategy-ui/src/main/java/org/apache/taverna/workbench/iterationstrategy/editor/IterationStrategyTree.java b/taverna-iteration-strategy-ui/src/main/java/org/apache/taverna/workbench/iterationstrategy/editor/IterationStrategyTree.java
new file mode 100644
index 0000000..c5e9390
--- /dev/null
+++ b/taverna-iteration-strategy-ui/src/main/java/org/apache/taverna/workbench/iterationstrategy/editor/IterationStrategyTree.java
@@ -0,0 +1,106 @@
+/*******************************************************************************
+ * 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 org.apache.taverna.workbench.iterationstrategy.editor;
+
+import java.util.Enumeration;
+
+import javax.swing.ImageIcon;
+import javax.swing.JTree;
+import javax.swing.tree.DefaultMutableTreeNode;
+import javax.swing.tree.DefaultTreeModel;
+import javax.swing.tree.TreeModel;
+import javax.swing.tree.TreeNode;
+import javax.swing.tree.TreePath;
+import javax.swing.tree.TreeSelectionModel;
+
+import org.apache.taverna.workbench.iterationstrategy.IterationStrategyIcons;
+import org.apache.taverna.workbench.ui.zaria.UIComponentSPI;
+import org.apache.taverna.workflowmodel.processor.iteration.IterationStrategy;
+
+@SuppressWarnings("serial")
+public class IterationStrategyTree extends JTree implements UIComponentSPI {
+
+	private IterationStrategy strategy = null;
+
+	public IterationStrategyTree() {
+		super();
+		setCellRenderer(new IterationStrategyCellRenderer());
+	}
+
+	public ImageIcon getIcon() {
+		return IterationStrategyIcons.leafnodeicon;
+	}
+
+	public void onDisplay() {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void onDispose() {
+		this.strategy = null;
+		setModel(null);
+	}
+
+	public synchronized void setIterationStrategy(
+			IterationStrategy theStrategy) {
+		if (theStrategy != this.strategy) {
+			this.strategy = theStrategy;
+			TreeNode terminal = theStrategy.getTerminalNode();
+			setModel(new DefaultTreeModel(terminal));
+			this.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
+			expandTree();
+			revalidate();
+		}
+	}
+	
+	protected synchronized void refreshModel() {
+		this.getModel().nodeStructureChanged(strategy.getTerminalNode());
+		expandTree();
+	}
+
+	@Override
+	public DefaultTreeModel getModel() {
+		return (DefaultTreeModel) super.getModel();
+	}
+
+	@Override
+	public void setModel(TreeModel newModel) {
+		if (newModel != null && !(newModel instanceof DefaultTreeModel)) {
+			throw new IllegalArgumentException(
+					"Model must be a DefaultTreeModel");
+		}
+		super.setModel(newModel);
+	}
+
+	protected void expandTree() {  
+		DefaultMutableTreeNode root =  
+	        (DefaultMutableTreeNode)this.getModel().getRoot();  
+	    Enumeration e = root.breadthFirstEnumeration();  
+	    while(e.hasMoreElements()) {  
+	        DefaultMutableTreeNode node =  
+	            (DefaultMutableTreeNode)e.nextElement();  
+	        if(node.isLeaf()) continue;  
+	        int row = this.getRowForPath(new TreePath(node.getPath()));  
+	        this.expandRow(row);  
+	    }  
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-iteration-strategy-ui/src/main/java/org/apache/taverna/workbench/iterationstrategy/menu/IterationStrategyConfigureMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-iteration-strategy-ui/src/main/java/org/apache/taverna/workbench/iterationstrategy/menu/IterationStrategyConfigureMenuAction.java b/taverna-iteration-strategy-ui/src/main/java/org/apache/taverna/workbench/iterationstrategy/menu/IterationStrategyConfigureMenuAction.java
new file mode 100644
index 0000000..8a31b59
--- /dev/null
+++ b/taverna-iteration-strategy-ui/src/main/java/org/apache/taverna/workbench/iterationstrategy/menu/IterationStrategyConfigureMenuAction.java
@@ -0,0 +1,65 @@
+/**********************************************************************
+ * 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 org.apache.taverna.workbench.iterationstrategy.menu;
+
+import java.awt.event.ActionEvent;
+import java.net.URI;
+
+import javax.swing.AbstractAction;
+import javax.swing.Action;
+
+import org.apache.taverna.ui.menu.AbstractContextualMenuAction;
+import org.apache.taverna.workbench.helper.HelpEnabledDialog;
+import org.apache.taverna.workbench.iterationstrategy.contextview.IterationStrategyConfigurationDialog;
+import org.apache.taverna.workbench.iterationstrategy.contextview.IterationStrategyContextualView;
+import org.apache.taverna.workflowmodel.Processor;
+
+public class IterationStrategyConfigureMenuAction extends AbstractContextualMenuAction {
+	
+	
+	
+	public static final URI configureRunningSection = URI
+	.create("http://taverna.sf.net/2009/contextMenu/configureRunning");
+	
+	private static final URI ITERATION_STRATEGY_CONFIGURE_URI = URI
+	.create("http://taverna.sf.net/2008/t2workbench/iterationStrategyConfigure");
+
+	public IterationStrategyConfigureMenuAction() {
+		super(configureRunningSection, 40, ITERATION_STRATEGY_CONFIGURE_URI);
+	}
+
+	@SuppressWarnings("serial")
+	@Override
+	protected Action createAction() {
+		return new AbstractAction("List handling...") {
+			public void actionPerformed(ActionEvent e) {
+				Processor p = (Processor) getContextualSelection().getSelection();
+				final HelpEnabledDialog dialog = new IterationStrategyConfigurationDialog(null, p, IterationStrategyContextualView.copyIterationStrategyStack(p.getIterationStrategy()));		
+				dialog.setVisible(true);
+			}
+		};
+	}
+	
+	public boolean isEnabled() {
+		return super.isEnabled() && (getContextualSelection().getSelection() instanceof Processor);
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-iteration-strategy-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.ui.menu.MenuComponent
----------------------------------------------------------------------
diff --git a/taverna-iteration-strategy-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.ui.menu.MenuComponent b/taverna-iteration-strategy-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.ui.menu.MenuComponent
deleted file mode 100644
index 6f25f4e..0000000
--- a/taverna-iteration-strategy-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.ui.menu.MenuComponent
+++ /dev/null
@@ -1 +0,0 @@
-net.sf.taverna.t2.workbench.iterationstrategy.menu.IterationStrategyConfigureMenuAction
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-iteration-strategy-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory
----------------------------------------------------------------------
diff --git a/taverna-iteration-strategy-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory b/taverna-iteration-strategy-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory
deleted file mode 100644
index a6a27b0..0000000
--- a/taverna-iteration-strategy-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory
+++ /dev/null
@@ -1 +0,0 @@
-net.sf.taverna.t2.workbench.iterationstrategy.contextview.IterationStrategyContextualViewFactory

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-iteration-strategy-ui/src/main/resources/META-INF/services/org.apache.taverna.ui.menu.MenuComponent
----------------------------------------------------------------------
diff --git a/taverna-iteration-strategy-ui/src/main/resources/META-INF/services/org.apache.taverna.ui.menu.MenuComponent b/taverna-iteration-strategy-ui/src/main/resources/META-INF/services/org.apache.taverna.ui.menu.MenuComponent
new file mode 100644
index 0000000..12083f8
--- /dev/null
+++ b/taverna-iteration-strategy-ui/src/main/resources/META-INF/services/org.apache.taverna.ui.menu.MenuComponent
@@ -0,0 +1 @@
+org.apache.taverna.workbench.iterationstrategy.menu.IterationStrategyConfigureMenuAction
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-iteration-strategy-ui/src/main/resources/META-INF/services/org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory
----------------------------------------------------------------------
diff --git a/taverna-iteration-strategy-ui/src/main/resources/META-INF/services/org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory b/taverna-iteration-strategy-ui/src/main/resources/META-INF/services/org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory
new file mode 100644
index 0000000..857bf2e
--- /dev/null
+++ b/taverna-iteration-strategy-ui/src/main/resources/META-INF/services/org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory
@@ -0,0 +1 @@
+org.apache.taverna.workbench.iterationstrategy.contextview.IterationStrategyContextualViewFactory

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-iteration-strategy-ui/src/main/resources/META-INF/spring/iteration-strategy-ui-context-osgi.xml
----------------------------------------------------------------------
diff --git a/taverna-iteration-strategy-ui/src/main/resources/META-INF/spring/iteration-strategy-ui-context-osgi.xml b/taverna-iteration-strategy-ui/src/main/resources/META-INF/spring/iteration-strategy-ui-context-osgi.xml
index e3db399..af54774 100644
--- a/taverna-iteration-strategy-ui/src/main/resources/META-INF/spring/iteration-strategy-ui-context-osgi.xml
+++ b/taverna-iteration-strategy-ui/src/main/resources/META-INF/spring/iteration-strategy-ui-context-osgi.xml
@@ -6,9 +6,9 @@
                       http://www.springframework.org/schema/osgi
                       http://www.springframework.org/schema/osgi/spring-osgi.xsd">
 
-	<service ref="IterationStrategyContextualViewFactory" interface="net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory" />
+	<service ref="IterationStrategyContextualViewFactory" interface="org.apache.taverna.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="editManager" interface="org.apache.taverna.workbench.edits.EditManager" />
+	<reference id="fileManager" interface="org.apache.taverna.workbench.file.FileManager" />
 
 </beans:beans>

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-iteration-strategy-ui/src/main/resources/META-INF/spring/iteration-strategy-ui-context.xml
----------------------------------------------------------------------
diff --git a/taverna-iteration-strategy-ui/src/main/resources/META-INF/spring/iteration-strategy-ui-context.xml b/taverna-iteration-strategy-ui/src/main/resources/META-INF/spring/iteration-strategy-ui-context.xml
index f0bc464..b61e49f 100644
--- a/taverna-iteration-strategy-ui/src/main/resources/META-INF/spring/iteration-strategy-ui-context.xml
+++ b/taverna-iteration-strategy-ui/src/main/resources/META-INF/spring/iteration-strategy-ui-context.xml
@@ -3,7 +3,7 @@
 	xsi:schemaLocation="http://www.springframework.org/schema/beans
                       http://www.springframework.org/schema/beans/spring-beans.xsd">
 
-	<bean id="IterationStrategyContextualViewFactory" class="net.sf.taverna.t2.workbench.iterationstrategy.contextview.IterationStrategyContextualViewFactory">
+	<bean id="IterationStrategyContextualViewFactory" class="org.apache.taverna.workbench.iterationstrategy.contextview.IterationStrategyContextualViewFactory">
 			<property name="editManager" ref="editManager" />
 			<property name="fileManager" ref="fileManager" />
 	</bean>

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-iteration-strategy-ui/src/main/resources/net/sf/taverna/t2/workbench/iterationstrategy/icons/crossproducticon.png
----------------------------------------------------------------------
diff --git a/taverna-iteration-strategy-ui/src/main/resources/net/sf/taverna/t2/workbench/iterationstrategy/icons/crossproducticon.png b/taverna-iteration-strategy-ui/src/main/resources/net/sf/taverna/t2/workbench/iterationstrategy/icons/crossproducticon.png
deleted file mode 100644
index 4627fc8..0000000
Binary files a/taverna-iteration-strategy-ui/src/main/resources/net/sf/taverna/t2/workbench/iterationstrategy/icons/crossproducticon.png and /dev/null differ

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-iteration-strategy-ui/src/main/resources/net/sf/taverna/t2/workbench/iterationstrategy/icons/dotproducticon.png
----------------------------------------------------------------------
diff --git a/taverna-iteration-strategy-ui/src/main/resources/net/sf/taverna/t2/workbench/iterationstrategy/icons/dotproducticon.png b/taverna-iteration-strategy-ui/src/main/resources/net/sf/taverna/t2/workbench/iterationstrategy/icons/dotproducticon.png
deleted file mode 100644
index c269883..0000000
Binary files a/taverna-iteration-strategy-ui/src/main/resources/net/sf/taverna/t2/workbench/iterationstrategy/icons/dotproducticon.png and /dev/null differ

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-iteration-strategy-ui/src/main/resources/net/sf/taverna/t2/workbench/iterationstrategy/icons/leafnodeicon.png
----------------------------------------------------------------------
diff --git a/taverna-iteration-strategy-ui/src/main/resources/net/sf/taverna/t2/workbench/iterationstrategy/icons/leafnodeicon.png b/taverna-iteration-strategy-ui/src/main/resources/net/sf/taverna/t2/workbench/iterationstrategy/icons/leafnodeicon.png
deleted file mode 100644
index 36808c6..0000000
Binary files a/taverna-iteration-strategy-ui/src/main/resources/net/sf/taverna/t2/workbench/iterationstrategy/icons/leafnodeicon.png and /dev/null differ

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-iteration-strategy-ui/src/main/resources/org/apache/taverna/workbench/iterationstrategy/icons/crossproducticon.png
----------------------------------------------------------------------
diff --git a/taverna-iteration-strategy-ui/src/main/resources/org/apache/taverna/workbench/iterationstrategy/icons/crossproducticon.png b/taverna-iteration-strategy-ui/src/main/resources/org/apache/taverna/workbench/iterationstrategy/icons/crossproducticon.png
new file mode 100644
index 0000000..4627fc8
Binary files /dev/null and b/taverna-iteration-strategy-ui/src/main/resources/org/apache/taverna/workbench/iterationstrategy/icons/crossproducticon.png differ

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-iteration-strategy-ui/src/main/resources/org/apache/taverna/workbench/iterationstrategy/icons/dotproducticon.png
----------------------------------------------------------------------
diff --git a/taverna-iteration-strategy-ui/src/main/resources/org/apache/taverna/workbench/iterationstrategy/icons/dotproducticon.png b/taverna-iteration-strategy-ui/src/main/resources/org/apache/taverna/workbench/iterationstrategy/icons/dotproducticon.png
new file mode 100644
index 0000000..c269883
Binary files /dev/null and b/taverna-iteration-strategy-ui/src/main/resources/org/apache/taverna/workbench/iterationstrategy/icons/dotproducticon.png differ

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-iteration-strategy-ui/src/main/resources/org/apache/taverna/workbench/iterationstrategy/icons/leafnodeicon.png
----------------------------------------------------------------------
diff --git a/taverna-iteration-strategy-ui/src/main/resources/org/apache/taverna/workbench/iterationstrategy/icons/leafnodeicon.png b/taverna-iteration-strategy-ui/src/main/resources/org/apache/taverna/workbench/iterationstrategy/icons/leafnodeicon.png
new file mode 100644
index 0000000..36808c6
Binary files /dev/null and b/taverna-iteration-strategy-ui/src/main/resources/org/apache/taverna/workbench/iterationstrategy/icons/leafnodeicon.png differ

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-iteration-strategy-ui/src/test/java/net/sf/taverna/t2/workbench/iterationstrategy/editor/RunIterationStrategyEditor.java
----------------------------------------------------------------------
diff --git a/taverna-iteration-strategy-ui/src/test/java/net/sf/taverna/t2/workbench/iterationstrategy/editor/RunIterationStrategyEditor.java b/taverna-iteration-strategy-ui/src/test/java/net/sf/taverna/t2/workbench/iterationstrategy/editor/RunIterationStrategyEditor.java
deleted file mode 100644
index fcc2041..0000000
--- a/taverna-iteration-strategy-ui/src/test/java/net/sf/taverna/t2/workbench/iterationstrategy/editor/RunIterationStrategyEditor.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*******************************************************************************
- * 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.iterationstrategy.editor;
-
-import javax.swing.JFrame;
-
-import org.apache.taverna.workflowmodel.processor.iteration.NamedInputPortNode;
-import org.apache.taverna.workflowmodel.processor.iteration.impl.IterationStrategyImpl;
-
-public class RunIterationStrategyEditor {
-
-	/**
-	 * @param args
-	 */
-	public static void main(String[] args) {
-		IterationStrategyImpl iterationStrategyImpl = new IterationStrategyImpl();
-		NamedInputPortNode fishPort = new NamedInputPortNode("fish", 2);
-		NamedInputPortNode otherPort = new NamedInputPortNode("other", 0);
-		NamedInputPortNode soupPort = new NamedInputPortNode("soup", 1);
-		iterationStrategyImpl.addInput(fishPort);
-		iterationStrategyImpl.addInput(soupPort);
-		iterationStrategyImpl.addInput(otherPort);
-
-		iterationStrategyImpl.connectDefault(otherPort);
-		iterationStrategyImpl.connectDefault(fishPort);
-		iterationStrategyImpl.connectDefault(soupPort);
-		
-		IterationStrategyEditorControl editorControl = new IterationStrategyEditorControl(iterationStrategyImpl);
-		
-		JFrame frame = new JFrame("List handling editor");
-		frame.add(editorControl);
-		frame.setSize(500,400);
-		frame.setVisible(true);
-		
-		
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-iteration-strategy-ui/src/test/java/org/apache/taverna/workbench/iterationstrategy/editor/RunIterationStrategyEditor.java
----------------------------------------------------------------------
diff --git a/taverna-iteration-strategy-ui/src/test/java/org/apache/taverna/workbench/iterationstrategy/editor/RunIterationStrategyEditor.java b/taverna-iteration-strategy-ui/src/test/java/org/apache/taverna/workbench/iterationstrategy/editor/RunIterationStrategyEditor.java
new file mode 100644
index 0000000..d5a28b9
--- /dev/null
+++ b/taverna-iteration-strategy-ui/src/test/java/org/apache/taverna/workbench/iterationstrategy/editor/RunIterationStrategyEditor.java
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * 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 org.apache.taverna.workbench.iterationstrategy.editor;
+
+import org.apache.taverna.workbench.iterationstrategy.editor.IterationStrategyEditorControl;
+import javax.swing.JFrame;
+
+import org.apache.taverna.workflowmodel.processor.iteration.NamedInputPortNode;
+import org.apache.taverna.workflowmodel.processor.iteration.impl.IterationStrategyImpl;
+
+public class RunIterationStrategyEditor {
+
+	/**
+	 * @param args
+	 */
+	public static void main(String[] args) {
+		IterationStrategyImpl iterationStrategyImpl = new IterationStrategyImpl();
+		NamedInputPortNode fishPort = new NamedInputPortNode("fish", 2);
+		NamedInputPortNode otherPort = new NamedInputPortNode("other", 0);
+		NamedInputPortNode soupPort = new NamedInputPortNode("soup", 1);
+		iterationStrategyImpl.addInput(fishPort);
+		iterationStrategyImpl.addInput(soupPort);
+		iterationStrategyImpl.addInput(otherPort);
+
+		iterationStrategyImpl.connectDefault(otherPort);
+		iterationStrategyImpl.connectDefault(fishPort);
+		iterationStrategyImpl.connectDefault(soupPort);
+		
+		IterationStrategyEditorControl editorControl = new IterationStrategyEditorControl(iterationStrategyImpl);
+		
+		JFrame frame = new JFrame("List handling editor");
+		frame.add(editorControl);
+		frame.setSize(500,400);
+		frame.setVisible(true);
+		
+		
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-loop-ui/src/main/java/net/sf/taverna/t2/workbench/loop/ActivityGenerator.java
----------------------------------------------------------------------
diff --git a/taverna-loop-ui/src/main/java/net/sf/taverna/t2/workbench/loop/ActivityGenerator.java b/taverna-loop-ui/src/main/java/net/sf/taverna/t2/workbench/loop/ActivityGenerator.java
deleted file mode 100644
index 4bf03e8..0000000
--- a/taverna-loop-ui/src/main/java/net/sf/taverna/t2/workbench/loop/ActivityGenerator.java
+++ /dev/null
@@ -1,194 +0,0 @@
-/*******************************************************************************
- * 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.net.URI;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Set;
-import java.util.Map.Entry;
-
-import net.sf.taverna.t2.workbench.loop.comparisons.Comparison;
-import net.sf.taverna.t2.workbench.loop.comparisons.EqualTo;
-import net.sf.taverna.t2.workbench.loop.comparisons.IsGreaterThan;
-import net.sf.taverna.t2.workbench.loop.comparisons.IsLessThan;
-import net.sf.taverna.t2.workbench.loop.comparisons.Matches;
-import net.sf.taverna.t2.workbench.loop.comparisons.NotEqualTo;
-import net.sf.taverna.t2.workbench.loop.comparisons.NotMatches;
-
-import org.apache.log4j.Logger;
-
-import org.apache.taverna.scufl2.api.activity.Activity;
-import org.apache.taverna.scufl2.api.common.Scufl2Tools;
-import org.apache.taverna.scufl2.api.configurations.Configuration;
-import org.apache.taverna.scufl2.api.core.Processor;
-import org.apache.taverna.scufl2.api.port.InputActivityPort;
-import org.apache.taverna.scufl2.api.port.InputProcessorPort;
-import org.apache.taverna.scufl2.api.port.OutputActivityPort;
-import org.apache.taverna.scufl2.api.port.OutputProcessorPort;
-
-import com.fasterxml.jackson.databind.node.ObjectNode;
-
-public class ActivityGenerator {
-
-    private static final String LOOP_PORT = "loop";
-
-    private static final String SCRIPT = "script";
-
-    public static URI BEANSHELL_ACTIVITY = URI
-            .create("http://ns.taverna.org.uk/2010/activity/beanshell");
-
-    public static URI BEANSHELL_CONFIG = BEANSHELL_ACTIVITY.resolve("#Config");
-
-    
-	public static final double DEFAULT_DELAY_S = 0.2;
-	public static final String COMPARE_PORT = "comparePort";
-	public static final String COMPARISON = "comparison";
-	public static final String CUSTOM_COMPARISON = "custom";
-	public static final String COMPARE_VALUE = "compareValue";
-	public static final String IS_FEED_BACK = "isFeedBack";
-	public static final String DELAY = "delay";
-
-	private static Logger logger = Logger.getLogger(ActivityGenerator.class);
-	private final ObjectNode loopProperties;
-	private final Processor processorToCompare;
-	private static Scufl2Tools scufl2Tools = new Scufl2Tools();
-
-	public ActivityGenerator(ObjectNode configuration,
-			Processor processorToCompare) {
-		this.loopProperties = configuration;
-		this.processorToCompare = processorToCompare;
-	}
-
-	protected Activity generateActivity() {
-		Activity beanshell = new Activity();
-		beanshell.setType(BEANSHELL_ACTIVITY);
-		Configuration config = generateBeanshellConfig(beanshell);
-		// TODO: Where to put the config?
-		return beanshell;
-	}
-
-	private Configuration generateBeanshellConfig(Activity beanshell) {
-	    Configuration config = scufl2Tools.createConfigurationFor(beanshell, BEANSHELL_CONFIG);
-	    generateInputPorts(beanshell);
-	    generateOutputPorts(beanshell);
-	    config.getJsonAsObjectNode().put(SCRIPT, generateScript());
-		return config;
-	}
-
-	protected static List<Comparison> comparisons = Arrays.asList(
-			new EqualTo(), new NotEqualTo(), new Matches(), new NotMatches(),
-			new IsGreaterThan(), new IsLessThan());
-
-	protected static Comparison getComparisonById(String id) {
-	    if (id == null || id.isEmpty()) {
-	        return comparisons.get(0);
-	    }
-		for (Comparison potentialComparison : comparisons) {
-			if (potentialComparison.getId().equals(id)) {
-				return potentialComparison;
-			}
-		}
-		return null;
-	}
-
-	@SuppressWarnings("boxing")
-	private String generateScript() {
-		Map<String, String> replacements = new HashMap<String, String>();
-		replacements.put("${loopPort}", LOOP_PORT);
-		replacements.put("${port}", loopProperties.findValue(COMPARE_PORT).asText());
-		replacements.put("${value}", beanshellString(loopProperties
-				.findValue(COMPARE_VALUE).asText()));
-
-
-		// as seconds
-		Double delay = loopProperties.findPath(DELAY).asDouble(DEFAULT_DELAY_S);
-		// as milliseconds
-		delay = Math.max(0.0, delay) * 1000;
-		// as integer (for Thread.sleep)
-		replacements.put("${delay}", Integer.toString(delay.intValue()));
-
-		String template = getComparisonById(
-				loopProperties.findValue(COMPARISON).asText()).getScriptTemplate();
-
-		if (delay > 0.0) {
-    		template += "\nif (\"true\".matches(${loopPort})) {\n";
-    		template += "   Thread.sleep(${delay});\n";
-    		template += "}";
-		}
-
-		String script = template;
-		for (Entry<String, String> mapping : replacements.entrySet()) {
-			script = script.replace(mapping.getKey(), mapping.getValue());
-		}
-		return script;
-	}
-
-	private String beanshellString(String value) {
-		value = value.replace("\\", "\\\\");
-		value = value.replace("\n", "\\n");
-		value = value.replace("\"", "\\\"");
-		return '"' + value + '"';
-	}
-
-	private void generateInputPorts(Activity beanshell) {
-		if (processorToCompare == null) {
-		    return;
-		}
-		for (OutputProcessorPort procOut : processorToCompare.getOutputPorts()) {
-		    // Any of the outputs are available to the script, giving
-		    // a custom script that compares multiple outputs a better
-		    // starting point.
-			String portName = procOut.getName();
-			if (portName.equals(loopProperties.findValue(COMPARE_PORT).asText()) ||
-			        (loopProperties.findValue(IS_FEED_BACK).asBoolean())) {
-				InputActivityPort input = new InputActivityPort(beanshell, portName);
-				input.setDepth(procOut.getDepth());
-				input.setParent(beanshell);
-			}
-		}
-	}
-
-	private void generateOutputPorts(Activity beanshell) {
-	       OutputActivityPort loopPort = new OutputActivityPort(beanshell, LOOP_PORT);
-	        loopPort.setDepth(0);
-	        loopPort.setGranularDepth(0);
-	    if (processorToCompare == null) {
-            return;
-	    }	    
-	    if (! loopProperties.findValue(IS_FEED_BACK).asBoolean()) {
-           return;
-	    }
-	    for (InputProcessorPort procIn : processorToCompare.getInputPorts()) {
-            String portName = procIn.getName();
-            if (processorToCompare.getOutputPorts().containsName(portName)) {
-                OutputActivityPort actOut = new OutputActivityPort(beanshell, portName);
-                actOut.setDepth(procIn.getDepth());
-                actOut.setGranularDepth(procIn.getDepth());
-            }
-	    }
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-loop-ui/src/main/java/net/sf/taverna/t2/workbench/loop/AddLoopFactory.java
----------------------------------------------------------------------
diff --git a/taverna-loop-ui/src/main/java/net/sf/taverna/t2/workbench/loop/AddLoopFactory.java b/taverna-loop-ui/src/main/java/net/sf/taverna/t2/workbench/loop/AddLoopFactory.java
deleted file mode 100644
index ed5e66b..0000000
--- a/taverna-loop-ui/src/main/java/net/sf/taverna/t2/workbench/loop/AddLoopFactory.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/*******************************************************************************
- * 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.event.ActionEvent;
-import java.net.URI;
-import java.util.List;
-
-import javax.swing.AbstractAction;
-import javax.swing.Action;
-
-import net.sf.taverna.t2.workbench.MainWindow;
-import net.sf.taverna.t2.workbench.edits.EditManager;
-import net.sf.taverna.t2.workbench.file.FileManager;
-import net.sf.taverna.t2.workbench.selection.SelectionManager;
-import net.sf.taverna.t2.workbench.ui.views.contextualviews.AddLayerFactorySPI;
-
-import org.apache.log4j.Logger;
-
-import uk.org.taverna.configuration.app.ApplicationConfiguration;
-import org.apache.taverna.scufl2.api.common.Scufl2Tools;
-import org.apache.taverna.scufl2.api.configurations.Configuration;
-import org.apache.taverna.scufl2.api.core.Processor;
-
-import com.fasterxml.jackson.databind.node.JsonNodeFactory;
-import com.fasterxml.jackson.databind.node.ObjectNode;
-
-public class AddLoopFactory implements AddLayerFactorySPI {
-
-    private static final URI LOOP_TYPE = URI.create("http://ns.taverna.org.uk/2010/scufl2/taverna/dispatchlayer/Loop");
-
-    
-    private static Logger logger = Logger.getLogger(AddLoopFactory.class);
-    private static final JsonNodeFactory JSON_NODE_FACTORY = JsonNodeFactory.instance;
-    private static Scufl2Tools scufl2Tools = new Scufl2Tools();
-    
-	private EditManager editManager;
-	private FileManager fileManager;
-	private SelectionManager selectionManager;
-	private ApplicationConfiguration applicationConfig;
-
-	public boolean canAddLayerFor(Processor processor) {
-	   return findLoopLayer(processor) == null;
-	}
-
-
-    public ObjectNode findLoopLayer(Processor processor) {
-        List<Configuration> configs = scufl2Tools.configurationsFor(processor, selectionManager.getSelectedProfile());
-        for (Configuration config : configs) {
-            if (config.getJson().has("loop")) {
-                return (ObjectNode) config.getJson().get("loop");
-            }
-        }
-        return null;
-    }
-	
-	@SuppressWarnings("serial")
-	public Action getAddLayerActionFor(final Processor processor) {
-		return new AbstractAction("Add looping") {
-
-            public void actionPerformed(ActionEvent e) {
-				    ObjectNode loopLayer = findLoopLayer(processor);
-				    if (loopLayer == null) {
-				        loopLayer = JSON_NODE_FACTORY.objectNode();
-				    }
-					// Pop up the configure loop dialog
-                LoopConfigureAction loopConfigureAction = new LoopConfigureAction(
-                        MainWindow.getMainWindow(), null, processor, loopLayer,
-                        selectionManager.getSelectedProfile(), editManager,
-                        fileManager, getApplicationConfig());
-					loopConfigureAction.actionPerformed(e);
-			}
-		};
-	}
-
-	@Override
-	public boolean canCreateLayerClass(URI dispatchLayerType) {
-	    return dispatchLayerType.equals(LOOP_TYPE);
-	}
-
-	public void setEditManager(EditManager editManager) {
-		this.editManager = editManager;
-	}
-
-	public void setFileManager(FileManager fileManager) {
-		this.fileManager = fileManager;
-	}
-
-    public SelectionManager getSelectionManager() {
-        return selectionManager;
-    }
-
-    public void setSelectionManager(SelectionManager selectionManager) {
-        this.selectionManager = selectionManager;
-    }
-
-
-    public ApplicationConfiguration getApplicationConfig() {
-        return applicationConfig;
-    }
-
-
-    public void setApplicationConfig(ApplicationConfiguration applicationConfig) {
-        this.applicationConfig = applicationConfig;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-loop-ui/src/main/java/net/sf/taverna/t2/workbench/loop/LoopAddMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-loop-ui/src/main/java/net/sf/taverna/t2/workbench/loop/LoopAddMenuAction.java b/taverna-loop-ui/src/main/java/net/sf/taverna/t2/workbench/loop/LoopAddMenuAction.java
deleted file mode 100644
index 4dd2c99..0000000
--- a/taverna-loop-ui/src/main/java/net/sf/taverna/t2/workbench/loop/LoopAddMenuAction.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/**********************************************************************
- * 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.workbench.loop;
-
-import java.awt.event.ActionEvent;
-import java.net.URI;
-
-import javax.swing.AbstractAction;
-import javax.swing.Action;
-
-import org.apache.taverna.scufl2.api.core.Processor;
-
-import net.sf.taverna.t2.ui.menu.AbstractContextualMenuAction;
-
-public class LoopAddMenuAction extends AbstractContextualMenuAction {
-
-	public static final URI configureRunningSection = URI
-	.create("http://taverna.sf.net/2009/contextMenu/configureRunning");
-
-	private static final URI LOOP_ADD_URI = URI
-	.create("http://taverna.sf.net/2008/t2workbench/loopAdd");
-
-	private static final String LOOP_ADD = "Loop add";
-
-	public LoopAddMenuAction() {
-		super(configureRunningSection, 20, LOOP_ADD_URI);
-	}
-
-	private AddLoopFactory addLoopFactory;
-
-	@SuppressWarnings("serial")
-	@Override
-	protected Action createAction() {
-		return new AbstractAction("Looping...") {
-			public void actionPerformed(ActionEvent e) {
-				//Loop loopLayer = null;
-				Processor p = (Processor) getContextualSelection().getSelection();
-				addLoopFactory.getAddLayerActionFor(p).actionPerformed(e);
-				//LoopConfigureMenuAction.configureLoopLayer(p, e); // Configuration dialog pop up is now done from getAddLayerActionFor()
-			}
-		};
-	}
-
-	public boolean isEnabled() {
-		Object selection = getContextualSelection().getSelection();
-		return (super.isEnabled() && (selection instanceof Processor) && (LoopConfigureMenuAction.getLoopLayer((Processor)selection) == null));
-	}
-
-	public void setAddLoopFactory(AddLoopFactory addLoopFactory) {
-		this.addLoopFactory = addLoopFactory;
-	}
-
-
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-loop-ui/src/main/java/net/sf/taverna/t2/workbench/loop/LoopConfigurationPanel.java
----------------------------------------------------------------------
diff --git a/taverna-loop-ui/src/main/java/net/sf/taverna/t2/workbench/loop/LoopConfigurationPanel.java b/taverna-loop-ui/src/main/java/net/sf/taverna/t2/workbench/loop/LoopConfigurationPanel.java
deleted file mode 100644
index 6b2afd0..0000000
--- a/taverna-loop-ui/src/main/java/net/sf/taverna/t2/workbench/loop/LoopConfigurationPanel.java
+++ /dev/null
@@ -1,588 +0,0 @@
-/*******************************************************************************
- * 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.Color;
-import java.awt.FlowLayout;
-import java.awt.Frame;
-import java.awt.GridBagConstraints;
-import java.awt.GridBagLayout;
-import java.awt.Insets;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Properties;
-
-import javax.swing.AbstractAction;
-import javax.swing.Box;
-import javax.swing.JButton;
-import javax.swing.JCheckBox;
-import javax.swing.JComboBox;
-import javax.swing.JDialog;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JTextField;
-import javax.swing.SwingConstants;
-import javax.swing.border.EmptyBorder;
-
-import net.sf.taverna.t2.activities.beanshell.views.BeanshellConfigurationPanel;
-import net.sf.taverna.t2.workbench.helper.HelpEnabledDialog;
-import net.sf.taverna.t2.workbench.loop.comparisons.Comparison;
-import net.sf.taverna.t2.workbench.ui.Utils;
-
-import org.apache.log4j.Logger;
-
-import uk.org.taverna.configuration.app.ApplicationConfiguration;
-import org.apache.taverna.scufl2.api.activity.Activity;
-import org.apache.taverna.scufl2.api.common.Scufl2Tools;
-import org.apache.taverna.scufl2.api.configurations.Configuration;
-import org.apache.taverna.scufl2.api.core.Processor;
-import org.apache.taverna.scufl2.api.profiles.Profile;
-
-import com.fasterxml.jackson.databind.node.ObjectNode;
-
-/**
- * UI for {@link LoopConfiguration}
- *
- * @author Stian Soiland-Reyes
- *
- */
-@SuppressWarnings("serial")
-public class LoopConfigurationPanel extends JPanel {
-
-	private static final String CONDITION_ACTIVITY = "conditionActivity";
-    private static final String DEFAULT_DELAY_S = "0.5";
-	protected ObjectNode configuration;
-
-	private static final Scufl2Tools scufl2tools = new Scufl2Tools();
-	private ApplicationConfiguration applicationConfig;
-
-	
-	protected final Processor processor;
-
-	protected JPanel headerPanel = new JPanel();
-	protected JPanel optionsPanel = new JPanel();
-	protected JPanel configPanel = new JPanel();
-	protected JPanel customPanel = new JPanel();
-
-	protected JLabel valueTypeLabel = new JLabel("the string");
-
-	protected JTextField valueField = new JTextField("", 15);
-
-	protected JLabel delayLabel = new JLabel("adding a delay of ");
-	protected JTextField delayField = new JTextField(
-			Double.toString(ActivityGenerator.DEFAULT_DELAY_S), 4);
-	protected JLabel secondsLabel = new JLabel(" seconds between the loops.");
-
-	private JComboBox<String> portCombo;
-	private JComboBox<Comparison> comparisonCombo;
-	private JButton customizeButton;
-
-	protected ObjectNode loopLayer;
-	private Object Comparison;
-	private Activity originalCondition = null;
-    private Profile profile;
-
-    public LoopConfigurationPanel(Processor processor, ObjectNode loopLayer,
-            Profile profile, ApplicationConfiguration applicationConfig) {
-		this.processor = processor;
-		this.loopLayer = loopLayer;
-        this.profile = profile;
-        this.applicationConfig = applicationConfig;
-		this.setBorder(new EmptyBorder(10,10,10,10));
-		initialise();
-		setConfiguration(loopLayer);
-	}
-
-	public ObjectNode getConfiguration() {
-		uiToConfig();
-		return loopLayer.deepCopy();
-	}
-
-	private static Logger logger = Logger
-			.getLogger(LoopConfigurationPanel.class);
-
-	protected void uiToConfig() {
-	    String comparisonStr = configuration.path(ActivityGenerator.COMPARISON).asText();
-	    if (comparisonStr.isEmpty()) {
-	        comparisonStr = ActivityGenerator.CUSTOM_COMPARISON;
-	    }
-		if (comparisonStr.equals(ActivityGenerator.CUSTOM_COMPARISON)
-				&& ! configuration.path(CONDITION_ACTIVITY).asText().isEmpty()) {
-			// Ignore values
-		} else {
-		    configuration.put("runFirst", true);
-			if (portCombo.getSelectedItem() == null) {
-			    // unconfigured port
-				configuration.remove(ActivityGenerator.COMPARE_PORT);
-				configuration.putNull(CONDITION_ACTIVITY);
-				return;
-			} else {
-				configuration.put(ActivityGenerator.COMPARE_PORT,
-						((String) portCombo.getSelectedItem()));
-			}
-
-			Comparison comparison = (Comparison) comparisonCombo
-					.getSelectedItem();
-			if (comparison == null) {
-				configuration.remove(ActivityGenerator.COMPARISON);
-				configuration.putNull(CONDITION_ACTIVITY);
-				return;
-			} else {
-				configuration
-						.put(ActivityGenerator.COMPARISON, comparison.getId());
-			}
-			configuration.put(ActivityGenerator.COMPARE_VALUE, valueField
-					.getText());
-			configuration.put(ActivityGenerator.DELAY, Double.parseDouble(delayField.getText()));
-			configuration.put(ActivityGenerator.IS_FEED_BACK, feedBackCheck.isSelected());
-
-			// Generate activity
-			ActivityGenerator activityGenerator = new ActivityGenerator(
-					configuration, processor);
-			configuration.put(CONDITION_ACTIVITY, activityGenerator.generateActivity().getName());
-		}
-	}
-
-	public class ResetAction extends AbstractAction {
-		public ResetAction() {
-			super("Clear");
-		}
-
-		public void actionPerformed(ActionEvent e) {
-			configuration.putNull(CONDITION_ACTIVITY);
-			configToUi();
-		}
-	}
-
-	private final class CustomizeAction implements ActionListener {
-
-
-//		public CustomizeAction() {
-//			super();
-//			//putValue(NAME, "Customise loop condition");
-//		}
-
-		public void actionPerformed(ActionEvent e) {
-			uiToConfig();
-
-			String conditionName = configuration.path(CONDITION_ACTIVITY).asText();
-			
-			Activity condition = profile.getActivities().getByName(conditionName);
-			if (condition == null) {
-			    condition = new Activity();
-			    profile.getActivities().add(condition);
-			    configuration.put(CONDITION_ACTIVITY, condition.getName());
-			    condition.setType(ActivityGenerator.BEANSHELL_ACTIVITY);
-			    Configuration config = scufl2tools.createConfigurationFor(condition, ActivityGenerator.BEANSHELL_CONFIG);
-			} else if (!(condition.getType().equals(ActivityGenerator.BEANSHELL_ACTIVITY))) {
-				logger.warn("Can't configure unsupported loop condition of service type "
-						+ condition.getType());
-				return;
-			}
-
-			Frame owner = Utils.getParentFrame(LoopConfigurationPanel.this);
-			
-			
-            final BeanshellConfigurationPanel beanshellConfigView = new BeanshellConfigurationPanel(
-                    condition, applicationConfig);
-			
-			final JDialog dialog = new HelpEnabledDialog(owner, "Customize looping", true);
-			dialog.setLayout(new BorderLayout());
-			dialog.add(beanshellConfigView, BorderLayout.NORTH);
-			dialog.setSize(600, 600);
-			JPanel buttonPanel = new JPanel();
-
-			buttonPanel.setLayout(new FlowLayout(FlowLayout.RIGHT));
-
-			JButton applyButton = new JButton(new AbstractAction() {
-
-				public void actionPerformed(ActionEvent e) {
-					if (beanshellConfigView.isConfigurationChanged()) {
-						beanshellConfigView.noteConfiguration();
-//							beanshellActivity.configure(beanshellConfigView
-//									.getConfiguration());
-//							configuration.setCondition(beanshellActivity);
-						Configuration config = beanshellConfigView.getConfiguration();
-						// TODO: Do we need to store this somehow?
-						configuration.put(
-								ActivityGenerator.COMPARISON,
-								ActivityGenerator.CUSTOM_COMPARISON);
-					}
-					dialog.setVisible(false);
-					configToUi();
-				}
-
-			});
-			applyButton.setText("Apply");
-
-			buttonPanel.add(applyButton);
-			JButton closeButton = new JButton(new AbstractAction() {
-
-				public void actionPerformed(ActionEvent e) {
-					dialog.setVisible(false);
-				}
-			});
-			closeButton.setText("Cancel");
-			buttonPanel.add(closeButton);
-			dialog.add(buttonPanel, BorderLayout.SOUTH);
-			dialog.setLocationRelativeTo(customizeButton);
-			dialog.setVisible(true);
-
-		}
-	}
-
-	public void setConfiguration(ObjectNode configuration) {
-		this.configuration = configuration.deepCopy();
-		configToUi();
-	}
-
-	protected void configToUi() {
-		
-
-		String comparisonId;
-		
-		if (configuration.has(ActivityGenerator.COMPARISON)) {
-            comparisonId = configuration.get(ActivityGenerator.COMPARISON)
-                    .asText();
-		} else {
-            comparisonId = ActivityGenerator.CUSTOM_COMPARISON;
-		}
-
-		if (comparisonId.equals(ActivityGenerator.CUSTOM_COMPARISON)
-				&& configuration.has("conditionalActivity")) {
-			configPanel.setVisible(false);
-			customPanel.setVisible(true);
-		} else {
-			configPanel.setVisible(true);
-			customPanel.setVisible(false);
-		}
-
-		portCombo.setSelectedItem(configuration.get(ActivityGenerator.COMPARE_PORT).asText());
-		if (portCombo.getSelectedIndex() == -1
-				&& portCombo.getModel().getSize() > 0) {
-			portCombo.setSelectedIndex(0);
-		}
-
-		Comparison comparison = ActivityGenerator
-				.getComparisonById(comparisonId);
-		comparisonCombo.setSelectedItem(comparison);
-		if (comparisonCombo.getSelectedIndex() == -1
-				&& comparisonCombo.getModel().getSize() > 0) {
-			comparisonCombo.setSelectedIndex(0);
-		}
-
-		valueField.setText(configuration.get(ActivityGenerator.COMPARE_VALUE).asText());
-
-		if (configuration.has(ActivityGenerator.DELAY)) {
-		    delayField.setText(configuration.get(ActivityGenerator.DELAY).asText());
-		} else {
-		    delayField.setText(DEFAULT_DELAY_S);
-		}
-
-		feedBackCheck.setSelected(configuration.get(ActivityGenerator.IS_FEED_BACK).asBoolean());
-		updateFeedbackHelp();
-	}
-
-	private void initialise() {
-		removeAll();
-		setLayout(new GridBagLayout());
-		GridBagConstraints gbc = new GridBagConstraints();
-		gbc.fill = GridBagConstraints.HORIZONTAL;
-		gbc.anchor = GridBagConstraints.FIRST_LINE_START;
-		gbc.gridx = 0;
-		gbc.weightx = 0.1;
-
-		makeHeader();
-		add(headerPanel, gbc);
-
-		makeConfigPanel();
-		gbc.weighty = 0.1;
-		gbc.anchor = GridBagConstraints.CENTER;
-		gbc.fill = GridBagConstraints.BOTH;
-		add(configPanel, gbc);
-
-		makeCustomPanel();
-		add(customPanel, gbc);
-
-		makeOptions();
-		add(optionsPanel, gbc);
-	}
-
-	protected void makeCustomPanel() {
-		customPanel.removeAll();
-		customPanel.setLayout(new GridBagLayout());
-
-		GridBagConstraints gbc = new GridBagConstraints();
-		gbc.anchor = GridBagConstraints.LINE_START;
-		gbc.gridx = 0;
-		gbc.gridy = 0;
-		gbc.gridwidth = 2;
-		gbc.weightx = 0.1;
-		gbc.fill = GridBagConstraints.HORIZONTAL;
-
-		JLabel helpLabel = new JLabel(
-				"<html><body>"
-						+ "The service <strong>" + processor.getName() +  "</strong> will be "
-						+ "invoked repeatedly as "
-						+ "long as the <em>customized loop condition service</em> returns a string equal "
-						+ "to <strong>\"true\"</strong> on its output port <code>loop</code>."
-//						+ "<br><br>"
-//						+ "Input ports of the condition service will be populated with values from "
-//						+ "the <em>corresponding output ports</em> of the main service invocation "
-//						+ "(as long as they are also "
-//						+ "<strong>connected</strong> in the containing workflow)."
-//						+ "<br><br> "
-//
-//						+ "Any <em>matching "
-//						+ "output ports</em> from the condition service will provide the corresponding "
-//						+ "<em>inputs</em> to the main service while looping. You will need to connect "
-//						+ "the <em>initial inputs</em> in the containing workflow."
-						+ "</body></html>");
-		customPanel.add(helpLabel, gbc);
-
-		gbc.weightx = 0.1;
-		gbc.fill = GridBagConstraints.NONE;
-		gbc.gridx = 0;
-		gbc.gridy++;
-		gbc.gridwidth = 1;
-		gbc.anchor = GridBagConstraints.EAST;
-		JPanel customiseButtonPanel = new JPanel(new FlowLayout());
-		customiseButtonPanel.setBorder(new EmptyBorder(10,0,0,0));
-		customizeButton = new JButton("Customize loop condition");
-		customizeButton.addActionListener(new CustomizeAction());
-		customiseButtonPanel.add(customizeButton);
-		customiseButtonPanel.add(new JButton(new ResetAction()));
-		customPanel.add(customiseButtonPanel, gbc);
-
-	}
-
-	protected void makeConfigPanel() {
-		configPanel.removeAll();
-		configPanel.setLayout(new GridBagLayout());
-
-		GridBagConstraints gbc = new GridBagConstraints();
-		gbc.anchor = GridBagConstraints.LINE_START;
-		gbc.gridx = 0;
-		gbc.gridy = 0;
-		gbc.gridwidth = 4;
-		gbc.weightx = 0.1;
-		gbc.fill = GridBagConstraints.HORIZONTAL;
-		JLabel invokedRepeatedlyLabel = new JLabel(
-
-				"<html><body>The service <strong>" + processor.getName() +  "</strong> " +
-						"will be invoked repeatedly <em>until</em> its output port</body></html>");
-		invokedRepeatedlyLabel.setBorder(new EmptyBorder(10,0,10,0)); // give some top and bottom border to the label
-		configPanel.add(invokedRepeatedlyLabel, gbc);
-		gbc.ipadx = 4;
-		gbc.ipady = 4;
-
-		gbc.weightx = 0.0;
-		gbc.fill = GridBagConstraints.HORIZONTAL;
-		gbc.gridx = 0;
-		gbc.gridy = 1;
-		gbc.gridwidth = 1;
-		List<String> activityOutputPorts = getActivityOutputPorts();
-		portCombo = new JComboBox(activityOutputPorts.toArray());
-		configPanel.add(portCombo, gbc);
-
-		comparisonCombo = new JComboBox(ActivityGenerator.comparisons.toArray());
-		comparisonCombo.addActionListener(new ActionListener() {
-			public void actionPerformed(ActionEvent e) {
-				Comparison selectedComparison = (Comparison) comparisonCombo
-						.getSelectedItem();
-				if (selectedComparison != null) {
-					valueTypeLabel.setText("the "
-							+ selectedComparison.getValueType());
-				}
-			}
-		});
-		if (comparisonCombo.getSelectedIndex() == -1) {
-			comparisonCombo.setSelectedIndex(0);
-		}
-		gbc.gridx = 1;
-		gbc.gridy = 1;
-		configPanel.add(comparisonCombo, gbc);
-
-		gbc.gridx = 2;
-		gbc.gridy = 1;
-		valueTypeLabel.setHorizontalAlignment(SwingConstants.RIGHT);
-		configPanel.add(valueTypeLabel, gbc);
-
-		gbc.gridx = 3;
-		gbc.gridy = 1;
-		gbc.weightx = 0.5; // request all extra space
-		gbc.fill = GridBagConstraints.HORIZONTAL;
-		configPanel.add(valueField, gbc);
-
-		gbc.gridx = 0;
-		gbc.gridy = 2;
-		gbc.weightx = 0.0;
-		configPanel.add(delayLabel, gbc);
-
-		gbc.gridx = 1;
-		gbc.gridx = 1;
-		gbc.gridy = 2;
-		gbc.weightx = 0.0;
-		delayField.setHorizontalAlignment(JTextField.RIGHT);
-		configPanel.add(delayField, gbc);
-
-		gbc.gridx = 2;
-		gbc.gridy = 2;
-		gbc.gridwidth = 2;
-		gbc.weightx = 0.5; // request all extra space
-		gbc.fill = GridBagConstraints.HORIZONTAL;
-		configPanel.add(secondsLabel, gbc);
-
-		if (activityOutputPorts.isEmpty()) {
-			JLabel warningLabel = new JLabel(
-					"<html><body><strong>Warning:</strong><br>"
-							+ "<i>No single value output ports detected on the main service, "
-							+ "cannot use built-in comparisons. You may still add a customized " +
-									"looping script</i></body></html>");
-			gbc.gridx = 0;
-			gbc.gridy++;
-			gbc.gridwidth = 4;
-			gbc.weightx = 0.1;
-			gbc.fill = GridBagConstraints.BOTH;
-			gbc.gridy++;
-			configPanel.add(warningLabel, gbc);
-			invokedRepeatedlyLabel.setVisible(false);
-			portCombo.setVisible(false);
-			comparisonCombo.setVisible(false);
-			portWarning.setVisible(false);
-			valueTypeLabel.setVisible(false);
-			valueField.setVisible(false);
-			delayField.setVisible(false);
-			delayLabel.setVisible(false);
-			secondsLabel.setVisible(false);
-		}
-
-		gbc.gridy++;
-		gbc.gridx = 0;
-		gbc.weightx = 0.1;
-		gbc.gridwidth = 4;
-		gbc.weightx = 0.1;
-		gbc.fill = GridBagConstraints.BOTH;
-		gbc.fill = GridBagConstraints.HORIZONTAL;
-		gbc.insets = new Insets(10, 0, 10, 0);
-		configPanel.add(portWarning, gbc);
-
-		gbc.insets = new Insets(0, 0, 0, 0);
-		gbc.weightx = 0.1;
-		gbc.fill = GridBagConstraints.NONE;
-		gbc.gridx = 0;
-		gbc.gridy++;
-		gbc.gridwidth = 4;
-		gbc.anchor = GridBagConstraints.LAST_LINE_END;
-		JPanel customiseButtonPanel = new JPanel(new FlowLayout());
-		customizeButton = new JButton("Customize loop condition");
-		customizeButton.addActionListener(new CustomizeAction());
-		customiseButtonPanel.add(customizeButton);
-		configPanel.add(customiseButtonPanel, gbc);
-
-		// filler
-		gbc.gridy++;
-		gbc.fill = GridBagConstraints.BOTH;
-		gbc.gridx = 4;
-		gbc.weightx = 0.1;
-		gbc.weighty = 0.1;
-		gbc.gridwidth = 4;
-		configPanel.add(Box.createGlue(), gbc);
-	}
-
-	private List<String> getActivityOutputPorts() {
-	    // Should already be sorted
-	    return new ArrayList<>(processor.getOutputPorts().getNames());
-    }
-
-    protected JCheckBox feedBackCheck = new JCheckBox(
-			"Enable output port to input port feedback");
-	private JLabel portWarning = new JLabel(
-			"<html><body><small>Note that for Taverna to be able to execute this loop, "
-					+ "the output port <strong>must</strong> be connected to an input of another service "
-					+ "or a workflow output port.</small></body></html>");
-
-	protected void makeOptions() {
-		optionsPanel.removeAll();
-		optionsPanel.setLayout(new GridBagLayout());
-		GridBagConstraints gbc = new GridBagConstraints();
-		gbc.gridx = 0;
-		gbc.gridy = 0;
-		gbc.weightx = 0.1;
-		gbc.anchor = GridBagConstraints.FIRST_LINE_START;
-		gbc.fill = GridBagConstraints.HORIZONTAL;
-		feedBackCheck.setBorder(new EmptyBorder(0,0,10,0));
-		optionsPanel.add(feedBackCheck, gbc);
-		feedBackCheck.addActionListener(new ActionListener() {
-			public void actionPerformed(ActionEvent e) {
-				updateFeedbackHelp();
-			}
-		});
-		updateFeedbackHelp();
-
-		gbc.gridy = 1;
-		gbc.fill = GridBagConstraints.HORIZONTAL;
-		optionsPanel.add(feedbackHelp, gbc);
-	}
-
-	protected void updateFeedbackHelp() {
-		feedbackHelp.setEnabled(feedBackCheck.isSelected());
-		Color color;
-		if (feedBackCheck.isSelected()) {
-			color = valueTypeLabel.getForeground();
-		} else {
-			// Work around
-			// http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4303706
-			// and assume gray is the 'disabled' colour in our Look n Feel
-			color = Color.gray;
-		}
-		feedbackHelp.setForeground(color);
-
-	}
-
-	JLabel feedbackHelp = new JLabel(
-			"<html><small>"
-					+ "<p>When feedback is enabled, the value of the output port is used as input " +
-							"the next time the loop in invoked. The input and output ports used for feedback "
-					+ "<strong>must</strong> have the same <strong>name</strong> and <strong>depth</strong>."
-					+ "</p><br>"
-
-					+ "<p>Feedback can be useful for looping over a nested workflow, "
-					+ "where the nested workflow's output determines its next input value.</p><br>"
-
-					+ "<p>In order to use feedback looping, you must provide an initial value to the input port by "
-					+ "connecting it to the output of a previous service or workflow input port."
-					+ "The output port used as feedback also has to be connected to a downstream service " +
-							"or a workflow output port.</p>"
-
-					+ "</small></html>");
-
-	protected void makeHeader() {
-		headerPanel.removeAll();
-		headerPanel.setLayout(new BorderLayout());
-		//headerPanel.add(new ShadedLabel("Looping for service"
-		//		+ processor.getLocalName(), ShadedLabel.ORANGE));
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-loop-ui/src/main/java/net/sf/taverna/t2/workbench/loop/LoopConfigureAction.java
----------------------------------------------------------------------
diff --git a/taverna-loop-ui/src/main/java/net/sf/taverna/t2/workbench/loop/LoopConfigureAction.java b/taverna-loop-ui/src/main/java/net/sf/taverna/t2/workbench/loop/LoopConfigureAction.java
deleted file mode 100644
index 7e8a1de..0000000
--- a/taverna-loop-ui/src/main/java/net/sf/taverna/t2/workbench/loop/LoopConfigureAction.java
+++ /dev/null
@@ -1,262 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.workbench.loop;
-
-import java.awt.BorderLayout;
-import java.awt.FlowLayout;
-import java.awt.Frame;
-import java.awt.event.ActionEvent;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import javax.swing.AbstractAction;
-import javax.swing.JButton;
-import javax.swing.JDialog;
-import javax.swing.JOptionPane;
-import javax.swing.JPanel;
-
-import org.apache.log4j.Logger;
-
-import com.fasterxml.jackson.databind.node.ObjectNode;
-
-import uk.org.taverna.configuration.app.ApplicationConfiguration;
-import org.apache.taverna.scufl2.api.core.Processor;
-import org.apache.taverna.scufl2.api.profiles.Profile;
-
-import net.sf.taverna.t2.workbench.edits.EditManager;
-import net.sf.taverna.t2.workbench.file.FileManager;
-import net.sf.taverna.t2.workbench.helper.HelpEnabledDialog;
-
-/**
- * @author Alan R Williams
- * @author Stian Soiland-Reyes
- *
- */
-@SuppressWarnings("serial")
-public class LoopConfigureAction extends AbstractAction {
-
-	private static Logger logger = Logger.getLogger(LoopConfigureAction.class);
-
-	private final EditManager editManager;
-	private final FileManager fileManager;
-
-	private final Frame owner;
-	private final ObjectNode loopLayer;
-	private final LoopContextualView contextualView;
-	private final Processor processor;
-    private final Profile profile;
-
-    private ApplicationConfiguration applicationConfig;
-
-
-    protected LoopConfigureAction(Frame owner,
-            LoopContextualView contextualView, Processor processor,
-            ObjectNode loopLayer, Profile profile, EditManager editManager,
-            FileManager fileManager, ApplicationConfiguration applicationConfig) {
-		super("Configure");
-		this.owner = owner;
-		this.contextualView = contextualView;
-		this.loopLayer = loopLayer;
-        this.profile = profile;
-		this.editManager = editManager;
-		this.fileManager = fileManager;
-		this.processor = processor;
-        this.applicationConfig = applicationConfig;
-	}
-
-	public void actionPerformed(ActionEvent e) {
-		String title = "Looping for service " + processor.getName();
-		final JDialog dialog = new HelpEnabledDialog(owner, title, true);
-        LoopConfigurationPanel loopConfigurationPanel = new LoopConfigurationPanel(
-                processor, loopLayer, profile, applicationConfig);
-		dialog.add(loopConfigurationPanel, BorderLayout.CENTER);
-
-		JPanel buttonPanel = new JPanel();
-		buttonPanel.setLayout(new FlowLayout());
-
-		JButton okButton = new JButton(new OKAction(dialog, loopConfigurationPanel));
-		buttonPanel.add(okButton);
-
-		JButton resetButton = new JButton(new ResetAction(loopConfigurationPanel));
-		buttonPanel.add(resetButton);
-
-		JButton cancelButton = new JButton(new CancelAction(dialog));
-		buttonPanel.add(cancelButton);
-
-		dialog.add(buttonPanel, BorderLayout.SOUTH);
-		dialog.pack();
-		dialog.setSize(650, 430);
-		dialog.setLocationRelativeTo(null);
-		dialog.setVisible(true);
-	}
-
-	protected class CancelAction extends AbstractAction {
-		private final JDialog dialog;
-
-		protected CancelAction(JDialog dialog) {
-			super("Cancel");
-			this.dialog = dialog;
-		}
-
-		public void actionPerformed(ActionEvent e) {
-			dialog.setVisible(false);
-			if (contextualView != null) {
-				contextualView.refreshView();
-			}
-		}
-
-	}
-
-	protected class OKAction extends AbstractAction {
-		private final JDialog dialog;
-		private final LoopConfigurationPanel loopConfigurationPanel;
-
-		protected OKAction(JDialog dialog, LoopConfigurationPanel loopConfigurationPanel) {
-			super("OK");
-			this.dialog = dialog;
-			this.loopConfigurationPanel = loopConfigurationPanel;
-		}
-
-		public void actionPerformed(ActionEvent e) {
-			try {
-
-				List<Edit<?>> compoundEdit = new ArrayList<Edit<?>>();
-				LoopConfiguration configuration = loopConfigurationPanel.getConfiguration();
-				compoundEdit.add(edits.getConfigureEdit(loopLayer, configuration));
-				compoundEdit.addAll(checkPortMappings(configuration.getCondition()));
-
-				editManager.doDataflowEdit(fileManager.getCurrentDataflow(), new CompoundEdit(
-						compoundEdit));
-				dialog.setVisible(false);
-				if (contextualView != null) {
-					contextualView.refreshView();
-				}
-			} catch (RuntimeException ex) {
-				logger.warn("Could not configure looping", ex);
-				JOptionPane.showMessageDialog(owner, "Could not configure looping",
-						"An error occured when configuring looping: " + ex.getMessage(),
-						JOptionPane.ERROR_MESSAGE);
-			} catch (EditException ex) {
-				logger.warn("Could not configure looping", ex);
-				JOptionPane.showMessageDialog(owner, "Could not configure looping",
-						"An error occured when configuring looping: " + ex.getMessage(),
-						JOptionPane.ERROR_MESSAGE);
-			}
-		}
-
-		protected List<Edit<?>> checkPortMappings(Activity<?> conditionActivity) {
-
-			List<Edit<?>> compoundEdit = new ArrayList<Edit<?>>();
-			if (processor.getActivityList().isEmpty()) {
-				return compoundEdit;
-			}
-			Set<String> newInputs = new HashSet<String>();
-			Set<String> newOutputs = new HashSet<String>();
-
-			Activity<?> firstProcessorActivity;
-			firstProcessorActivity = processor.getActivityList().get(0);
-			if (conditionActivity != null) {
-				for (OutputPort condOutPort : conditionActivity.getOutputPorts()) {
-					String portName = condOutPort.getName();
-					Map<String, String> mapping = firstProcessorActivity.getInputPortMapping();
-					if (!mapping.containsKey(portName)) {
-						if (mapping.containsKey(portName)) {
-							logger.warn("Can't re-map input for " + "conditional output "
-									+ portName);
-						}
-						for (InputPort inputPort : firstProcessorActivity.getInputPorts()) {
-							if (inputPort.equals(portName)) {
-								Edit<Activity<?>> edit = edits.getAddActivityInputPortMappingEdit(
-										firstProcessorActivity, portName, portName);
-								compoundEdit.add(edit);
-								newInputs.add(portName);
-							}
-						}
-					}
-				}
-				for (InputPort condInPort : conditionActivity.getInputPorts()) {
-					String portName = condInPort.getName();
-					Map<String, String> mapping = firstProcessorActivity.getOutputPortMapping();
-					if (!mapping.containsValue(portName)) {
-						for (OutputPort outputPort : firstProcessorActivity.getOutputPorts()) {
-							if (outputPort.equals(portName)) {
-								if (mapping.containsKey(portName)) {
-									logger.warn("Can't re-map output for " + "conditional input "
-											+ portName);
-								}
-								Edit<Activity<?>> edit = edits.getAddActivityOutputPortMappingEdit(
-										firstProcessorActivity, portName, portName);
-								logger.info("Mapping for conditional non-outgoing activity port binding "
-										+ portName);
-								compoundEdit.add(edit);
-								newOutputs.add(portName);
-							}
-						}
-					}
-				}
-			}
-			// Remove any stale bindings that no longer match neither
-			// conditional activity or the processor output ports
-			for (String processorIn : firstProcessorActivity.getInputPortMapping().keySet()) {
-				if (newInputs.contains(processorIn)) {
-					continue;
-				}
-				boolean foundMatch = false;
-				for (InputPort processorPort : processor.getInputPorts()) {
-					if (processorPort.getName().equals(processorIn)) {
-						foundMatch = true;
-						break;
-					}
-				}
-				if (!foundMatch) {
-					Edit<Activity<?>> edit = edits.getRemoveActivityInputPortMappingEdit(
-							firstProcessorActivity, processorIn);
-					logger.info("Removing stale input port binding " + processorIn);
-					compoundEdit.add(edit);
-				}
-			}
-			for (String processorOut : firstProcessorActivity.getOutputPortMapping().keySet()) {
-				if (newInputs.contains(processorOut)) {
-					continue;
-				}
-				boolean foundMatch = false;
-				for (OutputPort processorPort : processor.getOutputPorts()) {
-					if (processorPort.getName().equals(processorOut)) {
-						foundMatch = true;
-						break;
-					}
-				}
-				if (!foundMatch) {
-					Edit<Activity<?>> edit = edits.getRemoveActivityOutputPortMappingEdit(
-							firstProcessorActivity, processorOut);
-					logger.info("Removing stale output port binding " + processorOut);
-					compoundEdit.add(edit);
-				}
-			}
-
-			return compoundEdit;
-		}
-	}
-
-	protected class ResetAction extends AbstractAction {
-		private LoopConfigurationPanel loopConfigurationPanel;
-
-		protected ResetAction(LoopConfigurationPanel loopConfigurationPanel) {
-			super("Reset");
-			this.loopConfigurationPanel = loopConfigurationPanel;
-		}
-
-		public void actionPerformed(ActionEvent e) {
-			if (contextualView != null) {
-				contextualView.refreshView();
-			}
-			loopConfigurationPanel.setConfiguration(loopLayer.getConfiguration());
-		}
-
-	}
-
-}


[46/51] [partial] incubator-taverna-workbench git commit: all packages are moved to org.apache.taverna.*

Posted by re...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-ui/src/main/java/net/sf/taverna/t2/workbench/ui/servicepanel/config/ServiceDescriptionConfigUIFactory.java
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-ui/src/main/java/net/sf/taverna/t2/workbench/ui/servicepanel/config/ServiceDescriptionConfigUIFactory.java b/taverna-activity-palette-ui/src/main/java/net/sf/taverna/t2/workbench/ui/servicepanel/config/ServiceDescriptionConfigUIFactory.java
deleted file mode 100644
index 8746b54..0000000
--- a/taverna-activity-palette-ui/src/main/java/net/sf/taverna/t2/workbench/ui/servicepanel/config/ServiceDescriptionConfigUIFactory.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * 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.servicepanel.config;
-
-import javax.swing.JPanel;
-
-import uk.org.taverna.configuration.Configurable;
-import uk.org.taverna.configuration.ConfigurationUIFactory;
-
-import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionRegistry;
-import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionsConfiguration;
-
-public class ServiceDescriptionConfigUIFactory implements ConfigurationUIFactory {
-	private ServiceDescriptionsConfiguration serviceDescriptionsConfiguration;
-	private ServiceDescriptionRegistry serviceDescriptionRegistry;
-
-	@Override
-	public boolean canHandle(String uuid) {
-		return uuid.equals(serviceDescriptionsConfiguration.getUUID());
-	}
-
-	@Override
-	public Configurable getConfigurable() {
-		return serviceDescriptionsConfiguration;
-	}
-
-	@Override
-	public JPanel getConfigurationPanel() {
-		return new ServiceDescriptionConfigPanel(serviceDescriptionsConfiguration, serviceDescriptionRegistry);
-	}
-
-	public void setServiceDescriptionRegistry(ServiceDescriptionRegistry serviceDescriptionRegistry) {
-		this.serviceDescriptionRegistry = serviceDescriptionRegistry;
-	}
-
-	public void setServiceDescriptionsConfiguration(ServiceDescriptionsConfiguration serviceDescriptionsConfiguration) {
-		this.serviceDescriptionsConfiguration = serviceDescriptionsConfiguration;
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-ui/src/main/java/net/sf/taverna/t2/workbench/ui/servicepanel/menu/AddServiceProviderMenu.java
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-ui/src/main/java/net/sf/taverna/t2/workbench/ui/servicepanel/menu/AddServiceProviderMenu.java b/taverna-activity-palette-ui/src/main/java/net/sf/taverna/t2/workbench/ui/servicepanel/menu/AddServiceProviderMenu.java
deleted file mode 100644
index f975778..0000000
--- a/taverna-activity-palette-ui/src/main/java/net/sf/taverna/t2/workbench/ui/servicepanel/menu/AddServiceProviderMenu.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*******************************************************************************
- * 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.servicepanel.menu;
-
-import java.awt.Component;
-import java.awt.event.ActionEvent;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.List;
-
-import javax.swing.AbstractAction;
-import javax.swing.JButton;
-import javax.swing.JPopupMenu;
-
-import net.sf.taverna.t2.servicedescriptions.ConfigurableServiceProvider;
-import net.sf.taverna.t2.servicedescriptions.ServiceDescription;
-import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionProvider;
-import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionRegistry;
-import net.sf.taverna.t2.workbench.ui.servicepanel.ServicePanel;
-import net.sf.taverna.t2.workbench.ui.servicepanel.actions.AddServiceProviderAction;
-
-/**
- * A menu that provides a set up menu actions for adding new service providers
- * to the Service Panel.
- * <p>
- * The Actions are discovered from the {@link ServiceDescriptionProvider}s found
- * through the SPI.
- *
- * @author Stuart Owen
- * @author Stian Soiland-Reyes
- * @author Alan R Williams
- *
- * @see ServiceDescription
- * @see ServicePanel
- * @see ServiceDescriptionRegistry#addServiceDescriptionProvider(ServiceDescriptionProvider)
- */
-@SuppressWarnings("serial")
-public class AddServiceProviderMenu extends JButton {
-	public static class ServiceProviderComparator implements
-			Comparator<ServiceDescriptionProvider> {
-		@Override
-		public int compare(ServiceDescriptionProvider o1,
-				ServiceDescriptionProvider o2) {
-			return o1.getName().toLowerCase().compareTo(
-					o2.getName().toLowerCase());
-		}
-	}
-
-	private final static String ADD_SERVICE_PROVIDER_MENU_NAME = "Import new services";
-
-	private final ServiceDescriptionRegistry serviceDescriptionRegistry;
-
-	public AddServiceProviderMenu(ServiceDescriptionRegistry serviceDescriptionRegistry) {
-		super();
-		this.serviceDescriptionRegistry = serviceDescriptionRegistry;
-
-		final Component c = createCustomComponent();
-		setAction(new AbstractAction(ADD_SERVICE_PROVIDER_MENU_NAME) {
-			@Override
-			public void actionPerformed(ActionEvent e) {
-				((JPopupMenu) c).show(AddServiceProviderMenu.this, 0,
-						AddServiceProviderMenu.this.getHeight());
-			}
-		});
-	}
-
-	private Component createCustomComponent() {
-		JPopupMenu addServiceMenu = new JPopupMenu(
-				ADD_SERVICE_PROVIDER_MENU_NAME);
-		addServiceMenu.setToolTipText("Add a new service provider");
-		boolean isEmpty = true;
-		List<ConfigurableServiceProvider> providers = new ArrayList<>(
-				serviceDescriptionRegistry.getUnconfiguredServiceProviders());
-		Collections.sort(providers,  new ServiceProviderComparator());
-		for (ConfigurableServiceProvider provider : providers) {
-			/*
-			 * Skip BioCatalogue's ConfigurableServiceProviderS as they should
-			 * not be used to add servcie directlry but rather though the
-			 * Service Catalogue perspective
-			 */
-			if (provider.getId().toLowerCase().contains("servicecatalogue"))
-				continue;
-
-			AddServiceProviderAction addAction = new AddServiceProviderAction(
-					provider, this);
-			addAction.setServiceDescriptionRegistry(serviceDescriptionRegistry);
-			addServiceMenu.add(addAction);
-			isEmpty = false;
-		}
-		if (isEmpty)
-			addServiceMenu.setEnabled(false);
-		return addServiceMenu;
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-ui/src/main/java/net/sf/taverna/t2/workbench/ui/servicepanel/tree/Filter.java
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-ui/src/main/java/net/sf/taverna/t2/workbench/ui/servicepanel/tree/Filter.java b/taverna-activity-palette-ui/src/main/java/net/sf/taverna/t2/workbench/ui/servicepanel/tree/Filter.java
deleted file mode 100644
index e67e8f5..0000000
--- a/taverna-activity-palette-ui/src/main/java/net/sf/taverna/t2/workbench/ui/servicepanel/tree/Filter.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*******************************************************************************
- * 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.workbench.ui.servicepanel.tree;
-
-import javax.swing.tree.DefaultMutableTreeNode;
-
-public interface Filter {
-	boolean pass(DefaultMutableTreeNode node);
-
-	String filterRepresentation(String original);
-
-	void setSuperseded(boolean superseded);
-
-	boolean isSuperseded();
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-ui/src/main/java/net/sf/taverna/t2/workbench/ui/servicepanel/tree/FilterTreeCellRenderer.java
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-ui/src/main/java/net/sf/taverna/t2/workbench/ui/servicepanel/tree/FilterTreeCellRenderer.java b/taverna-activity-palette-ui/src/main/java/net/sf/taverna/t2/workbench/ui/servicepanel/tree/FilterTreeCellRenderer.java
deleted file mode 100644
index 21f43c5..0000000
--- a/taverna-activity-palette-ui/src/main/java/net/sf/taverna/t2/workbench/ui/servicepanel/tree/FilterTreeCellRenderer.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*******************************************************************************
- * 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.workbench.ui.servicepanel.tree;
-
-import static net.sf.taverna.t2.workbench.icons.WorkbenchIcons.folderClosedIcon;
-import static net.sf.taverna.t2.workbench.icons.WorkbenchIcons.folderOpenIcon;
-
-import java.awt.Component;
-
-import javax.swing.JTree;
-import javax.swing.tree.DefaultTreeCellRenderer;
-
-@SuppressWarnings("serial")
-public class FilterTreeCellRenderer extends DefaultTreeCellRenderer {
-	private Filter filter = null;
-
-	@Override
-	public Component getTreeCellRendererComponent(JTree tree, Object value,
-			boolean sel, boolean expanded, boolean leaf, int row,
-			boolean hasFocus) {
-
-		super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf,
-				row, hasFocus);
-		Filter filter = getFilter();
-		if (filter != null)
-			setText(filter.filterRepresentation(getText()));
-		if (expanded)
-			setIcon(folderOpenIcon);
-		else
-			setIcon(folderClosedIcon);
-		return this;
-	}
-
-	public Filter getFilter() {
-		return filter;
-	}
-
-	public void setFilter(Filter currentFilter) {
-		this.filter = currentFilter;
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-ui/src/main/java/net/sf/taverna/t2/workbench/ui/servicepanel/tree/FilterTreeModel.java
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-ui/src/main/java/net/sf/taverna/t2/workbench/ui/servicepanel/tree/FilterTreeModel.java b/taverna-activity-palette-ui/src/main/java/net/sf/taverna/t2/workbench/ui/servicepanel/tree/FilterTreeModel.java
deleted file mode 100644
index 191ed66..0000000
--- a/taverna-activity-palette-ui/src/main/java/net/sf/taverna/t2/workbench/ui/servicepanel/tree/FilterTreeModel.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*******************************************************************************
- * 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.workbench.ui.servicepanel.tree;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.swing.tree.DefaultTreeModel;
-import javax.swing.tree.TreePath;
-
-import org.apache.log4j.Logger;
-
-public final class FilterTreeModel extends DefaultTreeModel {
-	private static final long serialVersionUID = -8931308369832839862L;
-	private static final Logger logger = Logger
-			.getLogger(FilterTreeModel.class);
-	
-	Filter currentFilter;
-
-	public FilterTreeModel(FilterTreeNode node) {
-		this(node, null);
-	}
-	
-	public FilterTreeModel(FilterTreeNode node, Filter filter) {
-		super(node);
-		currentFilter = filter;
-		node.setFilter(filter);
-	}
-
-	public void setFilter(Filter filter) {
-		if (root != null) {
-			currentFilter = filter;
-			((FilterTreeNode) root).setFilter(filter);
-			Object[] path = { root };
-			fireTreeStructureChanged(this, path, null, null);
-		}
-	}
-
-	@Override
-	public int getChildCount(Object parent) {
-		if (parent instanceof FilterTreeNode)
-			return (((FilterTreeNode) parent).getChildCount());
-		return 0;
-	}
-
-	@Override
-	public Object getChild(Object parent, int index) {
-		if (parent instanceof FilterTreeNode)
-			return (((FilterTreeNode) parent).getChildAt(index));
-		return null;
-	}
-
-	/**
-	 * @return the currentFilter
-	 */
-	public Filter getCurrentFilter() {
-		return currentFilter;
-	}
-
-	public TreePath getTreePathForObjectPath(List<Object> path) {
-		List<FilterTreeNode> resultList = new ArrayList<>();
-		FilterTreeNode current = (FilterTreeNode) root;
-		resultList.add(current);
-		for (int i = 1; (i < path.size()) && (current != null); i++) {
-			logger.debug("Looking in " + current.getUserObject() + " for " + path.get(i));
-			current = current.getChildForObject(path.get(i));
-			if (current != null)
-				resultList.add(current);
-		}
-		if (current != null)
-			return new TreePath(resultList.toArray());
-		return null;
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-ui/src/main/java/net/sf/taverna/t2/workbench/ui/servicepanel/tree/FilterTreeNode.java
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-ui/src/main/java/net/sf/taverna/t2/workbench/ui/servicepanel/tree/FilterTreeNode.java b/taverna-activity-palette-ui/src/main/java/net/sf/taverna/t2/workbench/ui/servicepanel/tree/FilterTreeNode.java
deleted file mode 100644
index 83fd439..0000000
--- a/taverna-activity-palette-ui/src/main/java/net/sf/taverna/t2/workbench/ui/servicepanel/tree/FilterTreeNode.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*******************************************************************************
- * 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.workbench.ui.servicepanel.tree;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import javax.swing.tree.DefaultMutableTreeNode;
-
-import org.apache.log4j.Logger;
-
-public class FilterTreeNode extends DefaultMutableTreeNode {
-	private static final long serialVersionUID = 1933553584349932151L;
-	@SuppressWarnings("unused")
-	private static Logger logger = Logger.getLogger(FilterTreeNode.class);
-	
-	private Filter filter;
-	private boolean passed = true;
-	private List<FilterTreeNode> filteredChildren = new ArrayList<>();
-
-	public FilterTreeNode(Object userObject) {
-		super(userObject);
-		userObject.toString();
-	}
-
-	public Filter getFilter() {
-		return filter;
-	}
-	
-	public void setFilter(Filter filter) {
-		if ((filter == null) || !filter.isSuperseded()) {
-			this.filter = filter;
-			passed = false;
-			filteredChildren.clear();
-			if (filter == null) {
-				passed = true;
-				passFilterDown(null);
-			} else if (filter.pass(this)) {
-				passed = true;
-				passFilterDown(null);
-			} else {
-				passFilterDown(filter);
-				passed = filteredChildren.size() != 0;
-			}
-		}
-	}
-
-	private void passFilterDown(Filter filter) {
-		int realChildCount = super.getChildCount();
-		for (int i = 0; i < realChildCount; i++) {
-			FilterTreeNode realChild = (FilterTreeNode) super.getChildAt(i);
-			realChild.setFilter(filter);
-			if (realChild.isPassed())
-				filteredChildren.add(realChild);
-		}
-	}
-
-	public void add(FilterTreeNode node) {
-		super.add(node);
-		node.setFilter(filter);
-		// TODO work up
-		if (node.isPassed())
-			filteredChildren.add(node);
-	}
-	
-	@Override
-	public void remove(int childIndex) {
-		if (filter != null)
-			// as child indexes might be inconsistent..
-			throw new IllegalStateException("Can't remove while the filter is active");
-		super.remove(childIndex);
-	}
-
-	@Override
-	public int getChildCount() {
-		if (filter == null)
-			return super.getChildCount();
-		return filteredChildren.size();
-	}
-
-	@Override
-	public FilterTreeNode getChildAt(int index) {
-		if (filter == null)
-			return (FilterTreeNode) super.getChildAt(index);
-		return filteredChildren.get(index);
-	}
-
-	public boolean isPassed() {
-		return passed;
-	}
-	
-	public Set<FilterTreeNode> getLeaves() {
-		Set<FilterTreeNode> result = new HashSet<>();
-		if (super.getChildCount() == 0) {
-			result.add(this);
-			return result;
-		}
-
-		for (int i = 0; i < super.getChildCount(); i++) {
-			FilterTreeNode child = (FilterTreeNode) super.getChildAt(i);
-			result.addAll(child.getLeaves());
-		}
-		return result;
-	}
-
-	public FilterTreeNode getChildForObject(Object userObject) {
-		FilterTreeNode result = null;
-		for (int i=0; (i < super.getChildCount()) && (result == null); i++) {
-			FilterTreeNode child = (FilterTreeNode) super.getChildAt(i);
-			Object nodeObject = child.getUserObject();
-//			logger.info("nodeObject is a " + nodeObject.getClass() + " - " +
-//					"userObject is a " + userObject.getClass());
-			if (nodeObject.toString().equals(userObject.toString())) {
-				result = child;
-//				logger.info(nodeObject + " is equal to " + userObject);
-//			} else {
-//				logger.info(nodeObject + " is not equal to " + userObject);
-			}
-		}
-		return result;
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-ui/src/main/java/net/sf/taverna/t2/workbench/ui/servicepanel/tree/FilterTreeSelectionModel.java
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-ui/src/main/java/net/sf/taverna/t2/workbench/ui/servicepanel/tree/FilterTreeSelectionModel.java b/taverna-activity-palette-ui/src/main/java/net/sf/taverna/t2/workbench/ui/servicepanel/tree/FilterTreeSelectionModel.java
deleted file mode 100644
index a5adfe9..0000000
--- a/taverna-activity-palette-ui/src/main/java/net/sf/taverna/t2/workbench/ui/servicepanel/tree/FilterTreeSelectionModel.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*******************************************************************************
- * 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.servicepanel.tree;
-
-import javax.swing.tree.DefaultTreeSelectionModel;
-import javax.swing.tree.TreePath;
-import javax.swing.tree.TreeSelectionModel;
-
-public class FilterTreeSelectionModel extends DefaultTreeSelectionModel{
-	private static final long serialVersionUID = 3127644524735089630L;
-	
-	public FilterTreeSelectionModel(){
-		super();
-		setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
-	}
-	
-	@Override
-	public void setSelectionPath(TreePath path) {
-		/*
-		 * Nothing happens here - only calls to mySetSelectionPath() will have
-		 * the effect of a node being selected.
-		 */
-	}
-	
-	public void mySetSelectionPath(TreePath path) {
-		super.setSelectionPath(path);
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-ui/src/main/java/net/sf/taverna/t2/workbench/ui/servicepanel/tree/MyFilter.java
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-ui/src/main/java/net/sf/taverna/t2/workbench/ui/servicepanel/tree/MyFilter.java b/taverna-activity-palette-ui/src/main/java/net/sf/taverna/t2/workbench/ui/servicepanel/tree/MyFilter.java
deleted file mode 100644
index 8baa0eb..0000000
--- a/taverna-activity-palette-ui/src/main/java/net/sf/taverna/t2/workbench/ui/servicepanel/tree/MyFilter.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*******************************************************************************
- * 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.workbench.ui.servicepanel.tree;
-
-import javax.swing.tree.DefaultMutableTreeNode;
-
-public class MyFilter implements Filter {
-	private static final String HTML_MATCH_END = "</font><font color=\"black\">";
-	private static final String HTML_MATCH_START = "</font><font color=\"red\">";
-	private static final String HTML_POSTFIX = "</font></html>";
-	private static final String HTML_PREFIX = "<html><font color=\"black\">";
-
-	private String filterString;
-	private boolean superseded;
-	private String filterLowerCase;
-
-	public MyFilter(String filterString) {
-		this.filterString = filterString;
-		this.filterLowerCase = filterString.toLowerCase();
-		this.superseded = false;
-	}
-
-	private boolean basicFilter(DefaultMutableTreeNode node) {
-		if (filterString.isEmpty())
-			return true;
-		return node.getUserObject().toString().toLowerCase()
-				.contains(filterLowerCase);
-	}
-
-	@Override
-	public boolean pass(DefaultMutableTreeNode node) {
-		return basicFilter(node);
-	}
-
-	@Override
-	public String filterRepresentation(String original) {
-		StringBuilder sb = new StringBuilder(HTML_PREFIX);
-		int from = 0;
-		String originalLowerCase = original.toLowerCase();
-		int index = originalLowerCase.indexOf(filterLowerCase, from);
-		while (index > -1) {
-			sb.append(original.substring(from, index));
-			sb.append(HTML_MATCH_START);
-			sb.append(original.substring(index,
-					index + filterLowerCase.length()));
-			sb.append(HTML_MATCH_END);
-			from = index + filterLowerCase.length();
-			index = originalLowerCase.indexOf(filterLowerCase, from);
-		}
-		if (from < original.length())
-			sb.append(original.substring(from, original.length()));
-		return sb.append(HTML_POSTFIX).toString();
-	}
-
-	/**
-	 * @return the superseded
-	 */
-	@Override
-	public boolean isSuperseded() {
-		return superseded;
-	}
-
-	/**
-	 * @param superseded
-	 *            the superseded to set
-	 */
-	@Override
-	public void setSuperseded(boolean superseded) {
-		this.superseded = superseded;
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-ui/src/main/java/net/sf/taverna/t2/workbench/ui/servicepanel/tree/TreePanel.java
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-ui/src/main/java/net/sf/taverna/t2/workbench/ui/servicepanel/tree/TreePanel.java b/taverna-activity-palette-ui/src/main/java/net/sf/taverna/t2/workbench/ui/servicepanel/tree/TreePanel.java
deleted file mode 100644
index 46eca53..0000000
--- a/taverna-activity-palette-ui/src/main/java/net/sf/taverna/t2/workbench/ui/servicepanel/tree/TreePanel.java
+++ /dev/null
@@ -1,371 +0,0 @@
-/*******************************************************************************
- * 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.workbench.ui.servicepanel.tree;
-
-import static java.awt.BorderLayout.CENTER;
-import static java.awt.BorderLayout.NORTH;
-import static java.awt.BorderLayout.WEST;
-import static java.awt.Color.GRAY;
-import static java.awt.GridBagConstraints.HORIZONTAL;
-import static java.awt.GridBagConstraints.NONE;
-import static javax.swing.SwingUtilities.invokeLater;
-import static net.sf.taverna.t2.lang.ui.EdgeLineBorder.TOP;
-
-import java.awt.BorderLayout;
-import java.awt.Component;
-import java.awt.GridBagConstraints;
-import java.awt.GridBagLayout;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.KeyAdapter;
-import java.awt.event.KeyEvent;
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import java.util.Timer;
-import java.util.TimerTask;
-
-import javax.swing.JButton;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTextField;
-import javax.swing.JTree;
-import javax.swing.border.CompoundBorder;
-import javax.swing.border.EmptyBorder;
-import javax.swing.event.TreeExpansionEvent;
-import javax.swing.event.TreeExpansionListener;
-import javax.swing.tree.TreeCellRenderer;
-import javax.swing.tree.TreePath;
-
-import net.sf.taverna.t2.lang.ui.EdgeLineBorder;
-
-import org.apache.log4j.Logger;
-
-@SuppressWarnings("serial")
-public abstract class TreePanel extends JPanel {
-	private static int MAX_EXPANSION = 100;
-	private static final int SEARCH_WIDTH = 15;
-	private static Logger logger = Logger.getLogger(TreePanel.class);
-
-	protected Set<List<Object>> expandedPaths = new HashSet<>();
-	protected FilterTreeModel filterTreeModel;
-	protected JTextField searchField = new JTextField(SEARCH_WIDTH);
-	protected JTree tree = new JTree();
-	protected JScrollPane treeScrollPane;
-
-	private String availableObjectsString = "";
-	private String matchingObjectsString = "";
-	private String noMatchingObjectsString = "";
-
-	private TreeExpandCollapseListener treeExpandListener = new TreeExpandCollapseListener();
-	private Object filterLock = new Object();
-
-	public TreePanel(FilterTreeModel treeModel) {
-		filterTreeModel = treeModel;
-	}
-
-	public void expandTreePaths() throws InterruptedException,
-			InvocationTargetException {
-//		Filter appliedFilter = filterTreeModel.getCurrentFilter();
-//		if (appliedFilter == null) {
-			for (int i = 0; (i < tree.getRowCount()) && (i < MAX_EXPANSION); i++)
-				tree.expandRow(i);
-//		} else {
-//			boolean rowsFinished = false;
-//			for (int i = 0; (!appliedFilter.isSuperseded()) && (!rowsFinished)
-//					&& (i < MAX_EXPANSION); i++) {
-//				TreePath tp = tree.getPathForRow(i);
-//				if (tp == null) {
-//					rowsFinished = true;
-//				} else {
-//					if (!appliedFilter.pass((DefaultMutableTreeNode) tp
-//							.getLastPathComponent())) {
-//						tree.expandRow(i);
-//					}
-//				}
-//			}
-//		}
-	}
-
-	public void expandAll(FilterTreeNode node, boolean expand) {
-        @SuppressWarnings("unused")
-		FilterTreeNode root = (FilterTreeNode) tree.getModel().getRoot();
-
-        // Traverse tree from root
-        expandAll(new TreePath(node.getPath()), expand);
-    }
-
-    @SuppressWarnings("rawtypes")
-	private void expandAll(TreePath parent, boolean expand) {
-        // Traverse children
-        FilterTreeNode node = (FilterTreeNode) parent.getLastPathComponent();
-        if (node.getChildCount() >= 0)
-            for (Enumeration e=node.children(); e.hasMoreElements(); ) {
-                FilterTreeNode n = (FilterTreeNode) e.nextElement();
-                TreePath path = parent.pathByAddingChild(n);
-                expandAll(path, expand);
-            }
-
-        // Expansion or collapse must be done bottom-up
-        if (expand)
-            tree.expandPath(parent);
-        else
-            tree.collapsePath(parent);
-    }
-
-	protected void initialize() {
-		setLayout(new BorderLayout());
-		treeScrollPane = new JScrollPane(tree);
-		tree.setModel(filterTreeModel);
-		tree.addTreeExpansionListener(treeExpandListener);
-		tree.setCellRenderer(createCellRenderer());
-		tree.setSelectionModel(new FilterTreeSelectionModel());
-
-		JPanel topPanel = new JPanel();
-		topPanel.setBorder(new CompoundBorder(new EdgeLineBorder(TOP, GRAY), new EmptyBorder(10, 5, 0, 5)));
-		topPanel.setLayout(new GridBagLayout());
-		GridBagConstraints c = new GridBagConstraints();
-
-		JLabel filterLabel = new JLabel("Filter:  ");
-		c.fill = NONE;
-		c.gridx = 0;
-		c.gridy = 0;
-		c.weightx = 0.0;
-		c.anchor = GridBagConstraints.LINE_START;
-		topPanel.add(filterLabel, c);
-
-		c.fill = HORIZONTAL;
-		c.gridx = 1;
-		c.gridy = 0;
-		c.weightx = 1.0;
-		topPanel.add(searchField, c);
-
-
-		c.fill = NONE;
-		c.gridx = 2;
-		c.gridy = 0;
-		c.weightx = 0.0;
-		final JButton clearButton = new JButton("Clear");
-		clearButton.addActionListener(new ActionListener() {
-			@Override
-			public void actionPerformed(ActionEvent e) {
-				searchField.setText("");
-				invokeLater(new RunFilter());
-				clearButton.getParent().requestFocusInWindow();// so that the button does not stay focused after it is clicked on and did its action
-			}
-		});
-		topPanel.add(clearButton, c);
-
-		c.gridx = 3;
-		c.weightx = 0.2;
-		topPanel.add(new JPanel(), c);
-
-		JPanel topExtraPanel = new JPanel(new BorderLayout());
-
-		topExtraPanel.add(topPanel, NORTH);
-
-		Component extraComponent = createExtraComponent();
-		if (extraComponent != null) {
-			JPanel extraPanel  = new JPanel();
-			extraPanel.setLayout(new BorderLayout());
-			extraPanel.add(extraComponent, WEST);
-			topExtraPanel.add(extraPanel, CENTER);
-		}
-
-		add(topExtraPanel, NORTH);
-		add(treeScrollPane, CENTER);
-
-		searchField.addKeyListener(new SearchFieldKeyAdapter());
-	}
-
-	protected Component createExtraComponent() {
-		return null;
-	}
-
-	protected TreeCellRenderer createCellRenderer() {
-		return new FilterTreeCellRenderer();
-	}
-
-	public void runFilter() throws InterruptedException,
-			InvocationTargetException {
-		/*
-		 * Special lock object, don't do a synchronized model, as the lock on
-		 * JComponent might deadlock when painting the panel - see comments at
-		 * http://www.mygrid.org.uk/dev/issues/browse/T2-1438
-		 */
-		synchronized (filterLock) {
-			tree.removeTreeExpansionListener(treeExpandListener);
-			String text = searchField.getText();
-			FilterTreeNode root = (FilterTreeNode) tree.getModel().getRoot();
-			if (text.isEmpty()) {
-				setFilter(null);
-				root.setUserObject(getAvailableObjectsString());
-				filterTreeModel.nodeChanged(root);
-				for (List<Object> tp : expandedPaths) {
-	//				for (int i = 0; i < tp.length; i++)
-	//					logger.info("Trying to expand " + tp[i]);
-					tree.expandPath(filterTreeModel.getTreePathForObjectPath(tp));
-				}
-			} else {
-				setFilter(createFilter(text));
-				root.setUserObject(root.getChildCount() > 0 ? getMatchingObjectsString()
-						: getNoMatchingObjectsString());
-				filterTreeModel.nodeChanged(root);
-				expandTreePaths();
-			}
-			tree.addTreeExpansionListener(treeExpandListener);
-		}
-	}
-
-	/**
-	 * @return the availableObjectsString
-	 */
-	public String getAvailableObjectsString() {
-		return availableObjectsString;
-	}
-
-	/**
-	 * @param availableObjectsString the availableObjectsString to set
-	 */
-	public void setAvailableObjectsString(String availableObjectsString) {
-		this.availableObjectsString = availableObjectsString;
-	}
-
-	/**
-	 * @return the matchingObjectsString
-	 */
-	public String getMatchingObjectsString() {
-		return matchingObjectsString;
-	}
-
-	/**
-	 * @param matchingObjectsString the matchingObjectsString to set
-	 */
-	public void setMatchingObjectsString(String matchingObjectsString) {
-		this.matchingObjectsString = matchingObjectsString;
-	}
-
-	/**
-	 * @return the noMatchingObjectsString
-	 */
-	public String getNoMatchingObjectsString() {
-		return noMatchingObjectsString;
-	}
-
-	/**
-	 * @param noMatchingObjectsString the noMatchingObjectsString to set
-	 */
-	public void setNoMatchingObjectsString(String noMatchingObjectsString) {
-		this.noMatchingObjectsString = noMatchingObjectsString;
-	}
-
-	public Filter createFilter(String text) {
-		return new MyFilter(text);
-	}
-
-	public void setFilter(Filter filter) {
-		if (tree.getCellRenderer() instanceof FilterTreeCellRenderer)
-			((FilterTreeCellRenderer)tree.getCellRenderer()).setFilter(filter);
-		filterTreeModel.setFilter(filter);
-	}
-
-	protected class ExpandRowRunnable implements Runnable {
-		int rowNumber;
-
-		public ExpandRowRunnable(int rowNumber) {
-			this.rowNumber = rowNumber;
-		}
-
-		@Override
-		public void run() {
-			tree.expandRow(rowNumber);
-		}
-	}
-
-	protected class RunFilter implements Runnable {
-		@Override
-		public void run() {
-			Filter oldFilter = filterTreeModel.getCurrentFilter();
-			if (oldFilter != null)
-				oldFilter.setSuperseded(true);
-			try {
-				runFilter();
-			} catch (InterruptedException e) {
-				Thread.interrupted();
-			} catch (InvocationTargetException e) {
-				logger.error("", e);
-			}
-		}
-	}
-
-	protected class SearchFieldKeyAdapter extends KeyAdapter {
-		private final Runnable runFilterRunnable;
-		Timer timer = new Timer("Search field timer", true);
-
-		private SearchFieldKeyAdapter() {
-			this.runFilterRunnable = new RunFilter();
-		}
-
-		@Override
-		public void keyReleased(KeyEvent e) {
-			timer.cancel();
-			timer = new Timer();
-			timer.schedule(new TimerTask() {
-				@Override
-				public void run() {
-					invokeLater(runFilterRunnable);
-				}
-			}, 500);
-		}
-	}
-
-	private void noteExpansions() {
-		expandedPaths.clear();
-		TreePath rootPath = new TreePath(filterTreeModel.getRoot());
-		for (Enumeration<TreePath> e = tree.getExpandedDescendants(rootPath); e.hasMoreElements();) {
-			List<Object> userObjects = new ArrayList<>();
-			Object[] expandedPath = e.nextElement().getPath();
-			for (int i = 0; i < expandedPath.length; i++) {
-				FilterTreeNode node = (FilterTreeNode) expandedPath[i];
-//				logger.info("The object in the path is a " + expandedPath[i].getClass());
-				userObjects.add(node.getUserObject());
-//				logger.info("Added " + node.getUserObject() + " to path");
-			}
-			expandedPaths.add(userObjects);
-		}
-	}
-	
-	protected class TreeExpandCollapseListener implements TreeExpansionListener {
-		@Override
-		public void treeCollapsed(TreeExpansionEvent event) {
-			noteExpansions();
-		}
-
-		@Override
-		public void treeExpanded(TreeExpansionEvent event) {
-			noteExpansions();
-		}
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-ui/src/main/java/org/apache/taverna/workbench/ui/servicepanel/PathElementFilterTreeNode.java
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-ui/src/main/java/org/apache/taverna/workbench/ui/servicepanel/PathElementFilterTreeNode.java b/taverna-activity-palette-ui/src/main/java/org/apache/taverna/workbench/ui/servicepanel/PathElementFilterTreeNode.java
new file mode 100644
index 0000000..8a4a247
--- /dev/null
+++ b/taverna-activity-palette-ui/src/main/java/org/apache/taverna/workbench/ui/servicepanel/PathElementFilterTreeNode.java
@@ -0,0 +1,33 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.servicepanel;
+
+import org.apache.taverna.workbench.ui.servicepanel.tree.FilterTreeNode;
+
+/**
+ * @author alanrw
+ */
+public class PathElementFilterTreeNode extends FilterTreeNode {
+	private static final long serialVersionUID = 6491242031931630314L;
+
+	public PathElementFilterTreeNode(String userObject) {
+		super(userObject);
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-ui/src/main/java/org/apache/taverna/workbench/ui/servicepanel/RootFilterTreeNode.java
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-ui/src/main/java/org/apache/taverna/workbench/ui/servicepanel/RootFilterTreeNode.java b/taverna-activity-palette-ui/src/main/java/org/apache/taverna/workbench/ui/servicepanel/RootFilterTreeNode.java
new file mode 100644
index 0000000..8ae210e
--- /dev/null
+++ b/taverna-activity-palette-ui/src/main/java/org/apache/taverna/workbench/ui/servicepanel/RootFilterTreeNode.java
@@ -0,0 +1,33 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.servicepanel;
+
+import org.apache.taverna.workbench.ui.servicepanel.tree.FilterTreeNode;
+
+/**
+ * @author alanrw
+ */
+public class RootFilterTreeNode extends FilterTreeNode {
+	private static final long serialVersionUID = 1047743498806473971L;
+
+	public RootFilterTreeNode(String userObject) {
+		super(userObject);
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-ui/src/main/java/org/apache/taverna/workbench/ui/servicepanel/ServiceFilter.java
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-ui/src/main/java/org/apache/taverna/workbench/ui/servicepanel/ServiceFilter.java b/taverna-activity-palette-ui/src/main/java/org/apache/taverna/workbench/ui/servicepanel/ServiceFilter.java
new file mode 100644
index 0000000..c4dd75a
--- /dev/null
+++ b/taverna-activity-palette-ui/src/main/java/org/apache/taverna/workbench/ui/servicepanel/ServiceFilter.java
@@ -0,0 +1,157 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.servicepanel;
+
+import static java.beans.Introspector.getBeanInfo;
+
+import java.beans.BeanInfo;
+import java.beans.IntrospectionException;
+import java.beans.PropertyDescriptor;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
+import javax.swing.tree.DefaultMutableTreeNode;
+
+import org.apache.taverna.servicedescriptions.ServiceDescription;
+import org.apache.taverna.workbench.ui.servicepanel.tree.Filter;
+
+import org.apache.log4j.Logger;
+
+public class ServiceFilter implements Filter {
+	private static Logger logger = Logger.getLogger(ServiceFilter.class);
+
+	private String filterString;
+	private boolean superseded;
+	private String[] filterLowerCaseSplit;
+	private final Object rootToIgnore;
+
+	public ServiceFilter(String filterString, Object rootToIgnore) {
+		this.filterString = filterString;
+		this.rootToIgnore = rootToIgnore;
+		this.filterLowerCaseSplit = filterString.toLowerCase().split(" ");
+		this.superseded = false;
+	}
+
+	private boolean basicFilter(DefaultMutableTreeNode node) {
+		if (node == rootToIgnore)
+			return false;
+		if (filterString.isEmpty())
+			return true;
+
+		if (node.getUserObject() instanceof ServiceDescription) {
+			ServiceDescription serviceDescription = (ServiceDescription) node
+					.getUserObject();
+			for (String searchTerm : filterLowerCaseSplit) {
+				if (superseded)
+					return false;
+				String[] typeSplit = searchTerm.split(":", 2);
+				String type;
+				String keyword;
+				if (typeSplit.length == 2) {
+					type = typeSplit[0];
+					keyword = typeSplit[1].toLowerCase();
+				} else {
+					type = null;
+					keyword = searchTerm.toLowerCase();
+				}
+				try {
+					if (!doesPropertySatisfy(serviceDescription, type, keyword))
+						return false;
+				} catch (IntrospectionException | IllegalArgumentException
+						| IllegalAccessException | InvocationTargetException e) {
+					logger.error(
+							"failed to get properties of service description",
+							e);
+					return false;
+				}
+			}
+			return true;
+		}
+		for (String searchString : filterLowerCaseSplit)
+			if (!node.getUserObject().toString().toLowerCase().contains(
+					searchString))
+				return false;
+		return true;
+	}
+
+	/**
+	 * Determine whether a service description satisfies a search term.
+	 * 
+	 * @param serviceDescription
+	 *            The service description bean to look in.
+	 * @param type
+	 *            The name of the property to look in, or <tt>null</tt> to
+	 *            search in all public non-expert properties.
+	 * @param searchTerm
+	 *            The string to search for.
+	 * @return <tt>true</tt> if-and-only-if the description matches.
+	 */
+	private boolean doesPropertySatisfy(ServiceDescription serviceDescription,
+			String type, String searchTerm) throws IllegalAccessException,
+			IllegalArgumentException, InvocationTargetException,
+			IntrospectionException {
+		BeanInfo beanInfo = getBeanInfo(serviceDescription.getClass());
+		for (PropertyDescriptor property : beanInfo.getPropertyDescriptors()) {
+			if (superseded)
+				return false;
+			if ((type == null && !property.isHidden() && !property.isExpert())
+					|| property.getName().equalsIgnoreCase(type)) {
+				Method readMethod = property.getReadMethod();
+				if (readMethod == null)
+					continue;
+				Object readProperty = readMethod.invoke(serviceDescription,
+						new Object[0]);
+				if (readProperty == null)
+					continue;
+				if (readProperty.toString().toLowerCase().contains(searchTerm))
+					return true;
+				// Dig deeper?
+			}
+		}
+		return false;
+	}
+
+	@Override
+	public boolean pass(DefaultMutableTreeNode node) {
+		return basicFilter(node);
+	}
+
+	@Override
+	public String filterRepresentation(String original) {
+		return original;
+	}
+
+	/**
+	 * @return the superseded
+	 */
+	@Override
+	public boolean isSuperseded() {
+		return superseded;
+	}
+
+	/**
+	 * @param superseded
+	 *            the superseded to set
+	 */
+	@Override
+	public void setSuperseded(boolean superseded) {
+		this.superseded = superseded;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-ui/src/main/java/org/apache/taverna/workbench/ui/servicepanel/ServiceFilterTreeNode.java
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-ui/src/main/java/org/apache/taverna/workbench/ui/servicepanel/ServiceFilterTreeNode.java b/taverna-activity-palette-ui/src/main/java/org/apache/taverna/workbench/ui/servicepanel/ServiceFilterTreeNode.java
new file mode 100644
index 0000000..ef7811e
--- /dev/null
+++ b/taverna-activity-palette-ui/src/main/java/org/apache/taverna/workbench/ui/servicepanel/ServiceFilterTreeNode.java
@@ -0,0 +1,39 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.servicepanel;
+
+import org.apache.taverna.servicedescriptions.ServiceDescription;
+import org.apache.taverna.workbench.ui.servicepanel.tree.FilterTreeNode;
+
+/**
+ * @author alanrw
+ */
+public class ServiceFilterTreeNode extends FilterTreeNode {
+	private static final long serialVersionUID = 6066698619971305454L;
+	
+	public ServiceFilterTreeNode(ServiceDescription userObject) {
+		super(userObject);
+	}
+
+	@Override
+	public ServiceDescription getUserObject() {
+		return (ServiceDescription) super.getUserObject();
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-ui/src/main/java/org/apache/taverna/workbench/ui/servicepanel/ServicePanel.java
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-ui/src/main/java/org/apache/taverna/workbench/ui/servicepanel/ServicePanel.java b/taverna-activity-palette-ui/src/main/java/org/apache/taverna/workbench/ui/servicepanel/ServicePanel.java
new file mode 100644
index 0000000..e95869f
--- /dev/null
+++ b/taverna-activity-palette-ui/src/main/java/org/apache/taverna/workbench/ui/servicepanel/ServicePanel.java
@@ -0,0 +1,410 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.servicepanel;
+
+import static javax.swing.JOptionPane.ERROR_MESSAGE;
+import static javax.swing.JOptionPane.showMessageDialog;
+import static javax.swing.SwingUtilities.invokeLater;
+import static org.apache.taverna.servicedescriptions.ServiceDescription.LOCAL_SERVICES;
+import static org.apache.taverna.servicedescriptions.ServiceDescription.SERVICE_TEMPLATES;
+
+import java.awt.BorderLayout;
+import java.lang.reflect.InvocationTargetException;
+import java.util.Comparator;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+import java.util.Timer;
+import java.util.TimerTask;
+import java.util.TreeMap;
+import java.util.TreeSet;
+
+import javax.swing.ImageIcon;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+
+import org.apache.taverna.lang.observer.Observable;
+import org.apache.taverna.lang.observer.Observer;
+import org.apache.taverna.servicedescriptions.ServiceDescription;
+import org.apache.taverna.servicedescriptions.ServiceDescriptionProvider;
+import org.apache.taverna.servicedescriptions.ServiceDescriptionRegistry;
+import org.apache.taverna.servicedescriptions.events.AbstractProviderEvent;
+import org.apache.taverna.servicedescriptions.events.AbstractProviderNotification;
+import org.apache.taverna.servicedescriptions.events.PartialServiceDescriptionsNotification;
+import org.apache.taverna.servicedescriptions.events.ProviderErrorNotification;
+import org.apache.taverna.servicedescriptions.events.RemovedProviderEvent;
+import org.apache.taverna.servicedescriptions.events.ServiceDescriptionProvidedEvent;
+import org.apache.taverna.servicedescriptions.events.ServiceDescriptionRegistryEvent;
+import org.apache.taverna.ui.menu.MenuManager;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.selection.SelectionManager;
+import org.apache.taverna.workbench.ui.servicepanel.tree.FilterTreeModel;
+import org.apache.taverna.workbench.ui.servicepanel.tree.FilterTreeNode;
+import org.apache.taverna.workbench.ui.zaria.UIComponentSPI;
+
+import org.apache.log4j.Logger;
+
+import org.apache.taverna.commons.services.ServiceRegistry;
+
+/**
+ * A panel of available services
+ *
+ * @author Stian Soiland-Reyes
+ */
+@SuppressWarnings("serial")
+public class ServicePanel extends JPanel implements UIComponentSPI {
+	private static Logger logger = Logger.getLogger(ServicePanel.class);
+	private static final int INITIAL_BLANK_OUT_COUNTER = 2;
+	public static final String AVAILABLE_SERVICES = "Available services";
+	public static final String MATCHING_SERVIES = "Matching services";
+	public static final String NO_MATCHING_SERVICES = "No matching services";
+	public static final String MOBY_OBJECTS = "MOBY Objects";
+	/**
+	 * A Comparable constant to be used with buildPathMap
+	 */
+	private static final String SERVICES = "4DA84170-7746-4817-8C2E-E29AF8B2984D";
+	private static final int STATUS_LINE_MESSAGE_MS = 600;
+	private static ServicePathElementComparator servicePathElementComparator = new ServicePathElementComparator();
+
+	public int blankOutCounter = 0;
+	private TreeUpdaterThread updaterThread;
+	private RootFilterTreeNode root = new RootFilterTreeNode(AVAILABLE_SERVICES);
+	private ServiceTreePanel serviceTreePanel;
+	private JLabel statusLine;
+	private FilterTreeModel treeModel;
+	protected Timer statusUpdateTimer;
+
+	private final ServiceDescriptionRegistry serviceDescriptionRegistry;
+	protected final ServiceDescriptionRegistryObserver serviceDescriptionRegistryObserver = new ServiceDescriptionRegistryObserver();
+	protected final Object updateLock = new Object();
+	private final EditManager editManager;
+	private final MenuManager menuManager;
+	private final SelectionManager selectionManager;
+	private final ServiceRegistry serviceRegistry;
+
+	public ServicePanel(ServiceDescriptionRegistry serviceDescriptionRegistry,
+			EditManager editManager, MenuManager menuManager,
+			SelectionManager selectionManager, ServiceRegistry serviceRegistry) {
+		this.serviceDescriptionRegistry = serviceDescriptionRegistry;
+		this.editManager = editManager;
+		this.menuManager = menuManager;
+		this.selectionManager = selectionManager;
+		this.serviceRegistry = serviceRegistry;
+		serviceDescriptionRegistry.addObserver(serviceDescriptionRegistryObserver);
+		initialise();
+	}
+
+	@Override
+	public ImageIcon getIcon() {
+		return null;
+	}
+
+	@Override
+	public String getName() {
+		return "Service panel";
+	}
+
+	@Override
+	public void onDisplay() {
+	}
+
+	@Override
+	public void onDispose() {
+	}
+
+	public void providerStatus(ServiceDescriptionProvider provider, String message) {
+		logger.info(message + " " + provider);
+		final String htmlMessage = "<small>" + message + " [" + provider + "]</small>";
+
+		invokeLater(new Runnable() {
+			@Override
+			public void run() {
+				blankOutCounter = INITIAL_BLANK_OUT_COUNTER;
+				statusLine.setText("<html>" + htmlMessage + "</html>");
+				statusLine.setVisible(true);
+			}
+		});
+	}
+
+	protected void initialise() {
+		removeAll();
+		setLayout(new BorderLayout());
+		treeModel = new FilterTreeModel(root);
+		serviceTreePanel = new ServiceTreePanel(treeModel, serviceDescriptionRegistry, editManager, menuManager, selectionManager, serviceRegistry);
+		serviceTreePanel.setAvailableObjectsString(AVAILABLE_SERVICES);
+		serviceTreePanel.setMatchingObjectsString(MATCHING_SERVIES);
+		serviceTreePanel.setNoMatchingObjectsString(NO_MATCHING_SERVICES);
+		add(serviceTreePanel);
+		statusLine = new JLabel();
+		add(statusLine, BorderLayout.SOUTH);
+		if (statusUpdateTimer != null)
+			statusUpdateTimer.cancel();
+		statusUpdateTimer = new Timer("Clear status line", true);
+		statusUpdateTimer
+				.scheduleAtFixedRate(new UpdateStatusLineTask(), 0, STATUS_LINE_MESSAGE_MS);
+		updateTree();
+	}
+
+	protected void updateTree() {
+		synchronized (updateLock) {
+			if (updaterThread != null && updaterThread.isAlive()) {
+				return;
+			}
+			updaterThread = new TreeUpdaterThread();
+			updaterThread.start();
+		}
+	}
+
+	protected static class ServicePathElementComparator implements Comparator<Object> {
+		@Override
+		public int compare(Object o1, Object o2) {
+			if ((o1 instanceof String) && (o2 instanceof String)) {
+				if (o1.equals(SERVICE_TEMPLATES))
+					return -1;
+				else if (o2.equals(SERVICE_TEMPLATES))
+					return 1;
+				if (o1.equals(LOCAL_SERVICES))
+					return -1;
+				else if (o2.equals(LOCAL_SERVICES))
+					return 1;
+				if (o1.equals(MOBY_OBJECTS))
+					return -1;
+				else if (o2.equals(MOBY_OBJECTS))
+					return 1;
+			}
+			return o1.toString().compareToIgnoreCase(o2.toString());
+		}
+	}
+
+	@SuppressWarnings({ "rawtypes", "unchecked" })
+	//FIXME this class is type-disastrous! Really bad.
+	public class TreeUpdaterThread extends Thread {
+		private boolean aborting = false;
+
+		private TreeUpdaterThread() {
+			super("Updating service panel");
+			setDaemon(true);
+		}
+
+		public void abort() {
+			aborting = true;
+			interrupt();
+		}
+
+		@Override
+		public void run() {
+			Map<Comparable, Map> pathMap = buildPathMap();
+			populateChildren(root, pathMap);
+			invokeLater(new Runnable() {
+				@Override
+				public void run() {
+					try {
+						serviceTreePanel.runFilter();
+					} catch (InterruptedException | InvocationTargetException e) {
+						logger.error("failed to filter", e);
+					}
+				}
+			});
+		}
+
+		protected Map<Comparable, Map> buildPathMap() {
+			Map<Comparable, Map> paths = new TreeMap<>();
+			for (ServiceDescription serviceDescription : serviceDescriptionRegistry
+					.getServiceDescriptions()) {
+				if (aborting)
+					return paths;
+				Map currentPath = paths;
+				for (Object pathElem : serviceDescription.getPath()) {
+					Map pathEntry = (Map) currentPath.get(pathElem);
+					if (pathEntry == null) {
+						pathEntry = new TreeMap();
+						currentPath.put(pathElem, pathEntry);
+					}
+					currentPath = pathEntry;
+				}
+				TreeMap<String, Set<ServiceDescription>> services = (TreeMap) currentPath
+						.get(SERVICES);
+				if (services == null) {
+					services = new TreeMap<>();
+					currentPath.put(SERVICES, services);
+				}
+				String serviceDescriptionName = serviceDescription.getName();
+				if (!services.containsKey(serviceDescriptionName)) {
+					Set<ServiceDescription> serviceSet = new HashSet<>();
+					services.put(serviceDescriptionName, serviceSet);
+				}
+				services.get(serviceDescriptionName).add(serviceDescription);
+			}
+			return paths;
+		}
+
+		protected void populateChildren(FilterTreeNode node, Map pathMap) {
+			if (aborting)
+				return;
+			if (node == root) {
+				// Clear top root
+				invokeLater(new Runnable() {
+					@Override
+					public void run() {
+						if (aborting)
+							return;
+						serviceTreePanel.setFilter(null);
+						root.removeAllChildren();
+					}
+				});
+			}
+
+			Set<Comparable> paths = new TreeSet<>(servicePathElementComparator);
+			Map<String, Set<ServiceDescription>> services = (Map) pathMap
+					.get(SERVICES);
+			if (services == null)
+				services = new TreeMap<>();
+			paths.addAll(pathMap.keySet());
+			paths.addAll(services.keySet());
+
+			for (Comparable pathElement : paths) {
+				if (aborting)
+					return;
+				if (pathElement.equals(SERVICES))
+					continue;
+				Set<FilterTreeNode> childNodes = new HashSet<>();
+				if (services.containsKey(pathElement)) {
+					for (ServiceDescription sd : services.get(pathElement))
+						childNodes.add(new ServiceFilterTreeNode(sd));
+				} else
+					childNodes.add(new PathElementFilterTreeNode((String) pathElement));
+				invokeLater(new AddNodeRunnable(node, childNodes));
+				if ((pathMap.containsKey(pathElement)) && !childNodes.isEmpty())
+					populateChildren(childNodes.iterator().next(), (Map) pathMap.get(pathElement));
+			}
+			// if (!services.isEmpty()) {
+			// Collections.sort(services, serviceComparator);
+			// for (String serviceName : services.keySet()) {
+			// if (aborting) {
+			// return;
+			// }
+			// if (pathMap.containsKey(serviceName)) {
+			// continue;
+			// }
+			// SwingUtilities.invokeLater(new AddNodeRunnable(node,
+			// new ServiceFilterTreeNode(services.get(serviceName))));
+			// }
+			// }
+		}
+
+		public class AddNodeRunnable implements Runnable {
+			private final Set<FilterTreeNode> nodes;
+			private final FilterTreeNode root;
+
+			public AddNodeRunnable(FilterTreeNode root, Set<FilterTreeNode> nodes) {
+				this.root = root;
+				this.nodes = nodes;
+			}
+
+			@Override
+			public void run() {
+				if (aborting)
+					return;
+				for (FilterTreeNode n : nodes)
+					root.add(n);
+			}
+		}
+	}
+
+	public static class RemoveNodeRunnable implements Runnable {
+		private final FilterTreeNode root;
+
+		public RemoveNodeRunnable(FilterTreeNode root) {
+			this.root = root;
+		}
+
+		@Override
+		public void run() {
+			root.removeFromParent();
+		}
+	}
+
+	private final class ServiceDescriptionRegistryObserver implements
+			Observer<ServiceDescriptionRegistryEvent> {
+		Set<ServiceDescriptionProvider> alreadyComplainedAbout = new HashSet<>();
+
+		@Override
+		public void notify(Observable<ServiceDescriptionRegistryEvent> sender,
+				ServiceDescriptionRegistryEvent message) throws Exception {
+			if (message instanceof ProviderErrorNotification)
+				reportServiceProviderError((ProviderErrorNotification) message);
+			else if (message instanceof ServiceDescriptionProvidedEvent
+					|| message instanceof RemovedProviderEvent) {
+				AbstractProviderEvent ape = (AbstractProviderEvent) message;
+				alreadyComplainedAbout.remove(ape.getProvider());
+			}
+
+			if (message instanceof AbstractProviderNotification) {
+				AbstractProviderNotification abstractProviderNotification = (AbstractProviderNotification) message;
+				providerStatus(abstractProviderNotification.getProvider(),
+						abstractProviderNotification.getMessage());
+			}
+			if (message instanceof PartialServiceDescriptionsNotification)
+				/*
+				 * TODO: Support other events and only update relevant parts of
+				 * tree, or at least select the recently added provider
+				 */
+				updateTree();
+			else if (message instanceof RemovedProviderEvent)
+				updateTree();
+		}
+
+		private void reportServiceProviderError(
+				final ProviderErrorNotification pen) {
+			ServiceDescriptionProvider provider = pen.getProvider();
+			if (serviceDescriptionRegistry
+					.getDefaultServiceDescriptionProviders().contains(provider))
+				return;
+			if (alreadyComplainedAbout.contains(provider))
+				return;
+
+			alreadyComplainedAbout.add(provider);
+			invokeLater(new Runnable() {
+				@Override
+				public void run() {
+					showMessageDialog(ServicePanel.this, pen.getMessage()
+							+ "\n" + pen.getProvider(), "Import service error",
+							ERROR_MESSAGE);
+				}
+			});
+		}
+	}
+
+	private final class UpdateStatusLineTask extends TimerTask {
+		@Override
+		public void run() {
+			if (blankOutCounter < 0 || blankOutCounter-- > 0)
+				// Only clear it once
+				return;
+			invokeLater(new Runnable() {
+				@Override
+				public void run() {
+					if (blankOutCounter < 0)
+						statusLine.setVisible(false);
+				}
+			});
+		}
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-ui/src/main/java/org/apache/taverna/workbench/ui/servicepanel/ServicePanelComponentFactory.java
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-ui/src/main/java/org/apache/taverna/workbench/ui/servicepanel/ServicePanelComponentFactory.java b/taverna-activity-palette-ui/src/main/java/org/apache/taverna/workbench/ui/servicepanel/ServicePanelComponentFactory.java
new file mode 100644
index 0000000..1bd92a5
--- /dev/null
+++ b/taverna-activity-palette-ui/src/main/java/org/apache/taverna/workbench/ui/servicepanel/ServicePanelComponentFactory.java
@@ -0,0 +1,81 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.servicepanel;
+
+import javax.swing.ImageIcon;
+
+import org.apache.taverna.commons.services.ServiceRegistry;
+
+import org.apache.taverna.servicedescriptions.ServiceDescriptionRegistry;
+import org.apache.taverna.ui.menu.MenuManager;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.selection.SelectionManager;
+import org.apache.taverna.workbench.ui.zaria.UIComponentFactorySPI;
+import org.apache.taverna.workbench.ui.zaria.UIComponentSPI;
+
+/**
+ * Service panel factory
+ * 
+ * @author Stian Soiland-Reyes
+ */
+public class ServicePanelComponentFactory implements UIComponentFactorySPI {
+	private ServiceDescriptionRegistry serviceDescriptionRegistry;
+	private EditManager editManager;
+	private MenuManager menuManager;
+	private SelectionManager selectionManager;
+	private ServiceRegistry serviceRegistry;
+
+	@Override
+	public UIComponentSPI getComponent() {
+		return new ServicePanel(serviceDescriptionRegistry, editManager,
+				menuManager, selectionManager, serviceRegistry);
+	}
+
+	@Override
+	public ImageIcon getIcon() {
+		return null;
+	}
+
+	@Override
+	public String getName() {
+		return "Service panel";
+	}
+
+	public void setServiceDescriptionRegistry(
+			ServiceDescriptionRegistry serviceDescriptionRegistry) {
+		this.serviceDescriptionRegistry = serviceDescriptionRegistry;
+	}
+
+	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;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-ui/src/main/java/org/apache/taverna/workbench/ui/servicepanel/ServiceTreeCellRenderer.java
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-ui/src/main/java/org/apache/taverna/workbench/ui/servicepanel/ServiceTreeCellRenderer.java b/taverna-activity-palette-ui/src/main/java/org/apache/taverna/workbench/ui/servicepanel/ServiceTreeCellRenderer.java
new file mode 100644
index 0000000..e5f65a9
--- /dev/null
+++ b/taverna-activity-palette-ui/src/main/java/org/apache/taverna/workbench/ui/servicepanel/ServiceTreeCellRenderer.java
@@ -0,0 +1,76 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.servicepanel;
+
+import static org.apache.taverna.workbench.activityicons.DefaultActivityIcon.getDefaultIcon;
+
+import java.awt.Component;
+
+import javax.swing.Icon;
+import javax.swing.JTree;
+
+import org.apache.taverna.servicedescriptions.ServiceDescription;
+import org.apache.taverna.workbench.ui.servicepanel.tree.FilterTreeCellRenderer;
+import org.apache.taverna.workbench.ui.servicepanel.tree.FilterTreeNode;
+
+@SuppressWarnings("serial")
+public class ServiceTreeCellRenderer extends FilterTreeCellRenderer {
+	@Override
+	public Component getTreeCellRendererComponent(JTree tree, Object value,
+			boolean sel, boolean expanded, boolean leaf, int row,
+			boolean hasFocus) {
+		Component result = super.getTreeCellRendererComponent(tree, value, sel,
+				expanded, leaf, row, hasFocus);
+		if (result instanceof ServiceTreeCellRenderer
+				&& value instanceof FilterTreeNode
+				&& ((FilterTreeNode) value).getUserObject() instanceof ServiceDescription)
+			prettifyServiceTreeCell((ServiceTreeCellRenderer) result,
+					(ServiceDescription) ((FilterTreeNode) value)
+							.getUserObject());
+		else {
+			// Commented out - these are ugly, use the default folder icons instead
+			/*
+			 * if (expanded) { ((ServiceTreeCellRenderer) result)
+			 * .setIcon(WorkbenchIcons.folderOpenIcon); } else {
+			 * ((ServiceTreeCellRenderer) result)
+			 * .setIcon(WorkbenchIcons.folderClosedIcon); }
+			 */
+		}
+		return result;
+	}
+
+	private void prettifyServiceTreeCell(ServiceTreeCellRenderer renderer,
+			ServiceDescription item) {
+		String name = item.getName();
+		if (getFilter() != null)
+			name = getFilter().filterRepresentation(name);
+		// serviceTreeCellRenderer.setForeground(Color.red);
+		String displayName = name;
+
+		String textualDescription = item.getDescription();
+		if (textualDescription != null && !textualDescription.isEmpty())
+			displayName = displayName + " - " + textualDescription;
+		renderer.setText(displayName);
+
+		Icon activityIcon = item.getIcon();
+		renderer.setIcon(activityIcon != null ? activityIcon
+				: getDefaultIcon());
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-ui/src/main/java/org/apache/taverna/workbench/ui/servicepanel/ServiceTreeClickListener.java
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-ui/src/main/java/org/apache/taverna/workbench/ui/servicepanel/ServiceTreeClickListener.java b/taverna-activity-palette-ui/src/main/java/org/apache/taverna/workbench/ui/servicepanel/ServiceTreeClickListener.java
new file mode 100644
index 0000000..8109cdc
--- /dev/null
+++ b/taverna-activity-palette-ui/src/main/java/org/apache/taverna/workbench/ui/servicepanel/ServiceTreeClickListener.java
@@ -0,0 +1,251 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.servicepanel;
+
+import static java.awt.Color.RED;
+import static javax.swing.SwingUtilities.invokeLater;
+import static org.apache.taverna.lang.ui.ShadedLabel.BLUE;
+import static org.apache.taverna.lang.ui.ShadedLabel.GREEN;
+import static org.apache.taverna.lang.ui.ShadedLabel.ORANGE;
+import static org.apache.taverna.lang.ui.ShadedLabel.halfShade;
+import static org.apache.taverna.workbench.icons.WorkbenchIcons.minusIcon;
+import static org.apache.taverna.workbench.icons.WorkbenchIcons.plusIcon;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeMap;
+
+import javax.swing.AbstractAction;
+import javax.swing.JMenuItem;
+import javax.swing.JPopupMenu;
+import javax.swing.JTree;
+import javax.swing.tree.TreePath;
+
+import org.apache.taverna.lang.ui.ShadedLabel;
+import org.apache.taverna.servicedescriptions.ConfigurableServiceProvider;
+import org.apache.taverna.servicedescriptions.ServiceDescription;
+import org.apache.taverna.servicedescriptions.ServiceDescriptionProvider;
+import org.apache.taverna.servicedescriptions.ServiceDescriptionRegistry;
+import org.apache.taverna.ui.menu.MenuManager;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.selection.SelectionManager;
+import org.apache.taverna.workbench.ui.servicepanel.actions.ExportServiceDescriptionsAction;
+import org.apache.taverna.workbench.ui.servicepanel.actions.ImportServiceDescriptionsFromFileAction;
+import org.apache.taverna.workbench.ui.servicepanel.actions.ImportServiceDescriptionsFromURLAction;
+import org.apache.taverna.workbench.ui.servicepanel.actions.RemoveDefaultServicesAction;
+import org.apache.taverna.workbench.ui.servicepanel.actions.RemoveUserServicesAction;
+import org.apache.taverna.workbench.ui.servicepanel.actions.RestoreDefaultServicesAction;
+import org.apache.taverna.workbench.ui.servicepanel.tree.FilterTreeNode;
+import org.apache.taverna.workbench.ui.servicepanel.tree.FilterTreeSelectionModel;
+import org.apache.taverna.workbench.ui.servicepanel.tree.TreePanel;
+import org.apache.taverna.workbench.ui.workflowview.WorkflowView;
+
+import org.apache.log4j.Logger;
+
+import org.apache.taverna.commons.services.ServiceRegistry;
+
+/**
+ * @author alanrw
+ */
+public class ServiceTreeClickListener extends MouseAdapter {
+	private static Logger logger = Logger.getLogger(ServiceTreeClickListener.class);
+
+	private JTree tree;
+	private TreePanel panel;
+	private final ServiceDescriptionRegistry serviceDescriptionRegistry;
+	private final EditManager editManager;
+	private final MenuManager menuManager;
+	private final SelectionManager selectionManager;
+	private final ServiceRegistry serviceRegistry;
+
+	public ServiceTreeClickListener(JTree tree, TreePanel panel,
+			ServiceDescriptionRegistry serviceDescriptionRegistry, EditManager editManager,
+			MenuManager menuManager, SelectionManager selectionManager, ServiceRegistry serviceRegistry) {
+		this.tree = tree;
+		this.panel = panel;
+		this.serviceDescriptionRegistry = serviceDescriptionRegistry;
+		this.editManager = editManager;
+		this.menuManager = menuManager;
+		this.selectionManager = selectionManager;
+		this.serviceRegistry = serviceRegistry;
+	}
+
+	@SuppressWarnings("serial")
+	private void handleMouseEvent(MouseEvent evt) {
+		FilterTreeSelectionModel selectionModel = (FilterTreeSelectionModel) tree
+				.getSelectionModel();
+		// Discover the tree row that was clicked on
+		int selRow = tree.getRowForLocation(evt.getX(), evt.getY());
+		if (selRow == -1)
+			return;
+
+		// Get the selection path for the row
+		TreePath selectionPath = tree
+				.getPathForLocation(evt.getX(), evt.getY());
+		if (selectionPath == null)
+			return;
+
+		// Get the selected node
+		final FilterTreeNode selectedNode = (FilterTreeNode) selectionPath
+				.getLastPathComponent();
+
+		selectionModel.clearSelection();
+		selectionModel.mySetSelectionPath(selectionPath);
+
+		if (evt.isPopupTrigger()) {
+			JPopupMenu menu = new JPopupMenu();
+			Object selectedObject = selectedNode.getUserObject();
+			logger.info(selectedObject.getClass().getName());
+			if (!(selectedObject instanceof ServiceDescription)) {
+				menu.add(new ShadedLabel("Tree", BLUE));
+				menu.add(new JMenuItem(new AbstractAction("Expand all",
+						plusIcon) {
+					@Override
+					public void actionPerformed(ActionEvent evt) {
+						invokeLater(new Runnable() {
+							@Override
+							public void run() {
+								panel.expandAll(selectedNode, true);
+							}
+						});
+					}
+				}));
+				menu.add(new JMenuItem(new AbstractAction("Collapse all",
+						minusIcon) {
+					@Override
+					public void actionPerformed(ActionEvent evt) {
+						invokeLater(new Runnable() {
+							@Override
+							public void run() {
+								panel.expandAll(selectedNode, false);
+							}
+						});
+					}
+				}));
+			}
+
+			if (selectedObject instanceof ServiceDescription) {
+				final ServiceDescription sd = (ServiceDescription) selectedObject;
+				menu.add(new ShadedLabel(sd.getName(), ORANGE));
+				menu.add(new AbstractAction("Add to workflow") {
+					@Override
+					public void actionPerformed(ActionEvent e) {
+						WorkflowView.importServiceDescription(sd, false, editManager,
+								menuManager, selectionManager, serviceRegistry);
+					}
+				});
+				menu.add(new AbstractAction("Add to workflow with name...") {
+					@Override
+					public void actionPerformed(ActionEvent e) {
+						WorkflowView.importServiceDescription(sd, true, editManager,
+								menuManager, selectionManager, serviceRegistry);
+					}
+				});
+			}
+
+			Map<String, ServiceDescriptionProvider> nameMap = getServiceDescriptionProviderMap(selectedNode);
+
+			boolean first = true;
+			for (String name : nameMap.keySet()) {
+				final ServiceDescriptionProvider sdp = nameMap.get(name);
+				if (!(sdp instanceof ConfigurableServiceProvider))
+					continue;
+				if (first) {
+					menu.add(new ShadedLabel(
+							"Remove individual service provider", GREEN));
+					first = false;
+				}
+				menu.add(new AbstractAction(name) {
+					@Override
+					public void actionPerformed(ActionEvent e) {
+						serviceDescriptionRegistry
+								.removeServiceDescriptionProvider(sdp);
+					}
+				});
+			}
+
+			if (selectedNode.isRoot()) { // Root "Available services"
+				menu.add(new ShadedLabel("Default and added service providers",
+						ORANGE));
+				menu.add(new RemoveUserServicesAction(
+						serviceDescriptionRegistry));
+				menu.add(new RemoveDefaultServicesAction(
+						serviceDescriptionRegistry));
+				menu.add(new RestoreDefaultServicesAction(
+						serviceDescriptionRegistry));
+
+				menu.add(new ShadedLabel("Import/export services", halfShade(RED)));
+				menu.add(new ImportServiceDescriptionsFromFileAction(
+						serviceDescriptionRegistry));
+				menu.add(new ImportServiceDescriptionsFromURLAction(
+						serviceDescriptionRegistry));
+				menu.add(new ExportServiceDescriptionsAction(
+						serviceDescriptionRegistry));
+			}
+
+			menu.show(evt.getComponent(), evt.getX(), evt.getY());
+		}
+	}
+
+	private Map<String, ServiceDescriptionProvider> getServiceDescriptionProviderMap(
+			FilterTreeNode selectedNode) {
+		Set<ServiceDescriptionProvider> providers;
+
+		if (selectedNode.isRoot())
+			providers = serviceDescriptionRegistry
+					.getServiceDescriptionProviders();
+		else {
+			providers = new HashSet<>();
+			for (FilterTreeNode leaf : selectedNode.getLeaves()) {
+				if (!leaf.isLeaf())
+					logger.info("Not a leaf");
+				if (!(leaf.getUserObject() instanceof ServiceDescription)) {
+					logger.info(leaf.getUserObject().getClass()
+							.getCanonicalName());
+					logger.info(leaf.getUserObject().toString());
+					continue;
+				}
+				providers
+						.addAll(serviceDescriptionRegistry
+								.getServiceDescriptionProviders((ServiceDescription) leaf
+										.getUserObject()));
+			}
+		}
+
+		TreeMap<String, ServiceDescriptionProvider> nameMap = new TreeMap<>();
+		for (ServiceDescriptionProvider sdp : providers)
+			nameMap.put(sdp.toString(), sdp);
+		return nameMap;
+	}
+
+	@Override
+	public void mousePressed(MouseEvent evt) {
+		handleMouseEvent(evt);
+	}
+
+	@Override
+	public void mouseReleased(MouseEvent evt) {
+		handleMouseEvent(evt);
+	}
+}


[24/51] [partial] incubator-taverna-workbench git commit: all packages are moved to org.apache.taverna.*

Posted by re...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-api/src/main/java/net/sf/taverna/t2/workbench/edits/package-info.java
----------------------------------------------------------------------
diff --git a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workbench/edits/package-info.java b/taverna-edits-api/src/main/java/net/sf/taverna/t2/workbench/edits/package-info.java
deleted file mode 100644
index c1df7c9..0000000
--- a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workbench/edits/package-info.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * 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
- ******************************************************************************/
-/**
- * A {@link net.sf.taverna.t2.workbench.edits.EditManager} that can manage
- * {@link net.sf.taverna.t2.workflowmodel.Edit}s performed from the UI.
- * <p>
- * To perform an edit that is to be undoable, use
- * {@link EditManager#doDataflowEdit(net.sf.taverna.t2.workflowmodel.Dataflow, net.sf.taverna.t2.workflowmodel.Edit)}
- * instead of {@link net.sf.taverna.t2.workflowmodel.Edit#doEdit()}. Such edits
- * can be
- * {@link EditManager#undoDataflowEdit(net.sf.taverna.t2.workflowmodel.Dataflow) undone}
- * and
- * {@link EditManager#redoDataflowEdit(net.sf.taverna.t2.workflowmodel.Dataflow) redone}.
- * </p>
- * <p>
- * Edits are organised by {@link net.sf.taverna.t2.workflowmodel.Dataflow} so
- * that if a user changes the active workflow in the Workbench and does "Undo" -
- * that would undo the last undo done related to that workflow.
- * </p>
- * <p>
- * The {@link net.sf.taverna.t2.workbench.edits.impl} implementation of the
- * EditManager is discovered by {@link net.sf.taverna.t2.workbench.edits.EditManager#getInstance()}. The
- * implementation also includes {@link net.sf.taverna.t2.ui.menu.MenuComponent}s
- * for Undo and Redo.
- * </p>
- * 
- * @author Stian Soiland-Reyes
- * 
- */
-package net.sf.taverna.t2.workbench.edits;

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/AbstractEdit.java
----------------------------------------------------------------------
diff --git a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/AbstractEdit.java b/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/AbstractEdit.java
deleted file mode 100644
index 3f03282..0000000
--- a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/AbstractEdit.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007-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.workflow.edits;
-
-import net.sf.taverna.t2.workbench.edits.Edit;
-import net.sf.taverna.t2.workbench.edits.EditException;
-import org.apache.taverna.scufl2.api.common.Scufl2Tools;
-import org.apache.taverna.scufl2.api.common.WorkflowBean;
-
-/**
- * An abstract {@link Edit} implementation that checks if an edit has been
- * applied or not.
- *
- * @author Stian Soiland-Reyes
- *
- * @param <Subject>
- *            Subject of this edit
- */
-public abstract class AbstractEdit<Subject extends WorkflowBean> implements
-		Edit<Subject> {
-	private boolean applied = false;
-	private final Subject subject;
-	protected final Scufl2Tools scufl2Tools = new Scufl2Tools();
-
-	/**
-	 * Construct an AbstractEdit.
-	 *
-	 * @param subjectType
-	 *            The expected implementation type of the subject. The edit will
-	 *            not go through unless the subject is an instance of this type.
-	 *            If the edit don't care about the implementation type, provide
-	 *            the official SubjectInterface instead.
-	 * @param subject
-	 *            The subject of this edit
-	 */
-	public AbstractEdit(Subject subject) {
-		if (subject == null && !isNullSubjectAllowed())
-			throw new IllegalArgumentException(
-					"Cannot construct an edit with null subject");
-		this.subject = subject;
-	}
-
-	protected boolean isNullSubjectAllowed() {
-		return false;
-	}
-
-	@Override
-	public final Subject doEdit() throws EditException {
-		if (applied)
-			throw new EditException("Edit has already been applied!");
-		try {
-			synchronized (subject) {
-				doEditAction(subject);
-				applied = true;
-				return this.subject;
-			}
-		} catch (EditException ee) {
-			applied = false;
-			throw ee;
-		}
-	}
-
-	/**
-	 * Do the actual edit here
-	 *
-	 * @param subject
-	 *            The instance to which the edit applies
-	 * @throws EditException
-	 */
-	protected abstract void doEditAction(Subject subject)
-			throws EditException;
-
-	/**
-	 * Undo any edit effects here
-	 *
-	 * @param subject
-	 *            The instance to which the edit applies
-	 */
-	protected abstract void undoEditAction(Subject subject);
-
-	@Override
-	public final Subject getSubject() {
-		return subject;
-	}
-
-	@Override
-	public final boolean isApplied() {
-		return applied;
-	}
-
-	@Override
-	public final void undo() {
-		if (!applied)
-			throw new RuntimeException(
-					"Attempt to undo edit that was never applied");
-		synchronized (subject) {
-			undoEditAction(subject);
-			applied = false;
-		}
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/AddActivityEdit.java
----------------------------------------------------------------------
diff --git a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/AddActivityEdit.java b/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/AddActivityEdit.java
deleted file mode 100644
index fe6e3ef..0000000
--- a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/AddActivityEdit.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2012 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.workflow.edits;
-
-import org.apache.taverna.scufl2.api.activity.Activity;
-import org.apache.taverna.scufl2.api.core.Processor;
-import org.apache.taverna.scufl2.api.profiles.ProcessorBinding;
-
-/**
- * Creates a ProcessorBinding binding for the Activity and Processor and adds the binding to the
- * Profile containing the Activity.
- *
- * @author David Withers
- */
-public class AddActivityEdit extends AbstractEdit<Processor> {
-	private Activity activity;
-	private ProcessorBinding addedProcessorBinding;
-
-	public AddActivityEdit(Processor processor, Activity activity) {
-		super(processor);
-		this.activity = activity;
-	}
-
-	@Override
-	protected void doEditAction(Processor processor) {
-		ProcessorBinding binding = new ProcessorBinding();
-		binding.setBoundProcessor(processor);
-		binding.setBoundActivity(activity);
-		binding.setParent(activity.getParent());
-		addedProcessorBinding = binding;
-	}
-
-	@Override
-	protected void undoEditAction(Processor processor) {
-		addedProcessorBinding.setParent(null);
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/AddActivityInputPortMappingEdit.java
----------------------------------------------------------------------
diff --git a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/AddActivityInputPortMappingEdit.java b/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/AddActivityInputPortMappingEdit.java
deleted file mode 100644
index 0f084a4..0000000
--- a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/AddActivityInputPortMappingEdit.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*******************************************************************************
- * 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.workflow.edits;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.taverna.scufl2.api.activity.Activity;
-import org.apache.taverna.scufl2.api.port.InputActivityPort;
-import org.apache.taverna.scufl2.api.port.InputProcessorPort;
-import org.apache.taverna.scufl2.api.profiles.ProcessorBinding;
-import org.apache.taverna.scufl2.api.profiles.ProcessorInputPortBinding;
-
-public class AddActivityInputPortMappingEdit extends AbstractEdit<Activity> {
-	private final InputProcessorPort inputProcessorPort;
-	private final InputActivityPort inputActivityPort;
-	private List<ProcessorInputPortBinding> portBindings;
-
-	public AddActivityInputPortMappingEdit(Activity activity,
-			InputProcessorPort inputProcessorPort,
-			InputActivityPort inputActivityPort) {
-		super(activity);
-		this.inputProcessorPort = inputProcessorPort;
-		this.inputActivityPort = inputActivityPort;
-	}
-
-	@Override
-	protected void doEditAction(Activity activity) {
-		portBindings = new ArrayList<>();
-		for (ProcessorBinding binding : scufl2Tools
-				.processorBindingsToActivity(activity))
-			portBindings.add(new ProcessorInputPortBinding(binding,
-					inputProcessorPort, inputActivityPort));
-	}
-
-	@Override
-	protected void undoEditAction(Activity activity) {
-		for (ProcessorInputPortBinding binding : portBindings)
-			binding.setParent(null);
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/AddActivityOutputPortMappingEdit.java
----------------------------------------------------------------------
diff --git a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/AddActivityOutputPortMappingEdit.java b/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/AddActivityOutputPortMappingEdit.java
deleted file mode 100644
index 10d2661..0000000
--- a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/AddActivityOutputPortMappingEdit.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*******************************************************************************
- * 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.workflow.edits;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.taverna.scufl2.api.activity.Activity;
-import org.apache.taverna.scufl2.api.port.OutputActivityPort;
-import org.apache.taverna.scufl2.api.port.OutputProcessorPort;
-import org.apache.taverna.scufl2.api.profiles.ProcessorBinding;
-import org.apache.taverna.scufl2.api.profiles.ProcessorOutputPortBinding;
-
-public class AddActivityOutputPortMappingEdit extends AbstractEdit<Activity> {
-	private final OutputProcessorPort outputProcessorPort;
-	private final OutputActivityPort outputActivityPort;
-	private List<ProcessorOutputPortBinding> portBindings;
-
-	public AddActivityOutputPortMappingEdit(Activity activity,
-			OutputProcessorPort outputProcessorPort,
-			OutputActivityPort outputActivityPort) {
-		super(activity);
-		this.outputProcessorPort = outputProcessorPort;
-		this.outputActivityPort = outputActivityPort;
-	}
-
-	@Override
-	protected void doEditAction(Activity activity) {
-		portBindings = new ArrayList<>();
-		for (ProcessorBinding binding : scufl2Tools
-				.processorBindingsToActivity(activity))
-			portBindings.add(new ProcessorOutputPortBinding(binding,
-					outputActivityPort, outputProcessorPort));
-	}
-
-	@Override
-	protected void undoEditAction(Activity activity) {
-		for (ProcessorOutputPortBinding binding : portBindings)
-			binding.setParent(null);
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/AddChildEdit.java
----------------------------------------------------------------------
diff --git a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/AddChildEdit.java b/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/AddChildEdit.java
deleted file mode 100644
index f8c7bc5..0000000
--- a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/AddChildEdit.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2012 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.workflow.edits;
-
-import org.apache.taverna.scufl2.api.common.Child;
-import org.apache.taverna.scufl2.api.common.WorkflowBean;
-
-/**
- * Adds a child to a parent.
- *
- * @author David Withers
- */
-public class AddChildEdit<T extends WorkflowBean> extends AbstractEdit<T> {
-	private Child<T> child;
-
-	public AddChildEdit(T parent, Child<T> child) {
-		super(parent);
-		this.child = child;
-	}
-
-	@Override
-	protected void doEditAction(T parent) {
-		child.setParent(parent);
-	}
-
-	@Override
-	protected void undoEditAction(T parent) {
-		child.setParent(null);
-	}
-
-	public Child<T> getChild() {
-		return child;
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/AddDataLinkEdit.java
----------------------------------------------------------------------
diff --git a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/AddDataLinkEdit.java b/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/AddDataLinkEdit.java
deleted file mode 100644
index 4126aae..0000000
--- a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/AddDataLinkEdit.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2012 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.workflow.edits;
-
-import java.util.List;
-
-import org.apache.taverna.scufl2.api.core.DataLink;
-import org.apache.taverna.scufl2.api.core.Workflow;
-import org.apache.taverna.scufl2.api.iterationstrategy.CrossProduct;
-import org.apache.taverna.scufl2.api.iterationstrategy.DotProduct;
-import org.apache.taverna.scufl2.api.iterationstrategy.IterationStrategyParent;
-import org.apache.taverna.scufl2.api.iterationstrategy.IterationStrategyTopNode;
-import org.apache.taverna.scufl2.api.iterationstrategy.PortNode;
-import org.apache.taverna.scufl2.api.port.InputProcessorPort;
-import org.apache.taverna.scufl2.api.port.ReceiverPort;
-
-/**
- * Adds a DataLink to a Workflow.
- * <p>
- * Handles setting the merge position of all dataLinks with the same receiver port.
- * <p>
- * Modifies the processor's iteration strategy or when the first DataLink is added.
- *
- * @author David Withers
- */
-public class AddDataLinkEdit extends AbstractEdit<Workflow> {
-	private DataLink dataLink;
-	private PortNode portNode;
-
-	public AddDataLinkEdit(Workflow workflow, DataLink dataLink) {
-		super(workflow);
-		this.dataLink = dataLink;
-	}
-
-	@Override
-	protected void doEditAction(Workflow workflow) {
-		ReceiverPort sink = dataLink.getSendsTo();
-		List<DataLink> datalinksTo = scufl2Tools.datalinksTo(sink);
-		if (datalinksTo.size() > 0) {
-			if (datalinksTo.size() == 1)
-				datalinksTo.get(0).setMergePosition(0);
-			dataLink.setMergePosition(datalinksTo.size());
-		} else {
-			dataLink.setMergePosition(null);
-			if (sink instanceof InputProcessorPort) {
-				InputProcessorPort inputProcessorPort = (InputProcessorPort) sink;
-				for (IterationStrategyTopNode node : inputProcessorPort.getParent().getIterationStrategyStack()) {
-					portNode = new PortNode(node, inputProcessorPort);
-					portNode.setDesiredDepth(inputProcessorPort.getDepth());
-					break;
-				}
-			}
-		}
-		dataLink.setParent(workflow);
-	}
-
-	@Override
-	protected void undoEditAction(Workflow workflow) {
-		dataLink.setParent(null);
-		ReceiverPort sink = dataLink.getSendsTo();
-		List<DataLink> datalinksTo = scufl2Tools.datalinksTo(sink);
-		if (datalinksTo.size() == 1)
-			datalinksTo.get(0).setMergePosition(null);
-		else if (datalinksTo.isEmpty()&&portNode != null) {
-			IterationStrategyParent parent = portNode.getParent();
-			if (parent instanceof DotProduct)
-				((DotProduct) parent).remove(portNode);
-			else if (parent instanceof CrossProduct)
-				((CrossProduct) parent).remove(portNode);
-		}
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/AddIterationStrategyEdit.java
----------------------------------------------------------------------
diff --git a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/AddIterationStrategyEdit.java b/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/AddIterationStrategyEdit.java
deleted file mode 100644
index 1644c31..0000000
--- a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/AddIterationStrategyEdit.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2011 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.workflow.edits;
-
-import org.apache.taverna.scufl2.api.iterationstrategy.IterationStrategyStack;
-import org.apache.taverna.scufl2.api.iterationstrategy.IterationStrategyTopNode;
-
-/**
- * Adds an IterationStrategyTopNode to an IterationStrategyStack.
- *
- * @author David Withers
- */
-public class AddIterationStrategyEdit extends AbstractEdit<IterationStrategyStack> {
-	private final IterationStrategyTopNode iterationStrategyTopNode;
-
-	public AddIterationStrategyEdit(IterationStrategyStack iterationStrategyStack,
-			IterationStrategyTopNode iterationStrategyTopNode) {
-		super(iterationStrategyStack);
-		this.iterationStrategyTopNode = iterationStrategyTopNode;
-	}
-
-	@Override
-	public void doEditAction(IterationStrategyStack iterationStrategyStack) {
-		iterationStrategyStack.add(iterationStrategyTopNode);
-	}
-
-	@Override
-	public void undoEditAction(IterationStrategyStack iterationStrategyStack) {
-		iterationStrategyStack.remove(iterationStrategyTopNode);
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/AddIterationStrategyInputPortEdit.java
----------------------------------------------------------------------
diff --git a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/AddIterationStrategyInputPortEdit.java b/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/AddIterationStrategyInputPortEdit.java
deleted file mode 100644
index 0d0fca5..0000000
--- a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/AddIterationStrategyInputPortEdit.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2011 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.workflow.edits;
-
-import org.apache.taverna.scufl2.api.iterationstrategy.IterationStrategyStack;
-import org.apache.taverna.scufl2.api.iterationstrategy.PortNode;
-
-/**
- * Adds an iteration strategy input port node to an iteration strategy.
- * 
- * @author David Withers
- */
-public class AddIterationStrategyInputPortEdit extends
-		AbstractEdit<IterationStrategyStack> {
-	private final PortNode portNode;
-
-	public AddIterationStrategyInputPortEdit(
-			IterationStrategyStack iterationStrategy, PortNode portNode) {
-		super(iterationStrategy);
-		this.portNode = portNode;
-	}
-
-	@Override
-	public void doEditAction(IterationStrategyStack iterationStrategy) {
-		portNode.setParent(iterationStrategy.get(0));
-	}
-
-	@Override
-	public void undoEditAction(IterationStrategyStack iterationStrategy) {
-		portNode.setParent(null);
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/AddProcessorEdit.java
----------------------------------------------------------------------
diff --git a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/AddProcessorEdit.java b/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/AddProcessorEdit.java
deleted file mode 100644
index facc975..0000000
--- a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/AddProcessorEdit.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*******************************************************************************
- * 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.workflow.edits;
-
-import org.apache.taverna.scufl2.api.core.Processor;
-import org.apache.taverna.scufl2.api.core.Workflow;
-
-/**
- * Adds a Processor to a Workflow.
- *
- * @author Stuart Owen
- * @author David Withers
- */
-public class AddProcessorEdit extends AddChildEdit<Workflow> {
-	private Processor processor;
-
-	public AddProcessorEdit(Workflow workflow, Processor processor) {
-		super(workflow, processor);
-		this.processor = processor;
-	}
-
-	@Override
-	protected void doEditAction(Workflow workflow) {
-		getSubject().getProcessors().addWithUniqueName(processor);
-		super.doEditAction(workflow);
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/AddProcessorInputPortEdit.java
----------------------------------------------------------------------
diff --git a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/AddProcessorInputPortEdit.java b/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/AddProcessorInputPortEdit.java
deleted file mode 100644
index 87575d4..0000000
--- a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/AddProcessorInputPortEdit.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*******************************************************************************
- * 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.workflow.edits;
-
-import org.apache.taverna.scufl2.api.core.Processor;
-import org.apache.taverna.scufl2.api.port.InputProcessorPort;
-
-/**
- * Adds an input port to a processor.
- *
- * @author Tom Oinn
- * @author David Withers
- */
-public class AddProcessorInputPortEdit extends AddChildEdit<Processor> {
-	private final InputProcessorPort port;
-
-	public AddProcessorInputPortEdit(Processor processor, InputProcessorPort port) {
-		super(processor, port);
-		this.port = port;
-	}
-
-	@Override
-	protected void doEditAction(Processor processor) {
-		processor.getInputPorts().addWithUniqueName(port);
-		super.doEditAction(processor);
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/AddProcessorOutputPortEdit.java
----------------------------------------------------------------------
diff --git a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/AddProcessorOutputPortEdit.java b/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/AddProcessorOutputPortEdit.java
deleted file mode 100644
index 1a01972..0000000
--- a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/AddProcessorOutputPortEdit.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*******************************************************************************
- * 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.workflow.edits;
-
-import org.apache.taverna.scufl2.api.core.Processor;
-import org.apache.taverna.scufl2.api.port.OutputProcessorPort;
-
-/**
- * Adds an output port to a processor.
- * 
- * @author Tom Oinn
- * @author David Withers
- */
-public class AddProcessorOutputPortEdit extends AddChildEdit<Processor> {
-	private final OutputProcessorPort port;
-
-	public AddProcessorOutputPortEdit(Processor processor,
-			OutputProcessorPort port) {
-		super(processor, port);
-		this.port = port;
-	}
-
-	@Override
-	protected void doEditAction(Processor processor) {
-		processor.getOutputPorts().addWithUniqueName(port);
-		super.doEditAction(processor);
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/AddWorkflowInputPortEdit.java
----------------------------------------------------------------------
diff --git a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/AddWorkflowInputPortEdit.java b/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/AddWorkflowInputPortEdit.java
deleted file mode 100644
index 46c72a2..0000000
--- a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/AddWorkflowInputPortEdit.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2013 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.workflow.edits;
-
-import static org.apache.taverna.scufl2.api.common.Scufl2Tools.NESTED_WORKFLOW;
-
-import java.util.List;
-
-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 org.apache.taverna.scufl2.api.activity.Activity;
-import org.apache.taverna.scufl2.api.configurations.Configuration;
-import org.apache.taverna.scufl2.api.container.WorkflowBundle;
-import org.apache.taverna.scufl2.api.core.Processor;
-import org.apache.taverna.scufl2.api.core.Workflow;
-import org.apache.taverna.scufl2.api.port.InputActivityPort;
-import org.apache.taverna.scufl2.api.port.InputProcessorPort;
-import org.apache.taverna.scufl2.api.port.InputWorkflowPort;
-import org.apache.taverna.scufl2.api.profiles.ProcessorBinding;
-import org.apache.taverna.scufl2.api.profiles.ProcessorInputPortBinding;
-import org.apache.taverna.scufl2.api.profiles.Profile;
-
-import com.fasterxml.jackson.databind.JsonNode;
-
-/**
- * Adds an input port to a workflow.
- * 
- * @author David Withers
- */
-public class AddWorkflowInputPortEdit extends AbstractEdit<Workflow> {
-	private final InputWorkflowPort port;
-	private final CompoundEdit nestedPortEdit = new CompoundEdit();
-
-	public AddWorkflowInputPortEdit(Workflow workflow, InputWorkflowPort port) {
-		super(workflow);
-		this.port = port;
-		WorkflowBundle workflowBundle = workflow.getParent();
-		if (workflowBundle != null)
-			for (Profile profile : workflowBundle.getProfiles())
-				for (Activity activity : profile.getActivities())
-					if (activity.getType().equals(NESTED_WORKFLOW))
-						for (Configuration c : scufl2Tools.configurationsFor(
-								activity, profile))
-							defineEditsForOneConfiguration(workflow, port,
-									workflowBundle, activity, c);
-	}
-
-	private void defineEditsForOneConfiguration(Workflow workflow,
-			InputWorkflowPort port, WorkflowBundle workflowBundle,
-			Activity activity, Configuration c) {
-		List<Edit<?>> edits = nestedPortEdit.getChildEdits();
-		JsonNode nested = c.getJson().get("nestedWorkflow");
-		Workflow nestedWorkflow = workflowBundle.getWorkflows().getByName(
-				nested.asText());
-
-		if (nestedWorkflow == workflow) {
-			InputActivityPort activityPort = new InputActivityPort();
-			activityPort.setName(port.getName());
-			activityPort.setDepth(port.getDepth());
-			edits.add(new AddChildEdit<>(activity, activityPort));
-
-			for (ProcessorBinding binding : scufl2Tools
-					.processorBindingsToActivity(activity)) {
-				Processor processor = binding.getBoundProcessor();
-				InputProcessorPort processorPort = new InputProcessorPort();
-				processorPort.setName(port.getName());
-				processorPort.setDepth(port.getDepth());
-				edits.add(new AddProcessorInputPortEdit(processor,
-						processorPort));
-
-				ProcessorInputPortBinding portBinding = new ProcessorInputPortBinding();
-				portBinding.setBoundProcessorPort(processorPort);
-				portBinding.setBoundActivityPort(activityPort);
-				edits.add(new AddChildEdit<>(binding, portBinding));
-			}
-		}
-	}
-
-	@Override
-	protected void doEditAction(Workflow workflow) throws EditException {
-		workflow.getInputPorts().addWithUniqueName(port);
-		port.setParent(workflow);
-		nestedPortEdit.doEdit();
-	}
-
-	@Override
-	protected void undoEditAction(Workflow workflow) {
-		port.setParent(null);
-		nestedPortEdit.undo();
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/AddWorkflowOutputPortEdit.java
----------------------------------------------------------------------
diff --git a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/AddWorkflowOutputPortEdit.java b/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/AddWorkflowOutputPortEdit.java
deleted file mode 100644
index b5d8b99..0000000
--- a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/AddWorkflowOutputPortEdit.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2013 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.workflow.edits;
-
-import static org.apache.taverna.scufl2.api.common.Scufl2Tools.NESTED_WORKFLOW;
-
-import java.util.List;
-
-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 org.apache.taverna.scufl2.api.activity.Activity;
-import org.apache.taverna.scufl2.api.configurations.Configuration;
-import org.apache.taverna.scufl2.api.container.WorkflowBundle;
-import org.apache.taverna.scufl2.api.core.Processor;
-import org.apache.taverna.scufl2.api.core.Workflow;
-import org.apache.taverna.scufl2.api.port.OutputActivityPort;
-import org.apache.taverna.scufl2.api.port.OutputProcessorPort;
-import org.apache.taverna.scufl2.api.port.OutputWorkflowPort;
-import org.apache.taverna.scufl2.api.profiles.ProcessorBinding;
-import org.apache.taverna.scufl2.api.profiles.ProcessorOutputPortBinding;
-import org.apache.taverna.scufl2.api.profiles.Profile;
-
-import com.fasterxml.jackson.databind.JsonNode;
-
-/**
- * Adds an output port to a workflow.
- *
- * @author David Withers
- */
-public class AddWorkflowOutputPortEdit extends AbstractEdit<Workflow> {
-	private final OutputWorkflowPort port;
-	private final CompoundEdit nestedPortEdit = new CompoundEdit();
-
-	public AddWorkflowOutputPortEdit(Workflow workflow, OutputWorkflowPort port) {
-		super(workflow);
-		this.port = port;
-		WorkflowBundle workflowBundle = workflow.getParent();
-		if (workflowBundle != null)
-			for (Profile profile : workflowBundle.getProfiles())
-				for (Activity activity : profile.getActivities())
-					if (activity.getType().equals(NESTED_WORKFLOW))
-						for (Configuration c : scufl2Tools.configurationsFor(
-								activity, profile))
-							defineEditsForOneConfiguration(workflow, port,
-									workflowBundle, activity, c);
-	}
-
-	private void defineEditsForOneConfiguration(Workflow workflow,
-			OutputWorkflowPort port, WorkflowBundle workflowBundle,
-			Activity activity, Configuration c) {
-		List<Edit<?>> edits = nestedPortEdit.getChildEdits();
-		JsonNode nested = c.getJson().get("nestedWorkflow");
-		Workflow nestedWorkflow = workflowBundle.getWorkflows().getByName(
-				nested.asText());
-		if (nestedWorkflow == workflow) {
-			OutputActivityPort activityPort = new OutputActivityPort();
-			activityPort.setName(port.getName());
-			activityPort.setDepth(0);
-			activityPort.setGranularDepth(0);
-			edits.add(new AddChildEdit<>(activity, activityPort));
-
-			for (ProcessorBinding binding : scufl2Tools
-					.processorBindingsToActivity(activity)) {
-				Processor processor = binding.getBoundProcessor();
-				OutputProcessorPort processorPort = new OutputProcessorPort();
-				processorPort.setName(port.getName());
-				processorPort.setDepth(0);
-				processorPort.setGranularDepth(0);
-				edits.add(new AddProcessorOutputPortEdit(processor,
-						processorPort));
-
-				ProcessorOutputPortBinding portBinding = new ProcessorOutputPortBinding();
-				portBinding.setBoundProcessorPort(processorPort);
-				portBinding.setBoundActivityPort(activityPort);
-				edits.add(new AddChildEdit<>(binding, portBinding));
-			}
-		}
-	}
-
-	@Override
-	protected void doEditAction(Workflow workflow) throws EditException {
-		workflow.getOutputPorts().addWithUniqueName(port);
-		port.setParent(workflow);
-		nestedPortEdit.doEdit();
-	}
-
-	@Override
-	protected void undoEditAction(Workflow workflow) {
-		port.setParent(null);
-		nestedPortEdit.undo();
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/ChangeDepthEdit.java
----------------------------------------------------------------------
diff --git a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/ChangeDepthEdit.java b/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/ChangeDepthEdit.java
deleted file mode 100644
index 19c606e..0000000
--- a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/ChangeDepthEdit.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2012 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.workflow.edits;
-
-import static org.apache.taverna.scufl2.api.common.Scufl2Tools.NESTED_WORKFLOW;
-import org.apache.taverna.scufl2.api.activity.Activity;
-import org.apache.taverna.scufl2.api.configurations.Configuration;
-import org.apache.taverna.scufl2.api.container.WorkflowBundle;
-import org.apache.taverna.scufl2.api.core.Workflow;
-import org.apache.taverna.scufl2.api.port.ActivityPort;
-import org.apache.taverna.scufl2.api.port.DepthPort;
-import org.apache.taverna.scufl2.api.port.InputProcessorPort;
-import org.apache.taverna.scufl2.api.port.InputWorkflowPort;
-import org.apache.taverna.scufl2.api.profiles.ProcessorBinding;
-import org.apache.taverna.scufl2.api.profiles.ProcessorInputPortBinding;
-import org.apache.taverna.scufl2.api.profiles.Profile;
-
-import com.fasterxml.jackson.databind.JsonNode;
-
-/**
- * Changes the depth of a port.
- *
- * @author David Withers
- */
-public class ChangeDepthEdit<T extends DepthPort> extends AbstractEdit<T> {
-	private Integer newDepth, oldDepth;
-
-	public ChangeDepthEdit(T depthPort, Integer newDepth) {
-		super(depthPort);
-		this.newDepth = newDepth;
-		oldDepth = depthPort.getDepth();
-	}
-
-	@Override
-	protected void doEditAction(T depthPort) {
-		depthPort.setDepth(newDepth);
-		if (depthPort instanceof InputWorkflowPort)
-			checkNestedPortDepths((InputWorkflowPort) depthPort, newDepth);
-	}
-
-	@Override
-	protected void undoEditAction(T depthPort) {
-		depthPort.setDepth(oldDepth);
-		if (depthPort instanceof InputWorkflowPort)
-			checkNestedPortDepths((InputWorkflowPort) depthPort, oldDepth);
-	}
-
-	private void checkNestedPortDepths(InputWorkflowPort workflowPort,
-			Integer depth) {
-		Workflow workflow = workflowPort.getParent();
-		if (workflow != null) {
-			WorkflowBundle workflowBundle = workflow.getParent();
-			if (workflowBundle != null)
-				for (Profile profile : workflowBundle.getProfiles())
-					for (Activity activity : profile.getActivities())
-						if (activity.getType().equals(NESTED_WORKFLOW))
-							for (Configuration c : scufl2Tools
-									.configurationsFor(activity, profile))
-								checkOneConfiguration(workflowPort, depth,
-										workflow, workflowBundle, activity, c);
-		}
-	}
-
-	private void checkOneConfiguration(InputWorkflowPort workflowPort,
-			Integer depth, Workflow workflow, WorkflowBundle workflowBundle,
-			Activity activity, Configuration c) {
-		JsonNode nested = c.getJson().get("nestedWorkflow");
-		Workflow nestedWorkflow = workflowBundle.getWorkflows().getByName(
-				nested.asText());
-		if (nestedWorkflow != workflow)
-			return;
-
-		ActivityPort activityPort = activity.getInputPorts().getByName(
-				workflowPort.getName());
-		activityPort.setDepth(depth);
-		for (ProcessorBinding binding : scufl2Tools
-				.processorBindingsToActivity(activity))
-			for (ProcessorInputPortBinding portBinding : binding
-					.getInputPortBindings())
-				if (portBinding.getBoundActivityPort() == activityPort) {
-					InputProcessorPort processorPort = portBinding
-							.getBoundProcessorPort();
-					processorPort.setDepth(depth);
-				}
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/ChangeGranularDepthEdit.java
----------------------------------------------------------------------
diff --git a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/ChangeGranularDepthEdit.java b/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/ChangeGranularDepthEdit.java
deleted file mode 100644
index 2122478..0000000
--- a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/ChangeGranularDepthEdit.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2012 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.workflow.edits;
-
-import org.apache.taverna.scufl2.api.port.GranularDepthPort;
-
-/**
- * Changes the granular depth of a port.
- * 
- * @author David Withers
- */
-public class ChangeGranularDepthEdit<T extends GranularDepthPort> extends
-		AbstractEdit<T> {
-	private Integer newGranularDepth, oldGranularDepth;
-
-	public ChangeGranularDepthEdit(T granularDepthPort, Integer newGranularDepth) {
-		super(granularDepthPort);
-		this.newGranularDepth = newGranularDepth;
-		oldGranularDepth = granularDepthPort.getGranularDepth();
-	}
-
-	@Override
-	protected void doEditAction(T granularDepthPort) {
-		granularDepthPort.setGranularDepth(newGranularDepth);
-	}
-
-	@Override
-	protected void undoEditAction(T granularDepthPort) {
-		granularDepthPort.setGranularDepth(oldGranularDepth);
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/ChangeJsonEdit.java
----------------------------------------------------------------------
diff --git a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/ChangeJsonEdit.java b/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/ChangeJsonEdit.java
deleted file mode 100644
index 652f18f..0000000
--- a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/ChangeJsonEdit.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2012 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.workflow.edits;
-
-import org.apache.taverna.scufl2.api.configurations.Configuration;
-
-import com.fasterxml.jackson.databind.JsonNode;
-
-/**
- * Changes the JSON of a configuration.
- * 
- * @author David Withers
- */
-public class ChangeJsonEdit extends AbstractEdit<Configuration> {
-	private JsonNode oldJson, newJson;
-
-	public ChangeJsonEdit(Configuration configuration, JsonNode newJson) {
-		super(configuration);
-		this.newJson = newJson;
-		newJson = configuration.getJson();
-	}
-
-	@Override
-	protected void doEditAction(Configuration configuration) {
-		configuration.setJson(newJson);
-	}
-
-	@Override
-	protected void undoEditAction(Configuration configuration) {
-		configuration.setJson(oldJson);
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/ClearIterationStrategyStackEdit.java
----------------------------------------------------------------------
diff --git a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/ClearIterationStrategyStackEdit.java b/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/ClearIterationStrategyStackEdit.java
deleted file mode 100644
index aa5abe8..0000000
--- a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/ClearIterationStrategyStackEdit.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2011 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.workflow.edits;
-
-import org.apache.taverna.scufl2.api.iterationstrategy.IterationStrategyStack;
-
-/**
- * Removes all the iteration strategies from an iteration strategy stack.
- * 
- * @author David Withers
- */
-public class ClearIterationStrategyStackEdit extends
-		AbstractEdit<IterationStrategyStack> {
-	private IterationStrategyStack oldIterationStrategyStack;
-
-	public ClearIterationStrategyStackEdit(
-			IterationStrategyStack iterationStrategyStack) {
-		super(iterationStrategyStack);
-	}
-
-	@Override
-	protected void doEditAction(IterationStrategyStack iterationStrategyStack) {
-		oldIterationStrategyStack = new IterationStrategyStack();
-		oldIterationStrategyStack.addAll(iterationStrategyStack);
-		iterationStrategyStack.clear();
-	}
-
-	@Override
-	public void undoEditAction(IterationStrategyStack iterationStrategyStack) {
-		iterationStrategyStack.addAll(oldIterationStrategyStack);
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/ConfigureEdit.java
----------------------------------------------------------------------
diff --git a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/ConfigureEdit.java b/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/ConfigureEdit.java
deleted file mode 100644
index dbad345..0000000
--- a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/ConfigureEdit.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2012 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.workflow.edits;
-
-import org.apache.taverna.scufl2.api.common.Configurable;
-import org.apache.taverna.scufl2.api.configurations.Configuration;
-
-/**
- * An Edit that configures a {@link Configurable} with a given
- * {@link Configuration}.
- * 
- * @author David Withers
- */
-public class ConfigureEdit<ConfigurableType extends Configurable> extends
-		AbstractEdit<ConfigurableType> {
-	private final Configuration oldConfiguration;
-	private final Configuration newConfiguration;
-
-	public ConfigureEdit(ConfigurableType configurable,
-			Configuration oldConfiguration, Configuration newConfiguration) {
-		super(configurable);
-		this.oldConfiguration = oldConfiguration;
-		this.newConfiguration = newConfiguration;
-	}
-
-	@Override
-	protected void doEditAction(ConfigurableType configurable) {
-		oldConfiguration.setConfigures(null);
-		newConfiguration.setConfigures(configurable);
-	}
-
-	@Override
-	protected void undoEditAction(ConfigurableType configurable) {
-		oldConfiguration.setConfigures(configurable);
-		newConfiguration.setConfigures(null);
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/RemoveActivityEdit.java
----------------------------------------------------------------------
diff --git a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/RemoveActivityEdit.java b/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/RemoveActivityEdit.java
deleted file mode 100644
index 88c5936..0000000
--- a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/RemoveActivityEdit.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*******************************************************************************
- * 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.workflow.edits;
-
-import org.apache.taverna.scufl2.api.activity.Activity;
-import org.apache.taverna.scufl2.api.core.Processor;
-import org.apache.taverna.scufl2.api.profiles.ProcessorBinding;
-
-/**
- * Remove an Activity from a Processor.
- *
- * @author alanrw
- */
-public class RemoveActivityEdit extends AbstractEdit<Processor> {
-	private Activity activityToRemove;
-	private ProcessorBinding removedProcessorBinding;
-
-	public RemoveActivityEdit(Processor processor, Activity activity) {
-		super(processor);
-		this.activityToRemove = activity;
-	}
-
-	@Override
-	protected void doEditAction(Processor processor) {
-		for (ProcessorBinding binding : scufl2Tools
-				.processorBindingsToActivity(activityToRemove))
-			if (binding.getBoundProcessor().equals(processor)) {
-				removedProcessorBinding = binding;
-				removedProcessorBinding.setParent(null);
-			}
-	}
-
-	@Override
-	protected void undoEditAction(Processor processor) {
-		removedProcessorBinding.setParent(activityToRemove.getParent());
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/RemoveActivityInputPortMappingEdit.java
----------------------------------------------------------------------
diff --git a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/RemoveActivityInputPortMappingEdit.java b/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/RemoveActivityInputPortMappingEdit.java
deleted file mode 100644
index aa9ff63..0000000
--- a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/RemoveActivityInputPortMappingEdit.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * 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.workflow.edits;
-
-import org.apache.taverna.scufl2.api.activity.Activity;
-import org.apache.taverna.scufl2.api.port.InputActivityPort;
-import org.apache.taverna.scufl2.api.profiles.ProcessorBinding;
-import org.apache.taverna.scufl2.api.profiles.ProcessorInputPortBinding;
-
-public class RemoveActivityInputPortMappingEdit extends AbstractEdit<Activity> {
-	private final InputActivityPort inputActivityPort;
-	private ProcessorInputPortBinding removedPortBinding;
-	private ProcessorBinding processorBinding;
-
-	public RemoveActivityInputPortMappingEdit(Activity activity,
-			InputActivityPort inputActivityPort) {
-		super(activity);
-		this.inputActivityPort = inputActivityPort;
-	}
-
-	@Override
-	protected void doEditAction(Activity activity) {
-		removedPortBinding = scufl2Tools.processorPortBindingForPort(
-				inputActivityPort, activity.getParent());
-		processorBinding = removedPortBinding.getParent();
-		removedPortBinding.setParent(null);
-	}
-
-	@Override
-	protected void undoEditAction(Activity activity) {
-		removedPortBinding.setParent(processorBinding);
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/RemoveActivityOutputPortMappingEdit.java
----------------------------------------------------------------------
diff --git a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/RemoveActivityOutputPortMappingEdit.java b/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/RemoveActivityOutputPortMappingEdit.java
deleted file mode 100644
index 7430e83..0000000
--- a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/RemoveActivityOutputPortMappingEdit.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * 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.workflow.edits;
-
-import org.apache.taverna.scufl2.api.activity.Activity;
-import org.apache.taverna.scufl2.api.port.OutputActivityPort;
-import org.apache.taverna.scufl2.api.profiles.ProcessorBinding;
-import org.apache.taverna.scufl2.api.profiles.ProcessorOutputPortBinding;
-
-public class RemoveActivityOutputPortMappingEdit extends AbstractEdit<Activity> {
-	private final OutputActivityPort outputActivityPort;
-	private ProcessorOutputPortBinding removedPortBinding;
-	private ProcessorBinding processorBinding;
-
-	public RemoveActivityOutputPortMappingEdit(Activity activity,
-			OutputActivityPort outputActivityPort) {
-		super(activity);
-		this.outputActivityPort = outputActivityPort;
-	}
-
-	@Override
-	protected void doEditAction(Activity activity) {
-		removedPortBinding = scufl2Tools.processorPortBindingForPort(
-				outputActivityPort, activity.getParent());
-		processorBinding = removedPortBinding.getParent();
-		removedPortBinding.setParent(null);
-	}
-
-	@Override
-	protected void undoEditAction(Activity activity) {
-		removedPortBinding.setParent(processorBinding);
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/RemoveChildEdit.java
----------------------------------------------------------------------
diff --git a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/RemoveChildEdit.java b/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/RemoveChildEdit.java
deleted file mode 100644
index 6a0ee64..0000000
--- a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/RemoveChildEdit.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2012 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.workflow.edits;
-
-import org.apache.taverna.scufl2.api.common.Child;
-import org.apache.taverna.scufl2.api.common.WorkflowBean;
-
-/**
- * Removes a child from a parent.
- * 
- * @author David Withers
- */
-public class RemoveChildEdit<T extends WorkflowBean> extends AbstractEdit<T> {
-	private Child<T> child;
-
-	public RemoveChildEdit(T parent, Child<T> child) {
-		super(parent);
-		this.child = child;
-	}
-
-	@Override
-	protected void doEditAction(T parent) {
-		child.setParent(null);
-	}
-
-	@Override
-	protected void undoEditAction(T parent) {
-		child.setParent(parent);
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/RemoveDataLinkEdit.java
----------------------------------------------------------------------
diff --git a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/RemoveDataLinkEdit.java b/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/RemoveDataLinkEdit.java
deleted file mode 100644
index 4072d12..0000000
--- a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/RemoveDataLinkEdit.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*******************************************************************************
- * 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.workflow.edits;
-
-import java.util.List;
-
-import org.apache.taverna.scufl2.api.core.DataLink;
-import org.apache.taverna.scufl2.api.core.Workflow;
-import org.apache.taverna.scufl2.api.iterationstrategy.IterationStrategyNode;
-import org.apache.taverna.scufl2.api.iterationstrategy.IterationStrategyParent;
-import org.apache.taverna.scufl2.api.iterationstrategy.IterationStrategyTopNode;
-import org.apache.taverna.scufl2.api.iterationstrategy.PortNode;
-import org.apache.taverna.scufl2.api.port.InputProcessorPort;
-import org.apache.taverna.scufl2.api.port.ReceiverPort;
-
-/**
- * Remove a DataLink from a Workflow.
- * <p>
- * Handles setting the merge position of all dataLinks with the same receiver port.
- *
- * @author David Withers
- */
-public class RemoveDataLinkEdit extends AbstractEdit<Workflow> {
-	private final DataLink dataLink;
-	private PortNode portNode;
-	private int portPosition;
-	private IterationStrategyTopNode parent;
-
-	public RemoveDataLinkEdit(Workflow workflow, DataLink dataLink) {
-		super(workflow);
-		this.dataLink = dataLink;
-	}
-
-	@Override
-	protected void doEditAction(Workflow workflow) {
-		dataLink.setParent(null);
-		ReceiverPort sink = dataLink.getSendsTo();
-		List<DataLink> datalinksTo = scufl2Tools.datalinksTo(sink);
-		if (datalinksTo.isEmpty()) {
-			if (sink instanceof InputProcessorPort) {
-				InputProcessorPort port = (InputProcessorPort) sink;
-				for (IterationStrategyTopNode topNode : port.getParent().getIterationStrategyStack()) {
-					portNode = findPortNode(topNode, port);
-					if (portNode != null) {
-						IterationStrategyParent parentNode = portNode.getParent();
-						if (parentNode instanceof IterationStrategyTopNode) {
-							parent = (IterationStrategyTopNode) parentNode;
-							portPosition = parent.indexOf(portNode);
-							parent.remove(portNode);
-						}
-						break;
-					}
-				}
-			}
-		} else if (datalinksTo.size() == 1) {
-			datalinksTo.get(0).setMergePosition(null);
-		} else {
-			for (int i = 0; i < datalinksTo.size(); i++)
-				datalinksTo.get(i).setMergePosition(i);
-		}
-	}
-
-	@Override
-	protected void undoEditAction(Workflow workflow) {
-		ReceiverPort sink = dataLink.getSendsTo();
-		List<DataLink> datalinksTo = scufl2Tools.datalinksTo(sink);
-		if (dataLink.getMergePosition() != null)
-			for (int i = dataLink.getMergePosition(); i < datalinksTo.size(); i++)
-				datalinksTo.get(i).setMergePosition(i + 1);
-		if (portNode != null) {
-			parent.add(portPosition, portNode);
-			portNode.setParent(parent);
-		}
-		dataLink.setParent(workflow);
-	}
-
-	private PortNode findPortNode(IterationStrategyTopNode topNode,
-			InputProcessorPort port) {
-		for (IterationStrategyNode node : topNode) {
-			if (node instanceof PortNode) {
-				PortNode portNode = (PortNode) node;
-				if (port.equals(portNode.getInputProcessorPort()))
-					return portNode;
-			} else if (node instanceof IterationStrategyTopNode) {
-				IterationStrategyTopNode iterationStrategyTopNode = (IterationStrategyTopNode) node;
-				PortNode result = findPortNode(iterationStrategyTopNode, port);
-				if (result != null)
-					return result;
-			}
-		}
-		return null;
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/RemoveProcessorInputPortEdit.java
----------------------------------------------------------------------
diff --git a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/RemoveProcessorInputPortEdit.java b/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/RemoveProcessorInputPortEdit.java
deleted file mode 100644
index 3464cbb..0000000
--- a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/RemoveProcessorInputPortEdit.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*******************************************************************************
- * 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.workflow.edits;
-
-import org.apache.taverna.scufl2.api.core.Processor;
-import org.apache.taverna.scufl2.api.port.InputProcessorPort;
-
-public class RemoveProcessorInputPortEdit extends RemoveChildEdit<Processor> {
-	public RemoveProcessorInputPortEdit(Processor processor,
-			InputProcessorPort port) {
-		super(processor, port);
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/RemoveProcessorOutputPortEdit.java
----------------------------------------------------------------------
diff --git a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/RemoveProcessorOutputPortEdit.java b/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/RemoveProcessorOutputPortEdit.java
deleted file mode 100644
index 888eb77..0000000
--- a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/RemoveProcessorOutputPortEdit.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*******************************************************************************
- * 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.workflow.edits;
-
-import org.apache.taverna.scufl2.api.core.Processor;
-import org.apache.taverna.scufl2.api.port.OutputProcessorPort;
-
-public class RemoveProcessorOutputPortEdit extends RemoveChildEdit<Processor> {
-	public RemoveProcessorOutputPortEdit(Processor processor,
-			OutputProcessorPort port) {
-		super(processor, port);
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/RemoveWorkflowInputPortEdit.java
----------------------------------------------------------------------
diff --git a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/RemoveWorkflowInputPortEdit.java b/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/RemoveWorkflowInputPortEdit.java
deleted file mode 100644
index 8da256b..0000000
--- a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/RemoveWorkflowInputPortEdit.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2013 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.workflow.edits;
-
-import static org.apache.taverna.scufl2.api.common.Scufl2Tools.NESTED_WORKFLOW;
-
-import java.util.List;
-
-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 org.apache.taverna.scufl2.api.activity.Activity;
-import org.apache.taverna.scufl2.api.configurations.Configuration;
-import org.apache.taverna.scufl2.api.container.WorkflowBundle;
-import org.apache.taverna.scufl2.api.core.Processor;
-import org.apache.taverna.scufl2.api.core.Workflow;
-import org.apache.taverna.scufl2.api.port.InputActivityPort;
-import org.apache.taverna.scufl2.api.port.InputProcessorPort;
-import org.apache.taverna.scufl2.api.port.InputWorkflowPort;
-import org.apache.taverna.scufl2.api.profiles.ProcessorBinding;
-import org.apache.taverna.scufl2.api.profiles.ProcessorInputPortBinding;
-import org.apache.taverna.scufl2.api.profiles.Profile;
-
-import com.fasterxml.jackson.databind.JsonNode;
-
-/**
- * Removes an input port from a workflow.
- *
- * @author David Withers
- */
-public class RemoveWorkflowInputPortEdit extends AbstractEdit<Workflow> {
-	private final InputWorkflowPort port;
-	private final CompoundEdit nestedPortEdit = new CompoundEdit();
-
-	public RemoveWorkflowInputPortEdit(Workflow workflow, InputWorkflowPort port) {
-		super(workflow);
-		this.port = port;
-		WorkflowBundle workflowBundle = workflow.getParent();
-		if (workflowBundle != null)
-			for (Profile profile : workflowBundle.getProfiles())
-				for (Activity activity : profile.getActivities())
-					if (activity.getType().equals(NESTED_WORKFLOW))
-						for (Configuration c : scufl2Tools.configurationsFor(
-								activity, profile))
-							defineEditsForConfiguration(workflow, port,
-									workflowBundle, activity, c);
-	}
-
-	private void defineEditsForConfiguration(Workflow workflow,
-			InputWorkflowPort port, WorkflowBundle workflowBundle,
-			Activity activity, Configuration c) {
-		List<Edit<?>> edits = nestedPortEdit.getChildEdits();
-		JsonNode nested = c.getJson().get("nestedWorkflow");
-		Workflow nestedWorkflow = workflowBundle.getWorkflows().getByName(
-				nested.asText());
-		if (nestedWorkflow != workflow)
-			return;
-
-		InputActivityPort activityPort = activity.getInputPorts().getByName(
-				port.getName());
-		edits.add(new RemoveChildEdit<>(activity, activityPort));
-
-		for (ProcessorBinding binding : scufl2Tools
-				.processorBindingsToActivity(activity)) {
-			Processor processor = binding.getBoundProcessor();
-			for (ProcessorInputPortBinding portBinding : binding
-					.getInputPortBindings())
-				if (portBinding.getBoundActivityPort() == activityPort) {
-					InputProcessorPort processorPort = portBinding
-							.getBoundProcessorPort();
-					edits.add(new RemoveProcessorInputPortEdit(processor,
-							processorPort));
-					edits.add(new RemoveChildEdit<>(binding, portBinding));
-				}
-		}
-	}
-
-	@Override
-	protected void doEditAction(Workflow workflow) throws EditException {
-		port.setParent(null);
-		nestedPortEdit.doEdit();
-	}
-
-	@Override
-	protected void undoEditAction(Workflow workflow) {
-		port.setParent(workflow);
-		nestedPortEdit.undo();
-	}
-}


[36/51] [partial] incubator-taverna-workbench git commit: all packages are moved to org.apache.taverna.*

Posted by re...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/CredentialManagerUI.java
----------------------------------------------------------------------
diff --git a/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/CredentialManagerUI.java b/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/CredentialManagerUI.java
deleted file mode 100644
index fb6a347..0000000
--- a/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/CredentialManagerUI.java
+++ /dev/null
@@ -1,1512 +0,0 @@
-/*******************************************************************************
- * 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.credentialmanager;
-
-import static java.awt.BorderLayout.CENTER;
-import static java.awt.BorderLayout.NORTH;
-import static java.awt.BorderLayout.PAGE_END;
-import static java.awt.Dialog.ModalExclusionType.APPLICATION_EXCLUDE;
-import static java.awt.Toolkit.getDefaultToolkit;
-import static javax.swing.JFileChooser.APPROVE_OPTION;
-import static javax.swing.JOptionPane.ERROR_MESSAGE;
-import static javax.swing.JOptionPane.INFORMATION_MESSAGE;
-import static javax.swing.JOptionPane.NO_OPTION;
-import static javax.swing.JOptionPane.WARNING_MESSAGE;
-import static javax.swing.JOptionPane.YES_NO_OPTION;
-import static javax.swing.JOptionPane.YES_OPTION;
-import static javax.swing.JOptionPane.showConfirmDialog;
-import static javax.swing.JOptionPane.showMessageDialog;
-import static javax.swing.JTable.AUTO_RESIZE_ALL_COLUMNS;
-import static javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED;
-import static javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED;
-import static org.apache.taverna.security.credentialmanager.CredentialManager.KeystoreType.KEYSTORE;
-import static org.apache.taverna.security.credentialmanager.CredentialManager.KeystoreType.TRUSTSTORE;
-import static net.sf.taverna.t2.workbench.ui.credentialmanager.CMStrings.ALERT_TITLE;
-import static net.sf.taverna.t2.workbench.ui.credentialmanager.CMStrings.ERROR_TITLE;
-
-import java.awt.BorderLayout;
-import java.awt.Dimension;
-import java.awt.FlowLayout;
-import java.awt.Image;
-import java.awt.Point;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.MouseAdapter;
-import java.awt.event.MouseEvent;
-import java.awt.event.WindowAdapter;
-import java.awt.event.WindowEvent;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileWriter;
-import java.io.InputStreamReader;
-import java.net.URI;
-import java.security.Key;
-import java.security.KeyStore;
-import java.security.cert.Certificate;
-import java.security.cert.CertificateFactory;
-import java.security.cert.X509Certificate;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.prefs.Preferences;
-
-import javax.swing.JButton;
-import javax.swing.JFileChooser;
-import javax.swing.JFrame;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTabbedPane;
-import javax.swing.JTable;
-import javax.swing.border.EmptyBorder;
-import javax.swing.event.ListSelectionEvent;
-import javax.swing.event.ListSelectionListener;
-import javax.swing.table.TableColumn;
-
-import org.apache.taverna.security.credentialmanager.CMException;
-import org.apache.taverna.security.credentialmanager.CredentialManager;
-import org.apache.taverna.security.credentialmanager.CredentialManager.KeystoreType;
-import org.apache.taverna.security.credentialmanager.DistinguishedNameParser;
-import org.apache.taverna.security.credentialmanager.UsernamePassword;
-
-import org.apache.log4j.Logger;
-import org.bouncycastle.openssl.PEMReader;
-import org.bouncycastle.openssl.PEMWriter;
-
-/**
- * Provides a UI for the Credential Manager for users to manage their
- * credentials saved by the Credential Manager in Taverna's Keystore and
- * Trustore. Credentials include username and passwords pairs, key pairs, proxy
- * key pairs and trusted certificates of CA's and s. Credentials are stored in
- * two Bouncy Castle "UBER"-type keystores: the Keystore (containing passwords
- * and (normal and proxy) key pairs) and the Truststore (containing trusted
- * certificates).
- *
- * Inspired by the Portlecle tool (http://portecle.sourceforge.net/)
- * and Firefox's Certificate Manager.
- *
- * @author Alex Nenadic
- */
-
-@SuppressWarnings("serial")
-public class CredentialManagerUI extends JFrame {
-	private static Logger logger = Logger.getLogger(CredentialManagerUI.class);
-	/** Default tabbed pane width */
-	private static final int DEFAULT_FRAME_WIDTH = 650;
-	/** Default tabbed pane height */
-	private static final int DEFAULT_FRAME_HEIGHT = 400;
-	/** Credential Manager icon (when frame is minimised)*/
-	private static final Image credManagerIconImage = getDefaultToolkit()
-			.createImage(
-					CredentialManagerUI.class
-							.getResource("/images/cred_manager_transparent.png"));
-
-	/**
-	 * Credential Manager to manage all operations on the Keystore and
-	 * Truststore
-	 */
-	public final CredentialManager credManager;
-	private final DistinguishedNameParser dnParser;
-	
-	////////////// Tabs //////////////
-
-	/**
-	 * Tabbed pane to hold tables containing various entries in the Keystore and
-	 * Truststore
-	 */
-	private JTabbedPane keyStoreTabbedPane;
-	/** Tab 1: holds passwords table */
-	private JPanel passwordsTab = new JPanel(new BorderLayout(10, 10));
-	/** Tab 1: name */
-	public static final String PASSWORDS = "Passwords";
-	/** Tab 2: holds key pairs (user certificates) table */
-	private JPanel keyPairsTab = new JPanel(new BorderLayout(10, 10));
-	/** Tab 2: name */
-	public static final String KEYPAIRS = "Your Certificates";
-	/** Tab 3: holds trusted certificates table */
-	private JPanel trustedCertificatesTab = new JPanel(new BorderLayout(10, 10));
-	/** Tab 3: name */
-	public static final String TRUSTED_CERTIFICATES = "Trusted Certificates";
-
-	////////////// Tables //////////////
-
-	/** Password entries' table */
-	private JTable passwordsTable;
-	/** Key pair entries' table */
-	private JTable keyPairsTable;
-	/** Trusted certificate entries' table */
-	private JTable trustedCertsTable;
-	/** Password entry column type */
-	public static final String PASSWORD_ENTRY_TYPE = "Password";
-	/** Key pair entry column type */
-	public static final String KEY_PAIR_ENTRY_TYPE = "Key Pair";
-	/** Trusted cert entry column type */
-	public static final String TRUST_CERT_ENTRY_TYPE = "Trusted Certificate";
-
-	/**
-	 * Overrides the Object's clone method to prevent the singleton object to be
-	 * cloned.
-	 */
-	@Override
-	public Object clone() throws CloneNotSupportedException {
-		throw new CloneNotSupportedException();
-	}
-
-	/**
-	 * Creates a new Credential Manager UI's frame.
-	 */
-	public CredentialManagerUI(CredentialManager credentialManager,
-			DistinguishedNameParser dnParser) {
-		credManager = credentialManager;
-		this.dnParser = dnParser;
-		setModalExclusionType(APPLICATION_EXCLUDE);
-		// Initialise the UI components
-		initComponents();
-	}
-
-	private void initComponents() {
-		/*
-		 * Initialise the tabbed pane that contains the tabs with tabular
-		 * representations of the Keystore's content.
-		 */
-		keyStoreTabbedPane = new JTabbedPane();
-		/*
-		 * Initialise the tab containing the table for username/password entries
-		 * from the Keystore
-		 */
-		passwordsTable = initTable(PASSWORDS, passwordsTab);
-		/*
-		 * Initialise the tab containing the table for key pair entries from the
-		 * Keystore
-		 */
-		keyPairsTable = initTable(KEYPAIRS, keyPairsTab);
-		/*
-		 * Initialise the tab containing the table for proxy entries from the
-		 * Keystore
-		 */
-		//proxiesTable = initTable(PROXIES, proxiesTab);
-		/*
-		 * Initialise the tab containing the table for trusted certificate
-		 * entries from the Truststore
-		 */
-		trustedCertsTable = initTable(TRUSTED_CERTIFICATES,
-				trustedCertificatesTab);
-		/*
-		 * Set the size of the tabbed pane to the preferred size - the size of
-		 * the main application frame depends on it.
-		 */
-		keyStoreTabbedPane.setPreferredSize(new Dimension(DEFAULT_FRAME_WIDTH,
-				DEFAULT_FRAME_HEIGHT));
-
-		JPanel globalButtons = new JPanel(new FlowLayout(FlowLayout.RIGHT));
-		JButton resetJavaAuthCache = new JButton("Clear HTTP authentication");
-		resetJavaAuthCache.addActionListener(new ActionListener() {
-			@Override
-			public void actionPerformed(ActionEvent e) {
-				clearAuthenticationCache();
-			}
-		});
-		globalButtons.add(resetJavaAuthCache);
-
-		// Button for changing Credential Manager's master password
-		JButton changeMasterPasswordButton = new JButton(
-				"Change master password");
-		changeMasterPasswordButton.addActionListener(new ActionListener() {
-			@Override
-			public void actionPerformed(ActionEvent e) {
-				changeMasterPassword();
-			}
-		});
-		globalButtons.add(changeMasterPasswordButton);
-
-		// Add change master password to the main application frame
-		getContentPane().add(globalButtons, NORTH);
-		// Add tabbed pane to the main application frame
-		getContentPane().add(keyStoreTabbedPane, CENTER);
-
-		// Handle application close
-		addWindowListener(new WindowAdapter() {
-			@Override
-			public void windowClosing(WindowEvent evt) {
-				closeFrame();
-			}
-		});
-		setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
-
-		pack();
-
-		// Centre the frame in the centre of the screen
-		setLocationRelativeTo(null);
-
-		// Set the frame's icon
-		setIconImage(credManagerIconImage);
-
-		// Set the frame's title
-		setTitle("Credential Manager");
-
-		// setModal(true);
-		// setVisible(true);
-	}
-
-	protected void clearAuthenticationCache() {
-		if (!credManager.resetAuthCache())
-			showMessageDialog(
-					this,
-					"Java's internal HTTP authentication cache could not be cleared. \n\n"
-							+ "Taverna can only clear the cache using an undocumented Java API \n"
-							+ "that might not work if you are using a Java VM other than \n"
-							+ "Java 6 from Sun. You can restarting Taverna to clear the cache.",
-					"Could not clear authentication cache", ERROR_MESSAGE);
-		else
-			showMessageDialog(
-					this,
-					"Java's internal HTTP authentication cache has been cleared. \n\n"
-							+ "You might also need to edit or delete individual \n"
-							+ "password entries in the credential manager \n"
-							+ "if a relevant password has previously been saved.",
-					"Cleared authentication cache", INFORMATION_MESSAGE);
-	}
-
-	protected void changeMasterPassword() {
-		ChangeMasterPasswordDialog changePasswordDialog = new ChangeMasterPasswordDialog(
-				this, "Change master password", true,
-				"Change master password for Credential Manager", credManager);
-		changePasswordDialog.setLocationRelativeTo(null);
-		changePasswordDialog.setVisible(true);
-		String password = changePasswordDialog.getPassword();
-		if (password == null) // user cancelled
-			return; // do nothing
-
-		try {
-			credManager.changeMasterPassword(password);
-			showMessageDialog(this, "Master password changed sucessfully",
-					ALERT_TITLE, INFORMATION_MESSAGE);
-		} catch (CMException cme) {
-			/*
-			 * Failed to change the master password for Credential Manager -
-			 * warn the user
-			 */
-			String exMessage = "Failed to change master password for Credential Manager";
-			logger.error(exMessage);
-			showMessageDialog(this, exMessage, ERROR_TITLE, ERROR_MESSAGE);
-		}
-	}
-
-	/**
-	 * Initialise the tabs and tables with the content from the Keystore and Truststore.
-	 */
-	private JTable initTable(String tableType, JPanel tab) {
-		JTable table = null;
-
-		if (tableType.equals(PASSWORDS)) { // Passwords table
-			// The Passwords table's data model
-			PasswordsTableModel passwordsTableModel = new PasswordsTableModel(credManager);
-			// The table itself
-			table = new JTable(passwordsTableModel);
-
-			/*
-			 * Set the password and alias columns of the Passwords table to be
-			 * invisible by removing them from the column model (they will still
-			 * present in the table model)
-			 * 
-			 * Remove the last column first
-			 */
-			TableColumn aliasColumn = table.getColumnModel().getColumn(5);
-			table.getColumnModel().removeColumn(aliasColumn);
-			TableColumn passwordColumn = table.getColumnModel().getColumn(4);
-			table.getColumnModel().removeColumn(passwordColumn);
-			TableColumn lastModifiedDateColumn = table.getColumnModel().getColumn(3);
-			table.getColumnModel().removeColumn(lastModifiedDateColumn);
-
-			// Buttons
-			JButton newPasswordButton = new JButton("New");
-			newPasswordButton.addActionListener(new ActionListener() {
-				@Override
-				public void actionPerformed(ActionEvent e) {
-					newPassword();
-				}
-			});
-
-			final JButton viewPasswordButton = new JButton("Details");
-			viewPasswordButton.addActionListener(new ActionListener() {
-				@Override
-				public void actionPerformed(ActionEvent e) {
-					viewPassword();
-				}
-			});
-			viewPasswordButton.setEnabled(false);
-
-			final JButton editPasswordButton = new JButton("Edit");
-			editPasswordButton.addActionListener(new ActionListener() {
-				@Override
-				public void actionPerformed(ActionEvent e) {
-					editPassword();
-				}
-			});
-			editPasswordButton.setEnabled(false);
-
-			final JButton deletePasswordButton = new JButton("Delete");
-			deletePasswordButton.addActionListener(new ActionListener() {
-				@Override
-				public void actionPerformed(ActionEvent e) {
-					deletePassword();
-				}
-			});
-			deletePasswordButton.setEnabled(false);
-
-			/*
-			 * Selection listener for passwords table to enable/disable action
-			 * buttons accordingly
-			 */
-			class PasswordsTableSelectionListner implements
-					ListSelectionListener {
-				@Override
-				public void valueChanged(ListSelectionEvent e) {
-					if (e.getSource() != passwordsTable.getSelectionModel())
-						return;
-					if (passwordsTable.getSelectedRow() == -1) {
-						// nothing is selected
-						viewPasswordButton.setEnabled(false);
-						editPasswordButton.setEnabled(false);
-						deletePasswordButton.setEnabled(false);
-					} else {
-						if (!viewPasswordButton.isEnabled())
-							viewPasswordButton.setEnabled(true);
-						if (!editPasswordButton.isEnabled())
-							editPasswordButton.setEnabled(true);
-						if (!deletePasswordButton.isEnabled())
-							deletePasswordButton.setEnabled(true);
-					}
-				}
-			}
-			table.getSelectionModel().addListSelectionListener(new PasswordsTableSelectionListner());
-
-			// Panel to hold the buttons
-			JPanel bp = new JPanel();
-			bp.add(viewPasswordButton);
-			bp.add(editPasswordButton);
-			bp.add(newPasswordButton);
-			bp.add(deletePasswordButton);
-
-			// Add button panel to the tab
-			tab.add(bp, PAGE_END);
-
-		} else if (tableType.equals(KEYPAIRS)) { // Key Pairs tab
-			// The Key Pairs table's data model
-			KeyPairsTableModel keyPairsTableModel = new KeyPairsTableModel(credManager);
-			// The table itself
-			table = new JTable(keyPairsTableModel);
-
-			/*
-			 * Set the alias and service URIs columns of the KayPairs table to
-			 * be invisible by removing them from the column model (they will
-			 * still present in the table model)
-			 * 
-			 * Remove the last column first
-			 */
-			TableColumn aliasColumn = table.getColumnModel().getColumn(6);
-			table.getColumnModel().removeColumn(aliasColumn);
-			TableColumn serviceURIsColumn = table.getColumnModel().getColumn(5);
-			table.getColumnModel().removeColumn(serviceURIsColumn);
-			TableColumn lastModifiedDateColumn = table.getColumnModel().getColumn(4);
-			table.getColumnModel().removeColumn(lastModifiedDateColumn);
-
-			// Buttons
-			final JButton viewKeyPairButton = new JButton("Details");
-			viewKeyPairButton.addActionListener(new ActionListener() {
-				@Override
-				public void actionPerformed(ActionEvent e) {
-					viewCertificate();
-				}
-			});
-			viewKeyPairButton.setEnabled(false);
-
-			JButton importKeyPairButton = new JButton("Import");
-			importKeyPairButton.addActionListener(new ActionListener() {
-				@Override
-				public void actionPerformed(ActionEvent e) {
-					importKeyPair();
-				}
-			});
-
-			final JButton exportKeyPairButton = new JButton("Export");
-			exportKeyPairButton.addActionListener(new ActionListener() {
-				@Override
-				public void actionPerformed(ActionEvent e) {
-					exportKeyPair();
-				}
-			});
-			exportKeyPairButton.setEnabled(false);
-
-			final JButton deleteKeyPairButton = new JButton("Delete");
-			deleteKeyPairButton.addActionListener(new ActionListener() {
-				@Override
-				public void actionPerformed(ActionEvent e) {
-					deleteKeyPair();
-				}
-			});
-			deleteKeyPairButton.setEnabled(false);
-
-			/*
-			 * Selection listener for key pairs table to enable/disable action
-			 * buttons accordingly
-			 */
-			class KeyPairsTableSelectionListner implements
-					ListSelectionListener {
-				@Override
-				public void valueChanged(ListSelectionEvent e) {
-					if (e.getSource() != keyPairsTable.getSelectionModel())
-						return;
-					if (keyPairsTable.getSelectedRow() == -1) {
-						// nothing is selected
-						viewKeyPairButton.setEnabled(false);
-						exportKeyPairButton.setEnabled(false);
-						deleteKeyPairButton.setEnabled(false);
-					} else {
-						if (!viewKeyPairButton.isEnabled())
-							viewKeyPairButton.setEnabled(true);
-						if (!exportKeyPairButton.isEnabled())
-							exportKeyPairButton.setEnabled(true);
-						if (!deleteKeyPairButton.isEnabled())
-							deleteKeyPairButton.setEnabled(true);
-					}
-				}
-			}
-			table.getSelectionModel().addListSelectionListener(
-					new KeyPairsTableSelectionListner());
-
-			// Panel to hold the buttons
-			JPanel bp = new JPanel();
-			bp.add(viewKeyPairButton);
-			bp.add(importKeyPairButton);
-			bp.add(exportKeyPairButton);
-			bp.add(deleteKeyPairButton);
-
-			// Add button panel to the tab
-			tab.add(bp, PAGE_END);
-		} else if (tableType.equals(TRUSTED_CERTIFICATES)) { // Certificates tab
-
-			// The Trusted Certificate table's data model
-			TrustedCertsTableModel trustedCertificatesTableModel = new TrustedCertsTableModel(credManager);
-			// The table itself
-			table = new JTable(trustedCertificatesTableModel);
-
-			/*
-			 * Set the alias columns of the Trusted Certs table to be invisible
-			 * by removing them from the column model (they will still be
-			 * present in the table model)
-			 * 
-			 * Remove the last column first
-			 */
-			TableColumn aliasColumn = table.getColumnModel().getColumn(5);
-			table.getColumnModel().removeColumn(aliasColumn);
-			TableColumn lastModifiedDateColumn = table.getColumnModel().getColumn(4);
-			table.getColumnModel().removeColumn(lastModifiedDateColumn);
-
-			// Buttons
-			final JButton viewTrustedCertificateButton = new JButton("Details");
-			viewTrustedCertificateButton
-					.addActionListener(new ActionListener() {
-						@Override
-						public void actionPerformed(ActionEvent e) {
-							viewCertificate();
-						}
-					});
-			viewTrustedCertificateButton.setEnabled(false);
-
-			JButton importTrustedCertificateButton = new JButton("Import");
-			importTrustedCertificateButton
-					.addActionListener(new ActionListener() {
-						@Override
-						public void actionPerformed(ActionEvent e) {
-							importTrustedCertificate();
-						}
-					});
-
-			final JButton exportTrustedCertificateButton = new JButton("Export");
-			exportTrustedCertificateButton
-					.addActionListener(new ActionListener() {
-						@Override
-						public void actionPerformed(ActionEvent e) {
-							exportTrustedCertificate();
-						}
-					});
-			exportTrustedCertificateButton.setEnabled(false);
-
-			final JButton deleteTrustedCertificateButton = new JButton("Delete");
-			deleteTrustedCertificateButton
-					.addActionListener(new ActionListener() {
-						@Override
-						public void actionPerformed(ActionEvent e) {
-							deleteTrustedCertificate();
-						}
-					});
-			deleteTrustedCertificateButton.setEnabled(false);
-
-			// Selection listener for trusted certs table to enable/disable action buttons accordingly
-			class TrustedCertsTableSelectionListener implements
-					ListSelectionListener {
-				@Override
-				public void valueChanged(ListSelectionEvent e) {
-					if (e.getSource() != trustedCertsTable.getSelectionModel())
-						return;
-					if (trustedCertsTable.getSelectedRow() == -1) {
-						// nothing is selected
-						viewTrustedCertificateButton.setEnabled(false);
-						exportTrustedCertificateButton.setEnabled(false);
-						deleteTrustedCertificateButton.setEnabled(false);
-					} else {
-						if (!viewTrustedCertificateButton.isEnabled())
-							viewTrustedCertificateButton.setEnabled(true);
-						if (!exportTrustedCertificateButton.isEnabled())
-							exportTrustedCertificateButton.setEnabled(true);
-						if (!deleteTrustedCertificateButton.isEnabled())
-							deleteTrustedCertificateButton.setEnabled(true);
-					}
-				}
-			}
-			table.getSelectionModel().addListSelectionListener(
-					new TrustedCertsTableSelectionListener());
-
-			// Panel to hold the buttons
-			JPanel bp = new JPanel();
-			bp.add(viewTrustedCertificateButton);
-			bp.add(importTrustedCertificateButton);
-			bp.add(exportTrustedCertificateButton);
-			bp.add(deleteTrustedCertificateButton);
-
-			// Add button panel to the tab
-			tab.add(bp, PAGE_END);
-		} else {
-			throw new RuntimeException("Unknown table type " + tableType);
-		}
-
-		table.setShowGrid(false);
-		table.setRowMargin(0);
-		table.getColumnModel().setColumnMargin(0);
-		table.getTableHeader().setReorderingAllowed(false);
-		table.setAutoResizeMode(AUTO_RESIZE_ALL_COLUMNS);
-		// Top accommodates entry icons with 2 pixels spare space (images are
-		// 16x16 pixels)
-		table.setRowHeight(18);
-
-		// Add custom renderrers for the table headers and cells
-		for (int iCnt = 0; iCnt < table.getColumnCount(); iCnt++) {
-			TableColumn column = table.getColumnModel().getColumn(iCnt);
-			column.setHeaderRenderer(new TableHeaderRenderer());
-			column.setCellRenderer(new TableCellRenderer());
-		}
-
-		// Make the first column small and not resizable (it holds icons to
-		// represent different entry types)
-		TableColumn typeCol = table.getColumnModel().getColumn(0);
-		typeCol.setResizable(false);
-		typeCol.setMinWidth(20);
-		typeCol.setMaxWidth(20);
-		typeCol.setPreferredWidth(20);
-
-		// Set the size for the second column
-		// (i.e. Service URI column of Passwords table, and
-		// Certificate Name column of the Kay Pairs and Trusted Certificates tables)
-		// We do not care about the size of other columns.
-		TableColumn secondCol = table.getColumnModel().getColumn(1);
-		secondCol.setMinWidth(20);
-		secondCol.setMaxWidth(10000);
-		secondCol.setPreferredWidth(300);
-
-		// Put the table into a scroll pane
-		JScrollPane jspTableScrollPane = new JScrollPane(table,
-				VERTICAL_SCROLLBAR_AS_NEEDED, HORIZONTAL_SCROLLBAR_AS_NEEDED);
-		jspTableScrollPane.getViewport().setBackground(table.getBackground());
-
-		// Put the scroll pane on the tab panel
-		tab.add(jspTableScrollPane, CENTER);
-		jspTableScrollPane.setBorder(new EmptyBorder(3, 3, 3, 3));
-
-		/*
-		 * Add mouse listeners to show an entry's details if it is
-		 * double-clicked
-		 */
-		table.addMouseListener(new MouseAdapter() {
-			@Override
-			public void mouseClicked(MouseEvent evt) {
-				tableDoubleClick(evt);
-			}
-		});
-
-		// Add the tab to the tabbed pane
-		keyStoreTabbedPane.addTab(tableType, tab);
-
-		return table;
-	}
-
-	/**
-	 * Displays the details of the username/password pair entry - this includes
-	 * showing the plaintext password and service URI for this entry.
-	 */
-	private void viewPassword() {
-		// Which username/password pair entry has been selected, if any?
-		int iRow = passwordsTable.getSelectedRow();
-		if (iRow == -1) // no row currently selected
-			return;
-
-		// Get current values for service URI, username and password
-		String serviceURI = (String) passwordsTable.getValueAt(iRow, 1); // current entry's service URI
-
-		String username = (String) passwordsTable.getValueAt(iRow, 2); // current entry's username
-
-		/*
-		 * Because the password column is not visible we call the getValueAt
-		 * method on the table model rather than at the JTable
-		 */
-		String password = (String) passwordsTable.getModel()
-				.getValueAt(iRow, 4); // current entry's password value
-
-		// Let the user view service URI, username and password of the entry
-		ViewUsernamePasswordEntryDialog viewServicePassDialog = new ViewUsernamePasswordEntryDialog(
-				this, serviceURI, username, password);
-
-		viewServicePassDialog.setLocationRelativeTo(this);
-		viewServicePassDialog.setVisible(true);
-	}
-
-	/**
-	 * Lets a user insert a new username/password/service URI tuple to the
-	 * Keystore.
-	 */
-	private void newPassword() {
-		URI serviceURI = null; // service URI
-		String username = null; // username
-		String password = null; // password
-
-		// Loop until the user cancels or enters everything correctly
-		while (true) {
-			/*
-			 * Let the user insert a new password entry (by specifying service
-			 * URI, username and password)
-			 */
-			NewEditPasswordEntryDialog newPasswordDialog = new NewEditPasswordEntryDialog(
-					this, "New username and password for a service", true,
-					serviceURI, username, password, credManager);
-			newPasswordDialog.setLocationRelativeTo(this);
-			newPasswordDialog.setVisible(true);
-
-			serviceURI = newPasswordDialog.getServiceURI(); // get service URI
-			username = newPasswordDialog.getUsername(); // get username
-			password = newPasswordDialog.getPassword(); // get password
-
-			if (password == null) { // user cancelled - any of the above three
-				// fields is null
-				// do nothing
-				return;
-			}
-
-			/*
-			 * Check if a password entry with the given service URI already
-			 * exists in the Keystore. We ask this here as the user may wish to
-			 * overwrite the existing password entry. Checking for key pair
-			 * entries' URIs is done in the NewEditPasswordEntry dialog.
-			 */
-
-			/*
-			 * Get list of service URIs for all the password entries in the
-			 * Keystore
-			 */
-			List<URI> serviceURIs = null;
-			try {
-				serviceURIs = credManager
-						.getServiceURIsForAllUsernameAndPasswordPairs();
-			} catch (CMException cme) {
-				showMessageDialog(this, "Failed to get service URIs for all username and password pairs "
-						+ "to check if the entered service URI already exists",
-						ERROR_TITLE, ERROR_MESSAGE);
-				return;
-			}
-			if (serviceURIs.contains(serviceURI)) { // if such a URI already
-				// exists
-				// Ask if the user wants to overwrite it
-				int answer = showConfirmDialog(
-								this,
-								"Credential Manager already contains a password entry with the same service URI.\n"
-										+ "Do you want to overwrite it?",
-								ALERT_TITLE,
-								YES_NO_OPTION);
-
-				// Add the new password entry in the Keystore
-				try {
-					if (answer == YES_OPTION) {
-						credManager.addUsernameAndPasswordForService(
-								new UsernamePassword(username, password),
-								serviceURI);
-						break;
-					}
-				} catch (CMException cme) {
-					showMessageDialog(
-							this,
-							"Credential Manager failed to insert a new username and password pair",
-							ERROR_TITLE, ERROR_MESSAGE);
-				}
-				/*
-				 * Otherwise show the same window with the entered service URI,
-				 * username and password values
-				 */
-			} else
-				// Add the new password entry in the Keystore
-				try {
-					credManager.addUsernameAndPasswordForService(new UsernamePassword(username,
-							password), serviceURI);
-					break;
-				} catch (CMException cme) {
-					showMessageDialog(
-							this,
-							"Credential Manager failed to insert a new username and password pair",
-							ERROR_TITLE, ERROR_MESSAGE);
-				}
-		}
-	}
-
-	/**
-	 * Lets a user insert a new username/password pair for a given service URI
-	 * to the Keystore.
-	 */
-	public void newPasswordForService(URI serviceURI) {
-		/*
-		 * As this method can be called from outside of Credential Manager UI,
-		 * e.g. from wsdl-activity-ui or rshell-activity-ui to pop up a dialog
-		 * to ask the user for username and password, we also want to make sure
-		 * the main Credential Manager UI Dialog is visible as it may be clearer
-		 * to the user what is going on
-		 */
-		if (!isVisible() || getState() == ICONIFIED)
-			setVisible(true);
-
-		// Make sure password tab is selected as this method may
-		// be called from outside of Credential Manager UI.
-		keyStoreTabbedPane.setSelectedComponent(passwordsTab);
-
-		String username = null; // username
-		String password = null; // password
-
-		// Loop until the user cancels or enters everything correctly
-		while (true) {
-
-//			if(!this.isVisible()){ // if Cred Man UI is already showing but e.g. obscured by another window or minimised
-//				// Do not bring it up!
-//			} // actually we now want to show it as it makes it clearer to the user what is going on
-
-			// Let the user insert a new password entry for the given service
-			// URI (by specifying username and password)
-			NewEditPasswordEntryDialog newPasswordDialog = new NewEditPasswordEntryDialog(
-					this, "New username and password for a service", true,
-					serviceURI, username, password, credManager);
-			newPasswordDialog.setLocationRelativeTo(this);
-			newPasswordDialog.setVisible(true);
-
-			serviceURI = newPasswordDialog.getServiceURI(); // get service URI
-			username = newPasswordDialog.getUsername(); // get username
-			password = newPasswordDialog.getPassword(); // get password
-
-			if (password == null) // user cancelled - any of the above three
-				// fields is null
-				// do nothing
-				return;
-
-			/*
-			 * Check if a password entry with the given service URI already
-			 * exists in the Keystore. We ask this here as the user may wish to
-			 * overwrite the existing password entry. Checking for key pair
-			 * entries' URIs is done in the NewEditPasswordEntry dialog.
-			 */
-
-			// Get list of service URIs for all the password entries in the
-			// Keystore
-			List<URI> serviceURIs = null;
-			try {
-				serviceURIs = credManager
-						.getServiceURIsForAllUsernameAndPasswordPairs();
-			} catch (CMException cme) {
-				showMessageDialog(this, "Failed to get service URIs for all username and password pairs "
-						+ "to check if the entered service URI already exists",
-						ERROR_TITLE, ERROR_MESSAGE);
-				return;
-			}
-			if (serviceURIs.contains(serviceURI)) { // if such a URI already
-				// exists
-				// Ask if the user wants to overwrite it
-				int answer = showConfirmDialog(
-						this,
-						"Credential Manager already contains a password entry with the same service URI.\n"
-								+ "Do you want to overwrite it?", ALERT_TITLE,
-						YES_NO_OPTION);
-
-				// Add the new password entry in the Keystore
-				try {
-					if (answer == YES_OPTION) {
-						credManager.addUsernameAndPasswordForService(
-								new UsernamePassword(username, password),
-								serviceURI);
-						break;
-					}
-				} catch (CMException cme) {
-					String exMessage = "Credential Manager failed to insert a new username and password pair";
-					showMessageDialog(this, exMessage, ERROR_TITLE,
-							ERROR_MESSAGE);
-				}
-				// Otherwise show the same window with the entered service
-				// URI, username and password values
-			} else
-				// Add the new password entry in the Keystore
-				try {
-					credManager.addUsernameAndPasswordForService(new UsernamePassword(username,
-							password), serviceURI);
-					break;
-				} catch (CMException cme) {
-					showMessageDialog(this, "Credential Manager failed to insert a new username and password pair",
-							ERROR_TITLE,
-							ERROR_MESSAGE);
-				}
-		}
-	}
-
-	/**
-	 * Lets a user edit a username and password entry or their related service
-	 * URI to the Keystore.
-	 */
-	private void editPassword() {
-		// Which password entry has been selected?
-		int iRow = passwordsTable.getSelectedRow();
-		if (iRow == -1) { // no row currently selected
-			return;
-		}
-
-		// Get current values for service URI, username and password
-		URI serviceURI = URI.create((String) passwordsTable.getValueAt(iRow, 1)); // current entry's service URI
-
-		String username = (String) passwordsTable.getValueAt(iRow, 2); // current entry's username
-
-		/*
-		 * Because the password column is not visible we call the getValueAt
-		 * method on the table model rather than at the JTable
-		 */
-		String password = (String) passwordsTable.getModel()
-				.getValueAt(iRow, 4); // current entry's password value
-
-		while (true) { // loop until user cancels or enters everything correctly
-			// Let the user edit service URI, username or password of a password entry
-			NewEditPasswordEntryDialog editPasswordDialog = new NewEditPasswordEntryDialog(
-					this, "Edit username and password for a service", true,
-					serviceURI, username, password, credManager);
-
-			editPasswordDialog.setLocationRelativeTo(this);
-			editPasswordDialog.setVisible(true);
-
-			// New values
-			URI newServiceURI = editPasswordDialog.getServiceURI(); // get new service URI
-			String newUsername = editPasswordDialog.getUsername(); // get new username
-			String newPassword = editPasswordDialog.getPassword(); // get new password
-
-			if (newPassword == null) // user cancelled - any of the above three
-				// fields is null
-				// do nothing
-				return;
-
-			// Is anything actually modified?
-			boolean isModified = !serviceURI.equals(newServiceURI)
-					|| !username.equals(newUsername)
-					|| !password.equals(newPassword);
-
-			if (isModified) {
-				/*
-				 * Check if a different password entry with the new URI (i.e.
-				 * alias) already exists in the Keystore We ask this here as the
-				 * user may wish to overwrite that other password entry.
-				 */
-
-				// Get list of URIs for all passwords in the Keystore
-				List<URI> serviceURIs = null;
-				try {
-					serviceURIs = credManager
-							.getServiceURIsForAllUsernameAndPasswordPairs();
-				} catch (CMException cme) {
-					showMessageDialog(this, "Failed to get service URIs for all username and password pairs "
-							+ "to check if the modified entry already exists",
-							ERROR_TITLE,
-							ERROR_MESSAGE);
-					return;
-				}
-
-				// If the modified service URI already exists and is not the
-				// currently selected one
-				if (!newServiceURI.equals(serviceURI)
-						&& serviceURIs.contains(newServiceURI)) {
-					int answer = showConfirmDialog(
-							this,
-							"The Keystore already contains username and password pair for the entered service URI.\n"
-									+ "Do you want to overwrite it?",
-							ALERT_TITLE, YES_NO_OPTION);
-
-					try {
-						if (answer == YES_OPTION) {
-							/*
-							 * Overwrite that other entry entry and save the new
-							 * one in its place. Also remove the current one
-							 * that we are editing - as it is replacing the
-							 * other entry.
-							 */
-							credManager
-									.deleteUsernameAndPasswordForService(serviceURI);
-							credManager.addUsernameAndPasswordForService(
-									new UsernamePassword(newUsername,
-											newPassword), newServiceURI);
-							break;
-						}
-					} catch (CMException cme) {
-						showMessageDialog(
-								this,
-								"Failed to update the username and password pair in the Keystore",
-								ERROR_TITLE, ERROR_MESSAGE);
-					}
-					// Otherwise show the same window with the entered
-					// service URI, username and password values
-				} else
-					try {
-						if (!newServiceURI.equals(serviceURI))
-							credManager
-									.deleteUsernameAndPasswordForService(serviceURI);
-						credManager.addUsernameAndPasswordForService(
-								new UsernamePassword(newUsername, newPassword), newServiceURI);
-						break;
-					} catch (CMException cme) {
-						showMessageDialog(
-								this,
-								"Failed to update the username and password pair in the Keystore",
-								ERROR_TITLE, ERROR_MESSAGE);
-					}
-			} else // nothing actually modified
-				break;
-		}
-	}
-
-	/**
-	 * Lets the user delete the selected username and password entries from the
-	 * Keystore.
-	 */
-	private void deletePassword() {
-		// Which entries have been selected?
-		int[] selectedRows = passwordsTable.getSelectedRows();
-		if (selectedRows.length == 0) // no password entry selected
-			return;
-
-		// Ask user to confirm the deletion
-		if (showConfirmDialog(
-				null,
-				"Are you sure you want to delete the selected username and password entries?",
-				ALERT_TITLE, YES_NO_OPTION) != YES_OPTION)
-			return;
-
-		String exMessage = null;
-		for (int i = selectedRows.length - 1; i >= 0; i--) { // delete from backwards
-			// Get service URI for the current entry
-			URI serviceURI = URI.create((String) passwordsTable.getValueAt(selectedRows[i], 1));
-			// current entry's service URI
-			try {
-				// Delete the password entry from the Keystore
-				credManager.deleteUsernameAndPasswordForService(serviceURI);
-			} catch (CMException cme) {
-				exMessage = "Failed to delete the username and password pair from the Keystore";
-			}
-		}
-		if (exMessage != null)
-			showMessageDialog(this, exMessage, ERROR_TITLE, ERROR_MESSAGE);
-	}
-
-	/**
-	 * Shows the contents of a (user or trusted) certificate.
-	 */
-	private void viewCertificate() {
-		int selectedRow = -1;
-		String alias = null;
-		X509Certificate certToView = null;
-		ArrayList<String> serviceURIs = null;
-		KeystoreType keystoreType = null;
-
-		// Are we showing user's public key certificate?
-		if (keyPairsTab.isShowing()) {
-			keystoreType = KEYSTORE;
-			selectedRow = keyPairsTable.getSelectedRow();
-
-			if (selectedRow != -1)
-				/*
-				 * Because the alias column is not visible we call the
-				 * getValueAt method on the table model rather than at the
-				 * JTable
-				 */
-				alias = (String) keyPairsTable.getModel().getValueAt(selectedRow, 6); // current entry's Keystore alias
-		}
-		// Are we showing trusted certificate?
-		else if (trustedCertificatesTab.isShowing()) {
-			keystoreType = TRUSTSTORE;
-			selectedRow = trustedCertsTable.getSelectedRow();
-
-			if (selectedRow != -1)
-				/*
-				 * Get the selected trusted certificate entry's Truststore alias
-				 * Alias column is invisible so we get the value from the table
-				 * model
-				 */
-				alias = (String) trustedCertsTable.getModel().getValueAt(
-						selectedRow, 5);
-		}
-
-		try {
-			if (selectedRow != -1) { // something has been selected
-				// Get the entry's certificate
-				certToView = dnParser.convertCertificate(credManager
-						.getCertificate(keystoreType, alias));
-
-				// Show the certificate's contents to the user
-				ViewCertDetailsDialog viewCertDetailsDialog = new ViewCertDetailsDialog(
-						this, "Certificate details", true, certToView,
-						serviceURIs, dnParser);
-				viewCertDetailsDialog.setLocationRelativeTo(this);
-				viewCertDetailsDialog.setVisible(true);
-			}
-		} catch (CMException cme) {
-			String exMessage = "Failed to get certificate details to display to the user";
-			logger.error(exMessage, cme);
-			showMessageDialog(this, exMessage, ERROR_TITLE, ERROR_MESSAGE);
-		}
-	}
-
-	/**
-	 * Lets a user import a key pair from a PKCS #12 keystore file to the
-	 * Keystore.
-	 */
-	private void importKeyPair() {
-		/*
-		 * Let the user choose a PKCS #12 file (keystore) containing a public
-		 * and private key pair to import
-		 */
-		File importFile = selectImportExportFile(
-				"PKCS #12 file to import from", // title
-				new String[] { ".p12", ".pfx" }, // array of file extensions
-				// for the file filter
-				"PKCS#12 Files (*.p12, *.pfx)", // description of the filter
-				"Import", // text for the file chooser's approve button
-				"keyPairDir"); // preference string for saving the last chosen directory
-
-		if (importFile == null)
-			return;
-
-		// The PKCS #12 keystore is not a file
-		if (!importFile.isFile()) {
-			showMessageDialog(this, "Your selection is not a file",
-					ALERT_TITLE, WARNING_MESSAGE);
-			return;
-		}
-
-		// Get the user to enter the password that was used to encrypt the
-		// private key contained in the PKCS #12 file
-		GetPasswordDialog getPasswordDialog = new GetPasswordDialog(this,
-				"Import key pair entry", true,
-				"Enter the password that was used to encrypt the PKCS #12 file");
-		getPasswordDialog.setLocationRelativeTo(this);
-		getPasswordDialog.setVisible(true);
-
-		String pkcs12Password = getPasswordDialog.getPassword();
-
-		if (pkcs12Password == null) // user cancelled
-			return;
-		else if (pkcs12Password.isEmpty()) // empty password
-			// FIXME: Maybe user did not have the password set for the private key???
-			return;
-
-		try {
-			// Load the PKCS #12 keystore from the file
-			// (this is using the BouncyCastle provider !!!)
-			KeyStore pkcs12Keystore = credManager.loadPKCS12Keystore(importFile,
-					pkcs12Password);
-
-			/*
-			 * Display the import key pair dialog supplying all the private keys
-			 * stored in the PKCS #12 file (normally there will be only one
-			 * private key inside, but could be more as this is a keystore after
-			 * all).
-			 */
-			NewKeyPairEntryDialog importKeyPairDialog = new NewKeyPairEntryDialog(
-					this, "Credential Manager", true, pkcs12Keystore, dnParser);
-			importKeyPairDialog.setLocationRelativeTo(this);
-			importKeyPairDialog.setVisible(true);
-
-			// Get the private key and certificate chain of the key pair
-			Key privateKey = importKeyPairDialog.getPrivateKey();
-			Certificate[] certChain = importKeyPairDialog.getCertificateChain();
-
-			if (privateKey == null || certChain == null)
-				// User did not select a key pair for import or cancelled
-				return;
-
-			/*
-			 * Check if a key pair entry with the same alias already exists in
-			 * the Keystore
-			 */
-			if (credManager.hasKeyPair(privateKey, certChain)
-					&& showConfirmDialog(this,
-							"The keystore already contains the key pair entry with the same private key.\n"
-									+ "Do you want to overwrite it?",
-							ALERT_TITLE, YES_NO_OPTION) != YES_OPTION)
-				return;
-
-			// Place the private key and certificate chain into the Keystore
-			credManager.addKeyPair(privateKey, certChain);
-
-			// Display success message
-			showMessageDialog(this, "Key pair import successful", ALERT_TITLE,
-					INFORMATION_MESSAGE);
-		} catch (Exception ex) { // too many exceptions to catch separately
-			String exMessage = "Failed to import the key pair entry to the Keystore. "
-					+ ex.getMessage();
-			logger.error(exMessage, ex);
-			showMessageDialog(this, exMessage, ERROR_TITLE, ERROR_MESSAGE);
-		}
-	}
-
-	/**
-	 * Lets a user export user's private and public key pair to a PKCS #12
-	 * keystore file.
-	 */
-	private void exportKeyPair() {
-		// Which key pair entry has been selected?
-		int selectedRow = keyPairsTable.getSelectedRow();
-		if (selectedRow == -1) // no row currently selected
-			return;
-
-		// Get the key pair entry's Keystore alias
-		String alias = (String) keyPairsTable.getModel().getValueAt(selectedRow, 6);
-
-		// Let the user choose a PKCS #12 file (keystore) to export public and
-		// private key pair to
-		File exportFile = selectImportExportFile("Select a file to export to", // title
-				new String[] { ".p12", ".pfx" }, // array of file extensions
-				// for the file filter
-				"PKCS#12 Files (*.p12, *.pfx)", // description of the filter
-				"Export", // text for the file chooser's approve button
-				"keyPairDir"); // preference string for saving the last chosen directory
-
-		if (exportFile == null)
-			return;
-
-		// If file already exist - ask the user if he wants to overwrite it
-		if (exportFile.isFile()
-				&& showConfirmDialog(this,
-						"The file with the given name already exists.\n"
-								+ "Do you want to overwrite it?", ALERT_TITLE,
-						YES_NO_OPTION) == NO_OPTION)
-			return;
-
-		// Get the user to enter the password for the PKCS #12 keystore file
-		GetPasswordDialog getPasswordDialog = new GetPasswordDialog(this,
-				"Credential Manager", true,
-				"Enter the password for protecting the exported key pair");
-		getPasswordDialog.setLocationRelativeTo(this);
-		getPasswordDialog.setVisible(true);
-
-		String pkcs12Password = getPasswordDialog.getPassword();
-
-		if (pkcs12Password == null) { // user cancelled or empty password
-			// Warn the user
-			showMessageDialog(
-					this,
-					"You must supply a password for protecting the exported key pair.",
-					ALERT_TITLE, INFORMATION_MESSAGE);
-			return;
-		}
-
-		// Export the key pair
-		try {
-			credManager.exportKeyPair(alias, exportFile, pkcs12Password);
-			showMessageDialog(this, "Key pair export successful", ALERT_TITLE,
-					INFORMATION_MESSAGE);
-		} catch (CMException cme) {
-			showMessageDialog(this, cme.getMessage(), ERROR_TITLE,
-					ERROR_MESSAGE);
-		}
-	}
-
-	/**
-	 * Lets a user delete selected key pair entries from the Keystore.
-	 */
-	private void deleteKeyPair() {
-		// Which entries have been selected?
-		int[] selectedRows = keyPairsTable.getSelectedRows();
-		if (selectedRows.length == 0) // no key pair entry selected
-			return;
-
-		// Ask user to confirm the deletion
-		if (showConfirmDialog(null,
-				"Are you sure you want to delete the selected key pairs?",
-				ALERT_TITLE, YES_NO_OPTION) != YES_OPTION)
-			return;
-
-		String exMessage = null;
-		for (int i = selectedRows.length - 1; i >= 0; i--) { // delete from backwards
-			// Get the alias for the current entry
-			String alias = (String) keyPairsTable.getModel().getValueAt(
-					selectedRows[i], 6);
-			try {
-				// Delete the key pair entry from the Keystore
-				credManager.deleteKeyPair(alias);
-			} catch (CMException cme) {
-				logger.warn("failed to delete " + alias, cme);
-				exMessage = "Failed to delete the key pair(s) from the Keystore";
-			}
-		}
-		if (exMessage != null)
-			showMessageDialog(this, exMessage, ERROR_TITLE, ERROR_MESSAGE);
-	}
-
-	/**
-	 * Lets a user import a trusted certificate from a PEM or DER encoded file
-	 * into the Truststore.
-	 */
-	private void importTrustedCertificate() {
-		// Let the user choose a file containing trusted certificate(s) to
-		// import
-		File certFile = selectImportExportFile(
-				"Certificate file to import from", // title
-				new String[] { ".pem", ".crt", ".cer", ".der", "p7", ".p7c" }, // file extensions filters
-				"Certificate Files (*.pem, *.crt, , *.cer, *.der, *.p7, *.p7c)", // filter descriptions
-				"Import", // text for the file chooser's approve button
-				"trustedCertDir"); // preference string for saving the last chosen directory
-		if (certFile == null)
-			return;
-
-		// Load the certificate(s) from the file
-		ArrayList<X509Certificate> trustCertsList = new ArrayList<>();
-		CertificateFactory cf;
-		try {
-			cf = CertificateFactory.getInstance("X.509");
-		} catch (Exception e) {
-			// Nothing we can do! Things are badly misconfigured
-			cf = null;
-		}
-
-		if (cf != null) {
-			try (FileInputStream fis = new FileInputStream(certFile)) {
-				for (Certificate cert : cf.generateCertificates(fis))
-					trustCertsList.add((X509Certificate) cert);
-			} catch (Exception cex) {
-				// Do nothing
-			}
-
-			if (trustCertsList.size() == 0) {
-				// Could not load certificates as any of the above types
-				try (FileInputStream fis = new FileInputStream(certFile);
-						PEMReader pr = new PEMReader(
-								new InputStreamReader(fis), null, cf
-										.getProvider().getName())) {
-					/*
-					 * Try as openssl PEM format - which sligtly differs from
-					 * the one supported by JCE
-					 */
-					Object cert;
-					while ((cert = pr.readObject()) != null)
-						if (cert instanceof X509Certificate)
-							trustCertsList.add((X509Certificate) cert);
-				} catch (Exception cex) {
-					// do nothing
-				}
-			}
-		}
-
-		if (trustCertsList.size() == 0) {
-			/* Failed to load certifcate(s) using any of the known encodings */
-			showMessageDialog(this,
-					"Failed to load certificate(s) using any of the known encodings -\n"
-							+ "file format not recognised.", ERROR_TITLE,
-					ERROR_MESSAGE);
-			return;
-		}
-
-		// Show the list of certificates contained in the file for the user to
-		// select the ones to import
-		NewTrustCertsDialog importTrustCertsDialog = new NewTrustCertsDialog(this,
-				"Credential Manager", true, trustCertsList, dnParser);
-
-		importTrustCertsDialog.setLocationRelativeTo(this);
-		importTrustCertsDialog.setVisible(true);
-		List<X509Certificate> selectedTrustCerts = importTrustCertsDialog
-				.getTrustedCertificates(); // user-selected trusted certs to import
-
-		// If user cancelled or did not select any cert to import
-		if (selectedTrustCerts == null || selectedTrustCerts.isEmpty())
-			return;
-
-		try {
-			for (X509Certificate cert : selectedTrustCerts)
-				// Import the selected trusted certificates
-				credManager.addTrustedCertificate(cert);
-
-			// Display success message
-			showMessageDialog(this, "Trusted certificate(s) import successful",
-					ALERT_TITLE, INFORMATION_MESSAGE);
-		} catch (CMException cme) {
-			String exMessage = "Failed to import trusted certificate(s) to the Truststore";
-			logger.error(exMessage, cme);
-			showMessageDialog(this, exMessage, ERROR_TITLE, ERROR_MESSAGE);
-		}
-	}
-
-	/**
-	 * Lets the user export one (at the moment) or more (in future) trusted
-	 * certificate entries to a PEM-encoded file.
-	 */
-	private boolean exportTrustedCertificate() {
-		// Which trusted certificate has been selected?
-		int selectedRow = trustedCertsTable.getSelectedRow();
-		if (selectedRow == -1) // no row currently selected
-			return false;
-
-		// Get the trusted certificate entry's Keystore alias
-		String alias = (String) trustedCertsTable.getModel()
-				.getValueAt(selectedRow, 3);
-		// the alias column is invisible so we get the value from the table
-		// model
-
-		// Let the user choose a file to export to
-		File exportFile = selectImportExportFile("Select a file to export to", // title
-				new String[] { ".pem" }, // array of file extensions for the
-				// file filter
-				"Certificate Files (*.pem)", // description of the filter
-				"Export", // text for the file chooser's approve button
-				"trustedCertDir"); // preference string for saving the last chosen directory
-		if (exportFile == null)
-			return false;
-
-		// If file already exist - ask the user if he wants to overwrite it
-		if (exportFile.isFile()
-				&& showConfirmDialog(this,
-						"The file with the given name already exists.\n"
-								+ "Do you want to overwrite it?", ALERT_TITLE,
-						YES_NO_OPTION) == NO_OPTION)
-			return false;
-
-		// Export the trusted certificate
-		try (PEMWriter pw = new PEMWriter(new FileWriter(exportFile))) {
-			// Get the trusted certificate
-			pw.writeObject(credManager.getCertificate(TRUSTSTORE, alias));
-		} catch (Exception ex) {
-			String exMessage = "Failed to export the trusted certificate from the Truststore.";
-			logger.error(exMessage, ex);
-			showMessageDialog(this, exMessage, ERROR_TITLE, ERROR_MESSAGE);
-			return false;
-		}
-		showMessageDialog(this, "Trusted certificate export successful",
-				ALERT_TITLE, INFORMATION_MESSAGE);
-		return true;
-	}
-
-	/**
-	 * Lets a user delete the selected trusted certificate entries from the
-	 * Truststore.
-	 */
-	private void deleteTrustedCertificate() {
-		// Which entries have been selected?
-		int[] selectedRows = trustedCertsTable.getSelectedRows();
-		if (selectedRows.length == 0) // no trusted cert entry selected
-			return;
-
-		// Ask user to confirm the deletion
-		if (showConfirmDialog(
-				null,
-				"Are you sure you want to delete the selected trusted certificate(s)?",
-				ALERT_TITLE, YES_NO_OPTION) != YES_OPTION)
-			return;
-
-		String exMessage = null;
-		for (int i = selectedRows.length - 1; i >= 0; i--) { // delete from backwards
-			// Get the alias for the current entry
-			String alias = (String) trustedCertsTable.getModel().getValueAt(
-					selectedRows[i], 5);
-			try {
-				// Delete the trusted certificate entry from the Truststore
-				credManager.deleteTrustedCertificate(alias);
-			} catch (CMException cme) {
-				exMessage = "Failed to delete the trusted certificate(s) from the Truststore";
-				logger.error(exMessage, cme);
-			}
-		}
-		if (exMessage != null)
-			showMessageDialog(this, exMessage, ERROR_TITLE, ERROR_MESSAGE);
-	}
-
-	/**
-	 * If double click on a table occured - show the
-	 * details of the table entry.
-	 */
-	private void tableDoubleClick(MouseEvent evt) {
-		if (evt.getClickCount() > 1) { // is it a double click?
-			// Which row was clicked on (if any)?
-			Point point = new Point(evt.getX(), evt.getY());
-			int row = ((JTable) evt.getSource()).rowAtPoint(point);
-			if (row == -1)
-				return;
-			// Which table the click occured on?
-			if (((JTable) evt.getSource()).getModel() instanceof PasswordsTableModel)
-				// Passwords table
-				viewPassword();
-			else if (((JTable) evt.getSource()).getModel() instanceof KeyPairsTableModel)
-				// Key pairs table
-				viewCertificate();
-			else
-				// Trusted certificates table
-				viewCertificate();
-		}
-	}
-
-	/**
-	 * Lets the user select a file to export to or import from a key pair or a
-	 * certificate.
-	 */
-	private File selectImportExportFile(String title, String[] filter,
-			String description, String approveButtonText, String prefString) {
-		Preferences prefs = Preferences
-				.userNodeForPackage(CredentialManagerUI.class);
-		String keyPairDir = prefs.get(prefString,
-				System.getProperty("user.home"));
-		JFileChooser fileChooser = new JFileChooser();
-		fileChooser.addChoosableFileFilter(new CryptoFileFilter(filter,
-				description));
-		fileChooser.setDialogTitle(title);
-		fileChooser.setMultiSelectionEnabled(false);
-		fileChooser.setCurrentDirectory(new File(keyPairDir));
-
-		if (fileChooser.showDialog(this, approveButtonText) != APPROVE_OPTION)
-			return null;
-
-		File selectedFile = fileChooser.getSelectedFile();
-		prefs.put(prefString, fileChooser.getCurrentDirectory().toString());
-		return selectedFile;
-	}
-
-	private void closeFrame() {
-		setVisible(false);
-		dispose();
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/CredentialManagerUILauncher.java
----------------------------------------------------------------------
diff --git a/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/CredentialManagerUILauncher.java b/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/CredentialManagerUILauncher.java
deleted file mode 100644
index cdcabb7..0000000
--- a/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/CredentialManagerUILauncher.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*******************************************************************************
- * 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.credentialmanager;
-
-import static java.awt.BorderLayout.CENTER;
-import static javax.swing.SwingUtilities.invokeLater;
-
-import java.awt.Dimension;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-
-import javax.swing.ImageIcon;
-import javax.swing.JButton;
-import javax.swing.JFrame;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-
-/**
- * Test launcher for Credential Manager GUI (so it does not have to be
- * launched from Taverna).
- *
- * @author Alexandra Nenadic
- */
-public class CredentialManagerUILauncher extends JFrame {
-	private static final long serialVersionUID = 2079805060170251148L;
-
-	private final ImageIcon launchCMIcon = new ImageIcon(
-			CredentialManagerUILauncher.class
-					.getResource("/images/cred_manager.png"));
-
-	public CredentialManagerUILauncher() {
-		JPanel jpLaunch = new JPanel();
-		jpLaunch.setPreferredSize(new Dimension(300, 120));
-
-		JLabel jlLaunch = new JLabel("T2: Launch Credential Manager GUI");
-
-		JButton jbLaunch = new JButton();
-		jbLaunch.setIcon(launchCMIcon);
-		jbLaunch.setToolTipText("Launches Credential Manager");
-		jbLaunch.addActionListener(new ActionListener() {
-			@Override
-			public void actionPerformed(ActionEvent e) {
-				CredentialManagerUI cmGUI = new CredentialManagerUI(null, null);
-				if (cmGUI != null)
-					cmGUI.setVisible(true);
-			}
-		});
-
-		jpLaunch.add(jlLaunch);
-		jpLaunch.add(jbLaunch);
-
-		getContentPane().add(jpLaunch, CENTER);
-
-		// Handle application close
-		setDefaultCloseOperation(EXIT_ON_CLOSE);
-
-		pack();
-
-        // Centre the frame in the centre of the desktop
-        setLocationRelativeTo(null);
-        // Set the frame's title
-        setTitle("Credential Manager GUI Launcher");
-        setVisible(true);
-	}
-
-	/**
-	 * Launcher for the Credential Manager GUI.
-	 */
-	public static void main(String[] args) {
-        // Create and show GUI on the event handler thread
-        invokeLater(new Runnable(){
-        	@Override
-        	public void run() {
-        		new CredentialManagerUILauncher();
-        	}
-        });
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/CryptoFileFilter.java
----------------------------------------------------------------------
diff --git a/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/CryptoFileFilter.java b/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/CryptoFileFilter.java
deleted file mode 100644
index d58aa8a..0000000
--- a/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/CryptoFileFilter.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*******************************************************************************
- * 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.credentialmanager;
-
-import java.io.File;
-import java.util.Arrays;
-import java.util.List;
-
-import javax.swing.filechooser.FileFilter;
-
-/**
- * File filter for filtering against various file extensions. Crypto files
- * normally contain a private key (and optionally its certificate chain) or a
- * public key certificate (and optionally its certificate chain).
- * 
- * .p12 or .pfx are PKCS #12 keystore files containing private key and its
- * public key (+cert chain); .pem are ASN.1 PEM-encoded files containing one (or
- * more concatenated) public key certificate(s); .der are ASN.1 DER-encoded
- * files containing one public key certificate; .cer are CER-encoded files
- * containing one ore more DER-encoded certificates; .crt files are either
- * encoded as binary DER or as ASCII PEM. .p7 and .p7c are PKCS #7 certificate
- * chain files (i.e. SignedData structure without data, just certificate(s)).
- */
-public class CryptoFileFilter extends FileFilter {
-	// Description of the filter
-	private String description;
-
-	// Array of file extensions to filter against
-	private List<String> exts;
-
-	public CryptoFileFilter(String[] extList, String desc) {
-		exts = Arrays.asList(extList);
-		this.description = desc;
-	}
-
-	@Override
-	public boolean accept(File file) {
-		if (file.isDirectory())
-			return true;
-		if (file.isFile())
-			for (String ext : exts)
-				if (file.getName().toLowerCase().endsWith(ext))
-					return true;
-		return false;
-	}
-
-	public void setDescription(String desc) {
-		this.description = desc;
-	}
-
-	@Override
-	public String getDescription() {
-		return this.description;
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/GetMasterPasswordDialog.java
----------------------------------------------------------------------
diff --git a/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/GetMasterPasswordDialog.java b/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/GetMasterPasswordDialog.java
deleted file mode 100644
index b6f623e..0000000
--- a/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/GetMasterPasswordDialog.java
+++ /dev/null
@@ -1,169 +0,0 @@
-/*******************************************************************************
- * 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.credentialmanager;
-
-import static java.awt.BorderLayout.CENTER;
-import static java.awt.BorderLayout.NORTH;
-import static java.awt.BorderLayout.SOUTH;
-import static javax.swing.BoxLayout.Y_AXIS;
-import static javax.swing.JOptionPane.WARNING_MESSAGE;
-import static javax.swing.JOptionPane.showMessageDialog;
-import static net.sf.taverna.t2.workbench.ui.credentialmanager.CMStrings.WARN_TITLE;
-
-import java.awt.BorderLayout;
-import java.awt.FlowLayout;
-import java.awt.Frame;
-import java.awt.GridLayout;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.WindowAdapter;
-import java.awt.event.WindowEvent;
-
-import javax.swing.BoxLayout;
-import javax.swing.JButton;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JPasswordField;
-import javax.swing.border.EmptyBorder;
-
-import net.sf.taverna.t2.workbench.helper.NonBlockedHelpEnabledDialog;
-
-/**
- * Dialog used for getting a master password for Credential Manager from the
- * users.
- * 
- * @author Alex Nenadic
- */
-@SuppressWarnings("serial")
-public class GetMasterPasswordDialog extends NonBlockedHelpEnabledDialog {
-	/** Password entry field */
-	private JPasswordField passwordField;
-	/** The entered password */
-	private String password = null;
-	/** Text giving user the instructions what to do in the dialog */
-	private String instructions;
-
-	public GetMasterPasswordDialog(String instructions) {
-		super((Frame) null, "Enter master password", true);
-		this.instructions = instructions;
-		initComponents();
-	}
-
-	private void initComponents() {
-		getContentPane().setLayout(new BorderLayout());
-
-		JLabel instructionsLabel = new JLabel(instructions);
-		// instructionsLabel.setFont(new Font(null, Font.PLAIN, 11));
-
-		JPanel instructionsPanel = new JPanel();
-		instructionsPanel.setLayout(new BoxLayout(instructionsPanel, Y_AXIS));
-		instructionsPanel.add(instructionsLabel);
-		instructionsPanel.setBorder(new EmptyBorder(10, 5, 10, 0));
-
-		JLabel passwordLabel = new JLabel("Password");
-		passwordLabel.setBorder(new EmptyBorder(0, 5, 0, 0));
-
-		passwordField = new JPasswordField(15);
-		JPanel passwordPanel = new JPanel(new GridLayout(1, 1, 5, 5));
-		passwordPanel.add(passwordLabel);
-		passwordPanel.add(passwordField);
-
-		JPanel mainPanel = new JPanel(new BorderLayout());
-		mainPanel.setBorder(new EmptyBorder(10, 10, 10, 10));
-		mainPanel.add(instructionsPanel, NORTH);
-		mainPanel.add(passwordPanel, CENTER);
-
-		JButton okButton = new JButton("OK");
-		okButton.addActionListener(new ActionListener() {
-			@Override
-			public void actionPerformed(ActionEvent evt) {
-				okPressed();
-			}
-		});
-
-		JButton cancelButton = new JButton("Cancel");
-		cancelButton.addActionListener(new ActionListener() {
-			@Override
-			public void actionPerformed(ActionEvent evt) {
-				cancelPressed();
-			}
-		});
-		JPanel buttonsPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
-		buttonsPanel.add(okButton);
-		buttonsPanel.add(cancelButton);
-
-		getContentPane().add(mainPanel, CENTER);
-		getContentPane().add(buttonsPanel, SOUTH);
-
-		addWindowListener(new WindowAdapter() {
-			@Override
-			public void windowClosing(WindowEvent evt) {
-				closeDialog();
-			}
-		});
-
-		setResizable(false);
-		getRootPane().setDefaultButton(okButton);
-		pack();
-	}
-
-	/**
-	 * Get the password entered in the dialog.
-	 */
-	public String getPassword() {
-		return password;
-	}
-
-	/**
-	 * Check that the entered password is not empty and store the entered
-	 * password.
-	 */
-	private boolean checkPassword() {
-		password = new String(passwordField.getPassword());
-
-		if (password.isEmpty()) {
-			showMessageDialog(this, "The password cannot be empty",
-					WARN_TITLE, WARNING_MESSAGE);
-			return false;
-		}
-
-		return true;
-	}
-
-	private void okPressed() {
-		if (checkPassword())
-			closeDialog();
-	}
-
-	private void cancelPressed() {
-		/*
-		 * Set the password to null as it might have changed in the meantime if
-		 * user entered something then cancelled.
-		 */
-		password = null;
-		closeDialog();
-	}
-
-	private void closeDialog() {
-		setVisible(false);
-		dispose();
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/GetPasswordDialog.java
----------------------------------------------------------------------
diff --git a/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/GetPasswordDialog.java b/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/GetPasswordDialog.java
deleted file mode 100644
index 45a0f88..0000000
--- a/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/GetPasswordDialog.java
+++ /dev/null
@@ -1,168 +0,0 @@
-/*******************************************************************************
- * 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.credentialmanager;
-
-import static java.awt.BorderLayout.CENTER;
-import static java.awt.BorderLayout.NORTH;
-import static java.awt.BorderLayout.SOUTH;
-import static java.awt.Font.PLAIN;
-import static javax.swing.JOptionPane.WARNING_MESSAGE;
-import static javax.swing.JOptionPane.showMessageDialog;
-import static net.sf.taverna.t2.workbench.ui.credentialmanager.CMStrings.WARN_TITLE;
-
-import java.awt.BorderLayout;
-import java.awt.FlowLayout;
-import java.awt.Font;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.WindowAdapter;
-import java.awt.event.WindowEvent;
-
-import javax.swing.JButton;
-import javax.swing.JDialog;
-import javax.swing.JFrame;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JPasswordField;
-import javax.swing.border.EmptyBorder;
-
-import net.sf.taverna.t2.workbench.helper.NonBlockedHelpEnabledDialog;
-
-/**
- * A general dialog for entering a password.
- * 
- * @author Alex Nenadic
- */
-@SuppressWarnings("serial")
-public class GetPasswordDialog extends NonBlockedHelpEnabledDialog {
-	/** Instructions for user explaining the purpose of the password */
-	private String instructions = null;
-	/* Password entry password field */
-	private JPasswordField passwordField;
-	/* Stores the password entered */
-	private String password = null;
-
-	public GetPasswordDialog(JFrame parent, String title, boolean modal,
-			String instr) {
-		super(parent, title, modal);
-		instructions = instr;
-		initComponents();
-	}
-
-	public GetPasswordDialog(JDialog parent, String title, boolean modal,
-			String instr) {
-		super(parent, title, modal);
-		instructions = instr;
-		initComponents();
-	}
-
-	private void initComponents() {
-		getContentPane().setLayout(new BorderLayout());
-
-		JLabel passwordLabel = new JLabel("Password");
-		passwordField = new JPasswordField(15);
-
-		JButton okButton = new JButton("OK");
-		okButton.addActionListener(new ActionListener() {
-			@Override
-			public void actionPerformed(ActionEvent evt) {
-				okPressed();
-			}
-		});
-
-		JButton cancelButton = new JButton("Cancel");
-		cancelButton.addActionListener(new ActionListener() {
-			@Override
-			public void actionPerformed(ActionEvent evt) {
-				cancelPressed();
-			}
-		});
-
-		JLabel instructionsLabel; // Instructions
-		if (instructions != null) {
-			instructionsLabel = new JLabel(instructions);
-			instructionsLabel.setFont(new Font(null, PLAIN, 11));
-			instructionsLabel.setBorder(new EmptyBorder(5, 5, 5, 5));
-			getContentPane().add(instructionsLabel, NORTH);
-		}
-        
-        JPanel passwordPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
-        passwordPanel.add(passwordLabel);
-        passwordPanel.add(passwordField);
-        passwordPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
-
-        JPanel buttonsPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
-        buttonsPanel.add(okButton);
-        buttonsPanel.add(cancelButton);
-
-        getContentPane().add(passwordPanel, CENTER);
-        getContentPane().add(buttonsPanel, SOUTH);
-
-		addWindowListener(new WindowAdapter() {
-			@Override
-			public void windowClosing(WindowEvent evt) {
-				closeDialog();
-			}
-		});
-
-        setResizable(false);
-        getRootPane().setDefaultButton(okButton);
-        pack();
-	}
-
-	/**
-	 * Get the password entered in the dialog.
-	 */
-	public String getPassword() {
-		return password;
-	}
-
-	/**
-	 * Check that the password entered is not empty and store the entered
-	 * password.
-	 */
-	private boolean checkPassword() {
-		password = new String(passwordField.getPassword());
-
-		if (password.isEmpty()) {
-			showMessageDialog(this, "The password cannot be empty",
-					WARN_TITLE, WARNING_MESSAGE);
-			return false;
-		}
-
-		return true;
-	}
-
-	private void okPressed() {
-        if (checkPassword())
-            closeDialog();
-    }
-
-	private void cancelPressed() {
-		password = null;
-		closeDialog();
-	}
-
-	private void closeDialog() {
-		setVisible(false);
-		dispose();
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/KeyPairsTableModel.java
----------------------------------------------------------------------
diff --git a/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/KeyPairsTableModel.java b/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/KeyPairsTableModel.java
deleted file mode 100644
index 3d416e8..0000000
--- a/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/KeyPairsTableModel.java
+++ /dev/null
@@ -1,213 +0,0 @@
-/*******************************************************************************
- * 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.credentialmanager;
-
-import static javax.swing.JOptionPane.ERROR_MESSAGE;
-import static javax.swing.JOptionPane.showMessageDialog;
-import static org.apache.taverna.security.credentialmanager.CredentialManager.KeystoreType.KEYSTORE;
-import static net.sf.taverna.t2.workbench.ui.credentialmanager.CMStrings.ERROR_TITLE;
-import static net.sf.taverna.t2.workbench.ui.credentialmanager.CredentialManagerUI.KEY_PAIR_ENTRY_TYPE;
-
-import java.util.TreeMap;
-
-import javax.swing.JFrame;
-import javax.swing.table.AbstractTableModel;
-
-import org.apache.taverna.lang.observer.Observable;
-import org.apache.taverna.lang.observer.Observer;
-import org.apache.taverna.security.credentialmanager.CMException;
-import org.apache.taverna.security.credentialmanager.CredentialManager;
-import org.apache.taverna.security.credentialmanager.KeystoreChangedEvent;
-
-import org.apache.log4j.Logger;
-
-/**
- * The table model used to display the Keystore's key pair entries.
- *
- * @author Alex Nenadic
- */
-@SuppressWarnings("serial")
-public class KeyPairsTableModel extends AbstractTableModel implements Observer<KeystoreChangedEvent> {
-	private static final Logger logger = Logger.getLogger(KeyPairsTableModel.class);
-
-	/** Column names*/
-    private String[] columnNames;
-    /** Table data*/
-    private Object[][] data;
-	private CredentialManager credManager;
-
-    public KeyPairsTableModel(CredentialManager credentialManager) {
-        credManager = credentialManager;
-
-		if (credManager == null) {
-			/* Failed to instantiate Credential Manager - warn the user and exit */
-			String sMessage = "Failed to instantiate Credential Manager. ";
-			logger.error("CM GUI: " + sMessage);
-			showMessageDialog(new JFrame(), sMessage,
-					ERROR_TITLE, ERROR_MESSAGE);
-			return;
-		}
-
-       	data = new Object[0][0];
-        columnNames = new String[] {
-        	"Entry Type", // type of the Keystore entry
-        	"Owner", // owner's common name
-        	"Issuer", // issuer's common name
-        	"Serial Number", // public key certificate's serial number
-        	"Last Modified", // last modified date of the entry
-            "URLs", // the invisible column holding the list of URLs associated with this entry
-            "Alias" // the invisible column holding the actual alias in the Keystore
-        };
-
-		try {
-			load();
-		} catch (CMException cme) {
-			String sMessage = "Failed to load key pairs";
-			logger.error(sMessage, cme);
-			showMessageDialog(new JFrame(), sMessage,
-					ERROR_TITLE, ERROR_MESSAGE);
-			return;
-		}
-
-        // Start observing changes to the Keystore
-        credManager.addObserver(this);
-    }
-
-    /**
-     * Load the table model with the key pair entries from the Keystore.
-     */
-    public void load() throws CMException {
-    	// Place key pair entries' aliases in a tree map to sort them
-    	TreeMap<String, String> sortedAliases = new TreeMap<>();
-
-		for (String alias: credManager.getAliases(KEYSTORE))
-			/*
-			 * We are only interested in key pair entries here.
-			 * 
-			 * Alias for such entries is constructed as
-			 * "keypair#<CERT_SERIAL_NUMBER>#<CERT_COMMON_NAME>" where
-			 */
-			if (alias.startsWith("keypair#"))
-				sortedAliases.put(alias, alias);
-
-		// Create one table row for each key pair entry
-		data = new Object[sortedAliases.size()][7];
-
-		/*
-		 * Iterate through the sorted aliases (if any), retrieving the key pair
-		 * entries and populating the table model
-		 */
-		int iCnt = 0;
-		for (String alias : sortedAliases.values()) {
-			/*
-			 * Populate the type column - it is set with an integer but a custom
-			 * cell renderer will cause a suitable icon to be displayed
-			 */
-			data[iCnt][0] = KEY_PAIR_ENTRY_TYPE;
-
-			/*
-			 * Split the alias string to extract owner, issuer and serial number
-			 * alias =
-			 * "keypair#"<SUBJECT_COMMON_NAME>"#"<ISSUER_COMMON_NAME>"#"<SERIAL_NUMBER>
-			 */
-			String[] aliasComponents = alias.split("#");
-
-			// Populate the owner column extracted from the alias
-			data[iCnt][1] = aliasComponents[1];
-
-			// Populate the issuer column extracted from the alias
-			data[iCnt][2] = aliasComponents[2];
-
-			// Populate the serial number column extracted from the alias
-			data[iCnt][3] = aliasComponents[3];
-
-			// Populate the modified date column ("UBER" keystore type supports creation date)
-			//data[iCnt][4] = credManager.getEntryCreationDate(CredentialManager.KEYSTORE, alias);
-
-			// Populate the invisible URLs list column
-			//data[iCnt][5] = credManager.getServiceURLsForKeyPair(alias);
-
-			// Populate the invisible alias column
-			data[iCnt][6] = alias;
-
-			iCnt++;
-		}
-
-		fireTableDataChanged();
-    }
-
-	/**
-	 * Get the number of columns in the table.
-	 */
-	@Override
-	public int getColumnCount() {
-		return columnNames.length;
-	}
-
-	/**
-	 * Get the number of rows in the table.
-	 */
-	@Override
-	public int getRowCount() {
-		return data.length;
-	}
-
-	/**
-	 * Get the name of the column at the given position.
-	 */
-	@Override
-	public String getColumnName(int iCol) {
-		return columnNames[iCol];
-	}
-
-	/**
-	 * Get the cell value at the given row and column position.
-	 */
-	@Override
-	public Object getValueAt(int iRow, int iCol) {
-		return data[iRow][iCol];
-	}
-
-	/**
-	 * Get the class at of the cells at the given column position.
-	 */
-	@Override
-	public Class<? extends Object> getColumnClass(int iCol) {
-		return getValueAt(0, iCol).getClass();
-	}
-
-	/**
-	 * Is the cell at the given row and column position editable?
-	 */
-	@Override
-	public boolean isCellEditable(int iRow, int iCol) {
-		// The table is always read-only
-		return false;
-	}
-
-	@Override
-	public void notify(Observable<KeystoreChangedEvent> sender,
-			KeystoreChangedEvent message) throws Exception {
-		// reload the table
-		if (message.keystoreType.equals(KEYSTORE))
-			load();
-	}
-}


[19/51] [partial] incubator-taverna-workbench git commit: all packages are moved to org.apache.taverna.*

Posted by re...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/FileManager.java
----------------------------------------------------------------------
diff --git a/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/FileManager.java b/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/FileManager.java
new file mode 100644
index 0000000..7626de5
--- /dev/null
+++ b/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/FileManager.java
@@ -0,0 +1,573 @@
+/*******************************************************************************
+ * 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 org.apache.taverna.workbench.file;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.util.List;
+
+import javax.swing.filechooser.FileFilter;
+
+import org.apache.taverna.lang.observer.Observable;
+import org.apache.taverna.lang.observer.Observer;
+import org.apache.taverna.workbench.file.events.ClosedDataflowEvent;
+import org.apache.taverna.workbench.file.events.FileManagerEvent;
+import org.apache.taverna.workbench.file.events.OpenedDataflowEvent;
+import org.apache.taverna.workbench.file.events.SavedDataflowEvent;
+import org.apache.taverna.workbench.file.exceptions.OpenException;
+import org.apache.taverna.workbench.file.exceptions.OverwriteException;
+import org.apache.taverna.workbench.file.exceptions.SaveException;
+import org.apache.taverna.workbench.file.exceptions.UnsavedException;
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+
+/**
+ * Manager of open files (WorkflowBundleBundles) in the workbench.
+ * <p>
+ * A {@link WorkflowBundle} can be opened for the workbench using
+ * {@link #openDataflow(FileType, Object)} or {@link #openDataflow(WorkflowBundle)}.
+ * {@link Observer}s of the FileManager gets notified with an
+ * {@link OpenedDataflowEvent}. The opened workflow is also
+ * {@link #setCurrentDataflow(WorkflowBundle) made the current dataflow}, available
+ * through {@link #getCurrentDataflow()} or by observing the
+ * {@link net.sf.taverna.t2.lang.ui.ModelMap} for the model name
+ * {@link net.sf.taverna.t2.workbench.ModelMapConstants#CURRENT_DATAFLOW}.
+ * <p>
+ * A dataflow can be saved using
+ * {@link #saveDataflow(WorkflowBundle, FileType, Object, boolean)}. Observers will be
+ * presented a {@link SavedDataflowEvent}.
+ * <p>
+ * If a dataflow was previously opened from a saveable destination or previously
+ * saved using {@link #saveDataflow(WorkflowBundle, FileType, Object, boolean)},
+ * {@link #saveDataflow(WorkflowBundle, boolean)} can be used to resave to that
+ * destination.
+ * <p>
+ * You can get the last opened/saved source and type using
+ * {@link #getDataflowSource(WorkflowBundle)} and {@link #getDataflowType(WorkflowBundle)}.
+ * <p>
+ * If the save methods are used with failOnOverwrite=true, an
+ * {@link OverwriteException} will be thrown if the destination file already
+ * exists and was not last written by a previous save on that dataflow. (This is
+ * typically checked using timestamps on the file).
+ * <p>
+ * A dataflow can be closed using {@link #closeDataflow(WorkflowBundle, boolean)}. A
+ * closed dataflow is no longer monitored for changes and can no longer be used
+ * with the other operations, except {@link #openDataflow(WorkflowBundle)}.
+ * <p>
+ * If a dataflow has been changed using the {@link EditManager},
+ * {@link #isDataflowChanged(WorkflowBundle)} will return true until the next save. If
+ * the close methods are used with failOnUnsaved=true, an
+ * {@link UnsavedException} will be thrown if the dataflow has been changed.
+ * <p>
+ * The implementation of this interface is an OSGi Service.
+ *
+ * @author Stian Soiland-Reyes
+ */
+public interface FileManager extends Observable<FileManagerEvent> {
+	/**
+	 * True if {@link #saveDataflow(WorkflowBundle, boolean)} can save the
+	 * workflow, i.e., that there exists an SPI implementation of
+	 * {@link DataflowPersistenceHandler} that can save to
+	 * {@link #getDataflowSource(WorkflowBundle)} using
+	 * {@link #getDataflowType(WorkflowBundle)}.
+	 * 
+	 * @see #saveDataflow(WorkflowBundle, boolean)
+	 * @param dataflow
+	 *            The dataflow to check
+	 * @return <code>true</code> if the given dataflow can be saved without
+	 *         providing a destination and filetype
+	 */
+	boolean canSaveWithoutDestination(WorkflowBundle dataflow);
+
+	/**
+	 * Close the specified dataflow.
+	 * <p>
+	 * A closed dataflow can no longer be used with the save methods, and will
+	 * disappear from the UI's list of open dataflows.
+	 * <p>
+	 * If no more dataflows would be open after the close, a new empty dataflow
+	 * is opened as through {@link #newDataflow()}.
+	 * <p>
+	 * If the failOnUnsaved parameters is <code>true</code>, and
+	 * {@link #isDataflowChanged(WorkflowBundle)} is <code>true</code>, an
+	 * {@link UnsavedException} will be thrown, typically because the workflow
+	 * has been changed using the {@link EditManager} since the last change.
+	 * <p>
+	 * Listeners registered using {@link Observable#addObserver(Observer)} will
+	 * be notified with an {@link ClosedDataflowEvent}.
+	 *
+	 * @param dataflow
+	 *            {@link WorkflowBundle} to close
+	 * @param failOnUnsaved
+	 *            If <code>true</code>, fail on unsaved changes
+	 * @throws UnsavedException
+	 *             If failOnUnsaved was <code>true</code> and there has been
+	 *             changes to the dataflow since the last save
+	 */
+	boolean closeDataflow(WorkflowBundle dataflow, boolean failOnUnsaved)
+			throws UnsavedException;
+
+	/**
+	 * Get the current dataflow.
+	 * <p>
+	 * The current workflow is typically the one currently showed on the screen,
+	 * and is also in {@link #getOpenDataflows()}.
+	 * <p>
+	 * The current dataflow is set through {@link #setCurrentDataflow(WorkflowBundle)}
+	 * or the {@link net.sf.taverna.t2.lang.ui.ModelMap} using the key
+	 * {@link net.sf.taverna.t2.workbench.ModelMapConstants#CURRENT_DATAFLOW}.
+	 *
+	 * @return The current dataflow, or <code>null</code> if no dataflow is
+	 *         current
+	 */
+	WorkflowBundle getCurrentDataflow();
+
+	/**
+	 * Get the dataflow that was opened from or last saved to the given source.
+	 *
+	 * @param source
+	 *            The source as opened with or saved to
+	 *            {@link #openDataflow(FileType, Object)}
+	 * @return The opened {@link WorkflowBundle} or <code>null</code> if no matching
+	 *         dataflow found.
+	 */
+	WorkflowBundle getDataflowBySource(Object source);
+
+	/**
+	 * Get a name to represent this dataflow.
+	 * <p>
+	 * The name will primarily be deduced from the source of where the workflow
+	 * is opened from, unless {@link Object#toString()} is not overridden (for
+	 * instance opened from an InputStream) or if the source is unknown, in
+	 * which case the dataflow's internal name {@link WorkflowBundle#getName()}
+	 * is returned.
+	 * <p>
+	 * The returned name can be used in listings like the WorkflowBundles menu, but is
+	 * not guaranteed to be unique. (For instance a workflow could be opened
+	 * twice from the same source).
+	 *
+	 * @param dataflow
+	 *            WorkflowBundle to get the name for
+	 * @return The deduced workflow name
+	 */
+	String getDataflowName(WorkflowBundle dataflow);
+
+	/**
+	 * Returns the default name to use when creating new workflows.
+	 *
+	 * @return the default name to use when creating new workflows
+	 */
+	String getDefaultWorkflowName();
+
+	/**
+	 * Get the last opened/saved source/destination for the given dataflow.
+	 * <p>
+	 * The source is the last source used with
+	 * {@link #saveDataflow(WorkflowBundle, FileType, Object, boolean)} for the given
+	 * dataflow, or {@link #openDataflow(FileType, Object)} if it has not yet
+	 * been saved.
+	 * <p>
+	 * If the given dataflow's last opened/saved location was unknown (opened
+	 * with {@link #newDataflow()} or {@link #openDataflow(WorkflowBundle)}), return
+	 * <code>null</code>.
+	 *
+	 * @param dataflow
+	 *            {@link WorkflowBundle} which file is to be returned
+	 * @return The last opened/saved source for the given dataflow, or
+	 *         <code>null</code> if unknown.
+	 */
+	Object getDataflowSource(WorkflowBundle dataflow);
+
+	/**
+	 * Get the last opened/saved source/destination FileType for the given
+	 * dataflow.
+	 * <p>
+	 * The type is the last {@link FileType} used with
+	 * {@link #saveDataflow(WorkflowBundle, FileType, Object, boolean)} for the given
+	 * dataflow, or {@link #openDataflow(FileType, Object)} if it has not yet
+	 * been saved.
+	 * <p>
+	 * If the given dataflow's last opened/saved file type was unknown (opened
+	 * with {@link #newDataflow()} or {@link #openDataflow(WorkflowBundle)}), return
+	 * <code>null</code>.
+	 *
+	 * @param dataflow
+	 *            {@link WorkflowBundle} which file is to be returned
+	 * @return The last opened/saved {@link FileType} for the given dataflow, or
+	 *         <code>null</code> if unknown.
+	 */
+	FileType getDataflowType(WorkflowBundle dataflow);
+
+	/**
+	 * Get the list of currently open dataflows. This list of dataflows are
+	 * typically displayed in the UI in the "WorkflowBundles" menu to allow switching
+	 * the {@link #getCurrentDataflow() current dataflow}.
+	 *
+	 * @return A copy of the {@link List} of open {@link WorkflowBundle}s
+	 */
+	List<WorkflowBundle> getOpenDataflows();
+
+	/**
+	 * Get a list of {@link FileFilter}s for supported {@link FileType}s that
+	 * can be opened with any source class.
+	 *
+	 * @return A {@link List} of {@link FileFilter}s supported by
+	 *         {@link #openDataflow(FileType, Object)}
+	 */
+	List<FileFilter> getOpenFileFilters();
+
+	/**
+	 * Get a list of {@link FileFilter}s for supported {@link FileType}s that
+	 * can be opened with given source class.
+	 *
+	 * @param sourceClass
+	 *            Source class that can be opened from
+	 * @return A {@link List} of {@link FileFilter}s supported by
+	 *         {@link #openDataflow(FileType, Object)}
+	 */
+	List<FileFilter> getOpenFileFilters(Class<?> sourceClass);
+
+	/**
+	 * Get a list of {@link FileFilter}s for supported {@link FileType}s that
+	 * can be saved to any destination class.
+	 *
+	 * @return A {@link List} of {@link FileFilter}s supported by
+	 *         {@link #saveDataflow(WorkflowBundle, FileType, Object, boolean)}
+	 */
+	List<FileFilter> getSaveFileFilters();
+
+	/**
+	 * Get a list of {@link FileFilter}s for supported {@link FileType}s that
+	 * can be saved to the given destination class.
+	 *
+	 * @param destinationClass
+	 *            Destination class that can be saved to
+	 * @return A {@link List} of {@link FileFilter}s supported by
+	 *         {@link #saveDataflow(WorkflowBundle, FileType, Object, boolean)}
+	 */
+	List<FileFilter> getSaveFileFilters(Class<?> destinationClass);
+
+	/**
+	 * Return <code>true</code> if the dataflow has been changed (through the
+	 * {@link EditManager} or {@link #setDataflowChanged(WorkflowBundle, boolean)})
+	 * since last save.
+	 *
+	 * @param dataflow
+	 *            WorkflowBundle which changed status is to be checked
+	 * @return <code>true</code> if the dataflow has been changed since last
+	 *         save.
+	 */
+	boolean isDataflowChanged(WorkflowBundle dataflow);
+
+	/**
+	 * True if the given dataflow has been opened and is in
+	 * {@link #getOpenDataflows()}.
+	 *
+	 * @param dataflow
+	 *            Dataflow to check
+	 * @return <code>true</code> if dataflow is open
+	 */
+	boolean isDataflowOpen(WorkflowBundle dataflow);
+
+	/**
+	 * Create and open a new, blank dataflow. The dataflow will not initially be
+	 * marked as changed.
+	 * <p>
+	 * Listeners registered using {@link Observable#addObserver(Observer)} will
+	 * be notified with an {@link OpenedDataflowEvent}.
+	 * <p>
+	 * Note, if the dataflow is later changed, it will not be possible to save
+	 * it to any original location using
+	 * {@link #saveDataflow(WorkflowBundle, boolean)}, only
+	 * {@link #saveDataflow(WorkflowBundle, FileType, Object, boolean)}.
+	 *
+	 * @return The newly opened blank {@link WorkflowBundle}
+	 */
+	WorkflowBundle newDataflow();
+
+	/**
+	 * Open a {@link WorkflowBundle} instance that has been created outside the
+	 * {@link FileManager}. The dataflow will not initially be marked as
+	 * changed.
+	 * <p>
+	 * Listeners registered using {@link Observable#addObserver(Observer)} will
+	 * be notified with an {@link OpenedDataflowEvent}.
+	 * <p>
+	 * Note, if the dataflow is later changed, it will not be possible to save
+	 * it to its original location using
+	 * {@link #saveDataflow(WorkflowBundle, boolean)}, only
+	 * {@link #saveDataflow(WorkflowBundle, FileType, Object, boolean)}.
+	 * <p>
+	 * Instead of using this option it is recommended to create your own
+	 * {@link FileType} and/or source type and a
+	 * {@link DataflowPersistenceHandler} to implement save and/or reopen
+	 * (revert).
+	 * <p>
+	 * If there is only one workflow open before opening this workflow, and it
+	 * is an unchanged blank workflow, the blank workflow will be closed.
+	 *
+	 * @param dataflow
+	 *            {@link WorkflowBundle} instance that is to be added as an open
+	 *            dataflow
+	 */
+	void openDataflow(WorkflowBundle dataflow);
+
+	/**
+	 * Open a dataflow from a source. The dataflow will not initially be marked
+	 * as changed, and will be set as the new current workflow.
+	 * <p>
+	 * The file manager will find implementations of the SPI
+	 * {@link DataflowPersistenceHandler} to perform the opening for the given file
+	 * type and destination class.
+	 * <p>
+	 * Listeners registered using {@link Observable#addObserver(Observer)} will
+	 * be notified with an {@link OpenedDataflowEvent}.
+	 * <p>
+	 * If there is only one workflow open before opening this workflow, and it
+	 * is an unchanged blank workflow, the blank workflow will be closed.
+	 *
+	 * @param fileType
+	 *            The filetype, for instance
+	 *            {@link net.sf.taverna.t2.workbench.file.impl.T2FlowFileType}.
+	 *            The file type must be supported by an implementation of the
+	 *            SPI DataflowPersistenceHandler.
+	 * @param source
+	 *            The source, for instance a {@link File} or {@link URL}. The
+	 *            source type must be supported by an implementation of
+	 *            DataflowPersistenceHandler.
+	 * @return The opened {@link WorkflowBundle}.
+	 * @throws OpenException
+	 *             If there was no matching DataflowPersistenceHandler found or
+	 *             the source could not be opened for any other reason, such as
+	 *             IO errors or syntax errors.
+	 */
+	WorkflowBundle openDataflow(FileType fileType, Object source)
+			throws OpenException;
+
+	/**
+	 * Open a dataflow from a source silently. The dataflow will not be listed
+	 * as open, and will not be made the current workflow.
+	 * <p>
+	 * The file manager will find implementations of the SPI
+	 * {@link DataflowPersistenceHandler} to perform the opening for the given file
+	 * type and destination class.
+	 * <p>
+	 * Listeners will <strong>not</strong> be notified.
+	 *
+	 * @param fileType
+	 *            The filetype, for instance
+	 *            {@link net.sf.taverna.t2.workbench.file.impl.T2FlowFileType}.
+	 *            The file type must be supported by an implementation of the
+	 *            SPI DataflowPersistenceHandler.
+	 * @param source
+	 *            The source, for instance a {@link File} or {@link URL}. The
+	 *            source type must be supported by an implementation of
+	 *            DataflowPersistenceHandler.
+	 * @return The {@link DataflowInfo} describing the opened dataflow.
+	 * @throws OpenException
+	 *             If there was no matching DataflowPersistenceHandler found or
+	 *             the source could not be opened for any other reason, such as
+	 *             IO errors or syntax errors.
+	 */
+	DataflowInfo openDataflowSilently(FileType fileType, Object source)
+			throws OpenException;
+
+	/**
+	 * Save the dataflow to the last saved destination and FileType from
+	 * {@link #saveDataflow(WorkflowBundle, FileType, Object, boolean)} or the last
+	 * opened source and FileType from {@link #openDataflow(FileType, Object)}.
+	 * <p>
+	 * Listeners registered using {@link Observable#addObserver(Observer)} will
+	 * be notified with an {@link SavedDataflowEvent}.
+	 *
+	 * @param dataflow
+	 *            Dataflow to save. Dataflow must have been opened with
+	 *            {@link #openDataflow(FileType, Object)} or saved using
+	 *            {@link #saveDataflow(WorkflowBundle, FileType, Object, boolean)}.
+	 * @param failOnOverwrite
+	 *            If <code>true</code>, an {@link OverwriteException} is thrown
+	 *            if a save would overwrite the destination because it has been
+	 *            changed since last open/save.
+	 * @throws OverwriteException
+	 *             if failOnOverwrite was true, and a save would overwrite the
+	 *             destination because it has been changed since last open/save.
+	 *             The save was not performed.
+	 * @throws SaveException
+	 *             If any other error occurs during saving, including the case
+	 *             that a dataflow is not connected to a source or destination,
+	 *             that there are no handlers (some source types can't be saved
+	 *             to, such as HTTP URLs), or any other IO error occurring while
+	 *             saving.
+	 */
+	void saveDataflow(WorkflowBundle dataflow, boolean failOnOverwrite)
+			throws SaveException, OverwriteException;
+
+	/**
+	 * Save the dataflow to the given destination using the given filetype.
+	 * <p>
+	 * The file manager will find implementations of the SPI
+	 * {@link DataflowPersistenceHandler} to perform the save for the given file
+	 * type and destination class.
+	 * <p>
+	 * Listeners registered using {@link Observable#addObserver(Observer)} will
+	 * be notified with an {@link SavedDataflowEvent}.
+	 *
+	 * @param dataflow
+	 *            {@link Dataflow} to be saved
+	 * @param fileType
+	 *            {@link FileType} to save dataflow as, for instance
+	 *            {@link net.sf.taverna.t2.workbench.file.impl.T2FlowFileType}.
+	 *            The file type must be supported by an SPI implementation of
+	 *            {@link DataflowPersistenceHandler}.
+	 * @param destination
+	 *            Destination to save dataflow to, for instance a {@link File}
+	 * @param failOnOverwrite
+	 *            If <code>true</code>, an {@link OverwriteException} is thrown
+	 *            if a save would overwrite the destination because it already
+	 *            exists, but was not opened or save to using the file manager
+	 *            for the given dataflow. (ie. a repeated call to this function
+	 *            should not throw an OverwriteException unless someone outside
+	 *            has modified the file)
+	 * @throws OverwriteException
+	 *             if failOnOverwrite was true, and a save would overwrite the
+	 *             destination because it already existed, and was not last
+	 *             written to by a previous save. The save was not performed.
+	 * @throws SaveException
+	 *             If any other error occurs during saving, including the case
+	 *             that a dataflow is not connected to a source or destination,
+	 *             that there are no handlers (some source types can't be saved
+	 *             to, such as HTTP URLs), or any other IO error occurring while
+	 *             saving.
+	 */
+	void saveDataflow(WorkflowBundle dataflow, FileType fileType,
+			Object destination, boolean failOnOverwrite) throws SaveException,
+			OverwriteException;
+
+	/**
+	 * Silently save the dataflow to the given destination using the given
+	 * filetype.
+	 * <p>
+	 * The file manager will find implementations of the SPI
+	 * {@link DataflowPersistenceHandler} to perform the save for the given file
+	 * type and destination class.
+	 * <p>
+	 * Listeners will <strong>not</strong> be notified, and the dataflow does
+	 * not previously have to be opened. getDataflowSource(),
+	 * isDataflowChanged() etc will not be affected - as if the silent save
+	 * never happened.
+	 * 
+	 * @param dataflow
+	 *            {@link WorkflowBundle} to be saved
+	 * @param fileType
+	 *            {@link FileType} to save dataflow as, for instance
+	 *            {@link net.sf.taverna.t2.workbench.file.impl.T2FlowFileType}.
+	 *            The file type must be supported by an SPI implementation of
+	 *            {@link DataflowPersistenceHandler}.
+	 * @param destination
+	 *            Destination to save dataflow to, for instance a {@link File}
+	 * @param failOnOverwrite
+	 *            If <code>true</code>, an {@link OverwriteException} is thrown
+	 *            if a save would overwrite the destination because it already
+	 *            exists, but was not opened or save to using the file manager
+	 *            for the given dataflow. (ie. a repeated call to this function
+	 *            should not throw an OverwriteException unless someone outside
+	 *            has modified the file)
+	 * @return The {@link DataflowInfo} describing where the workflow was saved
+	 * @throws OverwriteException
+	 *             if failOnOverwrite was true, and a save would overwrite the
+	 *             destination because it already existed, and was not last
+	 *             written to by a previous save. The save was not performed.
+	 * @throws SaveException
+	 *             If any other error occurs during saving, including the case
+	 *             that a dataflow is not connected to a source or destination,
+	 *             that there are no handlers (some source types can't be saved
+	 *             to, such as HTTP URLs), or any other IO error occurring while
+	 *             saving.
+	 */
+	DataflowInfo saveDataflowSilently(WorkflowBundle dataflow, FileType fileType,
+			Object destination, boolean failOnOverwrite) throws SaveException,
+			OverwriteException;
+
+	/**
+	 * Set the current dataflow to the one provided.
+	 * <p>
+	 * The current dataflow can be retrieved using {@link #getCurrentDataflow()}
+	 * . Note that opening a dataflow will normally also set it as the current
+	 * dataflow.
+	 * <p>
+	 * Listeners registered using {@link Observable#addObserver(Observer)} will
+	 * be notified with an {@link SetCurrentDataflowEvent}.
+	 * <p>
+	 * Note, the dataflow must already be open. If this is not the case, use one
+	 * of the openDataflow() methods or
+	 * {@link #setCurrentDataflow(WorkflowBundle, boolean)}.
+	 *
+	 * @see #setCurrentDataflow(WorkflowBundle, boolean)
+	 * @param dataflow
+	 *            {@link WorkflowBundle} to be made current
+	 */
+	void setCurrentDataflow(WorkflowBundle dataflow);
+
+	/**
+	 * Set the current dataflow to the one provided.
+	 * <p>
+	 * The current dataflow can be retrieved using {@link #getCurrentDataflow()}
+	 * . Note that opening a dataflow will normally also set it as the current
+	 * dataflow.
+	 * <p>
+	 * Listeners registered using {@link Observable#addObserver(Observer)} will
+	 * be notified with an {@link SetCurrentDataflowEvent}.
+	 * <p>
+	 * Unless <code>openIfNeeded</code> is <code>true</code>, the dataflow must
+	 * already be open.
+	 *
+	 * @see #setCurrentDataflow(WorkflowBundle, boolean)
+	 * @param dataflow
+	 *            {@link WorkflowBundle} to be made current
+	 * @param openIfNeeded
+	 *            If <code>true</code>, open the dataflow if needed
+	 */
+	void setCurrentDataflow(WorkflowBundle dataflow, boolean openIfNeeded);
+
+	/**
+	 * Set a dataflow as changed or not. This changes the value returned by
+	 * {@link #isDataflowChanged(WorkflowBundle)}.
+	 * <p>
+	 * This method can be used if the dataflow has been changed outside the
+	 * {@link EditManager}.
+	 *
+	 * @param dataflow
+	 *            Dataflow which is to be marked
+	 * @param isChanged
+	 *            <code>true</code> if the dataflow is to be marked as changed,
+	 *            <code>false</code> if it is to be marked as not changed.
+	 */
+	void setDataflowChanged(WorkflowBundle dataflow, boolean isChanged);
+
+	/**
+	 * Returns the canonical form of the source where the dataflow was opened
+	 * from or saved to. The code for this method was devised based on
+	 * {@link net.sf.taverna.t2.workbench.file.impl.T2DataflowOpener#openDataflow(FileType fileType, Object source)}.
+	 */
+	Object getCanonical(Object source) throws IllegalArgumentException,
+			URISyntaxException, IOException;
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/FileType.java
----------------------------------------------------------------------
diff --git a/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/FileType.java b/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/FileType.java
new file mode 100644
index 0000000..ef2d53c
--- /dev/null
+++ b/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/FileType.java
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * 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 org.apache.taverna.workbench.file;
+
+/**
+ * A filetype to identify a way to (de)serialise a {@link WorkflowBundle} with
+ * the {@link FileManager}.
+ * <p>
+ * Two filetypes are considered equal if they share an extension or mime type or
+ * are the same instance.
+ * 
+ * @see net.sf.taverna.t2.workbench.file.impl.WorkflowBundleFileType
+ * @author Stian Soiland-Reyes
+ */
+public abstract class FileType {
+	public abstract String getExtension();
+
+	public abstract String getMimeType();
+
+	public abstract String getDescription();
+
+	/**
+	 * {@inheritDoc}
+	 */
+	@Override
+	public boolean equals(Object obj) {
+		if (obj == this)
+			return true;
+		if (!(obj instanceof FileType))
+			return false;
+		FileType other = (FileType) obj;
+		if (getMimeType() != null && other.getMimeType() != null)
+			return getMimeType().equalsIgnoreCase(other.getMimeType());
+		if (getExtension() != null && other.getExtension() != null)
+			return getExtension().equalsIgnoreCase(other.getExtension());
+		return false;
+	}
+
+	/**
+	 * {@inheritDoc}
+	 */
+	@Override
+	public int hashCode() {
+		int hash = 7;
+		hash = 31 * hash + getExtension().hashCode();
+		hash = 31 * hash + getMimeType().hashCode();
+		return hash;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/events/AbstractDataflowEvent.java
----------------------------------------------------------------------
diff --git a/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/events/AbstractDataflowEvent.java b/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/events/AbstractDataflowEvent.java
new file mode 100644
index 0000000..fa97fe0
--- /dev/null
+++ b/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/events/AbstractDataflowEvent.java
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * 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 org.apache.taverna.workbench.file.events;
+
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+
+/**
+ * Abstract FileManagerEvent that relates to a {@link WorkflowBundle}
+ * 
+ * @see AbstractDataflowEvent
+ * @see ClosedDataflowEvent
+ * @see OpenedDataflowEvent
+ * @see SavedDataflowEvent
+ * @see SetCurrentDataflowEvent
+ * @author Stian Soiland-Reyes
+ */
+public abstract class AbstractDataflowEvent extends FileManagerEvent {
+	private final WorkflowBundle workflowBundle;
+
+	public AbstractDataflowEvent(WorkflowBundle workflowBundle) {
+		this.workflowBundle = workflowBundle;
+	}
+
+	public WorkflowBundle getDataflow() {
+		return workflowBundle;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/events/ClosedDataflowEvent.java
----------------------------------------------------------------------
diff --git a/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/events/ClosedDataflowEvent.java b/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/events/ClosedDataflowEvent.java
new file mode 100644
index 0000000..ac69c89
--- /dev/null
+++ b/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/events/ClosedDataflowEvent.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * 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 org.apache.taverna.workbench.file.events;
+
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+
+/**
+ * {@link FileManagerEvent} that means a {@link WorkflowBundle} has been closed.
+ * 
+ * @author Stian Soiland-Reyes
+ */
+public class ClosedDataflowEvent extends AbstractDataflowEvent {
+	public ClosedDataflowEvent(WorkflowBundle workflowBundle) {
+		super(workflowBundle);
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/events/ClosingDataflowEvent.java
----------------------------------------------------------------------
diff --git a/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/events/ClosingDataflowEvent.java b/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/events/ClosingDataflowEvent.java
new file mode 100644
index 0000000..26142b5
--- /dev/null
+++ b/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/events/ClosingDataflowEvent.java
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * 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 org.apache.taverna.workbench.file.events;
+
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+
+/**
+ * {@link FileManagerEvent} that means a {@link WorkflowBundle} is being closed.
+ * <i>This event is abortable;</i> if aborted, the close will not occur.
+ * 
+ * @author Alan R Williams
+ */
+public class ClosingDataflowEvent extends AbstractDataflowEvent {
+	private boolean abortClose = false;
+
+	public boolean isAbortClose() {
+		return abortClose;
+	}
+
+	public void setAbortClose(boolean abortClose) {
+		this.abortClose = abortClose;
+	}
+
+	public ClosingDataflowEvent(WorkflowBundle workflowBundle) {
+		super(workflowBundle);
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/events/FileManagerEvent.java
----------------------------------------------------------------------
diff --git a/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/events/FileManagerEvent.java b/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/events/FileManagerEvent.java
new file mode 100644
index 0000000..025ea97
--- /dev/null
+++ b/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/events/FileManagerEvent.java
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * 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 org.apache.taverna.workbench.file.events;
+
+import org.apache.taverna.lang.observer.Observable;
+import org.apache.taverna.workbench.file.FileManager;
+
+/**
+ * An event given to {@link FileManager} observers registered using
+ * {@link Observable#addObserver(net.sf.taverna.t2.lang.observer.Observer)}.
+ * 
+ * @see AbstractDataflowEvent
+ * @see ClosedDataflowEvent
+ * @see OpenedDataflowEvent
+ * @see SavedDataflowEvent
+ * @see SetCurrentDataflowEvent
+ * @author Stian Soiland-Reyes
+ */
+public class FileManagerEvent {
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/events/OpenedDataflowEvent.java
----------------------------------------------------------------------
diff --git a/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/events/OpenedDataflowEvent.java b/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/events/OpenedDataflowEvent.java
new file mode 100644
index 0000000..31f8222
--- /dev/null
+++ b/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/events/OpenedDataflowEvent.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * 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 org.apache.taverna.workbench.file.events;
+
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+
+/**
+ * {@link FileManagerEvent} that means a dataflow has been opened
+ * 
+ * @author Stian Soiland-Reyes
+ */
+public class OpenedDataflowEvent extends AbstractDataflowEvent {
+	public OpenedDataflowEvent(WorkflowBundle workflowBundle) {
+		super(workflowBundle);
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/events/SavedDataflowEvent.java
----------------------------------------------------------------------
diff --git a/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/events/SavedDataflowEvent.java b/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/events/SavedDataflowEvent.java
new file mode 100644
index 0000000..70fc778
--- /dev/null
+++ b/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/events/SavedDataflowEvent.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * 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 org.apache.taverna.workbench.file.events;
+
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+
+/**
+ * {@link FileManagerEvent} that means a {@link WorkflowBundle} has been saved.
+ * 
+ * @author Stian Soiland-Reyes
+ */
+public class SavedDataflowEvent extends AbstractDataflowEvent {
+	public SavedDataflowEvent(WorkflowBundle workflowBundle) {
+		super(workflowBundle);
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/events/SetCurrentDataflowEvent.java
----------------------------------------------------------------------
diff --git a/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/events/SetCurrentDataflowEvent.java b/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/events/SetCurrentDataflowEvent.java
new file mode 100644
index 0000000..cd27705
--- /dev/null
+++ b/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/events/SetCurrentDataflowEvent.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * 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 org.apache.taverna.workbench.file.events;
+
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+
+/**
+ * {@link FileManagerEvent} that means a {@link WorkflowBundle} has been made
+ * current.
+ * 
+ * @author Stian Soiland-Reyes
+ */
+public class SetCurrentDataflowEvent extends AbstractDataflowEvent {
+	public SetCurrentDataflowEvent(WorkflowBundle workflowBundle) {
+		super(workflowBundle);
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/exceptions/FileException.java
----------------------------------------------------------------------
diff --git a/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/exceptions/FileException.java b/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/exceptions/FileException.java
new file mode 100644
index 0000000..67e17ac
--- /dev/null
+++ b/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/exceptions/FileException.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * 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 org.apache.taverna.workbench.file.exceptions;
+
+import org.apache.taverna.workbench.file.FileManager;
+
+/**
+ * Superclass of exceptions thrown by the {@link FileManager}.
+ */
+@SuppressWarnings("serial")
+public class FileException extends Exception {
+	public FileException() {
+	}
+
+	public FileException(String message) {
+		super(message);
+	}
+
+	public FileException(Throwable cause) {
+		super(cause);
+	}
+
+	public FileException(String message, Throwable cause) {
+		super(message, cause);
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/exceptions/OpenException.java
----------------------------------------------------------------------
diff --git a/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/exceptions/OpenException.java b/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/exceptions/OpenException.java
new file mode 100644
index 0000000..e687c94
--- /dev/null
+++ b/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/exceptions/OpenException.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 org.apache.taverna.workbench.file.exceptions;
+
+/** Indicate that something went wrong during opening a file */
+@SuppressWarnings("serial")
+public class OpenException extends FileException {
+	public OpenException() {
+	}
+
+	public OpenException(String message) {
+		super(message);
+	}
+
+	public OpenException(Throwable cause) {
+		super(cause);
+	}
+
+	public OpenException(String message, Throwable cause) {
+		super(message, cause);
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/exceptions/OverwriteException.java
----------------------------------------------------------------------
diff --git a/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/exceptions/OverwriteException.java b/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/exceptions/OverwriteException.java
new file mode 100644
index 0000000..fff8aa0
--- /dev/null
+++ b/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/exceptions/OverwriteException.java
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * 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 org.apache.taverna.workbench.file.exceptions;
+
+/** Indicate that something could not be overwritten. */
+@SuppressWarnings("serial")
+public class OverwriteException extends SaveException {
+	private final Object destination;
+
+	public OverwriteException(Object destination) {
+		super("Save would overwrite existing destination " + destination);
+		this.destination = destination;
+	}
+
+	public Object getDestination() {
+		return destination;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/exceptions/SaveException.java
----------------------------------------------------------------------
diff --git a/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/exceptions/SaveException.java b/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/exceptions/SaveException.java
new file mode 100644
index 0000000..4d2866f
--- /dev/null
+++ b/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/exceptions/SaveException.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 org.apache.taverna.workbench.file.exceptions;
+
+/** Indicate that a workflow could not be saved. */
+@SuppressWarnings("serial")
+public class SaveException extends FileException {
+	public SaveException() {
+	}
+
+	public SaveException(String message) {
+		super(message);
+	}
+
+	public SaveException(Throwable cause) {
+		super(cause);
+	}
+
+	public SaveException(String message, Throwable cause) {
+		super(message, cause);
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/exceptions/UnsavedException.java
----------------------------------------------------------------------
diff --git a/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/exceptions/UnsavedException.java b/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/exceptions/UnsavedException.java
new file mode 100644
index 0000000..a72606d
--- /dev/null
+++ b/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/exceptions/UnsavedException.java
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * 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 org.apache.taverna.workbench.file.exceptions;
+
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+
+/** Indicate that a workflow bundle is not saved. */
+@SuppressWarnings("serial")
+public class UnsavedException extends FileException {
+	private final WorkflowBundle workflowBundle;
+
+	public UnsavedException(WorkflowBundle workflowBundle) {
+		super("WorkflowBundle was not saved: " + workflowBundle);
+		this.workflowBundle = workflowBundle;
+	}
+
+	public WorkflowBundle getDataflow() {
+		return workflowBundle;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/DataflowFromDataflowPersistenceHandler.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/DataflowFromDataflowPersistenceHandler.java b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/DataflowFromDataflowPersistenceHandler.java
index 5776c78..0c498bc 100644
--- a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/DataflowFromDataflowPersistenceHandler.java
+++ b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/DataflowFromDataflowPersistenceHandler.java
@@ -7,11 +7,11 @@ import java.util.Arrays;
 import java.util.Date;
 import java.util.List;
 
-import net.sf.taverna.t2.workbench.file.AbstractDataflowPersistenceHandler;
-import net.sf.taverna.t2.workbench.file.DataflowInfo;
-import net.sf.taverna.t2.workbench.file.DataflowPersistenceHandler;
-import net.sf.taverna.t2.workbench.file.FileType;
-import net.sf.taverna.t2.workbench.file.exceptions.OpenException;
+import org.apache.taverna.workbench.file.AbstractDataflowPersistenceHandler;
+import org.apache.taverna.workbench.file.DataflowInfo;
+import org.apache.taverna.workbench.file.DataflowPersistenceHandler;
+import org.apache.taverna.workbench.file.FileType;
+import org.apache.taverna.workbench.file.exceptions.OpenException;
 import org.apache.taverna.scufl2.api.container.WorkflowBundle;
 import org.apache.taverna.scufl2.api.core.Workflow;
 

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/DataflowPersistenceHandlerRegistry.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/DataflowPersistenceHandlerRegistry.java b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/DataflowPersistenceHandlerRegistry.java
index 39117e9..c33119d 100644
--- a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/DataflowPersistenceHandlerRegistry.java
+++ b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/DataflowPersistenceHandlerRegistry.java
@@ -31,8 +31,8 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
-import net.sf.taverna.t2.workbench.file.DataflowPersistenceHandler;
-import net.sf.taverna.t2.workbench.file.FileType;
+import org.apache.taverna.workbench.file.DataflowPersistenceHandler;
+import org.apache.taverna.workbench.file.FileType;
 
 import org.apache.commons.collections.Factory;
 

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/FileDataflowInfo.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/FileDataflowInfo.java b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/FileDataflowInfo.java
index 1e9080b..b7377e9 100644
--- a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/FileDataflowInfo.java
+++ b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/FileDataflowInfo.java
@@ -24,9 +24,9 @@ import java.io.File;
 import java.io.IOException;
 import java.util.Date;
 
-import net.sf.taverna.t2.workbench.file.DataflowInfo;
-import net.sf.taverna.t2.workbench.file.FileManager;
-import net.sf.taverna.t2.workbench.file.FileType;
+import org.apache.taverna.workbench.file.DataflowInfo;
+import org.apache.taverna.workbench.file.FileManager;
+import org.apache.taverna.workbench.file.FileType;
 
 import org.apache.log4j.Logger;
 

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/FileManagerImpl.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/FileManagerImpl.java b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/FileManagerImpl.java
index c587caa..eed7d51 100644
--- a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/FileManagerImpl.java
+++ b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/FileManagerImpl.java
@@ -43,23 +43,23 @@ import javax.swing.filechooser.FileFilter;
 import org.apache.taverna.lang.observer.MultiCaster;
 import org.apache.taverna.lang.observer.Observable;
 import org.apache.taverna.lang.observer.Observer;
-import net.sf.taverna.t2.workbench.edits.EditManager;
-import net.sf.taverna.t2.workbench.edits.EditManager.AbstractDataflowEditEvent;
-import net.sf.taverna.t2.workbench.edits.EditManager.EditManagerEvent;
-import net.sf.taverna.t2.workbench.file.DataflowInfo;
-import net.sf.taverna.t2.workbench.file.DataflowPersistenceHandler;
-import net.sf.taverna.t2.workbench.file.FileManager;
-import net.sf.taverna.t2.workbench.file.FileType;
-import net.sf.taverna.t2.workbench.file.events.ClosedDataflowEvent;
-import net.sf.taverna.t2.workbench.file.events.ClosingDataflowEvent;
-import net.sf.taverna.t2.workbench.file.events.FileManagerEvent;
-import net.sf.taverna.t2.workbench.file.events.OpenedDataflowEvent;
-import net.sf.taverna.t2.workbench.file.events.SavedDataflowEvent;
-import net.sf.taverna.t2.workbench.file.events.SetCurrentDataflowEvent;
-import net.sf.taverna.t2.workbench.file.exceptions.OpenException;
-import net.sf.taverna.t2.workbench.file.exceptions.OverwriteException;
-import net.sf.taverna.t2.workbench.file.exceptions.SaveException;
-import net.sf.taverna.t2.workbench.file.exceptions.UnsavedException;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.edits.EditManager.AbstractDataflowEditEvent;
+import org.apache.taverna.workbench.edits.EditManager.EditManagerEvent;
+import org.apache.taverna.workbench.file.DataflowInfo;
+import org.apache.taverna.workbench.file.DataflowPersistenceHandler;
+import org.apache.taverna.workbench.file.FileManager;
+import org.apache.taverna.workbench.file.FileType;
+import org.apache.taverna.workbench.file.events.ClosedDataflowEvent;
+import org.apache.taverna.workbench.file.events.ClosingDataflowEvent;
+import org.apache.taverna.workbench.file.events.FileManagerEvent;
+import org.apache.taverna.workbench.file.events.OpenedDataflowEvent;
+import org.apache.taverna.workbench.file.events.SavedDataflowEvent;
+import org.apache.taverna.workbench.file.events.SetCurrentDataflowEvent;
+import org.apache.taverna.workbench.file.exceptions.OpenException;
+import org.apache.taverna.workbench.file.exceptions.OverwriteException;
+import org.apache.taverna.workbench.file.exceptions.SaveException;
+import org.apache.taverna.workbench.file.exceptions.UnsavedException;
 
 import org.apache.log4j.Logger;
 

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/FileTypeFileFilter.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/FileTypeFileFilter.java b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/FileTypeFileFilter.java
index 6416163..6383295 100644
--- a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/FileTypeFileFilter.java
+++ b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/FileTypeFileFilter.java
@@ -24,7 +24,7 @@ import java.io.File;
 
 import javax.swing.filechooser.FileFilter;
 
-import net.sf.taverna.t2.workbench.file.FileType;
+import org.apache.taverna.workbench.file.FileType;
 
 public class FileTypeFileFilter extends FileFilter {
 	private final FileType fileType;

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/MultipleFileTypes.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/MultipleFileTypes.java b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/MultipleFileTypes.java
index c398805..0205d86 100644
--- a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/MultipleFileTypes.java
+++ b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/MultipleFileTypes.java
@@ -25,7 +25,7 @@ import java.util.Set;
 
 import javax.swing.filechooser.FileFilter;
 
-import net.sf.taverna.t2.workbench.file.FileType;
+import org.apache.taverna.workbench.file.FileType;
 
 public class MultipleFileTypes extends FileFilter {
 	private String description;

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/OpenDataflowInProgressDialog.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/OpenDataflowInProgressDialog.java b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/OpenDataflowInProgressDialog.java
index dc08cff..021a1b2 100644
--- a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/OpenDataflowInProgressDialog.java
+++ b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/OpenDataflowInProgressDialog.java
@@ -22,8 +22,8 @@
 package net.sf.taverna.t2.workbench.file.impl;
 
 import static java.awt.BorderLayout.CENTER;
-import static net.sf.taverna.t2.workbench.MainWindow.getMainWindow;
-import static net.sf.taverna.t2.workbench.icons.WorkbenchIcons.workingIcon;
+import static org.apache.taverna.workbench.MainWindow.getMainWindow;
+import static org.apache.taverna.workbench.icons.WorkbenchIcons.workingIcon;
 
 import java.awt.BorderLayout;
 import java.awt.Dimension;
@@ -32,7 +32,7 @@ import javax.swing.JLabel;
 import javax.swing.JPanel;
 import javax.swing.border.EmptyBorder;
 
-import net.sf.taverna.t2.workbench.helper.HelpEnabledDialog;
+import org.apache.taverna.workbench.helper.HelpEnabledDialog;
 
 /**
  * Dialog that is popped up while we are opening a workflow.

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/OpenDataflowInfo.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/OpenDataflowInfo.java b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/OpenDataflowInfo.java
index 4a4a1e3..00245f1 100644
--- a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/OpenDataflowInfo.java
+++ b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/OpenDataflowInfo.java
@@ -22,8 +22,8 @@ package net.sf.taverna.t2.workbench.file.impl;
 
 import java.util.Date;
 
-import net.sf.taverna.t2.workbench.file.DataflowInfo;
-import net.sf.taverna.t2.workbench.file.FileType;
+import org.apache.taverna.workbench.file.DataflowInfo;
+import org.apache.taverna.workbench.file.FileType;
 
 /**
  * Information about an open dataflow.

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/OpenDataflowRunnable.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/OpenDataflowRunnable.java b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/OpenDataflowRunnable.java
index 7cb1c57..504c2a9 100644
--- a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/OpenDataflowRunnable.java
+++ b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/OpenDataflowRunnable.java
@@ -4,9 +4,9 @@
 package net.sf.taverna.t2.workbench.file.impl;
 
 import static java.lang.Thread.sleep;
-import net.sf.taverna.t2.workbench.file.FileType;
-import net.sf.taverna.t2.workbench.file.exceptions.OpenException;
-import net.sf.taverna.t2.workbench.ui.SwingWorkerCompletionWaiter;
+import org.apache.taverna.workbench.file.FileType;
+import org.apache.taverna.workbench.file.exceptions.OpenException;
+import org.apache.taverna.workbench.ui.SwingWorkerCompletionWaiter;
 import org.apache.taverna.scufl2.api.container.WorkflowBundle;
 
 /**

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/OpenDataflowSwingWorker.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/OpenDataflowSwingWorker.java b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/OpenDataflowSwingWorker.java
index c8a78db..ba74b03 100644
--- a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/OpenDataflowSwingWorker.java
+++ b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/OpenDataflowSwingWorker.java
@@ -22,8 +22,8 @@ package net.sf.taverna.t2.workbench.file.impl;
 
 import javax.swing.SwingWorker;
 
-import net.sf.taverna.t2.workbench.file.FileType;
-import net.sf.taverna.t2.workbench.file.exceptions.OpenException;
+import org.apache.taverna.workbench.file.FileType;
+import org.apache.taverna.workbench.file.exceptions.OpenException;
 
 import org.apache.log4j.Logger;
 

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/T2DataflowOpener.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/T2DataflowOpener.java b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/T2DataflowOpener.java
index 79f3e6f..d6e0db2 100644
--- a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/T2DataflowOpener.java
+++ b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/T2DataflowOpener.java
@@ -32,11 +32,11 @@ import java.util.Arrays;
 import java.util.Date;
 import java.util.List;
 
-import net.sf.taverna.t2.workbench.file.AbstractDataflowPersistenceHandler;
-import net.sf.taverna.t2.workbench.file.DataflowInfo;
-import net.sf.taverna.t2.workbench.file.DataflowPersistenceHandler;
-import net.sf.taverna.t2.workbench.file.FileType;
-import net.sf.taverna.t2.workbench.file.exceptions.OpenException;
+import org.apache.taverna.workbench.file.AbstractDataflowPersistenceHandler;
+import org.apache.taverna.workbench.file.DataflowInfo;
+import org.apache.taverna.workbench.file.DataflowPersistenceHandler;
+import org.apache.taverna.workbench.file.FileType;
+import org.apache.taverna.workbench.file.exceptions.OpenException;
 
 import org.apache.log4j.Logger;
 

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/T2FlowFileType.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/T2FlowFileType.java b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/T2FlowFileType.java
index a2774e4..cb2b399 100644
--- a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/T2FlowFileType.java
+++ b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/T2FlowFileType.java
@@ -20,7 +20,7 @@
  ******************************************************************************/
 package net.sf.taverna.t2.workbench.file.impl;
 
-import net.sf.taverna.t2.workbench.file.FileType;
+import org.apache.taverna.workbench.file.FileType;
 
 public class T2FlowFileType extends FileType {
 	public static final String APPLICATION_VND_TAVERNA_T2FLOW_XML = "application/vnd.taverna.t2flow+xml";

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/WorkflowBundleFileType.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/WorkflowBundleFileType.java b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/WorkflowBundleFileType.java
index 09b30b0..ad50f79 100644
--- a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/WorkflowBundleFileType.java
+++ b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/WorkflowBundleFileType.java
@@ -20,7 +20,7 @@
  ******************************************************************************/
 package net.sf.taverna.t2.workbench.file.impl;
 
-import net.sf.taverna.t2.workbench.file.FileType;
+import org.apache.taverna.workbench.file.FileType;
 
 public class WorkflowBundleFileType extends FileType {
 	public static final String APPLICATION_VND_TAVERNA_SCUFL2_WORKFLOW_BUNDLE = "application/vnd.taverna.scufl2.workflow-bundle";

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/WorkflowBundleOpener.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/WorkflowBundleOpener.java b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/WorkflowBundleOpener.java
index 8d13438..6092dad 100644
--- a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/WorkflowBundleOpener.java
+++ b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/WorkflowBundleOpener.java
@@ -32,11 +32,11 @@ import java.util.Arrays;
 import java.util.Date;
 import java.util.List;
 
-import net.sf.taverna.t2.workbench.file.AbstractDataflowPersistenceHandler;
-import net.sf.taverna.t2.workbench.file.DataflowInfo;
-import net.sf.taverna.t2.workbench.file.DataflowPersistenceHandler;
-import net.sf.taverna.t2.workbench.file.FileType;
-import net.sf.taverna.t2.workbench.file.exceptions.OpenException;
+import org.apache.taverna.workbench.file.AbstractDataflowPersistenceHandler;
+import org.apache.taverna.workbench.file.DataflowInfo;
+import org.apache.taverna.workbench.file.DataflowPersistenceHandler;
+import org.apache.taverna.workbench.file.FileType;
+import org.apache.taverna.workbench.file.exceptions.OpenException;
 
 import org.apache.log4j.Logger;
 

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/WorkflowBundleSaver.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/WorkflowBundleSaver.java b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/WorkflowBundleSaver.java
index c534a8d..3933e67 100644
--- a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/WorkflowBundleSaver.java
+++ b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/WorkflowBundleSaver.java
@@ -31,11 +31,11 @@ import java.util.Arrays;
 import java.util.Date;
 import java.util.List;
 
-import net.sf.taverna.t2.workbench.file.AbstractDataflowPersistenceHandler;
-import net.sf.taverna.t2.workbench.file.DataflowInfo;
-import net.sf.taverna.t2.workbench.file.DataflowPersistenceHandler;
-import net.sf.taverna.t2.workbench.file.FileType;
-import net.sf.taverna.t2.workbench.file.exceptions.SaveException;
+import org.apache.taverna.workbench.file.AbstractDataflowPersistenceHandler;
+import org.apache.taverna.workbench.file.DataflowInfo;
+import org.apache.taverna.workbench.file.DataflowPersistenceHandler;
+import org.apache.taverna.workbench.file.FileType;
+import org.apache.taverna.workbench.file.exceptions.SaveException;
 
 import org.apache.log4j.Logger;
 

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/actions/CloseAllWorkflowsAction.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/actions/CloseAllWorkflowsAction.java b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/actions/CloseAllWorkflowsAction.java
index 8a39c06..337d9a3 100644
--- a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/actions/CloseAllWorkflowsAction.java
+++ b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/actions/CloseAllWorkflowsAction.java
@@ -25,7 +25,7 @@ import static java.awt.event.InputEvent.SHIFT_DOWN_MASK;
 import static java.awt.event.KeyEvent.VK_L;
 import static java.awt.event.KeyEvent.VK_W;
 import static javax.swing.KeyStroke.getKeyStroke;
-import static net.sf.taverna.t2.workbench.icons.WorkbenchIcons.closeAllIcon;
+import static org.apache.taverna.workbench.icons.WorkbenchIcons.closeAllIcon;
 
 import java.awt.Component;
 import java.awt.event.ActionEvent;
@@ -34,8 +34,8 @@ import java.util.List;
 
 import javax.swing.AbstractAction;
 
-import net.sf.taverna.t2.workbench.edits.EditManager;
-import net.sf.taverna.t2.workbench.file.FileManager;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.file.FileManager;
 
 import org.apache.log4j.Logger;
 

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/actions/CloseWorkflowAction.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/actions/CloseWorkflowAction.java b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/actions/CloseWorkflowAction.java
index f4c07ac..b696fae 100644
--- a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/actions/CloseWorkflowAction.java
+++ b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/actions/CloseWorkflowAction.java
@@ -29,16 +29,16 @@ import static javax.swing.JOptionPane.YES_NO_CANCEL_OPTION;
 import static javax.swing.JOptionPane.YES_OPTION;
 import static javax.swing.JOptionPane.showConfirmDialog;
 import static javax.swing.KeyStroke.getKeyStroke;
-import static net.sf.taverna.t2.workbench.icons.WorkbenchIcons.closeIcon;
+import static org.apache.taverna.workbench.icons.WorkbenchIcons.closeIcon;
 
 import java.awt.Component;
 import java.awt.event.ActionEvent;
 
 import javax.swing.AbstractAction;
 
-import net.sf.taverna.t2.workbench.edits.EditManager;
-import net.sf.taverna.t2.workbench.file.FileManager;
-import net.sf.taverna.t2.workbench.file.exceptions.UnsavedException;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.file.FileManager;
+import org.apache.taverna.workbench.file.exceptions.UnsavedException;
 
 import org.apache.log4j.Logger;
 

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/actions/NewWorkflowAction.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/actions/NewWorkflowAction.java b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/actions/NewWorkflowAction.java
index 3b9256a..3497d77 100644
--- a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/actions/NewWorkflowAction.java
+++ b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/actions/NewWorkflowAction.java
@@ -23,14 +23,14 @@ package net.sf.taverna.t2.workbench.file.impl.actions;
 import static java.awt.Toolkit.getDefaultToolkit;
 import static java.awt.event.KeyEvent.VK_N;
 import static javax.swing.KeyStroke.getKeyStroke;
-import static net.sf.taverna.t2.workbench.icons.WorkbenchIcons.newIcon;
+import static org.apache.taverna.workbench.icons.WorkbenchIcons.newIcon;
 
 import java.awt.event.ActionEvent;
 import java.awt.event.KeyEvent;
 
 import javax.swing.AbstractAction;
 
-import net.sf.taverna.t2.workbench.file.FileManager;
+import org.apache.taverna.workbench.file.FileManager;
 
 import org.apache.log4j.Logger;
 

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/actions/OpenNestedWorkflowAction.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/actions/OpenNestedWorkflowAction.java b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/actions/OpenNestedWorkflowAction.java
index f647833..91c9caa 100644
--- a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/actions/OpenNestedWorkflowAction.java
+++ b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/actions/OpenNestedWorkflowAction.java
@@ -23,9 +23,9 @@ package net.sf.taverna.t2.workbench.file.impl.actions;
 import java.awt.Component;
 import java.io.File;
 
-import net.sf.taverna.t2.workbench.file.FileManager;
-import net.sf.taverna.t2.workbench.file.FileType;
-import net.sf.taverna.t2.workbench.file.exceptions.OpenException;
+import org.apache.taverna.workbench.file.FileManager;
+import org.apache.taverna.workbench.file.FileType;
+import org.apache.taverna.workbench.file.exceptions.OpenException;
 
 import org.apache.log4j.Logger;
 

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/actions/OpenWorkflowAction.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/actions/OpenWorkflowAction.java b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/actions/OpenWorkflowAction.java
index e51bb7a..39f0e97 100644
--- a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/actions/OpenWorkflowAction.java
+++ b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/actions/OpenWorkflowAction.java
@@ -34,7 +34,7 @@ import static javax.swing.JOptionPane.showMessageDialog;
 import static javax.swing.JOptionPane.showOptionDialog;
 import static javax.swing.KeyStroke.getKeyStroke;
 import static javax.swing.SwingUtilities.invokeLater;
-import static net.sf.taverna.t2.workbench.icons.WorkbenchIcons.openIcon;
+import static org.apache.taverna.workbench.icons.WorkbenchIcons.openIcon;
 
 import java.awt.Component;
 import java.awt.event.ActionEvent;
@@ -47,9 +47,9 @@ import javax.swing.AbstractAction;
 import javax.swing.JFileChooser;
 import javax.swing.filechooser.FileFilter;
 
-import net.sf.taverna.t2.workbench.file.FileManager;
-import net.sf.taverna.t2.workbench.file.FileType;
-import net.sf.taverna.t2.workbench.file.exceptions.OpenException;
+import org.apache.taverna.workbench.file.FileManager;
+import org.apache.taverna.workbench.file.FileType;
+import org.apache.taverna.workbench.file.exceptions.OpenException;
 import net.sf.taverna.t2.workbench.file.impl.FileTypeFileFilter;
 
 import org.apache.log4j.Logger;

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/actions/OpenWorkflowFromURLAction.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/actions/OpenWorkflowFromURLAction.java b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/actions/OpenWorkflowFromURLAction.java
index 7ae20e9..83efa74 100644
--- a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/actions/OpenWorkflowFromURLAction.java
+++ b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/actions/OpenWorkflowFromURLAction.java
@@ -31,7 +31,7 @@ import static javax.swing.JOptionPane.showInputDialog;
 import static javax.swing.JOptionPane.showMessageDialog;
 import static javax.swing.JOptionPane.showOptionDialog;
 import static javax.swing.KeyStroke.getKeyStroke;
-import static net.sf.taverna.t2.workbench.icons.WorkbenchIcons.openurlIcon;
+import static org.apache.taverna.workbench.icons.WorkbenchIcons.openurlIcon;
 
 import java.awt.Component;
 import java.awt.event.ActionEvent;
@@ -40,7 +40,7 @@ import java.util.prefs.Preferences;
 
 import javax.swing.AbstractAction;
 
-import net.sf.taverna.t2.workbench.file.FileManager;
+import org.apache.taverna.workbench.file.FileManager;
 
 import org.apache.log4j.Logger;
 

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/actions/PasswordInput.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/actions/PasswordInput.java b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/actions/PasswordInput.java
index 401a232..c4fdc0f 100644
--- a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/actions/PasswordInput.java
+++ b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/actions/PasswordInput.java
@@ -36,7 +36,7 @@ import javax.swing.JLabel;
 import javax.swing.JPasswordField;
 import javax.swing.JTextField;
 
-import net.sf.taverna.t2.workbench.helper.HelpEnabledDialog;
+import org.apache.taverna.workbench.helper.HelpEnabledDialog;
 
 import org.apache.commons.codec.binary.Base64;
 import org.apache.log4j.Logger;

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/actions/SaveAllWorkflowsAction.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/actions/SaveAllWorkflowsAction.java b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/actions/SaveAllWorkflowsAction.java
index a1e7eef..1bd8a7a 100644
--- a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/actions/SaveAllWorkflowsAction.java
+++ b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/actions/SaveAllWorkflowsAction.java
@@ -25,7 +25,7 @@ import static java.awt.event.InputEvent.SHIFT_DOWN_MASK;
 import static java.awt.event.KeyEvent.VK_A;
 import static java.awt.event.KeyEvent.VK_S;
 import static javax.swing.KeyStroke.getKeyStroke;
-import static net.sf.taverna.t2.workbench.icons.WorkbenchIcons.saveAllIcon;
+import static org.apache.taverna.workbench.icons.WorkbenchIcons.saveAllIcon;
 
 import java.awt.Component;
 import java.awt.event.ActionEvent;
@@ -36,9 +36,9 @@ import javax.swing.AbstractAction;
 
 import org.apache.taverna.lang.observer.Observable;
 import org.apache.taverna.lang.observer.Observer;
-import net.sf.taverna.t2.workbench.edits.EditManager;
-import net.sf.taverna.t2.workbench.file.FileManager;
-import net.sf.taverna.t2.workbench.file.events.FileManagerEvent;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.file.FileManager;
+import org.apache.taverna.workbench.file.events.FileManagerEvent;
 
 import org.apache.log4j.Logger;
 


[26/51] [partial] incubator-taverna-workbench git commit: all packages are moved to org.apache.taverna.*

Posted by re...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-design-ui/src/main/java/net/sf/taverna/t2/workbench/design/actions/EditDataflowOutputPortAction.java
----------------------------------------------------------------------
diff --git a/taverna-design-ui/src/main/java/net/sf/taverna/t2/workbench/design/actions/EditDataflowOutputPortAction.java b/taverna-design-ui/src/main/java/net/sf/taverna/t2/workbench/design/actions/EditDataflowOutputPortAction.java
deleted file mode 100644
index d331da6..0000000
--- a/taverna-design-ui/src/main/java/net/sf/taverna/t2/workbench/design/actions/EditDataflowOutputPortAction.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*******************************************************************************
- * 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.design.actions;
-
-import java.awt.Component;
-import java.awt.Dimension;
-import java.awt.event.ActionEvent;
-import java.util.HashSet;
-import java.util.Set;
-
-import net.sf.taverna.t2.lang.ui.ValidatingUserInputDialog;
-import net.sf.taverna.t2.workbench.design.ui.DataflowOutputPortPanel;
-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.RenameEdit;
-
-import org.apache.log4j.Logger;
-
-import org.apache.taverna.scufl2.api.core.Workflow;
-import org.apache.taverna.scufl2.api.port.OutputWorkflowPort;
-
-/**
- * Action for editing a dataflow output port.
- * 
- * @author David Withers
- */
-@SuppressWarnings("serial")
-public class EditDataflowOutputPortAction extends DataflowEditAction {
-	private static final Logger logger = Logger
-			.getLogger(EditDataflowOutputPortAction.class);
-
-	private OutputWorkflowPort port;
-
-	public EditDataflowOutputPortAction(Workflow dataflow,
-			OutputWorkflowPort port, Component component,
-			EditManager editManager, SelectionManager selectionManager) {
-		super(dataflow, component, editManager, selectionManager);
-		this.port = port;
-		putValue(SMALL_ICON, WorkbenchIcons.renameIcon);
-		putValue(NAME, "Edit workflow output port...");
-	}
-
-	@Override
-	public void actionPerformed(ActionEvent e) {
-		Set<String> usedOutputPorts = new HashSet<>();
-		for (OutputWorkflowPort usedOutputPort : dataflow.getOutputPorts())
-			if (!usedOutputPort.getName().equals(port.getName()))
-				usedOutputPorts.add(usedOutputPort.getName());
-
-		DataflowOutputPortPanel inputPanel = new DataflowOutputPortPanel();
-
-		ValidatingUserInputDialog vuid = new ValidatingUserInputDialog(
-				"Edit Workflow Output Port", inputPanel);
-		vuid.addTextComponentValidation(inputPanel.getPortNameField(),
-				"Set the workflow output port name.", usedOutputPorts,
-				"Duplicate workflow output port name.",
-				"[\\p{L}\\p{Digit}_.]+", "Invalid workflow output port name.");
-		vuid.setSize(new Dimension(400, 200));
-
-		inputPanel.setPortName(port.getName());
-
-		try {
-			if (vuid.show(component))
-				changeOutputPort(inputPanel);
-		} catch (EditException ex) {
-			logger.debug("Rename workflow output port failed", ex);
-		}
-	}
-
-	private void changeOutputPort(DataflowOutputPortPanel inputPanel)
-			throws EditException {
-		editManager.doDataflowEdit(dataflow.getParent(), new RenameEdit<>(port,
-				inputPanel.getPortName()));
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-design-ui/src/main/java/net/sf/taverna/t2/workbench/design/actions/RemoveConditionAction.java
----------------------------------------------------------------------
diff --git a/taverna-design-ui/src/main/java/net/sf/taverna/t2/workbench/design/actions/RemoveConditionAction.java b/taverna-design-ui/src/main/java/net/sf/taverna/t2/workbench/design/actions/RemoveConditionAction.java
deleted file mode 100644
index a067d26..0000000
--- a/taverna-design-ui/src/main/java/net/sf/taverna/t2/workbench/design/actions/RemoveConditionAction.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*******************************************************************************
- * 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.design.actions;
-
-import static net.sf.taverna.t2.workbench.icons.WorkbenchIcons.deleteIcon;
-
-import java.awt.Component;
-import java.awt.event.ActionEvent;
-
-import net.sf.taverna.t2.workbench.edits.EditException;
-import net.sf.taverna.t2.workbench.edits.EditManager;
-import net.sf.taverna.t2.workbench.selection.SelectionManager;
-import net.sf.taverna.t2.workflow.edits.RemoveChildEdit;
-
-import org.apache.log4j.Logger;
-
-import org.apache.taverna.scufl2.api.core.ControlLink;
-import org.apache.taverna.scufl2.api.core.Workflow;
-
-/**
- * Action for removing a condition from the dataflow.
- * 
- * @author David Withers
- */
-@SuppressWarnings("serial")
-public class RemoveConditionAction extends DataflowEditAction {
-	private static final Logger logger = Logger
-			.getLogger(RemoveConditionAction.class);
-
-	private ControlLink controlLink;
-
-	public RemoveConditionAction(Workflow dataflow, ControlLink controlLink,
-			Component component, EditManager editManager,
-			SelectionManager selectionManager) {
-		super(dataflow, component, editManager, selectionManager);
-		this.controlLink = controlLink;
-		putValue(SMALL_ICON, deleteIcon);
-		putValue(NAME, "Delete control link");
-	}
-
-	@Override
-	public void actionPerformed(ActionEvent e) {
-		try {
-			dataflowSelectionModel.removeSelection(controlLink);
-			editManager.doDataflowEdit(dataflow.getParent(),
-					new RemoveChildEdit<>(dataflow, controlLink));
-		} catch (EditException e1) {
-			logger.debug("Delete control link failed", e1);
-		}
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-design-ui/src/main/java/net/sf/taverna/t2/workbench/design/actions/RemoveDataflowInputPortAction.java
----------------------------------------------------------------------
diff --git a/taverna-design-ui/src/main/java/net/sf/taverna/t2/workbench/design/actions/RemoveDataflowInputPortAction.java b/taverna-design-ui/src/main/java/net/sf/taverna/t2/workbench/design/actions/RemoveDataflowInputPortAction.java
deleted file mode 100644
index 707835a..0000000
--- a/taverna-design-ui/src/main/java/net/sf/taverna/t2/workbench/design/actions/RemoveDataflowInputPortAction.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*******************************************************************************
- * 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.design.actions;
-
-import static net.sf.taverna.t2.workbench.icons.WorkbenchIcons.deleteIcon;
-
-import java.awt.Component;
-import java.awt.event.ActionEvent;
-import java.util.ArrayList;
-import java.util.List;
-
-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.selection.SelectionManager;
-import net.sf.taverna.t2.workflow.edits.RemoveDataLinkEdit;
-import net.sf.taverna.t2.workflow.edits.RemoveWorkflowInputPortEdit;
-
-import org.apache.log4j.Logger;
-
-import org.apache.taverna.scufl2.api.core.DataLink;
-import org.apache.taverna.scufl2.api.core.Workflow;
-import org.apache.taverna.scufl2.api.port.InputWorkflowPort;
-
-/**
- * Action for removing an input port from the dataflow.
- * 
- * @author David Withers
- */
-@SuppressWarnings("serial")
-public class RemoveDataflowInputPortAction extends DataflowEditAction {
-	private static Logger logger = Logger
-			.getLogger(RemoveDataflowInputPortAction.class);
-
-	private InputWorkflowPort port;
-
-	public RemoveDataflowInputPortAction(Workflow dataflow,
-			InputWorkflowPort port, Component component,
-			EditManager editManager, SelectionManager selectionManager) {
-		super(dataflow, component, editManager, selectionManager);
-		this.port = port;
-		putValue(SMALL_ICON, deleteIcon);
-		putValue(NAME, "Delete workflow input port");
-	}
-
-	@Override
-	public void actionPerformed(ActionEvent e) {
-		try {
-			dataflowSelectionModel.removeSelection(port);
-			List<DataLink> datalinks = scufl2Tools.datalinksFrom(port);
-			if (datalinks.isEmpty())
-				editManager.doDataflowEdit(dataflow.getParent(),
-						new RemoveWorkflowInputPortEdit(dataflow, port));
-			else {
-				List<Edit<?>> editList = new ArrayList<>();
-				for (DataLink datalink : datalinks)
-					editList.add(new RemoveDataLinkEdit(dataflow, datalink));
-				editList.add(new RemoveWorkflowInputPortEdit(dataflow, port));
-				editManager.doDataflowEdit(dataflow.getParent(),
-						new CompoundEdit(editList));
-			}
-		} catch (EditException e1) {
-			logger.debug("Delete workflow input port failed", e1);
-		}
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-design-ui/src/main/java/net/sf/taverna/t2/workbench/design/actions/RemoveDataflowOutputPortAction.java
----------------------------------------------------------------------
diff --git a/taverna-design-ui/src/main/java/net/sf/taverna/t2/workbench/design/actions/RemoveDataflowOutputPortAction.java b/taverna-design-ui/src/main/java/net/sf/taverna/t2/workbench/design/actions/RemoveDataflowOutputPortAction.java
deleted file mode 100644
index 69d5559..0000000
--- a/taverna-design-ui/src/main/java/net/sf/taverna/t2/workbench/design/actions/RemoveDataflowOutputPortAction.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*******************************************************************************
- * 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.design.actions;
-
-import static net.sf.taverna.t2.workbench.icons.WorkbenchIcons.deleteIcon;
-
-import java.awt.Component;
-import java.awt.event.ActionEvent;
-import java.util.ArrayList;
-import java.util.List;
-
-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.selection.SelectionManager;
-import net.sf.taverna.t2.workflow.edits.RemoveDataLinkEdit;
-import net.sf.taverna.t2.workflow.edits.RemoveWorkflowOutputPortEdit;
-
-import org.apache.log4j.Logger;
-
-import org.apache.taverna.scufl2.api.core.DataLink;
-import org.apache.taverna.scufl2.api.core.Workflow;
-import org.apache.taverna.scufl2.api.port.OutputWorkflowPort;
-
-/**
- * Action for removing an output port from the dataflow.
- * 
- * @author David Withers
- */
-@SuppressWarnings("serial")
-public class RemoveDataflowOutputPortAction extends DataflowEditAction {
-	private static final Logger logger = Logger
-			.getLogger(RemoveDataflowOutputPortAction.class);
-
-	private OutputWorkflowPort port;
-
-	public RemoveDataflowOutputPortAction(Workflow dataflow,
-			OutputWorkflowPort port, Component component,
-			EditManager editManager, SelectionManager selectionManager) {
-		super(dataflow, component, editManager, selectionManager);
-		this.port = port;
-		putValue(SMALL_ICON, deleteIcon);
-		putValue(NAME, "Delete workflow output port");
-	}
-
-	@Override
-	public void actionPerformed(ActionEvent e) {
-		try {
-			dataflowSelectionModel.removeSelection(port);
-			List<DataLink> datalinks = scufl2Tools.datalinksTo(port);
-			if (datalinks.isEmpty())
-				editManager.doDataflowEdit(dataflow.getParent(),
-						new RemoveWorkflowOutputPortEdit(dataflow, port));
-			else {
-				List<Edit<?>> editList = new ArrayList<>();
-				for (DataLink datalink : datalinks)
-					editList.add(new RemoveDataLinkEdit(dataflow, datalink));
-				editList.add(new RemoveWorkflowOutputPortEdit(dataflow, port));
-				editManager.doDataflowEdit(dataflow.getParent(),
-						new CompoundEdit(editList));
-			}
-		} catch (EditException ex) {
-			logger.debug("Delete workflow output port failed", ex);
-		}
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-design-ui/src/main/java/net/sf/taverna/t2/workbench/design/actions/RemoveDatalinkAction.java
----------------------------------------------------------------------
diff --git a/taverna-design-ui/src/main/java/net/sf/taverna/t2/workbench/design/actions/RemoveDatalinkAction.java b/taverna-design-ui/src/main/java/net/sf/taverna/t2/workbench/design/actions/RemoveDatalinkAction.java
deleted file mode 100644
index 4e1a31f..0000000
--- a/taverna-design-ui/src/main/java/net/sf/taverna/t2/workbench/design/actions/RemoveDatalinkAction.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*******************************************************************************
- * 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.design.actions;
-
-import static net.sf.taverna.t2.workbench.icons.WorkbenchIcons.deleteIcon;
-
-import java.awt.Component;
-import java.awt.event.ActionEvent;
-
-import net.sf.taverna.t2.workbench.edits.EditException;
-import net.sf.taverna.t2.workbench.edits.EditManager;
-import net.sf.taverna.t2.workbench.selection.SelectionManager;
-import net.sf.taverna.t2.workflow.edits.RemoveDataLinkEdit;
-
-import org.apache.log4j.Logger;
-
-import org.apache.taverna.scufl2.api.core.DataLink;
-import org.apache.taverna.scufl2.api.core.Workflow;
-
-/**
- * Action for removing a datalink from the dataflow.
- * 
- * @author David Withers
- */
-@SuppressWarnings("serial")
-public class RemoveDatalinkAction extends DataflowEditAction {
-	private static final Logger logger = Logger.getLogger(RemoveDatalinkAction.class);
-
-	private DataLink datalink;
-
-	public RemoveDatalinkAction(Workflow dataflow, DataLink datalink,
-			Component component, EditManager editManager,
-			SelectionManager selectionManager) {
-		super(dataflow, component, editManager, selectionManager);
-		this.datalink = datalink;
-		putValue(SMALL_ICON, deleteIcon);
-		putValue(NAME, "Delete data link");
-	}
-
-	@Override
-	public void actionPerformed(ActionEvent ev) {
-		try {
-			dataflowSelectionModel.removeSelection(datalink);
-			editManager.doDataflowEdit(dataflow.getParent(),
-					new RemoveDataLinkEdit(dataflow, datalink));
-		} catch (EditException ex) {
-			logger.debug("Delete data link failed", ex);
-		}
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-design-ui/src/main/java/net/sf/taverna/t2/workbench/design/actions/RemoveProcessorAction.java
----------------------------------------------------------------------
diff --git a/taverna-design-ui/src/main/java/net/sf/taverna/t2/workbench/design/actions/RemoveProcessorAction.java b/taverna-design-ui/src/main/java/net/sf/taverna/t2/workbench/design/actions/RemoveProcessorAction.java
deleted file mode 100644
index 16e4eb7..0000000
--- a/taverna-design-ui/src/main/java/net/sf/taverna/t2/workbench/design/actions/RemoveProcessorAction.java
+++ /dev/null
@@ -1,136 +0,0 @@
-/*******************************************************************************
- * 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.design.actions;
-
-import static net.sf.taverna.t2.workbench.icons.WorkbenchIcons.deleteIcon;
-
-import java.awt.Component;
-import java.awt.event.ActionEvent;
-import java.util.ArrayList;
-import java.util.List;
-
-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.selection.SelectionManager;
-import net.sf.taverna.t2.workflow.edits.RemoveChildEdit;
-import net.sf.taverna.t2.workflow.edits.RemoveDataLinkEdit;
-
-import org.apache.log4j.Logger;
-
-import org.apache.taverna.scufl2.api.activity.Activity;
-import org.apache.taverna.scufl2.api.common.NamedSet;
-import org.apache.taverna.scufl2.api.configurations.Configuration;
-import org.apache.taverna.scufl2.api.core.BlockingControlLink;
-import org.apache.taverna.scufl2.api.core.ControlLink;
-import org.apache.taverna.scufl2.api.core.DataLink;
-import org.apache.taverna.scufl2.api.core.Processor;
-import org.apache.taverna.scufl2.api.core.Workflow;
-import org.apache.taverna.scufl2.api.port.InputProcessorPort;
-import org.apache.taverna.scufl2.api.port.OutputProcessorPort;
-import org.apache.taverna.scufl2.api.profiles.ProcessorBinding;
-import org.apache.taverna.scufl2.api.profiles.Profile;
-
-/**
- * Action for removing a processor from the dataflow.
- * 
- * @author David Withers
- */
-@SuppressWarnings("serial")
-public class RemoveProcessorAction extends DataflowEditAction {
-	private static final Logger logger = Logger
-			.getLogger(RemoveProcessorAction.class);
-
-	private Processor processor;
-
-	public RemoveProcessorAction(Workflow dataflow, Processor processor,
-			Component component, EditManager editManager,
-			SelectionManager selectionManager) {
-		super(dataflow, component, editManager, selectionManager);
-		this.processor = processor;
-		putValue(SMALL_ICON, deleteIcon);
-		putValue(NAME, "Delete service");
-	}
-
-	@Override
-	public void actionPerformed(ActionEvent e) {
-		try {
-			dataflowSelectionModel.removeSelection(processor);
-
-			NamedSet<InputProcessorPort> inputPorts = processor.getInputPorts();
-			NamedSet<OutputProcessorPort> outputPorts = processor
-					.getOutputPorts();
-			List<BlockingControlLink> controlLinksBlocking = scufl2Tools
-					.controlLinksBlocking(processor);
-			List<BlockingControlLink> controlLinksWaitingFor = scufl2Tools
-					.controlLinksWaitingFor(processor);
-			List<Edit<?>> editList = new ArrayList<>();
-			for (InputProcessorPort inputPort : inputPorts)
-				for (DataLink datalink : scufl2Tools.datalinksTo(inputPort))
-					editList.add(new RemoveDataLinkEdit(dataflow, datalink));
-			for (OutputProcessorPort outputPort : outputPorts)
-				for (DataLink datalink : scufl2Tools.datalinksFrom(outputPort))
-					editList.add(new RemoveDataLinkEdit(dataflow, datalink));
-			for (ControlLink controlLink : controlLinksBlocking)
-				editList.add(new RemoveChildEdit<>(dataflow, controlLink));
-			for (ControlLink controlLink : controlLinksWaitingFor)
-				editList.add(new RemoveChildEdit<>(dataflow, controlLink));
-
-			for (Profile profile : dataflow.getParent().getProfiles()) {
-				List<ProcessorBinding> processorBindings = scufl2Tools
-						.processorBindingsForProcessor(processor, profile);
-				for (ProcessorBinding processorBinding : processorBindings) {
-					Activity boundActivity = processorBinding
-							.getBoundActivity();
-					List<ProcessorBinding> processorBindingsToActivity = scufl2Tools
-							.processorBindingsToActivity(boundActivity);
-					if (processorBindingsToActivity.size() == 1) {
-						editList.add(new RemoveChildEdit<>(profile,
-								boundActivity));
-						for (Configuration configuration : scufl2Tools
-								.configurationsFor(boundActivity, profile))
-							editList.add(new RemoveChildEdit<Profile>(profile,
-									configuration));
-					}
-					editList.add(new RemoveChildEdit<Profile>(profile,
-							processorBinding));
-				}
-			}
-			for (Profile profile : dataflow.getParent().getProfiles()) {
-				List<Configuration> configurations = scufl2Tools
-						.configurationsFor(processor, profile);
-				for (Configuration configuration : configurations)
-					editList.add(new RemoveChildEdit<>(profile, configuration));
-			}
-			if (editList.isEmpty())
-				editManager.doDataflowEdit(dataflow.getParent(),
-						new RemoveChildEdit<>(dataflow, processor));
-			else {
-				editList.add(new RemoveChildEdit<>(dataflow, processor));
-				editManager.doDataflowEdit(dataflow.getParent(),
-						new CompoundEdit(editList));
-			}
-		} catch (EditException e1) {
-			logger.error("Delete processor failed", e1);
-		}
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-design-ui/src/main/java/net/sf/taverna/t2/workbench/design/actions/RenameProcessorAction.java
----------------------------------------------------------------------
diff --git a/taverna-design-ui/src/main/java/net/sf/taverna/t2/workbench/design/actions/RenameProcessorAction.java b/taverna-design-ui/src/main/java/net/sf/taverna/t2/workbench/design/actions/RenameProcessorAction.java
deleted file mode 100644
index a291762..0000000
--- a/taverna-design-ui/src/main/java/net/sf/taverna/t2/workbench/design/actions/RenameProcessorAction.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*******************************************************************************
- * 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.design.actions;
-
-import java.awt.Component;
-import java.awt.Dimension;
-import java.awt.event.ActionEvent;
-import java.util.HashSet;
-import java.util.Set;
-
-import net.sf.taverna.t2.lang.ui.ValidatingUserInputDialog;
-import net.sf.taverna.t2.workbench.design.ui.ProcessorPanel;
-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.RenameEdit;
-
-import org.apache.log4j.Logger;
-
-import org.apache.taverna.scufl2.api.core.Processor;
-import org.apache.taverna.scufl2.api.core.Workflow;
-
-/**
- * Action for renaming a processor.
- * 
- * @author David Withers
- */
-public class RenameProcessorAction extends DataflowEditAction {
-
-	private static final long serialVersionUID = 1L;
-
-	private static Logger logger = Logger
-			.getLogger(RenameProcessorAction.class);
-
-	private Processor processor;
-
-	public RenameProcessorAction(Workflow dataflow, Processor processor,
-			Component component, EditManager editManager,
-			SelectionManager selectionManager) {
-		super(dataflow, component, editManager, selectionManager);
-		this.processor = processor;
-		putValue(SMALL_ICON, WorkbenchIcons.renameIcon);
-		putValue(NAME, "Rename service...");
-	}
-
-	@Override
-	public void actionPerformed(ActionEvent e) {
-		Set<String> usedProcessors = new HashSet<>();
-		for (Processor usedProcessor : dataflow.getProcessors())
-			if (!usedProcessor.getName().equals(processor.getName()))
-				usedProcessors.add(usedProcessor.getName());
-
-		ProcessorPanel inputPanel = new ProcessorPanel();
-
-		ValidatingUserInputDialog vuid = new ValidatingUserInputDialog(
-				"Rename service", inputPanel);
-		vuid.addTextComponentValidation(inputPanel.getProcessorNameField(),
-				"Set the service name.", usedProcessors, "Duplicate service.",
-				"[\\p{L}\\p{Digit}_.]+", "Invalid service name.");
-		vuid.setSize(new Dimension(400, 200));
-
-		inputPanel.setProcessorName(processor.getName());
-
-		try {
-			if (vuid.show(component))
-				changeProcessorName(inputPanel);
-		} catch (EditException e1) {
-			logger.debug("Rename service (processor) failed", e1);
-		}
-	}
-
-	private void changeProcessorName(ProcessorPanel inputPanel)
-			throws EditException {
-		String processorName = inputPanel.getProcessorName();
-		editManager.doDataflowEdit(dataflow.getParent(), new RenameEdit<>(
-				processor, processorName));
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-design-ui/src/main/java/net/sf/taverna/t2/workbench/design/ui/DataflowInputPortPanel.java
----------------------------------------------------------------------
diff --git a/taverna-design-ui/src/main/java/net/sf/taverna/t2/workbench/design/ui/DataflowInputPortPanel.java b/taverna-design-ui/src/main/java/net/sf/taverna/t2/workbench/design/ui/DataflowInputPortPanel.java
deleted file mode 100644
index e578ef2..0000000
--- a/taverna-design-ui/src/main/java/net/sf/taverna/t2/workbench/design/ui/DataflowInputPortPanel.java
+++ /dev/null
@@ -1,203 +0,0 @@
-/*******************************************************************************
- * 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.design.ui;
-
-import static java.awt.GridBagConstraints.HORIZONTAL;
-import static java.awt.GridBagConstraints.NONE;
-import static java.awt.GridBagConstraints.NORTHWEST;
-import static java.awt.GridBagConstraints.WEST;
-import static java.awt.event.ItemEvent.SELECTED;
-
-import java.awt.GridBagConstraints;
-import java.awt.GridBagLayout;
-import java.awt.Insets;
-import java.awt.event.ItemEvent;
-import java.awt.event.ItemListener;
-
-import javax.swing.ButtonGroup;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JRadioButton;
-import javax.swing.JSpinner;
-import javax.swing.JTextField;
-import javax.swing.SpinnerNumberModel;
-import javax.swing.border.EmptyBorder;
-
-/**
- * UI for creating/editing dataflow input ports.
- * 
- * @author David Withers
- */
-public class DataflowInputPortPanel extends JPanel {
-	private static final long serialVersionUID = 2650486705615513458L;
-
-	private JTextField portNameField;
-	private JRadioButton singleValueButton;
-	private JRadioButton listValueButton;
-	private JSpinner listDepthSpinner;
-
-	public DataflowInputPortPanel() {
-		super(new GridBagLayout());
-
-		portNameField = new JTextField();
-		singleValueButton = new JRadioButton("Single value");
-		listValueButton = new JRadioButton("List of depth ");
-		listDepthSpinner = new JSpinner(new SpinnerNumberModel(1, 1, 100, 1));
-
-		setBorder(new EmptyBorder(10, 10, 10, 10));
-
-		GridBagConstraints constraints = new GridBagConstraints();
-
-		constraints.anchor = WEST;
-		constraints.gridx = 0;
-		constraints.gridy = 0;
-		constraints.ipadx = 10;
-		add(new JLabel("Name:"), constraints);
-
-		constraints.gridx = 1;
-		constraints.gridwidth = 2;
-		constraints.ipadx = 0;
-		constraints.weightx = 1d;
-		constraints.fill = HORIZONTAL;
-		add(portNameField, constraints);
-
-		constraints.gridx = 0;
-		constraints.gridy = 1;
-		constraints.gridwidth = 1;
-		constraints.weightx = 0d;
-		constraints.fill = NONE;
-		constraints.ipadx = 10;
-		constraints.insets = new Insets(10, 0, 0, 0);
-		add(new JLabel("Type:"), constraints);
-
-		ButtonGroup buttonGroup = new ButtonGroup();
-		buttonGroup.add(singleValueButton);
-		buttonGroup.add(listValueButton);
-
-		final JLabel helpLabel = new JLabel(
-				"Depth 1 is a list, 2 is a list of lists, etc.");
-		helpLabel.setFont(helpLabel.getFont().deriveFont(11f));
-
-		singleValueButton.addItemListener(new ItemListener() {
-			@Override
-			public void itemStateChanged(ItemEvent e) {
-				boolean selected = (e.getStateChange() == SELECTED);
-				listDepthSpinner.setEnabled(!selected);
-				helpLabel.setEnabled(!selected);
-			}
-		});
-
-		constraints.gridx = 1;
-		constraints.gridwidth = 2;
-		constraints.ipadx = 0;
-		add(singleValueButton, constraints);
-		constraints.gridy = 2;
-		constraints.gridwidth = 1;
-		constraints.insets = new Insets(0, 0, 0, 0);
-		add(listValueButton, constraints);
-		constraints.gridx = 2;
-		add(listDepthSpinner, constraints);
-		constraints.gridx = 1;
-		constraints.gridy = 3;
-		constraints.gridwidth = 2;
-		constraints.weighty = 1d;
-		constraints.anchor = NORTHWEST;
-		constraints.insets = new Insets(0, 20, 0, 0);
-		add(helpLabel, constraints);
-	}
-
-	/**
-	 * Returns the portNameField.
-	 * 
-	 * @return the portNameField
-	 */
-	public JTextField getPortNameField() {
-		return portNameField;
-	}
-
-	/**
-	 * Returns the singleValueButton.
-	 * 
-	 * @return the singleValueButton
-	 */
-	public JRadioButton getSingleValueButton() {
-		return singleValueButton;
-	}
-
-	/**
-	 * Returns the listValueButton.
-	 * 
-	 * @return the listValueButton
-	 */
-	public JRadioButton getListValueButton() {
-		return listValueButton;
-	}
-
-	/**
-	 * Returns the port name.
-	 * 
-	 * @return the port name
-	 */
-	public String getPortName() {
-		return portNameField.getText();
-	}
-
-	/**
-	 * Sets the port name.
-	 * 
-	 * @param name
-	 *            the name of the port
-	 */
-	public void setPortName(String name) {
-		portNameField.setText(name);
-		// Select the text
-		if (!name.isEmpty()) {
-			portNameField.setSelectionStart(0);
-			portNameField.setSelectionEnd(name.length());
-		}
-	}
-
-	/**
-	 * Returns the port depth.
-	 * 
-	 * @return the port depth
-	 */
-	public int getPortDepth() {
-		if (singleValueButton.isSelected())
-			return 0;
-		return (Integer) listDepthSpinner.getValue();
-	}
-
-	/**
-	 * Sets the port depth.
-	 * 
-	 * @param depth
-	 *            the depth of the port
-	 */
-	public void setPortDepth(int depth) {
-		if (depth == 0) {
-			singleValueButton.setSelected(true);
-		} else {
-			listValueButton.setSelected(true);
-			listDepthSpinner.setValue(depth);
-		}
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-design-ui/src/main/java/net/sf/taverna/t2/workbench/design/ui/DataflowOutputPortPanel.java
----------------------------------------------------------------------
diff --git a/taverna-design-ui/src/main/java/net/sf/taverna/t2/workbench/design/ui/DataflowOutputPortPanel.java b/taverna-design-ui/src/main/java/net/sf/taverna/t2/workbench/design/ui/DataflowOutputPortPanel.java
deleted file mode 100644
index 59ac0f7..0000000
--- a/taverna-design-ui/src/main/java/net/sf/taverna/t2/workbench/design/ui/DataflowOutputPortPanel.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*******************************************************************************
- * 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.design.ui;
-
-import static java.awt.GridBagConstraints.HORIZONTAL;
-import static java.awt.GridBagConstraints.VERTICAL;
-import static java.awt.GridBagConstraints.WEST;
-
-import java.awt.GridBagConstraints;
-import java.awt.GridBagLayout;
-
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JTextField;
-import javax.swing.border.EmptyBorder;
-
-/**
- * UI for creating/editing dataflow output ports.
- * 
- * @author David Withers
- */
-public class DataflowOutputPortPanel extends JPanel {
-	private static final long serialVersionUID = -2542858679939965553L;
-
-	private JTextField portNameField;
-
-	public DataflowOutputPortPanel() {
-		super(new GridBagLayout());
-
-		portNameField = new JTextField();
- 
-		setBorder(new EmptyBorder(10, 10, 10, 10));
-		
-		GridBagConstraints constraints = new GridBagConstraints();
-
-		constraints.anchor = WEST;
-		constraints.gridx = 0;
-		constraints.gridy = 0;
-		constraints.ipadx = 10;
-		add(new JLabel("Name:"), constraints);
-
-		constraints.gridx = 1;
-		constraints.gridwidth = 2;
-		constraints.ipadx = 0;
-		constraints.weightx = 1d;
-		constraints.fill = HORIZONTAL;
-		add(portNameField, constraints);
-
-		constraints.gridx = 0;
-		constraints.gridy = 1;
-		constraints.fill = VERTICAL;
-		constraints.weighty = 1d;
-		add(new JPanel(), constraints);
-	}
-	
-	/**
-	 * Returns the portNameField.
-	 *
-	 * @return the portNameField
-	 */
-	public JTextField getPortNameField() {
-		return portNameField;
-	}
-
-	/**
-	 * Returns the port name.
-	 *
-	 * @return the port name
-	 */
-	public String getPortName() {
-		return portNameField.getText();
-	}
-	
-	/**
-	 * Sets the port name.
-	 *
-	 * @param name the name of the port
-	 */
-	public void setPortName(String name) {
-		portNameField.setText(name);
-		// Select the text
-		if (!name.isEmpty()) {
-			portNameField.setSelectionStart(0);
-			portNameField.setSelectionEnd(name.length());
-		}
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-design-ui/src/main/java/net/sf/taverna/t2/workbench/design/ui/ProcessorPanel.java
----------------------------------------------------------------------
diff --git a/taverna-design-ui/src/main/java/net/sf/taverna/t2/workbench/design/ui/ProcessorPanel.java b/taverna-design-ui/src/main/java/net/sf/taverna/t2/workbench/design/ui/ProcessorPanel.java
deleted file mode 100644
index 4528727..0000000
--- a/taverna-design-ui/src/main/java/net/sf/taverna/t2/workbench/design/ui/ProcessorPanel.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*******************************************************************************
- * 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.design.ui;
-
-import static java.awt.GridBagConstraints.HORIZONTAL;
-import static java.awt.GridBagConstraints.VERTICAL;
-import static java.awt.GridBagConstraints.WEST;
-
-import java.awt.GridBagConstraints;
-import java.awt.GridBagLayout;
-
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JTextField;
-import javax.swing.border.EmptyBorder;
-
-/**
- * UI for editing processors.
- * 
- * @author David Withers
- */
-public class ProcessorPanel extends JPanel {
-	private static final long serialVersionUID = 260705376633425003L;
-
-	private JTextField processorNameField;
-
-	public ProcessorPanel() {
-		super(new GridBagLayout());
-
-		processorNameField = new JTextField();
-
-		setBorder(new EmptyBorder(10, 10, 10, 10));
-
-		GridBagConstraints constraints = new GridBagConstraints();
-
-		constraints.anchor = WEST;
-		constraints.gridx = 0;
-		constraints.gridy = 0;
-		constraints.ipadx = 10;
-		add(new JLabel("Name:"), constraints);
-
-		constraints.gridx = 1;
-		constraints.gridwidth = 2;
-		constraints.ipadx = 0;
-		constraints.weightx = 1d;
-		constraints.fill = HORIZONTAL;
-		add(processorNameField, constraints);
-
-		constraints.gridx = 0;
-		constraints.gridy = 1;
-		constraints.fill = VERTICAL;
-		constraints.weighty = 1d;
-		add(new JPanel(), constraints);
-	}
-
-	/**
-	 * Returns the processorNameField.
-	 * 
-	 * @return the processorNameField
-	 */
-	public JTextField getProcessorNameField() {
-		return processorNameField;
-	}
-
-	/**
-	 * Returns the processor name.
-	 * 
-	 * @return the processor name
-	 */
-	public String getProcessorName() {
-		return processorNameField.getText();
-	}
-
-	/**
-	 * Sets the processor name.
-	 * 
-	 * @param name
-	 *            the name of the processor
-	 */
-	public void setProcessorName(String name) {
-		processorNameField.setText(name);
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-design-ui/src/main/java/org/apache/taverna/workbench/design/actions/AddConditionAction.java
----------------------------------------------------------------------
diff --git a/taverna-design-ui/src/main/java/org/apache/taverna/workbench/design/actions/AddConditionAction.java b/taverna-design-ui/src/main/java/org/apache/taverna/workbench/design/actions/AddConditionAction.java
new file mode 100644
index 0000000..a5b0966
--- /dev/null
+++ b/taverna-design-ui/src/main/java/org/apache/taverna/workbench/design/actions/AddConditionAction.java
@@ -0,0 +1,81 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.design.actions;
+
+import java.awt.Component;
+import java.awt.event.ActionEvent;
+
+import org.apache.taverna.workbench.activityicons.ActivityIconManager;
+import org.apache.taverna.workbench.edits.EditException;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.selection.SelectionManager;
+import org.apache.taverna.workflow.edits.AddChildEdit;
+
+import org.apache.log4j.Logger;
+
+import org.apache.taverna.scufl2.api.common.Scufl2Tools;
+import org.apache.taverna.scufl2.api.core.BlockingControlLink;
+import org.apache.taverna.scufl2.api.core.Processor;
+import org.apache.taverna.scufl2.api.core.Workflow;
+import org.apache.taverna.scufl2.api.profiles.ProcessorBinding;
+
+/**
+ * Action for adding a condition to the dataflow.
+ * 
+ * @author David Withers
+ */
+@SuppressWarnings("serial")
+public class AddConditionAction extends DataflowEditAction {
+	private static final Logger logger = Logger.getLogger(AddConditionAction.class);
+	private static final Scufl2Tools scufl2Tools = new Scufl2Tools();
+
+	private Processor control;
+	private Processor target;
+
+	public AddConditionAction(Workflow dataflow, Processor control,
+			Processor target, Component component, EditManager editManager,
+			SelectionManager selectionManager,
+			ActivityIconManager activityIconManager) {
+		super(dataflow, component, editManager, selectionManager);
+		this.control = control;
+		this.target = target;
+		ProcessorBinding processorBinding = scufl2Tools
+				.processorBindingForProcessor(control, dataflow.getParent()
+						.getMainProfile());
+		putValue(SMALL_ICON,
+				activityIconManager.iconForActivity(processorBinding
+						.getBoundActivity().getType()));
+		putValue(NAME, control.getName());
+	}
+
+	@Override
+	public void actionPerformed(ActionEvent event) {
+		try {
+			BlockingControlLink controlLink = new BlockingControlLink();
+			controlLink.setUntilFinished(control);
+			controlLink.setBlock(target);
+			editManager.doDataflowEdit(dataflow.getParent(),
+					new AddChildEdit<>(dataflow, controlLink));
+		} catch (EditException e) {
+			logger.debug("Create control link between '" + control.getName()
+					+ "' and '" + target.getName() + "' failed");
+		}
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-design-ui/src/main/java/org/apache/taverna/workbench/design/actions/AddDataflowInputAction.java
----------------------------------------------------------------------
diff --git a/taverna-design-ui/src/main/java/org/apache/taverna/workbench/design/actions/AddDataflowInputAction.java b/taverna-design-ui/src/main/java/org/apache/taverna/workbench/design/actions/AddDataflowInputAction.java
new file mode 100644
index 0000000..23428ce
--- /dev/null
+++ b/taverna-design-ui/src/main/java/org/apache/taverna/workbench/design/actions/AddDataflowInputAction.java
@@ -0,0 +1,95 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.design.actions;
+
+import java.awt.Component;
+import java.awt.Dimension;
+import java.awt.event.ActionEvent;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.apache.taverna.lang.ui.ValidatingUserInputDialog;
+import org.apache.taverna.workbench.design.ui.DataflowInputPortPanel;
+import org.apache.taverna.workbench.edits.EditException;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.icons.WorkbenchIcons;
+import org.apache.taverna.workbench.selection.SelectionManager;
+import org.apache.taverna.workflow.edits.AddWorkflowInputPortEdit;
+
+import org.apache.log4j.Logger;
+
+import org.apache.taverna.scufl2.api.core.Workflow;
+import org.apache.taverna.scufl2.api.port.InputWorkflowPort;
+
+/**
+ * Action for adding an input port to the dataflow.
+ * 
+ * @author David Withers
+ */
+@SuppressWarnings("serial")
+public class AddDataflowInputAction extends DataflowEditAction {
+	private static final Logger logger = Logger
+			.getLogger(AddDataflowInputAction.class);
+
+	public AddDataflowInputAction(Workflow dataflow, Component component,
+			EditManager editManager, SelectionManager selectionManager) {
+		super(dataflow, component, editManager, selectionManager);
+		putValue(SMALL_ICON, WorkbenchIcons.inputIcon);
+		putValue(NAME, "Workflow input port");
+		putValue(SHORT_DESCRIPTION, "Add workflow input port");
+	}
+
+	@Override
+	public void actionPerformed(ActionEvent event) {
+		try {
+			Set<String> usedInputPorts = new HashSet<>();
+			for (InputWorkflowPort inputPort : dataflow.getInputPorts())
+				usedInputPorts.add(inputPort.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.",
+					"[\\p{L}\\p{Digit}_.]+",
+					"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(new Dimension(400, 250));
+
+			inputPanel.setPortDepth(0);
+
+			if (vuid.show(component)) {
+				InputWorkflowPort dataflowInputPort = new InputWorkflowPort();
+				dataflowInputPort.setName(inputPanel.getPortName());
+				dataflowInputPort.setDepth(inputPanel.getPortDepth());
+				editManager.doDataflowEdit(dataflow.getParent(),
+						new AddWorkflowInputPortEdit(dataflow,
+								dataflowInputPort));
+			}
+		} catch (EditException e) {
+			logger.warn("Adding a new workflow input port failed");
+		}
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-design-ui/src/main/java/org/apache/taverna/workbench/design/actions/AddDataflowOutputAction.java
----------------------------------------------------------------------
diff --git a/taverna-design-ui/src/main/java/org/apache/taverna/workbench/design/actions/AddDataflowOutputAction.java b/taverna-design-ui/src/main/java/org/apache/taverna/workbench/design/actions/AddDataflowOutputAction.java
new file mode 100644
index 0000000..27f241d
--- /dev/null
+++ b/taverna-design-ui/src/main/java/org/apache/taverna/workbench/design/actions/AddDataflowOutputAction.java
@@ -0,0 +1,89 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.design.actions;
+
+import java.awt.Component;
+import java.awt.Dimension;
+import java.awt.event.ActionEvent;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.apache.taverna.lang.ui.ValidatingUserInputDialog;
+import org.apache.taverna.workbench.design.ui.DataflowOutputPortPanel;
+import org.apache.taverna.workbench.edits.EditException;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.icons.WorkbenchIcons;
+import org.apache.taverna.workbench.selection.SelectionManager;
+import org.apache.taverna.workflow.edits.AddWorkflowOutputPortEdit;
+
+import org.apache.log4j.Logger;
+
+import org.apache.taverna.scufl2.api.core.Workflow;
+import org.apache.taverna.scufl2.api.port.OutputWorkflowPort;
+
+/**
+ * Action for adding an output port to the dataflow.
+ * 
+ * @author David Withers
+ */
+@SuppressWarnings("serial")
+public class AddDataflowOutputAction extends DataflowEditAction {
+	private static final Logger logger = Logger
+			.getLogger(AddDataflowOutputAction.class);
+
+	public AddDataflowOutputAction(Workflow dataflow, Component component,
+			EditManager editManager, SelectionManager selectionManager) {
+		super(dataflow, component, editManager, selectionManager);
+		putValue(SMALL_ICON, WorkbenchIcons.outputIcon);
+		putValue(NAME, "Workflow output port");
+		putValue(SHORT_DESCRIPTION, "Add workflow output port");
+	}
+
+	@Override
+	public void actionPerformed(ActionEvent event) {
+		try {
+			Set<String> usedOutputPorts = new HashSet<>();
+			for (OutputWorkflowPort outputPort : dataflow.getOutputPorts())
+				usedOutputPorts.add(outputPort.getName());
+
+			DataflowOutputPortPanel inputPanel = new DataflowOutputPortPanel();
+
+			ValidatingUserInputDialog vuid = new ValidatingUserInputDialog(
+					"Add Workflow Output Port", inputPanel);
+			vuid.addTextComponentValidation(inputPanel.getPortNameField(),
+					"Set the workflow output port name.", usedOutputPorts,
+					"Duplicate workflow output port name.",
+					"[\\p{L}\\p{Digit}_.]+",
+					"Invalid workflow output port name.");
+			vuid.setSize(new Dimension(400, 200));
+
+			if (vuid.show(component)) {
+				String portName = inputPanel.getPortName();
+				OutputWorkflowPort dataflowOutputPort = new OutputWorkflowPort();
+				dataflowOutputPort.setName(portName);
+				editManager.doDataflowEdit(dataflow.getParent(),
+						new AddWorkflowOutputPortEdit(dataflow,
+								dataflowOutputPort));
+			}
+		} catch (EditException e) {
+			logger.debug("Create workflow output port failed", e);
+		}
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-design-ui/src/main/java/org/apache/taverna/workbench/design/actions/DataflowEditAction.java
----------------------------------------------------------------------
diff --git a/taverna-design-ui/src/main/java/org/apache/taverna/workbench/design/actions/DataflowEditAction.java b/taverna-design-ui/src/main/java/org/apache/taverna/workbench/design/actions/DataflowEditAction.java
new file mode 100644
index 0000000..337dada
--- /dev/null
+++ b/taverna-design-ui/src/main/java/org/apache/taverna/workbench/design/actions/DataflowEditAction.java
@@ -0,0 +1,56 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.design.actions;
+
+import java.awt.Component;
+
+import javax.swing.AbstractAction;
+
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.selection.DataflowSelectionModel;
+import org.apache.taverna.workbench.selection.SelectionManager;
+import org.apache.taverna.scufl2.api.common.Scufl2Tools;
+import org.apache.taverna.scufl2.api.core.Workflow;
+
+/**
+ * Abstract superclass of dataflow edit actions.
+ * 
+ * @author David Withers
+ */
+public abstract class DataflowEditAction extends AbstractAction {
+	private static final long serialVersionUID = -1155192575675025091L;
+
+	protected final SelectionManager selectionManager;
+	protected EditManager editManager;
+	protected DataflowSelectionModel dataflowSelectionModel;
+	protected Workflow dataflow;
+	protected Component component;
+	protected Scufl2Tools scufl2Tools = new Scufl2Tools();
+
+	public DataflowEditAction(Workflow dataflow, Component component,
+			EditManager editManager, SelectionManager selectionManager) {
+		this.dataflow = dataflow;
+		this.component = component;
+		this.editManager = editManager;
+		this.selectionManager = selectionManager;
+		dataflowSelectionModel = selectionManager
+				.getDataflowSelectionModel(dataflow.getParent());
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-design-ui/src/main/java/org/apache/taverna/workbench/design/actions/EditDataflowInputPortAction.java
----------------------------------------------------------------------
diff --git a/taverna-design-ui/src/main/java/org/apache/taverna/workbench/design/actions/EditDataflowInputPortAction.java b/taverna-design-ui/src/main/java/org/apache/taverna/workbench/design/actions/EditDataflowInputPortAction.java
new file mode 100644
index 0000000..df8df77
--- /dev/null
+++ b/taverna-design-ui/src/main/java/org/apache/taverna/workbench/design/actions/EditDataflowInputPortAction.java
@@ -0,0 +1,114 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.design.actions;
+
+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 org.apache.taverna.lang.ui.ValidatingUserInputDialog;
+import org.apache.taverna.workbench.design.ui.DataflowInputPortPanel;
+import org.apache.taverna.workbench.edits.CompoundEdit;
+import org.apache.taverna.workbench.edits.Edit;
+import org.apache.taverna.workbench.edits.EditException;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.icons.WorkbenchIcons;
+import org.apache.taverna.workbench.selection.SelectionManager;
+import org.apache.taverna.workflow.edits.ChangeDepthEdit;
+import org.apache.taverna.workflow.edits.RenameEdit;
+
+import org.apache.log4j.Logger;
+
+import org.apache.taverna.scufl2.api.core.Workflow;
+import org.apache.taverna.scufl2.api.port.InputWorkflowPort;
+
+/**
+ * Action for editing a dataflow input port.
+ * 
+ * @author David Withers
+ */
+@SuppressWarnings("serial")
+public class EditDataflowInputPortAction extends DataflowEditAction {
+	private static Logger logger = Logger
+			.getLogger(EditDataflowInputPortAction.class);
+
+	private InputWorkflowPort port;
+
+	public EditDataflowInputPortAction(Workflow dataflow,
+			InputWorkflowPort port, Component component,
+			EditManager editManager, SelectionManager selectionManager) {
+		super(dataflow, component, editManager, selectionManager);
+		this.port = port;
+		putValue(SMALL_ICON, WorkbenchIcons.renameIcon);
+		putValue(NAME, "Edit workflow input port...");
+	}
+
+	@Override
+	public void actionPerformed(ActionEvent e) {
+		Set<String> usedInputPorts = new HashSet<>();
+		for (InputWorkflowPort usedInputPort : dataflow.getInputPorts())
+			if (!usedInputPort.getName().equals(port.getName()))
+				usedInputPorts.add(usedInputPort.getName());
+
+		DataflowInputPortPanel inputPanel = new DataflowInputPortPanel();
+
+		ValidatingUserInputDialog vuid = new ValidatingUserInputDialog(
+				"Edit Workflow Input Port", inputPanel);
+		vuid.addTextComponentValidation(inputPanel.getPortNameField(),
+				"Set the workflow input port name.", usedInputPorts,
+				"Duplicate workflow input port name.", "[\\p{L}\\p{Digit}_.]+",
+				"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(new Dimension(400, 250));
+
+		inputPanel.setPortName(port.getName());
+		inputPanel.setPortDepth(port.getDepth());
+
+		try {
+			if (vuid.show(component))
+				changeInputPort(inputPanel);
+		} catch (EditException e1) {
+			logger.warn("Rename workflow input port failed", e1);
+		}
+	}
+
+	private void changeInputPort(DataflowInputPortPanel inputPanel)
+			throws EditException {
+		List<Edit<?>> editList = new ArrayList<>();
+		String portName = inputPanel.getPortName();
+		if (!portName.equals(port.getName()))
+			editList.add(new RenameEdit<>(port, portName));
+		int portDepth = inputPanel.getPortDepth();
+		if (portDepth != port.getDepth())
+			editList.add(new ChangeDepthEdit<>(port, portDepth));
+		if (editList.size() == 1)
+			editManager.doDataflowEdit(dataflow.getParent(), editList.get(0));
+		else if (editList.size() > 1)
+			editManager.doDataflowEdit(dataflow.getParent(), new CompoundEdit(
+					editList));
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-design-ui/src/main/java/org/apache/taverna/workbench/design/actions/EditDataflowOutputPortAction.java
----------------------------------------------------------------------
diff --git a/taverna-design-ui/src/main/java/org/apache/taverna/workbench/design/actions/EditDataflowOutputPortAction.java b/taverna-design-ui/src/main/java/org/apache/taverna/workbench/design/actions/EditDataflowOutputPortAction.java
new file mode 100644
index 0000000..8dd5388
--- /dev/null
+++ b/taverna-design-ui/src/main/java/org/apache/taverna/workbench/design/actions/EditDataflowOutputPortAction.java
@@ -0,0 +1,94 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.design.actions;
+
+import java.awt.Component;
+import java.awt.Dimension;
+import java.awt.event.ActionEvent;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.apache.taverna.lang.ui.ValidatingUserInputDialog;
+import org.apache.taverna.workbench.design.ui.DataflowOutputPortPanel;
+import org.apache.taverna.workbench.edits.EditException;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.icons.WorkbenchIcons;
+import org.apache.taverna.workbench.selection.SelectionManager;
+import org.apache.taverna.workflow.edits.RenameEdit;
+
+import org.apache.log4j.Logger;
+
+import org.apache.taverna.scufl2.api.core.Workflow;
+import org.apache.taverna.scufl2.api.port.OutputWorkflowPort;
+
+/**
+ * Action for editing a dataflow output port.
+ * 
+ * @author David Withers
+ */
+@SuppressWarnings("serial")
+public class EditDataflowOutputPortAction extends DataflowEditAction {
+	private static final Logger logger = Logger
+			.getLogger(EditDataflowOutputPortAction.class);
+
+	private OutputWorkflowPort port;
+
+	public EditDataflowOutputPortAction(Workflow dataflow,
+			OutputWorkflowPort port, Component component,
+			EditManager editManager, SelectionManager selectionManager) {
+		super(dataflow, component, editManager, selectionManager);
+		this.port = port;
+		putValue(SMALL_ICON, WorkbenchIcons.renameIcon);
+		putValue(NAME, "Edit workflow output port...");
+	}
+
+	@Override
+	public void actionPerformed(ActionEvent e) {
+		Set<String> usedOutputPorts = new HashSet<>();
+		for (OutputWorkflowPort usedOutputPort : dataflow.getOutputPorts())
+			if (!usedOutputPort.getName().equals(port.getName()))
+				usedOutputPorts.add(usedOutputPort.getName());
+
+		DataflowOutputPortPanel inputPanel = new DataflowOutputPortPanel();
+
+		ValidatingUserInputDialog vuid = new ValidatingUserInputDialog(
+				"Edit Workflow Output Port", inputPanel);
+		vuid.addTextComponentValidation(inputPanel.getPortNameField(),
+				"Set the workflow output port name.", usedOutputPorts,
+				"Duplicate workflow output port name.",
+				"[\\p{L}\\p{Digit}_.]+", "Invalid workflow output port name.");
+		vuid.setSize(new Dimension(400, 200));
+
+		inputPanel.setPortName(port.getName());
+
+		try {
+			if (vuid.show(component))
+				changeOutputPort(inputPanel);
+		} catch (EditException ex) {
+			logger.debug("Rename workflow output port failed", ex);
+		}
+	}
+
+	private void changeOutputPort(DataflowOutputPortPanel inputPanel)
+			throws EditException {
+		editManager.doDataflowEdit(dataflow.getParent(), new RenameEdit<>(port,
+				inputPanel.getPortName()));
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-design-ui/src/main/java/org/apache/taverna/workbench/design/actions/RemoveConditionAction.java
----------------------------------------------------------------------
diff --git a/taverna-design-ui/src/main/java/org/apache/taverna/workbench/design/actions/RemoveConditionAction.java b/taverna-design-ui/src/main/java/org/apache/taverna/workbench/design/actions/RemoveConditionAction.java
new file mode 100644
index 0000000..5c19dc5
--- /dev/null
+++ b/taverna-design-ui/src/main/java/org/apache/taverna/workbench/design/actions/RemoveConditionAction.java
@@ -0,0 +1,68 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.design.actions;
+
+import static org.apache.taverna.workbench.icons.WorkbenchIcons.deleteIcon;
+
+import java.awt.Component;
+import java.awt.event.ActionEvent;
+
+import org.apache.taverna.workbench.edits.EditException;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.selection.SelectionManager;
+import org.apache.taverna.workflow.edits.RemoveChildEdit;
+
+import org.apache.log4j.Logger;
+
+import org.apache.taverna.scufl2.api.core.ControlLink;
+import org.apache.taverna.scufl2.api.core.Workflow;
+
+/**
+ * Action for removing a condition from the dataflow.
+ * 
+ * @author David Withers
+ */
+@SuppressWarnings("serial")
+public class RemoveConditionAction extends DataflowEditAction {
+	private static final Logger logger = Logger
+			.getLogger(RemoveConditionAction.class);
+
+	private ControlLink controlLink;
+
+	public RemoveConditionAction(Workflow dataflow, ControlLink controlLink,
+			Component component, EditManager editManager,
+			SelectionManager selectionManager) {
+		super(dataflow, component, editManager, selectionManager);
+		this.controlLink = controlLink;
+		putValue(SMALL_ICON, deleteIcon);
+		putValue(NAME, "Delete control link");
+	}
+
+	@Override
+	public void actionPerformed(ActionEvent e) {
+		try {
+			dataflowSelectionModel.removeSelection(controlLink);
+			editManager.doDataflowEdit(dataflow.getParent(),
+					new RemoveChildEdit<>(dataflow, controlLink));
+		} catch (EditException e1) {
+			logger.debug("Delete control link failed", e1);
+		}
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-design-ui/src/main/java/org/apache/taverna/workbench/design/actions/RemoveDataflowInputPortAction.java
----------------------------------------------------------------------
diff --git a/taverna-design-ui/src/main/java/org/apache/taverna/workbench/design/actions/RemoveDataflowInputPortAction.java b/taverna-design-ui/src/main/java/org/apache/taverna/workbench/design/actions/RemoveDataflowInputPortAction.java
new file mode 100644
index 0000000..e71a0d9
--- /dev/null
+++ b/taverna-design-ui/src/main/java/org/apache/taverna/workbench/design/actions/RemoveDataflowInputPortAction.java
@@ -0,0 +1,84 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.design.actions;
+
+import static org.apache.taverna.workbench.icons.WorkbenchIcons.deleteIcon;
+
+import java.awt.Component;
+import java.awt.event.ActionEvent;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.taverna.workbench.edits.CompoundEdit;
+import org.apache.taverna.workbench.edits.Edit;
+import org.apache.taverna.workbench.edits.EditException;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.selection.SelectionManager;
+import org.apache.taverna.workflow.edits.RemoveDataLinkEdit;
+import org.apache.taverna.workflow.edits.RemoveWorkflowInputPortEdit;
+
+import org.apache.log4j.Logger;
+
+import org.apache.taverna.scufl2.api.core.DataLink;
+import org.apache.taverna.scufl2.api.core.Workflow;
+import org.apache.taverna.scufl2.api.port.InputWorkflowPort;
+
+/**
+ * Action for removing an input port from the dataflow.
+ * 
+ * @author David Withers
+ */
+@SuppressWarnings("serial")
+public class RemoveDataflowInputPortAction extends DataflowEditAction {
+	private static Logger logger = Logger
+			.getLogger(RemoveDataflowInputPortAction.class);
+
+	private InputWorkflowPort port;
+
+	public RemoveDataflowInputPortAction(Workflow dataflow,
+			InputWorkflowPort port, Component component,
+			EditManager editManager, SelectionManager selectionManager) {
+		super(dataflow, component, editManager, selectionManager);
+		this.port = port;
+		putValue(SMALL_ICON, deleteIcon);
+		putValue(NAME, "Delete workflow input port");
+	}
+
+	@Override
+	public void actionPerformed(ActionEvent e) {
+		try {
+			dataflowSelectionModel.removeSelection(port);
+			List<DataLink> datalinks = scufl2Tools.datalinksFrom(port);
+			if (datalinks.isEmpty())
+				editManager.doDataflowEdit(dataflow.getParent(),
+						new RemoveWorkflowInputPortEdit(dataflow, port));
+			else {
+				List<Edit<?>> editList = new ArrayList<>();
+				for (DataLink datalink : datalinks)
+					editList.add(new RemoveDataLinkEdit(dataflow, datalink));
+				editList.add(new RemoveWorkflowInputPortEdit(dataflow, port));
+				editManager.doDataflowEdit(dataflow.getParent(),
+						new CompoundEdit(editList));
+			}
+		} catch (EditException e1) {
+			logger.debug("Delete workflow input port failed", e1);
+		}
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-design-ui/src/main/java/org/apache/taverna/workbench/design/actions/RemoveDataflowOutputPortAction.java
----------------------------------------------------------------------
diff --git a/taverna-design-ui/src/main/java/org/apache/taverna/workbench/design/actions/RemoveDataflowOutputPortAction.java b/taverna-design-ui/src/main/java/org/apache/taverna/workbench/design/actions/RemoveDataflowOutputPortAction.java
new file mode 100644
index 0000000..ece84ba
--- /dev/null
+++ b/taverna-design-ui/src/main/java/org/apache/taverna/workbench/design/actions/RemoveDataflowOutputPortAction.java
@@ -0,0 +1,84 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.design.actions;
+
+import static org.apache.taverna.workbench.icons.WorkbenchIcons.deleteIcon;
+
+import java.awt.Component;
+import java.awt.event.ActionEvent;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.taverna.workbench.edits.CompoundEdit;
+import org.apache.taverna.workbench.edits.Edit;
+import org.apache.taverna.workbench.edits.EditException;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.selection.SelectionManager;
+import org.apache.taverna.workflow.edits.RemoveDataLinkEdit;
+import org.apache.taverna.workflow.edits.RemoveWorkflowOutputPortEdit;
+
+import org.apache.log4j.Logger;
+
+import org.apache.taverna.scufl2.api.core.DataLink;
+import org.apache.taverna.scufl2.api.core.Workflow;
+import org.apache.taverna.scufl2.api.port.OutputWorkflowPort;
+
+/**
+ * Action for removing an output port from the dataflow.
+ * 
+ * @author David Withers
+ */
+@SuppressWarnings("serial")
+public class RemoveDataflowOutputPortAction extends DataflowEditAction {
+	private static final Logger logger = Logger
+			.getLogger(RemoveDataflowOutputPortAction.class);
+
+	private OutputWorkflowPort port;
+
+	public RemoveDataflowOutputPortAction(Workflow dataflow,
+			OutputWorkflowPort port, Component component,
+			EditManager editManager, SelectionManager selectionManager) {
+		super(dataflow, component, editManager, selectionManager);
+		this.port = port;
+		putValue(SMALL_ICON, deleteIcon);
+		putValue(NAME, "Delete workflow output port");
+	}
+
+	@Override
+	public void actionPerformed(ActionEvent e) {
+		try {
+			dataflowSelectionModel.removeSelection(port);
+			List<DataLink> datalinks = scufl2Tools.datalinksTo(port);
+			if (datalinks.isEmpty())
+				editManager.doDataflowEdit(dataflow.getParent(),
+						new RemoveWorkflowOutputPortEdit(dataflow, port));
+			else {
+				List<Edit<?>> editList = new ArrayList<>();
+				for (DataLink datalink : datalinks)
+					editList.add(new RemoveDataLinkEdit(dataflow, datalink));
+				editList.add(new RemoveWorkflowOutputPortEdit(dataflow, port));
+				editManager.doDataflowEdit(dataflow.getParent(),
+						new CompoundEdit(editList));
+			}
+		} catch (EditException ex) {
+			logger.debug("Delete workflow output port failed", ex);
+		}
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-design-ui/src/main/java/org/apache/taverna/workbench/design/actions/RemoveDatalinkAction.java
----------------------------------------------------------------------
diff --git a/taverna-design-ui/src/main/java/org/apache/taverna/workbench/design/actions/RemoveDatalinkAction.java b/taverna-design-ui/src/main/java/org/apache/taverna/workbench/design/actions/RemoveDatalinkAction.java
new file mode 100644
index 0000000..2f23e25
--- /dev/null
+++ b/taverna-design-ui/src/main/java/org/apache/taverna/workbench/design/actions/RemoveDatalinkAction.java
@@ -0,0 +1,67 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.design.actions;
+
+import static org.apache.taverna.workbench.icons.WorkbenchIcons.deleteIcon;
+
+import java.awt.Component;
+import java.awt.event.ActionEvent;
+
+import org.apache.taverna.workbench.edits.EditException;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.selection.SelectionManager;
+import org.apache.taverna.workflow.edits.RemoveDataLinkEdit;
+
+import org.apache.log4j.Logger;
+
+import org.apache.taverna.scufl2.api.core.DataLink;
+import org.apache.taverna.scufl2.api.core.Workflow;
+
+/**
+ * Action for removing a datalink from the dataflow.
+ * 
+ * @author David Withers
+ */
+@SuppressWarnings("serial")
+public class RemoveDatalinkAction extends DataflowEditAction {
+	private static final Logger logger = Logger.getLogger(RemoveDatalinkAction.class);
+
+	private DataLink datalink;
+
+	public RemoveDatalinkAction(Workflow dataflow, DataLink datalink,
+			Component component, EditManager editManager,
+			SelectionManager selectionManager) {
+		super(dataflow, component, editManager, selectionManager);
+		this.datalink = datalink;
+		putValue(SMALL_ICON, deleteIcon);
+		putValue(NAME, "Delete data link");
+	}
+
+	@Override
+	public void actionPerformed(ActionEvent ev) {
+		try {
+			dataflowSelectionModel.removeSelection(datalink);
+			editManager.doDataflowEdit(dataflow.getParent(),
+					new RemoveDataLinkEdit(dataflow, datalink));
+		} catch (EditException ex) {
+			logger.debug("Delete data link failed", ex);
+		}
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-design-ui/src/main/java/org/apache/taverna/workbench/design/actions/RemoveProcessorAction.java
----------------------------------------------------------------------
diff --git a/taverna-design-ui/src/main/java/org/apache/taverna/workbench/design/actions/RemoveProcessorAction.java b/taverna-design-ui/src/main/java/org/apache/taverna/workbench/design/actions/RemoveProcessorAction.java
new file mode 100644
index 0000000..a8fc634
--- /dev/null
+++ b/taverna-design-ui/src/main/java/org/apache/taverna/workbench/design/actions/RemoveProcessorAction.java
@@ -0,0 +1,135 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.design.actions;
+
+import static org.apache.taverna.workbench.icons.WorkbenchIcons.deleteIcon;
+
+import java.awt.Component;
+import java.awt.event.ActionEvent;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.taverna.workbench.edits.CompoundEdit;
+import org.apache.taverna.workbench.edits.Edit;
+import org.apache.taverna.workbench.edits.EditException;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.selection.SelectionManager;
+import org.apache.taverna.workflow.edits.RemoveChildEdit;
+import org.apache.taverna.workflow.edits.RemoveDataLinkEdit;
+
+import org.apache.log4j.Logger;
+
+import org.apache.taverna.scufl2.api.activity.Activity;
+import org.apache.taverna.scufl2.api.common.NamedSet;
+import org.apache.taverna.scufl2.api.configurations.Configuration;
+import org.apache.taverna.scufl2.api.core.BlockingControlLink;
+import org.apache.taverna.scufl2.api.core.ControlLink;
+import org.apache.taverna.scufl2.api.core.DataLink;
+import org.apache.taverna.scufl2.api.core.Processor;
+import org.apache.taverna.scufl2.api.core.Workflow;
+import org.apache.taverna.scufl2.api.port.InputProcessorPort;
+import org.apache.taverna.scufl2.api.port.OutputProcessorPort;
+import org.apache.taverna.scufl2.api.profiles.ProcessorBinding;
+import org.apache.taverna.scufl2.api.profiles.Profile;
+
+/**
+ * Action for removing a processor from the dataflow.
+ * 
+ * @author David Withers
+ */
+@SuppressWarnings("serial")
+public class RemoveProcessorAction extends DataflowEditAction {
+	private static final Logger logger = Logger
+			.getLogger(RemoveProcessorAction.class);
+
+	private Processor processor;
+
+	public RemoveProcessorAction(Workflow dataflow, Processor processor,
+			Component component, EditManager editManager,
+			SelectionManager selectionManager) {
+		super(dataflow, component, editManager, selectionManager);
+		this.processor = processor;
+		putValue(SMALL_ICON, deleteIcon);
+		putValue(NAME, "Delete service");
+	}
+
+	@Override
+	public void actionPerformed(ActionEvent e) {
+		try {
+			dataflowSelectionModel.removeSelection(processor);
+
+			NamedSet<InputProcessorPort> inputPorts = processor.getInputPorts();
+			NamedSet<OutputProcessorPort> outputPorts = processor
+					.getOutputPorts();
+			List<BlockingControlLink> controlLinksBlocking = scufl2Tools
+					.controlLinksBlocking(processor);
+			List<BlockingControlLink> controlLinksWaitingFor = scufl2Tools
+					.controlLinksWaitingFor(processor);
+			List<Edit<?>> editList = new ArrayList<>();
+			for (InputProcessorPort inputPort : inputPorts)
+				for (DataLink datalink : scufl2Tools.datalinksTo(inputPort))
+					editList.add(new RemoveDataLinkEdit(dataflow, datalink));
+			for (OutputProcessorPort outputPort : outputPorts)
+				for (DataLink datalink : scufl2Tools.datalinksFrom(outputPort))
+					editList.add(new RemoveDataLinkEdit(dataflow, datalink));
+			for (ControlLink controlLink : controlLinksBlocking)
+				editList.add(new RemoveChildEdit<>(dataflow, controlLink));
+			for (ControlLink controlLink : controlLinksWaitingFor)
+				editList.add(new RemoveChildEdit<>(dataflow, controlLink));
+
+			for (Profile profile : dataflow.getParent().getProfiles()) {
+				List<ProcessorBinding> processorBindings = scufl2Tools
+						.processorBindingsForProcessor(processor, profile);
+				for (ProcessorBinding processorBinding : processorBindings) {
+					Activity boundActivity = processorBinding
+							.getBoundActivity();
+					List<ProcessorBinding> processorBindingsToActivity = scufl2Tools
+							.processorBindingsToActivity(boundActivity);
+					if (processorBindingsToActivity.size() == 1) {
+						editList.add(new RemoveChildEdit<>(profile,
+								boundActivity));
+						for (Configuration configuration : scufl2Tools
+								.configurationsFor(boundActivity, profile))
+							editList.add(new RemoveChildEdit<Profile>(profile,
+									configuration));
+					}
+					editList.add(new RemoveChildEdit<Profile>(profile,
+							processorBinding));
+				}
+			}
+			for (Profile profile : dataflow.getParent().getProfiles()) {
+				List<Configuration> configurations = scufl2Tools
+						.configurationsFor(processor, profile);
+				for (Configuration configuration : configurations)
+					editList.add(new RemoveChildEdit<>(profile, configuration));
+			}
+			if (editList.isEmpty())
+				editManager.doDataflowEdit(dataflow.getParent(),
+						new RemoveChildEdit<>(dataflow, processor));
+			else {
+				editList.add(new RemoveChildEdit<>(dataflow, processor));
+				editManager.doDataflowEdit(dataflow.getParent(),
+						new CompoundEdit(editList));
+			}
+		} catch (EditException e1) {
+			logger.error("Delete processor failed", e1);
+		}
+	}
+}


[22/51] [partial] incubator-taverna-workbench git commit: all packages are moved to org.apache.taverna.*

Posted by re...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/ConfigureEdit.java
----------------------------------------------------------------------
diff --git a/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/ConfigureEdit.java b/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/ConfigureEdit.java
new file mode 100644
index 0000000..9ffc962
--- /dev/null
+++ b/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/ConfigureEdit.java
@@ -0,0 +1,54 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workflow.edits;
+
+import org.apache.taverna.scufl2.api.common.Configurable;
+import org.apache.taverna.scufl2.api.configurations.Configuration;
+
+/**
+ * An Edit that configures a {@link Configurable} with a given
+ * {@link Configuration}.
+ * 
+ * @author David Withers
+ */
+public class ConfigureEdit<ConfigurableType extends Configurable> extends
+		AbstractEdit<ConfigurableType> {
+	private final Configuration oldConfiguration;
+	private final Configuration newConfiguration;
+
+	public ConfigureEdit(ConfigurableType configurable,
+			Configuration oldConfiguration, Configuration newConfiguration) {
+		super(configurable);
+		this.oldConfiguration = oldConfiguration;
+		this.newConfiguration = newConfiguration;
+	}
+
+	@Override
+	protected void doEditAction(ConfigurableType configurable) {
+		oldConfiguration.setConfigures(null);
+		newConfiguration.setConfigures(configurable);
+	}
+
+	@Override
+	protected void undoEditAction(ConfigurableType configurable) {
+		oldConfiguration.setConfigures(configurable);
+		newConfiguration.setConfigures(null);
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/RemoveActivityEdit.java
----------------------------------------------------------------------
diff --git a/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/RemoveActivityEdit.java b/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/RemoveActivityEdit.java
new file mode 100644
index 0000000..d41c8c7
--- /dev/null
+++ b/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/RemoveActivityEdit.java
@@ -0,0 +1,54 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workflow.edits;
+
+import org.apache.taverna.scufl2.api.activity.Activity;
+import org.apache.taverna.scufl2.api.core.Processor;
+import org.apache.taverna.scufl2.api.profiles.ProcessorBinding;
+
+/**
+ * Remove an Activity from a Processor.
+ *
+ * @author alanrw
+ */
+public class RemoveActivityEdit extends AbstractEdit<Processor> {
+	private Activity activityToRemove;
+	private ProcessorBinding removedProcessorBinding;
+
+	public RemoveActivityEdit(Processor processor, Activity activity) {
+		super(processor);
+		this.activityToRemove = activity;
+	}
+
+	@Override
+	protected void doEditAction(Processor processor) {
+		for (ProcessorBinding binding : scufl2Tools
+				.processorBindingsToActivity(activityToRemove))
+			if (binding.getBoundProcessor().equals(processor)) {
+				removedProcessorBinding = binding;
+				removedProcessorBinding.setParent(null);
+			}
+	}
+
+	@Override
+	protected void undoEditAction(Processor processor) {
+		removedProcessorBinding.setParent(activityToRemove.getParent());
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/RemoveActivityInputPortMappingEdit.java
----------------------------------------------------------------------
diff --git a/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/RemoveActivityInputPortMappingEdit.java b/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/RemoveActivityInputPortMappingEdit.java
new file mode 100644
index 0000000..9de5b29
--- /dev/null
+++ b/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/RemoveActivityInputPortMappingEdit.java
@@ -0,0 +1,50 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workflow.edits;
+
+import org.apache.taverna.scufl2.api.activity.Activity;
+import org.apache.taverna.scufl2.api.port.InputActivityPort;
+import org.apache.taverna.scufl2.api.profiles.ProcessorBinding;
+import org.apache.taverna.scufl2.api.profiles.ProcessorInputPortBinding;
+
+public class RemoveActivityInputPortMappingEdit extends AbstractEdit<Activity> {
+	private final InputActivityPort inputActivityPort;
+	private ProcessorInputPortBinding removedPortBinding;
+	private ProcessorBinding processorBinding;
+
+	public RemoveActivityInputPortMappingEdit(Activity activity,
+			InputActivityPort inputActivityPort) {
+		super(activity);
+		this.inputActivityPort = inputActivityPort;
+	}
+
+	@Override
+	protected void doEditAction(Activity activity) {
+		removedPortBinding = scufl2Tools.processorPortBindingForPort(
+				inputActivityPort, activity.getParent());
+		processorBinding = removedPortBinding.getParent();
+		removedPortBinding.setParent(null);
+	}
+
+	@Override
+	protected void undoEditAction(Activity activity) {
+		removedPortBinding.setParent(processorBinding);
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/RemoveActivityOutputPortMappingEdit.java
----------------------------------------------------------------------
diff --git a/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/RemoveActivityOutputPortMappingEdit.java b/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/RemoveActivityOutputPortMappingEdit.java
new file mode 100644
index 0000000..abc2b67
--- /dev/null
+++ b/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/RemoveActivityOutputPortMappingEdit.java
@@ -0,0 +1,50 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workflow.edits;
+
+import org.apache.taverna.scufl2.api.activity.Activity;
+import org.apache.taverna.scufl2.api.port.OutputActivityPort;
+import org.apache.taverna.scufl2.api.profiles.ProcessorBinding;
+import org.apache.taverna.scufl2.api.profiles.ProcessorOutputPortBinding;
+
+public class RemoveActivityOutputPortMappingEdit extends AbstractEdit<Activity> {
+	private final OutputActivityPort outputActivityPort;
+	private ProcessorOutputPortBinding removedPortBinding;
+	private ProcessorBinding processorBinding;
+
+	public RemoveActivityOutputPortMappingEdit(Activity activity,
+			OutputActivityPort outputActivityPort) {
+		super(activity);
+		this.outputActivityPort = outputActivityPort;
+	}
+
+	@Override
+	protected void doEditAction(Activity activity) {
+		removedPortBinding = scufl2Tools.processorPortBindingForPort(
+				outputActivityPort, activity.getParent());
+		processorBinding = removedPortBinding.getParent();
+		removedPortBinding.setParent(null);
+	}
+
+	@Override
+	protected void undoEditAction(Activity activity) {
+		removedPortBinding.setParent(processorBinding);
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/RemoveChildEdit.java
----------------------------------------------------------------------
diff --git a/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/RemoveChildEdit.java b/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/RemoveChildEdit.java
new file mode 100644
index 0000000..ae2d7a6
--- /dev/null
+++ b/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/RemoveChildEdit.java
@@ -0,0 +1,47 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workflow.edits;
+
+import org.apache.taverna.scufl2.api.common.Child;
+import org.apache.taverna.scufl2.api.common.WorkflowBean;
+
+/**
+ * Removes a child from a parent.
+ * 
+ * @author David Withers
+ */
+public class RemoveChildEdit<T extends WorkflowBean> extends AbstractEdit<T> {
+	private Child<T> child;
+
+	public RemoveChildEdit(T parent, Child<T> child) {
+		super(parent);
+		this.child = child;
+	}
+
+	@Override
+	protected void doEditAction(T parent) {
+		child.setParent(null);
+	}
+
+	@Override
+	protected void undoEditAction(T parent) {
+		child.setParent(parent);
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/RemoveDataLinkEdit.java
----------------------------------------------------------------------
diff --git a/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/RemoveDataLinkEdit.java b/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/RemoveDataLinkEdit.java
new file mode 100644
index 0000000..3838368
--- /dev/null
+++ b/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/RemoveDataLinkEdit.java
@@ -0,0 +1,110 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workflow.edits;
+
+import java.util.List;
+
+import org.apache.taverna.scufl2.api.core.DataLink;
+import org.apache.taverna.scufl2.api.core.Workflow;
+import org.apache.taverna.scufl2.api.iterationstrategy.IterationStrategyNode;
+import org.apache.taverna.scufl2.api.iterationstrategy.IterationStrategyParent;
+import org.apache.taverna.scufl2.api.iterationstrategy.IterationStrategyTopNode;
+import org.apache.taverna.scufl2.api.iterationstrategy.PortNode;
+import org.apache.taverna.scufl2.api.port.InputProcessorPort;
+import org.apache.taverna.scufl2.api.port.ReceiverPort;
+
+/**
+ * Remove a DataLink from a Workflow.
+ * <p>
+ * Handles setting the merge position of all dataLinks with the same receiver port.
+ *
+ * @author David Withers
+ */
+public class RemoveDataLinkEdit extends AbstractEdit<Workflow> {
+	private final DataLink dataLink;
+	private PortNode portNode;
+	private int portPosition;
+	private IterationStrategyTopNode parent;
+
+	public RemoveDataLinkEdit(Workflow workflow, DataLink dataLink) {
+		super(workflow);
+		this.dataLink = dataLink;
+	}
+
+	@Override
+	protected void doEditAction(Workflow workflow) {
+		dataLink.setParent(null);
+		ReceiverPort sink = dataLink.getSendsTo();
+		List<DataLink> datalinksTo = scufl2Tools.datalinksTo(sink);
+		if (datalinksTo.isEmpty()) {
+			if (sink instanceof InputProcessorPort) {
+				InputProcessorPort port = (InputProcessorPort) sink;
+				for (IterationStrategyTopNode topNode : port.getParent().getIterationStrategyStack()) {
+					portNode = findPortNode(topNode, port);
+					if (portNode != null) {
+						IterationStrategyParent parentNode = portNode.getParent();
+						if (parentNode instanceof IterationStrategyTopNode) {
+							parent = (IterationStrategyTopNode) parentNode;
+							portPosition = parent.indexOf(portNode);
+							parent.remove(portNode);
+						}
+						break;
+					}
+				}
+			}
+		} else if (datalinksTo.size() == 1) {
+			datalinksTo.get(0).setMergePosition(null);
+		} else {
+			for (int i = 0; i < datalinksTo.size(); i++)
+				datalinksTo.get(i).setMergePosition(i);
+		}
+	}
+
+	@Override
+	protected void undoEditAction(Workflow workflow) {
+		ReceiverPort sink = dataLink.getSendsTo();
+		List<DataLink> datalinksTo = scufl2Tools.datalinksTo(sink);
+		if (dataLink.getMergePosition() != null)
+			for (int i = dataLink.getMergePosition(); i < datalinksTo.size(); i++)
+				datalinksTo.get(i).setMergePosition(i + 1);
+		if (portNode != null) {
+			parent.add(portPosition, portNode);
+			portNode.setParent(parent);
+		}
+		dataLink.setParent(workflow);
+	}
+
+	private PortNode findPortNode(IterationStrategyTopNode topNode,
+			InputProcessorPort port) {
+		for (IterationStrategyNode node : topNode) {
+			if (node instanceof PortNode) {
+				PortNode portNode = (PortNode) node;
+				if (port.equals(portNode.getInputProcessorPort()))
+					return portNode;
+			} else if (node instanceof IterationStrategyTopNode) {
+				IterationStrategyTopNode iterationStrategyTopNode = (IterationStrategyTopNode) node;
+				PortNode result = findPortNode(iterationStrategyTopNode, port);
+				if (result != null)
+					return result;
+			}
+		}
+		return null;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/RemoveProcessorInputPortEdit.java
----------------------------------------------------------------------
diff --git a/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/RemoveProcessorInputPortEdit.java b/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/RemoveProcessorInputPortEdit.java
new file mode 100644
index 0000000..0088725
--- /dev/null
+++ b/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/RemoveProcessorInputPortEdit.java
@@ -0,0 +1,30 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workflow.edits;
+
+import org.apache.taverna.scufl2.api.core.Processor;
+import org.apache.taverna.scufl2.api.port.InputProcessorPort;
+
+public class RemoveProcessorInputPortEdit extends RemoveChildEdit<Processor> {
+	public RemoveProcessorInputPortEdit(Processor processor,
+			InputProcessorPort port) {
+		super(processor, port);
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/RemoveProcessorOutputPortEdit.java
----------------------------------------------------------------------
diff --git a/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/RemoveProcessorOutputPortEdit.java b/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/RemoveProcessorOutputPortEdit.java
new file mode 100644
index 0000000..7b6536b
--- /dev/null
+++ b/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/RemoveProcessorOutputPortEdit.java
@@ -0,0 +1,30 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workflow.edits;
+
+import org.apache.taverna.scufl2.api.core.Processor;
+import org.apache.taverna.scufl2.api.port.OutputProcessorPort;
+
+public class RemoveProcessorOutputPortEdit extends RemoveChildEdit<Processor> {
+	public RemoveProcessorOutputPortEdit(Processor processor,
+			OutputProcessorPort port) {
+		super(processor, port);
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/RemoveWorkflowInputPortEdit.java
----------------------------------------------------------------------
diff --git a/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/RemoveWorkflowInputPortEdit.java b/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/RemoveWorkflowInputPortEdit.java
new file mode 100644
index 0000000..32c7f98
--- /dev/null
+++ b/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/RemoveWorkflowInputPortEdit.java
@@ -0,0 +1,106 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workflow.edits;
+
+import static org.apache.taverna.scufl2.api.common.Scufl2Tools.NESTED_WORKFLOW;
+
+import java.util.List;
+
+import org.apache.taverna.workbench.edits.CompoundEdit;
+import org.apache.taverna.workbench.edits.Edit;
+import org.apache.taverna.workbench.edits.EditException;
+import org.apache.taverna.scufl2.api.activity.Activity;
+import org.apache.taverna.scufl2.api.configurations.Configuration;
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+import org.apache.taverna.scufl2.api.core.Processor;
+import org.apache.taverna.scufl2.api.core.Workflow;
+import org.apache.taverna.scufl2.api.port.InputActivityPort;
+import org.apache.taverna.scufl2.api.port.InputProcessorPort;
+import org.apache.taverna.scufl2.api.port.InputWorkflowPort;
+import org.apache.taverna.scufl2.api.profiles.ProcessorBinding;
+import org.apache.taverna.scufl2.api.profiles.ProcessorInputPortBinding;
+import org.apache.taverna.scufl2.api.profiles.Profile;
+
+import com.fasterxml.jackson.databind.JsonNode;
+
+/**
+ * Removes an input port from a workflow.
+ *
+ * @author David Withers
+ */
+public class RemoveWorkflowInputPortEdit extends AbstractEdit<Workflow> {
+	private final InputWorkflowPort port;
+	private final CompoundEdit nestedPortEdit = new CompoundEdit();
+
+	public RemoveWorkflowInputPortEdit(Workflow workflow, InputWorkflowPort port) {
+		super(workflow);
+		this.port = port;
+		WorkflowBundle workflowBundle = workflow.getParent();
+		if (workflowBundle != null)
+			for (Profile profile : workflowBundle.getProfiles())
+				for (Activity activity : profile.getActivities())
+					if (activity.getType().equals(NESTED_WORKFLOW))
+						for (Configuration c : scufl2Tools.configurationsFor(
+								activity, profile))
+							defineEditsForConfiguration(workflow, port,
+									workflowBundle, activity, c);
+	}
+
+	private void defineEditsForConfiguration(Workflow workflow,
+			InputWorkflowPort port, WorkflowBundle workflowBundle,
+			Activity activity, Configuration c) {
+		List<Edit<?>> edits = nestedPortEdit.getChildEdits();
+		JsonNode nested = c.getJson().get("nestedWorkflow");
+		Workflow nestedWorkflow = workflowBundle.getWorkflows().getByName(
+				nested.asText());
+		if (nestedWorkflow != workflow)
+			return;
+
+		InputActivityPort activityPort = activity.getInputPorts().getByName(
+				port.getName());
+		edits.add(new RemoveChildEdit<>(activity, activityPort));
+
+		for (ProcessorBinding binding : scufl2Tools
+				.processorBindingsToActivity(activity)) {
+			Processor processor = binding.getBoundProcessor();
+			for (ProcessorInputPortBinding portBinding : binding
+					.getInputPortBindings())
+				if (portBinding.getBoundActivityPort() == activityPort) {
+					InputProcessorPort processorPort = portBinding
+							.getBoundProcessorPort();
+					edits.add(new RemoveProcessorInputPortEdit(processor,
+							processorPort));
+					edits.add(new RemoveChildEdit<>(binding, portBinding));
+				}
+		}
+	}
+
+	@Override
+	protected void doEditAction(Workflow workflow) throws EditException {
+		port.setParent(null);
+		nestedPortEdit.doEdit();
+	}
+
+	@Override
+	protected void undoEditAction(Workflow workflow) {
+		port.setParent(workflow);
+		nestedPortEdit.undo();
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/RemoveWorkflowOutputPortEdit.java
----------------------------------------------------------------------
diff --git a/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/RemoveWorkflowOutputPortEdit.java b/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/RemoveWorkflowOutputPortEdit.java
new file mode 100644
index 0000000..3fc5f3d
--- /dev/null
+++ b/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/RemoveWorkflowOutputPortEdit.java
@@ -0,0 +1,104 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workflow.edits;
+
+import static org.apache.taverna.scufl2.api.common.Scufl2Tools.NESTED_WORKFLOW;
+
+import java.util.List;
+
+import org.apache.taverna.workbench.edits.CompoundEdit;
+import org.apache.taverna.workbench.edits.Edit;
+import org.apache.taverna.workbench.edits.EditException;
+import org.apache.taverna.scufl2.api.activity.Activity;
+import org.apache.taverna.scufl2.api.configurations.Configuration;
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+import org.apache.taverna.scufl2.api.core.Workflow;
+import org.apache.taverna.scufl2.api.port.OutputActivityPort;
+import org.apache.taverna.scufl2.api.port.OutputProcessorPort;
+import org.apache.taverna.scufl2.api.port.OutputWorkflowPort;
+import org.apache.taverna.scufl2.api.profiles.ProcessorBinding;
+import org.apache.taverna.scufl2.api.profiles.ProcessorOutputPortBinding;
+import org.apache.taverna.scufl2.api.profiles.Profile;
+
+import com.fasterxml.jackson.databind.JsonNode;
+
+/**
+ * Removes an output port from a workflow.
+ *
+ * @author David Withers
+ */
+public class RemoveWorkflowOutputPortEdit extends AbstractEdit<Workflow> {
+	private final OutputWorkflowPort port;
+	private final CompoundEdit nestedPortEdit = new CompoundEdit();
+
+	public RemoveWorkflowOutputPortEdit(Workflow workflow,
+			OutputWorkflowPort port) {
+		super(workflow);
+		this.port = port;
+		WorkflowBundle workflowBundle = workflow.getParent();
+		if (workflowBundle != null)
+			for (Profile profile : workflowBundle.getProfiles())
+				for (Activity activity : profile.getActivities())
+					if (activity.getType().equals(NESTED_WORKFLOW))
+						for (Configuration c : scufl2Tools.configurationsFor(
+								activity, profile))
+							defineEditsForConfiguration(workflow, port,
+									workflowBundle, activity, c);
+	}
+
+	private void defineEditsForConfiguration(Workflow workflow,
+			OutputWorkflowPort port, WorkflowBundle workflowBundle,
+			Activity activity, Configuration c) {
+		List<Edit<?>> edits = nestedPortEdit.getChildEdits();
+		JsonNode nested = c.getJson().get("nestedWorkflow");
+		Workflow nestedWorkflow = workflowBundle.getWorkflows().getByName(
+				nested.asText());
+		if (nestedWorkflow != workflow)
+			return;
+
+		OutputActivityPort activityPort = activity.getOutputPorts().getByName(
+				port.getName());
+		edits.add(new RemoveChildEdit<>(activity, activityPort));
+		for (ProcessorBinding processorBinding : scufl2Tools
+				.processorBindingsToActivity(activity))
+			for (ProcessorOutputPortBinding portBinding : processorBinding
+					.getOutputPortBindings())
+				if (portBinding.getBoundActivityPort() == activityPort) {
+					OutputProcessorPort processorPort = portBinding
+							.getBoundProcessorPort();
+					edits.add(new RemoveProcessorOutputPortEdit(
+							processorBinding.getBoundProcessor(), processorPort));
+					edits.add(new RemoveChildEdit<>(processorBinding,
+							portBinding));
+				}
+	}
+
+	@Override
+	protected void doEditAction(Workflow workflow) throws EditException {
+		port.setParent(null);
+		nestedPortEdit.doEdit();
+	}
+
+	@Override
+	protected void undoEditAction(Workflow workflow) {
+		port.setParent(workflow);
+		nestedPortEdit.undo();
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/RenameEdit.java
----------------------------------------------------------------------
diff --git a/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/RenameEdit.java b/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/RenameEdit.java
new file mode 100644
index 0000000..6e94d3d
--- /dev/null
+++ b/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/RenameEdit.java
@@ -0,0 +1,135 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workflow.edits;
+
+import static org.apache.taverna.scufl2.api.common.Scufl2Tools.NESTED_WORKFLOW;
+import org.apache.taverna.scufl2.api.activity.Activity;
+import org.apache.taverna.scufl2.api.common.Named;
+import org.apache.taverna.scufl2.api.configurations.Configuration;
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+import org.apache.taverna.scufl2.api.core.Workflow;
+import org.apache.taverna.scufl2.api.port.ActivityPort;
+import org.apache.taverna.scufl2.api.port.InputPort;
+import org.apache.taverna.scufl2.api.port.ProcessorPort;
+import org.apache.taverna.scufl2.api.port.WorkflowPort;
+import org.apache.taverna.scufl2.api.profiles.ProcessorBinding;
+import org.apache.taverna.scufl2.api.profiles.ProcessorInputPortBinding;
+import org.apache.taverna.scufl2.api.profiles.ProcessorOutputPortBinding;
+import org.apache.taverna.scufl2.api.profiles.Profile;
+
+import com.fasterxml.jackson.databind.JsonNode;
+
+/**
+ * Renames a Named WorkflowBean.
+ *
+ * @author David Withers
+ */
+public class RenameEdit<T extends Named> extends AbstractEdit<T> {
+	private String oldName, newName;
+
+	public RenameEdit(T named, String newName) {
+		super(named);
+		this.newName = newName;
+		oldName = named.getName();
+	}
+
+	@Override
+	protected void doEditAction(T named) {
+		named.setName(newName);
+		if (named instanceof WorkflowPort)
+			checkNestedPortNames((WorkflowPort) named, oldName, newName);
+	}
+
+	@Override
+	protected void undoEditAction(T named) {
+		named.setName(oldName);
+		if (named instanceof WorkflowPort)
+			checkNestedPortNames((WorkflowPort) named, newName, oldName);
+	}
+
+	private void checkNestedPortNames(WorkflowPort workflowPort, String oldName, String newName) {
+		Workflow workflow = workflowPort.getParent();
+		if (workflow == null)
+			return;
+		WorkflowBundle workflowBundle = workflow.getParent();
+		if (workflowBundle == null)
+			return;
+		for (Profile profile : workflowBundle.getProfiles())
+			for (Activity activity : profile.getActivities())
+				if (activity.getType().equals(NESTED_WORKFLOW))
+					for (Configuration c : scufl2Tools.configurationsFor(activity, profile))
+						changeActivityPortName(workflowPort, oldName,
+								newName, workflow, workflowBundle, activity, c);
+	}
+
+	private void changeActivityPortName(WorkflowPort workflowPort,
+			String oldName, String newName, Workflow workflow,
+			WorkflowBundle workflowBundle, Activity activity, Configuration c) {
+		JsonNode nested = c.getJson().get("nestedWorkflow");
+		Workflow nestedWorkflow = workflowBundle.getWorkflows().getByName(
+				nested.asText());
+		if (nestedWorkflow != workflow)
+			return;
+
+		ActivityPort activityPort;
+		if (workflowPort instanceof InputPort) {
+			activityPort = activity.getInputPorts().getByName(oldName);
+			changeProcessorInputPortName(oldName, newName, activity,
+					activityPort);
+		} else {
+			activityPort = activity.getOutputPorts().getByName(oldName);
+			changeProcessorOutputPortName(oldName, newName, activity,
+					activityPort);
+		}
+		activityPort.setName(newName);
+	}
+
+	private void changeProcessorInputPortName(String oldName, String newName,
+			Activity activity, ActivityPort activityPort) {
+		bindings: for (ProcessorBinding binding : scufl2Tools
+				.processorBindingsToActivity(activity))
+			for (ProcessorInputPortBinding portBinding : binding
+					.getInputPortBindings())
+				if (portBinding.getBoundActivityPort() == activityPort) {
+					ProcessorPort processorPort = portBinding
+							.getBoundProcessorPort();
+					if (processorPort.getName().equals(oldName)) {
+						processorPort.setName(newName);
+						continue bindings;
+					}
+				}
+	}
+
+	private void changeProcessorOutputPortName(String oldName, String newName,
+			Activity activity, ActivityPort activityPort) {
+		bindings: for (ProcessorBinding binding : scufl2Tools
+				.processorBindingsToActivity(activity))
+			for (ProcessorOutputPortBinding portBinding : binding
+					.getOutputPortBindings())
+				if (portBinding.getBoundActivityPort() == activityPort) {
+					ProcessorPort processorPort = portBinding
+							.getBoundProcessorPort();
+					if (processorPort.getName().equals(oldName)) {
+						processorPort.setName(newName);
+						continue bindings;
+					}
+				}
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/ReorderMergePositionsEdit.java
----------------------------------------------------------------------
diff --git a/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/ReorderMergePositionsEdit.java b/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/ReorderMergePositionsEdit.java
new file mode 100644
index 0000000..bd5dbd8
--- /dev/null
+++ b/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/ReorderMergePositionsEdit.java
@@ -0,0 +1,56 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workflow.edits;
+
+import java.util.List;
+
+import org.apache.taverna.workbench.edits.EditException;
+import org.apache.taverna.scufl2.api.core.DataLink;
+import org.apache.taverna.scufl2.api.port.ReceiverPort;
+
+/**
+ * Change datalink merge positions based on ordered list of data links.
+ * 
+ * @author David Withers
+ * @author Stian Soiland-Reyes
+ */
+public class ReorderMergePositionsEdit extends AbstractEdit<ReceiverPort> {
+	private List<DataLink> newMergePositions;
+	private final List<DataLink> oldMergePositions;
+
+	public ReorderMergePositionsEdit(List<DataLink> dataLinks,
+			List<DataLink> newMergePositions) {
+		super(dataLinks.get(0).getSendsTo());
+		this.oldMergePositions = dataLinks;
+		this.newMergePositions = newMergePositions;
+	}
+
+	@Override
+	protected void doEditAction(ReceiverPort subject) throws EditException {
+		for (int i = 0; i < newMergePositions.size(); i++)
+			newMergePositions.get(i).setMergePosition(i);
+	}
+
+	@Override
+	protected void undoEditAction(ReceiverPort subject) {
+		for (int i = 0; i < oldMergePositions.size(); i++)
+			oldMergePositions.get(i).setMergePosition(i);
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/SetIterationStrategyStackEdit.java
----------------------------------------------------------------------
diff --git a/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/SetIterationStrategyStackEdit.java b/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/SetIterationStrategyStackEdit.java
new file mode 100644
index 0000000..a54843c
--- /dev/null
+++ b/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/SetIterationStrategyStackEdit.java
@@ -0,0 +1,50 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workflow.edits;
+
+import org.apache.taverna.scufl2.api.core.Processor;
+import org.apache.taverna.scufl2.api.iterationstrategy.IterationStrategyStack;
+
+/**
+ * Set the iteration strategy
+ * 
+ * @author Stian Soiland-Reyes
+ */
+public class SetIterationStrategyStackEdit extends AbstractEdit<Processor> {
+	private final IterationStrategyStack iterationStrategyStack;
+	private IterationStrategyStack oldStrategyStack;
+
+	public SetIterationStrategyStackEdit(Processor processor,
+			IterationStrategyStack iterationStrategyStack) {
+		super(processor);
+		this.iterationStrategyStack = iterationStrategyStack;
+	}
+
+	@Override
+	protected void doEditAction(Processor processor) {
+		oldStrategyStack = processor.getIterationStrategyStack();
+		processor.setIterationStrategyStack(iterationStrategyStack);
+	}
+
+	@Override
+	protected void undoEditAction(Processor processor) {
+		processor.setIterationStrategyStack(oldStrategyStack);
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/UpdateDataflowInternalIdentifierEdit.java
----------------------------------------------------------------------
diff --git a/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/UpdateDataflowInternalIdentifierEdit.java b/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/UpdateDataflowInternalIdentifierEdit.java
new file mode 100644
index 0000000..8a03cd0
--- /dev/null
+++ b/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/UpdateDataflowInternalIdentifierEdit.java
@@ -0,0 +1,47 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workflow.edits;
+
+import java.net.URI;
+
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+
+public class UpdateDataflowInternalIdentifierEdit extends
+		AbstractEdit<WorkflowBundle> {
+	private URI newId;
+	private URI oldId;
+
+	public UpdateDataflowInternalIdentifierEdit(WorkflowBundle dataflow,
+			URI newId) {
+		super(dataflow);
+		this.newId = newId;
+		this.oldId = dataflow.getGlobalBaseURI();
+	}
+
+	@Override
+	protected void doEditAction(WorkflowBundle dataflow) {
+		dataflow.setGlobalBaseURI(newId);
+	}
+
+	@Override
+	protected void undoEditAction(WorkflowBundle dataflow) {
+		dataflow.setGlobalBaseURI(oldId);
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-impl/src/main/java/net/sf/taverna/t2/workbench/edits/impl/EditManagerImpl.java
----------------------------------------------------------------------
diff --git a/taverna-edits-impl/src/main/java/net/sf/taverna/t2/workbench/edits/impl/EditManagerImpl.java b/taverna-edits-impl/src/main/java/net/sf/taverna/t2/workbench/edits/impl/EditManagerImpl.java
deleted file mode 100644
index 7ef062c..0000000
--- a/taverna-edits-impl/src/main/java/net/sf/taverna/t2/workbench/edits/impl/EditManagerImpl.java
+++ /dev/null
@@ -1,285 +0,0 @@
-/*******************************************************************************
- * 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.edits.impl;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.taverna.lang.observer.MultiCaster;
-import org.apache.taverna.lang.observer.Observer;
-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 org.apache.log4j.Logger;
-
-import org.apache.taverna.scufl2.api.container.WorkflowBundle;
-
-/**
- * Implementation of {@link EditManager}.
- *
- * @author Stian Soiland-Reyes
- */
-public class EditManagerImpl implements EditManager {
-	private static Logger logger = Logger.getLogger(EditManagerImpl.class);
-
-	private MultiCaster<EditManagerEvent> multiCaster = new MultiCaster<>(this);
-	private Map<WorkflowBundle, DataflowEdits> editsForDataflow = new HashMap<>();
-
-	@Override
-	public void addObserver(Observer<EditManagerEvent> observer) {
-		multiCaster.addObserver(observer);
-	}
-
-	@Override
-	public boolean canRedoDataflowEdit(WorkflowBundle dataflow) {
-		DataflowEdits edits = getEditsForDataflow(dataflow);
-		return edits.canRedo();
-	}
-
-	@Override
-	public boolean canUndoDataflowEdit(WorkflowBundle dataflow) {
-		DataflowEdits edits = getEditsForDataflow(dataflow);
-		return edits.canUndo();
-	}
-
-	@Override
-	public void doDataflowEdit(WorkflowBundle dataflow, Edit<?> edit)
-			throws EditException {
-		// We do the edit before we notify the observers
-		DataflowEdits edits = getEditsForDataflow(dataflow);
-		synchronized (edits) {
-			// Make sure the edits are in the order they were performed
-			edit.doEdit();
-			edits.addEdit(edit);
-		}
-		multiCaster.notify(new DataflowEditEvent(dataflow, edit));
-	}
-
-	@Override
-	public List<Observer<EditManagerEvent>> getObservers() {
-		return multiCaster.getObservers();
-	}
-
-	@Override
-	public void redoDataflowEdit(WorkflowBundle dataflow) throws EditException {
-		DataflowEdits edits = getEditsForDataflow(dataflow);
-		Edit<?> edit;
-		synchronized (edits) {
-			if (!edits.canRedo())
-				return;
-			edit = edits.getLastUndo();
-			edit.doEdit();
-			edits.addRedo(edit);
-		}
-		multiCaster.notify(new DataFlowRedoEvent(dataflow, edit));
-	}
-
-	@Override
-	public void removeObserver(Observer<EditManagerEvent> observer) {
-		multiCaster.removeObserver(observer);
-	}
-
-	@Override
-	public void undoDataflowEdit(WorkflowBundle dataflow) {
-		DataflowEdits edits = getEditsForDataflow(dataflow);
-		Edit<?> edit;
-		synchronized (edits) {
-			if (!edits.canUndo())
-				return;
-			edit = edits.getLastEdit();
-			edit.undo();
-			edits.addUndo(edit);
-		}
-		logger.info("Undoing an edit");
-		multiCaster.notify(new DataFlowUndoEvent(dataflow, edit));
-	}
-
-	/**
-	 * Get the set of edits for a given dataflow, creating if neccessary.
-	 *
-	 * @param dataflow
-	 *            Dataflow the edits relate to
-	 * @return A {@link DataflowEdits} instance to keep edits for the given
-	 *         dataflow
-	 */
-	protected synchronized DataflowEdits getEditsForDataflow(WorkflowBundle dataflow) {
-		DataflowEdits edits = editsForDataflow.get(dataflow);
-		if (edits == null) {
-			edits = new DataflowEdits();
-			editsForDataflow.put(dataflow, edits);
-		}
-		return edits;
-	}
-
-	/**
-	 * A set of edits and undoes for a {@link Dataflow}
-	 *
-	 * @author Stian Soiland-Reyes
-	 *
-	 */
-	public class DataflowEdits {
-		/**
-		 * List of edits that have been performed and can be undone.
-		 */
-		private List<Edit<?>> edits = new ArrayList<>();
-		/**
-		 * List of edits that have been undone and can be redone
-		 */
-		private List<Edit<?>> undoes = new ArrayList<>();
-
-		/**
-		 * Add an {@link Edit} that has been done by the EditManager.
-		 * <p>
-		 * This can later be retrieved using {@link #getLastEdit()}. After
-		 * calling this {@link #canRedo()} will be false.
-		 *
-		 * @param edit
-		 *            {@link Edit} that has been undone
-		 */
-		public synchronized void addEdit(Edit<?> edit) {
-			addEditOrRedo(edit, false);
-		}
-
-		/**
-		 * Add an {@link Edit} that has been redone by the EditManager.
-		 * <p>
-		 * The {@link Edit} must be the same as the last undo returned through
-		 * {@link #getLastUndo()}.
-		 * <p>
-		 * This method works like {@link #addEdit(Edit)} except that instead of
-		 * removing all possible redoes, only the given {@link Edit} is removed.
-		 *
-		 * @param edit
-		 *            {@link Edit} that has been redone
-		 */
-		public synchronized void addRedo(Edit<?> edit) {
-			addEditOrRedo(edit, true);
-		}
-
-		/**
-		 * Add an {@link Edit} that has been undone by the EditManager.
-		 * <p>
-		 * After calling this method {@link #canRedo()} will be true, and the
-		 * edit can be retrieved using {@link #getLastUndo()}.
-		 * </p>
-		 * <p>
-		 * The {@link Edit} must be the last edit returned from
-		 * {@link #getLastEdit()}, after calling this method
-		 * {@link #getLastEdit()} will return the previous edit or
-		 * {@link #canUndo()} will be false if there are no more edits.
-		 *
-		 * @param edit
-		 *            {@link Edit} that has been undone
-		 */
-		public synchronized void addUndo(Edit<?> edit) {
-			int lastIndex = edits.size() - 1;
-			if (lastIndex < 0 || !edits.get(lastIndex).equals(edit))
-				throw new IllegalArgumentException("Can't undo unknown edit "
-						+ edit);
-			undoes.add(edit);
-			edits.remove(lastIndex);
-		}
-
-		/**
-		 * True if there are undone events that can be redone.
-		 *
-		 * @return <code>true</code> if there are undone events
-		 */
-		public boolean canRedo() {
-			return !undoes.isEmpty();
-		}
-
-		/**
-		 * True if there are edits that can be undone and later added with
-		 * {@link #addUndo(Edit)}.
-		 *
-		 * @return <code>true</code> if there are edits that can be undone
-		 */
-		public boolean canUndo() {
-			return !edits.isEmpty();
-		}
-
-		/**
-		 * Get the last edit that can be undone. This edit was the last one to
-		 * be added with {@link #addEdit(Edit)} or {@link #addRedo(Edit)}.
-		 *
-		 * @return The last added {@link Edit}
-		 * @throws IllegalStateException
-		 *             If there are no more edits (Check with {@link #canUndo()}
-		 *             first)
-		 *
-		 */
-		public synchronized Edit<?> getLastEdit() throws IllegalStateException {
-			if (edits.isEmpty())
-				throw new IllegalStateException("No more edits");
-			int lastEdit = edits.size() - 1;
-			return edits.get(lastEdit);
-		}
-
-		/**
-		 * Get the last edit that can be redone. This edit was the last one to
-		 * be added with {@link #addUndo(Edit)}.
-		 *
-		 * @return The last undone {@link Edit}
-		 * @throws IllegalStateException
-		 *             If there are no more edits (Check with {@link #canRedo()}
-		 *             first)
-		 *
-		 */
-		public synchronized Edit<?> getLastUndo() throws IllegalStateException {
-			if (undoes.isEmpty())
-				throw new IllegalStateException("No more undoes");
-			int lastUndo = undoes.size() - 1;
-			return undoes.get(lastUndo);
-		}
-
-		/**
-		 * Add an edit or redo. Common functionallity called by
-		 * {@link #addEdit(Edit)} and {@link #addRedo(Edit)}.
-		 *
-		 * @see #addEdit(Edit)
-		 * @see #addRedo(Edit)
-		 * @param edit
-		 *            The {@link Edit} to add
-		 * @param isRedo
-		 *            True if this is a redo
-		 */
-		protected void addEditOrRedo(Edit<?> edit, boolean isRedo) {
-			edits.add(edit);
-			if (undoes.isEmpty())
-				return;
-			if (isRedo) {
-				// It's a redo, remove only the last one
-				int lastUndoIndex = undoes.size() - 1;
-				Edit<?> lastUndo = undoes.get(lastUndoIndex);
-				if (!edit.equals(lastUndo))
-					throw new IllegalArgumentException(
-							"Can only redo last undo");
-				undoes.remove(lastUndoIndex);
-			} else
-				// It's a new edit, remove all redos
-				undoes.clear();
-		}
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-impl/src/main/java/net/sf/taverna/t2/workbench/edits/impl/menu/AbstractUndoAction.java
----------------------------------------------------------------------
diff --git a/taverna-edits-impl/src/main/java/net/sf/taverna/t2/workbench/edits/impl/menu/AbstractUndoAction.java b/taverna-edits-impl/src/main/java/net/sf/taverna/t2/workbench/edits/impl/menu/AbstractUndoAction.java
deleted file mode 100644
index cbd6b7f..0000000
--- a/taverna-edits-impl/src/main/java/net/sf/taverna/t2/workbench/edits/impl/menu/AbstractUndoAction.java
+++ /dev/null
@@ -1,166 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2012 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.edits.impl.menu;
-
-import static java.awt.Toolkit.getDefaultToolkit;
-import static java.awt.event.KeyEvent.VK_Y;
-import static java.awt.event.KeyEvent.VK_Z;
-import static javax.swing.KeyStroke.getKeyStroke;
-import static net.sf.taverna.t2.workbench.icons.WorkbenchIcons.redoIcon;
-import static net.sf.taverna.t2.workbench.icons.WorkbenchIcons.undoIcon;
-
-import java.awt.event.ActionEvent;
-
-import javax.swing.AbstractAction;
-
-import org.apache.taverna.lang.observer.Observable;
-import org.apache.taverna.lang.observer.Observer;
-import org.apache.taverna.lang.observer.SwingAwareObserver;
-import net.sf.taverna.t2.workbench.edits.EditManager;
-import net.sf.taverna.t2.workbench.edits.EditManager.AbstractDataflowEditEvent;
-import net.sf.taverna.t2.workbench.edits.EditManager.EditManagerEvent;
-import net.sf.taverna.t2.workbench.selection.SelectionManager;
-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 org.apache.taverna.scufl2.api.container.WorkflowBundle;
-
-/**
- * @author David Withers
- */
-@SuppressWarnings("serial")
-public abstract class AbstractUndoAction extends AbstractAction {
-	protected EditManager editManager;
-	private SelectionManager selectionManager;
-
-	public AbstractUndoAction(String label, EditManager editManager) {
-		super(label);
-		this.editManager = editManager;
-		if (label.equals("Undo")) {
-			this.putValue(SMALL_ICON, undoIcon);
-			this.putValue(SHORT_DESCRIPTION, "Undo an action");
-			putValue(
-					ACCELERATOR_KEY,
-					getKeyStroke(VK_Z, getDefaultToolkit()
-							.getMenuShortcutKeyMask()));
-		} else if (label.equals("Redo")) {
-			this.putValue(SMALL_ICON, redoIcon);
-			this.putValue(SHORT_DESCRIPTION, "Redo an action");
-			putValue(
-					ACCELERATOR_KEY,
-					getKeyStroke(VK_Y, getDefaultToolkit()
-							.getMenuShortcutKeyMask()));
-		}
-		editManager.addObserver(new EditManagerObserver());
-		updateStatus();
-	}
-
-	@Override
-	public void actionPerformed(ActionEvent e) {
-		WorkflowBundle workflowBundle = getCurrentDataflow();
-		if (workflowBundle != null)
-			performUndoOrRedo(workflowBundle);
-	}
-
-	/**
-	 * Check if action should be enabled or disabled and update its status.
-	 */
-	public void updateStatus() {
-		WorkflowBundle workflowBundle = getCurrentDataflow();
-		if (workflowBundle == null)
-			setEnabled(false);
-		setEnabled(isActive(workflowBundle));
-	}
-
-	/**
-	 * Retrieve the current dataflow from the {@link ModelMap}, or
-	 * <code>null</code> if no workflow is active.
-	 * 
-	 * @return The current {@link Dataflow}
-	 */
-	protected WorkflowBundle getCurrentDataflow() {
-		if (selectionManager == null)
-			return null;
-		return selectionManager.getSelectedWorkflowBundle();
-	}
-
-	/**
-	 * Return <code>true</code> if the action should be enabled when the given
-	 * {@link Dataflow} is the current, ie. if it's undoable or redoable.
-	 * 
-	 * @param dataflow
-	 *            Current {@link Dataflow}
-	 * @return <code>true</code> if the action should be enabled.
-	 */
-	protected abstract boolean isActive(WorkflowBundle workflowBundle);
-
-	/**
-	 * Called by {@link #actionPerformed(ActionEvent)} when the current dataflow
-	 * is not <code>null</code>.
-	 * 
-	 * @param dataflow
-	 *            {@link Dataflow} on which to undo or redo
-	 */
-	protected abstract void performUndoOrRedo(WorkflowBundle workflowBundle);
-
-	public void setSelectionManager(SelectionManager selectionManager) {
-		this.selectionManager = selectionManager;
-		if (selectionManager != null)
-			selectionManager.addObserver(new SelectionManagerObserver());
-	}
-
-	/**
-	 * Update the status if there's been an edit done on the current workflow.
-	 * 
-	 */
-	protected class EditManagerObserver implements Observer<EditManagerEvent> {
-		@Override
-		public void notify(Observable<EditManagerEvent> sender,
-				EditManagerEvent message) throws Exception {
-			if (!(message instanceof AbstractDataflowEditEvent))
-				return;
-			AbstractDataflowEditEvent dataflowEdit = (AbstractDataflowEditEvent) message;
-			if (dataflowEdit.getDataFlow().equals(dataflowEdit.getDataFlow()))
-				// It's an edit that could effect our undoability
-				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)
-				updateStatus();
-			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/a9a52bd5/taverna-edits-impl/src/main/java/net/sf/taverna/t2/workbench/edits/impl/menu/RedoMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-edits-impl/src/main/java/net/sf/taverna/t2/workbench/edits/impl/menu/RedoMenuAction.java b/taverna-edits-impl/src/main/java/net/sf/taverna/t2/workbench/edits/impl/menu/RedoMenuAction.java
deleted file mode 100644
index 5d42868..0000000
--- a/taverna-edits-impl/src/main/java/net/sf/taverna/t2/workbench/edits/impl/menu/RedoMenuAction.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*******************************************************************************
- * 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.edits.impl.menu;
-
-import static javax.swing.JOptionPane.ERROR_MESSAGE;
-import static javax.swing.JOptionPane.showMessageDialog;
-import static net.sf.taverna.t2.workbench.edits.impl.menu.UndoMenuSection.UNDO_SECTION_URI;
-
-import javax.swing.Action;
-
-import net.sf.taverna.t2.ui.menu.AbstractMenuAction;
-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.selection.SelectionManager;
-
-import org.apache.log4j.Logger;
-
-import org.apache.taverna.scufl2.api.container.WorkflowBundle;
-
-/**
- * Redo the previous {@link Edit} done on the current workflow using the
- * {@link EditManager}.
- *
- * @author Stian Soiland-Reyes
- */
-public class RedoMenuAction extends AbstractMenuAction {
-	private static Logger logger = Logger.getLogger(RedoMenuAction.class);
-	private final EditManager editManager;
-	private SelectionManager selectionManager;
-	private AbstractUndoAction undoAction;
-
-	public RedoMenuAction(EditManager editManager) {
-		super(UNDO_SECTION_URI, 20);
-		this.editManager = editManager;
-	}
-
-	@SuppressWarnings("serial")
-	@Override
-	protected Action createAction() {
-		undoAction = new AbstractUndoAction("Redo", editManager) {
-			@Override
-			protected boolean isActive(WorkflowBundle workflowBundle) {
-				return editManager.canRedoDataflowEdit(workflowBundle);
-			}
-
-			@Override
-			protected void performUndoOrRedo(WorkflowBundle workflowBundle) {
-				try {
-					editManager.redoDataflowEdit(workflowBundle);
-				} catch (EditException | RuntimeException e) {
-					logger.warn("Could not redo for " + workflowBundle, e);
-					showMessageDialog(null, "Could not redo for workflow "
-							+ workflowBundle + ":\n" + e, "Could not redo",
-							ERROR_MESSAGE);
-				}
-			}
-		};
-		undoAction.setSelectionManager(selectionManager);
-		return undoAction;
-	}
-
-	public void setSelectionManager(SelectionManager selectionManager) {
-		this.selectionManager = selectionManager;
-		if (undoAction != null)
-			undoAction.setSelectionManager(selectionManager);
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-impl/src/main/java/net/sf/taverna/t2/workbench/edits/impl/menu/UndoMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-edits-impl/src/main/java/net/sf/taverna/t2/workbench/edits/impl/menu/UndoMenuAction.java b/taverna-edits-impl/src/main/java/net/sf/taverna/t2/workbench/edits/impl/menu/UndoMenuAction.java
deleted file mode 100644
index 21da7c1..0000000
--- a/taverna-edits-impl/src/main/java/net/sf/taverna/t2/workbench/edits/impl/menu/UndoMenuAction.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*******************************************************************************
- * 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.edits.impl.menu;
-
-import static javax.swing.JOptionPane.ERROR_MESSAGE;
-import static javax.swing.JOptionPane.showMessageDialog;
-import static net.sf.taverna.t2.workbench.edits.impl.menu.UndoMenuSection.UNDO_SECTION_URI;
-
-import javax.swing.Action;
-
-import net.sf.taverna.t2.ui.menu.AbstractMenuAction;
-import net.sf.taverna.t2.workbench.edits.Edit;
-import net.sf.taverna.t2.workbench.edits.EditManager;
-import net.sf.taverna.t2.workbench.selection.SelectionManager;
-
-import org.apache.log4j.Logger;
-
-import org.apache.taverna.scufl2.api.container.WorkflowBundle;
-
-/**
- * Undo the last {@link Edit} done on the current workflow using the
- * {@link EditManager}.
- * 
- * @author Stian Soiland-Reyes
- * 
- */
-public class UndoMenuAction extends AbstractMenuAction {
-	private static Logger logger = Logger.getLogger(UndoMenuAction.class);
-	private final EditManager editManager;
-	private SelectionManager selectionManager;
-	private AbstractUndoAction undoAction;
-
-	public UndoMenuAction(EditManager editManager) {
-		super(UNDO_SECTION_URI, 10);
-		this.editManager = editManager;
-	}
-
-	@SuppressWarnings("serial")
-	@Override
-	protected Action createAction() {
-		undoAction = new AbstractUndoAction("Undo", editManager) {
-			@Override
-			protected boolean isActive(WorkflowBundle workflowBundle) {
-				return editManager.canUndoDataflowEdit(workflowBundle);
-			}
-
-			@Override
-			protected void performUndoOrRedo(WorkflowBundle workflowBundle) {
-				try {
-					editManager.undoDataflowEdit(workflowBundle);
-				} catch (RuntimeException e) {
-					logger.warn("Could not undo for " + workflowBundle, e);
-					showMessageDialog(null, "Could not undo for workflow "
-							+ workflowBundle + ":\n" + e, "Could not undo",
-							ERROR_MESSAGE);
-				}
-			}
-		};
-		undoAction.setSelectionManager(selectionManager);
-		return undoAction;
-	}
-
-	public void setSelectionManager(SelectionManager selectionManager) {
-		this.selectionManager = selectionManager;
-		if (undoAction != null)
-			undoAction.setSelectionManager(selectionManager);
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-impl/src/main/java/net/sf/taverna/t2/workbench/edits/impl/menu/UndoMenuSection.java
----------------------------------------------------------------------
diff --git a/taverna-edits-impl/src/main/java/net/sf/taverna/t2/workbench/edits/impl/menu/UndoMenuSection.java b/taverna-edits-impl/src/main/java/net/sf/taverna/t2/workbench/edits/impl/menu/UndoMenuSection.java
deleted file mode 100644
index b83a650..0000000
--- a/taverna-edits-impl/src/main/java/net/sf/taverna/t2/workbench/edits/impl/menu/UndoMenuSection.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*******************************************************************************
- * 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.edits.impl.menu;
-
-import java.net.URI;
-
-import net.sf.taverna.t2.ui.menu.AbstractMenuSection;
-
-/**
- * A section of the Edit menu that contains {@link UndoMenuSection undo} and
- * {@link RedoMenuAction redo}.
- * 
- * @author Stian Soiland-Reyes
- */
-public class UndoMenuSection extends AbstractMenuSection {
-	public static final URI UNDO_SECTION_URI = URI
-			.create("http://taverna.sf.net/2008/t2workbench/edits#undoSection");
-	public static final URI EDIT_MENU_URI = URI
-			.create("http://taverna.sf.net/2008/t2workbench/menu#edit");
-
-	public UndoMenuSection() {
-		super(EDIT_MENU_URI, 10, UNDO_SECTION_URI);
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-impl/src/main/java/net/sf/taverna/t2/workbench/edits/impl/toolbar/EditToolbarSection.java
----------------------------------------------------------------------
diff --git a/taverna-edits-impl/src/main/java/net/sf/taverna/t2/workbench/edits/impl/toolbar/EditToolbarSection.java b/taverna-edits-impl/src/main/java/net/sf/taverna/t2/workbench/edits/impl/toolbar/EditToolbarSection.java
deleted file mode 100644
index 9eea85a..0000000
--- a/taverna-edits-impl/src/main/java/net/sf/taverna/t2/workbench/edits/impl/toolbar/EditToolbarSection.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*******************************************************************************
- * 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.edits.impl.toolbar;
-
-import static net.sf.taverna.t2.ui.menu.DefaultToolBar.DEFAULT_TOOL_BAR;
-
-import java.net.URI;
-
-import net.sf.taverna.t2.ui.menu.AbstractMenuSection;
-
-public class EditToolbarSection extends AbstractMenuSection {
-	public static final URI EDIT_TOOLBAR_SECTION = URI
-			.create("http://taverna.sf.net/2008/t2workbench/menu#editToolbarSection");
-
-	public EditToolbarSection() {
-		super(DEFAULT_TOOL_BAR, 60, EDIT_TOOLBAR_SECTION);
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-impl/src/main/java/net/sf/taverna/t2/workbench/edits/impl/toolbar/RedoToolbarAction.java
----------------------------------------------------------------------
diff --git a/taverna-edits-impl/src/main/java/net/sf/taverna/t2/workbench/edits/impl/toolbar/RedoToolbarAction.java b/taverna-edits-impl/src/main/java/net/sf/taverna/t2/workbench/edits/impl/toolbar/RedoToolbarAction.java
deleted file mode 100644
index 09c0058..0000000
--- a/taverna-edits-impl/src/main/java/net/sf/taverna/t2/workbench/edits/impl/toolbar/RedoToolbarAction.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*******************************************************************************
- * 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.edits.impl.toolbar;
-
-import static net.sf.taverna.t2.workbench.edits.impl.toolbar.EditToolbarSection.EDIT_TOOLBAR_SECTION;
-
-import java.net.URI;
-
-import javax.swing.Action;
-
-import net.sf.taverna.t2.ui.menu.AbstractMenuAction;
-import net.sf.taverna.t2.workbench.edits.impl.menu.RedoMenuAction;
-
-public class RedoToolbarAction extends AbstractMenuAction {
-	private static final URI EDIT_TOOLBAR_REDO_URI = URI
-			.create("http://taverna.sf.net/2008/t2workbench/menu#editToolbarRedo");
-	private final RedoMenuAction redoMenuAction;
-
-	public RedoToolbarAction(RedoMenuAction redoMenuAction) {
-		super(EDIT_TOOLBAR_SECTION, 20, EDIT_TOOLBAR_REDO_URI);
-		this.redoMenuAction = redoMenuAction;
-	}
-
-	@Override
-	protected Action createAction() {
-		return redoMenuAction.getAction();
-	}
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-impl/src/main/java/net/sf/taverna/t2/workbench/edits/impl/toolbar/UndoToolbarAction.java
----------------------------------------------------------------------
diff --git a/taverna-edits-impl/src/main/java/net/sf/taverna/t2/workbench/edits/impl/toolbar/UndoToolbarAction.java b/taverna-edits-impl/src/main/java/net/sf/taverna/t2/workbench/edits/impl/toolbar/UndoToolbarAction.java
deleted file mode 100644
index 8e31ed3..0000000
--- a/taverna-edits-impl/src/main/java/net/sf/taverna/t2/workbench/edits/impl/toolbar/UndoToolbarAction.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*******************************************************************************
- * 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.edits.impl.toolbar;
-
-import static net.sf.taverna.t2.workbench.edits.impl.toolbar.EditToolbarSection.EDIT_TOOLBAR_SECTION;
-
-import java.net.URI;
-
-import javax.swing.Action;
-
-import net.sf.taverna.t2.ui.menu.AbstractMenuAction;
-import net.sf.taverna.t2.workbench.edits.impl.menu.UndoMenuAction;
-
-public class UndoToolbarAction extends AbstractMenuAction {
-	private static final URI EDIT_TOOLBAR_UNDO_URI = URI
-			.create("http://taverna.sf.net/2008/t2workbench/menu#editToolbarUndo");
-	private final UndoMenuAction undoMenuAction;
-
-	public UndoToolbarAction(UndoMenuAction undoMenuAction) {
-		super(EDIT_TOOLBAR_SECTION, 10, EDIT_TOOLBAR_UNDO_URI);
-		this.undoMenuAction = undoMenuAction;
-	}
-
-	@Override
-	protected Action createAction() {
-		return undoMenuAction.getAction();
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-impl/src/main/java/org/apache/taverna/workbench/edits/impl/EditManagerImpl.java
----------------------------------------------------------------------
diff --git a/taverna-edits-impl/src/main/java/org/apache/taverna/workbench/edits/impl/EditManagerImpl.java b/taverna-edits-impl/src/main/java/org/apache/taverna/workbench/edits/impl/EditManagerImpl.java
new file mode 100644
index 0000000..09d0b60
--- /dev/null
+++ b/taverna-edits-impl/src/main/java/org/apache/taverna/workbench/edits/impl/EditManagerImpl.java
@@ -0,0 +1,284 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.edits.impl;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.taverna.lang.observer.MultiCaster;
+import org.apache.taverna.lang.observer.Observer;
+import org.apache.taverna.workbench.edits.Edit;
+import org.apache.taverna.workbench.edits.EditException;
+import org.apache.taverna.workbench.edits.EditManager;
+
+import org.apache.log4j.Logger;
+
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+
+/**
+ * Implementation of {@link EditManager}.
+ *
+ * @author Stian Soiland-Reyes
+ */
+public class EditManagerImpl implements EditManager {
+	private static Logger logger = Logger.getLogger(EditManagerImpl.class);
+
+	private MultiCaster<EditManagerEvent> multiCaster = new MultiCaster<>(this);
+	private Map<WorkflowBundle, DataflowEdits> editsForDataflow = new HashMap<>();
+
+	@Override
+	public void addObserver(Observer<EditManagerEvent> observer) {
+		multiCaster.addObserver(observer);
+	}
+
+	@Override
+	public boolean canRedoDataflowEdit(WorkflowBundle dataflow) {
+		DataflowEdits edits = getEditsForDataflow(dataflow);
+		return edits.canRedo();
+	}
+
+	@Override
+	public boolean canUndoDataflowEdit(WorkflowBundle dataflow) {
+		DataflowEdits edits = getEditsForDataflow(dataflow);
+		return edits.canUndo();
+	}
+
+	@Override
+	public void doDataflowEdit(WorkflowBundle dataflow, Edit<?> edit)
+			throws EditException {
+		// We do the edit before we notify the observers
+		DataflowEdits edits = getEditsForDataflow(dataflow);
+		synchronized (edits) {
+			// Make sure the edits are in the order they were performed
+			edit.doEdit();
+			edits.addEdit(edit);
+		}
+		multiCaster.notify(new DataflowEditEvent(dataflow, edit));
+	}
+
+	@Override
+	public List<Observer<EditManagerEvent>> getObservers() {
+		return multiCaster.getObservers();
+	}
+
+	@Override
+	public void redoDataflowEdit(WorkflowBundle dataflow) throws EditException {
+		DataflowEdits edits = getEditsForDataflow(dataflow);
+		Edit<?> edit;
+		synchronized (edits) {
+			if (!edits.canRedo())
+				return;
+			edit = edits.getLastUndo();
+			edit.doEdit();
+			edits.addRedo(edit);
+		}
+		multiCaster.notify(new DataFlowRedoEvent(dataflow, edit));
+	}
+
+	@Override
+	public void removeObserver(Observer<EditManagerEvent> observer) {
+		multiCaster.removeObserver(observer);
+	}
+
+	@Override
+	public void undoDataflowEdit(WorkflowBundle dataflow) {
+		DataflowEdits edits = getEditsForDataflow(dataflow);
+		Edit<?> edit;
+		synchronized (edits) {
+			if (!edits.canUndo())
+				return;
+			edit = edits.getLastEdit();
+			edit.undo();
+			edits.addUndo(edit);
+		}
+		logger.info("Undoing an edit");
+		multiCaster.notify(new DataFlowUndoEvent(dataflow, edit));
+	}
+
+	/**
+	 * Get the set of edits for a given dataflow, creating if neccessary.
+	 *
+	 * @param dataflow
+	 *            Dataflow the edits relate to
+	 * @return A {@link DataflowEdits} instance to keep edits for the given
+	 *         dataflow
+	 */
+	protected synchronized DataflowEdits getEditsForDataflow(WorkflowBundle dataflow) {
+		DataflowEdits edits = editsForDataflow.get(dataflow);
+		if (edits == null) {
+			edits = new DataflowEdits();
+			editsForDataflow.put(dataflow, edits);
+		}
+		return edits;
+	}
+
+	/**
+	 * A set of edits and undoes for a {@link Dataflow}
+	 *
+	 * @author Stian Soiland-Reyes
+	 *
+	 */
+	public class DataflowEdits {
+		/**
+		 * List of edits that have been performed and can be undone.
+		 */
+		private List<Edit<?>> edits = new ArrayList<>();
+		/**
+		 * List of edits that have been undone and can be redone
+		 */
+		private List<Edit<?>> undoes = new ArrayList<>();
+
+		/**
+		 * Add an {@link Edit} that has been done by the EditManager.
+		 * <p>
+		 * This can later be retrieved using {@link #getLastEdit()}. After
+		 * calling this {@link #canRedo()} will be false.
+		 *
+		 * @param edit
+		 *            {@link Edit} that has been undone
+		 */
+		public synchronized void addEdit(Edit<?> edit) {
+			addEditOrRedo(edit, false);
+		}
+
+		/**
+		 * Add an {@link Edit} that has been redone by the EditManager.
+		 * <p>
+		 * The {@link Edit} must be the same as the last undo returned through
+		 * {@link #getLastUndo()}.
+		 * <p>
+		 * This method works like {@link #addEdit(Edit)} except that instead of
+		 * removing all possible redoes, only the given {@link Edit} is removed.
+		 *
+		 * @param edit
+		 *            {@link Edit} that has been redone
+		 */
+		public synchronized void addRedo(Edit<?> edit) {
+			addEditOrRedo(edit, true);
+		}
+
+		/**
+		 * Add an {@link Edit} that has been undone by the EditManager.
+		 * <p>
+		 * After calling this method {@link #canRedo()} will be true, and the
+		 * edit can be retrieved using {@link #getLastUndo()}.
+		 * </p>
+		 * <p>
+		 * The {@link Edit} must be the last edit returned from
+		 * {@link #getLastEdit()}, after calling this method
+		 * {@link #getLastEdit()} will return the previous edit or
+		 * {@link #canUndo()} will be false if there are no more edits.
+		 *
+		 * @param edit
+		 *            {@link Edit} that has been undone
+		 */
+		public synchronized void addUndo(Edit<?> edit) {
+			int lastIndex = edits.size() - 1;
+			if (lastIndex < 0 || !edits.get(lastIndex).equals(edit))
+				throw new IllegalArgumentException("Can't undo unknown edit "
+						+ edit);
+			undoes.add(edit);
+			edits.remove(lastIndex);
+		}
+
+		/**
+		 * True if there are undone events that can be redone.
+		 *
+		 * @return <code>true</code> if there are undone events
+		 */
+		public boolean canRedo() {
+			return !undoes.isEmpty();
+		}
+
+		/**
+		 * True if there are edits that can be undone and later added with
+		 * {@link #addUndo(Edit)}.
+		 *
+		 * @return <code>true</code> if there are edits that can be undone
+		 */
+		public boolean canUndo() {
+			return !edits.isEmpty();
+		}
+
+		/**
+		 * Get the last edit that can be undone. This edit was the last one to
+		 * be added with {@link #addEdit(Edit)} or {@link #addRedo(Edit)}.
+		 *
+		 * @return The last added {@link Edit}
+		 * @throws IllegalStateException
+		 *             If there are no more edits (Check with {@link #canUndo()}
+		 *             first)
+		 *
+		 */
+		public synchronized Edit<?> getLastEdit() throws IllegalStateException {
+			if (edits.isEmpty())
+				throw new IllegalStateException("No more edits");
+			int lastEdit = edits.size() - 1;
+			return edits.get(lastEdit);
+		}
+
+		/**
+		 * Get the last edit that can be redone. This edit was the last one to
+		 * be added with {@link #addUndo(Edit)}.
+		 *
+		 * @return The last undone {@link Edit}
+		 * @throws IllegalStateException
+		 *             If there are no more edits (Check with {@link #canRedo()}
+		 *             first)
+		 *
+		 */
+		public synchronized Edit<?> getLastUndo() throws IllegalStateException {
+			if (undoes.isEmpty())
+				throw new IllegalStateException("No more undoes");
+			int lastUndo = undoes.size() - 1;
+			return undoes.get(lastUndo);
+		}
+
+		/**
+		 * Add an edit or redo. Common functionallity called by
+		 * {@link #addEdit(Edit)} and {@link #addRedo(Edit)}.
+		 *
+		 * @see #addEdit(Edit)
+		 * @see #addRedo(Edit)
+		 * @param edit
+		 *            The {@link Edit} to add
+		 * @param isRedo
+		 *            True if this is a redo
+		 */
+		protected void addEditOrRedo(Edit<?> edit, boolean isRedo) {
+			edits.add(edit);
+			if (undoes.isEmpty())
+				return;
+			if (isRedo) {
+				// It's a redo, remove only the last one
+				int lastUndoIndex = undoes.size() - 1;
+				Edit<?> lastUndo = undoes.get(lastUndoIndex);
+				if (!edit.equals(lastUndo))
+					throw new IllegalArgumentException(
+							"Can only redo last undo");
+				undoes.remove(lastUndoIndex);
+			} else
+				// It's a new edit, remove all redos
+				undoes.clear();
+		}
+	}
+}


[11/51] [partial] incubator-taverna-workbench git commit: all packages are moved to org.apache.taverna.*

Posted by re...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/actions/AddWFInputAction.java
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/actions/AddWFInputAction.java b/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/actions/AddWFInputAction.java
index 0803b74..c102cd6 100644
--- a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/actions/AddWFInputAction.java
+++ b/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/actions/AddWFInputAction.java
@@ -24,16 +24,16 @@ import static java.awt.event.InputEvent.ALT_DOWN_MASK;
 import static java.awt.event.InputEvent.SHIFT_DOWN_MASK;
 import static java.awt.event.KeyEvent.VK_I;
 import static javax.swing.KeyStroke.getKeyStroke;
-import static net.sf.taverna.t2.workbench.icons.WorkbenchIcons.inputIcon;
+import static org.apache.taverna.workbench.icons.WorkbenchIcons.inputIcon;
 
 import java.awt.event.ActionEvent;
 
 import javax.swing.AbstractAction;
 
-import net.sf.taverna.t2.ui.menu.DesignOnlyAction;
-import net.sf.taverna.t2.workbench.design.actions.AddDataflowInputAction;
-import net.sf.taverna.t2.workbench.edits.EditManager;
-import net.sf.taverna.t2.workbench.selection.SelectionManager;
+import org.apache.taverna.ui.menu.DesignOnlyAction;
+import org.apache.taverna.workbench.design.actions.AddDataflowInputAction;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.selection.SelectionManager;
 import org.apache.taverna.scufl2.api.core.Workflow;
 
 /**

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/actions/AddWFOutputAction.java
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/actions/AddWFOutputAction.java b/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/actions/AddWFOutputAction.java
index 1196de2..72dfc61 100644
--- a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/actions/AddWFOutputAction.java
+++ b/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/actions/AddWFOutputAction.java
@@ -29,11 +29,11 @@ import java.awt.event.ActionEvent;
 
 import javax.swing.AbstractAction;
 
-import net.sf.taverna.t2.ui.menu.DesignOnlyAction;
-import net.sf.taverna.t2.workbench.design.actions.AddDataflowOutputAction;
-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 org.apache.taverna.ui.menu.DesignOnlyAction;
+import org.apache.taverna.workbench.design.actions.AddDataflowOutputAction;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.icons.WorkbenchIcons;
+import org.apache.taverna.workbench.selection.SelectionManager;
 import org.apache.taverna.scufl2.api.core.Workflow;
 
 /**

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/actions/DeleteGraphComponentAction.java
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/actions/DeleteGraphComponentAction.java b/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/actions/DeleteGraphComponentAction.java
index 9ad8e72..3d2736d 100644
--- a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/actions/DeleteGraphComponentAction.java
+++ b/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/actions/DeleteGraphComponentAction.java
@@ -22,7 +22,7 @@ package net.sf.taverna.t2.workbench.views.graph.actions;
 
 import static java.awt.event.KeyEvent.VK_DELETE;
 import static javax.swing.KeyStroke.getKeyStroke;
-import static net.sf.taverna.t2.workbench.icons.WorkbenchIcons.deleteIcon;
+import static org.apache.taverna.workbench.icons.WorkbenchIcons.deleteIcon;
 
 import java.awt.event.ActionEvent;
 import java.util.Set;
@@ -32,18 +32,18 @@ import javax.swing.AbstractAction;
 import org.apache.taverna.lang.observer.Observable;
 import org.apache.taverna.lang.observer.Observer;
 import org.apache.taverna.lang.observer.SwingAwareObserver;
-import net.sf.taverna.t2.ui.menu.DesignOnlyAction;
-import net.sf.taverna.t2.workbench.design.actions.RemoveConditionAction;
-import net.sf.taverna.t2.workbench.design.actions.RemoveDataflowInputPortAction;
-import net.sf.taverna.t2.workbench.design.actions.RemoveDataflowOutputPortAction;
-import net.sf.taverna.t2.workbench.design.actions.RemoveDatalinkAction;
-import net.sf.taverna.t2.workbench.design.actions.RemoveProcessorAction;
-import net.sf.taverna.t2.workbench.edits.EditManager;
-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.SelectionManagerEvent;
-import net.sf.taverna.t2.workbench.selection.events.WorkflowBundleSelectionEvent;
+import org.apache.taverna.ui.menu.DesignOnlyAction;
+import org.apache.taverna.workbench.design.actions.RemoveConditionAction;
+import org.apache.taverna.workbench.design.actions.RemoveDataflowInputPortAction;
+import org.apache.taverna.workbench.design.actions.RemoveDataflowOutputPortAction;
+import org.apache.taverna.workbench.design.actions.RemoveDatalinkAction;
+import org.apache.taverna.workbench.design.actions.RemoveProcessorAction;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.selection.DataflowSelectionModel;
+import org.apache.taverna.workbench.selection.SelectionManager;
+import org.apache.taverna.workbench.selection.events.DataflowSelectionMessage;
+import org.apache.taverna.workbench.selection.events.SelectionManagerEvent;
+import org.apache.taverna.workbench.selection.events.WorkflowBundleSelectionEvent;
 import org.apache.taverna.scufl2.api.container.WorkflowBundle;
 import org.apache.taverna.scufl2.api.core.ControlLink;
 import org.apache.taverna.scufl2.api.core.DataLink;

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/actions/RenameWFInputOutputProcessorAction.java
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/actions/RenameWFInputOutputProcessorAction.java b/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/actions/RenameWFInputOutputProcessorAction.java
index ac3e356..ea7e626 100644
--- a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/actions/RenameWFInputOutputProcessorAction.java
+++ b/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/actions/RenameWFInputOutputProcessorAction.java
@@ -33,17 +33,17 @@ import javax.swing.AbstractAction;
 import org.apache.taverna.lang.observer.Observable;
 import org.apache.taverna.lang.observer.Observer;
 import org.apache.taverna.lang.observer.SwingAwareObserver;
-import net.sf.taverna.t2.ui.menu.DesignOnlyAction;
-import net.sf.taverna.t2.workbench.design.actions.EditDataflowInputPortAction;
-import net.sf.taverna.t2.workbench.design.actions.EditDataflowOutputPortAction;
-import net.sf.taverna.t2.workbench.design.actions.RenameProcessorAction;
-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.SelectionManagerEvent;
-import net.sf.taverna.t2.workbench.selection.events.WorkflowBundleSelectionEvent;
+import org.apache.taverna.ui.menu.DesignOnlyAction;
+import org.apache.taverna.workbench.design.actions.EditDataflowInputPortAction;
+import org.apache.taverna.workbench.design.actions.EditDataflowOutputPortAction;
+import org.apache.taverna.workbench.design.actions.RenameProcessorAction;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.icons.WorkbenchIcons;
+import org.apache.taverna.workbench.selection.DataflowSelectionModel;
+import org.apache.taverna.workbench.selection.SelectionManager;
+import org.apache.taverna.workbench.selection.events.DataflowSelectionMessage;
+import org.apache.taverna.workbench.selection.events.SelectionManagerEvent;
+import org.apache.taverna.workbench.selection.events.WorkflowBundleSelectionEvent;
 import org.apache.taverna.scufl2.api.container.WorkflowBundle;
 import org.apache.taverna.scufl2.api.core.Processor;
 import org.apache.taverna.scufl2.api.port.InputWorkflowPort;

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/config/GraphViewConfiguration.java
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/config/GraphViewConfiguration.java b/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/config/GraphViewConfiguration.java
index b1c3265..1400064 100644
--- a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/config/GraphViewConfiguration.java
+++ b/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/config/GraphViewConfiguration.java
@@ -26,8 +26,8 @@ import java.util.Map;
 import uk.org.taverna.configuration.AbstractConfigurable;
 import uk.org.taverna.configuration.ConfigurationManager;
 
-import net.sf.taverna.t2.workbench.models.graph.Graph.Alignment;
-import net.sf.taverna.t2.workbench.models.graph.GraphController.PortStyle;
+import org.apache.taverna.workbench.models.graph.Graph.Alignment;
+import org.apache.taverna.workbench.models.graph.GraphController.PortStyle;
 
 /**
  * Configuration for the GraphViewComponent.

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/config/GraphViewConfigurationPanel.java
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/config/GraphViewConfigurationPanel.java b/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/config/GraphViewConfigurationPanel.java
index 397ad1b..ff03ce1 100644
--- a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/config/GraphViewConfigurationPanel.java
+++ b/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/config/GraphViewConfigurationPanel.java
@@ -26,12 +26,12 @@ import static java.awt.GridBagConstraints.RELATIVE;
 import static java.awt.GridBagConstraints.REMAINDER;
 import static java.awt.GridBagConstraints.WEST;
 import static javax.swing.SwingConstants.LEFT;
-import static net.sf.taverna.t2.workbench.helper.Helper.showHelp;
-import static net.sf.taverna.t2.workbench.icons.WorkbenchIcons.allportIcon;
-import static net.sf.taverna.t2.workbench.icons.WorkbenchIcons.blobIcon;
-import static net.sf.taverna.t2.workbench.icons.WorkbenchIcons.horizontalIcon;
-import static net.sf.taverna.t2.workbench.icons.WorkbenchIcons.noportIcon;
-import static net.sf.taverna.t2.workbench.icons.WorkbenchIcons.verticalIcon;
+import static org.apache.taverna.workbench.helper.Helper.showHelp;
+import static org.apache.taverna.workbench.icons.WorkbenchIcons.allportIcon;
+import static org.apache.taverna.workbench.icons.WorkbenchIcons.blobIcon;
+import static org.apache.taverna.workbench.icons.WorkbenchIcons.horizontalIcon;
+import static org.apache.taverna.workbench.icons.WorkbenchIcons.noportIcon;
+import static org.apache.taverna.workbench.icons.WorkbenchIcons.verticalIcon;
 import static net.sf.taverna.t2.workbench.views.graph.config.GraphViewConfiguration.ALIGNMENT;
 import static net.sf.taverna.t2.workbench.views.graph.config.GraphViewConfiguration.ANIMATION_ENABLED;
 import static net.sf.taverna.t2.workbench.views.graph.config.GraphViewConfiguration.ANIMATION_SPEED;
@@ -57,8 +57,8 @@ import javax.swing.JSlider;
 import javax.swing.JTextArea;
 import javax.swing.border.EmptyBorder;
 
-import net.sf.taverna.t2.workbench.models.graph.Graph.Alignment;
-import net.sf.taverna.t2.workbench.models.graph.GraphController.PortStyle;
+import org.apache.taverna.workbench.models.graph.Graph.Alignment;
+import org.apache.taverna.workbench.models.graph.GraphController.PortStyle;
 
 /**
  * UI for GraphViewConfiguration.

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/AddWFInputMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/AddWFInputMenuAction.java b/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/AddWFInputMenuAction.java
index 65448c3..41919e2 100644
--- a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/AddWFInputMenuAction.java
+++ b/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/AddWFInputMenuAction.java
@@ -26,9 +26,9 @@ import java.net.URI;
 
 import javax.swing.Action;
 
-import net.sf.taverna.t2.ui.menu.AbstractMenuAction;
-import net.sf.taverna.t2.workbench.edits.EditManager;
-import net.sf.taverna.t2.workbench.selection.SelectionManager;
+import org.apache.taverna.ui.menu.AbstractMenuAction;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.selection.SelectionManager;
 import net.sf.taverna.t2.workbench.views.graph.actions.AddWFInputAction;
 
 /**

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/AddWFOutputMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/AddWFOutputMenuAction.java b/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/AddWFOutputMenuAction.java
index 522c841..b019811 100644
--- a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/AddWFOutputMenuAction.java
+++ b/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/AddWFOutputMenuAction.java
@@ -26,9 +26,9 @@ import java.net.URI;
 
 import javax.swing.Action;
 
-import net.sf.taverna.t2.ui.menu.AbstractMenuAction;
-import net.sf.taverna.t2.workbench.edits.EditManager;
-import net.sf.taverna.t2.workbench.selection.SelectionManager;
+import org.apache.taverna.ui.menu.AbstractMenuAction;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.selection.SelectionManager;
 import net.sf.taverna.t2.workbench.views.graph.actions.AddWFOutputAction;
 
 /**

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/DeleteGraphComponentMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/DeleteGraphComponentMenuAction.java b/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/DeleteGraphComponentMenuAction.java
index 654078f..1cb4a98 100644
--- a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/DeleteGraphComponentMenuAction.java
+++ b/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/DeleteGraphComponentMenuAction.java
@@ -26,9 +26,9 @@ import java.net.URI;
 
 import javax.swing.Action;
 
-import net.sf.taverna.t2.ui.menu.AbstractMenuAction;
-import net.sf.taverna.t2.workbench.edits.EditManager;
-import net.sf.taverna.t2.workbench.selection.SelectionManager;
+import org.apache.taverna.ui.menu.AbstractMenuAction;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.selection.SelectionManager;
 import net.sf.taverna.t2.workbench.views.graph.actions.DeleteGraphComponentAction;
 
 /**

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/DiagramMenu.java
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/DiagramMenu.java b/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/DiagramMenu.java
index 02c71d8..742042c 100644
--- a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/DiagramMenu.java
+++ b/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/DiagramMenu.java
@@ -22,11 +22,11 @@ package net.sf.taverna.t2.workbench.views.graph.menu;
 
 import static java.awt.event.KeyEvent.VK_V;
 import static javax.swing.Action.MNEMONIC_KEY;
-import static net.sf.taverna.t2.ui.menu.DefaultMenuBar.DEFAULT_MENU_BAR;
+import static org.apache.taverna.ui.menu.DefaultMenuBar.DEFAULT_MENU_BAR;
 
 import java.net.URI;
 
-import net.sf.taverna.t2.ui.menu.AbstractMenu;
+import org.apache.taverna.ui.menu.AbstractMenu;
 
 public class DiagramMenu extends AbstractMenu {
 	public static final URI DIAGRAM = URI

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/DiagramSaveMenuSection.java
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/DiagramSaveMenuSection.java b/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/DiagramSaveMenuSection.java
index 5ebb770..593e7c1 100644
--- a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/DiagramSaveMenuSection.java
+++ b/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/DiagramSaveMenuSection.java
@@ -24,7 +24,7 @@ import static net.sf.taverna.t2.workbench.views.graph.menu.DiagramMenu.DIAGRAM;
 
 import java.net.URI;
 
-import net.sf.taverna.t2.ui.menu.AbstractMenuSection;
+import org.apache.taverna.ui.menu.AbstractMenuSection;
 
 /**
  * @author Alex Nenadic

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/DiagramZoomMenuSection.java
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/DiagramZoomMenuSection.java b/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/DiagramZoomMenuSection.java
index 639deee..5330c05 100644
--- a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/DiagramZoomMenuSection.java
+++ b/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/DiagramZoomMenuSection.java
@@ -24,7 +24,7 @@ import static net.sf.taverna.t2.workbench.views.graph.menu.DiagramMenu.DIAGRAM;
 
 import java.net.URI;
 
-import net.sf.taverna.t2.ui.menu.AbstractMenuSection;
+import org.apache.taverna.ui.menu.AbstractMenuSection;
 
 /**
  * @author Alex Nenadic

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/GraphCopyMenuSection.java
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/GraphCopyMenuSection.java b/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/GraphCopyMenuSection.java
index 70cc462..8457bdf 100644
--- a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/GraphCopyMenuSection.java
+++ b/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/GraphCopyMenuSection.java
@@ -24,7 +24,7 @@ import static net.sf.taverna.t2.workbench.views.graph.menu.GraphMenuSection.GRAP
 
 import java.net.URI;
 
-import net.sf.taverna.t2.ui.menu.AbstractMenuSection;
+import org.apache.taverna.ui.menu.AbstractMenuSection;
 
 /**
  * ???

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/GraphDeleteMenuSection.java
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/GraphDeleteMenuSection.java b/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/GraphDeleteMenuSection.java
index 28d2144..f118ece 100644
--- a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/GraphDeleteMenuSection.java
+++ b/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/GraphDeleteMenuSection.java
@@ -24,7 +24,7 @@ import static net.sf.taverna.t2.workbench.views.graph.menu.GraphMenuSection.GRAP
 
 import java.net.URI;
 
-import net.sf.taverna.t2.ui.menu.AbstractMenuSection;
+import org.apache.taverna.ui.menu.AbstractMenuSection;
 
 /**
  * @author Alex Nenadic

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/GraphDetailsMenuSection.java
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/GraphDetailsMenuSection.java b/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/GraphDetailsMenuSection.java
index f2b6af1..e14e6d1 100644
--- a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/GraphDetailsMenuSection.java
+++ b/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/GraphDetailsMenuSection.java
@@ -24,7 +24,7 @@ import static net.sf.taverna.t2.workbench.views.graph.menu.GraphMenuSection.GRAP
 
 import java.net.URI;
 
-import net.sf.taverna.t2.ui.menu.AbstractMenuSection;
+import org.apache.taverna.ui.menu.AbstractMenuSection;
 
 /**
  * @author Alex Nenadic

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/GraphEditMenuSection.java
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/GraphEditMenuSection.java b/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/GraphEditMenuSection.java
index 1a487b1..51eb370 100644
--- a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/GraphEditMenuSection.java
+++ b/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/GraphEditMenuSection.java
@@ -24,7 +24,7 @@ import static net.sf.taverna.t2.workbench.views.graph.menu.GraphMenuSection.GRAP
 
 import java.net.URI;
 
-import net.sf.taverna.t2.ui.menu.AbstractMenuSection;
+import org.apache.taverna.ui.menu.AbstractMenuSection;
 
 /**
  * @author Alex Nenadic

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/GraphMenuSection.java
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/GraphMenuSection.java b/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/GraphMenuSection.java
index 4030d34..e5e3979 100644
--- a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/GraphMenuSection.java
+++ b/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/GraphMenuSection.java
@@ -22,7 +22,7 @@ package net.sf.taverna.t2.workbench.views.graph.menu;
 
 import java.net.URI;
 
-import net.sf.taverna.t2.ui.menu.AbstractMenuSection;
+import org.apache.taverna.ui.menu.AbstractMenuSection;
 
 /**
  * @author Alex Nenadic

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/InsertMenu.java
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/InsertMenu.java b/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/InsertMenu.java
index 9b498e5..556ee53 100644
--- a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/InsertMenu.java
+++ b/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/InsertMenu.java
@@ -5,11 +5,11 @@ package net.sf.taverna.t2.workbench.views.graph.menu;
 
 import static java.awt.event.KeyEvent.VK_I;
 import static javax.swing.Action.MNEMONIC_KEY;
-import static net.sf.taverna.t2.ui.menu.DefaultMenuBar.DEFAULT_MENU_BAR;
+import static org.apache.taverna.ui.menu.DefaultMenuBar.DEFAULT_MENU_BAR;
 
 import java.net.URI;
 
-import net.sf.taverna.t2.ui.menu.AbstractMenu;
+import org.apache.taverna.ui.menu.AbstractMenu;
 
 /**
  * @author alanrw

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/RenameWFInputOutputProcessorMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/RenameWFInputOutputProcessorMenuAction.java b/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/RenameWFInputOutputProcessorMenuAction.java
index 3cf9f66..0e49157 100644
--- a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/RenameWFInputOutputProcessorMenuAction.java
+++ b/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/RenameWFInputOutputProcessorMenuAction.java
@@ -26,9 +26,9 @@ import java.net.URI;
 
 import javax.swing.Action;
 
-import net.sf.taverna.t2.ui.menu.AbstractMenuAction;
-import net.sf.taverna.t2.workbench.edits.EditManager;
-import net.sf.taverna.t2.workbench.selection.SelectionManager;
+import org.apache.taverna.ui.menu.AbstractMenuAction;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.selection.SelectionManager;
 import net.sf.taverna.t2.workbench.views.graph.actions.RenameWFInputOutputProcessorAction;
 
 /**

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/ResetDiagramAction.java
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/ResetDiagramAction.java b/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/ResetDiagramAction.java
index 9fbd452..f3b3928 100644
--- a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/ResetDiagramAction.java
+++ b/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/ResetDiagramAction.java
@@ -23,14 +23,14 @@ package net.sf.taverna.t2.workbench.views.graph.menu;
 import static java.awt.Toolkit.getDefaultToolkit;
 import static java.awt.event.KeyEvent.VK_0;
 import static javax.swing.KeyStroke.getKeyStroke;
-import static net.sf.taverna.t2.workbench.icons.WorkbenchIcons.refreshIcon;
+import static org.apache.taverna.workbench.icons.WorkbenchIcons.refreshIcon;
 
 import java.awt.event.ActionEvent;
 
 import javax.swing.AbstractAction;
 import javax.swing.Action;
 
-import net.sf.taverna.t2.ui.menu.DesignOrResultsAction;
+import org.apache.taverna.ui.menu.DesignOrResultsAction;
 
 @SuppressWarnings("serial")
 public class ResetDiagramAction extends AbstractAction implements

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/ResetDiagramMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/ResetDiagramMenuAction.java b/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/ResetDiagramMenuAction.java
index c4b402e..d99f097 100644
--- a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/ResetDiagramMenuAction.java
+++ b/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/ResetDiagramMenuAction.java
@@ -26,7 +26,7 @@ import java.net.URI;
 
 import javax.swing.Action;
 
-import net.sf.taverna.t2.ui.menu.AbstractMenuAction;
+import org.apache.taverna.ui.menu.AbstractMenuAction;
 
 /**
  * An action that zooms a diagram image

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/SaveGraphImageSubMenu.java
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/SaveGraphImageSubMenu.java b/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/SaveGraphImageSubMenu.java
index 14a8445..360500f 100644
--- a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/SaveGraphImageSubMenu.java
+++ b/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/SaveGraphImageSubMenu.java
@@ -47,22 +47,22 @@ import javax.swing.JMenu;
 import javax.swing.JMenuItem;
 import javax.swing.JOptionPane;
 
-import net.sf.taverna.t2.lang.io.StreamCopier;
-import net.sf.taverna.t2.lang.io.StreamDevourer;
+import org.apache.taverna.lang.io.StreamCopier;
+import org.apache.taverna.lang.io.StreamDevourer;
 import org.apache.taverna.lang.observer.Observable;
 import org.apache.taverna.lang.observer.SwingAwareObserver;
-import net.sf.taverna.t2.lang.ui.ExtensionFileFilter;
-import net.sf.taverna.t2.ui.menu.AbstractMenuCustom;
-import net.sf.taverna.t2.ui.menu.DesignOnlyAction;
-import net.sf.taverna.t2.workbench.configuration.workbench.WorkbenchConfiguration;
-import net.sf.taverna.t2.workbench.file.FileManager;
-import net.sf.taverna.t2.workbench.icons.WorkbenchIcons;
-import net.sf.taverna.t2.workbench.models.graph.DotWriter;
-import net.sf.taverna.t2.workbench.models.graph.GraphController;
-import net.sf.taverna.t2.workbench.models.graph.svg.SVGUtil;
-import net.sf.taverna.t2.workbench.selection.SelectionManager;
-import net.sf.taverna.t2.workbench.selection.events.PerspectiveSelectionEvent;
-import net.sf.taverna.t2.workbench.selection.events.SelectionManagerEvent;
+import org.apache.taverna.lang.ui.ExtensionFileFilter;
+import org.apache.taverna.ui.menu.AbstractMenuCustom;
+import org.apache.taverna.ui.menu.DesignOnlyAction;
+import org.apache.taverna.workbench.configuration.workbench.WorkbenchConfiguration;
+import org.apache.taverna.workbench.file.FileManager;
+import org.apache.taverna.workbench.icons.WorkbenchIcons;
+import org.apache.taverna.workbench.models.graph.DotWriter;
+import org.apache.taverna.workbench.models.graph.GraphController;
+import org.apache.taverna.workbench.models.graph.svg.SVGUtil;
+import org.apache.taverna.workbench.selection.SelectionManager;
+import org.apache.taverna.workbench.selection.events.PerspectiveSelectionEvent;
+import org.apache.taverna.workbench.selection.events.SelectionManagerEvent;
 import net.sf.taverna.t2.workbench.views.graph.GraphViewComponent;
 
 import org.apache.log4j.Logger;

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/ZoomInAction.java
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/ZoomInAction.java b/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/ZoomInAction.java
index b8735c9..55ee8ff 100644
--- a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/ZoomInAction.java
+++ b/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/ZoomInAction.java
@@ -23,14 +23,14 @@ package net.sf.taverna.t2.workbench.views.graph.menu;
 import static java.awt.Toolkit.getDefaultToolkit;
 import static java.awt.event.KeyEvent.VK_EQUALS;
 import static javax.swing.KeyStroke.getKeyStroke;
-import static net.sf.taverna.t2.workbench.icons.WorkbenchIcons.zoomInIcon;
+import static org.apache.taverna.workbench.icons.WorkbenchIcons.zoomInIcon;
 
 import java.awt.event.ActionEvent;
 
 import javax.swing.AbstractAction;
 import javax.swing.Action;
 
-import net.sf.taverna.t2.ui.menu.DesignOrResultsAction;
+import org.apache.taverna.ui.menu.DesignOrResultsAction;
 
 import org.apache.log4j.Logger;
 

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/ZoomInMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/ZoomInMenuAction.java b/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/ZoomInMenuAction.java
index 89eea7d..82ab39b 100644
--- a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/ZoomInMenuAction.java
+++ b/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/ZoomInMenuAction.java
@@ -26,7 +26,7 @@ import java.net.URI;
 
 import javax.swing.Action;
 
-import net.sf.taverna.t2.ui.menu.AbstractMenuAction;
+import org.apache.taverna.ui.menu.AbstractMenuAction;
 
 /**
  * An action that zooms a diagram image

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/ZoomOutAction.java
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/ZoomOutAction.java b/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/ZoomOutAction.java
index bd2a2b9..4dd769e 100644
--- a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/ZoomOutAction.java
+++ b/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/ZoomOutAction.java
@@ -29,8 +29,8 @@ import java.awt.event.ActionEvent;
 import javax.swing.AbstractAction;
 import javax.swing.Action;
 
-import net.sf.taverna.t2.ui.menu.DesignOrResultsAction;
-import net.sf.taverna.t2.workbench.icons.WorkbenchIcons;
+import org.apache.taverna.ui.menu.DesignOrResultsAction;
+import org.apache.taverna.workbench.icons.WorkbenchIcons;
 
 @SuppressWarnings("serial")
 public class ZoomOutAction extends AbstractAction implements

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/ZoomOutMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/ZoomOutMenuAction.java b/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/ZoomOutMenuAction.java
index bc34252..1b68a1d 100644
--- a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/ZoomOutMenuAction.java
+++ b/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/ZoomOutMenuAction.java
@@ -26,7 +26,7 @@ import java.net.URI;
 
 import javax.swing.Action;
 
-import net.sf.taverna.t2.ui.menu.AbstractMenuAction;
+import org.apache.taverna.ui.menu.AbstractMenuAction;
 
 /**
  * An action that zooms a diagram image

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/toolbar/AddWFInputToolbarAction.java
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/toolbar/AddWFInputToolbarAction.java b/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/toolbar/AddWFInputToolbarAction.java
index 736ba8d..d408bbd 100644
--- a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/toolbar/AddWFInputToolbarAction.java
+++ b/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/toolbar/AddWFInputToolbarAction.java
@@ -26,9 +26,9 @@ import java.net.URI;
 
 import javax.swing.Action;
 
-import net.sf.taverna.t2.ui.menu.AbstractMenuAction;
-import net.sf.taverna.t2.workbench.edits.EditManager;
-import net.sf.taverna.t2.workbench.selection.SelectionManager;
+import org.apache.taverna.ui.menu.AbstractMenuAction;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.selection.SelectionManager;
 import net.sf.taverna.t2.workbench.views.graph.actions.AddWFInputAction;
 
 /**

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/toolbar/AddWFOutputToolbarAction.java
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/toolbar/AddWFOutputToolbarAction.java b/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/toolbar/AddWFOutputToolbarAction.java
index ae7d5d0..09f94d3 100644
--- a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/toolbar/AddWFOutputToolbarAction.java
+++ b/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/toolbar/AddWFOutputToolbarAction.java
@@ -26,9 +26,9 @@ import java.net.URI;
 
 import javax.swing.Action;
 
-import net.sf.taverna.t2.ui.menu.AbstractMenuAction;
-import net.sf.taverna.t2.workbench.edits.EditManager;
-import net.sf.taverna.t2.workbench.selection.SelectionManager;
+import org.apache.taverna.ui.menu.AbstractMenuAction;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.selection.SelectionManager;
 import net.sf.taverna.t2.workbench.views.graph.actions.AddWFOutputAction;
 
 /**

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/toolbar/DeleteGraphComponentToolbarAction.java
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/toolbar/DeleteGraphComponentToolbarAction.java b/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/toolbar/DeleteGraphComponentToolbarAction.java
index 068c530..9fc472e 100644
--- a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/toolbar/DeleteGraphComponentToolbarAction.java
+++ b/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/toolbar/DeleteGraphComponentToolbarAction.java
@@ -26,9 +26,9 @@ import java.net.URI;
 
 import javax.swing.Action;
 
-import net.sf.taverna.t2.ui.menu.AbstractMenuAction;
-import net.sf.taverna.t2.workbench.edits.EditManager;
-import net.sf.taverna.t2.workbench.selection.SelectionManager;
+import org.apache.taverna.ui.menu.AbstractMenuAction;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.selection.SelectionManager;
 import net.sf.taverna.t2.workbench.views.graph.actions.DeleteGraphComponentAction;
 
 /**

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/toolbar/GraphDeleteToolbarSection.java
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/toolbar/GraphDeleteToolbarSection.java b/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/toolbar/GraphDeleteToolbarSection.java
index 794cf1f..78d510b 100644
--- a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/toolbar/GraphDeleteToolbarSection.java
+++ b/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/toolbar/GraphDeleteToolbarSection.java
@@ -20,11 +20,11 @@
  ******************************************************************************/
 package net.sf.taverna.t2.workbench.views.graph.toolbar;
 
-import static net.sf.taverna.t2.ui.menu.DefaultToolBar.DEFAULT_TOOL_BAR;
+import static org.apache.taverna.ui.menu.DefaultToolBar.DEFAULT_TOOL_BAR;
 
 import java.net.URI;
 
-import net.sf.taverna.t2.ui.menu.AbstractMenuSection;
+import org.apache.taverna.ui.menu.AbstractMenuSection;
 
 /**
  * @author Alex Nenadic

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/toolbar/GraphEditToolbarSection.java
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/toolbar/GraphEditToolbarSection.java b/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/toolbar/GraphEditToolbarSection.java
index a61259a..7a06acc 100644
--- a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/toolbar/GraphEditToolbarSection.java
+++ b/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/toolbar/GraphEditToolbarSection.java
@@ -20,11 +20,11 @@
  ******************************************************************************/
 package net.sf.taverna.t2.workbench.views.graph.toolbar;
 
-import static net.sf.taverna.t2.ui.menu.DefaultToolBar.DEFAULT_TOOL_BAR;
+import static org.apache.taverna.ui.menu.DefaultToolBar.DEFAULT_TOOL_BAR;
 
 import java.net.URI;
 
-import net.sf.taverna.t2.ui.menu.AbstractMenuSection;
+import org.apache.taverna.ui.menu.AbstractMenuSection;
 
 /**
  * @author Alex Nenadic

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/toolbar/RenameWFInputOutputProcessorToolbarAction.java
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/toolbar/RenameWFInputOutputProcessorToolbarAction.java b/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/toolbar/RenameWFInputOutputProcessorToolbarAction.java
index 1794e8f..4a55db8 100644
--- a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/toolbar/RenameWFInputOutputProcessorToolbarAction.java
+++ b/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/toolbar/RenameWFInputOutputProcessorToolbarAction.java
@@ -26,9 +26,9 @@ import java.net.URI;
 
 import javax.swing.Action;
 
-import net.sf.taverna.t2.ui.menu.AbstractMenuAction;
-import net.sf.taverna.t2.workbench.edits.EditManager;
-import net.sf.taverna.t2.workbench.selection.SelectionManager;
+import org.apache.taverna.ui.menu.AbstractMenuAction;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.selection.SelectionManager;
 import net.sf.taverna.t2.workbench.views.graph.actions.RenameWFInputOutputProcessorAction;
 
 /**

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-graph-view/src/main/resources/META-INF/services/net.sf.taverna.t2.ui.menu.MenuComponent
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/main/resources/META-INF/services/net.sf.taverna.t2.ui.menu.MenuComponent b/taverna-graph-view/src/main/resources/META-INF/services/net.sf.taverna.t2.ui.menu.MenuComponent
deleted file mode 100644
index 226078d..0000000
--- a/taverna-graph-view/src/main/resources/META-INF/services/net.sf.taverna.t2.ui.menu.MenuComponent
+++ /dev/null
@@ -1,29 +0,0 @@
-net.sf.taverna.t2.workbench.views.graph.toolbar.GraphEditToolbarSection
-net.sf.taverna.t2.workbench.views.graph.toolbar.GraphDeleteToolbarSection
-net.sf.taverna.t2.workbench.views.graph.toolbar.GraphSaveToolbarSection
-net.sf.taverna.t2.workbench.views.graph.toolbar.AddWFInputToolbarAction
-net.sf.taverna.t2.workbench.views.graph.toolbar.AddWFOutputToolbarAction
-net.sf.taverna.t2.workbench.views.graph.toolbar.RenameWFInputOutputProcessorToolbarAction
-net.sf.taverna.t2.workbench.views.graph.toolbar.DeleteGraphComponentToolbarAction
-net.sf.taverna.t2.workbench.views.graph.toolbar.SaveGraphImageToolbarAction
-
-net.sf.taverna.t2.workbench.views.graph.menu.DiagramMenu
-net.sf.taverna.t2.workbench.views.graph.menu.DiagramSaveMenuSection
-net.sf.taverna.t2.workbench.views.graph.menu.DiagramZoomMenuSection
-
-net.sf.taverna.t2.workbench.views.graph.menu.GraphMenuSection
-net.sf.taverna.t2.workbench.views.graph.menu.GraphCopyMenuSection
-net.sf.taverna.t2.workbench.views.graph.menu.GraphEditMenuSection
-net.sf.taverna.t2.workbench.views.graph.menu.GraphDeleteMenuSection
-net.sf.taverna.t2.workbench.views.graph.menu.GraphDetailsMenuSection
-
-net.sf.taverna.t2.workbench.views.graph.menu.InsertMenu
-
-net.sf.taverna.t2.workbench.views.graph.menu.AddWFInputMenuAction
-net.sf.taverna.t2.workbench.views.graph.menu.AddWFOutputMenuAction
-net.sf.taverna.t2.workbench.views.graph.menu.RenameWFInputOutputProcessorMenuAction
-net.sf.taverna.t2.workbench.views.graph.menu.DeleteGraphComponentMenuAction
-net.sf.taverna.t2.workbench.views.graph.menu.SaveGraphImageSubMenu
-net.sf.taverna.t2.workbench.views.graph.menu.ZoomInMenuAction
-net.sf.taverna.t2.workbench.views.graph.menu.ZoomOutMenuAction
-net.sf.taverna.t2.workbench.views.graph.menu.ResetDiagramMenuAction
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-graph-view/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.configuration.ConfigurationUIFactory
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.configuration.ConfigurationUIFactory b/taverna-graph-view/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.configuration.ConfigurationUIFactory
deleted file mode 100644
index 70830ec..0000000
--- a/taverna-graph-view/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.configuration.ConfigurationUIFactory
+++ /dev/null
@@ -1 +0,0 @@
-net.sf.taverna.t2.workbench.views.graph.config.GraphViewConfigurationUIFactory

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-graph-view/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.ui.zaria.UIComponentFactorySPI
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.ui.zaria.UIComponentFactorySPI b/taverna-graph-view/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.ui.zaria.UIComponentFactorySPI
deleted file mode 100644
index 8086a8d..0000000
--- a/taverna-graph-view/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.ui.zaria.UIComponentFactorySPI
+++ /dev/null
@@ -1 +0,0 @@
-net.sf.taverna.t2.workbench.views.graph.GraphViewComponentFactory
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-graph-view/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.ui.zaria.UIComponentSPI
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.ui.zaria.UIComponentSPI b/taverna-graph-view/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.ui.zaria.UIComponentSPI
deleted file mode 100644
index 563c21d..0000000
--- a/taverna-graph-view/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.ui.zaria.UIComponentSPI
+++ /dev/null
@@ -1 +0,0 @@
-net.sf.taverna.t2.workbench.views.graph.GraphViewComponent

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-graph-view/src/main/resources/META-INF/services/org.apache.taverna.ui.menu.MenuComponent
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/main/resources/META-INF/services/org.apache.taverna.ui.menu.MenuComponent b/taverna-graph-view/src/main/resources/META-INF/services/org.apache.taverna.ui.menu.MenuComponent
new file mode 100644
index 0000000..226078d
--- /dev/null
+++ b/taverna-graph-view/src/main/resources/META-INF/services/org.apache.taverna.ui.menu.MenuComponent
@@ -0,0 +1,29 @@
+net.sf.taverna.t2.workbench.views.graph.toolbar.GraphEditToolbarSection
+net.sf.taverna.t2.workbench.views.graph.toolbar.GraphDeleteToolbarSection
+net.sf.taverna.t2.workbench.views.graph.toolbar.GraphSaveToolbarSection
+net.sf.taverna.t2.workbench.views.graph.toolbar.AddWFInputToolbarAction
+net.sf.taverna.t2.workbench.views.graph.toolbar.AddWFOutputToolbarAction
+net.sf.taverna.t2.workbench.views.graph.toolbar.RenameWFInputOutputProcessorToolbarAction
+net.sf.taverna.t2.workbench.views.graph.toolbar.DeleteGraphComponentToolbarAction
+net.sf.taverna.t2.workbench.views.graph.toolbar.SaveGraphImageToolbarAction
+
+net.sf.taverna.t2.workbench.views.graph.menu.DiagramMenu
+net.sf.taverna.t2.workbench.views.graph.menu.DiagramSaveMenuSection
+net.sf.taverna.t2.workbench.views.graph.menu.DiagramZoomMenuSection
+
+net.sf.taverna.t2.workbench.views.graph.menu.GraphMenuSection
+net.sf.taverna.t2.workbench.views.graph.menu.GraphCopyMenuSection
+net.sf.taverna.t2.workbench.views.graph.menu.GraphEditMenuSection
+net.sf.taverna.t2.workbench.views.graph.menu.GraphDeleteMenuSection
+net.sf.taverna.t2.workbench.views.graph.menu.GraphDetailsMenuSection
+
+net.sf.taverna.t2.workbench.views.graph.menu.InsertMenu
+
+net.sf.taverna.t2.workbench.views.graph.menu.AddWFInputMenuAction
+net.sf.taverna.t2.workbench.views.graph.menu.AddWFOutputMenuAction
+net.sf.taverna.t2.workbench.views.graph.menu.RenameWFInputOutputProcessorMenuAction
+net.sf.taverna.t2.workbench.views.graph.menu.DeleteGraphComponentMenuAction
+net.sf.taverna.t2.workbench.views.graph.menu.SaveGraphImageSubMenu
+net.sf.taverna.t2.workbench.views.graph.menu.ZoomInMenuAction
+net.sf.taverna.t2.workbench.views.graph.menu.ZoomOutMenuAction
+net.sf.taverna.t2.workbench.views.graph.menu.ResetDiagramMenuAction
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-graph-view/src/main/resources/META-INF/services/org.apache.taverna.workbench.configuration.ConfigurationUIFactory
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/main/resources/META-INF/services/org.apache.taverna.workbench.configuration.ConfigurationUIFactory b/taverna-graph-view/src/main/resources/META-INF/services/org.apache.taverna.workbench.configuration.ConfigurationUIFactory
new file mode 100644
index 0000000..70830ec
--- /dev/null
+++ b/taverna-graph-view/src/main/resources/META-INF/services/org.apache.taverna.workbench.configuration.ConfigurationUIFactory
@@ -0,0 +1 @@
+net.sf.taverna.t2.workbench.views.graph.config.GraphViewConfigurationUIFactory

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-graph-view/src/main/resources/META-INF/services/org.apache.taverna.workbench.ui.zaria.UIComponentFactorySPI
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/main/resources/META-INF/services/org.apache.taverna.workbench.ui.zaria.UIComponentFactorySPI b/taverna-graph-view/src/main/resources/META-INF/services/org.apache.taverna.workbench.ui.zaria.UIComponentFactorySPI
new file mode 100644
index 0000000..8086a8d
--- /dev/null
+++ b/taverna-graph-view/src/main/resources/META-INF/services/org.apache.taverna.workbench.ui.zaria.UIComponentFactorySPI
@@ -0,0 +1 @@
+net.sf.taverna.t2.workbench.views.graph.GraphViewComponentFactory
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-graph-view/src/main/resources/META-INF/services/org.apache.taverna.workbench.ui.zaria.UIComponentSPI
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/main/resources/META-INF/services/org.apache.taverna.workbench.ui.zaria.UIComponentSPI b/taverna-graph-view/src/main/resources/META-INF/services/org.apache.taverna.workbench.ui.zaria.UIComponentSPI
new file mode 100644
index 0000000..563c21d
--- /dev/null
+++ b/taverna-graph-view/src/main/resources/META-INF/services/org.apache.taverna.workbench.ui.zaria.UIComponentSPI
@@ -0,0 +1 @@
+net.sf.taverna.t2.workbench.views.graph.GraphViewComponent

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-graph-view/src/main/resources/META-INF/spring/graph-view-context-osgi.xml
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/main/resources/META-INF/spring/graph-view-context-osgi.xml b/taverna-graph-view/src/main/resources/META-INF/spring/graph-view-context-osgi.xml
index c7adec0..c6d5620 100644
--- a/taverna-graph-view/src/main/resources/META-INF/spring/graph-view-context-osgi.xml
+++ b/taverna-graph-view/src/main/resources/META-INF/spring/graph-view-context-osgi.xml
@@ -8,7 +8,7 @@
 
 	<service ref="GraphViewConfigurationUIFactory" interface="uk.org.taverna.configuration.ConfigurationUIFactory" />
 
-	<service ref="GraphViewComponentFactory" interface="net.sf.taverna.t2.workbench.ui.zaria.UIComponentFactorySPI" />
+	<service ref="GraphViewComponentFactory" interface="org.apache.taverna.workbench.ui.zaria.UIComponentFactorySPI" />
 
 	<service ref="GraphEditToolbarSection" auto-export="interfaces" />
 	<service ref="GraphDeleteToolbarSection" auto-export="interfaces" />
@@ -34,12 +34,12 @@
 	<service ref="ZoomOutMenuAction" auto-export="interfaces" />
 	<service ref="ResetDiagramMenuAction" auto-export="interfaces" />
 
-	<reference id="editManager" interface="net.sf.taverna.t2.workbench.edits.EditManager" />
-	<reference id="fileManager" interface="net.sf.taverna.t2.workbench.file.FileManager" />
-	<reference id="menuManager" interface="net.sf.taverna.t2.ui.menu.MenuManager" />
-	<reference id="selectionManager" interface="net.sf.taverna.t2.workbench.selection.SelectionManager" />
-	<reference id="colourManager" interface="net.sf.taverna.t2.workbench.configuration.colour.ColourManager" />
-	<reference id="workbenchConfiguration" interface="net.sf.taverna.t2.workbench.configuration.workbench.WorkbenchConfiguration" />
+	<reference id="editManager" interface="org.apache.taverna.workbench.edits.EditManager" />
+	<reference id="fileManager" interface="org.apache.taverna.workbench.file.FileManager" />
+	<reference id="menuManager" interface="org.apache.taverna.ui.menu.MenuManager" />
+	<reference id="selectionManager" interface="org.apache.taverna.workbench.selection.SelectionManager" />
+	<reference id="colourManager" interface="org.apache.taverna.workbench.configuration.colour.ColourManager" />
+	<reference id="workbenchConfiguration" interface="org.apache.taverna.workbench.configuration.workbench.WorkbenchConfiguration" />
 	<reference id="configurationManager" interface="uk.org.taverna.configuration.ConfigurationManager" />
 	<reference id="serviceRegistry" interface="uk.org.taverna.commons.services.ServiceRegistry" />
 

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-graph-view/src/main/resources/META-INF/spring/graph-view-context.xml
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/main/resources/META-INF/spring/graph-view-context.xml b/taverna-graph-view/src/main/resources/META-INF/spring/graph-view-context.xml
index 9968805..aaca21b 100644
--- a/taverna-graph-view/src/main/resources/META-INF/spring/graph-view-context.xml
+++ b/taverna-graph-view/src/main/resources/META-INF/spring/graph-view-context.xml
@@ -5,18 +5,18 @@
                       http://www.springframework.org/schema/beans/spring-beans.xsd">
 
 	<bean id="graphViewConfiguration"
-		class="net.sf.taverna.t2.workbench.views.graph.config.GraphViewConfiguration">
+		class="org.apache.taverna.workbench.views.graph.config.GraphViewConfiguration">
 		<constructor-arg name="configurationManager" ref="configurationManager" />
 	</bean>
 
 	<bean id="GraphViewConfigurationUIFactory"
-		class="net.sf.taverna.t2.workbench.views.graph.config.GraphViewConfigurationUIFactory">
+		class="org.apache.taverna.workbench.views.graph.config.GraphViewConfigurationUIFactory">
 		<property name="graphViewConfiguration">
 			<ref local="graphViewConfiguration" />
 		</property>
 	</bean>
 
-	<bean id="GraphViewComponentFactory" class="net.sf.taverna.t2.workbench.views.graph.GraphViewComponentFactory">
+	<bean id="GraphViewComponentFactory" class="org.apache.taverna.workbench.views.graph.GraphViewComponentFactory">
 		<property name="colourManager" ref="colourManager" />
 		<property name="editManager" ref="editManager" />
 		<property name="menuManager" ref="menuManager" />
@@ -30,78 +30,78 @@
 	</bean>
 
 	<bean id="GraphEditToolbarSection"
-		class="net.sf.taverna.t2.workbench.views.graph.toolbar.GraphEditToolbarSection" />
+		class="org.apache.taverna.workbench.views.graph.toolbar.GraphEditToolbarSection" />
 	<bean id="GraphDeleteToolbarSection"
-		class="net.sf.taverna.t2.workbench.views.graph.toolbar.GraphDeleteToolbarSection" />
+		class="org.apache.taverna.workbench.views.graph.toolbar.GraphDeleteToolbarSection" />
 	<bean id="AddWFInputToolbarAction"
-		class="net.sf.taverna.t2.workbench.views.graph.toolbar.AddWFInputToolbarAction">
+		class="org.apache.taverna.workbench.views.graph.toolbar.AddWFInputToolbarAction">
 		<property name="editManager" ref="editManager" />
 		<property name="selectionManager" ref="selectionManager" />
 	</bean>
 	<bean id="AddWFOutputToolbarAction"
-		class="net.sf.taverna.t2.workbench.views.graph.toolbar.AddWFOutputToolbarAction">
+		class="org.apache.taverna.workbench.views.graph.toolbar.AddWFOutputToolbarAction">
 		<property name="editManager" ref="editManager" />
 		<property name="selectionManager" ref="selectionManager" />
 	</bean>
 	<bean id="RenameWFInputOutputProcessorToolbarAction"
-		class="net.sf.taverna.t2.workbench.views.graph.toolbar.RenameWFInputOutputProcessorToolbarAction">
+		class="org.apache.taverna.workbench.views.graph.toolbar.RenameWFInputOutputProcessorToolbarAction">
 		<property name="editManager" ref="editManager" />
 		<property name="selectionManager" ref="selectionManager" />
 	</bean>
 	<bean id="DeleteGraphComponentToolbarAction"
-		class="net.sf.taverna.t2.workbench.views.graph.toolbar.DeleteGraphComponentToolbarAction">
+		class="org.apache.taverna.workbench.views.graph.toolbar.DeleteGraphComponentToolbarAction">
 		<property name="editManager" ref="editManager" />
 		<property name="selectionManager" ref="selectionManager" />
 	</bean>
 	<bean id="DiagramMenu"
-		class="net.sf.taverna.t2.workbench.views.graph.menu.DiagramMenu" />
+		class="org.apache.taverna.workbench.views.graph.menu.DiagramMenu" />
 	<bean id="DiagramSaveMenuSection"
-		class="net.sf.taverna.t2.workbench.views.graph.menu.DiagramSaveMenuSection" />
+		class="org.apache.taverna.workbench.views.graph.menu.DiagramSaveMenuSection" />
 	<bean id="DiagramZoomMenuSection"
-		class="net.sf.taverna.t2.workbench.views.graph.menu.DiagramZoomMenuSection" />
+		class="org.apache.taverna.workbench.views.graph.menu.DiagramZoomMenuSection" />
 	<bean id="GraphMenuSection"
-		class="net.sf.taverna.t2.workbench.views.graph.menu.GraphMenuSection" />
+		class="org.apache.taverna.workbench.views.graph.menu.GraphMenuSection" />
 	<bean id="GraphCopyMenuSection"
-		class="net.sf.taverna.t2.workbench.views.graph.menu.GraphCopyMenuSection" />
+		class="org.apache.taverna.workbench.views.graph.menu.GraphCopyMenuSection" />
 	<bean id="GraphEditMenuSection"
-		class="net.sf.taverna.t2.workbench.views.graph.menu.GraphEditMenuSection" />
+		class="org.apache.taverna.workbench.views.graph.menu.GraphEditMenuSection" />
 	<bean id="GraphDeleteMenuSection"
-		class="net.sf.taverna.t2.workbench.views.graph.menu.GraphDeleteMenuSection" />
+		class="org.apache.taverna.workbench.views.graph.menu.GraphDeleteMenuSection" />
 	<bean id="GraphDetailsMenuSection"
-		class="net.sf.taverna.t2.workbench.views.graph.menu.GraphDetailsMenuSection" />
-	<bean id="InsertMenu" class="net.sf.taverna.t2.workbench.views.graph.menu.InsertMenu" />
+		class="org.apache.taverna.workbench.views.graph.menu.GraphDetailsMenuSection" />
+	<bean id="InsertMenu" class="org.apache.taverna.workbench.views.graph.menu.InsertMenu" />
 	<bean id="AddWFInputMenuAction"
-		class="net.sf.taverna.t2.workbench.views.graph.menu.AddWFInputMenuAction">
+		class="org.apache.taverna.workbench.views.graph.menu.AddWFInputMenuAction">
 		<property name="editManager" ref="editManager" />
 		<property name="selectionManager" ref="selectionManager" />
 	</bean>
 	<bean id="AddWFOutputMenuAction"
-		class="net.sf.taverna.t2.workbench.views.graph.menu.AddWFOutputMenuAction">
+		class="org.apache.taverna.workbench.views.graph.menu.AddWFOutputMenuAction">
 		<property name="editManager" ref="editManager" />
 		<property name="selectionManager" ref="selectionManager" />
 	</bean>
 	<bean id="RenameWFInputOutputProcessorMenuAction"
-		class="net.sf.taverna.t2.workbench.views.graph.menu.RenameWFInputOutputProcessorMenuAction">
+		class="org.apache.taverna.workbench.views.graph.menu.RenameWFInputOutputProcessorMenuAction">
 		<property name="editManager" ref="editManager" />
 		<property name="selectionManager" ref="selectionManager" />
 	</bean>
 	<bean id="DeleteGraphComponentMenuAction"
-		class="net.sf.taverna.t2.workbench.views.graph.menu.DeleteGraphComponentMenuAction">
+		class="org.apache.taverna.workbench.views.graph.menu.DeleteGraphComponentMenuAction">
 		<property name="editManager" ref="editManager" />
 		<property name="selectionManager" ref="selectionManager" />
 	</bean>
 	<!-- <bean id="SaveGraphImageSubMenu"
-		class="net.sf.taverna.t2.workbench.views.graph.menu.SaveGraphImageSubMenu">
+		class="org.apache.taverna.workbench.views.graph.menu.SaveGraphImageSubMenu">
 		<property name="fileManager" ref="fileManager" />
 		<property name="workbenchConfiguration" ref="workbenchConfiguration" />
 		<property name="selectionManager" ref="selectionManager" />
 		<property name="graphViewComponent" ref="GraphViewComponent" />
 	</bean> -->
 	<bean id="ZoomInMenuAction"
-		class="net.sf.taverna.t2.workbench.views.graph.menu.ZoomInMenuAction" />
+		class="org.apache.taverna.workbench.views.graph.menu.ZoomInMenuAction" />
 	<bean id="ZoomOutMenuAction"
-		class="net.sf.taverna.t2.workbench.views.graph.menu.ZoomOutMenuAction" />
+		class="org.apache.taverna.workbench.views.graph.menu.ZoomOutMenuAction" />
 	<bean id="ResetDiagramMenuAction"
-		class="net.sf.taverna.t2.workbench.views.graph.menu.ResetDiagramMenuAction" />
+		class="org.apache.taverna.workbench.views.graph.menu.ResetDiagramMenuAction" />
 
 </beans>

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-helper-api/src/main/java/net/sf/taverna/t2/workbench/helper/HelpCollator.java
----------------------------------------------------------------------
diff --git a/taverna-helper-api/src/main/java/net/sf/taverna/t2/workbench/helper/HelpCollator.java b/taverna-helper-api/src/main/java/net/sf/taverna/t2/workbench/helper/HelpCollator.java
deleted file mode 100644
index 8b19b69..0000000
--- a/taverna-helper-api/src/main/java/net/sf/taverna/t2/workbench/helper/HelpCollator.java
+++ /dev/null
@@ -1,307 +0,0 @@
-package net.sf.taverna.t2.workbench.helper;
-
-import java.awt.Component;
-import java.io.IOException;
-import java.net.HttpURLConnection;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.MissingResourceException;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import javax.help.BadIDException;
-import javax.help.HelpSet;
-import javax.help.HelpSetException;
-import javax.help.Map.ID;
-import javax.help.TryMap;
-import javax.swing.JTree;
-import javax.swing.tree.DefaultMutableTreeNode;
-import javax.swing.tree.TreePath;
-
-import org.apache.log4j.Logger;
-
-/**
- * This class loads the {@link HelpSet} and also deals with the registration of
- * ids and the decoding from a {@link Component} to the corresponding id. These
- * two sets of functionality should possibly be separated.
- * 
- * @author alanrw
- */
-// TODO Convert to a bean
-public final class HelpCollator {
-	private static Logger logger = Logger.getLogger(HelpCollator.class);
-	/**
-	 * The HelpSet that is being used.
-	 */
-	private static HelpSet hs = null;
-	/**
-	 * The mapping from components to ids. This is used because of problems with
-	 * CSH throwing exceptions because it tried to use ids that were not in the
-	 * map.
-	 */
-	private static Map<Component, String> idMap;
-	/**
-	 * Indicates whether the HelpCollator has been initialized.
-	 */
-	private static boolean initialized = false;
-	/**
-	 * A Pattern for normalizing the ids.
-	 */
-	private static Pattern nonAlphanumeric;
-	/**
-	 * The emptyHelp is set if the HelpCollator was unable to read the
-	 */
-	private static boolean emptyHelp = true;
-	private static int TIMEOUT = 5000;
-
-	private static String externalHelpSetURL = "http://www.mygrid.org.uk/taverna/helpset/"
-			+ version() + "/helpset.hs";
-
-	// private static Profile profile = ProfileFactory.getInstance().getProfile();
-	private static String version() {
-		return "NO-VERSION";//profile.getVersion();
-		// TODO find a better way to find the version
-	}
-
-	/**
-	 * Attempt to read the up-to-date HelpSet from the web
-	 */
-	private static void readExternalHelpSet() {
-		try {
-			URL url = new URL(externalHelpSetURL);
-			checkConnection(url);
-			hs = new HelpSet(null, url);
-			if (hs.getLocalMap() == null) {
-			    hs = null;
-				logger.error("Helpset from " + externalHelpSetURL
-						+ " local map was null");
-			} else
-				logger.info("Read external help set from " + externalHelpSetURL);
-		} catch (MissingResourceException e) {
-		    logger.error("No external HelpSet URL specified", e);
-		} catch (MalformedURLException e) {
-		    logger.error("External HelpSet URL is malformed", e);
-		} catch (HelpSetException e) {
-		    logger.error("External HelpSet could not be read", e);
-		} catch (IOException e) {
-			logger.error("IOException reading External HelpSet", e);
-		}
-	}
-
-	private static void checkConnection(URL url) throws IOException {
-		if (!url.getProtocol().startsWith("http"))
-			return;
-		HttpURLConnection connection = (HttpURLConnection) url.openConnection();
-		connection.setReadTimeout(TIMEOUT);
-		connection.setConnectTimeout(TIMEOUT);
-		connection.setRequestMethod("HEAD");
-		connection.getInputStream().close();
-		connection.disconnect();
-	}
-
-	/**
-	 * This methods creates a HelpSet based upon, in priority, the external
-	 * HelpSet, then a newly created empty HelpSet.
-	 */
-	private static void initialize() {
-		if (initialized)
-			return;
-		readExternalHelpSet();
-		if (hs == null) {
-			hs = new HelpSet();
-			hs.setLocalMap(new TryMap());
-		} else {
-			logger.trace("EmptyHelp set to false");
-			emptyHelp = false;
-		}
-		idMap = new HashMap<>();
-		nonAlphanumeric = Pattern.compile("[^a-z0-9\\.]");
-		initialized = true;
-	}
-
-	/**
-	 * Indicates if an empty HelpSet is being used
-	 *
-	 * @return
-	 */
-	public static boolean isEmptyHelp() {
-		return emptyHelp;
-	}
-
-	public static URL getURLFromID(String id) throws BadIDException,
-			MalformedURLException {
-		initialize();
-		logger.trace("Looking for id: " + id);
-		ID theId = ID.create(id, hs);
-		if (theId == null)
-			return null;
-		return hs.getCombinedMap().getURLFromID(theId);
-	}
-
-	/**
-	 * Register a component under the specified id. The method checks that the
-	 * id is known to the HelpSet's map.
-	 * 
-	 * @param component
-	 * @param id
-	 */
-	public static void registerComponent(Component component, String id) {
-		logger.trace("Attempting to register " + id);
-		initialize();
-		String normalizedId = normalizeString(id.toLowerCase());
-		if (idMap.containsKey(component)) {
-			logger.info("Registered " + normalizedId);
-			return;
-		}
-
-		/*
-		 * If Workbench is started up while there is no network connection -
-		 * hs.getLocalMap() is null for some reason
-		 */
-		if (hs != null && hs.getLocalMap() != null
-				&& hs.getLocalMap().isValidID(normalizedId, hs)) {
-			idMap.put(component, normalizedId);
-			logger.info("Registered " + normalizedId);
-		} else
-			logger.warn("Refused to register component as " + normalizedId
-					+ " not in map");
-	}
-
-	/**
-	 * Register a component. Since no id is specified, the HelpCollator takes
-	 * the canonical name of the component's class. This is useful when an
-	 * explicit hierarchy-based approach has been taken.
-	 *
-	 * @param component
-	 */
-	public static void registerComponent(Component component) {
-		String canonicalName = component.getClass().getCanonicalName();
-		if (canonicalName != null)
-			registerComponent(component, canonicalName);
-	}
-
-	/**
-	 * Register a component based upon its parent's class and a suffix
-	 * indicating the component's purpose in the parent.
-	 *
-	 * @param component
-	 * @param parent
-	 * @param suffix
-	 */
-	public static void registerComponent(Component component, Object parent,
-			String suffix) {
-		String canonicalName = parent.getClass().getCanonicalName();
-		if (canonicalName != null)
-			registerComponent(component, canonicalName + "-" + suffix);
-	}
-
-	/**
-	 * Try to find an id for the Component. This code should be re-written when
-	 * we have more experience in how to couple the UI and HelpSets.
-	 *
-	 * @param c
-	 * @return
-	 */
-	static String getHelpID(Component c) {
-		initialize();
-		boolean found = false;
-		String result = null;
-		if (c instanceof JTree) {
-			String idInTree = getHelpIDInTree((JTree) c);
-			if (idInTree != null) {
-				found = true;
-				result = idInTree;
-			}
-		}
-		Component working = c;
-		if (c != null)
-			logger.trace("Starting at a " + working.getClass());
-		while (!found && (working != null)) {
-			if (idMap.containsKey(working)) {
-				result = idMap.get(working);
-				found = true;
-				logger.trace("Found component id " + result);
-			} else {
-				String className = working.getClass().getCanonicalName();
-				if (hs.getLocalMap().isValidID(className, hs)) {
-					result = className;
-					found = true;
-					logger.trace("Found class name " + result);
-				}
-			}
-			if (!found) {
-				working = working.getParent();
-				if (working != null)
-					logger.trace("Moved up to a " + working.getClass());
-			}
-		}
-		return result;
-	}
-
-	/**
-	 * Change the input String into an id that contains only alphanumeric
-	 * characters or hyphens.
-	 *
-	 * @param input
-	 * @return
-	 */
-	private static String normalizeString(String input) {
-		Matcher m = nonAlphanumeric.matcher(input);
-		return m.replaceAll("-");
-	}
-
-	/**
-	 * If help is sought on part of a JTree, then this method attempts to find a
-	 * node of the tree that can be mapped to an id. The possibilities are ad
-	 * hoc and should be re-examined when more experience is gained.
-	 * 
-	 * @param c
-	 * @return
-	 */
-	private static String getHelpIDInTree(JTree c) {
-		initialize();
-
-		TreePath tp = c.getSelectionPath();
-		if (tp == null)
-			return null;
-
-		Object o = tp.getLastPathComponent();
-		if (o == null)
-			return null;
-
-		if (o instanceof DefaultMutableTreeNode) {
-			DefaultMutableTreeNode dmtn = (DefaultMutableTreeNode) o;
-			if (dmtn.getUserObject() != null)
-				o = dmtn.getUserObject();
-		}
-
-		String className = o.getClass().getCanonicalName();
-
-		logger.trace("Tree node as a string is " + o);
-
-		String possibility = normalizeString(o.toString().toLowerCase());
-
-		logger.trace("Normalized is " + possibility);
-		logger.trace("Tree node class name is " + className);
-
-		possibility = className + "-" + possibility;
-
-		logger.trace("Possibility is " + possibility);
-
-		String result;
-		if (hs.getLocalMap().isValidID(possibility, hs)) {
-			result = possibility;
-			logger.trace("Accepted tree node " + result);
-		} else if (hs.getLocalMap().isValidID(className, hs)) {
-			result = className;
-			logger.trace("Found tree node class name " + result);
-		} else {
-			result = null;
-		}
-
-		logger.debug("Tree node is a " + o.getClass());
-		return result;
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-helper-api/src/main/java/net/sf/taverna/t2/workbench/helper/HelpEnabledDialog.java
----------------------------------------------------------------------
diff --git a/taverna-helper-api/src/main/java/net/sf/taverna/t2/workbench/helper/HelpEnabledDialog.java b/taverna-helper-api/src/main/java/net/sf/taverna/t2/workbench/helper/HelpEnabledDialog.java
deleted file mode 100644
index ec17171..0000000
--- a/taverna-helper-api/src/main/java/net/sf/taverna/t2/workbench/helper/HelpEnabledDialog.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.workbench.helper;
-
-import static net.sf.taverna.t2.workbench.MainWindow.getMainWindow;
-import static net.sf.taverna.t2.workbench.helper.HelpCollator.registerComponent;
-import static net.sf.taverna.t2.workbench.helper.Helper.setKeyCatcher;
-
-import java.awt.Dialog;
-import java.awt.Frame;
-import java.awt.HeadlessException;
-
-import javax.swing.JDialog;
-
-/**
- * This class extends JDialog to register the dialog and also attach a key
- * catcher so that F1 is interpreted as help
- *
- * @author alanrw
- */
-public class HelpEnabledDialog extends JDialog {
-	private static final long serialVersionUID = -5068807887477419800L;
-
-	/**
-	 * Create a HelpEnabledDialog, register it (if possible) with the
-	 * HelpCollator and attach a keycatcher.
-	 *
-	 * @param owner
-	 * @param title
-	 * @param modal
-	 * @param id
-	 * @throws HeadlessException
-	 */
-	public HelpEnabledDialog(Frame owner, String title, boolean modal, String id)
-			throws HeadlessException {
-		super(owner == null ? getMainWindow() : owner, title, modal);
-
-		if (id != null)
-			registerComponent(this, id);
-		else if (owner != null)
-			registerComponent(this, owner.getClass().getCanonicalName()
-					+ "-dialog");
-		else if (title != null && !title.isEmpty())
-			registerComponent(this, title);
-		setKeyCatcher(this);
-	}
-
-	/**
-	 * Create a HelpEnabledDialog, register it (if possible) with the
-	 * HelpCollator and attach a keycatcher.
-	 *
-	 * @param owner
-	 * @param title
-	 * @param modal
-	 * @param id
-	 * @throws HeadlessException
-	 */
-	public HelpEnabledDialog(Dialog owner, String title, boolean modal,
-			String id) throws HeadlessException {
-		super(owner, title, modal);
-		if (id != null)
-			registerComponent(this, id);
-		else if (owner != null)
-			registerComponent(this, owner.getClass().getCanonicalName()
-					+ "-dialog");
-		setKeyCatcher(this);
-	}
-
-	/**
-	 * Create a HelpEnabledDialog, register it (if possible) with the
-	 * HelpCollator and attach a keycatcher.
-	 *
-	 * @param owner
-	 * @param title
-	 * @param modal
-	 * @throws HeadlessException
-	 */
-	public HelpEnabledDialog(Frame parent, String title, boolean modal) {
-		this(parent, title, modal, null);
-	}
-
-	/**
-	 * Create a HelpEnabledDialog, register it (if possible) with the
-	 * HelpCollator and attach a keycatcher.
-	 *
-	 * @param owner
-	 * @param title
-	 * @param modal
-	 * @throws HeadlessException
-	 */
-	public HelpEnabledDialog(Dialog parent, String title, boolean modal) {
-		this(parent, title, modal, null);
-	}
-
-	@Override
-	public void setVisible(boolean b) {
-		setLocationRelativeTo(getParent());
-		super.setVisible(b);
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-helper-api/src/main/java/net/sf/taverna/t2/workbench/helper/Helper.java
----------------------------------------------------------------------
diff --git a/taverna-helper-api/src/main/java/net/sf/taverna/t2/workbench/helper/Helper.java b/taverna-helper-api/src/main/java/net/sf/taverna/t2/workbench/helper/Helper.java
deleted file mode 100644
index 21b0f75..0000000
--- a/taverna-helper-api/src/main/java/net/sf/taverna/t2/workbench/helper/Helper.java
+++ /dev/null
@@ -1,187 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.workbench.helper;
-
-import static java.awt.Desktop.getDesktop;
-import static java.awt.MouseInfo.getPointerInfo;
-import static javax.swing.JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT;
-import static javax.swing.KeyStroke.getKeyStroke;
-import static net.sf.taverna.t2.workbench.helper.HelpCollator.getHelpID;
-import static net.sf.taverna.t2.workbench.helper.HelpCollator.getURLFromID;
-
-import java.awt.AWTEvent;
-import java.awt.Component;
-import java.awt.Container;
-import java.awt.Point;
-import java.awt.event.ActionEvent;
-import java.io.IOException;
-import java.net.URISyntaxException;
-import java.net.URL;
-
-import javax.help.BadIDException;
-import javax.swing.AbstractAction;
-import javax.swing.ActionMap;
-import javax.swing.InputMap;
-import javax.swing.JComponent;
-import javax.swing.JRootPane;
-import javax.swing.RootPaneContainer;
-
-import org.apache.log4j.Logger;
-
-/**
- * This class creates the dialogs for the presentation of the HelpSet held by
- * the HelpCollator.
- *
- * @author alanrw
- */
-public final class Helper {
-	private static Helper instance;
-	private static Logger logger = Logger.getLogger(Helper.class);
-
-	/**
-	 * Create a Helper and initialize the static variables.
-	 */
-	private Helper() {
-	}
-
-	/**
-	 * Get the singleton instance of Helper. In theory there could be more than
-	 * one.
-	 *
-	 * @return
-	 */
-	private static Helper getInstance() {
-		if (instance == null)
-			instance = new Helper();
-		return instance;
-	}
-
-	/**
-	 * Show in the current dialog the entry (if any) corresponding to the
-	 * specified id.
-	 *
-	 * @param id
-	 */
-	private static void showID(String id) {
-		getInstance();
-		try {
-			URL result = getURLFromID(id);
-			if (result == null)
-				result = getURLFromID("home");
-			getDesktop().browse(result.toURI());
-		} catch (BadIDException | IOException | URISyntaxException e) {
-			logger.error(e);
-		}
-	}
-
-	/**
-	 * Show the most suitable help for the specified component.
-	 *
-	 * @param c
-	 */
-	public static void showHelp(Component c) {
-		showID(getHelpID(c));
-	}
-
-	/**
-	 * Display the default home page help.
-	 *
-	 * @param e
-	 */
-	public static void displayDefaultHelp(AWTEvent e) {
-		showID("home");
-	}
-
-	public static void displayFieldLevelHelp(ActionEvent e) {
-		//
-	}
-
-	private static final String HELP_KEY = "F1";
-
-	/**
-	 * Associated the specified action with key presses in the specified
-	 * component.
-	 * 
-	 * @param component
-	 * @param theAction
-	 */
-	public static void setKeyCatcher(final JComponent component,
-			final AbstractAction theAction) {
-		InputMap oldInputMap = component
-				.getInputMap(WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
-		InputMap newInputMap = new InputMap();
-		newInputMap.setParent(oldInputMap);
-		newInputMap.put(getKeyStroke(HELP_KEY), "doSomething");
-		component.setInputMap(WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, newInputMap);
-		ActionMap oldActionMap = component.getActionMap();
-		ActionMap newActionMap = new ActionMap();
-		newActionMap.setParent(oldActionMap);
-		newActionMap.put("doSomething", theAction);
-		component.setActionMap(newActionMap);
-	}
-
-	/**
-	 * Set up a key-press catcher for the specified component such that when F1
-	 * is pressed it should help for the component where the cursor is.
-	 *
-	 * @param rootpanecontainer
-	 */
-	public static void setKeyCatcher(final RootPaneContainer rootpanecontainer) {
-		@SuppressWarnings("serial")
-		AbstractAction theAction = new AbstractAction() {
-			@Override
-			public void actionPerformed(ActionEvent evt) {
-				Component component = (Component) rootpanecontainer;
-				Container container = (Container) rootpanecontainer;
-				logger.info("frame action F1 pressed with source "
-						+ evt.getSource().getClass().getName());
-				Point mousePosition = getPointerInfo().getLocation();
-				Point framePosition = component.getLocation();
-				Point relativePosition = (Point) mousePosition.clone();
-				relativePosition.translate(-framePosition.x, -framePosition.y);
-				Component c = container.findComponentAt(relativePosition);
-				if (c != null)
-					logger.info("F1 pressed in a " + c.getClass().getName());
-				showHelpWithinContainer(rootpanecontainer, c);
-			}
-		};
-
-		JRootPane pane = rootpanecontainer.getRootPane();
-		setKeyCatcher(pane, theAction);
-	}
-
-	/**
-	 * Show the help most associated with the specific component within the container.
-	 *
-	 * @param root
-	 * @param c
-	 */
-	static void showHelpWithinContainer(RootPaneContainer root, Component c) {
-		getInstance();
-		showHelp(c);
-	}
-
-	/**
-	 * Register a component with the {@link HelpCollator} under the specified
-	 * id.
-	 * 
-	 * @param component
-	 * @param id
-	 */
-	public static void registerComponent(Component component, final String id) {
-		HelpCollator.registerComponent(component, id);
-	}
-
-	/**
-	 * Register a component with the {@link HelpCollator}.
-	 *
-	 * @param component
-	 * @param parent
-	 * @param suffix
-	 */
-	public static void registerComponent(Component component, Object parent,
-			String suffix) {
-		HelpCollator.registerComponent(component, parent, suffix);
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-helper-api/src/main/java/net/sf/taverna/t2/workbench/helper/NonBlockedHelpEnabledDialog.java
----------------------------------------------------------------------
diff --git a/taverna-helper-api/src/main/java/net/sf/taverna/t2/workbench/helper/NonBlockedHelpEnabledDialog.java b/taverna-helper-api/src/main/java/net/sf/taverna/t2/workbench/helper/NonBlockedHelpEnabledDialog.java
deleted file mode 100644
index 67e6bc5..0000000
--- a/taverna-helper-api/src/main/java/net/sf/taverna/t2/workbench/helper/NonBlockedHelpEnabledDialog.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/**
- * 
- */
-package net.sf.taverna.t2.workbench.helper;
-
-import static java.awt.Dialog.ModalExclusionType.APPLICATION_EXCLUDE;
-
-import java.awt.Dialog;
-import java.awt.Frame;
-import java.awt.HeadlessException;
-
-/**
- * @author alanrw
- */
-public class NonBlockedHelpEnabledDialog extends HelpEnabledDialog {
-	private static final long serialVersionUID = -2455471377333940417L;
-
-	public NonBlockedHelpEnabledDialog(Dialog owner, String title,
-			boolean modal, String id) throws HeadlessException {
-		super(owner, title, modal, id);
-		this.setModalExclusionType(APPLICATION_EXCLUDE);
-	}
-
-	public NonBlockedHelpEnabledDialog(Frame owner, String title,
-			boolean modal, String id) throws HeadlessException {
-		super(owner, title, modal, id);
-		this.setModalExclusionType(APPLICATION_EXCLUDE);
-	}
-
-	public NonBlockedHelpEnabledDialog(Frame parent, String title, boolean modal) {
-		super(parent, title, modal, null);
-		this.setModalExclusionType(APPLICATION_EXCLUDE);
-	}
-
-	public NonBlockedHelpEnabledDialog(Dialog parent, String title,
-			boolean modal) {
-		super(parent, title, modal, null);
-		this.setModalExclusionType(APPLICATION_EXCLUDE);
-	}
-}


[03/51] [partial] incubator-taverna-workbench git commit: all packages are moved to org.apache.taverna.*

Posted by re...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-menu-impl/src/main/java/net/sf/taverna/t2/ui/menu/impl/MenuManagerImpl.java
----------------------------------------------------------------------
diff --git a/taverna-menu-impl/src/main/java/net/sf/taverna/t2/ui/menu/impl/MenuManagerImpl.java b/taverna-menu-impl/src/main/java/net/sf/taverna/t2/ui/menu/impl/MenuManagerImpl.java
deleted file mode 100644
index 29b8057..0000000
--- a/taverna-menu-impl/src/main/java/net/sf/taverna/t2/ui/menu/impl/MenuManagerImpl.java
+++ /dev/null
@@ -1,880 +0,0 @@
-/*******************************************************************************
- * 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.impl;
-
-import static java.lang.Math.min;
-import static javax.help.CSH.setHelpIDString;
-import static javax.swing.Action.NAME;
-import static javax.swing.Action.SHORT_DESCRIPTION;
-import static net.sf.taverna.t2.lang.ui.ShadedLabel.GREEN;
-import static net.sf.taverna.t2.ui.menu.AbstractMenuSection.SECTION_COLOR;
-import static net.sf.taverna.t2.ui.menu.DefaultContextualMenu.DEFAULT_CONTEXT_MENU;
-import static net.sf.taverna.t2.ui.menu.DefaultMenuBar.DEFAULT_MENU_BAR;
-import static net.sf.taverna.t2.ui.menu.DefaultToolBar.DEFAULT_TOOL_BAR;
-
-import java.awt.Color;
-import java.awt.Component;
-import java.lang.ref.WeakReference;
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.WeakHashMap;
-
-import javax.swing.AbstractButton;
-import javax.swing.Action;
-import javax.swing.ButtonGroup;
-import javax.swing.JButton;
-import javax.swing.JCheckBoxMenuItem;
-import javax.swing.JMenu;
-import javax.swing.JMenuBar;
-import javax.swing.JMenuItem;
-import javax.swing.JPopupMenu;
-import javax.swing.JRadioButtonMenuItem;
-import javax.swing.JToggleButton;
-import javax.swing.JToolBar;
-import javax.swing.border.EmptyBorder;
-
-import org.apache.taverna.lang.observer.MultiCaster;
-import org.apache.taverna.lang.observer.Observable;
-import org.apache.taverna.lang.observer.Observer;
-import org.apache.taverna.lang.observer.SwingAwareObserver;
-import net.sf.taverna.t2.lang.ui.ShadedLabel;
-import net.sf.taverna.t2.ui.menu.AbstractMenuAction;
-import net.sf.taverna.t2.ui.menu.AbstractMenuOptionGroup;
-import net.sf.taverna.t2.ui.menu.ContextualMenuComponent;
-import net.sf.taverna.t2.ui.menu.ContextualSelection;
-import net.sf.taverna.t2.ui.menu.DesignOnlyAction;
-import net.sf.taverna.t2.ui.menu.DesignOrResultsAction;
-import net.sf.taverna.t2.ui.menu.MenuComponent;
-import net.sf.taverna.t2.ui.menu.MenuComponent.MenuType;
-import net.sf.taverna.t2.ui.menu.MenuManager;
-import net.sf.taverna.t2.workbench.selection.SelectionManager;
-import net.sf.taverna.t2.workbench.selection.events.PerspectiveSelectionEvent;
-import net.sf.taverna.t2.workbench.selection.events.SelectionManagerEvent;
-
-import org.apache.log4j.Logger;
-
-/**
- * Implementation of {@link MenuManager}.
- *
- * @author Stian Soiland-Reyes
- */
-public class MenuManagerImpl implements MenuManager {
-	private static Logger logger = Logger.getLogger(MenuManagerImpl.class);
-
-	private boolean needsUpdate;
-	/**
-	 * Cache used by {@link #getURIByComponent(Component)}
-	 */
-	private WeakHashMap<Component, URI> componentToUri;
-	/**
-	 * {@link MenuElementComparator} used for sorting menu components from the
-	 * SPI registry.
-	 */
-	private MenuElementComparator menuElementComparator = new MenuElementComparator();
-	/**
-	 * Map of {@link URI} to it's discovered children. Populated by
-	 * {@link #findChildren()}.
-	 */
-	private HashMap<URI, List<MenuComponent>> menuElementTree;
-	/**
-	 * Multicaster to distribute messages to {@link Observer}s of this menu
-	 * manager.
-	 */
-	private MultiCaster<MenuManagerEvent> multiCaster;
-	/**
-	 * Lock for {@link #update()}
-	 */
-	private final Object updateLock = new Object();
-	/**
-	 * True if {@link #doUpdate()} is running, subsequents call to
-	 * {@link #update()} will return immediately.
-	 */
-	private boolean updating;
-	/**
-	 * Cache used by {@link #getComponentByURI(URI)}
-	 */
-	private Map<URI, WeakReference<Component>> uriToComponent;
-	/**
-	 * Map from {@link URI} to defining {@link MenuComponent}. Children are in
-	 * {@link #menuElementTree}.
-	 */
-	private Map<URI, MenuComponent> uriToMenuElement;
-	// Note: Not reset by #resetCollections()
-	private Map<URI, List<WeakReference<Component>>> uriToPublishedComponents = new HashMap<>();
-	private List<MenuComponent> menuComponents = new ArrayList<>();
-
-	/**
-	 * Construct the MenuManagerImpl. Observes the SPI registry and does an
-	 * initial {@link #update()}.
-	 */
-	public MenuManagerImpl() {
-		multiCaster = new MultiCaster<>(this);
-		needsUpdate = true;
-	}
-
-	/**
-	 * {@inheritDoc}
-	 */
-	@Override
-	public void addMenuItemsWithExpansion(List<JMenuItem> menuItems,
-			JMenu parentMenu, int maxItemsInMenu,
-			ComponentFactory headerItemFactory) {
-		if (menuItems.size() <= maxItemsInMenu) {
-			// Just add them directly
-			for (JMenuItem menuItem : menuItems)
-				parentMenu.add(menuItem);
-			return;
-		}
-		int index = 0;
-		while (index < menuItems.size()) {
-			int toIndex = min(menuItems.size(), index + maxItemsInMenu);
-			if (toIndex == menuItems.size() - 1)
-				// Don't leave a single item left for the last subMenu
-				toIndex--;
-			List<JMenuItem> subList = menuItems.subList(index, toIndex);
-			JMenuItem firstItem = subList.get(0);
-			JMenuItem lastItem = subList.get(subList.size() - 1);
-			JMenu subMenu = new JMenu(firstItem.getText() + " ... "
-					+ lastItem.getText());
-			if (headerItemFactory != null)
-				subMenu.add(headerItemFactory.makeComponent());
-			for (JMenuItem menuItem : subList)
-				subMenu.add(menuItem);
-			parentMenu.add(subMenu);
-			index = toIndex;
-		}
-	}
-
-	@Override
-	public void addObserver(Observer<MenuManagerEvent> observer) {
-		multiCaster.addObserver(observer);
-	}
-
-	@Override
-	public JPopupMenu createContextMenu(Object parent, Object selection,
-			Component relativeToComponent) {
-		ContextualSelection contextualSelection = new ContextualSelection(
-				parent, selection, relativeToComponent);
-		JPopupMenu popupMenu = new JPopupMenu();
-		populateContextMenu(popupMenu, DEFAULT_CONTEXT_MENU,
-				contextualSelection);
-		registerComponent(DEFAULT_CONTEXT_MENU, popupMenu, true);
-		return popupMenu;
-	}
-
-	@Override
-	public JMenuBar createMenuBar() {
-		return createMenuBar(DEFAULT_MENU_BAR);
-	}
-
-	@Override
-	public JMenuBar createMenuBar(URI id) {
-		JMenuBar menuBar = new JMenuBar();
-		if (needsUpdate)
-			update();
-		populateMenuBar(menuBar, id);
-		registerComponent(id, menuBar, true);
-		return menuBar;
-	}
-
-	@Override
-	public JToolBar createToolBar() {
-		return createToolBar(DEFAULT_TOOL_BAR);
-	}
-
-	@Override
-	public JToolBar createToolBar(URI id) {
-		JToolBar toolbar = new JToolBar();
-		if (needsUpdate)
-			update();
-		populateToolBar(toolbar, id);
-		registerComponent(id, toolbar, true);
-		return toolbar;
-	}
-
-	@Override
-	public synchronized Component getComponentByURI(URI id) {
-		WeakReference<Component> componentRef = uriToComponent.get(id);
-		if (componentRef == null)
-			return null;
-		// Might also be null it reference has gone dead
-		return componentRef.get();
-	}
-
-	@Override
-	public List<Observer<MenuManagerEvent>> getObservers() {
-		return multiCaster.getObservers();
-	}
-
-	@Override
-	public synchronized URI getURIByComponent(Component component) {
-		return componentToUri.get(component);
-	}
-
-	@Override
-	public void removeObserver(Observer<MenuManagerEvent> observer) {
-		multiCaster.removeObserver(observer);
-	}
-
-	@Override
-	public void update() {
-		synchronized (updateLock) {
-			if (updating && !needsUpdate)
-				return;
-			updating = true;
-		}
-		try {
-			doUpdate();
-		} finally {
-			synchronized (updateLock) {
-				updating = false;
-				needsUpdate = false;
-			}
-		}
-	}
-
-	public void update(Object service, Map<?, ?> properties) {
-		needsUpdate = true;
-		update();
-	}
-
-	/**
-	 * Add a {@link JMenu} to the list of components as described by the menu
-	 * component. If there are no children, the menu is not added.
-	 *
-	 * @param components
-	 *            List of components where to add the created {@link JMenu}
-	 * @param menuComponent
-	 *            The {@link MenuComponent} definition for this menu
-	 * @param isToolbar
-	 *            True if the list of components is to be added to a toolbar
-	 */
-	private void addMenu(List<Component> components,
-			MenuComponent menuComponent, MenuOptions menuOptions) {
-		URI menuId = menuComponent.getId();
-		if (menuOptions.isToolbar()) {
-			logger.warn("Can't have menu " + menuComponent
-					+ " within toolBar element");
-			return;
-		}
-		MenuOptions childOptions = new MenuOptions(menuOptions);
-		List<Component> subComponents = makeComponents(menuId, childOptions);
-		if (subComponents.isEmpty()) {
-			logger.warn("No sub components found for menu " + menuId);
-			return;
-		}
-
-		JMenu menu = new JMenu(menuComponent.getAction());
-		for (Component menuItem : subComponents)
-			if (menuItem == null)
-				menu.addSeparator();
-			else
-				menu.add(menuItem);
-		registerComponent(menuId, menu);
-		components.add(menu);
-	}
-
-	/**
-	 * Add <code>null</code> to the list of components, meaning that a separator
-	 * is to be created. Subsequent separators are ignored, and if there are no
-	 * components on the list already no separator will be added.
-	 * 
-	 * @param components
-	 *            List of components
-	 */
-	private void addNullSeparator(List<Component> components) {
-		if (components.isEmpty())
-			// Don't start with a separator
-			return;
-		if (components.get(components.size() - 1) == null)
-			// Already a separator in last position
-			return;
-		components.add(null);
-	}
-
-	/**
-	 * Add an {@link AbstractMenuOptionGroup option group} to the list of
-	 * components
-	 *
-	 * @param components
-	 *            List of components where to add the created {@link JMenu}
-	 * @param optionGroupId
-	 *            The {@link URI} identifying the option group
-	 * @param isToolbar
-	 *            True if the option group is to be added to a toolbar
-	 */
-	private void addOptionGroup(List<Component> components, URI optionGroupId,
-			MenuOptions menuOptions) {
-		MenuOptions childOptions = new MenuOptions(menuOptions);
-		childOptions.setOptionGroup(true);
-
-		List<Component> buttons = makeComponents(optionGroupId, childOptions);
-		addNullSeparator(components);
-		if (buttons.isEmpty()) {
-			logger.warn("No sub components found for option group "
-					+ optionGroupId);
-			return;
-		}
-		ButtonGroup buttonGroup = new ButtonGroup();
-
-		for (Component button : buttons) {
-			if (button instanceof AbstractButton)
-				buttonGroup.add((AbstractButton) button);
-			else
-				logger.warn("Component of button group " + optionGroupId
-						+ " is not an AbstractButton: " + button);
-			if (button == null) {
-				logger.warn("Separator found within button group");
-				addNullSeparator(components);
-			} else
-				components.add(button);
-		}
-		addNullSeparator(components);
-	}
-
-	/**
-	 * Add a section to a list of components.
-	 *
-	 * @param components
-	 *            List of components
-	 * @param sectionId
-	 *            The {@link URI} identifying the section
-	 * @param menuOptions
-	 *            {@link MenuOptions options} for creating the menu
-	 */
-	private void addSection(List<Component> components, URI sectionId,
-			MenuOptions menuOptions) {
-		List<Component> childComponents = makeComponents(sectionId, menuOptions);
-
-		MenuComponent sectionDef = uriToMenuElement.get(sectionId);
-		addNullSeparator(components);
-		if (childComponents.isEmpty()) {
-			logger.warn("No sub components found for section " + sectionId);
-			return;
-		}
-		Action sectionAction = sectionDef.getAction();
-		if (sectionAction != null) {
-			String sectionLabel = (String) sectionAction.getValue(NAME);
-			if (sectionLabel != null) {
-				// No separators before the label
-				stripTrailingNullSeparator(components);
-				Color labelColor = (Color) sectionAction.getValue(SECTION_COLOR);
-				if (labelColor == null)
-					labelColor = GREEN;
-				ShadedLabel label = new ShadedLabel(sectionLabel, labelColor);
-				components.add(label);
-			}
-		}
-		for (Component childComponent : childComponents)
-			if (childComponent == null) {
-				logger.warn("Separator found within section " + sectionId);
-				addNullSeparator(components);
-			} else
-				components.add(childComponent);
-		addNullSeparator(components);
-	}
-
-	/**
-	 * Remove the last <code>null</code> separator from the list of components
-	 * if it's present.
-	 *
-	 * @param components
-	 *            List of components
-	 */
-	private void stripTrailingNullSeparator(List<Component> components) {
-		if (!components.isEmpty()) {
-			int lastIndex = components.size() - 1;
-			if (components.get(lastIndex) == null)
-				components.remove(lastIndex);
-		}
-	}
-
-	/**
-	 * Perform the actual update, called by {@link #update()}. Reset all the
-	 * collections, refresh from SPI, modify any previously published components
-	 * and notify any observers.
-	 */
-	protected synchronized void doUpdate() {
-		resetCollections();
-		findChildren();
-		updatePublishedComponents();
-		multiCaster.notify(new UpdatedMenuManagerEvent());
-	}
-
-	/**
-	 * Find all children for all known menu components. Populates
-	 * {@link #uriToMenuElement}.
-	 *
-	 */
-	protected void findChildren() {
-		for (MenuComponent menuElement : menuComponents) {
-			uriToMenuElement.put(menuElement.getId(), menuElement);
-			logger.debug("Found menu element " + menuElement.getId() + " "
-					+ menuElement);
-			if (menuElement.getParentId() == null)
-				continue;
-			List<MenuComponent> siblings = menuElementTree.get(menuElement
-					.getParentId());
-			if (siblings == null) {
-				siblings = new ArrayList<>();
-				synchronized (menuElementTree) {
-					menuElementTree.put(menuElement.getParentId(), siblings);
-				}
-			}
-			siblings.add(menuElement);
-		}
-//		if (uriToMenuElement.isEmpty()) {
-//			logger.error("No menu elements found, check classpath/Raven/SPI");
-//		}
-	}
-
-	/**
-	 * Get the children which have the given URI specified as their parent, or
-	 * an empty list if no children exist.
-	 *
-	 * @param id
-	 *            The {@link URI} of the parent
-	 * @return The {@link List} of {@link MenuComponent} which have the given
-	 *         parent
-	 */
-	protected List<MenuComponent> getChildren(URI id) {
-		List<MenuComponent> children = null;
-		synchronized (menuElementTree) {
-			children = menuElementTree.get(id);
-			if (children != null)
-				children = new ArrayList<>(children);
-		}
-		if (children == null)
-			children = Collections.<MenuComponent> emptyList();
-		else
-			Collections.sort(children, menuElementComparator);
-		return children;
-	}
-
-	/**
-	 * Make the list of Swing {@link Component}s that are the children of the
-	 * given {@link URI}.
-	 *
-	 * @param id
-	 *            The {@link URI} of the parent which children are to be made
-	 * @param menuOptions
-	 *            Options of the created menu, for instance
-	 *            {@link MenuOptions#isToolbar()}.
-	 * @return A {@link List} of {@link Component}s that can be added to a
-	 *         {@link JMenuBar}, {@link JMenu} or {@link JToolBar}.
-	 */
-	protected List<Component> makeComponents(URI id, MenuOptions menuOptions) {
-		List<Component> components = new ArrayList<>();
-		for (MenuComponent childElement : getChildren(id)) {
-			if (childElement instanceof ContextualMenuComponent)
-				((ContextualMenuComponent) childElement)
-						.setContextualSelection(menuOptions
-								.getContextualSelection());
-			/*
-			 * Important - check this AFTER setContextualSelection so the item
-			 * can change it's enabled-state if needed.
-			 */
-			if (!childElement.isEnabled())
-				continue;
-			MenuType type = childElement.getType();
-			Action action = childElement.getAction();
-			URI childId = childElement.getId();
-			if (type.equals(MenuType.action)) {
-				if (action == null) {
-					logger.warn("Skipping invalid action " + childId + " for "
-							+ id);
-					continue;
-				}
-
-				Component actionComponent;
-				if (menuOptions.isOptionGroup()) {
-					if (menuOptions.isToolbar()) {
-						actionComponent = new JToggleButton(action);
-						toolbarizeButton((AbstractButton) actionComponent);
-					} else
-						actionComponent = new JRadioButtonMenuItem(action);
-				} else {
-					if (menuOptions.isToolbar()) {
-						actionComponent = new JButton(action);
-						toolbarizeButton((AbstractButton) actionComponent);
-					} else
-						actionComponent = new JMenuItem(action);
-				}
-				registerComponent(childId, actionComponent);
-				components.add(actionComponent);
-			} else if (type.equals(MenuType.toggle)) {
-				if (action == null) {
-					logger.warn("Skipping invalid toggle " + childId + " for "
-							+ id);
-					continue;
-				}
-				Component toggleComponent;
-				if (menuOptions.isToolbar())
-					toggleComponent = new JToggleButton(action);
-				else
-					toggleComponent = new JCheckBoxMenuItem(action);
-				registerComponent(childId, toggleComponent);
-				components.add(toggleComponent);
-			} else if (type.equals(MenuType.custom)) {
-				Component customComponent = childElement.getCustomComponent();
-				if (customComponent == null) {
-					logger.warn("Skipping null custom component " + childId
-							+ " for " + id);
-					continue;
-				}
-				registerComponent(childId, customComponent);
-				components.add(customComponent);
-			} else if (type.equals(MenuType.optionGroup))
-				addOptionGroup(components, childId, menuOptions);
-			else if (type.equals(MenuType.section))
-				addSection(components, childId, menuOptions);
-			else if (type.equals(MenuType.menu))
-				addMenu(components, childElement, menuOptions);
-			else {
-				logger.warn("Skipping invalid/unknown type " + type + " for "
-						+ id);
-				continue;
-			}
-		}
-		stripTrailingNullSeparator(components);
-		return components;
-	}
-
-	/**
-	 * Fill the specified menu bar with the menu elements that have the given
-	 * URI as their parent.
-	 * <p>
-	 * Existing elements on the menu bar will be removed.
-	 *
-	 * @param menuBar
-	 *            The {@link JMenuBar} to update
-	 * @param id
-	 *            The {@link URI} of the menu bar
-	 */
-	protected void populateMenuBar(JMenuBar menuBar, URI id) {
-		menuBar.removeAll();
-		MenuComponent menuDef = uriToMenuElement.get(id);
-		if (menuDef == null)
-			throw new IllegalArgumentException("Unknown menuBar " + id);
-		if (!menuDef.getType().equals(MenuType.menu))
-			throw new IllegalArgumentException("Element " + id
-					+ " is not a menu, but a " + menuDef.getType());
-		MenuOptions menuOptions = new MenuOptions();
-		for (Component component : makeComponents(id, menuOptions))
-			if (component == null)
-				logger.warn("Ignoring separator in menu bar " + id);
-			else
-				menuBar.add(component);
-	}
-
-	/**
-	 * Fill the specified menu bar with the menu elements that have the given
-	 * URI as their parent.
-	 * <p>
-	 * Existing elements on the menu bar will be removed.
-	 *
-	 * @param popupMenu
-	 *            The {@link JPopupMenu} to update
-	 * @param id
-	 *            The {@link URI} of the menu bar
-	 * @param contextualSelection
-	 *            The current selection for the context menu
-	 */
-	protected void populateContextMenu(JPopupMenu popupMenu, URI id,
-			ContextualSelection contextualSelection) {
-		popupMenu.removeAll();
-		MenuComponent menuDef = uriToMenuElement.get(id);
-		if (menuDef == null)
-			throw new IllegalArgumentException("Unknown menuBar " + id);
-		if (!menuDef.getType().equals(MenuType.menu))
-			throw new IllegalArgumentException("Element " + id
-					+ " is not a menu, but a " + menuDef.getType());
-		MenuOptions menuOptions = new MenuOptions();
-		menuOptions.setContextualSelection(contextualSelection);
-		for (Component component : makeComponents(id, menuOptions))
-			if (component == null)
-				popupMenu.addSeparator();
-			else
-				popupMenu.add(component);
-	}
-
-	/**
-	 * Fill the specified tool bar with the elements that have the given URI as
-	 * their parent.
-	 * <p>
-	 * Existing elements on the tool bar will be removed.
-	 *
-	 * @param toolbar
-	 *            The {@link JToolBar} to update
-	 * @param id
-	 *            The {@link URI} of the tool bar
-	 */
-	protected void populateToolBar(JToolBar toolbar, URI id) {
-		toolbar.removeAll();
-		MenuComponent toolbarDef = uriToMenuElement.get(id);
-		if (toolbarDef == null)
-			throw new IllegalArgumentException("Unknown toolBar " + id);
-		if (!toolbarDef.getType().equals(MenuType.toolBar))
-			throw new IllegalArgumentException("Element " + id
-					+ " is not a toolBar, but a " + toolbarDef.getType());
-		if (toolbarDef.getAction() != null) {
-			String name = (String) toolbarDef.getAction().getValue(Action.NAME);
-			toolbar.setName(name);
-		} else
-			toolbar.setName("");
-		MenuOptions menuOptions = new MenuOptions();
-		menuOptions.setToolbar(true);
-		for (Component component : makeComponents(id, menuOptions)) {
-			if (component == null) {
-				toolbar.addSeparator();
-				continue;
-			}
-			if (component instanceof JButton) {
-				JButton toolbarButton = (JButton) component;
-				toolbarButton.putClientProperty("hideActionText", true);
-			}
-			toolbar.add(component);
-		}
-	}
-
-	/**
-	 * Register a component that has been created. Such a component can be
-	 * resolved through {@link #getComponentByURI(URI)}.
-	 *
-	 * @param id
-	 *            The {@link URI} that defined the component
-	 * @param component
-	 *            The {@link Component} that was created.
-	 */
-	protected synchronized void registerComponent(URI id, Component component) {
-		registerComponent(id, component, false);
-	}
-
-	/**
-	 * Register a component that has been created. Such a component can be
-	 * resolved through {@link #getComponentByURI(URI)}.
-	 *
-	 * @param id
-	 *            The {@link URI} that defined the component
-	 * @param component
-	 *            The {@link Component} that was created.
-	 * @param published
-	 *            <code>true</code> if the component has been published through
-	 *            {@link #createMenuBar()} or similar, and is to be
-	 *            automatically updated by later calls to {@link #update()}.
-	 */
-	protected synchronized void registerComponent(URI id, Component component,
-			boolean published) {
-		uriToComponent.put(id, new WeakReference<>(component));
-		componentToUri.put(component, id);
-		if (published) {
-			List<WeakReference<Component>> publishedComponents = uriToPublishedComponents
-					.get(id);
-			if (publishedComponents == null) {
-				publishedComponents = new ArrayList<>();
-				uriToPublishedComponents.put(id, publishedComponents);
-			}
-			publishedComponents.add(new WeakReference<>(component));
-		}
-		setHelpStringForComponent(component, id);
-	}
-
-	/**
-	 * Reset all collections
-	 *
-	 */
-	protected synchronized void resetCollections() {
-		menuElementTree = new HashMap<>();
-		componentToUri = new WeakHashMap<>();
-		uriToMenuElement = new HashMap<>();
-		uriToComponent = new HashMap<>();
-	}
-
-	/**
-	 * Set javax.help string to identify the component for later references to
-	 * the help document. Note that the component (ie. the
-	 * {@link AbstractMenuAction} must have an ID for an registration to take
-	 * place.
-	 *
-	 * @param component
-	 *            The {@link Component} to set help string for
-	 * @param componentId
-	 *            The {@link URI} to be used as identifier
-	 */
-	protected void setHelpStringForComponent(Component component,
-			URI componentId) {
-		if (componentId != null) {
-			String helpId = componentId.toASCIIString();
-			setHelpIDString(component, helpId);
-		}
-	}
-
-	/**
-	 * Make an {@link AbstractButton} be configured in a "toolbar-like" way, for
-	 * instance showing only the icon.
-	 *
-	 * @param actionButton
-	 *            Button to toolbarise
-	 */
-	protected void toolbarizeButton(AbstractButton actionButton) {
-		Action action = actionButton.getAction();
-		if (action.getValue(SHORT_DESCRIPTION) == null)
-			action.putValue(SHORT_DESCRIPTION, action.getValue(NAME));
-		actionButton.setBorder(new EmptyBorder(0, 2, 0, 2));
-		// actionButton.setHorizontalTextPosition(JButton.CENTER);
-		// actionButton.setVerticalTextPosition(JButton.BOTTOM);
-		if (action.getValue(Action.SMALL_ICON) != null) {
-			// Don't show the text
-			actionButton.putClientProperty("hideActionText", true);
-			// Since hideActionText seems to be broken in Java 5 and/or OS X
-			actionButton.setText(null);
-		}
-	}
-
-	/**
-	 * Update all components that have been published using
-	 * {@link #createMenuBar()} and similar. Content of such components will be
-	 * removed and replaced by fresh components.
-	 */
-	protected void updatePublishedComponents() {
-		for (Entry<URI, List<WeakReference<Component>>> entry : uriToPublishedComponents
-				.entrySet())
-			for (WeakReference<Component> reference : entry.getValue()) {
-				URI id = entry.getKey();
-				Component component = reference.get();
-				if (component == null)
-					continue;
-				if (component instanceof JToolBar)
-					populateToolBar((JToolBar) component, id);
-				else if (component instanceof JMenuBar)
-					populateMenuBar((JMenuBar) component, id);
-				else
-					logger.warn("Could not update published component " + id
-							+ ": " + component.getClass());
-			}
-	}
-
-	public void setMenuComponents(List<MenuComponent> menuComponents) {
-		this.menuComponents = menuComponents;
-	}
-
-	public void setSelectionManager(SelectionManager selectionManager) {
-		selectionManager.addObserver(new SelectionManagerObserver());
-	}
-
-	/**
-	 * {@link Comparator} that can order {@link MenuComponent}s by their
-	 * {@link MenuComponent#getPositionHint()}.
-	 */
-	protected static class MenuElementComparator implements
-			Comparator<MenuComponent> {
-		@Override
-		public int compare(MenuComponent a, MenuComponent b) {
-			return a.getPositionHint() - b.getPositionHint();
-		}
-	}
-
-	/**
-	 * Various options for
-	 * {@link MenuManagerImpl#makeComponents(URI, MenuOptions)} and friends.
-	 *
-	 * @author Stian Soiland-Reyes
-	 */
-	public static class MenuOptions {
-		private boolean isToolbar = false;
-		private boolean isOptionGroup = false;
-		private ContextualSelection contextualSelection = null;
-
-		public ContextualSelection getContextualSelection() {
-			return contextualSelection;
-		}
-
-		public void setContextualSelection(
-				ContextualSelection contextualSelection) {
-			this.contextualSelection = contextualSelection;
-		}
-
-		public MenuOptions(MenuOptions original) {
-			this.isOptionGroup = original.isOptionGroup();
-			this.isToolbar = original.isToolbar();
-			this.contextualSelection = original.getContextualSelection();
-		}
-
-		public MenuOptions() {
-		}
-
-		@Override
-		protected MenuOptions clone() {
-			return new MenuOptions(this);
-		}
-
-		public boolean isToolbar() {
-			return isToolbar;
-		}
-
-		public void setToolbar(boolean isToolbar) {
-			this.isToolbar = isToolbar;
-		}
-
-		public boolean isOptionGroup() {
-			return isOptionGroup;
-		}
-
-		public void setOptionGroup(boolean isOptionGroup) {
-			this.isOptionGroup = isOptionGroup;
-		}
-	}
-
-	private final class SelectionManagerObserver extends
-			SwingAwareObserver<SelectionManagerEvent> {
-		private static final String DESIGN_PERSPECTIVE_ID = "net.sf.taverna.t2.ui.perspectives.design.DesignPerspective";
-		private static final String RESULTS_PERSPECTIVE_ID = "net.sf.taverna.t2.ui.perspectives.results.ResultsPerspective";
-
-		@Override
-		public void notifySwing(Observable<SelectionManagerEvent> sender,
-				SelectionManagerEvent message) {
-			if (!(message instanceof PerspectiveSelectionEvent))
-				return;
-			handlePerspectiveSelect((PerspectiveSelectionEvent) message);
-		}
-
-		private void handlePerspectiveSelect(PerspectiveSelectionEvent event) {
-			String perspectiveID = event.getSelectedPerspective().getID();
-			boolean isDesign = DESIGN_PERSPECTIVE_ID.equals(perspectiveID);
-			boolean isResults = RESULTS_PERSPECTIVE_ID.equals(perspectiveID);
-
-			for (MenuComponent menuComponent : menuComponents)
-				if (!(menuComponent instanceof ContextualMenuComponent)) {
-					Action action = menuComponent.getAction();
-					if (action instanceof DesignOnlyAction)
-						action.setEnabled(isDesign);
-					else if (action instanceof DesignOrResultsAction)
-						action.setEnabled(isDesign || isResults);
-				}
-		}
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-menu-impl/src/main/java/net/sf/taverna/t2/workbench/ui/impl/menu/AdvancedMenu.java
----------------------------------------------------------------------
diff --git a/taverna-menu-impl/src/main/java/net/sf/taverna/t2/workbench/ui/impl/menu/AdvancedMenu.java b/taverna-menu-impl/src/main/java/net/sf/taverna/t2/workbench/ui/impl/menu/AdvancedMenu.java
deleted file mode 100644
index 9a2f37b..0000000
--- a/taverna-menu-impl/src/main/java/net/sf/taverna/t2/workbench/ui/impl/menu/AdvancedMenu.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * 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 static java.awt.event.KeyEvent.VK_A;
-import static javax.swing.Action.MNEMONIC_KEY;
-import static net.sf.taverna.t2.ui.menu.DefaultMenuBar.DEFAULT_MENU_BAR;
-
-import java.net.URI;
-
-import net.sf.taverna.t2.ui.menu.AbstractMenu;
-
-public class AdvancedMenu extends AbstractMenu {
-	public static final URI ADVANCED_URI = URI
-			.create("http://taverna.sf.net/2008/t2workbench/menu#advanced");
-
-	public AdvancedMenu() {
-		super(DEFAULT_MENU_BAR, 1000, ADVANCED_URI, makeAction());
-	}
-
-	public static DummyAction makeAction() {
-		DummyAction action = new DummyAction("Advanced");
-		action.putValue(MNEMONIC_KEY, Integer.valueOf(VK_A));
-		return action;
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-menu-impl/src/main/java/net/sf/taverna/t2/workbench/ui/impl/menu/EditMenu.java
----------------------------------------------------------------------
diff --git a/taverna-menu-impl/src/main/java/net/sf/taverna/t2/workbench/ui/impl/menu/EditMenu.java b/taverna-menu-impl/src/main/java/net/sf/taverna/t2/workbench/ui/impl/menu/EditMenu.java
deleted file mode 100644
index a15237c..0000000
--- a/taverna-menu-impl/src/main/java/net/sf/taverna/t2/workbench/ui/impl/menu/EditMenu.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************
- * 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 static java.awt.event.KeyEvent.VK_E;
-import static javax.swing.Action.MNEMONIC_KEY;
-import static net.sf.taverna.t2.ui.menu.DefaultMenuBar.DEFAULT_MENU_BAR;
-
-import java.net.URI;
-
-import net.sf.taverna.t2.ui.menu.AbstractMenu;
-
-public class EditMenu extends AbstractMenu {
-	public EditMenu() {
-		super(DEFAULT_MENU_BAR, 20, URI
-				.create("http://taverna.sf.net/2008/t2workbench/menu#edit"),
-				makeAction());
-	}
-
-	public static DummyAction makeAction() {
-		DummyAction action = new DummyAction("Edit");
-		action.putValue(MNEMONIC_KEY, Integer.valueOf(VK_E));
-		return action;
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-menu-impl/src/main/java/net/sf/taverna/t2/workbench/ui/impl/menu/FeedbackMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-menu-impl/src/main/java/net/sf/taverna/t2/workbench/ui/impl/menu/FeedbackMenuAction.java b/taverna-menu-impl/src/main/java/net/sf/taverna/t2/workbench/ui/impl/menu/FeedbackMenuAction.java
deleted file mode 100644
index 6b6eb7c..0000000
--- a/taverna-menu-impl/src/main/java/net/sf/taverna/t2/workbench/ui/impl/menu/FeedbackMenuAction.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*******************************************************************************
- * 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 static java.awt.Desktop.getDesktop;
-import static net.sf.taverna.t2.workbench.ui.impl.menu.HelpMenu.HELP_URI;
-
-import java.awt.event.ActionEvent;
-import java.io.IOException;
-import java.net.URI;
-import java.net.URISyntaxException;
-
-import javax.swing.AbstractAction;
-import javax.swing.Action;
-
-import net.sf.taverna.t2.ui.menu.AbstractMenuAction;
-
-import org.apache.log4j.Logger;
-
-/**
- * MenuItem for feedback
- * 
- * @author alanrw
- */
-public class FeedbackMenuAction extends AbstractMenuAction {
-	private static Logger logger = Logger.getLogger(FeedbackMenuAction.class);
-
-	private static String FEEDBACK_URL = "http://www.taverna.org.uk/about/contact-us/feedback/";
-
-	public FeedbackMenuAction() {
-		super(HELP_URI, 20);
-	}
-
-	@Override
-	protected Action createAction() {
-		return new FeedbackAction();
-	}
-
-	@SuppressWarnings("serial")
-	private final class FeedbackAction extends AbstractAction {
-		private FeedbackAction() {
-			super("Contact us");
-		}
-
-		@Override
-		public void actionPerformed(ActionEvent e) {
-			try {
-				getDesktop().browse(new URI(FEEDBACK_URL));
-			} catch (IOException e1) {
-				logger.error("Unable to open URL", e1);
-			} catch (URISyntaxException e1) {
-				logger.error("Invalid URL syntax", e1);
-			}
-		}
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-menu-impl/src/main/java/net/sf/taverna/t2/workbench/ui/impl/menu/FileMenu.java
----------------------------------------------------------------------
diff --git a/taverna-menu-impl/src/main/java/net/sf/taverna/t2/workbench/ui/impl/menu/FileMenu.java b/taverna-menu-impl/src/main/java/net/sf/taverna/t2/workbench/ui/impl/menu/FileMenu.java
deleted file mode 100644
index 61f963b..0000000
--- a/taverna-menu-impl/src/main/java/net/sf/taverna/t2/workbench/ui/impl/menu/FileMenu.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * 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 static java.awt.event.KeyEvent.VK_F;
-import static javax.swing.Action.MNEMONIC_KEY;
-import static net.sf.taverna.t2.ui.menu.DefaultMenuBar.DEFAULT_MENU_BAR;
-
-import java.net.URI;
-
-import net.sf.taverna.t2.ui.menu.AbstractMenu;
-
-/**
- * File menu
- * 
- * @author Stian Soiland-Reyes
- */
-public class FileMenu extends AbstractMenu {
-	public FileMenu() {
-		super(DEFAULT_MENU_BAR, 10, URI
-				.create("http://taverna.sf.net/2008/t2workbench/menu#file"),
-				makeAction());
-	}
-
-	public static DummyAction makeAction() {
-		DummyAction action = new DummyAction("File");
-		action.putValue(MNEMONIC_KEY, Integer.valueOf(VK_F));
-		return action;
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-menu-impl/src/main/java/net/sf/taverna/t2/workbench/ui/impl/menu/HelpMenu.java
----------------------------------------------------------------------
diff --git a/taverna-menu-impl/src/main/java/net/sf/taverna/t2/workbench/ui/impl/menu/HelpMenu.java b/taverna-menu-impl/src/main/java/net/sf/taverna/t2/workbench/ui/impl/menu/HelpMenu.java
deleted file mode 100644
index c4169cc..0000000
--- a/taverna-menu-impl/src/main/java/net/sf/taverna/t2/workbench/ui/impl/menu/HelpMenu.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * 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 static java.awt.event.KeyEvent.VK_H;
-import static javax.swing.Action.MNEMONIC_KEY;
-import static net.sf.taverna.t2.ui.menu.DefaultMenuBar.DEFAULT_MENU_BAR;
-
-import java.net.URI;
-
-import net.sf.taverna.t2.ui.menu.AbstractMenu;
-
-public class HelpMenu extends AbstractMenu {
-	public static final URI HELP_URI = URI
-			.create("http://taverna.sf.net/2008/t2workbench/menu#help");
-
-	public HelpMenu() {
-		super(DEFAULT_MENU_BAR, 1024, HELP_URI, makeAction());
-	}
-
-	public static DummyAction makeAction() {
-		DummyAction action = new DummyAction("Help");
-		action.putValue(MNEMONIC_KEY, Integer.valueOf(VK_H));
-		return action;
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-menu-impl/src/main/java/net/sf/taverna/t2/workbench/ui/impl/menu/OnlineHelpMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-menu-impl/src/main/java/net/sf/taverna/t2/workbench/ui/impl/menu/OnlineHelpMenuAction.java b/taverna-menu-impl/src/main/java/net/sf/taverna/t2/workbench/ui/impl/menu/OnlineHelpMenuAction.java
deleted file mode 100644
index d091c8e..0000000
--- a/taverna-menu-impl/src/main/java/net/sf/taverna/t2/workbench/ui/impl/menu/OnlineHelpMenuAction.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*******************************************************************************
- * 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 static java.awt.event.KeyEvent.VK_F1;
-import static javax.swing.KeyStroke.getKeyStroke;
-import static net.sf.taverna.t2.workbench.helper.Helper.displayDefaultHelp;
-import static net.sf.taverna.t2.workbench.ui.impl.menu.HelpMenu.HELP_URI;
-
-import java.awt.AWTEvent;
-import java.awt.event.ActionEvent;
-
-import javax.swing.AbstractAction;
-import javax.swing.Action;
-
-import net.sf.taverna.t2.ui.menu.AbstractMenuAction;
-
-/**
- * MenuItem for help
- * 
- * @author alanrw
- */
-public class OnlineHelpMenuAction extends AbstractMenuAction {
-	public OnlineHelpMenuAction() {
-		super(HELP_URI, 10);
-	}
-
-	@Override
-	protected Action createAction() {
-		return new OnlineHelpAction();
-	}
-
-	@SuppressWarnings("serial")
-	private final class OnlineHelpAction extends AbstractAction {
-		private OnlineHelpAction() {
-			super("Online help");
-			putValue(ACCELERATOR_KEY, getKeyStroke(VK_F1, 0));
-
-		}
-
-		/**
-		 * When selected, use the Helper to display the default help.
-		 */
-		@Override
-		public void actionPerformed(ActionEvent e) {
-			displayDefaultHelp((AWTEvent) e);
-			// TODO change helper to bean?
-		}
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-menu-impl/src/main/java/net/sf/taverna/t2/workbench/ui/impl/menu/ShowLogsAndDataMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-menu-impl/src/main/java/net/sf/taverna/t2/workbench/ui/impl/menu/ShowLogsAndDataMenuAction.java b/taverna-menu-impl/src/main/java/net/sf/taverna/t2/workbench/ui/impl/menu/ShowLogsAndDataMenuAction.java
deleted file mode 100644
index 308d51d..0000000
--- a/taverna-menu-impl/src/main/java/net/sf/taverna/t2/workbench/ui/impl/menu/ShowLogsAndDataMenuAction.java
+++ /dev/null
@@ -1,89 +0,0 @@
-package net.sf.taverna.t2.workbench.ui.impl.menu;
-
-import static java.lang.Runtime.getRuntime;
-import static javax.swing.JOptionPane.INFORMATION_MESSAGE;
-import static javax.swing.JOptionPane.showInputDialog;
-import static net.sf.taverna.t2.workbench.MainWindow.getMainWindow;
-import static net.sf.taverna.t2.workbench.ui.impl.menu.AdvancedMenu.ADVANCED_URI;
-
-import java.awt.event.ActionEvent;
-import java.io.File;
-
-import javax.swing.AbstractAction;
-import javax.swing.Action;
-
-import net.sf.taverna.t2.ui.menu.AbstractMenuAction;
-
-import org.apache.log4j.Logger;
-
-import uk.org.taverna.configuration.app.ApplicationConfiguration;
-
-public class ShowLogsAndDataMenuAction extends AbstractMenuAction {
-	private static final String OPEN = "open";
-	private static final String EXPLORER = "explorer";
-	// TODO Consider using xdg-open instead of gnome-open
-	private static final String GNOME_OPEN = "gnome-open";
-	private static final String WINDOWS = "Windows";
-	private static final String MAC_OS_X = "Mac OS X";
-
-	private ApplicationConfiguration applicationConfiguration;
-
-	public ShowLogsAndDataMenuAction() {
-		super(ADVANCED_URI, 200);
-	}
-
-	private static Logger logger = Logger.getLogger(ShowLogsAndDataMenuAction.class);
-
-	@Override
-	protected Action createAction() {
-		return new AbstractAction("Show logs and data folder") {
-			private static final long serialVersionUID = 1L;
-
-			@Override
-			public void actionPerformed(ActionEvent e) {
-				File logsAndDataDir = applicationConfiguration.getApplicationHomeDir();
-				showDirectory(logsAndDataDir, "Taverna logs and data folder");
-			}
-		};
-	}
-
-	public static void showDirectory(File dir, String title) {
-		String path = dir.getAbsolutePath();
-		String os = System.getProperty("os.name");
-		String cmd;
-		boolean isWindows = false;
-		if (os.equals(MAC_OS_X))
-			cmd = OPEN;
-		else if (os.startsWith(WINDOWS)) {
-			cmd = EXPLORER;
-			isWindows = true;
-		} else
-			// Assume Unix - best option is gnome-open
-			cmd = GNOME_OPEN;
-
-		String[] cmdArray = new String[2];
-		cmdArray[0] = cmd;
-		cmdArray[1] = path;
-		try {
-			Process exec = getRuntime().exec(cmdArray);
-			Thread.sleep(300);
-			exec.getErrorStream().close();
-			exec.getInputStream().close();
-			exec.getOutputStream().close();
-			exec.waitFor();
-			if (exec.exitValue() == 0 || isWindows && exec.exitValue() == 1)
-				// explorer.exe thinks 1 means success
-				return;
-			logger.warn("Exit value from " + cmd + " " + path + ": " + exec.exitValue());
-		} catch (Exception ex) {
-			logger.warn("Could not call " + cmd + " " + path, ex);
-		}
-		// Fall-back - just show a dialogue with the path
-		showInputDialog(getMainWindow(), "Copy path from below:", title,
-				INFORMATION_MESSAGE, null, null, path);
-	}
-
-	public void setApplicationConfiguration(ApplicationConfiguration applicationConfiguration) {
-		this.applicationConfiguration = applicationConfiguration;
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/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
deleted file mode 100644
index 2df05e5..0000000
--- a/taverna-menu-impl/src/main/java/net/sf/taverna/t2/workbench/ui/impl/menu/ViewShowMenuSection.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * 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/a9a52bd5/taverna-menu-impl/src/main/java/org/apache/taverna/ui/menu/impl/MenuManagerImpl.java
----------------------------------------------------------------------
diff --git a/taverna-menu-impl/src/main/java/org/apache/taverna/ui/menu/impl/MenuManagerImpl.java b/taverna-menu-impl/src/main/java/org/apache/taverna/ui/menu/impl/MenuManagerImpl.java
new file mode 100644
index 0000000..826114e
--- /dev/null
+++ b/taverna-menu-impl/src/main/java/org/apache/taverna/ui/menu/impl/MenuManagerImpl.java
@@ -0,0 +1,879 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.ui.menu.impl;
+
+import static java.lang.Math.min;
+import static javax.help.CSH.setHelpIDString;
+import static javax.swing.Action.NAME;
+import static javax.swing.Action.SHORT_DESCRIPTION;
+import static org.apache.taverna.lang.ui.ShadedLabel.GREEN;
+import static org.apache.taverna.ui.menu.AbstractMenuSection.SECTION_COLOR;
+import static org.apache.taverna.ui.menu.DefaultContextualMenu.DEFAULT_CONTEXT_MENU;
+import static org.apache.taverna.ui.menu.DefaultMenuBar.DEFAULT_MENU_BAR;
+import static org.apache.taverna.ui.menu.DefaultToolBar.DEFAULT_TOOL_BAR;
+
+import java.awt.Color;
+import java.awt.Component;
+import java.lang.ref.WeakReference;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.WeakHashMap;
+
+import javax.swing.AbstractButton;
+import javax.swing.Action;
+import javax.swing.ButtonGroup;
+import javax.swing.JButton;
+import javax.swing.JCheckBoxMenuItem;
+import javax.swing.JMenu;
+import javax.swing.JMenuBar;
+import javax.swing.JMenuItem;
+import javax.swing.JPopupMenu;
+import javax.swing.JRadioButtonMenuItem;
+import javax.swing.JToggleButton;
+import javax.swing.JToolBar;
+import javax.swing.border.EmptyBorder;
+
+import org.apache.taverna.lang.observer.MultiCaster;
+import org.apache.taverna.lang.observer.Observable;
+import org.apache.taverna.lang.observer.Observer;
+import org.apache.taverna.lang.observer.SwingAwareObserver;
+import org.apache.taverna.lang.ui.ShadedLabel;
+import org.apache.taverna.ui.menu.AbstractMenuAction;
+import org.apache.taverna.ui.menu.AbstractMenuOptionGroup;
+import org.apache.taverna.ui.menu.ContextualMenuComponent;
+import org.apache.taverna.ui.menu.ContextualSelection;
+import org.apache.taverna.ui.menu.DesignOnlyAction;
+import org.apache.taverna.ui.menu.DesignOrResultsAction;
+import org.apache.taverna.ui.menu.MenuComponent;
+import org.apache.taverna.ui.menu.MenuComponent.MenuType;
+import org.apache.taverna.ui.menu.MenuManager;
+import org.apache.taverna.workbench.selection.SelectionManager;
+import org.apache.taverna.workbench.selection.events.PerspectiveSelectionEvent;
+import org.apache.taverna.workbench.selection.events.SelectionManagerEvent;
+
+import org.apache.log4j.Logger;
+
+/**
+ * Implementation of {@link MenuManager}.
+ *
+ * @author Stian Soiland-Reyes
+ */
+public class MenuManagerImpl implements MenuManager {
+	private static Logger logger = Logger.getLogger(MenuManagerImpl.class);
+
+	private boolean needsUpdate;
+	/**
+	 * Cache used by {@link #getURIByComponent(Component)}
+	 */
+	private WeakHashMap<Component, URI> componentToUri;
+	/**
+	 * {@link MenuElementComparator} used for sorting menu components from the
+	 * SPI registry.
+	 */
+	private MenuElementComparator menuElementComparator = new MenuElementComparator();
+	/**
+	 * Map of {@link URI} to it's discovered children. Populated by
+	 * {@link #findChildren()}.
+	 */
+	private HashMap<URI, List<MenuComponent>> menuElementTree;
+	/**
+	 * Multicaster to distribute messages to {@link Observer}s of this menu
+	 * manager.
+	 */
+	private MultiCaster<MenuManagerEvent> multiCaster;
+	/**
+	 * Lock for {@link #update()}
+	 */
+	private final Object updateLock = new Object();
+	/**
+	 * True if {@link #doUpdate()} is running, subsequents call to
+	 * {@link #update()} will return immediately.
+	 */
+	private boolean updating;
+	/**
+	 * Cache used by {@link #getComponentByURI(URI)}
+	 */
+	private Map<URI, WeakReference<Component>> uriToComponent;
+	/**
+	 * Map from {@link URI} to defining {@link MenuComponent}. Children are in
+	 * {@link #menuElementTree}.
+	 */
+	private Map<URI, MenuComponent> uriToMenuElement;
+	// Note: Not reset by #resetCollections()
+	private Map<URI, List<WeakReference<Component>>> uriToPublishedComponents = new HashMap<>();
+	private List<MenuComponent> menuComponents = new ArrayList<>();
+
+	/**
+	 * Construct the MenuManagerImpl. Observes the SPI registry and does an
+	 * initial {@link #update()}.
+	 */
+	public MenuManagerImpl() {
+		multiCaster = new MultiCaster<>(this);
+		needsUpdate = true;
+	}
+
+	/**
+	 * {@inheritDoc}
+	 */
+	@Override
+	public void addMenuItemsWithExpansion(List<JMenuItem> menuItems,
+			JMenu parentMenu, int maxItemsInMenu,
+			ComponentFactory headerItemFactory) {
+		if (menuItems.size() <= maxItemsInMenu) {
+			// Just add them directly
+			for (JMenuItem menuItem : menuItems)
+				parentMenu.add(menuItem);
+			return;
+		}
+		int index = 0;
+		while (index < menuItems.size()) {
+			int toIndex = min(menuItems.size(), index + maxItemsInMenu);
+			if (toIndex == menuItems.size() - 1)
+				// Don't leave a single item left for the last subMenu
+				toIndex--;
+			List<JMenuItem> subList = menuItems.subList(index, toIndex);
+			JMenuItem firstItem = subList.get(0);
+			JMenuItem lastItem = subList.get(subList.size() - 1);
+			JMenu subMenu = new JMenu(firstItem.getText() + " ... "
+					+ lastItem.getText());
+			if (headerItemFactory != null)
+				subMenu.add(headerItemFactory.makeComponent());
+			for (JMenuItem menuItem : subList)
+				subMenu.add(menuItem);
+			parentMenu.add(subMenu);
+			index = toIndex;
+		}
+	}
+
+	@Override
+	public void addObserver(Observer<MenuManagerEvent> observer) {
+		multiCaster.addObserver(observer);
+	}
+
+	@Override
+	public JPopupMenu createContextMenu(Object parent, Object selection,
+			Component relativeToComponent) {
+		ContextualSelection contextualSelection = new ContextualSelection(
+				parent, selection, relativeToComponent);
+		JPopupMenu popupMenu = new JPopupMenu();
+		populateContextMenu(popupMenu, DEFAULT_CONTEXT_MENU,
+				contextualSelection);
+		registerComponent(DEFAULT_CONTEXT_MENU, popupMenu, true);
+		return popupMenu;
+	}
+
+	@Override
+	public JMenuBar createMenuBar() {
+		return createMenuBar(DEFAULT_MENU_BAR);
+	}
+
+	@Override
+	public JMenuBar createMenuBar(URI id) {
+		JMenuBar menuBar = new JMenuBar();
+		if (needsUpdate)
+			update();
+		populateMenuBar(menuBar, id);
+		registerComponent(id, menuBar, true);
+		return menuBar;
+	}
+
+	@Override
+	public JToolBar createToolBar() {
+		return createToolBar(DEFAULT_TOOL_BAR);
+	}
+
+	@Override
+	public JToolBar createToolBar(URI id) {
+		JToolBar toolbar = new JToolBar();
+		if (needsUpdate)
+			update();
+		populateToolBar(toolbar, id);
+		registerComponent(id, toolbar, true);
+		return toolbar;
+	}
+
+	@Override
+	public synchronized Component getComponentByURI(URI id) {
+		WeakReference<Component> componentRef = uriToComponent.get(id);
+		if (componentRef == null)
+			return null;
+		// Might also be null it reference has gone dead
+		return componentRef.get();
+	}
+
+	@Override
+	public List<Observer<MenuManagerEvent>> getObservers() {
+		return multiCaster.getObservers();
+	}
+
+	@Override
+	public synchronized URI getURIByComponent(Component component) {
+		return componentToUri.get(component);
+	}
+
+	@Override
+	public void removeObserver(Observer<MenuManagerEvent> observer) {
+		multiCaster.removeObserver(observer);
+	}
+
+	@Override
+	public void update() {
+		synchronized (updateLock) {
+			if (updating && !needsUpdate)
+				return;
+			updating = true;
+		}
+		try {
+			doUpdate();
+		} finally {
+			synchronized (updateLock) {
+				updating = false;
+				needsUpdate = false;
+			}
+		}
+	}
+
+	public void update(Object service, Map<?, ?> properties) {
+		needsUpdate = true;
+		update();
+	}
+
+	/**
+	 * Add a {@link JMenu} to the list of components as described by the menu
+	 * component. If there are no children, the menu is not added.
+	 *
+	 * @param components
+	 *            List of components where to add the created {@link JMenu}
+	 * @param menuComponent
+	 *            The {@link MenuComponent} definition for this menu
+	 * @param isToolbar
+	 *            True if the list of components is to be added to a toolbar
+	 */
+	private void addMenu(List<Component> components,
+			MenuComponent menuComponent, MenuOptions menuOptions) {
+		URI menuId = menuComponent.getId();
+		if (menuOptions.isToolbar()) {
+			logger.warn("Can't have menu " + menuComponent
+					+ " within toolBar element");
+			return;
+		}
+		MenuOptions childOptions = new MenuOptions(menuOptions);
+		List<Component> subComponents = makeComponents(menuId, childOptions);
+		if (subComponents.isEmpty()) {
+			logger.warn("No sub components found for menu " + menuId);
+			return;
+		}
+
+		JMenu menu = new JMenu(menuComponent.getAction());
+		for (Component menuItem : subComponents)
+			if (menuItem == null)
+				menu.addSeparator();
+			else
+				menu.add(menuItem);
+		registerComponent(menuId, menu);
+		components.add(menu);
+	}
+
+	/**
+	 * Add <code>null</code> to the list of components, meaning that a separator
+	 * is to be created. Subsequent separators are ignored, and if there are no
+	 * components on the list already no separator will be added.
+	 * 
+	 * @param components
+	 *            List of components
+	 */
+	private void addNullSeparator(List<Component> components) {
+		if (components.isEmpty())
+			// Don't start with a separator
+			return;
+		if (components.get(components.size() - 1) == null)
+			// Already a separator in last position
+			return;
+		components.add(null);
+	}
+
+	/**
+	 * Add an {@link AbstractMenuOptionGroup option group} to the list of
+	 * components
+	 *
+	 * @param components
+	 *            List of components where to add the created {@link JMenu}
+	 * @param optionGroupId
+	 *            The {@link URI} identifying the option group
+	 * @param isToolbar
+	 *            True if the option group is to be added to a toolbar
+	 */
+	private void addOptionGroup(List<Component> components, URI optionGroupId,
+			MenuOptions menuOptions) {
+		MenuOptions childOptions = new MenuOptions(menuOptions);
+		childOptions.setOptionGroup(true);
+
+		List<Component> buttons = makeComponents(optionGroupId, childOptions);
+		addNullSeparator(components);
+		if (buttons.isEmpty()) {
+			logger.warn("No sub components found for option group "
+					+ optionGroupId);
+			return;
+		}
+		ButtonGroup buttonGroup = new ButtonGroup();
+
+		for (Component button : buttons) {
+			if (button instanceof AbstractButton)
+				buttonGroup.add((AbstractButton) button);
+			else
+				logger.warn("Component of button group " + optionGroupId
+						+ " is not an AbstractButton: " + button);
+			if (button == null) {
+				logger.warn("Separator found within button group");
+				addNullSeparator(components);
+			} else
+				components.add(button);
+		}
+		addNullSeparator(components);
+	}
+
+	/**
+	 * Add a section to a list of components.
+	 *
+	 * @param components
+	 *            List of components
+	 * @param sectionId
+	 *            The {@link URI} identifying the section
+	 * @param menuOptions
+	 *            {@link MenuOptions options} for creating the menu
+	 */
+	private void addSection(List<Component> components, URI sectionId,
+			MenuOptions menuOptions) {
+		List<Component> childComponents = makeComponents(sectionId, menuOptions);
+
+		MenuComponent sectionDef = uriToMenuElement.get(sectionId);
+		addNullSeparator(components);
+		if (childComponents.isEmpty()) {
+			logger.warn("No sub components found for section " + sectionId);
+			return;
+		}
+		Action sectionAction = sectionDef.getAction();
+		if (sectionAction != null) {
+			String sectionLabel = (String) sectionAction.getValue(NAME);
+			if (sectionLabel != null) {
+				// No separators before the label
+				stripTrailingNullSeparator(components);
+				Color labelColor = (Color) sectionAction.getValue(SECTION_COLOR);
+				if (labelColor == null)
+					labelColor = GREEN;
+				ShadedLabel label = new ShadedLabel(sectionLabel, labelColor);
+				components.add(label);
+			}
+		}
+		for (Component childComponent : childComponents)
+			if (childComponent == null) {
+				logger.warn("Separator found within section " + sectionId);
+				addNullSeparator(components);
+			} else
+				components.add(childComponent);
+		addNullSeparator(components);
+	}
+
+	/**
+	 * Remove the last <code>null</code> separator from the list of components
+	 * if it's present.
+	 *
+	 * @param components
+	 *            List of components
+	 */
+	private void stripTrailingNullSeparator(List<Component> components) {
+		if (!components.isEmpty()) {
+			int lastIndex = components.size() - 1;
+			if (components.get(lastIndex) == null)
+				components.remove(lastIndex);
+		}
+	}
+
+	/**
+	 * Perform the actual update, called by {@link #update()}. Reset all the
+	 * collections, refresh from SPI, modify any previously published components
+	 * and notify any observers.
+	 */
+	protected synchronized void doUpdate() {
+		resetCollections();
+		findChildren();
+		updatePublishedComponents();
+		multiCaster.notify(new UpdatedMenuManagerEvent());
+	}
+
+	/**
+	 * Find all children for all known menu components. Populates
+	 * {@link #uriToMenuElement}.
+	 *
+	 */
+	protected void findChildren() {
+		for (MenuComponent menuElement : menuComponents) {
+			uriToMenuElement.put(menuElement.getId(), menuElement);
+			logger.debug("Found menu element " + menuElement.getId() + " "
+					+ menuElement);
+			if (menuElement.getParentId() == null)
+				continue;
+			List<MenuComponent> siblings = menuElementTree.get(menuElement
+					.getParentId());
+			if (siblings == null) {
+				siblings = new ArrayList<>();
+				synchronized (menuElementTree) {
+					menuElementTree.put(menuElement.getParentId(), siblings);
+				}
+			}
+			siblings.add(menuElement);
+		}
+//		if (uriToMenuElement.isEmpty()) {
+//			logger.error("No menu elements found, check classpath/Raven/SPI");
+//		}
+	}
+
+	/**
+	 * Get the children which have the given URI specified as their parent, or
+	 * an empty list if no children exist.
+	 *
+	 * @param id
+	 *            The {@link URI} of the parent
+	 * @return The {@link List} of {@link MenuComponent} which have the given
+	 *         parent
+	 */
+	protected List<MenuComponent> getChildren(URI id) {
+		List<MenuComponent> children = null;
+		synchronized (menuElementTree) {
+			children = menuElementTree.get(id);
+			if (children != null)
+				children = new ArrayList<>(children);
+		}
+		if (children == null)
+			children = Collections.<MenuComponent> emptyList();
+		else
+			Collections.sort(children, menuElementComparator);
+		return children;
+	}
+
+	/**
+	 * Make the list of Swing {@link Component}s that are the children of the
+	 * given {@link URI}.
+	 *
+	 * @param id
+	 *            The {@link URI} of the parent which children are to be made
+	 * @param menuOptions
+	 *            Options of the created menu, for instance
+	 *            {@link MenuOptions#isToolbar()}.
+	 * @return A {@link List} of {@link Component}s that can be added to a
+	 *         {@link JMenuBar}, {@link JMenu} or {@link JToolBar}.
+	 */
+	protected List<Component> makeComponents(URI id, MenuOptions menuOptions) {
+		List<Component> components = new ArrayList<>();
+		for (MenuComponent childElement : getChildren(id)) {
+			if (childElement instanceof ContextualMenuComponent)
+				((ContextualMenuComponent) childElement)
+						.setContextualSelection(menuOptions
+								.getContextualSelection());
+			/*
+			 * Important - check this AFTER setContextualSelection so the item
+			 * can change it's enabled-state if needed.
+			 */
+			if (!childElement.isEnabled())
+				continue;
+			MenuType type = childElement.getType();
+			Action action = childElement.getAction();
+			URI childId = childElement.getId();
+			if (type.equals(MenuType.action)) {
+				if (action == null) {
+					logger.warn("Skipping invalid action " + childId + " for "
+							+ id);
+					continue;
+				}
+
+				Component actionComponent;
+				if (menuOptions.isOptionGroup()) {
+					if (menuOptions.isToolbar()) {
+						actionComponent = new JToggleButton(action);
+						toolbarizeButton((AbstractButton) actionComponent);
+					} else
+						actionComponent = new JRadioButtonMenuItem(action);
+				} else {
+					if (menuOptions.isToolbar()) {
+						actionComponent = new JButton(action);
+						toolbarizeButton((AbstractButton) actionComponent);
+					} else
+						actionComponent = new JMenuItem(action);
+				}
+				registerComponent(childId, actionComponent);
+				components.add(actionComponent);
+			} else if (type.equals(MenuType.toggle)) {
+				if (action == null) {
+					logger.warn("Skipping invalid toggle " + childId + " for "
+							+ id);
+					continue;
+				}
+				Component toggleComponent;
+				if (menuOptions.isToolbar())
+					toggleComponent = new JToggleButton(action);
+				else
+					toggleComponent = new JCheckBoxMenuItem(action);
+				registerComponent(childId, toggleComponent);
+				components.add(toggleComponent);
+			} else if (type.equals(MenuType.custom)) {
+				Component customComponent = childElement.getCustomComponent();
+				if (customComponent == null) {
+					logger.warn("Skipping null custom component " + childId
+							+ " for " + id);
+					continue;
+				}
+				registerComponent(childId, customComponent);
+				components.add(customComponent);
+			} else if (type.equals(MenuType.optionGroup))
+				addOptionGroup(components, childId, menuOptions);
+			else if (type.equals(MenuType.section))
+				addSection(components, childId, menuOptions);
+			else if (type.equals(MenuType.menu))
+				addMenu(components, childElement, menuOptions);
+			else {
+				logger.warn("Skipping invalid/unknown type " + type + " for "
+						+ id);
+				continue;
+			}
+		}
+		stripTrailingNullSeparator(components);
+		return components;
+	}
+
+	/**
+	 * Fill the specified menu bar with the menu elements that have the given
+	 * URI as their parent.
+	 * <p>
+	 * Existing elements on the menu bar will be removed.
+	 *
+	 * @param menuBar
+	 *            The {@link JMenuBar} to update
+	 * @param id
+	 *            The {@link URI} of the menu bar
+	 */
+	protected void populateMenuBar(JMenuBar menuBar, URI id) {
+		menuBar.removeAll();
+		MenuComponent menuDef = uriToMenuElement.get(id);
+		if (menuDef == null)
+			throw new IllegalArgumentException("Unknown menuBar " + id);
+		if (!menuDef.getType().equals(MenuType.menu))
+			throw new IllegalArgumentException("Element " + id
+					+ " is not a menu, but a " + menuDef.getType());
+		MenuOptions menuOptions = new MenuOptions();
+		for (Component component : makeComponents(id, menuOptions))
+			if (component == null)
+				logger.warn("Ignoring separator in menu bar " + id);
+			else
+				menuBar.add(component);
+	}
+
+	/**
+	 * Fill the specified menu bar with the menu elements that have the given
+	 * URI as their parent.
+	 * <p>
+	 * Existing elements on the menu bar will be removed.
+	 *
+	 * @param popupMenu
+	 *            The {@link JPopupMenu} to update
+	 * @param id
+	 *            The {@link URI} of the menu bar
+	 * @param contextualSelection
+	 *            The current selection for the context menu
+	 */
+	protected void populateContextMenu(JPopupMenu popupMenu, URI id,
+			ContextualSelection contextualSelection) {
+		popupMenu.removeAll();
+		MenuComponent menuDef = uriToMenuElement.get(id);
+		if (menuDef == null)
+			throw new IllegalArgumentException("Unknown menuBar " + id);
+		if (!menuDef.getType().equals(MenuType.menu))
+			throw new IllegalArgumentException("Element " + id
+					+ " is not a menu, but a " + menuDef.getType());
+		MenuOptions menuOptions = new MenuOptions();
+		menuOptions.setContextualSelection(contextualSelection);
+		for (Component component : makeComponents(id, menuOptions))
+			if (component == null)
+				popupMenu.addSeparator();
+			else
+				popupMenu.add(component);
+	}
+
+	/**
+	 * Fill the specified tool bar with the elements that have the given URI as
+	 * their parent.
+	 * <p>
+	 * Existing elements on the tool bar will be removed.
+	 *
+	 * @param toolbar
+	 *            The {@link JToolBar} to update
+	 * @param id
+	 *            The {@link URI} of the tool bar
+	 */
+	protected void populateToolBar(JToolBar toolbar, URI id) {
+		toolbar.removeAll();
+		MenuComponent toolbarDef = uriToMenuElement.get(id);
+		if (toolbarDef == null)
+			throw new IllegalArgumentException("Unknown toolBar " + id);
+		if (!toolbarDef.getType().equals(MenuType.toolBar))
+			throw new IllegalArgumentException("Element " + id
+					+ " is not a toolBar, but a " + toolbarDef.getType());
+		if (toolbarDef.getAction() != null) {
+			String name = (String) toolbarDef.getAction().getValue(Action.NAME);
+			toolbar.setName(name);
+		} else
+			toolbar.setName("");
+		MenuOptions menuOptions = new MenuOptions();
+		menuOptions.setToolbar(true);
+		for (Component component : makeComponents(id, menuOptions)) {
+			if (component == null) {
+				toolbar.addSeparator();
+				continue;
+			}
+			if (component instanceof JButton) {
+				JButton toolbarButton = (JButton) component;
+				toolbarButton.putClientProperty("hideActionText", true);
+			}
+			toolbar.add(component);
+		}
+	}
+
+	/**
+	 * Register a component that has been created. Such a component can be
+	 * resolved through {@link #getComponentByURI(URI)}.
+	 *
+	 * @param id
+	 *            The {@link URI} that defined the component
+	 * @param component
+	 *            The {@link Component} that was created.
+	 */
+	protected synchronized void registerComponent(URI id, Component component) {
+		registerComponent(id, component, false);
+	}
+
+	/**
+	 * Register a component that has been created. Such a component can be
+	 * resolved through {@link #getComponentByURI(URI)}.
+	 *
+	 * @param id
+	 *            The {@link URI} that defined the component
+	 * @param component
+	 *            The {@link Component} that was created.
+	 * @param published
+	 *            <code>true</code> if the component has been published through
+	 *            {@link #createMenuBar()} or similar, and is to be
+	 *            automatically updated by later calls to {@link #update()}.
+	 */
+	protected synchronized void registerComponent(URI id, Component component,
+			boolean published) {
+		uriToComponent.put(id, new WeakReference<>(component));
+		componentToUri.put(component, id);
+		if (published) {
+			List<WeakReference<Component>> publishedComponents = uriToPublishedComponents
+					.get(id);
+			if (publishedComponents == null) {
+				publishedComponents = new ArrayList<>();
+				uriToPublishedComponents.put(id, publishedComponents);
+			}
+			publishedComponents.add(new WeakReference<>(component));
+		}
+		setHelpStringForComponent(component, id);
+	}
+
+	/**
+	 * Reset all collections
+	 *
+	 */
+	protected synchronized void resetCollections() {
+		menuElementTree = new HashMap<>();
+		componentToUri = new WeakHashMap<>();
+		uriToMenuElement = new HashMap<>();
+		uriToComponent = new HashMap<>();
+	}
+
+	/**
+	 * Set javax.help string to identify the component for later references to
+	 * the help document. Note that the component (ie. the
+	 * {@link AbstractMenuAction} must have an ID for an registration to take
+	 * place.
+	 *
+	 * @param component
+	 *            The {@link Component} to set help string for
+	 * @param componentId
+	 *            The {@link URI} to be used as identifier
+	 */
+	protected void setHelpStringForComponent(Component component,
+			URI componentId) {
+		if (componentId != null) {
+			String helpId = componentId.toASCIIString();
+			setHelpIDString(component, helpId);
+		}
+	}
+
+	/**
+	 * Make an {@link AbstractButton} be configured in a "toolbar-like" way, for
+	 * instance showing only the icon.
+	 *
+	 * @param actionButton
+	 *            Button to toolbarise
+	 */
+	protected void toolbarizeButton(AbstractButton actionButton) {
+		Action action = actionButton.getAction();
+		if (action.getValue(SHORT_DESCRIPTION) == null)
+			action.putValue(SHORT_DESCRIPTION, action.getValue(NAME));
+		actionButton.setBorder(new EmptyBorder(0, 2, 0, 2));
+		// actionButton.setHorizontalTextPosition(JButton.CENTER);
+		// actionButton.setVerticalTextPosition(JButton.BOTTOM);
+		if (action.getValue(Action.SMALL_ICON) != null) {
+			// Don't show the text
+			actionButton.putClientProperty("hideActionText", true);
+			// Since hideActionText seems to be broken in Java 5 and/or OS X
+			actionButton.setText(null);
+		}
+	}
+
+	/**
+	 * Update all components that have been published using
+	 * {@link #createMenuBar()} and similar. Content of such components will be
+	 * removed and replaced by fresh components.
+	 */
+	protected void updatePublishedComponents() {
+		for (Entry<URI, List<WeakReference<Component>>> entry : uriToPublishedComponents
+				.entrySet())
+			for (WeakReference<Component> reference : entry.getValue()) {
+				URI id = entry.getKey();
+				Component component = reference.get();
+				if (component == null)
+					continue;
+				if (component instanceof JToolBar)
+					populateToolBar((JToolBar) component, id);
+				else if (component instanceof JMenuBar)
+					populateMenuBar((JMenuBar) component, id);
+				else
+					logger.warn("Could not update published component " + id
+							+ ": " + component.getClass());
+			}
+	}
+
+	public void setMenuComponents(List<MenuComponent> menuComponents) {
+		this.menuComponents = menuComponents;
+	}
+
+	public void setSelectionManager(SelectionManager selectionManager) {
+		selectionManager.addObserver(new SelectionManagerObserver());
+	}
+
+	/**
+	 * {@link Comparator} that can order {@link MenuComponent}s by their
+	 * {@link MenuComponent#getPositionHint()}.
+	 */
+	protected static class MenuElementComparator implements
+			Comparator<MenuComponent> {
+		@Override
+		public int compare(MenuComponent a, MenuComponent b) {
+			return a.getPositionHint() - b.getPositionHint();
+		}
+	}
+
+	/**
+	 * Various options for
+	 * {@link MenuManagerImpl#makeComponents(URI, MenuOptions)} and friends.
+	 *
+	 * @author Stian Soiland-Reyes
+	 */
+	public static class MenuOptions {
+		private boolean isToolbar = false;
+		private boolean isOptionGroup = false;
+		private ContextualSelection contextualSelection = null;
+
+		public ContextualSelection getContextualSelection() {
+			return contextualSelection;
+		}
+
+		public void setContextualSelection(
+				ContextualSelection contextualSelection) {
+			this.contextualSelection = contextualSelection;
+		}
+
+		public MenuOptions(MenuOptions original) {
+			this.isOptionGroup = original.isOptionGroup();
+			this.isToolbar = original.isToolbar();
+			this.contextualSelection = original.getContextualSelection();
+		}
+
+		public MenuOptions() {
+		}
+
+		@Override
+		protected MenuOptions clone() {
+			return new MenuOptions(this);
+		}
+
+		public boolean isToolbar() {
+			return isToolbar;
+		}
+
+		public void setToolbar(boolean isToolbar) {
+			this.isToolbar = isToolbar;
+		}
+
+		public boolean isOptionGroup() {
+			return isOptionGroup;
+		}
+
+		public void setOptionGroup(boolean isOptionGroup) {
+			this.isOptionGroup = isOptionGroup;
+		}
+	}
+
+	private final class SelectionManagerObserver extends
+			SwingAwareObserver<SelectionManagerEvent> {
+		private static final String DESIGN_PERSPECTIVE_ID = "net.sf.taverna.t2.ui.perspectives.design.DesignPerspective";
+		private static final String RESULTS_PERSPECTIVE_ID = "net.sf.taverna.t2.ui.perspectives.results.ResultsPerspective";
+
+		@Override
+		public void notifySwing(Observable<SelectionManagerEvent> sender,
+				SelectionManagerEvent message) {
+			if (!(message instanceof PerspectiveSelectionEvent))
+				return;
+			handlePerspectiveSelect((PerspectiveSelectionEvent) message);
+		}
+
+		private void handlePerspectiveSelect(PerspectiveSelectionEvent event) {
+			String perspectiveID = event.getSelectedPerspective().getID();
+			boolean isDesign = DESIGN_PERSPECTIVE_ID.equals(perspectiveID);
+			boolean isResults = RESULTS_PERSPECTIVE_ID.equals(perspectiveID);
+
+			for (MenuComponent menuComponent : menuComponents)
+				if (!(menuComponent instanceof ContextualMenuComponent)) {
+					Action action = menuComponent.getAction();
+					if (action instanceof DesignOnlyAction)
+						action.setEnabled(isDesign);
+					else if (action instanceof DesignOrResultsAction)
+						action.setEnabled(isDesign || isResults);
+				}
+		}
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-menu-impl/src/main/java/org/apache/taverna/workbench/ui/impl/menu/AdvancedMenu.java
----------------------------------------------------------------------
diff --git a/taverna-menu-impl/src/main/java/org/apache/taverna/workbench/ui/impl/menu/AdvancedMenu.java b/taverna-menu-impl/src/main/java/org/apache/taverna/workbench/ui/impl/menu/AdvancedMenu.java
new file mode 100644
index 0000000..50c57e0
--- /dev/null
+++ b/taverna-menu-impl/src/main/java/org/apache/taverna/workbench/ui/impl/menu/AdvancedMenu.java
@@ -0,0 +1,43 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.impl.menu;
+
+import static java.awt.event.KeyEvent.VK_A;
+import static javax.swing.Action.MNEMONIC_KEY;
+import static org.apache.taverna.ui.menu.DefaultMenuBar.DEFAULT_MENU_BAR;
+
+import java.net.URI;
+
+import org.apache.taverna.ui.menu.AbstractMenu;
+
+public class AdvancedMenu extends AbstractMenu {
+	public static final URI ADVANCED_URI = URI
+			.create("http://taverna.sf.net/2008/t2workbench/menu#advanced");
+
+	public AdvancedMenu() {
+		super(DEFAULT_MENU_BAR, 1000, ADVANCED_URI, makeAction());
+	}
+
+	public static DummyAction makeAction() {
+		DummyAction action = new DummyAction("Advanced");
+		action.putValue(MNEMONIC_KEY, Integer.valueOf(VK_A));
+		return action;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-menu-impl/src/main/java/org/apache/taverna/workbench/ui/impl/menu/EditMenu.java
----------------------------------------------------------------------
diff --git a/taverna-menu-impl/src/main/java/org/apache/taverna/workbench/ui/impl/menu/EditMenu.java b/taverna-menu-impl/src/main/java/org/apache/taverna/workbench/ui/impl/menu/EditMenu.java
new file mode 100644
index 0000000..4d63107
--- /dev/null
+++ b/taverna-menu-impl/src/main/java/org/apache/taverna/workbench/ui/impl/menu/EditMenu.java
@@ -0,0 +1,42 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.impl.menu;
+
+import static java.awt.event.KeyEvent.VK_E;
+import static javax.swing.Action.MNEMONIC_KEY;
+import static org.apache.taverna.ui.menu.DefaultMenuBar.DEFAULT_MENU_BAR;
+
+import java.net.URI;
+
+import org.apache.taverna.ui.menu.AbstractMenu;
+
+public class EditMenu extends AbstractMenu {
+	public EditMenu() {
+		super(DEFAULT_MENU_BAR, 20, URI
+				.create("http://taverna.sf.net/2008/t2workbench/menu#edit"),
+				makeAction());
+	}
+
+	public static DummyAction makeAction() {
+		DummyAction action = new DummyAction("Edit");
+		action.putValue(MNEMONIC_KEY, Integer.valueOf(VK_E));
+		return action;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-menu-impl/src/main/java/org/apache/taverna/workbench/ui/impl/menu/FeedbackMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-menu-impl/src/main/java/org/apache/taverna/workbench/ui/impl/menu/FeedbackMenuAction.java b/taverna-menu-impl/src/main/java/org/apache/taverna/workbench/ui/impl/menu/FeedbackMenuAction.java
new file mode 100644
index 0000000..3cb6b7d
--- /dev/null
+++ b/taverna-menu-impl/src/main/java/org/apache/taverna/workbench/ui/impl/menu/FeedbackMenuAction.java
@@ -0,0 +1,74 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.impl.menu;
+
+import static java.awt.Desktop.getDesktop;
+import static org.apache.taverna.workbench.ui.impl.menu.HelpMenu.HELP_URI;
+
+import java.awt.event.ActionEvent;
+import java.io.IOException;
+import java.net.URI;
+import java.net.URISyntaxException;
+
+import javax.swing.AbstractAction;
+import javax.swing.Action;
+
+import org.apache.taverna.ui.menu.AbstractMenuAction;
+
+import org.apache.log4j.Logger;
+
+/**
+ * MenuItem for feedback
+ * 
+ * @author alanrw
+ */
+public class FeedbackMenuAction extends AbstractMenuAction {
+	private static Logger logger = Logger.getLogger(FeedbackMenuAction.class);
+
+	private static String FEEDBACK_URL = "http://www.taverna.org.uk/about/contact-us/feedback/";
+
+	public FeedbackMenuAction() {
+		super(HELP_URI, 20);
+	}
+
+	@Override
+	protected Action createAction() {
+		return new FeedbackAction();
+	}
+
+	@SuppressWarnings("serial")
+	private final class FeedbackAction extends AbstractAction {
+		private FeedbackAction() {
+			super("Contact us");
+		}
+
+		@Override
+		public void actionPerformed(ActionEvent e) {
+			try {
+				getDesktop().browse(new URI(FEEDBACK_URL));
+			} catch (IOException e1) {
+				logger.error("Unable to open URL", e1);
+			} catch (URISyntaxException e1) {
+				logger.error("Invalid URL syntax", e1);
+			}
+		}
+	}
+
+}


[35/51] [partial] incubator-taverna-workbench git commit: all packages are moved to org.apache.taverna.*

Posted by re...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/NewEditPasswordEntryDialog.java
----------------------------------------------------------------------
diff --git a/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/NewEditPasswordEntryDialog.java b/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/NewEditPasswordEntryDialog.java
deleted file mode 100644
index 4bb62e0..0000000
--- a/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/NewEditPasswordEntryDialog.java
+++ /dev/null
@@ -1,397 +0,0 @@
-/*******************************************************************************
- * 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.credentialmanager;
-
-import static java.awt.BorderLayout.CENTER;
-import static java.awt.BorderLayout.SOUTH;
-import static java.awt.GridBagConstraints.HORIZONTAL;
-import static java.awt.GridBagConstraints.NONE;
-import static java.awt.GridBagConstraints.WEST;
-import static javax.swing.JOptionPane.ERROR_MESSAGE;
-import static javax.swing.JOptionPane.WARNING_MESSAGE;
-import static javax.swing.JOptionPane.showMessageDialog;
-import static net.sf.taverna.t2.workbench.ui.credentialmanager.CMStrings.ALERT_TITLE;
-import static net.sf.taverna.t2.workbench.ui.credentialmanager.CMStrings.ERROR_TITLE;
-import static net.sf.taverna.t2.workbench.ui.credentialmanager.CMStrings.WARN_TITLE;
-
-import java.awt.BorderLayout;
-import java.awt.FlowLayout;
-import java.awt.GridBagConstraints;
-import java.awt.GridBagLayout;
-import java.awt.Insets;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.WindowAdapter;
-import java.awt.event.WindowEvent;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.List;
-
-import javax.swing.JButton;
-import javax.swing.JDialog;
-import javax.swing.JFrame;
-import javax.swing.JLabel;
-import javax.swing.JPasswordField;
-import javax.swing.JTextField;
-import javax.swing.JPanel;
-import javax.swing.border.CompoundBorder;
-import javax.swing.border.EmptyBorder;
-import javax.swing.border.EtchedBorder;
-
-import org.apache.log4j.Logger;
-
-import org.apache.taverna.security.credentialmanager.CMException;
-import org.apache.taverna.security.credentialmanager.CredentialManager;
-import net.sf.taverna.t2.workbench.helper.NonBlockedHelpEnabledDialog;
-
-/**
- * Dialog used for editing or entering new service URI, username or password for
- * a password entry.
- *
- * @author Alex Nenadic
- */
-@SuppressWarnings("serial")
-public class NewEditPasswordEntryDialog extends NonBlockedHelpEnabledDialog
-{
-	private static final Logger logger = Logger
-			.getLogger(NewEditPasswordEntryDialog.class);
-	/** 'Edit' mode constant - the dialog is in the 'edit' entry mode */
-	private static final String EDIT_MODE = "EDIT";
-	/** 'New' mode constant - the dialog is in the 'new' entry mode */
-	private static final String NEW_MODE = "NEW";
-
-	/**
-	 * Mode of this dialog - {@link #NEW_MODE} for entering new password entry
-	 * and {@link #EDIT_MODE} for editting an existing password entry
-	 */
-	String mode;
-	/** Service URI field */
-	private JTextField serviceURIField;
-	/** Username field */
-	private JTextField usernameField;
-	/** First password entry field */
-	private JPasswordField passwordField;
-	/** Password confirmation entry field */
-	private JPasswordField passwordConfirmField;
-	/** Stores service URI entered */
-	private URI serviceURI;
-	/** Stores previous service URI for {@link #EDIT_MODE} */
-	private URI serviceURIOld;
-	/** Stores username entered */
-	private String username;
-    /** Stores password entered*/
-    private String password;
-    private CredentialManager credentialManager;
-
-	public NewEditPasswordEntryDialog(JFrame parent, String title,
-			boolean modal, URI currentURI, String currentUsername,
-			String currentPassword, CredentialManager credentialManager) {
-		super(parent, title, modal);
-		serviceURI = currentURI;
-		username = currentUsername;
-		password = currentPassword;
-		this.credentialManager = credentialManager;
-		if (serviceURI == null && username == null && password == null) {
-			// if passed values are all null
-        	mode = NEW_MODE; // dialog is for entering a new password entry
-		} else {
-            mode = EDIT_MODE; // dialog is for editing an existing entry
-            serviceURIOld = currentURI;
-        }
-        initComponents();
-    }
-
-	public NewEditPasswordEntryDialog(JDialog parent, String title,
-			boolean modal, URI currentURI, String currentUsername,
-			String currentPassword, CredentialManager credentialManager) {
-		super(parent, title, modal);
-        serviceURI = currentURI;
-        username = currentUsername;
-        password = currentPassword;
-		this.credentialManager = credentialManager;
-		if (serviceURI == null && username == null && password == null) {
-			// if passed values are all null
-        	mode = NEW_MODE; // dialog is for entering new password entry
-		} else {
-            mode = EDIT_MODE; // dialog is for editing existing entry
-            serviceURIOld = currentURI;
-        }
-        initComponents();
-    }
-
-	private void initComponents() {
-		getContentPane().setLayout(new BorderLayout());
-
-        JLabel serviceURILabel = new JLabel("Service URI");
-        serviceURILabel.setBorder(new EmptyBorder(0,5,0,0));
-
-        JLabel usernameLabel = new JLabel("Username");
-        usernameLabel.setBorder(new EmptyBorder(0,5,0,0));
-
-        JLabel passwordLabel = new JLabel("Password");
-        passwordLabel.setBorder(new EmptyBorder(0,5,0,0));
-
-        JLabel passwordConfirmLabel = new JLabel("Confirm password");
-        passwordConfirmLabel.setBorder(new EmptyBorder(0,5,0,0));
-
-        serviceURIField = new JTextField();
-        //jtfServiceURI.setBorder(new EmptyBorder(0,0,0,5));
-
-        usernameField = new JTextField(15);
-        //jtfUsername.setBorder(new EmptyBorder(0,0,0,5));
-
-        passwordField = new JPasswordField(15);
-        //jpfFirstPassword.setBorder(new EmptyBorder(0,0,0,5));
-
-        passwordConfirmField = new JPasswordField(15);
-        //jpfConfirmPassword.setBorder(new EmptyBorder(0,0,0,5));
-
-        //If in EDIT_MODE - populate the fields with current values
-		if (mode.equals(EDIT_MODE)) {
-			serviceURIField.setText(serviceURI.toASCIIString());
-			usernameField.setText(username);
-			passwordField.setText(password);
-			passwordConfirmField.setText(password);
-		}
-
-		JButton okButton = new JButton("OK");
-		okButton.addActionListener(new ActionListener() {
-			@Override
-			public void actionPerformed(ActionEvent evt) {
-				okPressed();
-			}
-		});
-
-		JButton cancelButton = new JButton("Cancel");
-		cancelButton.addActionListener(new ActionListener() {
-			@Override
-			public void actionPerformed(ActionEvent evt) {
-				cancelPressed();
-			}
-		});
-
-		JPanel passwordPanel = new JPanel(new GridBagLayout());
-
-		GridBagConstraints gbc = new GridBagConstraints();
-		gbc.weighty = 0.0;
-
-		gbc.weightx = 0.0;
-		gbc.gridx = 0;
-		gbc.gridy = 0;
-		gbc.fill = NONE;
-		gbc.anchor = WEST;
-		gbc.insets = new Insets(5, 10, 0, 0);
-        passwordPanel.add(serviceURILabel, gbc);
-
-		gbc.weightx = 1.0;
-		gbc.gridx = 1;
-		gbc.gridy = 0;
-		gbc.fill = HORIZONTAL;
-		gbc.anchor = WEST;
-		gbc.insets = new Insets(5, 10, 0, 5);
-        passwordPanel.add(serviceURIField, gbc);
-
-		gbc.weightx = 0.0;
-		gbc.gridx = 0;
-		gbc.gridy = 1;
-		gbc.fill = NONE;
-		gbc.anchor = WEST;
-		gbc.insets = new Insets(5, 10, 0, 0);
-        passwordPanel.add(usernameLabel, gbc);
-
-		gbc.weightx = 1.0;
-		gbc.gridx = 1;
-		gbc.gridy = 1;
-		gbc.fill = HORIZONTAL;
-		gbc.anchor = WEST;
-		gbc.insets = new Insets(5, 10, 0, 5);
-        passwordPanel.add(usernameField, gbc);
-
-		gbc.weightx = 0.0;
-		gbc.gridx = 0;
-		gbc.gridy = 2;
-		gbc.fill = NONE;
-		gbc.anchor = WEST;
-		gbc.insets = new Insets(5, 10, 0, 0);
-        passwordPanel.add(passwordLabel, gbc);
-
-		gbc.weightx = 1.0;
-		gbc.gridx = 1;
-		gbc.gridy = 2;
-		gbc.fill = HORIZONTAL;
-		gbc.anchor = WEST;
-		gbc.insets = new Insets(5, 10, 0, 5);
-        passwordPanel.add(passwordField, gbc);
-
-		gbc.weightx = 0.0;
-		gbc.gridx = 0;
-		gbc.gridy = 3;
-		gbc.fill = NONE;
-		gbc.anchor = WEST;
-		gbc.insets = new Insets(5, 10, 0, 0);
-        passwordPanel.add(passwordConfirmLabel, gbc);
-
-		gbc.weightx = 1.0;
-		gbc.gridx = 1;
-		gbc.gridy = 3;
-		gbc.fill = HORIZONTAL;
-		gbc.anchor = WEST;
-		gbc.insets = new Insets(5, 10, 0, 5);
-		passwordPanel.add(passwordConfirmField, gbc);
-
-		passwordPanel.setBorder(new CompoundBorder(new EmptyBorder(10, 10, 10,
-				10), new EtchedBorder()));
-
-		JPanel buttonsPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
-		buttonsPanel.add(okButton);
-		buttonsPanel.add(cancelButton);
-
-		getContentPane().add(passwordPanel, CENTER);
-		getContentPane().add(buttonsPanel, SOUTH);
-
-		addWindowListener(new WindowAdapter() {
-			@Override
-			public void windowClosing(WindowEvent evt) {
-				closeDialog();
-			}
-		});
-
-        //setResizable(false);
-        getRootPane().setDefaultButton(okButton);
-        pack();
-    }
-
-	/**
-	 * Get the username entered in the dialog.
-	 */
-	public String getUsername() {
-		return username;
-	}
-
-	/**
-	 * Get the service URI entered in the dialog.
-	 */
-	public URI getServiceURI() {
-		return serviceURI;
-	}
-
-	/**
-	 * Get the password entered in the dialog.
-	 */
-	public String getPassword() {
-		return password;
-	}
-
-	/**
-	 * Checks that the user has entered a non-empty service URI, a non-empty
-	 * username, a non-empty password and that an entry with the same URI
-	 * already does not already exist in the Keystore. Store the new password.
-	 */
-	private boolean checkControls() {
-		String serviceURIString = new String(serviceURIField.getText());
-		if (serviceURIString.isEmpty()) {
-			showMessageDialog(this, "Service URI cannot be empty",
-					WARN_TITLE, WARNING_MESSAGE);
-			return false;
-		}
-    	try {
-			serviceURI = new URI(serviceURIString);
-		} catch (URISyntaxException e) {
-			showMessageDialog(this, "Service URI is not a valid URI",
-					WARN_TITLE, WARNING_MESSAGE);
-			return false;
-		}
-
-		username = new String(usernameField.getText());
-		if (username.isEmpty()) {
-			showMessageDialog(this, "Username cannot be empty", WARN_TITLE,
-					WARNING_MESSAGE);
-			return false;
-		}
-
-		String firstPassword = new String(passwordField.getPassword());
-		String confirmPassword = new String(passwordConfirmField.getPassword());
-
-		if (!firstPassword.equals(confirmPassword)) {
-			// passwords do not match
-			showMessageDialog(this, "Passwords do not match", WARN_TITLE,
-					WARNING_MESSAGE);
-			return false;
-		}
-		if (firstPassword.isEmpty()) {
-			// passwords match but are empty
-			showMessageDialog(this, "Password cannot be empty", WARN_TITLE,
-					WARNING_MESSAGE);
-			return false;
-		}
-
-		// passwords the same and non-empty
-		password = firstPassword;
-
-		// Check if the entered service URL is already associated with another password entry in the Keystore
-    	List<URI> uriList = null;
-    	try {
-			uriList = credentialManager.getServiceURIsForAllUsernameAndPasswordPairs();
-		} catch (CMException cme) {
-			// Failed to instantiate Credential Manager - warn the user and exit
-			String exMessage = "Failed to instantiate Credential Manager to check for duplicate service URIs.";
-			logger.error(exMessage, cme);
-			showMessageDialog(new JFrame(), exMessage, ERROR_TITLE,
-					ERROR_MESSAGE);
-			return false;
-		}
-
-       	if (uriList != null) { // should not be null really (although can be empty). Check anyway.
-       		if (mode.equals(EDIT_MODE)) // edit mode
-            	// Remove the current entry's service URI from the list
-                uriList.remove(serviceURIOld);
-
-   			if (uriList.contains(serviceURI)) { // found another entry for this service URI
-        		// Warn the user and exit
-				showMessageDialog(
-						this,
-						"The entered service URI is already associated with another password entry",
-						ALERT_TITLE, WARNING_MESSAGE);
-				return false;
-			}
-		}
-
-		return true;
-	}
-
-	private void okPressed() {
-		if (checkControls())
-			closeDialog();
-	}
-
-	private void cancelPressed() {
-    	// Set all fields to null to indicate that cancel button was pressed
-		serviceURI = null;
-		username = null;
-		password = null;
-		closeDialog();
-	}
-
-	private void closeDialog() {
-		setVisible(false);
-		dispose();
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/NewKeyPairEntryDialog.java
----------------------------------------------------------------------
diff --git a/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/NewKeyPairEntryDialog.java b/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/NewKeyPairEntryDialog.java
deleted file mode 100644
index 2915f65..0000000
--- a/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/NewKeyPairEntryDialog.java
+++ /dev/null
@@ -1,304 +0,0 @@
-/*******************************************************************************
- * 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.credentialmanager;
-
-import static java.awt.BorderLayout.CENTER;
-import static java.awt.BorderLayout.SOUTH;
-import static java.awt.BorderLayout.WEST;
-import static java.awt.Font.PLAIN;
-import static javax.swing.BoxLayout.Y_AXIS;
-import static javax.swing.JOptionPane.ERROR_MESSAGE;
-import static javax.swing.JOptionPane.WARNING_MESSAGE;
-import static javax.swing.JOptionPane.showMessageDialog;
-import static javax.swing.ListSelectionModel.SINGLE_SELECTION;
-import static javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED;
-import static javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED;
-import static net.sf.taverna.t2.workbench.ui.credentialmanager.CMStrings.ALERT_TITLE;
-import static net.sf.taverna.t2.workbench.ui.credentialmanager.CMStrings.ERROR_TITLE;
-
-import java.awt.BorderLayout;
-import java.awt.FlowLayout;
-import java.awt.Font;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.WindowAdapter;
-import java.awt.event.WindowEvent;
-import java.security.GeneralSecurityException;
-import java.security.Key;
-import java.security.KeyStore;
-import java.security.cert.Certificate;
-import java.security.cert.X509Certificate;
-import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.List;
-
-import javax.swing.BoxLayout;
-import javax.swing.JButton;
-import javax.swing.JDialog;
-import javax.swing.JFrame;
-import javax.swing.JLabel;
-import javax.swing.JList;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.border.EmptyBorder;
-import javax.swing.event.ListSelectionEvent;
-import javax.swing.event.ListSelectionListener;
-
-import org.apache.taverna.security.credentialmanager.CMException;
-import org.apache.taverna.security.credentialmanager.DistinguishedNameParser;
-import net.sf.taverna.t2.workbench.helper.NonBlockedHelpEnabledDialog;
-
-/**
- * Allows the user import a key pair from a PKCS #12 file (keystore).
- */
-@SuppressWarnings("serial")
-class NewKeyPairEntryDialog extends NonBlockedHelpEnabledDialog {
-	//private static final Logger logger = Logger.getLogger(NewKeyPairEntryDialog.class);
-
-	/** List of key pairs available for import */
-	private JList<String> keyPairsJList;
-	/** PKCS #12 keystore */
-	private KeyStore pkcs12KeyStore;
-	/** Private key part of the key pair chosen by the user for import */
-	private Key privateKey;
-	/** Certificate chain part of the key pair chosen by the user for import */
-	private Certificate[] certificateChain;
-	/** Key pair alias to be used for this entry in the Keystore */
-	private String alias;
-	private final DistinguishedNameParser dnParser;
-
-	public NewKeyPairEntryDialog(JFrame parent, String title, boolean modal,
-			KeyStore pkcs12KeyStore, DistinguishedNameParser dnParser)
-			throws CMException {
-		super(parent, title, modal);
-		this.pkcs12KeyStore = pkcs12KeyStore;
-		this.dnParser = dnParser;
-		initComponents();
-	}
-
-	public NewKeyPairEntryDialog(JDialog parent, String title, boolean modal,
-			KeyStore pkcs12KeyStore, DistinguishedNameParser dnParser)
-			throws CMException {
-		super(parent, title, modal);
-		this.pkcs12KeyStore = pkcs12KeyStore;
-		this.dnParser = dnParser;
-		initComponents();
-	}
-
-	/**
-	 * Get the private part of the key pair.
-	 */
-	public Key getPrivateKey() {
-		return privateKey;
-	}
-
-	/**
-	 * Get the certificate chain part of the key pair.
-	 */
-	public Certificate[] getCertificateChain() {
-		return certificateChain;
-	}
-
-	/**
-	 * Get the keystore alias of the key pair.
-	 */
-	public String getAlias() {
-		return alias;
-	}
-
-	private void initComponents() throws CMException {
-		// Instructions
-		JLabel instructionsLabel = new JLabel("Select a key pair to import:");
-		instructionsLabel.setFont(new Font(null, PLAIN, 11));
-		instructionsLabel.setBorder(new EmptyBorder(5, 5, 5, 5));
-		JPanel instructionsPanel = new JPanel(new BorderLayout());
-		instructionsPanel.add(instructionsLabel, WEST);
-
-		// Import button
-		final JButton importButton = new JButton("Import");
-		importButton.setEnabled(false);
-		importButton.addActionListener(new ActionListener() {
-			@Override
-			public void actionPerformed(ActionEvent evt) {
-				importPressed();
-			}
-		});
-
-		// Certificate details button
-		final JButton certificateDetailsButton = new JButton("Details");
-		certificateDetailsButton.setEnabled(false);
-		certificateDetailsButton.addActionListener(new ActionListener() {
-			@Override
-			public void actionPerformed(ActionEvent evt) {
-				certificateDetailsPressed();
-			}
-		});
-
-        // List to hold keystore's key pairs
-		keyPairsJList = new JList<>();
-		keyPairsJList.setSelectionMode(SINGLE_SELECTION);
-		keyPairsJList.addListSelectionListener(new ListSelectionListener() {
-			@Override
-			public void valueChanged(ListSelectionEvent evt) {
-				boolean enabled = keyPairsJList.getSelectedIndex() >= 0;
-				importButton.setEnabled(enabled);
-				certificateDetailsButton.setEnabled(enabled);
-			}
-		});
-
-        // Put the key list into a scroll pane
-		JScrollPane keyPairsScrollPane = new JScrollPane(keyPairsJList,
-				VERTICAL_SCROLLBAR_AS_NEEDED, HORIZONTAL_SCROLLBAR_AS_NEEDED);
-		keyPairsScrollPane.getViewport().setBackground(
-				keyPairsJList.getBackground());
-        
-        JPanel keyPairsPanel = new JPanel();
-        keyPairsPanel.setLayout(new BoxLayout(keyPairsPanel, Y_AXIS));
-		keyPairsPanel.setBorder(new EmptyBorder(10, 10, 10, 10));
-
-		instructionsPanel.setAlignmentY(LEFT_ALIGNMENT);
-		keyPairsPanel.add(instructionsPanel);
-		keyPairsScrollPane.setAlignmentY(LEFT_ALIGNMENT);
-		keyPairsPanel.add(keyPairsScrollPane);
-
-		// Cancel button
-		final JButton cancelButton = new JButton("Cancel");
-		cancelButton.addActionListener(new ActionListener() {
-			@Override
-			public void actionPerformed(ActionEvent evt) {
-				cancelPressed();
-			}
-		});
-
-		JPanel buttonsPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
-		buttonsPanel.add(certificateDetailsButton);
-		buttonsPanel.add(importButton);
-		buttonsPanel.add(cancelButton);
-
-		getContentPane().setLayout(new BorderLayout());
-		getContentPane().add(keyPairsPanel, CENTER);
-		getContentPane().add(buttonsPanel, SOUTH);
-
-		// Populate the list
-		populateKeyPairList();
-
-		addWindowListener(new WindowAdapter() {
-			@Override
-			public void windowClosing(WindowEvent evt) {
-				closeDialog();
-			}
-		});
-
-		setResizable(false);
-		getRootPane().setDefaultButton(importButton);
-		pack();
-	}
-
-	/**
-	 * Populate the key pair list with the PKCS #12 keystore's key pair aliases.
-	 */
-	private void populateKeyPairList() throws CMException {
-		try {
-			List<String> keyPairAliases = new ArrayList<>();
-
-			Enumeration<String> aliases = pkcs12KeyStore.aliases();
-			while (aliases.hasMoreElements()) {
-				String alias = aliases.nextElement();
-
-				if (pkcs12KeyStore.isKeyEntry(alias)) {
-					pkcs12KeyStore.getKey(alias, new char[] {});
-					Certificate[] certs = pkcs12KeyStore
-							.getCertificateChain(alias);
-					if (certs != null && certs.length != 0)
-						keyPairAliases.add(alias);
-				}
-			}
-
-            if (!keyPairAliases.isEmpty()) {
-                keyPairsJList.setListData(keyPairAliases.toArray(new String[0]));
-                keyPairsJList.setSelectedIndex(0);
-			} else
-                // No key pairs were found - warn the user
-				showMessageDialog(this,
-						"No private key pairs were found in the file",
-						ALERT_TITLE, WARNING_MESSAGE);
-		} catch (GeneralSecurityException ex) {
-            throw new CMException("Problem occured while reading the PKCS #12 file.",
-                ex);
-        }
-    }
-
-	/**
-	 * Display the selected key pair's certificate.
-	 */
-	private void certificateDetailsPressed() {
-		try {
-			String alias = (String) keyPairsJList.getSelectedValue();
-
-			// Convert the certificate object into an X509Certificate object.
-			X509Certificate cert = dnParser.convertCertificate(pkcs12KeyStore
-					.getCertificate(alias));
-
-			ViewCertDetailsDialog viewCertificateDialog = new ViewCertDetailsDialog(
-					this, "Certificate details", true, (X509Certificate) cert,
-					null, dnParser);
-			viewCertificateDialog.setLocationRelativeTo(this);
-			viewCertificateDialog.setVisible(true);
-		} catch (Exception ex) {
-			showMessageDialog(this,
-					"Failed to obtain certificate details to show",
-					ALERT_TITLE, WARNING_MESSAGE);
-			closeDialog();
-		}
-	}
-
-	public void importPressed() {
-		String alias = (String) keyPairsJList.getSelectedValue();
-		try {
-			privateKey = pkcs12KeyStore.getKey(alias, new char[] {});
-			certificateChain = pkcs12KeyStore.getCertificateChain(alias);
-			this.alias = alias;
-		} catch (Exception ex) {
-			showMessageDialog(
-					this,
-					"Failed to load the private key and certificate chain from the PKCS #12 file.",
-					ERROR_TITLE, ERROR_MESSAGE);
-		}
-
-        closeDialog();
-    }
-
-	public void cancelPressed() {
-		/*
-		 * Set everything to null, just in case some of the values have been set
-		 * previously and the user pressed 'cancel' after that.
-		 */
-		privateKey = null;
-		certificateChain = null;
-		closeDialog();
-	}
-
-	private void closeDialog() {
-		setVisible(false);
-		dispose();
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/NewTrustCertsDialog.java
----------------------------------------------------------------------
diff --git a/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/NewTrustCertsDialog.java b/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/NewTrustCertsDialog.java
deleted file mode 100644
index 7841f1c..0000000
--- a/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/NewTrustCertsDialog.java
+++ /dev/null
@@ -1,248 +0,0 @@
-/*******************************************************************************
- * 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.credentialmanager;
-
-import static java.awt.BorderLayout.CENTER;
-import static java.awt.BorderLayout.SOUTH;
-import static java.awt.BorderLayout.WEST;
-import static java.awt.Font.PLAIN;
-import static javax.security.auth.x500.X500Principal.RFC2253;
-import static javax.swing.BoxLayout.Y_AXIS;
-import static javax.swing.JOptionPane.WARNING_MESSAGE;
-import static javax.swing.JOptionPane.showMessageDialog;
-import static javax.swing.ListSelectionModel.MULTIPLE_INTERVAL_SELECTION;
-import static javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED;
-import static javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED;
-import static net.sf.taverna.t2.workbench.ui.credentialmanager.CMStrings.ALERT_TITLE;
-
-import java.awt.BorderLayout;
-import java.awt.FlowLayout;
-import java.awt.Font;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.WindowAdapter;
-import java.awt.event.WindowEvent;
-import java.security.cert.X509Certificate;
-import java.util.ArrayList;
-
-import javax.swing.BoxLayout;
-import javax.swing.JButton;
-import javax.swing.JDialog;
-import javax.swing.JFrame;
-import javax.swing.JLabel;
-import javax.swing.JList;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.border.CompoundBorder;
-import javax.swing.border.EmptyBorder;
-import javax.swing.border.EtchedBorder;
-import javax.swing.event.ListSelectionEvent;
-import javax.swing.event.ListSelectionListener;
-
-import org.apache.taverna.security.credentialmanager.DistinguishedNameParser;
-import org.apache.taverna.security.credentialmanager.ParsedDistinguishedName;
-import net.sf.taverna.t2.workbench.helper.NonBlockedHelpEnabledDialog;
-
-/**
- * Allows the user to import one or more trusted certificates from a file.
- */
-@SuppressWarnings("serial")
-public class NewTrustCertsDialog extends NonBlockedHelpEnabledDialog {
-	private JList<String> trustedCertsJList;
-	/** List of trusted certs read from the file and available for import */
-	private ArrayList<X509Certificate> availableTrustedCerts = new ArrayList<>();
-	/** List of trusted certs selected for import */
-	private ArrayList<X509Certificate> selectedTrustedCerts;
-	private final DistinguishedNameParser dnParser;
-
-	public NewTrustCertsDialog(JFrame parent, String title, boolean modal,
-			ArrayList<X509Certificate> lCerts, DistinguishedNameParser dnParser) {
-		super(parent, title, modal);
-		availableTrustedCerts = lCerts;
-		this.dnParser = dnParser;
-		initComponents();
-	}
-
-	public NewTrustCertsDialog(JDialog parent, String title, boolean modal,
-			ArrayList<X509Certificate> lCerts, DistinguishedNameParser dnParser) {
-		super(parent, title, modal);
-		availableTrustedCerts = lCerts;
-		this.dnParser = dnParser;
-		initComponents();
-	}
-
-	private void initComponents() {
-		// Instructions
-		JLabel instructionsLabel = new JLabel(
-				"Select one or more certificates for import:");
-		instructionsLabel.setFont(new Font(null, PLAIN, 11));
-		instructionsLabel.setBorder(new EmptyBorder(5, 5, 5, 5));
-		JPanel instructionsPanel = new JPanel(new BorderLayout());
-		instructionsPanel.add(instructionsLabel, WEST);
-
-		// Import button
-		final JButton importButton = new JButton("Import");
-		importButton.setEnabled(false);
-		importButton.addActionListener(new ActionListener() {
-			@Override
-			public void actionPerformed(ActionEvent evt) {
-				importPressed();
-			}
-		});
-
-		// Certificate details button
-		final JButton certificateDetailsButton = new JButton(
-				"Certificate Details");
-		certificateDetailsButton.setEnabled(false);
-		certificateDetailsButton.addActionListener(new ActionListener() {
-			@Override
-			public void actionPerformed(ActionEvent evt) {
-				certificateDetailsPressed();
-			}
-		});
-
-		// List with trusted certs' aliases
-		trustedCertsJList = new JList<>();
-		trustedCertsJList.setSelectionMode(MULTIPLE_INTERVAL_SELECTION);
-		trustedCertsJList.addListSelectionListener(new ListSelectionListener() {
-			@Override
-			public void valueChanged(ListSelectionEvent evt) {
-				boolean enabled = trustedCertsJList.getSelectedIndex() >= 0;
-				importButton.setEnabled(enabled);
-				certificateDetailsButton.setEnabled(enabled);
-			}
-		});
-		// Populate the list - get the certificate subjects' CNs
-		ArrayList<String> cns = new ArrayList<>();
-		for (int i = 0; i < availableTrustedCerts.size(); i++) {
-			String subjectDN = ((X509Certificate) availableTrustedCerts.get(i))
-					.getSubjectX500Principal().getName(RFC2253);
-			ParsedDistinguishedName parsedDN = dnParser.parseDN(subjectDN);
-			String subjectCN = parsedDN.getCN();
-			cns.add(i, subjectCN);
-		}
-		trustedCertsJList.setListData(cns.toArray(new String[0]));
-		trustedCertsJList.setSelectedIndex(0);
-
-		// Put the list into a scroll pane
-		JScrollPane trustedCertsScrollPanel = new JScrollPane(
-				trustedCertsJList, VERTICAL_SCROLLBAR_AS_NEEDED,
-				HORIZONTAL_SCROLLBAR_AS_NEEDED);
-		trustedCertsScrollPanel.getViewport().setBackground(
-				trustedCertsJList.getBackground());
-
-		JPanel trustedCertsPanel = new JPanel();
-		trustedCertsPanel.setLayout(new BoxLayout(trustedCertsPanel, Y_AXIS));
-		trustedCertsPanel.setBorder(new CompoundBorder(new CompoundBorder(
-				new EmptyBorder(5, 5, 5, 5), new EtchedBorder()),
-				new EmptyBorder(5, 5, 5, 5)));
-
-		instructionsPanel.setAlignmentY(LEFT_ALIGNMENT);
-		trustedCertsPanel.add(instructionsPanel);
-		trustedCertsScrollPanel.setAlignmentY(LEFT_ALIGNMENT);
-		trustedCertsPanel.add(trustedCertsScrollPanel);
-		certificateDetailsButton.setAlignmentY(RIGHT_ALIGNMENT);
-		trustedCertsPanel.add(certificateDetailsButton);
-
-		// Cancel button
-		final JButton cancelButton = new JButton("Cancel");
-		cancelButton.addActionListener(new ActionListener() {
-			@Override
-			public void actionPerformed(ActionEvent evt) {
-				cancelPressed();
-			}
-		});
-
-		JPanel jpButtons = new JPanel(new FlowLayout(FlowLayout.CENTER));
-		jpButtons.add(importButton);
-		jpButtons.add(cancelButton);
-
-		getContentPane().setLayout(new BorderLayout());
-		getContentPane().add(trustedCertsPanel, CENTER);
-		getContentPane().add(jpButtons, SOUTH);
-
-		addWindowListener(new WindowAdapter() {
-			@Override
-			public void windowClosing(WindowEvent evt) {
-				closeDialog();
-			}
-		});
-
-		setResizable(false);
-		getRootPane().setDefaultButton(importButton);
-		pack();
-	}
-
-	/**
-	 * Shows the selected key pair's certificate.
-	 */
-	private void certificateDetailsPressed() {
-		try {
-			int i = trustedCertsJList.getSelectedIndex();
-
-			X509Certificate cert = (X509Certificate) availableTrustedCerts
-					.get(i);
-
-			ViewCertDetailsDialog viewCertificateDialog = new ViewCertDetailsDialog(
-					this, "Certificate details", true, cert, null, dnParser);
-			viewCertificateDialog.setLocationRelativeTo(this);
-			viewCertificateDialog.setVisible(true);
-		} catch (Exception ex) {
-			showMessageDialog(this,
-					"Failed to obtain certificate details to show",
-					ALERT_TITLE, WARNING_MESSAGE);
-			closeDialog();
-		}
-	}
-
-	/**
-	 * Get the trusted certificates selected for import.
-	 */
-	public ArrayList<X509Certificate> getTrustedCertificates() {
-		return selectedTrustedCerts;
-	}
-
-	/**
-	 * Store the selected trusted certs.
-	 */
-	public void importPressed() {
-		int[] selectedValues = trustedCertsJList.getSelectedIndices();
-		selectedTrustedCerts = new ArrayList<>();
-		for (int i = 0; i < selectedValues.length; i++)
-			selectedTrustedCerts.add(availableTrustedCerts
-					.get(selectedValues[i]));
-		closeDialog();
-	}
-
-	public void cancelPressed() {
-		/*
-		 * Set selectedTrustCerts to null to indicate that user has cancelled
-		 * the import
-		 */
-		selectedTrustedCerts = null;
-		closeDialog();
-	}
-
-	private void closeDialog() {
-		setVisible(false);
-		dispose();
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/PasswordsTableModel.java
----------------------------------------------------------------------
diff --git a/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/PasswordsTableModel.java b/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/PasswordsTableModel.java
deleted file mode 100644
index a069c73..0000000
--- a/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/PasswordsTableModel.java
+++ /dev/null
@@ -1,227 +0,0 @@
-/*******************************************************************************
- * 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.credentialmanager;
-
-import static javax.swing.JOptionPane.ERROR_MESSAGE;
-import static javax.swing.JOptionPane.showMessageDialog;
-import static org.apache.taverna.security.credentialmanager.CredentialManager.KeystoreType.KEYSTORE;
-import static net.sf.taverna.t2.workbench.ui.credentialmanager.CMStrings.ERROR_TITLE;
-import static net.sf.taverna.t2.workbench.ui.credentialmanager.CredentialManagerUI.PASSWORD_ENTRY_TYPE;
-
-import java.net.URI;
-import java.util.TreeMap;
-
-import javax.swing.JFrame;
-import javax.swing.table.AbstractTableModel;
-
-import org.apache.taverna.lang.observer.Observable;
-import org.apache.taverna.lang.observer.Observer;
-import org.apache.taverna.security.credentialmanager.CMException;
-import org.apache.taverna.security.credentialmanager.CredentialManager;
-import org.apache.taverna.security.credentialmanager.KeystoreChangedEvent;
-import org.apache.taverna.security.credentialmanager.UsernamePassword;
-
-import org.apache.log4j.Logger;
-
-/**
- * The table model used to display the Keystore's username/password pair
- * entries.
- * 
- * @author Alex Nenadic
- */
-@SuppressWarnings("serial")
-public class PasswordsTableModel extends AbstractTableModel implements
-		Observer<KeystoreChangedEvent> {
-	private static final Logger logger = Logger
-			.getLogger(PasswordsTableModel.class);
-
-	// Column names
-	private String[] columnNames;
-	// Table data
-	private Object[][] data;
-	private CredentialManager credManager;
-
-	public PasswordsTableModel(CredentialManager credentialManager) {
-		credManager = credentialManager;
-		if (credentialManager == null) {
-			// Failed to instantiate Credential Manager - warn the user and exit
-			String sMessage = "Failed to instantiate Credential Manager. ";
-			logger.error("CM GUI: " + sMessage);
-			showMessageDialog(new JFrame(), sMessage, ERROR_TITLE,
-					ERROR_MESSAGE);
-			return;
-		}
-
-		data = new Object[0][0];
-		columnNames = new String[] { "Entry Type", // type of the Keystore entry
-				"Service URL", // the service url, part of the actual alias in
-								// the Keystore
-				"Username", // username for the service, part of the password
-							// entry in the Keystore
-				"Last Modified", // last modified date of the entry
-				"Password", // the invisible column holding the password value
-							// of the password entry in the Keystore
-				"Alias" // the invisible column holding the Keystore alias of
-						// the entry
-		};
-
-		try {
-			load();
-		} catch (CMException cme) {
-			String sMessage = "Failed to load username and password pairs";
-			logger.error(sMessage);
-			showMessageDialog(new JFrame(), sMessage, ERROR_TITLE,
-					ERROR_MESSAGE);
-			return;
-		}
-
-		// Start observing changes to the Keystore
-		credManager.addObserver(this);
-	}
-
-	/**
-	 * Load the PasswordsTableModel with the password entries from the Keystore.
-	 */
-	public void load() throws CMException {
-		// Place password entries' aliases in a tree map to sort them
-		TreeMap<String, String> aliases = new TreeMap<>();
-
-		for (String alias : credManager.getAliases(KEYSTORE))
-			/*
-			 * We are only interested in username/password entries here. Alias
-			 * for such entries is constructed as "password#"<SERVICE_URL> where
-			 * service URL is the service this username/password pair is to be
-			 * used for.
-			 */
-			if (alias.startsWith("password#"))
-				aliases.put(alias, alias);
-
-		// Create one table row for each password entry
-		data = new Object[aliases.size()][6];
-
-		/*
-		 * Iterate through the sorted aliases, retrieving the password entries
-		 * and populating the table model
-		 */
-		int iCnt = 0;
-		for (String alias : aliases.values()) {
-			/*
-			 * Populate the type column - it is set with an integer but a custom
-			 * cell renderer will cause a suitable icon to be displayed
-			 */
-			data[iCnt][0] = PASSWORD_ENTRY_TYPE;
-
-			/*
-			 * Populate the service URL column as a substring of alias from the
-			 * first occurrence of '#' till the end of the string
-			 */
-			String serviceURL = alias.substring(alias.indexOf('#') + 1);
-			data[iCnt][1] = serviceURL;
-
-			/*
-			 * Get the username and password pair from the Keystore. They are
-			 * returned in a single string in format
-			 * <USERNAME><SEPARATOR_CHARACTER><PASSWORD>
-			 */
-			UsernamePassword usernamePassword = credManager
-					.getUsernameAndPasswordForService(URI.create(serviceURL),
-							false, "");
-			String username = usernamePassword.getUsername();
-			String password = usernamePassword.getPasswordAsString();
-
-			// Populate the username column
-			data[iCnt][2] = username;
-
-			// Populate the last modified date column ("UBER" keystore type
-			// supports creation date)
-			// data[iCnt][3] =
-			// credManager.getEntryCreationDate(CredentialManager.KEYSTORE,
-			// alias);
-
-			// Populate the invisible password column
-			data[iCnt][4] = password;
-
-			// Populate the invisible alias column
-			data[iCnt][5] = alias;
-
-			iCnt++;
-		}
-
-		fireTableDataChanged();
-	}
-
-	/**
-	 * Get the number of columns in the table.
-	 */
-	@Override
-	public int getColumnCount() {
-		return columnNames.length;
-	}
-
-	/**
-	 * Get the number of rows in the table.
-	 */
-	@Override
-	public int getRowCount() {
-		return data.length;
-	}
-
-	/**
-	 * Get the name of the column at the given position.
-	 */
-	@Override
-	public String getColumnName(int iCol) {
-		return columnNames[iCol];
-	}
-
-	/**
-	 * Get the cell value at the given row and column position.
-	 */
-	@Override
-	public Object getValueAt(int iRow, int iCol) {
-		return data[iRow][iCol];
-	}
-
-	/**
-	 * Get the class at of the cells at the given column position.
-	 */
-	@Override
-	public Class<? extends Object> getColumnClass(int iCol) {
-		return getValueAt(0, iCol).getClass();
-	}
-
-	/**
-	 * Is the cell at the given row and column position editable?
-	 */
-	@Override
-	public boolean isCellEditable(int iRow, int iCol) {
-		// The table is always read-only
-		return false;
-	}
-
-	@Override
-	public void notify(Observable<KeystoreChangedEvent> sender,
-			KeystoreChangedEvent message) throws Exception {
-		// reload the table
-		if (message.keystoreType.equals(KEYSTORE))
-			load();
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/SetMasterPasswordDialog.java
----------------------------------------------------------------------
diff --git a/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/SetMasterPasswordDialog.java b/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/SetMasterPasswordDialog.java
deleted file mode 100644
index bae6068..0000000
--- a/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/SetMasterPasswordDialog.java
+++ /dev/null
@@ -1,189 +0,0 @@
-/*******************************************************************************
- * 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.credentialmanager;
-
-import static java.awt.BorderLayout.CENTER;
-import static java.awt.BorderLayout.NORTH;
-import static java.awt.BorderLayout.SOUTH;
-import static java.awt.Font.PLAIN;
-import static javax.swing.BoxLayout.Y_AXIS;
-import static javax.swing.JOptionPane.WARNING_MESSAGE;
-import static javax.swing.JOptionPane.showMessageDialog;
-import static net.sf.taverna.t2.workbench.ui.credentialmanager.CMStrings.WARN_TITLE;
-
-import java.awt.BorderLayout;
-import java.awt.FlowLayout;
-import java.awt.Font;
-import java.awt.GridLayout;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.WindowAdapter;
-import java.awt.event.WindowEvent;
-
-import javax.swing.BoxLayout;
-import javax.swing.JButton;
-import javax.swing.JFrame;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JPasswordField;
-import javax.swing.border.CompoundBorder;
-import javax.swing.border.EmptyBorder;
-import javax.swing.border.EtchedBorder;
-
-import net.sf.taverna.t2.workbench.helper.NonBlockedHelpEnabledDialog;
-
-/**
- * Dialog used for user to set a master password for Credential Manager.
- * 
- * @author Alex Nenadic
- */
-@SuppressWarnings("serial")
-public class SetMasterPasswordDialog extends NonBlockedHelpEnabledDialog {
-	/** Password entry field */
-	private JPasswordField passwordField;
-	/** Password confirmation entry field */
-	private JPasswordField passwordConfirmField;
-	/** The entered password */
-	private String password = null;
-	/** Instructions for the user */
-	private String instructions;
-
-	public SetMasterPasswordDialog(JFrame parent, String title, boolean modal,
-			String instructions) {
-		super(parent, title, modal);
-		this.instructions = instructions;
-		initComponents();
-	}
-
-	private void initComponents() {
-		getContentPane().setLayout(new BorderLayout());
-
-		JLabel instructionsLabel = new JLabel(instructions);
-		instructionsLabel.setFont(new Font(null, PLAIN, 11));
-
-		JPanel instructionsPanel = new JPanel();
-		instructionsPanel.setLayout(new BoxLayout(instructionsPanel, Y_AXIS));
-		instructionsPanel.add(instructionsLabel);
-		instructionsPanel.setBorder(new EmptyBorder(10, 5, 10, 0));
-
-		JLabel passwordLabel = new JLabel("Master password");
-		passwordLabel.setBorder(new EmptyBorder(0, 5, 0, 0));
-
-		JLabel passwordConfirmLabel = new JLabel("Confirm master password");
-		passwordConfirmLabel.setBorder(new EmptyBorder(0, 5, 0, 0));
-
-		passwordField = new JPasswordField(15);
-		passwordConfirmField = new JPasswordField(15);
-
-		JPanel passwordPanel = new JPanel(new GridLayout(2, 2, 5, 5));
-		passwordPanel.add(passwordLabel);
-		passwordPanel.add(passwordField);
-		passwordPanel.add(passwordConfirmLabel);
-		passwordPanel.add(passwordConfirmField);
-
-		JPanel mainPanel = new JPanel(new BorderLayout());
-		mainPanel.setBorder(new CompoundBorder(new EmptyBorder(10, 10, 10, 10),
-				new EtchedBorder()));
-		mainPanel.add(instructionsPanel, NORTH);
-		mainPanel.add(passwordPanel, CENTER);
-
-		JButton okButton = new JButton("OK");
-		okButton.addActionListener(new ActionListener() {
-			@Override
-			public void actionPerformed(ActionEvent evt) {
-				okPressed();
-			}
-		});
-
-		JButton cancelButton = new JButton("Cancel");
-		cancelButton.addActionListener(new ActionListener() {
-			@Override
-			public void actionPerformed(ActionEvent evt) {
-				cancelPressed();
-			}
-		});
-		JPanel buttonsPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
-		buttonsPanel.add(okButton);
-		buttonsPanel.add(cancelButton);
-
-		getContentPane().add(mainPanel, CENTER);
-		getContentPane().add(buttonsPanel, SOUTH);
-
-		addWindowListener(new WindowAdapter() {
-			@Override
-			public void windowClosing(WindowEvent evt) {
-				closeDialog();
-			}
-		});
-
-		setResizable(false);
-		getRootPane().setDefaultButton(okButton);
-		pack();
-	}
-
-	public String getPassword() {
-		return password;
-	}
-
-	/**
-	 * Check that the user has entered a non-empty password and store the new
-	 * password.
-	 */
-	private boolean checkPassword() {
-		String firstPassword = new String(passwordField.getPassword());
-		String confirmPassword = new String(passwordConfirmField.getPassword());
-
-		if (!firstPassword.equals(confirmPassword)) {
-			showMessageDialog(this, "The passwords do not match", WARN_TITLE,
-					WARNING_MESSAGE);
-			return false;
-		}
-		if (firstPassword.isEmpty()) {
-			// passwords match but are empty
-			showMessageDialog(this, "The password cannot be empty", WARN_TITLE,
-					WARNING_MESSAGE);
-			return false;
-		}
-
-		// passwords match and not empty
-		password = firstPassword;
-		return true;
-	}
-
-	private void okPressed() {
-		if (checkPassword())
-			closeDialog();
-	}
-
-	private void cancelPressed() {
-		/*
-		 * Set the password to null as it might have changed in the meantime if
-		 * user entered something then cancelled.
-		 */
-		password = null;
-		closeDialog();
-	}
-
-	private void closeDialog() {
-		setVisible(false);
-		dispose();
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/TableCellRenderer.java
----------------------------------------------------------------------
diff --git a/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/TableCellRenderer.java b/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/TableCellRenderer.java
deleted file mode 100644
index 0eaae99..0000000
--- a/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/TableCellRenderer.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*******************************************************************************
- * 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.credentialmanager;
-
-import static net.sf.taverna.t2.workbench.ui.credentialmanager.CredentialManagerUI.KEY_PAIR_ENTRY_TYPE;
-import static net.sf.taverna.t2.workbench.ui.credentialmanager.CredentialManagerUI.PASSWORD_ENTRY_TYPE;
-import static net.sf.taverna.t2.workbench.ui.credentialmanager.CredentialManagerUI.TRUST_CERT_ENTRY_TYPE;
-
-import java.awt.Component;
-//import java.text.DateFormat;
-//import java.util.Date;
-
-import javax.swing.ImageIcon;
-import javax.swing.JLabel;
-import javax.swing.JTable;
-import javax.swing.border.EmptyBorder;
-import javax.swing.table.DefaultTableCellRenderer;
-//import net.sf.taverna.t2.workbench.ui.credentialmanager.KeyPairsTableModel;
-//import net.sf.taverna.t2.workbench.ui.credentialmanager.PasswordsTableModel;
-//import net.sf.taverna.t2.workbench.ui.credentialmanager.TrustedCertsTableModel;
-
-/**
- * Custom cell renderer for the cells of the tables displaying
- * Keystore/Truststore contents.
- * 
- * @author Alex Nenadic
- */
-public class TableCellRenderer extends DefaultTableCellRenderer {
-	private static final long serialVersionUID = -3983986682794010259L;
-
-	private final ImageIcon passwordEntryIcon = new ImageIcon(
-			TableCellRenderer.class.getResource("/images/table/key_entry.png"));
-	private final ImageIcon keypairEntryIcon = new ImageIcon(
-			TableCellRenderer.class
-					.getResource("/images/table/keypair_entry.png"));
-	private final ImageIcon trustcertEntryIcon = new ImageIcon(
-			TableCellRenderer.class
-					.getResource("/images/table/trustcert_entry.png"));
-
-	/**
-	 * Get the rendered cell for the supplied value and column.
-	 */
-	@Override
-	public Component getTableCellRendererComponent(JTable keyStoreTable,
-			Object value, boolean bIsSelected, boolean bHasFocus, int iRow,
-			int iCol) {
-		JLabel cell = (JLabel) super.getTableCellRendererComponent(
-				keyStoreTable, value, bIsSelected, bHasFocus, iRow, iCol);
-
-		if (value != null) {
-        	// Type column - display an icon representing the type
-			if (iCol == 0)
-				configureTypeColumn(value, cell);
-            // Last Modified column - format date (if date supplied)        
-            /*else if (((keyStoreTable.getModel() instanceof PasswordsTableModel) && (iCol == 3)) || 
-            	((keyStoreTable.getModel() instanceof KeyPairsTableModel) && (iCol == 4))||
-            	((keyStoreTable.getModel() instanceof TrustedCertsTableModel) && (iCol == 4))){
-            	if (value instanceof Date) {
-            		// Include timezone
-            		cell.setText(DateFormat.getDateTimeInstance(DateFormat.MEDIUM,
-            			DateFormat.LONG).format((Date) value));
-            	} else {
-            		cell.setText(value.toString());
-            	}
-            }*/
-            // Other columns - just use their text values
-			else
-				cell.setText(value.toString());
-		}
-
-		cell.setBorder(new EmptyBorder(0, 5, 0, 5));
-		return cell;
-	}
-
-	private void configureTypeColumn(Object value, JLabel cell) {
-		ImageIcon icon = null;
-		// The cell is in the first column of Passwords table
-		if (PASSWORD_ENTRY_TYPE.equals(value)) {
-			icon = passwordEntryIcon; // key (i.e. password) entry image
-		}
-		// The cell is in the first column of Key Pairs table
-		else if (KEY_PAIR_ENTRY_TYPE.equals(value)) {
-			icon = keypairEntryIcon; // key pair entry image
-		}
-		// The cell is in the first column of Trusted Certificates table
-		else if (TRUST_CERT_ENTRY_TYPE.equals(value)) {
-			icon = trustcertEntryIcon; // trust. certificate entry image
-		}
-
-		cell.setIcon(icon);
-		cell.setText("");
-		cell.setVerticalAlignment(CENTER);
-		cell.setHorizontalAlignment(CENTER);
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/TableHeaderRenderer.java
----------------------------------------------------------------------
diff --git a/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/TableHeaderRenderer.java b/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/TableHeaderRenderer.java
deleted file mode 100644
index 8070b98..0000000
--- a/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/TableHeaderRenderer.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*******************************************************************************
- * 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.credentialmanager;
-
-import static javax.swing.border.BevelBorder.RAISED;
-
-import java.awt.Component;
-
-import javax.swing.ImageIcon;
-import javax.swing.JLabel;
-import javax.swing.JTable;
-import javax.swing.border.BevelBorder;
-import javax.swing.border.CompoundBorder;
-import javax.swing.border.EmptyBorder;
-import javax.swing.table.DefaultTableCellRenderer;
-
-import net.sf.taverna.t2.workbench.ui.credentialmanager.KeyPairsTableModel;
-import net.sf.taverna.t2.workbench.ui.credentialmanager.PasswordsTableModel;
-import net.sf.taverna.t2.workbench.ui.credentialmanager.TableHeaderRenderer;
-import net.sf.taverna.t2.workbench.ui.credentialmanager.TrustedCertsTableModel;
-
-/**
- * Custom cell renderer for the headers of the tables displaying 
- * the Keystore/Truststore contents.
- */
-@SuppressWarnings("serial")
-public class TableHeaderRenderer extends DefaultTableCellRenderer {
-	private final ImageIcon entryTypeIcon = new ImageIcon(
-			TableHeaderRenderer.class
-					.getResource("/images/table/entry_heading.png"));
-
-	@Override
-	public Component getTableCellRendererComponent(JTable jtKeyStoreTable,
-			Object value, boolean bIsSelected, boolean bHasFocus, int iRow,
-			int iCol) {
-        // Get header renderer
-        JLabel header = (JLabel) jtKeyStoreTable.getColumnModel().getColumn(iCol).getHeaderRenderer();
-
-        // The entry type header contains an icon for every table
-        if (iCol == 0) {
-            header.setText("");
-            header.setIcon(entryTypeIcon); // entry type icon (header for the first column of the table)
-            header.setHorizontalAlignment(CENTER);
-            header.setVerticalAlignment(CENTER);
-            header.setToolTipText("Entry type");
-        }
-        // All other headers contain text
-        else {
-            header.setText((String) value);
-            header.setHorizontalAlignment(LEFT);
-            
-            // Passwords table
-            if (jtKeyStoreTable.getModel() instanceof PasswordsTableModel){
-                if (iCol == 1) //Service URL column
-					header.setToolTipText("URL of the service username and password will be used for");
-				else if (iCol == 2) // Username column
-					header.setToolTipText("Username for the service");
-			}
-            // Key pairs table
-			else if (jtKeyStoreTable.getModel() instanceof KeyPairsTableModel) {
-				if (iCol == 1) // Owner
-					header.setToolTipText("Certificate's owner");
-				else if (iCol == 2) // Issuer
-					header.setToolTipText("Certificate's issuer");
-				else if (iCol == 3) // Serial number
-					header.setToolTipText("Certificate's serial number");
-            }       
-            // Trusted certs table
-			else if (jtKeyStoreTable.getModel() instanceof TrustedCertsTableModel) {
-				if (iCol == 1) // Owner
-					header.setToolTipText("Certificate's owner");
-				else if (iCol == 2) // Issuer
-					header.setToolTipText("Certificate's issuer");
-				else if (iCol == 3) // Serial number
-					header.setToolTipText("Certificate's serial number");
-            }         
-        }
-		header.setBorder(new CompoundBorder(new BevelBorder(RAISED),
-				new EmptyBorder(0, 5, 0, 5)));
-		return header;
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/TrustedCertsTableModel.java
----------------------------------------------------------------------
diff --git a/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/TrustedCertsTableModel.java b/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/TrustedCertsTableModel.java
deleted file mode 100644
index 28faf23..0000000
--- a/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/TrustedCertsTableModel.java
+++ /dev/null
@@ -1,216 +0,0 @@
-/*******************************************************************************
- * 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.credentialmanager;
-
-import static javax.swing.JOptionPane.ERROR_MESSAGE;
-import static javax.swing.JOptionPane.showMessageDialog;
-import static org.apache.taverna.security.credentialmanager.CredentialManager.KeystoreType.TRUSTSTORE;
-import static net.sf.taverna.t2.workbench.ui.credentialmanager.CMStrings.ERROR_TITLE;
-import static net.sf.taverna.t2.workbench.ui.credentialmanager.CredentialManagerUI.TRUST_CERT_ENTRY_TYPE;
-
-import java.util.Set;
-import java.util.TreeSet;
-
-import javax.swing.JFrame;
-import javax.swing.table.AbstractTableModel;
-
-import org.apache.taverna.lang.observer.Observable;
-import org.apache.taverna.lang.observer.Observer;
-import org.apache.taverna.security.credentialmanager.CMException;
-import org.apache.taverna.security.credentialmanager.CredentialManager;
-import org.apache.taverna.security.credentialmanager.KeystoreChangedEvent;
-
-import org.apache.log4j.Logger;
-
-/**
- * The table model used to display the Keystore's trusted certificate entries.
- * 
- * @author Alex Nenadic
- */
-@SuppressWarnings("serial")
-public class TrustedCertsTableModel extends AbstractTableModel implements
-		Observer<KeystoreChangedEvent> {
-	private static final Logger logger = Logger
-			.getLogger(TrustedCertsTableModel.class);
-
-	// Column names
-	private String[] columnNames;
-	// Table data
-	private Object[][] data;
-	private CredentialManager credManager;
-
-	public TrustedCertsTableModel(CredentialManager credentialManager) {
-		credManager = credentialManager;
-		if (credentialManager == null) {
-			// Failed to instantiate Credential Manager - warn the user and exit
-			String sMessage = "Failed to instantiate Credential Manager. ";
-			logger.error("CM GUI: "+ sMessage);
-			showMessageDialog(new JFrame(), sMessage, ERROR_TITLE,
-					ERROR_MESSAGE);
-			return;
-        }
-
-       	data = new Object[0][0];
-        columnNames = new String[] {
-        	"Entry Type", // type of the Keystore entry
-        	"Owner", // owner's common name
-        	"Issuer", // issuer's common name
-        	"Serial Number", // public key certificate's serial number
-            "Last Modified", // last modified date of the entry
-            "Alias" // the invisible column holding the actual alias in the Keystore
-        };
-
-        try {
-			load();
-		} catch (CMException cme) {
-			String sMessage = "Failed to load trusted certificates";
-			logger.error(sMessage);
-			showMessageDialog(new JFrame(), sMessage, ERROR_TITLE,
-					ERROR_MESSAGE);
-			return;
-		}
-
-        // Start observing changes to the Keystore
-        credManager.addObserver(this);
-    }
-
-    /**
-     * Load the TrustCertsTableModel with trusted certificate entries from the Keystore.
-     */
-	public void load() throws CMException {
-		/*
-		 * Place trusted certificate entries' aliases in a tree map to sort them
-		 */
-		Set<String> aliases = new TreeSet<>();
-		for (String alias : credManager.getAliases(TRUSTSTORE))
-			/*
-			 * We are only interested in trusted certificate entries here. Alias
-			 * for such entries is constructed as
-			 * "trustedcert#<CERT_SERIAL_NUMBER>#<CERT_COMMON_NAME>"
-			 */
-			if (alias.startsWith("trustedcert#"))
-				aliases.add(alias);
-
-		/*
-		 * Create one table row for each trusted certificate entry Each row has
-		 * 4 fields - type, owner name, last modified data and the invisible
-		 * alias
-		 */
-		data = new Object[aliases.size()][6];
-
-		/*
-		 * Iterate through the sorted aliases, retrieving the trusted
-		 * certificate entries and populating the table model
-		 */
-		int i = 0;
-		for (String alias : aliases) {
-			/*
-			 * Populate the type column - it is set with an integer but a custom
-			 * cell renderer will cause a suitable icon to be displayed
-			 */
-			data[i][0] = TRUST_CERT_ENTRY_TYPE;
-
-			/*
-			 * Split the alias string to extract owner, issuer and serial number
-			 * alias =
-			 * "trustedcert#<CERT_SUBJECT_COMMON_NAME>"#"<CERT_ISSUER_COMMON_NAME>"
-			 * #"<CERT_SERIAL_NUMBER>
-			 */
-			String[] aliasComponents = alias.split("#");
-
-			// Populate the owner column extracted from the alias
-			data[i][1] = aliasComponents[1];
-
-			// Populate the issuer column extracted from the alias
-			data[i][2] = aliasComponents[2];
-
-			// Populate the serial number column extracted from the alias
-			data[i][3] = aliasComponents[3];
-
-			// Populate the modified date column
-			//data[iCnt][4] = credManager.getEntryCreationDate(CredentialManager.TRUSTSTORE, alias);
-
-			// Populate the invisible alias column
-			data[i][5] = alias;
-
-			i++;
-		}
-
-        fireTableDataChanged();
-    }
-
-	/**
-	 * Get the number of columns in the table.
-	 */
-	@Override
-	public int getColumnCount() {
-		return columnNames.length;
-	}
-
-	/**
-	 * Get the number of rows in the table.
-	 */
-	@Override
-	public int getRowCount() {
-		return data.length;
-	}
-
-	/**
-	 * Get the name of the column at the given position.
-	 */
-	@Override
-	public String getColumnName(int iCol) {
-		return columnNames[iCol];
-	}
-
-	/**
-	 * Get the cell value at the given row and column position.
-	 */
-	@Override
-	public Object getValueAt(int iRow, int iCol) {
-		return data[iRow][iCol];
-	}
-
-	/**
-	 * Get the class at of the cells at the given column position.
-	 */
-	@Override
-	public Class<? extends Object> getColumnClass(int iCol) {
-		return getValueAt(0, iCol).getClass();
-	}
-
-	/**
-	 * Is the cell at the given row and column position editable?
-	 */
-	@Override
-	public boolean isCellEditable(int iRow, int iCol) {
-		// The table is always read-only
-		return false;
-	}
-
-	@Override
-	public void notify(Observable<KeystoreChangedEvent> sender,
-			KeystoreChangedEvent message) throws Exception {
-		// reload the table
-		if (message.keystoreType.equals(TRUSTSTORE))
-			load();
-	}
-}


[30/51] [partial] incubator-taverna-workbench git commit: all packages are moved to org.apache.taverna.*

Posted by re...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/toolbar/CredentialManagerToolbarSection.java
----------------------------------------------------------------------
diff --git a/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/toolbar/CredentialManagerToolbarSection.java b/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/toolbar/CredentialManagerToolbarSection.java
new file mode 100644
index 0000000..4ed2c67
--- /dev/null
+++ b/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/toolbar/CredentialManagerToolbarSection.java
@@ -0,0 +1,37 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.credentialmanager.toolbar;
+
+import static org.apache.taverna.ui.menu.DefaultToolBar.DEFAULT_TOOL_BAR;
+
+import java.net.URI;
+
+import org.apache.taverna.ui.menu.AbstractMenuSection;
+
+public class CredentialManagerToolbarSection extends AbstractMenuSection {
+	private static final String ENTRY_URI = "http://taverna.sf.net/2008/t2workbench/toolbar#credentialManagerSection";
+	/** {@value #ENTRY_URI} */
+	public static URI CREDENTIAL_MANAGER_TOOLBAR_SECTION = URI
+			.create(ENTRY_URI);
+
+	public CredentialManagerToolbarSection() {
+		super(DEFAULT_TOOL_BAR, 300, CREDENTIAL_MANAGER_TOOLBAR_SECTION);
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-credential-manager-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.security.credentialmanager.CredentialProviderSPI
----------------------------------------------------------------------
diff --git a/taverna-credential-manager-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.security.credentialmanager.CredentialProviderSPI b/taverna-credential-manager-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.security.credentialmanager.CredentialProviderSPI
deleted file mode 100644
index 725aa11..0000000
--- a/taverna-credential-manager-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.security.credentialmanager.CredentialProviderSPI
+++ /dev/null
@@ -1,3 +0,0 @@
-net.sf.taverna.t2.workbench.ui.credentialmanager.password.UIUsernamePasswordProvider
-net.sf.taverna.t2.workbench.ui.credentialmanager.password.UIMasterPasswordProvider
-net.sf.taverna.t2.workbench.ui.credentialmanager.ConfirmTrustedCertificateUI

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-credential-manager-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.ui.menu.MenuComponent
----------------------------------------------------------------------
diff --git a/taverna-credential-manager-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.ui.menu.MenuComponent b/taverna-credential-manager-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.ui.menu.MenuComponent
deleted file mode 100644
index 3743c2f..0000000
--- a/taverna-credential-manager-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.ui.menu.MenuComponent
+++ /dev/null
@@ -1,3 +0,0 @@
-net.sf.taverna.t2.workbench.ui.credentialmanager.menu.CredentialManagerMenu
-#net.sf.taverna.t2.workbench.ui.credentialmanager.toolbar.CredentialManagerToolbarAction
-#net.sf.taverna.t2.workbench.ui.credentialmanager.toolbar.CredentialManagerToolbarSection
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-credential-manager-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.StartupSPI
----------------------------------------------------------------------
diff --git a/taverna-credential-manager-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.StartupSPI b/taverna-credential-manager-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.StartupSPI
deleted file mode 100644
index b43772c..0000000
--- a/taverna-credential-manager-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.StartupSPI
+++ /dev/null
@@ -1,2 +0,0 @@
-net.sf.taverna.t2.workbench.ui.credentialmanager.startup.InitialiseSSLStartupHook
-net.sf.taverna.t2.workbench.ui.credentialmanager.startup.SetCredManAuthenticatorStartupHook

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-credential-manager-ui/src/main/resources/META-INF/services/org.apache.taverna.security.credentialmanager.CredentialProviderSPI
----------------------------------------------------------------------
diff --git a/taverna-credential-manager-ui/src/main/resources/META-INF/services/org.apache.taverna.security.credentialmanager.CredentialProviderSPI b/taverna-credential-manager-ui/src/main/resources/META-INF/services/org.apache.taverna.security.credentialmanager.CredentialProviderSPI
new file mode 100644
index 0000000..22eb8b3
--- /dev/null
+++ b/taverna-credential-manager-ui/src/main/resources/META-INF/services/org.apache.taverna.security.credentialmanager.CredentialProviderSPI
@@ -0,0 +1,3 @@
+org.apache.taverna.workbench.ui.credentialmanager.password.UIUsernamePasswordProvider
+org.apache.taverna.workbench.ui.credentialmanager.password.UIMasterPasswordProvider
+org.apache.taverna.workbench.ui.credentialmanager.ConfirmTrustedCertificateUI

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-credential-manager-ui/src/main/resources/META-INF/services/org.apache.taverna.ui.menu.MenuComponent
----------------------------------------------------------------------
diff --git a/taverna-credential-manager-ui/src/main/resources/META-INF/services/org.apache.taverna.ui.menu.MenuComponent b/taverna-credential-manager-ui/src/main/resources/META-INF/services/org.apache.taverna.ui.menu.MenuComponent
new file mode 100644
index 0000000..fb49d25
--- /dev/null
+++ b/taverna-credential-manager-ui/src/main/resources/META-INF/services/org.apache.taverna.ui.menu.MenuComponent
@@ -0,0 +1,3 @@
+org.apache.taverna.workbench.ui.credentialmanager.menu.CredentialManagerMenu
+#net.sf.taverna.t2.workbench.ui.credentialmanager.toolbar.CredentialManagerToolbarAction
+#net.sf.taverna.t2.workbench.ui.credentialmanager.toolbar.CredentialManagerToolbarSection
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-credential-manager-ui/src/main/resources/META-INF/services/org.apache.taverna.workbench.StartupSPI
----------------------------------------------------------------------
diff --git a/taverna-credential-manager-ui/src/main/resources/META-INF/services/org.apache.taverna.workbench.StartupSPI b/taverna-credential-manager-ui/src/main/resources/META-INF/services/org.apache.taverna.workbench.StartupSPI
new file mode 100644
index 0000000..7bf38ac
--- /dev/null
+++ b/taverna-credential-manager-ui/src/main/resources/META-INF/services/org.apache.taverna.workbench.StartupSPI
@@ -0,0 +1,2 @@
+org.apache.taverna.workbench.ui.credentialmanager.startup.InitialiseSSLStartupHook
+org.apache.taverna.workbench.ui.credentialmanager.startup.SetCredManAuthenticatorStartupHook

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-credential-manager-ui/src/main/resources/META-INF/spring/credential-manager-ui-context-osgi.xml
----------------------------------------------------------------------
diff --git a/taverna-credential-manager-ui/src/main/resources/META-INF/spring/credential-manager-ui-context-osgi.xml b/taverna-credential-manager-ui/src/main/resources/META-INF/spring/credential-manager-ui-context-osgi.xml
index f595eda..c4628a7 100644
--- a/taverna-credential-manager-ui/src/main/resources/META-INF/spring/credential-manager-ui-context-osgi.xml
+++ b/taverna-credential-manager-ui/src/main/resources/META-INF/spring/credential-manager-ui-context-osgi.xml
@@ -6,15 +6,15 @@
                       http://www.springframework.org/schema/osgi
                       http://www.springframework.org/schema/osgi/spring-osgi.xsd">
 
-	<service ref="askUserMasterPasswordProvider" interface="net.sf.taverna.t2.security.credentialmanager.MasterPasswordProvider" />
+	<service ref="askUserMasterPasswordProvider" interface="org.apache.taverna.security.credentialmanager.MasterPasswordProvider" />
 
-	<service ref="simpleMasterPasswordProvider" interface="net.sf.taverna.t2.security.credentialmanager.MasterPasswordProvider" />
+	<service ref="simpleMasterPasswordProvider" interface="org.apache.taverna.security.credentialmanager.MasterPasswordProvider" />
 
-	<service ref="askUserJavaTruststorePasswordProvider" interface="net.sf.taverna.t2.security.credentialmanager.JavaTruststorePasswordProvider" />
+	<service ref="askUserJavaTruststorePasswordProvider" interface="org.apache.taverna.security.credentialmanager.JavaTruststorePasswordProvider" />
 
-	<service ref="askUserServiceUsernameAndPasswordProvider" interface="net.sf.taverna.t2.security.credentialmanager.ServiceUsernameAndPasswordProvider" />
+	<service ref="askUserServiceUsernameAndPasswordProvider" interface="org.apache.taverna.security.credentialmanager.ServiceUsernameAndPasswordProvider" />
 
-	<service ref="askUserTrustConfirmationProvider" interface="net.sf.taverna.t2.security.credentialmanager.TrustConfirmationProvider" />
+	<service ref="askUserTrustConfirmationProvider" interface="org.apache.taverna.security.credentialmanager.TrustConfirmationProvider" />
 
 	<service ref="UIUsernamePasswordProvider" auto-export="interfaces" />
         
@@ -22,15 +22,15 @@
 	
         <service ref="ConfirmTrustedCertificateUI" auto-export="interfaces" />
 
-	<service ref="InitialiseSSLStartupHook" interface="net.sf.taverna.t2.workbench.StartupSPI" />
+	<service ref="InitialiseSSLStartupHook" interface="org.apache.taverna.workbench.StartupSPI" />
 	
-        <service ref="SetCredManAuthenticatorStartupHook" interface="net.sf.taverna.t2.workbench.StartupSPI" />
+        <service ref="SetCredManAuthenticatorStartupHook" interface="org.apache.taverna.workbench.StartupSPI" />
 
 	<service ref="CredentialManagerMenu" auto-export="interfaces" />
 
-	<reference id="CredentialManager" interface="net.sf.taverna.t2.security.credentialmanager.CredentialManager" />
+	<reference id="CredentialManager" interface="org.apache.taverna.security.credentialmanager.CredentialManager" />
 	
-        <reference id="distinguishedNameParser" interface="net.sf.taverna.t2.security.credentialmanager.DistinguishedNameParser" />
+        <reference id="distinguishedNameParser" interface="org.apache.taverna.security.credentialmanager.DistinguishedNameParser" />
 	
         <reference id="ApplicationConfiguration" interface="uk.org.taverna.configuration.app.ApplicationConfiguration" />
 

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-credential-manager-ui/src/main/resources/META-INF/spring/credential-manager-ui-context.xml
----------------------------------------------------------------------
diff --git a/taverna-credential-manager-ui/src/main/resources/META-INF/spring/credential-manager-ui-context.xml b/taverna-credential-manager-ui/src/main/resources/META-INF/spring/credential-manager-ui-context.xml
index 0e54c93..1689dcd 100644
--- a/taverna-credential-manager-ui/src/main/resources/META-INF/spring/credential-manager-ui-context.xml
+++ b/taverna-credential-manager-ui/src/main/resources/META-INF/spring/credential-manager-ui-context.xml
@@ -3,40 +3,40 @@
 	xsi:schemaLocation="http://www.springframework.org/schema/beans
                       http://www.springframework.org/schema/beans/spring-beans.xsd">
 
-	<bean id="askUserMasterPasswordProvider" class="net.sf.taverna.t2.workbench.ui.credentialmanager.password.AskUserMasterPasswordProvider" />
+	<bean id="askUserMasterPasswordProvider" class="org.apache.taverna.workbench.ui.credentialmanager.password.AskUserMasterPasswordProvider" />
 
-	<bean id="simpleMasterPasswordProvider" class="net.sf.taverna.t2.workbench.ui.credentialmanager.password.SimpleMasterPasswordProvider" />
+	<bean id="simpleMasterPasswordProvider" class="org.apache.taverna.workbench.ui.credentialmanager.password.SimpleMasterPasswordProvider" />
 
-	<bean id="askUserJavaTruststorePasswordProvider" class="net.sf.taverna.t2.workbench.ui.credentialmanager.password.AskUserJavaTruststorePasswordProvider" />
+	<bean id="askUserJavaTruststorePasswordProvider" class="org.apache.taverna.workbench.ui.credentialmanager.password.AskUserJavaTruststorePasswordProvider" />
 
-	<bean id="askUserServiceUsernameAndPasswordProvider" class="net.sf.taverna.t2.workbench.ui.credentialmanager.password.AskUserServiceUsernameAndPasswordProvider" />
+	<bean id="askUserServiceUsernameAndPasswordProvider" class="org.apache.taverna.workbench.ui.credentialmanager.password.AskUserServiceUsernameAndPasswordProvider" />
 
-	<bean id="askUserTrustConfirmationProvider" class="net.sf.taverna.t2.workbench.ui.credentialmanager.password.AskUserTrustConfirmationProvider" />
+	<bean id="askUserTrustConfirmationProvider" class="org.apache.taverna.workbench.ui.credentialmanager.password.AskUserTrustConfirmationProvider" />
 
-	<bean id="MasterPasswordProviderComparator" class="net.sf.taverna.t2.security.credentialmanager.MasterPasswordProvider$ProviderComparator" />
+	<bean id="MasterPasswordProviderComparator" class="org.apache.taverna.security.credentialmanager.MasterPasswordProvider$ProviderComparator" />
 
-	<bean id="UIUsernamePasswordProvider" class="net.sf.taverna.t2.workbench.ui.credentialmanager.password.UIUsernamePasswordProvider" >
+	<bean id="UIUsernamePasswordProvider" class="org.apache.taverna.workbench.ui.credentialmanager.password.UIUsernamePasswordProvider" >
                 <property name="distinguishedNameParser" ref="distinguishedNameParser" />
 	</bean>            
 	
-        <bean id="UIMasterPasswordProvider" class="net.sf.taverna.t2.workbench.ui.credentialmanager.password.UIMasterPasswordProvider">
+        <bean id="UIMasterPasswordProvider" class="org.apache.taverna.workbench.ui.credentialmanager.password.UIMasterPasswordProvider">
 		<property name="applicationConfiguration" ref="ApplicationConfiguration" />
                 <property name="distinguishedNameParser" ref="distinguishedNameParser" />
 	</bean>
 	
-        <bean id="ConfirmTrustedCertificateUI" class="net.sf.taverna.t2.workbench.ui.credentialmanager.ConfirmTrustedCertificateUI">
+        <bean id="ConfirmTrustedCertificateUI" class="org.apache.taverna.workbench.ui.credentialmanager.ConfirmTrustedCertificateUI">
                 <property name="distinguishedNameParser" ref="distinguishedNameParser" />
 	</bean>            
 	
-        <bean id="InitialiseSSLStartupHook" class="net.sf.taverna.t2.workbench.ui.credentialmanager.startup.InitialiseSSLStartupHook">
+        <bean id="InitialiseSSLStartupHook" class="org.apache.taverna.workbench.ui.credentialmanager.startup.InitialiseSSLStartupHook">
 		<property name="credentialManager" ref="CredentialManager" />
 	</bean>
 	
-        <bean id="SetCredManAuthenticatorStartupHook" class="net.sf.taverna.t2.workbench.ui.credentialmanager.startup.SetCredManAuthenticatorStartupHook" >
+        <bean id="SetCredManAuthenticatorStartupHook" class="org.apache.taverna.workbench.ui.credentialmanager.startup.SetCredManAuthenticatorStartupHook" >
 		<property name="credentialManager" ref="CredentialManager" />
 	</bean>
 
-	<bean id="CredentialManagerMenu" class="net.sf.taverna.t2.workbench.ui.credentialmanager.menu.CredentialManagerMenu" >
+	<bean id="CredentialManagerMenu" class="org.apache.taverna.workbench.ui.credentialmanager.menu.CredentialManagerMenu" >
 		<property name="credentialManager" ref="CredentialManager" />
                 <property name="distinguishedNameParser" ref="distinguishedNameParser" />
 	</bean>

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-data-management-config-ui/src/main/java/net/sf/taverna/t2/workbench/reference/config/DataManagementConfigurationPanel.java
----------------------------------------------------------------------
diff --git a/taverna-data-management-config-ui/src/main/java/net/sf/taverna/t2/workbench/reference/config/DataManagementConfigurationPanel.java b/taverna-data-management-config-ui/src/main/java/net/sf/taverna/t2/workbench/reference/config/DataManagementConfigurationPanel.java
deleted file mode 100644
index 1b880d8..0000000
--- a/taverna-data-management-config-ui/src/main/java/net/sf/taverna/t2/workbench/reference/config/DataManagementConfigurationPanel.java
+++ /dev/null
@@ -1,304 +0,0 @@
-/*******************************************************************************
- * 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.reference.config;
-
-import static java.awt.Color.RED;
-import static java.awt.Font.PLAIN;
-import static java.awt.GridBagConstraints.BOTH;
-import static java.awt.GridBagConstraints.HORIZONTAL;
-import static java.awt.GridBagConstraints.NONE;
-import static java.awt.GridBagConstraints.RELATIVE;
-import static java.awt.GridBagConstraints.WEST;
-import static net.sf.taverna.t2.workbench.helper.Helper.showHelp;
-
-import java.awt.Font;
-import java.awt.GridBagConstraints;
-import java.awt.GridBagLayout;
-import java.awt.Insets;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.sql.Connection;
-
-import javax.swing.AbstractAction;
-import javax.swing.JButton;
-import javax.swing.JCheckBox;
-import javax.swing.JComponent;
-import javax.swing.JPanel;
-import javax.swing.JTextArea;
-import javax.swing.border.EmptyBorder;
-
-import net.sf.taverna.t2.lang.ui.DialogTextArea;
-import org.apache.taverna.configuration.database.DatabaseConfiguration;
-import org.apache.taverna.configuration.database.DatabaseManager;
-
-@SuppressWarnings("serial")
-public class DataManagementConfigurationPanel extends JPanel {
-	private DatabaseConfiguration configuration;
-	private DatabaseManager databaseManager;
-
-	private JCheckBox enableProvenance;
-	private JCheckBox enableInMemory;
-	private JButton helpButton;
-	private JButton resetButton;
-	private JButton applyButton;
-	private JTextArea storageText;
-	private JTextArea exposeDatanatureText;
-	private JCheckBox exposeDatanatureBox;
-	private DialogTextArea enableInMemoryTextDisabled;
-
-	public DataManagementConfigurationPanel(DatabaseConfiguration configuration, DatabaseManager databaseManager) {
-		this.configuration = configuration;
-		this.databaseManager = databaseManager;
-
-		setLayout(generateLayout());
-		resetFields();
-	}
-
-	private static final boolean ADD_WARNING_LISTENERS = false;
-
-	private GridBagLayout generateLayout() {
-		GridBagLayout gridbag = new GridBagLayout();
-		GridBagConstraints c = new GridBagConstraints();
-
-		enableProvenance = new JCheckBox("Enable provenance capture");
-		DialogTextArea enableProvenanceText = new DialogTextArea(
-				"Disabling provenance will prevent you from being able to view intermediate results, but does give a performance benefit.");
-		Font plain = enableProvenanceText.getFont().deriveFont(PLAIN, 11);
-		enableProvenanceText.setLineWrap(true);
-		enableProvenanceText.setWrapStyleWord(true);
-		enableProvenanceText.setEditable(false);
-		enableProvenanceText.setFocusable(false);
-		enableProvenanceText.setOpaque(false);
-		enableProvenanceText.setFont(plain);
-
-		enableInMemory = new JCheckBox("In-memory storage");
-		DialogTextArea enableInMemoryText = new DialogTextArea(
-				"Data will not be stored between workbench sessions. If you run workflows passing larger amounts of data, try disabling in-memory storage, which can reduce execution performance, but also Taverna's memory consumption. ");
-		enableInMemoryText.setLineWrap(true);
-		enableInMemoryText.setWrapStyleWord(true);
-		enableInMemoryText.setEditable(false);
-		enableInMemoryText.setFocusable(false);
-		enableInMemoryText.setOpaque(false);
-		enableInMemoryText.setFont(plain);
-
-		enableInMemoryTextDisabled = new DialogTextArea(
-				"If you enable in-memory storage of data when provenance collection is turned on then provenance will not be available after you shutdown Taverna as the in-memory data will be lost.");
-		enableInMemoryTextDisabled.setLineWrap(true);
-		enableInMemoryTextDisabled.setWrapStyleWord(true);
-		enableInMemoryTextDisabled.setEditable(false);
-		enableInMemoryTextDisabled.setFocusable(false);
-		enableInMemoryTextDisabled.setOpaque(false);
-		enableInMemoryTextDisabled.setFont(plain);
-		enableInMemoryTextDisabled.setForeground(RED);
-		enableInMemoryTextDisabled.setVisible(false);
-
-		// Disable warning as inMemory is default
-		// To re-enable - also see resetFields()
-
-		if (ADD_WARNING_LISTENERS) {
-			enableInMemory.addActionListener(new ActionListener() {
-				@Override
-				public void actionPerformed(ActionEvent e) {
-					enableInMemoryTextDisabled.setVisible(enableProvenance
-							.isSelected() && enableInMemory.isSelected());
-				}
-			});
-			enableProvenance.addActionListener(new ActionListener() {
-				@Override
-				public void actionPerformed(ActionEvent e) {
-					enableInMemoryTextDisabled.setVisible(enableProvenance
-							.isSelected() && enableInMemory.isSelected());
-				}
-			});
-		}
-
-		storageText = new JTextArea(
-				"Select how Taverna stores the data and provenance produced when a workflow is run. This includes workflow results and intermediate results.");
-		storageText.setLineWrap(true);
-		storageText.setWrapStyleWord(true);
-		storageText.setEditable(false);
-		storageText.setFocusable(false);
-		storageText.setBorder(new EmptyBorder(10, 10, 10, 10));
-		storageText.setFont(plain);
-
-		JComponent portPanel = createDerbyServerStatusComponent();
-
-		c.anchor = WEST;
-		c.insets = new Insets(0, 0, 10, 0);
-		c.gridx = 0;
-		c.gridy = RELATIVE;
-		c.weightx = 0.0;
-		c.weighty = 0.0;
-		c.fill = HORIZONTAL;
-		gridbag.setConstraints(storageText, c);
-		add(storageText);
-
-		c.ipady = 0;
-		c.insets = new Insets(0, 0, 5, 0);
-		c.fill = NONE;
-		gridbag.setConstraints(enableProvenance, c);
-		add(enableProvenance);
-
-		c.insets = new Insets(0, 20, 15, 20);
-		c.fill = HORIZONTAL;
-		gridbag.setConstraints(enableProvenanceText, c);
-		add(enableProvenanceText);
-
-		c.insets = new Insets(0, 0, 5, 0);
-		c.fill = GridBagConstraints.NONE;
-		gridbag.setConstraints(enableInMemory, c);
-		add(enableInMemory);
-
-		c.insets = new Insets(0, 20, 15, 20);
-		c.fill = HORIZONTAL;
-		gridbag.setConstraints(enableInMemoryText, c);
-		add(enableInMemoryText);
-
-		c.insets = new Insets(0, 20, 15, 20);
-		c.fill = HORIZONTAL;
-		gridbag.setConstraints(enableInMemoryTextDisabled, c);
-		add(enableInMemoryTextDisabled);
-
-		c.insets = new Insets(0, 20, 15, 20);
-		gridbag.setConstraints(portPanel, c);
-		add(portPanel);
-
-		c.insets = new Insets(0, 0, 5, 0);
-		c.fill = NONE;
-		exposeDatanatureBox = new JCheckBox(
-				"Allow setting of input data encoding");
-		gridbag.setConstraints(exposeDatanatureBox, c);
-		add(exposeDatanatureBox);
-
-		exposeDatanatureText = new JTextArea(
-				"Select if you want to control how Taverna handles files read as input data");
-		exposeDatanatureText.setLineWrap(true);
-		exposeDatanatureText.setWrapStyleWord(true);
-		exposeDatanatureText.setEditable(false);
-		exposeDatanatureText.setFocusable(false);
-		exposeDatanatureText.setOpaque(false);
-		exposeDatanatureText.setFont(plain);
-
-		c.insets = new Insets(0, 20, 15, 20);
-		c.fill = HORIZONTAL;
-		gridbag.setConstraints(exposeDatanatureText, c);
-		add(exposeDatanatureText);
-
-		JPanel buttonPanel = createButtonPanel();
-		c.weightx = 1.0;
-		c.weighty = 1.0;
-		c.fill = BOTH;
-		c.insets = new Insets(0, 0, 5, 0);
-		gridbag.setConstraints(buttonPanel, c);
-		add(buttonPanel);
-		return gridbag;
-	}
-
-	private JComponent createDerbyServerStatusComponent() {
-		DialogTextArea textArea = new DialogTextArea();
-		boolean running;
-
-		try (Connection connection = databaseManager.getConnection()) {
-			running = databaseManager.isRunning();
-		} catch (Exception e) {
-			running = false;
-		}
-
-		if (running)
-			textArea.setText("The database is currently running on port: "
-					+ configuration.getCurrentPort() + ".");
-		else
-			textArea.setText("Unable to retrieve a database connection - "
-					+ "the database is not available.");
-
-		textArea.setLineWrap(true);
-		textArea.setWrapStyleWord(true);
-		textArea.setEditable(false);
-		textArea.setFocusable(false);
-		textArea.setOpaque(false);
-		textArea.setAlignmentX(CENTER_ALIGNMENT);
-		textArea.setFont(textArea.getFont().deriveFont(PLAIN, 11));
-		textArea.setVisible(configuration.getStartInternalDerbyServer());
-		return textArea;
-	}
-
-	// for testing only
-//	public static void main(String[] args) {
-//		JDialog dialog = new JDialog();
-//		dialog.add(new DataManagementConfigurationPanel());
-//		dialog.setModal(true);
-//		dialog.setSize(500, 300);
-//		dialog.setVisible(true);
-//		System.exit(0);
-//	}
-
-	public void resetFields() {
-		enableInMemory.setSelected(configuration.isInMemory());
-		enableProvenance.setSelected(configuration.isProvenanceEnabled());
-		exposeDatanatureBox.setSelected(configuration.isExposeDatanature());
-
-		if (ADD_WARNING_LISTENERS) {
-			enableInMemoryTextDisabled.setVisible(enableProvenance.isSelected()
-					&& enableInMemory.isSelected());
-		}
-	}
-
-	/*private boolean workflowInstances() {
-		return DataflowRunsComponent.getInstance().getRunListCount()>0;
-	}*/
-
-	private void applySettings() {
-		configuration.setProvenanceEnabled(enableProvenance.isSelected());
-		configuration.setInMemory(enableInMemory.isSelected());
-		configuration.setExposeDatanature(exposeDatanatureBox.isSelected());
-	}
-
-	private JPanel createButtonPanel() {
-		final JPanel panel = new JPanel();
-
-		helpButton = new JButton(new AbstractAction("Help") {
-			@Override
-			public void actionPerformed(ActionEvent arg0) {
-				showHelp(panel);
-			}
-		});
-		panel.add(helpButton);
-
-		resetButton = new JButton(new AbstractAction("Reset") {
-			@Override
-			public void actionPerformed(ActionEvent arg0) {
-				resetFields();
-			}
-		});
-		panel.add(resetButton);
-
-		applyButton = new JButton(new AbstractAction("Apply") {
-			@Override
-			public void actionPerformed(ActionEvent arg0) {
-				applySettings();
-				resetFields();
-			}
-		});
-		panel.add(applyButton);
-
-		return panel;
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-data-management-config-ui/src/main/java/net/sf/taverna/t2/workbench/reference/config/DataManagementConfigurationUIFactory.java
----------------------------------------------------------------------
diff --git a/taverna-data-management-config-ui/src/main/java/net/sf/taverna/t2/workbench/reference/config/DataManagementConfigurationUIFactory.java b/taverna-data-management-config-ui/src/main/java/net/sf/taverna/t2/workbench/reference/config/DataManagementConfigurationUIFactory.java
deleted file mode 100644
index efdc019..0000000
--- a/taverna-data-management-config-ui/src/main/java/net/sf/taverna/t2/workbench/reference/config/DataManagementConfigurationUIFactory.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*******************************************************************************
- * 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.reference.config;
-
-import javax.swing.JPanel;
-
-import uk.org.taverna.configuration.Configurable;
-import uk.org.taverna.configuration.ConfigurationUIFactory;
-import org.apache.taverna.configuration.database.DatabaseConfiguration;
-import org.apache.taverna.configuration.database.DatabaseManager;
-
-public class DataManagementConfigurationUIFactory implements
-		ConfigurationUIFactory {
-	private DatabaseConfiguration databaseConfiguration;
-	private DatabaseManager databaseManager;
-
-	private DataManagementConfigurationPanel configPanel;
-
-	@Override
-	public boolean canHandle(String uuid) {
-		return uuid.equals(getConfigurable().getUUID());
-	}
-
-	@Override
-	public JPanel getConfigurationPanel() {
-		if (configPanel == null)
-			configPanel = new DataManagementConfigurationPanel(
-					databaseConfiguration, databaseManager);
-		configPanel.resetFields();
-		return configPanel;
-	}
-
-	@Override
-	public Configurable getConfigurable() {
-		return databaseConfiguration;
-	}
-
-	public void setDatabaseConfiguration(
-			DatabaseConfiguration databaseConfiguration) {
-		this.databaseConfiguration = databaseConfiguration;
-	}
-
-	public void setDatabaseManager(DatabaseManager databaseManager) {
-		this.databaseManager = databaseManager;
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-data-management-config-ui/src/main/java/org/apache/taverna/workbench/reference/config/DataManagementConfigurationPanel.java
----------------------------------------------------------------------
diff --git a/taverna-data-management-config-ui/src/main/java/org/apache/taverna/workbench/reference/config/DataManagementConfigurationPanel.java b/taverna-data-management-config-ui/src/main/java/org/apache/taverna/workbench/reference/config/DataManagementConfigurationPanel.java
new file mode 100644
index 0000000..d17bb16
--- /dev/null
+++ b/taverna-data-management-config-ui/src/main/java/org/apache/taverna/workbench/reference/config/DataManagementConfigurationPanel.java
@@ -0,0 +1,303 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.reference.config;
+
+import static java.awt.Color.RED;
+import static java.awt.Font.PLAIN;
+import static java.awt.GridBagConstraints.BOTH;
+import static java.awt.GridBagConstraints.HORIZONTAL;
+import static java.awt.GridBagConstraints.NONE;
+import static java.awt.GridBagConstraints.RELATIVE;
+import static java.awt.GridBagConstraints.WEST;
+import static org.apache.taverna.workbench.helper.Helper.showHelp;
+
+import java.awt.Font;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.Insets;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.sql.Connection;
+
+import javax.swing.AbstractAction;
+import javax.swing.JButton;
+import javax.swing.JCheckBox;
+import javax.swing.JComponent;
+import javax.swing.JPanel;
+import javax.swing.JTextArea;
+import javax.swing.border.EmptyBorder;
+
+import org.apache.taverna.lang.ui.DialogTextArea;
+import org.apache.taverna.configuration.database.DatabaseConfiguration;
+import org.apache.taverna.configuration.database.DatabaseManager;
+
+@SuppressWarnings("serial")
+public class DataManagementConfigurationPanel extends JPanel {
+	private DatabaseConfiguration configuration;
+	private DatabaseManager databaseManager;
+
+	private JCheckBox enableProvenance;
+	private JCheckBox enableInMemory;
+	private JButton helpButton;
+	private JButton resetButton;
+	private JButton applyButton;
+	private JTextArea storageText;
+	private JTextArea exposeDatanatureText;
+	private JCheckBox exposeDatanatureBox;
+	private DialogTextArea enableInMemoryTextDisabled;
+
+	public DataManagementConfigurationPanel(DatabaseConfiguration configuration, DatabaseManager databaseManager) {
+		this.configuration = configuration;
+		this.databaseManager = databaseManager;
+
+		setLayout(generateLayout());
+		resetFields();
+	}
+
+	private static final boolean ADD_WARNING_LISTENERS = false;
+
+	private GridBagLayout generateLayout() {
+		GridBagLayout gridbag = new GridBagLayout();
+		GridBagConstraints c = new GridBagConstraints();
+
+		enableProvenance = new JCheckBox("Enable provenance capture");
+		DialogTextArea enableProvenanceText = new DialogTextArea(
+				"Disabling provenance will prevent you from being able to view intermediate results, but does give a performance benefit.");
+		Font plain = enableProvenanceText.getFont().deriveFont(PLAIN, 11);
+		enableProvenanceText.setLineWrap(true);
+		enableProvenanceText.setWrapStyleWord(true);
+		enableProvenanceText.setEditable(false);
+		enableProvenanceText.setFocusable(false);
+		enableProvenanceText.setOpaque(false);
+		enableProvenanceText.setFont(plain);
+
+		enableInMemory = new JCheckBox("In-memory storage");
+		DialogTextArea enableInMemoryText = new DialogTextArea(
+				"Data will not be stored between workbench sessions. If you run workflows passing larger amounts of data, try disabling in-memory storage, which can reduce execution performance, but also Taverna's memory consumption. ");
+		enableInMemoryText.setLineWrap(true);
+		enableInMemoryText.setWrapStyleWord(true);
+		enableInMemoryText.setEditable(false);
+		enableInMemoryText.setFocusable(false);
+		enableInMemoryText.setOpaque(false);
+		enableInMemoryText.setFont(plain);
+
+		enableInMemoryTextDisabled = new DialogTextArea(
+				"If you enable in-memory storage of data when provenance collection is turned on then provenance will not be available after you shutdown Taverna as the in-memory data will be lost.");
+		enableInMemoryTextDisabled.setLineWrap(true);
+		enableInMemoryTextDisabled.setWrapStyleWord(true);
+		enableInMemoryTextDisabled.setEditable(false);
+		enableInMemoryTextDisabled.setFocusable(false);
+		enableInMemoryTextDisabled.setOpaque(false);
+		enableInMemoryTextDisabled.setFont(plain);
+		enableInMemoryTextDisabled.setForeground(RED);
+		enableInMemoryTextDisabled.setVisible(false);
+
+		// Disable warning as inMemory is default
+		// To re-enable - also see resetFields()
+
+		if (ADD_WARNING_LISTENERS) {
+			enableInMemory.addActionListener(new ActionListener() {
+				@Override
+				public void actionPerformed(ActionEvent e) {
+					enableInMemoryTextDisabled.setVisible(enableProvenance
+							.isSelected() && enableInMemory.isSelected());
+				}
+			});
+			enableProvenance.addActionListener(new ActionListener() {
+				@Override
+				public void actionPerformed(ActionEvent e) {
+					enableInMemoryTextDisabled.setVisible(enableProvenance
+							.isSelected() && enableInMemory.isSelected());
+				}
+			});
+		}
+
+		storageText = new JTextArea(
+				"Select how Taverna stores the data and provenance produced when a workflow is run. This includes workflow results and intermediate results.");
+		storageText.setLineWrap(true);
+		storageText.setWrapStyleWord(true);
+		storageText.setEditable(false);
+		storageText.setFocusable(false);
+		storageText.setBorder(new EmptyBorder(10, 10, 10, 10));
+		storageText.setFont(plain);
+
+		JComponent portPanel = createDerbyServerStatusComponent();
+
+		c.anchor = WEST;
+		c.insets = new Insets(0, 0, 10, 0);
+		c.gridx = 0;
+		c.gridy = RELATIVE;
+		c.weightx = 0.0;
+		c.weighty = 0.0;
+		c.fill = HORIZONTAL;
+		gridbag.setConstraints(storageText, c);
+		add(storageText);
+
+		c.ipady = 0;
+		c.insets = new Insets(0, 0, 5, 0);
+		c.fill = NONE;
+		gridbag.setConstraints(enableProvenance, c);
+		add(enableProvenance);
+
+		c.insets = new Insets(0, 20, 15, 20);
+		c.fill = HORIZONTAL;
+		gridbag.setConstraints(enableProvenanceText, c);
+		add(enableProvenanceText);
+
+		c.insets = new Insets(0, 0, 5, 0);
+		c.fill = GridBagConstraints.NONE;
+		gridbag.setConstraints(enableInMemory, c);
+		add(enableInMemory);
+
+		c.insets = new Insets(0, 20, 15, 20);
+		c.fill = HORIZONTAL;
+		gridbag.setConstraints(enableInMemoryText, c);
+		add(enableInMemoryText);
+
+		c.insets = new Insets(0, 20, 15, 20);
+		c.fill = HORIZONTAL;
+		gridbag.setConstraints(enableInMemoryTextDisabled, c);
+		add(enableInMemoryTextDisabled);
+
+		c.insets = new Insets(0, 20, 15, 20);
+		gridbag.setConstraints(portPanel, c);
+		add(portPanel);
+
+		c.insets = new Insets(0, 0, 5, 0);
+		c.fill = NONE;
+		exposeDatanatureBox = new JCheckBox(
+				"Allow setting of input data encoding");
+		gridbag.setConstraints(exposeDatanatureBox, c);
+		add(exposeDatanatureBox);
+
+		exposeDatanatureText = new JTextArea(
+				"Select if you want to control how Taverna handles files read as input data");
+		exposeDatanatureText.setLineWrap(true);
+		exposeDatanatureText.setWrapStyleWord(true);
+		exposeDatanatureText.setEditable(false);
+		exposeDatanatureText.setFocusable(false);
+		exposeDatanatureText.setOpaque(false);
+		exposeDatanatureText.setFont(plain);
+
+		c.insets = new Insets(0, 20, 15, 20);
+		c.fill = HORIZONTAL;
+		gridbag.setConstraints(exposeDatanatureText, c);
+		add(exposeDatanatureText);
+
+		JPanel buttonPanel = createButtonPanel();
+		c.weightx = 1.0;
+		c.weighty = 1.0;
+		c.fill = BOTH;
+		c.insets = new Insets(0, 0, 5, 0);
+		gridbag.setConstraints(buttonPanel, c);
+		add(buttonPanel);
+		return gridbag;
+	}
+
+	private JComponent createDerbyServerStatusComponent() {
+		DialogTextArea textArea = new DialogTextArea();
+		boolean running;
+
+		try (Connection connection = databaseManager.getConnection()) {
+			running = databaseManager.isRunning();
+		} catch (Exception e) {
+			running = false;
+		}
+
+		if (running)
+			textArea.setText("The database is currently running on port: "
+					+ configuration.getCurrentPort() + ".");
+		else
+			textArea.setText("Unable to retrieve a database connection - "
+					+ "the database is not available.");
+
+		textArea.setLineWrap(true);
+		textArea.setWrapStyleWord(true);
+		textArea.setEditable(false);
+		textArea.setFocusable(false);
+		textArea.setOpaque(false);
+		textArea.setAlignmentX(CENTER_ALIGNMENT);
+		textArea.setFont(textArea.getFont().deriveFont(PLAIN, 11));
+		textArea.setVisible(configuration.getStartInternalDerbyServer());
+		return textArea;
+	}
+
+	// for testing only
+//	public static void main(String[] args) {
+//		JDialog dialog = new JDialog();
+//		dialog.add(new DataManagementConfigurationPanel());
+//		dialog.setModal(true);
+//		dialog.setSize(500, 300);
+//		dialog.setVisible(true);
+//		System.exit(0);
+//	}
+
+	public void resetFields() {
+		enableInMemory.setSelected(configuration.isInMemory());
+		enableProvenance.setSelected(configuration.isProvenanceEnabled());
+		exposeDatanatureBox.setSelected(configuration.isExposeDatanature());
+
+		if (ADD_WARNING_LISTENERS) {
+			enableInMemoryTextDisabled.setVisible(enableProvenance.isSelected()
+					&& enableInMemory.isSelected());
+		}
+	}
+
+	/*private boolean workflowInstances() {
+		return DataflowRunsComponent.getInstance().getRunListCount()>0;
+	}*/
+
+	private void applySettings() {
+		configuration.setProvenanceEnabled(enableProvenance.isSelected());
+		configuration.setInMemory(enableInMemory.isSelected());
+		configuration.setExposeDatanature(exposeDatanatureBox.isSelected());
+	}
+
+	private JPanel createButtonPanel() {
+		final JPanel panel = new JPanel();
+
+		helpButton = new JButton(new AbstractAction("Help") {
+			@Override
+			public void actionPerformed(ActionEvent arg0) {
+				showHelp(panel);
+			}
+		});
+		panel.add(helpButton);
+
+		resetButton = new JButton(new AbstractAction("Reset") {
+			@Override
+			public void actionPerformed(ActionEvent arg0) {
+				resetFields();
+			}
+		});
+		panel.add(resetButton);
+
+		applyButton = new JButton(new AbstractAction("Apply") {
+			@Override
+			public void actionPerformed(ActionEvent arg0) {
+				applySettings();
+				resetFields();
+			}
+		});
+		panel.add(applyButton);
+
+		return panel;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-data-management-config-ui/src/main/java/org/apache/taverna/workbench/reference/config/DataManagementConfigurationUIFactory.java
----------------------------------------------------------------------
diff --git a/taverna-data-management-config-ui/src/main/java/org/apache/taverna/workbench/reference/config/DataManagementConfigurationUIFactory.java b/taverna-data-management-config-ui/src/main/java/org/apache/taverna/workbench/reference/config/DataManagementConfigurationUIFactory.java
new file mode 100644
index 0000000..df1ce0b
--- /dev/null
+++ b/taverna-data-management-config-ui/src/main/java/org/apache/taverna/workbench/reference/config/DataManagementConfigurationUIFactory.java
@@ -0,0 +1,63 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.reference.config;
+
+import javax.swing.JPanel;
+
+import uk.org.taverna.configuration.Configurable;
+import uk.org.taverna.configuration.ConfigurationUIFactory;
+import org.apache.taverna.configuration.database.DatabaseConfiguration;
+import org.apache.taverna.configuration.database.DatabaseManager;
+
+public class DataManagementConfigurationUIFactory implements
+		ConfigurationUIFactory {
+	private DatabaseConfiguration databaseConfiguration;
+	private DatabaseManager databaseManager;
+
+	private DataManagementConfigurationPanel configPanel;
+
+	@Override
+	public boolean canHandle(String uuid) {
+		return uuid.equals(getConfigurable().getUUID());
+	}
+
+	@Override
+	public JPanel getConfigurationPanel() {
+		if (configPanel == null)
+			configPanel = new DataManagementConfigurationPanel(
+					databaseConfiguration, databaseManager);
+		configPanel.resetFields();
+		return configPanel;
+	}
+
+	@Override
+	public Configurable getConfigurable() {
+		return databaseConfiguration;
+	}
+
+	public void setDatabaseConfiguration(
+			DatabaseConfiguration databaseConfiguration) {
+		this.databaseConfiguration = databaseConfiguration;
+	}
+
+	public void setDatabaseManager(DatabaseManager databaseManager) {
+		this.databaseManager = databaseManager;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-data-management-config-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.configuration.ConfigurationUIFactory
----------------------------------------------------------------------
diff --git a/taverna-data-management-config-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.configuration.ConfigurationUIFactory b/taverna-data-management-config-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.configuration.ConfigurationUIFactory
deleted file mode 100644
index 8afa6ca..0000000
--- a/taverna-data-management-config-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.configuration.ConfigurationUIFactory
+++ /dev/null
@@ -1 +0,0 @@
-net.sf.taverna.t2.workbench.reference.config.DataManagementConfigurationUIFactory
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-data-management-config-ui/src/main/resources/META-INF/services/org.apache.taverna.workbench.configuration.ConfigurationUIFactory
----------------------------------------------------------------------
diff --git a/taverna-data-management-config-ui/src/main/resources/META-INF/services/org.apache.taverna.workbench.configuration.ConfigurationUIFactory b/taverna-data-management-config-ui/src/main/resources/META-INF/services/org.apache.taverna.workbench.configuration.ConfigurationUIFactory
new file mode 100644
index 0000000..8afa6ca
--- /dev/null
+++ b/taverna-data-management-config-ui/src/main/resources/META-INF/services/org.apache.taverna.workbench.configuration.ConfigurationUIFactory
@@ -0,0 +1 @@
+net.sf.taverna.t2.workbench.reference.config.DataManagementConfigurationUIFactory
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-data-management-config-ui/src/main/resources/META-INF/spring/data-management-config-ui-context-osgi.xml
----------------------------------------------------------------------
diff --git a/taverna-data-management-config-ui/src/main/resources/META-INF/spring/data-management-config-ui-context-osgi.xml b/taverna-data-management-config-ui/src/main/resources/META-INF/spring/data-management-config-ui-context-osgi.xml
index 89f84a7..b5c5b21 100644
--- a/taverna-data-management-config-ui/src/main/resources/META-INF/spring/data-management-config-ui-context-osgi.xml
+++ b/taverna-data-management-config-ui/src/main/resources/META-INF/spring/data-management-config-ui-context-osgi.xml
@@ -6,7 +6,7 @@
                       http://www.springframework.org/schema/osgi
                       http://www.springframework.org/schema/osgi/spring-osgi.xsd">
 
-	<service ref="DataManagementConfigurationUIFactory" interface="uk.org.taverna.configuration.ConfigurationUIFactory" />
+	<service ref="DataManagementConfigurationUIFactory" interface="org.apache.taverna.configuration.ConfigurationUIFactory" />
 
 	<reference id="databaseConfiguration" interface="uk.org.taverna.configuration.database.DatabaseConfiguration" />
 	<reference id="databaseManager" interface="uk.org.taverna.configuration.database.DatabaseManager" />

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-data-management-config-ui/src/main/resources/META-INF/spring/data-management-config-ui-context.xml
----------------------------------------------------------------------
diff --git a/taverna-data-management-config-ui/src/main/resources/META-INF/spring/data-management-config-ui-context.xml b/taverna-data-management-config-ui/src/main/resources/META-INF/spring/data-management-config-ui-context.xml
index f9f40ed..9d20390 100644
--- a/taverna-data-management-config-ui/src/main/resources/META-INF/spring/data-management-config-ui-context.xml
+++ b/taverna-data-management-config-ui/src/main/resources/META-INF/spring/data-management-config-ui-context.xml
@@ -3,7 +3,7 @@
 	xsi:schemaLocation="http://www.springframework.org/schema/beans
                       http://www.springframework.org/schema/beans/spring-beans.xsd">
 
-	<bean id="DataManagementConfigurationUIFactory" class="net.sf.taverna.t2.workbench.reference.config.DataManagementConfigurationUIFactory">
+	<bean id="DataManagementConfigurationUIFactory" class="org.apache.taverna.workbench.reference.config.DataManagementConfigurationUIFactory">
 		<property name="databaseConfiguration" ref="databaseConfiguration"/>
 		<property name="databaseManager" ref="databaseManager"/>
 	</bean>

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-dataflow-activity-ui/src/main/java/net/sf/taverna/t2/activities/dataflow/actions/EditNestedDataflowAction.java
----------------------------------------------------------------------
diff --git a/taverna-dataflow-activity-ui/src/main/java/net/sf/taverna/t2/activities/dataflow/actions/EditNestedDataflowAction.java b/taverna-dataflow-activity-ui/src/main/java/net/sf/taverna/t2/activities/dataflow/actions/EditNestedDataflowAction.java
deleted file mode 100644
index 0642295..0000000
--- a/taverna-dataflow-activity-ui/src/main/java/net/sf/taverna/t2/activities/dataflow/actions/EditNestedDataflowAction.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.activities.dataflow.actions;
-
-import java.awt.event.ActionEvent;
-
-import javax.swing.AbstractAction;
-
-import com.fasterxml.jackson.databind.JsonNode;
-
-import net.sf.taverna.t2.activities.dataflow.servicedescriptions.DataflowTemplateService;
-import net.sf.taverna.t2.workbench.selection.SelectionManager;
-import org.apache.taverna.scufl2.api.activity.Activity;
-import org.apache.taverna.scufl2.api.common.Scufl2Tools;
-import org.apache.taverna.scufl2.api.configurations.Configuration;
-import org.apache.taverna.scufl2.api.core.Workflow;
-
-@SuppressWarnings("serial")
-public class EditNestedDataflowAction extends AbstractAction {
-
-	private final Activity activity;
-	private final SelectionManager selectionManager;
-
-	private Scufl2Tools scufl2Tools = new Scufl2Tools();
-
-	public EditNestedDataflowAction(Activity activity, SelectionManager selectionManager) {
-		super("Edit nested workflow");
-		this.activity = activity;
-		this.selectionManager = selectionManager;
-	}
-
-	public void actionPerformed(ActionEvent e) {
-		if (activity.getType().equals(DataflowTemplateService.ACTIVITY_TYPE)) {
-			for (Configuration configuration : scufl2Tools.configurationsFor(activity, selectionManager.getSelectedProfile())) {
-				JsonNode nested = configuration.getJson().get("nestedWorkflow");
-				Workflow nestedWorkflow = selectionManager.getSelectedWorkflowBundle().getWorkflows().getByName(nested.asText());
-				if (nestedWorkflow != null) {
-					selectionManager.setSelectedWorkflow(nestedWorkflow);
-					break;
-				}
-			}
-		}
-	}
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-dataflow-activity-ui/src/main/java/net/sf/taverna/t2/activities/dataflow/menu/EditNestedDataflowMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-dataflow-activity-ui/src/main/java/net/sf/taverna/t2/activities/dataflow/menu/EditNestedDataflowMenuAction.java b/taverna-dataflow-activity-ui/src/main/java/net/sf/taverna/t2/activities/dataflow/menu/EditNestedDataflowMenuAction.java
deleted file mode 100644
index 8bdf0e1..0000000
--- a/taverna-dataflow-activity-ui/src/main/java/net/sf/taverna/t2/activities/dataflow/menu/EditNestedDataflowMenuAction.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package net.sf.taverna.t2.activities.dataflow.menu;
-
-import javax.swing.Action;
-
-import net.sf.taverna.t2.activities.dataflow.actions.EditNestedDataflowAction;
-import net.sf.taverna.t2.activities.dataflow.servicedescriptions.DataflowTemplateService;
-import net.sf.taverna.t2.workbench.activitytools.AbstractConfigureActivityMenuAction;
-import net.sf.taverna.t2.workbench.selection.SelectionManager;
-
-public class EditNestedDataflowMenuAction extends AbstractConfigureActivityMenuAction {
-
-	private SelectionManager selectionManager;
-
-	public EditNestedDataflowMenuAction() {
-		super(DataflowTemplateService.ACTIVITY_TYPE);
-	}
-
-	@Override
-	protected Action createAction() {
-		EditNestedDataflowAction configAction = new EditNestedDataflowAction(findActivity(), selectionManager);
-		return configAction;
-	}
-
-	public void setSelectionManager(SelectionManager selectionManager) {
-		this.selectionManager = selectionManager;
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-dataflow-activity-ui/src/main/java/net/sf/taverna/t2/activities/dataflow/servicedescriptions/DataflowActivityIcon.java
----------------------------------------------------------------------
diff --git a/taverna-dataflow-activity-ui/src/main/java/net/sf/taverna/t2/activities/dataflow/servicedescriptions/DataflowActivityIcon.java b/taverna-dataflow-activity-ui/src/main/java/net/sf/taverna/t2/activities/dataflow/servicedescriptions/DataflowActivityIcon.java
deleted file mode 100644
index 6d7e766..0000000
--- a/taverna-dataflow-activity-ui/src/main/java/net/sf/taverna/t2/activities/dataflow/servicedescriptions/DataflowActivityIcon.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * 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.activities.dataflow.servicedescriptions;
-
-import java.net.URI;
-
-import javax.swing.Icon;
-import javax.swing.ImageIcon;
-
-import net.sf.taverna.t2.workbench.activityicons.ActivityIconSPI;
-
-/**
- *
- * @author Alex Nenadic
- * @author alanrw
- *
- */
-public class DataflowActivityIcon implements ActivityIconSPI{
-
-	private static Icon icon;
-
-	public int canProvideIconScore(URI activityType) {
-		if (DataflowTemplateService.ACTIVITY_TYPE.equals(activityType))
-			return DEFAULT_ICON + 1;
-		else
-			return NO_ICON;
-	}
-
-	public Icon getIcon(URI activityType) {
-		return getDataflowIcon();
-	}
-
-	public static Icon getDataflowIcon() {
-		if (icon == null) {
-			icon = new ImageIcon(DataflowActivityIcon.class.getResource("/dataflow.png"));
-		}
-		return icon;
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-dataflow-activity-ui/src/main/java/net/sf/taverna/t2/activities/dataflow/servicedescriptions/DataflowTemplateService.java
----------------------------------------------------------------------
diff --git a/taverna-dataflow-activity-ui/src/main/java/net/sf/taverna/t2/activities/dataflow/servicedescriptions/DataflowTemplateService.java b/taverna-dataflow-activity-ui/src/main/java/net/sf/taverna/t2/activities/dataflow/servicedescriptions/DataflowTemplateService.java
deleted file mode 100644
index b981816..0000000
--- a/taverna-dataflow-activity-ui/src/main/java/net/sf/taverna/t2/activities/dataflow/servicedescriptions/DataflowTemplateService.java
+++ /dev/null
@@ -1,54 +0,0 @@
-package net.sf.taverna.t2.activities.dataflow.servicedescriptions;
-
-import java.net.URI;
-
-import javax.swing.Icon;
-
-import net.sf.taverna.t2.servicedescriptions.AbstractTemplateService;
-import net.sf.taverna.t2.servicedescriptions.ServiceDescription;
-import org.apache.taverna.scufl2.api.configurations.Configuration;
-
-public class DataflowTemplateService extends AbstractTemplateService {
-
-	public static final URI ACTIVITY_TYPE = URI.create("http://ns.taverna.org.uk/2010/activity/nested-workflow");
-
-	private static final String A_CONFIGURABLE_NESTED_WORKFLOW = "A service that allows you to have one workflow nested within another";
-	private static final String DATAFLOW = "Nested workflow";
-
-	private static final URI providerId = URI.create("http://taverna.sf.net/2010/service-provider/dataflow");
-
-	@Override
-	public URI getActivityType() {
-		return ACTIVITY_TYPE;
-	}
-
-	@Override
-	public Configuration getActivityConfiguration() {
-		Configuration configuration = new Configuration();
-		configuration.setType(ACTIVITY_TYPE.resolve("#Config"));
-		return configuration;
-	}
-
-	@Override
-	public Icon getIcon() {
-		return DataflowActivityIcon.getDataflowIcon();
-	}
-
-	public String getName() {
-		return DATAFLOW;
-	}
-
-	public String getDescription() {
-		return A_CONFIGURABLE_NESTED_WORKFLOW;
-	}
-
-	public static ServiceDescription getServiceDescription() {
-		DataflowTemplateService dts = new DataflowTemplateService();
-		return dts.templateService;
-	}
-
-	public String getId() {
-		return providerId.toString();
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-dataflow-activity-ui/src/main/java/net/sf/taverna/t2/activities/dataflow/views/DataflowActivityContextualView.java
----------------------------------------------------------------------
diff --git a/taverna-dataflow-activity-ui/src/main/java/net/sf/taverna/t2/activities/dataflow/views/DataflowActivityContextualView.java b/taverna-dataflow-activity-ui/src/main/java/net/sf/taverna/t2/activities/dataflow/views/DataflowActivityContextualView.java
deleted file mode 100644
index a92ea36..0000000
--- a/taverna-dataflow-activity-ui/src/main/java/net/sf/taverna/t2/activities/dataflow/views/DataflowActivityContextualView.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*******************************************************************************
- * 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.activities.dataflow.views;
-
-import java.awt.BorderLayout;
-import java.awt.FlowLayout;
-import java.awt.Frame;
-
-import javax.swing.Action;
-import javax.swing.JButton;
-import javax.swing.JComponent;
-import javax.swing.JPanel;
-
-import net.sf.taverna.t2.activities.dataflow.actions.EditNestedDataflowAction;
-import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionRegistry;
-import net.sf.taverna.t2.ui.menu.MenuManager;
-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.file.FileManager;
-import net.sf.taverna.t2.workbench.file.importworkflow.actions.ReplaceNestedWorkflowAction;
-import net.sf.taverna.t2.workbench.selection.SelectionManager;
-import net.sf.taverna.t2.workbench.ui.actions.activity.HTMLBasedActivityContextualView;
-
-import org.apache.log4j.Logger;
-
-import org.apache.taverna.scufl2.api.activity.Activity;
-
-@SuppressWarnings("serial")
-public class DataflowActivityContextualView extends HTMLBasedActivityContextualView {
-
-	static Logger logger = Logger.getLogger(DataflowActivityContextualView.class);
-
-	private final EditManager editManager;
-	private final FileManager fileManager;
-	private final MenuManager menuManager;
-	private final ActivityIconManager activityIconManager;
-	private final ColourManager colourManager;
-	private final WorkbenchConfiguration workbenchConfiguration;
-	private final ServiceDescriptionRegistry serviceDescriptionRegistry;
-
-	private final SelectionManager selectionManager;
-
-	public DataflowActivityContextualView(Activity activity, EditManager editManager,
-			FileManager fileManager, MenuManager menuManager,
-			ActivityIconManager activityIconManager, ColourManager colourManager,
-			ServiceDescriptionRegistry serviceDescriptionRegistry,
-			WorkbenchConfiguration workbenchConfiguration, SelectionManager selectionManager) {
-		super(activity, colourManager);
-		this.editManager = editManager;
-		this.fileManager = fileManager;
-		this.menuManager = menuManager;
-		this.activityIconManager = activityIconManager;
-		this.colourManager = colourManager;
-		this.serviceDescriptionRegistry = serviceDescriptionRegistry;
-		this.workbenchConfiguration = workbenchConfiguration;
-		this.selectionManager = selectionManager;
-		addEditButtons();
-	}
-
-	@Override
-	public Activity getActivity() {
-		return super.getActivity();
-	}
-
-	public void addEditButtons() {
-		JComponent mainFrame = getMainFrame();
-		JButton viewWorkflowButton = new JButton("Edit workflow");
-		viewWorkflowButton.addActionListener(new EditNestedDataflowAction(getActivity(),
-				selectionManager));
-		JButton configureButton = new JButton(new ReplaceNestedWorkflowAction(getActivity(),
-				editManager, fileManager, menuManager, activityIconManager, colourManager,
-				serviceDescriptionRegistry, workbenchConfiguration, selectionManager));
-		configureButton.setIcon(null);
-		JPanel flowPanel = new JPanel(new FlowLayout());
-		flowPanel.add(viewWorkflowButton);
-		flowPanel.add(configureButton);
-		mainFrame.add(flowPanel, BorderLayout.SOUTH);
-		mainFrame.revalidate();
-	}
-
-//	@Override
-//	public JComponent getMainFrame() {
-//		JComponent mainFrame = super.getMainFrame();
-//		JButton viewWorkflowButton = new JButton("Edit workflow");
-//		viewWorkflowButton.addActionListener(new EditNestedDataflowAction(getActivity(),
-//				selectionManager));
-//		JButton configureButton = new JButton(new ReplaceNestedWorkflowAction(getActivity(),
-//				editManager, fileManager, menuManager, activityIconManager, colourManager,
-//				serviceDescriptionRegistry, workbenchConfiguration, selectionManager));
-//		configureButton.setIcon(null);
-//		JPanel flowPanel = new JPanel(new FlowLayout());
-//		flowPanel.add(viewWorkflowButton);
-//		flowPanel.add(configureButton);
-//		mainFrame.add(flowPanel, BorderLayout.SOUTH);
-//		return mainFrame;
-//	}
-
-	@Override
-	protected String getRawTableRowsHtml() {
-		return ("<tr><td colspan=2>" + getActivity().getName() + "</td></tr>");
-	}
-
-	@Override
-	public String getViewTitle() {
-		return "Nested workflow";
-	}
-
-	@Override
-	public Action getConfigureAction(Frame owner) {
-		return null;
-		// return new OpenNestedDataflowFromFileAction(
-		// (DataflowActivity) getActivity(), owner);
-	}
-
-	@Override
-	public int getPreferredPosition() {
-		return 100;
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-dataflow-activity-ui/src/main/java/net/sf/taverna/t2/activities/dataflow/views/DataflowActivityViewFactory.java
----------------------------------------------------------------------
diff --git a/taverna-dataflow-activity-ui/src/main/java/net/sf/taverna/t2/activities/dataflow/views/DataflowActivityViewFactory.java b/taverna-dataflow-activity-ui/src/main/java/net/sf/taverna/t2/activities/dataflow/views/DataflowActivityViewFactory.java
deleted file mode 100644
index 955c88a..0000000
--- a/taverna-dataflow-activity-ui/src/main/java/net/sf/taverna/t2/activities/dataflow/views/DataflowActivityViewFactory.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*******************************************************************************
- * 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.activities.dataflow.views;
-
-import java.util.Arrays;
-import java.util.List;
-
-import net.sf.taverna.t2.activities.dataflow.servicedescriptions.DataflowTemplateService;
-import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionRegistry;
-import net.sf.taverna.t2.ui.menu.MenuManager;
-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.file.FileManager;
-import net.sf.taverna.t2.workbench.selection.SelectionManager;
-import net.sf.taverna.t2.workbench.ui.views.contextualviews.ContextualView;
-import net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory;
-import org.apache.taverna.scufl2.api.activity.Activity;
-
-public class DataflowActivityViewFactory implements ContextualViewFactory<Activity> {
-
-	private EditManager editManager;
-	private FileManager fileManager;
-	private MenuManager menuManager;
-	private ColourManager colourManager;
-	private ActivityIconManager activityIconManager;
-	private WorkbenchConfiguration workbenchConfiguration;
-	private ServiceDescriptionRegistry serviceDescriptionRegistry;
-	private SelectionManager selectionManager;
-
-	public boolean canHandle(Object object) {
-		return object instanceof Activity
-				&& ((Activity) object).getType().equals(DataflowTemplateService.ACTIVITY_TYPE);
-	}
-
-	public List<ContextualView> getViews(Activity activity) {
-		return Arrays.asList(new ContextualView[] { new DataflowActivityContextualView(activity,
-				editManager, fileManager, menuManager, activityIconManager, colourManager,
-				serviceDescriptionRegistry, workbenchConfiguration, selectionManager) });
-	}
-
-	public void setEditManager(EditManager editManager) {
-		this.editManager = editManager;
-	}
-
-	public void setFileManager(FileManager fileManager) {
-		this.fileManager = fileManager;
-	}
-
-	public void setMenuManager(MenuManager menuManager) {
-		this.menuManager = menuManager;
-	}
-
-	public void setActivityIconManager(ActivityIconManager activityIconManager) {
-		this.activityIconManager = activityIconManager;
-	}
-
-	public void setColourManager(ColourManager colourManager) {
-		this.colourManager = colourManager;
-	}
-
-	public void setServiceDescriptionRegistry(ServiceDescriptionRegistry serviceDescriptionRegistry) {
-		this.serviceDescriptionRegistry = serviceDescriptionRegistry;
-	}
-
-	public void setWorkbenchConfiguration(WorkbenchConfiguration workbenchConfiguration) {
-		this.workbenchConfiguration = workbenchConfiguration;
-	}
-
-	public void setSelectionManager(SelectionManager selectionManager) {
-		this.selectionManager = selectionManager;
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-dataflow-activity-ui/src/main/java/net/sf/taverna/t2/workbench/file/importworkflow/DataflowMerger.java
----------------------------------------------------------------------
diff --git a/taverna-dataflow-activity-ui/src/main/java/net/sf/taverna/t2/workbench/file/importworkflow/DataflowMerger.java b/taverna-dataflow-activity-ui/src/main/java/net/sf/taverna/t2/workbench/file/importworkflow/DataflowMerger.java
deleted file mode 100644
index f090e50..0000000
--- a/taverna-dataflow-activity-ui/src/main/java/net/sf/taverna/t2/workbench/file/importworkflow/DataflowMerger.java
+++ /dev/null
@@ -1,124 +0,0 @@
-package net.sf.taverna.t2.workbench.file.importworkflow;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import net.sf.taverna.t2.workbench.edits.CompoundEdit;
-import net.sf.taverna.t2.workbench.edits.Edit;
-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 net.sf.taverna.t2.workflow.edits.AddWorkflowInputPortEdit;
-import net.sf.taverna.t2.workflow.edits.AddWorkflowOutputPortEdit;
-import org.apache.taverna.scufl2.api.common.AbstractCloneable;
-import org.apache.taverna.scufl2.api.container.WorkflowBundle;
-import org.apache.taverna.scufl2.api.core.ControlLink;
-import org.apache.taverna.scufl2.api.core.DataLink;
-import org.apache.taverna.scufl2.api.core.Processor;
-import org.apache.taverna.scufl2.api.core.Workflow;
-import org.apache.taverna.scufl2.api.port.InputWorkflowPort;
-import org.apache.taverna.scufl2.api.port.OutputWorkflowPort;
-
-/**
- * A tool that allows merging of two workflow.
- * <p>
- * The merge is performed as a series of edit, inserting a copy of the source
- * workflow into the destination workflow.
- *
- * @author Stian Soiland-Reyes
- * @author David Withers
- */
-public class DataflowMerger {
-
-	/**
-	 * Make a copy of a workflow.
-	 *
-	 * @param source
-	 *            workflow to copy
-	 * @return A copy of the workflow.
-	 */
-	public static Workflow copyWorkflow(Workflow source) {
-		WorkflowBundle workflowBundle = AbstractCloneable.cloneWorkflowBean(source.getParent());
-		return workflowBundle.getWorkflows().getByName(source.getName());
-	}
-
-	private final Workflow destinationWorkflow;
-
-	/**
-	 * Construct a {@link DataflowMerger} for the given destination workflow.
-	 *
-	 * @param destinationWorkflow
-	 *            Workflow to be merged into
-	 */
-	public DataflowMerger(Workflow destinationWorkflow) {
-		this.destinationWorkflow = destinationWorkflow;
-	}
-
-	/**
-	 * Make an {@link Edit} that when performed merges the given source dataflow
-	 * into the destination dataflow.
-	 * <p>
-	 * Internally a copy is made of the source dataflow, to avoid modifying the
-	 * links and processors.
-	 *
-	 * @param sourceDataflow
-	 *            Dataflow to merge from
-	 * @return An edit that can perform and undo the insertion of the components
-	 *         from the source dataflow.
-	 * @throws MergeException
-	 *             If the merge cannot be performed.
-	 */
-	public CompoundEdit getMergeEdit(Workflow sourceDataflow)
-			throws MergeException {
-		return getMergeEdit(sourceDataflow, "");
-	}
-
-	/**
-	 * Make an {@link Edit} that when performed merges the given source dataflow
-	 * into the destination dataflow.
-	 * <p>
-	 * Internally a copy is made of the source dataflow, to avoid modifying the
-	 * links and processors.
-	 *
-	 * @param sourceWorkflow
-	 *            Dataflow to merge from
-	 * @param prefix
-	 *            A prefix which will be inserted in front of the names for the
-	 *            merged workflow components.
-	 * @return An edit that can perform and undo the insertion of the components
-	 *         from the source dataflow.
-	 * @throws MergeException
-	 *             If the merge cannot be performed.
-	 */
-	public CompoundEdit getMergeEdit(Workflow sourceWorkflow, String prefix)
-			throws MergeException {
-		List<Edit<?>> compoundEdit = new ArrayList<>();
-
-		Workflow workflow = copyWorkflow(sourceWorkflow);
-
-		for (InputWorkflowPort input : workflow.getInputPorts()) {
-			destinationWorkflow.getInputPorts().addWithUniqueName(input);
-			destinationWorkflow.getInputPorts().remove(input);
-			compoundEdit.add(new AddWorkflowInputPortEdit(destinationWorkflow, input));
-		}
-		for (OutputWorkflowPort output : workflow.getOutputPorts()) {
-			destinationWorkflow.getOutputPorts().addWithUniqueName(output);
-			destinationWorkflow.getOutputPorts().remove(output);
-			compoundEdit.add(new AddWorkflowOutputPortEdit(destinationWorkflow, output));
-		}
-		for (Processor processor : workflow.getProcessors()) {
-			processor.setName(prefix + processor.getName());
-			compoundEdit.add(new AddProcessorEdit(destinationWorkflow, processor));
-		}
-		for (DataLink dataLink : workflow.getDataLinks()) {
-			compoundEdit.add(new AddDataLinkEdit(destinationWorkflow, dataLink));
-		}
-		for (ControlLink controlLink : workflow.getControlLinks()) {
-			compoundEdit.add(new AddChildEdit<Workflow>(destinationWorkflow, controlLink));
-		}
-
-		return new CompoundEdit(compoundEdit);
-
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-dataflow-activity-ui/src/main/java/net/sf/taverna/t2/workbench/file/importworkflow/MergeException.java
----------------------------------------------------------------------
diff --git a/taverna-dataflow-activity-ui/src/main/java/net/sf/taverna/t2/workbench/file/importworkflow/MergeException.java b/taverna-dataflow-activity-ui/src/main/java/net/sf/taverna/t2/workbench/file/importworkflow/MergeException.java
deleted file mode 100644
index 3645f91..0000000
--- a/taverna-dataflow-activity-ui/src/main/java/net/sf/taverna/t2/workbench/file/importworkflow/MergeException.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package net.sf.taverna.t2.workbench.file.importworkflow;
-
-public class MergeException extends Exception {
-	private static final long serialVersionUID = 6018700359518335402L;
-
-	public MergeException() {
-		super();
-	}
-
-	public MergeException(String message, Throwable cause) {
-		super(message, cause);
-	}
-
-	public MergeException(String message) {
-		super(message);
-	}
-
-	public MergeException(Throwable cause) {
-		super(cause);
-	}
-	
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-dataflow-activity-ui/src/main/java/net/sf/taverna/t2/workbench/file/importworkflow/actions/AddNestedWorkflowAction.java
----------------------------------------------------------------------
diff --git a/taverna-dataflow-activity-ui/src/main/java/net/sf/taverna/t2/workbench/file/importworkflow/actions/AddNestedWorkflowAction.java b/taverna-dataflow-activity-ui/src/main/java/net/sf/taverna/t2/workbench/file/importworkflow/actions/AddNestedWorkflowAction.java
deleted file mode 100644
index d6f04dd..0000000
--- a/taverna-dataflow-activity-ui/src/main/java/net/sf/taverna/t2/workbench/file/importworkflow/actions/AddNestedWorkflowAction.java
+++ /dev/null
@@ -1,59 +0,0 @@
-package net.sf.taverna.t2.workbench.file.importworkflow.actions;
-
-import java.awt.Component;
-import java.awt.event.ActionEvent;
-
-import javax.swing.AbstractAction;
-
-import net.sf.taverna.t2.activities.dataflow.servicedescriptions.DataflowActivityIcon;
-import net.sf.taverna.t2.ui.menu.MenuManager;
-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.file.FileManager;
-import net.sf.taverna.t2.workbench.file.importworkflow.gui.ImportWorkflowWizard;
-import net.sf.taverna.t2.workbench.selection.SelectionManager;
-import net.sf.taverna.t2.workbench.ui.Utils;
-
-/**
- * An action for adding a nested workflow.
- *
- * @author Stian Soiland-Reyes
- *
- */
-public class AddNestedWorkflowAction extends AbstractAction {
-	private static final long serialVersionUID = -2242979457902699028L;
-	private final EditManager editManager;
-	private final FileManager fileManager;
-	private final MenuManager menuManager;
-	private final ColourManager colourManager;
-	private final WorkbenchConfiguration workbenchConfiguration;
-	private final SelectionManager selectionManager;
-
-	public AddNestedWorkflowAction(EditManager editManager, FileManager fileManager,
-			MenuManager menuManager, ColourManager colourManager,
-			WorkbenchConfiguration workbenchConfiguration, SelectionManager selectionManager) {
-		super("Add nested workflow", DataflowActivityIcon.getDataflowIcon());
-		this.editManager = editManager;
-		this.fileManager = fileManager;
-		this.menuManager = menuManager;
-		this.colourManager = colourManager;
-		this.workbenchConfiguration = workbenchConfiguration;
-		this.selectionManager = selectionManager;
-	}
-
-	public void actionPerformed(ActionEvent e) {
-		final Component parentComponent;
-		if (e.getSource() instanceof Component) {
-			parentComponent = (Component) e.getSource();
-		} else {
-			parentComponent = null;
-		}
-		ImportWorkflowWizard wizard = new ImportWorkflowWizard(
-				Utils.getParentFrame(parentComponent), editManager, fileManager, menuManager,
-				colourManager, workbenchConfiguration, selectionManager);
-		wizard.setMergeEnabled(false);
-		wizard.setVisible(true);
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-dataflow-activity-ui/src/main/java/net/sf/taverna/t2/workbench/file/importworkflow/actions/ImportWorkflowAction.java
----------------------------------------------------------------------
diff --git a/taverna-dataflow-activity-ui/src/main/java/net/sf/taverna/t2/workbench/file/importworkflow/actions/ImportWorkflowAction.java b/taverna-dataflow-activity-ui/src/main/java/net/sf/taverna/t2/workbench/file/importworkflow/actions/ImportWorkflowAction.java
deleted file mode 100644
index 6d9fffb..0000000
--- a/taverna-dataflow-activity-ui/src/main/java/net/sf/taverna/t2/workbench/file/importworkflow/actions/ImportWorkflowAction.java
+++ /dev/null
@@ -1,59 +0,0 @@
-package net.sf.taverna.t2.workbench.file.importworkflow.actions;
-
-import java.awt.Component;
-import java.awt.event.ActionEvent;
-
-import javax.swing.AbstractAction;
-
-import net.sf.taverna.t2.activities.dataflow.servicedescriptions.DataflowActivityIcon;
-import net.sf.taverna.t2.ui.menu.MenuManager;
-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.file.FileManager;
-import net.sf.taverna.t2.workbench.file.importworkflow.gui.ImportWorkflowWizard;
-import net.sf.taverna.t2.workbench.selection.SelectionManager;
-import net.sf.taverna.t2.workbench.ui.Utils;
-
-/**
- * A general version of {@link AddNestedWorkflowAction} and {@link MergeWorkflowAction} that allows
- * the user to choose which action to perform.
- *
- * @author Stian Soiland-Reyes
- *
- */
-public class ImportWorkflowAction extends AbstractAction {
-	private static final long serialVersionUID = -2242979457902699028L;
-	private final EditManager editManager;
-	private final FileManager fileManager;
-	private final MenuManager menuManager;
-	private final ColourManager colourManager;
-	private final WorkbenchConfiguration workbenchConfiguration;
-	private final SelectionManager selectionManager;
-
-	public ImportWorkflowAction(EditManager editManager, FileManager fileManager,
-			MenuManager menuManager, ColourManager colourManager,
-			WorkbenchConfiguration workbenchConfiguration, SelectionManager selectionManager) {
-		super("Import workflow", DataflowActivityIcon.getDataflowIcon());
-		this.editManager = editManager;
-		this.fileManager = fileManager;
-		this.menuManager = menuManager;
-		this.colourManager = colourManager;
-		this.workbenchConfiguration = workbenchConfiguration;
-		this.selectionManager = selectionManager;
-	}
-
-	public void actionPerformed(ActionEvent e) {
-		final Component parentComponent;
-		if (e.getSource() instanceof Component) {
-			parentComponent = (Component) e.getSource();
-		} else {
-			parentComponent = null;
-		}
-		ImportWorkflowWizard wizard = new ImportWorkflowWizard(
-				Utils.getParentFrame(parentComponent), editManager, fileManager, menuManager,
-				colourManager, workbenchConfiguration, selectionManager);
-		wizard.setVisible(true);
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-dataflow-activity-ui/src/main/java/net/sf/taverna/t2/workbench/file/importworkflow/actions/MergeWorkflowAction.java
----------------------------------------------------------------------
diff --git a/taverna-dataflow-activity-ui/src/main/java/net/sf/taverna/t2/workbench/file/importworkflow/actions/MergeWorkflowAction.java b/taverna-dataflow-activity-ui/src/main/java/net/sf/taverna/t2/workbench/file/importworkflow/actions/MergeWorkflowAction.java
deleted file mode 100644
index d86f97c..0000000
--- a/taverna-dataflow-activity-ui/src/main/java/net/sf/taverna/t2/workbench/file/importworkflow/actions/MergeWorkflowAction.java
+++ /dev/null
@@ -1,58 +0,0 @@
-package net.sf.taverna.t2.workbench.file.importworkflow.actions;
-
-import java.awt.Component;
-import java.awt.event.ActionEvent;
-
-import javax.swing.AbstractAction;
-
-import net.sf.taverna.t2.ui.menu.MenuManager;
-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.file.FileManager;
-import net.sf.taverna.t2.workbench.file.importworkflow.gui.ImportWorkflowWizard;
-import net.sf.taverna.t2.workbench.selection.SelectionManager;
-import net.sf.taverna.t2.workbench.ui.Utils;
-
-/**
- * An action for merging two workflows
- *
- * @author Stian Soiland-Reyes
- *
- */
-public class MergeWorkflowAction extends AbstractAction {
-	private static final long serialVersionUID = -2242979457902699028L;
-	private final EditManager editManager;
-	private final FileManager fileManager;
-	private final MenuManager menuManager;
-	private final ColourManager colourManager;
-	private final WorkbenchConfiguration workbenchConfiguration;
-	private final SelectionManager selectionManager;
-
-	public MergeWorkflowAction(EditManager editManager, FileManager fileManager,
-			MenuManager menuManager, ColourManager colourManager,
-			WorkbenchConfiguration workbenchConfiguration, SelectionManager selectionManager) {
-		super("Merge workflow");
-		this.editManager = editManager;
-		this.fileManager = fileManager;
-		this.menuManager = menuManager;
-		this.colourManager = colourManager;
-		this.workbenchConfiguration = workbenchConfiguration;
-		this.selectionManager = selectionManager;
-	}
-
-	public void actionPerformed(ActionEvent e) {
-		final Component parentComponent;
-		if (e.getSource() instanceof Component) {
-			parentComponent = (Component) e.getSource();
-		} else {
-			parentComponent = null;
-		}
-		ImportWorkflowWizard wizard = new ImportWorkflowWizard(
-				Utils.getParentFrame(parentComponent), editManager, fileManager, menuManager,
-				colourManager, workbenchConfiguration, selectionManager);
-		wizard.setNestedEnabled(false);
-		wizard.setVisible(true);
-	}
-
-}


[42/51] [partial] incubator-taverna-workbench git commit: all packages are moved to org.apache.taverna.*

Posted by re...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-configuration-impl/src/test/java/net/sf/taverna/t2/workbench/ui/impl/configuration/ConfigurationManagerTest.java
----------------------------------------------------------------------
diff --git a/taverna-configuration-impl/src/test/java/net/sf/taverna/t2/workbench/ui/impl/configuration/ConfigurationManagerTest.java b/taverna-configuration-impl/src/test/java/net/sf/taverna/t2/workbench/ui/impl/configuration/ConfigurationManagerTest.java
deleted file mode 100644
index 1202c11..0000000
--- a/taverna-configuration-impl/src/test/java/net/sf/taverna/t2/workbench/ui/impl/configuration/ConfigurationManagerTest.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*******************************************************************************
- * 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.configuration;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-import java.io.File;
-import java.util.UUID;
-
-import net.sf.taverna.t2.workbench.configuration.colour.ColourManager;
-import net.sf.taverna.t2.workbench.ui.impl.configuration.colour.ColourManagerImpl;
-
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Test;
-
-import uk.org.taverna.configuration.app.impl.ApplicationConfigurationImpl;
-import uk.org.taverna.configuration.impl.ConfigurationManagerImpl;
-
-public class ConfigurationManagerTest {
-
-	ConfigurationManagerImpl configurationManager;
-
-	@Before
-	public void setup() {
-		configurationManager = new ConfigurationManagerImpl(new ApplicationConfigurationImpl());
-	}
-
-	@Test
-	public void createConfigManager() {
-		assertNotNull("Config Manager should not be null", configurationManager);
-	}
-
-	@Ignore("Hardcoded /Users/Ian") //FIXME: update test to work using File.createTempFile(...)
-	@Test
-	public void populateConfigOfColourmanager() {
-		ColourManager manager= new ColourManagerImpl(null);
-
-		manager.setProperty("colour.first", "25");
-		manager.setProperty("colour.second", "223");
-
-		configurationManager.setBaseConfigLocation(new File("/Users/Ian/scratch"));
-		try {
-			configurationManager.store(manager);
-		} catch (Exception e1) {
-			e1.printStackTrace();
-		}
-
-		ColourManager manager2 = new ColourManagerImpl(configurationManager);
-
-		try {
-			configurationManager.populate(manager2);
-		} catch (Exception e) {
-			e.printStackTrace();
-		}
-
-
-		assertEquals("Properties do not match", manager2.getProperty("colour.first"), manager.getProperty("colour.first"));
-		assertEquals("Properties do not match", manager2.getProperty("colour.second"), manager.getProperty("colour.second"));
-
-
-	}
-
-	@Test
-	public void saveColoursForDummyColourable() {
-		String dummy = "";
-		ColourManager manager=new ColourManagerImpl(configurationManager);
-		manager.setProperty(dummy.getClass().getCanonicalName(), "#000000");
-
-		File f = new File(System.getProperty("java.io.tmpdir"));
-		File d = new File(f, UUID.randomUUID().toString());
-		d.mkdir();
-		configurationManager.setBaseConfigLocation(d);
-		try {
-			configurationManager.store(manager);
-		} catch (Exception e1) {
-			e1.printStackTrace();
-		}
-
-		try {
-			configurationManager.populate(manager);
-		} catch (Exception e) {
-			// TODO Auto-generated catch block
-			e.printStackTrace();
-		}
-
-
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-configuration-impl/src/test/java/net/sf/taverna/t2/workbench/ui/impl/configuration/colour/ColourManagerTest.java
----------------------------------------------------------------------
diff --git a/taverna-configuration-impl/src/test/java/net/sf/taverna/t2/workbench/ui/impl/configuration/colour/ColourManagerTest.java b/taverna-configuration-impl/src/test/java/net/sf/taverna/t2/workbench/ui/impl/configuration/colour/ColourManagerTest.java
deleted file mode 100644
index 0239ea8..0000000
--- a/taverna-configuration-impl/src/test/java/net/sf/taverna/t2/workbench/ui/impl/configuration/colour/ColourManagerTest.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*******************************************************************************
- * 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.configuration.colour;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import java.awt.Color;
-import java.io.File;
-import java.util.UUID;
-
-import net.sf.taverna.t2.workbench.configuration.colour.ColourManager;
-
-import org.junit.Before;
-import org.junit.Test;
-
-import uk.org.taverna.configuration.Configurable;
-import uk.org.taverna.configuration.app.impl.ApplicationConfigurationImpl;
-import uk.org.taverna.configuration.impl.ConfigurationManagerImpl;
-
-public class ColourManagerTest {
-
-	private ConfigurationManagerImpl configurationManager;
-
-	@Before
-	public void setup() {
-		configurationManager = new ConfigurationManagerImpl(new ApplicationConfigurationImpl());
-
-		File f = new File(System.getProperty("java.io.tmpdir"));
-		File d = new File(f, UUID.randomUUID().toString());
-		d.mkdir();
-		configurationManager.setBaseConfigLocation(d);
-	}
-
-	@Test
-	public void testGetPreferredColourEqualsWhite() throws Exception {
-		String dummy = new String();
-
-		Color c = new ColourManagerImpl(configurationManager).getPreferredColour(dummy);
-		assertEquals("The default colour should be WHITE", Color.WHITE, c);
-	}
-
-	@Test
-	public void testConfigurableness() throws Exception {
-		ColourManager manager = new ColourManagerImpl(configurationManager);
-		assertTrue(manager instanceof Configurable);
-
-		assertEquals("wrong category", "colour", manager.getCategory());
-		assertEquals("wrong name", "Colour Management", manager.getDisplayName());
-		assertEquals("wrong UUID", "a2148420-5967-11dd-ae16-0800200c9a66",
-				manager.getUUID());
-		assertNotNull("there is no default property map", manager
-				.getDefaultPropertyMap());
-	}
-
-	@Test
-	public void saveAsWrongArrayType() throws Exception {
-		String dummy = "";
-		ColourManager manager = new ColourManagerImpl(configurationManager);
-		manager.setProperty(dummy.getClass().getCanonicalName(), "#ffffff");
-
-		File baseLoc = File.createTempFile("test", "scratch");
-		baseLoc.delete();
-		assertTrue("Could not make directory " + baseLoc, baseLoc.mkdir());
-		configurationManager.setBaseConfigLocation(baseLoc);
-		configurationManager.store(manager);
-		configurationManager.populate(manager);
-		manager.getPreferredColour(dummy);
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-configuration-impl/src/test/java/org/apache/taverna/workbench/ui/impl/configuration/ConfigurationManagerTest.java
----------------------------------------------------------------------
diff --git a/taverna-configuration-impl/src/test/java/org/apache/taverna/workbench/ui/impl/configuration/ConfigurationManagerTest.java b/taverna-configuration-impl/src/test/java/org/apache/taverna/workbench/ui/impl/configuration/ConfigurationManagerTest.java
new file mode 100644
index 0000000..08a4fcc
--- /dev/null
+++ b/taverna-configuration-impl/src/test/java/org/apache/taverna/workbench/ui/impl/configuration/ConfigurationManagerTest.java
@@ -0,0 +1,108 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.impl.configuration;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import java.io.File;
+import java.util.UUID;
+
+import org.apache.taverna.workbench.configuration.colour.ColourManager;
+import org.apache.taverna.workbench.ui.impl.configuration.colour.ColourManagerImpl;
+
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+
+import uk.org.taverna.configuration.app.impl.ApplicationConfigurationImpl;
+import uk.org.taverna.configuration.impl.ConfigurationManagerImpl;
+
+public class ConfigurationManagerTest {
+
+	ConfigurationManagerImpl configurationManager;
+
+	@Before
+	public void setup() {
+		configurationManager = new ConfigurationManagerImpl(new ApplicationConfigurationImpl());
+	}
+
+	@Test
+	public void createConfigManager() {
+		assertNotNull("Config Manager should not be null", configurationManager);
+	}
+
+	@Ignore("Hardcoded /Users/Ian") //FIXME: update test to work using File.createTempFile(...)
+	@Test
+	public void populateConfigOfColourmanager() {
+		ColourManager manager= new ColourManagerImpl(null);
+
+		manager.setProperty("colour.first", "25");
+		manager.setProperty("colour.second", "223");
+
+		configurationManager.setBaseConfigLocation(new File("/Users/Ian/scratch"));
+		try {
+			configurationManager.store(manager);
+		} catch (Exception e1) {
+			e1.printStackTrace();
+		}
+
+		ColourManager manager2 = new ColourManagerImpl(configurationManager);
+
+		try {
+			configurationManager.populate(manager2);
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+
+
+		assertEquals("Properties do not match", manager2.getProperty("colour.first"), manager.getProperty("colour.first"));
+		assertEquals("Properties do not match", manager2.getProperty("colour.second"), manager.getProperty("colour.second"));
+
+
+	}
+
+	@Test
+	public void saveColoursForDummyColourable() {
+		String dummy = "";
+		ColourManager manager=new ColourManagerImpl(configurationManager);
+		manager.setProperty(dummy.getClass().getCanonicalName(), "#000000");
+
+		File f = new File(System.getProperty("java.io.tmpdir"));
+		File d = new File(f, UUID.randomUUID().toString());
+		d.mkdir();
+		configurationManager.setBaseConfigLocation(d);
+		try {
+			configurationManager.store(manager);
+		} catch (Exception e1) {
+			e1.printStackTrace();
+		}
+
+		try {
+			configurationManager.populate(manager);
+		} catch (Exception e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+
+
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-configuration-impl/src/test/java/org/apache/taverna/workbench/ui/impl/configuration/colour/ColourManagerTest.java
----------------------------------------------------------------------
diff --git a/taverna-configuration-impl/src/test/java/org/apache/taverna/workbench/ui/impl/configuration/colour/ColourManagerTest.java b/taverna-configuration-impl/src/test/java/org/apache/taverna/workbench/ui/impl/configuration/colour/ColourManagerTest.java
new file mode 100644
index 0000000..b664a04
--- /dev/null
+++ b/taverna-configuration-impl/src/test/java/org/apache/taverna/workbench/ui/impl/configuration/colour/ColourManagerTest.java
@@ -0,0 +1,89 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.impl.configuration.colour;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.awt.Color;
+import java.io.File;
+import java.util.UUID;
+
+import org.apache.taverna.workbench.configuration.colour.ColourManager;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import uk.org.taverna.configuration.Configurable;
+import uk.org.taverna.configuration.app.impl.ApplicationConfigurationImpl;
+import uk.org.taverna.configuration.impl.ConfigurationManagerImpl;
+
+public class ColourManagerTest {
+
+	private ConfigurationManagerImpl configurationManager;
+
+	@Before
+	public void setup() {
+		configurationManager = new ConfigurationManagerImpl(new ApplicationConfigurationImpl());
+
+		File f = new File(System.getProperty("java.io.tmpdir"));
+		File d = new File(f, UUID.randomUUID().toString());
+		d.mkdir();
+		configurationManager.setBaseConfigLocation(d);
+	}
+
+	@Test
+	public void testGetPreferredColourEqualsWhite() throws Exception {
+		String dummy = new String();
+
+		Color c = new ColourManagerImpl(configurationManager).getPreferredColour(dummy);
+		assertEquals("The default colour should be WHITE", Color.WHITE, c);
+	}
+
+	@Test
+	public void testConfigurableness() throws Exception {
+		ColourManager manager = new ColourManagerImpl(configurationManager);
+		assertTrue(manager instanceof Configurable);
+
+		assertEquals("wrong category", "colour", manager.getCategory());
+		assertEquals("wrong name", "Colour Management", manager.getDisplayName());
+		assertEquals("wrong UUID", "a2148420-5967-11dd-ae16-0800200c9a66",
+				manager.getUUID());
+		assertNotNull("there is no default property map", manager
+				.getDefaultPropertyMap());
+	}
+
+	@Test
+	public void saveAsWrongArrayType() throws Exception {
+		String dummy = "";
+		ColourManager manager = new ColourManagerImpl(configurationManager);
+		manager.setProperty(dummy.getClass().getCanonicalName(), "#ffffff");
+
+		File baseLoc = File.createTempFile("test", "scratch");
+		baseLoc.delete();
+		assertTrue("Could not make directory " + baseLoc, baseLoc.mkdir());
+		configurationManager.setBaseConfigLocation(baseLoc);
+		configurationManager.store(manager);
+		configurationManager.populate(manager);
+		manager.getPreferredColour(dummy);
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-contextual-views-api/src/main/java/net/sf/taverna/t2/workbench/ui/actions/activity/ActivityConfigurationAction.java
----------------------------------------------------------------------
diff --git a/taverna-contextual-views-api/src/main/java/net/sf/taverna/t2/workbench/ui/actions/activity/ActivityConfigurationAction.java b/taverna-contextual-views-api/src/main/java/net/sf/taverna/t2/workbench/ui/actions/activity/ActivityConfigurationAction.java
deleted file mode 100644
index a6da26d..0000000
--- a/taverna-contextual-views-api/src/main/java/net/sf/taverna/t2/workbench/ui/actions/activity/ActivityConfigurationAction.java
+++ /dev/null
@@ -1,167 +0,0 @@
-/*******************************************************************************
- * 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.actions.activity;
-
-import java.util.List;
-import java.util.WeakHashMap;
-
-import javax.swing.AbstractAction;
-import javax.swing.JDialog;
-
-import org.apache.taverna.lang.observer.Observable;
-import org.apache.taverna.lang.observer.Observer;
-import net.sf.taverna.t2.servicedescriptions.ServiceDescription;
-import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionRegistry;
-import net.sf.taverna.t2.workbench.activityicons.ActivityIconManager;
-import net.sf.taverna.t2.workbench.file.FileManager;
-import net.sf.taverna.t2.workbench.file.events.ClosingDataflowEvent;
-import net.sf.taverna.t2.workbench.file.events.FileManagerEvent;
-import net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ActivityConfigurationDialog;
-import org.apache.taverna.scufl2.api.activity.Activity;
-import org.apache.taverna.scufl2.api.common.Scufl2Tools;
-import org.apache.taverna.scufl2.api.container.WorkflowBundle;
-import org.apache.taverna.scufl2.api.core.Processor;
-import org.apache.taverna.scufl2.api.core.Workflow;
-import org.apache.taverna.scufl2.api.profiles.ProcessorBinding;
-import org.apache.taverna.scufl2.api.profiles.Profile;
-
-@SuppressWarnings("serial")
-public abstract class ActivityConfigurationAction extends AbstractAction {
-	private static WeakHashMap<Activity, ActivityConfigurationDialog> configurationDialogs = new WeakHashMap<>();
-	private static DataflowCloseListener listener;
-
-	protected Activity activity;
-	private final ServiceDescriptionRegistry serviceDescriptionRegistry;
-
-	public ActivityConfigurationAction(Activity activity,
-			ActivityIconManager activityIconManager,
-			ServiceDescriptionRegistry serviceDescriptionRegistry) {
-		this.activity = activity;
-		this.serviceDescriptionRegistry = serviceDescriptionRegistry;
-		putValue(SMALL_ICON,
-				activityIconManager.iconForActivity(activity.getType()));
-	}
-
-	protected Activity getActivity() {
-		return activity;
-	}
-
-	protected ServiceDescription getServiceDescription() {
-		return serviceDescriptionRegistry.getServiceDescription(activity
-				.getType());
-	}
-
-	protected static void setDialog(Activity activity,
-			ActivityConfigurationDialog dialog, FileManager fileManager) {
-		if (listener == null) {
-			listener = new DataflowCloseListener();
-			/*
-			 * Ensure that the DataflowCloseListener is the first notified
-			 * listener. Otherwise you cannot save the configurations.
-			 */
-			List<Observer<FileManagerEvent>> existingListeners = fileManager
-					.getObservers();
-			fileManager.addObserver(listener);
-			for (Observer<FileManagerEvent> observer : existingListeners)
-				if (!observer.equals(listener)) {
-					fileManager.removeObserver(observer);
-					fileManager.addObserver(observer);
-				}
-		}
-		if (configurationDialogs.containsKey(activity)) {
-			ActivityConfigurationDialog currentDialog = configurationDialogs
-					.get(activity);
-			if (!currentDialog.equals(dialog) && currentDialog.isVisible())
-				currentDialog.setVisible(false);
-		}
-		configurationDialogs.put(activity, dialog);
-		dialog.setVisible(true);
-	}
-
-	public static void clearDialog(Activity activity) {
-		if (configurationDialogs.containsKey(activity)) {
-			ActivityConfigurationDialog currentDialog = configurationDialogs
-					.get(activity);
-			if (currentDialog.isVisible())
-				currentDialog.setVisible(false);
-			configurationDialogs.remove(activity);
-			currentDialog.dispose();
-		}
-	}
-
-	protected static void clearDialog(JDialog dialog) {
-		if (configurationDialogs.containsValue(dialog)) {
-			if (dialog.isVisible())
-				dialog.setVisible(false);
-			for (Activity activity : configurationDialogs.keySet())
-				if (configurationDialogs.get(activity).equals(dialog))
-					configurationDialogs.remove(activity);
-			dialog.dispose();
-		}
-	}
-
-	public static boolean closeDialog(Activity activity) {
-		boolean closeIt = true;
-		if (configurationDialogs.containsKey(activity)) {
-			ActivityConfigurationDialog currentDialog = configurationDialogs
-					.get(activity);
-			if (currentDialog.isVisible())
-				closeIt = currentDialog.closeDialog();
-			if (closeIt)
-				configurationDialogs.remove(activity);
-		}
-		return closeIt;
-	}
-
-	public static ActivityConfigurationDialog getDialog(Activity activity) {
-		return configurationDialogs.get(activity);
-	}
-
-	private static class DataflowCloseListener implements
-			Observer<FileManagerEvent> {
-		private Scufl2Tools scufl2Tools = new Scufl2Tools();
-
-		@Override
-		public void notify(Observable<FileManagerEvent> sender,
-				FileManagerEvent message) throws Exception {
-			if (message instanceof ClosingDataflowEvent) {
-				ClosingDataflowEvent closingDataflowEvent = (ClosingDataflowEvent) message;
-				if (closingDataflowEvent.isAbortClose())
-					return;
-				closingDataflow(closingDataflowEvent,
-						((ClosingDataflowEvent) message).getDataflow());
-			}
-		}
-
-		private void closingDataflow(ClosingDataflowEvent event,
-				WorkflowBundle bundle) {
-			Profile profile = bundle.getMainProfile();
-			for (Workflow workflow : bundle.getWorkflows())
-				for (Processor p : workflow.getProcessors()) {
-					ProcessorBinding processorBinding = scufl2Tools
-							.processorBindingForProcessor(p, profile);
-					Activity activity = processorBinding.getBoundActivity();
-					if (!closeDialog(activity))
-						event.setAbortClose(true);
-				}
-		}
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-contextual-views-api/src/main/java/net/sf/taverna/t2/workbench/ui/actions/activity/ActivityContextualView.java
----------------------------------------------------------------------
diff --git a/taverna-contextual-views-api/src/main/java/net/sf/taverna/t2/workbench/ui/actions/activity/ActivityContextualView.java b/taverna-contextual-views-api/src/main/java/net/sf/taverna/t2/workbench/ui/actions/activity/ActivityContextualView.java
deleted file mode 100644
index 85ddfd9..0000000
--- a/taverna-contextual-views-api/src/main/java/net/sf/taverna/t2/workbench/ui/actions/activity/ActivityContextualView.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*******************************************************************************
- * 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.actions.activity;
-
-import net.sf.taverna.t2.workbench.ui.views.contextualviews.ContextualView;
-import org.apache.taverna.scufl2.api.activity.Activity;
-import org.apache.taverna.scufl2.api.common.Scufl2Tools;
-import org.apache.taverna.scufl2.api.configurations.Configuration;
-
-/**
- * A contextual view specific to an Activity. Concrete subclasses must
- * initialise the view by calling {@link #initView()}.
- * <p>
- * The implementation provides a view based upon the properties set in the
- * Configuration
- * 
- * @author Stuart Owen
- * @author Ian Dunlop
- * 
- * @see Activity
- * @see ContextualView
- */
-@SuppressWarnings("serial")
-public abstract class ActivityContextualView extends ContextualView {
-	private Activity activity;
-	private Scufl2Tools scufl2Tools = new Scufl2Tools();
-
-	/**
-	 * Constructs an instance of the view.
-	 * <p>
-	 * The constructor parameter for the implementation of this class should
-	 * define the specific Activity type itself.
-	 * 
-	 * @param activity
-	 */
-	protected ActivityContextualView(Activity activity) {
-		super();
-		this.activity = activity;
-	}
-
-	public Activity getActivity() {
-		return activity;
-	}
-
-	public Configuration getConfigBean() {
-		return scufl2Tools.configurationFor(activity, activity.getParent());
-	}
-
-	@Override
-	public abstract void refreshView();
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-contextual-views-api/src/main/java/net/sf/taverna/t2/workbench/ui/actions/activity/HTMLBasedActivityContextualView.java
----------------------------------------------------------------------
diff --git a/taverna-contextual-views-api/src/main/java/net/sf/taverna/t2/workbench/ui/actions/activity/HTMLBasedActivityContextualView.java b/taverna-contextual-views-api/src/main/java/net/sf/taverna/t2/workbench/ui/actions/activity/HTMLBasedActivityContextualView.java
deleted file mode 100644
index b9385cb..0000000
--- a/taverna-contextual-views-api/src/main/java/net/sf/taverna/t2/workbench/ui/actions/activity/HTMLBasedActivityContextualView.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*******************************************************************************
- * 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.actions.activity;
-
-import static net.sf.taverna.t2.lang.ui.HtmlUtils.buildTableOpeningTag;
-import static net.sf.taverna.t2.lang.ui.HtmlUtils.createEditorPane;
-import static net.sf.taverna.t2.lang.ui.HtmlUtils.getHtmlHead;
-import static net.sf.taverna.t2.lang.ui.HtmlUtils.panelForHtml;
-
-import javax.swing.JComponent;
-import javax.swing.JEditorPane;
-
-import net.sf.taverna.t2.workbench.configuration.colour.ColourManager;
-import org.apache.taverna.scufl2.api.activity.Activity;
-
-@SuppressWarnings("serial")
-public abstract class HTMLBasedActivityContextualView extends ActivityContextualView {
-	private static final String BEANSHELL_URI = "http://ns.taverna.org.uk/2010/activity/beanshell";
-	private static final String LOCALWORKER_URI = "http://ns.taverna.org.uk/2010/activity/localworker";
-	private JEditorPane editorPane;
-	private final ColourManager colourManager;
-
-	public HTMLBasedActivityContextualView(Activity activity, ColourManager colourManager) {
-		super(activity);
-		this.colourManager = colourManager;
-		initView();
-	}
-
-	@Override
-	public JComponent getMainFrame() {
-		editorPane = createEditorPane(buildHtml());
-		return panelForHtml(editorPane);
-	}
-
-	private String buildHtml() {
-		StringBuilder html = new StringBuilder(getHtmlHead(getBackgroundColour()));
-		html.append(buildTableOpeningTag());
-		html.append("<tr><th colspan=\"2\">").append(getViewTitle()).append("</th></tr>");
-		html.append(getRawTableRowsHtml()).append("</table>");
-		html.append("</body></html>");
-		return html.toString();
-	}
-
-	protected abstract String getRawTableRowsHtml();
-
-	public String getBackgroundColour() {
-		String activityType = getActivity().getType().toString();
-		if (LOCALWORKER_URI.equals(activityType))
-			if (getConfigBean().getJson().get("isAltered").booleanValue())
-				return (String) colourManager.getProperty(BEANSHELL_URI);
-		String colour = (String) colourManager.getProperty(activityType);
-		return colour == null ? "#ffffff" : colour;
-	}
-
-	/**
-	 * Update the html view with the latest information in the configuration
-	 * bean
-	 */
-	@Override
-	public void refreshView() {
-		editorPane.setText(buildHtml());
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-contextual-views-api/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/AddLayerFactorySPI.java
----------------------------------------------------------------------
diff --git a/taverna-contextual-views-api/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/AddLayerFactorySPI.java b/taverna-contextual-views-api/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/AddLayerFactorySPI.java
deleted file mode 100644
index 7e5fd04..0000000
--- a/taverna-contextual-views-api/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/AddLayerFactorySPI.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************
- * 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.ui.views.contextualviews;
-
-import java.net.URI;
-
-import javax.swing.Action;
-
-import org.apache.taverna.scufl2.api.core.Processor;
-
-/**
- * SPI for adding dispatch stack layers to a processor, such as
- * {@link net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Loop}.
- * <p>
- * Buttons or similar will be added in the processor contextual view.
- * 
- * @author Stian Soiland-Reyes
- */
-public interface AddLayerFactorySPI {
-	boolean canAddLayerFor(Processor proc);
-
-	Action getAddLayerActionFor(Processor proc);
-
-	boolean canCreateLayerClass(URI dispatchLayerType);
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-contextual-views-api/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/ContextualView.java
----------------------------------------------------------------------
diff --git a/taverna-contextual-views-api/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/ContextualView.java b/taverna-contextual-views-api/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/ContextualView.java
deleted file mode 100644
index 45efaab..0000000
--- a/taverna-contextual-views-api/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/ContextualView.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*******************************************************************************
- * 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.views.contextualviews;
-
-import static java.awt.BorderLayout.CENTER;
-
-import java.awt.BorderLayout;
-import java.awt.Frame;
-
-import javax.swing.Action;
-import javax.swing.JComponent;
-import javax.swing.JPanel;
-
-/**
- * An abstract class defining the base container to hold a contextual view over
- * Dataflow element.
- * <p>
- * The specific implementation of this class to support a given dataflow element
- * needs to implement the {@link #getMainFrame()} and {@link #getViewTitle()}.
- * <p>
- * If a view is associated with an action handler to configure this component,
- * then the {@link #getConfigureAction(Frame) getConfigureAction} handler must
- * be over-ridden. If this returns null then the configure button is left
- * disabled and it is not possible to configure the element.
- * 
- * @author Stuart Owen
- * @author Ian Dunlop
- * @author Alan R Williams
- */
-@SuppressWarnings("serial")
-public abstract class ContextualView extends JPanel {
-	/**
-	 * When implemented, this method should define the main frame that is placed
-	 * in this container, and provides a static view of the Dataflow element.
-	 * 
-	 * @return a JComponent that represents the dataflow element.
-	 */
-	public abstract JComponent getMainFrame();
-
-	/**
-	 * @return a String providing a title for the view
-	 */
-	public abstract String getViewTitle();
-
-	/**
-	 * Allows the item to be configured, but returning an action handler that
-	 * will be invoked when selecting to configure. By default this is provided
-	 * by a button.
-	 * <p>
-	 * If there is no ability to configure the given item, then this should
-	 * return null.
-	 * 
-	 * @param owner
-	 *            the owning dialog to be used when displaying dialogues for
-	 *            configuration options
-	 * @return an action that allows the element being viewed to be configured.
-	 */
-	public Action getConfigureAction(Frame owner) {
-		return null;
-	}
-
-	/**
-	 * This <i>must</i> be called by any sub-classes after they have initialised
-	 * their own view since it gets their main panel and adds it to the main
-	 * contextual view. If you don't do this you will get a very empty frame
-	 * popping up!
-	 */
-	public void initView() {
-		setLayout(new BorderLayout());
-		add(getMainFrame(), CENTER);
-		setName(getViewTitle());
-	}
-
-	public abstract void refreshView();
-
-	public abstract int getPreferredPosition();
-
-	public static String getTextFromDepth(String kind, Integer depth) {
-		String labelText = "The last prediction said the " + kind;
-		if (depth == null) {
-			labelText += " would not transmit a value";
-		} else if (depth == -1) {
-			labelText += " was invalid/unpredicted";
-		} else if (depth == 0) {
-			labelText += " would carry a single value";
-		} else {
-			labelText += " would carry a list of depth " + depth;
-		}
-		return labelText;
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-contextual-views-api/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/activity/ActivityConfigurationDialog.java
----------------------------------------------------------------------
diff --git a/taverna-contextual-views-api/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/activity/ActivityConfigurationDialog.java b/taverna-contextual-views-api/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/activity/ActivityConfigurationDialog.java
deleted file mode 100644
index decea0f..0000000
--- a/taverna-contextual-views-api/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/activity/ActivityConfigurationDialog.java
+++ /dev/null
@@ -1,474 +0,0 @@
-package net.sf.taverna.t2.workbench.ui.views.contextualviews.activity;
-
-import static java.awt.BorderLayout.SOUTH;
-import static java.awt.Cursor.DEFAULT_CURSOR;
-import static java.awt.Cursor.WAIT_CURSOR;
-import static java.awt.Cursor.getPredefinedCursor;
-import static java.lang.Math.max;
-import static javax.swing.JOptionPane.CANCEL_OPTION;
-import static javax.swing.JOptionPane.NO_OPTION;
-import static javax.swing.JOptionPane.YES_NO_CANCEL_OPTION;
-import static javax.swing.JOptionPane.YES_NO_OPTION;
-import static javax.swing.JOptionPane.YES_OPTION;
-import static javax.swing.JOptionPane.showConfirmDialog;
-import static net.sf.taverna.t2.workbench.MainWindow.getMainWindow;
-import static net.sf.taverna.t2.workbench.helper.Helper.showHelp;
-import static net.sf.taverna.t2.workbench.ui.actions.activity.ActivityConfigurationAction.clearDialog;
-
-import java.awt.BorderLayout;
-import java.awt.Dimension;
-import java.awt.FlowLayout;
-import java.awt.event.ActionEvent;
-import java.awt.event.ComponentAdapter;
-import java.awt.event.ComponentEvent;
-import java.awt.event.WindowAdapter;
-import java.awt.event.WindowEvent;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import javax.swing.AbstractAction;
-import javax.swing.JButton;
-import javax.swing.JPanel;
-import javax.swing.border.EmptyBorder;
-
-import org.apache.taverna.lang.observer.Observable;
-import org.apache.taverna.lang.observer.Observer;
-import net.sf.taverna.t2.lang.ui.DeselectingButton;
-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.edits.EditManager.DataFlowRedoEvent;
-import net.sf.taverna.t2.workbench.edits.EditManager.DataFlowUndoEvent;
-import net.sf.taverna.t2.workbench.edits.EditManager.EditManagerEvent;
-import net.sf.taverna.t2.workbench.helper.HelpEnabledDialog;
-import net.sf.taverna.t2.workflow.edits.AddChildEdit;
-import net.sf.taverna.t2.workflow.edits.AddProcessorInputPortEdit;
-import net.sf.taverna.t2.workflow.edits.AddProcessorOutputPortEdit;
-import net.sf.taverna.t2.workflow.edits.ChangeDepthEdit;
-import net.sf.taverna.t2.workflow.edits.ChangeGranularDepthEdit;
-import net.sf.taverna.t2.workflow.edits.ChangeJsonEdit;
-import net.sf.taverna.t2.workflow.edits.RemoveChildEdit;
-import net.sf.taverna.t2.workflow.edits.RemoveProcessorInputPortEdit;
-import net.sf.taverna.t2.workflow.edits.RemoveProcessorOutputPortEdit;
-import net.sf.taverna.t2.workflow.edits.RenameEdit;
-
-import org.apache.log4j.Logger;
-
-import org.apache.taverna.scufl2.api.activity.Activity;
-import org.apache.taverna.scufl2.api.common.Scufl2Tools;
-import org.apache.taverna.scufl2.api.configurations.Configuration;
-import org.apache.taverna.scufl2.api.container.WorkflowBundle;
-import org.apache.taverna.scufl2.api.core.Processor;
-import org.apache.taverna.scufl2.api.core.Workflow;
-import org.apache.taverna.scufl2.api.port.ActivityPort;
-import org.apache.taverna.scufl2.api.port.InputActivityPort;
-import org.apache.taverna.scufl2.api.port.InputProcessorPort;
-import org.apache.taverna.scufl2.api.port.OutputActivityPort;
-import org.apache.taverna.scufl2.api.port.OutputProcessorPort;
-import org.apache.taverna.scufl2.api.profiles.ProcessorBinding;
-import org.apache.taverna.scufl2.api.profiles.ProcessorInputPortBinding;
-import org.apache.taverna.scufl2.api.profiles.ProcessorOutputPortBinding;
-import org.apache.taverna.scufl2.api.profiles.Profile;
-
-import com.fasterxml.jackson.databind.node.ObjectNode;
-
-@SuppressWarnings("serial")
-public class ActivityConfigurationDialog extends HelpEnabledDialog {
-	private enum PortType {
-		INPUT, OUTPUT
-	}
-	
-	protected static Logger logger = Logger.getLogger(ActivityConfigurationDialog.class);
-	private static final Scufl2Tools scufl2Tools = new Scufl2Tools();
-
-	private final EditManager editManager;
-
-	private Activity activity;
-	private ActivityConfigurationPanel panel;
-	protected WorkflowBundle owningWorkflowBundle;
-	protected Processor owningProcessor;
-	private Observer<EditManagerEvent> observer;
-	Dimension minimalSize = null;
-	Dimension buttonPanelSize = null;
-	JPanel buttonPanel;
-	protected JButton applyButton;
-
-	public ActivityConfigurationDialog(Activity a, ActivityConfigurationPanel p,
-			EditManager editManager) {
-		super(getMainWindow(), "Configuring " + a.getClass().getSimpleName(),
-				false, null);
-		this.activity = a;
-		this.panel = p;
-		this.editManager = editManager;
-
-		owningWorkflowBundle = activity.getParent().getParent();
-		owningProcessor = findProcessor(a);
-
-		setTitle(getRelativeName(owningWorkflowBundle, activity));
-		setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
-		setLayout(new BorderLayout());
-
-		add(panel, BorderLayout.CENTER);
-
-		buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
-		buttonPanel.setBorder(new EmptyBorder(5, 20, 5, 5));
-
-		JButton helpButton = new DeselectingButton("Help", new AbstractAction() {
-			@Override
-			public void actionPerformed(ActionEvent e) {
-				showHelp(panel);
-			}
-		});
-		buttonPanel.add(helpButton);
-
-		applyButton = new DeselectingButton("Apply", new AbstractAction() {
-			@Override
-			public void actionPerformed(ActionEvent e) {
-				/*
-				 * For the moment it always does an apply as what should be
-				 * happening is that the apply button only becomes available
-				 * when the configuration has changed. However, many
-				 * configuration panels are not set up to detected changes
-				 */
-				// if (panel.isConfigurationChanged()) {
-				if (checkPanelValues())
-					applyConfiguration();
-				// } else {
-				// logger.info("Ignoring apply");
-				// }
-			}
-		});
-		buttonPanel.add(applyButton);
-
-		JButton closeButton = new DeselectingButton("Close", new AbstractAction() {
-			@Override
-			public void actionPerformed(ActionEvent e) {
-				closeDialog();
-			}
-		});
-		buttonPanel.add(closeButton);
-
-		add(buttonPanel, SOUTH);
-
-		this.addWindowListener(new WindowAdapter() {
-			@Override
-			public void windowOpened(WindowEvent e) {
-				requestFocusInWindow();
-				panel.whenOpened();
-			}
-
-			@Override
-			public void windowClosing(WindowEvent e) {
-				closeDialog();
-			}
-		});
-		pack();
-		minimalSize = getSize();
-		setLocationRelativeTo(null);
-		setResizable(true);
-		addComponentListener(new ComponentAdapter() {
-			@Override
-			public void componentResized(ComponentEvent e) {
-				int newWidth = max(getWidth(), minimalSize.width);
-				int newHeight = max(getHeight(), minimalSize.height);
-				setSize(new Dimension(newWidth, newHeight));
-			}
-		});
-
-		observer = new Observer<EditManagerEvent>() {
-			@Override
-			public void notify(Observable<EditManagerEvent> sender, EditManagerEvent message)
-					throws Exception {
-				logger.info("sender is a " + sender.getClass().getCanonicalName());
-				logger.info("message is a " + message.getClass().getCanonicalName());
-				Edit<?> edit = message.getEdit();
-				logger.info(edit.getClass().getCanonicalName());
-				considerEdit(message, edit);
-			}
-		};
-		editManager.addObserver(observer);
-	}
-
-	private boolean checkPanelValues() {
-		boolean result = false;
-		try {
-			setCursor(getPredefinedCursor(WAIT_CURSOR));
-			result = panel.checkValues();
-		} finally {
-			setCursor(getPredefinedCursor(DEFAULT_CURSOR));
-		}
-		return result;
-	}
-
-	private void considerEdit(EditManagerEvent message, Edit<?> edit) {
-		// boolean result = false;
-		if (edit instanceof CompoundEdit) {
-			for (Edit<?> subEdit : ((CompoundEdit) edit).getChildEdits())
-				considerEdit(message, subEdit);
-			return;
-		}
-
-		Object subject = edit.getSubject();
-		if (subject == owningProcessor) {
-			// panel.reevaluate();
-			setTitle(getRelativeName(owningWorkflowBundle, activity));
-		} else if (subject == owningWorkflowBundle) {
-			for (Workflow workflow : owningWorkflowBundle.getWorkflows())
-				if (!workflow.getProcessors().contains(owningProcessor))
-					clearDialog(activity);
-		} else if (subject == activity) {
-			if (message instanceof DataFlowUndoEvent) {
-				logger.info("undo of activity edit found");
-				panel.refreshConfiguration();
-			} else if (message instanceof DataFlowRedoEvent) {
-				logger.info("redo of activity edit found");
-				panel.refreshConfiguration();
-			}
-		}
-	}
-
-	protected void configureActivity(ObjectNode json, List<ActivityPortConfiguration> inputPorts,
-			List<ActivityPortConfiguration> outputPorts) {
-		configureActivity(owningWorkflowBundle, activity, json, inputPorts, outputPorts);
-	}
-
-	public void configureActivity(WorkflowBundle workflowBundle, Activity activity,
-			ObjectNode json, List<ActivityPortConfiguration> inputPorts,
-			List<ActivityPortConfiguration> outputPorts) {
-		try {
-			List<Edit<?>> editList = new ArrayList<Edit<?>>();
-			Profile profile = activity.getParent();
-			List<ProcessorBinding> processorBindings = scufl2Tools
-					.processorBindingsToActivity(activity);
-			Configuration configuration = scufl2Tools.configurationFor(activity, profile);
-			editList.add(new ChangeJsonEdit(configuration, json));
-
-			configurePorts(activity, editList, processorBindings, inputPorts, PortType.INPUT);
-			configurePorts(activity, editList, processorBindings, outputPorts, PortType.OUTPUT);
-			editManager.doDataflowEdit(workflowBundle, new CompoundEdit(editList));
-		} catch (IllegalStateException | EditException e) {
-			logger.error(e);
-		}
-	}
-
-	private void configurePorts(Activity activity, List<Edit<?>> editList,
-			List<ProcessorBinding> processorBindings,
-			List<ActivityPortConfiguration> portDefinitions, PortType portType) {
-		Set<ActivityPort> ports = new HashSet<>();
-		for (ActivityPort activityPort : portType == PortType.INPUT ? activity
-				.getInputPorts() : activity.getOutputPorts())
-			ports.add(activityPort);
-		for (ActivityPortConfiguration portDefinition : portDefinitions) {
-			String portName = portDefinition.getName();
-			int portDepth = portDefinition.getDepth();
-			int granularPortDepth = portDefinition.getGranularDepth();
-			ActivityPort activityPort = portDefinition.getActivityPort();
-			if (activityPort == null) {
-				// no activity port so add a new one
-				if (portType == PortType.INPUT)
-					createInputPort(activity, editList, processorBindings, portDefinition);
-				else
-					createOutputPort(activity, editList, processorBindings, portDefinition);
-			} else {
-				ports.remove(activityPort);
-				// check if port has changed
-				for (ProcessorBinding processorBinding : processorBindings)
-					if (portType == PortType.INPUT)
-						for (ProcessorInputPortBinding portBinding : processorBinding
-								.getInputPortBindings()) {
-							if (!portBinding.getBoundActivityPort().equals(
-									activityPort))
-								continue;
-							InputProcessorPort processorPort = portBinding
-									.getBoundProcessorPort();
-							if (!activityPort.getName().equals(portName))
-								// port name changed
-								if (processorPort.getName().equals(activityPort.getName()))
-									// default mapping so change processor port
-									editList.add(new RenameEdit<>(processorPort, portName));
-							if (!processorPort.getDepth().equals(portDepth))
-								// port depth changed
-								editList.add(new ChangeDepthEdit<>(
-										processorPort, portDepth));
-						}
-					else
-						for (ProcessorOutputPortBinding portBinding : processorBinding
-								.getOutputPortBindings()) {
-							if (!portBinding.getBoundActivityPort().equals(
-									activityPort))
-								continue;
-							OutputProcessorPort processorPort = portBinding
-									.getBoundProcessorPort();
-							if (!activityPort.getName().equals(portName))
-								// port name changed
-								if (processorPort.getName().equals(
-										activityPort.getName()))
-									// default mapping so change processor port
-									editList.add(new RenameEdit<>(
-											processorPort, portName));
-							if (!processorPort.getDepth().equals(portDepth))
-								// port depth changed
-								editList.add(new ChangeDepthEdit<>(
-										processorPort, portDepth));
-							if (!processorPort.getGranularDepth().equals(
-									granularPortDepth))
-								// port granular depth changed
-								editList.add(new ChangeGranularDepthEdit<>(
-										processorPort, granularPortDepth));
-						}
-				if (!activityPort.getName().equals(portName))
-					// port name changed
-					editList.add(new RenameEdit<>(activityPort, portName));
-				if (!activityPort.getDepth().equals(portDepth))
-					// port depth changed
-					editList.add(new ChangeDepthEdit<>(activityPort, portDepth));
-				if (activityPort instanceof OutputActivityPort) {
-					OutputActivityPort outputActivityPort = (OutputActivityPort) activityPort;
-					Integer granularDepth = outputActivityPort
-							.getGranularDepth();
-					if (granularDepth == null
-							|| !granularDepth.equals(granularPortDepth))
-						// granular port depth changed
-						editList.add(new ChangeGranularDepthEdit<>(
-								outputActivityPort, granularPortDepth));
-				}
-			}
-		}
-
-		// remove any unconfigured ports
-		for (ActivityPort activityPort : ports) {
-			// remove processor ports and bindings
-			for (ProcessorBinding processorBinding : processorBindings)
-				if (portType.equals(PortType.INPUT))
-					for (ProcessorInputPortBinding portBinding : processorBinding
-							.getInputPortBindings()) {
-						if (portBinding.getBoundActivityPort().equals(activityPort)) {
-							editList.add(new RemoveProcessorInputPortEdit(processorBinding
-									.getBoundProcessor(), portBinding.getBoundProcessorPort()));
-							editList.add(new RemoveChildEdit<>(processorBinding,
-									portBinding));
-						}
-					}
-				else
-					for (ProcessorOutputPortBinding portBinding : processorBinding
-							.getOutputPortBindings())
-						if (portBinding.getBoundActivityPort().equals(activityPort)) {
-							editList.add(new RemoveProcessorOutputPortEdit(processorBinding
-									.getBoundProcessor(), portBinding.getBoundProcessorPort()));
-							editList.add(new RemoveChildEdit<>(processorBinding,
-									portBinding));
-						}
-			// remove activity port
-			editList.add(new RemoveChildEdit<Activity>(activity, activityPort));
-		}
-	}
-
-	private void createInputPort(Activity activity, List<Edit<?>> editList,
-			List<ProcessorBinding> processorBindings,
-			ActivityPortConfiguration portDefinition) {
-		InputActivityPort actPort = new InputActivityPort(null,
-				portDefinition.getName());
-		actPort.setDepth(portDefinition.getDepth());
-		// add port to activity
-		editList.add(new AddChildEdit<>(activity, actPort));
-		for (ProcessorBinding processorBinding : processorBindings) {
-			Processor processor = processorBinding.getBoundProcessor();
-			// add a new processor port
-			InputProcessorPort procPort = new InputProcessorPort();
-			procPort.setName(portDefinition.getName());
-			procPort.setDepth(portDefinition.getDepth());
-			editList.add(new AddProcessorInputPortEdit(processor, procPort));
-			// add a new port binding
-			ProcessorInputPortBinding binding = new ProcessorInputPortBinding();
-			binding.setBoundProcessorPort(procPort);
-			binding.setBoundActivityPort(actPort);
-			editList.add(new AddChildEdit<>(processorBinding, binding));
-		}
-	}
-
-	private void createOutputPort(Activity activity, List<Edit<?>> editList,
-			List<ProcessorBinding> processorBindings,
-			ActivityPortConfiguration portDefinition) {
-		OutputActivityPort actPort = new OutputActivityPort(null,
-				portDefinition.getName());
-		actPort.setDepth(portDefinition.getDepth());
-		actPort.setGranularDepth(portDefinition.getGranularDepth());
-		// add port to activity
-		editList.add(new AddChildEdit<Activity>(activity, actPort));
-		for (ProcessorBinding processorBinding : processorBindings) {
-			Processor processor = processorBinding.getBoundProcessor();
-			// add a new processor port
-			OutputProcessorPort procPort = new OutputProcessorPort();
-			procPort.setName(portDefinition.getName());
-			procPort.setDepth(portDefinition.getDepth());
-			procPort.setGranularDepth(portDefinition.getGranularDepth());
-			editList.add(new AddProcessorOutputPortEdit(processor, procPort));
-			// add a new port binding
-			ProcessorOutputPortBinding binding = new ProcessorOutputPortBinding();
-			binding.setBoundProcessorPort(procPort);
-			binding.setBoundActivityPort(actPort);
-			editList.add(new AddChildEdit<>(processorBinding, binding));
-		}
-	}
-
-	protected static Processor findProcessor(Activity activity) {
-		for (ProcessorBinding processorBinding : scufl2Tools
-				.processorBindingsToActivity(activity))
-			return processorBinding.getBoundProcessor();
-		return null;
-	}
-
-	public static String getRelativeName(WorkflowBundle workflowBundle, Activity activity) {
-		StringBuilder relativeName = new StringBuilder("");
-		if (workflowBundle != null) {
-			Workflow workflow = workflowBundle.getMainWorkflow();
-			if (workflow != null) {
-				relativeName.append(workflow.getName());
-				relativeName.append(":");
-			}
-		}
-		Processor processor = findProcessor(activity);
-		if (processor != null)
-			relativeName.append(processor.getName());
-		return relativeName.toString();
-	}
-
-	public boolean closeDialog() {
-		if (panel.isConfigurationChanged()) {
-			String relativeName = getRelativeName(owningWorkflowBundle, activity);
-			if (checkPanelValues()) {
-				int answer = showConfirmDialog(this,
-						"Do you want to save the configuration of " + relativeName + "?",
-						relativeName, YES_NO_CANCEL_OPTION);
-				if (answer == YES_OPTION) {
-					applyConfiguration();
-				} else if (answer == CANCEL_OPTION) {
-					return false;
-				}
-			} else if (showConfirmDialog(
-					this,
-					"New configuration could not be saved. Do you still want to close?",
-					relativeName, YES_NO_OPTION) == NO_OPTION)
-				return false;
-		}
-		panel.whenClosed();
-		clearDialog(activity);
-		return true;
-	}
-
-	private void applyConfiguration() {
-		panel.noteConfiguration();
-		configureActivity(panel.getJson(), panel.getInputPorts(),
-				panel.getOutputPorts());
-		panel.refreshConfiguration();
-	}
-
-	@Override
-	public void dispose() {
-		super.dispose();
-		editManager.removeObserver(observer);
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-contextual-views-api/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/activity/ActivityConfigurationPanel.java
----------------------------------------------------------------------
diff --git a/taverna-contextual-views-api/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/activity/ActivityConfigurationPanel.java b/taverna-contextual-views-api/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/activity/ActivityConfigurationPanel.java
deleted file mode 100644
index 38d19a2..0000000
--- a/taverna-contextual-views-api/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/activity/ActivityConfigurationPanel.java
+++ /dev/null
@@ -1,214 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.workbench.ui.views.contextualviews.activity;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.swing.JPanel;
-
-import org.apache.log4j.Logger;
-
-import org.apache.taverna.commons.services.ActivityTypeNotFoundException;
-import org.apache.taverna.commons.services.InvalidConfigurationException;
-import org.apache.taverna.commons.services.ServiceRegistry;
-import org.apache.taverna.scufl2.api.activity.Activity;
-import org.apache.taverna.scufl2.api.common.Scufl2Tools;
-import org.apache.taverna.scufl2.api.configurations.Configuration;
-import org.apache.taverna.scufl2.api.port.ActivityPort;
-import org.apache.taverna.scufl2.api.port.InputActivityPort;
-import org.apache.taverna.scufl2.api.port.OutputActivityPort;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.node.ObjectNode;
-
-/**
- * @author alanrw
- */
-@SuppressWarnings("serial")
-public abstract class ActivityConfigurationPanel extends JPanel {
-	private static final Logger logger = Logger.getLogger(ActivityConfigurationPanel.class);
-	private final static Scufl2Tools scufl2Tools = new Scufl2Tools();
-
-	// protected final URITools uriTools = new URITools();
-	private final Activity activity;
-	private final Configuration configuration;
-	private final List<ActivityPortConfiguration> inputPorts;
-	private final List<ActivityPortConfiguration> outputPorts;
-	protected ObjectNode json;
-
-	public ActivityConfigurationPanel(Activity activity) {
-		this(activity, scufl2Tools.configurationFor(activity,
-				activity.getParent()));
-	}
-
-	public ActivityConfigurationPanel(Activity activity,
-			Configuration configuration) {
-		this.activity = activity;
-		this.configuration = configuration;
-		inputPorts = new ArrayList<>();
-		outputPorts = new ArrayList<>();
-	}
-
-	/**
-	 * Initializes the configuration panel. This method is also used to discard
-	 * any changes and reset the panel to its initial state. Subclasses should
-	 * implement this method to set up the panel and must call
-	 * <tt>super.initialise()</tt> first.
-	 */
-	protected void initialise() {
-		json = configuration.getJson().deepCopy();
-		inputPorts.clear();
-		for (InputActivityPort activityPort : activity.getInputPorts())
-			inputPorts.add(new ActivityPortConfiguration(activityPort));
-		outputPorts.clear();
-		for (OutputActivityPort activityPort : activity.getOutputPorts())
-			outputPorts.add(new ActivityPortConfiguration(activityPort));
-	}
-
-	public abstract boolean checkValues();
-
-	public abstract void noteConfiguration();
-
-	public boolean isConfigurationChanged() {
-		noteConfiguration();
-		if (portsChanged(inputPorts, activity.getInputPorts().size()))
-			return true;
-		if (portsChanged(outputPorts, activity.getOutputPorts().size()))
-			return true;
-		return !json.equals(configuration.getJson());
-	}
-
-	public Configuration getConfiguration() {
-		return configuration;
-	}
-
-	public ObjectNode getJson() {
-		return json;
-	}
-
-	protected void setJson(ObjectNode json) {
-		this.json = json;
-	}
-
-	public void refreshConfiguration() {
-		initialise();
-	}
-
-	public void whenOpened() {
-	}
-
-	public void whenClosed() {
-	}
-
-	/**
-	 * Convenience method for getting simple String property values.
-	 *
-	 * @param name
-	 *            the property name
-	 * @return the property value
-	 */
-	protected String getProperty(String name) {
-		JsonNode jsonNode = json.get(name);
-		if (jsonNode == null)
-			return null;
-		return json.get(name).asText();
-	}
-
-	/**
-	 * Convenience method for setting simple String property values.
-	 *
-	 * @param name
-	 *            the property name
-	 * @param value
-	 *            the property value
-	 */
-	protected void setProperty(String name, String value) {
-		json.put(name, value);
-	}
-
-	public List<ActivityPortConfiguration> getInputPorts() {
-		return inputPorts;
-	}
-
-	public List<ActivityPortConfiguration> getOutputPorts() {
-		return outputPorts;
-	}
-
-	protected void configureInputPorts(ServiceRegistry serviceRegistry) {
-		try {
-			Map<String, InputActivityPort> newInputPorts = new HashMap<>();
-			for (InputActivityPort port : serviceRegistry
-					.getActivityInputPorts(getActivity().getType(), getJson()))
-				newInputPorts.put(port.getName(), port);
-			List<ActivityPortConfiguration> inputPorts = getInputPorts();
-			for (ActivityPortConfiguration portConfig : new ArrayList<>(
-					inputPorts))
-				if (newInputPorts.containsKey(portConfig.getName())) {
-					InputActivityPort port = newInputPorts.remove(portConfig
-							.getName());
-					portConfig.setDepth(port.getDepth());
-				} else
-					inputPorts.remove(portConfig);
-			for (InputActivityPort newPort : newInputPorts.values())
-				inputPorts.add(new ActivityPortConfiguration(newPort.getName(),
-						newPort.getDepth()));
-		} catch (InvalidConfigurationException | ActivityTypeNotFoundException e) {
-			logger.warn("Error configuring input ports", e);
-		}
-	}
-
-	protected void configureOutputPorts(ServiceRegistry serviceRegistry) {
-		try {
-			Map<String, OutputActivityPort> newOutputPorts = new HashMap<>();
-			for (OutputActivityPort port : serviceRegistry
-					.getActivityOutputPorts(getActivity().getType(), getJson()))
-				newOutputPorts.put(port.getName(), port);
-			List<ActivityPortConfiguration> outputPorts = getOutputPorts();
-			for (ActivityPortConfiguration portConfig : new ArrayList<>(
-					outputPorts))
-				if (newOutputPorts.containsKey(portConfig.getName())) {
-					OutputActivityPort port = newOutputPorts.remove(portConfig
-							.getName());
-					portConfig.setDepth(port.getDepth());
-					portConfig.setGranularDepth(port.getGranularDepth());
-				} else
-					outputPorts.remove(portConfig);
-			for (OutputActivityPort newPort : newOutputPorts.values())
-				outputPorts.add(new ActivityPortConfiguration(
-						newPort.getName(), newPort.getDepth()));
-		} catch (InvalidConfigurationException | ActivityTypeNotFoundException e) {
-			logger.warn("Error configuring output ports", e);
-		}
-	}
-
-	private boolean portsChanged(List<ActivityPortConfiguration> portDefinitions, int ports) {
-		int checkedPorts = 0;
-		for (ActivityPortConfiguration portDefinition : portDefinitions) {
-			String portName = portDefinition.getName();
-			int portDepth = portDefinition.getDepth();
-			ActivityPort activityPort = portDefinition.getActivityPort();
-			if (activityPort == null)
-				// new port added
-				return true;
-			if (!activityPort.getName().equals(portName))
-				// port name changed
-				return true;
-			if (!activityPort.getDepth().equals(portDepth))
-				// port depth changed
-				return true;
-			checkedPorts++;
-		}
-		if (checkedPorts < ports)
-			// ports deleted
-			return true;
-		return false;
-	}
-
-	public Activity getActivity() {
-		return activity;
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-contextual-views-api/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/activity/ActivityPortConfiguration.java
----------------------------------------------------------------------
diff --git a/taverna-contextual-views-api/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/activity/ActivityPortConfiguration.java b/taverna-contextual-views-api/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/activity/ActivityPortConfiguration.java
deleted file mode 100644
index 7e17ec6..0000000
--- a/taverna-contextual-views-api/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/activity/ActivityPortConfiguration.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2013 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.views.contextualviews.activity;
-
-import org.apache.taverna.scufl2.api.port.ActivityPort;
-
-/**
- *
- *
- * @author David Withers
- */
-public class ActivityPortConfiguration {
-
-	private ActivityPort activityPort;
-
-	private String name;
-
-	private int depth;
-
-	private int granularDepth;
-
-	public ActivityPortConfiguration(ActivityPort activityPort) {
-		this.activityPort = activityPort;
-		name = activityPort.getName();
-		depth = activityPort.getDepth();
-	}
-
-	public ActivityPortConfiguration(String name, int depth) {
-		this(name, depth, depth);
-	}
-
-	public ActivityPortConfiguration(String name, int depth, int granularDepth) {
-		this.name = name;
-		this.depth = depth;
-		this.granularDepth = granularDepth;
-	}
-
-	public ActivityPort getActivityPort() {
-		return activityPort;
-	}
-
-	public String getName() {
-		return name;
-	}
-
-	public void setName(String name) {
-		this.name = name;
-	}
-
-	public int getDepth() {
-		return depth;
-	}
-
-	public void setDepth(int depth) {
-		this.depth = depth;
-	}
-
-	public int getGranularDepth() {
-		return granularDepth;
-	}
-
-	public void setGranularDepth(int granularDepth) {
-		this.granularDepth = granularDepth;
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-contextual-views-api/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/activity/ContextualViewFactory.java
----------------------------------------------------------------------
diff --git a/taverna-contextual-views-api/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/activity/ContextualViewFactory.java b/taverna-contextual-views-api/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/activity/ContextualViewFactory.java
deleted file mode 100644
index b5d29d7..0000000
--- a/taverna-contextual-views-api/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/activity/ContextualViewFactory.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*******************************************************************************
- * 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.views.contextualviews.activity;
-
-import java.util.List;
-
-import net.sf.taverna.t2.workbench.ui.views.contextualviews.ContextualView;
-
-/**
- * Defines a factory class that when associated with a selected object creates a
- * {@link ContextualView} for that selection.
- * <p>
- * This factory acts as an SPI to find {@link ContextualView}s for a given
- * Activity and other workflow components.
- * </p>
- * 
- * @author Stuart Owen
- * @author Ian Dunlop
- * @author Stian Soiland-Reyes
- * 
- * 
- * @param <SelectionType>
- *            - the selection type this factory is associated with
- * 
- * @see ContextualView
- * @see ContextualViewFactoryRegistry
- */
-public interface ContextualViewFactory<SelectionType> {
-	/**
-	 * @param selection
-	 *            - the object for which ContextualViews needs to be generated
-	 * @return instance of {@link ContextualView}
-	 */
-	public List<ContextualView> getViews(SelectionType selection);
-
-	/**
-	 * Used by the SPI system to find the correct factory that can handle the
-	 * given object type. 
-	 * 
-	 * @param selection
-	 * @return true if this factory relates to the given selection type
-	 * @see ContextualViewFactoryRegistry
-	 */
-	public boolean canHandle(Object selection);
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-contextual-views-api/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/activity/ContextualViewFactoryRegistry.java
----------------------------------------------------------------------
diff --git a/taverna-contextual-views-api/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/activity/ContextualViewFactoryRegistry.java b/taverna-contextual-views-api/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/activity/ContextualViewFactoryRegistry.java
deleted file mode 100644
index 305f3c0..0000000
--- a/taverna-contextual-views-api/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/activity/ContextualViewFactoryRegistry.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2011 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.views.contextualviews.activity;
-
-import java.util.List;
-
-/**
- * A registry for discovering ActivityViewFactories for a given object,
- * like an {@link net.sf.taverna.t2.workflowmodel.processor.activity.Activity}.
- *
- * @author David Withers
- */
-public interface ContextualViewFactoryRegistry {
-	/**
-	 * Discover and return the ContextualViewFactory associated to the provided
-	 * object. This is accomplished by returning the discovered
-	 * {@link ContextualViewFactory#canHandle(Object)} that returns true for
-	 * that Object.
-	 *
-	 * @param object
-	 * @return
-	 * @see ContextualViewFactory#canHandle(Object)
-	 */
-	public <T> List<ContextualViewFactory<? super T>> getViewFactoriesForObject(T object);
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-contextual-views-api/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/activity/DependencyConfigurationPanel.java
----------------------------------------------------------------------
diff --git a/taverna-contextual-views-api/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/activity/DependencyConfigurationPanel.java b/taverna-contextual-views-api/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/activity/DependencyConfigurationPanel.java
deleted file mode 100644
index c28cb55..0000000
--- a/taverna-contextual-views-api/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/activity/DependencyConfigurationPanel.java
+++ /dev/null
@@ -1,293 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2013 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.views.contextualviews.activity;
-
-import static java.awt.BorderLayout.CENTER;
-import static java.awt.BorderLayout.NORTH;
-import static java.awt.Color.RED;
-import static java.awt.GridBagConstraints.FIRST_LINE_START;
-import static java.awt.GridBagConstraints.HORIZONTAL;
-import static java.awt.event.ItemEvent.DESELECTED;
-import static java.awt.event.ItemEvent.SELECTED;
-import static java.util.Arrays.asList;
-import static javax.swing.Box.createRigidArea;
-import static javax.swing.BoxLayout.PAGE_AXIS;
-import static javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER;
-import static javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED;
-
-import java.awt.BorderLayout;
-import java.awt.Dimension;
-import java.awt.GridBagConstraints;
-import java.awt.GridBagLayout;
-import java.awt.Insets;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.ItemEvent;
-import java.awt.event.ItemListener;
-import java.io.File;
-import java.io.FilenameFilter;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import javax.swing.BoxLayout;
-import javax.swing.JCheckBox;
-import javax.swing.JComboBox;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.border.EmptyBorder;
-
-/**
- * Component for configuring activities that require dependencies.
- *
- * @author David Withers
- */
-@SuppressWarnings("serial")
-public class DependencyConfigurationPanel extends JPanel {
-	private String classLoaderSharing;
-	private List<String> localDependencies;
-	private File libDir;
-
-	public DependencyConfigurationPanel(String classLoaderSharing,
-			List<String> localDependencies, File libDir) {
-		this.classLoaderSharing = classLoaderSharing;
-		this.localDependencies = localDependencies;
-		this.libDir = libDir;
-		setLayout(new BoxLayout(this, PAGE_AXIS));
-
-		// Create panel with classloading options
-		JPanel classloadingPanel = new ClassloadingPanel();
-		// Create panel for selecting jar files
-		JPanel jarFilesPanel = new JarFilesPanel();
-
-		add(classloadingPanel);
-		add(createRigidArea(new Dimension(0,10)));
-		add(jarFilesPanel);
-		add(createRigidArea(new Dimension(0,10)));
-
-	}
-
-	public String getClassLoaderSharing() {
-		return classLoaderSharing;
-	}
-
-	public List<String> getLocalDependencies() {
-		return localDependencies;
-	}
-
-	// Classloading option 'workflow'
-	private static final String WORKFLOW = "Shared for whole workflow";
-	// Classloading option 'system'
-	private static final String SYSTEM = "System classloader";
-	
-	// Panel containing classloading options
-	private class ClassloadingPanel extends JPanel {
-		// Combobox with classloading options
-		private JComboBox<String> jcbClassloadingOption;
-		// Classloading option descriptions
-		private HashMap<String, String> classloadingDescriptions;
-		// JLabel with classloading option description
-		private JLabel jlClassloadingDescription;
-
-		/*
-		 * Panel containing a list of possible classloading options which users
-		 * can select from
-		 */
-		private ClassloadingPanel() {
-			super(new GridBagLayout());
-			jcbClassloadingOption = new JComboBox<>(new String[] { WORKFLOW,
-					SYSTEM });
-			// Set the current classlaoding option based on the configuration bean
-			if ("workflow".equals(classLoaderSharing)) {
-				jcbClassloadingOption.setSelectedItem(WORKFLOW);
-			} else if ("system".equals(classLoaderSharing)) {
-				jcbClassloadingOption.setSelectedItem(SYSTEM);
-			}
-
-			jcbClassloadingOption.addActionListener(new ActionListener(){
-				// Fires up when combobox selection changes
-				@Override
-				public void actionPerformed(ActionEvent e) {
-					Object selectedItem = jcbClassloadingOption.getSelectedItem();
-					jlClassloadingDescription.setText(classloadingDescriptions
-							.get(selectedItem));
-					if (selectedItem.equals(WORKFLOW))
-						classLoaderSharing = "workflow";
-					else if (selectedItem.equals(SYSTEM))
-						classLoaderSharing = "system";
-				}
-			});
-			//jcbClassloadingOption.setEnabled(false);
-
-			classloadingDescriptions = new HashMap<>();
-			classloadingDescriptions.put(WORKFLOW, "<html><small>"
-					+ "Classes are shared across the whole workflow (with any service<br>"
-					+ "also selecting this option), but are reinitialised for each workflow run.<br>"
-					+ "This might be needed if a service passes objects to another, or <br>"
-					+ "state is shared within static members of loaded classes."
-					+ "</small></html>");
-			classloadingDescriptions.put(SYSTEM, "<html><small><p>"
-					+ "The (global) system classloader is used, any dependencies defined here are<br>"
-					+ "made available globally on the first run. Note that if you are NOT using<br>"
-					+ "the defaulf Taverna BootstrapClassLoader, any settings here will be disregarded."
-					+ "</p><p>"
-					+ "This is mainly useful if you are using JNI-based libraries. Note that <br>"
-					+ "for JNI you also have to specify <code>-Djava.library.path</code> and <br>"
-					+ "probably your operating system's dynamic library search path<br>"
-					+ "<code>LD_LIBRARY_PATH</code> / <code>DYLD_LIBRARY_PATH</code> / <code>PATH</code> </p>"
-					+ "</small></html>");
-
-			/*
-			 * Set the current classlaoding description based on the item
-			 * selected in the combobox.
-			 */
-			jlClassloadingDescription = new JLabel(classloadingDescriptions
-					.get(jcbClassloadingOption.getSelectedItem()));
-
-			// Add components to the ClassloadingPanel
-			GridBagConstraints c = new GridBagConstraints();
-			c.anchor = FIRST_LINE_START;
-			c.fill = HORIZONTAL;
-			c.gridx = 0;
-			c.insets = new Insets(10,0,0,0);
-			add(new JLabel("Classloader persistence"), c);
-			c.insets = new Insets(0,0,0,0);
-			add(jcbClassloadingOption, c);
-			c.insets = new Insets(0,30,0,0);
-			add(jlClassloadingDescription, c);
-		}
-	}
-
-	// Panel for users to add local JAR dependencies (contains a list of jar files which users can select from)
-	private class JarFilesPanel extends JPanel {
-		private JLabel warning = new JLabel(
-				"<html>"
-						+ "<center<font color='red'>"
-						+ "Warning: Depending on local libraries makes this workflow<br>"
-						+ "difficult or impossible to run for other users. Try depending<br>"
-						+ "on artifacts from a public repository if possible.</font></center>"
-						+ "</html>");
-
-		private JarFilesPanel() {
-			super();
-			setMinimumSize(new Dimension(400, 150));
-			setLayout(new BorderLayout());
-			setBorder(new EmptyBorder(0,10,0,10));
-
-			JPanel labelPanel = new JPanel();
-			labelPanel.setLayout(new BoxLayout(labelPanel, PAGE_AXIS));
-			JLabel label = new JLabel("Local JAR files");
-			JLabel libLabel = new JLabel("<html><small>" + libDir.getAbsolutePath()
-					+ "</small></html>");
-			labelPanel.add(label);
-			labelPanel.add(libLabel);
-
-			add(labelPanel, NORTH);
-			add(new JScrollPane(jarFiles(), VERTICAL_SCROLLBAR_AS_NEEDED,
-					HORIZONTAL_SCROLLBAR_NEVER), CENTER);
-
-			warning.setVisible(false);
-			/*
-			 * We'll skip the warning until we actually have support for
-			 * artifacts
-			 */
-			//add(warning);
-			updateWarning();
-		}
-
-		private void updateWarning() {
-			// Show warning if there is any local dependencies
-			warning.setVisible(!localDependencies.isEmpty());
-		}
-
-		public JPanel jarFiles() {
-			JPanel panel = new JPanel();
-			panel.setLayout(new BoxLayout(panel, PAGE_AXIS));
-
-			// List of all jar files in the lib directory
-			List<String> jarFiles = asList(libDir
-					.list(new FileExtFilter(".jar")));
-			/*
-			 * We also add the list of jars that may have been configured
-			 * sometime before but are now not present in the lib directory for
-			 * some reason
-			 */
-			Set<String> missingLocalDeps = new HashSet<>(localDependencies);
-			missingLocalDeps.removeAll(jarFiles);
-			/*
-			 * jarFiles and missingLocalDeps now contain two sets of files that
-			 * do not intersect
-			 */
-			List<String> jarFilesList = new ArrayList<>();
-			// Put them all together
-			jarFilesList.addAll(jarFiles);
-			jarFilesList.addAll(missingLocalDeps);
-			Collections.sort(jarFilesList);
-
-			if (jarFilesList.isEmpty()) {
-				panel.add(new JLabel("<html><small>To depend on a JAR file, "
-					+ "copy it to the above-mentioned folder.</small></html>"));
-				return panel;
-			}
-
-			for (String jarFile : jarFilesList) {
-				JCheckBox checkBox = new JCheckBox(jarFile);
-				// Has it already been selected in some previous configuring?
-				checkBox.setSelected(localDependencies.contains(jarFile));
-				checkBox.addItemListener(new ItemListener() {
-					@Override
-					public void itemStateChanged(ItemEvent e) {
-						JCheckBox box = (JCheckBox) e.getSource();
-						if (e.getStateChange() == SELECTED)
-							localDependencies.add(box.getText());
-						else if (e.getStateChange() == DESELECTED)
-							localDependencies.remove(box.getText());
-						updateWarning();
-					}
-				});
-				panel.add(checkBox);
-				// The jar may not be in the lib directory, so warn the user
-				if (!new File(libDir, jarFile).exists()) {
-					checkBox.setForeground(RED);
-					checkBox.setText(checkBox.getText() + " (missing file!)");
-				}
-			}
-			return panel;
-		}
-	}
-
-	public static class FileExtFilter implements FilenameFilter {
-		final String ext;
-
-		public FileExtFilter(String ext) {
-			this.ext = ext;
-		}
-
-		@Override
-		public boolean accept(File dir, String name) {
-			return name.endsWith(ext);
-		}
-	}
-}


[27/51] [partial] incubator-taverna-workbench git commit: all packages are moved to org.apache.taverna.*

Posted by re...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-dataflow-activity-ui/src/main/java/org/apache/taverna/workbench/file/importworkflow/menu/ReplaceNestedWorkflowMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-dataflow-activity-ui/src/main/java/org/apache/taverna/workbench/file/importworkflow/menu/ReplaceNestedWorkflowMenuAction.java b/taverna-dataflow-activity-ui/src/main/java/org/apache/taverna/workbench/file/importworkflow/menu/ReplaceNestedWorkflowMenuAction.java
new file mode 100644
index 0000000..79fc02f
--- /dev/null
+++ b/taverna-dataflow-activity-ui/src/main/java/org/apache/taverna/workbench/file/importworkflow/menu/ReplaceNestedWorkflowMenuAction.java
@@ -0,0 +1,76 @@
+package org.apache.taverna.workbench.file.importworkflow.menu;
+
+import java.net.URI;
+
+import javax.swing.Action;
+
+import org.apache.taverna.servicedescriptions.ServiceDescriptionRegistry;
+import org.apache.taverna.ui.menu.MenuManager;
+import org.apache.taverna.workbench.activityicons.ActivityIconManager;
+import org.apache.taverna.workbench.activitytools.AbstractConfigureActivityMenuAction;
+import org.apache.taverna.workbench.configuration.colour.ColourManager;
+import org.apache.taverna.workbench.configuration.workbench.WorkbenchConfiguration;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.file.FileManager;
+import org.apache.taverna.workbench.file.importworkflow.actions.ReplaceNestedWorkflowAction;
+import org.apache.taverna.workbench.selection.SelectionManager;
+
+public class ReplaceNestedWorkflowMenuAction extends AbstractConfigureActivityMenuAction {
+
+	private static final URI NESTED_ACTIVITY = URI.create("http://ns.taverna.org.uk/2010/activity/nested-workflow");
+
+	private EditManager editManager;
+	private FileManager fileManager;
+	private MenuManager menuManager;
+	private ActivityIconManager activityIconManager;
+	private ColourManager colourManager;
+	private WorkbenchConfiguration workbenchConfiguration;
+	private ServiceDescriptionRegistry serviceDescriptionRegistry;
+	private SelectionManager selectionManager;
+
+	public ReplaceNestedWorkflowMenuAction() {
+		super(NESTED_ACTIVITY);
+	}
+
+	@Override
+	protected Action createAction() {
+		ReplaceNestedWorkflowAction configAction = new ReplaceNestedWorkflowAction(findActivity(),
+				editManager, fileManager, menuManager, activityIconManager, colourManager,
+				serviceDescriptionRegistry, workbenchConfiguration, selectionManager);
+		addMenuDots(configAction);
+		return configAction;
+	}
+
+	public void setEditManager(EditManager editManager) {
+		this.editManager = editManager;
+	}
+
+	public void setFileManager(FileManager fileManager) {
+		this.fileManager = fileManager;
+	}
+
+	public void setMenuManager(MenuManager menuManager) {
+		this.menuManager = menuManager;
+	}
+
+	public void setActivityIconManager(ActivityIconManager activityIconManager) {
+		this.activityIconManager = activityIconManager;
+	}
+
+	public void setColourManager(ColourManager colourManager) {
+		this.colourManager = colourManager;
+	}
+
+	public void setServiceDescriptionRegistry(ServiceDescriptionRegistry serviceDescriptionRegistry) {
+		this.serviceDescriptionRegistry = serviceDescriptionRegistry;
+	}
+
+	public void setWorkbenchConfiguration(WorkbenchConfiguration workbenchConfiguration) {
+		this.workbenchConfiguration = workbenchConfiguration;
+	}
+
+	public void setSelectionManager(SelectionManager selectionManager) {
+		this.selectionManager = selectionManager;
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-dataflow-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.servicedescriptions.ServiceDescriptionProvider
----------------------------------------------------------------------
diff --git a/taverna-dataflow-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.servicedescriptions.ServiceDescriptionProvider b/taverna-dataflow-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.servicedescriptions.ServiceDescriptionProvider
deleted file mode 100644
index bf42bef..0000000
--- a/taverna-dataflow-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.servicedescriptions.ServiceDescriptionProvider
+++ /dev/null
@@ -1 +0,0 @@
-net.sf.taverna.t2.activities.dataflow.servicedescriptions.DataflowTemplateService

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-dataflow-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.ui.menu.MenuComponent
----------------------------------------------------------------------
diff --git a/taverna-dataflow-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.ui.menu.MenuComponent b/taverna-dataflow-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.ui.menu.MenuComponent
deleted file mode 100644
index 6e7eec5..0000000
--- a/taverna-dataflow-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.ui.menu.MenuComponent
+++ /dev/null
@@ -1,9 +0,0 @@
-# Needs to be first AbstractConfigureActivityMenuAction to be
-# picked up as the automatic 'configure' action for template services
-net.sf.taverna.t2.workbench.file.importworkflow.menu.ReplaceNestedWorkflowMenuAction
-
-net.sf.taverna.t2.workbench.file.importworkflow.menu.AddNestedWorkflowMenuAction
-net.sf.taverna.t2.workbench.file.importworkflow.menu.ImportWorkflowMenuAction
-net.sf.taverna.t2.workbench.file.importworkflow.menu.MergeWorkflowMenuAction
-
-net.sf.taverna.t2.activities.dataflow.menu.EditNestedDataflowMenuAction

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-dataflow-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.activityicons.ActivityIconSPI
----------------------------------------------------------------------
diff --git a/taverna-dataflow-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.activityicons.ActivityIconSPI b/taverna-dataflow-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.activityicons.ActivityIconSPI
deleted file mode 100644
index 5cb0543..0000000
--- a/taverna-dataflow-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.activityicons.ActivityIconSPI
+++ /dev/null
@@ -1 +0,0 @@
-net.sf.taverna.t2.activities.dataflow.servicedescriptions.DataflowActivityIcon
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-dataflow-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.file.DataflowPersistenceHandler
----------------------------------------------------------------------
diff --git a/taverna-dataflow-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.file.DataflowPersistenceHandler b/taverna-dataflow-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.file.DataflowPersistenceHandler
deleted file mode 100644
index a334e66..0000000
--- a/taverna-dataflow-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.file.DataflowPersistenceHandler
+++ /dev/null
@@ -1 +0,0 @@
-net.sf.taverna.t2.activities.dataflow.filemanager.NestedDataflowPersistenceHandler
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-dataflow-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory
----------------------------------------------------------------------
diff --git a/taverna-dataflow-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory b/taverna-dataflow-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory
deleted file mode 100644
index 39d7ec2..0000000
--- a/taverna-dataflow-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory
+++ /dev/null
@@ -1 +0,0 @@
-net.sf.taverna.t2.activities.dataflow.views.DataflowActivityViewFactory
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-dataflow-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.servicedescriptions.ServiceDescriptionProvider
----------------------------------------------------------------------
diff --git a/taverna-dataflow-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.servicedescriptions.ServiceDescriptionProvider b/taverna-dataflow-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.servicedescriptions.ServiceDescriptionProvider
new file mode 100644
index 0000000..4fb5e75
--- /dev/null
+++ b/taverna-dataflow-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.servicedescriptions.ServiceDescriptionProvider
@@ -0,0 +1 @@
+org.apache.taverna.activities.dataflow.servicedescriptions.DataflowTemplateService

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-dataflow-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.ui.menu.MenuComponent
----------------------------------------------------------------------
diff --git a/taverna-dataflow-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.ui.menu.MenuComponent b/taverna-dataflow-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.ui.menu.MenuComponent
new file mode 100644
index 0000000..cd9685a
--- /dev/null
+++ b/taverna-dataflow-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.ui.menu.MenuComponent
@@ -0,0 +1,9 @@
+# Needs to be first AbstractConfigureActivityMenuAction to be
+# picked up as the automatic 'configure' action for template services
+org.apache.taverna.workbench.file.importworkflow.menu.ReplaceNestedWorkflowMenuAction
+
+org.apache.taverna.workbench.file.importworkflow.menu.AddNestedWorkflowMenuAction
+org.apache.taverna.workbench.file.importworkflow.menu.ImportWorkflowMenuAction
+org.apache.taverna.workbench.file.importworkflow.menu.MergeWorkflowMenuAction
+
+org.apache.taverna.activities.dataflow.menu.EditNestedDataflowMenuAction

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-dataflow-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.workbench.activityicons.ActivityIconSPI
----------------------------------------------------------------------
diff --git a/taverna-dataflow-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.workbench.activityicons.ActivityIconSPI b/taverna-dataflow-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.workbench.activityicons.ActivityIconSPI
new file mode 100644
index 0000000..263a49a
--- /dev/null
+++ b/taverna-dataflow-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.workbench.activityicons.ActivityIconSPI
@@ -0,0 +1 @@
+org.apache.taverna.activities.dataflow.servicedescriptions.DataflowActivityIcon
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-dataflow-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.workbench.file.DataflowPersistenceHandler
----------------------------------------------------------------------
diff --git a/taverna-dataflow-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.workbench.file.DataflowPersistenceHandler b/taverna-dataflow-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.workbench.file.DataflowPersistenceHandler
new file mode 100644
index 0000000..907b777
--- /dev/null
+++ b/taverna-dataflow-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.workbench.file.DataflowPersistenceHandler
@@ -0,0 +1 @@
+org.apache.taverna.activities.dataflow.filemanager.NestedDataflowPersistenceHandler
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-dataflow-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory
----------------------------------------------------------------------
diff --git a/taverna-dataflow-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory b/taverna-dataflow-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory
new file mode 100644
index 0000000..626ac26
--- /dev/null
+++ b/taverna-dataflow-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory
@@ -0,0 +1 @@
+org.apache.taverna.activities.dataflow.views.DataflowActivityViewFactory
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-dataflow-activity-ui/src/main/resources/META-INF/spring/dataflow-activity-ui-context-osgi.xml
----------------------------------------------------------------------
diff --git a/taverna-dataflow-activity-ui/src/main/resources/META-INF/spring/dataflow-activity-ui-context-osgi.xml b/taverna-dataflow-activity-ui/src/main/resources/META-INF/spring/dataflow-activity-ui-context-osgi.xml
index e664429..f2d35c1 100644
--- a/taverna-dataflow-activity-ui/src/main/resources/META-INF/spring/dataflow-activity-ui-context-osgi.xml
+++ b/taverna-dataflow-activity-ui/src/main/resources/META-INF/spring/dataflow-activity-ui-context-osgi.xml
@@ -6,9 +6,9 @@
                       http://www.springframework.org/schema/osgi
                       http://www.springframework.org/schema/osgi/spring-osgi.xsd">
 
-	<service ref="DataflowActivityIcon" interface="net.sf.taverna.t2.workbench.activityicons.ActivityIconSPI" />
+	<service ref="DataflowActivityIcon" interface="org.apache.taverna.workbench.activityicons.ActivityIconSPI" />
 
-	<service ref="DataflowTemplateService" interface="net.sf.taverna.t2.servicedescriptions.ServiceDescriptionProvider" />
+	<service ref="DataflowTemplateService" interface="org.apache.taverna.servicedescriptions.ServiceDescriptionProvider" />
 
 	<service ref="ReplaceNestedWorkflowMenuAction" auto-export="interfaces" />
 	<service ref="AddNestedWorkflowMenuAction" auto-export="interfaces" />
@@ -16,18 +16,18 @@
 	<service ref="MergeWorkflowMenuAction" auto-export="interfaces" />
 	<service ref="EditNestedDataflowMenuAction" auto-export="interfaces" />
 
-	<!-- <service ref="NestedDataflowPersistenceHandler" interface="net.sf.taverna.t2.workbench.file.DataflowPersistenceHandler" /> -->
+	<!-- <service ref="NestedDataflowPersistenceHandler" interface="org.apache.taverna.workbench.file.DataflowPersistenceHandler" /> -->
 
-	<service ref="DataflowActivityViewFactory" interface="net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory" />
+	<service ref="DataflowActivityViewFactory" interface="org.apache.taverna.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="menuManager" interface="net.sf.taverna.t2.ui.menu.MenuManager" />
-	<reference id="edits" interface="net.sf.taverna.t2.workflowmodel.Edits" />
-	<reference id="activityIconManager" interface="net.sf.taverna.t2.workbench.activityicons.ActivityIconManager" />
-	<reference id="colourManager" interface="net.sf.taverna.t2.workbench.configuration.colour.ColourManager" />
-	<reference id="serviceDescriptionRegistry" interface="net.sf.taverna.t2.servicedescriptions.ServiceDescriptionRegistry" />
-	<reference id="workbenchConfiguration" interface="net.sf.taverna.t2.workbench.configuration.workbench.WorkbenchConfiguration" />
-	<reference id="selectionManager" interface="net.sf.taverna.t2.workbench.selection.SelectionManager" />
+	<reference id="editManager" interface="org.apache.taverna.workbench.edits.EditManager" />
+	<reference id="fileManager" interface="org.apache.taverna.workbench.file.FileManager" />
+	<reference id="menuManager" interface="org.apache.taverna.ui.menu.MenuManager" />
+	<reference id="edits" interface="org.apache.taverna.workflowmodel.Edits" />
+	<reference id="activityIconManager" interface="org.apache.taverna.workbench.activityicons.ActivityIconManager" />
+	<reference id="colourManager" interface="org.apache.taverna.workbench.configuration.colour.ColourManager" />
+	<reference id="serviceDescriptionRegistry" interface="org.apache.taverna.servicedescriptions.ServiceDescriptionRegistry" />
+	<reference id="workbenchConfiguration" interface="org.apache.taverna.workbench.configuration.workbench.WorkbenchConfiguration" />
+	<reference id="selectionManager" interface="org.apache.taverna.workbench.selection.SelectionManager" />
 
 </beans:beans>

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-dataflow-activity-ui/src/main/resources/META-INF/spring/dataflow-activity-ui-context.xml
----------------------------------------------------------------------
diff --git a/taverna-dataflow-activity-ui/src/main/resources/META-INF/spring/dataflow-activity-ui-context.xml b/taverna-dataflow-activity-ui/src/main/resources/META-INF/spring/dataflow-activity-ui-context.xml
index f72abd2..faa1a43 100644
--- a/taverna-dataflow-activity-ui/src/main/resources/META-INF/spring/dataflow-activity-ui-context.xml
+++ b/taverna-dataflow-activity-ui/src/main/resources/META-INF/spring/dataflow-activity-ui-context.xml
@@ -3,11 +3,11 @@
 	xsi:schemaLocation="http://www.springframework.org/schema/beans
                       http://www.springframework.org/schema/beans/spring-beans.xsd">
 
-	<bean id="DataflowActivityIcon" class="net.sf.taverna.t2.activities.dataflow.servicedescriptions.DataflowActivityIcon" />
+	<bean id="DataflowActivityIcon" class="org.apache.taverna.activities.dataflow.servicedescriptions.DataflowActivityIcon" />
 
-	<bean id="DataflowTemplateService" class="net.sf.taverna.t2.activities.dataflow.servicedescriptions.DataflowTemplateService" />
+	<bean id="DataflowTemplateService" class="org.apache.taverna.activities.dataflow.servicedescriptions.DataflowTemplateService" />
 
-	<bean id="ReplaceNestedWorkflowMenuAction" class="net.sf.taverna.t2.workbench.file.importworkflow.menu.ReplaceNestedWorkflowMenuAction">
+	<bean id="ReplaceNestedWorkflowMenuAction" class="org.apache.taverna.workbench.file.importworkflow.menu.ReplaceNestedWorkflowMenuAction">
 			<property name="editManager" ref="editManager" />
 			<property name="fileManager" ref="fileManager" />
 			<property name="menuManager" ref="menuManager" />
@@ -17,7 +17,7 @@
 			<property name="workbenchConfiguration" ref="workbenchConfiguration" />
 			<property name="selectionManager" ref="selectionManager" />
 	</bean>
-	<bean id="AddNestedWorkflowMenuAction" class="net.sf.taverna.t2.workbench.file.importworkflow.menu.AddNestedWorkflowMenuAction">
+	<bean id="AddNestedWorkflowMenuAction" class="org.apache.taverna.workbench.file.importworkflow.menu.AddNestedWorkflowMenuAction">
 			<property name="editManager" ref="editManager" />
 			<property name="fileManager" ref="fileManager" />
 			<property name="menuManager" ref="menuManager" />
@@ -25,7 +25,7 @@
 			<property name="workbenchConfiguration" ref="workbenchConfiguration" />
 			<property name="selectionManager" ref="selectionManager" />
 	</bean>
-	<bean id="ImportWorkflowMenuAction" class="net.sf.taverna.t2.workbench.file.importworkflow.menu.ImportWorkflowMenuAction">
+	<bean id="ImportWorkflowMenuAction" class="org.apache.taverna.workbench.file.importworkflow.menu.ImportWorkflowMenuAction">
 			<property name="editManager" ref="editManager" />
 			<property name="fileManager" ref="fileManager" />
 			<property name="menuManager" ref="menuManager" />
@@ -33,7 +33,7 @@
 			<property name="workbenchConfiguration" ref="workbenchConfiguration" />
 			<property name="selectionManager" ref="selectionManager" />
 	</bean>
-	<bean id="MergeWorkflowMenuAction" class="net.sf.taverna.t2.workbench.file.importworkflow.menu.MergeWorkflowMenuAction">
+	<bean id="MergeWorkflowMenuAction" class="org.apache.taverna.workbench.file.importworkflow.menu.MergeWorkflowMenuAction">
 			<property name="editManager" ref="editManager" />
 			<property name="fileManager" ref="fileManager" />
 			<property name="menuManager" ref="menuManager" />
@@ -41,16 +41,16 @@
 			<property name="workbenchConfiguration" ref="workbenchConfiguration" />
 			<property name="selectionManager" ref="selectionManager" />
 	</bean>
-	<bean id="EditNestedDataflowMenuAction" class="net.sf.taverna.t2.activities.dataflow.menu.EditNestedDataflowMenuAction">
+	<bean id="EditNestedDataflowMenuAction" class="org.apache.taverna.activities.dataflow.menu.EditNestedDataflowMenuAction">
 			<property name="selectionManager" ref="selectionManager" />
 	</bean>
 
-	<!-- <bean id="NestedDataflowPersistenceHandler" class="net.sf.taverna.t2.activities.dataflow.filemanager.NestedDataflowPersistenceHandler">
+	<!-- <bean id="NestedDataflowPersistenceHandler" class="org.apache.taverna.activities.dataflow.filemanager.NestedDataflowPersistenceHandler">
 			<property name="editManager" ref="editManager" />
 			<property name="fileManager" ref="fileManager" />
 	</bean> -->
 
-	<bean id="DataflowActivityViewFactory" class="net.sf.taverna.t2.activities.dataflow.views.DataflowActivityViewFactory">
+	<bean id="DataflowActivityViewFactory" class="org.apache.taverna.activities.dataflow.views.DataflowActivityViewFactory">
 			<property name="editManager" ref="editManager" />
 			<property name="fileManager" ref="fileManager" />
 			<property name="menuManager" ref="menuManager" />

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-dataflow-activity-ui/src/test/java/net/sf/taverna/t2/workbench/file/importworkflow/AbstractTestHelper.java
----------------------------------------------------------------------
diff --git a/taverna-dataflow-activity-ui/src/test/java/net/sf/taverna/t2/workbench/file/importworkflow/AbstractTestHelper.java b/taverna-dataflow-activity-ui/src/test/java/net/sf/taverna/t2/workbench/file/importworkflow/AbstractTestHelper.java
deleted file mode 100644
index 9c43474..0000000
--- a/taverna-dataflow-activity-ui/src/test/java/net/sf/taverna/t2/workbench/file/importworkflow/AbstractTestHelper.java
+++ /dev/null
@@ -1,266 +0,0 @@
-package net.sf.taverna.t2.workbench.file.importworkflow;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import java.io.InputStream;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.junit.Before;
-
-import org.apache.taverna.scufl2.api.common.Scufl2Tools;
-import org.apache.taverna.scufl2.api.container.WorkflowBundle;
-import org.apache.taverna.scufl2.api.core.BlockingControlLink;
-import org.apache.taverna.scufl2.api.core.ControlLink;
-import org.apache.taverna.scufl2.api.core.DataLink;
-import org.apache.taverna.scufl2.api.core.Processor;
-import org.apache.taverna.scufl2.api.core.Workflow;
-import org.apache.taverna.scufl2.api.io.WorkflowBundleIO;
-import org.apache.taverna.scufl2.api.port.InputWorkflowPort;
-import org.apache.taverna.scufl2.api.port.OutputWorkflowPort;
-import org.apache.taverna.scufl2.api.port.ProcessorPort;
-import org.apache.taverna.scufl2.api.port.ReceiverPort;
-import org.apache.taverna.scufl2.api.port.SenderPort;
-
-public abstract class AbstractTestHelper {
-
-	private static final String Q_T2FLOW = "/q.t2flow";
-
-	private static final String ABC_T2FLOW = "/abc.t2flow";
-
-	private static final String P_T2FLOW = "/p.t2flow";
-
-	private WorkflowBundleIO workflowBundleIO = new WorkflowBundleIO();
-
-	protected Scufl2Tools scufl2Tools = new Scufl2Tools();
-
-	protected Workflow abc;
-
-	protected Workflow p;
-
-	protected Workflow q;
-
-	protected void assertHasConditionals(Workflow dataflow,
-			String... expectedConditionalDef) {
-		Set<String> expectedConditionals = new HashSet<String>();
-		for (String expected : expectedConditionalDef) {
-			expectedConditionals.add(expected);
-		}
-
-		Set<String> foundConditionals = new HashSet<String>();
-
-		for (ControlLink c : dataflow.getControlLinks()) {
-			if (c instanceof BlockingControlLink) {
-			BlockingControlLink bcl = (BlockingControlLink) c;
-			foundConditionals.add(bcl.getUntilFinished().getName() + ";"
-					+ bcl.getBlock().getName());
-			}
-		}
-
-		Set<String> extras = new HashSet<String>(foundConditionals);
-		extras.removeAll(expectedConditionals);
-		assertTrue("Unexpected conditional  " + extras, extras.isEmpty());
-
-		Set<String> missing = new HashSet<String>(expectedConditionals);
-		missing.removeAll(foundConditionals);
-		assertTrue("Could not find conditional  " + missing, missing.isEmpty());
-	}
-
-	protected void assertHasDatalinks(Workflow dataflow,
-			String... expectedLinkDef) {
-		Set<String> expectedLinks = new HashSet<String>();
-		for (String expected : expectedLinkDef) {
-			expectedLinks.add(expected);
-		}
-
-		Set<String> foundLinks = new HashSet<String>();
-
-		for (DataLink link : dataflow.getDataLinks()) {
-			StringBuilder linkRef = new StringBuilder();
-			SenderPort source = link.getReceivesFrom();
-			if (source instanceof ProcessorPort) {
-				linkRef.append(((ProcessorPort) source).getParent()
-						.getName());
-				linkRef.append('.');
-			}
-			linkRef.append(source.getName());
-
-			linkRef.append("->");
-
-			ReceiverPort sink = link.getSendsTo();
-			if (sink instanceof ProcessorPort) {
-				linkRef.append(((ProcessorPort) sink).getParent()
-						.getName());
-				linkRef.append('.');
-			}
-			linkRef.append(sink.getName());
-
-			String linkStr = linkRef.toString();
-			foundLinks.add(linkStr);
-		}
-
-		Set<String> extras = new HashSet<String>(foundLinks);
-		extras.removeAll(expectedLinks);
-		assertTrue("Unexpected links  " + extras, extras.isEmpty());
-
-		Set<String> missing = new HashSet<String>(expectedLinks);
-		missing.removeAll(foundLinks);
-		assertTrue("Could not find links  " + missing, missing.isEmpty());
-	}
-
-	protected void assertHasInputPorts(Workflow dataflow,
-			String... expectedInputPorts) {
-		Set<String> expectedNames = new HashSet<String>();
-		for (String expected : expectedInputPorts) {
-			expectedNames.add(expected);
-		}
-		Set<String> foundNames = new HashSet<String>();
-		for (InputWorkflowPort port : dataflow.getInputPorts()) {
-			String name = port.getName();
-			foundNames.add(name);
-		}
-
-		Set<String> extras = new HashSet<String>(foundNames);
-		extras.removeAll(expectedNames);
-		assertTrue("Unexpected input port  " + extras, extras.isEmpty());
-
-		Set<String> missing = new HashSet<String>(expectedNames);
-		missing.removeAll(foundNames);
-		assertTrue("Could not find input port  " + missing, missing.isEmpty());
-
-	}
-
-	protected void assertHasOutputPorts(Workflow dataflow,
-			String... expectedOutputPorts) {
-		Set<String> expectedNames = new HashSet<String>();
-		for (String expected : expectedOutputPorts) {
-			expectedNames.add(expected);
-		}
-		Set<String> foundNames = new HashSet<String>();
-		for (OutputWorkflowPort port : dataflow.getOutputPorts()) {
-			String name = port.getName();
-			foundNames.add(name);
-		}
-
-		Set<String> extras = new HashSet<String>(foundNames);
-		extras.removeAll(expectedNames);
-		assertTrue("Unexpected output port  " + extras, extras.isEmpty());
-
-		Set<String> missing = new HashSet<String>(expectedNames);
-		missing.removeAll(foundNames);
-		assertTrue("Could not find output port  " + missing, missing.isEmpty());
-	}
-
-	protected void assertHasProcessors(Workflow dataflow,
-			String... expectedProcessors) {
-		Set<String> expectedNames = new HashSet<String>();
-		for (String expected : expectedProcessors) {
-			expectedNames.add(expected);
-		}
-		Set<String> foundNames = new HashSet<String>();
-
-		for (Processor proc : dataflow.getProcessors()) {
-			String processorName = proc.getName();
-			foundNames.add(processorName);
-		}
-
-		Set<String> extras = new HashSet<String>(foundNames);
-		extras.removeAll(expectedNames);
-		assertTrue("Unexpected processor  " + extras, extras.isEmpty());
-
-		Set<String> missing = new HashSet<String>(expectedNames);
-		missing.removeAll(foundNames);
-		assertTrue("Could not find processor  " + missing, missing.isEmpty());
-	}
-
-	protected void checkAbc() throws Exception {
-		assertHasProcessors(abc, "A", "B", "C");
-		assertHasInputPorts(abc, "in1", "in2");
-		assertHasOutputPorts(abc, "a", "b", "c");
-		assertHasDatalinks(abc, "in2->B.inputlist", "in1->A.string1",
-				"in2->A.string2", "Merge0:Merge0_output->C.inputlist",
-				"A.output->a", "B.outputlist->b",
-				"B.outputlist->Merge0:outputlistToMerge0_input0",
-				"A.output->Merge0:outputToMerge0_input0", "C.outputlist->c");
-		assertHasConditionals(abc, "A;B");
-	}
-
-	protected void checkP() throws Exception {
-		assertHasProcessors(p, "P");
-		assertHasInputPorts(p, "i");
-		assertHasOutputPorts(p, "o");
-		assertHasDatalinks(p, "i->P.inputlist", "P.outputlist->o");
-		assertHasConditionals(p);
-
-	}
-
-	protected void checkQ() throws Exception {
-		assertHasProcessors(q, "Q");
-		assertHasInputPorts(q, "p");
-		assertHasOutputPorts(q, "p", "q");
-		assertHasDatalinks(q, "p->Q.inputlist", "Q.outputlist->q", "p->p");
-		assertHasConditionals(q);
-
-		List<DataLink> datalinksTo = scufl2Tools.datalinksTo(findOutputPort(q, "p"));
-		assertEquals(1, datalinksTo.size());
-		SenderPort source = datalinksTo.get(0).getReceivesFrom();
-		assertEquals("out port P not linked to input P", source, findInputPort(q, "p"));
-
-	}
-
-	protected Workflow loadAbc() throws Exception {
-		return openWorkflow(getClass().getResourceAsStream(ABC_T2FLOW));
-	}
-
-	protected Workflow loadP() throws Exception {
-		return openWorkflow(getClass().getResourceAsStream(P_T2FLOW));
-	}
-
-	protected Workflow loadQ() throws Exception {
-		return openWorkflow(getClass().getResourceAsStream(Q_T2FLOW));
-	}
-
-	@Before
-	public void loadWorkflows() throws Exception {
-		abc = loadAbc();
-		p = loadP();
-		q = loadQ();
-	}
-
-	protected Workflow openWorkflow(InputStream workflowXMLstream) throws Exception {
-		assertNotNull(workflowXMLstream);
-		WorkflowBundle workflowBundle = workflowBundleIO.readBundle(workflowXMLstream, "application/vnd.taverna.t2flow+xml");
-		return workflowBundle.getMainWorkflow();
-	}
-
-	protected InputWorkflowPort findInputPort(Workflow wf, String name) {
-		for (InputWorkflowPort inp : wf.getInputPorts()) {
-			if (inp.getName().equals(name)) {
-				return inp;
-			}
-		}
-		throw new IllegalArgumentException("Unknown input port: " + name);
-	}
-
-	protected OutputWorkflowPort findOutputPort(Workflow wf, String name) {
-		for (OutputWorkflowPort outp : wf.getOutputPorts()) {
-			if (outp.getName().equals(name)) {
-				return outp;
-			}
-		}
-		throw new IllegalArgumentException("Unknown output port: " + name);
-	}
-
-	protected Processor findProcessor(Workflow wf, String name) {
-		for (Processor proc : wf.getProcessors()) {
-			if (proc.getName().equals(name)) {
-				return proc;
-			}
-		}
-		throw new IllegalArgumentException("Unknown processor: " + name);
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-dataflow-activity-ui/src/test/java/net/sf/taverna/t2/workbench/file/importworkflow/TestPortMerge.java
----------------------------------------------------------------------
diff --git a/taverna-dataflow-activity-ui/src/test/java/net/sf/taverna/t2/workbench/file/importworkflow/TestPortMerge.java b/taverna-dataflow-activity-ui/src/test/java/net/sf/taverna/t2/workbench/file/importworkflow/TestPortMerge.java
deleted file mode 100644
index d950ae2..0000000
--- a/taverna-dataflow-activity-ui/src/test/java/net/sf/taverna/t2/workbench/file/importworkflow/TestPortMerge.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package net.sf.taverna.t2.workbench.file.importworkflow;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertSame;
-
-import java.util.List;
-
-import org.junit.Ignore;
-import org.junit.Test;
-
-import org.apache.taverna.scufl2.api.core.DataLink;
-import org.apache.taverna.scufl2.api.core.Workflow;
-import org.apache.taverna.scufl2.api.port.SenderPort;
-
-@Ignore
-public class TestPortMerge extends AbstractTestHelper {
-
-	@Test
-	public void mergeQintoP() throws Exception {
-		DataflowMerger merger = new DataflowMerger(p);
-		merger.getMergeEdit(q).doEdit();
-		Workflow merged = p;
-		checkQ();
-
-		assertHasProcessors(merged, "P", "Q");
-		assertHasInputPorts(merged, "i", "p");
-		assertHasOutputPorts(merged, "o", "p", "q");
-		assertHasDatalinks(merged, "i->P.inputlist", "P.outputlist->o", "p->Q.inputlist",
-				"Q.outputlist->q", "p->p");
-
-		List<DataLink> datalinksTo = scufl2Tools.datalinksTo(findOutputPort(merged, "p"));
-		assertEquals(1, datalinksTo.size());
-		SenderPort source = datalinksTo.get(0).getReceivesFrom();
-		assertSame("out port P not linked to input P", source, findInputPort(merged, "p"));
-
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-dataflow-activity-ui/src/test/java/net/sf/taverna/t2/workbench/file/importworkflow/TestRename.java
----------------------------------------------------------------------
diff --git a/taverna-dataflow-activity-ui/src/test/java/net/sf/taverna/t2/workbench/file/importworkflow/TestRename.java b/taverna-dataflow-activity-ui/src/test/java/net/sf/taverna/t2/workbench/file/importworkflow/TestRename.java
deleted file mode 100644
index 2755645..0000000
--- a/taverna-dataflow-activity-ui/src/test/java/net/sf/taverna/t2/workbench/file/importworkflow/TestRename.java
+++ /dev/null
@@ -1,58 +0,0 @@
-package net.sf.taverna.t2.workbench.file.importworkflow;
-
-import org.junit.Ignore;
-import org.junit.Test;
-
-import org.apache.taverna.scufl2.api.core.Workflow;
-
-@Ignore
-public class TestRename extends AbstractTestHelper {
-
-	@Test
-	public void mergePintoP() throws Exception {
-		DataflowMerger merger = new DataflowMerger(p);
-		merger.getMergeEdit(p).doEdit();
-		Workflow merged = p;
-
-		assertHasProcessors(merged, "P", "P_2");
-		assertHasInputPorts(merged, "i", "i_2");
-		assertHasOutputPorts(merged, "o", "o_2");
-		assertHasDatalinks(merged, "i->P.inputlist", "P.outputlist->o",
-				"i_2->P_2.inputlist", "P_2.outputlist->o_2");
-	}
-
-	@Test
-	public void mergePintoPintoP() throws Exception {
-		// Don't put p in constructor, or we would get exponential merging!
-		Workflow merged = new Workflow();
-		DataflowMerger merger = new DataflowMerger(merged);
-		merger.getMergeEdit(p).doEdit();
-		merger.getMergeEdit(p).doEdit();
-		merger.getMergeEdit(p).doEdit();
-
-		assertHasProcessors(merged, "P", "P_2", "P_3");
-		assertHasInputPorts(merged, "i", "i_2", "i_3");
-		assertHasOutputPorts(merged, "o", "o_2", "o_3");
-		assertHasDatalinks(merged, "i->P.inputlist", "P.outputlist->o",
-				"i_2->P_2.inputlist", "P_2.outputlist->o_2",
-				"i_3->P_3.inputlist", "P_3.outputlist->o_3");
-	}
-
-	@Test
-	public void mergePintoPWithPrefix() throws Exception {
-		// Don't put p in constructor, or we would get exponential merging!
-		Workflow merged = new Workflow();
-		DataflowMerger merger = new DataflowMerger(merged);
-		merger.getMergeEdit(p).doEdit();
-		merger.getMergeEdit(p, "fish_").doEdit();
-		merger.getMergeEdit(p, "soup_").doEdit();
-
-		assertHasProcessors(merged, "P", "fish_P", "soup_P");
-		assertHasInputPorts(merged, "i", "fish_i", "soup_i");
-		assertHasOutputPorts(merged, "o", "fish_o", "soup_o");
-		assertHasDatalinks(merged, "i->P.inputlist", "P.outputlist->o",
-				"fish_i->fish_P.inputlist", "fish_P.outputlist->fish_o",
-				"soup_i->soup_P.inputlist", "soup_P.outputlist->soup_o");
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-dataflow-activity-ui/src/test/java/net/sf/taverna/t2/workbench/file/importworkflow/TestSimpleMerge.java
----------------------------------------------------------------------
diff --git a/taverna-dataflow-activity-ui/src/test/java/net/sf/taverna/t2/workbench/file/importworkflow/TestSimpleMerge.java b/taverna-dataflow-activity-ui/src/test/java/net/sf/taverna/t2/workbench/file/importworkflow/TestSimpleMerge.java
deleted file mode 100644
index 8199979..0000000
--- a/taverna-dataflow-activity-ui/src/test/java/net/sf/taverna/t2/workbench/file/importworkflow/TestSimpleMerge.java
+++ /dev/null
@@ -1,98 +0,0 @@
-package net.sf.taverna.t2.workbench.file.importworkflow;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotSame;
-import static org.junit.Assert.assertSame;
-
-import java.util.List;
-
-import org.junit.Ignore;
-import org.junit.Test;
-
-import org.apache.taverna.scufl2.api.core.DataLink;
-import org.apache.taverna.scufl2.api.core.Processor;
-import org.apache.taverna.scufl2.api.core.Workflow;
-import org.apache.taverna.scufl2.api.port.InputProcessorPort;
-import org.apache.taverna.scufl2.api.port.InputWorkflowPort;
-import org.apache.taverna.scufl2.api.port.SenderPort;
-
-@Ignore
-public class TestSimpleMerge extends AbstractTestHelper {
-
-	private void checkMergedAbcP(Workflow merged) {
-		// Check that it has everything from both
-		assertHasProcessors(merged, "A", "B", "C", "P");
-		assertHasInputPorts(merged, "in1", "in2", "i");
-		assertHasOutputPorts(merged, "a", "b", "c", "o");
-		assertHasDatalinks(merged, "in2->B.inputlist", "in1->A.string1",
-				"in2->A.string2", "Merge0:Merge0_output->C.inputlist",
-				"A.output->a", "B.outputlist->b",
-				"B.outputlist->Merge0:outputlistToMerge0_input0",
-				"A.output->Merge0:outputToMerge0_input0", "C.outputlist->c",
-				"i->P.inputlist", "P.outputlist->o");
-		assertHasConditionals(merged, "A;B");
-	}
-
-	private void checkCopiedFromP(Workflow merged) {
-		Processor newProcP = findProcessor(merged, "P");
-		Processor originalProcP = findProcessor(p, "P");
-		assertNotSame("Did not copy processor P", newProcP, originalProcP);
-
-		InputProcessorPort inp = newProcP.getInputPorts().first();
-		InputWorkflowPort newInI = findInputPort(merged, "i");
-		assertEquals(0, newInI.getDepth().intValue());
-
-		InputWorkflowPort originalInI = findInputPort(p, "i");
-		assertNotSame("Did not copy port 'i'", originalInI, newInI);
-
-		List<DataLink> datalinksTo = scufl2Tools.datalinksTo(inp);
-		assertEquals(1, datalinksTo.size());
-		SenderPort source = datalinksTo.get(0).getReceivesFrom();
-
-		assertSame("Not linked to new port", source, newInI);
-		assertNotSame("Still linked to old port", source, originalInI);
-	}
-
-
-	@Test
-	public void mergeAbcAndPIntoNew() throws Exception {
-		Workflow merged = new Workflow();
-		DataflowMerger merger = new DataflowMerger(merged);
-		merger.getMergeEdit(abc).doEdit();
-
-		assertNotSame(abc, merged);
-		merger.getMergeEdit(p).doEdit();
-
-
-		// Assert abc and p were not modified
-		checkAbc();
-		checkP();
-
-		checkMergedAbcP(merged);
-		checkCopiedFromP(merged);
-	}
-
-	@Test
-	public void mergePintoAbc() throws Exception {
-		DataflowMerger merger = new DataflowMerger(abc);
-		Workflow merged = abc;
-
-		merger.getMergeEdit(p).doEdit();
-		checkMergedAbcP(merged);
-		checkCopiedFromP(merged);
-		// Assert P did not change
-		checkP();
-	}
-
-	@Test
-	public void mergeAbcintoP() throws Exception {
-		Workflow merged = p;
-		DataflowMerger merger = new DataflowMerger(merged);
-		merger.getMergeEdit(abc).doEdit();
-
-		checkMergedAbcP(merged);
-		// Assert ABC did not change
-		checkAbc();
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-dataflow-activity-ui/src/test/java/net/sf/taverna/t2/workbench/file/importworkflow/TestTestHelper.java
----------------------------------------------------------------------
diff --git a/taverna-dataflow-activity-ui/src/test/java/net/sf/taverna/t2/workbench/file/importworkflow/TestTestHelper.java b/taverna-dataflow-activity-ui/src/test/java/net/sf/taverna/t2/workbench/file/importworkflow/TestTestHelper.java
deleted file mode 100644
index 2165a67..0000000
--- a/taverna-dataflow-activity-ui/src/test/java/net/sf/taverna/t2/workbench/file/importworkflow/TestTestHelper.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package net.sf.taverna.t2.workbench.file.importworkflow;
-
-import org.junit.Ignore;
-import org.junit.Test;
-
-@Ignore
-public class TestTestHelper extends AbstractTestHelper {
-
-	@Test
-	public void checkAbc() throws Exception {
-		super.checkAbc();
-	}
-
-	@Test
-	public void checkP() throws Exception {
-		super.checkP();
-	}
-
-	@Test
-	public void checkQ() throws Exception {
-		super.checkQ();
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-dataflow-activity-ui/src/test/java/net/sf/taverna/t2/workbench/file/importworkflow/gui/ImportWizardLauncher.java
----------------------------------------------------------------------
diff --git a/taverna-dataflow-activity-ui/src/test/java/net/sf/taverna/t2/workbench/file/importworkflow/gui/ImportWizardLauncher.java b/taverna-dataflow-activity-ui/src/test/java/net/sf/taverna/t2/workbench/file/importworkflow/gui/ImportWizardLauncher.java
deleted file mode 100644
index b45a774..0000000
--- a/taverna-dataflow-activity-ui/src/test/java/net/sf/taverna/t2/workbench/file/importworkflow/gui/ImportWizardLauncher.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package net.sf.taverna.t2.workbench.file.importworkflow.gui;
-
-import javax.swing.UIManager;
-
-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;
-
-
-public class ImportWizardLauncher {
-
-	public static void main(String[] args) throws Exception {
-
-		UIManager.setLookAndFeel(UIManager
-				.getSystemLookAndFeelClassName());
-
-		EditManager editManager = new EditManagerImpl();
-		FileManager fileManager = new FileManagerImpl(editManager);
-
-		ImportWorkflowWizard s = new ImportWorkflowWizard(null, editManager, fileManager, null, null, null, null);
-		s.setVisible(true);
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-dataflow-activity-ui/src/test/java/org/apache/taverna/workbench/file/importworkflow/AbstractTestHelper.java
----------------------------------------------------------------------
diff --git a/taverna-dataflow-activity-ui/src/test/java/org/apache/taverna/workbench/file/importworkflow/AbstractTestHelper.java b/taverna-dataflow-activity-ui/src/test/java/org/apache/taverna/workbench/file/importworkflow/AbstractTestHelper.java
new file mode 100644
index 0000000..2e4dde5
--- /dev/null
+++ b/taverna-dataflow-activity-ui/src/test/java/org/apache/taverna/workbench/file/importworkflow/AbstractTestHelper.java
@@ -0,0 +1,266 @@
+package org.apache.taverna.workbench.file.importworkflow;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.io.InputStream;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.junit.Before;
+
+import org.apache.taverna.scufl2.api.common.Scufl2Tools;
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+import org.apache.taverna.scufl2.api.core.BlockingControlLink;
+import org.apache.taverna.scufl2.api.core.ControlLink;
+import org.apache.taverna.scufl2.api.core.DataLink;
+import org.apache.taverna.scufl2.api.core.Processor;
+import org.apache.taverna.scufl2.api.core.Workflow;
+import org.apache.taverna.scufl2.api.io.WorkflowBundleIO;
+import org.apache.taverna.scufl2.api.port.InputWorkflowPort;
+import org.apache.taverna.scufl2.api.port.OutputWorkflowPort;
+import org.apache.taverna.scufl2.api.port.ProcessorPort;
+import org.apache.taverna.scufl2.api.port.ReceiverPort;
+import org.apache.taverna.scufl2.api.port.SenderPort;
+
+public abstract class AbstractTestHelper {
+
+	private static final String Q_T2FLOW = "/q.t2flow";
+
+	private static final String ABC_T2FLOW = "/abc.t2flow";
+
+	private static final String P_T2FLOW = "/p.t2flow";
+
+	private WorkflowBundleIO workflowBundleIO = new WorkflowBundleIO();
+
+	protected Scufl2Tools scufl2Tools = new Scufl2Tools();
+
+	protected Workflow abc;
+
+	protected Workflow p;
+
+	protected Workflow q;
+
+	protected void assertHasConditionals(Workflow dataflow,
+			String... expectedConditionalDef) {
+		Set<String> expectedConditionals = new HashSet<String>();
+		for (String expected : expectedConditionalDef) {
+			expectedConditionals.add(expected);
+		}
+
+		Set<String> foundConditionals = new HashSet<String>();
+
+		for (ControlLink c : dataflow.getControlLinks()) {
+			if (c instanceof BlockingControlLink) {
+			BlockingControlLink bcl = (BlockingControlLink) c;
+			foundConditionals.add(bcl.getUntilFinished().getName() + ";"
+					+ bcl.getBlock().getName());
+			}
+		}
+
+		Set<String> extras = new HashSet<String>(foundConditionals);
+		extras.removeAll(expectedConditionals);
+		assertTrue("Unexpected conditional  " + extras, extras.isEmpty());
+
+		Set<String> missing = new HashSet<String>(expectedConditionals);
+		missing.removeAll(foundConditionals);
+		assertTrue("Could not find conditional  " + missing, missing.isEmpty());
+	}
+
+	protected void assertHasDatalinks(Workflow dataflow,
+			String... expectedLinkDef) {
+		Set<String> expectedLinks = new HashSet<String>();
+		for (String expected : expectedLinkDef) {
+			expectedLinks.add(expected);
+		}
+
+		Set<String> foundLinks = new HashSet<String>();
+
+		for (DataLink link : dataflow.getDataLinks()) {
+			StringBuilder linkRef = new StringBuilder();
+			SenderPort source = link.getReceivesFrom();
+			if (source instanceof ProcessorPort) {
+				linkRef.append(((ProcessorPort) source).getParent()
+						.getName());
+				linkRef.append('.');
+			}
+			linkRef.append(source.getName());
+
+			linkRef.append("->");
+
+			ReceiverPort sink = link.getSendsTo();
+			if (sink instanceof ProcessorPort) {
+				linkRef.append(((ProcessorPort) sink).getParent()
+						.getName());
+				linkRef.append('.');
+			}
+			linkRef.append(sink.getName());
+
+			String linkStr = linkRef.toString();
+			foundLinks.add(linkStr);
+		}
+
+		Set<String> extras = new HashSet<String>(foundLinks);
+		extras.removeAll(expectedLinks);
+		assertTrue("Unexpected links  " + extras, extras.isEmpty());
+
+		Set<String> missing = new HashSet<String>(expectedLinks);
+		missing.removeAll(foundLinks);
+		assertTrue("Could not find links  " + missing, missing.isEmpty());
+	}
+
+	protected void assertHasInputPorts(Workflow dataflow,
+			String... expectedInputPorts) {
+		Set<String> expectedNames = new HashSet<String>();
+		for (String expected : expectedInputPorts) {
+			expectedNames.add(expected);
+		}
+		Set<String> foundNames = new HashSet<String>();
+		for (InputWorkflowPort port : dataflow.getInputPorts()) {
+			String name = port.getName();
+			foundNames.add(name);
+		}
+
+		Set<String> extras = new HashSet<String>(foundNames);
+		extras.removeAll(expectedNames);
+		assertTrue("Unexpected input port  " + extras, extras.isEmpty());
+
+		Set<String> missing = new HashSet<String>(expectedNames);
+		missing.removeAll(foundNames);
+		assertTrue("Could not find input port  " + missing, missing.isEmpty());
+
+	}
+
+	protected void assertHasOutputPorts(Workflow dataflow,
+			String... expectedOutputPorts) {
+		Set<String> expectedNames = new HashSet<String>();
+		for (String expected : expectedOutputPorts) {
+			expectedNames.add(expected);
+		}
+		Set<String> foundNames = new HashSet<String>();
+		for (OutputWorkflowPort port : dataflow.getOutputPorts()) {
+			String name = port.getName();
+			foundNames.add(name);
+		}
+
+		Set<String> extras = new HashSet<String>(foundNames);
+		extras.removeAll(expectedNames);
+		assertTrue("Unexpected output port  " + extras, extras.isEmpty());
+
+		Set<String> missing = new HashSet<String>(expectedNames);
+		missing.removeAll(foundNames);
+		assertTrue("Could not find output port  " + missing, missing.isEmpty());
+	}
+
+	protected void assertHasProcessors(Workflow dataflow,
+			String... expectedProcessors) {
+		Set<String> expectedNames = new HashSet<String>();
+		for (String expected : expectedProcessors) {
+			expectedNames.add(expected);
+		}
+		Set<String> foundNames = new HashSet<String>();
+
+		for (Processor proc : dataflow.getProcessors()) {
+			String processorName = proc.getName();
+			foundNames.add(processorName);
+		}
+
+		Set<String> extras = new HashSet<String>(foundNames);
+		extras.removeAll(expectedNames);
+		assertTrue("Unexpected processor  " + extras, extras.isEmpty());
+
+		Set<String> missing = new HashSet<String>(expectedNames);
+		missing.removeAll(foundNames);
+		assertTrue("Could not find processor  " + missing, missing.isEmpty());
+	}
+
+	protected void checkAbc() throws Exception {
+		assertHasProcessors(abc, "A", "B", "C");
+		assertHasInputPorts(abc, "in1", "in2");
+		assertHasOutputPorts(abc, "a", "b", "c");
+		assertHasDatalinks(abc, "in2->B.inputlist", "in1->A.string1",
+				"in2->A.string2", "Merge0:Merge0_output->C.inputlist",
+				"A.output->a", "B.outputlist->b",
+				"B.outputlist->Merge0:outputlistToMerge0_input0",
+				"A.output->Merge0:outputToMerge0_input0", "C.outputlist->c");
+		assertHasConditionals(abc, "A;B");
+	}
+
+	protected void checkP() throws Exception {
+		assertHasProcessors(p, "P");
+		assertHasInputPorts(p, "i");
+		assertHasOutputPorts(p, "o");
+		assertHasDatalinks(p, "i->P.inputlist", "P.outputlist->o");
+		assertHasConditionals(p);
+
+	}
+
+	protected void checkQ() throws Exception {
+		assertHasProcessors(q, "Q");
+		assertHasInputPorts(q, "p");
+		assertHasOutputPorts(q, "p", "q");
+		assertHasDatalinks(q, "p->Q.inputlist", "Q.outputlist->q", "p->p");
+		assertHasConditionals(q);
+
+		List<DataLink> datalinksTo = scufl2Tools.datalinksTo(findOutputPort(q, "p"));
+		assertEquals(1, datalinksTo.size());
+		SenderPort source = datalinksTo.get(0).getReceivesFrom();
+		assertEquals("out port P not linked to input P", source, findInputPort(q, "p"));
+
+	}
+
+	protected Workflow loadAbc() throws Exception {
+		return openWorkflow(getClass().getResourceAsStream(ABC_T2FLOW));
+	}
+
+	protected Workflow loadP() throws Exception {
+		return openWorkflow(getClass().getResourceAsStream(P_T2FLOW));
+	}
+
+	protected Workflow loadQ() throws Exception {
+		return openWorkflow(getClass().getResourceAsStream(Q_T2FLOW));
+	}
+
+	@Before
+	public void loadWorkflows() throws Exception {
+		abc = loadAbc();
+		p = loadP();
+		q = loadQ();
+	}
+
+	protected Workflow openWorkflow(InputStream workflowXMLstream) throws Exception {
+		assertNotNull(workflowXMLstream);
+		WorkflowBundle workflowBundle = workflowBundleIO.readBundle(workflowXMLstream, "application/vnd.taverna.t2flow+xml");
+		return workflowBundle.getMainWorkflow();
+	}
+
+	protected InputWorkflowPort findInputPort(Workflow wf, String name) {
+		for (InputWorkflowPort inp : wf.getInputPorts()) {
+			if (inp.getName().equals(name)) {
+				return inp;
+			}
+		}
+		throw new IllegalArgumentException("Unknown input port: " + name);
+	}
+
+	protected OutputWorkflowPort findOutputPort(Workflow wf, String name) {
+		for (OutputWorkflowPort outp : wf.getOutputPorts()) {
+			if (outp.getName().equals(name)) {
+				return outp;
+			}
+		}
+		throw new IllegalArgumentException("Unknown output port: " + name);
+	}
+
+	protected Processor findProcessor(Workflow wf, String name) {
+		for (Processor proc : wf.getProcessors()) {
+			if (proc.getName().equals(name)) {
+				return proc;
+			}
+		}
+		throw new IllegalArgumentException("Unknown processor: " + name);
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-dataflow-activity-ui/src/test/java/org/apache/taverna/workbench/file/importworkflow/TestPortMerge.java
----------------------------------------------------------------------
diff --git a/taverna-dataflow-activity-ui/src/test/java/org/apache/taverna/workbench/file/importworkflow/TestPortMerge.java b/taverna-dataflow-activity-ui/src/test/java/org/apache/taverna/workbench/file/importworkflow/TestPortMerge.java
new file mode 100644
index 0000000..9ccc3be
--- /dev/null
+++ b/taverna-dataflow-activity-ui/src/test/java/org/apache/taverna/workbench/file/importworkflow/TestPortMerge.java
@@ -0,0 +1,39 @@
+package org.apache.taverna.workbench.file.importworkflow;
+
+import org.apache.taverna.workbench.file.importworkflow.DataflowMerger;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertSame;
+
+import java.util.List;
+
+import org.junit.Ignore;
+import org.junit.Test;
+
+import org.apache.taverna.scufl2.api.core.DataLink;
+import org.apache.taverna.scufl2.api.core.Workflow;
+import org.apache.taverna.scufl2.api.port.SenderPort;
+
+@Ignore
+public class TestPortMerge extends AbstractTestHelper {
+
+	@Test
+	public void mergeQintoP() throws Exception {
+		DataflowMerger merger = new DataflowMerger(p);
+		merger.getMergeEdit(q).doEdit();
+		Workflow merged = p;
+		checkQ();
+
+		assertHasProcessors(merged, "P", "Q");
+		assertHasInputPorts(merged, "i", "p");
+		assertHasOutputPorts(merged, "o", "p", "q");
+		assertHasDatalinks(merged, "i->P.inputlist", "P.outputlist->o", "p->Q.inputlist",
+				"Q.outputlist->q", "p->p");
+
+		List<DataLink> datalinksTo = scufl2Tools.datalinksTo(findOutputPort(merged, "p"));
+		assertEquals(1, datalinksTo.size());
+		SenderPort source = datalinksTo.get(0).getReceivesFrom();
+		assertSame("out port P not linked to input P", source, findInputPort(merged, "p"));
+
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-dataflow-activity-ui/src/test/java/org/apache/taverna/workbench/file/importworkflow/TestRename.java
----------------------------------------------------------------------
diff --git a/taverna-dataflow-activity-ui/src/test/java/org/apache/taverna/workbench/file/importworkflow/TestRename.java b/taverna-dataflow-activity-ui/src/test/java/org/apache/taverna/workbench/file/importworkflow/TestRename.java
new file mode 100644
index 0000000..bae4b3b
--- /dev/null
+++ b/taverna-dataflow-activity-ui/src/test/java/org/apache/taverna/workbench/file/importworkflow/TestRename.java
@@ -0,0 +1,59 @@
+package org.apache.taverna.workbench.file.importworkflow;
+
+import org.apache.taverna.workbench.file.importworkflow.DataflowMerger;
+import org.junit.Ignore;
+import org.junit.Test;
+
+import org.apache.taverna.scufl2.api.core.Workflow;
+
+@Ignore
+public class TestRename extends AbstractTestHelper {
+
+	@Test
+	public void mergePintoP() throws Exception {
+		DataflowMerger merger = new DataflowMerger(p);
+		merger.getMergeEdit(p).doEdit();
+		Workflow merged = p;
+
+		assertHasProcessors(merged, "P", "P_2");
+		assertHasInputPorts(merged, "i", "i_2");
+		assertHasOutputPorts(merged, "o", "o_2");
+		assertHasDatalinks(merged, "i->P.inputlist", "P.outputlist->o",
+				"i_2->P_2.inputlist", "P_2.outputlist->o_2");
+	}
+
+	@Test
+	public void mergePintoPintoP() throws Exception {
+		// Don't put p in constructor, or we would get exponential merging!
+		Workflow merged = new Workflow();
+		DataflowMerger merger = new DataflowMerger(merged);
+		merger.getMergeEdit(p).doEdit();
+		merger.getMergeEdit(p).doEdit();
+		merger.getMergeEdit(p).doEdit();
+
+		assertHasProcessors(merged, "P", "P_2", "P_3");
+		assertHasInputPorts(merged, "i", "i_2", "i_3");
+		assertHasOutputPorts(merged, "o", "o_2", "o_3");
+		assertHasDatalinks(merged, "i->P.inputlist", "P.outputlist->o",
+				"i_2->P_2.inputlist", "P_2.outputlist->o_2",
+				"i_3->P_3.inputlist", "P_3.outputlist->o_3");
+	}
+
+	@Test
+	public void mergePintoPWithPrefix() throws Exception {
+		// Don't put p in constructor, or we would get exponential merging!
+		Workflow merged = new Workflow();
+		DataflowMerger merger = new DataflowMerger(merged);
+		merger.getMergeEdit(p).doEdit();
+		merger.getMergeEdit(p, "fish_").doEdit();
+		merger.getMergeEdit(p, "soup_").doEdit();
+
+		assertHasProcessors(merged, "P", "fish_P", "soup_P");
+		assertHasInputPorts(merged, "i", "fish_i", "soup_i");
+		assertHasOutputPorts(merged, "o", "fish_o", "soup_o");
+		assertHasDatalinks(merged, "i->P.inputlist", "P.outputlist->o",
+				"fish_i->fish_P.inputlist", "fish_P.outputlist->fish_o",
+				"soup_i->soup_P.inputlist", "soup_P.outputlist->soup_o");
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-dataflow-activity-ui/src/test/java/org/apache/taverna/workbench/file/importworkflow/TestSimpleMerge.java
----------------------------------------------------------------------
diff --git a/taverna-dataflow-activity-ui/src/test/java/org/apache/taverna/workbench/file/importworkflow/TestSimpleMerge.java b/taverna-dataflow-activity-ui/src/test/java/org/apache/taverna/workbench/file/importworkflow/TestSimpleMerge.java
new file mode 100644
index 0000000..7dc9f96
--- /dev/null
+++ b/taverna-dataflow-activity-ui/src/test/java/org/apache/taverna/workbench/file/importworkflow/TestSimpleMerge.java
@@ -0,0 +1,99 @@
+package org.apache.taverna.workbench.file.importworkflow;
+
+import org.apache.taverna.workbench.file.importworkflow.DataflowMerger;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotSame;
+import static org.junit.Assert.assertSame;
+
+import java.util.List;
+
+import org.junit.Ignore;
+import org.junit.Test;
+
+import org.apache.taverna.scufl2.api.core.DataLink;
+import org.apache.taverna.scufl2.api.core.Processor;
+import org.apache.taverna.scufl2.api.core.Workflow;
+import org.apache.taverna.scufl2.api.port.InputProcessorPort;
+import org.apache.taverna.scufl2.api.port.InputWorkflowPort;
+import org.apache.taverna.scufl2.api.port.SenderPort;
+
+@Ignore
+public class TestSimpleMerge extends AbstractTestHelper {
+
+	private void checkMergedAbcP(Workflow merged) {
+		// Check that it has everything from both
+		assertHasProcessors(merged, "A", "B", "C", "P");
+		assertHasInputPorts(merged, "in1", "in2", "i");
+		assertHasOutputPorts(merged, "a", "b", "c", "o");
+		assertHasDatalinks(merged, "in2->B.inputlist", "in1->A.string1",
+				"in2->A.string2", "Merge0:Merge0_output->C.inputlist",
+				"A.output->a", "B.outputlist->b",
+				"B.outputlist->Merge0:outputlistToMerge0_input0",
+				"A.output->Merge0:outputToMerge0_input0", "C.outputlist->c",
+				"i->P.inputlist", "P.outputlist->o");
+		assertHasConditionals(merged, "A;B");
+	}
+
+	private void checkCopiedFromP(Workflow merged) {
+		Processor newProcP = findProcessor(merged, "P");
+		Processor originalProcP = findProcessor(p, "P");
+		assertNotSame("Did not copy processor P", newProcP, originalProcP);
+
+		InputProcessorPort inp = newProcP.getInputPorts().first();
+		InputWorkflowPort newInI = findInputPort(merged, "i");
+		assertEquals(0, newInI.getDepth().intValue());
+
+		InputWorkflowPort originalInI = findInputPort(p, "i");
+		assertNotSame("Did not copy port 'i'", originalInI, newInI);
+
+		List<DataLink> datalinksTo = scufl2Tools.datalinksTo(inp);
+		assertEquals(1, datalinksTo.size());
+		SenderPort source = datalinksTo.get(0).getReceivesFrom();
+
+		assertSame("Not linked to new port", source, newInI);
+		assertNotSame("Still linked to old port", source, originalInI);
+	}
+
+
+	@Test
+	public void mergeAbcAndPIntoNew() throws Exception {
+		Workflow merged = new Workflow();
+		DataflowMerger merger = new DataflowMerger(merged);
+		merger.getMergeEdit(abc).doEdit();
+
+		assertNotSame(abc, merged);
+		merger.getMergeEdit(p).doEdit();
+
+
+		// Assert abc and p were not modified
+		checkAbc();
+		checkP();
+
+		checkMergedAbcP(merged);
+		checkCopiedFromP(merged);
+	}
+
+	@Test
+	public void mergePintoAbc() throws Exception {
+		DataflowMerger merger = new DataflowMerger(abc);
+		Workflow merged = abc;
+
+		merger.getMergeEdit(p).doEdit();
+		checkMergedAbcP(merged);
+		checkCopiedFromP(merged);
+		// Assert P did not change
+		checkP();
+	}
+
+	@Test
+	public void mergeAbcintoP() throws Exception {
+		Workflow merged = p;
+		DataflowMerger merger = new DataflowMerger(merged);
+		merger.getMergeEdit(abc).doEdit();
+
+		checkMergedAbcP(merged);
+		// Assert ABC did not change
+		checkAbc();
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-dataflow-activity-ui/src/test/java/org/apache/taverna/workbench/file/importworkflow/TestTestHelper.java
----------------------------------------------------------------------
diff --git a/taverna-dataflow-activity-ui/src/test/java/org/apache/taverna/workbench/file/importworkflow/TestTestHelper.java b/taverna-dataflow-activity-ui/src/test/java/org/apache/taverna/workbench/file/importworkflow/TestTestHelper.java
new file mode 100644
index 0000000..8442f88
--- /dev/null
+++ b/taverna-dataflow-activity-ui/src/test/java/org/apache/taverna/workbench/file/importworkflow/TestTestHelper.java
@@ -0,0 +1,24 @@
+package org.apache.taverna.workbench.file.importworkflow;
+
+import org.junit.Ignore;
+import org.junit.Test;
+
+@Ignore
+public class TestTestHelper extends AbstractTestHelper {
+
+	@Test
+	public void checkAbc() throws Exception {
+		super.checkAbc();
+	}
+
+	@Test
+	public void checkP() throws Exception {
+		super.checkP();
+	}
+
+	@Test
+	public void checkQ() throws Exception {
+		super.checkQ();
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-dataflow-activity-ui/src/test/java/org/apache/taverna/workbench/file/importworkflow/gui/ImportWizardLauncher.java
----------------------------------------------------------------------
diff --git a/taverna-dataflow-activity-ui/src/test/java/org/apache/taverna/workbench/file/importworkflow/gui/ImportWizardLauncher.java b/taverna-dataflow-activity-ui/src/test/java/org/apache/taverna/workbench/file/importworkflow/gui/ImportWizardLauncher.java
new file mode 100644
index 0000000..96f67bf
--- /dev/null
+++ b/taverna-dataflow-activity-ui/src/test/java/org/apache/taverna/workbench/file/importworkflow/gui/ImportWizardLauncher.java
@@ -0,0 +1,25 @@
+package org.apache.taverna.workbench.file.importworkflow.gui;
+
+import org.apache.taverna.workbench.file.importworkflow.gui.ImportWorkflowWizard;
+import javax.swing.UIManager;
+
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.edits.impl.EditManagerImpl;
+import org.apache.taverna.workbench.file.FileManager;
+import net.sf.taverna.t2.workbench.file.impl.FileManagerImpl;
+
+
+public class ImportWizardLauncher {
+
+	public static void main(String[] args) throws Exception {
+
+		UIManager.setLookAndFeel(UIManager
+				.getSystemLookAndFeelClassName());
+
+		EditManager editManager = new EditManagerImpl();
+		FileManager fileManager = new FileManagerImpl(editManager);
+
+		ImportWorkflowWizard s = new ImportWorkflowWizard(null, editManager, fileManager, null, null, null, null);
+		s.setVisible(true);
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-design-ui/src/main/java/net/sf/taverna/t2/workbench/design/actions/AddConditionAction.java
----------------------------------------------------------------------
diff --git a/taverna-design-ui/src/main/java/net/sf/taverna/t2/workbench/design/actions/AddConditionAction.java b/taverna-design-ui/src/main/java/net/sf/taverna/t2/workbench/design/actions/AddConditionAction.java
deleted file mode 100644
index c26a1d6..0000000
--- a/taverna-design-ui/src/main/java/net/sf/taverna/t2/workbench/design/actions/AddConditionAction.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*******************************************************************************
- * 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.design.actions;
-
-import java.awt.Component;
-import java.awt.event.ActionEvent;
-
-import net.sf.taverna.t2.workbench.activityicons.ActivityIconManager;
-import net.sf.taverna.t2.workbench.edits.EditException;
-import net.sf.taverna.t2.workbench.edits.EditManager;
-import net.sf.taverna.t2.workbench.selection.SelectionManager;
-import net.sf.taverna.t2.workflow.edits.AddChildEdit;
-
-import org.apache.log4j.Logger;
-
-import org.apache.taverna.scufl2.api.common.Scufl2Tools;
-import org.apache.taverna.scufl2.api.core.BlockingControlLink;
-import org.apache.taverna.scufl2.api.core.Processor;
-import org.apache.taverna.scufl2.api.core.Workflow;
-import org.apache.taverna.scufl2.api.profiles.ProcessorBinding;
-
-/**
- * Action for adding a condition to the dataflow.
- * 
- * @author David Withers
- */
-@SuppressWarnings("serial")
-public class AddConditionAction extends DataflowEditAction {
-	private static final Logger logger = Logger.getLogger(AddConditionAction.class);
-	private static final Scufl2Tools scufl2Tools = new Scufl2Tools();
-
-	private Processor control;
-	private Processor target;
-
-	public AddConditionAction(Workflow dataflow, Processor control,
-			Processor target, Component component, EditManager editManager,
-			SelectionManager selectionManager,
-			ActivityIconManager activityIconManager) {
-		super(dataflow, component, editManager, selectionManager);
-		this.control = control;
-		this.target = target;
-		ProcessorBinding processorBinding = scufl2Tools
-				.processorBindingForProcessor(control, dataflow.getParent()
-						.getMainProfile());
-		putValue(SMALL_ICON,
-				activityIconManager.iconForActivity(processorBinding
-						.getBoundActivity().getType()));
-		putValue(NAME, control.getName());
-	}
-
-	@Override
-	public void actionPerformed(ActionEvent event) {
-		try {
-			BlockingControlLink controlLink = new BlockingControlLink();
-			controlLink.setUntilFinished(control);
-			controlLink.setBlock(target);
-			editManager.doDataflowEdit(dataflow.getParent(),
-					new AddChildEdit<>(dataflow, controlLink));
-		} catch (EditException e) {
-			logger.debug("Create control link between '" + control.getName()
-					+ "' and '" + target.getName() + "' failed");
-		}
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-design-ui/src/main/java/net/sf/taverna/t2/workbench/design/actions/AddDataflowInputAction.java
----------------------------------------------------------------------
diff --git a/taverna-design-ui/src/main/java/net/sf/taverna/t2/workbench/design/actions/AddDataflowInputAction.java b/taverna-design-ui/src/main/java/net/sf/taverna/t2/workbench/design/actions/AddDataflowInputAction.java
deleted file mode 100644
index 36b6fcc..0000000
--- a/taverna-design-ui/src/main/java/net/sf/taverna/t2/workbench/design/actions/AddDataflowInputAction.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*******************************************************************************
- * 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.design.actions;
-
-import java.awt.Component;
-import java.awt.Dimension;
-import java.awt.event.ActionEvent;
-import java.util.HashSet;
-import java.util.Set;
-
-import net.sf.taverna.t2.lang.ui.ValidatingUserInputDialog;
-import net.sf.taverna.t2.workbench.design.ui.DataflowInputPortPanel;
-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.AddWorkflowInputPortEdit;
-
-import org.apache.log4j.Logger;
-
-import org.apache.taverna.scufl2.api.core.Workflow;
-import org.apache.taverna.scufl2.api.port.InputWorkflowPort;
-
-/**
- * Action for adding an input port to the dataflow.
- * 
- * @author David Withers
- */
-@SuppressWarnings("serial")
-public class AddDataflowInputAction extends DataflowEditAction {
-	private static final Logger logger = Logger
-			.getLogger(AddDataflowInputAction.class);
-
-	public AddDataflowInputAction(Workflow dataflow, Component component,
-			EditManager editManager, SelectionManager selectionManager) {
-		super(dataflow, component, editManager, selectionManager);
-		putValue(SMALL_ICON, WorkbenchIcons.inputIcon);
-		putValue(NAME, "Workflow input port");
-		putValue(SHORT_DESCRIPTION, "Add workflow input port");
-	}
-
-	@Override
-	public void actionPerformed(ActionEvent event) {
-		try {
-			Set<String> usedInputPorts = new HashSet<>();
-			for (InputWorkflowPort inputPort : dataflow.getInputPorts())
-				usedInputPorts.add(inputPort.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.",
-					"[\\p{L}\\p{Digit}_.]+",
-					"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(new Dimension(400, 250));
-
-			inputPanel.setPortDepth(0);
-
-			if (vuid.show(component)) {
-				InputWorkflowPort dataflowInputPort = new InputWorkflowPort();
-				dataflowInputPort.setName(inputPanel.getPortName());
-				dataflowInputPort.setDepth(inputPanel.getPortDepth());
-				editManager.doDataflowEdit(dataflow.getParent(),
-						new AddWorkflowInputPortEdit(dataflow,
-								dataflowInputPort));
-			}
-		} catch (EditException e) {
-			logger.warn("Adding a new workflow input port failed");
-		}
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-design-ui/src/main/java/net/sf/taverna/t2/workbench/design/actions/AddDataflowOutputAction.java
----------------------------------------------------------------------
diff --git a/taverna-design-ui/src/main/java/net/sf/taverna/t2/workbench/design/actions/AddDataflowOutputAction.java b/taverna-design-ui/src/main/java/net/sf/taverna/t2/workbench/design/actions/AddDataflowOutputAction.java
deleted file mode 100644
index a1783d5..0000000
--- a/taverna-design-ui/src/main/java/net/sf/taverna/t2/workbench/design/actions/AddDataflowOutputAction.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*******************************************************************************
- * 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.design.actions;
-
-import java.awt.Component;
-import java.awt.Dimension;
-import java.awt.event.ActionEvent;
-import java.util.HashSet;
-import java.util.Set;
-
-import net.sf.taverna.t2.lang.ui.ValidatingUserInputDialog;
-import net.sf.taverna.t2.workbench.design.ui.DataflowOutputPortPanel;
-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.AddWorkflowOutputPortEdit;
-
-import org.apache.log4j.Logger;
-
-import org.apache.taverna.scufl2.api.core.Workflow;
-import org.apache.taverna.scufl2.api.port.OutputWorkflowPort;
-
-/**
- * Action for adding an output port to the dataflow.
- * 
- * @author David Withers
- */
-@SuppressWarnings("serial")
-public class AddDataflowOutputAction extends DataflowEditAction {
-	private static final Logger logger = Logger
-			.getLogger(AddDataflowOutputAction.class);
-
-	public AddDataflowOutputAction(Workflow dataflow, Component component,
-			EditManager editManager, SelectionManager selectionManager) {
-		super(dataflow, component, editManager, selectionManager);
-		putValue(SMALL_ICON, WorkbenchIcons.outputIcon);
-		putValue(NAME, "Workflow output port");
-		putValue(SHORT_DESCRIPTION, "Add workflow output port");
-	}
-
-	@Override
-	public void actionPerformed(ActionEvent event) {
-		try {
-			Set<String> usedOutputPorts = new HashSet<>();
-			for (OutputWorkflowPort outputPort : dataflow.getOutputPorts())
-				usedOutputPorts.add(outputPort.getName());
-
-			DataflowOutputPortPanel inputPanel = new DataflowOutputPortPanel();
-
-			ValidatingUserInputDialog vuid = new ValidatingUserInputDialog(
-					"Add Workflow Output Port", inputPanel);
-			vuid.addTextComponentValidation(inputPanel.getPortNameField(),
-					"Set the workflow output port name.", usedOutputPorts,
-					"Duplicate workflow output port name.",
-					"[\\p{L}\\p{Digit}_.]+",
-					"Invalid workflow output port name.");
-			vuid.setSize(new Dimension(400, 200));
-
-			if (vuid.show(component)) {
-				String portName = inputPanel.getPortName();
-				OutputWorkflowPort dataflowOutputPort = new OutputWorkflowPort();
-				dataflowOutputPort.setName(portName);
-				editManager.doDataflowEdit(dataflow.getParent(),
-						new AddWorkflowOutputPortEdit(dataflow,
-								dataflowOutputPort));
-			}
-		} catch (EditException e) {
-			logger.debug("Create workflow output port failed", e);
-		}
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-design-ui/src/main/java/net/sf/taverna/t2/workbench/design/actions/DataflowEditAction.java
----------------------------------------------------------------------
diff --git a/taverna-design-ui/src/main/java/net/sf/taverna/t2/workbench/design/actions/DataflowEditAction.java b/taverna-design-ui/src/main/java/net/sf/taverna/t2/workbench/design/actions/DataflowEditAction.java
deleted file mode 100644
index dc6300d..0000000
--- a/taverna-design-ui/src/main/java/net/sf/taverna/t2/workbench/design/actions/DataflowEditAction.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * 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.design.actions;
-
-import java.awt.Component;
-
-import javax.swing.AbstractAction;
-
-import net.sf.taverna.t2.workbench.edits.EditManager;
-import net.sf.taverna.t2.workbench.selection.DataflowSelectionModel;
-import net.sf.taverna.t2.workbench.selection.SelectionManager;
-import org.apache.taverna.scufl2.api.common.Scufl2Tools;
-import org.apache.taverna.scufl2.api.core.Workflow;
-
-/**
- * Abstract superclass of dataflow edit actions.
- * 
- * @author David Withers
- */
-public abstract class DataflowEditAction extends AbstractAction {
-	private static final long serialVersionUID = -1155192575675025091L;
-
-	protected final SelectionManager selectionManager;
-	protected EditManager editManager;
-	protected DataflowSelectionModel dataflowSelectionModel;
-	protected Workflow dataflow;
-	protected Component component;
-	protected Scufl2Tools scufl2Tools = new Scufl2Tools();
-
-	public DataflowEditAction(Workflow dataflow, Component component,
-			EditManager editManager, SelectionManager selectionManager) {
-		this.dataflow = dataflow;
-		this.component = component;
-		this.editManager = editManager;
-		this.selectionManager = selectionManager;
-		dataflowSelectionModel = selectionManager
-				.getDataflowSelectionModel(dataflow.getParent());
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-design-ui/src/main/java/net/sf/taverna/t2/workbench/design/actions/EditDataflowInputPortAction.java
----------------------------------------------------------------------
diff --git a/taverna-design-ui/src/main/java/net/sf/taverna/t2/workbench/design/actions/EditDataflowInputPortAction.java b/taverna-design-ui/src/main/java/net/sf/taverna/t2/workbench/design/actions/EditDataflowInputPortAction.java
deleted file mode 100644
index 77be3a3..0000000
--- a/taverna-design-ui/src/main/java/net/sf/taverna/t2/workbench/design/actions/EditDataflowInputPortAction.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/*******************************************************************************
- * 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.design.actions;
-
-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 net.sf.taverna.t2.lang.ui.ValidatingUserInputDialog;
-import net.sf.taverna.t2.workbench.design.ui.DataflowInputPortPanel;
-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.ChangeDepthEdit;
-import net.sf.taverna.t2.workflow.edits.RenameEdit;
-
-import org.apache.log4j.Logger;
-
-import org.apache.taverna.scufl2.api.core.Workflow;
-import org.apache.taverna.scufl2.api.port.InputWorkflowPort;
-
-/**
- * Action for editing a dataflow input port.
- * 
- * @author David Withers
- */
-@SuppressWarnings("serial")
-public class EditDataflowInputPortAction extends DataflowEditAction {
-	private static Logger logger = Logger
-			.getLogger(EditDataflowInputPortAction.class);
-
-	private InputWorkflowPort port;
-
-	public EditDataflowInputPortAction(Workflow dataflow,
-			InputWorkflowPort port, Component component,
-			EditManager editManager, SelectionManager selectionManager) {
-		super(dataflow, component, editManager, selectionManager);
-		this.port = port;
-		putValue(SMALL_ICON, WorkbenchIcons.renameIcon);
-		putValue(NAME, "Edit workflow input port...");
-	}
-
-	@Override
-	public void actionPerformed(ActionEvent e) {
-		Set<String> usedInputPorts = new HashSet<>();
-		for (InputWorkflowPort usedInputPort : dataflow.getInputPorts())
-			if (!usedInputPort.getName().equals(port.getName()))
-				usedInputPorts.add(usedInputPort.getName());
-
-		DataflowInputPortPanel inputPanel = new DataflowInputPortPanel();
-
-		ValidatingUserInputDialog vuid = new ValidatingUserInputDialog(
-				"Edit Workflow Input Port", inputPanel);
-		vuid.addTextComponentValidation(inputPanel.getPortNameField(),
-				"Set the workflow input port name.", usedInputPorts,
-				"Duplicate workflow input port name.", "[\\p{L}\\p{Digit}_.]+",
-				"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(new Dimension(400, 250));
-
-		inputPanel.setPortName(port.getName());
-		inputPanel.setPortDepth(port.getDepth());
-
-		try {
-			if (vuid.show(component))
-				changeInputPort(inputPanel);
-		} catch (EditException e1) {
-			logger.warn("Rename workflow input port failed", e1);
-		}
-	}
-
-	private void changeInputPort(DataflowInputPortPanel inputPanel)
-			throws EditException {
-		List<Edit<?>> editList = new ArrayList<>();
-		String portName = inputPanel.getPortName();
-		if (!portName.equals(port.getName()))
-			editList.add(new RenameEdit<>(port, portName));
-		int portDepth = inputPanel.getPortDepth();
-		if (portDepth != port.getDepth())
-			editList.add(new ChangeDepthEdit<>(port, portDepth));
-		if (editList.size() == 1)
-			editManager.doDataflowEdit(dataflow.getParent(), editList.get(0));
-		else if (editList.size() > 1)
-			editManager.doDataflowEdit(dataflow.getParent(), new CompoundEdit(
-					editList));
-	}
-}


[20/51] [partial] incubator-taverna-workbench git commit: all packages are moved to org.apache.taverna.*

Posted by re...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-file-api/src/main/java/net/sf/taverna/t2/workbench/file/FileManager.java
----------------------------------------------------------------------
diff --git a/taverna-file-api/src/main/java/net/sf/taverna/t2/workbench/file/FileManager.java b/taverna-file-api/src/main/java/net/sf/taverna/t2/workbench/file/FileManager.java
deleted file mode 100644
index 299cdad..0000000
--- a/taverna-file-api/src/main/java/net/sf/taverna/t2/workbench/file/FileManager.java
+++ /dev/null
@@ -1,573 +0,0 @@
-/*******************************************************************************
- * 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.file;
-
-import java.io.File;
-import java.io.IOException;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.util.List;
-
-import javax.swing.filechooser.FileFilter;
-
-import org.apache.taverna.lang.observer.Observable;
-import org.apache.taverna.lang.observer.Observer;
-import net.sf.taverna.t2.workbench.file.events.ClosedDataflowEvent;
-import net.sf.taverna.t2.workbench.file.events.FileManagerEvent;
-import net.sf.taverna.t2.workbench.file.events.OpenedDataflowEvent;
-import net.sf.taverna.t2.workbench.file.events.SavedDataflowEvent;
-import net.sf.taverna.t2.workbench.file.exceptions.OpenException;
-import net.sf.taverna.t2.workbench.file.exceptions.OverwriteException;
-import net.sf.taverna.t2.workbench.file.exceptions.SaveException;
-import net.sf.taverna.t2.workbench.file.exceptions.UnsavedException;
-import org.apache.taverna.scufl2.api.container.WorkflowBundle;
-
-/**
- * Manager of open files (WorkflowBundleBundles) in the workbench.
- * <p>
- * A {@link WorkflowBundle} can be opened for the workbench using
- * {@link #openDataflow(FileType, Object)} or {@link #openDataflow(WorkflowBundle)}.
- * {@link Observer}s of the FileManager gets notified with an
- * {@link OpenedDataflowEvent}. The opened workflow is also
- * {@link #setCurrentDataflow(WorkflowBundle) made the current dataflow}, available
- * through {@link #getCurrentDataflow()} or by observing the
- * {@link net.sf.taverna.t2.lang.ui.ModelMap} for the model name
- * {@link net.sf.taverna.t2.workbench.ModelMapConstants#CURRENT_DATAFLOW}.
- * <p>
- * A dataflow can be saved using
- * {@link #saveDataflow(WorkflowBundle, FileType, Object, boolean)}. Observers will be
- * presented a {@link SavedDataflowEvent}.
- * <p>
- * If a dataflow was previously opened from a saveable destination or previously
- * saved using {@link #saveDataflow(WorkflowBundle, FileType, Object, boolean)},
- * {@link #saveDataflow(WorkflowBundle, boolean)} can be used to resave to that
- * destination.
- * <p>
- * You can get the last opened/saved source and type using
- * {@link #getDataflowSource(WorkflowBundle)} and {@link #getDataflowType(WorkflowBundle)}.
- * <p>
- * If the save methods are used with failOnOverwrite=true, an
- * {@link OverwriteException} will be thrown if the destination file already
- * exists and was not last written by a previous save on that dataflow. (This is
- * typically checked using timestamps on the file).
- * <p>
- * A dataflow can be closed using {@link #closeDataflow(WorkflowBundle, boolean)}. A
- * closed dataflow is no longer monitored for changes and can no longer be used
- * with the other operations, except {@link #openDataflow(WorkflowBundle)}.
- * <p>
- * If a dataflow has been changed using the {@link EditManager},
- * {@link #isDataflowChanged(WorkflowBundle)} will return true until the next save. If
- * the close methods are used with failOnUnsaved=true, an
- * {@link UnsavedException} will be thrown if the dataflow has been changed.
- * <p>
- * The implementation of this interface is an OSGi Service.
- *
- * @author Stian Soiland-Reyes
- */
-public interface FileManager extends Observable<FileManagerEvent> {
-	/**
-	 * True if {@link #saveDataflow(WorkflowBundle, boolean)} can save the
-	 * workflow, i.e., that there exists an SPI implementation of
-	 * {@link DataflowPersistenceHandler} that can save to
-	 * {@link #getDataflowSource(WorkflowBundle)} using
-	 * {@link #getDataflowType(WorkflowBundle)}.
-	 * 
-	 * @see #saveDataflow(WorkflowBundle, boolean)
-	 * @param dataflow
-	 *            The dataflow to check
-	 * @return <code>true</code> if the given dataflow can be saved without
-	 *         providing a destination and filetype
-	 */
-	boolean canSaveWithoutDestination(WorkflowBundle dataflow);
-
-	/**
-	 * Close the specified dataflow.
-	 * <p>
-	 * A closed dataflow can no longer be used with the save methods, and will
-	 * disappear from the UI's list of open dataflows.
-	 * <p>
-	 * If no more dataflows would be open after the close, a new empty dataflow
-	 * is opened as through {@link #newDataflow()}.
-	 * <p>
-	 * If the failOnUnsaved parameters is <code>true</code>, and
-	 * {@link #isDataflowChanged(WorkflowBundle)} is <code>true</code>, an
-	 * {@link UnsavedException} will be thrown, typically because the workflow
-	 * has been changed using the {@link EditManager} since the last change.
-	 * <p>
-	 * Listeners registered using {@link Observable#addObserver(Observer)} will
-	 * be notified with an {@link ClosedDataflowEvent}.
-	 *
-	 * @param dataflow
-	 *            {@link WorkflowBundle} to close
-	 * @param failOnUnsaved
-	 *            If <code>true</code>, fail on unsaved changes
-	 * @throws UnsavedException
-	 *             If failOnUnsaved was <code>true</code> and there has been
-	 *             changes to the dataflow since the last save
-	 */
-	boolean closeDataflow(WorkflowBundle dataflow, boolean failOnUnsaved)
-			throws UnsavedException;
-
-	/**
-	 * Get the current dataflow.
-	 * <p>
-	 * The current workflow is typically the one currently showed on the screen,
-	 * and is also in {@link #getOpenDataflows()}.
-	 * <p>
-	 * The current dataflow is set through {@link #setCurrentDataflow(WorkflowBundle)}
-	 * or the {@link net.sf.taverna.t2.lang.ui.ModelMap} using the key
-	 * {@link net.sf.taverna.t2.workbench.ModelMapConstants#CURRENT_DATAFLOW}.
-	 *
-	 * @return The current dataflow, or <code>null</code> if no dataflow is
-	 *         current
-	 */
-	WorkflowBundle getCurrentDataflow();
-
-	/**
-	 * Get the dataflow that was opened from or last saved to the given source.
-	 *
-	 * @param source
-	 *            The source as opened with or saved to
-	 *            {@link #openDataflow(FileType, Object)}
-	 * @return The opened {@link WorkflowBundle} or <code>null</code> if no matching
-	 *         dataflow found.
-	 */
-	WorkflowBundle getDataflowBySource(Object source);
-
-	/**
-	 * Get a name to represent this dataflow.
-	 * <p>
-	 * The name will primarily be deduced from the source of where the workflow
-	 * is opened from, unless {@link Object#toString()} is not overridden (for
-	 * instance opened from an InputStream) or if the source is unknown, in
-	 * which case the dataflow's internal name {@link WorkflowBundle#getName()}
-	 * is returned.
-	 * <p>
-	 * The returned name can be used in listings like the WorkflowBundles menu, but is
-	 * not guaranteed to be unique. (For instance a workflow could be opened
-	 * twice from the same source).
-	 *
-	 * @param dataflow
-	 *            WorkflowBundle to get the name for
-	 * @return The deduced workflow name
-	 */
-	String getDataflowName(WorkflowBundle dataflow);
-
-	/**
-	 * Returns the default name to use when creating new workflows.
-	 *
-	 * @return the default name to use when creating new workflows
-	 */
-	String getDefaultWorkflowName();
-
-	/**
-	 * Get the last opened/saved source/destination for the given dataflow.
-	 * <p>
-	 * The source is the last source used with
-	 * {@link #saveDataflow(WorkflowBundle, FileType, Object, boolean)} for the given
-	 * dataflow, or {@link #openDataflow(FileType, Object)} if it has not yet
-	 * been saved.
-	 * <p>
-	 * If the given dataflow's last opened/saved location was unknown (opened
-	 * with {@link #newDataflow()} or {@link #openDataflow(WorkflowBundle)}), return
-	 * <code>null</code>.
-	 *
-	 * @param dataflow
-	 *            {@link WorkflowBundle} which file is to be returned
-	 * @return The last opened/saved source for the given dataflow, or
-	 *         <code>null</code> if unknown.
-	 */
-	Object getDataflowSource(WorkflowBundle dataflow);
-
-	/**
-	 * Get the last opened/saved source/destination FileType for the given
-	 * dataflow.
-	 * <p>
-	 * The type is the last {@link FileType} used with
-	 * {@link #saveDataflow(WorkflowBundle, FileType, Object, boolean)} for the given
-	 * dataflow, or {@link #openDataflow(FileType, Object)} if it has not yet
-	 * been saved.
-	 * <p>
-	 * If the given dataflow's last opened/saved file type was unknown (opened
-	 * with {@link #newDataflow()} or {@link #openDataflow(WorkflowBundle)}), return
-	 * <code>null</code>.
-	 *
-	 * @param dataflow
-	 *            {@link WorkflowBundle} which file is to be returned
-	 * @return The last opened/saved {@link FileType} for the given dataflow, or
-	 *         <code>null</code> if unknown.
-	 */
-	FileType getDataflowType(WorkflowBundle dataflow);
-
-	/**
-	 * Get the list of currently open dataflows. This list of dataflows are
-	 * typically displayed in the UI in the "WorkflowBundles" menu to allow switching
-	 * the {@link #getCurrentDataflow() current dataflow}.
-	 *
-	 * @return A copy of the {@link List} of open {@link WorkflowBundle}s
-	 */
-	List<WorkflowBundle> getOpenDataflows();
-
-	/**
-	 * Get a list of {@link FileFilter}s for supported {@link FileType}s that
-	 * can be opened with any source class.
-	 *
-	 * @return A {@link List} of {@link FileFilter}s supported by
-	 *         {@link #openDataflow(FileType, Object)}
-	 */
-	List<FileFilter> getOpenFileFilters();
-
-	/**
-	 * Get a list of {@link FileFilter}s for supported {@link FileType}s that
-	 * can be opened with given source class.
-	 *
-	 * @param sourceClass
-	 *            Source class that can be opened from
-	 * @return A {@link List} of {@link FileFilter}s supported by
-	 *         {@link #openDataflow(FileType, Object)}
-	 */
-	List<FileFilter> getOpenFileFilters(Class<?> sourceClass);
-
-	/**
-	 * Get a list of {@link FileFilter}s for supported {@link FileType}s that
-	 * can be saved to any destination class.
-	 *
-	 * @return A {@link List} of {@link FileFilter}s supported by
-	 *         {@link #saveDataflow(WorkflowBundle, FileType, Object, boolean)}
-	 */
-	List<FileFilter> getSaveFileFilters();
-
-	/**
-	 * Get a list of {@link FileFilter}s for supported {@link FileType}s that
-	 * can be saved to the given destination class.
-	 *
-	 * @param destinationClass
-	 *            Destination class that can be saved to
-	 * @return A {@link List} of {@link FileFilter}s supported by
-	 *         {@link #saveDataflow(WorkflowBundle, FileType, Object, boolean)}
-	 */
-	List<FileFilter> getSaveFileFilters(Class<?> destinationClass);
-
-	/**
-	 * Return <code>true</code> if the dataflow has been changed (through the
-	 * {@link EditManager} or {@link #setDataflowChanged(WorkflowBundle, boolean)})
-	 * since last save.
-	 *
-	 * @param dataflow
-	 *            WorkflowBundle which changed status is to be checked
-	 * @return <code>true</code> if the dataflow has been changed since last
-	 *         save.
-	 */
-	boolean isDataflowChanged(WorkflowBundle dataflow);
-
-	/**
-	 * True if the given dataflow has been opened and is in
-	 * {@link #getOpenDataflows()}.
-	 *
-	 * @param dataflow
-	 *            Dataflow to check
-	 * @return <code>true</code> if dataflow is open
-	 */
-	boolean isDataflowOpen(WorkflowBundle dataflow);
-
-	/**
-	 * Create and open a new, blank dataflow. The dataflow will not initially be
-	 * marked as changed.
-	 * <p>
-	 * Listeners registered using {@link Observable#addObserver(Observer)} will
-	 * be notified with an {@link OpenedDataflowEvent}.
-	 * <p>
-	 * Note, if the dataflow is later changed, it will not be possible to save
-	 * it to any original location using
-	 * {@link #saveDataflow(WorkflowBundle, boolean)}, only
-	 * {@link #saveDataflow(WorkflowBundle, FileType, Object, boolean)}.
-	 *
-	 * @return The newly opened blank {@link WorkflowBundle}
-	 */
-	WorkflowBundle newDataflow();
-
-	/**
-	 * Open a {@link WorkflowBundle} instance that has been created outside the
-	 * {@link FileManager}. The dataflow will not initially be marked as
-	 * changed.
-	 * <p>
-	 * Listeners registered using {@link Observable#addObserver(Observer)} will
-	 * be notified with an {@link OpenedDataflowEvent}.
-	 * <p>
-	 * Note, if the dataflow is later changed, it will not be possible to save
-	 * it to its original location using
-	 * {@link #saveDataflow(WorkflowBundle, boolean)}, only
-	 * {@link #saveDataflow(WorkflowBundle, FileType, Object, boolean)}.
-	 * <p>
-	 * Instead of using this option it is recommended to create your own
-	 * {@link FileType} and/or source type and a
-	 * {@link DataflowPersistenceHandler} to implement save and/or reopen
-	 * (revert).
-	 * <p>
-	 * If there is only one workflow open before opening this workflow, and it
-	 * is an unchanged blank workflow, the blank workflow will be closed.
-	 *
-	 * @param dataflow
-	 *            {@link WorkflowBundle} instance that is to be added as an open
-	 *            dataflow
-	 */
-	void openDataflow(WorkflowBundle dataflow);
-
-	/**
-	 * Open a dataflow from a source. The dataflow will not initially be marked
-	 * as changed, and will be set as the new current workflow.
-	 * <p>
-	 * The file manager will find implementations of the SPI
-	 * {@link DataflowPersistenceHandler} to perform the opening for the given file
-	 * type and destination class.
-	 * <p>
-	 * Listeners registered using {@link Observable#addObserver(Observer)} will
-	 * be notified with an {@link OpenedDataflowEvent}.
-	 * <p>
-	 * If there is only one workflow open before opening this workflow, and it
-	 * is an unchanged blank workflow, the blank workflow will be closed.
-	 *
-	 * @param fileType
-	 *            The filetype, for instance
-	 *            {@link net.sf.taverna.t2.workbench.file.impl.T2FlowFileType}.
-	 *            The file type must be supported by an implementation of the
-	 *            SPI DataflowPersistenceHandler.
-	 * @param source
-	 *            The source, for instance a {@link File} or {@link URL}. The
-	 *            source type must be supported by an implementation of
-	 *            DataflowPersistenceHandler.
-	 * @return The opened {@link WorkflowBundle}.
-	 * @throws OpenException
-	 *             If there was no matching DataflowPersistenceHandler found or
-	 *             the source could not be opened for any other reason, such as
-	 *             IO errors or syntax errors.
-	 */
-	WorkflowBundle openDataflow(FileType fileType, Object source)
-			throws OpenException;
-
-	/**
-	 * Open a dataflow from a source silently. The dataflow will not be listed
-	 * as open, and will not be made the current workflow.
-	 * <p>
-	 * The file manager will find implementations of the SPI
-	 * {@link DataflowPersistenceHandler} to perform the opening for the given file
-	 * type and destination class.
-	 * <p>
-	 * Listeners will <strong>not</strong> be notified.
-	 *
-	 * @param fileType
-	 *            The filetype, for instance
-	 *            {@link net.sf.taverna.t2.workbench.file.impl.T2FlowFileType}.
-	 *            The file type must be supported by an implementation of the
-	 *            SPI DataflowPersistenceHandler.
-	 * @param source
-	 *            The source, for instance a {@link File} or {@link URL}. The
-	 *            source type must be supported by an implementation of
-	 *            DataflowPersistenceHandler.
-	 * @return The {@link DataflowInfo} describing the opened dataflow.
-	 * @throws OpenException
-	 *             If there was no matching DataflowPersistenceHandler found or
-	 *             the source could not be opened for any other reason, such as
-	 *             IO errors or syntax errors.
-	 */
-	DataflowInfo openDataflowSilently(FileType fileType, Object source)
-			throws OpenException;
-
-	/**
-	 * Save the dataflow to the last saved destination and FileType from
-	 * {@link #saveDataflow(WorkflowBundle, FileType, Object, boolean)} or the last
-	 * opened source and FileType from {@link #openDataflow(FileType, Object)}.
-	 * <p>
-	 * Listeners registered using {@link Observable#addObserver(Observer)} will
-	 * be notified with an {@link SavedDataflowEvent}.
-	 *
-	 * @param dataflow
-	 *            Dataflow to save. Dataflow must have been opened with
-	 *            {@link #openDataflow(FileType, Object)} or saved using
-	 *            {@link #saveDataflow(WorkflowBundle, FileType, Object, boolean)}.
-	 * @param failOnOverwrite
-	 *            If <code>true</code>, an {@link OverwriteException} is thrown
-	 *            if a save would overwrite the destination because it has been
-	 *            changed since last open/save.
-	 * @throws OverwriteException
-	 *             if failOnOverwrite was true, and a save would overwrite the
-	 *             destination because it has been changed since last open/save.
-	 *             The save was not performed.
-	 * @throws SaveException
-	 *             If any other error occurs during saving, including the case
-	 *             that a dataflow is not connected to a source or destination,
-	 *             that there are no handlers (some source types can't be saved
-	 *             to, such as HTTP URLs), or any other IO error occurring while
-	 *             saving.
-	 */
-	void saveDataflow(WorkflowBundle dataflow, boolean failOnOverwrite)
-			throws SaveException, OverwriteException;
-
-	/**
-	 * Save the dataflow to the given destination using the given filetype.
-	 * <p>
-	 * The file manager will find implementations of the SPI
-	 * {@link DataflowPersistenceHandler} to perform the save for the given file
-	 * type and destination class.
-	 * <p>
-	 * Listeners registered using {@link Observable#addObserver(Observer)} will
-	 * be notified with an {@link SavedDataflowEvent}.
-	 *
-	 * @param dataflow
-	 *            {@link Dataflow} to be saved
-	 * @param fileType
-	 *            {@link FileType} to save dataflow as, for instance
-	 *            {@link net.sf.taverna.t2.workbench.file.impl.T2FlowFileType}.
-	 *            The file type must be supported by an SPI implementation of
-	 *            {@link DataflowPersistenceHandler}.
-	 * @param destination
-	 *            Destination to save dataflow to, for instance a {@link File}
-	 * @param failOnOverwrite
-	 *            If <code>true</code>, an {@link OverwriteException} is thrown
-	 *            if a save would overwrite the destination because it already
-	 *            exists, but was not opened or save to using the file manager
-	 *            for the given dataflow. (ie. a repeated call to this function
-	 *            should not throw an OverwriteException unless someone outside
-	 *            has modified the file)
-	 * @throws OverwriteException
-	 *             if failOnOverwrite was true, and a save would overwrite the
-	 *             destination because it already existed, and was not last
-	 *             written to by a previous save. The save was not performed.
-	 * @throws SaveException
-	 *             If any other error occurs during saving, including the case
-	 *             that a dataflow is not connected to a source or destination,
-	 *             that there are no handlers (some source types can't be saved
-	 *             to, such as HTTP URLs), or any other IO error occurring while
-	 *             saving.
-	 */
-	void saveDataflow(WorkflowBundle dataflow, FileType fileType,
-			Object destination, boolean failOnOverwrite) throws SaveException,
-			OverwriteException;
-
-	/**
-	 * Silently save the dataflow to the given destination using the given
-	 * filetype.
-	 * <p>
-	 * The file manager will find implementations of the SPI
-	 * {@link DataflowPersistenceHandler} to perform the save for the given file
-	 * type and destination class.
-	 * <p>
-	 * Listeners will <strong>not</strong> be notified, and the dataflow does
-	 * not previously have to be opened. getDataflowSource(),
-	 * isDataflowChanged() etc will not be affected - as if the silent save
-	 * never happened.
-	 * 
-	 * @param dataflow
-	 *            {@link WorkflowBundle} to be saved
-	 * @param fileType
-	 *            {@link FileType} to save dataflow as, for instance
-	 *            {@link net.sf.taverna.t2.workbench.file.impl.T2FlowFileType}.
-	 *            The file type must be supported by an SPI implementation of
-	 *            {@link DataflowPersistenceHandler}.
-	 * @param destination
-	 *            Destination to save dataflow to, for instance a {@link File}
-	 * @param failOnOverwrite
-	 *            If <code>true</code>, an {@link OverwriteException} is thrown
-	 *            if a save would overwrite the destination because it already
-	 *            exists, but was not opened or save to using the file manager
-	 *            for the given dataflow. (ie. a repeated call to this function
-	 *            should not throw an OverwriteException unless someone outside
-	 *            has modified the file)
-	 * @return The {@link DataflowInfo} describing where the workflow was saved
-	 * @throws OverwriteException
-	 *             if failOnOverwrite was true, and a save would overwrite the
-	 *             destination because it already existed, and was not last
-	 *             written to by a previous save. The save was not performed.
-	 * @throws SaveException
-	 *             If any other error occurs during saving, including the case
-	 *             that a dataflow is not connected to a source or destination,
-	 *             that there are no handlers (some source types can't be saved
-	 *             to, such as HTTP URLs), or any other IO error occurring while
-	 *             saving.
-	 */
-	DataflowInfo saveDataflowSilently(WorkflowBundle dataflow, FileType fileType,
-			Object destination, boolean failOnOverwrite) throws SaveException,
-			OverwriteException;
-
-	/**
-	 * Set the current dataflow to the one provided.
-	 * <p>
-	 * The current dataflow can be retrieved using {@link #getCurrentDataflow()}
-	 * . Note that opening a dataflow will normally also set it as the current
-	 * dataflow.
-	 * <p>
-	 * Listeners registered using {@link Observable#addObserver(Observer)} will
-	 * be notified with an {@link SetCurrentDataflowEvent}.
-	 * <p>
-	 * Note, the dataflow must already be open. If this is not the case, use one
-	 * of the openDataflow() methods or
-	 * {@link #setCurrentDataflow(WorkflowBundle, boolean)}.
-	 *
-	 * @see #setCurrentDataflow(WorkflowBundle, boolean)
-	 * @param dataflow
-	 *            {@link WorkflowBundle} to be made current
-	 */
-	void setCurrentDataflow(WorkflowBundle dataflow);
-
-	/**
-	 * Set the current dataflow to the one provided.
-	 * <p>
-	 * The current dataflow can be retrieved using {@link #getCurrentDataflow()}
-	 * . Note that opening a dataflow will normally also set it as the current
-	 * dataflow.
-	 * <p>
-	 * Listeners registered using {@link Observable#addObserver(Observer)} will
-	 * be notified with an {@link SetCurrentDataflowEvent}.
-	 * <p>
-	 * Unless <code>openIfNeeded</code> is <code>true</code>, the dataflow must
-	 * already be open.
-	 *
-	 * @see #setCurrentDataflow(WorkflowBundle, boolean)
-	 * @param dataflow
-	 *            {@link WorkflowBundle} to be made current
-	 * @param openIfNeeded
-	 *            If <code>true</code>, open the dataflow if needed
-	 */
-	void setCurrentDataflow(WorkflowBundle dataflow, boolean openIfNeeded);
-
-	/**
-	 * Set a dataflow as changed or not. This changes the value returned by
-	 * {@link #isDataflowChanged(WorkflowBundle)}.
-	 * <p>
-	 * This method can be used if the dataflow has been changed outside the
-	 * {@link EditManager}.
-	 *
-	 * @param dataflow
-	 *            Dataflow which is to be marked
-	 * @param isChanged
-	 *            <code>true</code> if the dataflow is to be marked as changed,
-	 *            <code>false</code> if it is to be marked as not changed.
-	 */
-	void setDataflowChanged(WorkflowBundle dataflow, boolean isChanged);
-
-	/**
-	 * Returns the canonical form of the source where the dataflow was opened
-	 * from or saved to. The code for this method was devised based on
-	 * {@link net.sf.taverna.t2.workbench.file.impl.T2DataflowOpener#openDataflow(FileType fileType, Object source)}.
-	 */
-	Object getCanonical(Object source) throws IllegalArgumentException,
-			URISyntaxException, IOException;
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-file-api/src/main/java/net/sf/taverna/t2/workbench/file/FileType.java
----------------------------------------------------------------------
diff --git a/taverna-file-api/src/main/java/net/sf/taverna/t2/workbench/file/FileType.java b/taverna-file-api/src/main/java/net/sf/taverna/t2/workbench/file/FileType.java
deleted file mode 100644
index 001d82c..0000000
--- a/taverna-file-api/src/main/java/net/sf/taverna/t2/workbench/file/FileType.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*******************************************************************************
- * 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.file;
-
-/**
- * A filetype to identify a way to (de)serialise a {@link WorkflowBundle} with
- * the {@link FileManager}.
- * <p>
- * Two filetypes are considered equal if they share an extension or mime type or
- * are the same instance.
- * 
- * @see net.sf.taverna.t2.workbench.file.impl.WorkflowBundleFileType
- * @author Stian Soiland-Reyes
- */
-public abstract class FileType {
-	public abstract String getExtension();
-
-	public abstract String getMimeType();
-
-	public abstract String getDescription();
-
-	/**
-	 * {@inheritDoc}
-	 */
-	@Override
-	public boolean equals(Object obj) {
-		if (obj == this)
-			return true;
-		if (!(obj instanceof FileType))
-			return false;
-		FileType other = (FileType) obj;
-		if (getMimeType() != null && other.getMimeType() != null)
-			return getMimeType().equalsIgnoreCase(other.getMimeType());
-		if (getExtension() != null && other.getExtension() != null)
-			return getExtension().equalsIgnoreCase(other.getExtension());
-		return false;
-	}
-
-	/**
-	 * {@inheritDoc}
-	 */
-	@Override
-	public int hashCode() {
-		int hash = 7;
-		hash = 31 * hash + getExtension().hashCode();
-		hash = 31 * hash + getMimeType().hashCode();
-		return hash;
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-file-api/src/main/java/net/sf/taverna/t2/workbench/file/events/AbstractDataflowEvent.java
----------------------------------------------------------------------
diff --git a/taverna-file-api/src/main/java/net/sf/taverna/t2/workbench/file/events/AbstractDataflowEvent.java b/taverna-file-api/src/main/java/net/sf/taverna/t2/workbench/file/events/AbstractDataflowEvent.java
deleted file mode 100644
index 26e697e..0000000
--- a/taverna-file-api/src/main/java/net/sf/taverna/t2/workbench/file/events/AbstractDataflowEvent.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*******************************************************************************
- * 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.file.events;
-
-import org.apache.taverna.scufl2.api.container.WorkflowBundle;
-
-/**
- * Abstract FileManagerEvent that relates to a {@link WorkflowBundle}
- * 
- * @see AbstractDataflowEvent
- * @see ClosedDataflowEvent
- * @see OpenedDataflowEvent
- * @see SavedDataflowEvent
- * @see SetCurrentDataflowEvent
- * @author Stian Soiland-Reyes
- */
-public abstract class AbstractDataflowEvent extends FileManagerEvent {
-	private final WorkflowBundle workflowBundle;
-
-	public AbstractDataflowEvent(WorkflowBundle workflowBundle) {
-		this.workflowBundle = workflowBundle;
-	}
-
-	public WorkflowBundle getDataflow() {
-		return workflowBundle;
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-file-api/src/main/java/net/sf/taverna/t2/workbench/file/events/ClosedDataflowEvent.java
----------------------------------------------------------------------
diff --git a/taverna-file-api/src/main/java/net/sf/taverna/t2/workbench/file/events/ClosedDataflowEvent.java b/taverna-file-api/src/main/java/net/sf/taverna/t2/workbench/file/events/ClosedDataflowEvent.java
deleted file mode 100644
index 9df5b7c..0000000
--- a/taverna-file-api/src/main/java/net/sf/taverna/t2/workbench/file/events/ClosedDataflowEvent.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*******************************************************************************
- * 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.file.events;
-
-import org.apache.taverna.scufl2.api.container.WorkflowBundle;
-
-/**
- * {@link FileManagerEvent} that means a {@link WorkflowBundle} has been closed.
- * 
- * @author Stian Soiland-Reyes
- */
-public class ClosedDataflowEvent extends AbstractDataflowEvent {
-	public ClosedDataflowEvent(WorkflowBundle workflowBundle) {
-		super(workflowBundle);
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-file-api/src/main/java/net/sf/taverna/t2/workbench/file/events/ClosingDataflowEvent.java
----------------------------------------------------------------------
diff --git a/taverna-file-api/src/main/java/net/sf/taverna/t2/workbench/file/events/ClosingDataflowEvent.java b/taverna-file-api/src/main/java/net/sf/taverna/t2/workbench/file/events/ClosingDataflowEvent.java
deleted file mode 100644
index 62f16eb..0000000
--- a/taverna-file-api/src/main/java/net/sf/taverna/t2/workbench/file/events/ClosingDataflowEvent.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*******************************************************************************
- * 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.file.events;
-
-import org.apache.taverna.scufl2.api.container.WorkflowBundle;
-
-/**
- * {@link FileManagerEvent} that means a {@link WorkflowBundle} is being closed.
- * <i>This event is abortable;</i> if aborted, the close will not occur.
- * 
- * @author Alan R Williams
- */
-public class ClosingDataflowEvent extends AbstractDataflowEvent {
-	private boolean abortClose = false;
-
-	public boolean isAbortClose() {
-		return abortClose;
-	}
-
-	public void setAbortClose(boolean abortClose) {
-		this.abortClose = abortClose;
-	}
-
-	public ClosingDataflowEvent(WorkflowBundle workflowBundle) {
-		super(workflowBundle);
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-file-api/src/main/java/net/sf/taverna/t2/workbench/file/events/FileManagerEvent.java
----------------------------------------------------------------------
diff --git a/taverna-file-api/src/main/java/net/sf/taverna/t2/workbench/file/events/FileManagerEvent.java b/taverna-file-api/src/main/java/net/sf/taverna/t2/workbench/file/events/FileManagerEvent.java
deleted file mode 100644
index df44b16..0000000
--- a/taverna-file-api/src/main/java/net/sf/taverna/t2/workbench/file/events/FileManagerEvent.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*******************************************************************************
- * 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.file.events;
-
-import org.apache.taverna.lang.observer.Observable;
-import net.sf.taverna.t2.workbench.file.FileManager;
-
-/**
- * An event given to {@link FileManager} observers registered using
- * {@link Observable#addObserver(net.sf.taverna.t2.lang.observer.Observer)}.
- * 
- * @see AbstractDataflowEvent
- * @see ClosedDataflowEvent
- * @see OpenedDataflowEvent
- * @see SavedDataflowEvent
- * @see SetCurrentDataflowEvent
- * @author Stian Soiland-Reyes
- */
-public class FileManagerEvent {
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-file-api/src/main/java/net/sf/taverna/t2/workbench/file/events/OpenedDataflowEvent.java
----------------------------------------------------------------------
diff --git a/taverna-file-api/src/main/java/net/sf/taverna/t2/workbench/file/events/OpenedDataflowEvent.java b/taverna-file-api/src/main/java/net/sf/taverna/t2/workbench/file/events/OpenedDataflowEvent.java
deleted file mode 100644
index eb5492c..0000000
--- a/taverna-file-api/src/main/java/net/sf/taverna/t2/workbench/file/events/OpenedDataflowEvent.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*******************************************************************************
- * 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.file.events;
-
-import org.apache.taverna.scufl2.api.container.WorkflowBundle;
-
-/**
- * {@link FileManagerEvent} that means a dataflow has been opened
- * 
- * @author Stian Soiland-Reyes
- */
-public class OpenedDataflowEvent extends AbstractDataflowEvent {
-	public OpenedDataflowEvent(WorkflowBundle workflowBundle) {
-		super(workflowBundle);
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-file-api/src/main/java/net/sf/taverna/t2/workbench/file/events/SavedDataflowEvent.java
----------------------------------------------------------------------
diff --git a/taverna-file-api/src/main/java/net/sf/taverna/t2/workbench/file/events/SavedDataflowEvent.java b/taverna-file-api/src/main/java/net/sf/taverna/t2/workbench/file/events/SavedDataflowEvent.java
deleted file mode 100644
index be70485..0000000
--- a/taverna-file-api/src/main/java/net/sf/taverna/t2/workbench/file/events/SavedDataflowEvent.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*******************************************************************************
- * 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.file.events;
-
-import org.apache.taverna.scufl2.api.container.WorkflowBundle;
-
-/**
- * {@link FileManagerEvent} that means a {@link WorkflowBundle} has been saved.
- * 
- * @author Stian Soiland-Reyes
- */
-public class SavedDataflowEvent extends AbstractDataflowEvent {
-	public SavedDataflowEvent(WorkflowBundle workflowBundle) {
-		super(workflowBundle);
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-file-api/src/main/java/net/sf/taverna/t2/workbench/file/events/SetCurrentDataflowEvent.java
----------------------------------------------------------------------
diff --git a/taverna-file-api/src/main/java/net/sf/taverna/t2/workbench/file/events/SetCurrentDataflowEvent.java b/taverna-file-api/src/main/java/net/sf/taverna/t2/workbench/file/events/SetCurrentDataflowEvent.java
deleted file mode 100644
index 993c844..0000000
--- a/taverna-file-api/src/main/java/net/sf/taverna/t2/workbench/file/events/SetCurrentDataflowEvent.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*******************************************************************************
- * 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.file.events;
-
-import org.apache.taverna.scufl2.api.container.WorkflowBundle;
-
-/**
- * {@link FileManagerEvent} that means a {@link WorkflowBundle} has been made
- * current.
- * 
- * @author Stian Soiland-Reyes
- */
-public class SetCurrentDataflowEvent extends AbstractDataflowEvent {
-	public SetCurrentDataflowEvent(WorkflowBundle workflowBundle) {
-		super(workflowBundle);
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-file-api/src/main/java/net/sf/taverna/t2/workbench/file/exceptions/FileException.java
----------------------------------------------------------------------
diff --git a/taverna-file-api/src/main/java/net/sf/taverna/t2/workbench/file/exceptions/FileException.java b/taverna-file-api/src/main/java/net/sf/taverna/t2/workbench/file/exceptions/FileException.java
deleted file mode 100644
index a2cb9ce..0000000
--- a/taverna-file-api/src/main/java/net/sf/taverna/t2/workbench/file/exceptions/FileException.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * 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.file.exceptions;
-
-import net.sf.taverna.t2.workbench.file.FileManager;
-
-/**
- * Superclass of exceptions thrown by the {@link FileManager}.
- */
-@SuppressWarnings("serial")
-public class FileException extends Exception {
-	public FileException() {
-	}
-
-	public FileException(String message) {
-		super(message);
-	}
-
-	public FileException(Throwable cause) {
-		super(cause);
-	}
-
-	public FileException(String message, Throwable cause) {
-		super(message, cause);
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-file-api/src/main/java/net/sf/taverna/t2/workbench/file/exceptions/OpenException.java
----------------------------------------------------------------------
diff --git a/taverna-file-api/src/main/java/net/sf/taverna/t2/workbench/file/exceptions/OpenException.java b/taverna-file-api/src/main/java/net/sf/taverna/t2/workbench/file/exceptions/OpenException.java
deleted file mode 100644
index 057679b..0000000
--- a/taverna-file-api/src/main/java/net/sf/taverna/t2/workbench/file/exceptions/OpenException.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * 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.file.exceptions;
-
-/** Indicate that something went wrong during opening a file */
-@SuppressWarnings("serial")
-public class OpenException extends FileException {
-	public OpenException() {
-	}
-
-	public OpenException(String message) {
-		super(message);
-	}
-
-	public OpenException(Throwable cause) {
-		super(cause);
-	}
-
-	public OpenException(String message, Throwable cause) {
-		super(message, cause);
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-file-api/src/main/java/net/sf/taverna/t2/workbench/file/exceptions/OverwriteException.java
----------------------------------------------------------------------
diff --git a/taverna-file-api/src/main/java/net/sf/taverna/t2/workbench/file/exceptions/OverwriteException.java b/taverna-file-api/src/main/java/net/sf/taverna/t2/workbench/file/exceptions/OverwriteException.java
deleted file mode 100644
index 6d410a3..0000000
--- a/taverna-file-api/src/main/java/net/sf/taverna/t2/workbench/file/exceptions/OverwriteException.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*******************************************************************************
- * 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.file.exceptions;
-
-/** Indicate that something could not be overwritten. */
-@SuppressWarnings("serial")
-public class OverwriteException extends SaveException {
-	private final Object destination;
-
-	public OverwriteException(Object destination) {
-		super("Save would overwrite existing destination " + destination);
-		this.destination = destination;
-	}
-
-	public Object getDestination() {
-		return destination;
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-file-api/src/main/java/net/sf/taverna/t2/workbench/file/exceptions/SaveException.java
----------------------------------------------------------------------
diff --git a/taverna-file-api/src/main/java/net/sf/taverna/t2/workbench/file/exceptions/SaveException.java b/taverna-file-api/src/main/java/net/sf/taverna/t2/workbench/file/exceptions/SaveException.java
deleted file mode 100644
index 8c4266f..0000000
--- a/taverna-file-api/src/main/java/net/sf/taverna/t2/workbench/file/exceptions/SaveException.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * 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.file.exceptions;
-
-/** Indicate that a workflow could not be saved. */
-@SuppressWarnings("serial")
-public class SaveException extends FileException {
-	public SaveException() {
-	}
-
-	public SaveException(String message) {
-		super(message);
-	}
-
-	public SaveException(Throwable cause) {
-		super(cause);
-	}
-
-	public SaveException(String message, Throwable cause) {
-		super(message, cause);
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-file-api/src/main/java/net/sf/taverna/t2/workbench/file/exceptions/UnsavedException.java
----------------------------------------------------------------------
diff --git a/taverna-file-api/src/main/java/net/sf/taverna/t2/workbench/file/exceptions/UnsavedException.java b/taverna-file-api/src/main/java/net/sf/taverna/t2/workbench/file/exceptions/UnsavedException.java
deleted file mode 100644
index 1bc6767..0000000
--- a/taverna-file-api/src/main/java/net/sf/taverna/t2/workbench/file/exceptions/UnsavedException.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*******************************************************************************
- * 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.file.exceptions;
-
-import org.apache.taverna.scufl2.api.container.WorkflowBundle;
-
-/** Indicate that a workflow bundle is not saved. */
-@SuppressWarnings("serial")
-public class UnsavedException extends FileException {
-	private final WorkflowBundle workflowBundle;
-
-	public UnsavedException(WorkflowBundle workflowBundle) {
-		super("WorkflowBundle was not saved: " + workflowBundle);
-		this.workflowBundle = workflowBundle;
-	}
-
-	public WorkflowBundle getDataflow() {
-		return workflowBundle;
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/AbstractDataflowPersistenceHandler.java
----------------------------------------------------------------------
diff --git a/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/AbstractDataflowPersistenceHandler.java b/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/AbstractDataflowPersistenceHandler.java
new file mode 100644
index 0000000..71a3c12
--- /dev/null
+++ b/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/AbstractDataflowPersistenceHandler.java
@@ -0,0 +1,69 @@
+/*******************************************************************************
+ * 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 org.apache.taverna.workbench.file;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.taverna.workbench.file.exceptions.OpenException;
+import org.apache.taverna.workbench.file.exceptions.SaveException;
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+
+public abstract class AbstractDataflowPersistenceHandler implements
+		DataflowPersistenceHandler {
+	@Override
+	public List<FileType> getOpenFileTypes() {
+		return Collections.emptyList();
+	}
+
+	@Override
+	public List<FileType> getSaveFileTypes() {
+		return Collections.emptyList();
+	}
+
+	@Override
+	public List<Class<?>> getOpenSourceTypes() {
+		return Collections.emptyList();
+	}
+
+	@Override
+	public List<Class<?>> getSaveDestinationTypes() {
+		return Collections.emptyList();
+	}
+
+	@Override
+	public DataflowInfo openDataflow(FileType fileType, Object source)
+			throws OpenException {
+		throw new UnsupportedOperationException();
+	}
+
+	@Override
+	public DataflowInfo saveDataflow(WorkflowBundle workflowBundle, FileType fileType,
+			Object destination) throws SaveException {
+		throw new UnsupportedOperationException();
+	}
+
+	@Override
+	public boolean wouldOverwriteDataflow(WorkflowBundle workflowBundle, FileType fileType,
+			Object destination, DataflowInfo lastDataflowInfo) {
+		throw new UnsupportedOperationException();
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/DataflowInfo.java
----------------------------------------------------------------------
diff --git a/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/DataflowInfo.java b/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/DataflowInfo.java
new file mode 100644
index 0000000..b841aa9
--- /dev/null
+++ b/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/DataflowInfo.java
@@ -0,0 +1,108 @@
+/*******************************************************************************
+ * 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 org.apache.taverna.workbench.file;
+
+import java.util.Date;
+
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+
+/**
+ * Information about a WorkflowBundle that has been opened by the
+ * {@link FileManager}.
+ * <p>
+ * This class, or a subclass of it, is used by
+ * {@link DataflowPersistenceHandler}s to keep information about where a
+ * {@link WorkflowBundle} came from or where it was saved to.
+ * 
+ * @author Stian Soiland-Reyes
+ */
+public class DataflowInfo {
+	private final FileType fileType;
+	private final WorkflowBundle worflowBundle;
+	private final Date lastModified;
+	private final Object canonicalSource;
+
+	public DataflowInfo(FileType fileType, Object canonicalSource,
+			WorkflowBundle worflowBundle, Date lastModified) {
+		this.fileType = fileType;
+		this.canonicalSource = canonicalSource;
+		this.worflowBundle = worflowBundle;
+		this.lastModified = lastModified;
+	}
+
+	public DataflowInfo(FileType fileType, Object canonicalSource,
+			WorkflowBundle worflowBundle) {
+		this(fileType, canonicalSource, worflowBundle, null);
+	}
+
+	/**
+	 * Return the canonical source of where the WorkflowBundle was opened from
+	 * or saved to.
+	 * <p>
+	 * This is not necessarily the source provided to
+	 * {@link FileManager#openDataflow(FileType, Object)} or
+	 * {@link FileManager#saveDataflow(WorkflowBundle, FileType, Object, boolean)}
+	 * , but it's canonical version.
+	 * <p>
+	 * For instance, if a WorkflowBundle was opened from a
+	 * File("relative/something.wfbundle) this canonical source would resolve
+	 * the relative path.
+	 * 
+	 * @return
+	 */
+	public Object getCanonicalSource() {
+		return canonicalSource;
+	}
+
+	/**
+	 * Return the WorkflowBundle that is open.
+	 * 
+	 * @return The open WorkflowBundle
+	 */
+	public WorkflowBundle getDataflow() {
+		return worflowBundle;
+	}
+
+	/**
+	 * Get the last modified {@link Date} of the source at the time when it was
+	 * opened/saved.
+	 * <p>
+	 * It is important that this value is checked on creation time, and not on
+	 * demand.
+	 * 
+	 * @return The {@link Date} of the source/destination's last modified
+	 *         timestamp, or <code>null</code> if unknown.
+	 */
+	public Date getLastModified() {
+		return lastModified;
+	}
+
+	/**
+	 * The {@link FileType} of this {@link WorkflowBundle} serialisation used
+	 * for opening/saving.
+	 * 
+	 * @return The {@link FileType}, for instance
+	 *         {@link net.sf.taverna.t2.workbench.file.impl.WorkflowBundleFileType}
+	 */
+	public FileType getFileType() {
+		return fileType;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/DataflowPersistenceHandler.java
----------------------------------------------------------------------
diff --git a/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/DataflowPersistenceHandler.java b/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/DataflowPersistenceHandler.java
new file mode 100644
index 0000000..b3cc260
--- /dev/null
+++ b/taverna-file-api/src/main/java/org/apache/taverna/workbench/file/DataflowPersistenceHandler.java
@@ -0,0 +1,152 @@
+/*******************************************************************************
+ * 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 org.apache.taverna.workbench.file;
+
+import java.io.File;
+import java.net.URL;
+import java.util.Collection;
+
+import org.apache.taverna.workbench.file.exceptions.OpenException;
+import org.apache.taverna.workbench.file.exceptions.SaveException;
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+
+/**
+ * A handler for opening or saving {@link WorkflowBundle} from the
+ * {@link FileManager}.
+ * 
+ * @author Stian Soiland-Reyes
+ */
+public interface DataflowPersistenceHandler {
+	/**
+	 * A collection of supported file types for
+	 * {@link #openDataflow(FileType, Object)}, or an empty collection if
+	 * opening is not supported by this handler.
+	 * 
+	 * @return A collection of supported {@link FileType}s for opening.
+	 */
+	Collection<FileType> getOpenFileTypes();
+
+	/**
+	 * A collection of supported source classes for
+	 * {@link #openDataflow(FileType, Object)}, or an empty collection if
+	 * opening is not supported by this handler.
+	 * <p>
+	 * For example, a handler that supports sources opened from a {@link File}
+	 * and {@link URL} could return
+	 * <code>Arrays.asList(File.class, URL.class)</code>
+	 * 
+	 * @return A collection of supported {@link Class}es of the open source
+	 *         types.
+	 */
+	Collection<Class<?>> getOpenSourceTypes();
+
+	/**
+	 * A collection of supported destination classes for
+	 * {@link #saveDataflow(Dataflow, FileType, Object)}, or an empty collection
+	 * if saving is not supported by this handler.
+	 * <p>
+	 * For example, a handler that supports saving to destinations that are
+	 * instances of a {@link File} could return
+	 * <code>Arrays.asList(File.class)</code>
+	 * 
+	 * @return A collection of supported {{@link Class}es of the save
+	 *         destination types.
+	 */
+	Collection<Class<?>> getSaveDestinationTypes();
+
+	/**
+	 * A collection of supported file types for
+	 * {@link #saveDataflow(WorkflowBundle, FileType, Object)}, or an empty
+	 * collection if saving is not supported by this handler.
+	 * 
+	 * @return A collection of supported {@link FileType}s for saving.
+	 */
+	Collection<FileType> getSaveFileTypes();
+
+	/**
+	 * Open a dataflow from a source containing a dataflow of the given
+	 * {@link FileType}.
+	 * <p>
+	 * The {@link FileType} will be equal to one of the types from
+	 * {@link #getOpenFileTypes()}, and the source class will be one that is
+	 * assignable to one of the classes from {@link #getOpenSourceTypes()}.
+	 * 
+	 * @param fileType
+	 *            {@link FileType} determining which serialisation method has
+	 *            been used
+	 * @param source
+	 *            Source for reading the WorkflowBundle
+	 * @return {@link DataflowInfo} describing the opened WorkflowBundle,
+	 *         including the WorkflowBundle itself
+	 * @throws OpenException
+	 *             If the WorkflowBundle could not be read, parsed or opened for
+	 *             any reason.
+	 */
+	DataflowInfo openDataflow(FileType fileType, Object source)
+			throws OpenException;
+
+	/**
+	 * Save a WorkflowBundle to a destination of the given {@link FileType}.
+	 * <p>
+	 * The {@link FileType} will be equal to one of the types from
+	 * {@link #getSaveFileTypes()}, and the destination class will be one that
+	 * is assignable to one of the classes from
+	 * {@link #getSaveDestinationTypes()}.
+	 * 
+	 * @param dataflow
+	 *            {@link WorkflowBundle} to be saved
+	 * @param fileType
+	 *            {@link FileType} determining which serialisation method to use
+	 * @param destination
+	 *            Destination for writing the WorkflowBundle
+	 * @return {@link DataflowInfo} describing the saved WorkflowBundle,
+	 *         including the WorkflowBundle itself
+	 * @throws OpenException
+	 *             If the WorkflowBundle could not be read, parsed or opened for
+	 *             any reason.
+	 */
+	DataflowInfo saveDataflow(WorkflowBundle dataflow, FileType fileType,
+			Object destination) throws SaveException;
+
+	/**
+	 * Return <code>true</code> if a call to
+	 * {@link #saveDataflow(WorkflowBundle, FileType, Object)} would overwrite
+	 * the destination, and the destination is different from last
+	 * {@link #openDataflow(FileType, Object)} or
+	 * {@link #saveDataflow(WorkflowBundle, FileType, Object)} of the given
+	 * dataflow.
+	 * 
+	 * @param dataflow
+	 *            {@link WorkflowBundle} that is to be saved
+	 * @param fileType
+	 *            {@link FileType} for saving WorkflowBundle
+	 * @param destination
+	 *            destination for writing WorkflowBundle
+	 * @param lastDataflowInfo
+	 *            last provided {@link DataflowInfo} returned by
+	 *            {@link #openDataflow(FileType, Object)} or
+	 *            {@link #saveDataflow(WorkflowBundle, FileType, Object)}. (but
+	 *            not necessarily from this handler)
+	 * @return <code>true</code> if the save would overwrite
+	 */
+	boolean wouldOverwriteDataflow(WorkflowBundle dataflow, FileType fileType,
+			Object destination, DataflowInfo lastDataflowInfo);
+}


[39/51] [partial] incubator-taverna-workbench git commit: all packages are moved to org.apache.taverna.*

Posted by re...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-contextual-views-impl/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/impl/ContextualViewComponent.java
----------------------------------------------------------------------
diff --git a/taverna-contextual-views-impl/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/impl/ContextualViewComponent.java b/taverna-contextual-views-impl/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/impl/ContextualViewComponent.java
deleted file mode 100644
index dc0018e..0000000
--- a/taverna-contextual-views-impl/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/impl/ContextualViewComponent.java
+++ /dev/null
@@ -1,389 +0,0 @@
-package net.sf.taverna.t2.workbench.ui.views.contextualviews.impl;
-
-import static java.awt.GridBagConstraints.BOTH;
-import static java.awt.GridBagConstraints.CENTER;
-import static java.awt.GridBagConstraints.HORIZONTAL;
-import static java.awt.GridBagConstraints.LINE_START;
-import static java.awt.GridBagConstraints.NONE;
-import static net.sf.taverna.t2.lang.ui.ShadedLabel.BLUE;
-import static net.sf.taverna.t2.lang.ui.ShadedLabel.GREEN;
-import static net.sf.taverna.t2.lang.ui.ShadedLabel.ORANGE;
-import static net.sf.taverna.t2.workbench.icons.WorkbenchIcons.minusIcon;
-import static net.sf.taverna.t2.workbench.icons.WorkbenchIcons.plusIcon;
-
-import java.awt.Color;
-import java.awt.Frame;
-import java.awt.GridBagConstraints;
-import java.awt.GridBagLayout;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.MouseAdapter;
-import java.awt.event.MouseEvent;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Set;
-
-import javax.swing.Action;
-import javax.swing.ImageIcon;
-import javax.swing.JButton;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.SwingUtilities;
-import javax.swing.Timer;
-
-import org.apache.taverna.lang.observer.Observable;
-import org.apache.taverna.lang.observer.Observer;
-import org.apache.taverna.lang.observer.SwingAwareObserver;
-import net.sf.taverna.t2.lang.ui.ShadedLabel;
-import net.sf.taverna.t2.workbench.edits.EditManager;
-import net.sf.taverna.t2.workbench.edits.EditManager.EditManagerEvent;
-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.SelectionManagerEvent;
-import net.sf.taverna.t2.workbench.selection.events.WorkflowBundleSelectionEvent;
-import net.sf.taverna.t2.workbench.ui.Utils;
-import net.sf.taverna.t2.workbench.ui.views.contextualviews.ContextualView;
-import net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory;
-import net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactoryRegistry;
-import net.sf.taverna.t2.workbench.ui.zaria.UIComponentSPI;
-import org.apache.taverna.scufl2.api.container.WorkflowBundle;
-
-@SuppressWarnings("serial")
-public class ContextualViewComponent extends JScrollPane implements UIComponentSPI {
-	/** delay before contextual view is redrawn */
-	private static final int DELAY = 250;
-	private static final Color[] colors = new Color[] { BLUE, GREEN, ORANGE };
-	// HACK ALERT!
-	public static boolean selfGenerated = false;
-
-	private Observer<DataflowSelectionMessage> dataflowSelectionListener = new DataflowSelectionListener();
-	private SelectionManager selectionManager;
-	private ContextualViewFactoryRegistry contextualViewFactoryRegistry;
-	GridBagConstraints gbc;
-	protected Map<JPanel, SectionLabel> panelToLabelMap = new HashMap<>();
-	private String lastOpenedSectionName = "";
-	private JPanel mainPanel;
-	private List<JPanel> shownComponents = null;
-	int colorIndex = 0;
-	private Timer updateSelectionTimer = null;
-	private Object lastSelectedObject = null;
-
-	private static final Comparator<ContextualView> viewComparator = new Comparator<ContextualView>() {
-		@Override
-		public int compare(ContextualView o1, ContextualView o2) {
-			return o1.getPreferredPosition() - o2.getPreferredPosition();
-		}
-	};
-
-	public ContextualViewComponent(EditManager editManager,
-			SelectionManager selectionManager,
-			ContextualViewFactoryRegistry contextualViewFactoryRegistry) {
-		this.selectionManager = selectionManager;
-		this.contextualViewFactoryRegistry = contextualViewFactoryRegistry;
-		updateSelectionTimer = new Timer(DELAY, updateSelectionListener);
-		updateSelectionTimer.setRepeats(false);
-
-		initialise();
-
-		editManager.addObserver(new EditManagerObserver());
-		selectionManager.addObserver(new SelectionManagerObserver());
-	}
-
-	@Override
-	public ImageIcon getIcon() {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	@Override
-	public String getName() {
-		return "Details";
-	}
-
-	private void initialise() {
-		mainPanel = new JPanel(new GridBagLayout());
-		this.setViewportView(mainPanel);
-	}
-
-	@Override
-	public void onDisplay() {
-	}
-
-	@Override
-	public void onDispose() {
-		updateSelectionTimer.stop();
-	}
-
-	@SuppressWarnings("unchecked")
-	private void updateContextualView(List<ContextualViewFactory<? super Object>> viewFactories,
-			Object selection) {
-		if (selection == lastSelectedObject)
-			return;
-		lastSelectedObject = selection;
-		mainPanel = new JPanel(new GridBagLayout());
-		panelToLabelMap.clear();
-
-		GridBagConstraints gbc = new GridBagConstraints();
-		gbc.gridx = 0;
-		gbc.weightx = 0.1;
-		gbc.fill = HORIZONTAL;
-
-		gbc.gridy = 0;
-		shownComponents = new ArrayList<>();
-		List<ContextualView> views = new ArrayList<>();
-		for (ContextualViewFactory<?> cvf : viewFactories)
-			views.addAll(((ContextualViewFactory<Object>) cvf)
-					.getViews(selection));
-		Collections.sort(views, viewComparator);
-		colorIndex = 0;
-		if (views.isEmpty())
-			mainPanel.add(new JLabel("No details available"));
-		else
-			populateContextualView(viewFactories, gbc, views);
-		gbc.weighty = 0.1;
-		gbc.fill = BOTH;
-		mainPanel.add(new JPanel(), gbc);
-		// mainPanel.revalidate();
-		// mainPanel.repaint();
-		this.setViewportView(mainPanel);
-		// this.revalidate();
-		// this.repaint();
-	}
-
-	private void populateContextualView(
-			List<ContextualViewFactory<? super Object>> viewFactories,
-			GridBagConstraints gbc, List<ContextualView> views) {
-		JPanel firstPanel = null;
-		JPanel lastOpenedSection = null;
-		for (ContextualView view : views) {
-			SectionLabel label = new SectionLabel(view.getViewTitle(), nextColor());
-			mainPanel.add(label, gbc);
-			gbc.gridy++;
-			JPanel subPanel = new JPanel();
-			if (view.getViewTitle().equals(lastOpenedSectionName))
-				lastOpenedSection = subPanel;
-			subPanel.setLayout(new GridBagLayout());
-
-			GridBagConstraints constraints = new GridBagConstraints();
-			constraints.gridx = 0;
-			constraints.gridy = 0;
-			constraints.weightx = 0.1;
-			constraints.weighty = 0;
-			constraints.anchor = CENTER;
-			constraints.fill = HORIZONTAL;
-
-			subPanel.add(view, constraints);
-			Frame frame = Utils.getParentFrame(this);
-			Action configureAction = view.getConfigureAction(frame);
-			if (configureAction != null) {
-				JButton configButton = new JButton(configureAction);
-				if (configButton.getText() == null
-						|| configButton.getText().isEmpty())
-					configButton.setText("Configure");
-				constraints.gridy++;
-				constraints.fill = NONE;
-				constraints.anchor = LINE_START;
-				subPanel.add(configButton, constraints);
-			}
-			if (firstPanel == null)
-				firstPanel = subPanel;
-			mainPanel.add(subPanel, gbc);
-			shownComponents.add(subPanel);
-			gbc.gridy++;
-			if (viewFactories.size() != 1)
-				makeCloseable(subPanel, label);
-			else {
-				lastOpenedSectionName = label.getText();
-				lastOpenedSection = subPanel;
-				panelToLabelMap.put(subPanel, label);
-				subPanel.setVisible(false);
-			}
-		}
-		if (lastOpenedSection != null)
-			openSection(lastOpenedSection);
-		else if (firstPanel != null)
-			openSection(firstPanel);
-	}
-
-	private void clearContextualView() {
-		lastSelectedObject = null;
-		mainPanel = new JPanel(new GridBagLayout());
-		mainPanel.add(new JLabel("No details available"));
-		this.setViewportView(mainPanel);
-		this.revalidate();
-	}
-
-	public void updateSelection(Object selectedItem) {
-		findContextualView(selectedItem);
-	}
-
-	private Runnable updateSelectionRunnable = new Runnable() {
-		@Override
-		public void run() {
-			Object selection = getSelection();
-			if (selection == null)
-				clearContextualView();
-			else
-				updateSelection(selection);
-		}
-	};
-
-	private ActionListener updateSelectionListener = new ActionListener() {
-		@Override
-		public void actionPerformed(ActionEvent e) {
-			SwingUtilities.invokeLater(updateSelectionRunnable);
-		}
-	};
-
-	public void updateSelection() {
-		updateSelectionTimer.restart();
-	}
-
-	private Object getSelection() {
-		WorkflowBundle workflowBundle = selectionManager.getSelectedWorkflowBundle();
-
-		/*
-		 * If there is no currently opened dataflow, clear the contextual view
-		 * panel
-		 */
-		if (workflowBundle == null) {
-			return null;
-		}
-		DataflowSelectionModel selectionModel = selectionManager
-				.getDataflowSelectionModel(workflowBundle);
-		Set<Object> selection = selectionModel.getSelection();
-
-		/*
-		 * If the dataflow is opened but no component of the dataflow is
-		 * selected, clear the contextual view panel
-		 */
-		if (selection.isEmpty())
-			return null;
-		return selection.iterator().next();
-	}
-
-	private void findContextualView(Object selection) {
-		List<ContextualViewFactory<? super Object>> viewFactoriesForBeanType = contextualViewFactoryRegistry
-				.getViewFactoriesForObject(selection);
-		updateContextualView(viewFactoriesForBeanType, selection);
-	}
-
-	private final class SelectionManagerObserver extends SwingAwareObserver<SelectionManagerEvent> {
-		@Override
-		public void notifySwing(Observable<SelectionManagerEvent> sender, SelectionManagerEvent message) {
-			if (message instanceof WorkflowBundleSelectionEvent)
-				bundleSelected((WorkflowBundleSelectionEvent) message);
-		}
-
-		private void bundleSelected(WorkflowBundleSelectionEvent event) {
-			WorkflowBundle oldBundle = event
-					.getPreviouslySelectedWorkflowBundle();
-			WorkflowBundle newBundle = event.getSelectedWorkflowBundle();
-
-			if (oldBundle != null)
-				selectionManager.getDataflowSelectionModel(oldBundle)
-						.removeObserver(dataflowSelectionListener);
-			if (newBundle != null)
-				selectionManager.getDataflowSelectionModel(newBundle)
-						.addObserver(dataflowSelectionListener);
-			lastSelectedObject = null;
-			updateSelection();
-		}
-	}
-
-	private final class DataflowSelectionListener extends SwingAwareObserver<DataflowSelectionMessage> {
-		@Override
-		public void notifySwing(Observable<DataflowSelectionMessage> sender,
-				DataflowSelectionMessage message) {
-			updateSelection();
-		}
-	}
-
-	private final class EditManagerObserver extends SwingAwareObserver<EditManagerEvent> {
-		@Override
-		public void notifySwing(Observable<EditManagerEvent> sender, EditManagerEvent message) {
-			Object selection = getSelection();
-			if ((selection != lastSelectedObject) && !selfGenerated) {
-				lastSelectedObject = null;
-				refreshView();
-			}
-		}
-	}
-
-	public void refreshView() {
-		if (mainPanel != null)
-			updateSelection();
-	}
-
-	private final class SectionLabel extends ShadedLabel {
-		private JLabel expand;
-
-		private SectionLabel(String text, Color colour) {
-			super(text, colour);
-			expand = new JLabel(minusIcon);
-			add(expand, 0);
-			setExpanded(true);
-		}
-
-		public void setExpanded(boolean expanded) {
-			if (expanded)
-				expand.setIcon(minusIcon);
-			else
-				expand.setIcon(plusIcon);
-		}
-	}
-
-	private void makeCloseable(JPanel panel, SectionLabel label) {
-		panel.setVisible(false);
-		if (panelToLabelMap.get(panel) != label) {
-			panelToLabelMap.put(panel, label);
-			// Only add mouse listener once
-			label.addMouseListener(new SectionOpener(panel));
-		}
-	}
-
-	protected class SectionOpener extends MouseAdapter {
-		private final JPanel sectionToOpen;
-
-		public SectionOpener(JPanel sectionToOpen) {
-			this.sectionToOpen = sectionToOpen;
-		}
-
-		@Override
-		public void mouseClicked(MouseEvent e) {
-			openSection(sectionToOpen);
-		}
-	}
-
-	public synchronized void openSection(JPanel sectionToOpen) {
-		lastOpenedSectionName = "";
-		for (Entry<JPanel, SectionLabel> entry : panelToLabelMap.entrySet()) {
-			JPanel section = entry.getKey();
-			SectionLabel sectionLabel = entry.getValue();
-
-			if (section != sectionToOpen)
-				section.setVisible(false);
-			else {
-				section.setVisible(!section.isVisible());
-				if (section.isVisible())
-					lastOpenedSectionName = sectionLabel.getText();
-			}
-			sectionLabel.setExpanded(section.isVisible());
-		}
-		this.revalidate();
-		this.repaint();
-	}
-
-	private Color nextColor() {
-		if (colorIndex >= colors.length)
-			colorIndex = 0;
-		return colors[colorIndex++];
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-contextual-views-impl/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/impl/ContextualViewComponentFactory.java
----------------------------------------------------------------------
diff --git a/taverna-contextual-views-impl/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/impl/ContextualViewComponentFactory.java b/taverna-contextual-views-impl/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/impl/ContextualViewComponentFactory.java
deleted file mode 100644
index db43a0d..0000000
--- a/taverna-contextual-views-impl/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/impl/ContextualViewComponentFactory.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007-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.ui.views.contextualviews.impl;
-
-import javax.swing.ImageIcon;
-
-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.activity.ContextualViewFactoryRegistry;
-import net.sf.taverna.t2.workbench.ui.zaria.UIComponentFactorySPI;
-import net.sf.taverna.t2.workbench.ui.zaria.UIComponentSPI;
-
-public class ContextualViewComponentFactory implements UIComponentFactorySPI {
-	private EditManager editManager;
-	private SelectionManager selectionManager;
-	private ContextualViewFactoryRegistry contextualViewFactoryRegistry;
-
-	@Override
-	public UIComponentSPI getComponent() {
-		return new ContextualViewComponent(editManager, selectionManager,
-				contextualViewFactoryRegistry);
-	}
-
-	@Override
-	public ImageIcon getIcon() {
-		return null;
-	}
-
-	@Override
-	public String getName() {
-		return "Details";
-	}
-
-	public void setEditManager(EditManager editManager) {
-		this.editManager = editManager;
-	}
-
-	public void setSelectionManager(SelectionManager selectionManager) {
-		this.selectionManager = selectionManager;
-	}
-
-	public void setContextualViewFactoryRegistry(
-			ContextualViewFactoryRegistry contextualViewFactoryRegistry) {
-		this.contextualViewFactoryRegistry = contextualViewFactoryRegistry;
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-contextual-views-impl/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/inputport/InputPortContextualView.java
----------------------------------------------------------------------
diff --git a/taverna-contextual-views-impl/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/inputport/InputPortContextualView.java b/taverna-contextual-views-impl/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/inputport/InputPortContextualView.java
deleted file mode 100644
index 452f7b3..0000000
--- a/taverna-contextual-views-impl/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/inputport/InputPortContextualView.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*******************************************************************************
- * 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.views.contextualviews.inputport;
-
-import static java.awt.FlowLayout.LEFT;
-
-import java.awt.FlowLayout;
-
-import javax.swing.JComponent;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.border.EmptyBorder;
-
-import org.apache.taverna.scufl2.api.port.InputActivityPort;
-import net.sf.taverna.t2.workbench.ui.views.contextualviews.ContextualView;
-
-/**
- * Contextual view for dataflow procerssor's input ports.
- * 
- * @author Alex Nenadic
- */
-class InputPortContextualView extends ContextualView {
-	private static final String NO_DETAILS_AVAILABLE_HTML = "<html><body>"
-			+ "<i>No details available.</i>" + "</body><html>";
-	private static final long serialVersionUID = -7743029534480678624L;
-
-	private InputActivityPort inputPort;
-	private JPanel inputPortView;
-
-	public InputPortContextualView(InputActivityPort inputport) {
-		this.inputPort = inputport;
-		initView();
-	}
-
-	@Override
-	public JComponent getMainFrame() {
-		refreshView();
-		return inputPortView;
-	}
-
-	@Override
-	public String getViewTitle() {
-		return "Service input port: " + inputPort.getName();
-	}
-
-	@Override
-	public void refreshView() {
-		inputPortView = new JPanel(new FlowLayout(LEFT));
-		inputPortView.setBorder(new EmptyBorder(5, 5, 5, 5));
-		JLabel label = new JLabel(NO_DETAILS_AVAILABLE_HTML);
-		inputPortView.add(label);
-	}
-
-	@Override
-	public int getPreferredPosition() {
-		return 100;
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-contextual-views-impl/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/inputport/InputPortContextualViewFactory.java
----------------------------------------------------------------------
diff --git a/taverna-contextual-views-impl/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/inputport/InputPortContextualViewFactory.java b/taverna-contextual-views-impl/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/inputport/InputPortContextualViewFactory.java
deleted file mode 100644
index bf35c17..0000000
--- a/taverna-contextual-views-impl/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/inputport/InputPortContextualViewFactory.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * 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.views.contextualviews.inputport;
-
-import java.util.Arrays;
-import java.util.List;
-
-import net.sf.taverna.t2.workbench.ui.views.contextualviews.ContextualView;
-import net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory;
-import org.apache.taverna.scufl2.api.port.InputActivityPort;
-
-/**
- * A factory of contextual views for dataflow proessor's (i.e. its associated
- * activity's) input ports.
- *
- * @author Alex Nenadic
- */
-public class InputPortContextualViewFactory implements
-		ContextualViewFactory<InputActivityPort> {
-	@Override
-	public boolean canHandle(Object object) {
-		return object instanceof InputActivityPort;
-	}
-
-	@Override
-	public List<ContextualView> getViews(InputActivityPort inputport) {
-		return Arrays.asList(new ContextualView[] {
-				new InputPortContextualView(inputport)});
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-contextual-views-impl/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/merge/MergeConfigurationAction.java
----------------------------------------------------------------------
diff --git a/taverna-contextual-views-impl/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/merge/MergeConfigurationAction.java b/taverna-contextual-views-impl/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/merge/MergeConfigurationAction.java
deleted file mode 100644
index ad06636..0000000
--- a/taverna-contextual-views-impl/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/merge/MergeConfigurationAction.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*******************************************************************************
- * 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.views.contextualviews.merge;
-
-import java.awt.event.ActionEvent;
-import java.util.List;
-
-import javax.swing.AbstractAction;
-
-import net.sf.taverna.t2.workbench.edits.EditException;
-import net.sf.taverna.t2.workbench.edits.EditManager;
-import net.sf.taverna.t2.workbench.selection.SelectionManager;
-import net.sf.taverna.t2.workflow.edits.ReorderMergePositionsEdit;
-
-import org.apache.log4j.Logger;
-
-import org.apache.taverna.scufl2.api.container.WorkflowBundle;
-import org.apache.taverna.scufl2.api.core.DataLink;
-
-/**
- * Configuration action for a Merge. This action changes the order of
- * merge's incoming ports.
- *
- * @author Alex Nenadic
- *
- */
-@SuppressWarnings("serial")
-class MergeConfigurationAction extends AbstractAction {
-	private static Logger logger = Logger
-			.getLogger(MergeConfigurationAction.class);
-
-	private final List<DataLink> reorderedDataLinksList;
-	private final List<DataLink> datalinks;
-	private final EditManager editManager;
-	private final SelectionManager selectionManager;
-
-	MergeConfigurationAction(List<DataLink> datalinks,
-			List<DataLink> reorderedDataLinksList, EditManager editManager,
-			SelectionManager selectionManager) {
-		this.datalinks = datalinks;
-		this.reorderedDataLinksList = reorderedDataLinksList;
-		this.editManager = editManager;
-		this.selectionManager = selectionManager;
-	}
-
-	@Override
-	public void actionPerformed(ActionEvent e) {
-		ReorderMergePositionsEdit edit = new ReorderMergePositionsEdit(
-				datalinks, reorderedDataLinksList);
-
-		WorkflowBundle bundle = selectionManager.getSelectedWorkflowBundle();
-
-		try {
-			editManager.doDataflowEdit(bundle, edit);
-		} catch (IllegalStateException ex1) {
-			logger.error("Could not configure merge", ex1);
-		} catch (EditException ex2) {
-			logger.error("Could not configure merge", ex2);
-		}
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-contextual-views-impl/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/merge/MergeConfigurationView.java
----------------------------------------------------------------------
diff --git a/taverna-contextual-views-impl/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/merge/MergeConfigurationView.java b/taverna-contextual-views-impl/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/merge/MergeConfigurationView.java
deleted file mode 100644
index 8f07c58..0000000
--- a/taverna-contextual-views-impl/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/merge/MergeConfigurationView.java
+++ /dev/null
@@ -1,233 +0,0 @@
-package net.sf.taverna.t2.workbench.ui.views.contextualviews.merge;
-
-import static java.awt.BorderLayout.EAST;
-import static java.awt.BorderLayout.NORTH;
-import static java.awt.BorderLayout.SOUTH;
-import static java.lang.Math.max;
-import static javax.swing.BoxLayout.Y_AXIS;
-import static javax.swing.ListSelectionModel.SINGLE_SELECTION;
-import static javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS;
-import static javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS;
-import static javax.swing.SwingConstants.CENTER;
-import static javax.swing.SwingConstants.LEFT;
-import static javax.swing.SwingConstants.RIGHT;
-import static net.sf.taverna.t2.workbench.icons.WorkbenchIcons.downArrowIcon;
-import static net.sf.taverna.t2.workbench.icons.WorkbenchIcons.upArrowIcon;
-
-import java.awt.BorderLayout;
-import java.awt.Dimension;
-import java.awt.FlowLayout;
-import java.awt.FontMetrics;
-import java.awt.Frame;
-import java.awt.event.ActionEvent;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.swing.AbstractAction;
-import javax.swing.BoxLayout;
-import javax.swing.DefaultListModel;
-import javax.swing.JButton;
-import javax.swing.JLabel;
-import javax.swing.JList;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.border.CompoundBorder;
-import javax.swing.border.EmptyBorder;
-import javax.swing.border.EtchedBorder;
-import javax.swing.event.ListSelectionEvent;
-import javax.swing.event.ListSelectionListener;
-
-import net.sf.taverna.t2.workbench.edits.EditManager;
-import net.sf.taverna.t2.workbench.helper.HelpEnabledDialog;
-import net.sf.taverna.t2.workbench.selection.SelectionManager;
-import org.apache.taverna.scufl2.api.core.DataLink;
-
-@SuppressWarnings("serial")
-public class MergeConfigurationView extends HelpEnabledDialog {
-	private static final String TITLE = "<html><body><b>Order of incoming links</b></body></html>";
-
-	private List<DataLink> dataLinks;
-	private List<DataLink> reorderedDataLinks;
-	/** Ordered list of labels for dataLinks to be displayed to the user */
-	private DefaultListModel<String> labelListModel;
-	/** JList that displays the labelListModel */
-	JList<String> list;
-	/** Button to push the dataLink up the list */
-	private JButton upButton;
-	/** Button to push the dataLink down the list */
-	private JButton downButton;
-	private final EditManager editManager;
-	private final SelectionManager selectionManager;
-
-	public MergeConfigurationView(List<DataLink> dataLinks, EditManager editManager,
-			SelectionManager selectionManager) {
-		super((Frame)null, "Merge Configuration", true);
-
-		this.dataLinks = new ArrayList<>(dataLinks);
-		reorderedDataLinks = new ArrayList<>(dataLinks);
-		this.editManager = editManager;
-		this.selectionManager = selectionManager;
-		labelListModel = new DefaultListModel<>();
-		for (DataLink dataLink : dataLinks)
-			labelListModel.addElement(dataLink.toString());
-
-		initComponents();
-	}
-
-	private void initComponents() {
-        getContentPane().setLayout(new BorderLayout());
-
-		JPanel listPanel = new JPanel();
-		listPanel.setLayout(new BorderLayout());
-		listPanel.setBorder(new CompoundBorder(new EmptyBorder(10, 10, 10, 10),
-				new EtchedBorder()));
-
-		JLabel title = new JLabel(TITLE);
-		title.setBorder(new EmptyBorder(5, 5, 5, 5));
-		listPanel.add(title, NORTH);
-
-		list = new JList<>(labelListModel);
-		list.setSelectionMode(SINGLE_SELECTION);
-		list.setVisibleRowCount(-1);
-		list.addListSelectionListener(new ListSelectionListener() {
-			/**
-			 * Enable and disable up and down buttons based on which item in the
-			 * list is selected
-			 */
-			@Override
-			public void valueChanged(ListSelectionEvent e) {
-				int index = list.getSelectedIndex();
-				if ((index == -1) || (index == 0 && labelListModel.size() == 0)) {
-					// nothing selected or only one item in the list
-					upButton.setEnabled(false);
-					downButton.setEnabled(false);
-				} else {
-					upButton.setEnabled(index > 0);
-					downButton.setEnabled(index < labelListModel.size() - 1);
-				}
-			}
-		});
-
-		final JScrollPane listScroller = new JScrollPane(list);
-		listScroller.setBorder(new EmptyBorder(5, 5, 5, 5));
-		listScroller.setBackground(listPanel.getBackground());
-		listScroller.setHorizontalScrollBarPolicy(HORIZONTAL_SCROLLBAR_ALWAYS);
-		listScroller.setVerticalScrollBarPolicy(VERTICAL_SCROLLBAR_ALWAYS);
-		// Set the size of scroll pane to make all list items visible
-		FontMetrics fm = listScroller.getFontMetrics(this.getFont());
-		int listScrollerHeight = fm.getHeight() * labelListModel.size() + 75; //+75 just in case
-		listScroller.setPreferredSize(new Dimension(listScroller
-				.getPreferredSize().width, max(listScrollerHeight,
-				listScroller.getPreferredSize().height)));
-		listPanel.add(listScroller, BorderLayout.CENTER);
-
-		JPanel upDownButtonPanel = new JPanel();
-		upDownButtonPanel.setLayout(new BoxLayout(upDownButtonPanel, Y_AXIS));
-		upDownButtonPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
-
-		upButton = new JButton(new AbstractAction() {
-			@Override
-			public void actionPerformed(ActionEvent e) {
-				int index = list.getSelectedIndex();
-				if (index != -1) {
-					// Swap the labels
-					String label = (String) labelListModel.elementAt(index);
-					labelListModel.set(index, labelListModel.get(index - 1));
-					labelListModel.set(index - 1, label);
-					// Swap the dataLinks
-					DataLink dataLink = reorderedDataLinks.get(index);
-					reorderedDataLinks.set(index,
-							reorderedDataLinks.get(index - 1));
-					reorderedDataLinks.set(index - 1, dataLink);
-					// Make the pushed item selected
-					list.setSelectedIndex(index - 1);
-					// Refresh the list
-					listScroller.repaint();
-					listScroller.revalidate();
-				}
-			}
-		});
-		upButton.setIcon(upArrowIcon);
-		upButton.setText("Up");
-	    // Place text to the right of icon, vertically centered
-		upButton.setVerticalTextPosition(CENTER);
-		upButton.setHorizontalTextPosition(RIGHT);
-		// Set the horizontal alignment of the icon and text
-		upButton.setHorizontalAlignment(LEFT);
-		upButton.setEnabled(false);
-		upDownButtonPanel.add(upButton);
-
-		downButton = new JButton(new AbstractAction() {
-			@Override
-			public void actionPerformed(ActionEvent e) {
-				int index = list.getSelectedIndex();
-				if (index != -1) {
-					// Swap the labels
-					String label = (String) labelListModel.elementAt(index);
-					labelListModel.set(index, labelListModel.get(index + 1));
-					labelListModel.set(index + 1, label);
-					// Swap the dataLinks
-					DataLink dataLink = reorderedDataLinks.get(index);
-					reorderedDataLinks.set(index,
-							reorderedDataLinks.get(index + 1));
-					reorderedDataLinks.set(index + 1, dataLink);
-					// Make the pushed item selected
-					list.setSelectedIndex(index + 1);
-					// Refresh the list
-					list.repaint();
-					listScroller.revalidate();
-				}
-			}
-		});
-		downButton.setIcon(downArrowIcon);
-		downButton.setText("Down");
-	    // Place text to the right of icon, vertically centered
-		downButton.setVerticalTextPosition(CENTER);
-		downButton.setHorizontalTextPosition(RIGHT);
-		// Set the horizontal alignment of the icon and text
-		downButton.setHorizontalAlignment(LEFT);
-		downButton.setEnabled(false);
-		// set the up button to be of the same size as down button
-		upButton.setPreferredSize(downButton.getPreferredSize());
-		upButton.setMaximumSize(downButton.getPreferredSize());
-		upButton.setMinimumSize(downButton.getPreferredSize());
-		upDownButtonPanel.add(downButton);
-
-		listPanel.add(upDownButtonPanel, EAST);
-
-		JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
-
-		JButton jbOK = new JButton("OK");
-		jbOK.addActionListener(new AbstractAction() {
-			@Override
-			public void actionPerformed(ActionEvent e) {
-				new MergeConfigurationAction(dataLinks, reorderedDataLinks,
-						editManager, selectionManager).actionPerformed(e);
-				closeDialog();
-			}
-		});
-
-		JButton jbCancel = new JButton("Cancel");
-		jbCancel.addActionListener(new AbstractAction() {
-			@Override
-			public void actionPerformed(ActionEvent e) {
-				closeDialog();
-			}
-		});
-
-        buttonPanel.add(jbOK);
-        buttonPanel.add(jbCancel);
-
-        getContentPane().add(listPanel, BorderLayout.CENTER);
-        getContentPane().add(buttonPanel, SOUTH);
-        pack();
-	}
-
-	/**
-	 * Close the dialog.
-	 */
-	private void closeDialog() {
-		setVisible(false);
-		dispose();
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-contextual-views-impl/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/merge/MergeContextualView.java
----------------------------------------------------------------------
diff --git a/taverna-contextual-views-impl/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/merge/MergeContextualView.java b/taverna-contextual-views-impl/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/merge/MergeContextualView.java
deleted file mode 100644
index 441f41b..0000000
--- a/taverna-contextual-views-impl/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/merge/MergeContextualView.java
+++ /dev/null
@@ -1,150 +0,0 @@
-/*******************************************************************************
- * 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.views.contextualviews.merge;
-
-import static java.awt.BorderLayout.CENTER;
-import static java.awt.BorderLayout.SOUTH;
-import static java.awt.FlowLayout.LEFT;
-import static net.sf.taverna.t2.lang.ui.HtmlUtils.buildTableOpeningTag;
-import static net.sf.taverna.t2.lang.ui.HtmlUtils.createEditorPane;
-import static net.sf.taverna.t2.lang.ui.HtmlUtils.getHtmlHead;
-
-import java.awt.BorderLayout;
-import java.awt.FlowLayout;
-import java.awt.event.ActionEvent;
-import java.util.List;
-
-import javax.swing.AbstractAction;
-import javax.swing.JButton;
-import javax.swing.JComponent;
-import javax.swing.JEditorPane;
-import javax.swing.JPanel;
-
-import net.sf.taverna.t2.workbench.configuration.colour.ColourManager;
-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.ContextualView;
-import org.apache.taverna.workflowmodel.Merge;
-import org.apache.taverna.scufl2.api.common.Scufl2Tools;
-import org.apache.taverna.scufl2.api.container.WorkflowBundle;
-import org.apache.taverna.scufl2.api.core.DataLink;
-
-/**
- * Contextual view for a {@link Merge}.
- * 
- * @author Alex Nenadic
- */
-@SuppressWarnings("serial")
-class MergeContextualView extends ContextualView {
-	@SuppressWarnings("unused")
-	private DataLink dataLink;
-	private List<DataLink> datalinks;
-	@SuppressWarnings("unused")
-	private WorkflowBundle workflow;
-	private JEditorPane editorPane;
-	private final EditManager editManager;
-	private final ColourManager colourManager;
-	private final SelectionManager selectionManager;
-
-	// TODO inject from Spring via factory?
-	private Scufl2Tools scufl2Tools = new Scufl2Tools();
-
-	public MergeContextualView(DataLink dataLink, EditManager editManager,
-			SelectionManager selectionManager, ColourManager colourManager) {
-		this.dataLink = dataLink;
-		this.selectionManager = selectionManager;
-		datalinks = scufl2Tools.datalinksTo(dataLink.getSendsTo());
-		this.editManager = editManager;
-		this.colourManager = colourManager;
-		workflow = selectionManager.getSelectedWorkflowBundle();
-		initView();
-	}
-
-	@Override
-	public JComponent getMainFrame() {
-		editorPane = createEditorPane(buildHtml());
-		return panelForHtml(editorPane);
-	}
-
-	@Override
-	public String getViewTitle() {
-		return "Merge Position";
-	}
-
-	/**
-	 * Update the view with the latest information from the configuration bean.
-	 */
-	@Override
-	public void refreshView() {
-		editorPane.setText(buildHtml());
-		repaint();
-	}
-
-	private String buildHtml() {
-		StringBuilder html = new StringBuilder(
-				getHtmlHead(getBackgroundColour()));
-		html.append(buildTableOpeningTag())
-				.append("<tr><td colspan=\"2\"><b>")
-				.append(getViewTitle())
-				.append("</b></td></tr>")
-				.append("<tr><td colspan=\"2\"><b>Ordered incoming links</b></td></tr>");
-
-		int counter = 1;
-		for (DataLink datalink : datalinks)
-			html.append("<tr><td>").append(counter++).append(".</td><td>")
-					.append(datalink).append("</td></tr>");
-
-		return html.append("</table>").append("</body></html>").toString();
-	}
-
-	protected JPanel panelForHtml(JEditorPane editorPane) {
-		final JPanel panel = new JPanel();
-
-		JPanel buttonPanel = new JPanel(new FlowLayout(LEFT));
-
-		JButton configureButton = new JButton(new AbstractAction() {
-			@Override
-			public void actionPerformed(ActionEvent e) {
-				MergeConfigurationView mergeConfigurationView = new MergeConfigurationView(
-						datalinks, editManager, selectionManager);
-				mergeConfigurationView.setLocationRelativeTo(panel);
-				mergeConfigurationView.setVisible(true);
-			}
-		});
-		configureButton.setText("Configure");
-		buttonPanel.add(configureButton);
-
-		panel.setLayout(new BorderLayout());
-		panel.add(editorPane, CENTER);
-		panel.add(buttonPanel, SOUTH);
-		return panel;
-	}
-
-	public String getBackgroundColour() {
-		return colourManager.getDefaultPropertyMap().get(
-				"net.sf.taverna.t2.workflowmodel.Merge");
-	}
-
-	@Override
-	public int getPreferredPosition() {
-		return 100;
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-contextual-views-impl/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/merge/MergeContextualViewFactory.java
----------------------------------------------------------------------
diff --git a/taverna-contextual-views-impl/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/merge/MergeContextualViewFactory.java b/taverna-contextual-views-impl/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/merge/MergeContextualViewFactory.java
deleted file mode 100644
index 8e4a93a..0000000
--- a/taverna-contextual-views-impl/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/merge/MergeContextualViewFactory.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*******************************************************************************
- * 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.views.contextualviews.merge;
-
-import java.util.Arrays;
-import java.util.List;
-
-import net.sf.taverna.t2.workbench.configuration.colour.ColourManager;
-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.ContextualView;
-import net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory;
-import org.apache.taverna.scufl2.api.core.DataLink;
-
-/**
- * A factory of contextual views for dataflow's merges.
- *
- * @author Alex Nenadic
- */
-public class MergeContextualViewFactory implements ContextualViewFactory<DataLink> {
-	private EditManager editManager;
-	private SelectionManager selectionManager;
-	private ColourManager colourManager;
-
-	@Override
-	public boolean canHandle(Object object) {
-		return object instanceof DataLink
-				&& ((DataLink) object).getMergePosition() != null;
-	}
-
-	@Override
-	public List<ContextualView> getViews(DataLink merge) {
-		return Arrays.asList(new ContextualView[] {
-				new MergeContextualView(merge, editManager, selectionManager, colourManager)});
-	}
-
-	public void setEditManager(EditManager editManager) {
-		this.editManager = editManager;
-	}
-
-	public void setColourManager(ColourManager colourManager) {
-		this.colourManager = colourManager;
-	}
-
-	public void setSelectionManager(SelectionManager selectionManager) {
-		this.selectionManager = selectionManager;
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-contextual-views-impl/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/outputport/OutputPortContextualView.java
----------------------------------------------------------------------
diff --git a/taverna-contextual-views-impl/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/outputport/OutputPortContextualView.java b/taverna-contextual-views-impl/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/outputport/OutputPortContextualView.java
deleted file mode 100644
index d997637..0000000
--- a/taverna-contextual-views-impl/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/outputport/OutputPortContextualView.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*******************************************************************************
- * 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.views.contextualviews.outputport;
-
-import static java.awt.FlowLayout.LEFT;
-
-import java.awt.FlowLayout;
-
-import javax.swing.JComponent;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.border.EmptyBorder;
-
-import net.sf.taverna.t2.workbench.ui.views.contextualviews.ContextualView;
-import org.apache.taverna.workflowmodel.processor.activity.ActivityOutputPort;
-
-/**
- * Contextual view for dataflow procerssor's output ports.
- * 
- * @author Alex Nenadic
- */
-public class OutputPortContextualView extends ContextualView {
-	private static final String NO_DETAILS_AVAILABLE_HTML = "<html><body>"
-			+ "<i>No details available.</i>" + "</body><html>";
-	private static final long serialVersionUID = -7743029534480678624L;
-
-	private ActivityOutputPort outputPort;
-	private JPanel outputPortView;
-
-	public OutputPortContextualView(ActivityOutputPort outputport) {
-		this.outputPort = outputport;
-		initView();
-	}
-
-	@Override
-	public JComponent getMainFrame() {
-		refreshView();
-		return outputPortView;
-	}
-
-	@Override
-	public String getViewTitle() {
-		return "Service output port: " + outputPort.getName();
-	}
-
-	@Override
-	public void refreshView() {
-		outputPortView = new JPanel(new FlowLayout(LEFT));
-		outputPortView.setBorder(new EmptyBorder(5,5,5,5));
-		JLabel label = new JLabel(NO_DETAILS_AVAILABLE_HTML);
-		outputPortView.add(label);
-	}
-
-	@Override
-	public int getPreferredPosition() {
-		return 100;
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-contextual-views-impl/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/outputport/OutputPortContextualViewFactory.java
----------------------------------------------------------------------
diff --git a/taverna-contextual-views-impl/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/outputport/OutputPortContextualViewFactory.java b/taverna-contextual-views-impl/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/outputport/OutputPortContextualViewFactory.java
deleted file mode 100644
index a01a259..0000000
--- a/taverna-contextual-views-impl/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/outputport/OutputPortContextualViewFactory.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * 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.views.contextualviews.outputport;
-
-import java.util.Arrays;
-import java.util.List;
-
-import net.sf.taverna.t2.workbench.ui.views.contextualviews.ContextualView;
-import net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory;
-import org.apache.taverna.workflowmodel.processor.activity.ActivityOutputPort;
-
-/**
- * A factory of contextual views for dataflow proessor's (i.e. its associated
- * activity's) output ports.
- *
- * @author Alex Nenadic
- */
-public class OutputPortContextualViewFactory implements
-		ContextualViewFactory<ActivityOutputPort> {
-	@Override
-	public boolean canHandle(Object object) {
-		return object instanceof ActivityOutputPort;
-	}
-
-	@Override
-	public List<ContextualView> getViews(ActivityOutputPort outputport) {
-		return Arrays.asList(new ContextualView[] {
-				new OutputPortContextualView(outputport)});
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-contextual-views-impl/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/activity/impl/ContextualViewFactoryRegistryImpl.java
----------------------------------------------------------------------
diff --git a/taverna-contextual-views-impl/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/activity/impl/ContextualViewFactoryRegistryImpl.java b/taverna-contextual-views-impl/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/activity/impl/ContextualViewFactoryRegistryImpl.java
new file mode 100644
index 0000000..d3d858d
--- /dev/null
+++ b/taverna-contextual-views-impl/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/activity/impl/ContextualViewFactoryRegistryImpl.java
@@ -0,0 +1,71 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.views.contextualviews.activity.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory;
+import org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactoryRegistry;
+
+/**
+ * An SPI registry for discovering ActivityViewFactories for a given object,
+ * like an {@link org.apache.taverna.workflowmodel.processor.activity.Activity}.
+ * <p>
+ * For {@link ContextualViewFactory factories} to be found, its full qualified
+ * name needs to be defined as a resource file
+ * <code>/META-INF/services/net.sf.taverna.t2.workbench.ui.views.contextualviews.ContextualViewFactory</code>
+ *
+ * @author Alan R Williams
+ * @author Stuart Owen
+ * @author Ian Dunlop
+ * @author Stian Soiland-Reyes
+ * 
+ * @see ContextualViewFactory
+ */
+public class ContextualViewFactoryRegistryImpl implements
+		ContextualViewFactoryRegistry {
+	private List<ContextualViewFactory<?>> contextualViewFactories;
+
+	/**
+	 * Discover and return the ContextualViewFactory associated to the provided
+	 * object. This is accomplished by returning the discovered
+	 * {@link ContextualViewFactory#canHandle(Object)} that returns true for
+	 * that Object.
+	 * 
+	 * @param object
+	 * @return
+	 * @see ContextualViewFactory#canHandle(Object)
+	 */
+	@Override
+	public List<ContextualViewFactory<?>> getViewFactoriesForObject(
+			Object object) {
+		List<ContextualViewFactory<?>> result = new ArrayList<>();
+		for (ContextualViewFactory<?> factory : contextualViewFactories)
+			if (factory.canHandle(object))
+				result.add(factory);
+		return result;
+	}
+
+	public void setContextualViewFactories(
+			List<ContextualViewFactory<?>> contextualViewFactories) {
+		this.contextualViewFactories = contextualViewFactories;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-contextual-views-impl/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/annotated/AnnotatedContextualView.java
----------------------------------------------------------------------
diff --git a/taverna-contextual-views-impl/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/annotated/AnnotatedContextualView.java b/taverna-contextual-views-impl/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/annotated/AnnotatedContextualView.java
new file mode 100644
index 0000000..f912549
--- /dev/null
+++ b/taverna-contextual-views-impl/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/annotated/AnnotatedContextualView.java
@@ -0,0 +1,262 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.views.contextualviews.annotated;
+
+import static javax.swing.BoxLayout.Y_AXIS;
+
+import java.awt.event.FocusEvent;
+import java.awt.event.FocusListener;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.PropertyResourceBundle;
+import java.util.ResourceBundle;
+import java.util.regex.Pattern;
+
+import javax.swing.BoxLayout;
+import javax.swing.JComponent;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.border.EmptyBorder;
+import javax.swing.border.TitledBorder;
+
+import org.apache.taverna.annotation.Annotated;
+import org.apache.taverna.annotation.AnnotationBeanSPI;
+import org.apache.taverna.lang.ui.DialogTextArea;
+import org.apache.taverna.workbench.edits.CompoundEdit;
+import org.apache.taverna.workbench.edits.Edit;
+import org.apache.taverna.workbench.edits.EditException;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.selection.SelectionManager;
+import org.apache.taverna.workbench.ui.views.contextualviews.ContextualView;
+import org.apache.taverna.workbench.ui.views.contextualviews.impl.ContextualViewComponent;
+
+import org.apache.log4j.Logger;
+
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+
+/**
+ * This is a ContextualView that should be able to display and allow editing of
+ * Annotation information for any Annotated. At the moment it is only used for
+ * Dataflow.
+ * 
+ * @author Alan R Williams
+ */
+@SuppressWarnings("serial")
+class AnnotatedContextualView extends ContextualView {
+	private static final int WORKFLOW_NAME_LENGTH = 20;
+	public static final String VIEW_TITLE = "Annotations";
+	private final static String MISSING_VALUE = "Type here to give details";
+	private final static int DEFAULT_AREA_WIDTH = 60;
+	private final static int DEFAULT_AREA_ROWS = 8;
+
+	private static Logger logger = Logger
+			.getLogger(AnnotatedContextualView.class);
+	private static PropertyResourceBundle prb = (PropertyResourceBundle) ResourceBundle
+			.getBundle("annotatedcontextualview");
+
+	// TODO convert to scufl2
+	// private static AnnotationTools annotationTools = new AnnotationTools();
+
+	/**
+	 * The object to which the Annotations apply
+	 */
+	private Annotated<?> annotated;
+	private SelectionManager selectionManager;
+	private EditManager editManager;
+	private boolean isStandalone = false;
+	private JPanel panel;
+	@SuppressWarnings("unused")
+	private final List<AnnotationBeanSPI> annotationBeans;
+
+	public AnnotatedContextualView(Annotated<?> annotated,
+			EditManager editManager, SelectionManager selectionManager,
+			List<AnnotationBeanSPI> annotationBeans) {
+		super();
+		this.editManager = editManager;
+		this.selectionManager = selectionManager;
+		this.annotationBeans = annotationBeans;
+		this.annotated = annotated;
+
+		initialise();
+		initView();
+	}
+
+	@Override
+	public void refreshView() {
+		initialise();
+	}
+
+	private void initialise() {
+		if (panel == null) {
+			panel = new JPanel();
+			panel.setLayout(new BoxLayout(panel, Y_AXIS));
+		} else
+			panel.removeAll();
+		populatePanel();
+		revalidate();
+	}
+
+	@Override
+	public JComponent getMainFrame() {
+		return panel;
+	}
+
+	@Override
+	public String getViewTitle() {
+		return VIEW_TITLE;
+	}
+
+	private Map<String,String> getAnnotations() {
+		// TODO convert to scufl2
+		Map<String, String> result = new HashMap<>();
+		//for (Class<?> c : annotationTools.getAnnotatingClasses(annotated)) {
+		// String name = "";
+		// try {
+		// name = prb.getString(c.getCanonicalName());
+		// } catch (MissingResourceException e) {
+		// name = c.getCanonicalName();
+		// }
+		// String value = annotationTools.getAnnotationString(annotated, c,
+		// MISSING_VALUE);
+		// result.put(name,value);
+		//}
+		return result;
+	}
+	public void populatePanel() {
+		JPanel scrollPanel = new JPanel();
+		scrollPanel.setLayout(new BoxLayout(scrollPanel, Y_AXIS));
+		panel.setBorder(new EmptyBorder(5, 5, 5, 5));
+		Map<String,String>annotations = getAnnotations();
+		for (String name : annotations.keySet()) {
+			JPanel subPanel = new JPanel();
+			subPanel.setBorder(new TitledBorder(name));
+			subPanel.add(createTextArea(String.class, annotations.get(name)));
+			scrollPanel.add(subPanel);
+		}
+		JScrollPane scrollPane = new JScrollPane(scrollPanel);
+		panel.add(scrollPane);
+	}
+
+	private JScrollPane createTextArea(Class<?> c, String value) {
+		DialogTextArea area = new DialogTextArea(value);
+		area.setFocusable(true);
+		area.addFocusListener(new TextAreaFocusListener(area, c));
+		area.setColumns(DEFAULT_AREA_WIDTH);
+		area.setRows(DEFAULT_AREA_ROWS);
+		area.setLineWrap(true);
+		area.setWrapStyleWord(true);
+
+		return new JScrollPane(area);
+	}
+
+	private class TextAreaFocusListener implements FocusListener {
+		String oldValue = null;
+		Class<?> annotationClass;
+		DialogTextArea area = null;
+
+		public TextAreaFocusListener(DialogTextArea area, Class<?> c) {
+			annotationClass = c;
+			oldValue = area.getText();
+			this.area = area;
+		}
+
+		@Override
+		public void focusGained(FocusEvent e) {
+			if (area.getText().equals(MISSING_VALUE))
+				area.setText("");
+		}
+
+		@Override
+		public void focusLost(FocusEvent e) {
+			String currentValue = area.getText();
+			if (currentValue.isEmpty() || currentValue.equals(MISSING_VALUE)) {
+				currentValue = MISSING_VALUE;
+				area.setText(currentValue);
+			}
+			if (!currentValue.equals(oldValue)) {
+				if (currentValue == MISSING_VALUE)
+					currentValue = "";
+				try {
+					WorkflowBundle currentDataflow = selectionManager
+							.getSelectedWorkflowBundle();
+					List<Edit<?>> editList = new ArrayList<>();
+					addWorkflowNameEdits(currentValue, currentDataflow,
+							editList);
+					if (!isStandalone)
+						ContextualViewComponent.selfGenerated = true;
+					editManager.doDataflowEdit(currentDataflow,
+							new CompoundEdit(editList));
+					ContextualViewComponent.selfGenerated = false;
+				} catch (EditException e1) {
+					logger.warn("Can't set annotation", e1);
+				}
+				oldValue = area.getText();
+			}
+		}
+
+		private boolean isTitleAnnotation() {
+			// TODO convert to scufl2
+			return prb.getString(annotationClass.getCanonicalName()).equals(
+					"Title");
+		}
+
+		// TODO convert to scufl2
+		private void addWorkflowNameEdits(String currentValue,
+				WorkflowBundle currentDataflow, List<Edit<?>> editList) {
+			//editList.add(annotationTools.setAnnotationString(annotated,
+			//		annotationClass, currentValue, edits));
+			if (annotated == currentDataflow && isTitleAnnotation()
+					&& !currentValue.isEmpty()) {
+				@SuppressWarnings("unused")
+				String sanitised = sanitiseName(currentValue);
+				//editList.add(edits.getUpdateDataflowNameEdit(currentDataflow,
+				//		sanitised));
+			}
+		}
+	}
+
+	/**
+	 * Checks that the name does not have any characters that are invalid for a
+	 * processor name.
+	 * <p>
+	 * The resulting name must contain only the chars [A-Za-z_0-9].
+	 * 
+	 * @param name
+	 *            the original name
+	 * @return the sanitised name
+	 */
+	private static String sanitiseName(String name) {
+		if (name.length() > WORKFLOW_NAME_LENGTH)
+			name = name.substring(0, WORKFLOW_NAME_LENGTH);
+		if (Pattern.matches("\\w++", name))
+			return name;
+		StringBuilder temp = new StringBuilder();
+		for (char c : name.toCharArray())
+			temp.append(Character.isLetterOrDigit(c) || c == '_' ? c : '_');
+		return temp.toString();
+	}
+
+	@Override
+	public int getPreferredPosition() {
+		return 500;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-contextual-views-impl/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/annotated/AnnotatedContextualViewFactory.java
----------------------------------------------------------------------
diff --git a/taverna-contextual-views-impl/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/annotated/AnnotatedContextualViewFactory.java b/taverna-contextual-views-impl/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/annotated/AnnotatedContextualViewFactory.java
new file mode 100644
index 0000000..9cd0d1f
--- /dev/null
+++ b/taverna-contextual-views-impl/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/annotated/AnnotatedContextualViewFactory.java
@@ -0,0 +1,62 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.views.contextualviews.annotated;
+
+import static java.util.Collections.singletonList;
+
+import java.util.List;
+
+import org.apache.taverna.annotation.Annotated;
+import org.apache.taverna.annotation.AnnotationBeanSPI;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.selection.SelectionManager;
+import org.apache.taverna.workbench.ui.views.contextualviews.ContextualView;
+import org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory;
+import org.apache.taverna.workflowmodel.processor.activity.Activity;
+
+public class AnnotatedContextualViewFactory implements
+		ContextualViewFactory<Annotated<?>> {
+	private EditManager editManager;
+	private List<AnnotationBeanSPI> annotationBeans;
+	private SelectionManager selectionManager;
+
+	@Override
+	public boolean canHandle(Object selection) {
+		return ((selection instanceof Annotated) && !(selection instanceof Activity));
+	}
+
+	@Override
+	public List<ContextualView> getViews(Annotated<?> selection) {
+		return singletonList((ContextualView) new AnnotatedContextualView(
+				selection, editManager, selectionManager, annotationBeans));
+	}
+
+	public void setEditManager(EditManager editManager) {
+		this.editManager = editManager;
+	}
+
+	public void setSelectionManager(SelectionManager selectionManager) {
+		this.selectionManager = selectionManager;
+	}
+
+	public void setAnnotationBeans(List<AnnotationBeanSPI> annotationBeans) {
+		this.annotationBeans = annotationBeans;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-contextual-views-impl/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/condition/ConditionContextualView.java
----------------------------------------------------------------------
diff --git a/taverna-contextual-views-impl/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/condition/ConditionContextualView.java b/taverna-contextual-views-impl/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/condition/ConditionContextualView.java
new file mode 100644
index 0000000..8bf136c
--- /dev/null
+++ b/taverna-contextual-views-impl/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/condition/ConditionContextualView.java
@@ -0,0 +1,73 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.views.contextualviews.condition;
+
+import java.awt.FlowLayout;
+
+import javax.swing.JComponent;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.border.EmptyBorder;
+
+import org.apache.taverna.workbench.ui.views.contextualviews.ContextualView;
+import org.apache.taverna.scufl2.api.core.BlockingControlLink;
+
+/**
+ * Contextual view for dataflow's control (condition) links.
+ * 
+ * @author David Withers
+ */
+class ConditionContextualView extends ContextualView {
+	private static final long serialVersionUID = -894521200616176439L;
+
+	private final BlockingControlLink condition;
+	private JPanel contitionView;
+
+	public ConditionContextualView(BlockingControlLink condition) {
+		this.condition = condition;
+		initView();
+	}
+
+	@Override
+	public JComponent getMainFrame() {
+		refreshView();
+		return contitionView;
+	}
+
+	@Override
+	public String getViewTitle() {
+		return "Control link: " + condition.getBlock().getName()
+				+ " runs after " + condition.getUntilFinished().getName();
+	}
+
+	@Override
+	public void refreshView() {
+		contitionView = new JPanel(new FlowLayout(FlowLayout.LEFT));
+		contitionView.setBorder(new EmptyBorder(5, 5, 5, 5));
+		JLabel label = new JLabel(
+				"<html><body><i>No details available.</i></body><html>");
+		contitionView.add(label);
+	}
+
+	@Override
+	public int getPreferredPosition() {
+		return 100;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-contextual-views-impl/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/condition/ConditionContextualViewFactory.java
----------------------------------------------------------------------
diff --git a/taverna-contextual-views-impl/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/condition/ConditionContextualViewFactory.java b/taverna-contextual-views-impl/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/condition/ConditionContextualViewFactory.java
new file mode 100644
index 0000000..30bc50e
--- /dev/null
+++ b/taverna-contextual-views-impl/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/condition/ConditionContextualViewFactory.java
@@ -0,0 +1,50 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.views.contextualviews.condition;
+
+import static java.util.Arrays.asList;
+
+import java.util.List;
+
+import org.apache.taverna.workbench.ui.views.contextualviews.ContextualView;
+import org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory;
+import org.apache.taverna.workflowmodel.Condition;
+import org.apache.taverna.scufl2.api.core.BlockingControlLink;
+
+/**
+ * A factory of contextual views for dataflow's condition links.
+ * 
+ * @author David Withers
+ * 
+ */
+public class ConditionContextualViewFactory implements
+		ContextualViewFactory<BlockingControlLink> {
+	@Override
+	public boolean canHandle(Object object) {
+		return object instanceof Condition;
+	}
+
+	@Override
+	public List<ContextualView> getViews(BlockingControlLink condition) {
+		return asList(new ContextualView[] { new ConditionContextualView(
+				condition) });
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-contextual-views-impl/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/dataflow/DataflowContextualView.java
----------------------------------------------------------------------
diff --git a/taverna-contextual-views-impl/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/dataflow/DataflowContextualView.java b/taverna-contextual-views-impl/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/dataflow/DataflowContextualView.java
new file mode 100644
index 0000000..d40d75a
--- /dev/null
+++ b/taverna-contextual-views-impl/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/dataflow/DataflowContextualView.java
@@ -0,0 +1,124 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.views.contextualviews.dataflow;
+
+import static org.apache.taverna.lang.ui.HtmlUtils.buildTableOpeningTag;
+import static org.apache.taverna.lang.ui.HtmlUtils.createEditorPane;
+import static org.apache.taverna.lang.ui.HtmlUtils.getHtmlHead;
+import static org.apache.taverna.lang.ui.HtmlUtils.panelForHtml;
+
+import javax.swing.JComponent;
+import javax.swing.JEditorPane;
+
+import org.apache.taverna.workbench.configuration.colour.ColourManager;
+import org.apache.taverna.workbench.file.FileManager;
+import org.apache.taverna.workbench.ui.views.contextualviews.ContextualView;
+import org.apache.taverna.workflowmodel.Dataflow;
+import org.apache.taverna.scufl2.api.core.Workflow;
+import org.apache.taverna.scufl2.api.port.InputWorkflowPort;
+import org.apache.taverna.scufl2.api.port.OutputWorkflowPort;
+
+/**
+ * @author alanrw
+ */
+@SuppressWarnings("serial")
+class DataflowContextualView extends ContextualView {
+	private static int MAX_LENGTH = 50;
+	private static final String ELLIPSIS = "...";
+
+	private Workflow dataflow;
+	private JEditorPane editorPane;
+	private final FileManager fileManager;
+	private final ColourManager colourManager;
+
+	public DataflowContextualView(Workflow dataflow, FileManager fileManager,
+			ColourManager colourManager) {
+		this.dataflow = dataflow;
+		this.fileManager = fileManager;
+		this.colourManager = colourManager;
+		initView();
+	}
+
+	@Override
+	public JComponent getMainFrame() {
+		editorPane = createEditorPane(buildHtml());
+		return panelForHtml(editorPane);
+	}
+
+	private String buildHtml() {
+		StringBuilder html = new StringBuilder(getHtmlHead(getBackgroundColour()));
+		html.append(buildTableOpeningTag());
+
+		html.append("<tr><td colspan=\"2\" align=\"center\"><b>Source</b></td></tr>");
+		String source = "Newly created";
+		if (fileManager.getDataflowSource(dataflow.getParent()) != null)
+			source = fileManager.getDataflowName(dataflow.getParent());
+
+		html.append("<tr><td colspan=\"2\" align=\"center\">").append(source)
+				.append("</td></tr>");
+		if (!dataflow.getInputPorts().isEmpty()) {
+			html.append("<tr><th>Input Port Name</th><th>Depth</th></tr>");
+			for (InputWorkflowPort dip : dataflow.getInputPorts())
+				html.append("<tr><td>")
+						.append(dip.getName())
+						.append("</td><td>")
+						.append(dip.getDepth() < 0 ? "invalid/unpredicted"
+								: dip.getDepth()).append("</td></tr>");
+		}
+		if (!dataflow.getOutputPorts().isEmpty()) {
+			html.append("<tr><th>Output Port Name</th><th>Depth</th></tr>");
+			for (OutputWorkflowPort dop : dataflow.getOutputPorts())
+				html.append("<tr><td>")
+						.append(dop.getName())
+						.append("</td><td>")
+						.append(/*(dop.getDepth() < 0 ?*/ "invalid/unpredicted" /*: dop.getDepth())*/)
+						.append("</td>" + "</tr>");
+		}
+
+		return html.append("</table>").append("</body></html>").toString();
+	}
+
+	public String getBackgroundColour() {
+		return colourManager.getDefaultPropertyMap().get(
+				Dataflow.class.toString());
+	}
+
+	@Override
+	public int getPreferredPosition() {
+		return 100;
+	}
+
+	private String limitName(String fullName) {
+		if (fullName.length() <= MAX_LENGTH)
+			return fullName;
+		return fullName.substring(0, MAX_LENGTH - ELLIPSIS.length()) + ELLIPSIS;
+	}
+
+	@Override
+	public String getViewTitle() {
+		return "Workflow " + limitName(dataflow.getName());
+	}
+
+	@Override
+	public void refreshView() {
+		editorPane.setText(buildHtml());
+		repaint();
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-contextual-views-impl/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/dataflow/DataflowContextualViewFactory.java
----------------------------------------------------------------------
diff --git a/taverna-contextual-views-impl/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/dataflow/DataflowContextualViewFactory.java b/taverna-contextual-views-impl/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/dataflow/DataflowContextualViewFactory.java
new file mode 100644
index 0000000..9bb3fed
--- /dev/null
+++ b/taverna-contextual-views-impl/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/dataflow/DataflowContextualViewFactory.java
@@ -0,0 +1,57 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.views.contextualviews.dataflow;
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.apache.taverna.workbench.configuration.colour.ColourManager;
+import org.apache.taverna.workbench.file.FileManager;
+import org.apache.taverna.workbench.ui.views.contextualviews.ContextualView;
+import org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory;
+import org.apache.taverna.scufl2.api.core.Workflow;
+
+/**
+ * @author alanrw
+ */
+public class DataflowContextualViewFactory implements
+		ContextualViewFactory<Workflow> {
+	private FileManager fileManager;
+	private ColourManager colourManager;
+
+	@Override
+	public boolean canHandle(Object selection) {
+		return selection instanceof Workflow;
+	}
+
+	@Override
+	public List<ContextualView> getViews(Workflow selection) {
+		return Arrays.asList(new ContextualView[] {
+				new DataflowContextualView(selection, fileManager, colourManager)});
+	}
+
+	public void setFileManager(FileManager fileManager) {
+		this.fileManager = fileManager;
+	}
+
+	public void setColourManager(ColourManager colourManager) {
+		this.colourManager = colourManager;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-contextual-views-impl/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/dataflowinputport/DataflowInputPortContextualView.java
----------------------------------------------------------------------
diff --git a/taverna-contextual-views-impl/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/dataflowinputport/DataflowInputPortContextualView.java b/taverna-contextual-views-impl/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/dataflowinputport/DataflowInputPortContextualView.java
new file mode 100644
index 0000000..e2a0c30
--- /dev/null
+++ b/taverna-contextual-views-impl/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/dataflowinputport/DataflowInputPortContextualView.java
@@ -0,0 +1,95 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.views.contextualviews.dataflowinputport;
+
+import static java.awt.FlowLayout.LEFT;
+
+import java.awt.FlowLayout;
+import java.awt.Frame;
+import java.awt.event.ActionEvent;
+
+import javax.swing.AbstractAction;
+import javax.swing.Action;
+import javax.swing.JComponent;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.border.EmptyBorder;
+
+import org.apache.taverna.scufl2.api.port.InputWorkflowPort;
+import org.apache.taverna.workbench.file.FileManager;
+import org.apache.taverna.workbench.ui.views.contextualviews.ContextualView;
+
+/**
+ * Contextual view for dataflow's input ports.
+ *
+ * @author Alex Nenadic
+ */
+class DataflowInputPortContextualView extends ContextualView{
+	private static final long serialVersionUID = -8746856072335775933L;
+
+	private InputWorkflowPort dataflowInputPort;
+	private JPanel dataflowInputPortView;
+	@SuppressWarnings("unused")
+	private FileManager fileManager;
+
+	public DataflowInputPortContextualView(InputWorkflowPort inputport,
+			FileManager fileManager) {
+		this.dataflowInputPort = inputport;
+		this.fileManager = fileManager;
+		initView();
+	}
+
+	@Override
+	public JComponent getMainFrame() {
+		refreshView();
+		return dataflowInputPortView;
+	}
+
+	@Override
+	public String getViewTitle() {
+		return "Workflow input port: " + dataflowInputPort.getName();
+	}
+
+	@Override
+	public void refreshView() {
+		dataflowInputPortView = new JPanel(new FlowLayout(LEFT));
+		dataflowInputPortView.setBorder(new EmptyBorder(5, 5, 5, 5));
+		JLabel label = new JLabel(getTextFromDepth("port",
+				dataflowInputPort.getDepth()));
+		dataflowInputPortView.add(label);
+	}
+
+	@SuppressWarnings("serial")
+	@Override
+	public Action getConfigureAction(Frame owner) {
+		return new AbstractAction("Update prediction") {
+			@Override
+			public void actionPerformed(ActionEvent e) {
+				// fileManager.getCurrentDataflow().checkValidity();
+				refreshView();
+			}
+		};
+	}
+
+	@Override
+	public int getPreferredPosition() {
+		return 100;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-contextual-views-impl/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/dataflowinputport/DataflowInputPortContextualViewFactory.java
----------------------------------------------------------------------
diff --git a/taverna-contextual-views-impl/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/dataflowinputport/DataflowInputPortContextualViewFactory.java b/taverna-contextual-views-impl/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/dataflowinputport/DataflowInputPortContextualViewFactory.java
new file mode 100644
index 0000000..e53ce14
--- /dev/null
+++ b/taverna-contextual-views-impl/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/dataflowinputport/DataflowInputPortContextualViewFactory.java
@@ -0,0 +1,53 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.views.contextualviews.dataflowinputport;
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.apache.taverna.workbench.file.FileManager;
+import org.apache.taverna.workbench.ui.views.contextualviews.ContextualView;
+import org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory;
+import org.apache.taverna.scufl2.api.port.InputWorkflowPort;
+
+/**
+ * A factory of contextual views for dataflow's input ports.
+ *
+ * @author Alex Nenadic
+ */
+public class DataflowInputPortContextualViewFactory implements
+		ContextualViewFactory<InputWorkflowPort> {
+	private FileManager fileManager;
+
+	@Override
+	public boolean canHandle(Object object) {
+		return object instanceof InputWorkflowPort;
+	}
+
+	@Override
+	public List<ContextualView> getViews(InputWorkflowPort inputport) {
+		return Arrays.asList(new ContextualView[] {
+				new DataflowInputPortContextualView(inputport, fileManager)});
+	}
+
+	public void setFileManager(FileManager fileManager) {
+		this.fileManager = fileManager;
+	}
+}


[38/51] [partial] incubator-taverna-workbench git commit: all packages are moved to org.apache.taverna.*

Posted by re...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-contextual-views-impl/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/dataflowoutputport/DataflowOutputPortContextualView.java
----------------------------------------------------------------------
diff --git a/taverna-contextual-views-impl/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/dataflowoutputport/DataflowOutputPortContextualView.java b/taverna-contextual-views-impl/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/dataflowoutputport/DataflowOutputPortContextualView.java
new file mode 100644
index 0000000..eb9f744
--- /dev/null
+++ b/taverna-contextual-views-impl/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/dataflowoutputport/DataflowOutputPortContextualView.java
@@ -0,0 +1,105 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.views.contextualviews.dataflowoutputport;
+
+import static java.awt.FlowLayout.LEFT;
+
+import java.awt.FlowLayout;
+import java.awt.Frame;
+import java.awt.event.ActionEvent;
+
+import javax.swing.AbstractAction;
+import javax.swing.Action;
+import javax.swing.JComponent;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.border.EmptyBorder;
+
+import org.apache.taverna.scufl2.api.port.OutputWorkflowPort;
+import org.apache.taverna.workbench.file.FileManager;
+import org.apache.taverna.workbench.ui.views.contextualviews.ContextualView;
+
+/**
+ * Contextual view for dataflow's output ports.
+ *
+ * @author Alex Nenadic
+ */
+public class DataflowOutputPortContextualView extends ContextualView {
+	private static final long serialVersionUID = 5496014085110553051L;
+
+	private OutputWorkflowPort dataflowOutputPort;
+	private JPanel dataflowOutputPortView;
+	@SuppressWarnings("unused")
+	private FileManager fileManager;
+
+	public DataflowOutputPortContextualView(OutputWorkflowPort outputport,
+			FileManager fileManager) {
+		this.dataflowOutputPort = outputport;
+		this.fileManager = fileManager;
+		initView();
+	}
+
+	@Override
+	public JComponent getMainFrame() {
+		refreshView();
+		return dataflowOutputPortView;
+	}
+
+	@Override
+	public String getViewTitle() {
+		return "Workflow output port: " + dataflowOutputPort.getName();
+	}
+
+	@Override
+	public void refreshView() {
+		dataflowOutputPortView = new JPanel(new FlowLayout(LEFT));
+		dataflowOutputPortView.setBorder(new EmptyBorder(5,5,5,5));
+		JLabel label = new JLabel(getTextForLabel());
+		dataflowOutputPortView.add(label);
+	}
+
+	private String getTextForLabel() {
+		//FIXME
+		//return getTextFromDepth("port", dataflowOutputPort.getDepth());
+		return "Fix depth for OutputWorkflowPort";
+	}
+
+	private void updatePrediction() {
+		//FIXME
+		// fileManager.getCurrentDataflow().checkValidity();
+	}
+
+	@Override
+	@SuppressWarnings("serial")
+	public Action getConfigureAction(Frame owner) {
+		return new AbstractAction("Update prediction") {
+			@Override
+			public void actionPerformed(ActionEvent e) {
+				updatePrediction();
+				refreshView();
+			}
+		};
+	}
+
+	@Override
+	public int getPreferredPosition() {
+		return 100;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-contextual-views-impl/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/dataflowoutputport/DataflowOutputPortContextualViewFactory.java
----------------------------------------------------------------------
diff --git a/taverna-contextual-views-impl/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/dataflowoutputport/DataflowOutputPortContextualViewFactory.java b/taverna-contextual-views-impl/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/dataflowoutputport/DataflowOutputPortContextualViewFactory.java
new file mode 100644
index 0000000..a571df1
--- /dev/null
+++ b/taverna-contextual-views-impl/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/dataflowoutputport/DataflowOutputPortContextualViewFactory.java
@@ -0,0 +1,54 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.views.contextualviews.dataflowoutputport;
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.apache.taverna.workbench.file.FileManager;
+import org.apache.taverna.workbench.ui.views.contextualviews.ContextualView;
+import org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory;
+import org.apache.taverna.workflowmodel.DataflowOutputPort;
+import org.apache.taverna.scufl2.api.port.OutputWorkflowPort;
+
+/**
+ * A factory of contextual views for dataflow's output ports.
+ *
+ * @author Alex Nenadic
+ */
+public class DataflowOutputPortContextualViewFactory implements
+		ContextualViewFactory<OutputWorkflowPort> {
+	private FileManager fileManager;
+
+	@Override
+	public boolean canHandle(Object object) {
+		return object instanceof DataflowOutputPort;
+	}
+
+	@Override
+	public List<ContextualView> getViews(OutputWorkflowPort outputport) {
+		return Arrays.asList(new ContextualView[] {
+				new DataflowOutputPortContextualView(outputport, fileManager)});
+	}
+
+	public void setFileManager(FileManager fileManager) {
+		this.fileManager = fileManager;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-contextual-views-impl/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/datalink/DatalinkContextualView.java
----------------------------------------------------------------------
diff --git a/taverna-contextual-views-impl/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/datalink/DatalinkContextualView.java b/taverna-contextual-views-impl/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/datalink/DatalinkContextualView.java
new file mode 100644
index 0000000..2b40fde
--- /dev/null
+++ b/taverna-contextual-views-impl/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/datalink/DatalinkContextualView.java
@@ -0,0 +1,105 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.views.contextualviews.datalink;
+
+import static java.awt.FlowLayout.LEFT;
+
+import java.awt.FlowLayout;
+import java.awt.Frame;
+import java.awt.event.ActionEvent;
+
+import javax.swing.AbstractAction;
+import javax.swing.Action;
+import javax.swing.JComponent;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.border.EmptyBorder;
+
+import org.apache.taverna.scufl2.api.core.DataLink;
+import org.apache.taverna.workbench.file.FileManager;
+import org.apache.taverna.workbench.ui.views.contextualviews.ContextualView;
+
+/**
+ * Contextual view for dataflow's datalinks.
+ *
+ * @author Alex Nenadic
+ * @author Alan R Williams
+ */
+class DatalinkContextualView extends ContextualView {
+	private static final long serialVersionUID = -5031256519235454876L;
+
+	private DataLink datalink;
+	private JPanel datalinkView;
+	@SuppressWarnings("unused")
+	private final FileManager fileManager;
+
+	public DatalinkContextualView(DataLink datalink, FileManager fileManager) {
+		this.datalink = datalink;
+		this.fileManager = fileManager;
+		initView();
+	}
+
+	@Override
+	public JComponent getMainFrame() {
+		refreshView();
+		return datalinkView;
+	}
+
+	@Override
+	public String getViewTitle() {
+		return "Data link: " + datalink.getReceivesFrom().getName() + " -> " + datalink.getSendsTo().getName();
+	}
+
+	@Override
+	public void refreshView() {
+		datalinkView = new JPanel(new FlowLayout(LEFT));
+		datalinkView.setBorder(new EmptyBorder(5,5,5,5));
+		JLabel label = new JLabel (getTextForLabel());
+		datalinkView.add(label);
+	}
+
+	private String getTextForLabel() {
+		//FIXME
+		// return getTextFromDepth("link", datalink.getResolvedDepth());
+		return "Fix DataLink resolved depth";
+	}
+
+	private void updatePrediction() {
+		//FIXME
+		// fileManager.getCurrentDataflow().checkValidity();
+	}
+
+	@Override
+	@SuppressWarnings("serial")
+	public Action getConfigureAction(Frame owner) {
+		return new AbstractAction("Update prediction") {
+			@Override
+			public void actionPerformed(ActionEvent e) {
+				updatePrediction();
+				refreshView();
+			}
+		};
+	}
+
+	@Override
+	public int getPreferredPosition() {
+		return 100;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-contextual-views-impl/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/datalink/DatalinkContextualViewFactory.java
----------------------------------------------------------------------
diff --git a/taverna-contextual-views-impl/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/datalink/DatalinkContextualViewFactory.java b/taverna-contextual-views-impl/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/datalink/DatalinkContextualViewFactory.java
new file mode 100644
index 0000000..449ba52
--- /dev/null
+++ b/taverna-contextual-views-impl/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/datalink/DatalinkContextualViewFactory.java
@@ -0,0 +1,54 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.views.contextualviews.datalink;
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.apache.taverna.workbench.file.FileManager;
+import org.apache.taverna.workbench.ui.views.contextualviews.ContextualView;
+import org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory;
+import org.apache.taverna.workflowmodel.Datalink;
+import org.apache.taverna.scufl2.api.core.DataLink;
+
+/**
+ * A factory of contextual views for dataflow's datalinks.
+ *
+ * @author Alex Nenadic
+ */
+public class DatalinkContextualViewFactory implements
+		ContextualViewFactory<DataLink> {
+	private FileManager fileManager;
+
+	@Override
+	public boolean canHandle(Object object) {
+		return object instanceof Datalink;
+	}
+
+	@Override
+	public List<ContextualView> getViews(DataLink datalink) {
+		return Arrays.asList(new ContextualView[] {
+				new DatalinkContextualView(datalink, fileManager)});
+	}
+
+	public void setFileManager(FileManager fileManager) {
+		this.fileManager = fileManager;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-contextual-views-impl/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/impl/ContextualViewComponent.java
----------------------------------------------------------------------
diff --git a/taverna-contextual-views-impl/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/impl/ContextualViewComponent.java b/taverna-contextual-views-impl/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/impl/ContextualViewComponent.java
new file mode 100644
index 0000000..8099239
--- /dev/null
+++ b/taverna-contextual-views-impl/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/impl/ContextualViewComponent.java
@@ -0,0 +1,408 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.views.contextualviews.impl;
+
+import static java.awt.GridBagConstraints.BOTH;
+import static java.awt.GridBagConstraints.CENTER;
+import static java.awt.GridBagConstraints.HORIZONTAL;
+import static java.awt.GridBagConstraints.LINE_START;
+import static java.awt.GridBagConstraints.NONE;
+import static org.apache.taverna.lang.ui.ShadedLabel.BLUE;
+import static org.apache.taverna.lang.ui.ShadedLabel.GREEN;
+import static org.apache.taverna.lang.ui.ShadedLabel.ORANGE;
+import static org.apache.taverna.workbench.icons.WorkbenchIcons.minusIcon;
+import static org.apache.taverna.workbench.icons.WorkbenchIcons.plusIcon;
+
+import java.awt.Color;
+import java.awt.Frame;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+
+import javax.swing.Action;
+import javax.swing.ImageIcon;
+import javax.swing.JButton;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.SwingUtilities;
+import javax.swing.Timer;
+
+import org.apache.taverna.lang.observer.Observable;
+import org.apache.taverna.lang.observer.Observer;
+import org.apache.taverna.lang.observer.SwingAwareObserver;
+import org.apache.taverna.lang.ui.ShadedLabel;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.edits.EditManager.EditManagerEvent;
+import org.apache.taverna.workbench.selection.DataflowSelectionModel;
+import org.apache.taverna.workbench.selection.SelectionManager;
+import org.apache.taverna.workbench.selection.events.DataflowSelectionMessage;
+import org.apache.taverna.workbench.selection.events.SelectionManagerEvent;
+import org.apache.taverna.workbench.selection.events.WorkflowBundleSelectionEvent;
+import org.apache.taverna.workbench.ui.Utils;
+import org.apache.taverna.workbench.ui.views.contextualviews.ContextualView;
+import org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory;
+import org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactoryRegistry;
+import org.apache.taverna.workbench.ui.zaria.UIComponentSPI;
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+
+@SuppressWarnings("serial")
+public class ContextualViewComponent extends JScrollPane implements UIComponentSPI {
+	/** delay before contextual view is redrawn */
+	private static final int DELAY = 250;
+	private static final Color[] colors = new Color[] { BLUE, GREEN, ORANGE };
+	// HACK ALERT!
+	public static boolean selfGenerated = false;
+
+	private Observer<DataflowSelectionMessage> dataflowSelectionListener = new DataflowSelectionListener();
+	private SelectionManager selectionManager;
+	private ContextualViewFactoryRegistry contextualViewFactoryRegistry;
+	GridBagConstraints gbc;
+	protected Map<JPanel, SectionLabel> panelToLabelMap = new HashMap<>();
+	private String lastOpenedSectionName = "";
+	private JPanel mainPanel;
+	private List<JPanel> shownComponents = null;
+	int colorIndex = 0;
+	private Timer updateSelectionTimer = null;
+	private Object lastSelectedObject = null;
+
+	private static final Comparator<ContextualView> viewComparator = new Comparator<ContextualView>() {
+		@Override
+		public int compare(ContextualView o1, ContextualView o2) {
+			return o1.getPreferredPosition() - o2.getPreferredPosition();
+		}
+	};
+
+	public ContextualViewComponent(EditManager editManager,
+			SelectionManager selectionManager,
+			ContextualViewFactoryRegistry contextualViewFactoryRegistry) {
+		this.selectionManager = selectionManager;
+		this.contextualViewFactoryRegistry = contextualViewFactoryRegistry;
+		updateSelectionTimer = new Timer(DELAY, updateSelectionListener);
+		updateSelectionTimer.setRepeats(false);
+
+		initialise();
+
+		editManager.addObserver(new EditManagerObserver());
+		selectionManager.addObserver(new SelectionManagerObserver());
+	}
+
+	@Override
+	public ImageIcon getIcon() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public String getName() {
+		return "Details";
+	}
+
+	private void initialise() {
+		mainPanel = new JPanel(new GridBagLayout());
+		this.setViewportView(mainPanel);
+	}
+
+	@Override
+	public void onDisplay() {
+	}
+
+	@Override
+	public void onDispose() {
+		updateSelectionTimer.stop();
+	}
+
+	@SuppressWarnings("unchecked")
+	private void updateContextualView(List<ContextualViewFactory<? super Object>> viewFactories,
+			Object selection) {
+		if (selection == lastSelectedObject)
+			return;
+		lastSelectedObject = selection;
+		mainPanel = new JPanel(new GridBagLayout());
+		panelToLabelMap.clear();
+
+		GridBagConstraints gbc = new GridBagConstraints();
+		gbc.gridx = 0;
+		gbc.weightx = 0.1;
+		gbc.fill = HORIZONTAL;
+
+		gbc.gridy = 0;
+		shownComponents = new ArrayList<>();
+		List<ContextualView> views = new ArrayList<>();
+		for (ContextualViewFactory<?> cvf : viewFactories)
+			views.addAll(((ContextualViewFactory<Object>) cvf)
+					.getViews(selection));
+		Collections.sort(views, viewComparator);
+		colorIndex = 0;
+		if (views.isEmpty())
+			mainPanel.add(new JLabel("No details available"));
+		else
+			populateContextualView(viewFactories, gbc, views);
+		gbc.weighty = 0.1;
+		gbc.fill = BOTH;
+		mainPanel.add(new JPanel(), gbc);
+		// mainPanel.revalidate();
+		// mainPanel.repaint();
+		this.setViewportView(mainPanel);
+		// this.revalidate();
+		// this.repaint();
+	}
+
+	private void populateContextualView(
+			List<ContextualViewFactory<? super Object>> viewFactories,
+			GridBagConstraints gbc, List<ContextualView> views) {
+		JPanel firstPanel = null;
+		JPanel lastOpenedSection = null;
+		for (ContextualView view : views) {
+			SectionLabel label = new SectionLabel(view.getViewTitle(), nextColor());
+			mainPanel.add(label, gbc);
+			gbc.gridy++;
+			JPanel subPanel = new JPanel();
+			if (view.getViewTitle().equals(lastOpenedSectionName))
+				lastOpenedSection = subPanel;
+			subPanel.setLayout(new GridBagLayout());
+
+			GridBagConstraints constraints = new GridBagConstraints();
+			constraints.gridx = 0;
+			constraints.gridy = 0;
+			constraints.weightx = 0.1;
+			constraints.weighty = 0;
+			constraints.anchor = CENTER;
+			constraints.fill = HORIZONTAL;
+
+			subPanel.add(view, constraints);
+			Frame frame = Utils.getParentFrame(this);
+			Action configureAction = view.getConfigureAction(frame);
+			if (configureAction != null) {
+				JButton configButton = new JButton(configureAction);
+				if (configButton.getText() == null
+						|| configButton.getText().isEmpty())
+					configButton.setText("Configure");
+				constraints.gridy++;
+				constraints.fill = NONE;
+				constraints.anchor = LINE_START;
+				subPanel.add(configButton, constraints);
+			}
+			if (firstPanel == null)
+				firstPanel = subPanel;
+			mainPanel.add(subPanel, gbc);
+			shownComponents.add(subPanel);
+			gbc.gridy++;
+			if (viewFactories.size() != 1)
+				makeCloseable(subPanel, label);
+			else {
+				lastOpenedSectionName = label.getText();
+				lastOpenedSection = subPanel;
+				panelToLabelMap.put(subPanel, label);
+				subPanel.setVisible(false);
+			}
+		}
+		if (lastOpenedSection != null)
+			openSection(lastOpenedSection);
+		else if (firstPanel != null)
+			openSection(firstPanel);
+	}
+
+	private void clearContextualView() {
+		lastSelectedObject = null;
+		mainPanel = new JPanel(new GridBagLayout());
+		mainPanel.add(new JLabel("No details available"));
+		this.setViewportView(mainPanel);
+		this.revalidate();
+	}
+
+	public void updateSelection(Object selectedItem) {
+		findContextualView(selectedItem);
+	}
+
+	private Runnable updateSelectionRunnable = new Runnable() {
+		@Override
+		public void run() {
+			Object selection = getSelection();
+			if (selection == null)
+				clearContextualView();
+			else
+				updateSelection(selection);
+		}
+	};
+
+	private ActionListener updateSelectionListener = new ActionListener() {
+		@Override
+		public void actionPerformed(ActionEvent e) {
+			SwingUtilities.invokeLater(updateSelectionRunnable);
+		}
+	};
+
+	public void updateSelection() {
+		updateSelectionTimer.restart();
+	}
+
+	private Object getSelection() {
+		WorkflowBundle workflowBundle = selectionManager.getSelectedWorkflowBundle();
+
+		/*
+		 * If there is no currently opened dataflow, clear the contextual view
+		 * panel
+		 */
+		if (workflowBundle == null) {
+			return null;
+		}
+		DataflowSelectionModel selectionModel = selectionManager
+				.getDataflowSelectionModel(workflowBundle);
+		Set<Object> selection = selectionModel.getSelection();
+
+		/*
+		 * If the dataflow is opened but no component of the dataflow is
+		 * selected, clear the contextual view panel
+		 */
+		if (selection.isEmpty())
+			return null;
+		return selection.iterator().next();
+	}
+
+	private void findContextualView(Object selection) {
+		List<ContextualViewFactory<? super Object>> viewFactoriesForBeanType = contextualViewFactoryRegistry
+				.getViewFactoriesForObject(selection);
+		updateContextualView(viewFactoriesForBeanType, selection);
+	}
+
+	private final class SelectionManagerObserver extends SwingAwareObserver<SelectionManagerEvent> {
+		@Override
+		public void notifySwing(Observable<SelectionManagerEvent> sender, SelectionManagerEvent message) {
+			if (message instanceof WorkflowBundleSelectionEvent)
+				bundleSelected((WorkflowBundleSelectionEvent) message);
+		}
+
+		private void bundleSelected(WorkflowBundleSelectionEvent event) {
+			WorkflowBundle oldBundle = event
+					.getPreviouslySelectedWorkflowBundle();
+			WorkflowBundle newBundle = event.getSelectedWorkflowBundle();
+
+			if (oldBundle != null)
+				selectionManager.getDataflowSelectionModel(oldBundle)
+						.removeObserver(dataflowSelectionListener);
+			if (newBundle != null)
+				selectionManager.getDataflowSelectionModel(newBundle)
+						.addObserver(dataflowSelectionListener);
+			lastSelectedObject = null;
+			updateSelection();
+		}
+	}
+
+	private final class DataflowSelectionListener extends SwingAwareObserver<DataflowSelectionMessage> {
+		@Override
+		public void notifySwing(Observable<DataflowSelectionMessage> sender,
+				DataflowSelectionMessage message) {
+			updateSelection();
+		}
+	}
+
+	private final class EditManagerObserver extends SwingAwareObserver<EditManagerEvent> {
+		@Override
+		public void notifySwing(Observable<EditManagerEvent> sender, EditManagerEvent message) {
+			Object selection = getSelection();
+			if ((selection != lastSelectedObject) && !selfGenerated) {
+				lastSelectedObject = null;
+				refreshView();
+			}
+		}
+	}
+
+	public void refreshView() {
+		if (mainPanel != null)
+			updateSelection();
+	}
+
+	private final class SectionLabel extends ShadedLabel {
+		private JLabel expand;
+
+		private SectionLabel(String text, Color colour) {
+			super(text, colour);
+			expand = new JLabel(minusIcon);
+			add(expand, 0);
+			setExpanded(true);
+		}
+
+		public void setExpanded(boolean expanded) {
+			if (expanded)
+				expand.setIcon(minusIcon);
+			else
+				expand.setIcon(plusIcon);
+		}
+	}
+
+	private void makeCloseable(JPanel panel, SectionLabel label) {
+		panel.setVisible(false);
+		if (panelToLabelMap.get(panel) != label) {
+			panelToLabelMap.put(panel, label);
+			// Only add mouse listener once
+			label.addMouseListener(new SectionOpener(panel));
+		}
+	}
+
+	protected class SectionOpener extends MouseAdapter {
+		private final JPanel sectionToOpen;
+
+		public SectionOpener(JPanel sectionToOpen) {
+			this.sectionToOpen = sectionToOpen;
+		}
+
+		@Override
+		public void mouseClicked(MouseEvent e) {
+			openSection(sectionToOpen);
+		}
+	}
+
+	public synchronized void openSection(JPanel sectionToOpen) {
+		lastOpenedSectionName = "";
+		for (Entry<JPanel, SectionLabel> entry : panelToLabelMap.entrySet()) {
+			JPanel section = entry.getKey();
+			SectionLabel sectionLabel = entry.getValue();
+
+			if (section != sectionToOpen)
+				section.setVisible(false);
+			else {
+				section.setVisible(!section.isVisible());
+				if (section.isVisible())
+					lastOpenedSectionName = sectionLabel.getText();
+			}
+			sectionLabel.setExpanded(section.isVisible());
+		}
+		this.revalidate();
+		this.repaint();
+	}
+
+	private Color nextColor() {
+		if (colorIndex >= colors.length)
+			colorIndex = 0;
+		return colors[colorIndex++];
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-contextual-views-impl/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/impl/ContextualViewComponentFactory.java
----------------------------------------------------------------------
diff --git a/taverna-contextual-views-impl/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/impl/ContextualViewComponentFactory.java b/taverna-contextual-views-impl/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/impl/ContextualViewComponentFactory.java
new file mode 100644
index 0000000..c3f7196
--- /dev/null
+++ b/taverna-contextual-views-impl/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/impl/ContextualViewComponentFactory.java
@@ -0,0 +1,63 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.views.contextualviews.impl;
+
+import javax.swing.ImageIcon;
+
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.selection.SelectionManager;
+import org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactoryRegistry;
+import org.apache.taverna.workbench.ui.zaria.UIComponentFactorySPI;
+import org.apache.taverna.workbench.ui.zaria.UIComponentSPI;
+
+public class ContextualViewComponentFactory implements UIComponentFactorySPI {
+	private EditManager editManager;
+	private SelectionManager selectionManager;
+	private ContextualViewFactoryRegistry contextualViewFactoryRegistry;
+
+	@Override
+	public UIComponentSPI getComponent() {
+		return new ContextualViewComponent(editManager, selectionManager,
+				contextualViewFactoryRegistry);
+	}
+
+	@Override
+	public ImageIcon getIcon() {
+		return null;
+	}
+
+	@Override
+	public String getName() {
+		return "Details";
+	}
+
+	public void setEditManager(EditManager editManager) {
+		this.editManager = editManager;
+	}
+
+	public void setSelectionManager(SelectionManager selectionManager) {
+		this.selectionManager = selectionManager;
+	}
+
+	public void setContextualViewFactoryRegistry(
+			ContextualViewFactoryRegistry contextualViewFactoryRegistry) {
+		this.contextualViewFactoryRegistry = contextualViewFactoryRegistry;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-contextual-views-impl/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/inputport/InputPortContextualView.java
----------------------------------------------------------------------
diff --git a/taverna-contextual-views-impl/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/inputport/InputPortContextualView.java b/taverna-contextual-views-impl/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/inputport/InputPortContextualView.java
new file mode 100644
index 0000000..363beb9
--- /dev/null
+++ b/taverna-contextual-views-impl/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/inputport/InputPortContextualView.java
@@ -0,0 +1,75 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.views.contextualviews.inputport;
+
+import static java.awt.FlowLayout.LEFT;
+
+import java.awt.FlowLayout;
+
+import javax.swing.JComponent;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.border.EmptyBorder;
+
+import org.apache.taverna.scufl2.api.port.InputActivityPort;
+import org.apache.taverna.workbench.ui.views.contextualviews.ContextualView;
+
+/**
+ * Contextual view for dataflow procerssor's input ports.
+ * 
+ * @author Alex Nenadic
+ */
+class InputPortContextualView extends ContextualView {
+	private static final String NO_DETAILS_AVAILABLE_HTML = "<html><body>"
+			+ "<i>No details available.</i>" + "</body><html>";
+	private static final long serialVersionUID = -7743029534480678624L;
+
+	private InputActivityPort inputPort;
+	private JPanel inputPortView;
+
+	public InputPortContextualView(InputActivityPort inputport) {
+		this.inputPort = inputport;
+		initView();
+	}
+
+	@Override
+	public JComponent getMainFrame() {
+		refreshView();
+		return inputPortView;
+	}
+
+	@Override
+	public String getViewTitle() {
+		return "Service input port: " + inputPort.getName();
+	}
+
+	@Override
+	public void refreshView() {
+		inputPortView = new JPanel(new FlowLayout(LEFT));
+		inputPortView.setBorder(new EmptyBorder(5, 5, 5, 5));
+		JLabel label = new JLabel(NO_DETAILS_AVAILABLE_HTML);
+		inputPortView.add(label);
+	}
+
+	@Override
+	public int getPreferredPosition() {
+		return 100;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-contextual-views-impl/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/inputport/InputPortContextualViewFactory.java
----------------------------------------------------------------------
diff --git a/taverna-contextual-views-impl/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/inputport/InputPortContextualViewFactory.java b/taverna-contextual-views-impl/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/inputport/InputPortContextualViewFactory.java
new file mode 100644
index 0000000..12888ab
--- /dev/null
+++ b/taverna-contextual-views-impl/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/inputport/InputPortContextualViewFactory.java
@@ -0,0 +1,47 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.views.contextualviews.inputport;
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.apache.taverna.workbench.ui.views.contextualviews.ContextualView;
+import org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory;
+import org.apache.taverna.scufl2.api.port.InputActivityPort;
+
+/**
+ * A factory of contextual views for dataflow proessor's (i.e. its associated
+ * activity's) input ports.
+ *
+ * @author Alex Nenadic
+ */
+public class InputPortContextualViewFactory implements
+		ContextualViewFactory<InputActivityPort> {
+	@Override
+	public boolean canHandle(Object object) {
+		return object instanceof InputActivityPort;
+	}
+
+	@Override
+	public List<ContextualView> getViews(InputActivityPort inputport) {
+		return Arrays.asList(new ContextualView[] {
+				new InputPortContextualView(inputport)});
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-contextual-views-impl/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/merge/MergeConfigurationAction.java
----------------------------------------------------------------------
diff --git a/taverna-contextual-views-impl/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/merge/MergeConfigurationAction.java b/taverna-contextual-views-impl/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/merge/MergeConfigurationAction.java
new file mode 100644
index 0000000..4ea63f6
--- /dev/null
+++ b/taverna-contextual-views-impl/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/merge/MergeConfigurationAction.java
@@ -0,0 +1,78 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.views.contextualviews.merge;
+
+import java.awt.event.ActionEvent;
+import java.util.List;
+
+import javax.swing.AbstractAction;
+
+import org.apache.taverna.workbench.edits.EditException;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.selection.SelectionManager;
+import org.apache.taverna.workflow.edits.ReorderMergePositionsEdit;
+
+import org.apache.log4j.Logger;
+
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+import org.apache.taverna.scufl2.api.core.DataLink;
+
+/**
+ * Configuration action for a Merge. This action changes the order of
+ * merge's incoming ports.
+ *
+ * @author Alex Nenadic
+ *
+ */
+@SuppressWarnings("serial")
+class MergeConfigurationAction extends AbstractAction {
+	private static Logger logger = Logger
+			.getLogger(MergeConfigurationAction.class);
+
+	private final List<DataLink> reorderedDataLinksList;
+	private final List<DataLink> datalinks;
+	private final EditManager editManager;
+	private final SelectionManager selectionManager;
+
+	MergeConfigurationAction(List<DataLink> datalinks,
+			List<DataLink> reorderedDataLinksList, EditManager editManager,
+			SelectionManager selectionManager) {
+		this.datalinks = datalinks;
+		this.reorderedDataLinksList = reorderedDataLinksList;
+		this.editManager = editManager;
+		this.selectionManager = selectionManager;
+	}
+
+	@Override
+	public void actionPerformed(ActionEvent e) {
+		ReorderMergePositionsEdit edit = new ReorderMergePositionsEdit(
+				datalinks, reorderedDataLinksList);
+
+		WorkflowBundle bundle = selectionManager.getSelectedWorkflowBundle();
+
+		try {
+			editManager.doDataflowEdit(bundle, edit);
+		} catch (IllegalStateException ex1) {
+			logger.error("Could not configure merge", ex1);
+		} catch (EditException ex2) {
+			logger.error("Could not configure merge", ex2);
+		}
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-contextual-views-impl/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/merge/MergeConfigurationView.java
----------------------------------------------------------------------
diff --git a/taverna-contextual-views-impl/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/merge/MergeConfigurationView.java b/taverna-contextual-views-impl/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/merge/MergeConfigurationView.java
new file mode 100644
index 0000000..3fa0987
--- /dev/null
+++ b/taverna-contextual-views-impl/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/merge/MergeConfigurationView.java
@@ -0,0 +1,252 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.views.contextualviews.merge;
+
+import static java.awt.BorderLayout.EAST;
+import static java.awt.BorderLayout.NORTH;
+import static java.awt.BorderLayout.SOUTH;
+import static java.lang.Math.max;
+import static javax.swing.BoxLayout.Y_AXIS;
+import static javax.swing.ListSelectionModel.SINGLE_SELECTION;
+import static javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS;
+import static javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS;
+import static javax.swing.SwingConstants.CENTER;
+import static javax.swing.SwingConstants.LEFT;
+import static javax.swing.SwingConstants.RIGHT;
+import static org.apache.taverna.workbench.icons.WorkbenchIcons.downArrowIcon;
+import static org.apache.taverna.workbench.icons.WorkbenchIcons.upArrowIcon;
+
+import java.awt.BorderLayout;
+import java.awt.Dimension;
+import java.awt.FlowLayout;
+import java.awt.FontMetrics;
+import java.awt.Frame;
+import java.awt.event.ActionEvent;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.swing.AbstractAction;
+import javax.swing.BoxLayout;
+import javax.swing.DefaultListModel;
+import javax.swing.JButton;
+import javax.swing.JLabel;
+import javax.swing.JList;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.border.CompoundBorder;
+import javax.swing.border.EmptyBorder;
+import javax.swing.border.EtchedBorder;
+import javax.swing.event.ListSelectionEvent;
+import javax.swing.event.ListSelectionListener;
+
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.helper.HelpEnabledDialog;
+import org.apache.taverna.workbench.selection.SelectionManager;
+import org.apache.taverna.scufl2.api.core.DataLink;
+
+@SuppressWarnings("serial")
+public class MergeConfigurationView extends HelpEnabledDialog {
+	private static final String TITLE = "<html><body><b>Order of incoming links</b></body></html>";
+
+	private List<DataLink> dataLinks;
+	private List<DataLink> reorderedDataLinks;
+	/** Ordered list of labels for dataLinks to be displayed to the user */
+	private DefaultListModel<String> labelListModel;
+	/** JList that displays the labelListModel */
+	JList<String> list;
+	/** Button to push the dataLink up the list */
+	private JButton upButton;
+	/** Button to push the dataLink down the list */
+	private JButton downButton;
+	private final EditManager editManager;
+	private final SelectionManager selectionManager;
+
+	public MergeConfigurationView(List<DataLink> dataLinks, EditManager editManager,
+			SelectionManager selectionManager) {
+		super((Frame)null, "Merge Configuration", true);
+
+		this.dataLinks = new ArrayList<>(dataLinks);
+		reorderedDataLinks = new ArrayList<>(dataLinks);
+		this.editManager = editManager;
+		this.selectionManager = selectionManager;
+		labelListModel = new DefaultListModel<>();
+		for (DataLink dataLink : dataLinks)
+			labelListModel.addElement(dataLink.toString());
+
+		initComponents();
+	}
+
+	private void initComponents() {
+        getContentPane().setLayout(new BorderLayout());
+
+		JPanel listPanel = new JPanel();
+		listPanel.setLayout(new BorderLayout());
+		listPanel.setBorder(new CompoundBorder(new EmptyBorder(10, 10, 10, 10),
+				new EtchedBorder()));
+
+		JLabel title = new JLabel(TITLE);
+		title.setBorder(new EmptyBorder(5, 5, 5, 5));
+		listPanel.add(title, NORTH);
+
+		list = new JList<>(labelListModel);
+		list.setSelectionMode(SINGLE_SELECTION);
+		list.setVisibleRowCount(-1);
+		list.addListSelectionListener(new ListSelectionListener() {
+			/**
+			 * Enable and disable up and down buttons based on which item in the
+			 * list is selected
+			 */
+			@Override
+			public void valueChanged(ListSelectionEvent e) {
+				int index = list.getSelectedIndex();
+				if ((index == -1) || (index == 0 && labelListModel.size() == 0)) {
+					// nothing selected or only one item in the list
+					upButton.setEnabled(false);
+					downButton.setEnabled(false);
+				} else {
+					upButton.setEnabled(index > 0);
+					downButton.setEnabled(index < labelListModel.size() - 1);
+				}
+			}
+		});
+
+		final JScrollPane listScroller = new JScrollPane(list);
+		listScroller.setBorder(new EmptyBorder(5, 5, 5, 5));
+		listScroller.setBackground(listPanel.getBackground());
+		listScroller.setHorizontalScrollBarPolicy(HORIZONTAL_SCROLLBAR_ALWAYS);
+		listScroller.setVerticalScrollBarPolicy(VERTICAL_SCROLLBAR_ALWAYS);
+		// Set the size of scroll pane to make all list items visible
+		FontMetrics fm = listScroller.getFontMetrics(this.getFont());
+		int listScrollerHeight = fm.getHeight() * labelListModel.size() + 75; //+75 just in case
+		listScroller.setPreferredSize(new Dimension(listScroller
+				.getPreferredSize().width, max(listScrollerHeight,
+				listScroller.getPreferredSize().height)));
+		listPanel.add(listScroller, BorderLayout.CENTER);
+
+		JPanel upDownButtonPanel = new JPanel();
+		upDownButtonPanel.setLayout(new BoxLayout(upDownButtonPanel, Y_AXIS));
+		upDownButtonPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
+
+		upButton = new JButton(new AbstractAction() {
+			@Override
+			public void actionPerformed(ActionEvent e) {
+				int index = list.getSelectedIndex();
+				if (index != -1) {
+					// Swap the labels
+					String label = (String) labelListModel.elementAt(index);
+					labelListModel.set(index, labelListModel.get(index - 1));
+					labelListModel.set(index - 1, label);
+					// Swap the dataLinks
+					DataLink dataLink = reorderedDataLinks.get(index);
+					reorderedDataLinks.set(index,
+							reorderedDataLinks.get(index - 1));
+					reorderedDataLinks.set(index - 1, dataLink);
+					// Make the pushed item selected
+					list.setSelectedIndex(index - 1);
+					// Refresh the list
+					listScroller.repaint();
+					listScroller.revalidate();
+				}
+			}
+		});
+		upButton.setIcon(upArrowIcon);
+		upButton.setText("Up");
+	    // Place text to the right of icon, vertically centered
+		upButton.setVerticalTextPosition(CENTER);
+		upButton.setHorizontalTextPosition(RIGHT);
+		// Set the horizontal alignment of the icon and text
+		upButton.setHorizontalAlignment(LEFT);
+		upButton.setEnabled(false);
+		upDownButtonPanel.add(upButton);
+
+		downButton = new JButton(new AbstractAction() {
+			@Override
+			public void actionPerformed(ActionEvent e) {
+				int index = list.getSelectedIndex();
+				if (index != -1) {
+					// Swap the labels
+					String label = (String) labelListModel.elementAt(index);
+					labelListModel.set(index, labelListModel.get(index + 1));
+					labelListModel.set(index + 1, label);
+					// Swap the dataLinks
+					DataLink dataLink = reorderedDataLinks.get(index);
+					reorderedDataLinks.set(index,
+							reorderedDataLinks.get(index + 1));
+					reorderedDataLinks.set(index + 1, dataLink);
+					// Make the pushed item selected
+					list.setSelectedIndex(index + 1);
+					// Refresh the list
+					list.repaint();
+					listScroller.revalidate();
+				}
+			}
+		});
+		downButton.setIcon(downArrowIcon);
+		downButton.setText("Down");
+	    // Place text to the right of icon, vertically centered
+		downButton.setVerticalTextPosition(CENTER);
+		downButton.setHorizontalTextPosition(RIGHT);
+		// Set the horizontal alignment of the icon and text
+		downButton.setHorizontalAlignment(LEFT);
+		downButton.setEnabled(false);
+		// set the up button to be of the same size as down button
+		upButton.setPreferredSize(downButton.getPreferredSize());
+		upButton.setMaximumSize(downButton.getPreferredSize());
+		upButton.setMinimumSize(downButton.getPreferredSize());
+		upDownButtonPanel.add(downButton);
+
+		listPanel.add(upDownButtonPanel, EAST);
+
+		JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
+
+		JButton jbOK = new JButton("OK");
+		jbOK.addActionListener(new AbstractAction() {
+			@Override
+			public void actionPerformed(ActionEvent e) {
+				new MergeConfigurationAction(dataLinks, reorderedDataLinks,
+						editManager, selectionManager).actionPerformed(e);
+				closeDialog();
+			}
+		});
+
+		JButton jbCancel = new JButton("Cancel");
+		jbCancel.addActionListener(new AbstractAction() {
+			@Override
+			public void actionPerformed(ActionEvent e) {
+				closeDialog();
+			}
+		});
+
+        buttonPanel.add(jbOK);
+        buttonPanel.add(jbCancel);
+
+        getContentPane().add(listPanel, BorderLayout.CENTER);
+        getContentPane().add(buttonPanel, SOUTH);
+        pack();
+	}
+
+	/**
+	 * Close the dialog.
+	 */
+	private void closeDialog() {
+		setVisible(false);
+		dispose();
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-contextual-views-impl/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/merge/MergeContextualView.java
----------------------------------------------------------------------
diff --git a/taverna-contextual-views-impl/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/merge/MergeContextualView.java b/taverna-contextual-views-impl/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/merge/MergeContextualView.java
new file mode 100644
index 0000000..abdce77
--- /dev/null
+++ b/taverna-contextual-views-impl/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/merge/MergeContextualView.java
@@ -0,0 +1,149 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.views.contextualviews.merge;
+
+import static java.awt.BorderLayout.CENTER;
+import static java.awt.BorderLayout.SOUTH;
+import static java.awt.FlowLayout.LEFT;
+import static org.apache.taverna.lang.ui.HtmlUtils.buildTableOpeningTag;
+import static org.apache.taverna.lang.ui.HtmlUtils.createEditorPane;
+import static org.apache.taverna.lang.ui.HtmlUtils.getHtmlHead;
+
+import java.awt.BorderLayout;
+import java.awt.FlowLayout;
+import java.awt.event.ActionEvent;
+import java.util.List;
+
+import javax.swing.AbstractAction;
+import javax.swing.JButton;
+import javax.swing.JComponent;
+import javax.swing.JEditorPane;
+import javax.swing.JPanel;
+
+import org.apache.taverna.workbench.configuration.colour.ColourManager;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.selection.SelectionManager;
+import org.apache.taverna.workbench.ui.views.contextualviews.ContextualView;
+import org.apache.taverna.workflowmodel.Merge;
+import org.apache.taverna.scufl2.api.common.Scufl2Tools;
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+import org.apache.taverna.scufl2.api.core.DataLink;
+
+/**
+ * Contextual view for a {@link Merge}.
+ * 
+ * @author Alex Nenadic
+ */
+@SuppressWarnings("serial")
+class MergeContextualView extends ContextualView {
+	@SuppressWarnings("unused")
+	private DataLink dataLink;
+	private List<DataLink> datalinks;
+	@SuppressWarnings("unused")
+	private WorkflowBundle workflow;
+	private JEditorPane editorPane;
+	private final EditManager editManager;
+	private final ColourManager colourManager;
+	private final SelectionManager selectionManager;
+
+	// TODO inject from Spring via factory?
+	private Scufl2Tools scufl2Tools = new Scufl2Tools();
+
+	public MergeContextualView(DataLink dataLink, EditManager editManager,
+			SelectionManager selectionManager, ColourManager colourManager) {
+		this.dataLink = dataLink;
+		this.selectionManager = selectionManager;
+		datalinks = scufl2Tools.datalinksTo(dataLink.getSendsTo());
+		this.editManager = editManager;
+		this.colourManager = colourManager;
+		workflow = selectionManager.getSelectedWorkflowBundle();
+		initView();
+	}
+
+	@Override
+	public JComponent getMainFrame() {
+		editorPane = createEditorPane(buildHtml());
+		return panelForHtml(editorPane);
+	}
+
+	@Override
+	public String getViewTitle() {
+		return "Merge Position";
+	}
+
+	/**
+	 * Update the view with the latest information from the configuration bean.
+	 */
+	@Override
+	public void refreshView() {
+		editorPane.setText(buildHtml());
+		repaint();
+	}
+
+	private String buildHtml() {
+		StringBuilder html = new StringBuilder(
+				getHtmlHead(getBackgroundColour()));
+		html.append(buildTableOpeningTag())
+				.append("<tr><td colspan=\"2\"><b>")
+				.append(getViewTitle())
+				.append("</b></td></tr>")
+				.append("<tr><td colspan=\"2\"><b>Ordered incoming links</b></td></tr>");
+
+		int counter = 1;
+		for (DataLink datalink : datalinks)
+			html.append("<tr><td>").append(counter++).append(".</td><td>")
+					.append(datalink).append("</td></tr>");
+
+		return html.append("</table>").append("</body></html>").toString();
+	}
+
+	protected JPanel panelForHtml(JEditorPane editorPane) {
+		final JPanel panel = new JPanel();
+
+		JPanel buttonPanel = new JPanel(new FlowLayout(LEFT));
+
+		JButton configureButton = new JButton(new AbstractAction() {
+			@Override
+			public void actionPerformed(ActionEvent e) {
+				MergeConfigurationView mergeConfigurationView = new MergeConfigurationView(
+						datalinks, editManager, selectionManager);
+				mergeConfigurationView.setLocationRelativeTo(panel);
+				mergeConfigurationView.setVisible(true);
+			}
+		});
+		configureButton.setText("Configure");
+		buttonPanel.add(configureButton);
+
+		panel.setLayout(new BorderLayout());
+		panel.add(editorPane, CENTER);
+		panel.add(buttonPanel, SOUTH);
+		return panel;
+	}
+
+	public String getBackgroundColour() {
+		return colourManager.getDefaultPropertyMap().get(
+				"org.apache.taverna.workflowmodel.Merge");
+	}
+
+	@Override
+	public int getPreferredPosition() {
+		return 100;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-contextual-views-impl/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/merge/MergeContextualViewFactory.java
----------------------------------------------------------------------
diff --git a/taverna-contextual-views-impl/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/merge/MergeContextualViewFactory.java b/taverna-contextual-views-impl/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/merge/MergeContextualViewFactory.java
new file mode 100644
index 0000000..f7c8406
--- /dev/null
+++ b/taverna-contextual-views-impl/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/merge/MergeContextualViewFactory.java
@@ -0,0 +1,65 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.views.contextualviews.merge;
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.apache.taverna.workbench.configuration.colour.ColourManager;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.selection.SelectionManager;
+import org.apache.taverna.workbench.ui.views.contextualviews.ContextualView;
+import org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory;
+import org.apache.taverna.scufl2.api.core.DataLink;
+
+/**
+ * A factory of contextual views for dataflow's merges.
+ *
+ * @author Alex Nenadic
+ */
+public class MergeContextualViewFactory implements ContextualViewFactory<DataLink> {
+	private EditManager editManager;
+	private SelectionManager selectionManager;
+	private ColourManager colourManager;
+
+	@Override
+	public boolean canHandle(Object object) {
+		return object instanceof DataLink
+				&& ((DataLink) object).getMergePosition() != null;
+	}
+
+	@Override
+	public List<ContextualView> getViews(DataLink merge) {
+		return Arrays.asList(new ContextualView[] {
+				new MergeContextualView(merge, editManager, selectionManager, colourManager)});
+	}
+
+	public void setEditManager(EditManager editManager) {
+		this.editManager = editManager;
+	}
+
+	public void setColourManager(ColourManager colourManager) {
+		this.colourManager = colourManager;
+	}
+
+	public void setSelectionManager(SelectionManager selectionManager) {
+		this.selectionManager = selectionManager;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-contextual-views-impl/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/outputport/OutputPortContextualView.java
----------------------------------------------------------------------
diff --git a/taverna-contextual-views-impl/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/outputport/OutputPortContextualView.java b/taverna-contextual-views-impl/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/outputport/OutputPortContextualView.java
new file mode 100644
index 0000000..3675b0b
--- /dev/null
+++ b/taverna-contextual-views-impl/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/outputport/OutputPortContextualView.java
@@ -0,0 +1,75 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.views.contextualviews.outputport;
+
+import static java.awt.FlowLayout.LEFT;
+
+import java.awt.FlowLayout;
+
+import javax.swing.JComponent;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.border.EmptyBorder;
+
+import org.apache.taverna.workbench.ui.views.contextualviews.ContextualView;
+import org.apache.taverna.workflowmodel.processor.activity.ActivityOutputPort;
+
+/**
+ * Contextual view for dataflow procerssor's output ports.
+ * 
+ * @author Alex Nenadic
+ */
+public class OutputPortContextualView extends ContextualView {
+	private static final String NO_DETAILS_AVAILABLE_HTML = "<html><body>"
+			+ "<i>No details available.</i>" + "</body><html>";
+	private static final long serialVersionUID = -7743029534480678624L;
+
+	private ActivityOutputPort outputPort;
+	private JPanel outputPortView;
+
+	public OutputPortContextualView(ActivityOutputPort outputport) {
+		this.outputPort = outputport;
+		initView();
+	}
+
+	@Override
+	public JComponent getMainFrame() {
+		refreshView();
+		return outputPortView;
+	}
+
+	@Override
+	public String getViewTitle() {
+		return "Service output port: " + outputPort.getName();
+	}
+
+	@Override
+	public void refreshView() {
+		outputPortView = new JPanel(new FlowLayout(LEFT));
+		outputPortView.setBorder(new EmptyBorder(5,5,5,5));
+		JLabel label = new JLabel(NO_DETAILS_AVAILABLE_HTML);
+		outputPortView.add(label);
+	}
+
+	@Override
+	public int getPreferredPosition() {
+		return 100;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-contextual-views-impl/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/outputport/OutputPortContextualViewFactory.java
----------------------------------------------------------------------
diff --git a/taverna-contextual-views-impl/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/outputport/OutputPortContextualViewFactory.java b/taverna-contextual-views-impl/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/outputport/OutputPortContextualViewFactory.java
new file mode 100644
index 0000000..6d31102
--- /dev/null
+++ b/taverna-contextual-views-impl/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/outputport/OutputPortContextualViewFactory.java
@@ -0,0 +1,47 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.views.contextualviews.outputport;
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.apache.taverna.workbench.ui.views.contextualviews.ContextualView;
+import org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory;
+import org.apache.taverna.workflowmodel.processor.activity.ActivityOutputPort;
+
+/**
+ * A factory of contextual views for dataflow proessor's (i.e. its associated
+ * activity's) output ports.
+ *
+ * @author Alex Nenadic
+ */
+public class OutputPortContextualViewFactory implements
+		ContextualViewFactory<ActivityOutputPort> {
+	@Override
+	public boolean canHandle(Object object) {
+		return object instanceof ActivityOutputPort;
+	}
+
+	@Override
+	public List<ContextualView> getViews(ActivityOutputPort outputport) {
+		return Arrays.asList(new ContextualView[] {
+				new OutputPortContextualView(outputport)});
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-contextual-views-impl/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory
----------------------------------------------------------------------
diff --git a/taverna-contextual-views-impl/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory b/taverna-contextual-views-impl/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory
deleted file mode 100644
index 7744cb3..0000000
--- a/taverna-contextual-views-impl/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory
+++ /dev/null
@@ -1,9 +0,0 @@
-net.sf.taverna.t2.workbench.ui.views.contextualviews.outputport.OutputPortContextualViewFactory
-net.sf.taverna.t2.workbench.ui.views.contextualviews.inputport.InputPortContextualViewFactory
-net.sf.taverna.t2.workbench.ui.views.contextualviews.dataflowoutputport.DataflowOutputPortContextualViewFactory
-net.sf.taverna.t2.workbench.ui.views.contextualviews.dataflowinputport.DataflowInputPortContextualViewFactory
-net.sf.taverna.t2.workbench.ui.views.contextualviews.datalink.DatalinkContextualViewFactory
-net.sf.taverna.t2.workbench.ui.views.contextualviews.condition.ConditionContextualViewFactory
-net.sf.taverna.t2.workbench.ui.views.contextualviews.merge.MergeContextualViewFactory
-net.sf.taverna.t2.workbench.ui.views.contextualviews.annotated.AnnotatedContextualViewFactory
-net.sf.taverna.t2.workbench.ui.views.contextualviews.dataflow.DataflowContextualViewFactory

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-contextual-views-impl/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.ui.zaria.UIComponentFactorySPI
----------------------------------------------------------------------
diff --git a/taverna-contextual-views-impl/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.ui.zaria.UIComponentFactorySPI b/taverna-contextual-views-impl/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.ui.zaria.UIComponentFactorySPI
deleted file mode 100644
index a564691..0000000
--- a/taverna-contextual-views-impl/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.ui.zaria.UIComponentFactorySPI
+++ /dev/null
@@ -1 +0,0 @@
-net.sf.taverna.t2.workbench.ui.views.contextualviews.ContextualViewComponentFactory
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-contextual-views-impl/src/main/resources/META-INF/services/org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory
----------------------------------------------------------------------
diff --git a/taverna-contextual-views-impl/src/main/resources/META-INF/services/org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory b/taverna-contextual-views-impl/src/main/resources/META-INF/services/org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory
new file mode 100644
index 0000000..7fcabca
--- /dev/null
+++ b/taverna-contextual-views-impl/src/main/resources/META-INF/services/org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory
@@ -0,0 +1,9 @@
+org.apache.taverna.workbench.ui.views.contextualviews.outputport.OutputPortContextualViewFactory
+org.apache.taverna.workbench.ui.views.contextualviews.inputport.InputPortContextualViewFactory
+org.apache.taverna.workbench.ui.views.contextualviews.dataflowoutputport.DataflowOutputPortContextualViewFactory
+org.apache.taverna.workbench.ui.views.contextualviews.dataflowinputport.DataflowInputPortContextualViewFactory
+org.apache.taverna.workbench.ui.views.contextualviews.datalink.DatalinkContextualViewFactory
+org.apache.taverna.workbench.ui.views.contextualviews.condition.ConditionContextualViewFactory
+org.apache.taverna.workbench.ui.views.contextualviews.merge.MergeContextualViewFactory
+org.apache.taverna.workbench.ui.views.contextualviews.annotated.AnnotatedContextualViewFactory
+org.apache.taverna.workbench.ui.views.contextualviews.dataflow.DataflowContextualViewFactory

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-contextual-views-impl/src/main/resources/META-INF/services/org.apache.taverna.workbench.ui.zaria.UIComponentFactorySPI
----------------------------------------------------------------------
diff --git a/taverna-contextual-views-impl/src/main/resources/META-INF/services/org.apache.taverna.workbench.ui.zaria.UIComponentFactorySPI b/taverna-contextual-views-impl/src/main/resources/META-INF/services/org.apache.taverna.workbench.ui.zaria.UIComponentFactorySPI
new file mode 100644
index 0000000..44eb868
--- /dev/null
+++ b/taverna-contextual-views-impl/src/main/resources/META-INF/services/org.apache.taverna.workbench.ui.zaria.UIComponentFactorySPI
@@ -0,0 +1 @@
+org.apache.taverna.workbench.ui.views.contextualviews.ContextualViewComponentFactory
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-contextual-views-impl/src/main/resources/META-INF/spring/contextual-views-impl-context-osgi.xml
----------------------------------------------------------------------
diff --git a/taverna-contextual-views-impl/src/main/resources/META-INF/spring/contextual-views-impl-context-osgi.xml b/taverna-contextual-views-impl/src/main/resources/META-INF/spring/contextual-views-impl-context-osgi.xml
index 767943d..159cd30 100644
--- a/taverna-contextual-views-impl/src/main/resources/META-INF/spring/contextual-views-impl-context-osgi.xml
+++ b/taverna-contextual-views-impl/src/main/resources/META-INF/spring/contextual-views-impl-context-osgi.xml
@@ -6,26 +6,26 @@
                       http://www.springframework.org/schema/osgi
                       http://www.springframework.org/schema/osgi/spring-osgi.xsd">
 
-	<service ref="ContextualViewComponentFactory" interface="net.sf.taverna.t2.workbench.ui.zaria.UIComponentFactorySPI" />
+	<service ref="ContextualViewComponentFactory" interface="org.apache.taverna.workbench.ui.zaria.UIComponentFactorySPI" />
 
-	<service ref="OutputPortContextualViewFactory" interface="net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory" />
-	<service ref="InputPortContextualViewFactory" interface="net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory" />
-	<service ref="DataflowOutputPortContextualViewFactory" interface="net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory" />
-	<service ref="DataflowInputPortContextualViewFactory" interface="net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory" />
-	<service ref="DatalinkContextualViewFactory" interface="net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory" />
-	<service ref="ConditionContextualViewFactory" interface="net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory" />
-	<service ref="MergeContextualViewFactory" interface="net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory" />
-	<service ref="AnnotatedContextualViewFactory" interface="net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory" />
-	<service ref="DataflowContextualViewFactory" interface="net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory" />
+	<service ref="OutputPortContextualViewFactory" interface="org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory" />
+	<service ref="InputPortContextualViewFactory" interface="org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory" />
+	<service ref="DataflowOutputPortContextualViewFactory" interface="org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory" />
+	<service ref="DataflowInputPortContextualViewFactory" interface="org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory" />
+	<service ref="DatalinkContextualViewFactory" interface="org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory" />
+	<service ref="ConditionContextualViewFactory" interface="org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory" />
+	<service ref="MergeContextualViewFactory" interface="org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory" />
+	<service ref="AnnotatedContextualViewFactory" interface="org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory" />
+	<service ref="DataflowContextualViewFactory" interface="org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory" />
 
-	<service ref="ContextualViewFactoryRegistry" interface="net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactoryRegistry" />
+	<service ref="ContextualViewFactoryRegistry" interface="org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactoryRegistry" />
 
-	<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="colourManager" interface="net.sf.taverna.t2.workbench.configuration.colour.ColourManager" />
+	<reference id="editManager" interface="org.apache.taverna.workbench.edits.EditManager" />
+	<reference id="fileManager" interface="org.apache.taverna.workbench.file.FileManager" />
+	<reference id="selectionManager" interface="org.apache.taverna.workbench.selection.SelectionManager" />
+	<reference id="colourManager" interface="org.apache.taverna.workbench.configuration.colour.ColourManager" />
 
-	<list id="annotationBeans" interface="net.sf.taverna.t2.annotation.AnnotationBeanSPI" />
-	<list id="contextualViewFactories" interface="net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory" cardinality="0..N" />
+	<list id="annotationBeans" interface="org.apache.taverna.annotation.AnnotationBeanSPI" />
+	<list id="contextualViewFactories" interface="org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory" cardinality="0..N" />
 
 </beans:beans>

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-contextual-views-impl/src/main/resources/META-INF/spring/contextual-views-impl-context.xml
----------------------------------------------------------------------
diff --git a/taverna-contextual-views-impl/src/main/resources/META-INF/spring/contextual-views-impl-context.xml b/taverna-contextual-views-impl/src/main/resources/META-INF/spring/contextual-views-impl-context.xml
index 18bbd36..1ad067e 100644
--- a/taverna-contextual-views-impl/src/main/resources/META-INF/spring/contextual-views-impl-context.xml
+++ b/taverna-contextual-views-impl/src/main/resources/META-INF/spring/contextual-views-impl-context.xml
@@ -3,40 +3,40 @@
 	xsi:schemaLocation="http://www.springframework.org/schema/beans
                       http://www.springframework.org/schema/beans/spring-beans.xsd">
 
-	<bean id="ContextualViewComponentFactory" class="net.sf.taverna.t2.workbench.ui.views.contextualviews.impl.ContextualViewComponentFactory">
+	<bean id="ContextualViewComponentFactory" class="org.apache.taverna.workbench.ui.views.contextualviews.impl.ContextualViewComponentFactory">
 			<property name="editManager" ref="editManager" />
 			<property name="selectionManager" ref="selectionManager" />
 			<property name="contextualViewFactoryRegistry" ref="ContextualViewFactoryRegistry"/>
 	</bean>
 
-	<bean id="OutputPortContextualViewFactory" class="net.sf.taverna.t2.workbench.ui.views.contextualviews.outputport.OutputPortContextualViewFactory" />
-	<bean id="InputPortContextualViewFactory" class="net.sf.taverna.t2.workbench.ui.views.contextualviews.inputport.InputPortContextualViewFactory" />
-	<bean id="DataflowOutputPortContextualViewFactory" class="net.sf.taverna.t2.workbench.ui.views.contextualviews.dataflowoutputport.DataflowOutputPortContextualViewFactory">
+	<bean id="OutputPortContextualViewFactory" class="org.apache.taverna.workbench.ui.views.contextualviews.outputport.OutputPortContextualViewFactory" />
+	<bean id="InputPortContextualViewFactory" class="org.apache.taverna.workbench.ui.views.contextualviews.inputport.InputPortContextualViewFactory" />
+	<bean id="DataflowOutputPortContextualViewFactory" class="org.apache.taverna.workbench.ui.views.contextualviews.dataflowoutputport.DataflowOutputPortContextualViewFactory">
 			<property name="fileManager" ref="fileManager" />
 	</bean>
-	<bean id="DataflowInputPortContextualViewFactory" class="net.sf.taverna.t2.workbench.ui.views.contextualviews.dataflowinputport.DataflowInputPortContextualViewFactory">
+	<bean id="DataflowInputPortContextualViewFactory" class="org.apache.taverna.workbench.ui.views.contextualviews.dataflowinputport.DataflowInputPortContextualViewFactory">
 			<property name="fileManager" ref="fileManager" />
 	</bean>
-	<bean id="DatalinkContextualViewFactory" class="net.sf.taverna.t2.workbench.ui.views.contextualviews.datalink.DatalinkContextualViewFactory">
+	<bean id="DatalinkContextualViewFactory" class="org.apache.taverna.workbench.ui.views.contextualviews.datalink.DatalinkContextualViewFactory">
 			<property name="fileManager" ref="fileManager" />
 	</bean>
-	<bean id="ConditionContextualViewFactory" class="net.sf.taverna.t2.workbench.ui.views.contextualviews.condition.ConditionContextualViewFactory" />
-	<bean id="MergeContextualViewFactory" class="net.sf.taverna.t2.workbench.ui.views.contextualviews.merge.MergeContextualViewFactory">
+	<bean id="ConditionContextualViewFactory" class="org.apache.taverna.workbench.ui.views.contextualviews.condition.ConditionContextualViewFactory" />
+	<bean id="MergeContextualViewFactory" class="org.apache.taverna.workbench.ui.views.contextualviews.merge.MergeContextualViewFactory">
 			<property name="editManager" ref="editManager" />
 			<property name="selectionManager" ref="selectionManager" />
 			<property name="colourManager" ref="colourManager" />
 	</bean>
-	<bean id="AnnotatedContextualViewFactory" class="net.sf.taverna.t2.workbench.ui.views.contextualviews.annotated.AnnotatedContextualViewFactory">
+	<bean id="AnnotatedContextualViewFactory" class="org.apache.taverna.workbench.ui.views.contextualviews.annotated.AnnotatedContextualViewFactory">
 			<property name="editManager" ref="editManager" />
 			<property name="selectionManager" ref="selectionManager" />
 			<property name="annotationBeans" ref ="annotationBeans"/>
 	</bean>
-	<bean id="DataflowContextualViewFactory" class="net.sf.taverna.t2.workbench.ui.views.contextualviews.dataflow.DataflowContextualViewFactory">
+	<bean id="DataflowContextualViewFactory" class="org.apache.taverna.workbench.ui.views.contextualviews.dataflow.DataflowContextualViewFactory">
 			<property name="fileManager" ref="fileManager" />
 			<property name="colourManager" ref="colourManager" />
 	</bean>
 
-	<bean id="ContextualViewFactoryRegistry" class="net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.impl.ContextualViewFactoryRegistryImpl">
+	<bean id="ContextualViewFactoryRegistry" class="org.apache.taverna.workbench.ui.views.contextualviews.activity.impl.ContextualViewFactoryRegistryImpl">
 			<property name="contextualViewFactories" ref="contextualViewFactories" />
 	</bean>
 

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-contextual-views/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/processor/ProcessorActivitiesContextualView.java
----------------------------------------------------------------------
diff --git a/taverna-contextual-views/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/processor/ProcessorActivitiesContextualView.java b/taverna-contextual-views/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/processor/ProcessorActivitiesContextualView.java
deleted file mode 100644
index f11b0b0..0000000
--- a/taverna-contextual-views/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/processor/ProcessorActivitiesContextualView.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007-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.ui.views.contextualviews.processor;
-
-import static java.awt.GridBagConstraints.CENTER;
-import static java.awt.GridBagConstraints.HORIZONTAL;
-import static java.awt.GridBagConstraints.LINE_START;
-import static java.awt.GridBagConstraints.NONE;
-import static net.sf.taverna.t2.workbench.ui.Utils.getParentFrame;
-
-import java.awt.Frame;
-import java.awt.GridBagConstraints;
-import java.awt.GridBagLayout;
-import java.util.List;
-
-import javax.swing.Action;
-import javax.swing.JButton;
-import javax.swing.JComponent;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-
-import net.sf.taverna.t2.workbench.selection.SelectionManager;
-import net.sf.taverna.t2.workbench.ui.views.contextualviews.ContextualView;
-import net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory;
-import net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactoryRegistry;
-
-import org.apache.taverna.scufl2.api.activity.Activity;
-import org.apache.taverna.scufl2.api.common.Scufl2Tools;
-import org.apache.taverna.scufl2.api.core.Processor;
-import org.apache.taverna.scufl2.api.profiles.ProcessorBinding;
-
-/**
- * View of a processor, including it's iteration stack, activities, etc.
- *
- * @author Stian Soiland-Reyes
- * @author Alan R Williams
- */
-@SuppressWarnings("serial")
-public class ProcessorActivitiesContextualView extends ContextualView {
-	private static final String ABSTRACT_PROCESSOR_MSG = "<strong>Abstract processor</strong><br>"
-			+ "<i>No services. This will not execute.</i>";
-	private Scufl2Tools scufl2Tools = new Scufl2Tools();
-	protected JPanel mainPanel = new JPanel();
-	protected Processor processor;
-	private final ContextualViewFactoryRegistry contextualViewFactoryRegistry;
-	private final SelectionManager selectionManager;
-
-	public ProcessorActivitiesContextualView(Processor processor,
-			ContextualViewFactoryRegistry contextualViewFactoryRegistry,
-			SelectionManager selectionManager) {
-		super();
-		this.processor = processor;
-		this.contextualViewFactoryRegistry = contextualViewFactoryRegistry;
-		this.selectionManager = selectionManager;
-		initialise();
-		initView();
-	}
-
-	@Override
-	public void refreshView() {
-		initialise();
-		this.revalidate();
-	}
-
-	private synchronized void initialise() {
-		mainPanel.removeAll();
-		mainPanel.setLayout(new GridBagLayout());
-
-		GridBagConstraints constraints = new GridBagConstraints();
-		constraints.gridx = 0;
-		constraints.gridy = 0;
-		constraints.weightx = 0.1;
-		constraints.weighty = 0;
-
-		List<ProcessorBinding> processorBindings = scufl2Tools
-				.processorBindingsForProcessor(processor,
-						selectionManager.getSelectedProfile());
-		if (processorBindings.isEmpty()) {
-			JLabel noActivitiesLabel = new JLabel("<html>"
-					+ ABSTRACT_PROCESSOR_MSG + "</html>");
-			constraints.fill = NONE;
-			constraints.anchor = LINE_START;
-			mainPanel.add(noActivitiesLabel, constraints);
-		} else
-			for (ProcessorBinding processorBinding : processorBindings)
-				addViewForBinding(constraints, processorBinding);
-		mainPanel.revalidate();
-		mainPanel.repaint();
-		this.revalidate();
-		this.repaint();
-	}
-
-	private void addViewForBinding(GridBagConstraints constraints,
-			ProcessorBinding processorBinding) {
-		Activity activity = processorBinding.getBoundActivity();
-		List<ContextualViewFactory<? super Activity>> viewFactoryForBeanType = contextualViewFactoryRegistry
-				.getViewFactoriesForObject(activity);
-		if (viewFactoryForBeanType.isEmpty())
-			return;
-		// TODO why a list when we only use the first, twice, and assume non-empty too?
-		ContextualView view = (ContextualView) viewFactoryForBeanType.get(0)
-				.getViews(activity).get(0);
-
-		constraints.anchor = CENTER;
-		constraints.fill = HORIZONTAL;
-		mainPanel.add(view, constraints);
-		Frame frame = getParentFrame(this);
-		Action configureAction = view.getConfigureAction(frame);
-		if (configureAction != null) {
-			constraints.gridy++;
-			constraints.fill = NONE;
-			constraints.anchor = LINE_START;
-			JButton configureButton = new JButton(configureAction);
-			if (configureButton.getText() == null
-					|| configureButton.getText().isEmpty())
-				configureButton.setText("Configure");
-			mainPanel.add(configureButton, constraints);
-		}
-		constraints.gridy++;
-	}
-
-	@Override
-	public JComponent getMainFrame() {
-		return mainPanel;
-	}
-
-	@Override
-	public String getViewTitle() {
-		return "Service";
-	}
-
-	@Override
-	public int getPreferredPosition() {
-		return 100;
-	}
-}


[06/51] [partial] incubator-taverna-workbench git commit: all packages are moved to org.apache.taverna.*

Posted by re...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-loop-ui/src/main/java/org/apache/taverna/workbench/loop/LoopContextualViewFactory.java
----------------------------------------------------------------------
diff --git a/taverna-loop-ui/src/main/java/org/apache/taverna/workbench/loop/LoopContextualViewFactory.java b/taverna-loop-ui/src/main/java/org/apache/taverna/workbench/loop/LoopContextualViewFactory.java
new file mode 100644
index 0000000..b44480f
--- /dev/null
+++ b/taverna-loop-ui/src/main/java/org/apache/taverna/workbench/loop/LoopContextualViewFactory.java
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * 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 org.apache.taverna.workbench.loop;
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.apache.taverna.scufl2.api.core.Processor;
+
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.file.FileManager;
+import org.apache.taverna.workbench.ui.views.contextualviews.ContextualView;
+import org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory;
+
+public class LoopContextualViewFactory implements ContextualViewFactory<Processor> {
+
+	private EditManager editManager;
+	private FileManager fileManager;
+
+	public boolean canHandle(Object selection) {
+		return selection instanceof Processor;
+	}
+
+	public List<ContextualView> getViews(Processor selection) {
+		return Arrays.asList(new ContextualView[] {new LoopContextualView(selection, editManager, fileManager)});
+	}
+
+	public void setEditManager(EditManager editManager) {
+		this.editManager = editManager;
+	}
+
+	public void setFileManager(FileManager fileManager) {
+		this.fileManager = fileManager;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-loop-ui/src/main/java/org/apache/taverna/workbench/loop/LoopRemoveMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-loop-ui/src/main/java/org/apache/taverna/workbench/loop/LoopRemoveMenuAction.java b/taverna-loop-ui/src/main/java/org/apache/taverna/workbench/loop/LoopRemoveMenuAction.java
new file mode 100644
index 0000000..0d8fb3c
--- /dev/null
+++ b/taverna-loop-ui/src/main/java/org/apache/taverna/workbench/loop/LoopRemoveMenuAction.java
@@ -0,0 +1,92 @@
+/**********************************************************************
+ * 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 org.apache.taverna.workbench.loop;
+
+import java.awt.event.ActionEvent;
+import java.net.URI;
+
+import javax.swing.AbstractAction;
+import javax.swing.Action;
+
+import org.apache.taverna.ui.menu.AbstractContextualMenuAction;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.file.FileManager;
+
+import org.apache.log4j.Logger;
+
+import org.apache.taverna.scufl2.api.core.Processor;
+
+public class LoopRemoveMenuAction extends AbstractContextualMenuAction {
+
+	private static Logger logger = Logger
+	.getLogger(LoopRemoveMenuAction.class);
+
+	public static final URI configureRunningSection = URI
+	.create("http://taverna.sf.net/2009/contextMenu/configureRunning");
+
+	private static final URI LOOP_REMOVE_URI = URI
+	.create("http://taverna.sf.net/2008/t2workbench/loopRemove");
+
+	private static final String LOOP_REMOVE = "Loop remove";
+
+	public LoopRemoveMenuAction() {
+		super(configureRunningSection, 25, LOOP_REMOVE_URI);
+	}
+
+	private EditManager editManager;
+	private FileManager fileManager;
+
+
+	@SuppressWarnings("serial")
+	@Override
+	protected Action createAction() {
+		return new AbstractAction("Disable looping") {
+			public void actionPerformed(ActionEvent e) {
+				Processor p = (Processor) getContextualSelection().getSelection();
+					Loop loopLayer = LoopConfigureMenuAction.getLoopLayer(p);
+					Edit<DispatchStack> deleteEdit = editManager.getEdits().getDeleteDispatchLayerEdit(
+							p.getDispatchStack(), loopLayer);
+					// TODO: Should warn before removing "essential" layers
+					try {
+						editManager.doDataflowEdit(fileManager.getCurrentDataflow(),
+								deleteEdit);
+					} catch (EditException ex) {
+						logger.warn("Could not remove layer " + loopLayer, ex);
+					}
+
+			}
+		};
+	}
+
+	public boolean isEnabled() {
+		Object selection = getContextualSelection().getSelection();
+		return (super.isEnabled() && (selection instanceof Processor) && (LoopConfigureMenuAction.getLoopLayer((Processor)selection) != null));
+	}
+
+	public void setEditManager(EditManager editManager) {
+		this.editManager = editManager;
+	}
+
+	public void setFileManager(FileManager fileManager) {
+		this.fileManager = fileManager;
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-loop-ui/src/main/java/org/apache/taverna/workbench/loop/comparisons/Comparison.java
----------------------------------------------------------------------
diff --git a/taverna-loop-ui/src/main/java/org/apache/taverna/workbench/loop/comparisons/Comparison.java b/taverna-loop-ui/src/main/java/org/apache/taverna/workbench/loop/comparisons/Comparison.java
new file mode 100644
index 0000000..a5b4c04
--- /dev/null
+++ b/taverna-loop-ui/src/main/java/org/apache/taverna/workbench/loop/comparisons/Comparison.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * 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 org.apache.taverna.workbench.loop.comparisons;
+
+import org.apache.taverna.workbench.loop.LoopConfigurationPanel;
+
+/**
+ * A comparison beanshell template for {@link LoopConfigurationPanel}.
+ * <p>
+ * A comparison is a template for generating a beanshell that can be used for
+ * comparisons in say the {@link Loop} layer.
+ * 
+ * @author Stian Soiland-Reyes
+ * 
+ */
+public abstract class Comparison {
+
+	public String toString() {
+		return getName();
+	}
+
+	public abstract String getId();
+
+	public abstract String getName();
+
+	public abstract String getValueType();
+
+	public abstract String getScriptTemplate();
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-loop-ui/src/main/java/org/apache/taverna/workbench/loop/comparisons/EqualTo.java
----------------------------------------------------------------------
diff --git a/taverna-loop-ui/src/main/java/org/apache/taverna/workbench/loop/comparisons/EqualTo.java b/taverna-loop-ui/src/main/java/org/apache/taverna/workbench/loop/comparisons/EqualTo.java
new file mode 100644
index 0000000..8cdf4d9
--- /dev/null
+++ b/taverna-loop-ui/src/main/java/org/apache/taverna/workbench/loop/comparisons/EqualTo.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 org.apache.taverna.workbench.loop.comparisons;
+
+public class EqualTo extends Comparison {
+
+	public String getId() {
+		return "EqualTo";
+	}
+
+	public String getName() {
+		return "is equal to";
+	}
+
+	public String getScriptTemplate() {
+		return "${loopPort} = \"\" + ! ${port}.equals(${value}); ";
+	}
+
+	public String getValueType() {
+		return "string";
+	}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-loop-ui/src/main/java/org/apache/taverna/workbench/loop/comparisons/IsGreaterThan.java
----------------------------------------------------------------------
diff --git a/taverna-loop-ui/src/main/java/org/apache/taverna/workbench/loop/comparisons/IsGreaterThan.java b/taverna-loop-ui/src/main/java/org/apache/taverna/workbench/loop/comparisons/IsGreaterThan.java
new file mode 100644
index 0000000..19f6764
--- /dev/null
+++ b/taverna-loop-ui/src/main/java/org/apache/taverna/workbench/loop/comparisons/IsGreaterThan.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 org.apache.taverna.workbench.loop.comparisons;
+
+public class IsGreaterThan extends Comparison {
+
+	public String getId() {
+		return "IsGreaterThan";
+	}
+
+	public String getName() {
+		return "is greater than";
+	}
+
+	public String getScriptTemplate() {
+		return "${loopPort} = \"\" + (! (Double.parseDouble(${port}) > Double.parseDouble(${value})));";
+	}
+
+	public String getValueType() {
+		return "number";
+	}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-loop-ui/src/main/java/org/apache/taverna/workbench/loop/comparisons/IsLessThan.java
----------------------------------------------------------------------
diff --git a/taverna-loop-ui/src/main/java/org/apache/taverna/workbench/loop/comparisons/IsLessThan.java b/taverna-loop-ui/src/main/java/org/apache/taverna/workbench/loop/comparisons/IsLessThan.java
new file mode 100644
index 0000000..3ee5c24
--- /dev/null
+++ b/taverna-loop-ui/src/main/java/org/apache/taverna/workbench/loop/comparisons/IsLessThan.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 org.apache.taverna.workbench.loop.comparisons;
+
+public class IsLessThan extends Comparison {
+
+	public String getId() {
+		return "IsLessThan";
+	}
+
+	public String getName() {
+		return "is less than";
+	}
+
+	public String getScriptTemplate() {
+		return "${loopPort} = \"\" + (! (Double.parseDouble(${port}) < Double.parseDouble(${value})));";
+	}
+
+	public String getValueType() {
+		return "number";
+	}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-loop-ui/src/main/java/org/apache/taverna/workbench/loop/comparisons/Matches.java
----------------------------------------------------------------------
diff --git a/taverna-loop-ui/src/main/java/org/apache/taverna/workbench/loop/comparisons/Matches.java b/taverna-loop-ui/src/main/java/org/apache/taverna/workbench/loop/comparisons/Matches.java
new file mode 100644
index 0000000..133e134
--- /dev/null
+++ b/taverna-loop-ui/src/main/java/org/apache/taverna/workbench/loop/comparisons/Matches.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 org.apache.taverna.workbench.loop.comparisons;
+
+public class Matches extends Comparison {
+
+	public String getId() {
+		return "Matches";
+	}
+
+	public String getName() {
+		return "matches";
+	}
+
+	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/a9a52bd5/taverna-loop-ui/src/main/java/org/apache/taverna/workbench/loop/comparisons/NotEqualTo.java
----------------------------------------------------------------------
diff --git a/taverna-loop-ui/src/main/java/org/apache/taverna/workbench/loop/comparisons/NotEqualTo.java b/taverna-loop-ui/src/main/java/org/apache/taverna/workbench/loop/comparisons/NotEqualTo.java
new file mode 100644
index 0000000..5657c52
--- /dev/null
+++ b/taverna-loop-ui/src/main/java/org/apache/taverna/workbench/loop/comparisons/NotEqualTo.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 org.apache.taverna.workbench.loop.comparisons;
+
+public class NotEqualTo extends Comparison {
+
+	public String getId() {
+		return "NotEqualTo";
+	}
+
+	public String getName() {
+		return "is not equal to";
+	}
+
+	public String getScriptTemplate() {
+		return "${loopPort} = \"\" + ${port}.equals(${value});";
+	}
+
+	public String getValueType() {
+		return "string";
+	}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-loop-ui/src/main/java/org/apache/taverna/workbench/loop/comparisons/NotMatches.java
----------------------------------------------------------------------
diff --git a/taverna-loop-ui/src/main/java/org/apache/taverna/workbench/loop/comparisons/NotMatches.java b/taverna-loop-ui/src/main/java/org/apache/taverna/workbench/loop/comparisons/NotMatches.java
new file mode 100644
index 0000000..ed9766b
--- /dev/null
+++ b/taverna-loop-ui/src/main/java/org/apache/taverna/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 org.apache.taverna.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/a9a52bd5/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
deleted file mode 100644
index 1956a3f..0000000
--- a/taverna-loop-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.ui.menu.MenuComponent
+++ /dev/null
@@ -1,3 +0,0 @@
-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/a9a52bd5/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
deleted file mode 100644
index 52eafc4..0000000
--- a/taverna-loop-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.ui.views.contextualviews.AddLayerFactorySPI
+++ /dev/null
@@ -1 +0,0 @@
-net.sf.taverna.t2.workbench.loop.AddLoopFactory

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/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
deleted file mode 100644
index 9150066..0000000
--- a/taverna-loop-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory
+++ /dev/null
@@ -1 +0,0 @@
-net.sf.taverna.t2.workbench.loop.LoopContextualViewFactory

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

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

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

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/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
index 4abb75f..2e94fbf 100644
--- 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
@@ -6,16 +6,16 @@
                       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="AddLoopFactory" interface="org.apache.taverna.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" />
+	<service ref="LoopContextualViewFactory" interface="org.apache.taverna.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="editManager" interface="org.apache.taverna.workbench.edits.EditManager" />
+	<reference id="fileManager" interface="org.apache.taverna.workbench.file.FileManager" />
+    <reference id="selectionManager" interface="org.apache.taverna.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/a9a52bd5/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
index 4c2133c..7dd7818 100644
--- 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
@@ -3,28 +3,28 @@
 	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">
+	<bean id="AddLoopFactory" class="org.apache.taverna.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">
+	<bean id="LoopConfigureMenuAction" class="org.apache.taverna.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">
+	<bean id="LoopAddMenuAction" class="org.apache.taverna.workbench.loop.LoopAddMenuAction">
 			<property name="addLoopFactory">
 				<ref local="AddLoopFactory"/>
 			</property>
 	</bean>
-	<bean id="LoopRemoveMenuAction" class="net.sf.taverna.t2.workbench.loop.LoopRemoveMenuAction">
+	<bean id="LoopRemoveMenuAction" class="org.apache.taverna.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">
+	<bean id="LoopContextualViewFactory" class="org.apache.taverna.workbench.loop.LoopContextualViewFactory">
 			<property name="editManager" ref="editManager" />
 			<property name="fileManager" ref="fileManager" />
 	</bean>

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/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
deleted file mode 100644
index 9e63c6d..0000000
--- a/taverna-loop-ui/src/test/java/net/sf/taverna/t2/workbench/loop/ShowContextualView.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*******************************************************************************
- * 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 org.apache.taverna.scufl2.api.container.WorkflowBundle;
-import org.apache.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 org.apache.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/a9a52bd5/taverna-loop-ui/src/test/java/org/apache/taverna/workbench/loop/ShowContextualView.java
----------------------------------------------------------------------
diff --git a/taverna-loop-ui/src/test/java/org/apache/taverna/workbench/loop/ShowContextualView.java b/taverna-loop-ui/src/test/java/org/apache/taverna/workbench/loop/ShowContextualView.java
new file mode 100644
index 0000000..2fe8351
--- /dev/null
+++ b/taverna-loop-ui/src/test/java/org/apache/taverna/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 org.apache.taverna.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 org.apache.taverna.scufl2.api.container.WorkflowBundle;
+import org.apache.taverna.scufl2.api.core.Processor;
+
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.edits.impl.EditManagerImpl;
+import org.apache.taverna.workbench.file.FileManager;
+import net.sf.taverna.t2.workbench.file.impl.FileManagerImpl;
+import org.apache.taverna.workbench.selection.SelectionManager;
+import org.apache.taverna.workbench.selection.impl.SelectionManagerImpl;
+import org.apache.taverna.workbench.ui.views.contextualviews.impl.ContextualViewComponent;
+import org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactoryRegistry;
+import org.apache.taverna.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 org.apache.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/a9a52bd5/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
deleted file mode 100644
index 7209cae..0000000
--- a/taverna-menu-api/src/main/java/net/sf/taverna/t2/ui/menu/AbstractContextualMenuAction.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/**********************************************************************
- * 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/a9a52bd5/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
deleted file mode 100644
index 07eb8d2..0000000
--- a/taverna-menu-api/src/main/java/net/sf/taverna/t2/ui/menu/AbstractMenu.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*******************************************************************************
- * 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/a9a52bd5/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
deleted file mode 100644
index 446a2ec..0000000
--- a/taverna-menu-api/src/main/java/net/sf/taverna/t2/ui/menu/AbstractMenuAction.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*******************************************************************************
- * 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/a9a52bd5/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
deleted file mode 100644
index 9a64130..0000000
--- a/taverna-menu-api/src/main/java/net/sf/taverna/t2/ui/menu/AbstractMenuCustom.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/*******************************************************************************
- * 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/a9a52bd5/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
deleted file mode 100644
index 63b6c78..0000000
--- a/taverna-menu-api/src/main/java/net/sf/taverna/t2/ui/menu/AbstractMenuItem.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/*******************************************************************************
- * 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/a9a52bd5/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
deleted file mode 100644
index 091cc23..0000000
--- a/taverna-menu-api/src/main/java/net/sf/taverna/t2/ui/menu/AbstractMenuOptionGroup.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*******************************************************************************
- * 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/a9a52bd5/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
deleted file mode 100644
index 2e649e0..0000000
--- a/taverna-menu-api/src/main/java/net/sf/taverna/t2/ui/menu/AbstractMenuSection.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*******************************************************************************
- * 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/a9a52bd5/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
deleted file mode 100644
index 97e977d..0000000
--- a/taverna-menu-api/src/main/java/net/sf/taverna/t2/ui/menu/AbstractMenuToggle.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/*******************************************************************************
- * 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();
-}


[40/51] [partial] incubator-taverna-workbench git commit: all packages are moved to org.apache.taverna.*

Posted by re...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-contextual-views-api/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/activity/DependencyConfigurationPanel.java
----------------------------------------------------------------------
diff --git a/taverna-contextual-views-api/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/activity/DependencyConfigurationPanel.java b/taverna-contextual-views-api/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/activity/DependencyConfigurationPanel.java
new file mode 100644
index 0000000..e27ff27
--- /dev/null
+++ b/taverna-contextual-views-api/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/activity/DependencyConfigurationPanel.java
@@ -0,0 +1,292 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.views.contextualviews.activity;
+
+import static java.awt.BorderLayout.CENTER;
+import static java.awt.BorderLayout.NORTH;
+import static java.awt.Color.RED;
+import static java.awt.GridBagConstraints.FIRST_LINE_START;
+import static java.awt.GridBagConstraints.HORIZONTAL;
+import static java.awt.event.ItemEvent.DESELECTED;
+import static java.awt.event.ItemEvent.SELECTED;
+import static java.util.Arrays.asList;
+import static javax.swing.Box.createRigidArea;
+import static javax.swing.BoxLayout.PAGE_AXIS;
+import static javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER;
+import static javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED;
+
+import java.awt.BorderLayout;
+import java.awt.Dimension;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.Insets;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.ItemEvent;
+import java.awt.event.ItemListener;
+import java.io.File;
+import java.io.FilenameFilter;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import javax.swing.BoxLayout;
+import javax.swing.JCheckBox;
+import javax.swing.JComboBox;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.border.EmptyBorder;
+
+/**
+ * Component for configuring activities that require dependencies.
+ *
+ * @author David Withers
+ */
+@SuppressWarnings("serial")
+public class DependencyConfigurationPanel extends JPanel {
+	private String classLoaderSharing;
+	private List<String> localDependencies;
+	private File libDir;
+
+	public DependencyConfigurationPanel(String classLoaderSharing,
+			List<String> localDependencies, File libDir) {
+		this.classLoaderSharing = classLoaderSharing;
+		this.localDependencies = localDependencies;
+		this.libDir = libDir;
+		setLayout(new BoxLayout(this, PAGE_AXIS));
+
+		// Create panel with classloading options
+		JPanel classloadingPanel = new ClassloadingPanel();
+		// Create panel for selecting jar files
+		JPanel jarFilesPanel = new JarFilesPanel();
+
+		add(classloadingPanel);
+		add(createRigidArea(new Dimension(0,10)));
+		add(jarFilesPanel);
+		add(createRigidArea(new Dimension(0,10)));
+
+	}
+
+	public String getClassLoaderSharing() {
+		return classLoaderSharing;
+	}
+
+	public List<String> getLocalDependencies() {
+		return localDependencies;
+	}
+
+	// Classloading option 'workflow'
+	private static final String WORKFLOW = "Shared for whole workflow";
+	// Classloading option 'system'
+	private static final String SYSTEM = "System classloader";
+	
+	// Panel containing classloading options
+	private class ClassloadingPanel extends JPanel {
+		// Combobox with classloading options
+		private JComboBox<String> jcbClassloadingOption;
+		// Classloading option descriptions
+		private HashMap<String, String> classloadingDescriptions;
+		// JLabel with classloading option description
+		private JLabel jlClassloadingDescription;
+
+		/*
+		 * Panel containing a list of possible classloading options which users
+		 * can select from
+		 */
+		private ClassloadingPanel() {
+			super(new GridBagLayout());
+			jcbClassloadingOption = new JComboBox<>(new String[] { WORKFLOW,
+					SYSTEM });
+			// Set the current classlaoding option based on the configuration bean
+			if ("workflow".equals(classLoaderSharing)) {
+				jcbClassloadingOption.setSelectedItem(WORKFLOW);
+			} else if ("system".equals(classLoaderSharing)) {
+				jcbClassloadingOption.setSelectedItem(SYSTEM);
+			}
+
+			jcbClassloadingOption.addActionListener(new ActionListener(){
+				// Fires up when combobox selection changes
+				@Override
+				public void actionPerformed(ActionEvent e) {
+					Object selectedItem = jcbClassloadingOption.getSelectedItem();
+					jlClassloadingDescription.setText(classloadingDescriptions
+							.get(selectedItem));
+					if (selectedItem.equals(WORKFLOW))
+						classLoaderSharing = "workflow";
+					else if (selectedItem.equals(SYSTEM))
+						classLoaderSharing = "system";
+				}
+			});
+			//jcbClassloadingOption.setEnabled(false);
+
+			classloadingDescriptions = new HashMap<>();
+			classloadingDescriptions.put(WORKFLOW, "<html><small>"
+					+ "Classes are shared across the whole workflow (with any service<br>"
+					+ "also selecting this option), but are reinitialised for each workflow run.<br>"
+					+ "This might be needed if a service passes objects to another, or <br>"
+					+ "state is shared within static members of loaded classes."
+					+ "</small></html>");
+			classloadingDescriptions.put(SYSTEM, "<html><small><p>"
+					+ "The (global) system classloader is used, any dependencies defined here are<br>"
+					+ "made available globally on the first run. Note that if you are NOT using<br>"
+					+ "the defaulf Taverna BootstrapClassLoader, any settings here will be disregarded."
+					+ "</p><p>"
+					+ "This is mainly useful if you are using JNI-based libraries. Note that <br>"
+					+ "for JNI you also have to specify <code>-Djava.library.path</code> and <br>"
+					+ "probably your operating system's dynamic library search path<br>"
+					+ "<code>LD_LIBRARY_PATH</code> / <code>DYLD_LIBRARY_PATH</code> / <code>PATH</code> </p>"
+					+ "</small></html>");
+
+			/*
+			 * Set the current classlaoding description based on the item
+			 * selected in the combobox.
+			 */
+			jlClassloadingDescription = new JLabel(classloadingDescriptions
+					.get(jcbClassloadingOption.getSelectedItem()));
+
+			// Add components to the ClassloadingPanel
+			GridBagConstraints c = new GridBagConstraints();
+			c.anchor = FIRST_LINE_START;
+			c.fill = HORIZONTAL;
+			c.gridx = 0;
+			c.insets = new Insets(10,0,0,0);
+			add(new JLabel("Classloader persistence"), c);
+			c.insets = new Insets(0,0,0,0);
+			add(jcbClassloadingOption, c);
+			c.insets = new Insets(0,30,0,0);
+			add(jlClassloadingDescription, c);
+		}
+	}
+
+	// Panel for users to add local JAR dependencies (contains a list of jar files which users can select from)
+	private class JarFilesPanel extends JPanel {
+		private JLabel warning = new JLabel(
+				"<html>"
+						+ "<center<font color='red'>"
+						+ "Warning: Depending on local libraries makes this workflow<br>"
+						+ "difficult or impossible to run for other users. Try depending<br>"
+						+ "on artifacts from a public repository if possible.</font></center>"
+						+ "</html>");
+
+		private JarFilesPanel() {
+			super();
+			setMinimumSize(new Dimension(400, 150));
+			setLayout(new BorderLayout());
+			setBorder(new EmptyBorder(0,10,0,10));
+
+			JPanel labelPanel = new JPanel();
+			labelPanel.setLayout(new BoxLayout(labelPanel, PAGE_AXIS));
+			JLabel label = new JLabel("Local JAR files");
+			JLabel libLabel = new JLabel("<html><small>" + libDir.getAbsolutePath()
+					+ "</small></html>");
+			labelPanel.add(label);
+			labelPanel.add(libLabel);
+
+			add(labelPanel, NORTH);
+			add(new JScrollPane(jarFiles(), VERTICAL_SCROLLBAR_AS_NEEDED,
+					HORIZONTAL_SCROLLBAR_NEVER), CENTER);
+
+			warning.setVisible(false);
+			/*
+			 * We'll skip the warning until we actually have support for
+			 * artifacts
+			 */
+			//add(warning);
+			updateWarning();
+		}
+
+		private void updateWarning() {
+			// Show warning if there is any local dependencies
+			warning.setVisible(!localDependencies.isEmpty());
+		}
+
+		public JPanel jarFiles() {
+			JPanel panel = new JPanel();
+			panel.setLayout(new BoxLayout(panel, PAGE_AXIS));
+
+			// List of all jar files in the lib directory
+			List<String> jarFiles = asList(libDir
+					.list(new FileExtFilter(".jar")));
+			/*
+			 * We also add the list of jars that may have been configured
+			 * sometime before but are now not present in the lib directory for
+			 * some reason
+			 */
+			Set<String> missingLocalDeps = new HashSet<>(localDependencies);
+			missingLocalDeps.removeAll(jarFiles);
+			/*
+			 * jarFiles and missingLocalDeps now contain two sets of files that
+			 * do not intersect
+			 */
+			List<String> jarFilesList = new ArrayList<>();
+			// Put them all together
+			jarFilesList.addAll(jarFiles);
+			jarFilesList.addAll(missingLocalDeps);
+			Collections.sort(jarFilesList);
+
+			if (jarFilesList.isEmpty()) {
+				panel.add(new JLabel("<html><small>To depend on a JAR file, "
+					+ "copy it to the above-mentioned folder.</small></html>"));
+				return panel;
+			}
+
+			for (String jarFile : jarFilesList) {
+				JCheckBox checkBox = new JCheckBox(jarFile);
+				// Has it already been selected in some previous configuring?
+				checkBox.setSelected(localDependencies.contains(jarFile));
+				checkBox.addItemListener(new ItemListener() {
+					@Override
+					public void itemStateChanged(ItemEvent e) {
+						JCheckBox box = (JCheckBox) e.getSource();
+						if (e.getStateChange() == SELECTED)
+							localDependencies.add(box.getText());
+						else if (e.getStateChange() == DESELECTED)
+							localDependencies.remove(box.getText());
+						updateWarning();
+					}
+				});
+				panel.add(checkBox);
+				// The jar may not be in the lib directory, so warn the user
+				if (!new File(libDir, jarFile).exists()) {
+					checkBox.setForeground(RED);
+					checkBox.setText(checkBox.getText() + " (missing file!)");
+				}
+			}
+			return panel;
+		}
+	}
+
+	public static class FileExtFilter implements FilenameFilter {
+		final String ext;
+
+		public FileExtFilter(String ext) {
+			this.ext = ext;
+		}
+
+		@Override
+		public boolean accept(File dir, String name) {
+			return name.endsWith(ext);
+		}
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-contextual-views-api/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/activity/ListConfigurationComponent.java
----------------------------------------------------------------------
diff --git a/taverna-contextual-views-api/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/activity/ListConfigurationComponent.java b/taverna-contextual-views-api/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/activity/ListConfigurationComponent.java
new file mode 100644
index 0000000..d927763
--- /dev/null
+++ b/taverna-contextual-views-api/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/activity/ListConfigurationComponent.java
@@ -0,0 +1,118 @@
+/*
+* 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.
+*/
+        
+package org.apache.taverna.workbench.ui.views.contextualviews.activity;
+
+import static java.awt.BorderLayout.CENTER;
+import static java.awt.BorderLayout.EAST;
+import static java.awt.BorderLayout.SOUTH;
+import static java.awt.FlowLayout.RIGHT;
+
+import java.awt.BorderLayout;
+import java.awt.Component;
+import java.awt.FlowLayout;
+import java.awt.event.ActionEvent;
+import java.util.List;
+
+import javax.swing.AbstractAction;
+import javax.swing.Action;
+import javax.swing.JButton;
+import javax.swing.JComponent;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+
+/**
+ * @author David Withers
+ */
+@SuppressWarnings("serial")
+public abstract class ListConfigurationComponent<T> extends JPanel {
+	private static final String REMOVE = "Remove";
+	private static final String ADD = "Add";
+
+	private String name;
+	private List<T> items;
+	private JPanel listPanel;
+
+	public ListConfigurationComponent(String name, List<T> items) {
+		this.name = name;
+		setLayout(new BorderLayout());
+
+		listPanel = new JPanel(new ListLayout());
+		JPanel buttonPanel = new JPanel(new FlowLayout(RIGHT));
+		buttonPanel.add(new JButton(createAddAction()));
+
+		add(new JScrollPane(listPanel), CENTER);
+		add(buttonPanel, SOUTH);
+
+		setItems(items);
+	}
+
+	protected void setItems(List<T> items) {
+		this.items = items;
+		listPanel.removeAll();
+		for (T item : items)
+			addItemComponent(item);
+	}
+
+	protected void addItem(T item) {
+		items.add(item);
+		addItemComponent(item);
+	}
+
+	protected void addItemComponent(T item) {
+		JComponent itemPanel = new JPanel(new BorderLayout());
+		itemPanel.add(createItemComponent(item), CENTER);
+		itemPanel.add(new JButton(createRemoveAction(item)), EAST);
+		listPanel.add(itemPanel);
+		listPanel.revalidate();
+		listPanel.repaint();
+	}
+
+	protected void removeItem(T item) {
+		int index = items.indexOf(item);
+		if (index >= 0) {
+			items.remove(index);
+			listPanel.remove(index);
+			listPanel.revalidate();
+			listPanel.repaint();
+		}
+	}
+
+	private Action createRemoveAction(final T item) {
+		return new AbstractAction(REMOVE) {
+			@Override
+			public void actionPerformed(ActionEvent e) {
+				removeItem(item);
+			}
+		};
+	}
+
+	private Action createAddAction() {
+		return new AbstractAction(ADD + " " + name) {
+			@Override
+			public void actionPerformed(ActionEvent e) {
+				addItem(createDefaultItem());
+			}
+		};
+	}
+
+	protected abstract Component createItemComponent(T item);
+
+	protected abstract T createDefaultItem();
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-contextual-views-api/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/activity/ListLayout.java
----------------------------------------------------------------------
diff --git a/taverna-contextual-views-api/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/activity/ListLayout.java b/taverna-contextual-views-api/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/activity/ListLayout.java
new file mode 100644
index 0000000..ab1ba72
--- /dev/null
+++ b/taverna-contextual-views-api/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/activity/ListLayout.java
@@ -0,0 +1,91 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.views.contextualviews.activity;
+
+import java.awt.Component;
+import java.awt.Container;
+import java.awt.Dimension;
+import java.awt.Insets;
+import java.awt.LayoutManager;
+
+/**
+ * Lays out components vertically using their preferred height and the available
+ * width.
+ * 
+ * @author David Withers
+ */
+public class ListLayout implements LayoutManager {
+	private static final int DEFAULT_GAP = 5;
+	private final int gap;
+
+	public ListLayout() {
+		this(DEFAULT_GAP);
+	}
+
+	public ListLayout(int gap) {
+		this.gap = gap;
+	}
+
+	@Override
+	public void removeLayoutComponent(Component comp) {
+	}
+
+	@Override
+	public void addLayoutComponent(String name, Component comp) {
+	}
+
+	@Override
+	public void layoutContainer(Container parent) {
+		Insets insets = parent.getInsets();
+		int x = insets.left;
+		int y = insets.top;
+		int width = parent.getWidth() - insets.left - insets.right;
+		Component[] components = parent.getComponents();
+		for (int i = 0; i < components.length; i++) {
+			components[i].setLocation(x, y);
+			components[i].setSize(width,
+					components[i].getPreferredSize().height);
+			y = y + gap + components[i].getHeight();
+		}
+	}
+
+	@Override
+	public Dimension minimumLayoutSize(Container parent) {
+		Insets insets = parent.getInsets();
+		int minimumWidth = 0;
+		int minimumHeight = 0;
+		Component[] components = parent.getComponents();
+		for (int i = 0; i < components.length; i++) {
+			Dimension size = components[i].getPreferredSize();
+			if (size.width > minimumWidth)
+				minimumWidth = size.width;
+			minimumHeight = minimumHeight + size.height + gap;
+		}
+		minimumWidth = minimumWidth + insets.left + insets.right;
+		minimumHeight = minimumHeight + insets.top + insets.bottom;
+
+		return new Dimension(minimumWidth, minimumHeight);
+	}
+
+	@Override
+	public Dimension preferredLayoutSize(Container parent) {
+		return minimumLayoutSize(parent);
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-contextual-views-api/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/activity/MultiPageActivityConfigurationPanel.java
----------------------------------------------------------------------
diff --git a/taverna-contextual-views-api/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/activity/MultiPageActivityConfigurationPanel.java b/taverna-contextual-views-api/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/activity/MultiPageActivityConfigurationPanel.java
new file mode 100644
index 0000000..5bd6f59
--- /dev/null
+++ b/taverna-contextual-views-api/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/activity/MultiPageActivityConfigurationPanel.java
@@ -0,0 +1,64 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.views.contextualviews.activity;
+
+import static java.awt.BorderLayout.CENTER;
+
+import java.awt.BorderLayout;
+import java.awt.Component;
+
+import javax.swing.JTabbedPane;
+
+import org.apache.taverna.scufl2.api.activity.Activity;
+
+/**
+ * Component for configuring activities that have multiple configuration pages.
+ * 
+ * @author David Withers
+ */
+@SuppressWarnings("serial")
+public abstract class MultiPageActivityConfigurationPanel extends
+		ActivityConfigurationPanel {
+	private JTabbedPane tabbedPane;
+
+	/**
+	 * Constructs a new <code>MultiPageActivityConfigurationPanel</code>.
+	 * 
+	 * @param activity
+	 */
+	public MultiPageActivityConfigurationPanel(Activity activity) {
+		super(activity);
+		setLayout(new BorderLayout());
+		tabbedPane = new JTabbedPane();
+		add(tabbedPane, CENTER);
+	}
+
+	public void addPage(String name, Component component) {
+		tabbedPane.addTab(name, component);
+	}
+
+	public void removePage(String name) {
+		tabbedPane.removeTabAt(tabbedPane.indexOfTab(name));
+	}
+
+	public void removeAllPages() {
+		tabbedPane.removeAll();
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-contextual-views-api/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/activity/ScriptConfigurationComponent.java
----------------------------------------------------------------------
diff --git a/taverna-contextual-views-api/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/activity/ScriptConfigurationComponent.java b/taverna-contextual-views-api/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/activity/ScriptConfigurationComponent.java
new file mode 100644
index 0000000..a066bd3
--- /dev/null
+++ b/taverna-contextual-views-api/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/activity/ScriptConfigurationComponent.java
@@ -0,0 +1,149 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.views.contextualviews.activity;
+
+import static java.awt.BorderLayout.CENTER;
+import static java.awt.BorderLayout.SOUTH;
+import static java.awt.Color.WHITE;
+import static java.awt.Font.PLAIN;
+import static javax.swing.JOptionPane.INFORMATION_MESSAGE;
+import static javax.swing.JOptionPane.YES_NO_OPTION;
+import static javax.swing.JOptionPane.YES_OPTION;
+import static javax.swing.JOptionPane.showConfirmDialog;
+import static javax.swing.JOptionPane.showMessageDialog;
+import static org.apache.taverna.lang.ui.FileTools.readStringFromFile;
+import static org.apache.taverna.lang.ui.FileTools.saveStringToFile;
+
+import java.awt.BorderLayout;
+import java.awt.Dimension;
+import java.awt.FlowLayout;
+import java.awt.Font;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.util.Set;
+
+import javax.swing.JButton;
+import javax.swing.JPanel;
+import javax.swing.JTextPane;
+
+import org.apache.taverna.lang.ui.KeywordDocument;
+import org.apache.taverna.lang.ui.LineEnabledTextPanel;
+import org.apache.taverna.lang.ui.LinePainter;
+import org.apache.taverna.lang.ui.NoWrapEditorKit;
+
+/**
+ * Component for configuring activities that have scripts.
+ *
+ * @author David Withers
+ */
+@SuppressWarnings("serial")
+public class ScriptConfigurationComponent extends JPanel {
+	private JTextPane scriptTextArea;
+
+	public ScriptConfigurationComponent(String script, Set<String> keywords,
+			Set<String> ports, final String scriptType,
+			final String fileExtension) {
+		this(script, keywords, ports, scriptType, fileExtension, "");
+	}
+
+	public ScriptConfigurationComponent(String script, Set<String> keywords,
+			Set<String> ports, final String scriptType,
+			final String fileExtension, final String resetScript) {
+		super(new BorderLayout());
+		scriptTextArea = new JTextPane();
+		new LinePainter(scriptTextArea, WHITE);
+
+		final KeywordDocument doc = new KeywordDocument(keywords, ports);
+
+		// NOTE: Due to T2-1145 - always set editor kit BEFORE setDocument
+		scriptTextArea.setEditorKit(new NoWrapEditorKit());
+		scriptTextArea.setFont(new Font("Monospaced", PLAIN, 14));
+		scriptTextArea.setDocument(doc);
+		scriptTextArea.setText(script);
+		scriptTextArea.setCaretPosition(0);
+		scriptTextArea.setPreferredSize(new Dimension(200, 100));
+
+		add(new LineEnabledTextPanel(scriptTextArea), CENTER);
+
+		final JButton checkScriptButton = new JButton("Check script");
+		checkScriptButton.setToolTipText("Check the " + scriptType + " script");
+		checkScriptButton.addActionListener(new ActionListener() {
+			@Override
+			public void actionPerformed(ActionEvent ex) {
+				showMessageDialog(ScriptConfigurationComponent.this, scriptType
+						+ " script check not implemented", scriptType
+						+ " script check", INFORMATION_MESSAGE);
+			}
+		});
+
+		JButton loadScriptButton = new JButton("Load script");
+		loadScriptButton.setToolTipText("Load a " + scriptType
+				+ " script from a file");
+		loadScriptButton.addActionListener(new ActionListener() {
+			@Override
+			public void actionPerformed(ActionEvent e) {
+				String newScript = readStringFromFile(
+						ScriptConfigurationComponent.this, "Load " + scriptType
+								+ " script", fileExtension);
+				if (newScript != null) {
+					scriptTextArea.setText(newScript);
+					scriptTextArea.setCaretPosition(0);
+				}
+			}
+		});
+
+		JButton saveRScriptButton = new JButton("Save script");
+		saveRScriptButton.setToolTipText("Save the " + scriptType
+				+ " script to a file");
+		saveRScriptButton.addActionListener(new ActionListener() {
+			@Override
+			public void actionPerformed(ActionEvent e) {
+				saveStringToFile(ScriptConfigurationComponent.this, "Save "
+						+ scriptType + " script", fileExtension,
+						scriptTextArea.getText());
+			}
+		});
+
+		JButton clearScriptButton = new JButton("Clear script");
+		clearScriptButton.setToolTipText("Clear current script from the edit area");
+		clearScriptButton.addActionListener(new ActionListener() {
+			@Override
+			public void actionPerformed(ActionEvent e) {
+				if (showConfirmDialog(ScriptConfigurationComponent.this,
+						"Do you really want to clear the script?",
+						"Clearing the script", YES_NO_OPTION) == YES_OPTION)
+					scriptTextArea.setText(resetScript);
+			}
+		});
+
+		JPanel buttonPanel = new JPanel();
+		buttonPanel.setLayout(new FlowLayout());
+		buttonPanel.add(checkScriptButton);
+		buttonPanel.add(loadScriptButton);
+		buttonPanel.add(saveRScriptButton);
+		buttonPanel.add(clearScriptButton);
+
+		add(buttonPanel, SOUTH);
+	}
+
+	public String getScript() {
+		return scriptTextArea.getText();
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-contextual-views-api/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/activity/ValidatingTextField.java
----------------------------------------------------------------------
diff --git a/taverna-contextual-views-api/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/activity/ValidatingTextField.java b/taverna-contextual-views-api/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/activity/ValidatingTextField.java
new file mode 100644
index 0000000..4ae9346
--- /dev/null
+++ b/taverna-contextual-views-api/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/activity/ValidatingTextField.java
@@ -0,0 +1,52 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.views.contextualviews.activity;
+
+import javax.swing.JTextField;
+
+/**
+ * Adds a "<tt>valid</tt>" property to a JTextField.
+ * 
+ * @author David Withers
+ */
+@SuppressWarnings("serial")
+public class ValidatingTextField extends JTextField {
+	private boolean valid = true;
+
+	public ValidatingTextField() {
+	}
+
+	public ValidatingTextField(String text) {
+		super(text);
+	}
+
+	@Override
+	public boolean isValid() {
+		return valid;
+	}
+
+	public void setValid(boolean valid) {
+		if (this.valid != valid) {
+			boolean old = this.valid;
+			this.valid = valid;
+			firePropertyChange("valid", old, valid);
+		}
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-contextual-views-api/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/activity/ValidatingTextGroup.java
----------------------------------------------------------------------
diff --git a/taverna-contextual-views-api/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/activity/ValidatingTextGroup.java b/taverna-contextual-views-api/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/activity/ValidatingTextGroup.java
new file mode 100644
index 0000000..87795e9
--- /dev/null
+++ b/taverna-contextual-views-api/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/activity/ValidatingTextGroup.java
@@ -0,0 +1,118 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.views.contextualviews.activity;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import javax.swing.event.DocumentEvent;
+import javax.swing.event.DocumentListener;
+
+/**
+ *
+ *
+ * @author David Withers
+ */
+public class ValidatingTextGroup {
+	private Map<ValidatingTextField, DocumentListener> textComponents;
+
+	public ValidatingTextGroup() {
+		textComponents = new HashMap<>();
+	}
+
+	public void addValidTextComponent(ValidatingTextField textComponent) {
+		setUniqueText(textComponent);
+		DocumentListener documentListener = new ValidatorDocumentListener();
+		textComponent.getDocument().addDocumentListener(documentListener);
+		textComponents.put(textComponent, documentListener);
+	}
+
+	public void addTextComponent(ValidatingTextField textComponent) {
+		DocumentListener documentListener = new ValidatorDocumentListener();
+		textComponent.getDocument().addDocumentListener(documentListener);
+		textComponents.put(textComponent, documentListener);
+		validate();
+	}
+
+	public void removeTextComponent(ValidatingTextField textComponent) {
+		textComponent.getDocument().removeDocumentListener(
+				textComponents.remove(textComponent));
+		validate();
+	}
+
+	private void setUniqueText(ValidatingTextField textComponent) {
+		String text = textComponent.getText();
+		if (textExists(text)) {
+			// Remove any existing number suffix
+			String nameTemplate = text.replaceAll("_\\d+$", "_");
+			long i = 1;
+			do {
+				text = nameTemplate + i++;
+			} while (textExists(text));
+
+			textComponent.setText(text);
+		}
+	}
+
+	private void validate() {
+		Map<String, ValidatingTextField> textValues = new HashMap<>();
+		Set<ValidatingTextField> maybeValid = new HashSet<>();
+		for (ValidatingTextField textComponent : textComponents.keySet()) {
+			ValidatingTextField duplicate = textValues.get(textComponent
+					.getText());
+			if (duplicate != null) {
+				duplicate.setValid(false);
+				maybeValid.remove(duplicate);
+				textComponent.setValid(false);
+			} else {
+				textValues.put(textComponent.getText(), textComponent);
+				maybeValid.add(textComponent);
+			}
+		}
+		for (ValidatingTextField textComponent : maybeValid)
+			textComponent.setValid(true);
+	}
+
+	private boolean textExists(String text) {
+		for (ValidatingTextField currentTextComponent : textComponents.keySet())
+			if (text.equals(currentTextComponent.getText()))
+				return true;
+		return false;
+	}
+
+	class ValidatorDocumentListener implements DocumentListener {
+		@Override
+		public void insertUpdate(DocumentEvent e) {
+			validate();
+		}
+
+		@Override
+		public void removeUpdate(DocumentEvent e) {
+			validate();
+		}
+
+		@Override
+		public void changedUpdate(DocumentEvent e) {
+			validate();
+		}
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-contextual-views-api/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.ui.zaria.UIComponentFactorySPI
----------------------------------------------------------------------
diff --git a/taverna-contextual-views-api/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.ui.zaria.UIComponentFactorySPI b/taverna-contextual-views-api/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.ui.zaria.UIComponentFactorySPI
deleted file mode 100644
index 312f95b..0000000
--- a/taverna-contextual-views-api/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.ui.zaria.UIComponentFactorySPI
+++ /dev/null
@@ -1,2 +0,0 @@
-#net.sf.taverna.t2.workbench.ui.actions.activity.draggable.ActivityDraggerPaletteComponentFactory
-#net.sf.taverna.t2.workbench.ui.views.contextualviews.DragActivitiesToHereComponentFactory

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-contextual-views-api/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.ui.zaria.UIComponentSPI
----------------------------------------------------------------------
diff --git a/taverna-contextual-views-api/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.ui.zaria.UIComponentSPI b/taverna-contextual-views-api/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.ui.zaria.UIComponentSPI
deleted file mode 100644
index 1448a49..0000000
--- a/taverna-contextual-views-api/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.ui.zaria.UIComponentSPI
+++ /dev/null
@@ -1,3 +0,0 @@
-#net.sf.taverna.t2.workbench.ui.actions.activity.draggable.ActivityDraggerPaletteComponent
-#net.sf.taverna.t2.workbench.ui.views.contextualviews.DragActivitiesToHereComponent
-net.sf.taverna.t2.workbench.ui.views.contextualviews.ContextualViewComponent

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-contextual-views-api/src/main/resources/META-INF/services/org.apache.taverna.workbench.ui.zaria.UIComponentFactorySPI
----------------------------------------------------------------------
diff --git a/taverna-contextual-views-api/src/main/resources/META-INF/services/org.apache.taverna.workbench.ui.zaria.UIComponentFactorySPI b/taverna-contextual-views-api/src/main/resources/META-INF/services/org.apache.taverna.workbench.ui.zaria.UIComponentFactorySPI
new file mode 100644
index 0000000..42b6caf
--- /dev/null
+++ b/taverna-contextual-views-api/src/main/resources/META-INF/services/org.apache.taverna.workbench.ui.zaria.UIComponentFactorySPI
@@ -0,0 +1,2 @@
+#org.apache.taverna.workbench.ui.actions.activity.draggable.ActivityDraggerPaletteComponentFactory
+#org.apache.taverna.workbench.ui.views.contextualviews.DragActivitiesToHereComponentFactory

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-contextual-views-api/src/main/resources/META-INF/services/org.apache.taverna.workbench.ui.zaria.UIComponentSPI
----------------------------------------------------------------------
diff --git a/taverna-contextual-views-api/src/main/resources/META-INF/services/org.apache.taverna.workbench.ui.zaria.UIComponentSPI b/taverna-contextual-views-api/src/main/resources/META-INF/services/org.apache.taverna.workbench.ui.zaria.UIComponentSPI
new file mode 100644
index 0000000..a61bfab
--- /dev/null
+++ b/taverna-contextual-views-api/src/main/resources/META-INF/services/org.apache.taverna.workbench.ui.zaria.UIComponentSPI
@@ -0,0 +1,3 @@
+#org.apache.taverna.workbench.ui.actions.activity.draggable.ActivityDraggerPaletteComponent
+#org.apache.taverna.workbench.ui.views.contextualviews.DragActivitiesToHereComponent
+org.apache.taverna.workbench.ui.views.contextualviews.ContextualViewComponent

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-contextual-views-impl/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/activity/impl/ContextualViewFactoryRegistryImpl.java
----------------------------------------------------------------------
diff --git a/taverna-contextual-views-impl/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/activity/impl/ContextualViewFactoryRegistryImpl.java b/taverna-contextual-views-impl/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/activity/impl/ContextualViewFactoryRegistryImpl.java
deleted file mode 100644
index 8bac354..0000000
--- a/taverna-contextual-views-impl/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/activity/impl/ContextualViewFactoryRegistryImpl.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*******************************************************************************
- * 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
- ******************************************************************************/
-
-/**
- * @author Alan R Williams
- */
-package net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.impl;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory;
-import net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactoryRegistry;
-
-/**
- * An SPI registry for discovering ActivityViewFactories for a given object,
- * like an {@link net.sf.taverna.t2.workflowmodel.processor.activity.Activity}.
- * <p>
- * For {@link ContextualViewFactory factories} to be found, its full qualified
- * name needs to be defined as a resource file
- * <code>/META-INF/services/net.sf.taverna.t2.workbench.ui.views.contextualviews.ContextualViewFactory</code>
- * 
- * @author Stuart Owen
- * @author Ian Dunlop
- * @author Stian Soiland-Reyes
- * 
- * @see ContextualViewFactory
- */
-public class ContextualViewFactoryRegistryImpl implements
-		ContextualViewFactoryRegistry {
-	private List<ContextualViewFactory<?>> contextualViewFactories;
-
-	/**
-	 * Discover and return the ContextualViewFactory associated to the provided
-	 * object. This is accomplished by returning the discovered
-	 * {@link ContextualViewFactory#canHandle(Object)} that returns true for
-	 * that Object.
-	 * 
-	 * @param object
-	 * @return
-	 * @see ContextualViewFactory#canHandle(Object)
-	 */
-	@Override
-	public List<ContextualViewFactory<?>> getViewFactoriesForObject(
-			Object object) {
-		List<ContextualViewFactory<?>> result = new ArrayList<>();
-		for (ContextualViewFactory<?> factory : contextualViewFactories)
-			if (factory.canHandle(object))
-				result.add(factory);
-		return result;
-	}
-
-	public void setContextualViewFactories(
-			List<ContextualViewFactory<?>> contextualViewFactories) {
-		this.contextualViewFactories = contextualViewFactories;
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-contextual-views-impl/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/annotated/AnnotatedContextualView.java
----------------------------------------------------------------------
diff --git a/taverna-contextual-views-impl/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/annotated/AnnotatedContextualView.java b/taverna-contextual-views-impl/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/annotated/AnnotatedContextualView.java
deleted file mode 100644
index 5dd5a81..0000000
--- a/taverna-contextual-views-impl/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/annotated/AnnotatedContextualView.java
+++ /dev/null
@@ -1,263 +0,0 @@
-/*******************************************************************************
- * 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.views.contextualviews.annotated;
-
-import static javax.swing.BoxLayout.Y_AXIS;
-
-import java.awt.event.FocusEvent;
-import java.awt.event.FocusListener;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.PropertyResourceBundle;
-import java.util.ResourceBundle;
-import java.util.regex.Pattern;
-
-import javax.swing.BoxLayout;
-import javax.swing.JComponent;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.border.EmptyBorder;
-import javax.swing.border.TitledBorder;
-
-import org.apache.taverna.annotation.Annotated;
-import org.apache.taverna.annotation.AnnotationBeanSPI;
-import net.sf.taverna.t2.lang.ui.DialogTextArea;
-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.selection.SelectionManager;
-import net.sf.taverna.t2.workbench.ui.views.contextualviews.ContextualView;
-import net.sf.taverna.t2.workbench.ui.views.contextualviews.impl.ContextualViewComponent;
-
-import org.apache.log4j.Logger;
-
-import org.apache.taverna.scufl2.api.container.WorkflowBundle;
-
-/**
- * This is a ContextualView that should be able to display and allow editing of
- * Annotation information for any Annotated. At the moment it is only used for
- * Dataflow.
- * 
- * @author Alan R Williams
- */
-@SuppressWarnings("serial")
-class AnnotatedContextualView extends ContextualView {
-	private static final int WORKFLOW_NAME_LENGTH = 20;
-	public static final String VIEW_TITLE = "Annotations";
-	private final static String MISSING_VALUE = "Type here to give details";
-	private final static int DEFAULT_AREA_WIDTH = 60;
-	private final static int DEFAULT_AREA_ROWS = 8;
-
-	private static Logger logger = Logger
-			.getLogger(AnnotatedContextualView.class);
-	private static PropertyResourceBundle prb = (PropertyResourceBundle) ResourceBundle
-			.getBundle("annotatedcontextualview");
-
-	// TODO convert to scufl2
-	// private static AnnotationTools annotationTools = new AnnotationTools();
-
-	/**
-	 * The object to which the Annotations apply
-	 */
-	private Annotated<?> annotated;
-	private SelectionManager selectionManager;
-	private EditManager editManager;
-	private boolean isStandalone = false;
-	private JPanel panel;
-	@SuppressWarnings("unused")
-	private final List<AnnotationBeanSPI> annotationBeans;
-
-	public AnnotatedContextualView(Annotated<?> annotated,
-			EditManager editManager, SelectionManager selectionManager,
-			List<AnnotationBeanSPI> annotationBeans) {
-		super();
-		this.editManager = editManager;
-		this.selectionManager = selectionManager;
-		this.annotationBeans = annotationBeans;
-		this.annotated = annotated;
-
-		initialise();
-		initView();
-	}
-
-	@Override
-	public void refreshView() {
-		initialise();
-	}
-
-	private void initialise() {
-		if (panel == null) {
-			panel = new JPanel();
-			panel.setLayout(new BoxLayout(panel, Y_AXIS));
-		} else
-			panel.removeAll();
-		populatePanel();
-		revalidate();
-	}
-
-	@Override
-	public JComponent getMainFrame() {
-		return panel;
-	}
-
-	@Override
-	public String getViewTitle() {
-		return VIEW_TITLE;
-	}
-
-	private Map<String,String> getAnnotations() {
-		// TODO convert to scufl2
-		Map<String, String> result = new HashMap<>();
-		//for (Class<?> c : annotationTools.getAnnotatingClasses(annotated)) {
-		// String name = "";
-		// try {
-		// name = prb.getString(c.getCanonicalName());
-		// } catch (MissingResourceException e) {
-		// name = c.getCanonicalName();
-		// }
-		// String value = annotationTools.getAnnotationString(annotated, c,
-		// MISSING_VALUE);
-		// result.put(name,value);
-		//}
-		return result;
-	}
-	public void populatePanel() {
-		JPanel scrollPanel = new JPanel();
-		scrollPanel.setLayout(new BoxLayout(scrollPanel, Y_AXIS));
-		panel.setBorder(new EmptyBorder(5, 5, 5, 5));
-		Map<String,String>annotations = getAnnotations();
-		for (String name : annotations.keySet()) {
-			JPanel subPanel = new JPanel();
-			subPanel.setBorder(new TitledBorder(name));
-			subPanel.add(createTextArea(String.class, annotations.get(name)));
-			scrollPanel.add(subPanel);
-		}
-		JScrollPane scrollPane = new JScrollPane(scrollPanel);
-		panel.add(scrollPane);
-	}
-
-	private JScrollPane createTextArea(Class<?> c, String value) {
-		DialogTextArea area = new DialogTextArea(value);
-		area.setFocusable(true);
-		area.addFocusListener(new TextAreaFocusListener(area, c));
-		area.setColumns(DEFAULT_AREA_WIDTH);
-		area.setRows(DEFAULT_AREA_ROWS);
-		area.setLineWrap(true);
-		area.setWrapStyleWord(true);
-
-		return new JScrollPane(area);
-	}
-
-	private class TextAreaFocusListener implements FocusListener {
-		String oldValue = null;
-		Class<?> annotationClass;
-		DialogTextArea area = null;
-
-		public TextAreaFocusListener(DialogTextArea area, Class<?> c) {
-			annotationClass = c;
-			oldValue = area.getText();
-			this.area = area;
-		}
-
-		@Override
-		public void focusGained(FocusEvent e) {
-			if (area.getText().equals(MISSING_VALUE))
-				area.setText("");
-		}
-
-		@Override
-		public void focusLost(FocusEvent e) {
-			String currentValue = area.getText();
-			if (currentValue.isEmpty() || currentValue.equals(MISSING_VALUE)) {
-				currentValue = MISSING_VALUE;
-				area.setText(currentValue);
-			}
-			if (!currentValue.equals(oldValue)) {
-				if (currentValue == MISSING_VALUE)
-					currentValue = "";
-				try {
-					WorkflowBundle currentDataflow = selectionManager
-							.getSelectedWorkflowBundle();
-					List<Edit<?>> editList = new ArrayList<>();
-					addWorkflowNameEdits(currentValue, currentDataflow,
-							editList);
-					if (!isStandalone)
-						ContextualViewComponent.selfGenerated = true;
-					editManager.doDataflowEdit(currentDataflow,
-							new CompoundEdit(editList));
-					ContextualViewComponent.selfGenerated = false;
-				} catch (EditException e1) {
-					logger.warn("Can't set annotation", e1);
-				}
-				oldValue = area.getText();
-			}
-		}
-
-		private boolean isTitleAnnotation() {
-			// TODO convert to scufl2
-			return prb.getString(annotationClass.getCanonicalName()).equals(
-					"Title");
-		}
-
-		// TODO convert to scufl2
-		private void addWorkflowNameEdits(String currentValue,
-				WorkflowBundle currentDataflow, List<Edit<?>> editList) {
-			//editList.add(annotationTools.setAnnotationString(annotated,
-			//		annotationClass, currentValue, edits));
-			if (annotated == currentDataflow && isTitleAnnotation()
-					&& !currentValue.isEmpty()) {
-				@SuppressWarnings("unused")
-				String sanitised = sanitiseName(currentValue);
-				//editList.add(edits.getUpdateDataflowNameEdit(currentDataflow,
-				//		sanitised));
-			}
-		}
-	}
-
-	/**
-	 * Checks that the name does not have any characters that are invalid for a
-	 * processor name.
-	 * <p>
-	 * The resulting name must contain only the chars [A-Za-z_0-9].
-	 * 
-	 * @param name
-	 *            the original name
-	 * @return the sanitised name
-	 */
-	private static String sanitiseName(String name) {
-		if (name.length() > WORKFLOW_NAME_LENGTH)
-			name = name.substring(0, WORKFLOW_NAME_LENGTH);
-		if (Pattern.matches("\\w++", name))
-			return name;
-		StringBuilder temp = new StringBuilder();
-		for (char c : name.toCharArray())
-			temp.append(Character.isLetterOrDigit(c) || c == '_' ? c : '_');
-		return temp.toString();
-	}
-
-	@Override
-	public int getPreferredPosition() {
-		return 500;
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-contextual-views-impl/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/annotated/AnnotatedContextualViewFactory.java
----------------------------------------------------------------------
diff --git a/taverna-contextual-views-impl/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/annotated/AnnotatedContextualViewFactory.java b/taverna-contextual-views-impl/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/annotated/AnnotatedContextualViewFactory.java
deleted file mode 100644
index 55f4fa6..0000000
--- a/taverna-contextual-views-impl/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/annotated/AnnotatedContextualViewFactory.java
+++ /dev/null
@@ -1,43 +0,0 @@
-package net.sf.taverna.t2.workbench.ui.views.contextualviews.annotated;
-
-import static java.util.Collections.singletonList;
-
-import java.util.List;
-
-import org.apache.taverna.annotation.Annotated;
-import org.apache.taverna.annotation.AnnotationBeanSPI;
-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.ContextualView;
-import net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory;
-import org.apache.taverna.workflowmodel.processor.activity.Activity;
-
-public class AnnotatedContextualViewFactory implements
-		ContextualViewFactory<Annotated<?>> {
-	private EditManager editManager;
-	private List<AnnotationBeanSPI> annotationBeans;
-	private SelectionManager selectionManager;
-
-	@Override
-	public boolean canHandle(Object selection) {
-		return ((selection instanceof Annotated) && !(selection instanceof Activity));
-	}
-
-	@Override
-	public List<ContextualView> getViews(Annotated<?> selection) {
-		return singletonList((ContextualView) new AnnotatedContextualView(
-				selection, editManager, selectionManager, annotationBeans));
-	}
-
-	public void setEditManager(EditManager editManager) {
-		this.editManager = editManager;
-	}
-
-	public void setSelectionManager(SelectionManager selectionManager) {
-		this.selectionManager = selectionManager;
-	}
-
-	public void setAnnotationBeans(List<AnnotationBeanSPI> annotationBeans) {
-		this.annotationBeans = annotationBeans;
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-contextual-views-impl/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/condition/ConditionContextualView.java
----------------------------------------------------------------------
diff --git a/taverna-contextual-views-impl/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/condition/ConditionContextualView.java b/taverna-contextual-views-impl/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/condition/ConditionContextualView.java
deleted file mode 100644
index de39835..0000000
--- a/taverna-contextual-views-impl/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/condition/ConditionContextualView.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*******************************************************************************
- * 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.views.contextualviews.condition;
-
-import java.awt.FlowLayout;
-
-import javax.swing.JComponent;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.border.EmptyBorder;
-
-import net.sf.taverna.t2.workbench.ui.views.contextualviews.ContextualView;
-import org.apache.taverna.scufl2.api.core.BlockingControlLink;
-
-/**
- * Contextual view for dataflow's control (condition) links.
- * 
- * @author David Withers
- */
-class ConditionContextualView extends ContextualView {
-	private static final long serialVersionUID = -894521200616176439L;
-
-	private final BlockingControlLink condition;
-	private JPanel contitionView;
-
-	public ConditionContextualView(BlockingControlLink condition) {
-		this.condition = condition;
-		initView();
-	}
-
-	@Override
-	public JComponent getMainFrame() {
-		refreshView();
-		return contitionView;
-	}
-
-	@Override
-	public String getViewTitle() {
-		return "Control link: " + condition.getBlock().getName()
-				+ " runs after " + condition.getUntilFinished().getName();
-	}
-
-	@Override
-	public void refreshView() {
-		contitionView = new JPanel(new FlowLayout(FlowLayout.LEFT));
-		contitionView.setBorder(new EmptyBorder(5, 5, 5, 5));
-		JLabel label = new JLabel(
-				"<html><body><i>No details available.</i></body><html>");
-		contitionView.add(label);
-	}
-
-	@Override
-	public int getPreferredPosition() {
-		return 100;
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-contextual-views-impl/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/condition/ConditionContextualViewFactory.java
----------------------------------------------------------------------
diff --git a/taverna-contextual-views-impl/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/condition/ConditionContextualViewFactory.java b/taverna-contextual-views-impl/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/condition/ConditionContextualViewFactory.java
deleted file mode 100644
index 15dacd7..0000000
--- a/taverna-contextual-views-impl/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/condition/ConditionContextualViewFactory.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * 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.views.contextualviews.condition;
-
-import static java.util.Arrays.asList;
-
-import java.util.List;
-
-import net.sf.taverna.t2.workbench.ui.views.contextualviews.ContextualView;
-import net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory;
-import org.apache.taverna.workflowmodel.Condition;
-import org.apache.taverna.scufl2.api.core.BlockingControlLink;
-
-/**
- * A factory of contextual views for dataflow's condition links.
- * 
- * @author David Withers
- * 
- */
-public class ConditionContextualViewFactory implements
-		ContextualViewFactory<BlockingControlLink> {
-	@Override
-	public boolean canHandle(Object object) {
-		return object instanceof Condition;
-	}
-
-	@Override
-	public List<ContextualView> getViews(BlockingControlLink condition) {
-		return asList(new ContextualView[] { new ConditionContextualView(
-				condition) });
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-contextual-views-impl/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/dataflow/DataflowContextualView.java
----------------------------------------------------------------------
diff --git a/taverna-contextual-views-impl/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/dataflow/DataflowContextualView.java b/taverna-contextual-views-impl/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/dataflow/DataflowContextualView.java
deleted file mode 100644
index 9b38a53..0000000
--- a/taverna-contextual-views-impl/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/dataflow/DataflowContextualView.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.workbench.ui.views.contextualviews.dataflow;
-
-import static net.sf.taverna.t2.lang.ui.HtmlUtils.buildTableOpeningTag;
-import static net.sf.taverna.t2.lang.ui.HtmlUtils.createEditorPane;
-import static net.sf.taverna.t2.lang.ui.HtmlUtils.getHtmlHead;
-import static net.sf.taverna.t2.lang.ui.HtmlUtils.panelForHtml;
-
-import javax.swing.JComponent;
-import javax.swing.JEditorPane;
-
-import net.sf.taverna.t2.workbench.configuration.colour.ColourManager;
-import net.sf.taverna.t2.workbench.file.FileManager;
-import net.sf.taverna.t2.workbench.ui.views.contextualviews.ContextualView;
-import org.apache.taverna.workflowmodel.Dataflow;
-import org.apache.taverna.scufl2.api.core.Workflow;
-import org.apache.taverna.scufl2.api.port.InputWorkflowPort;
-import org.apache.taverna.scufl2.api.port.OutputWorkflowPort;
-
-/**
- * @author alanrw
- */
-@SuppressWarnings("serial")
-class DataflowContextualView extends ContextualView {
-	private static int MAX_LENGTH = 50;
-	private static final String ELLIPSIS = "...";
-
-	private Workflow dataflow;
-	private JEditorPane editorPane;
-	private final FileManager fileManager;
-	private final ColourManager colourManager;
-
-	public DataflowContextualView(Workflow dataflow, FileManager fileManager,
-			ColourManager colourManager) {
-		this.dataflow = dataflow;
-		this.fileManager = fileManager;
-		this.colourManager = colourManager;
-		initView();
-	}
-
-	@Override
-	public JComponent getMainFrame() {
-		editorPane = createEditorPane(buildHtml());
-		return panelForHtml(editorPane);
-	}
-
-	private String buildHtml() {
-		StringBuilder html = new StringBuilder(getHtmlHead(getBackgroundColour()));
-		html.append(buildTableOpeningTag());
-
-		html.append("<tr><td colspan=\"2\" align=\"center\"><b>Source</b></td></tr>");
-		String source = "Newly created";
-		if (fileManager.getDataflowSource(dataflow.getParent()) != null)
-			source = fileManager.getDataflowName(dataflow.getParent());
-
-		html.append("<tr><td colspan=\"2\" align=\"center\">").append(source)
-				.append("</td></tr>");
-		if (!dataflow.getInputPorts().isEmpty()) {
-			html.append("<tr><th>Input Port Name</th><th>Depth</th></tr>");
-			for (InputWorkflowPort dip : dataflow.getInputPorts())
-				html.append("<tr><td>")
-						.append(dip.getName())
-						.append("</td><td>")
-						.append(dip.getDepth() < 0 ? "invalid/unpredicted"
-								: dip.getDepth()).append("</td></tr>");
-		}
-		if (!dataflow.getOutputPorts().isEmpty()) {
-			html.append("<tr><th>Output Port Name</th><th>Depth</th></tr>");
-			for (OutputWorkflowPort dop : dataflow.getOutputPorts())
-				html.append("<tr><td>")
-						.append(dop.getName())
-						.append("</td><td>")
-						.append(/*(dop.getDepth() < 0 ?*/ "invalid/unpredicted" /*: dop.getDepth())*/)
-						.append("</td>" + "</tr>");
-		}
-
-		return html.append("</table>").append("</body></html>").toString();
-	}
-
-	public String getBackgroundColour() {
-		return colourManager.getDefaultPropertyMap().get(
-				Dataflow.class.toString());
-	}
-
-	@Override
-	public int getPreferredPosition() {
-		return 100;
-	}
-
-	private String limitName(String fullName) {
-		if (fullName.length() <= MAX_LENGTH)
-			return fullName;
-		return fullName.substring(0, MAX_LENGTH - ELLIPSIS.length()) + ELLIPSIS;
-	}
-
-	@Override
-	public String getViewTitle() {
-		return "Workflow " + limitName(dataflow.getName());
-	}
-
-	@Override
-	public void refreshView() {
-		editorPane.setText(buildHtml());
-		repaint();
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-contextual-views-impl/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/dataflow/DataflowContextualViewFactory.java
----------------------------------------------------------------------
diff --git a/taverna-contextual-views-impl/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/dataflow/DataflowContextualViewFactory.java b/taverna-contextual-views-impl/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/dataflow/DataflowContextualViewFactory.java
deleted file mode 100644
index d2ea6d7..0000000
--- a/taverna-contextual-views-impl/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/dataflow/DataflowContextualViewFactory.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.workbench.ui.views.contextualviews.dataflow;
-
-import java.util.Arrays;
-import java.util.List;
-
-import net.sf.taverna.t2.workbench.configuration.colour.ColourManager;
-import net.sf.taverna.t2.workbench.file.FileManager;
-import net.sf.taverna.t2.workbench.ui.views.contextualviews.ContextualView;
-import net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory;
-import org.apache.taverna.scufl2.api.core.Workflow;
-
-/**
- * @author alanrw
- */
-public class DataflowContextualViewFactory implements
-		ContextualViewFactory<Workflow> {
-	private FileManager fileManager;
-	private ColourManager colourManager;
-
-	@Override
-	public boolean canHandle(Object selection) {
-		return selection instanceof Workflow;
-	}
-
-	@Override
-	public List<ContextualView> getViews(Workflow selection) {
-		return Arrays.asList(new ContextualView[] {
-				new DataflowContextualView(selection, fileManager, colourManager)});
-	}
-
-	public void setFileManager(FileManager fileManager) {
-		this.fileManager = fileManager;
-	}
-
-	public void setColourManager(ColourManager colourManager) {
-		this.colourManager = colourManager;
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-contextual-views-impl/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/dataflowinputport/DataflowInputPortContextualView.java
----------------------------------------------------------------------
diff --git a/taverna-contextual-views-impl/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/dataflowinputport/DataflowInputPortContextualView.java b/taverna-contextual-views-impl/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/dataflowinputport/DataflowInputPortContextualView.java
deleted file mode 100644
index 644804d..0000000
--- a/taverna-contextual-views-impl/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/dataflowinputport/DataflowInputPortContextualView.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*******************************************************************************
- * 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.views.contextualviews.dataflowinputport;
-
-import static java.awt.FlowLayout.LEFT;
-
-import java.awt.FlowLayout;
-import java.awt.Frame;
-import java.awt.event.ActionEvent;
-
-import javax.swing.AbstractAction;
-import javax.swing.Action;
-import javax.swing.JComponent;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.border.EmptyBorder;
-
-import org.apache.taverna.scufl2.api.port.InputWorkflowPort;
-import net.sf.taverna.t2.workbench.file.FileManager;
-import net.sf.taverna.t2.workbench.ui.views.contextualviews.ContextualView;
-
-/**
- * Contextual view for dataflow's input ports.
- *
- * @author Alex Nenadic
- */
-class DataflowInputPortContextualView extends ContextualView{
-	private static final long serialVersionUID = -8746856072335775933L;
-
-	private InputWorkflowPort dataflowInputPort;
-	private JPanel dataflowInputPortView;
-	@SuppressWarnings("unused")
-	private FileManager fileManager;
-
-	public DataflowInputPortContextualView(InputWorkflowPort inputport,
-			FileManager fileManager) {
-		this.dataflowInputPort = inputport;
-		this.fileManager = fileManager;
-		initView();
-	}
-
-	@Override
-	public JComponent getMainFrame() {
-		refreshView();
-		return dataflowInputPortView;
-	}
-
-	@Override
-	public String getViewTitle() {
-		return "Workflow input port: " + dataflowInputPort.getName();
-	}
-
-	@Override
-	public void refreshView() {
-		dataflowInputPortView = new JPanel(new FlowLayout(LEFT));
-		dataflowInputPortView.setBorder(new EmptyBorder(5, 5, 5, 5));
-		JLabel label = new JLabel(getTextFromDepth("port",
-				dataflowInputPort.getDepth()));
-		dataflowInputPortView.add(label);
-	}
-
-	@SuppressWarnings("serial")
-	@Override
-	public Action getConfigureAction(Frame owner) {
-		return new AbstractAction("Update prediction") {
-			@Override
-			public void actionPerformed(ActionEvent e) {
-				// fileManager.getCurrentDataflow().checkValidity();
-				refreshView();
-			}
-		};
-	}
-
-	@Override
-	public int getPreferredPosition() {
-		return 100;
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-contextual-views-impl/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/dataflowinputport/DataflowInputPortContextualViewFactory.java
----------------------------------------------------------------------
diff --git a/taverna-contextual-views-impl/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/dataflowinputport/DataflowInputPortContextualViewFactory.java b/taverna-contextual-views-impl/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/dataflowinputport/DataflowInputPortContextualViewFactory.java
deleted file mode 100644
index bc07803..0000000
--- a/taverna-contextual-views-impl/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/dataflowinputport/DataflowInputPortContextualViewFactory.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * 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.views.contextualviews.dataflowinputport;
-
-import java.util.Arrays;
-import java.util.List;
-
-import net.sf.taverna.t2.workbench.file.FileManager;
-import net.sf.taverna.t2.workbench.ui.views.contextualviews.ContextualView;
-import net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory;
-import org.apache.taverna.scufl2.api.port.InputWorkflowPort;
-
-/**
- * A factory of contextual views for dataflow's input ports.
- *
- * @author Alex Nenadic
- */
-public class DataflowInputPortContextualViewFactory implements
-		ContextualViewFactory<InputWorkflowPort> {
-	private FileManager fileManager;
-
-	@Override
-	public boolean canHandle(Object object) {
-		return object instanceof InputWorkflowPort;
-	}
-
-	@Override
-	public List<ContextualView> getViews(InputWorkflowPort inputport) {
-		return Arrays.asList(new ContextualView[] {
-				new DataflowInputPortContextualView(inputport, fileManager)});
-	}
-
-	public void setFileManager(FileManager fileManager) {
-		this.fileManager = fileManager;
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-contextual-views-impl/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/dataflowoutputport/DataflowOutputPortContextualView.java
----------------------------------------------------------------------
diff --git a/taverna-contextual-views-impl/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/dataflowoutputport/DataflowOutputPortContextualView.java b/taverna-contextual-views-impl/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/dataflowoutputport/DataflowOutputPortContextualView.java
deleted file mode 100644
index d203be4..0000000
--- a/taverna-contextual-views-impl/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/dataflowoutputport/DataflowOutputPortContextualView.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*******************************************************************************
- * 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.views.contextualviews.dataflowoutputport;
-
-import static java.awt.FlowLayout.LEFT;
-
-import java.awt.FlowLayout;
-import java.awt.Frame;
-import java.awt.event.ActionEvent;
-
-import javax.swing.AbstractAction;
-import javax.swing.Action;
-import javax.swing.JComponent;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.border.EmptyBorder;
-
-import org.apache.taverna.scufl2.api.port.OutputWorkflowPort;
-import net.sf.taverna.t2.workbench.file.FileManager;
-import net.sf.taverna.t2.workbench.ui.views.contextualviews.ContextualView;
-
-/**
- * Contextual view for dataflow's output ports.
- *
- * @author Alex Nenadic
- */
-public class DataflowOutputPortContextualView extends ContextualView {
-	private static final long serialVersionUID = 5496014085110553051L;
-
-	private OutputWorkflowPort dataflowOutputPort;
-	private JPanel dataflowOutputPortView;
-	@SuppressWarnings("unused")
-	private FileManager fileManager;
-
-	public DataflowOutputPortContextualView(OutputWorkflowPort outputport,
-			FileManager fileManager) {
-		this.dataflowOutputPort = outputport;
-		this.fileManager = fileManager;
-		initView();
-	}
-
-	@Override
-	public JComponent getMainFrame() {
-		refreshView();
-		return dataflowOutputPortView;
-	}
-
-	@Override
-	public String getViewTitle() {
-		return "Workflow output port: " + dataflowOutputPort.getName();
-	}
-
-	@Override
-	public void refreshView() {
-		dataflowOutputPortView = new JPanel(new FlowLayout(LEFT));
-		dataflowOutputPortView.setBorder(new EmptyBorder(5,5,5,5));
-		JLabel label = new JLabel(getTextForLabel());
-		dataflowOutputPortView.add(label);
-	}
-
-	private String getTextForLabel() {
-		//FIXME
-		//return getTextFromDepth("port", dataflowOutputPort.getDepth());
-		return "Fix depth for OutputWorkflowPort";
-	}
-
-	private void updatePrediction() {
-		//FIXME
-		// fileManager.getCurrentDataflow().checkValidity();
-	}
-
-	@Override
-	@SuppressWarnings("serial")
-	public Action getConfigureAction(Frame owner) {
-		return new AbstractAction("Update prediction") {
-			@Override
-			public void actionPerformed(ActionEvent e) {
-				updatePrediction();
-				refreshView();
-			}
-		};
-	}
-
-	@Override
-	public int getPreferredPosition() {
-		return 100;
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-contextual-views-impl/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/dataflowoutputport/DataflowOutputPortContextualViewFactory.java
----------------------------------------------------------------------
diff --git a/taverna-contextual-views-impl/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/dataflowoutputport/DataflowOutputPortContextualViewFactory.java b/taverna-contextual-views-impl/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/dataflowoutputport/DataflowOutputPortContextualViewFactory.java
deleted file mode 100644
index e0c69a5..0000000
--- a/taverna-contextual-views-impl/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/dataflowoutputport/DataflowOutputPortContextualViewFactory.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*******************************************************************************
- * 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.views.contextualviews.dataflowoutputport;
-
-import java.util.Arrays;
-import java.util.List;
-
-import net.sf.taverna.t2.workbench.file.FileManager;
-import net.sf.taverna.t2.workbench.ui.views.contextualviews.ContextualView;
-import net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory;
-import org.apache.taverna.workflowmodel.DataflowOutputPort;
-import org.apache.taverna.scufl2.api.port.OutputWorkflowPort;
-
-/**
- * A factory of contextual views for dataflow's output ports.
- *
- * @author Alex Nenadic
- */
-public class DataflowOutputPortContextualViewFactory implements
-		ContextualViewFactory<OutputWorkflowPort> {
-	private FileManager fileManager;
-
-	@Override
-	public boolean canHandle(Object object) {
-		return object instanceof DataflowOutputPort;
-	}
-
-	@Override
-	public List<ContextualView> getViews(OutputWorkflowPort outputport) {
-		return Arrays.asList(new ContextualView[] {
-				new DataflowOutputPortContextualView(outputport, fileManager)});
-	}
-
-	public void setFileManager(FileManager fileManager) {
-		this.fileManager = fileManager;
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-contextual-views-impl/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/datalink/DatalinkContextualView.java
----------------------------------------------------------------------
diff --git a/taverna-contextual-views-impl/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/datalink/DatalinkContextualView.java b/taverna-contextual-views-impl/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/datalink/DatalinkContextualView.java
deleted file mode 100644
index 0abbd48..0000000
--- a/taverna-contextual-views-impl/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/datalink/DatalinkContextualView.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*******************************************************************************
- * 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.views.contextualviews.datalink;
-
-import static java.awt.FlowLayout.LEFT;
-
-import java.awt.FlowLayout;
-import java.awt.Frame;
-import java.awt.event.ActionEvent;
-
-import javax.swing.AbstractAction;
-import javax.swing.Action;
-import javax.swing.JComponent;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.border.EmptyBorder;
-
-import org.apache.taverna.scufl2.api.core.DataLink;
-import net.sf.taverna.t2.workbench.file.FileManager;
-import net.sf.taverna.t2.workbench.ui.views.contextualviews.ContextualView;
-
-/**
- * Contextual view for dataflow's datalinks.
- *
- * @author Alex Nenadic
- * @author Alan R Williams
- */
-class DatalinkContextualView extends ContextualView {
-	private static final long serialVersionUID = -5031256519235454876L;
-
-	private DataLink datalink;
-	private JPanel datalinkView;
-	@SuppressWarnings("unused")
-	private final FileManager fileManager;
-
-	public DatalinkContextualView(DataLink datalink, FileManager fileManager) {
-		this.datalink = datalink;
-		this.fileManager = fileManager;
-		initView();
-	}
-
-	@Override
-	public JComponent getMainFrame() {
-		refreshView();
-		return datalinkView;
-	}
-
-	@Override
-	public String getViewTitle() {
-		return "Data link: " + datalink.getReceivesFrom().getName() + " -> " + datalink.getSendsTo().getName();
-	}
-
-	@Override
-	public void refreshView() {
-		datalinkView = new JPanel(new FlowLayout(LEFT));
-		datalinkView.setBorder(new EmptyBorder(5,5,5,5));
-		JLabel label = new JLabel (getTextForLabel());
-		datalinkView.add(label);
-	}
-
-	private String getTextForLabel() {
-		//FIXME
-		// return getTextFromDepth("link", datalink.getResolvedDepth());
-		return "Fix DataLink resolved depth";
-	}
-
-	private void updatePrediction() {
-		//FIXME
-		// fileManager.getCurrentDataflow().checkValidity();
-	}
-
-	@Override
-	@SuppressWarnings("serial")
-	public Action getConfigureAction(Frame owner) {
-		return new AbstractAction("Update prediction") {
-			@Override
-			public void actionPerformed(ActionEvent e) {
-				updatePrediction();
-				refreshView();
-			}
-		};
-	}
-
-	@Override
-	public int getPreferredPosition() {
-		return 100;
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-contextual-views-impl/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/datalink/DatalinkContextualViewFactory.java
----------------------------------------------------------------------
diff --git a/taverna-contextual-views-impl/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/datalink/DatalinkContextualViewFactory.java b/taverna-contextual-views-impl/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/datalink/DatalinkContextualViewFactory.java
deleted file mode 100644
index b3e67dc..0000000
--- a/taverna-contextual-views-impl/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/datalink/DatalinkContextualViewFactory.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*******************************************************************************
- * 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.views.contextualviews.datalink;
-
-import java.util.Arrays;
-import java.util.List;
-
-import net.sf.taverna.t2.workbench.file.FileManager;
-import net.sf.taverna.t2.workbench.ui.views.contextualviews.ContextualView;
-import net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory;
-import org.apache.taverna.workflowmodel.Datalink;
-import org.apache.taverna.scufl2.api.core.DataLink;
-
-/**
- * A factory of contextual views for dataflow's datalinks.
- *
- * @author Alex Nenadic
- */
-public class DatalinkContextualViewFactory implements
-		ContextualViewFactory<DataLink> {
-	private FileManager fileManager;
-
-	@Override
-	public boolean canHandle(Object object) {
-		return object instanceof Datalink;
-	}
-
-	@Override
-	public List<ContextualView> getViews(DataLink datalink) {
-		return Arrays.asList(new ContextualView[] {
-				new DatalinkContextualView(datalink, fileManager)});
-	}
-
-	public void setFileManager(FileManager fileManager) {
-		this.fileManager = fileManager;
-	}
-}


[49/51] [partial] incubator-taverna-workbench git commit: all packages are moved to org.apache.taverna.*

Posted by re...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/events/PartialServiceDescriptionsNotification.java
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/events/PartialServiceDescriptionsNotification.java b/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/events/PartialServiceDescriptionsNotification.java
new file mode 100644
index 0000000..763b32a
--- /dev/null
+++ b/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/events/PartialServiceDescriptionsNotification.java
@@ -0,0 +1,41 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.servicedescriptions.events;
+
+import java.util.Collection;
+
+import org.apache.taverna.servicedescriptions.ServiceDescription;
+import org.apache.taverna.servicedescriptions.ServiceDescriptionProvider;
+
+public class PartialServiceDescriptionsNotification extends
+		AbstractProviderNotification {
+	private final Collection<? extends ServiceDescription> serviceDescriptions;
+
+	public PartialServiceDescriptionsNotification(
+			ServiceDescriptionProvider provider,
+			Collection<? extends ServiceDescription> serviceDescriptions) {
+		super(provider, "Found " + serviceDescriptions.size() + " services");
+		this.serviceDescriptions = serviceDescriptions;
+	}
+
+	public Collection<? extends ServiceDescription> getServiceDescriptions() {
+		return serviceDescriptions;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/events/ProviderErrorNotification.java
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/events/ProviderErrorNotification.java b/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/events/ProviderErrorNotification.java
new file mode 100644
index 0000000..ed786f5
--- /dev/null
+++ b/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/events/ProviderErrorNotification.java
@@ -0,0 +1,38 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.servicedescriptions.events;
+
+import org.apache.taverna.servicedescriptions.ServiceDescriptionProvider;
+
+public class ProviderErrorNotification extends AbstractProviderNotification {
+
+	private final Throwable cause;
+
+	public ProviderErrorNotification(ServiceDescriptionProvider provider,
+			String message, Throwable cause) {
+		super(provider, message);
+		this.cause = cause;
+	}
+
+	public Throwable getCause() {
+		return cause;
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/events/ProviderStatusNotification.java
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/events/ProviderStatusNotification.java b/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/events/ProviderStatusNotification.java
new file mode 100644
index 0000000..384631e
--- /dev/null
+++ b/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/events/ProviderStatusNotification.java
@@ -0,0 +1,31 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.servicedescriptions.events;
+
+import org.apache.taverna.servicedescriptions.ServiceDescriptionProvider;
+
+public class ProviderStatusNotification extends AbstractProviderNotification {
+
+	public ProviderStatusNotification(ServiceDescriptionProvider provider,
+			String message) {
+		super(provider, message);
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/events/ProviderUpdatingNotification.java
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/events/ProviderUpdatingNotification.java b/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/events/ProviderUpdatingNotification.java
new file mode 100644
index 0000000..3e35c5d
--- /dev/null
+++ b/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/events/ProviderUpdatingNotification.java
@@ -0,0 +1,30 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.servicedescriptions.events;
+
+import org.apache.taverna.servicedescriptions.ServiceDescriptionProvider;
+
+public class ProviderUpdatingNotification extends AbstractProviderNotification {
+
+	public ProviderUpdatingNotification(ServiceDescriptionProvider provider) {
+		super(provider, "Updating");
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/events/ProviderWarningNotification.java
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/events/ProviderWarningNotification.java b/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/events/ProviderWarningNotification.java
new file mode 100644
index 0000000..3348504
--- /dev/null
+++ b/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/events/ProviderWarningNotification.java
@@ -0,0 +1,31 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.servicedescriptions.events;
+
+import org.apache.taverna.servicedescriptions.ServiceDescriptionProvider;
+
+public class ProviderWarningNotification extends AbstractProviderNotification {
+
+	public ProviderWarningNotification(ServiceDescriptionProvider provider,
+			String message) {
+		super(provider, message);
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/events/RemovedProviderEvent.java
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/events/RemovedProviderEvent.java b/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/events/RemovedProviderEvent.java
new file mode 100644
index 0000000..b2b0494
--- /dev/null
+++ b/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/events/RemovedProviderEvent.java
@@ -0,0 +1,29 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.servicedescriptions.events;
+
+import org.apache.taverna.servicedescriptions.ServiceDescriptionProvider;
+
+public class RemovedProviderEvent extends AbstractProviderEvent {
+
+	public RemovedProviderEvent(ServiceDescriptionProvider provider) {
+		super(provider);
+	}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/events/ServiceDescriptionProvidedEvent.java
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/events/ServiceDescriptionProvidedEvent.java b/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/events/ServiceDescriptionProvidedEvent.java
new file mode 100644
index 0000000..520906c
--- /dev/null
+++ b/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/events/ServiceDescriptionProvidedEvent.java
@@ -0,0 +1,39 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.servicedescriptions.events;
+
+import java.util.Set;
+
+import org.apache.taverna.servicedescriptions.ServiceDescription;
+import org.apache.taverna.servicedescriptions.ServiceDescriptionProvider;
+
+public class ServiceDescriptionProvidedEvent extends AbstractProviderEvent {
+	private final Set<ServiceDescription> serviceDescriptions;
+
+	public ServiceDescriptionProvidedEvent(ServiceDescriptionProvider provider,
+			Set<ServiceDescription> serviceDescriptions) {
+		super(provider);
+		this.serviceDescriptions = serviceDescriptions;
+	}
+
+	public Set<ServiceDescription> getServiceDescriptions() {
+		return serviceDescriptions;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/events/ServiceDescriptionRegistryEvent.java
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/events/ServiceDescriptionRegistryEvent.java b/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/events/ServiceDescriptionRegistryEvent.java
new file mode 100644
index 0000000..68c98b2
--- /dev/null
+++ b/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/events/ServiceDescriptionRegistryEvent.java
@@ -0,0 +1,23 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.servicedescriptions.events;
+
+public abstract class ServiceDescriptionRegistryEvent {
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-impl/src/main/java/net/sf/taverna/t2/servicedescriptions/impl/ServiceDescriptionConstants.java
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-impl/src/main/java/net/sf/taverna/t2/servicedescriptions/impl/ServiceDescriptionConstants.java b/taverna-activity-palette-impl/src/main/java/net/sf/taverna/t2/servicedescriptions/impl/ServiceDescriptionConstants.java
deleted file mode 100644
index c5221be..0000000
--- a/taverna-activity-palette-impl/src/main/java/net/sf/taverna/t2/servicedescriptions/impl/ServiceDescriptionConstants.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package net.sf.taverna.t2.servicedescriptions.impl;
-
-public interface ServiceDescriptionConstants {
-	String SERVICE_PANEL_CONFIGURATION = "servicePanelConfiguration";
-	String PROVIDERS = "providers";
-	String IGNORED = "ignored";
-	String PROVIDER_ID = "providerID";
-	String CONFIGURATION = "configuration";
-	String TYPE = "type";
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-impl/src/main/java/net/sf/taverna/t2/servicedescriptions/impl/ServiceDescriptionDeserializer.java
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-impl/src/main/java/net/sf/taverna/t2/servicedescriptions/impl/ServiceDescriptionDeserializer.java b/taverna-activity-palette-impl/src/main/java/net/sf/taverna/t2/servicedescriptions/impl/ServiceDescriptionDeserializer.java
deleted file mode 100644
index 379888a..0000000
--- a/taverna-activity-palette-impl/src/main/java/net/sf/taverna/t2/servicedescriptions/impl/ServiceDescriptionDeserializer.java
+++ /dev/null
@@ -1,167 +0,0 @@
-package net.sf.taverna.t2.servicedescriptions.impl;
-
-import static net.sf.taverna.t2.servicedescriptions.impl.ServiceDescriptionConstants.CONFIGURATION;
-import static net.sf.taverna.t2.servicedescriptions.impl.ServiceDescriptionConstants.IGNORED;
-import static net.sf.taverna.t2.servicedescriptions.impl.ServiceDescriptionConstants.PROVIDERS;
-import static net.sf.taverna.t2.servicedescriptions.impl.ServiceDescriptionConstants.PROVIDER_ID;
-import static net.sf.taverna.t2.servicedescriptions.impl.ServiceDescriptionConstants.TYPE;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URI;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-import org.apache.taverna.scufl2.api.configurations.Configuration;
-import net.sf.taverna.t2.servicedescriptions.ConfigurableServiceProvider;
-import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionProvider;
-import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionRegistry;
-
-import com.fasterxml.jackson.core.JsonFactory;
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.node.ArrayNode;
-import com.fasterxml.jackson.databind.node.ObjectNode;
-
-class ServiceDescriptionDeserializer {
-	private List<ServiceDescriptionProvider> serviceDescriptionProviders;
-
-	ServiceDescriptionDeserializer(
-			List<ServiceDescriptionProvider> serviceDescriptionProviders) {
-		this.serviceDescriptionProviders = serviceDescriptionProviders;
-	}
-
-	public void deserialize(ServiceDescriptionRegistry registry,
-			File serviceDescriptionsFile) throws DeserializationException {
-		try (FileInputStream serviceDescriptionFileStream = new FileInputStream(
-				serviceDescriptionsFile)) {
-			deserialize(registry, serviceDescriptionFileStream);
-		} catch (FileNotFoundException ex) {
-			throw new DeserializationException("Could not locate file "
-					+ serviceDescriptionsFile.getAbsolutePath()
-					+ " containing service descriptions.");
-		} catch (IOException ex) {
-			throw new DeserializationException(
-					"Could not read stream containing service descriptions from "
-							+ serviceDescriptionsFile.getAbsolutePath(), ex);
-		}
-	}
-
-	public void deserialize(ServiceDescriptionRegistry registry,
-			URL serviceDescriptionsURL) throws DeserializationException {
-		try (InputStream serviceDescriptionInputStream = serviceDescriptionsURL
-				.openStream()) {
-			deserialize(registry, serviceDescriptionInputStream);
-		} catch (FileNotFoundException ex) {
-			throw new DeserializationException("Could not open URL "
-					+ serviceDescriptionsURL
-					+ " containing service descriptions.");
-		} catch (IOException ex) {
-			throw new DeserializationException(
-					"Could not read stream containing service descriptions from "
-							+ serviceDescriptionsURL, ex);
-		}
-	}
-
-	private static final JsonFactory factory = new JsonFactory();
-
-	private void deserialize(ServiceDescriptionRegistry registry,
-			InputStream serviceDescriptionsInputStream) throws IOException,
-			DeserializationException {
-		ObjectNode node = (ObjectNode) new ObjectMapper(factory)
-				.readTree(serviceDescriptionsInputStream);
-		List<ServiceDescriptionProvider> providers = deserializeProviders(node,
-				true);
-		for (ServiceDescriptionProvider provider : providers)
-			registry.addServiceDescriptionProvider(provider);
-	}
-
-	public Collection<? extends ServiceDescriptionProvider> deserializeDefaults(
-			ServiceDescriptionRegistry registry,
-			File defaultConfigurableServiceProvidersFile)
-			throws DeserializationException {
-		ObjectNode node;
-		try (FileInputStream serviceDescriptionStream = new FileInputStream(
-				defaultConfigurableServiceProvidersFile)) {
-			node = (ObjectNode) new ObjectMapper(factory)
-					.readTree(serviceDescriptionStream);
-		} catch (IOException e) {
-			throw new DeserializationException("Can't read "
-					+ defaultConfigurableServiceProvidersFile);
-		}
-		return deserializeProviders(node, false);
-	}
-
-	private List<ServiceDescriptionProvider> deserializeProviders(
-			ObjectNode rootNode, boolean obeyIgnored)
-			throws DeserializationException {
-		List<ServiceDescriptionProvider> providers = new ArrayList<>();
-
-		ArrayNode providersNode = (ArrayNode) rootNode.get(PROVIDERS);
-		if (providersNode != null)
-			for (JsonNode provider : providersNode)
-				providers.add(deserializeProvider((ObjectNode) provider));
-
-		if (obeyIgnored) {
-			ArrayNode ignoredNode = (ArrayNode) rootNode.get(IGNORED);
-			if (ignoredNode != null)
-				for (JsonNode provider : ignoredNode)
-					providers
-							.remove(deserializeProvider((ObjectNode) provider));
-		}
-
-		return providers;
-	}
-
-	private ServiceDescriptionProvider deserializeProvider(
-			ObjectNode providerNode) throws DeserializationException {
-		String providerId = providerNode.get(PROVIDER_ID).asText().trim();
-		ServiceDescriptionProvider provider = null;
-		for (ServiceDescriptionProvider serviceProvider : serviceDescriptionProviders)
-			if (serviceProvider.getId().equals(providerId)) {
-				provider = serviceProvider;
-				break;
-			}
-		if (provider == null)
-			throw new DeserializationException(
-					"Could not find provider with id " + providerId);
-
-		/*
-		 * So we know the service provider now, but we need a separate instance
-		 * of that provider for each providerElem. E.g. we can have 2 or more
-		 * WSDL provider elements and need to return a separate provider
-		 * instance for each as they will have different configurations.
-		 */
-		ServiceDescriptionProvider instance = provider.newInstance();
-
-		if (instance instanceof ConfigurableServiceProvider)
-			try {
-				Configuration config = new Configuration();
-				config.setType(URI.create(providerNode.get(TYPE).textValue()));
-				config.setJson(providerNode.get(CONFIGURATION));
-				if (config != null)
-					((ConfigurableServiceProvider) instance).configure(config);
-			} catch (Exception e) {
-				throw new DeserializationException(
-						"Could not configure provider " + providerId
-								+ " using bean " + providerNode, e);
-			}
-		return instance;
-	}
-
-	@SuppressWarnings("serial")
-	static class DeserializationException extends Exception {
-		public DeserializationException(String string) {
-			super(string);
-		}
-
-		public DeserializationException(String string, Exception ex) {
-			super(string, ex);
-		}
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-impl/src/main/java/net/sf/taverna/t2/servicedescriptions/impl/ServiceDescriptionRegistryImpl.java
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-impl/src/main/java/net/sf/taverna/t2/servicedescriptions/impl/ServiceDescriptionRegistryImpl.java b/taverna-activity-palette-impl/src/main/java/net/sf/taverna/t2/servicedescriptions/impl/ServiceDescriptionRegistryImpl.java
deleted file mode 100644
index d481727..0000000
--- a/taverna-activity-palette-impl/src/main/java/net/sf/taverna/t2/servicedescriptions/impl/ServiceDescriptionRegistryImpl.java
+++ /dev/null
@@ -1,652 +0,0 @@
-/*******************************************************************************
- * 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.servicedescriptions.impl;
-
-import static java.lang.System.currentTimeMillis;
-import static java.lang.Thread.MIN_PRIORITY;
-import static java.lang.Thread.currentThread;
-
-import java.io.File;
-import java.io.IOException;
-import java.lang.Thread.UncaughtExceptionHandler;
-import java.lang.reflect.InvocationTargetException;
-import java.net.URI;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.taverna.lang.observer.MultiCaster;
-import org.apache.taverna.lang.observer.Observer;
-import net.sf.taverna.t2.servicedescriptions.ConfigurableServiceProvider;
-import net.sf.taverna.t2.servicedescriptions.ServiceDescription;
-import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionProvider;
-import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionsConfiguration;
-import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionProvider.FindServiceDescriptionsCallBack;
-import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionRegistry;
-import net.sf.taverna.t2.servicedescriptions.events.AddedProviderEvent;
-import net.sf.taverna.t2.servicedescriptions.events.PartialServiceDescriptionsNotification;
-import net.sf.taverna.t2.servicedescriptions.events.ProviderErrorNotification;
-import net.sf.taverna.t2.servicedescriptions.events.ProviderStatusNotification;
-import net.sf.taverna.t2.servicedescriptions.events.ProviderUpdatingNotification;
-import net.sf.taverna.t2.servicedescriptions.events.ProviderWarningNotification;
-import net.sf.taverna.t2.servicedescriptions.events.RemovedProviderEvent;
-import net.sf.taverna.t2.servicedescriptions.events.ServiceDescriptionProvidedEvent;
-import net.sf.taverna.t2.servicedescriptions.events.ServiceDescriptionRegistryEvent;
-import net.sf.taverna.t2.servicedescriptions.impl.ServiceDescriptionDeserializer.DeserializationException;
-
-import org.apache.commons.beanutils.BeanUtils;
-import org.apache.log4j.Logger;
-
-import uk.org.taverna.configuration.app.ApplicationConfiguration;
-
-public class ServiceDescriptionRegistryImpl implements ServiceDescriptionRegistry {
-	/**
-	 * If a writable property of this name on a provider exists (ie. the provider has a method
-	 * setServiceDescriptionRegistry(ServiceDescriptionRegistry registry) - then this property will
-	 * be set to the current registry.
-	 */
-	public static final String SERVICE_DESCRIPTION_REGISTRY = "serviceDescriptionRegistry";
-	public static Logger logger = Logger.getLogger(ServiceDescriptionRegistryImpl.class);
-	public static final ThreadGroup threadGroup = new ThreadGroup("Service description providers");
-	/**
-	 * Total maximum timeout while waiting for description threads to finish
-	 */
-	private static final long DESCRIPTION_THREAD_TIMEOUT_MS = 3000;
-	protected static final String CONF_DIR = "conf";
-	protected static final String SERVICE_PROVIDERS_FILENAME = "service_providers.xml";
-	private static final String DEFAULT_CONFIGURABLE_SERVICE_PROVIDERS_FILENAME = "default_service_providers.xml";
-
-	private ServiceDescriptionsConfiguration serviceDescriptionsConfig;
-	private ApplicationConfiguration applicationConfiguration;
-	/**
-	 * <code>false</code> until first call to {@link #loadServiceProviders()} - which is done by
-	 * first call to {@link #getServiceDescriptionProviders()}.
-	 */
-	private boolean hasLoadedProviders = false;
-	/**
-	 * <code>true</code> while {@link #loadServiceProviders(File)},
-	 * {@link #loadServiceProviders(URL)} or {@link #loadServiceProviders()} is in progress, avoids
-	 * triggering {@link #saveServiceDescriptions()} on
-	 * {@link #addServiceDescriptionProvider(ServiceDescriptionProvider)} calls.
-	 */
-	private boolean loading = false;
-	private MultiCaster<ServiceDescriptionRegistryEvent> observers = new MultiCaster<>(this);
-	private List<ServiceDescriptionProvider> serviceDescriptionProviders;
-	private Set<ServiceDescriptionProvider> allServiceProviders;
-	private Map<ServiceDescriptionProvider, Set<ServiceDescription>> providerDescriptions = new HashMap<>();
-	private Map<ServiceDescriptionProvider, Thread> serviceDescriptionThreads = new HashMap<>();
-	/**
-	 * Service providers added by the user, should be saved
-	 */
-	private Set<ServiceDescriptionProvider> userAddedProviders = new HashSet<>();
-	private Set<ServiceDescriptionProvider> userRemovedProviders = new HashSet<>();
-	private Set<ServiceDescriptionProvider> defaultServiceDescriptionProviders;
-	/**
-	 * File containing a list of configured ConfigurableServiceProviders which is used to get the
-	 * default set of service descriptions together with those provided by AbstractTemplateServiceS.
-	 * This file is located in the conf directory of the Taverna startup directory.
-	 */
-	private File defaultConfigurableServiceProvidersFile;
-	private boolean defaultSystemConfigurableProvidersLoaded = false;
-
-	static {
-		threadGroup.setMaxPriority(MIN_PRIORITY);
-	}
-
-	public ServiceDescriptionRegistryImpl(
-			ApplicationConfiguration applicationConfiguration) {
-		this.applicationConfiguration = applicationConfiguration;
-		defaultConfigurableServiceProvidersFile = new File(
-				getTavernaStartupConfigurationDirectory(),
-				DEFAULT_CONFIGURABLE_SERVICE_PROVIDERS_FILENAME);
-	}
-
-	/**
-	 * Get the Taverna distribution (startup) configuration directory.
-	 */
-	private File getTavernaStartupConfigurationDirectory() {
-		File distroHome = null;
-		File configDirectory = null;
-		distroHome = applicationConfiguration.getStartupDir();
-		configDirectory = new File(distroHome, "conf");
-		if (!configDirectory.exists())
-			configDirectory.mkdir();
-		return configDirectory;
-	}
-
-	private static void joinThreads(Collection<? extends Thread> threads,
-			long descriptionThreadTimeoutMs) {
-		long finishJoinBy = currentTimeMillis() + descriptionThreadTimeoutMs;
-		for (Thread thread : threads) {
-			// No shorter timeout than 1 ms (thread.join(0) waits forever!)
-			long timeout = Math.max(1, finishJoinBy - currentTimeMillis());
-			try {
-				thread.join(timeout);
-			} catch (InterruptedException e) {
-				currentThread().interrupt();
-				return;
-			}
-			if (thread.isAlive())
-				logger.debug("Thread did not finish " + thread);
-		}
-	}
-
-
-	@Override
-	public void addObserver(Observer<ServiceDescriptionRegistryEvent> observer) {
-		observers.addObserver(observer);
-	}
-
-	@Override
-	public void addServiceDescriptionProvider(ServiceDescriptionProvider provider) {
-		synchronized (this) {
-			userRemovedProviders.remove(provider);
-			if (!getDefaultServiceDescriptionProviders().contains(provider))
-				userAddedProviders.add(provider);
-			allServiceProviders.add(provider);
-		}
-
-		// Spring-like auto-config
-		try {
-			// BeanUtils should ignore this if provider does not have that property
-			BeanUtils.setProperty(provider, SERVICE_DESCRIPTION_REGISTRY, this);
-		} catch (IllegalAccessException | InvocationTargetException e) {
-			logger.warn("Could not set serviceDescriptionRegistry on "
-					+ provider, e);
-		}
-
-		if (!loading)
-			saveServiceDescriptions();
-		observers.notify(new AddedProviderEvent(provider));
-		updateServiceDescriptions(false, false);
-	}
-
-	private File findServiceDescriptionsFile() {
-		File confDir = new File(
-				applicationConfiguration.getApplicationHomeDir(), CONF_DIR);
-		confDir.mkdirs();
-		if (!confDir.isDirectory())
-			throw new RuntimeException("Invalid directory: " + confDir);
-		File serviceDescriptionsFile = new File(confDir,
-				SERVICE_PROVIDERS_FILENAME);
-		return serviceDescriptionsFile;
-	}
-
-	@Override
-	public List<Observer<ServiceDescriptionRegistryEvent>> getObservers() {
-		return observers.getObservers();
-	}
-
-	// Fallback to this method that uses hardcoded default services if you cannot read them from
-	// the file.
-//	@SuppressWarnings("unchecked")
-//	public synchronized Set<ServiceDescriptionProvider> getDefaultServiceDescriptionProvidersFallback() {
-//		/*if (defaultServiceDescriptionProviders != null) {
-//	 return defaultServiceDescriptionProviders;
-//	 }
-//	 defaultServiceDescriptionProviders = new HashSet<ServiceDescriptionProvider>();
-//		 */
-//		for (ServiceDescriptionProvider provider : serviceDescriptionProviders) {
-//
-//			/* We do not need these - already loaded them from getDefaultServiceDescriptionProviders()
-//	 if (!(provider instanceof ConfigurableServiceProvider)) {
-//	 defaultServiceDescriptionProviders.add(provider);
-//	 continue;
-//	 }*/
-//
-//			// Just load the hard coded default configurable service providers
-//			if (provider instanceof ConfigurableServiceProvider){
-//				ConfigurableServiceProvider<Object> template = ((ConfigurableServiceProvider<Object>)
-//						provider);
-//				// Get configurations
-//				List<Object> configurables = template.getDefaultConfigurations();
-//				for (Object config : configurables) {
-//					// Make a copy that we can configure
-//					ConfigurableServiceProvider<Object> configurableProvider = template.clone();
-//					try {
-//						configurableProvider.configure(config);
-//					} catch (ConfigurationException e) {
-//						logger.warn("Can't configure provider "
-//								+ configurableProvider + " with " + config);
-//						continue;
-//					}
-//					defaultServiceDescriptionProviders.add(configurableProvider);
-//				}
-//			}
-//		}
-//		return defaultServiceDescriptionProviders;
-//	}
-
-	// Get the default services.
-	@Override
-	public synchronized Set<ServiceDescriptionProvider> getDefaultServiceDescriptionProviders() {
-		if (defaultServiceDescriptionProviders != null)
-			return defaultServiceDescriptionProviders;
-		defaultServiceDescriptionProviders = new HashSet<>();
-
-		/*
-		 * Add default configurable service description providers from the
-		 * default_service_providers.xml file
-		 */
-		if (defaultConfigurableServiceProvidersFile.exists()) {
-			try {
-				ServiceDescriptionDeserializer deserializer = new ServiceDescriptionDeserializer(
-						serviceDescriptionProviders);
-				defaultServiceDescriptionProviders.addAll(deserializer
-						.deserializeDefaults(this,
-								defaultConfigurableServiceProvidersFile));
-				/*
-				 * We have successfully loaded the defaults for system
-				 * configurable providers. Note that there are still defaults
-				 * for third party configurable providers, which will be loaded
-				 * below using getDefaultConfigurations().
-				 */
-				defaultSystemConfigurableProvidersLoaded = true;
-			} catch (Exception e) {
-				logger.error("Could not load default service providers from "
-						+ defaultConfigurableServiceProvidersFile.getAbsolutePath(), e);
-
-				/*
-				 * Fallback on the old hardcoded method of loading default
-				 * system configurable service providers using
-				 * getDefaultConfigurations().
-				 */
-				defaultSystemConfigurableProvidersLoaded = false;
-			}
-		} else {
-			logger.warn("Could not find the file "
-					+ defaultConfigurableServiceProvidersFile.getAbsolutePath()
-					+ " containing default system service providers. "
-					+ "Using the hardcoded list of default system providers.");
-
-			/*
-			 * Fallback on the old hardcoded method of loading default system
-			 * configurable service providers using getDefaultConfigurations().
-			 */
-			defaultSystemConfigurableProvidersLoaded = false;
-		}
-
-		/*
-		 * Load other default service description providers - template, local
-		 * workers and third party configurable service providers
-		 */
-		for (ServiceDescriptionProvider provider : serviceDescriptionProviders) {
-			/*
-			 * Template service providers (beanshell, string constant, etc. )
-			 * and providers of local workers.
-			 */
-			if (!(provider instanceof ConfigurableServiceProvider)) {
-				defaultServiceDescriptionProviders.add(provider);
-				continue;
-			}
-
-			/*
-			 * Default system or third party configurable service description
-			 * provider. System ones are read from the
-			 * default_service_providers.xml file so getDefaultConfigurations()
-			 * on them will not have much effect here unless
-			 * defaultSystemConfigurableProvidersLoaded is set to false.
-			 */
-			//FIXME needs to be designed to work using Configuration instances
-			//FIXME needs to get configurations via OSGi discovery
-			/*
-			ConfigurableServiceProvider template = (ConfigurableServiceProvider) provider;
-			// Get configurations
-			for (ObjectNode config : template.getDefaultConfigurations()) {
-				// Make a copy that we can configure
-				ConfigurableServiceProvider configurableProvider = template.clone();
-				try {
-					configurableProvider.configure(config);
-				} catch (ConfigurationException e) {
-					logger.warn("Can't configure provider "
-							+ configurableProvider + " with " + config);
-					continue;
-				}
-				defaultServiceDescriptionProviders.add(configurableProvider);
-			}
-			*/
-		}
-
-		return defaultServiceDescriptionProviders;
-	}
-
-	@Override
-	public synchronized Set<ServiceDescriptionProvider> getServiceDescriptionProviders() {
-		if (allServiceProviders != null)
-			return new HashSet<>(allServiceProviders);
-		allServiceProviders = new HashSet<>(userAddedProviders);
-		synchronized (this) {
-			if (!hasLoadedProviders)
-				try {
-					loadServiceProviders();
-				} catch (Exception e) {
-					logger.error("Could not load service providers", e);
-				} finally {
-					hasLoadedProviders = true;
-				}
-		}
-		for (ServiceDescriptionProvider provider : getDefaultServiceDescriptionProviders()) {
-			if (userRemovedProviders.contains(provider))
-				continue;
-			if (provider instanceof ConfigurableServiceProvider
-					&& !serviceDescriptionsConfig.isIncludeDefaults())
-				// We'll skip the default configurable service provders
-				continue;
-			allServiceProviders.add(provider);
-		}
-		return new HashSet<>(allServiceProviders);
-	}
-
-	@Override
-	public Set<ServiceDescriptionProvider> getServiceDescriptionProviders(
-			ServiceDescription sd) {
-		Set<ServiceDescriptionProvider> result = new HashSet<>();
-		for (ServiceDescriptionProvider sdp : providerDescriptions.keySet())
-			if (providerDescriptions.get(sdp).contains(sd))
-				result.add(sdp);
-		return result;
-	}
-
-	@Override
-	public Set<ServiceDescription> getServiceDescriptions() {
-		updateServiceDescriptions(false, true);
-		Set<ServiceDescription> serviceDescriptions = new HashSet<>();
-		synchronized (providerDescriptions) {
-			for (Set<ServiceDescription> providerDesc : providerDescriptions
-					.values())
-				serviceDescriptions.addAll(providerDesc);
-		}
-		return serviceDescriptions;
-	}
-
-	@Override
-	public ServiceDescription getServiceDescription(URI serviceType) {
-		for (ServiceDescription serviceDescription : getServiceDescriptions())
-			if (serviceDescription.getActivityType().equals(serviceType))
-				return serviceDescription;
-		return null;
-	}
-
-	@Override
-	public List<ConfigurableServiceProvider> getUnconfiguredServiceProviders() {
-		List<ConfigurableServiceProvider> providers = new ArrayList<>();
-		for (ServiceDescriptionProvider provider : serviceDescriptionProviders)
-			if (provider instanceof ConfigurableServiceProvider)
-				providers.add((ConfigurableServiceProvider) provider);
-		return providers;
-	}
-
-	@Override
-	public Set<ServiceDescriptionProvider> getUserAddedServiceProviders() {
-		return new HashSet<>(userAddedProviders);
-	}
-
-	@Override
-	public Set<ServiceDescriptionProvider> getUserRemovedServiceProviders() {
-		return new HashSet<>(userRemovedProviders);
-	}
-
-	@Override
-	public void loadServiceProviders() {
-		File serviceProviderFile = findServiceDescriptionsFile();
-		if (serviceProviderFile.isFile())
-			loadServiceProviders(serviceProviderFile);
-		hasLoadedProviders = true;
-	}
-
-	@Override
-	public void loadServiceProviders(File serviceProvidersFile) {
-		ServiceDescriptionDeserializer deserializer = new ServiceDescriptionDeserializer(
-				serviceDescriptionProviders);
-		loading = true;
-		try {
-			deserializer.deserialize(this, serviceProvidersFile);
-		} catch (DeserializationException e) {
-			logger.error("failed to deserialize configuration", e);
-		}
-		loading = false;
-	}
-
-	@Override
-	public void loadServiceProviders(URL serviceProvidersURL) {
-		ServiceDescriptionDeserializer deserializer = new ServiceDescriptionDeserializer(
-				serviceDescriptionProviders);
-		loading = true;
-		try {
-			deserializer.deserialize(this, serviceProvidersURL);
-		} catch (DeserializationException e) {
-			logger.error("failed to deserialize configuration", e);
-		}
-		loading = false;
-	}
-
-	@Override
-	public void refresh() {
-		updateServiceDescriptions(true, false);
-	}
-
-	@Override
-	public void removeObserver(Observer<ServiceDescriptionRegistryEvent> observer) {
-		observers.removeObserver(observer);
-	}
-
-	@Override
-	public synchronized void removeServiceDescriptionProvider(
-			ServiceDescriptionProvider provider) {
-		if (!userAddedProviders.remove(provider))
-			// Not previously added - must be a default one.. but should we remove it?
-			if (loading || serviceDescriptionsConfig.isRemovePermanently()
-					&& serviceDescriptionsConfig.isIncludeDefaults())
-				userRemovedProviders.add(provider);
-		if (allServiceProviders.remove(provider)) {
-			synchronized (providerDescriptions) {
-				Thread thread = serviceDescriptionThreads.remove(provider);
-				if (thread != null)
-					thread.interrupt();
-				providerDescriptions.remove(provider);
-			}
-			observers.notify(new RemovedProviderEvent(provider));
-		}
-		if (!loading)
-			saveServiceDescriptions();
-	}
-
-	@Override
-	public void saveServiceDescriptions() {
-		File serviceDescriptionsFile = findServiceDescriptionsFile();
-		saveServiceDescriptions(serviceDescriptionsFile);
-	}
-
-	@Override
-	public void saveServiceDescriptions(File serviceDescriptionsFile) {
-		ServiceDescriptionSerializer serializer = new ServiceDescriptionSerializer();
-		try {
-			serializer.serializeRegistry(this, serviceDescriptionsFile);
-		} catch (IOException e) {
-			throw new RuntimeException("Can't save service descriptions to "
-					+ serviceDescriptionsFile);
-		}
-	}
-
-	/**
-	 * Exports all configurable service providers (that give service
-	 * descriptions) currently found in the Service Registry (apart from service
-	 * templates and local services) regardless of who added them (user or
-	 * default system providers).
-	 * <p>
-	 * Unlike {@link #saveServiceDescriptions}, this export does not have the
-	 * "ignored providers" section as this is just a plain export of everything
-	 * in the Service Registry.
-	 * 
-	 * @param serviceDescriptionsFile
-	 */
-	@Override
-	public void exportCurrentServiceDescriptions(File serviceDescriptionsFile) {
-		ServiceDescriptionSerializer serializer = new ServiceDescriptionSerializer();
-		try {
-			serializer.serializeFullRegistry(this, serviceDescriptionsFile);
-		} catch (IOException e) {
-			throw new RuntimeException("Could not save service descriptions to "
-					+ serviceDescriptionsFile);
-		}
-	}
-
-	public void setServiceDescriptionProvidersList(
-			List<ServiceDescriptionProvider> serviceDescriptionProviders) {
-		this.serviceDescriptionProviders = serviceDescriptionProviders;
-	}
-
-	private void updateServiceDescriptions(boolean refreshAll, boolean waitFor) {
-		List<Thread> threads = new ArrayList<>();
-		for (ServiceDescriptionProvider provider : getServiceDescriptionProviders()) {
-			synchronized (providerDescriptions) {
-				if (providerDescriptions.containsKey(provider) && !refreshAll)
-					// We'll used the cached values
-					continue;
-				Thread oldThread = serviceDescriptionThreads.get(provider);
-				if (oldThread != null && oldThread.isAlive()) {
-					if (refreshAll)
-						// New thread will override the old thread
-						oldThread.interrupt();
-					else {
-						// observers.notify(new ProviderStatusNotification(provider, "Waiting for provider"));
-						continue;
-					}
-				}
-				// Not run yet - we'll start a new tread
-				Thread thread = new FindServiceDescriptionsThread(provider);
-				threads.add(thread);
-				serviceDescriptionThreads.put(provider, thread);
-				thread.start();
-			}
-		}
-		if (waitFor)
-			joinThreads(threads, DESCRIPTION_THREAD_TIMEOUT_MS);
-	}
-
-	@Override
-	public boolean isDefaultSystemConfigurableProvidersLoaded() {
-		return defaultSystemConfigurableProvidersLoaded;
-	}
-
-	/**
-	 * Sets the serviceDescriptionsConfig.
-	 * 
-	 * @param serviceDescriptionsConfig
-	 *            the new value of serviceDescriptionsConfig
-	 */
-	public void setServiceDescriptionsConfig(
-			ServiceDescriptionsConfiguration serviceDescriptionsConfig) {
-		this.serviceDescriptionsConfig = serviceDescriptionsConfig;
-	}
-
-	class FindServiceDescriptionsThread extends Thread implements
-			UncaughtExceptionHandler, FindServiceDescriptionsCallBack {
-		private final ServiceDescriptionProvider provider;
-		private boolean aborting = false;
-		private final Set<ServiceDescription> providerDescs = new HashSet<>();
-
-		FindServiceDescriptionsThread(ServiceDescriptionProvider provider) {
-			super(threadGroup, "Find service descriptions from " + provider);
-			this.provider = provider;
-			setUncaughtExceptionHandler(this);
-			setDaemon(true);
-		}
-
-		@Override
-		public void fail(String message, Throwable ex) {
-			logger.warn("Provider " + getProvider() + ": " + message, ex);
-			if (aborting)
-				return;
-			observers.notify(new ProviderErrorNotification(getProvider(),
-					message, ex));
-		}
-
-		@Override
-		public void finished() {
-			if (aborting)
-				return;
-			synchronized (providerDescriptions) {
-				providerDescriptions.put(getProvider(), providerDescs);
-			}
-			observers.notify(new ServiceDescriptionProvidedEvent(getProvider(),
-					providerDescs));
-		}
-
-		@Override
-		public void partialResults(
-				Collection<? extends ServiceDescription> serviceDescriptions) {
-			if (aborting)
-				return;
-			providerDescs.addAll(serviceDescriptions);
-			synchronized (providerDescriptions) {
-				providerDescriptions.put(getProvider(), providerDescs);
-			}
-			observers.notify(new PartialServiceDescriptionsNotification(
-					getProvider(), serviceDescriptions));
-		}
-
-		@Override
-		public void status(String message) {
-			logger.debug("Provider " + getProvider() + ": " + message);
-			if (aborting)
-				return;
-			observers.notify(new ProviderStatusNotification(getProvider(),
-					message));
-		}
-
-		@Override
-		public void warning(String message) {
-			logger.warn("Provider " + getProvider() + ": " + message);
-			if (aborting)
-				return;
-			observers.notify(new ProviderWarningNotification(getProvider(),
-					message));
-		}
-
-		public ServiceDescriptionProvider getProvider() {
-			return provider;
-		}
-
-		@Override
-		public void interrupt() {
-			aborting = true;
-			super.interrupt();
-		}
-
-		@Override
-		public void run() {
-			observers.notify(new ProviderUpdatingNotification(provider));
-			getProvider().findServiceDescriptionsAsync(this);
-		}
-
-		@Override
-		public void uncaughtException(Thread t, Throwable ex) {
-			logger.error("Uncaught exception in " + t, ex);
-			fail("Uncaught exception", ex);
-		}
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-impl/src/main/java/net/sf/taverna/t2/servicedescriptions/impl/ServiceDescriptionSerializer.java
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-impl/src/main/java/net/sf/taverna/t2/servicedescriptions/impl/ServiceDescriptionSerializer.java b/taverna-activity-palette-impl/src/main/java/net/sf/taverna/t2/servicedescriptions/impl/ServiceDescriptionSerializer.java
deleted file mode 100644
index 8a047a3..0000000
--- a/taverna-activity-palette-impl/src/main/java/net/sf/taverna/t2/servicedescriptions/impl/ServiceDescriptionSerializer.java
+++ /dev/null
@@ -1,102 +0,0 @@
-package net.sf.taverna.t2.servicedescriptions.impl;
-
-import static net.sf.taverna.t2.servicedescriptions.impl.ServiceDescriptionConstants.CONFIGURATION;
-import static net.sf.taverna.t2.servicedescriptions.impl.ServiceDescriptionConstants.IGNORED;
-import static net.sf.taverna.t2.servicedescriptions.impl.ServiceDescriptionConstants.PROVIDERS;
-import static net.sf.taverna.t2.servicedescriptions.impl.ServiceDescriptionConstants.PROVIDER_ID;
-import static net.sf.taverna.t2.servicedescriptions.impl.ServiceDescriptionConstants.SERVICE_PANEL_CONFIGURATION;
-import static net.sf.taverna.t2.servicedescriptions.impl.ServiceDescriptionConstants.TYPE;
-
-import java.io.BufferedOutputStream;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.util.Set;
-
-import net.sf.taverna.t2.servicedescriptions.ConfigurableServiceProvider;
-import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionProvider;
-import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionRegistry;
-
-import org.apache.log4j.Logger;
-import org.jdom.JDOMException;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.node.ArrayNode;
-import com.fasterxml.jackson.databind.node.JsonNodeFactory;
-import com.fasterxml.jackson.databind.node.ObjectNode;
-
-class ServiceDescriptionSerializer {
-	private static Logger logger = Logger
-			.getLogger(ServiceDescriptionSerializer.class);
-
-	public void serializeRegistry(ServiceDescriptionRegistry registry, File file)
-			throws IOException {
-		Set<ServiceDescriptionProvider> ignoreProviders = registry
-				.getUserRemovedServiceProviders();
-		JsonNode registryElement = serializeRegistry(registry, ignoreProviders);
-		try (BufferedOutputStream bufferedOutStream = new BufferedOutputStream(
-				new FileOutputStream(file))) {
-			bufferedOutStream.write(registryElement.toString()
-					.getBytes("UTF-8"));
-		}
-	}
-
-	/**
-	 * Export the whole service registry to an xml file, regardless of who added
-	 * the service provider (user or system default). In this case there will be
-	 * no "ignored providers" in the saved file.
-	 */
-	public void serializeFullRegistry(ServiceDescriptionRegistry registry,
-			File file) throws IOException {
-		JsonNode registryElement = serializeRegistry(registry, ALL_PROVIDERS);
-		try (BufferedOutputStream bufferedOutStream = new BufferedOutputStream(
-				new FileOutputStream(file))) {
-			bufferedOutStream.write(registryElement.toString()
-					.getBytes("UTF-8"));
-		}
-	}
-
-	private static final JsonNodeFactory factory = JsonNodeFactory.instance;
-	private static final Set<ServiceDescriptionProvider> ALL_PROVIDERS = null;
-
-	private JsonNode serializeRegistry(ServiceDescriptionRegistry registry,
-			Set<ServiceDescriptionProvider> ignoreProviders) {
-		ObjectNode overallConfiguration = factory.objectNode();
-		overallConfiguration.put(SERVICE_PANEL_CONFIGURATION,
-				ignoreProviders != ALL_PROVIDERS ? "full" : "defaults only");
-		ArrayNode providers = overallConfiguration.putArray(PROVIDERS);
-
-		for (ServiceDescriptionProvider provider : registry
-				.getUserAddedServiceProviders())
-			try {
-				providers.add(serializeProvider(provider));
-			} catch (JDOMException | IOException e) {
-				logger.warn("Could not serialize " + provider, e);
-			}
-
-		if (ignoreProviders != ALL_PROVIDERS) {
-			ArrayNode ignored = overallConfiguration.putArray(IGNORED);
-			for (ServiceDescriptionProvider provider : ignoreProviders)
-				try {
-					ignored.add(serializeProvider(provider));
-				} catch (JDOMException | IOException e) {
-					logger.warn("Could not serialize " + provider, e);
-				}
-		}
-
-		return overallConfiguration;
-	}
-
-	private JsonNode serializeProvider(ServiceDescriptionProvider provider)
-			throws JDOMException, IOException {
-		ObjectNode node = factory.objectNode();
-		node.put(PROVIDER_ID, provider.getId());
-
-		if (provider instanceof ConfigurableServiceProvider) {
-			ConfigurableServiceProvider configurable = (ConfigurableServiceProvider) provider;
-			node.put(TYPE, configurable.getConfiguration().getType().toString());
-			node.put(CONFIGURATION, configurable.getConfiguration().getJson());
-		}
-		return node;
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-impl/src/main/java/net/sf/taverna/t2/servicedescriptions/impl/ServiceDescriptionXMLConstants.java
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-impl/src/main/java/net/sf/taverna/t2/servicedescriptions/impl/ServiceDescriptionXMLConstants.java b/taverna-activity-palette-impl/src/main/java/net/sf/taverna/t2/servicedescriptions/impl/ServiceDescriptionXMLConstants.java
deleted file mode 100644
index ee180a7..0000000
--- a/taverna-activity-palette-impl/src/main/java/net/sf/taverna/t2/servicedescriptions/impl/ServiceDescriptionXMLConstants.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package net.sf.taverna.t2.servicedescriptions.impl;
-
-import org.jdom.Namespace;
-
-public interface ServiceDescriptionXMLConstants {
-
-	public static final Namespace SERVICE_DESCRIPTION_NS = Namespace
-			.getNamespace("http://taverna.sf.net/2009/xml/servicedescription");
-	public static final String PROVIDER = "provider";
-	public static final String PROVIDERS = "providers";
-	public static final String SERVICE_DESCRIPTIONS = "serviceDescriptions";
-	public static final String IGNORED_PROVIDERS = "ignoredProviders";
-	public static final String PROVIDER_IDENTIFIER = "providerId";
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-impl/src/main/java/net/sf/taverna/t2/servicedescriptions/impl/ServiceDescriptionsConfigurationImpl.java
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-impl/src/main/java/net/sf/taverna/t2/servicedescriptions/impl/ServiceDescriptionsConfigurationImpl.java b/taverna-activity-palette-impl/src/main/java/net/sf/taverna/t2/servicedescriptions/impl/ServiceDescriptionsConfigurationImpl.java
deleted file mode 100644
index ef0295c..0000000
--- a/taverna-activity-palette-impl/src/main/java/net/sf/taverna/t2/servicedescriptions/impl/ServiceDescriptionsConfigurationImpl.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*******************************************************************************
- * 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.servicedescriptions.impl;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionsConfiguration;
-
-import uk.org.taverna.configuration.AbstractConfigurable;
-import uk.org.taverna.configuration.ConfigurationManager;
-
-public class ServiceDescriptionsConfigurationImpl extends AbstractConfigurable
-		implements ServiceDescriptionsConfiguration {
-	private static final String INCLUDE_DEFAULTS = "includeDefaults";
-	private static final String SERVICE_PALETTE = "Service providers";
-	private static final String SERVICE_PALETTE_PREFIX = "ServiceProviders";
-	private static final String CATEGORY = "Services";
-	private static final String UUID = "f0d1ef24-9337-412f-b2c3-220a01e2efd0";
-	private static final String REMOVE_PERMANENTLY = "removePermanently";
-
-	public ServiceDescriptionsConfigurationImpl(
-			ConfigurationManager configurationManager) {
-		super(configurationManager);
-	}
-
-	@Override
-	public String getCategory() {
-		return CATEGORY;
-	}
-
-	@Override
-	public Map<String, String> getDefaultPropertyMap() {
-		Map<String, String> defaults = new HashMap<String, String>();
-		defaults.put(INCLUDE_DEFAULTS, "true");
-		defaults.put(REMOVE_PERMANENTLY, "true");
-		return defaults;
-	}
-
-	@Override
-	public String getDisplayName() {
-		return SERVICE_PALETTE;
-	}
-
-	@Override
-	public String getFilePrefix() {
-		return SERVICE_PALETTE_PREFIX;
-	}
-
-	@Override
-	public String getUUID() {
-		return UUID;
-	}
-
-	@Override
-	public boolean isIncludeDefaults() {
-		return Boolean.parseBoolean(getProperty(INCLUDE_DEFAULTS));
-	}
-
-	@Override
-	public void setIncludeDefaults(boolean includeDefaults) {
-		setProperty(INCLUDE_DEFAULTS, Boolean.toString(includeDefaults));
-	}
-
-	@Override
-	public boolean isRemovePermanently() {
-		return Boolean.parseBoolean(getProperty(REMOVE_PERMANENTLY));
-	}
-
-	@Override
-	public void setRemovePermanently(boolean removePermanently) {
-		setProperty(REMOVE_PERMANENTLY, Boolean.toString(removePermanently));
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-impl/src/main/java/net/sf/taverna/t2/workbench/ui/activitypalette/ActivityPaletteConfiguration.java
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-impl/src/main/java/net/sf/taverna/t2/workbench/ui/activitypalette/ActivityPaletteConfiguration.java b/taverna-activity-palette-impl/src/main/java/net/sf/taverna/t2/workbench/ui/activitypalette/ActivityPaletteConfiguration.java
deleted file mode 100644
index 46f82c4..0000000
--- a/taverna-activity-palette-impl/src/main/java/net/sf/taverna/t2/workbench/ui/activitypalette/ActivityPaletteConfiguration.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*******************************************************************************
- * 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.activitypalette;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import uk.org.taverna.configuration.AbstractConfigurable;
-import uk.org.taverna.configuration.ConfigurationManager;
-
-public class ActivityPaletteConfiguration extends AbstractConfigurable {
-	private Map<String,String> defaultPropertyMap;
-
-	public ActivityPaletteConfiguration(ConfigurationManager configurationManager) {
-		super(configurationManager);
-	}
-
-	@Override
-	public String getCategory() {
-		return "Services";
-	}
-
-	@Override
-	public Map<String, String> getDefaultPropertyMap() {
-		if (defaultPropertyMap == null) {
-			defaultPropertyMap = new HashMap<>();
-
-			// //wsdl
-			//defaultPropertyMap.put("taverna.defaultwsdl", "http://www.ebi.ac.uk/xembl/XEMBL.wsdl,"+
-			//                    "http://soap.genome.jp/KEGG.wsdl,"+
-			//                    "http://eutils.ncbi.nlm.nih.gov/entrez/eutils/soap/eutils.wsdl,"+
-			//                    "http://soap.bind.ca/wsdl/bind.wsdl,"+
-			//                    "http://www.ebi.ac.uk/ws/services/urn:Dbfetch?wsdl");
-
-			// //soaplab
-			//defaultPropertyMap.put("taverna.defaultsoaplab", "http://www.ebi.ac.uk/soaplab/services/");
-
-			// //biomart
-			//defaultPropertyMap.put("taverna.defaultmartregistry","http://www.biomart.org/biomart");
-
-			//add property names
-			//defaultPropertyMap.put("name.taverna.defaultwsdl", "WSDL");
-			//defaultPropertyMap.put("name.taverna.defaultsoaplab","Soaplab");
-			//defaultPropertyMap.put("name.taverna.defaultmartregistry", "Biomart");
-		}
-		return defaultPropertyMap;
-	}
-
-	@Override
-	public String getDisplayName() {
-		return "Activity Palette";
-	}
-
-	@Override
-	public String getFilePrefix() {
-		return "ActivityPalette";
-	}
-
-	@Override
-	public String getUUID() {
-		return "ad9f3a60-5967-11dd-ae16-0800200c9a66";
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-impl/src/main/java/net/sf/taverna/t2/workbench/ui/activitypalette/ActivityPaletteConfigurationPanel.java
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-impl/src/main/java/net/sf/taverna/t2/workbench/ui/activitypalette/ActivityPaletteConfigurationPanel.java b/taverna-activity-palette-impl/src/main/java/net/sf/taverna/t2/workbench/ui/activitypalette/ActivityPaletteConfigurationPanel.java
deleted file mode 100644
index 6166e60..0000000
--- a/taverna-activity-palette-impl/src/main/java/net/sf/taverna/t2/workbench/ui/activitypalette/ActivityPaletteConfigurationPanel.java
+++ /dev/null
@@ -1,284 +0,0 @@
-/*******************************************************************************
- * 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.activitypalette;
-
-import static java.awt.BorderLayout.CENTER;
-import static java.awt.BorderLayout.EAST;
-import static java.awt.BorderLayout.NORTH;
-import static java.awt.BorderLayout.SOUTH;
-import static java.awt.FlowLayout.LEFT;
-import static java.awt.FlowLayout.RIGHT;
-import static javax.swing.BoxLayout.Y_AXIS;
-import static javax.swing.JOptionPane.INFORMATION_MESSAGE;
-import static javax.swing.JOptionPane.WARNING_MESSAGE;
-import static javax.swing.JOptionPane.YES_NO_OPTION;
-import static javax.swing.JOptionPane.YES_OPTION;
-import static javax.swing.JOptionPane.showConfirmDialog;
-import static javax.swing.JOptionPane.showInputDialog;
-import static javax.swing.border.BevelBorder.LOWERED;
-
-import java.awt.BorderLayout;
-import java.awt.Component;
-import java.awt.FlowLayout;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.swing.BoxLayout;
-import javax.swing.DefaultComboBoxModel;
-import javax.swing.DefaultListCellRenderer;
-import javax.swing.DefaultListModel;
-import javax.swing.JButton;
-import javax.swing.JComboBox;
-import javax.swing.JLabel;
-import javax.swing.JList;
-import javax.swing.JPanel;
-import javax.swing.border.BevelBorder;
-
-import org.apache.log4j.Logger;
-
-@SuppressWarnings("serial")
-public class ActivityPaletteConfigurationPanel extends JPanel {
-	private static Logger logger = Logger
-			.getLogger(ActivityPaletteConfigurationPanel.class);
-
-	private Map<String,List<String>> values = new HashMap<>();
-	private Map<String,String> names = new HashMap<>();
-	private DefaultComboBoxModel<String> model;
-	private DefaultListModel<String> listModel;
-	private JList<String> propertyListItems;
-	private String selectedKey;
-	private JButton deleteTypeButton;
-	private final ActivityPaletteConfiguration config;
-
-	public ActivityPaletteConfigurationPanel(ActivityPaletteConfiguration config) {
-		super(new BorderLayout());
-		this.config = config;
-
-		model = new DefaultComboBoxModel<>();
-		for (String key : config.getInternalPropertyMap().keySet()) {
-			if (key.startsWith("taverna.")
-					&& config.getPropertyStringList(key) != null) {
-				model.addElement(key);
-				values.put(key,
-						new ArrayList<>(config.getPropertyStringList(key)));
-			}
-			if (key.startsWith("name.taverna."))
-				names.put(key, config.getProperty(key).toString());
-		}
-		deleteTypeButton = new JButton("Delete");
-
-		final JButton addTypeButton = new JButton("Add");
-		final JComboBox<String> comboBox = new JComboBox<>(model);
-		comboBox.setRenderer(new DefaultListCellRenderer() {
-			@Override
-			public Component getListCellRendererComponent(JList<?> list,
-					Object value, int index, boolean isSelected,
-					boolean cellHasFocus) {
-				if (value != null && value instanceof String) {
-					String name = names.get("name." + value);
-					if (name != null)
-						value = name;
-				}
-				return super.getListCellRendererComponent(list, value, index,
-						isSelected, cellHasFocus);
-			}
-		});
-
-		deleteTypeButton.addActionListener(new ActionListener() {
-			@Override
-			public void actionPerformed(ActionEvent e) {
-				String displayText = names.get("name." + selectedKey);
-				if (displayText == null)
-					displayText = selectedKey;
-				if (confirm("Confirm removal",
-						"Are you sure you wish to remove the type "
-								+ displayText + "?")) {
-					names.remove("name." + selectedKey);
-					values.remove(selectedKey);
-					model.removeElement(selectedKey);
-					comboBox.setSelectedIndex(0);
-				}
-			}
-		});
-
-		addTypeButton.addActionListener(new ActionListener() {
-			@Override
-			public void actionPerformed(ActionEvent e) {
-				String key = input("New key", "Provide the new key.");
-				if (key == null)
-					return;
-				String name = input("Name for the key",
-						"Provide the name for the key: " + key);
-				if (name == null)
-					return;
-
-				values.put(key, new ArrayList<String>());
-				names.put("name." + key, name);
-				model.addElement(key);
-				comboBox.setSelectedItem(key);
-			}
-		});
-
-		comboBox.addActionListener(new ActionListener() {
-			@Override
-			public void actionPerformed(ActionEvent e) {
-				if (comboBox.getSelectedItem() != null
-						&& comboBox.getSelectedItem() instanceof String) {
-					selectedKey = (String) comboBox.getSelectedItem();
-					List<String> selectedList = values.get(selectedKey);
-					populateList(selectedList);
-					deleteTypeButton.setEnabled(selectedList.size() == 0);
-				}
-			}
-		});
-
-		JPanel propertySelectionPanel = new JPanel(new FlowLayout(LEFT));
-		propertySelectionPanel.add(new JLabel("Activity type:"));
-		propertySelectionPanel.add(comboBox);
-		propertySelectionPanel.add(addTypeButton);
-		propertySelectionPanel.add(deleteTypeButton);
-		add(propertySelectionPanel, NORTH);
-
-		JPanel listPanel = new JPanel(new BorderLayout());
-		listModel = new DefaultListModel<>();
-		propertyListItems = new JList<>(listModel);
-		propertyListItems.setBorder(new BevelBorder(LOWERED));
-
-		listPanel.add(propertyListItems, CENTER);
-		listPanel.add(listButtons(), EAST);
-
-		add(listPanel, CENTER);
-
-		add(applyButtonPanel(), SOUTH);
-
-		if (model.getSize() > 0)
-			comboBox.setSelectedItem(model.getElementAt(0));
-	}
-
-	private void populateList(List<String> selectedList) {
-		listModel.removeAllElements();
-		for (String item : selectedList)
-			listModel.addElement(item);
-	}
-
-	private JPanel applyButtonPanel() {
-		JPanel applyPanel = new JPanel(new FlowLayout(RIGHT));
-		JButton applyButton = new JButton("Apply");
-
-		applyButton.addActionListener(new ActionListener() {
-			@Override
-			public void actionPerformed(ActionEvent e) {
-				config.getInternalPropertyMap().clear();
-				for (String key : values.keySet()) {
-					List<String> properties = values.get(key);
-					config.setPropertyStringList(key, new ArrayList<>(
-							properties));
-				}
-				for (String key : names.keySet())
-					config.setProperty(key, names.get(key));
-				store();
-			}
-		});
-
-		applyPanel.add(applyButton);
-		return applyPanel;
-	}
-
-	private void store() {
-		try {
-			//FIXME
-			//ConfigurationManager.getInstance().store(config);
-		} catch (Exception e1) {
-			logger.error("There was an error storing the configuration:"
-					+ config.getFilePrefix() + " (UUID=" + config.getUUID()
-					+ ")", e1);
-		}
-	}
-
-	private JPanel listButtons() {
-		JPanel panel = new JPanel();
-		panel.setLayout(new BoxLayout(panel, Y_AXIS));
-		JButton addButton = new JButton("+");
-		addButton.addActionListener(new ActionListener() {
-			@Override
-			public void actionPerformed(ActionEvent e) {
-				String value = input("New property", "Provide new value for: "
-						+ selectedKey);
-				if (value != null) {
-					listModel.addElement(value);
-					values.get(selectedKey).add(value);
-					deleteTypeButton.setEnabled(false);
-				}
-			}
-		});
-
-		JButton deleteButton = new JButton("-");
-		deleteButton.addActionListener(new ActionListener() {
-			@Override
-			public void actionPerformed(ActionEvent e) {
-				Object value = propertyListItems.getSelectedValue();
-				if (confirm("Confirm removal",
-						"Are you sure you wish to remove " + value + "?")) {
-					listModel.removeElement(value);
-					values.get(selectedKey).remove(value);
-					if (values.get(selectedKey).size() == 0)
-						deleteTypeButton.setEnabled(true);
-				}
-			}
-		});
-
-		panel.add(addButton);
-		panel.add(deleteButton);
-
-		return panel;
-	}
-
-	private boolean confirm(String title, String message) {
-		return showConfirmDialog(this, message, title, YES_NO_OPTION,
-				WARNING_MESSAGE) == YES_OPTION;
-	}
-
-	private String input(String title, String message) {
-		return showInputDialog(this, message, title, INFORMATION_MESSAGE);
-	}
-
-/*	private JButton getAddTypeButton() {
-		JButton result = new JButton("Add");
-		result.addActionListener(new ActionListener() {
-			public void actionPerformed(ActionEvent e) {
-				String val = input("New property value","New property value");
-				if (val!=null) {
-					if (values.get(val) == null) {
-						model.addElement(val);
-						values.put(val, new ArrayList<String>());
-					} else
-						showMessageDialog(ActivityPaletteConfigurationPanel.this, "This property already exists");
-				}
-			}
-		});
-		return result;
-	}
-*/
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-impl/src/main/java/net/sf/taverna/t2/workbench/ui/activitypalette/ActivityPaletteConfigurationUIFactory.java
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-impl/src/main/java/net/sf/taverna/t2/workbench/ui/activitypalette/ActivityPaletteConfigurationUIFactory.java b/taverna-activity-palette-impl/src/main/java/net/sf/taverna/t2/workbench/ui/activitypalette/ActivityPaletteConfigurationUIFactory.java
deleted file mode 100644
index 39c4a5a..0000000
--- a/taverna-activity-palette-impl/src/main/java/net/sf/taverna/t2/workbench/ui/activitypalette/ActivityPaletteConfigurationUIFactory.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*******************************************************************************
- * 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.activitypalette;
-
-import javax.swing.JPanel;
-
-import uk.org.taverna.configuration.Configurable;
-import uk.org.taverna.configuration.ConfigurationUIFactory;
-
-public class ActivityPaletteConfigurationUIFactory implements
-		ConfigurationUIFactory {
-	private ActivityPaletteConfiguration activityPaletteConfiguration;
-
-	@Override
-	public boolean canHandle(String uuid) {
-		return uuid != null && uuid.equals(getConfigurable().getUUID());
-	}
-
-	@Override
-	public Configurable getConfigurable() {
-		return activityPaletteConfiguration;
-	}
-
-	@Override
-	public JPanel getConfigurationPanel() {
-		return new ActivityPaletteConfigurationPanel(
-				activityPaletteConfiguration);
-	}
-
-	public void setActivityPaletteConfiguration(
-			ActivityPaletteConfiguration activityPaletteConfiguration) {
-		this.activityPaletteConfiguration = activityPaletteConfiguration;
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-impl/src/main/java/org/apache/taverna/servicedescriptions/impl/ServiceDescriptionConstants.java
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-impl/src/main/java/org/apache/taverna/servicedescriptions/impl/ServiceDescriptionConstants.java b/taverna-activity-palette-impl/src/main/java/org/apache/taverna/servicedescriptions/impl/ServiceDescriptionConstants.java
new file mode 100644
index 0000000..8331c88
--- /dev/null
+++ b/taverna-activity-palette-impl/src/main/java/org/apache/taverna/servicedescriptions/impl/ServiceDescriptionConstants.java
@@ -0,0 +1,10 @@
+package org.apache.taverna.servicedescriptions.impl;
+
+public interface ServiceDescriptionConstants {
+	String SERVICE_PANEL_CONFIGURATION = "servicePanelConfiguration";
+	String PROVIDERS = "providers";
+	String IGNORED = "ignored";
+	String PROVIDER_ID = "providerID";
+	String CONFIGURATION = "configuration";
+	String TYPE = "type";
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-impl/src/main/java/org/apache/taverna/servicedescriptions/impl/ServiceDescriptionDeserializer.java
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-impl/src/main/java/org/apache/taverna/servicedescriptions/impl/ServiceDescriptionDeserializer.java b/taverna-activity-palette-impl/src/main/java/org/apache/taverna/servicedescriptions/impl/ServiceDescriptionDeserializer.java
new file mode 100644
index 0000000..546a278
--- /dev/null
+++ b/taverna-activity-palette-impl/src/main/java/org/apache/taverna/servicedescriptions/impl/ServiceDescriptionDeserializer.java
@@ -0,0 +1,167 @@
+package org.apache.taverna.servicedescriptions.impl;
+
+import static org.apache.taverna.servicedescriptions.impl.ServiceDescriptionConstants.CONFIGURATION;
+import static org.apache.taverna.servicedescriptions.impl.ServiceDescriptionConstants.IGNORED;
+import static org.apache.taverna.servicedescriptions.impl.ServiceDescriptionConstants.PROVIDERS;
+import static org.apache.taverna.servicedescriptions.impl.ServiceDescriptionConstants.PROVIDER_ID;
+import static org.apache.taverna.servicedescriptions.impl.ServiceDescriptionConstants.TYPE;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URI;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.apache.taverna.scufl2.api.configurations.Configuration;
+import org.apache.taverna.servicedescriptions.ConfigurableServiceProvider;
+import org.apache.taverna.servicedescriptions.ServiceDescriptionProvider;
+import org.apache.taverna.servicedescriptions.ServiceDescriptionRegistry;
+
+import com.fasterxml.jackson.core.JsonFactory;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ArrayNode;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+
+class ServiceDescriptionDeserializer {
+	private List<ServiceDescriptionProvider> serviceDescriptionProviders;
+
+	ServiceDescriptionDeserializer(
+			List<ServiceDescriptionProvider> serviceDescriptionProviders) {
+		this.serviceDescriptionProviders = serviceDescriptionProviders;
+	}
+
+	public void deserialize(ServiceDescriptionRegistry registry,
+			File serviceDescriptionsFile) throws DeserializationException {
+		try (FileInputStream serviceDescriptionFileStream = new FileInputStream(
+				serviceDescriptionsFile)) {
+			deserialize(registry, serviceDescriptionFileStream);
+		} catch (FileNotFoundException ex) {
+			throw new DeserializationException("Could not locate file "
+					+ serviceDescriptionsFile.getAbsolutePath()
+					+ " containing service descriptions.");
+		} catch (IOException ex) {
+			throw new DeserializationException(
+					"Could not read stream containing service descriptions from "
+							+ serviceDescriptionsFile.getAbsolutePath(), ex);
+		}
+	}
+
+	public void deserialize(ServiceDescriptionRegistry registry,
+			URL serviceDescriptionsURL) throws DeserializationException {
+		try (InputStream serviceDescriptionInputStream = serviceDescriptionsURL
+				.openStream()) {
+			deserialize(registry, serviceDescriptionInputStream);
+		} catch (FileNotFoundException ex) {
+			throw new DeserializationException("Could not open URL "
+					+ serviceDescriptionsURL
+					+ " containing service descriptions.");
+		} catch (IOException ex) {
+			throw new DeserializationException(
+					"Could not read stream containing service descriptions from "
+							+ serviceDescriptionsURL, ex);
+		}
+	}
+
+	private static final JsonFactory factory = new JsonFactory();
+
+	private void deserialize(ServiceDescriptionRegistry registry,
+			InputStream serviceDescriptionsInputStream) throws IOException,
+			DeserializationException {
+		ObjectNode node = (ObjectNode) new ObjectMapper(factory)
+				.readTree(serviceDescriptionsInputStream);
+		List<ServiceDescriptionProvider> providers = deserializeProviders(node,
+				true);
+		for (ServiceDescriptionProvider provider : providers)
+			registry.addServiceDescriptionProvider(provider);
+	}
+
+	public Collection<? extends ServiceDescriptionProvider> deserializeDefaults(
+			ServiceDescriptionRegistry registry,
+			File defaultConfigurableServiceProvidersFile)
+			throws DeserializationException {
+		ObjectNode node;
+		try (FileInputStream serviceDescriptionStream = new FileInputStream(
+				defaultConfigurableServiceProvidersFile)) {
+			node = (ObjectNode) new ObjectMapper(factory)
+					.readTree(serviceDescriptionStream);
+		} catch (IOException e) {
+			throw new DeserializationException("Can't read "
+					+ defaultConfigurableServiceProvidersFile);
+		}
+		return deserializeProviders(node, false);
+	}
+
+	private List<ServiceDescriptionProvider> deserializeProviders(
+			ObjectNode rootNode, boolean obeyIgnored)
+			throws DeserializationException {
+		List<ServiceDescriptionProvider> providers = new ArrayList<>();
+
+		ArrayNode providersNode = (ArrayNode) rootNode.get(PROVIDERS);
+		if (providersNode != null)
+			for (JsonNode provider : providersNode)
+				providers.add(deserializeProvider((ObjectNode) provider));
+
+		if (obeyIgnored) {
+			ArrayNode ignoredNode = (ArrayNode) rootNode.get(IGNORED);
+			if (ignoredNode != null)
+				for (JsonNode provider : ignoredNode)
+					providers
+							.remove(deserializeProvider((ObjectNode) provider));
+		}
+
+		return providers;
+	}
+
+	private ServiceDescriptionProvider deserializeProvider(
+			ObjectNode providerNode) throws DeserializationException {
+		String providerId = providerNode.get(PROVIDER_ID).asText().trim();
+		ServiceDescriptionProvider provider = null;
+		for (ServiceDescriptionProvider serviceProvider : serviceDescriptionProviders)
+			if (serviceProvider.getId().equals(providerId)) {
+				provider = serviceProvider;
+				break;
+			}
+		if (provider == null)
+			throw new DeserializationException(
+					"Could not find provider with id " + providerId);
+
+		/*
+		 * So we know the service provider now, but we need a separate instance
+		 * of that provider for each providerElem. E.g. we can have 2 or more
+		 * WSDL provider elements and need to return a separate provider
+		 * instance for each as they will have different configurations.
+		 */
+		ServiceDescriptionProvider instance = provider.newInstance();
+
+		if (instance instanceof ConfigurableServiceProvider)
+			try {
+				Configuration config = new Configuration();
+				config.setType(URI.create(providerNode.get(TYPE).textValue()));
+				config.setJson(providerNode.get(CONFIGURATION));
+				if (config != null)
+					((ConfigurableServiceProvider) instance).configure(config);
+			} catch (Exception e) {
+				throw new DeserializationException(
+						"Could not configure provider " + providerId
+								+ " using bean " + providerNode, e);
+			}
+		return instance;
+	}
+
+	@SuppressWarnings("serial")
+	static class DeserializationException extends Exception {
+		public DeserializationException(String string) {
+			super(string);
+		}
+
+		public DeserializationException(String string, Exception ex) {
+			super(string, ex);
+		}
+	}
+}


[50/51] [partial] incubator-taverna-workbench git commit: all packages are moved to org.apache.taverna.*

Posted by re...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-icons-api/src/main/java/net/sf/taverna/t2/workbench/activityicons/ActivityIconManager.java
----------------------------------------------------------------------
diff --git a/taverna-activity-icons-api/src/main/java/net/sf/taverna/t2/workbench/activityicons/ActivityIconManager.java b/taverna-activity-icons-api/src/main/java/net/sf/taverna/t2/workbench/activityicons/ActivityIconManager.java
deleted file mode 100644
index c92c4e8..0000000
--- a/taverna-activity-icons-api/src/main/java/net/sf/taverna/t2/workbench/activityicons/ActivityIconManager.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2011 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.activityicons;
-
-import java.net.URI;
-
-import javax.swing.Icon;
-
-import org.apache.taverna.scufl2.api.activity.Activity;
-
-/**
- * Manager for activities' icons.
- * 
- * @author David Withers
- */
-public interface ActivityIconManager {
-	/** Returns an icon for the Activity. */
-	Icon iconForActivity(URI activityType);
-
-	Icon iconForActivity(Activity activity);
-
-	void resetIcon(URI activityType);
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-icons-api/src/main/java/net/sf/taverna/t2/workbench/activityicons/ActivityIconSPI.java
----------------------------------------------------------------------
diff --git a/taverna-activity-icons-api/src/main/java/net/sf/taverna/t2/workbench/activityicons/ActivityIconSPI.java b/taverna-activity-icons-api/src/main/java/net/sf/taverna/t2/workbench/activityicons/ActivityIconSPI.java
deleted file mode 100644
index 7270dfc..0000000
--- a/taverna-activity-icons-api/src/main/java/net/sf/taverna/t2/workbench/activityicons/ActivityIconSPI.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * 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.activityicons;
-
-import java.net.URI;
-
-import javax.swing.Icon;
-
-/**
- * Defines an interface for getting an icon for an Activity.
- * 
- * @author Alex Nenadic
- */
-public interface ActivityIconSPI {
-	/**
-	 * A return value for {@link canProvideIconScore()} indicating an SPI cannot
-	 * provide an icon for a given activity.
-	 */
-	int NO_ICON = 0;
-
-	/**
-	 * {@link DefaultActivityIcon} returns this value that will be used when an
-	 * activity that has no other SPI providing an icon for. Any SPI shour
-	 * return value of at least DEFAULT_ICON + 1 if they want to 'override' the
-	 * default icon.
-	 */
-	int DEFAULT_ICON = 10;
-
-	/**
-	 * Returns a positive number if the class can provide an icon for the given
-	 * activity or {@link NO_ICON} otherwise. Out of two SPIs capable of
-	 * providing an icon for the same activity, the one returning a higher score
-	 * will be used.
-	 */
-	int canProvideIconScore(URI activityType);
-
-	/** Returns an icon for the Activity. */
-	Icon getIcon(URI activityType);
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-icons-api/src/main/java/net/sf/taverna/t2/workbench/activityicons/DefaultActivityIcon.java
----------------------------------------------------------------------
diff --git a/taverna-activity-icons-api/src/main/java/net/sf/taverna/t2/workbench/activityicons/DefaultActivityIcon.java b/taverna-activity-icons-api/src/main/java/net/sf/taverna/t2/workbench/activityicons/DefaultActivityIcon.java
deleted file mode 100644
index c474e69..0000000
--- a/taverna-activity-icons-api/src/main/java/net/sf/taverna/t2/workbench/activityicons/DefaultActivityIcon.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * 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.activityicons;
-
-import java.net.URI;
-
-import javax.swing.Icon;
-import javax.swing.ImageIcon;
-
-public class DefaultActivityIcon implements ActivityIconSPI {
-	private static final String ICON_RESOURCE = "/default-activity-icon.png";
-
-	@Override
-	public int canProvideIconScore(URI activityType) {
-		// For any activity we can provide a default icon
-		return DEFAULT_ICON;
-	}
-
-	@Override
-	public Icon getIcon(URI activityType) {
-		return getDefaultIcon();
-	}
-	
-	public static Icon getDefaultIcon() {
-		return IconLoader.icon;
-	}
-
-	private static class IconLoader {
-		static final Icon icon = loadDefaultIcon();
-
-		private static Icon loadDefaultIcon() {
-			return new ImageIcon(
-					DefaultActivityIcon.class.getResource(ICON_RESOURCE));
-		}
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-icons-api/src/main/java/net/sf/taverna/t2/workbench/activityicons/impl/ActivityIconManagerImpl.java
----------------------------------------------------------------------
diff --git a/taverna-activity-icons-api/src/main/java/net/sf/taverna/t2/workbench/activityicons/impl/ActivityIconManagerImpl.java b/taverna-activity-icons-api/src/main/java/net/sf/taverna/t2/workbench/activityicons/impl/ActivityIconManagerImpl.java
deleted file mode 100644
index 762de69..0000000
--- a/taverna-activity-icons-api/src/main/java/net/sf/taverna/t2/workbench/activityicons/impl/ActivityIconManagerImpl.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*******************************************************************************
- * 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.activityicons.impl;
-
-import static net.sf.taverna.t2.workbench.activityicons.ActivityIconSPI.NO_ICON;
-
-import java.net.URI;
-import java.util.List;
-import java.util.WeakHashMap;
-
-import javax.swing.Icon;
-
-import org.apache.taverna.scufl2.api.activity.Activity;
-import net.sf.taverna.t2.workbench.activityicons.ActivityIconManager;
-import net.sf.taverna.t2.workbench.activityicons.ActivityIconSPI;
-
-/**
- * Manager for activities' icons.
- *
- * @author Alex Nenadic
- * @author Alan R Williams
- */
-public class ActivityIconManagerImpl implements ActivityIconManager {
-	/** Cache of already obtained icons; maps activities to their icons*/
-	private WeakHashMap<URI, Icon> iconsMap = new WeakHashMap<>();
-
-	private List<ActivityIconSPI> activityIcons;
-
-	/** Returns an icon for the Activity. */
-	@Override
-	public Icon iconForActivity(URI activityType) {
-		Icon icon = iconsMap.get(activityType);
-		if (icon != null)
-			return icon;
-		int bestScore = NO_ICON;
-		ActivityIconSPI bestSPI = null;
-		for (ActivityIconSPI spi : activityIcons) {
-			int spiScore = spi.canProvideIconScore(activityType);
-			if (spiScore > bestScore) {
-				bestSPI = spi;
-				bestScore = spiScore;
-			}
-		}
-		if (bestSPI == null)
-			return null;
-		icon = bestSPI.getIcon(activityType);
-		iconsMap.put(activityType, icon);
-		return icon;
-	}
-
-	@Override
-	public Icon iconForActivity(Activity activity) {
-		return iconForActivity(activity.getType());
-	}
-
-	@Override
-	public void resetIcon(URI activityType) {
-		Icon icon = iconsMap.get(activityType);
-		if (icon != null)
-			iconsMap.remove(activityType);
-		iconForActivity(activityType);
-	}
-
-	public void setActivityIcons(List<ActivityIconSPI> activityIcons) {
-		this.activityIcons = activityIcons;
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-icons-api/src/main/java/org/apache/taverna/workbench/activityicons/ActivityIconManager.java
----------------------------------------------------------------------
diff --git a/taverna-activity-icons-api/src/main/java/org/apache/taverna/workbench/activityicons/ActivityIconManager.java b/taverna-activity-icons-api/src/main/java/org/apache/taverna/workbench/activityicons/ActivityIconManager.java
new file mode 100644
index 0000000..9a80fd3
--- /dev/null
+++ b/taverna-activity-icons-api/src/main/java/org/apache/taverna/workbench/activityicons/ActivityIconManager.java
@@ -0,0 +1,40 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.activityicons;
+
+import java.net.URI;
+
+import javax.swing.Icon;
+
+import org.apache.taverna.scufl2.api.activity.Activity;
+
+/**
+ * Manager for activities' icons.
+ * 
+ * @author David Withers
+ */
+public interface ActivityIconManager {
+	/** Returns an icon for the Activity. */
+	Icon iconForActivity(URI activityType);
+
+	Icon iconForActivity(Activity activity);
+
+	void resetIcon(URI activityType);
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-icons-api/src/main/java/org/apache/taverna/workbench/activityicons/ActivityIconSPI.java
----------------------------------------------------------------------
diff --git a/taverna-activity-icons-api/src/main/java/org/apache/taverna/workbench/activityicons/ActivityIconSPI.java b/taverna-activity-icons-api/src/main/java/org/apache/taverna/workbench/activityicons/ActivityIconSPI.java
new file mode 100644
index 0000000..59c6da0
--- /dev/null
+++ b/taverna-activity-icons-api/src/main/java/org/apache/taverna/workbench/activityicons/ActivityIconSPI.java
@@ -0,0 +1,56 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.activityicons;
+
+import java.net.URI;
+
+import javax.swing.Icon;
+
+/**
+ * Defines an interface for getting an icon for an Activity.
+ * 
+ * @author Alex Nenadic
+ */
+public interface ActivityIconSPI {
+	/**
+	 * A return value for {@link canProvideIconScore()} indicating an SPI cannot
+	 * provide an icon for a given activity.
+	 */
+	int NO_ICON = 0;
+
+	/**
+	 * {@link DefaultActivityIcon} returns this value that will be used when an
+	 * activity that has no other SPI providing an icon for. Any SPI shour
+	 * return value of at least DEFAULT_ICON + 1 if they want to 'override' the
+	 * default icon.
+	 */
+	int DEFAULT_ICON = 10;
+
+	/**
+	 * Returns a positive number if the class can provide an icon for the given
+	 * activity or {@link NO_ICON} otherwise. Out of two SPIs capable of
+	 * providing an icon for the same activity, the one returning a higher score
+	 * will be used.
+	 */
+	int canProvideIconScore(URI activityType);
+
+	/** Returns an icon for the Activity. */
+	Icon getIcon(URI activityType);
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-icons-api/src/main/java/org/apache/taverna/workbench/activityicons/DefaultActivityIcon.java
----------------------------------------------------------------------
diff --git a/taverna-activity-icons-api/src/main/java/org/apache/taverna/workbench/activityicons/DefaultActivityIcon.java b/taverna-activity-icons-api/src/main/java/org/apache/taverna/workbench/activityicons/DefaultActivityIcon.java
new file mode 100644
index 0000000..f061ded
--- /dev/null
+++ b/taverna-activity-icons-api/src/main/java/org/apache/taverna/workbench/activityicons/DefaultActivityIcon.java
@@ -0,0 +1,53 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.activityicons;
+
+import java.net.URI;
+
+import javax.swing.Icon;
+import javax.swing.ImageIcon;
+
+public class DefaultActivityIcon implements ActivityIconSPI {
+	private static final String ICON_RESOURCE = "/default-activity-icon.png";
+
+	@Override
+	public int canProvideIconScore(URI activityType) {
+		// For any activity we can provide a default icon
+		return DEFAULT_ICON;
+	}
+
+	@Override
+	public Icon getIcon(URI activityType) {
+		return getDefaultIcon();
+	}
+	
+	public static Icon getDefaultIcon() {
+		return IconLoader.icon;
+	}
+
+	private static class IconLoader {
+		static final Icon icon = loadDefaultIcon();
+
+		private static Icon loadDefaultIcon() {
+			return new ImageIcon(
+					DefaultActivityIcon.class.getResource(ICON_RESOURCE));
+		}
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-icons-api/src/main/java/org/apache/taverna/workbench/activityicons/impl/ActivityIconManagerImpl.java
----------------------------------------------------------------------
diff --git a/taverna-activity-icons-api/src/main/java/org/apache/taverna/workbench/activityicons/impl/ActivityIconManagerImpl.java b/taverna-activity-icons-api/src/main/java/org/apache/taverna/workbench/activityicons/impl/ActivityIconManagerImpl.java
new file mode 100644
index 0000000..61dd6e4
--- /dev/null
+++ b/taverna-activity-icons-api/src/main/java/org/apache/taverna/workbench/activityicons/impl/ActivityIconManagerImpl.java
@@ -0,0 +1,84 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.activityicons.impl;
+
+import static org.apache.taverna.workbench.activityicons.ActivityIconSPI.NO_ICON;
+
+import java.net.URI;
+import java.util.List;
+import java.util.WeakHashMap;
+
+import javax.swing.Icon;
+
+import org.apache.taverna.scufl2.api.activity.Activity;
+import org.apache.taverna.workbench.activityicons.ActivityIconManager;
+import org.apache.taverna.workbench.activityicons.ActivityIconSPI;
+
+/**
+ * Manager for activities' icons.
+ *
+ * @author Alex Nenadic
+ * @author Alan R Williams
+ */
+public class ActivityIconManagerImpl implements ActivityIconManager {
+	/** Cache of already obtained icons; maps activities to their icons*/
+	private WeakHashMap<URI, Icon> iconsMap = new WeakHashMap<>();
+
+	private List<ActivityIconSPI> activityIcons;
+
+	/** Returns an icon for the Activity. */
+	@Override
+	public Icon iconForActivity(URI activityType) {
+		Icon icon = iconsMap.get(activityType);
+		if (icon != null)
+			return icon;
+		int bestScore = NO_ICON;
+		ActivityIconSPI bestSPI = null;
+		for (ActivityIconSPI spi : activityIcons) {
+			int spiScore = spi.canProvideIconScore(activityType);
+			if (spiScore > bestScore) {
+				bestSPI = spi;
+				bestScore = spiScore;
+			}
+		}
+		if (bestSPI == null)
+			return null;
+		icon = bestSPI.getIcon(activityType);
+		iconsMap.put(activityType, icon);
+		return icon;
+	}
+
+	@Override
+	public Icon iconForActivity(Activity activity) {
+		return iconForActivity(activity.getType());
+	}
+
+	@Override
+	public void resetIcon(URI activityType) {
+		Icon icon = iconsMap.get(activityType);
+		if (icon != null)
+			iconsMap.remove(activityType);
+		iconForActivity(activityType);
+	}
+
+	public void setActivityIcons(List<ActivityIconSPI> activityIcons) {
+		this.activityIcons = activityIcons;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-icons-api/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.activityicons.ActivityIconSPI
----------------------------------------------------------------------
diff --git a/taverna-activity-icons-api/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.activityicons.ActivityIconSPI b/taverna-activity-icons-api/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.activityicons.ActivityIconSPI
deleted file mode 100644
index d268c81..0000000
--- a/taverna-activity-icons-api/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.activityicons.ActivityIconSPI
+++ /dev/null
@@ -1 +0,0 @@
-net.sf.taverna.t2.workbench.activityicons.DefaultActivityIcon
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-icons-api/src/main/resources/META-INF/services/org.apache.taverna.workbench.activityicons.ActivityIconSPI
----------------------------------------------------------------------
diff --git a/taverna-activity-icons-api/src/main/resources/META-INF/services/org.apache.taverna.workbench.activityicons.ActivityIconSPI b/taverna-activity-icons-api/src/main/resources/META-INF/services/org.apache.taverna.workbench.activityicons.ActivityIconSPI
new file mode 100644
index 0000000..5510f07
--- /dev/null
+++ b/taverna-activity-icons-api/src/main/resources/META-INF/services/org.apache.taverna.workbench.activityicons.ActivityIconSPI
@@ -0,0 +1 @@
+org.apache.taverna.workbench.activityicons.DefaultActivityIcon
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-icons-api/src/main/resources/META-INF/spring/activity-icons-api-context-osgi.xml
----------------------------------------------------------------------
diff --git a/taverna-activity-icons-api/src/main/resources/META-INF/spring/activity-icons-api-context-osgi.xml b/taverna-activity-icons-api/src/main/resources/META-INF/spring/activity-icons-api-context-osgi.xml
index 5c67640..e0e24ef 100644
--- a/taverna-activity-icons-api/src/main/resources/META-INF/spring/activity-icons-api-context-osgi.xml
+++ b/taverna-activity-icons-api/src/main/resources/META-INF/spring/activity-icons-api-context-osgi.xml
@@ -6,10 +6,10 @@
                       http://www.springframework.org/schema/osgi
                       http://www.springframework.org/schema/osgi/spring-osgi.xsd">
 
-	<service ref="DefaultActivityIcon" interface="net.sf.taverna.t2.workbench.activityicons.ActivityIconSPI" />
+	<service ref="DefaultActivityIcon" interface="org.apache.taverna.workbench.activityicons.ActivityIconSPI" />
 
-	<service ref="ActivityIconManager" interface="net.sf.taverna.t2.workbench.activityicons.ActivityIconManager" />
+	<service ref="ActivityIconManager" interface="org.apache.taverna.workbench.activityicons.ActivityIconManager" />
 
-	<list id="activityIcons" interface="net.sf.taverna.t2.workbench.activityicons.ActivityIconSPI" cardinality="0..N" />
+	<list id="activityIcons" interface="org.apache.taverna.workbench.activityicons.ActivityIconSPI" cardinality="0..N" />
 
 </beans:beans>

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-icons-api/src/main/resources/META-INF/spring/activity-icons-api-context.xml
----------------------------------------------------------------------
diff --git a/taverna-activity-icons-api/src/main/resources/META-INF/spring/activity-icons-api-context.xml b/taverna-activity-icons-api/src/main/resources/META-INF/spring/activity-icons-api-context.xml
index 93c98c4..8ff584d 100644
--- a/taverna-activity-icons-api/src/main/resources/META-INF/spring/activity-icons-api-context.xml
+++ b/taverna-activity-icons-api/src/main/resources/META-INF/spring/activity-icons-api-context.xml
@@ -3,9 +3,9 @@
 	xsi:schemaLocation="http://www.springframework.org/schema/beans
                       http://www.springframework.org/schema/beans/spring-beans.xsd">
 
-	<bean id="DefaultActivityIcon" class="net.sf.taverna.t2.workbench.activityicons.DefaultActivityIcon" />
+	<bean id="DefaultActivityIcon" class="org.apache.taverna.workbench.activityicons.DefaultActivityIcon" />
 
-	<bean id="ActivityIconManager" class="net.sf.taverna.t2.workbench.activityicons.impl.ActivityIconManagerImpl">
+	<bean id="ActivityIconManager" class="org.apache.taverna.workbench.activityicons.impl.ActivityIconManagerImpl">
 		<property name="activityIcons" ref="activityIcons" />
 	</bean>
 

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/AbstractConfigurableServiceProvider.java
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/AbstractConfigurableServiceProvider.java b/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/AbstractConfigurableServiceProvider.java
deleted file mode 100644
index e3c4c54..0000000
--- a/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/AbstractConfigurableServiceProvider.java
+++ /dev/null
@@ -1,53 +0,0 @@
-package net.sf.taverna.t2.servicedescriptions;
-
-import org.apache.taverna.scufl2.api.configurations.Configuration;
-
-public abstract class AbstractConfigurableServiceProvider extends
-		IdentifiedObject implements ConfigurableServiceProvider {
-	protected Configuration serviceProviderConfig;
-
-	/**
-	 * Construct configurable service provider.
-	 * 
-	 * @param configTemplate
-	 *            Template configuration
-	 */
-	public AbstractConfigurableServiceProvider(Configuration configTemplate) {
-		if (configTemplate == null)
-			throw new NullPointerException("Default config can't be null");
-		serviceProviderConfig = configTemplate;
-	}
-
-	/**
-	 * Package access constructor - only used with {@link #clone()} - otherwise
-	 * use {@link #AbstractConfigurableServiceProvider(Object)}
-	 */
-	AbstractConfigurableServiceProvider() {
-	}
-
-	@Override
-	public AbstractConfigurableServiceProvider clone() {
-		AbstractConfigurableServiceProvider provider = (AbstractConfigurableServiceProvider) newInstance();
-		Configuration configuration = getConfiguration();
-		if (configuration != null)
-			provider.configure(configuration);
-		return provider;
-	}
-
-	@Override
-	public synchronized void configure(Configuration conf) {
-		if (conf == null)
-			throw new IllegalArgumentException("Config can't be null");
-		this.serviceProviderConfig = conf;
-	}
-
-	@Override
-	public Configuration getConfiguration() {
-		return serviceProviderConfig;
-	}
-
-	@Override
-	public String toString() {
-		return getName() + " " + getConfiguration();
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/AbstractTemplateService.java
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/AbstractTemplateService.java b/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/AbstractTemplateService.java
deleted file mode 100644
index b5b2a7c..0000000
--- a/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/AbstractTemplateService.java
+++ /dev/null
@@ -1,85 +0,0 @@
-package net.sf.taverna.t2.servicedescriptions;
-
-import static java.util.Collections.singleton;
-
-import java.net.URI;
-import java.util.Arrays;
-import java.util.List;
-
-import javax.swing.Icon;
-
-import org.apache.taverna.scufl2.api.configurations.Configuration;
-
-public abstract class AbstractTemplateService implements
-		ServiceDescriptionProvider {
-	protected TemplateServiceDescription templateService = new TemplateServiceDescription();
-
-	@Override
-	public void findServiceDescriptionsAsync(
-			FindServiceDescriptionsCallBack callBack) {
-		callBack.partialResults(singleton(templateService));
-		callBack.finished();
-	}
-
-	@Override
-	public abstract Icon getIcon();
-
-	public URI getActivityType() {
-		return null;
-	}
-
-	public abstract Configuration getActivityConfiguration();
-
-	public class TemplateServiceDescription extends ServiceDescription {
-		@Override
-		public Icon getIcon() {
-			return AbstractTemplateService.this.getIcon();
-		}
-
-		@Override
-		public String getName() {
-			return AbstractTemplateService.this.getName();
-		}
-
-		@Override
-		public List<String> getPath() {
-			return Arrays.asList(SERVICE_TEMPLATES);
-		}
-
-		@Override
-		public boolean isTemplateService() {
-			return true;
-		}
-
-		@Override
-		protected List<Object> getIdentifyingData() {
-			// Do it by object identity
-			return null;
-		}
-
-		@Override
-		public URI getActivityType() {
-			return AbstractTemplateService.this.getActivityType();
-		}
-
-		@Override
-		public Configuration getActivityConfiguration() {
-			return AbstractTemplateService.this.getActivityConfiguration();
-		}
-
-		@Override
-		public String getDescription() {
-			return AbstractTemplateService.this.getDescription();
-		}
-	}
-
-	@Override
-	public String toString() {
-		return "Template service " + getName();
-	}
-
-	public String getDescription() {
-		// Default to an empty string
-		return "";
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/ConfigurableServiceProvider.java
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/ConfigurableServiceProvider.java b/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/ConfigurableServiceProvider.java
deleted file mode 100644
index d16afaa..0000000
--- a/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/ConfigurableServiceProvider.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package net.sf.taverna.t2.servicedescriptions;
-
-import org.apache.taverna.scufl2.api.common.Configurable;
-import org.apache.taverna.scufl2.api.configurations.Configuration;
-
-public interface ConfigurableServiceProvider extends
-		ServiceDescriptionProvider, Configurable, Cloneable {
-	void configure(Configuration configuration) throws Exception;
-	Configuration getConfiguration();
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/CustomizedConfigurePanelProvider.java
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/CustomizedConfigurePanelProvider.java b/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/CustomizedConfigurePanelProvider.java
deleted file mode 100644
index f6bdd4a..0000000
--- a/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/CustomizedConfigurePanelProvider.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*******************************************************************************
- * 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.servicedescriptions;
-
-import org.apache.taverna.scufl2.api.configurations.Configuration;
-
-public interface CustomizedConfigurePanelProvider extends
-		ConfigurableServiceProvider {
-	void createCustomizedConfigurePanel(CustomizedConfigureCallBack callBack);
-
-	interface CustomizedConfigureCallBack {
-		void newProviderConfiguration(Configuration providerConfig);
-
-		Configuration getTemplateConfig();
-
-		ServiceDescriptionRegistry getServiceDescriptionRegistry();
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/IdentifiedObject.java
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/IdentifiedObject.java b/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/IdentifiedObject.java
deleted file mode 100644
index 596f502..0000000
--- a/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/IdentifiedObject.java
+++ /dev/null
@@ -1,30 +0,0 @@
-package net.sf.taverna.t2.servicedescriptions;
-
-import java.util.List;
-
-import net.sf.taverna.t2.lang.beans.PropertyAnnotated;
-
-public abstract class IdentifiedObject extends PropertyAnnotated {
-	@Override
-	public boolean equals(Object obj) {
-		if (!(obj instanceof IdentifiedObject))
-			return false;
-		List<? extends Object> myIdentifyingData = getIdentifyingData();
-		if (myIdentifyingData == null)
-			return super.equals(obj);
-		if (!getClass().isInstance(obj) && obj.getClass().isInstance(this))
-			return false;
-		IdentifiedObject id = (IdentifiedObject) obj;
-		return myIdentifyingData.equals(id.getIdentifyingData());
-	}
-
-	@Override
-	public int hashCode() {
-		List<? extends Object> identifyingData = getIdentifyingData();
-		if (identifyingData == null)
-			return super.hashCode();
-		return identifyingData.hashCode();
-	}
-
-	protected abstract List<? extends Object> getIdentifyingData();
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/ServiceDescription.java
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/ServiceDescription.java b/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/ServiceDescription.java
deleted file mode 100644
index 72e1b2e..0000000
--- a/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/ServiceDescription.java
+++ /dev/null
@@ -1,80 +0,0 @@
-package net.sf.taverna.t2.servicedescriptions;
-
-import java.net.URI;
-import java.util.List;
-
-import javax.swing.Icon;
-
-import net.sf.taverna.t2.lang.beans.PropertyAnnotation;
-import net.sf.taverna.t2.workbench.edits.Edit;
-import org.apache.taverna.scufl2.api.activity.Activity;
-import org.apache.taverna.scufl2.api.configurations.Configuration;
-import org.apache.taverna.scufl2.api.core.Processor;
-import org.apache.taverna.scufl2.api.core.Workflow;
-
-public abstract class ServiceDescription extends IdentifiedObject {
-	public static final String SERVICE_TEMPLATES = "Service templates";
-	private static final String NAME = "Name";
-	private static final String SERVICE_CONFIGURATION = "Service configuration";
-	private static final String SERVICE_IMPLEMENTATION_URI = "Service implementation URI";
-	private static final String DESCRIPTION = "Description";
-	public static final String LOCAL_SERVICES = "Local services";
-
-	private String description = "";
-
-	@PropertyAnnotation(expert = true, displayName = SERVICE_IMPLEMENTATION_URI)
-	public abstract URI getActivityType();
-
-	@PropertyAnnotation(expert = true, displayName = SERVICE_CONFIGURATION)
-	public Configuration getActivityConfiguration() {
-		Configuration configuration = new Configuration();
-		configuration.setType(getActivityType().resolve("#Config"));
-		return configuration;
-	}
-
-	@PropertyAnnotation(displayName = DESCRIPTION)
-	public String getDescription() {
-		return this.description;
-	}
-
-	@PropertyAnnotation(expert = true)
-	public abstract Icon getIcon();
-
-	@PropertyAnnotation(displayName = NAME)
-	public abstract String getName();
-
-	@PropertyAnnotation(expert = true)
-	public abstract List<? extends Comparable<?>> getPath();
-
-	@PropertyAnnotation(hidden = true)
-	public boolean isTemplateService() {
-		return false;
-	}
-
-	/**
-	 * @param description
-	 *            the description to set
-	 */
-	public void setDescription(String description) {
-		this.description = description;
-	}
-
-	@Override
-	public String toString() {
-		return "Service description " + getName();
-	}
-
-	/**
-	 * Any additional edit that needs to be performed upon insertion of an
-	 * instance of the ServiceDescription into the {@link Workflow} within the
-	 * specified {@link Processor}
-	 * 
-	 * @param dataflow
-	 * @param p
-	 * @param a
-	 * @return
-	 */
-	public Edit<?> getInsertionEdit(Workflow dataflow, Processor p, Activity a) {
-		return null;
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/ServiceDescriptionProvider.java
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/ServiceDescriptionProvider.java b/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/ServiceDescriptionProvider.java
deleted file mode 100644
index 8170819..0000000
--- a/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/ServiceDescriptionProvider.java
+++ /dev/null
@@ -1,61 +0,0 @@
-package net.sf.taverna.t2.servicedescriptions;
-
-import java.util.Collection;
-
-import javax.swing.Icon;
-
-import net.sf.taverna.t2.lang.beans.PropertyAnnotation;
-
-/**
- * A provider of service descriptions
- * 
- * @author Stian Soiland-Reyes
- */
-public interface ServiceDescriptionProvider {
-	/**
-	 * Get all service descriptions.
-	 * 
-	 * @param callBack
-	 */
-	void findServiceDescriptionsAsync(FindServiceDescriptionsCallBack callBack);
-
-	/**
-	 * @author stain
-	 */
-	interface FindServiceDescriptionsCallBack {
-		void partialResults(
-				Collection<? extends ServiceDescription> serviceDescriptions);
-
-		void status(String message);
-
-		void warning(String message);
-
-		void finished();
-
-		void fail(String message, Throwable ex);
-	}
-
-	/**
-	 * Name of this service description provider, for instance "BioCatalogue" or
-	 * "WSDL". This name is typically used in a "Add service..." menu.
-	 * 
-	 * @return Name of provider
-	 */
-	String getName();
-
-	@PropertyAnnotation(expert = true)
-	abstract Icon getIcon();
-
-	/**
-	 * @return unique id of this provider.
-	 */
-	String getId();
-
-	/**
-	 * Create a new copy of this service provider. It <i>need not be
-	 * configured</i> at the point where it is returned.
-	 * 
-	 * @return The copy.
-	 */
-	ServiceDescriptionProvider newInstance();
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/ServiceDescriptionRegistry.java
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/ServiceDescriptionRegistry.java b/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/ServiceDescriptionRegistry.java
deleted file mode 100644
index c44b541..0000000
--- a/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/ServiceDescriptionRegistry.java
+++ /dev/null
@@ -1,50 +0,0 @@
-package net.sf.taverna.t2.servicedescriptions;
-
-import java.io.File;
-import java.net.URI;
-import java.net.URL;
-import java.util.List;
-import java.util.Set;
-
-import org.apache.taverna.lang.observer.Observable;
-import net.sf.taverna.t2.servicedescriptions.events.ServiceDescriptionRegistryEvent;
-
-public interface ServiceDescriptionRegistry extends
-		Observable<ServiceDescriptionRegistryEvent> {
-	void addServiceDescriptionProvider(ServiceDescriptionProvider provider);
-
-	Set<ServiceDescriptionProvider> getDefaultServiceDescriptionProviders();
-
-	Set<ServiceDescriptionProvider> getServiceDescriptionProviders();
-
-	Set<ServiceDescriptionProvider> getServiceDescriptionProviders(
-			ServiceDescription sd);
-
-	Set<ServiceDescription> getServiceDescriptions();
-
-	ServiceDescription getServiceDescription(URI activityType);
-
-	List<ConfigurableServiceProvider> getUnconfiguredServiceProviders();
-
-	Set<ServiceDescriptionProvider> getUserAddedServiceProviders();
-
-	Set<ServiceDescriptionProvider> getUserRemovedServiceProviders();
-
-	void loadServiceProviders();
-
-	void loadServiceProviders(File serviceProvidersURL);
-
-	void loadServiceProviders(URL serviceProvidersURL);
-
-	void refresh();
-
-	void removeServiceDescriptionProvider(ServiceDescriptionProvider provider);
-
-	void saveServiceDescriptions();
-
-	void saveServiceDescriptions(File serviceDescriptionsFile);
-
-	void exportCurrentServiceDescriptions(File serviceDescriptionsFile);
-
-	boolean isDefaultSystemConfigurableProvidersLoaded();
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/ServiceDescriptionsConfiguration.java
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/ServiceDescriptionsConfiguration.java b/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/ServiceDescriptionsConfiguration.java
deleted file mode 100644
index 7fbcbfc..0000000
--- a/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/ServiceDescriptionsConfiguration.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2012 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.servicedescriptions;
-
-import uk.org.taverna.configuration.Configurable;
-
-/**
- * @author David Withers
- */
-public interface ServiceDescriptionsConfiguration extends Configurable {
-	public boolean isIncludeDefaults();
-
-	public void setIncludeDefaults(boolean includeDefaults);
-
-	public boolean isRemovePermanently();
-
-	public void setRemovePermanently(boolean removePermanently);
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/events/AbstractProviderEvent.java
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/events/AbstractProviderEvent.java b/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/events/AbstractProviderEvent.java
deleted file mode 100644
index 1fd224e..0000000
--- a/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/events/AbstractProviderEvent.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package net.sf.taverna.t2.servicedescriptions.events;
-
-import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionProvider;
-
-public abstract class AbstractProviderEvent extends
-		ServiceDescriptionRegistryEvent {
-	private final ServiceDescriptionProvider provider;
-
-	public AbstractProviderEvent(ServiceDescriptionProvider provider) {
-		this.provider = provider;
-	}
-
-	public ServiceDescriptionProvider getProvider() {
-		return provider;
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/events/AbstractProviderNotification.java
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/events/AbstractProviderNotification.java b/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/events/AbstractProviderNotification.java
deleted file mode 100644
index 2cabf90..0000000
--- a/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/events/AbstractProviderNotification.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package net.sf.taverna.t2.servicedescriptions.events;
-
-import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionProvider;
-
-public class AbstractProviderNotification extends AbstractProviderEvent {
-
-	private final String message;
-
-	public AbstractProviderNotification(ServiceDescriptionProvider provider, String message) {
-		super(provider);
-		this.message = message;
-	}
-
-	public String getMessage() {
-		return message;
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/events/AddedProviderEvent.java
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/events/AddedProviderEvent.java b/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/events/AddedProviderEvent.java
deleted file mode 100644
index 6e003d7..0000000
--- a/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/events/AddedProviderEvent.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package net.sf.taverna.t2.servicedescriptions.events;
-
-import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionProvider;
-
-public class AddedProviderEvent extends AbstractProviderEvent {
-
-	public AddedProviderEvent(ServiceDescriptionProvider provider) {
-		super(provider);
-	}
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/events/PartialServiceDescriptionsNotification.java
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/events/PartialServiceDescriptionsNotification.java b/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/events/PartialServiceDescriptionsNotification.java
deleted file mode 100644
index 3bd8c7f..0000000
--- a/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/events/PartialServiceDescriptionsNotification.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package net.sf.taverna.t2.servicedescriptions.events;
-
-import java.util.Collection;
-
-import net.sf.taverna.t2.servicedescriptions.ServiceDescription;
-import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionProvider;
-
-public class PartialServiceDescriptionsNotification extends
-		AbstractProviderNotification {
-	private final Collection<? extends ServiceDescription> serviceDescriptions;
-
-	public PartialServiceDescriptionsNotification(
-			ServiceDescriptionProvider provider,
-			Collection<? extends ServiceDescription> serviceDescriptions) {
-		super(provider, "Found " + serviceDescriptions.size() + " services");
-		this.serviceDescriptions = serviceDescriptions;
-	}
-
-	public Collection<? extends ServiceDescription> getServiceDescriptions() {
-		return serviceDescriptions;
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/events/ProviderErrorNotification.java
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/events/ProviderErrorNotification.java b/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/events/ProviderErrorNotification.java
deleted file mode 100644
index a712124..0000000
--- a/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/events/ProviderErrorNotification.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package net.sf.taverna.t2.servicedescriptions.events;
-
-import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionProvider;
-
-public class ProviderErrorNotification extends AbstractProviderNotification {
-
-	private final Throwable cause;
-
-	public ProviderErrorNotification(ServiceDescriptionProvider provider,
-			String message, Throwable cause) {
-		super(provider, message);
-		this.cause = cause;
-	}
-
-	public Throwable getCause() {
-		return cause;
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/events/ProviderStatusNotification.java
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/events/ProviderStatusNotification.java b/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/events/ProviderStatusNotification.java
deleted file mode 100644
index f094e47..0000000
--- a/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/events/ProviderStatusNotification.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package net.sf.taverna.t2.servicedescriptions.events;
-
-import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionProvider;
-
-public class ProviderStatusNotification extends AbstractProviderNotification {
-
-	public ProviderStatusNotification(ServiceDescriptionProvider provider,
-			String message) {
-		super(provider, message);
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/events/ProviderUpdatingNotification.java
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/events/ProviderUpdatingNotification.java b/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/events/ProviderUpdatingNotification.java
deleted file mode 100644
index e2947e1..0000000
--- a/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/events/ProviderUpdatingNotification.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package net.sf.taverna.t2.servicedescriptions.events;
-
-import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionProvider;
-
-public class ProviderUpdatingNotification extends AbstractProviderNotification {
-
-	public ProviderUpdatingNotification(ServiceDescriptionProvider provider) {
-		super(provider, "Updating");
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/events/ProviderWarningNotification.java
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/events/ProviderWarningNotification.java b/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/events/ProviderWarningNotification.java
deleted file mode 100644
index d7476aa..0000000
--- a/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/events/ProviderWarningNotification.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package net.sf.taverna.t2.servicedescriptions.events;
-
-import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionProvider;
-
-public class ProviderWarningNotification extends AbstractProviderNotification {
-
-	public ProviderWarningNotification(ServiceDescriptionProvider provider,
-			String message) {
-		super(provider, message);
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/events/RemovedProviderEvent.java
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/events/RemovedProviderEvent.java b/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/events/RemovedProviderEvent.java
deleted file mode 100644
index a382bdf..0000000
--- a/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/events/RemovedProviderEvent.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package net.sf.taverna.t2.servicedescriptions.events;
-
-import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionProvider;
-
-public class RemovedProviderEvent extends AbstractProviderEvent {
-
-	public RemovedProviderEvent(ServiceDescriptionProvider provider) {
-		super(provider);
-	}
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/events/ServiceDescriptionProvidedEvent.java
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/events/ServiceDescriptionProvidedEvent.java b/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/events/ServiceDescriptionProvidedEvent.java
deleted file mode 100644
index 76ef22d..0000000
--- a/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/events/ServiceDescriptionProvidedEvent.java
+++ /dev/null
@@ -1,20 +0,0 @@
-package net.sf.taverna.t2.servicedescriptions.events;
-
-import java.util.Set;
-
-import net.sf.taverna.t2.servicedescriptions.ServiceDescription;
-import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionProvider;
-
-public class ServiceDescriptionProvidedEvent extends AbstractProviderEvent {
-	private final Set<ServiceDescription> serviceDescriptions;
-
-	public ServiceDescriptionProvidedEvent(ServiceDescriptionProvider provider,
-			Set<ServiceDescription> serviceDescriptions) {
-		super(provider);
-		this.serviceDescriptions = serviceDescriptions;
-	}
-
-	public Set<ServiceDescription> getServiceDescriptions() {
-		return serviceDescriptions;
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/events/ServiceDescriptionRegistryEvent.java
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/events/ServiceDescriptionRegistryEvent.java b/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/events/ServiceDescriptionRegistryEvent.java
deleted file mode 100644
index 0604510..0000000
--- a/taverna-activity-palette-api/src/main/java/net/sf/taverna/t2/servicedescriptions/events/ServiceDescriptionRegistryEvent.java
+++ /dev/null
@@ -1,4 +0,0 @@
-package net.sf.taverna.t2.servicedescriptions.events;
-
-public abstract class ServiceDescriptionRegistryEvent {
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/AbstractConfigurableServiceProvider.java
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/AbstractConfigurableServiceProvider.java b/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/AbstractConfigurableServiceProvider.java
new file mode 100644
index 0000000..31fd372
--- /dev/null
+++ b/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/AbstractConfigurableServiceProvider.java
@@ -0,0 +1,72 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.servicedescriptions;
+
+import org.apache.taverna.scufl2.api.configurations.Configuration;
+
+public abstract class AbstractConfigurableServiceProvider extends
+		IdentifiedObject implements ConfigurableServiceProvider {
+	protected Configuration serviceProviderConfig;
+
+	/**
+	 * Construct configurable service provider.
+	 * 
+	 * @param configTemplate
+	 *            Template configuration
+	 */
+	public AbstractConfigurableServiceProvider(Configuration configTemplate) {
+		if (configTemplate == null)
+			throw new NullPointerException("Default config can't be null");
+		serviceProviderConfig = configTemplate;
+	}
+
+	/**
+	 * Package access constructor - only used with {@link #clone()} - otherwise
+	 * use {@link #AbstractConfigurableServiceProvider(Object)}
+	 */
+	AbstractConfigurableServiceProvider() {
+	}
+
+	@Override
+	public AbstractConfigurableServiceProvider clone() {
+		AbstractConfigurableServiceProvider provider = (AbstractConfigurableServiceProvider) newInstance();
+		Configuration configuration = getConfiguration();
+		if (configuration != null)
+			provider.configure(configuration);
+		return provider;
+	}
+
+	@Override
+	public synchronized void configure(Configuration conf) {
+		if (conf == null)
+			throw new IllegalArgumentException("Config can't be null");
+		this.serviceProviderConfig = conf;
+	}
+
+	@Override
+	public Configuration getConfiguration() {
+		return serviceProviderConfig;
+	}
+
+	@Override
+	public String toString() {
+		return getName() + " " + getConfiguration();
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/AbstractTemplateService.java
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/AbstractTemplateService.java b/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/AbstractTemplateService.java
new file mode 100644
index 0000000..d42a72f
--- /dev/null
+++ b/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/AbstractTemplateService.java
@@ -0,0 +1,104 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.servicedescriptions;
+
+import static java.util.Collections.singleton;
+
+import java.net.URI;
+import java.util.Arrays;
+import java.util.List;
+
+import javax.swing.Icon;
+
+import org.apache.taverna.scufl2.api.configurations.Configuration;
+
+public abstract class AbstractTemplateService implements
+		ServiceDescriptionProvider {
+	protected TemplateServiceDescription templateService = new TemplateServiceDescription();
+
+	@Override
+	public void findServiceDescriptionsAsync(
+			FindServiceDescriptionsCallBack callBack) {
+		callBack.partialResults(singleton(templateService));
+		callBack.finished();
+	}
+
+	@Override
+	public abstract Icon getIcon();
+
+	public URI getActivityType() {
+		return null;
+	}
+
+	public abstract Configuration getActivityConfiguration();
+
+	public class TemplateServiceDescription extends ServiceDescription {
+		@Override
+		public Icon getIcon() {
+			return AbstractTemplateService.this.getIcon();
+		}
+
+		@Override
+		public String getName() {
+			return AbstractTemplateService.this.getName();
+		}
+
+		@Override
+		public List<String> getPath() {
+			return Arrays.asList(SERVICE_TEMPLATES);
+		}
+
+		@Override
+		public boolean isTemplateService() {
+			return true;
+		}
+
+		@Override
+		protected List<Object> getIdentifyingData() {
+			// Do it by object identity
+			return null;
+		}
+
+		@Override
+		public URI getActivityType() {
+			return AbstractTemplateService.this.getActivityType();
+		}
+
+		@Override
+		public Configuration getActivityConfiguration() {
+			return AbstractTemplateService.this.getActivityConfiguration();
+		}
+
+		@Override
+		public String getDescription() {
+			return AbstractTemplateService.this.getDescription();
+		}
+	}
+
+	@Override
+	public String toString() {
+		return "Template service " + getName();
+	}
+
+	public String getDescription() {
+		// Default to an empty string
+		return "";
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/ConfigurableServiceProvider.java
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/ConfigurableServiceProvider.java b/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/ConfigurableServiceProvider.java
new file mode 100644
index 0000000..9f8e85a
--- /dev/null
+++ b/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/ConfigurableServiceProvider.java
@@ -0,0 +1,29 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.servicedescriptions;
+
+import org.apache.taverna.scufl2.api.common.Configurable;
+import org.apache.taverna.scufl2.api.configurations.Configuration;
+
+public interface ConfigurableServiceProvider extends
+		ServiceDescriptionProvider, Configurable, Cloneable {
+	void configure(Configuration configuration) throws Exception;
+	Configuration getConfiguration();
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/CustomizedConfigurePanelProvider.java
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/CustomizedConfigurePanelProvider.java b/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/CustomizedConfigurePanelProvider.java
new file mode 100644
index 0000000..8c9ddb6
--- /dev/null
+++ b/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/CustomizedConfigurePanelProvider.java
@@ -0,0 +1,35 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.servicedescriptions;
+
+import org.apache.taverna.scufl2.api.configurations.Configuration;
+
+public interface CustomizedConfigurePanelProvider extends
+		ConfigurableServiceProvider {
+	void createCustomizedConfigurePanel(CustomizedConfigureCallBack callBack);
+
+	interface CustomizedConfigureCallBack {
+		void newProviderConfiguration(Configuration providerConfig);
+
+		Configuration getTemplateConfig();
+
+		ServiceDescriptionRegistry getServiceDescriptionRegistry();
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/IdentifiedObject.java
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/IdentifiedObject.java b/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/IdentifiedObject.java
new file mode 100644
index 0000000..1d97dce
--- /dev/null
+++ b/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/IdentifiedObject.java
@@ -0,0 +1,49 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.servicedescriptions;
+
+import java.util.List;
+
+import org.apache.taverna.lang.beans.PropertyAnnotated;
+
+public abstract class IdentifiedObject extends PropertyAnnotated {
+	@Override
+	public boolean equals(Object obj) {
+		if (!(obj instanceof IdentifiedObject))
+			return false;
+		List<? extends Object> myIdentifyingData = getIdentifyingData();
+		if (myIdentifyingData == null)
+			return super.equals(obj);
+		if (!getClass().isInstance(obj) && obj.getClass().isInstance(this))
+			return false;
+		IdentifiedObject id = (IdentifiedObject) obj;
+		return myIdentifyingData.equals(id.getIdentifyingData());
+	}
+
+	@Override
+	public int hashCode() {
+		List<? extends Object> identifyingData = getIdentifyingData();
+		if (identifyingData == null)
+			return super.hashCode();
+		return identifyingData.hashCode();
+	}
+
+	protected abstract List<? extends Object> getIdentifyingData();
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/ServiceDescription.java
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/ServiceDescription.java b/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/ServiceDescription.java
new file mode 100644
index 0000000..dda5fc6
--- /dev/null
+++ b/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/ServiceDescription.java
@@ -0,0 +1,99 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.servicedescriptions;
+
+import java.net.URI;
+import java.util.List;
+
+import javax.swing.Icon;
+
+import org.apache.taverna.lang.beans.PropertyAnnotation;
+import org.apache.taverna.workbench.edits.Edit;
+import org.apache.taverna.scufl2.api.activity.Activity;
+import org.apache.taverna.scufl2.api.configurations.Configuration;
+import org.apache.taverna.scufl2.api.core.Processor;
+import org.apache.taverna.scufl2.api.core.Workflow;
+
+public abstract class ServiceDescription extends IdentifiedObject {
+	public static final String SERVICE_TEMPLATES = "Service templates";
+	private static final String NAME = "Name";
+	private static final String SERVICE_CONFIGURATION = "Service configuration";
+	private static final String SERVICE_IMPLEMENTATION_URI = "Service implementation URI";
+	private static final String DESCRIPTION = "Description";
+	public static final String LOCAL_SERVICES = "Local services";
+
+	private String description = "";
+
+	@PropertyAnnotation(expert = true, displayName = SERVICE_IMPLEMENTATION_URI)
+	public abstract URI getActivityType();
+
+	@PropertyAnnotation(expert = true, displayName = SERVICE_CONFIGURATION)
+	public Configuration getActivityConfiguration() {
+		Configuration configuration = new Configuration();
+		configuration.setType(getActivityType().resolve("#Config"));
+		return configuration;
+	}
+
+	@PropertyAnnotation(displayName = DESCRIPTION)
+	public String getDescription() {
+		return this.description;
+	}
+
+	@PropertyAnnotation(expert = true)
+	public abstract Icon getIcon();
+
+	@PropertyAnnotation(displayName = NAME)
+	public abstract String getName();
+
+	@PropertyAnnotation(expert = true)
+	public abstract List<? extends Comparable<?>> getPath();
+
+	@PropertyAnnotation(hidden = true)
+	public boolean isTemplateService() {
+		return false;
+	}
+
+	/**
+	 * @param description
+	 *            the description to set
+	 */
+	public void setDescription(String description) {
+		this.description = description;
+	}
+
+	@Override
+	public String toString() {
+		return "Service description " + getName();
+	}
+
+	/**
+	 * Any additional edit that needs to be performed upon insertion of an
+	 * instance of the ServiceDescription into the {@link Workflow} within the
+	 * specified {@link Processor}
+	 * 
+	 * @param dataflow
+	 * @param p
+	 * @param a
+	 * @return
+	 */
+	public Edit<?> getInsertionEdit(Workflow dataflow, Processor p, Activity a) {
+		return null;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/ServiceDescriptionProvider.java
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/ServiceDescriptionProvider.java b/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/ServiceDescriptionProvider.java
new file mode 100644
index 0000000..582de92
--- /dev/null
+++ b/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/ServiceDescriptionProvider.java
@@ -0,0 +1,80 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.servicedescriptions;
+
+import java.util.Collection;
+
+import javax.swing.Icon;
+
+import org.apache.taverna.lang.beans.PropertyAnnotation;
+
+/**
+ * A provider of service descriptions
+ * 
+ * @author Stian Soiland-Reyes
+ */
+public interface ServiceDescriptionProvider {
+	/**
+	 * Get all service descriptions.
+	 * 
+	 * @param callBack
+	 */
+	void findServiceDescriptionsAsync(FindServiceDescriptionsCallBack callBack);
+
+	/**
+	 * @author stain
+	 */
+	interface FindServiceDescriptionsCallBack {
+		void partialResults(
+				Collection<? extends ServiceDescription> serviceDescriptions);
+
+		void status(String message);
+
+		void warning(String message);
+
+		void finished();
+
+		void fail(String message, Throwable ex);
+	}
+
+	/**
+	 * Name of this service description provider, for instance "BioCatalogue" or
+	 * "WSDL". This name is typically used in a "Add service..." menu.
+	 * 
+	 * @return Name of provider
+	 */
+	String getName();
+
+	@PropertyAnnotation(expert = true)
+	abstract Icon getIcon();
+
+	/**
+	 * @return unique id of this provider.
+	 */
+	String getId();
+
+	/**
+	 * Create a new copy of this service provider. It <i>need not be
+	 * configured</i> at the point where it is returned.
+	 * 
+	 * @return The copy.
+	 */
+	ServiceDescriptionProvider newInstance();
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/ServiceDescriptionRegistry.java
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/ServiceDescriptionRegistry.java b/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/ServiceDescriptionRegistry.java
new file mode 100644
index 0000000..59f96be
--- /dev/null
+++ b/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/ServiceDescriptionRegistry.java
@@ -0,0 +1,69 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.servicedescriptions;
+
+import java.io.File;
+import java.net.URI;
+import java.net.URL;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.taverna.lang.observer.Observable;
+import org.apache.taverna.servicedescriptions.events.ServiceDescriptionRegistryEvent;
+
+public interface ServiceDescriptionRegistry extends
+		Observable<ServiceDescriptionRegistryEvent> {
+	void addServiceDescriptionProvider(ServiceDescriptionProvider provider);
+
+	Set<ServiceDescriptionProvider> getDefaultServiceDescriptionProviders();
+
+	Set<ServiceDescriptionProvider> getServiceDescriptionProviders();
+
+	Set<ServiceDescriptionProvider> getServiceDescriptionProviders(
+			ServiceDescription sd);
+
+	Set<ServiceDescription> getServiceDescriptions();
+
+	ServiceDescription getServiceDescription(URI activityType);
+
+	List<ConfigurableServiceProvider> getUnconfiguredServiceProviders();
+
+	Set<ServiceDescriptionProvider> getUserAddedServiceProviders();
+
+	Set<ServiceDescriptionProvider> getUserRemovedServiceProviders();
+
+	void loadServiceProviders();
+
+	void loadServiceProviders(File serviceProvidersURL);
+
+	void loadServiceProviders(URL serviceProvidersURL);
+
+	void refresh();
+
+	void removeServiceDescriptionProvider(ServiceDescriptionProvider provider);
+
+	void saveServiceDescriptions();
+
+	void saveServiceDescriptions(File serviceDescriptionsFile);
+
+	void exportCurrentServiceDescriptions(File serviceDescriptionsFile);
+
+	boolean isDefaultSystemConfigurableProvidersLoaded();
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/ServiceDescriptionsConfiguration.java
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/ServiceDescriptionsConfiguration.java b/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/ServiceDescriptionsConfiguration.java
new file mode 100644
index 0000000..8aa62e3
--- /dev/null
+++ b/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/ServiceDescriptionsConfiguration.java
@@ -0,0 +1,35 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.servicedescriptions;
+
+import uk.org.taverna.configuration.Configurable;
+
+/**
+ * @author David Withers
+ */
+public interface ServiceDescriptionsConfiguration extends Configurable {
+	public boolean isIncludeDefaults();
+
+	public void setIncludeDefaults(boolean includeDefaults);
+
+	public boolean isRemovePermanently();
+
+	public void setRemovePermanently(boolean removePermanently);
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/events/AbstractProviderEvent.java
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/events/AbstractProviderEvent.java b/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/events/AbstractProviderEvent.java
new file mode 100644
index 0000000..8f58594
--- /dev/null
+++ b/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/events/AbstractProviderEvent.java
@@ -0,0 +1,35 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.servicedescriptions.events;
+
+import org.apache.taverna.servicedescriptions.ServiceDescriptionProvider;
+
+public abstract class AbstractProviderEvent extends
+		ServiceDescriptionRegistryEvent {
+	private final ServiceDescriptionProvider provider;
+
+	public AbstractProviderEvent(ServiceDescriptionProvider provider) {
+		this.provider = provider;
+	}
+
+	public ServiceDescriptionProvider getProvider() {
+		return provider;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/events/AbstractProviderNotification.java
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/events/AbstractProviderNotification.java b/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/events/AbstractProviderNotification.java
new file mode 100644
index 0000000..fa5bb48
--- /dev/null
+++ b/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/events/AbstractProviderNotification.java
@@ -0,0 +1,37 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.servicedescriptions.events;
+
+import org.apache.taverna.servicedescriptions.ServiceDescriptionProvider;
+
+public class AbstractProviderNotification extends AbstractProviderEvent {
+
+	private final String message;
+
+	public AbstractProviderNotification(ServiceDescriptionProvider provider, String message) {
+		super(provider);
+		this.message = message;
+	}
+
+	public String getMessage() {
+		return message;
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/events/AddedProviderEvent.java
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/events/AddedProviderEvent.java b/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/events/AddedProviderEvent.java
new file mode 100644
index 0000000..e3e1655
--- /dev/null
+++ b/taverna-activity-palette-api/src/main/java/org/apache/taverna/servicedescriptions/events/AddedProviderEvent.java
@@ -0,0 +1,29 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.servicedescriptions.events;
+
+import org.apache.taverna.servicedescriptions.ServiceDescriptionProvider;
+
+public class AddedProviderEvent extends AbstractProviderEvent {
+
+	public AddedProviderEvent(ServiceDescriptionProvider provider) {
+		super(provider);
+	}
+}
\ No newline at end of file


[33/51] [partial] incubator-taverna-workbench git commit: all packages are moved to org.apache.taverna.*

Posted by re...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/ChangeMasterPasswordDialog.java
----------------------------------------------------------------------
diff --git a/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/ChangeMasterPasswordDialog.java b/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/ChangeMasterPasswordDialog.java
new file mode 100644
index 0000000..686ebc1
--- /dev/null
+++ b/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/ChangeMasterPasswordDialog.java
@@ -0,0 +1,233 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.credentialmanager;
+
+import static java.awt.BorderLayout.CENTER;
+import static java.awt.BorderLayout.NORTH;
+import static java.awt.BorderLayout.SOUTH;
+import static java.awt.Font.PLAIN;
+import static javax.swing.BoxLayout.Y_AXIS;
+import static javax.swing.JOptionPane.WARNING_MESSAGE;
+import static javax.swing.JOptionPane.showMessageDialog;
+import static org.apache.taverna.workbench.ui.credentialmanager.CMStrings.WARN_TITLE;
+
+import java.awt.BorderLayout;
+import java.awt.FlowLayout;
+import java.awt.Font;
+import java.awt.GridLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+
+import javax.swing.BoxLayout;
+import javax.swing.JButton;
+import javax.swing.JFrame;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JPasswordField;
+import javax.swing.border.CompoundBorder;
+import javax.swing.border.EmptyBorder;
+import javax.swing.border.EtchedBorder;
+
+import org.apache.taverna.security.credentialmanager.CredentialManager;
+import org.apache.taverna.workbench.helper.NonBlockedHelpEnabledDialog;
+
+/**
+ * Dialog used by users to change their master password for the Credential
+ * Manager.
+ */
+@SuppressWarnings("serial")
+public class ChangeMasterPasswordDialog extends NonBlockedHelpEnabledDialog {
+	/** Old password entry field */
+	private JPasswordField oldPasswordField;
+	/** New password entry field */
+	private JPasswordField newPasswordField;
+	/** New password confirmation entry field */
+	private JPasswordField newPasswordConfirmField;
+	/** The entered new password */
+	private String password = null;
+	/** Instructions to the users as to what to do in the dialog */
+	private String instructions;
+	private final CredentialManager credentialManager;
+
+	public ChangeMasterPasswordDialog(JFrame parent, String title,
+			boolean modal, String instructions,
+			CredentialManager credentialManager) {
+		super(parent, title, modal, null);
+		this.instructions = instructions;
+		this.credentialManager = credentialManager;
+		initComponents();
+	}
+
+	private void initComponents() {
+		getContentPane().setLayout(new BorderLayout());
+
+		JLabel instructionsLabel = new JLabel(instructions);
+		instructionsLabel.setFont(new Font(null, PLAIN, 11));
+
+		JPanel instructionsPanel = new JPanel();
+		instructionsPanel.setLayout(new BoxLayout(instructionsPanel, Y_AXIS));
+		instructionsPanel.add(instructionsLabel);
+		instructionsPanel.setBorder(new EmptyBorder(10, 5, 10, 0));
+
+		JLabel oldPasswordLabel = new JLabel("Old master password");
+		oldPasswordLabel.setBorder(new EmptyBorder(0, 5, 0, 0));
+
+		JLabel newPasswordLabel = new JLabel("New master password");
+		newPasswordLabel.setBorder(new EmptyBorder(0, 5, 0, 0));
+
+		JLabel newPasswordConfirmLabel = new JLabel(
+				"Confirm new master password");
+		newPasswordConfirmLabel.setBorder(new EmptyBorder(0, 5, 0, 0));
+
+		oldPasswordField = new JPasswordField(15);
+		newPasswordField = new JPasswordField(15);
+		newPasswordConfirmField = new JPasswordField(15);
+
+		JPanel jpPassword = new JPanel(new GridLayout(0, 2, 5, 5));
+		jpPassword.add(oldPasswordLabel);
+		jpPassword.add(oldPasswordField);
+		jpPassword.add(newPasswordLabel);
+		jpPassword.add(newPasswordField);
+		jpPassword.add(newPasswordConfirmLabel);
+		jpPassword.add(newPasswordConfirmField);
+
+		JPanel mainPanel = new JPanel(new BorderLayout());
+		mainPanel.setBorder(new CompoundBorder(new EmptyBorder(10, 10, 10, 10),
+				new EtchedBorder()));
+		mainPanel.add(instructionsPanel, NORTH);
+		mainPanel.add(jpPassword, CENTER);
+
+		JButton okButton = new JButton("OK");
+		okButton.addActionListener(new ActionListener() {
+			@Override
+			public void actionPerformed(ActionEvent evt) {
+				okPressed();
+			}
+		});
+
+		JButton cancelButton = new JButton("Cancel");
+		cancelButton.addActionListener(new ActionListener() {
+			@Override
+			public void actionPerformed(ActionEvent evt) {
+				cancelPressed();
+			}
+		});
+		JPanel buttonsPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
+		buttonsPanel.add(okButton);
+		buttonsPanel.add(cancelButton);
+
+		getContentPane().add(mainPanel, CENTER);
+		getContentPane().add(buttonsPanel, SOUTH);
+
+		addWindowListener(new WindowAdapter() {
+			@Override
+			public void windowClosing(WindowEvent evt) {
+				closeDialog();
+			}
+		});
+
+		setResizable(false);
+		getRootPane().setDefaultButton(okButton);
+		pack();
+	}
+
+	/**
+	 * Get the password set in the dialog or null if none was set.
+	 */
+	public String getPassword() {
+		return password;
+	}
+
+	/**
+	 * Check that the user has provided the correct old master password, that
+	 * the user has supplied the new password and confirmed it and that it is
+	 * not empty. If all is OK, stores the new password in the password field.
+	 * 
+	 */
+	private boolean checkPassword() {
+		String oldPassword = new String(oldPasswordField.getPassword());
+
+		if (oldPassword.length() == 0) {
+			// old password must not be empty
+			showMessageDialog(this,
+					"You must provide your current master password",
+					WARN_TITLE, WARNING_MESSAGE);
+			return false;
+		}
+
+		try {
+			if (!credentialManager.confirmMasterPassword(oldPassword)) {
+				showMessageDialog(this,
+						"You have provided an incorrect master password",
+						WARN_TITLE, WARNING_MESSAGE);
+				return false;
+			}
+		} catch (Exception e) {
+			showMessageDialog(
+					this,
+					"Credential Manager could not verify your current master password",
+					WARN_TITLE, WARNING_MESSAGE);
+			return false;
+		}
+
+		String newPassword = new String(newPasswordField.getPassword());
+		String newPasswordConfirm = new String(
+				newPasswordConfirmField.getPassword());
+
+		if (!newPassword.equals(newPasswordConfirm)) {
+			// passwords do not match
+			showMessageDialog(this, "Passwords do not match", WARN_TITLE,
+					WARNING_MESSAGE);
+			return false;
+		}
+
+		if (newPassword.isEmpty()) {
+			// passwords match but are empty
+			showMessageDialog(this, "The new master password cannot be empty",
+					WARN_TITLE, WARNING_MESSAGE);
+			return false;
+		}
+
+		// passwords match and not empty
+		password = newPassword;
+		return true;
+	}
+
+	private void okPressed() {
+		if (checkPassword())
+			closeDialog();
+	}
+
+	private void cancelPressed() {
+		/*
+		 * Set the password to null as it might have changed in the meantime if
+		 * user entered something then cancelled.
+		 */
+		password = null;
+		closeDialog();
+	}
+
+	private void closeDialog() {
+		setVisible(false);
+		dispose();
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/ConfirmTrustedCertificateDialog.java
----------------------------------------------------------------------
diff --git a/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/ConfirmTrustedCertificateDialog.java b/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/ConfirmTrustedCertificateDialog.java
new file mode 100644
index 0000000..c725983
--- /dev/null
+++ b/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/ConfirmTrustedCertificateDialog.java
@@ -0,0 +1,519 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.credentialmanager;
+
+import static java.awt.BorderLayout.CENTER;
+import static java.awt.BorderLayout.NORTH;
+import static java.awt.BorderLayout.SOUTH;
+import static java.awt.Color.WHITE;
+import static java.awt.Font.BOLD;
+import static java.awt.Font.PLAIN;
+import static java.awt.GridBagConstraints.LINE_START;
+import static javax.security.auth.x500.X500Principal.RFC2253;
+
+import java.awt.BorderLayout;
+import java.awt.Dialog;
+import java.awt.FlowLayout;
+import java.awt.Font;
+import java.awt.Frame;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.Insets;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import java.math.BigInteger;
+import java.security.cert.CertificateEncodingException;
+import java.security.cert.X509Certificate;
+
+import javax.swing.JButton;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.border.CompoundBorder;
+import javax.swing.border.EmptyBorder;
+import javax.swing.border.EtchedBorder;
+
+import org.apache.taverna.lang.ui.DialogTextArea;
+import org.apache.taverna.security.credentialmanager.CMException;
+import org.apache.taverna.security.credentialmanager.DistinguishedNameParser;
+import org.apache.taverna.security.credentialmanager.ParsedDistinguishedName;
+import org.apache.taverna.workbench.helper.NonBlockedHelpEnabledDialog;
+
+import org.apache.log4j.Logger;
+
+/**
+ * Displays the details of a X.509 certificate and asks user if they want to
+ * trust it. This is normally invoked by the Taverna's TrustManager when trying 
+ * to confirm the trust in the remote server during SSL handshake.
+ */
+@SuppressWarnings("serial")
+public class ConfirmTrustedCertificateDialog extends NonBlockedHelpEnabledDialog {
+	private static Logger logger = Logger.getLogger(ConfirmTrustedCertificateDialog.class);
+
+	/** The certificate to display */
+	private X509Certificate cert;
+	/** User's decision as whether to trust this service's certificate or not */
+	private boolean shouldTrust;
+	/**
+	 * Should the decision also be saved in Credential Manager? Actually - it is
+	 * always saved now as it was really hard to implement trusting for one
+	 * connection only - so we can either "trust" or "not" trust but not
+	 * "trust once".
+	 */
+	private boolean shouldSave = false;
+	private final DistinguishedNameParser dnParser;
+
+	public ConfirmTrustedCertificateDialog(Frame parent, String title,
+			boolean modal, X509Certificate crt, DistinguishedNameParser dnParser) {
+		super(parent, title, modal);
+		this.cert = crt;
+		this.dnParser = dnParser;
+		initComponents();
+	}
+
+	public ConfirmTrustedCertificateDialog(Dialog parent, String title,
+			boolean modal, X509Certificate crt, DistinguishedNameParser dnParser)
+			throws CMException {
+		super(parent, title, modal);
+		this.cert = crt;
+		this.dnParser = dnParser;
+		initComponents();
+	}
+
+	private void initComponents(){		
+		// title panel
+		JPanel titlePanel = new JPanel(new BorderLayout());
+		titlePanel.setBackground(WHITE);
+		JLabel titleLabel = new JLabel("View service's certificate");
+		titleLabel.setFont(titleLabel.getFont().deriveFont(BOLD, 13.5f));
+		titleLabel.setBorder(new EmptyBorder(10, 10, 0, 10));
+
+		DialogTextArea titleMessage = new DialogTextArea();
+		titleMessage.setMargin(new Insets(5, 20, 10, 10));
+		titleMessage.setFont(titleMessage.getFont().deriveFont(11f));
+		titleMessage.setEditable(false);
+		titleMessage.setFocusable(false);
+		titlePanel.setBorder( new EmptyBorder(10, 10, 0, 10));
+		titlePanel.add(titleLabel, NORTH);
+		titlePanel.add(titleMessage, CENTER);
+		
+		// Certificate details:
+
+		ParsedDistinguishedName subjectDN = dnParser.parseDN(cert
+				.getSubjectX500Principal().getName(RFC2253));
+		ParsedDistinguishedName issuerDN = dnParser.parseDN(cert
+				.getIssuerX500Principal().getName(RFC2253));
+		JPanel certificatePanel = createCertificateDetailsPanel(subjectDN, issuerDN);
+		titleMessage.setText("The service host " + subjectDN.getCN() + " requires HTTPS connection and has identified itself with the certificate below.\n" +
+				"Do you want to trust this service? (Refusing to trust means you will not be able to invoke services on this host from a workflow.)");
+
+		// OK button
+		JPanel buttonsPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
+
+//		final JButton trustButton = new JButton("Trust once");
+//		trustButton.addActionListener(new ActionListener() {
+//			public void actionPerformed(ActionEvent evt) {
+//				trustPressed();
+//			}
+//		});
+		
+		//final JButton trustAlwaysButton = new JButton("Trust always");
+		final JButton trustAlwaysButton = new JButton("Trust");
+		trustAlwaysButton.addActionListener(new ActionListener() {
+			@Override
+			public void actionPerformed(ActionEvent evt) {
+				trustAlwaysPressed();
+			}
+		});
+		
+		final JButton dontTrustButton = new JButton("Do not trust");
+		dontTrustButton.addActionListener(new ActionListener() {
+			@Override
+			public void actionPerformed(ActionEvent evt) {
+				dontTrustPressed();
+			}
+		});
+
+		//jpButtons.add(trustButton);
+		buttonsPanel.add(trustAlwaysButton);
+		buttonsPanel.add(dontTrustButton);
+
+		getContentPane().add(titlePanel, NORTH);
+		getContentPane().add(certificatePanel, CENTER);
+		getContentPane().add(buttonsPanel, SOUTH);
+
+		setResizable(false);
+
+		addWindowListener(new WindowAdapter() {
+			@Override
+			public void windowClosing(WindowEvent evt) {
+				closeDialog();
+			}
+		});
+
+		getRootPane().setDefaultButton(trustAlwaysButton);
+		pack();
+	}
+
+	private JPanel createCertificateDetailsPanel(ParsedDistinguishedName subjectDN, ParsedDistinguishedName issuerDN) {
+		/*
+		 * Grid Bag Constraints templates for labels (column 1) and values
+		 * (column 2) of certificate details
+		 */
+		GridBagConstraints gbc_labels = new GridBagConstraints();
+		gbc_labels.gridx = 0;
+		gbc_labels.ipadx = 20;
+		gbc_labels.gridwidth = 1;
+		gbc_labels.gridheight = 1;
+		gbc_labels.insets = new Insets(2, 15, 2, 2);
+		gbc_labels.anchor = LINE_START;
+
+		GridBagConstraints gbc_values = new GridBagConstraints();
+		gbc_values.gridx = 1;
+		gbc_values.gridwidth = 1;
+		gbc_values.gridheight = 1;
+		gbc_values.insets = new Insets(2, 5, 2, 2);
+		gbc_values.anchor = LINE_START;
+
+		/*
+		 * Netscape Certificate Type non-critical extension (if any) defines the
+		 * intended uses of the certificate - to make it look like Firefox's
+		 * view certificate dialog
+		 * 
+		 * From openssl's documentation: "The [above] extension is non standard,
+		 * Netscape specific and largely obsolete. Their use in new applications
+		 * is discouraged."
+		 * 
+		 * TODO replace with "basicConstraints, keyUsage and extended key usage
+		 * extensions which are now used instead."
+		 */
+//		byte[] intendedUses = cert.getExtensionValue("2.16.840.1.113730.1.1"); // Netscape Certificate Type OID
+//		JLabel intendedUsesLabel = null;
+//		JTextField intendedUsesTextField = null;
+//		JPanel intendedUsesPanel = null;
+//		GridBagConstraints gbc_intendedUsesLabel = null;
+//		if (intendedUses != null) {
+//			intendedUsesLabel = new JLabel(
+//					"This certificate has been approved for the following uses:");
+//			intendedUsesLabel.setFont(new Font(null, Font.BOLD, 11));
+//			intendedUsesLabel.setBorder(new EmptyBorder(5, 5, 5, 5));
+//
+//			intendedUsesTextField = new JTextField(45);
+//			intendedUsesTextField.setText(CMUtils.getIntendedCertificateUses(intendedUses));
+//			intendedUsesTextField.setEditable(false);
+//			intendedUsesTextField.setFont(new Font(null, Font.PLAIN, 11));
+//
+//			intendedUsesPanel = new JPanel(new BorderLayout());
+//			intendedUsesPanel.add(intendedUsesLabel, BorderLayout.NORTH);
+//			intendedUsesPanel.add(intendedUsesTextField, BorderLayout.CENTER);
+//			JSeparator separator = new JSeparator(JSeparator.HORIZONTAL);
+//			intendedUsesPanel.add(separator, BorderLayout.SOUTH);
+//
+//			gbc_intendedUsesLabel = (GridBagConstraints) gbc_labels.clone();
+//			gbc_intendedUsesLabel.gridy = 0;
+//			gbc_intendedUsesLabel.gridwidth = 2; // takes two columns
+//			gbc_intendedUsesLabel.insets = new Insets(5, 5, 5, 5);// has slightly bigger insets
+//		}
+
+		// Issued To
+		JLabel issuedToLabel = new JLabel("Issued To");
+		issuedToLabel.setFont(new Font(null, BOLD, 11));
+		GridBagConstraints gbc_issuedTo = (GridBagConstraints) gbc_labels
+				.clone();
+		gbc_issuedTo.gridy = 1;
+		gbc_issuedTo.gridwidth = 2; // takes two columns
+		gbc_issuedTo.insets = new Insets(5, 5, 5, 5);// has slightly bigger insets
+		// Subject's Distinguished Name (DN)
+		// Extract the CN, O, OU and EMAILADDRESS fields
+		String subjectCN = subjectDN.getCN();
+		String subjectOrg = subjectDN.getO();
+		String subjectOU = subjectDN.getOU();
+		// String sEMAILADDRESS = CMUtils.getEmilAddress();
+		// Subject's Common Name (CN)
+		JLabel subjectCNLabel = new JLabel("Common Name (CN)");
+		subjectCNLabel.setFont(new Font(null, PLAIN, 11));
+		GridBagConstraints gbc_subjectCNLabel = (GridBagConstraints) gbc_labels.clone();
+		gbc_subjectCNLabel.gridy = 2;
+		JLabel subjectCNValue = new JLabel(subjectCN);
+		subjectCNValue.setFont(new Font(null, PLAIN, 11));
+		GridBagConstraints gbc_subjectCNValue = (GridBagConstraints) gbc_values
+				.clone();
+		gbc_subjectCNValue.gridy = 2;
+		// Subject's Organisation (O)
+		JLabel subjectOrgLabel = new JLabel("Organisation (O)");
+		subjectOrgLabel.setFont(new Font(null, PLAIN, 11));
+		GridBagConstraints gbc_subjectOrgLabel = (GridBagConstraints) gbc_labels.clone();
+		gbc_subjectOrgLabel.gridy = 3;
+		JLabel subjectOrgValue = new JLabel(subjectOrg);
+		subjectOrgValue.setFont(new Font(null, PLAIN, 11));
+		GridBagConstraints gbc_subjectOrgValue = (GridBagConstraints) gbc_values
+				.clone();
+		gbc_subjectOrgValue.gridy = 3;
+		// Subject's Organisation Unit (OU)
+		JLabel subjectOULabel = new JLabel("Organisation Unit (OU)");
+		subjectOULabel.setFont(new Font(null, PLAIN, 11));
+		GridBagConstraints gbc_subjectOULabel = (GridBagConstraints) gbc_labels.clone();
+		gbc_subjectOULabel.gridy = 4;
+		JLabel subjectOUValue = new JLabel(subjectOU);
+		subjectOUValue.setFont(new Font(null, PLAIN, 11));
+		GridBagConstraints gbc_subjectOUValue = (GridBagConstraints) gbc_values
+				.clone();
+		gbc_subjectOUValue.gridy = 4;
+		// E-mail Address
+		// JLabel jlEmail = new JLabel("E-mail Address");
+		// jlEmail.setFont(new Font(null, Font.PLAIN, 11));
+		// GridBagConstraints gbc_jlEmail = (GridBagConstraints)
+		// gbcLabel.clone();
+		// gbc_jlEmail.gridy = 5;
+		// JLabel jlEmailValue = new JLabel(sEMAILADDRESS);
+		// jlEmailValue.setFont(new Font(null, Font.PLAIN, 11));
+		// GridBagConstraints gbc_jlEmailValue = (GridBagConstraints)
+		// gbcValue.clone();
+		// gbc_jlEmailValue.gridy = 5;
+		// Serial Number
+		JLabel snLabel = new JLabel("Serial Number");
+		snLabel.setFont(new Font(null, PLAIN, 11));
+		GridBagConstraints gbc_snLabel = (GridBagConstraints) gbc_labels.clone();
+		gbc_snLabel.gridy = 6;
+		JLabel snValue = new JLabel();
+		// Get the hexadecimal serial number
+		StringBuilder strBuff = new StringBuilder(new BigInteger(1, cert
+				.getSerialNumber().toByteArray()).toString(16).toUpperCase());
+		// Place colons at every two hexadecimal characters
+		if (strBuff.length() > 2)
+			for (int iCnt = 2; iCnt < strBuff.length(); iCnt += 3)
+				strBuff.insert(iCnt, ':');
+		snValue.setText(strBuff.toString());
+		snValue.setFont(new Font(null, PLAIN, 11));
+		GridBagConstraints gbc_snValue = (GridBagConstraints) gbc_values
+				.clone();
+		gbc_snValue.gridy = 6;
+		// Certificate version number
+		JLabel versionLabel = new JLabel("Version");
+		versionLabel.setFont(new Font(null, PLAIN, 11));
+		GridBagConstraints gbc_versionLabel = (GridBagConstraints) gbc_labels
+				.clone();
+		gbc_versionLabel.gridy = 7;
+		JLabel versionValue = new JLabel(Integer.toString(cert.getVersion()));
+		versionValue.setFont(new Font(null, PLAIN, 11));
+		GridBagConstraints gbc_versionValue = (GridBagConstraints) gbc_values
+				.clone();
+		gbc_versionValue.gridy = 7;
+
+		// Issued By
+		JLabel issuedByLabel = new JLabel("Issued By");
+		issuedByLabel.setFont(new Font(null, BOLD, 11));
+		GridBagConstraints gbc_issuedByLabel = (GridBagConstraints) gbc_labels
+				.clone();
+		gbc_issuedByLabel.gridy = 8;
+		gbc_issuedByLabel.gridwidth = 2; // takes two columns
+		gbc_issuedByLabel.insets = new Insets(5, 5, 5, 5);// has slightly bigger insets
+		// Issuer's Distinguished Name (DN)
+		// Extract the CN, O and OU fields for the issuer
+		String issuerCN = issuerDN.getCN();
+		String issuerOrg = issuerDN.getO();
+		String issuerOU = issuerDN.getOU();
+		// Issuer's Common Name (CN)
+		JLabel issuerCNLabel = new JLabel("Common Name (CN)");
+		issuerCNLabel.setFont(new Font(null, PLAIN, 11));
+		GridBagConstraints gbc_issuerCNLabel = (GridBagConstraints) gbc_labels.clone();
+		gbc_issuerCNLabel.gridy = 9;
+		JLabel issuerCNValue = new JLabel(issuerCN);
+		issuerCNValue.setFont(new Font(null, PLAIN, 11));
+		GridBagConstraints gbc_issuerCNValue = (GridBagConstraints) gbc_values
+				.clone();
+		gbc_issuerCNValue.gridy = 9;
+		// Issuer's Organisation (O)
+		JLabel issuerOrgLabel = new JLabel("Organisation (O)");
+		issuerOrgLabel.setFont(new Font(null, PLAIN, 11));
+		GridBagConstraints gbc_issuerOrgLabel = (GridBagConstraints) gbc_labels.clone();
+		gbc_issuerOrgLabel.gridy = 10;
+		JLabel issuerOrgValue = new JLabel(issuerOrg);
+		issuerOrgValue.setFont(new Font(null, PLAIN, 11));
+		GridBagConstraints gbc_issuerOrgValue = (GridBagConstraints) gbc_values
+				.clone();
+		gbc_issuerOrgValue.gridy = 10;
+		// Issuer's Organisation Unit (OU)
+		JLabel issuerOULabel = new JLabel("Organisation Unit (OU)");
+		issuerOULabel.setFont(new Font(null, PLAIN, 11));
+		GridBagConstraints gbc_issuerOULabel = (GridBagConstraints) gbc_labels.clone();
+		gbc_issuerOULabel.gridy = 11;
+		JLabel issuerOUValue = new JLabel(issuerOU);
+		issuerOUValue.setFont(new Font(null, PLAIN, 11));
+		GridBagConstraints gbc_issuerOUValue = (GridBagConstraints) gbc_values
+				.clone();
+		gbc_issuerOUValue.gridy = 11;
+		
+		// Validity
+		JLabel validityLabel = new JLabel("Validity");
+		validityLabel.setFont(new Font(null, BOLD, 11));
+		GridBagConstraints gbc_validityLabel = (GridBagConstraints) gbc_labels
+				.clone();
+		gbc_validityLabel.gridy = 12;
+		gbc_validityLabel.gridwidth = 2; // takes two columns
+		gbc_validityLabel.insets = new Insets(5, 5, 5, 5);// has slightly bigger insets
+		// Issued On
+		JLabel issuedOnLabel = new JLabel("Issued On");
+		issuedOnLabel.setFont(new Font(null, PLAIN, 11));
+		GridBagConstraints gbc_issuedOnLabel = (GridBagConstraints) gbc_labels
+				.clone();
+		gbc_issuedOnLabel.gridy = 13;
+		JLabel issuedOnValue = new JLabel(cert.getNotBefore().toString());
+		issuedOnValue.setFont(new Font(null, PLAIN, 11));
+		GridBagConstraints gbc_issuedOnValue = (GridBagConstraints) gbc_values
+				.clone();
+		gbc_issuedOnValue.gridy = 13;
+		// Expires On
+		JLabel expiresOnLabel = new JLabel("Expires On");
+		expiresOnLabel.setFont(new Font(null, PLAIN, 11));
+		GridBagConstraints gbc_expiresOnLabel = (GridBagConstraints) gbc_labels
+				.clone();
+		gbc_expiresOnLabel.gridy = 14;
+		JLabel expiresOnValue = new JLabel(cert.getNotAfter().toString());
+		expiresOnValue.setFont(new Font(null, PLAIN, 11));
+		GridBagConstraints gbc_expiresOnValue = (GridBagConstraints) gbc_values
+				.clone();
+		gbc_expiresOnValue.gridy = 14;
+
+		// Fingerprints
+		byte[] binaryCertificateEncoding = new byte[0];
+		try {
+			// each certificate has one binary encoding; for X.509 certs it is DER
+			binaryCertificateEncoding = cert.getEncoded();
+		} catch (CertificateEncodingException ex) {
+			logger.error("Could not get the encoded form of the certificate.", ex);
+		}
+		JLabel fingerprintsLabel = new JLabel("Fingerprints");
+		fingerprintsLabel.setFont(new Font(null, BOLD, 11));
+		GridBagConstraints gbc_fingerprintsLabel = (GridBagConstraints) gbc_labels
+				.clone();
+		gbc_fingerprintsLabel.gridy = 15;
+		gbc_fingerprintsLabel.gridwidth = 2; // takes two columns
+		gbc_fingerprintsLabel.insets = new Insets(5, 5, 5, 5);// has slightly bigger insets
+		// SHA-1 Fingerprint
+		JLabel sha1FingerprintLabel = new JLabel("SHA1 Fingerprint");
+		sha1FingerprintLabel.setFont(new Font(null, PLAIN, 11));
+		GridBagConstraints gbc_sha1FingerprintLabel = (GridBagConstraints) gbc_labels
+				.clone();
+		gbc_sha1FingerprintLabel.gridy = 16;
+		JLabel sha1FingerprintValue = new JLabel(
+				dnParser.getMessageDigestAsFormattedString(
+						binaryCertificateEncoding, "SHA1"));
+		sha1FingerprintValue.setFont(new Font(null, PLAIN, 11));
+		GridBagConstraints gbc_sha1FingerprintValue = (GridBagConstraints) gbc_values
+				.clone();
+		gbc_sha1FingerprintValue.gridy = 16;
+		// MD5 Fingerprint
+		JLabel md5FingerprintLabel = new JLabel("MD5 Fingerprint");
+		md5FingerprintLabel.setFont(new Font(null, PLAIN, 11));
+		GridBagConstraints gbc_md5FingerprinLabel = (GridBagConstraints) gbc_labels
+				.clone();
+		gbc_md5FingerprinLabel.gridy = 17;
+		JLabel md5FingerprintValue = new JLabel(
+				dnParser.getMessageDigestAsFormattedString(
+						binaryCertificateEncoding, "MD5"));
+		md5FingerprintValue.setFont(new Font(null, PLAIN, 11));
+		GridBagConstraints gbc_md5FingerprintValue = (GridBagConstraints) gbc_values
+				.clone();
+		gbc_md5FingerprintValue.gridy = 17;
+
+		/*
+		 * Empty label to add a bit space at the bottom of the panel to make it
+		 * look like Firefox's view certificate dialog
+		 */
+		JLabel emptyLabel = new JLabel("");
+		GridBagConstraints gbc_emptyLabel = (GridBagConstraints) gbc_labels.clone();
+		gbc_emptyLabel.gridy = 18;
+		gbc_emptyLabel.gridwidth = 2; // takes two columns
+		gbc_emptyLabel.ipady = 40;
+
+		JPanel certificatePanel = new JPanel(new GridBagLayout());
+		certificatePanel.setBorder(new CompoundBorder(new EmptyBorder(15, 15, 15,
+				15), new EtchedBorder()));
+
+//		if (intendedUses != null)
+//			certificatePanel.add(intendedUsesPanel, gbc_intendedUsesLabel);
+		certificatePanel.add(issuedToLabel, gbc_issuedTo); // Issued To
+		certificatePanel.add(subjectCNLabel, gbc_subjectCNLabel);
+		certificatePanel.add(subjectCNValue, gbc_subjectCNValue);
+		certificatePanel.add(subjectOrgLabel, gbc_subjectOrgLabel);
+		certificatePanel.add(subjectOrgValue, gbc_subjectOrgValue);
+		certificatePanel.add(subjectOULabel, gbc_subjectOULabel);
+		certificatePanel.add(subjectOUValue, gbc_subjectOUValue);
+		// jpCertificate.add(jlEmail, gbc_jlEmail);
+		// jpCertificate.add(jlEmailValue, gbc_jlEmailValue);
+		certificatePanel.add(snLabel, gbc_snLabel);
+		certificatePanel.add(snValue, gbc_snValue);
+		certificatePanel.add(versionLabel, gbc_versionLabel);
+		certificatePanel.add(versionValue, gbc_versionValue);
+		certificatePanel.add(issuedByLabel, gbc_issuedByLabel); // Issued By
+		certificatePanel.add(issuerCNLabel, gbc_issuerCNLabel);
+		certificatePanel.add(issuerCNValue, gbc_issuerCNValue);
+		certificatePanel.add(issuerOrgLabel, gbc_issuerOrgLabel);
+		certificatePanel.add(issuerOrgValue, gbc_issuerOrgValue);
+		certificatePanel.add(issuerOULabel, gbc_issuerOULabel);
+		certificatePanel.add(issuerOUValue, gbc_issuerOUValue);
+		certificatePanel.add(validityLabel, gbc_validityLabel); // Validity
+		certificatePanel.add(issuedOnLabel, gbc_issuedOnLabel);
+		certificatePanel.add(issuedOnValue, gbc_issuedOnValue);
+		certificatePanel.add(expiresOnLabel, gbc_expiresOnLabel);
+		certificatePanel.add(expiresOnValue, gbc_expiresOnValue);
+		certificatePanel.add(fingerprintsLabel, gbc_fingerprintsLabel); // Fingerprints
+		certificatePanel.add(sha1FingerprintLabel, gbc_sha1FingerprintLabel);
+		certificatePanel.add(sha1FingerprintValue, gbc_sha1FingerprintValue);
+		certificatePanel.add(md5FingerprintLabel, gbc_md5FingerprinLabel);
+		certificatePanel.add(md5FingerprintValue, gbc_md5FingerprintValue);
+		// Empty label to get some vertical space on the frame
+		certificatePanel.add(emptyLabel, gbc_emptyLabel);
+		return certificatePanel;
+	}
+
+//	private void trustPressed() {
+//		shouldTrust = true;
+//		shouldSave = false;
+//		closeDialog();
+//	}
+
+	private void trustAlwaysPressed() {
+		shouldTrust = true;
+		shouldSave = true;
+		closeDialog();
+	}
+
+	private void dontTrustPressed() {
+		shouldTrust = false;
+		shouldSave = false;
+		closeDialog();
+	}
+
+	public void closeDialog() {
+		setVisible(false);
+		dispose();
+	}
+
+	public boolean shouldTrust() {
+		return shouldTrust;
+	}
+
+	public boolean shouldSave() {
+		return shouldSave;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/ConfirmTrustedCertificateUI.java
----------------------------------------------------------------------
diff --git a/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/ConfirmTrustedCertificateUI.java b/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/ConfirmTrustedCertificateUI.java
new file mode 100644
index 0000000..1207a73
--- /dev/null
+++ b/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/ConfirmTrustedCertificateUI.java
@@ -0,0 +1,70 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.credentialmanager;
+
+import static javax.swing.JOptionPane.INFORMATION_MESSAGE;
+import static javax.swing.JOptionPane.showMessageDialog;
+
+import java.awt.Frame;
+import java.security.cert.X509Certificate;
+
+import org.apache.taverna.security.credentialmanager.DistinguishedNameParser;
+import org.apache.taverna.security.credentialmanager.TrustConfirmationProvider;
+
+import org.apache.log4j.Logger;
+
+/**
+ * @author Stian Soiland-Reyes
+ */
+public class ConfirmTrustedCertificateUI implements TrustConfirmationProvider {
+	private static Logger logger = Logger
+			.getLogger(ConfirmTrustedCertificateUI.class);
+
+	private DistinguishedNameParser dnParser;
+
+	@Override
+	public Boolean shouldTrustCertificate(X509Certificate[] chain) {
+		boolean trustConfirm = false;
+		logger.info("Asking the user if they want to trust a certificate.");
+		// Ask user if they want to trust this service
+		ConfirmTrustedCertificateDialog confirmCertTrustDialog = new ConfirmTrustedCertificateDialog(
+				(Frame) null, "Untrusted HTTPS connection", true,
+				(X509Certificate) chain[0], dnParser);
+		confirmCertTrustDialog.setLocationRelativeTo(null);
+		confirmCertTrustDialog.setVisible(true);
+		trustConfirm = confirmCertTrustDialog.shouldTrust();
+//		trustConfirm.setShouldSave(confirmCertTrustDialog.shouldSave());
+		if (!confirmCertTrustDialog.shouldTrust())
+			showMessageDialog(
+					null,
+					"As you refused to trust this host, you will not be able to use its services from a workflow.",
+					"Untrusted HTTPS connection", INFORMATION_MESSAGE);
+
+		return trustConfirm;
+	}
+
+	/**
+	 * @param dnParser
+	 *            the dnParser to set
+	 */
+	public void setDistinguishedNameParser(DistinguishedNameParser dnParser) {
+		this.dnParser = dnParser;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/CredentialManagerUI.java
----------------------------------------------------------------------
diff --git a/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/CredentialManagerUI.java b/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/CredentialManagerUI.java
new file mode 100644
index 0000000..7547918
--- /dev/null
+++ b/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/CredentialManagerUI.java
@@ -0,0 +1,1511 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.credentialmanager;
+
+import static java.awt.BorderLayout.CENTER;
+import static java.awt.BorderLayout.NORTH;
+import static java.awt.BorderLayout.PAGE_END;
+import static java.awt.Dialog.ModalExclusionType.APPLICATION_EXCLUDE;
+import static java.awt.Toolkit.getDefaultToolkit;
+import static javax.swing.JFileChooser.APPROVE_OPTION;
+import static javax.swing.JOptionPane.ERROR_MESSAGE;
+import static javax.swing.JOptionPane.INFORMATION_MESSAGE;
+import static javax.swing.JOptionPane.NO_OPTION;
+import static javax.swing.JOptionPane.WARNING_MESSAGE;
+import static javax.swing.JOptionPane.YES_NO_OPTION;
+import static javax.swing.JOptionPane.YES_OPTION;
+import static javax.swing.JOptionPane.showConfirmDialog;
+import static javax.swing.JOptionPane.showMessageDialog;
+import static javax.swing.JTable.AUTO_RESIZE_ALL_COLUMNS;
+import static javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED;
+import static javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED;
+import static org.apache.taverna.security.credentialmanager.CredentialManager.KeystoreType.KEYSTORE;
+import static org.apache.taverna.security.credentialmanager.CredentialManager.KeystoreType.TRUSTSTORE;
+import static org.apache.taverna.workbench.ui.credentialmanager.CMStrings.ALERT_TITLE;
+import static org.apache.taverna.workbench.ui.credentialmanager.CMStrings.ERROR_TITLE;
+
+import java.awt.BorderLayout;
+import java.awt.Dimension;
+import java.awt.FlowLayout;
+import java.awt.Image;
+import java.awt.Point;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileWriter;
+import java.io.InputStreamReader;
+import java.net.URI;
+import java.security.Key;
+import java.security.KeyStore;
+import java.security.cert.Certificate;
+import java.security.cert.CertificateFactory;
+import java.security.cert.X509Certificate;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.prefs.Preferences;
+
+import javax.swing.JButton;
+import javax.swing.JFileChooser;
+import javax.swing.JFrame;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTabbedPane;
+import javax.swing.JTable;
+import javax.swing.border.EmptyBorder;
+import javax.swing.event.ListSelectionEvent;
+import javax.swing.event.ListSelectionListener;
+import javax.swing.table.TableColumn;
+
+import org.apache.taverna.security.credentialmanager.CMException;
+import org.apache.taverna.security.credentialmanager.CredentialManager;
+import org.apache.taverna.security.credentialmanager.CredentialManager.KeystoreType;
+import org.apache.taverna.security.credentialmanager.DistinguishedNameParser;
+import org.apache.taverna.security.credentialmanager.UsernamePassword;
+
+import org.apache.log4j.Logger;
+import org.bouncycastle.openssl.PEMReader;
+import org.bouncycastle.openssl.PEMWriter;
+
+/**
+ * Provides a UI for the Credential Manager for users to manage their
+ * credentials saved by the Credential Manager in Taverna's Keystore and
+ * Trustore. Credentials include username and passwords pairs, key pairs, proxy
+ * key pairs and trusted certificates of CA's and s. Credentials are stored in
+ * two Bouncy Castle "UBER"-type keystores: the Keystore (containing passwords
+ * and (normal and proxy) key pairs) and the Truststore (containing trusted
+ * certificates).
+ *
+ * Inspired by the Portlecle tool (http://portecle.sourceforge.net/)
+ * and Firefox's Certificate Manager.
+ *
+ * @author Alex Nenadic
+ */
+
+@SuppressWarnings("serial")
+public class CredentialManagerUI extends JFrame {
+	private static Logger logger = Logger.getLogger(CredentialManagerUI.class);
+	/** Default tabbed pane width */
+	private static final int DEFAULT_FRAME_WIDTH = 650;
+	/** Default tabbed pane height */
+	private static final int DEFAULT_FRAME_HEIGHT = 400;
+	/** Credential Manager icon (when frame is minimised)*/
+	private static final Image credManagerIconImage = getDefaultToolkit()
+			.createImage(
+					CredentialManagerUI.class
+							.getResource("/images/cred_manager_transparent.png"));
+
+	/**
+	 * Credential Manager to manage all operations on the Keystore and
+	 * Truststore
+	 */
+	public final CredentialManager credManager;
+	private final DistinguishedNameParser dnParser;
+	
+	////////////// Tabs //////////////
+
+	/**
+	 * Tabbed pane to hold tables containing various entries in the Keystore and
+	 * Truststore
+	 */
+	private JTabbedPane keyStoreTabbedPane;
+	/** Tab 1: holds passwords table */
+	private JPanel passwordsTab = new JPanel(new BorderLayout(10, 10));
+	/** Tab 1: name */
+	public static final String PASSWORDS = "Passwords";
+	/** Tab 2: holds key pairs (user certificates) table */
+	private JPanel keyPairsTab = new JPanel(new BorderLayout(10, 10));
+	/** Tab 2: name */
+	public static final String KEYPAIRS = "Your Certificates";
+	/** Tab 3: holds trusted certificates table */
+	private JPanel trustedCertificatesTab = new JPanel(new BorderLayout(10, 10));
+	/** Tab 3: name */
+	public static final String TRUSTED_CERTIFICATES = "Trusted Certificates";
+
+	////////////// Tables //////////////
+
+	/** Password entries' table */
+	private JTable passwordsTable;
+	/** Key pair entries' table */
+	private JTable keyPairsTable;
+	/** Trusted certificate entries' table */
+	private JTable trustedCertsTable;
+	/** Password entry column type */
+	public static final String PASSWORD_ENTRY_TYPE = "Password";
+	/** Key pair entry column type */
+	public static final String KEY_PAIR_ENTRY_TYPE = "Key Pair";
+	/** Trusted cert entry column type */
+	public static final String TRUST_CERT_ENTRY_TYPE = "Trusted Certificate";
+
+	/**
+	 * Overrides the Object's clone method to prevent the singleton object to be
+	 * cloned.
+	 */
+	@Override
+	public Object clone() throws CloneNotSupportedException {
+		throw new CloneNotSupportedException();
+	}
+
+	/**
+	 * Creates a new Credential Manager UI's frame.
+	 */
+	public CredentialManagerUI(CredentialManager credentialManager,
+			DistinguishedNameParser dnParser) {
+		credManager = credentialManager;
+		this.dnParser = dnParser;
+		setModalExclusionType(APPLICATION_EXCLUDE);
+		// Initialise the UI components
+		initComponents();
+	}
+
+	private void initComponents() {
+		/*
+		 * Initialise the tabbed pane that contains the tabs with tabular
+		 * representations of the Keystore's content.
+		 */
+		keyStoreTabbedPane = new JTabbedPane();
+		/*
+		 * Initialise the tab containing the table for username/password entries
+		 * from the Keystore
+		 */
+		passwordsTable = initTable(PASSWORDS, passwordsTab);
+		/*
+		 * Initialise the tab containing the table for key pair entries from the
+		 * Keystore
+		 */
+		keyPairsTable = initTable(KEYPAIRS, keyPairsTab);
+		/*
+		 * Initialise the tab containing the table for proxy entries from the
+		 * Keystore
+		 */
+		//proxiesTable = initTable(PROXIES, proxiesTab);
+		/*
+		 * Initialise the tab containing the table for trusted certificate
+		 * entries from the Truststore
+		 */
+		trustedCertsTable = initTable(TRUSTED_CERTIFICATES,
+				trustedCertificatesTab);
+		/*
+		 * Set the size of the tabbed pane to the preferred size - the size of
+		 * the main application frame depends on it.
+		 */
+		keyStoreTabbedPane.setPreferredSize(new Dimension(DEFAULT_FRAME_WIDTH,
+				DEFAULT_FRAME_HEIGHT));
+
+		JPanel globalButtons = new JPanel(new FlowLayout(FlowLayout.RIGHT));
+		JButton resetJavaAuthCache = new JButton("Clear HTTP authentication");
+		resetJavaAuthCache.addActionListener(new ActionListener() {
+			@Override
+			public void actionPerformed(ActionEvent e) {
+				clearAuthenticationCache();
+			}
+		});
+		globalButtons.add(resetJavaAuthCache);
+
+		// Button for changing Credential Manager's master password
+		JButton changeMasterPasswordButton = new JButton(
+				"Change master password");
+		changeMasterPasswordButton.addActionListener(new ActionListener() {
+			@Override
+			public void actionPerformed(ActionEvent e) {
+				changeMasterPassword();
+			}
+		});
+		globalButtons.add(changeMasterPasswordButton);
+
+		// Add change master password to the main application frame
+		getContentPane().add(globalButtons, NORTH);
+		// Add tabbed pane to the main application frame
+		getContentPane().add(keyStoreTabbedPane, CENTER);
+
+		// Handle application close
+		addWindowListener(new WindowAdapter() {
+			@Override
+			public void windowClosing(WindowEvent evt) {
+				closeFrame();
+			}
+		});
+		setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
+
+		pack();
+
+		// Centre the frame in the centre of the screen
+		setLocationRelativeTo(null);
+
+		// Set the frame's icon
+		setIconImage(credManagerIconImage);
+
+		// Set the frame's title
+		setTitle("Credential Manager");
+
+		// setModal(true);
+		// setVisible(true);
+	}
+
+	protected void clearAuthenticationCache() {
+		if (!credManager.resetAuthCache())
+			showMessageDialog(
+					this,
+					"Java's internal HTTP authentication cache could not be cleared. \n\n"
+							+ "Taverna can only clear the cache using an undocumented Java API \n"
+							+ "that might not work if you are using a Java VM other than \n"
+							+ "Java 6 from Sun. You can restarting Taverna to clear the cache.",
+					"Could not clear authentication cache", ERROR_MESSAGE);
+		else
+			showMessageDialog(
+					this,
+					"Java's internal HTTP authentication cache has been cleared. \n\n"
+							+ "You might also need to edit or delete individual \n"
+							+ "password entries in the credential manager \n"
+							+ "if a relevant password has previously been saved.",
+					"Cleared authentication cache", INFORMATION_MESSAGE);
+	}
+
+	protected void changeMasterPassword() {
+		ChangeMasterPasswordDialog changePasswordDialog = new ChangeMasterPasswordDialog(
+				this, "Change master password", true,
+				"Change master password for Credential Manager", credManager);
+		changePasswordDialog.setLocationRelativeTo(null);
+		changePasswordDialog.setVisible(true);
+		String password = changePasswordDialog.getPassword();
+		if (password == null) // user cancelled
+			return; // do nothing
+
+		try {
+			credManager.changeMasterPassword(password);
+			showMessageDialog(this, "Master password changed sucessfully",
+					ALERT_TITLE, INFORMATION_MESSAGE);
+		} catch (CMException cme) {
+			/*
+			 * Failed to change the master password for Credential Manager -
+			 * warn the user
+			 */
+			String exMessage = "Failed to change master password for Credential Manager";
+			logger.error(exMessage);
+			showMessageDialog(this, exMessage, ERROR_TITLE, ERROR_MESSAGE);
+		}
+	}
+
+	/**
+	 * Initialise the tabs and tables with the content from the Keystore and Truststore.
+	 */
+	private JTable initTable(String tableType, JPanel tab) {
+		JTable table = null;
+
+		if (tableType.equals(PASSWORDS)) { // Passwords table
+			// The Passwords table's data model
+			PasswordsTableModel passwordsTableModel = new PasswordsTableModel(credManager);
+			// The table itself
+			table = new JTable(passwordsTableModel);
+
+			/*
+			 * Set the password and alias columns of the Passwords table to be
+			 * invisible by removing them from the column model (they will still
+			 * present in the table model)
+			 * 
+			 * Remove the last column first
+			 */
+			TableColumn aliasColumn = table.getColumnModel().getColumn(5);
+			table.getColumnModel().removeColumn(aliasColumn);
+			TableColumn passwordColumn = table.getColumnModel().getColumn(4);
+			table.getColumnModel().removeColumn(passwordColumn);
+			TableColumn lastModifiedDateColumn = table.getColumnModel().getColumn(3);
+			table.getColumnModel().removeColumn(lastModifiedDateColumn);
+
+			// Buttons
+			JButton newPasswordButton = new JButton("New");
+			newPasswordButton.addActionListener(new ActionListener() {
+				@Override
+				public void actionPerformed(ActionEvent e) {
+					newPassword();
+				}
+			});
+
+			final JButton viewPasswordButton = new JButton("Details");
+			viewPasswordButton.addActionListener(new ActionListener() {
+				@Override
+				public void actionPerformed(ActionEvent e) {
+					viewPassword();
+				}
+			});
+			viewPasswordButton.setEnabled(false);
+
+			final JButton editPasswordButton = new JButton("Edit");
+			editPasswordButton.addActionListener(new ActionListener() {
+				@Override
+				public void actionPerformed(ActionEvent e) {
+					editPassword();
+				}
+			});
+			editPasswordButton.setEnabled(false);
+
+			final JButton deletePasswordButton = new JButton("Delete");
+			deletePasswordButton.addActionListener(new ActionListener() {
+				@Override
+				public void actionPerformed(ActionEvent e) {
+					deletePassword();
+				}
+			});
+			deletePasswordButton.setEnabled(false);
+
+			/*
+			 * Selection listener for passwords table to enable/disable action
+			 * buttons accordingly
+			 */
+			class PasswordsTableSelectionListner implements
+					ListSelectionListener {
+				@Override
+				public void valueChanged(ListSelectionEvent e) {
+					if (e.getSource() != passwordsTable.getSelectionModel())
+						return;
+					if (passwordsTable.getSelectedRow() == -1) {
+						// nothing is selected
+						viewPasswordButton.setEnabled(false);
+						editPasswordButton.setEnabled(false);
+						deletePasswordButton.setEnabled(false);
+					} else {
+						if (!viewPasswordButton.isEnabled())
+							viewPasswordButton.setEnabled(true);
+						if (!editPasswordButton.isEnabled())
+							editPasswordButton.setEnabled(true);
+						if (!deletePasswordButton.isEnabled())
+							deletePasswordButton.setEnabled(true);
+					}
+				}
+			}
+			table.getSelectionModel().addListSelectionListener(new PasswordsTableSelectionListner());
+
+			// Panel to hold the buttons
+			JPanel bp = new JPanel();
+			bp.add(viewPasswordButton);
+			bp.add(editPasswordButton);
+			bp.add(newPasswordButton);
+			bp.add(deletePasswordButton);
+
+			// Add button panel to the tab
+			tab.add(bp, PAGE_END);
+
+		} else if (tableType.equals(KEYPAIRS)) { // Key Pairs tab
+			// The Key Pairs table's data model
+			KeyPairsTableModel keyPairsTableModel = new KeyPairsTableModel(credManager);
+			// The table itself
+			table = new JTable(keyPairsTableModel);
+
+			/*
+			 * Set the alias and service URIs columns of the KayPairs table to
+			 * be invisible by removing them from the column model (they will
+			 * still present in the table model)
+			 * 
+			 * Remove the last column first
+			 */
+			TableColumn aliasColumn = table.getColumnModel().getColumn(6);
+			table.getColumnModel().removeColumn(aliasColumn);
+			TableColumn serviceURIsColumn = table.getColumnModel().getColumn(5);
+			table.getColumnModel().removeColumn(serviceURIsColumn);
+			TableColumn lastModifiedDateColumn = table.getColumnModel().getColumn(4);
+			table.getColumnModel().removeColumn(lastModifiedDateColumn);
+
+			// Buttons
+			final JButton viewKeyPairButton = new JButton("Details");
+			viewKeyPairButton.addActionListener(new ActionListener() {
+				@Override
+				public void actionPerformed(ActionEvent e) {
+					viewCertificate();
+				}
+			});
+			viewKeyPairButton.setEnabled(false);
+
+			JButton importKeyPairButton = new JButton("Import");
+			importKeyPairButton.addActionListener(new ActionListener() {
+				@Override
+				public void actionPerformed(ActionEvent e) {
+					importKeyPair();
+				}
+			});
+
+			final JButton exportKeyPairButton = new JButton("Export");
+			exportKeyPairButton.addActionListener(new ActionListener() {
+				@Override
+				public void actionPerformed(ActionEvent e) {
+					exportKeyPair();
+				}
+			});
+			exportKeyPairButton.setEnabled(false);
+
+			final JButton deleteKeyPairButton = new JButton("Delete");
+			deleteKeyPairButton.addActionListener(new ActionListener() {
+				@Override
+				public void actionPerformed(ActionEvent e) {
+					deleteKeyPair();
+				}
+			});
+			deleteKeyPairButton.setEnabled(false);
+
+			/*
+			 * Selection listener for key pairs table to enable/disable action
+			 * buttons accordingly
+			 */
+			class KeyPairsTableSelectionListner implements
+					ListSelectionListener {
+				@Override
+				public void valueChanged(ListSelectionEvent e) {
+					if (e.getSource() != keyPairsTable.getSelectionModel())
+						return;
+					if (keyPairsTable.getSelectedRow() == -1) {
+						// nothing is selected
+						viewKeyPairButton.setEnabled(false);
+						exportKeyPairButton.setEnabled(false);
+						deleteKeyPairButton.setEnabled(false);
+					} else {
+						if (!viewKeyPairButton.isEnabled())
+							viewKeyPairButton.setEnabled(true);
+						if (!exportKeyPairButton.isEnabled())
+							exportKeyPairButton.setEnabled(true);
+						if (!deleteKeyPairButton.isEnabled())
+							deleteKeyPairButton.setEnabled(true);
+					}
+				}
+			}
+			table.getSelectionModel().addListSelectionListener(
+					new KeyPairsTableSelectionListner());
+
+			// Panel to hold the buttons
+			JPanel bp = new JPanel();
+			bp.add(viewKeyPairButton);
+			bp.add(importKeyPairButton);
+			bp.add(exportKeyPairButton);
+			bp.add(deleteKeyPairButton);
+
+			// Add button panel to the tab
+			tab.add(bp, PAGE_END);
+		} else if (tableType.equals(TRUSTED_CERTIFICATES)) { // Certificates tab
+
+			// The Trusted Certificate table's data model
+			TrustedCertsTableModel trustedCertificatesTableModel = new TrustedCertsTableModel(credManager);
+			// The table itself
+			table = new JTable(trustedCertificatesTableModel);
+
+			/*
+			 * Set the alias columns of the Trusted Certs table to be invisible
+			 * by removing them from the column model (they will still be
+			 * present in the table model)
+			 * 
+			 * Remove the last column first
+			 */
+			TableColumn aliasColumn = table.getColumnModel().getColumn(5);
+			table.getColumnModel().removeColumn(aliasColumn);
+			TableColumn lastModifiedDateColumn = table.getColumnModel().getColumn(4);
+			table.getColumnModel().removeColumn(lastModifiedDateColumn);
+
+			// Buttons
+			final JButton viewTrustedCertificateButton = new JButton("Details");
+			viewTrustedCertificateButton
+					.addActionListener(new ActionListener() {
+						@Override
+						public void actionPerformed(ActionEvent e) {
+							viewCertificate();
+						}
+					});
+			viewTrustedCertificateButton.setEnabled(false);
+
+			JButton importTrustedCertificateButton = new JButton("Import");
+			importTrustedCertificateButton
+					.addActionListener(new ActionListener() {
+						@Override
+						public void actionPerformed(ActionEvent e) {
+							importTrustedCertificate();
+						}
+					});
+
+			final JButton exportTrustedCertificateButton = new JButton("Export");
+			exportTrustedCertificateButton
+					.addActionListener(new ActionListener() {
+						@Override
+						public void actionPerformed(ActionEvent e) {
+							exportTrustedCertificate();
+						}
+					});
+			exportTrustedCertificateButton.setEnabled(false);
+
+			final JButton deleteTrustedCertificateButton = new JButton("Delete");
+			deleteTrustedCertificateButton
+					.addActionListener(new ActionListener() {
+						@Override
+						public void actionPerformed(ActionEvent e) {
+							deleteTrustedCertificate();
+						}
+					});
+			deleteTrustedCertificateButton.setEnabled(false);
+
+			// Selection listener for trusted certs table to enable/disable action buttons accordingly
+			class TrustedCertsTableSelectionListener implements
+					ListSelectionListener {
+				@Override
+				public void valueChanged(ListSelectionEvent e) {
+					if (e.getSource() != trustedCertsTable.getSelectionModel())
+						return;
+					if (trustedCertsTable.getSelectedRow() == -1) {
+						// nothing is selected
+						viewTrustedCertificateButton.setEnabled(false);
+						exportTrustedCertificateButton.setEnabled(false);
+						deleteTrustedCertificateButton.setEnabled(false);
+					} else {
+						if (!viewTrustedCertificateButton.isEnabled())
+							viewTrustedCertificateButton.setEnabled(true);
+						if (!exportTrustedCertificateButton.isEnabled())
+							exportTrustedCertificateButton.setEnabled(true);
+						if (!deleteTrustedCertificateButton.isEnabled())
+							deleteTrustedCertificateButton.setEnabled(true);
+					}
+				}
+			}
+			table.getSelectionModel().addListSelectionListener(
+					new TrustedCertsTableSelectionListener());
+
+			// Panel to hold the buttons
+			JPanel bp = new JPanel();
+			bp.add(viewTrustedCertificateButton);
+			bp.add(importTrustedCertificateButton);
+			bp.add(exportTrustedCertificateButton);
+			bp.add(deleteTrustedCertificateButton);
+
+			// Add button panel to the tab
+			tab.add(bp, PAGE_END);
+		} else {
+			throw new RuntimeException("Unknown table type " + tableType);
+		}
+
+		table.setShowGrid(false);
+		table.setRowMargin(0);
+		table.getColumnModel().setColumnMargin(0);
+		table.getTableHeader().setReorderingAllowed(false);
+		table.setAutoResizeMode(AUTO_RESIZE_ALL_COLUMNS);
+		// Top accommodates entry icons with 2 pixels spare space (images are
+		// 16x16 pixels)
+		table.setRowHeight(18);
+
+		// Add custom renderrers for the table headers and cells
+		for (int iCnt = 0; iCnt < table.getColumnCount(); iCnt++) {
+			TableColumn column = table.getColumnModel().getColumn(iCnt);
+			column.setHeaderRenderer(new TableHeaderRenderer());
+			column.setCellRenderer(new TableCellRenderer());
+		}
+
+		// Make the first column small and not resizable (it holds icons to
+		// represent different entry types)
+		TableColumn typeCol = table.getColumnModel().getColumn(0);
+		typeCol.setResizable(false);
+		typeCol.setMinWidth(20);
+		typeCol.setMaxWidth(20);
+		typeCol.setPreferredWidth(20);
+
+		// Set the size for the second column
+		// (i.e. Service URI column of Passwords table, and
+		// Certificate Name column of the Kay Pairs and Trusted Certificates tables)
+		// We do not care about the size of other columns.
+		TableColumn secondCol = table.getColumnModel().getColumn(1);
+		secondCol.setMinWidth(20);
+		secondCol.setMaxWidth(10000);
+		secondCol.setPreferredWidth(300);
+
+		// Put the table into a scroll pane
+		JScrollPane jspTableScrollPane = new JScrollPane(table,
+				VERTICAL_SCROLLBAR_AS_NEEDED, HORIZONTAL_SCROLLBAR_AS_NEEDED);
+		jspTableScrollPane.getViewport().setBackground(table.getBackground());
+
+		// Put the scroll pane on the tab panel
+		tab.add(jspTableScrollPane, CENTER);
+		jspTableScrollPane.setBorder(new EmptyBorder(3, 3, 3, 3));
+
+		/*
+		 * Add mouse listeners to show an entry's details if it is
+		 * double-clicked
+		 */
+		table.addMouseListener(new MouseAdapter() {
+			@Override
+			public void mouseClicked(MouseEvent evt) {
+				tableDoubleClick(evt);
+			}
+		});
+
+		// Add the tab to the tabbed pane
+		keyStoreTabbedPane.addTab(tableType, tab);
+
+		return table;
+	}
+
+	/**
+	 * Displays the details of the username/password pair entry - this includes
+	 * showing the plaintext password and service URI for this entry.
+	 */
+	private void viewPassword() {
+		// Which username/password pair entry has been selected, if any?
+		int iRow = passwordsTable.getSelectedRow();
+		if (iRow == -1) // no row currently selected
+			return;
+
+		// Get current values for service URI, username and password
+		String serviceURI = (String) passwordsTable.getValueAt(iRow, 1); // current entry's service URI
+
+		String username = (String) passwordsTable.getValueAt(iRow, 2); // current entry's username
+
+		/*
+		 * Because the password column is not visible we call the getValueAt
+		 * method on the table model rather than at the JTable
+		 */
+		String password = (String) passwordsTable.getModel()
+				.getValueAt(iRow, 4); // current entry's password value
+
+		// Let the user view service URI, username and password of the entry
+		ViewUsernamePasswordEntryDialog viewServicePassDialog = new ViewUsernamePasswordEntryDialog(
+				this, serviceURI, username, password);
+
+		viewServicePassDialog.setLocationRelativeTo(this);
+		viewServicePassDialog.setVisible(true);
+	}
+
+	/**
+	 * Lets a user insert a new username/password/service URI tuple to the
+	 * Keystore.
+	 */
+	private void newPassword() {
+		URI serviceURI = null; // service URI
+		String username = null; // username
+		String password = null; // password
+
+		// Loop until the user cancels or enters everything correctly
+		while (true) {
+			/*
+			 * Let the user insert a new password entry (by specifying service
+			 * URI, username and password)
+			 */
+			NewEditPasswordEntryDialog newPasswordDialog = new NewEditPasswordEntryDialog(
+					this, "New username and password for a service", true,
+					serviceURI, username, password, credManager);
+			newPasswordDialog.setLocationRelativeTo(this);
+			newPasswordDialog.setVisible(true);
+
+			serviceURI = newPasswordDialog.getServiceURI(); // get service URI
+			username = newPasswordDialog.getUsername(); // get username
+			password = newPasswordDialog.getPassword(); // get password
+
+			if (password == null) { // user cancelled - any of the above three
+				// fields is null
+				// do nothing
+				return;
+			}
+
+			/*
+			 * Check if a password entry with the given service URI already
+			 * exists in the Keystore. We ask this here as the user may wish to
+			 * overwrite the existing password entry. Checking for key pair
+			 * entries' URIs is done in the NewEditPasswordEntry dialog.
+			 */
+
+			/*
+			 * Get list of service URIs for all the password entries in the
+			 * Keystore
+			 */
+			List<URI> serviceURIs = null;
+			try {
+				serviceURIs = credManager
+						.getServiceURIsForAllUsernameAndPasswordPairs();
+			} catch (CMException cme) {
+				showMessageDialog(this, "Failed to get service URIs for all username and password pairs "
+						+ "to check if the entered service URI already exists",
+						ERROR_TITLE, ERROR_MESSAGE);
+				return;
+			}
+			if (serviceURIs.contains(serviceURI)) { // if such a URI already
+				// exists
+				// Ask if the user wants to overwrite it
+				int answer = showConfirmDialog(
+								this,
+								"Credential Manager already contains a password entry with the same service URI.\n"
+										+ "Do you want to overwrite it?",
+								ALERT_TITLE,
+								YES_NO_OPTION);
+
+				// Add the new password entry in the Keystore
+				try {
+					if (answer == YES_OPTION) {
+						credManager.addUsernameAndPasswordForService(
+								new UsernamePassword(username, password),
+								serviceURI);
+						break;
+					}
+				} catch (CMException cme) {
+					showMessageDialog(
+							this,
+							"Credential Manager failed to insert a new username and password pair",
+							ERROR_TITLE, ERROR_MESSAGE);
+				}
+				/*
+				 * Otherwise show the same window with the entered service URI,
+				 * username and password values
+				 */
+			} else
+				// Add the new password entry in the Keystore
+				try {
+					credManager.addUsernameAndPasswordForService(new UsernamePassword(username,
+							password), serviceURI);
+					break;
+				} catch (CMException cme) {
+					showMessageDialog(
+							this,
+							"Credential Manager failed to insert a new username and password pair",
+							ERROR_TITLE, ERROR_MESSAGE);
+				}
+		}
+	}
+
+	/**
+	 * Lets a user insert a new username/password pair for a given service URI
+	 * to the Keystore.
+	 */
+	public void newPasswordForService(URI serviceURI) {
+		/*
+		 * As this method can be called from outside of Credential Manager UI,
+		 * e.g. from wsdl-activity-ui or rshell-activity-ui to pop up a dialog
+		 * to ask the user for username and password, we also want to make sure
+		 * the main Credential Manager UI Dialog is visible as it may be clearer
+		 * to the user what is going on
+		 */
+		if (!isVisible() || getState() == ICONIFIED)
+			setVisible(true);
+
+		// Make sure password tab is selected as this method may
+		// be called from outside of Credential Manager UI.
+		keyStoreTabbedPane.setSelectedComponent(passwordsTab);
+
+		String username = null; // username
+		String password = null; // password
+
+		// Loop until the user cancels or enters everything correctly
+		while (true) {
+
+//			if(!this.isVisible()){ // if Cred Man UI is already showing but e.g. obscured by another window or minimised
+//				// Do not bring it up!
+//			} // actually we now want to show it as it makes it clearer to the user what is going on
+
+			// Let the user insert a new password entry for the given service
+			// URI (by specifying username and password)
+			NewEditPasswordEntryDialog newPasswordDialog = new NewEditPasswordEntryDialog(
+					this, "New username and password for a service", true,
+					serviceURI, username, password, credManager);
+			newPasswordDialog.setLocationRelativeTo(this);
+			newPasswordDialog.setVisible(true);
+
+			serviceURI = newPasswordDialog.getServiceURI(); // get service URI
+			username = newPasswordDialog.getUsername(); // get username
+			password = newPasswordDialog.getPassword(); // get password
+
+			if (password == null) // user cancelled - any of the above three
+				// fields is null
+				// do nothing
+				return;
+
+			/*
+			 * Check if a password entry with the given service URI already
+			 * exists in the Keystore. We ask this here as the user may wish to
+			 * overwrite the existing password entry. Checking for key pair
+			 * entries' URIs is done in the NewEditPasswordEntry dialog.
+			 */
+
+			// Get list of service URIs for all the password entries in the
+			// Keystore
+			List<URI> serviceURIs = null;
+			try {
+				serviceURIs = credManager
+						.getServiceURIsForAllUsernameAndPasswordPairs();
+			} catch (CMException cme) {
+				showMessageDialog(this, "Failed to get service URIs for all username and password pairs "
+						+ "to check if the entered service URI already exists",
+						ERROR_TITLE, ERROR_MESSAGE);
+				return;
+			}
+			if (serviceURIs.contains(serviceURI)) { // if such a URI already
+				// exists
+				// Ask if the user wants to overwrite it
+				int answer = showConfirmDialog(
+						this,
+						"Credential Manager already contains a password entry with the same service URI.\n"
+								+ "Do you want to overwrite it?", ALERT_TITLE,
+						YES_NO_OPTION);
+
+				// Add the new password entry in the Keystore
+				try {
+					if (answer == YES_OPTION) {
+						credManager.addUsernameAndPasswordForService(
+								new UsernamePassword(username, password),
+								serviceURI);
+						break;
+					}
+				} catch (CMException cme) {
+					String exMessage = "Credential Manager failed to insert a new username and password pair";
+					showMessageDialog(this, exMessage, ERROR_TITLE,
+							ERROR_MESSAGE);
+				}
+				// Otherwise show the same window with the entered service
+				// URI, username and password values
+			} else
+				// Add the new password entry in the Keystore
+				try {
+					credManager.addUsernameAndPasswordForService(new UsernamePassword(username,
+							password), serviceURI);
+					break;
+				} catch (CMException cme) {
+					showMessageDialog(this, "Credential Manager failed to insert a new username and password pair",
+							ERROR_TITLE,
+							ERROR_MESSAGE);
+				}
+		}
+	}
+
+	/**
+	 * Lets a user edit a username and password entry or their related service
+	 * URI to the Keystore.
+	 */
+	private void editPassword() {
+		// Which password entry has been selected?
+		int iRow = passwordsTable.getSelectedRow();
+		if (iRow == -1) { // no row currently selected
+			return;
+		}
+
+		// Get current values for service URI, username and password
+		URI serviceURI = URI.create((String) passwordsTable.getValueAt(iRow, 1)); // current entry's service URI
+
+		String username = (String) passwordsTable.getValueAt(iRow, 2); // current entry's username
+
+		/*
+		 * Because the password column is not visible we call the getValueAt
+		 * method on the table model rather than at the JTable
+		 */
+		String password = (String) passwordsTable.getModel()
+				.getValueAt(iRow, 4); // current entry's password value
+
+		while (true) { // loop until user cancels or enters everything correctly
+			// Let the user edit service URI, username or password of a password entry
+			NewEditPasswordEntryDialog editPasswordDialog = new NewEditPasswordEntryDialog(
+					this, "Edit username and password for a service", true,
+					serviceURI, username, password, credManager);
+
+			editPasswordDialog.setLocationRelativeTo(this);
+			editPasswordDialog.setVisible(true);
+
+			// New values
+			URI newServiceURI = editPasswordDialog.getServiceURI(); // get new service URI
+			String newUsername = editPasswordDialog.getUsername(); // get new username
+			String newPassword = editPasswordDialog.getPassword(); // get new password
+
+			if (newPassword == null) // user cancelled - any of the above three
+				// fields is null
+				// do nothing
+				return;
+
+			// Is anything actually modified?
+			boolean isModified = !serviceURI.equals(newServiceURI)
+					|| !username.equals(newUsername)
+					|| !password.equals(newPassword);
+
+			if (isModified) {
+				/*
+				 * Check if a different password entry with the new URI (i.e.
+				 * alias) already exists in the Keystore We ask this here as the
+				 * user may wish to overwrite that other password entry.
+				 */
+
+				// Get list of URIs for all passwords in the Keystore
+				List<URI> serviceURIs = null;
+				try {
+					serviceURIs = credManager
+							.getServiceURIsForAllUsernameAndPasswordPairs();
+				} catch (CMException cme) {
+					showMessageDialog(this, "Failed to get service URIs for all username and password pairs "
+							+ "to check if the modified entry already exists",
+							ERROR_TITLE,
+							ERROR_MESSAGE);
+					return;
+				}
+
+				// If the modified service URI already exists and is not the
+				// currently selected one
+				if (!newServiceURI.equals(serviceURI)
+						&& serviceURIs.contains(newServiceURI)) {
+					int answer = showConfirmDialog(
+							this,
+							"The Keystore already contains username and password pair for the entered service URI.\n"
+									+ "Do you want to overwrite it?",
+							ALERT_TITLE, YES_NO_OPTION);
+
+					try {
+						if (answer == YES_OPTION) {
+							/*
+							 * Overwrite that other entry entry and save the new
+							 * one in its place. Also remove the current one
+							 * that we are editing - as it is replacing the
+							 * other entry.
+							 */
+							credManager
+									.deleteUsernameAndPasswordForService(serviceURI);
+							credManager.addUsernameAndPasswordForService(
+									new UsernamePassword(newUsername,
+											newPassword), newServiceURI);
+							break;
+						}
+					} catch (CMException cme) {
+						showMessageDialog(
+								this,
+								"Failed to update the username and password pair in the Keystore",
+								ERROR_TITLE, ERROR_MESSAGE);
+					}
+					// Otherwise show the same window with the entered
+					// service URI, username and password values
+				} else
+					try {
+						if (!newServiceURI.equals(serviceURI))
+							credManager
+									.deleteUsernameAndPasswordForService(serviceURI);
+						credManager.addUsernameAndPasswordForService(
+								new UsernamePassword(newUsername, newPassword), newServiceURI);
+						break;
+					} catch (CMException cme) {
+						showMessageDialog(
+								this,
+								"Failed to update the username and password pair in the Keystore",
+								ERROR_TITLE, ERROR_MESSAGE);
+					}
+			} else // nothing actually modified
+				break;
+		}
+	}
+
+	/**
+	 * Lets the user delete the selected username and password entries from the
+	 * Keystore.
+	 */
+	private void deletePassword() {
+		// Which entries have been selected?
+		int[] selectedRows = passwordsTable.getSelectedRows();
+		if (selectedRows.length == 0) // no password entry selected
+			return;
+
+		// Ask user to confirm the deletion
+		if (showConfirmDialog(
+				null,
+				"Are you sure you want to delete the selected username and password entries?",
+				ALERT_TITLE, YES_NO_OPTION) != YES_OPTION)
+			return;
+
+		String exMessage = null;
+		for (int i = selectedRows.length - 1; i >= 0; i--) { // delete from backwards
+			// Get service URI for the current entry
+			URI serviceURI = URI.create((String) passwordsTable.getValueAt(selectedRows[i], 1));
+			// current entry's service URI
+			try {
+				// Delete the password entry from the Keystore
+				credManager.deleteUsernameAndPasswordForService(serviceURI);
+			} catch (CMException cme) {
+				exMessage = "Failed to delete the username and password pair from the Keystore";
+			}
+		}
+		if (exMessage != null)
+			showMessageDialog(this, exMessage, ERROR_TITLE, ERROR_MESSAGE);
+	}
+
+	/**
+	 * Shows the contents of a (user or trusted) certificate.
+	 */
+	private void viewCertificate() {
+		int selectedRow = -1;
+		String alias = null;
+		X509Certificate certToView = null;
+		ArrayList<String> serviceURIs = null;
+		KeystoreType keystoreType = null;
+
+		// Are we showing user's public key certificate?
+		if (keyPairsTab.isShowing()) {
+			keystoreType = KEYSTORE;
+			selectedRow = keyPairsTable.getSelectedRow();
+
+			if (selectedRow != -1)
+				/*
+				 * Because the alias column is not visible we call the
+				 * getValueAt method on the table model rather than at the
+				 * JTable
+				 */
+				alias = (String) keyPairsTable.getModel().getValueAt(selectedRow, 6); // current entry's Keystore alias
+		}
+		// Are we showing trusted certificate?
+		else if (trustedCertificatesTab.isShowing()) {
+			keystoreType = TRUSTSTORE;
+			selectedRow = trustedCertsTable.getSelectedRow();
+
+			if (selectedRow != -1)
+				/*
+				 * Get the selected trusted certificate entry's Truststore alias
+				 * Alias column is invisible so we get the value from the table
+				 * model
+				 */
+				alias = (String) trustedCertsTable.getModel().getValueAt(
+						selectedRow, 5);
+		}
+
+		try {
+			if (selectedRow != -1) { // something has been selected
+				// Get the entry's certificate
+				certToView = dnParser.convertCertificate(credManager
+						.getCertificate(keystoreType, alias));
+
+				// Show the certificate's contents to the user
+				ViewCertDetailsDialog viewCertDetailsDialog = new ViewCertDetailsDialog(
+						this, "Certificate details", true, certToView,
+						serviceURIs, dnParser);
+				viewCertDetailsDialog.setLocationRelativeTo(this);
+				viewCertDetailsDialog.setVisible(true);
+			}
+		} catch (CMException cme) {
+			String exMessage = "Failed to get certificate details to display to the user";
+			logger.error(exMessage, cme);
+			showMessageDialog(this, exMessage, ERROR_TITLE, ERROR_MESSAGE);
+		}
+	}
+
+	/**
+	 * Lets a user import a key pair from a PKCS #12 keystore file to the
+	 * Keystore.
+	 */
+	private void importKeyPair() {
+		/*
+		 * Let the user choose a PKCS #12 file (keystore) containing a public
+		 * and private key pair to import
+		 */
+		File importFile = selectImportExportFile(
+				"PKCS #12 file to import from", // title
+				new String[] { ".p12", ".pfx" }, // array of file extensions
+				// for the file filter
+				"PKCS#12 Files (*.p12, *.pfx)", // description of the filter
+				"Import", // text for the file chooser's approve button
+				"keyPairDir"); // preference string for saving the last chosen directory
+
+		if (importFile == null)
+			return;
+
+		// The PKCS #12 keystore is not a file
+		if (!importFile.isFile()) {
+			showMessageDialog(this, "Your selection is not a file",
+					ALERT_TITLE, WARNING_MESSAGE);
+			return;
+		}
+
+		// Get the user to enter the password that was used to encrypt the
+		// private key contained in the PKCS #12 file
+		GetPasswordDialog getPasswordDialog = new GetPasswordDialog(this,
+				"Import key pair entry", true,
+				"Enter the password that was used to encrypt the PKCS #12 file");
+		getPasswordDialog.setLocationRelativeTo(this);
+		getPasswordDialog.setVisible(true);
+
+		String pkcs12Password = getPasswordDialog.getPassword();
+
+		if (pkcs12Password == null) // user cancelled
+			return;
+		else if (pkcs12Password.isEmpty()) // empty password
+			// FIXME: Maybe user did not have the password set for the private key???
+			return;
+
+		try {
+			// Load the PKCS #12 keystore from the file
+			// (this is using the BouncyCastle provider !!!)
+			KeyStore pkcs12Keystore = credManager.loadPKCS12Keystore(importFile,
+					pkcs12Password);
+
+			/*
+			 * Display the import key pair dialog supplying all the private keys
+			 * stored in the PKCS #12 file (normally there will be only one
+			 * private key inside, but could be more as this is a keystore after
+			 * all).
+			 */
+			NewKeyPairEntryDialog importKeyPairDialog = new NewKeyPairEntryDialog(
+					this, "Credential Manager", true, pkcs12Keystore, dnParser);
+			importKeyPairDialog.setLocationRelativeTo(this);
+			importKeyPairDialog.setVisible(true);
+
+			// Get the private key and certificate chain of the key pair
+			Key privateKey = importKeyPairDialog.getPrivateKey();
+			Certificate[] certChain = importKeyPairDialog.getCertificateChain();
+
+			if (privateKey == null || certChain == null)
+				// User did not select a key pair for import or cancelled
+				return;
+
+			/*
+			 * Check if a key pair entry with the same alias already exists in
+			 * the Keystore
+			 */
+			if (credManager.hasKeyPair(privateKey, certChain)
+					&& showConfirmDialog(this,
+							"The keystore already contains the key pair entry with the same private key.\n"
+									+ "Do you want to overwrite it?",
+							ALERT_TITLE, YES_NO_OPTION) != YES_OPTION)
+				return;
+
+			// Place the private key and certificate chain into the Keystore
+			credManager.addKeyPair(privateKey, certChain);
+
+			// Display success message
+			showMessageDialog(this, "Key pair import successful", ALERT_TITLE,
+					INFORMATION_MESSAGE);
+		} catch (Exception ex) { // too many exceptions to catch separately
+			String exMessage = "Failed to import the key pair entry to the Keystore. "
+					+ ex.getMessage();
+			logger.error(exMessage, ex);
+			showMessageDialog(this, exMessage, ERROR_TITLE, ERROR_MESSAGE);
+		}
+	}
+
+	/**
+	 * Lets a user export user's private and public key pair to a PKCS #12
+	 * keystore file.
+	 */
+	private void exportKeyPair() {
+		// Which key pair entry has been selected?
+		int selectedRow = keyPairsTable.getSelectedRow();
+		if (selectedRow == -1) // no row currently selected
+			return;
+
+		// Get the key pair entry's Keystore alias
+		String alias = (String) keyPairsTable.getModel().getValueAt(selectedRow, 6);
+
+		// Let the user choose a PKCS #12 file (keystore) to export public and
+		// private key pair to
+		File exportFile = selectImportExportFile("Select a file to export to", // title
+				new String[] { ".p12", ".pfx" }, // array of file extensions
+				// for the file filter
+				"PKCS#12 Files (*.p12, *.pfx)", // description of the filter
+				"Export", // text for the file chooser's approve button
+				"keyPairDir"); // preference string for saving the last chosen directory
+
+		if (exportFile == null)
+			return;
+
+		// If file already exist - ask the user if he wants to overwrite it
+		if (exportFile.isFile()
+				&& showConfirmDialog(this,
+						"The file with the given name already exists.\n"
+								+ "Do you want to overwrite it?", ALERT_TITLE,
+						YES_NO_OPTION) == NO_OPTION)
+			return;
+
+		// Get the user to enter the password for the PKCS #12 keystore file
+		GetPasswordDialog getPasswordDialog = new GetPasswordDialog(this,
+				"Credential Manager", true,
+				"Enter the password for protecting the exported key pair");
+		getPasswordDialog.setLocationRelativeTo(this);
+		getPasswordDialog.setVisible(true);
+
+		String pkcs12Password = getPasswordDialog.getPassword();
+
+		if (pkcs12Password == null) { // user cancelled or empty password
+			// Warn the user
+			showMessageDialog(
+					this,
+					"You must supply a password for protecting the exported key pair.",
+					ALERT_TITLE, INFORMATION_MESSAGE);
+			return;
+		}
+
+		// Export the key pair
+		try {
+			credManager.exportKeyPair(alias, exportFile, pkcs12Password);
+			showMessageDialog(this, "Key pair export successful", ALERT_TITLE,
+					INFORMATION_MESSAGE);
+		} catch (CMException cme) {
+			showMessageDialog(this, cme.getMessage(), ERROR_TITLE,
+					ERROR_MESSAGE);
+		}
+	}
+
+	/**
+	 * Lets a user delete selected key pair entries from the Keystore.
+	 */
+	private void deleteKeyPair() {
+		// Which entries have been selected?
+		int[] selectedRows = keyPairsTable.getSelectedRows();
+		if (selectedRows.length == 0) // no key pair entry selected
+			return;
+
+		// Ask user to confirm the deletion
+		if (showConfirmDialog(null,
+				"Are you sure you want to delete the selected key pairs?",
+				ALERT_TITLE, YES_NO_OPTION) != YES_OPTION)
+			return;
+
+		String exMessage = null;
+		for (int i = selectedRows.length - 1; i >= 0; i--) { // delete from backwards
+			// Get the alias for the current entry
+			String alias = (String) keyPairsTable.getModel().getValueAt(
+					selectedRows[i], 6);
+			try {
+				// Delete the key pair entry from the Keystore
+				credManager.deleteKeyPair(alias);
+			} catch (CMException cme) {
+				logger.warn("failed to delete " + alias, cme);
+				exMessage = "Failed to delete the key pair(s) from the Keystore";
+			}
+		}
+		if (exMessage != null)
+			showMessageDialog(this, exMessage, ERROR_TITLE, ERROR_MESSAGE);
+	}
+
+	/**
+	 * Lets a user import a trusted certificate from a PEM or DER encoded file
+	 * into the Truststore.
+	 */
+	private void importTrustedCertificate() {
+		// Let the user choose a file containing trusted certificate(s) to
+		// import
+		File certFile = selectImportExportFile(
+				"Certificate file to import from", // title
+				new String[] { ".pem", ".crt", ".cer", ".der", "p7", ".p7c" }, // file extensions filters
+				"Certificate Files (*.pem, *.crt, , *.cer, *.der, *.p7, *.p7c)", // filter descriptions
+				"Import", // text for the file chooser's approve button
+				"trustedCertDir"); // preference string for saving the last chosen directory
+		if (certFile == null)
+			return;
+
+		// Load the certificate(s) from the file
+		ArrayList<X509Certificate> trustCertsList = new ArrayList<>();
+		CertificateFactory cf;
+		try {
+			cf = CertificateFactory.getInstance("X.509");
+		} catch (Exception e) {
+			// Nothing we can do! Things are badly misconfigured
+			cf = null;
+		}
+
+		if (cf != null) {
+			try (FileInputStream fis = new FileInputStream(certFile)) {
+				for (Certificate cert : cf.generateCertificates(fis))
+					trustCertsList.add((X509Certificate) cert);
+			} catch (Exception cex) {
+				// Do nothing
+			}
+
+			if (trustCertsList.size() == 0) {
+				// Could not load certificates as any of the above types
+				try (FileInputStream fis = new FileInputStream(certFile);
+						PEMReader pr = new PEMReader(
+								new InputStreamReader(fis), null, cf
+										.getProvider().getName())) {
+					/*
+					 * Try as openssl PEM format - which sligtly differs from
+					 * the one supported by JCE
+					 */
+					Object cert;
+					while ((cert = pr.readObject()) != null)
+						if (cert instanceof X509Certificate)
+							trustCertsList.add((X509Certificate) cert);
+				} catch (Exception cex) {
+					// do nothing
+				}
+			}
+		}
+
+		if (trustCertsList.size() == 0) {
+			/* Failed to load certifcate(s) using any of the known encodings */
+			showMessageDialog(this,
+					"Failed to load certificate(s) using any of the known encodings -\n"
+							+ "file format not recognised.", ERROR_TITLE,
+					ERROR_MESSAGE);
+			return;
+		}
+
+		// Show the list of certificates contained in the file for the user to
+		// select the ones to import
+		NewTrustCertsDialog importTrustCertsDialog = new NewTrustCertsDialog(this,
+				"Credential Manager", true, trustCertsList, dnParser);
+
+		importTrustCertsDialog.setLocationRelativeTo(this);
+		importTrustCertsDialog.setVisible(true);
+		List<X509Certificate> selectedTrustCerts = importTrustCertsDialog
+				.getTrustedCertificates(); // user-selected trusted certs to import
+
+		// If user cancelled or did not select any cert to import
+		if (selectedTrustCerts == null || selectedTrustCerts.isEmpty())
+			return;
+
+		try {
+			for (X509Certificate cert : selectedTrustCerts)
+				// Import the selected trusted certificates
+				credManager.addTrustedCertificate(cert);
+
+			// Display success message
+			showMessageDialog(this, "Trusted certificate(s) import successful",
+					ALERT_TITLE, INFORMATION_MESSAGE);
+		} catch (CMException cme) {
+			String exMessage = "Failed to import trusted certificate(s) to the Truststore";
+			logger.error(exMessage, cme);
+			showMessageDialog(this, exMessage, ERROR_TITLE, ERROR_MESSAGE);
+		}
+	}
+
+	/**
+	 * Lets the user export one (at the moment) or more (in future) trusted
+	 * certificate entries to a PEM-encoded file.
+	 */
+	private boolean exportTrustedCertificate() {
+		// Which trusted certificate has been selected?
+		int selectedRow = trustedCertsTable.getSelectedRow();
+		if (selectedRow == -1) // no row currently selected
+			return false;
+
+		// Get the trusted certificate entry's Keystore alias
+		String alias = (String) trustedCertsTable.getModel()
+				.getValueAt(selectedRow, 3);
+		// the alias column is invisible so we get the value from the table
+		// model
+
+		// Let the user choose a file to export to
+		File exportFile = selectImportExportFile("Select a file to export to", // title
+				new String[] { ".pem" }, // array of file extensions for the
+				// file filter
+				"Certificate Files (*.pem)", // description of the filter
+				"Export", // text for the file chooser's approve button
+				"trustedCertDir"); // preference string for saving the last chosen directory
+		if (exportFile == null)
+			return false;
+
+		// If file already exist - ask the user if he wants to overwrite it
+		if (exportFile.isFile()
+				&& showConfirmDialog(this,
+						"The file with the given name already exists.\n"
+								+ "Do you want to overwrite it?", ALERT_TITLE,
+						YES_NO_OPTION) == NO_OPTION)
+			return false;
+
+		// Export the trusted certificate
+		try (PEMWriter pw = new PEMWriter(new FileWriter(exportFile))) {
+			// Get the trusted certificate
+			pw.writeObject(credManager.getCertificate(TRUSTSTORE, alias));
+		} catch (Exception ex) {
+			String exMessage = "Failed to export the trusted certificate from the Truststore.";
+			logger.error(exMessage, ex);
+			showMessageDialog(this, exMessage, ERROR_TITLE, ERROR_MESSAGE);
+			return false;
+		}
+		showMessageDialog(this, "Trusted certificate export successful",
+				ALERT_TITLE, INFORMATION_MESSAGE);
+		return true;
+	}
+
+	/**
+	 * Lets a user delete the selected trusted certificate entries from the
+	 * Truststore.
+	 */
+	private void deleteTrustedCertificate() {
+		// Which entries have been selected?
+		int[] selectedRows = trustedCertsTable.getSelectedRows();
+		if (selectedRows.length == 0) // no trusted cert entry selected
+			return;
+
+		// Ask user to confirm the deletion
+		if (showConfirmDialog(
+				null,
+				"Are you sure you want to delete the selected trusted certificate(s)?",
+				ALERT_TITLE, YES_NO_OPTION) != YES_OPTION)
+			return;
+
+		String exMessage = null;
+		for (int i = selectedRows.length - 1; i >= 0; i--) { // delete from backwards
+			// Get the alias for the current entry
+			String alias = (String) trustedCertsTable.getModel().getValueAt(
+					selectedRows[i], 5);
+			try {
+				// Delete the trusted certificate entry from the Truststore
+				credManager.deleteTrustedCertificate(alias);
+			} catch (CMException cme) {
+				exMessage = "Failed to delete the trusted certificate(s) from the Truststore";
+				logger.error(exMessage, cme);
+			}
+		}
+		if (exMessage != null)
+			showMessageDialog(this, exMessage, ERROR_TITLE, ERROR_MESSAGE);
+	}
+
+	/**
+	 * If double click on a table occured - show the
+	 * details of the table entry.
+	 */
+	private void tableDoubleClick(MouseEvent evt) {
+		if (evt.getClickCount() > 1) { // is it a double click?
+			// Which row was clicked on (if any)?
+			Point point = new Point(evt.getX(), evt.getY());
+			int row = ((JTable) evt.getSource()).rowAtPoint(point);
+			if (row == -1)
+				return;
+			// Which table the click occured on?
+			if (((JTable) evt.getSource()).getModel() instanceof PasswordsTableModel)
+				// Passwords table
+				viewPassword();
+			else if (((JTable) evt.getSource()).getModel() instanceof KeyPairsTableModel)
+				// Key pairs table
+				viewCertificate();
+			else
+				// Trusted certificates table
+				viewCertificate();
+		}
+	}
+
+	/**
+	 * Lets the user select a file to export to or import from a key pair or a
+	 * certificate.
+	 */
+	private File selectImportExportFile(String title, String[] filter,
+			String description, String approveButtonText, String prefString) {
+		Preferences prefs = Preferences
+				.userNodeForPackage(CredentialManagerUI.class);
+		String keyPairDir = prefs.get(prefString,
+				System.getProperty("user.home"));
+		JFileChooser fileChooser = new JFileChooser();
+		fileChooser.addChoosableFileFilter(new CryptoFileFilter(filter,
+				description));
+		fileChooser.setDialogTitle(title);
+		fileChooser.setMultiSelectionEnabled(false);
+		fileChooser.setCurrentDirectory(new File(keyPairDir));
+
+		if (fileChooser.showDialog(this, approveButtonText) != APPROVE_OPTION)
+			return null;
+
+		File selectedFile = fileChooser.getSelectedFile();
+		prefs.put(prefString, fileChooser.getCurrentDirectory().toString());
+		return selectedFile;
+	}
+
+	private void closeFrame() {
+		setVisible(false);
+		dispose();
+	}
+}


[32/51] [partial] incubator-taverna-workbench git commit: all packages are moved to org.apache.taverna.*

Posted by re...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/CredentialManagerUILauncher.java
----------------------------------------------------------------------
diff --git a/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/CredentialManagerUILauncher.java b/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/CredentialManagerUILauncher.java
new file mode 100644
index 0000000..e500281
--- /dev/null
+++ b/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/CredentialManagerUILauncher.java
@@ -0,0 +1,95 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.credentialmanager;
+
+import static java.awt.BorderLayout.CENTER;
+import static javax.swing.SwingUtilities.invokeLater;
+
+import java.awt.Dimension;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+import javax.swing.ImageIcon;
+import javax.swing.JButton;
+import javax.swing.JFrame;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+
+/**
+ * Test launcher for Credential Manager GUI (so it does not have to be
+ * launched from Taverna).
+ *
+ * @author Alexandra Nenadic
+ */
+public class CredentialManagerUILauncher extends JFrame {
+	private static final long serialVersionUID = 2079805060170251148L;
+
+	private final ImageIcon launchCMIcon = new ImageIcon(
+			CredentialManagerUILauncher.class
+					.getResource("/images/cred_manager.png"));
+
+	public CredentialManagerUILauncher() {
+		JPanel jpLaunch = new JPanel();
+		jpLaunch.setPreferredSize(new Dimension(300, 120));
+
+		JLabel jlLaunch = new JLabel("T2: Launch Credential Manager GUI");
+
+		JButton jbLaunch = new JButton();
+		jbLaunch.setIcon(launchCMIcon);
+		jbLaunch.setToolTipText("Launches Credential Manager");
+		jbLaunch.addActionListener(new ActionListener() {
+			@Override
+			public void actionPerformed(ActionEvent e) {
+				CredentialManagerUI cmGUI = new CredentialManagerUI(null, null);
+				if (cmGUI != null)
+					cmGUI.setVisible(true);
+			}
+		});
+
+		jpLaunch.add(jlLaunch);
+		jpLaunch.add(jbLaunch);
+
+		getContentPane().add(jpLaunch, CENTER);
+
+		// Handle application close
+		setDefaultCloseOperation(EXIT_ON_CLOSE);
+
+		pack();
+
+        // Centre the frame in the centre of the desktop
+        setLocationRelativeTo(null);
+        // Set the frame's title
+        setTitle("Credential Manager GUI Launcher");
+        setVisible(true);
+	}
+
+	/**
+	 * Launcher for the Credential Manager GUI.
+	 */
+	public static void main(String[] args) {
+        // Create and show GUI on the event handler thread
+        invokeLater(new Runnable(){
+        	@Override
+        	public void run() {
+        		new CredentialManagerUILauncher();
+        	}
+        });
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/CryptoFileFilter.java
----------------------------------------------------------------------
diff --git a/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/CryptoFileFilter.java b/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/CryptoFileFilter.java
new file mode 100644
index 0000000..e26b3f2
--- /dev/null
+++ b/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/CryptoFileFilter.java
@@ -0,0 +1,72 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.credentialmanager;
+
+import java.io.File;
+import java.util.Arrays;
+import java.util.List;
+
+import javax.swing.filechooser.FileFilter;
+
+/**
+ * File filter for filtering against various file extensions. Crypto files
+ * normally contain a private key (and optionally its certificate chain) or a
+ * public key certificate (and optionally its certificate chain).
+ * 
+ * .p12 or .pfx are PKCS #12 keystore files containing private key and its
+ * public key (+cert chain); .pem are ASN.1 PEM-encoded files containing one (or
+ * more concatenated) public key certificate(s); .der are ASN.1 DER-encoded
+ * files containing one public key certificate; .cer are CER-encoded files
+ * containing one ore more DER-encoded certificates; .crt files are either
+ * encoded as binary DER or as ASCII PEM. .p7 and .p7c are PKCS #7 certificate
+ * chain files (i.e. SignedData structure without data, just certificate(s)).
+ */
+public class CryptoFileFilter extends FileFilter {
+	// Description of the filter
+	private String description;
+
+	// Array of file extensions to filter against
+	private List<String> exts;
+
+	public CryptoFileFilter(String[] extList, String desc) {
+		exts = Arrays.asList(extList);
+		this.description = desc;
+	}
+
+	@Override
+	public boolean accept(File file) {
+		if (file.isDirectory())
+			return true;
+		if (file.isFile())
+			for (String ext : exts)
+				if (file.getName().toLowerCase().endsWith(ext))
+					return true;
+		return false;
+	}
+
+	public void setDescription(String desc) {
+		this.description = desc;
+	}
+
+	@Override
+	public String getDescription() {
+		return this.description;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/GetMasterPasswordDialog.java
----------------------------------------------------------------------
diff --git a/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/GetMasterPasswordDialog.java b/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/GetMasterPasswordDialog.java
new file mode 100644
index 0000000..a030c38
--- /dev/null
+++ b/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/GetMasterPasswordDialog.java
@@ -0,0 +1,168 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.credentialmanager;
+
+import static java.awt.BorderLayout.CENTER;
+import static java.awt.BorderLayout.NORTH;
+import static java.awt.BorderLayout.SOUTH;
+import static javax.swing.BoxLayout.Y_AXIS;
+import static javax.swing.JOptionPane.WARNING_MESSAGE;
+import static javax.swing.JOptionPane.showMessageDialog;
+import static org.apache.taverna.workbench.ui.credentialmanager.CMStrings.WARN_TITLE;
+
+import java.awt.BorderLayout;
+import java.awt.FlowLayout;
+import java.awt.Frame;
+import java.awt.GridLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+
+import javax.swing.BoxLayout;
+import javax.swing.JButton;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JPasswordField;
+import javax.swing.border.EmptyBorder;
+
+import org.apache.taverna.workbench.helper.NonBlockedHelpEnabledDialog;
+
+/**
+ * Dialog used for getting a master password for Credential Manager from the
+ * users.
+ * 
+ * @author Alex Nenadic
+ */
+@SuppressWarnings("serial")
+public class GetMasterPasswordDialog extends NonBlockedHelpEnabledDialog {
+	/** Password entry field */
+	private JPasswordField passwordField;
+	/** The entered password */
+	private String password = null;
+	/** Text giving user the instructions what to do in the dialog */
+	private String instructions;
+
+	public GetMasterPasswordDialog(String instructions) {
+		super((Frame) null, "Enter master password", true);
+		this.instructions = instructions;
+		initComponents();
+	}
+
+	private void initComponents() {
+		getContentPane().setLayout(new BorderLayout());
+
+		JLabel instructionsLabel = new JLabel(instructions);
+		// instructionsLabel.setFont(new Font(null, Font.PLAIN, 11));
+
+		JPanel instructionsPanel = new JPanel();
+		instructionsPanel.setLayout(new BoxLayout(instructionsPanel, Y_AXIS));
+		instructionsPanel.add(instructionsLabel);
+		instructionsPanel.setBorder(new EmptyBorder(10, 5, 10, 0));
+
+		JLabel passwordLabel = new JLabel("Password");
+		passwordLabel.setBorder(new EmptyBorder(0, 5, 0, 0));
+
+		passwordField = new JPasswordField(15);
+		JPanel passwordPanel = new JPanel(new GridLayout(1, 1, 5, 5));
+		passwordPanel.add(passwordLabel);
+		passwordPanel.add(passwordField);
+
+		JPanel mainPanel = new JPanel(new BorderLayout());
+		mainPanel.setBorder(new EmptyBorder(10, 10, 10, 10));
+		mainPanel.add(instructionsPanel, NORTH);
+		mainPanel.add(passwordPanel, CENTER);
+
+		JButton okButton = new JButton("OK");
+		okButton.addActionListener(new ActionListener() {
+			@Override
+			public void actionPerformed(ActionEvent evt) {
+				okPressed();
+			}
+		});
+
+		JButton cancelButton = new JButton("Cancel");
+		cancelButton.addActionListener(new ActionListener() {
+			@Override
+			public void actionPerformed(ActionEvent evt) {
+				cancelPressed();
+			}
+		});
+		JPanel buttonsPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
+		buttonsPanel.add(okButton);
+		buttonsPanel.add(cancelButton);
+
+		getContentPane().add(mainPanel, CENTER);
+		getContentPane().add(buttonsPanel, SOUTH);
+
+		addWindowListener(new WindowAdapter() {
+			@Override
+			public void windowClosing(WindowEvent evt) {
+				closeDialog();
+			}
+		});
+
+		setResizable(false);
+		getRootPane().setDefaultButton(okButton);
+		pack();
+	}
+
+	/**
+	 * Get the password entered in the dialog.
+	 */
+	public String getPassword() {
+		return password;
+	}
+
+	/**
+	 * Check that the entered password is not empty and store the entered
+	 * password.
+	 */
+	private boolean checkPassword() {
+		password = new String(passwordField.getPassword());
+
+		if (password.isEmpty()) {
+			showMessageDialog(this, "The password cannot be empty",
+					WARN_TITLE, WARNING_MESSAGE);
+			return false;
+		}
+
+		return true;
+	}
+
+	private void okPressed() {
+		if (checkPassword())
+			closeDialog();
+	}
+
+	private void cancelPressed() {
+		/*
+		 * Set the password to null as it might have changed in the meantime if
+		 * user entered something then cancelled.
+		 */
+		password = null;
+		closeDialog();
+	}
+
+	private void closeDialog() {
+		setVisible(false);
+		dispose();
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/GetPasswordDialog.java
----------------------------------------------------------------------
diff --git a/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/GetPasswordDialog.java b/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/GetPasswordDialog.java
new file mode 100644
index 0000000..d0fa8be
--- /dev/null
+++ b/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/GetPasswordDialog.java
@@ -0,0 +1,167 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.credentialmanager;
+
+import static java.awt.BorderLayout.CENTER;
+import static java.awt.BorderLayout.NORTH;
+import static java.awt.BorderLayout.SOUTH;
+import static java.awt.Font.PLAIN;
+import static javax.swing.JOptionPane.WARNING_MESSAGE;
+import static javax.swing.JOptionPane.showMessageDialog;
+import static org.apache.taverna.workbench.ui.credentialmanager.CMStrings.WARN_TITLE;
+
+import java.awt.BorderLayout;
+import java.awt.FlowLayout;
+import java.awt.Font;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+
+import javax.swing.JButton;
+import javax.swing.JDialog;
+import javax.swing.JFrame;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JPasswordField;
+import javax.swing.border.EmptyBorder;
+
+import org.apache.taverna.workbench.helper.NonBlockedHelpEnabledDialog;
+
+/**
+ * A general dialog for entering a password.
+ * 
+ * @author Alex Nenadic
+ */
+@SuppressWarnings("serial")
+public class GetPasswordDialog extends NonBlockedHelpEnabledDialog {
+	/** Instructions for user explaining the purpose of the password */
+	private String instructions = null;
+	/* Password entry password field */
+	private JPasswordField passwordField;
+	/* Stores the password entered */
+	private String password = null;
+
+	public GetPasswordDialog(JFrame parent, String title, boolean modal,
+			String instr) {
+		super(parent, title, modal);
+		instructions = instr;
+		initComponents();
+	}
+
+	public GetPasswordDialog(JDialog parent, String title, boolean modal,
+			String instr) {
+		super(parent, title, modal);
+		instructions = instr;
+		initComponents();
+	}
+
+	private void initComponents() {
+		getContentPane().setLayout(new BorderLayout());
+
+		JLabel passwordLabel = new JLabel("Password");
+		passwordField = new JPasswordField(15);
+
+		JButton okButton = new JButton("OK");
+		okButton.addActionListener(new ActionListener() {
+			@Override
+			public void actionPerformed(ActionEvent evt) {
+				okPressed();
+			}
+		});
+
+		JButton cancelButton = new JButton("Cancel");
+		cancelButton.addActionListener(new ActionListener() {
+			@Override
+			public void actionPerformed(ActionEvent evt) {
+				cancelPressed();
+			}
+		});
+
+		JLabel instructionsLabel; // Instructions
+		if (instructions != null) {
+			instructionsLabel = new JLabel(instructions);
+			instructionsLabel.setFont(new Font(null, PLAIN, 11));
+			instructionsLabel.setBorder(new EmptyBorder(5, 5, 5, 5));
+			getContentPane().add(instructionsLabel, NORTH);
+		}
+        
+        JPanel passwordPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
+        passwordPanel.add(passwordLabel);
+        passwordPanel.add(passwordField);
+        passwordPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
+
+        JPanel buttonsPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
+        buttonsPanel.add(okButton);
+        buttonsPanel.add(cancelButton);
+
+        getContentPane().add(passwordPanel, CENTER);
+        getContentPane().add(buttonsPanel, SOUTH);
+
+		addWindowListener(new WindowAdapter() {
+			@Override
+			public void windowClosing(WindowEvent evt) {
+				closeDialog();
+			}
+		});
+
+        setResizable(false);
+        getRootPane().setDefaultButton(okButton);
+        pack();
+	}
+
+	/**
+	 * Get the password entered in the dialog.
+	 */
+	public String getPassword() {
+		return password;
+	}
+
+	/**
+	 * Check that the password entered is not empty and store the entered
+	 * password.
+	 */
+	private boolean checkPassword() {
+		password = new String(passwordField.getPassword());
+
+		if (password.isEmpty()) {
+			showMessageDialog(this, "The password cannot be empty",
+					WARN_TITLE, WARNING_MESSAGE);
+			return false;
+		}
+
+		return true;
+	}
+
+	private void okPressed() {
+        if (checkPassword())
+            closeDialog();
+    }
+
+	private void cancelPressed() {
+		password = null;
+		closeDialog();
+	}
+
+	private void closeDialog() {
+		setVisible(false);
+		dispose();
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/KeyPairsTableModel.java
----------------------------------------------------------------------
diff --git a/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/KeyPairsTableModel.java b/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/KeyPairsTableModel.java
new file mode 100644
index 0000000..676a45f
--- /dev/null
+++ b/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/KeyPairsTableModel.java
@@ -0,0 +1,212 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.credentialmanager;
+
+import static javax.swing.JOptionPane.ERROR_MESSAGE;
+import static javax.swing.JOptionPane.showMessageDialog;
+import static org.apache.taverna.security.credentialmanager.CredentialManager.KeystoreType.KEYSTORE;
+import static org.apache.taverna.workbench.ui.credentialmanager.CMStrings.ERROR_TITLE;
+import static org.apache.taverna.workbench.ui.credentialmanager.CredentialManagerUI.KEY_PAIR_ENTRY_TYPE;
+
+import java.util.TreeMap;
+
+import javax.swing.JFrame;
+import javax.swing.table.AbstractTableModel;
+
+import org.apache.taverna.lang.observer.Observable;
+import org.apache.taverna.lang.observer.Observer;
+import org.apache.taverna.security.credentialmanager.CMException;
+import org.apache.taverna.security.credentialmanager.CredentialManager;
+import org.apache.taverna.security.credentialmanager.KeystoreChangedEvent;
+
+import org.apache.log4j.Logger;
+
+/**
+ * The table model used to display the Keystore's key pair entries.
+ *
+ * @author Alex Nenadic
+ */
+@SuppressWarnings("serial")
+public class KeyPairsTableModel extends AbstractTableModel implements Observer<KeystoreChangedEvent> {
+	private static final Logger logger = Logger.getLogger(KeyPairsTableModel.class);
+
+	/** Column names*/
+    private String[] columnNames;
+    /** Table data*/
+    private Object[][] data;
+	private CredentialManager credManager;
+
+    public KeyPairsTableModel(CredentialManager credentialManager) {
+        credManager = credentialManager;
+
+		if (credManager == null) {
+			/* Failed to instantiate Credential Manager - warn the user and exit */
+			String sMessage = "Failed to instantiate Credential Manager. ";
+			logger.error("CM GUI: " + sMessage);
+			showMessageDialog(new JFrame(), sMessage,
+					ERROR_TITLE, ERROR_MESSAGE);
+			return;
+		}
+
+       	data = new Object[0][0];
+        columnNames = new String[] {
+        	"Entry Type", // type of the Keystore entry
+        	"Owner", // owner's common name
+        	"Issuer", // issuer's common name
+        	"Serial Number", // public key certificate's serial number
+        	"Last Modified", // last modified date of the entry
+            "URLs", // the invisible column holding the list of URLs associated with this entry
+            "Alias" // the invisible column holding the actual alias in the Keystore
+        };
+
+		try {
+			load();
+		} catch (CMException cme) {
+			String sMessage = "Failed to load key pairs";
+			logger.error(sMessage, cme);
+			showMessageDialog(new JFrame(), sMessage,
+					ERROR_TITLE, ERROR_MESSAGE);
+			return;
+		}
+
+        // Start observing changes to the Keystore
+        credManager.addObserver(this);
+    }
+
+    /**
+     * Load the table model with the key pair entries from the Keystore.
+     */
+    public void load() throws CMException {
+    	// Place key pair entries' aliases in a tree map to sort them
+    	TreeMap<String, String> sortedAliases = new TreeMap<>();
+
+		for (String alias: credManager.getAliases(KEYSTORE))
+			/*
+			 * We are only interested in key pair entries here.
+			 * 
+			 * Alias for such entries is constructed as
+			 * "keypair#<CERT_SERIAL_NUMBER>#<CERT_COMMON_NAME>" where
+			 */
+			if (alias.startsWith("keypair#"))
+				sortedAliases.put(alias, alias);
+
+		// Create one table row for each key pair entry
+		data = new Object[sortedAliases.size()][7];
+
+		/*
+		 * Iterate through the sorted aliases (if any), retrieving the key pair
+		 * entries and populating the table model
+		 */
+		int iCnt = 0;
+		for (String alias : sortedAliases.values()) {
+			/*
+			 * Populate the type column - it is set with an integer but a custom
+			 * cell renderer will cause a suitable icon to be displayed
+			 */
+			data[iCnt][0] = KEY_PAIR_ENTRY_TYPE;
+
+			/*
+			 * Split the alias string to extract owner, issuer and serial number
+			 * alias =
+			 * "keypair#"<SUBJECT_COMMON_NAME>"#"<ISSUER_COMMON_NAME>"#"<SERIAL_NUMBER>
+			 */
+			String[] aliasComponents = alias.split("#");
+
+			// Populate the owner column extracted from the alias
+			data[iCnt][1] = aliasComponents[1];
+
+			// Populate the issuer column extracted from the alias
+			data[iCnt][2] = aliasComponents[2];
+
+			// Populate the serial number column extracted from the alias
+			data[iCnt][3] = aliasComponents[3];
+
+			// Populate the modified date column ("UBER" keystore type supports creation date)
+			//data[iCnt][4] = credManager.getEntryCreationDate(CredentialManager.KEYSTORE, alias);
+
+			// Populate the invisible URLs list column
+			//data[iCnt][5] = credManager.getServiceURLsForKeyPair(alias);
+
+			// Populate the invisible alias column
+			data[iCnt][6] = alias;
+
+			iCnt++;
+		}
+
+		fireTableDataChanged();
+    }
+
+	/**
+	 * Get the number of columns in the table.
+	 */
+	@Override
+	public int getColumnCount() {
+		return columnNames.length;
+	}
+
+	/**
+	 * Get the number of rows in the table.
+	 */
+	@Override
+	public int getRowCount() {
+		return data.length;
+	}
+
+	/**
+	 * Get the name of the column at the given position.
+	 */
+	@Override
+	public String getColumnName(int iCol) {
+		return columnNames[iCol];
+	}
+
+	/**
+	 * Get the cell value at the given row and column position.
+	 */
+	@Override
+	public Object getValueAt(int iRow, int iCol) {
+		return data[iRow][iCol];
+	}
+
+	/**
+	 * Get the class at of the cells at the given column position.
+	 */
+	@Override
+	public Class<? extends Object> getColumnClass(int iCol) {
+		return getValueAt(0, iCol).getClass();
+	}
+
+	/**
+	 * Is the cell at the given row and column position editable?
+	 */
+	@Override
+	public boolean isCellEditable(int iRow, int iCol) {
+		// The table is always read-only
+		return false;
+	}
+
+	@Override
+	public void notify(Observable<KeystoreChangedEvent> sender,
+			KeystoreChangedEvent message) throws Exception {
+		// reload the table
+		if (message.keystoreType.equals(KEYSTORE))
+			load();
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/NewEditPasswordEntryDialog.java
----------------------------------------------------------------------
diff --git a/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/NewEditPasswordEntryDialog.java b/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/NewEditPasswordEntryDialog.java
new file mode 100644
index 0000000..829144a
--- /dev/null
+++ b/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/NewEditPasswordEntryDialog.java
@@ -0,0 +1,396 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.credentialmanager;
+
+import static java.awt.BorderLayout.CENTER;
+import static java.awt.BorderLayout.SOUTH;
+import static java.awt.GridBagConstraints.HORIZONTAL;
+import static java.awt.GridBagConstraints.NONE;
+import static java.awt.GridBagConstraints.WEST;
+import static javax.swing.JOptionPane.ERROR_MESSAGE;
+import static javax.swing.JOptionPane.WARNING_MESSAGE;
+import static javax.swing.JOptionPane.showMessageDialog;
+import static org.apache.taverna.workbench.ui.credentialmanager.CMStrings.ALERT_TITLE;
+import static org.apache.taverna.workbench.ui.credentialmanager.CMStrings.ERROR_TITLE;
+import static org.apache.taverna.workbench.ui.credentialmanager.CMStrings.WARN_TITLE;
+
+import java.awt.BorderLayout;
+import java.awt.FlowLayout;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.Insets;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.List;
+
+import javax.swing.JButton;
+import javax.swing.JDialog;
+import javax.swing.JFrame;
+import javax.swing.JLabel;
+import javax.swing.JPasswordField;
+import javax.swing.JTextField;
+import javax.swing.JPanel;
+import javax.swing.border.CompoundBorder;
+import javax.swing.border.EmptyBorder;
+import javax.swing.border.EtchedBorder;
+
+import org.apache.log4j.Logger;
+
+import org.apache.taverna.security.credentialmanager.CMException;
+import org.apache.taverna.security.credentialmanager.CredentialManager;
+import org.apache.taverna.workbench.helper.NonBlockedHelpEnabledDialog;
+
+/**
+ * Dialog used for editing or entering new service URI, username or password for
+ * a password entry.
+ *
+ * @author Alex Nenadic
+ */
+@SuppressWarnings("serial")
+public class NewEditPasswordEntryDialog extends NonBlockedHelpEnabledDialog
+{
+	private static final Logger logger = Logger
+			.getLogger(NewEditPasswordEntryDialog.class);
+	/** 'Edit' mode constant - the dialog is in the 'edit' entry mode */
+	private static final String EDIT_MODE = "EDIT";
+	/** 'New' mode constant - the dialog is in the 'new' entry mode */
+	private static final String NEW_MODE = "NEW";
+
+	/**
+	 * Mode of this dialog - {@link #NEW_MODE} for entering new password entry
+	 * and {@link #EDIT_MODE} for editting an existing password entry
+	 */
+	String mode;
+	/** Service URI field */
+	private JTextField serviceURIField;
+	/** Username field */
+	private JTextField usernameField;
+	/** First password entry field */
+	private JPasswordField passwordField;
+	/** Password confirmation entry field */
+	private JPasswordField passwordConfirmField;
+	/** Stores service URI entered */
+	private URI serviceURI;
+	/** Stores previous service URI for {@link #EDIT_MODE} */
+	private URI serviceURIOld;
+	/** Stores username entered */
+	private String username;
+    /** Stores password entered*/
+    private String password;
+    private CredentialManager credentialManager;
+
+	public NewEditPasswordEntryDialog(JFrame parent, String title,
+			boolean modal, URI currentURI, String currentUsername,
+			String currentPassword, CredentialManager credentialManager) {
+		super(parent, title, modal);
+		serviceURI = currentURI;
+		username = currentUsername;
+		password = currentPassword;
+		this.credentialManager = credentialManager;
+		if (serviceURI == null && username == null && password == null) {
+			// if passed values are all null
+        	mode = NEW_MODE; // dialog is for entering a new password entry
+		} else {
+            mode = EDIT_MODE; // dialog is for editing an existing entry
+            serviceURIOld = currentURI;
+        }
+        initComponents();
+    }
+
+	public NewEditPasswordEntryDialog(JDialog parent, String title,
+			boolean modal, URI currentURI, String currentUsername,
+			String currentPassword, CredentialManager credentialManager) {
+		super(parent, title, modal);
+        serviceURI = currentURI;
+        username = currentUsername;
+        password = currentPassword;
+		this.credentialManager = credentialManager;
+		if (serviceURI == null && username == null && password == null) {
+			// if passed values are all null
+        	mode = NEW_MODE; // dialog is for entering new password entry
+		} else {
+            mode = EDIT_MODE; // dialog is for editing existing entry
+            serviceURIOld = currentURI;
+        }
+        initComponents();
+    }
+
+	private void initComponents() {
+		getContentPane().setLayout(new BorderLayout());
+
+        JLabel serviceURILabel = new JLabel("Service URI");
+        serviceURILabel.setBorder(new EmptyBorder(0,5,0,0));
+
+        JLabel usernameLabel = new JLabel("Username");
+        usernameLabel.setBorder(new EmptyBorder(0,5,0,0));
+
+        JLabel passwordLabel = new JLabel("Password");
+        passwordLabel.setBorder(new EmptyBorder(0,5,0,0));
+
+        JLabel passwordConfirmLabel = new JLabel("Confirm password");
+        passwordConfirmLabel.setBorder(new EmptyBorder(0,5,0,0));
+
+        serviceURIField = new JTextField();
+        //jtfServiceURI.setBorder(new EmptyBorder(0,0,0,5));
+
+        usernameField = new JTextField(15);
+        //jtfUsername.setBorder(new EmptyBorder(0,0,0,5));
+
+        passwordField = new JPasswordField(15);
+        //jpfFirstPassword.setBorder(new EmptyBorder(0,0,0,5));
+
+        passwordConfirmField = new JPasswordField(15);
+        //jpfConfirmPassword.setBorder(new EmptyBorder(0,0,0,5));
+
+        //If in EDIT_MODE - populate the fields with current values
+		if (mode.equals(EDIT_MODE)) {
+			serviceURIField.setText(serviceURI.toASCIIString());
+			usernameField.setText(username);
+			passwordField.setText(password);
+			passwordConfirmField.setText(password);
+		}
+
+		JButton okButton = new JButton("OK");
+		okButton.addActionListener(new ActionListener() {
+			@Override
+			public void actionPerformed(ActionEvent evt) {
+				okPressed();
+			}
+		});
+
+		JButton cancelButton = new JButton("Cancel");
+		cancelButton.addActionListener(new ActionListener() {
+			@Override
+			public void actionPerformed(ActionEvent evt) {
+				cancelPressed();
+			}
+		});
+
+		JPanel passwordPanel = new JPanel(new GridBagLayout());
+
+		GridBagConstraints gbc = new GridBagConstraints();
+		gbc.weighty = 0.0;
+
+		gbc.weightx = 0.0;
+		gbc.gridx = 0;
+		gbc.gridy = 0;
+		gbc.fill = NONE;
+		gbc.anchor = WEST;
+		gbc.insets = new Insets(5, 10, 0, 0);
+        passwordPanel.add(serviceURILabel, gbc);
+
+		gbc.weightx = 1.0;
+		gbc.gridx = 1;
+		gbc.gridy = 0;
+		gbc.fill = HORIZONTAL;
+		gbc.anchor = WEST;
+		gbc.insets = new Insets(5, 10, 0, 5);
+        passwordPanel.add(serviceURIField, gbc);
+
+		gbc.weightx = 0.0;
+		gbc.gridx = 0;
+		gbc.gridy = 1;
+		gbc.fill = NONE;
+		gbc.anchor = WEST;
+		gbc.insets = new Insets(5, 10, 0, 0);
+        passwordPanel.add(usernameLabel, gbc);
+
+		gbc.weightx = 1.0;
+		gbc.gridx = 1;
+		gbc.gridy = 1;
+		gbc.fill = HORIZONTAL;
+		gbc.anchor = WEST;
+		gbc.insets = new Insets(5, 10, 0, 5);
+        passwordPanel.add(usernameField, gbc);
+
+		gbc.weightx = 0.0;
+		gbc.gridx = 0;
+		gbc.gridy = 2;
+		gbc.fill = NONE;
+		gbc.anchor = WEST;
+		gbc.insets = new Insets(5, 10, 0, 0);
+        passwordPanel.add(passwordLabel, gbc);
+
+		gbc.weightx = 1.0;
+		gbc.gridx = 1;
+		gbc.gridy = 2;
+		gbc.fill = HORIZONTAL;
+		gbc.anchor = WEST;
+		gbc.insets = new Insets(5, 10, 0, 5);
+        passwordPanel.add(passwordField, gbc);
+
+		gbc.weightx = 0.0;
+		gbc.gridx = 0;
+		gbc.gridy = 3;
+		gbc.fill = NONE;
+		gbc.anchor = WEST;
+		gbc.insets = new Insets(5, 10, 0, 0);
+        passwordPanel.add(passwordConfirmLabel, gbc);
+
+		gbc.weightx = 1.0;
+		gbc.gridx = 1;
+		gbc.gridy = 3;
+		gbc.fill = HORIZONTAL;
+		gbc.anchor = WEST;
+		gbc.insets = new Insets(5, 10, 0, 5);
+		passwordPanel.add(passwordConfirmField, gbc);
+
+		passwordPanel.setBorder(new CompoundBorder(new EmptyBorder(10, 10, 10,
+				10), new EtchedBorder()));
+
+		JPanel buttonsPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
+		buttonsPanel.add(okButton);
+		buttonsPanel.add(cancelButton);
+
+		getContentPane().add(passwordPanel, CENTER);
+		getContentPane().add(buttonsPanel, SOUTH);
+
+		addWindowListener(new WindowAdapter() {
+			@Override
+			public void windowClosing(WindowEvent evt) {
+				closeDialog();
+			}
+		});
+
+        //setResizable(false);
+        getRootPane().setDefaultButton(okButton);
+        pack();
+    }
+
+	/**
+	 * Get the username entered in the dialog.
+	 */
+	public String getUsername() {
+		return username;
+	}
+
+	/**
+	 * Get the service URI entered in the dialog.
+	 */
+	public URI getServiceURI() {
+		return serviceURI;
+	}
+
+	/**
+	 * Get the password entered in the dialog.
+	 */
+	public String getPassword() {
+		return password;
+	}
+
+	/**
+	 * Checks that the user has entered a non-empty service URI, a non-empty
+	 * username, a non-empty password and that an entry with the same URI
+	 * already does not already exist in the Keystore. Store the new password.
+	 */
+	private boolean checkControls() {
+		String serviceURIString = new String(serviceURIField.getText());
+		if (serviceURIString.isEmpty()) {
+			showMessageDialog(this, "Service URI cannot be empty",
+					WARN_TITLE, WARNING_MESSAGE);
+			return false;
+		}
+    	try {
+			serviceURI = new URI(serviceURIString);
+		} catch (URISyntaxException e) {
+			showMessageDialog(this, "Service URI is not a valid URI",
+					WARN_TITLE, WARNING_MESSAGE);
+			return false;
+		}
+
+		username = new String(usernameField.getText());
+		if (username.isEmpty()) {
+			showMessageDialog(this, "Username cannot be empty", WARN_TITLE,
+					WARNING_MESSAGE);
+			return false;
+		}
+
+		String firstPassword = new String(passwordField.getPassword());
+		String confirmPassword = new String(passwordConfirmField.getPassword());
+
+		if (!firstPassword.equals(confirmPassword)) {
+			// passwords do not match
+			showMessageDialog(this, "Passwords do not match", WARN_TITLE,
+					WARNING_MESSAGE);
+			return false;
+		}
+		if (firstPassword.isEmpty()) {
+			// passwords match but are empty
+			showMessageDialog(this, "Password cannot be empty", WARN_TITLE,
+					WARNING_MESSAGE);
+			return false;
+		}
+
+		// passwords the same and non-empty
+		password = firstPassword;
+
+		// Check if the entered service URL is already associated with another password entry in the Keystore
+    	List<URI> uriList = null;
+    	try {
+			uriList = credentialManager.getServiceURIsForAllUsernameAndPasswordPairs();
+		} catch (CMException cme) {
+			// Failed to instantiate Credential Manager - warn the user and exit
+			String exMessage = "Failed to instantiate Credential Manager to check for duplicate service URIs.";
+			logger.error(exMessage, cme);
+			showMessageDialog(new JFrame(), exMessage, ERROR_TITLE,
+					ERROR_MESSAGE);
+			return false;
+		}
+
+       	if (uriList != null) { // should not be null really (although can be empty). Check anyway.
+       		if (mode.equals(EDIT_MODE)) // edit mode
+            	// Remove the current entry's service URI from the list
+                uriList.remove(serviceURIOld);
+
+   			if (uriList.contains(serviceURI)) { // found another entry for this service URI
+        		// Warn the user and exit
+				showMessageDialog(
+						this,
+						"The entered service URI is already associated with another password entry",
+						ALERT_TITLE, WARNING_MESSAGE);
+				return false;
+			}
+		}
+
+		return true;
+	}
+
+	private void okPressed() {
+		if (checkControls())
+			closeDialog();
+	}
+
+	private void cancelPressed() {
+    	// Set all fields to null to indicate that cancel button was pressed
+		serviceURI = null;
+		username = null;
+		password = null;
+		closeDialog();
+	}
+
+	private void closeDialog() {
+		setVisible(false);
+		dispose();
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/NewKeyPairEntryDialog.java
----------------------------------------------------------------------
diff --git a/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/NewKeyPairEntryDialog.java b/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/NewKeyPairEntryDialog.java
new file mode 100644
index 0000000..b2cefa8
--- /dev/null
+++ b/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/NewKeyPairEntryDialog.java
@@ -0,0 +1,303 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.credentialmanager;
+
+import static java.awt.BorderLayout.CENTER;
+import static java.awt.BorderLayout.SOUTH;
+import static java.awt.BorderLayout.WEST;
+import static java.awt.Font.PLAIN;
+import static javax.swing.BoxLayout.Y_AXIS;
+import static javax.swing.JOptionPane.ERROR_MESSAGE;
+import static javax.swing.JOptionPane.WARNING_MESSAGE;
+import static javax.swing.JOptionPane.showMessageDialog;
+import static javax.swing.ListSelectionModel.SINGLE_SELECTION;
+import static javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED;
+import static javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED;
+import static org.apache.taverna.workbench.ui.credentialmanager.CMStrings.ALERT_TITLE;
+import static org.apache.taverna.workbench.ui.credentialmanager.CMStrings.ERROR_TITLE;
+
+import java.awt.BorderLayout;
+import java.awt.FlowLayout;
+import java.awt.Font;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import java.security.GeneralSecurityException;
+import java.security.Key;
+import java.security.KeyStore;
+import java.security.cert.Certificate;
+import java.security.cert.X509Certificate;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.List;
+
+import javax.swing.BoxLayout;
+import javax.swing.JButton;
+import javax.swing.JDialog;
+import javax.swing.JFrame;
+import javax.swing.JLabel;
+import javax.swing.JList;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.border.EmptyBorder;
+import javax.swing.event.ListSelectionEvent;
+import javax.swing.event.ListSelectionListener;
+
+import org.apache.taverna.security.credentialmanager.CMException;
+import org.apache.taverna.security.credentialmanager.DistinguishedNameParser;
+import org.apache.taverna.workbench.helper.NonBlockedHelpEnabledDialog;
+
+/**
+ * Allows the user import a key pair from a PKCS #12 file (keystore).
+ */
+@SuppressWarnings("serial")
+class NewKeyPairEntryDialog extends NonBlockedHelpEnabledDialog {
+	//private static final Logger logger = Logger.getLogger(NewKeyPairEntryDialog.class);
+
+	/** List of key pairs available for import */
+	private JList<String> keyPairsJList;
+	/** PKCS #12 keystore */
+	private KeyStore pkcs12KeyStore;
+	/** Private key part of the key pair chosen by the user for import */
+	private Key privateKey;
+	/** Certificate chain part of the key pair chosen by the user for import */
+	private Certificate[] certificateChain;
+	/** Key pair alias to be used for this entry in the Keystore */
+	private String alias;
+	private final DistinguishedNameParser dnParser;
+
+	public NewKeyPairEntryDialog(JFrame parent, String title, boolean modal,
+			KeyStore pkcs12KeyStore, DistinguishedNameParser dnParser)
+			throws CMException {
+		super(parent, title, modal);
+		this.pkcs12KeyStore = pkcs12KeyStore;
+		this.dnParser = dnParser;
+		initComponents();
+	}
+
+	public NewKeyPairEntryDialog(JDialog parent, String title, boolean modal,
+			KeyStore pkcs12KeyStore, DistinguishedNameParser dnParser)
+			throws CMException {
+		super(parent, title, modal);
+		this.pkcs12KeyStore = pkcs12KeyStore;
+		this.dnParser = dnParser;
+		initComponents();
+	}
+
+	/**
+	 * Get the private part of the key pair.
+	 */
+	public Key getPrivateKey() {
+		return privateKey;
+	}
+
+	/**
+	 * Get the certificate chain part of the key pair.
+	 */
+	public Certificate[] getCertificateChain() {
+		return certificateChain;
+	}
+
+	/**
+	 * Get the keystore alias of the key pair.
+	 */
+	public String getAlias() {
+		return alias;
+	}
+
+	private void initComponents() throws CMException {
+		// Instructions
+		JLabel instructionsLabel = new JLabel("Select a key pair to import:");
+		instructionsLabel.setFont(new Font(null, PLAIN, 11));
+		instructionsLabel.setBorder(new EmptyBorder(5, 5, 5, 5));
+		JPanel instructionsPanel = new JPanel(new BorderLayout());
+		instructionsPanel.add(instructionsLabel, WEST);
+
+		// Import button
+		final JButton importButton = new JButton("Import");
+		importButton.setEnabled(false);
+		importButton.addActionListener(new ActionListener() {
+			@Override
+			public void actionPerformed(ActionEvent evt) {
+				importPressed();
+			}
+		});
+
+		// Certificate details button
+		final JButton certificateDetailsButton = new JButton("Details");
+		certificateDetailsButton.setEnabled(false);
+		certificateDetailsButton.addActionListener(new ActionListener() {
+			@Override
+			public void actionPerformed(ActionEvent evt) {
+				certificateDetailsPressed();
+			}
+		});
+
+        // List to hold keystore's key pairs
+		keyPairsJList = new JList<>();
+		keyPairsJList.setSelectionMode(SINGLE_SELECTION);
+		keyPairsJList.addListSelectionListener(new ListSelectionListener() {
+			@Override
+			public void valueChanged(ListSelectionEvent evt) {
+				boolean enabled = keyPairsJList.getSelectedIndex() >= 0;
+				importButton.setEnabled(enabled);
+				certificateDetailsButton.setEnabled(enabled);
+			}
+		});
+
+        // Put the key list into a scroll pane
+		JScrollPane keyPairsScrollPane = new JScrollPane(keyPairsJList,
+				VERTICAL_SCROLLBAR_AS_NEEDED, HORIZONTAL_SCROLLBAR_AS_NEEDED);
+		keyPairsScrollPane.getViewport().setBackground(
+				keyPairsJList.getBackground());
+        
+        JPanel keyPairsPanel = new JPanel();
+        keyPairsPanel.setLayout(new BoxLayout(keyPairsPanel, Y_AXIS));
+		keyPairsPanel.setBorder(new EmptyBorder(10, 10, 10, 10));
+
+		instructionsPanel.setAlignmentY(LEFT_ALIGNMENT);
+		keyPairsPanel.add(instructionsPanel);
+		keyPairsScrollPane.setAlignmentY(LEFT_ALIGNMENT);
+		keyPairsPanel.add(keyPairsScrollPane);
+
+		// Cancel button
+		final JButton cancelButton = new JButton("Cancel");
+		cancelButton.addActionListener(new ActionListener() {
+			@Override
+			public void actionPerformed(ActionEvent evt) {
+				cancelPressed();
+			}
+		});
+
+		JPanel buttonsPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
+		buttonsPanel.add(certificateDetailsButton);
+		buttonsPanel.add(importButton);
+		buttonsPanel.add(cancelButton);
+
+		getContentPane().setLayout(new BorderLayout());
+		getContentPane().add(keyPairsPanel, CENTER);
+		getContentPane().add(buttonsPanel, SOUTH);
+
+		// Populate the list
+		populateKeyPairList();
+
+		addWindowListener(new WindowAdapter() {
+			@Override
+			public void windowClosing(WindowEvent evt) {
+				closeDialog();
+			}
+		});
+
+		setResizable(false);
+		getRootPane().setDefaultButton(importButton);
+		pack();
+	}
+
+	/**
+	 * Populate the key pair list with the PKCS #12 keystore's key pair aliases.
+	 */
+	private void populateKeyPairList() throws CMException {
+		try {
+			List<String> keyPairAliases = new ArrayList<>();
+
+			Enumeration<String> aliases = pkcs12KeyStore.aliases();
+			while (aliases.hasMoreElements()) {
+				String alias = aliases.nextElement();
+
+				if (pkcs12KeyStore.isKeyEntry(alias)) {
+					pkcs12KeyStore.getKey(alias, new char[] {});
+					Certificate[] certs = pkcs12KeyStore
+							.getCertificateChain(alias);
+					if (certs != null && certs.length != 0)
+						keyPairAliases.add(alias);
+				}
+			}
+
+            if (!keyPairAliases.isEmpty()) {
+                keyPairsJList.setListData(keyPairAliases.toArray(new String[0]));
+                keyPairsJList.setSelectedIndex(0);
+			} else
+                // No key pairs were found - warn the user
+				showMessageDialog(this,
+						"No private key pairs were found in the file",
+						ALERT_TITLE, WARNING_MESSAGE);
+		} catch (GeneralSecurityException ex) {
+            throw new CMException("Problem occured while reading the PKCS #12 file.",
+                ex);
+        }
+    }
+
+	/**
+	 * Display the selected key pair's certificate.
+	 */
+	private void certificateDetailsPressed() {
+		try {
+			String alias = (String) keyPairsJList.getSelectedValue();
+
+			// Convert the certificate object into an X509Certificate object.
+			X509Certificate cert = dnParser.convertCertificate(pkcs12KeyStore
+					.getCertificate(alias));
+
+			ViewCertDetailsDialog viewCertificateDialog = new ViewCertDetailsDialog(
+					this, "Certificate details", true, (X509Certificate) cert,
+					null, dnParser);
+			viewCertificateDialog.setLocationRelativeTo(this);
+			viewCertificateDialog.setVisible(true);
+		} catch (Exception ex) {
+			showMessageDialog(this,
+					"Failed to obtain certificate details to show",
+					ALERT_TITLE, WARNING_MESSAGE);
+			closeDialog();
+		}
+	}
+
+	public void importPressed() {
+		String alias = (String) keyPairsJList.getSelectedValue();
+		try {
+			privateKey = pkcs12KeyStore.getKey(alias, new char[] {});
+			certificateChain = pkcs12KeyStore.getCertificateChain(alias);
+			this.alias = alias;
+		} catch (Exception ex) {
+			showMessageDialog(
+					this,
+					"Failed to load the private key and certificate chain from the PKCS #12 file.",
+					ERROR_TITLE, ERROR_MESSAGE);
+		}
+
+        closeDialog();
+    }
+
+	public void cancelPressed() {
+		/*
+		 * Set everything to null, just in case some of the values have been set
+		 * previously and the user pressed 'cancel' after that.
+		 */
+		privateKey = null;
+		certificateChain = null;
+		closeDialog();
+	}
+
+	private void closeDialog() {
+		setVisible(false);
+		dispose();
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/NewTrustCertsDialog.java
----------------------------------------------------------------------
diff --git a/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/NewTrustCertsDialog.java b/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/NewTrustCertsDialog.java
new file mode 100644
index 0000000..dc342a1
--- /dev/null
+++ b/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/NewTrustCertsDialog.java
@@ -0,0 +1,247 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.credentialmanager;
+
+import static java.awt.BorderLayout.CENTER;
+import static java.awt.BorderLayout.SOUTH;
+import static java.awt.BorderLayout.WEST;
+import static java.awt.Font.PLAIN;
+import static javax.security.auth.x500.X500Principal.RFC2253;
+import static javax.swing.BoxLayout.Y_AXIS;
+import static javax.swing.JOptionPane.WARNING_MESSAGE;
+import static javax.swing.JOptionPane.showMessageDialog;
+import static javax.swing.ListSelectionModel.MULTIPLE_INTERVAL_SELECTION;
+import static javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED;
+import static javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED;
+import static org.apache.taverna.workbench.ui.credentialmanager.CMStrings.ALERT_TITLE;
+
+import java.awt.BorderLayout;
+import java.awt.FlowLayout;
+import java.awt.Font;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import java.security.cert.X509Certificate;
+import java.util.ArrayList;
+
+import javax.swing.BoxLayout;
+import javax.swing.JButton;
+import javax.swing.JDialog;
+import javax.swing.JFrame;
+import javax.swing.JLabel;
+import javax.swing.JList;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.border.CompoundBorder;
+import javax.swing.border.EmptyBorder;
+import javax.swing.border.EtchedBorder;
+import javax.swing.event.ListSelectionEvent;
+import javax.swing.event.ListSelectionListener;
+
+import org.apache.taverna.security.credentialmanager.DistinguishedNameParser;
+import org.apache.taverna.security.credentialmanager.ParsedDistinguishedName;
+import org.apache.taverna.workbench.helper.NonBlockedHelpEnabledDialog;
+
+/**
+ * Allows the user to import one or more trusted certificates from a file.
+ */
+@SuppressWarnings("serial")
+public class NewTrustCertsDialog extends NonBlockedHelpEnabledDialog {
+	private JList<String> trustedCertsJList;
+	/** List of trusted certs read from the file and available for import */
+	private ArrayList<X509Certificate> availableTrustedCerts = new ArrayList<>();
+	/** List of trusted certs selected for import */
+	private ArrayList<X509Certificate> selectedTrustedCerts;
+	private final DistinguishedNameParser dnParser;
+
+	public NewTrustCertsDialog(JFrame parent, String title, boolean modal,
+			ArrayList<X509Certificate> lCerts, DistinguishedNameParser dnParser) {
+		super(parent, title, modal);
+		availableTrustedCerts = lCerts;
+		this.dnParser = dnParser;
+		initComponents();
+	}
+
+	public NewTrustCertsDialog(JDialog parent, String title, boolean modal,
+			ArrayList<X509Certificate> lCerts, DistinguishedNameParser dnParser) {
+		super(parent, title, modal);
+		availableTrustedCerts = lCerts;
+		this.dnParser = dnParser;
+		initComponents();
+	}
+
+	private void initComponents() {
+		// Instructions
+		JLabel instructionsLabel = new JLabel(
+				"Select one or more certificates for import:");
+		instructionsLabel.setFont(new Font(null, PLAIN, 11));
+		instructionsLabel.setBorder(new EmptyBorder(5, 5, 5, 5));
+		JPanel instructionsPanel = new JPanel(new BorderLayout());
+		instructionsPanel.add(instructionsLabel, WEST);
+
+		// Import button
+		final JButton importButton = new JButton("Import");
+		importButton.setEnabled(false);
+		importButton.addActionListener(new ActionListener() {
+			@Override
+			public void actionPerformed(ActionEvent evt) {
+				importPressed();
+			}
+		});
+
+		// Certificate details button
+		final JButton certificateDetailsButton = new JButton(
+				"Certificate Details");
+		certificateDetailsButton.setEnabled(false);
+		certificateDetailsButton.addActionListener(new ActionListener() {
+			@Override
+			public void actionPerformed(ActionEvent evt) {
+				certificateDetailsPressed();
+			}
+		});
+
+		// List with trusted certs' aliases
+		trustedCertsJList = new JList<>();
+		trustedCertsJList.setSelectionMode(MULTIPLE_INTERVAL_SELECTION);
+		trustedCertsJList.addListSelectionListener(new ListSelectionListener() {
+			@Override
+			public void valueChanged(ListSelectionEvent evt) {
+				boolean enabled = trustedCertsJList.getSelectedIndex() >= 0;
+				importButton.setEnabled(enabled);
+				certificateDetailsButton.setEnabled(enabled);
+			}
+		});
+		// Populate the list - get the certificate subjects' CNs
+		ArrayList<String> cns = new ArrayList<>();
+		for (int i = 0; i < availableTrustedCerts.size(); i++) {
+			String subjectDN = ((X509Certificate) availableTrustedCerts.get(i))
+					.getSubjectX500Principal().getName(RFC2253);
+			ParsedDistinguishedName parsedDN = dnParser.parseDN(subjectDN);
+			String subjectCN = parsedDN.getCN();
+			cns.add(i, subjectCN);
+		}
+		trustedCertsJList.setListData(cns.toArray(new String[0]));
+		trustedCertsJList.setSelectedIndex(0);
+
+		// Put the list into a scroll pane
+		JScrollPane trustedCertsScrollPanel = new JScrollPane(
+				trustedCertsJList, VERTICAL_SCROLLBAR_AS_NEEDED,
+				HORIZONTAL_SCROLLBAR_AS_NEEDED);
+		trustedCertsScrollPanel.getViewport().setBackground(
+				trustedCertsJList.getBackground());
+
+		JPanel trustedCertsPanel = new JPanel();
+		trustedCertsPanel.setLayout(new BoxLayout(trustedCertsPanel, Y_AXIS));
+		trustedCertsPanel.setBorder(new CompoundBorder(new CompoundBorder(
+				new EmptyBorder(5, 5, 5, 5), new EtchedBorder()),
+				new EmptyBorder(5, 5, 5, 5)));
+
+		instructionsPanel.setAlignmentY(LEFT_ALIGNMENT);
+		trustedCertsPanel.add(instructionsPanel);
+		trustedCertsScrollPanel.setAlignmentY(LEFT_ALIGNMENT);
+		trustedCertsPanel.add(trustedCertsScrollPanel);
+		certificateDetailsButton.setAlignmentY(RIGHT_ALIGNMENT);
+		trustedCertsPanel.add(certificateDetailsButton);
+
+		// Cancel button
+		final JButton cancelButton = new JButton("Cancel");
+		cancelButton.addActionListener(new ActionListener() {
+			@Override
+			public void actionPerformed(ActionEvent evt) {
+				cancelPressed();
+			}
+		});
+
+		JPanel jpButtons = new JPanel(new FlowLayout(FlowLayout.CENTER));
+		jpButtons.add(importButton);
+		jpButtons.add(cancelButton);
+
+		getContentPane().setLayout(new BorderLayout());
+		getContentPane().add(trustedCertsPanel, CENTER);
+		getContentPane().add(jpButtons, SOUTH);
+
+		addWindowListener(new WindowAdapter() {
+			@Override
+			public void windowClosing(WindowEvent evt) {
+				closeDialog();
+			}
+		});
+
+		setResizable(false);
+		getRootPane().setDefaultButton(importButton);
+		pack();
+	}
+
+	/**
+	 * Shows the selected key pair's certificate.
+	 */
+	private void certificateDetailsPressed() {
+		try {
+			int i = trustedCertsJList.getSelectedIndex();
+
+			X509Certificate cert = (X509Certificate) availableTrustedCerts
+					.get(i);
+
+			ViewCertDetailsDialog viewCertificateDialog = new ViewCertDetailsDialog(
+					this, "Certificate details", true, cert, null, dnParser);
+			viewCertificateDialog.setLocationRelativeTo(this);
+			viewCertificateDialog.setVisible(true);
+		} catch (Exception ex) {
+			showMessageDialog(this,
+					"Failed to obtain certificate details to show",
+					ALERT_TITLE, WARNING_MESSAGE);
+			closeDialog();
+		}
+	}
+
+	/**
+	 * Get the trusted certificates selected for import.
+	 */
+	public ArrayList<X509Certificate> getTrustedCertificates() {
+		return selectedTrustedCerts;
+	}
+
+	/**
+	 * Store the selected trusted certs.
+	 */
+	public void importPressed() {
+		int[] selectedValues = trustedCertsJList.getSelectedIndices();
+		selectedTrustedCerts = new ArrayList<>();
+		for (int i = 0; i < selectedValues.length; i++)
+			selectedTrustedCerts.add(availableTrustedCerts
+					.get(selectedValues[i]));
+		closeDialog();
+	}
+
+	public void cancelPressed() {
+		/*
+		 * Set selectedTrustCerts to null to indicate that user has cancelled
+		 * the import
+		 */
+		selectedTrustedCerts = null;
+		closeDialog();
+	}
+
+	private void closeDialog() {
+		setVisible(false);
+		dispose();
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/PasswordsTableModel.java
----------------------------------------------------------------------
diff --git a/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/PasswordsTableModel.java b/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/PasswordsTableModel.java
new file mode 100644
index 0000000..30af7b1
--- /dev/null
+++ b/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/PasswordsTableModel.java
@@ -0,0 +1,226 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.credentialmanager;
+
+import static javax.swing.JOptionPane.ERROR_MESSAGE;
+import static javax.swing.JOptionPane.showMessageDialog;
+import static org.apache.taverna.security.credentialmanager.CredentialManager.KeystoreType.KEYSTORE;
+import static org.apache.taverna.workbench.ui.credentialmanager.CMStrings.ERROR_TITLE;
+import static org.apache.taverna.workbench.ui.credentialmanager.CredentialManagerUI.PASSWORD_ENTRY_TYPE;
+
+import java.net.URI;
+import java.util.TreeMap;
+
+import javax.swing.JFrame;
+import javax.swing.table.AbstractTableModel;
+
+import org.apache.taverna.lang.observer.Observable;
+import org.apache.taverna.lang.observer.Observer;
+import org.apache.taverna.security.credentialmanager.CMException;
+import org.apache.taverna.security.credentialmanager.CredentialManager;
+import org.apache.taverna.security.credentialmanager.KeystoreChangedEvent;
+import org.apache.taverna.security.credentialmanager.UsernamePassword;
+
+import org.apache.log4j.Logger;
+
+/**
+ * The table model used to display the Keystore's username/password pair
+ * entries.
+ * 
+ * @author Alex Nenadic
+ */
+@SuppressWarnings("serial")
+public class PasswordsTableModel extends AbstractTableModel implements
+		Observer<KeystoreChangedEvent> {
+	private static final Logger logger = Logger
+			.getLogger(PasswordsTableModel.class);
+
+	// Column names
+	private String[] columnNames;
+	// Table data
+	private Object[][] data;
+	private CredentialManager credManager;
+
+	public PasswordsTableModel(CredentialManager credentialManager) {
+		credManager = credentialManager;
+		if (credentialManager == null) {
+			// Failed to instantiate Credential Manager - warn the user and exit
+			String sMessage = "Failed to instantiate Credential Manager. ";
+			logger.error("CM GUI: " + sMessage);
+			showMessageDialog(new JFrame(), sMessage, ERROR_TITLE,
+					ERROR_MESSAGE);
+			return;
+		}
+
+		data = new Object[0][0];
+		columnNames = new String[] { "Entry Type", // type of the Keystore entry
+				"Service URL", // the service url, part of the actual alias in
+								// the Keystore
+				"Username", // username for the service, part of the password
+							// entry in the Keystore
+				"Last Modified", // last modified date of the entry
+				"Password", // the invisible column holding the password value
+							// of the password entry in the Keystore
+				"Alias" // the invisible column holding the Keystore alias of
+						// the entry
+		};
+
+		try {
+			load();
+		} catch (CMException cme) {
+			String sMessage = "Failed to load username and password pairs";
+			logger.error(sMessage);
+			showMessageDialog(new JFrame(), sMessage, ERROR_TITLE,
+					ERROR_MESSAGE);
+			return;
+		}
+
+		// Start observing changes to the Keystore
+		credManager.addObserver(this);
+	}
+
+	/**
+	 * Load the PasswordsTableModel with the password entries from the Keystore.
+	 */
+	public void load() throws CMException {
+		// Place password entries' aliases in a tree map to sort them
+		TreeMap<String, String> aliases = new TreeMap<>();
+
+		for (String alias : credManager.getAliases(KEYSTORE))
+			/*
+			 * We are only interested in username/password entries here. Alias
+			 * for such entries is constructed as "password#"<SERVICE_URL> where
+			 * service URL is the service this username/password pair is to be
+			 * used for.
+			 */
+			if (alias.startsWith("password#"))
+				aliases.put(alias, alias);
+
+		// Create one table row for each password entry
+		data = new Object[aliases.size()][6];
+
+		/*
+		 * Iterate through the sorted aliases, retrieving the password entries
+		 * and populating the table model
+		 */
+		int iCnt = 0;
+		for (String alias : aliases.values()) {
+			/*
+			 * Populate the type column - it is set with an integer but a custom
+			 * cell renderer will cause a suitable icon to be displayed
+			 */
+			data[iCnt][0] = PASSWORD_ENTRY_TYPE;
+
+			/*
+			 * Populate the service URL column as a substring of alias from the
+			 * first occurrence of '#' till the end of the string
+			 */
+			String serviceURL = alias.substring(alias.indexOf('#') + 1);
+			data[iCnt][1] = serviceURL;
+
+			/*
+			 * Get the username and password pair from the Keystore. They are
+			 * returned in a single string in format
+			 * <USERNAME><SEPARATOR_CHARACTER><PASSWORD>
+			 */
+			UsernamePassword usernamePassword = credManager
+					.getUsernameAndPasswordForService(URI.create(serviceURL),
+							false, "");
+			String username = usernamePassword.getUsername();
+			String password = usernamePassword.getPasswordAsString();
+
+			// Populate the username column
+			data[iCnt][2] = username;
+
+			// Populate the last modified date column ("UBER" keystore type
+			// supports creation date)
+			// data[iCnt][3] =
+			// credManager.getEntryCreationDate(CredentialManager.KEYSTORE,
+			// alias);
+
+			// Populate the invisible password column
+			data[iCnt][4] = password;
+
+			// Populate the invisible alias column
+			data[iCnt][5] = alias;
+
+			iCnt++;
+		}
+
+		fireTableDataChanged();
+	}
+
+	/**
+	 * Get the number of columns in the table.
+	 */
+	@Override
+	public int getColumnCount() {
+		return columnNames.length;
+	}
+
+	/**
+	 * Get the number of rows in the table.
+	 */
+	@Override
+	public int getRowCount() {
+		return data.length;
+	}
+
+	/**
+	 * Get the name of the column at the given position.
+	 */
+	@Override
+	public String getColumnName(int iCol) {
+		return columnNames[iCol];
+	}
+
+	/**
+	 * Get the cell value at the given row and column position.
+	 */
+	@Override
+	public Object getValueAt(int iRow, int iCol) {
+		return data[iRow][iCol];
+	}
+
+	/**
+	 * Get the class at of the cells at the given column position.
+	 */
+	@Override
+	public Class<? extends Object> getColumnClass(int iCol) {
+		return getValueAt(0, iCol).getClass();
+	}
+
+	/**
+	 * Is the cell at the given row and column position editable?
+	 */
+	@Override
+	public boolean isCellEditable(int iRow, int iCol) {
+		// The table is always read-only
+		return false;
+	}
+
+	@Override
+	public void notify(Observable<KeystoreChangedEvent> sender,
+			KeystoreChangedEvent message) throws Exception {
+		// reload the table
+		if (message.keystoreType.equals(KEYSTORE))
+			load();
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/SetMasterPasswordDialog.java
----------------------------------------------------------------------
diff --git a/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/SetMasterPasswordDialog.java b/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/SetMasterPasswordDialog.java
new file mode 100644
index 0000000..9fe13a4
--- /dev/null
+++ b/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/SetMasterPasswordDialog.java
@@ -0,0 +1,188 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.credentialmanager;
+
+import static java.awt.BorderLayout.CENTER;
+import static java.awt.BorderLayout.NORTH;
+import static java.awt.BorderLayout.SOUTH;
+import static java.awt.Font.PLAIN;
+import static javax.swing.BoxLayout.Y_AXIS;
+import static javax.swing.JOptionPane.WARNING_MESSAGE;
+import static javax.swing.JOptionPane.showMessageDialog;
+import static org.apache.taverna.workbench.ui.credentialmanager.CMStrings.WARN_TITLE;
+
+import java.awt.BorderLayout;
+import java.awt.FlowLayout;
+import java.awt.Font;
+import java.awt.GridLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+
+import javax.swing.BoxLayout;
+import javax.swing.JButton;
+import javax.swing.JFrame;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JPasswordField;
+import javax.swing.border.CompoundBorder;
+import javax.swing.border.EmptyBorder;
+import javax.swing.border.EtchedBorder;
+
+import org.apache.taverna.workbench.helper.NonBlockedHelpEnabledDialog;
+
+/**
+ * Dialog used for user to set a master password for Credential Manager.
+ * 
+ * @author Alex Nenadic
+ */
+@SuppressWarnings("serial")
+public class SetMasterPasswordDialog extends NonBlockedHelpEnabledDialog {
+	/** Password entry field */
+	private JPasswordField passwordField;
+	/** Password confirmation entry field */
+	private JPasswordField passwordConfirmField;
+	/** The entered password */
+	private String password = null;
+	/** Instructions for the user */
+	private String instructions;
+
+	public SetMasterPasswordDialog(JFrame parent, String title, boolean modal,
+			String instructions) {
+		super(parent, title, modal);
+		this.instructions = instructions;
+		initComponents();
+	}
+
+	private void initComponents() {
+		getContentPane().setLayout(new BorderLayout());
+
+		JLabel instructionsLabel = new JLabel(instructions);
+		instructionsLabel.setFont(new Font(null, PLAIN, 11));
+
+		JPanel instructionsPanel = new JPanel();
+		instructionsPanel.setLayout(new BoxLayout(instructionsPanel, Y_AXIS));
+		instructionsPanel.add(instructionsLabel);
+		instructionsPanel.setBorder(new EmptyBorder(10, 5, 10, 0));
+
+		JLabel passwordLabel = new JLabel("Master password");
+		passwordLabel.setBorder(new EmptyBorder(0, 5, 0, 0));
+
+		JLabel passwordConfirmLabel = new JLabel("Confirm master password");
+		passwordConfirmLabel.setBorder(new EmptyBorder(0, 5, 0, 0));
+
+		passwordField = new JPasswordField(15);
+		passwordConfirmField = new JPasswordField(15);
+
+		JPanel passwordPanel = new JPanel(new GridLayout(2, 2, 5, 5));
+		passwordPanel.add(passwordLabel);
+		passwordPanel.add(passwordField);
+		passwordPanel.add(passwordConfirmLabel);
+		passwordPanel.add(passwordConfirmField);
+
+		JPanel mainPanel = new JPanel(new BorderLayout());
+		mainPanel.setBorder(new CompoundBorder(new EmptyBorder(10, 10, 10, 10),
+				new EtchedBorder()));
+		mainPanel.add(instructionsPanel, NORTH);
+		mainPanel.add(passwordPanel, CENTER);
+
+		JButton okButton = new JButton("OK");
+		okButton.addActionListener(new ActionListener() {
+			@Override
+			public void actionPerformed(ActionEvent evt) {
+				okPressed();
+			}
+		});
+
+		JButton cancelButton = new JButton("Cancel");
+		cancelButton.addActionListener(new ActionListener() {
+			@Override
+			public void actionPerformed(ActionEvent evt) {
+				cancelPressed();
+			}
+		});
+		JPanel buttonsPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
+		buttonsPanel.add(okButton);
+		buttonsPanel.add(cancelButton);
+
+		getContentPane().add(mainPanel, CENTER);
+		getContentPane().add(buttonsPanel, SOUTH);
+
+		addWindowListener(new WindowAdapter() {
+			@Override
+			public void windowClosing(WindowEvent evt) {
+				closeDialog();
+			}
+		});
+
+		setResizable(false);
+		getRootPane().setDefaultButton(okButton);
+		pack();
+	}
+
+	public String getPassword() {
+		return password;
+	}
+
+	/**
+	 * Check that the user has entered a non-empty password and store the new
+	 * password.
+	 */
+	private boolean checkPassword() {
+		String firstPassword = new String(passwordField.getPassword());
+		String confirmPassword = new String(passwordConfirmField.getPassword());
+
+		if (!firstPassword.equals(confirmPassword)) {
+			showMessageDialog(this, "The passwords do not match", WARN_TITLE,
+					WARNING_MESSAGE);
+			return false;
+		}
+		if (firstPassword.isEmpty()) {
+			// passwords match but are empty
+			showMessageDialog(this, "The password cannot be empty", WARN_TITLE,
+					WARNING_MESSAGE);
+			return false;
+		}
+
+		// passwords match and not empty
+		password = firstPassword;
+		return true;
+	}
+
+	private void okPressed() {
+		if (checkPassword())
+			closeDialog();
+	}
+
+	private void cancelPressed() {
+		/*
+		 * Set the password to null as it might have changed in the meantime if
+		 * user entered something then cancelled.
+		 */
+		password = null;
+		closeDialog();
+	}
+
+	private void closeDialog() {
+		setVisible(false);
+		dispose();
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/TableCellRenderer.java
----------------------------------------------------------------------
diff --git a/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/TableCellRenderer.java b/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/TableCellRenderer.java
new file mode 100644
index 0000000..ad88ac0
--- /dev/null
+++ b/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/TableCellRenderer.java
@@ -0,0 +1,112 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.credentialmanager;
+
+import static org.apache.taverna.workbench.ui.credentialmanager.CredentialManagerUI.KEY_PAIR_ENTRY_TYPE;
+import static org.apache.taverna.workbench.ui.credentialmanager.CredentialManagerUI.PASSWORD_ENTRY_TYPE;
+import static org.apache.taverna.workbench.ui.credentialmanager.CredentialManagerUI.TRUST_CERT_ENTRY_TYPE;
+
+import java.awt.Component;
+//import java.text.DateFormat;
+//import java.util.Date;
+
+import javax.swing.ImageIcon;
+import javax.swing.JLabel;
+import javax.swing.JTable;
+import javax.swing.border.EmptyBorder;
+import javax.swing.table.DefaultTableCellRenderer;
+//import net.sf.taverna.t2.workbench.ui.credentialmanager.KeyPairsTableModel;
+//import net.sf.taverna.t2.workbench.ui.credentialmanager.PasswordsTableModel;
+//import net.sf.taverna.t2.workbench.ui.credentialmanager.TrustedCertsTableModel;
+
+/**
+ * Custom cell renderer for the cells of the tables displaying
+ * Keystore/Truststore contents.
+ * 
+ * @author Alex Nenadic
+ */
+public class TableCellRenderer extends DefaultTableCellRenderer {
+	private static final long serialVersionUID = -3983986682794010259L;
+
+	private final ImageIcon passwordEntryIcon = new ImageIcon(
+			TableCellRenderer.class.getResource("/images/table/key_entry.png"));
+	private final ImageIcon keypairEntryIcon = new ImageIcon(
+			TableCellRenderer.class
+					.getResource("/images/table/keypair_entry.png"));
+	private final ImageIcon trustcertEntryIcon = new ImageIcon(
+			TableCellRenderer.class
+					.getResource("/images/table/trustcert_entry.png"));
+
+	/**
+	 * Get the rendered cell for the supplied value and column.
+	 */
+	@Override
+	public Component getTableCellRendererComponent(JTable keyStoreTable,
+			Object value, boolean bIsSelected, boolean bHasFocus, int iRow,
+			int iCol) {
+		JLabel cell = (JLabel) super.getTableCellRendererComponent(
+				keyStoreTable, value, bIsSelected, bHasFocus, iRow, iCol);
+
+		if (value != null) {
+        	// Type column - display an icon representing the type
+			if (iCol == 0)
+				configureTypeColumn(value, cell);
+            // Last Modified column - format date (if date supplied)        
+            /*else if (((keyStoreTable.getModel() instanceof PasswordsTableModel) && (iCol == 3)) || 
+            	((keyStoreTable.getModel() instanceof KeyPairsTableModel) && (iCol == 4))||
+            	((keyStoreTable.getModel() instanceof TrustedCertsTableModel) && (iCol == 4))){
+            	if (value instanceof Date) {
+            		// Include timezone
+            		cell.setText(DateFormat.getDateTimeInstance(DateFormat.MEDIUM,
+            			DateFormat.LONG).format((Date) value));
+            	} else {
+            		cell.setText(value.toString());
+            	}
+            }*/
+            // Other columns - just use their text values
+			else
+				cell.setText(value.toString());
+		}
+
+		cell.setBorder(new EmptyBorder(0, 5, 0, 5));
+		return cell;
+	}
+
+	private void configureTypeColumn(Object value, JLabel cell) {
+		ImageIcon icon = null;
+		// The cell is in the first column of Passwords table
+		if (PASSWORD_ENTRY_TYPE.equals(value)) {
+			icon = passwordEntryIcon; // key (i.e. password) entry image
+		}
+		// The cell is in the first column of Key Pairs table
+		else if (KEY_PAIR_ENTRY_TYPE.equals(value)) {
+			icon = keypairEntryIcon; // key pair entry image
+		}
+		// The cell is in the first column of Trusted Certificates table
+		else if (TRUST_CERT_ENTRY_TYPE.equals(value)) {
+			icon = trustcertEntryIcon; // trust. certificate entry image
+		}
+
+		cell.setIcon(icon);
+		cell.setText("");
+		cell.setVerticalAlignment(CENTER);
+		cell.setHorizontalAlignment(CENTER);
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/TableHeaderRenderer.java
----------------------------------------------------------------------
diff --git a/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/TableHeaderRenderer.java b/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/TableHeaderRenderer.java
new file mode 100644
index 0000000..11d7d3c
--- /dev/null
+++ b/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/TableHeaderRenderer.java
@@ -0,0 +1,94 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.credentialmanager;
+
+import static javax.swing.border.BevelBorder.RAISED;
+
+import java.awt.Component;
+
+import javax.swing.ImageIcon;
+import javax.swing.JLabel;
+import javax.swing.JTable;
+import javax.swing.border.BevelBorder;
+import javax.swing.border.CompoundBorder;
+import javax.swing.border.EmptyBorder;
+import javax.swing.table.DefaultTableCellRenderer;
+
+/**
+ * Custom cell renderer for the headers of the tables displaying 
+ * the Keystore/Truststore contents.
+ */
+@SuppressWarnings("serial")
+public class TableHeaderRenderer extends DefaultTableCellRenderer {
+	private final ImageIcon entryTypeIcon = new ImageIcon(
+			TableHeaderRenderer.class
+					.getResource("/images/table/entry_heading.png"));
+
+	@Override
+	public Component getTableCellRendererComponent(JTable jtKeyStoreTable,
+			Object value, boolean bIsSelected, boolean bHasFocus, int iRow,
+			int iCol) {
+        // Get header renderer
+        JLabel header = (JLabel) jtKeyStoreTable.getColumnModel().getColumn(iCol).getHeaderRenderer();
+
+        // The entry type header contains an icon for every table
+        if (iCol == 0) {
+            header.setText("");
+            header.setIcon(entryTypeIcon); // entry type icon (header for the first column of the table)
+            header.setHorizontalAlignment(CENTER);
+            header.setVerticalAlignment(CENTER);
+            header.setToolTipText("Entry type");
+        }
+        // All other headers contain text
+        else {
+            header.setText((String) value);
+            header.setHorizontalAlignment(LEFT);
+            
+            // Passwords table
+            if (jtKeyStoreTable.getModel() instanceof PasswordsTableModel){
+                if (iCol == 1) //Service URL column
+					header.setToolTipText("URL of the service username and password will be used for");
+				else if (iCol == 2) // Username column
+					header.setToolTipText("Username for the service");
+			}
+            // Key pairs table
+			else if (jtKeyStoreTable.getModel() instanceof KeyPairsTableModel) {
+				if (iCol == 1) // Owner
+					header.setToolTipText("Certificate's owner");
+				else if (iCol == 2) // Issuer
+					header.setToolTipText("Certificate's issuer");
+				else if (iCol == 3) // Serial number
+					header.setToolTipText("Certificate's serial number");
+            }       
+            // Trusted certs table
+			else if (jtKeyStoreTable.getModel() instanceof TrustedCertsTableModel) {
+				if (iCol == 1) // Owner
+					header.setToolTipText("Certificate's owner");
+				else if (iCol == 2) // Issuer
+					header.setToolTipText("Certificate's issuer");
+				else if (iCol == 3) // Serial number
+					header.setToolTipText("Certificate's serial number");
+            }         
+        }
+		header.setBorder(new CompoundBorder(new BevelBorder(RAISED),
+				new EmptyBorder(0, 5, 0, 5)));
+		return header;
+	}
+}


[29/51] [partial] incubator-taverna-workbench git commit: all packages are moved to org.apache.taverna.*

Posted by re...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-dataflow-activity-ui/src/main/java/net/sf/taverna/t2/workbench/file/importworkflow/actions/OpenSourceWorkflowAction.java
----------------------------------------------------------------------
diff --git a/taverna-dataflow-activity-ui/src/main/java/net/sf/taverna/t2/workbench/file/importworkflow/actions/OpenSourceWorkflowAction.java b/taverna-dataflow-activity-ui/src/main/java/net/sf/taverna/t2/workbench/file/importworkflow/actions/OpenSourceWorkflowAction.java
deleted file mode 100644
index f392405..0000000
--- a/taverna-dataflow-activity-ui/src/main/java/net/sf/taverna/t2/workbench/file/importworkflow/actions/OpenSourceWorkflowAction.java
+++ /dev/null
@@ -1,139 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2013 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.file.importworkflow.actions;
-
-import java.awt.Component;
-import java.awt.event.ActionEvent;
-import java.io.File;
-import java.util.Arrays;
-import java.util.List;
-import java.util.prefs.Preferences;
-
-import javax.swing.AbstractAction;
-import javax.swing.JFileChooser;
-import javax.swing.JOptionPane;
-import javax.swing.filechooser.FileFilter;
-
-import net.sf.taverna.t2.workbench.file.FileManager;
-import net.sf.taverna.t2.workbench.icons.WorkbenchIcons;
-
-import org.apache.log4j.Logger;
-
-/**
- * @author David Withers
- */
-@SuppressWarnings("serial")
-public abstract class OpenSourceWorkflowAction extends AbstractAction {
-
-	private static Logger logger = Logger.getLogger(OpenSourceWorkflowAction.class);
-
-	private static final String OPEN_WORKFLOW = "Open workflow...";
-
-	protected FileManager fileManager;
-
-	public OpenSourceWorkflowAction(FileManager fileManager) {
-		super(OPEN_WORKFLOW, WorkbenchIcons.openIcon);
-		this.fileManager = fileManager;
-	}
-
-	public void actionPerformed(ActionEvent e) {
-		final Component parentComponent;
-		if (e.getSource() instanceof Component) {
-			parentComponent = (Component) e.getSource();
-		} else {
-			parentComponent = null;
-		}
-		openWorkflows(parentComponent);
-	}
-
-	public abstract void openWorkflows(Component parentComponent, File[] files);
-
-	/**
-	 * Pop up an Open-dialogue to select one or more workflow files to open.
-	 *
-	 * @param parentComponent
-	 *            The UI parent component to use for pop up dialogues
-	 * @param openCallback
-	 *            An {@link OpenCallback} to be called during the file opening.
-	 *            The callback will be invoked for each file that has been
-	 *            opened, as file opening happens in a separate thread that
-	 *            might execute after the return of this method.
-	 * @return <code>false</code> if no files were selected or the dialogue was
-	 *         cancelled, or <code>true</code> if the process of opening one or
-	 *         more files has been started.
-	 */
-	public boolean openWorkflows(final Component parentComponent) {
-		JFileChooser fileChooser = new JFileChooser();
-		Preferences prefs = Preferences.userNodeForPackage(getClass());
-		String curDir = prefs.get("currentDir", System.getProperty("user.home"));
-		fileChooser.setDialogTitle(OPEN_WORKFLOW);
-
-		fileChooser.resetChoosableFileFilters();
-		fileChooser.setAcceptAllFileFilterUsed(false);
-		List<FileFilter> fileFilters = fileManager.getOpenFileFilters();
-		if (fileFilters.isEmpty()) {
-			logger.warn("No file types found for opening workflow");
-			JOptionPane
-					.showMessageDialog(parentComponent,
-							"No file types found for opening workflow.", "Error",
-							JOptionPane.ERROR_MESSAGE);
-			return false;
-		}
-		for (FileFilter fileFilter : fileFilters) {
-			fileChooser.addChoosableFileFilter(fileFilter);
-		}
-
-		fileChooser.setFileFilter(fileFilters.get(0));
-
-		fileChooser.setCurrentDirectory(new File(curDir));
-		fileChooser.setMultiSelectionEnabled(true);
-
-		int returnVal = fileChooser.showOpenDialog(parentComponent);
-		if (returnVal == JFileChooser.APPROVE_OPTION) {
-			prefs.put("currentDir", fileChooser.getCurrentDirectory().toString());
-			final File[] selectedFiles = fileChooser.getSelectedFiles();
-			if (selectedFiles.length == 0) {
-				logger.warn("No files selected");
-				return false;
-			}
-			new FileOpenerThread(parentComponent, selectedFiles).start();
-			return true;
-		}
-		return false;
-	}
-
-	private final class FileOpenerThread extends Thread {
-		private final File[] files;
-		private final Component parentComponent;
-
-		private FileOpenerThread(Component parentComponent, File[] selectedFiles) {
-			super("Opening workflows(s) " + Arrays.asList(selectedFiles));
-			this.parentComponent = parentComponent;
-			this.files = selectedFiles;
-		}
-
-		@Override
-		public void run() {
-			openWorkflows(parentComponent, files);
-		}
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-dataflow-activity-ui/src/main/java/net/sf/taverna/t2/workbench/file/importworkflow/actions/ReplaceNestedWorkflowAction.java
----------------------------------------------------------------------
diff --git a/taverna-dataflow-activity-ui/src/main/java/net/sf/taverna/t2/workbench/file/importworkflow/actions/ReplaceNestedWorkflowAction.java b/taverna-dataflow-activity-ui/src/main/java/net/sf/taverna/t2/workbench/file/importworkflow/actions/ReplaceNestedWorkflowAction.java
deleted file mode 100644
index 5578a5f..0000000
--- a/taverna-dataflow-activity-ui/src/main/java/net/sf/taverna/t2/workbench/file/importworkflow/actions/ReplaceNestedWorkflowAction.java
+++ /dev/null
@@ -1,84 +0,0 @@
-package net.sf.taverna.t2.workbench.file.importworkflow.actions;
-
-import java.awt.Component;
-import java.awt.event.ActionEvent;
-
-import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionRegistry;
-import net.sf.taverna.t2.ui.menu.MenuManager;
-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.Edit;
-import net.sf.taverna.t2.workbench.edits.EditManager;
-import net.sf.taverna.t2.workbench.file.FileManager;
-import net.sf.taverna.t2.workbench.file.importworkflow.gui.ImportWorkflowWizard;
-import net.sf.taverna.t2.workbench.selection.SelectionManager;
-import net.sf.taverna.t2.workbench.ui.Utils;
-import net.sf.taverna.t2.workbench.ui.actions.activity.ActivityConfigurationAction;
-import net.sf.taverna.t2.workflow.edits.ConfigureEdit;
-import org.apache.taverna.scufl2.api.activity.Activity;
-import org.apache.taverna.scufl2.api.configurations.Configuration;
-import org.apache.taverna.scufl2.api.core.Workflow;
-
-public class ReplaceNestedWorkflowAction extends ActivityConfigurationAction {
-	private static final long serialVersionUID = 1L;
-
-	private final EditManager editManager;
-	private final FileManager fileManager;
-	private final MenuManager menuManager;
-
-	private final ColourManager colourManager;
-
-	private final WorkbenchConfiguration workbenchConfiguration;
-
-	private final SelectionManager selectionManager;
-
-	public ReplaceNestedWorkflowAction(Activity activity, EditManager editManager,
-			FileManager fileManager, MenuManager menuManager,
-			ActivityIconManager activityIconManager, ColourManager colourManager,
-			ServiceDescriptionRegistry serviceDescriptionRegistry,
-			WorkbenchConfiguration workbenchConfiguration, SelectionManager selectionManager) {
-		super(activity, activityIconManager, serviceDescriptionRegistry);
-		this.editManager = editManager;
-		this.fileManager = fileManager;
-		this.menuManager = menuManager;
-		this.colourManager = colourManager;
-		this.workbenchConfiguration = workbenchConfiguration;
-		this.selectionManager = selectionManager;
-		putValue(NAME, "Replace nested workflow");
-	}
-
-	public void actionPerformed(ActionEvent e) {
-		final Component parentComponent;
-		if (e.getSource() instanceof Component) {
-			parentComponent = (Component) e.getSource();
-		} else {
-			parentComponent = null;
-		}
-		ImportWorkflowWizard wizard = new ImportWorkflowWizard(
-				Utils.getParentFrame(parentComponent), editManager, fileManager, menuManager,
-				colourManager, workbenchConfiguration, selectionManager) {
-			private static final long serialVersionUID = 1L;
-
-//			@Override
-//			protected Edit<?> makeInsertNestedWorkflowEdit(Workflow nestedFlow, String name) {
-//				Configuration configuration = new Configuration();
-//				configuration.setType(null);
-//				// TODO use service registry
-//				return new ConfigureEdit<Activity>(getActivity(), null, configuration);
-//			}
-
-//			@Override
-//			protected Activity getInsertedActivity() {
-//				return getActivity();
-//			}
-		};
-
-		wizard.setMergeEnabled(false);
-//		wizard.setCustomDestinationDataflow(fileManager.getCurrentDataflow(),
-//				"Existing nested workflow");
-//		wizard.setDestinationEnabled(false);
-		wizard.setVisible(true);
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-dataflow-activity-ui/src/main/java/net/sf/taverna/t2/workbench/file/importworkflow/gui/ImportWorkflowWizard.java
----------------------------------------------------------------------
diff --git a/taverna-dataflow-activity-ui/src/main/java/net/sf/taverna/t2/workbench/file/importworkflow/gui/ImportWorkflowWizard.java b/taverna-dataflow-activity-ui/src/main/java/net/sf/taverna/t2/workbench/file/importworkflow/gui/ImportWorkflowWizard.java
deleted file mode 100644
index fbad41d..0000000
--- a/taverna-dataflow-activity-ui/src/main/java/net/sf/taverna/t2/workbench/file/importworkflow/gui/ImportWorkflowWizard.java
+++ /dev/null
@@ -1,1272 +0,0 @@
-package net.sf.taverna.t2.workbench.file.importworkflow.gui;
-
-import java.awt.BorderLayout;
-import java.awt.Color;
-import java.awt.Component;
-import java.awt.Container;
-import java.awt.Frame;
-import java.awt.GridBagConstraints;
-import java.awt.GridBagLayout;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.FocusAdapter;
-import java.awt.event.FocusEvent;
-import java.awt.event.ItemEvent;
-import java.awt.event.ItemListener;
-import java.io.File;
-import java.lang.reflect.InvocationTargetException;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import javax.swing.AbstractAction;
-import javax.swing.BorderFactory;
-import javax.swing.ButtonGroup;
-import javax.swing.ButtonModel;
-import javax.swing.JButton;
-import javax.swing.JComboBox;
-import javax.swing.JLabel;
-import javax.swing.JOptionPane;
-import javax.swing.JPanel;
-import javax.swing.JRadioButton;
-import javax.swing.JTextField;
-import javax.swing.ProgressMonitor;
-import javax.swing.SwingUtilities;
-
-import net.sf.taverna.t2.activities.dataflow.servicedescriptions.DataflowTemplateService;
-import net.sf.taverna.t2.ui.menu.MenuManager;
-import net.sf.taverna.t2.workbench.MainWindow;
-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.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.file.DataflowInfo;
-import net.sf.taverna.t2.workbench.file.FileManager;
-import net.sf.taverna.t2.workbench.file.exceptions.OpenException;
-import net.sf.taverna.t2.workbench.file.importworkflow.DataflowMerger;
-import net.sf.taverna.t2.workbench.file.importworkflow.MergeException;
-import net.sf.taverna.t2.workbench.file.importworkflow.actions.OpenSourceWorkflowAction;
-import net.sf.taverna.t2.workbench.helper.HelpEnabledDialog;
-import net.sf.taverna.t2.workbench.models.graph.svg.SVGGraphController;
-import net.sf.taverna.t2.workbench.selection.SelectionManager;
-import net.sf.taverna.t2.workflow.edits.AddChildEdit;
-import net.sf.taverna.t2.workflow.edits.AddProcessorEdit;
-
-import org.apache.batik.swing.JSVGCanvas;
-import org.apache.log4j.Logger;
-
-import org.apache.taverna.scufl2.api.activity.Activity;
-import org.apache.taverna.scufl2.api.common.Scufl2Tools;
-import org.apache.taverna.scufl2.api.configurations.Configuration;
-import org.apache.taverna.scufl2.api.container.WorkflowBundle;
-import org.apache.taverna.scufl2.api.core.Processor;
-import org.apache.taverna.scufl2.api.core.Workflow;
-import org.apache.taverna.scufl2.api.iterationstrategy.CrossProduct;
-import org.apache.taverna.scufl2.api.port.InputActivityPort;
-import org.apache.taverna.scufl2.api.port.InputProcessorPort;
-import org.apache.taverna.scufl2.api.port.InputWorkflowPort;
-import org.apache.taverna.scufl2.api.port.OutputActivityPort;
-import org.apache.taverna.scufl2.api.port.OutputProcessorPort;
-import org.apache.taverna.scufl2.api.port.OutputWorkflowPort;
-import org.apache.taverna.scufl2.api.profiles.ProcessorBinding;
-import org.apache.taverna.scufl2.api.profiles.ProcessorInputPortBinding;
-import org.apache.taverna.scufl2.api.profiles.ProcessorOutputPortBinding;
-import org.apache.taverna.scufl2.api.profiles.Profile;
-
-import com.fasterxml.jackson.databind.node.ObjectNode;
-
-@SuppressWarnings("serial")
-public class ImportWorkflowWizard extends HelpEnabledDialog {
-
-	private static Logger logger = Logger.getLogger(ImportWorkflowWizard.class);
-
-	private Scufl2Tools scufl2Tools = new Scufl2Tools();
-
-	protected BrowseFileOnClick browseFileOnClick = new BrowseFileOnClick();
-	protected JButton buttonBrowse;
-	protected JComboBox chooseDataflow;
-	protected DataflowOpenerThread dataflowOpenerThread;
-
-	private WorkflowBundle destinationWorkflowBundle;
-	private Workflow destinationWorkflow;
-	private Profile destinationProfile;
-	private Workflow sourceWorkflow;
-
-	protected JTextField fieldFile;
-
-	protected JTextField fieldUrl;
-	protected boolean mergeEnabled = true;
-	protected boolean nestedEnabled = true;
-	protected JSVGCanvas previewSource = new JSVGCanvas(null, false, false);
-	protected JSVGCanvas previewDestination = new JSVGCanvas(null, false, false);
-	protected JTextField prefixField;
-	protected JRadioButton radioFile;
-	protected JRadioButton radioNew;
-	protected JRadioButton radioOpened;
-	protected JRadioButton radioUrl;
-	protected ButtonGroup sourceSelection;
-	protected ActionListener updateChosenListener = new UpdateChosenListener();
-	protected Thread updatePreviewsThread;
-	protected Component sourceSelectionPanel;
-	protected JLabel prefixLabel;
-	protected JLabel prefixHelp;
-//	protected JPanel destinationSelectionPanel;
-//	protected ButtonGroup destinationSelection;
-//	protected JRadioButton radioNewDestination;
-//	protected JRadioButton radioOpenDestination;
-//	protected JComboBox destinationAlreadyOpen;
-	protected JPanel introductionPanel;
-	protected ButtonGroup actionSelection;
-	protected JRadioButton actionNested;
-	protected JRadioButton actionMerge;
-	protected JRadioButton radioCustomSource;
-	protected JRadioButton radioCustomDestination;
-
-	private final EditManager editManager;
-	private final FileManager fileManager;
-	private final MenuManager menuManager;
-	private final ColourManager colourManager;
-	private final WorkbenchConfiguration workbenchConfiguration;
-	private final SelectionManager selectionManager;
-
-	private WorkflowBundle customSourceDataFlow = null;
-//	private Workflow customDestinationDataflow = null;
-	private String customSourceName = "";
-//	private String customDestinationName = "";
-
-	private boolean sourceEnabled = true;
-//	private boolean destinationEnabled = true;
-	private Activity insertedActivity;
-
-	public ImportWorkflowWizard(Frame parentFrame, EditManager editManager,
-			FileManager fileManager, MenuManager menuManager, ColourManager colourManager,
-			WorkbenchConfiguration workbenchConfiguration, SelectionManager selectionManager) {
-		super(parentFrame, "Import workflow", true, null);
-		this.selectionManager = selectionManager;
-		destinationWorkflow = selectionManager.getSelectedWorkflow();
-		destinationProfile = selectionManager.getSelectedProfile();
-		destinationWorkflowBundle = selectionManager.getSelectedWorkflowBundle();
-
-		this.editManager = editManager;
-		this.fileManager = fileManager;
-		this.menuManager = menuManager;
-		this.colourManager = colourManager;
-		this.workbenchConfiguration = workbenchConfiguration;
-
-		setSize(600, 600);
-		add(makeContentPane(), BorderLayout.CENTER);
-		// Add some space
-		add(new JPanel(), BorderLayout.WEST);
-		add(new JPanel(), BorderLayout.NORTH);
-		add(new JPanel(), BorderLayout.SOUTH);
-		add(new JPanel(), BorderLayout.EAST);
-		findChosenDataflow(this, true);
-		updateAll();
-	}
-
-	public void setMergeEnabled(boolean importEnabled) {
-		this.mergeEnabled = importEnabled;
-		updateAll();
-	}
-
-	public void setNestedEnabled(boolean nestedEnabled) {
-		this.nestedEnabled = nestedEnabled;
-		updateAll();
-	}
-
-	/**
-	 * Silly workaround to avoid "Cannot call invokeAndWait from the event dispatcher thread"
-	 * exception.
-	 *
-	 * @param runnable
-	 */
-	public static void invokeAndWait(Runnable runnable) {
-		if (SwingUtilities.isEventDispatchThread()) {
-			runnable.run();
-			return;
-		}
-		try {
-			SwingUtilities.invokeAndWait(runnable);
-		} catch (InterruptedException ex) {
-			// logger.warn("Runnable " + runnable + " was interrupted " + runnable, ex);
-		} catch (InvocationTargetException e) {
-			logger.warn("Can't invoke " + runnable, e);
-		}
-	}
-
-	protected Component makeWorkflowImage() {
-		JPanel workflowImages = new JPanel(new GridBagLayout());
-		GridBagConstraints gbc = new GridBagConstraints();
-		gbc.gridy = 0;
-		gbc.fill = GridBagConstraints.BOTH;
-		gbc.weighty = 0.1;
-
-		gbc.weightx = 0.1;
-		workflowImages.add(new JPanel(), gbc);// filler
-
-		gbc.weightx = 0.0;
-		previewSource.setBackground(workflowImages.getBackground());
-		workflowImages.add(previewSource, gbc);
-
-		JLabel arrow = new JLabel("\u2192");
-		arrow.setFont(arrow.getFont().deriveFont(48f));
-		workflowImages.add(arrow, gbc);
-
-		previewDestination.setBackground(workflowImages.getBackground());
-		workflowImages.add(previewDestination, gbc);
-
-		gbc.weightx = 0.1;
-		workflowImages.add(new JPanel(), gbc);
-		gbc.weightx = 0.0;
-
-		return workflowImages;
-	}
-
-	protected void updateAll() {
-		updatePreviews(); // will go in separate thread anyway, do it first
-		updateHeader();
-		updateSourceSection();
-//		updateDestinationSection();
-		updateFooter();
-	}
-
-//	protected void updateDestinationSection() {
-//
-//		radioNewDestination.setVisible(false);
-//
-//		radioCustomDestination.setText(customDestinationName);
-//		radioCustomDestination.setVisible(customDestinationDataflow != null);
-//
-//		// radioNewDestination.setVisible(nestedEnabled);
-//		// radioNewDestination.setEnabled(actionNested.isSelected());
-//
-//		destinationSelectionPanel.setVisible(destinationEnabled);
-//
-//	}
-
-	protected synchronized void updatePreviews() {
-		if (updatePreviewsThread != null && updatePreviewsThread.isAlive()) {
-			updatePreviewsThread.interrupt();
-		}
-		updatePreviewsThread = new UpdatePreviewsThread();
-		updatePreviewsThread.start();
-	}
-
-	protected void updateDestinationPreview() {
-		updateWorkflowGraphic(previewDestination, destinationWorkflow, destinationProfile);
-	}
-
-	protected void updateSourcePreview() {
-		Profile sourceProfile = null;
-		if (sourceWorkflow != null) {
-			sourceProfile = sourceWorkflow.getParent().getMainProfile();
-		}
-		updateWorkflowGraphic(previewSource, sourceWorkflow, sourceProfile);
-	}
-
-	protected void updateFooter() {
-		prefixField.setVisible(mergeEnabled);
-		prefixLabel.setVisible(mergeEnabled);
-		prefixHelp.setVisible(mergeEnabled);
-
-		prefixField.setEnabled(actionMerge.isSelected());
-		prefixLabel.setEnabled(actionMerge.isSelected());
-		prefixHelp.setEnabled(actionMerge.isSelected());
-		if (actionMerge.isSelected()) {
-			prefixHelp.setForeground(prefixLabel.getForeground());
-		} else {
-			// Work around
-			// http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4303706
-			// and assume gray is the 'disabled' colour in our Look n Feel
-			prefixHelp.setForeground(Color.gray);
-		}
-
-	}
-
-	protected void updateHeader() {
-		makeIntroductionPanel();
-	}
-
-	protected void updateSourceSection() {
-		radioCustomSource.setText(customSourceName);
-		radioCustomSource.setVisible(customSourceDataFlow != null);
-
-		radioNew.setVisible(nestedEnabled);
-		radioNew.setEnabled(actionNested.isSelected());
-
-		if (actionNested.isSelected() && sourceSelection.getSelection() == null) {
-			// Preselect the new workflow
-			radioNew.setSelected(true);
-		}
-
-		sourceSelectionPanel.setVisible(sourceEnabled);
-	}
-
-	/**
-	 * Create a PNG image of the workflow and place inside an ImageIcon
-	 *
-	 * @param dataflow
-	 * @return
-	 * @throws InvocationTargetException
-	 * @throws InterruptedException
-	 */
-	protected void updateWorkflowGraphic(final JSVGCanvas svgCanvas, final Workflow workflow, final Profile profile) {
-		try {
-			SwingUtilities.invokeAndWait(new Runnable() {
-				public void run() {
-					// Set it to blank while reloading
-					svgCanvas.setSVGDocument(null);
-					if (workflow != null) {
-						SVGGraphController currentWfGraphController = new SVGGraphController(
-								workflow, profile, false, svgCanvas,
-								editManager, menuManager, colourManager, workbenchConfiguration);
-					}
-				}
-			});
-		} catch (InterruptedException e) {
-			// logger.error(e);
-		} catch (InvocationTargetException e) {
-			// logger.error(e);
-		}
-	}
-
-	/**
-	 * Open the selected source and destination workflows. If background is true, this method will
-	 * return immediately while a {@link DataflowOpenerThread} performs the updates. If a
-	 * DataflowOpenerThread is already running, it will be interrupted and stopped.
-	 *
-	 * @param parentComponent
-	 *            The parent component for showing dialogues
-	 * @param background
-	 *            If true, will run in separate thread.
-	 * @return <code>false</code> if running in the background, or if a dialogue was shown and the
-	 *         operation is aborted by the user, or <code>true</code> if not running in the
-	 *         background and the method completed without user interruption.
-	 */
-	protected synchronized boolean findChosenDataflow(Component parentComponent, boolean background) {
-		if (dataflowOpenerThread != null && dataflowOpenerThread.isAlive()) {
-			if (background) {
-				// We've changed our mind
-				dataflowOpenerThread.interrupt();
-			} else {
-				// We'll let it finish, we don't need to do it again
-				try {
-					dataflowOpenerThread.join();
-				} catch (InterruptedException e) {
-					Thread.currentThread().interrupt();
-				}
-				return !dataflowOpenerThread.shownWarning;
-			}
-		}
-		dataflowOpenerThread = new DataflowOpenerThread(parentComponent, background);
-
-		if (background) {
-			dataflowOpenerThread.start();
-			return false;
-		} else {
-			dataflowOpenerThread.run();
-			return !dataflowOpenerThread.shownWarning;
-		}
-
-	}
-
-	protected Container makeContentPane() {
-		JPanel panel = new JPanel(new GridBagLayout());
-		GridBagConstraints gbc = new GridBagConstraints();
-
-		gbc.ipadx = 5;
-		gbc.ipady = 5;
-
-		gbc.gridx = 0;
-		gbc.weightx = 0.1;
-		gbc.fill = GridBagConstraints.BOTH;
-
-		introductionPanel = makeIntroductionPanel();
-		panel.add(introductionPanel, gbc);
-
-		sourceSelectionPanel = makeSourceSelectionPanel();
-		panel.add(sourceSelectionPanel, gbc);
-
-//		destinationSelectionPanel = makeDestinationSelectionPanel();
-//		panel.add(destinationSelectionPanel, gbc);
-
-		gbc.weighty = 0.1;
-		panel.add(makeImportStylePanel(), gbc);
-
-		return panel;
-	}
-
-	protected JPanel makeIntroductionPanel() {
-		if (introductionPanel == null) {
-			introductionPanel = new JPanel(new GridBagLayout());
-		} else {
-			introductionPanel.removeAll();
-		}
-		boolean bothEnabled = mergeEnabled && nestedEnabled;
-		if (bothEnabled) {
-			introductionPanel.setBorder(BorderFactory.createTitledBorder("Import method"));
-		} else {
-			introductionPanel.setBorder(BorderFactory.createEmptyBorder());
-		}
-		GridBagConstraints gbc = new GridBagConstraints();
-		gbc.gridx = 0;
-		// gbc.gridy = 0;
-		gbc.weightx = 0.1;
-		gbc.fill = GridBagConstraints.BOTH;
-		gbc.anchor = GridBagConstraints.FIRST_LINE_START;
-
-		StringBuilder nestedHelp = new StringBuilder();
-		nestedHelp.append("<html><small>");
-		nestedHelp.append("Add a <strong>nested workflow</strong> ");
-		nestedHelp.append("into the ");
-		nestedHelp.append("destination workflow as a single service. ");
-		nestedHelp.append("The nested workflow ");
-		nestedHelp.append("can be <em>edited separately</em>, but is shown ");
-		nestedHelp.append("expanded in the diagram of the parent  ");
-		nestedHelp.append("workflow. In the parent workflow you can ");
-		nestedHelp.append("connect to the input and output ports of the nested ");
-		nestedHelp.append("workflow. ");
-		nestedHelp.append("</small></html>");
-
-		StringBuilder mergeHelp = new StringBuilder();
-		mergeHelp.append("<html><small>");
-		mergeHelp.append("<strong>Merge</strong> a workflow ");
-		mergeHelp.append("by copying all services, ports and links ");
-		mergeHelp.append("directly into the destination workflow. This can be  ");
-		mergeHelp.append("useful for merging smaller workflow fragments. For ");
-		mergeHelp.append("inclusion of larger workflows you might find using ");
-		mergeHelp.append("<em>nested workflows</em> more beneficial.");
-		mergeHelp.append("</small></html>");
-
-		actionSelection = new ButtonGroup();
-		actionNested = new JRadioButton(nestedHelp.toString());
-		ActionListener updateListener = new ActionListener() {
-			public void actionPerformed(ActionEvent e) {
-				updateSourceSection();
-//				updateDestinationSection();
-				updateFooter();
-			}
-		};
-		actionNested.addActionListener(updateListener);
-		actionSelection.add(actionNested);
-
-		actionMerge = new JRadioButton(mergeHelp.toString());
-		actionMerge.addActionListener(updateListener);
-		actionSelection.add(actionMerge);
-
-		if (bothEnabled) {
-			introductionPanel.add(actionNested, gbc);
-			introductionPanel.add(actionMerge, gbc);
-			actionNested.setSelected(true);
-		} else if (nestedEnabled) {
-			introductionPanel.add(new JLabel(nestedHelp.toString()), gbc);
-			actionNested.setSelected(true);
-		} else if (mergeEnabled) {
-			introductionPanel.add(new JLabel(mergeHelp.toString()), gbc);
-			actionMerge.setSelected(true);
-		}
-		return introductionPanel;
-	}
-
-//	protected JPanel makeDestinationSelectionPanel() {
-//		JPanel j = new JPanel(new GridBagLayout());
-//		j.setBorder(BorderFactory.createTitledBorder("Workflow destination"));
-//
-//		GridBagConstraints gbc = new GridBagConstraints();
-//		gbc.gridx = 0;
-//		gbc.gridy = 0;
-//		gbc.fill = GridBagConstraints.BOTH;
-//
-//		destinationSelection = new ButtonGroup();
-//		radioNewDestination = new JRadioButton("New workflow");
-//		gbc.gridy = 0;
-//		j.add(radioNewDestination, gbc);
-//		destinationSelection.add(radioNewDestination);
-//		radioNewDestination.addActionListener(updateChosenListener);
-//
-//		radioOpenDestination = new JRadioButton("Already opened workflow");
-//		gbc.gridy = 2;
-//		j.add(radioOpenDestination, gbc);
-//		destinationSelection.add(radioOpenDestination);
-//		radioOpenDestination.addActionListener(updateChosenListener);
-//		gbc.weightx = 0.1;
-//		gbc.gridx = 1;
-//		destinationAlreadyOpen = makeSelectOpenWorkflowComboBox(true);
-//		j.add(destinationAlreadyOpen, gbc);
-//
-//		radioCustomDestination = new JRadioButton(customDestinationName);
-//		radioCustomDestination.setVisible(customDestinationName != null);
-//		gbc.gridx = 0;
-//		gbc.gridy = 3;
-//		gbc.gridwidth = 2;
-//		j.add(radioCustomDestination, gbc);
-//		destinationSelection.add(radioCustomDestination);
-//		radioCustomDestination.addActionListener(updateChosenListener);
-//		gbc.gridwidth = 1;
-//
-//		radioOpenDestination.setSelected(true);
-//		return j;
-//	}
-
-	protected Component makeImportStylePanel() {
-		JPanel j = new JPanel(new GridBagLayout());
-		GridBagConstraints gbc = new GridBagConstraints();
-		gbc.gridx = 0;
-		gbc.gridy = 0;
-		gbc.fill = GridBagConstraints.BOTH;
-
-		j.setBorder(BorderFactory.createTitledBorder("Import"));
-
-		prefixLabel = new JLabel("Prefix");
-		j.add(prefixLabel, gbc);
-		gbc.weightx = 0.1;
-		gbc.gridx = 1;
-
-		prefixField = new JTextField(10);
-		prefixLabel.setLabelFor(prefixField);
-		j.add(prefixField, gbc);
-
-		gbc.gridx = 0;
-		gbc.gridy = 1;
-		gbc.gridwidth = 2;
-
-		prefixHelp = new JLabel(
-				"<html><small>Optional prefix to be prepended to the name of the "
-						+ "inserted services and workflow ports. Even if no prefix is given, duplicate names will be "
-						+ "resolved by adding numbers, for instance <code>my_service_2</code> if <code>my_service</code> already "
-						+ "existed." + "</small></html>");
-		prefixHelp.setLabelFor(prefixField);
-		j.add(prefixHelp, gbc);
-
-		gbc.gridy = 2;
-		gbc.weightx = 0.1;
-		gbc.weighty = 0.1;
-
-		j.add(makeWorkflowImage(), gbc);
-
-		gbc.gridy = 3;
-		gbc.weighty = 0.0;
-		j.add(new JPanel(), gbc);
-
-		gbc.gridy = 4;
-		gbc.fill = GridBagConstraints.NONE;
-		JButton comp = new JButton(new ImportWorkflowAction());
-		j.add(comp, gbc);
-		return j;
-
-	}
-
-	protected Component makeSelectFile() {
-		JPanel j = new JPanel(new GridBagLayout());
-		j.setBorder(BorderFactory.createEtchedBorder());
-
-		GridBagConstraints gbc = new GridBagConstraints();
-		gbc.gridx = 0;
-		gbc.gridy = 0;
-		gbc.fill = GridBagConstraints.BOTH;
-		gbc.weightx = 0.1;
-
-		fieldFile = new JTextField(20);
-		fieldFile.setEditable(false);
-		fieldFile.addFocusListener(new FocusAdapter() {
-			public void focusGained(FocusEvent e) {
-				radioFile.setSelected(true);
-			}
-
-			@Override
-			public void focusLost(FocusEvent e) {
-				findChosenDataflow(e.getComponent(), true);
-			}
-		});
-		j.add(fieldFile, gbc);
-		radioFile.addItemListener(new ItemListener() {
-
-			public void itemStateChanged(ItemEvent e) {
-				if (e.getStateChange() == ItemEvent.SELECTED) {
-					browseFileOnClick.checkEmptyFile();
-				}
-			}
-		});
-
-		gbc.gridx = 1;
-		gbc.weightx = 0.0;
-		gbc.fill = GridBagConstraints.NONE;
-		buttonBrowse = new JButton(new OpenSourceWorkflowAction(fileManager) {
-			@Override
-			public void openWorkflows(Component parentComponent, File[] files) {
-				if (files.length == 0) {
-					radioFile.setSelected(false);
-					fieldFile.setText("");
-					radioFile.requestFocus();
-					return;
-				}
-				fieldFile.setText(files[0].getPath());
-				if (!radioFile.isSelected()) {
-					radioFile.setSelected(true);
-				}
-				findChosenDataflow(parentComponent, true);
-			}
-		});
-		buttonBrowse.setText("Browse");
-		j.add(buttonBrowse, gbc);
-
-		// This just duplicates things - we already have actions on
-		// the radioFile and fieldFile that will handle the events
-		// radioFile.addActionListener(browseFileOnClick);
-		// fieldFile.addActionListener(browseFileOnClick);
-		return j;
-	}
-
-	protected JComboBox makeSelectOpenWorkflowComboBox(boolean selectCurrent) {
-		List<DataflowSelection> openDataflows = new ArrayList<DataflowSelection>();
-		DataflowSelection current = null;
-		for (WorkflowBundle df : fileManager.getOpenDataflows()) {
-			String name = df.getMainWorkflow().getName();
-			boolean isCurrent = df.equals(fileManager.getCurrentDataflow());
-			if (isCurrent) {
-				// Wrapping as HTML causes weird drop-down box under MAC, so
-				// we just use normal text
-				// name = "<html><body>" + name
-				// + " <i>(current)</i></body></html>";
-				name = name + " (current)";
-			}
-			DataflowSelection selection = new DataflowSelection(df, name);
-			openDataflows.add(selection);
-			if (isCurrent) {
-				current = selection;
-			}
-		}
-		JComboBox chooseDataflow = new JComboBox(openDataflows.toArray());
-		if (selectCurrent) {
-			chooseDataflow.setSelectedItem(current);
-		}
-		chooseDataflow.addActionListener(updateChosenListener);
-		return chooseDataflow;
-
-	}
-
-	protected Component makeSourceSelectionPanel() {
-		JPanel j = new JPanel(new GridBagLayout());
-		j.setBorder(BorderFactory.createTitledBorder("Workflow source"));
-
-		GridBagConstraints gbc = new GridBagConstraints();
-		gbc.gridx = 0;
-		gbc.gridy = 0;
-		gbc.fill = GridBagConstraints.BOTH;
-
-		sourceSelection = new ButtonGroup();
-		radioNew = new JRadioButton("New workflow");
-		gbc.gridy = 0;
-		j.add(radioNew, gbc);
-		sourceSelection.add(radioNew);
-
-		radioNew.addActionListener(updateChosenListener);
-
-		radioFile = new JRadioButton("Import from file");
-		gbc.gridy = 1;
-		j.add(radioFile, gbc);
-		sourceSelection.add(radioFile);
-		radioFile.addActionListener(updateChosenListener);
-
-		radioUrl = new JRadioButton("Import from URL");
-		gbc.gridy = 2;
-		j.add(radioUrl, gbc);
-		sourceSelection.add(radioUrl);
-		radioUrl.addActionListener(updateChosenListener);
-
-		radioOpened = new JRadioButton("Already opened workflow");
-		gbc.gridy = 3;
-		j.add(radioOpened, gbc);
-		sourceSelection.add(radioOpened);
-		radioOpened.addActionListener(updateChosenListener);
-
-		radioCustomSource = new JRadioButton(customSourceName);
-		radioCustomSource.setVisible(customSourceDataFlow != null);
-		gbc.gridy = 4;
-		gbc.gridwidth = 2;
-		j.add(radioCustomSource, gbc);
-		sourceSelection.add(radioCustomSource);
-		radioCustomSource.addActionListener(updateChosenListener);
-		gbc.gridwidth = 1;
-
-		gbc.gridx = 1;
-		gbc.gridy = 1;
-		gbc.weightx = 0.1;
-		j.add(makeSelectFile(), gbc);
-
-		gbc.gridy = 2;
-		fieldUrl = new JTextField(20);
-		j.add(fieldUrl, gbc);
-		fieldUrl.addFocusListener(new FocusAdapter() {
-			@Override
-			public void focusGained(FocusEvent e) {
-				radioUrl.setSelected(true);
-			}
-
-			@Override
-			public void focusLost(FocusEvent e) {
-				findChosenDataflow(e.getComponent(), true);
-			}
-		});
-
-		gbc.gridy = 3;
-		chooseDataflow = makeSelectOpenWorkflowComboBox(false);
-		chooseDataflow.addFocusListener(new FocusAdapter() {
-			@Override
-			public void focusGained(FocusEvent e) {
-				radioOpened.setSelected(true);
-			}
-		});
-		j.add(chooseDataflow, gbc);
-
-		return j;
-	}
-
-	protected Edit<?> makeInsertNestedWorkflowEdit(Workflow nestedFlow) {
-		Processor processor = new Processor();
-		processor.setName("nestedWorkflow");
-
-		CrossProduct crossProduct = new CrossProduct();
-		crossProduct.setParent(processor.getIterationStrategyStack());
-
-		Activity activity = new Activity();
-		activity.setType(DataflowTemplateService.ACTIVITY_TYPE);
-		Configuration configuration = new Configuration();
-		configuration.setType(DataflowTemplateService.ACTIVITY_TYPE.resolve("#Config"));
-		destinationWorkflowBundle.getWorkflows().addWithUniqueName(nestedFlow);
-		((ObjectNode) configuration.getJson()).put("nestedWorkflow", nestedFlow.getName());
-		destinationWorkflowBundle.getWorkflows().remove(nestedFlow);
-		configuration.setConfigures(activity);
-
-		ProcessorBinding processorBinding = new ProcessorBinding();
-		processorBinding.setBoundProcessor(processor);
-		processorBinding.setBoundActivity(activity);
-
-		for (InputWorkflowPort workflowPort : nestedFlow.getInputPorts()) {
-			InputActivityPort activityPort = new InputActivityPort(activity, workflowPort.getName());
-			activityPort.setDepth(workflowPort.getDepth());
-			// create processor port
-			InputProcessorPort processorPort = new InputProcessorPort(processor, activityPort.getName());
-			processorPort.setDepth(activityPort.getDepth());
-			// add a new port binding
-			new ProcessorInputPortBinding(processorBinding, processorPort, activityPort);
-		}
-		for (OutputWorkflowPort workflowPort : nestedFlow.getOutputPorts()) {
-			OutputActivityPort activityPort = new OutputActivityPort(activity, workflowPort.getName());
-			// TODO calculate output depth
-			activityPort.setDepth(0);
-			activityPort.setGranularDepth(0);
-			// create processor port
-			OutputProcessorPort processorPort = new OutputProcessorPort(processor, activityPort.getName());
-			processorPort.setDepth(activityPort.getDepth());
-			processorPort.setGranularDepth(activityPort.getGranularDepth());
-			// add a new port binding
-			new ProcessorOutputPortBinding(processorBinding, activityPort, processorPort);
-		}
-
-		List<Edit<?>> editList = new ArrayList<Edit<?>>();
-		editList.add(new AddChildEdit<Profile>(destinationProfile, activity));
-		editList.add(new AddChildEdit<Profile>(destinationProfile, configuration));
-		editList.add(new AddChildEdit<Profile>(destinationProfile, processorBinding));
-		editList.add(new AddProcessorEdit(destinationWorkflow, processor));
-
-		editList.add(makeInsertWorkflowEdit(nestedFlow, nestedFlow.getParent().getMainProfile()));
-
-		return new CompoundEdit(editList);
-	}
-
-	protected Edit<?> makeInsertWorkflowEdit(Workflow nestedFlow, Profile profile) {
-		return makeInsertWorkflowEdit(nestedFlow, profile, new HashSet<>());
-	}
-
-	protected Edit<?> makeInsertWorkflowEdit(Workflow nestedFlow, Profile profile, Set<Object> seen) {
-		List<Edit<?>> editList = new ArrayList<Edit<?>>();
-		// add the nested workflow to the workflow bundle
-		editList.add(new AddChildEdit<WorkflowBundle>(destinationWorkflowBundle, nestedFlow));
-		seen.add(nestedFlow);
-		for (Processor processor : nestedFlow.getProcessors()) {
-			// add processor bindings to the profile
-			List<ProcessorBinding> processorBindings = scufl2Tools.processorBindingsForProcessor(processor, profile);
-			for (ProcessorBinding processorBinding : processorBindings) {
-				editList.add(new AddChildEdit<Profile>(destinationProfile, processorBinding));
-				// add activity to the profile
-				Activity activity = processorBinding.getBoundActivity();
-				if (!seen.contains(activity)) {
-					editList.add(new AddChildEdit<Profile>(destinationProfile, activity));
-					// add activity configurations to the profile
-					for (Configuration configuration : scufl2Tools.configurationsFor(activity, profile)) {
-						editList.add(new AddChildEdit<Profile>(destinationProfile, configuration));
-					}
-					seen.add(activity);
-				}
-			}
-			// add processor configurations to the profile
-			List<Configuration> configurations = scufl2Tools.configurationsFor(processor, profile);
-			for (Configuration configuration : configurations) {
-				editList.add(new AddChildEdit<Profile>(destinationProfile, configuration));
-			}
-
-			for (Workflow workflow : scufl2Tools.nestedWorkflowsForProcessor(processor, profile)) {
-				if (!seen.contains(workflow)) {
-					// recursively add nested workflows
-					editList.add(makeInsertWorkflowEdit(workflow, profile, seen));
-				}
-			}
-		}
-		return new CompoundEdit(editList);
-	}
-
-//	protected Activity getInsertedActivity() {
-//		return insertedActivity;
-//	}
-
-	protected class ImportWorkflowAction extends AbstractAction implements Runnable {
-		private static final String VALID_NAME_REGEX = "[\\p{L}\\p{Digit}_.]+";
-		private Component parentComponent;
-		private ProgressMonitor progressMonitor;
-
-		protected ImportWorkflowAction() {
-			super("Import workflow");
-		}
-
-		public void actionPerformed(ActionEvent e) {
-			/*
-			 * if (e.getSource() instanceof Component) { parentComponent = (Component)
-			 * e.getSource(); } else { parentComponent = null; }
-			 */
-			parentComponent = MainWindow.getMainWindow();
-			Thread t = new Thread(this, "Import workflow");
-			progressMonitor = new ProgressMonitor(parentComponent, "Importing workflow", "", 0, 100);
-			progressMonitor.setMillisToDecideToPopup(200);
-			progressMonitor.setProgress(5);
-			t.start();
-			setVisible(false);
-		}
-
-		protected void nested() {
-			if (progressMonitor.isCanceled()) {
-				return;
-			}
-			progressMonitor.setProgress(15);
-			selectionManager.setSelectedWorkflowBundle(destinationWorkflowBundle);
-			if (progressMonitor.isCanceled()) {
-				return;
-			}
-
-			progressMonitor.setNote("Copying source workflow");
-			Workflow nestedFlow;
-			try {
-				nestedFlow = DataflowMerger.copyWorkflow(sourceWorkflow);
-			} catch (Exception ex) {
-				logger.warn("Could not copy nested workflow", ex);
-				progressMonitor.setProgress(100);
-				JOptionPane.showMessageDialog(parentComponent,
-						"An error occured while copying workflow:\n" + ex.getLocalizedMessage(),
-						"Could not copy nested workflow", JOptionPane.WARNING_MESSAGE);
-				return;
-			}
-			if (progressMonitor.isCanceled()) {
-				return;
-			}
-
-			progressMonitor.setNote("Creating nested workflow");
-			progressMonitor.setProgress(45);
-
-			Edit<?> edit = makeInsertNestedWorkflowEdit(nestedFlow);
-			if (progressMonitor.isCanceled()) {
-				return;
-			}
-
-			progressMonitor.setNote("Inserting nested workflow");
-			progressMonitor.setProgress(65);
-
-			try {
-				editManager.doDataflowEdit(destinationWorkflowBundle, edit);
-			} catch (EditException e) {
-				progressMonitor.setProgress(100);
-				logger.warn("Could not import nested workflow", e);
-				JOptionPane.showMessageDialog(parentComponent,
-						"An error occured while importing workflow:\n" + e.getLocalizedMessage(),
-						"Could not import workflows", JOptionPane.WARNING_MESSAGE);
-				return;
-			}
-
-			if (radioNew.isSelected()) {
-				progressMonitor.setNote("Opening new nested workflow for editing");
-				progressMonitor.setProgress(90);
-				selectionManager.setSelectedWorkflow(nestedFlow);
-			}
-			progressMonitor.setProgress(100);
-		}
-
-		protected void merge() {
-			progressMonitor.setProgress(10);
-			DataflowMerger merger = new DataflowMerger(destinationWorkflow);
-			progressMonitor.setProgress(25);
-			progressMonitor.setNote("Planning workflow merging");
-
-			String prefix = prefixField.getText();
-			if (!prefix.equals("")) {
-				if (!prefix.matches("[_.]$")) {
-					prefix = prefix + "_";
-				}
-				if (!prefix.matches(VALID_NAME_REGEX)) {
-					progressMonitor.setProgress(100);
-					final String wrongPrefix = prefix;
-					SwingUtilities.invokeLater(new Runnable() {
-						public void run() {
-							JOptionPane.showMessageDialog(parentComponent, "The merge prefix '"
-									+ wrongPrefix + "' is not valid. Try "
-									+ "using only letters, numbers, " + "underscore and dot.",
-									"Invalid merge prefix", JOptionPane.ERROR_MESSAGE);
-							prefixField.requestFocus();
-							ImportWorkflowWizard.this.setVisible(true);
-						}
-					});
-					return;
-				}
-			}
-
-			CompoundEdit mergeEdit;
-			try {
-				mergeEdit = merger.getMergeEdit(ImportWorkflowWizard.this.sourceWorkflow, prefix);
-			} catch (MergeException e1) {
-				progressMonitor.setProgress(100);
-				logger.warn("Could not merge workflow", e1);
-				JOptionPane.showMessageDialog(parentComponent,
-						"An error occured while merging workflows:\n" + e1.getLocalizedMessage(),
-						"Could not merge workflows", JOptionPane.WARNING_MESSAGE);
-				return;
-			}
-
-			progressMonitor.setProgress(55);
-			selectionManager.setSelectedWorkflowBundle(destinationWorkflowBundle);
-
-			progressMonitor.setNote("Merging workflows");
-			progressMonitor.setProgress(75);
-
-			if (progressMonitor.isCanceled()) {
-				return;
-			}
-
-			try {
-				editManager.doDataflowEdit(destinationWorkflowBundle, mergeEdit);
-			} catch (EditException e1) {
-				progressMonitor.setProgress(100);
-				JOptionPane.showMessageDialog(parentComponent,
-						"An error occured while merging workflows:\n" + e1.getLocalizedMessage(),
-						"Could not merge workflows", JOptionPane.WARNING_MESSAGE);
-				return;
-			}
-			progressMonitor.setProgress(100);
-
-		}
-
-		public void run() {
-			boolean completed = findChosenDataflow(parentComponent, false);
-			if (!completed) {
-				return;
-			}
-			if (actionMerge.isSelected()) {
-				merge();
-			} else if (actionNested.isSelected()) {
-				nested();
-			}
-		}
-	}
-
-	protected class UpdatePreviewsThread extends Thread {
-		protected UpdatePreviewsThread() {
-			super("Updating destination previews");
-		}
-
-		public void run() {
-			if (Thread.interrupted()) {
-				return;
-			}
-			updateSourcePreview();
-
-			if (Thread.interrupted()) {
-				return;
-			}
-			updateDestinationPreview();
-		}
-	}
-
-	protected class BrowseFileOnClick implements ActionListener {
-		public void actionPerformed(ActionEvent e) {
-			checkEmptyFile();
-		}
-
-		public void checkEmptyFile() {
-			if (radioFile.isSelected() && fieldFile.getText().equals("")) {
-				// On first label click pop up Browse dialogue.
-				buttonBrowse.doClick();
-			}
-		}
-	}
-
-	protected class DataflowOpenerThread extends Thread {
-		private final boolean background;
-		private final Component parentComponent;
-		private boolean shouldStop = false;
-		private boolean shownWarning = false;
-
-		protected DataflowOpenerThread(Component parentComponent, boolean background) {
-			super("Inspecting selected workflow");
-			this.parentComponent = parentComponent;
-			this.background = background;
-		}
-
-		@Override
-		public void interrupt() {
-			this.shouldStop = true;
-			super.interrupt();
-		}
-
-		public void run() {
-			updateSource();
-//			updateDestination();
-		}
-
-//		public void updateDestination() {
-//			ButtonModel selection = destinationSelection.getSelection();
-//			Workflow chosenDataflow = null;
-//			if (selection == null) {
-//				chosenDataflow = null;
-//			} else if (selection.equals(radioNewDestination.getModel())) {
-//				chosenDataflow = new Workflow();
-//			} else if (selection.equals(radioOpenDestination.getModel())) {
-//				DataflowSelection chosen = (DataflowSelection) destinationAlreadyOpen
-//						.getSelectedItem();
-//				chosenDataflow = chosen.getDataflow();
-//			} else if (selection.equals(radioCustomDestination.getModel())) {
-//				chosenDataflow = customDestinationDataflow;
-//			} else {
-//				logger.error("Unknown selection " + selection);
-//			}
-//
-//			if (chosenDataflow == null) {
-//				if (!background && !shownWarning) {
-//					shownWarning = true;
-//					SwingUtilities.invokeLater(new Runnable() {
-//						public void run() {
-//							JOptionPane.showMessageDialog(parentComponent,
-//									"You need to choose a destination workflow",
-//									"No destination workflow chosen", JOptionPane.ERROR_MESSAGE);
-//							setVisible(true);
-//						}
-//					});
-//					return;
-//				}
-//			}
-//			if (checkInterrupted()) {
-//				return;
-//			}
-//			if (chosenDataflow != ImportWorkflowWizard.this.destinationDataflow) {
-//				updateWorkflowGraphic(previewDestination, chosenDataflow);
-//				if (checkInterrupted()) {
-//					return;
-//				}
-//				ImportWorkflowWizard.this.destinationDataflow = chosenDataflow;
-//			}
-//
-//		}
-
-		public void updateSource() {
-			ButtonModel selection = sourceSelection.getSelection();
-			Workflow chosenDataflow = null;
-			if (selection == null) {
-				chosenDataflow = null;
-			} else if (selection.equals(radioNew.getModel())) {
-				WorkflowBundle workflowBundle = new WorkflowBundle();
-				workflowBundle.setMainWorkflow(new Workflow());
-				workflowBundle.getMainWorkflow().setName(fileManager.getDefaultWorkflowName());
-				workflowBundle.setMainProfile(new Profile());
-				scufl2Tools.setParents(workflowBundle);
-				chosenDataflow = workflowBundle.getMainWorkflow();
-			} else if (selection.equals(radioFile.getModel())) {
-				final String filePath = fieldFile.getText();
-				try {
-					DataflowInfo opened = fileManager
-							.openDataflowSilently(null, new File(filePath));
-					if (checkInterrupted()) {
-						return;
-					}
-					chosenDataflow = opened.getDataflow().getMainWorkflow();
-				} catch (final OpenException e1) {
-					if (!background && !shownWarning) {
-						shownWarning = true;
-						logger.warn("Could not open workflow for merging: " + filePath, e1);
-						SwingUtilities.invokeLater(new Runnable() {
-							public void run() {
-								radioFile.requestFocus();
-								JOptionPane.showMessageDialog(parentComponent,
-										"An error occured while trying to open " + filePath + "\n"
-												+ e1.getMessage(), "Could not open workflow",
-										JOptionPane.WARNING_MESSAGE);
-								setVisible(true);
-							}
-						});
-					}
-				}
-			} else if (selection.equals(radioUrl.getModel())) {
-				final String url = fieldUrl.getText();
-				try {
-					DataflowInfo opened = fileManager.openDataflowSilently(null, new URL(url));
-					if (checkInterrupted()) {
-						return;
-					}
-					chosenDataflow = opened.getDataflow().getMainWorkflow();
-				} catch (final OpenException e1) {
-					if (!background && !shownWarning) {
-						logger.warn("Could not open source workflow: " + url, e1);
-						shownWarning = true;
-						SwingUtilities.invokeLater(new Runnable() {
-							public void run() {
-								fieldUrl.requestFocus();
-								JOptionPane.showMessageDialog(
-										parentComponent,
-										"An error occured while trying to open " + url + "\n"
-												+ e1.getMessage(), "Could not open workflow",
-										JOptionPane.WARNING_MESSAGE);
-								setVisible(true);
-							}
-						});
-
-					}
-					if (checkInterrupted()) {
-						return;
-					}
-				} catch (final MalformedURLException e1) {
-					if (!background && !shownWarning) {
-						logger.warn("Invalid workflow URL: " + url, e1);
-						shownWarning = true;
-						SwingUtilities.invokeLater(new Runnable() {
-							public void run() {
-								fieldUrl.requestFocus();
-								JOptionPane.showMessageDialog(
-										parentComponent,
-										"The workflow location " + url + " is invalid\n"
-												+ e1.getLocalizedMessage(), "Invalid URL",
-										JOptionPane.ERROR_MESSAGE);
-								setVisible(true);
-							}
-						});
-					}
-					if (checkInterrupted()) {
-						return;
-					}
-				}
-			} else if (selection.equals(radioOpened.getModel())) {
-				DataflowSelection chosen = (DataflowSelection) chooseDataflow.getSelectedItem();
-				chosenDataflow = chosen.getDataflow().getMainWorkflow();
-			} else if (selection.equals(radioCustomSource.getModel())) {
-				chosenDataflow = customSourceDataFlow.getMainWorkflow();
-			} else {
-				logger.error("Unknown selection " + selection);
-			}
-			if (checkInterrupted()) {
-				return;
-			}
-			if (chosenDataflow != ImportWorkflowWizard.this.sourceWorkflow) {
-				Profile chosenProfile = null;
-				if (chosenDataflow != null) {
-					chosenProfile = chosenDataflow.getParent().getMainProfile();
-				}
-				updateWorkflowGraphic(previewSource, chosenDataflow, chosenProfile);
-				if (checkInterrupted()) {
-					return;
-				}
-				ImportWorkflowWizard.this.sourceWorkflow = chosenDataflow;
-			}
-			if (chosenDataflow == null) {
-				if (!background && !shownWarning) {
-					shownWarning = true;
-					SwingUtilities.invokeLater(new Runnable() {
-						public void run() {
-							JOptionPane.showMessageDialog(parentComponent,
-									"You need to choose a workflow for merging",
-									"No workflow chosen", JOptionPane.ERROR_MESSAGE);
-							setVisible(true);
-						}
-					});
-				}
-			}
-		}
-
-		private boolean checkInterrupted() {
-			if (Thread.interrupted() || this.shouldStop) {
-				// ImportWorkflowWizard.this.chosenDataflow = null;
-				return true;
-			}
-			return false;
-		}
-	}
-
-	public static class DataflowSelection {
-		private final WorkflowBundle dataflow;
-		private final String name;
-
-		public DataflowSelection(WorkflowBundle dataflow, String name) {
-			this.dataflow = dataflow;
-			this.name = name;
-		}
-
-		public WorkflowBundle getDataflow() {
-			return dataflow;
-		}
-
-		public String getName() {
-			return name;
-		}
-
-		@Override
-		public String toString() {
-			return name;
-		}
-
-	}
-
-	protected class UpdateChosenListener implements ActionListener {
-		public void actionPerformed(ActionEvent e) {
-			Component parentComponent;
-			if (e.getSource() instanceof Component) {
-				parentComponent = (Component) e.getSource();
-			} else {
-				parentComponent = null;
-			}
-			findChosenDataflow(parentComponent, true);
-
-		}
-	}
-
-	public void setCustomSourceDataflow(WorkflowBundle sourceDataflow, String label) {
-		this.customSourceDataFlow = sourceDataflow;
-		this.customSourceName = label;
-		updateSourceSection();
-		radioCustomSource.doClick();
-	}
-
-//	public void setCustomDestinationDataflow(Workflow destinationDataflow, String label) {
-//		this.customDestinationDataflow = destinationDataflow;
-//		this.customDestinationName = label;
-//		updateDestinationSection();
-//		radioCustomDestination.doClick();
-//	}
-
-//	public void setDestinationEnabled(boolean destinationEnabled) {
-//		this.destinationEnabled = destinationEnabled;
-//		updateDestinationSection();
-//	}
-
-	public void setSourceEnabled(boolean sourceEnabled) {
-		this.sourceEnabled = sourceEnabled;
-		updateSourceSection();
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-dataflow-activity-ui/src/main/java/net/sf/taverna/t2/workbench/file/importworkflow/menu/AddNestedWorkflowMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-dataflow-activity-ui/src/main/java/net/sf/taverna/t2/workbench/file/importworkflow/menu/AddNestedWorkflowMenuAction.java b/taverna-dataflow-activity-ui/src/main/java/net/sf/taverna/t2/workbench/file/importworkflow/menu/AddNestedWorkflowMenuAction.java
deleted file mode 100644
index a37e308..0000000
--- a/taverna-dataflow-activity-ui/src/main/java/net/sf/taverna/t2/workbench/file/importworkflow/menu/AddNestedWorkflowMenuAction.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*******************************************************************************
- * 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.workbench.file.importworkflow.menu;
-
-import java.awt.event.InputEvent;
-import java.awt.event.KeyEvent;
-import java.net.URI;
-
-import javax.swing.Action;
-import javax.swing.KeyStroke;
-
-import net.sf.taverna.t2.ui.menu.AbstractMenuAction;
-import net.sf.taverna.t2.ui.menu.MenuManager;
-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.file.FileManager;
-import net.sf.taverna.t2.workbench.file.importworkflow.actions.AddNestedWorkflowAction;
-import net.sf.taverna.t2.workbench.selection.SelectionManager;
-import net.sf.taverna.t2.workbench.views.graph.menu.InsertMenu;
-
-/**
- * An action to add a nested workflow activity + a wrapping processor to the
- * workflow.
- *
- * @author Alex Nenadic
- * @author Stian Soiland-Reyes
- *
- */
-public class AddNestedWorkflowMenuAction extends AbstractMenuAction {
-
-	private static final String ADD_NESTED_WORKFLOW = "Nested workflow";
-
-	private static final URI ADD_NESTED_WORKFLOW_URI = URI
-			.create("http://taverna.sf.net/2008/t2workbench/menu#graphMenuAddNestedWorkflow");
-
-	private EditManager editManager;
-	private FileManager fileManager;
-	private MenuManager menuManager;
-	private ColourManager colourManager;
-	private WorkbenchConfiguration workbenchConfiguration;
-	private SelectionManager selectionManager;
-
-	public AddNestedWorkflowMenuAction() {
-		super(InsertMenu.INSERT, 400, ADD_NESTED_WORKFLOW_URI);
-	}
-
-	@Override
-	protected Action createAction() {
-		AddNestedWorkflowAction a = new AddNestedWorkflowAction(editManager, fileManager,
-				menuManager, colourManager, workbenchConfiguration, selectionManager);
-		// Override name to avoid "Add "
-		a.putValue(Action.NAME, ADD_NESTED_WORKFLOW);
-		a.putValue(Action.SHORT_DESCRIPTION, ADD_NESTED_WORKFLOW);
-		a.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(
-				KeyEvent.VK_N, InputEvent.SHIFT_DOWN_MASK
-						| InputEvent.ALT_DOWN_MASK));
-		return a;
-
-	}
-
-	public void setEditManager(EditManager editManager) {
-		this.editManager = editManager;
-	}
-
-	public void setFileManager(FileManager fileManager) {
-		this.fileManager = fileManager;
-	}
-
-	public void setMenuManager(MenuManager menuManager) {
-		this.menuManager = menuManager;
-	}
-
-	public void setColourManager(ColourManager colourManager) {
-		this.colourManager = colourManager;
-	}
-
-	public void setWorkbenchConfiguration(WorkbenchConfiguration workbenchConfiguration) {
-		this.workbenchConfiguration = workbenchConfiguration;
-	}
-
-	public void setSelectionManager(SelectionManager selectionManager) {
-		this.selectionManager = selectionManager;
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-dataflow-activity-ui/src/main/java/net/sf/taverna/t2/workbench/file/importworkflow/menu/ImportWorkflowMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-dataflow-activity-ui/src/main/java/net/sf/taverna/t2/workbench/file/importworkflow/menu/ImportWorkflowMenuAction.java b/taverna-dataflow-activity-ui/src/main/java/net/sf/taverna/t2/workbench/file/importworkflow/menu/ImportWorkflowMenuAction.java
deleted file mode 100644
index 9ce6e01..0000000
--- a/taverna-dataflow-activity-ui/src/main/java/net/sf/taverna/t2/workbench/file/importworkflow/menu/ImportWorkflowMenuAction.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*******************************************************************************
- * 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.workbench.file.importworkflow.menu;
-
-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.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.file.FileManager;
-import net.sf.taverna.t2.workbench.file.importworkflow.actions.ImportWorkflowAction;
-import net.sf.taverna.t2.workbench.selection.SelectionManager;
-import org.apache.taverna.scufl2.api.core.Workflow;
-
-/**
- * An action to import nested/merged workflows.
- *
- * @author Alex Nenadic
- * @author Stian Soiland-Reyes
- *
- */
-public class ImportWorkflowMenuAction extends AbstractContextualMenuAction {
-
-	private static final URI insertSection = URI
-			.create("http://taverna.sf.net/2009/contextMenu/insert");
-
-	private EditManager editManager;
-	private FileManager fileManager;
-	private MenuManager menuManager;
-	private ColourManager colourManager;
-	private WorkbenchConfiguration workbenchConfiguration;
-	private SelectionManager selectionManager;
-
-	public ImportWorkflowMenuAction() {
-		super(insertSection, 400);
-	}
-
-	@Override
-	public boolean isEnabled() {
-		return super.isEnabled() && getContextualSelection().getSelection() instanceof Workflow;
-	}
-
-	@Override
-	protected Action createAction() {
-		ImportWorkflowAction myAction = new ImportWorkflowAction(editManager, fileManager,
-				menuManager, colourManager, workbenchConfiguration, selectionManager);
-		// Just "Workflow" as we go under the "Insert" menu
-		myAction.putValue(Action.NAME, "Nested workflow");
-		return myAction;
-	}
-
-	public void setEditManager(EditManager editManager) {
-		this.editManager = editManager;
-	}
-
-	public void setFileManager(FileManager fileManager) {
-		this.fileManager = fileManager;
-	}
-
-	public void setMenuManager(MenuManager menuManager) {
-		this.menuManager = menuManager;
-	}
-
-	public void setColourManager(ColourManager colourManager) {
-		this.colourManager = colourManager;
-	}
-
-	public void setWorkbenchConfiguration(WorkbenchConfiguration workbenchConfiguration) {
-		this.workbenchConfiguration = workbenchConfiguration;
-	}
-
-	public void setSelectionManager(SelectionManager selectionManager) {
-		this.selectionManager = selectionManager;
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-dataflow-activity-ui/src/main/java/net/sf/taverna/t2/workbench/file/importworkflow/menu/MergeWorkflowMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-dataflow-activity-ui/src/main/java/net/sf/taverna/t2/workbench/file/importworkflow/menu/MergeWorkflowMenuAction.java b/taverna-dataflow-activity-ui/src/main/java/net/sf/taverna/t2/workbench/file/importworkflow/menu/MergeWorkflowMenuAction.java
deleted file mode 100644
index 7ce4891..0000000
--- a/taverna-dataflow-activity-ui/src/main/java/net/sf/taverna/t2/workbench/file/importworkflow/menu/MergeWorkflowMenuAction.java
+++ /dev/null
@@ -1,65 +0,0 @@
-package net.sf.taverna.t2.workbench.file.importworkflow.menu;
-
-import java.net.URI;
-
-import javax.swing.Action;
-
-import net.sf.taverna.t2.ui.menu.AbstractMenuAction;
-import net.sf.taverna.t2.ui.menu.MenuManager;
-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.file.FileManager;
-import net.sf.taverna.t2.workbench.file.importworkflow.actions.MergeWorkflowAction;
-import net.sf.taverna.t2.workbench.selection.SelectionManager;
-
-public class MergeWorkflowMenuAction extends AbstractMenuAction {
-
-	public static final URI INSERT_URI = URI
-			.create("http://taverna.sf.net/2008/t2workbench/menu#insert");
-
-	public static final URI IMPORT_URI = URI
-			.create("http://taverna.sf.net/2008/t2workbench/menu#insert");
-
-	private EditManager editManager;
-	private FileManager fileManager;
-	private MenuManager menuManager;
-	private ColourManager colourManager;
-	private WorkbenchConfiguration workbenchConfiguration;
-	private SelectionManager selectionManager;
-
-	public MergeWorkflowMenuAction() {
-		super(INSERT_URI, 2000, IMPORT_URI);
-	}
-
-	@Override
-	protected Action createAction() {
-		return new MergeWorkflowAction(editManager, fileManager, menuManager, colourManager,
-				workbenchConfiguration, selectionManager);
-	}
-
-	public void setEditManager(EditManager editManager) {
-		this.editManager = editManager;
-	}
-
-	public void setFileManager(FileManager fileManager) {
-		this.fileManager = fileManager;
-	}
-
-	public void setMenuManager(MenuManager menuManager) {
-		this.menuManager = menuManager;
-	}
-
-	public void setColourManager(ColourManager colourManager) {
-		this.colourManager = colourManager;
-	}
-
-	public void setWorkbenchConfiguration(WorkbenchConfiguration workbenchConfiguration) {
-		this.workbenchConfiguration = workbenchConfiguration;
-	}
-
-	public void setSelectionManager(SelectionManager selectionManager) {
-		this.selectionManager = selectionManager;
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-dataflow-activity-ui/src/main/java/net/sf/taverna/t2/workbench/file/importworkflow/menu/ReplaceNestedWorkflowMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-dataflow-activity-ui/src/main/java/net/sf/taverna/t2/workbench/file/importworkflow/menu/ReplaceNestedWorkflowMenuAction.java b/taverna-dataflow-activity-ui/src/main/java/net/sf/taverna/t2/workbench/file/importworkflow/menu/ReplaceNestedWorkflowMenuAction.java
deleted file mode 100644
index 3d424df..0000000
--- a/taverna-dataflow-activity-ui/src/main/java/net/sf/taverna/t2/workbench/file/importworkflow/menu/ReplaceNestedWorkflowMenuAction.java
+++ /dev/null
@@ -1,76 +0,0 @@
-package net.sf.taverna.t2.workbench.file.importworkflow.menu;
-
-import java.net.URI;
-
-import javax.swing.Action;
-
-import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionRegistry;
-import net.sf.taverna.t2.ui.menu.MenuManager;
-import net.sf.taverna.t2.workbench.activityicons.ActivityIconManager;
-import net.sf.taverna.t2.workbench.activitytools.AbstractConfigureActivityMenuAction;
-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.file.FileManager;
-import net.sf.taverna.t2.workbench.file.importworkflow.actions.ReplaceNestedWorkflowAction;
-import net.sf.taverna.t2.workbench.selection.SelectionManager;
-
-public class ReplaceNestedWorkflowMenuAction extends AbstractConfigureActivityMenuAction {
-
-	private static final URI NESTED_ACTIVITY = URI.create("http://ns.taverna.org.uk/2010/activity/nested-workflow");
-
-	private EditManager editManager;
-	private FileManager fileManager;
-	private MenuManager menuManager;
-	private ActivityIconManager activityIconManager;
-	private ColourManager colourManager;
-	private WorkbenchConfiguration workbenchConfiguration;
-	private ServiceDescriptionRegistry serviceDescriptionRegistry;
-	private SelectionManager selectionManager;
-
-	public ReplaceNestedWorkflowMenuAction() {
-		super(NESTED_ACTIVITY);
-	}
-
-	@Override
-	protected Action createAction() {
-		ReplaceNestedWorkflowAction configAction = new ReplaceNestedWorkflowAction(findActivity(),
-				editManager, fileManager, menuManager, activityIconManager, colourManager,
-				serviceDescriptionRegistry, workbenchConfiguration, selectionManager);
-		addMenuDots(configAction);
-		return configAction;
-	}
-
-	public void setEditManager(EditManager editManager) {
-		this.editManager = editManager;
-	}
-
-	public void setFileManager(FileManager fileManager) {
-		this.fileManager = fileManager;
-	}
-
-	public void setMenuManager(MenuManager menuManager) {
-		this.menuManager = menuManager;
-	}
-
-	public void setActivityIconManager(ActivityIconManager activityIconManager) {
-		this.activityIconManager = activityIconManager;
-	}
-
-	public void setColourManager(ColourManager colourManager) {
-		this.colourManager = colourManager;
-	}
-
-	public void setServiceDescriptionRegistry(ServiceDescriptionRegistry serviceDescriptionRegistry) {
-		this.serviceDescriptionRegistry = serviceDescriptionRegistry;
-	}
-
-	public void setWorkbenchConfiguration(WorkbenchConfiguration workbenchConfiguration) {
-		this.workbenchConfiguration = workbenchConfiguration;
-	}
-
-	public void setSelectionManager(SelectionManager selectionManager) {
-		this.selectionManager = selectionManager;
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-dataflow-activity-ui/src/main/java/org/apache/taverna/activities/dataflow/actions/EditNestedDataflowAction.java
----------------------------------------------------------------------
diff --git a/taverna-dataflow-activity-ui/src/main/java/org/apache/taverna/activities/dataflow/actions/EditNestedDataflowAction.java b/taverna-dataflow-activity-ui/src/main/java/org/apache/taverna/activities/dataflow/actions/EditNestedDataflowAction.java
new file mode 100644
index 0000000..3c71f8e
--- /dev/null
+++ b/taverna-dataflow-activity-ui/src/main/java/org/apache/taverna/activities/dataflow/actions/EditNestedDataflowAction.java
@@ -0,0 +1,46 @@
+/**
+ *
+ */
+package org.apache.taverna.activities.dataflow.actions;
+
+import java.awt.event.ActionEvent;
+
+import javax.swing.AbstractAction;
+
+import com.fasterxml.jackson.databind.JsonNode;
+
+import org.apache.taverna.activities.dataflow.servicedescriptions.DataflowTemplateService;
+import org.apache.taverna.workbench.selection.SelectionManager;
+import org.apache.taverna.scufl2.api.activity.Activity;
+import org.apache.taverna.scufl2.api.common.Scufl2Tools;
+import org.apache.taverna.scufl2.api.configurations.Configuration;
+import org.apache.taverna.scufl2.api.core.Workflow;
+
+@SuppressWarnings("serial")
+public class EditNestedDataflowAction extends AbstractAction {
+
+	private final Activity activity;
+	private final SelectionManager selectionManager;
+
+	private Scufl2Tools scufl2Tools = new Scufl2Tools();
+
+	public EditNestedDataflowAction(Activity activity, SelectionManager selectionManager) {
+		super("Edit nested workflow");
+		this.activity = activity;
+		this.selectionManager = selectionManager;
+	}
+
+	public void actionPerformed(ActionEvent e) {
+		if (activity.getType().equals(DataflowTemplateService.ACTIVITY_TYPE)) {
+			for (Configuration configuration : scufl2Tools.configurationsFor(activity, selectionManager.getSelectedProfile())) {
+				JsonNode nested = configuration.getJson().get("nestedWorkflow");
+				Workflow nestedWorkflow = selectionManager.getSelectedWorkflowBundle().getWorkflows().getByName(nested.asText());
+				if (nestedWorkflow != null) {
+					selectionManager.setSelectedWorkflow(nestedWorkflow);
+					break;
+				}
+			}
+		}
+	}
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-dataflow-activity-ui/src/main/java/org/apache/taverna/activities/dataflow/menu/EditNestedDataflowMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-dataflow-activity-ui/src/main/java/org/apache/taverna/activities/dataflow/menu/EditNestedDataflowMenuAction.java b/taverna-dataflow-activity-ui/src/main/java/org/apache/taverna/activities/dataflow/menu/EditNestedDataflowMenuAction.java
new file mode 100644
index 0000000..9fb9a0d
--- /dev/null
+++ b/taverna-dataflow-activity-ui/src/main/java/org/apache/taverna/activities/dataflow/menu/EditNestedDataflowMenuAction.java
@@ -0,0 +1,28 @@
+package org.apache.taverna.activities.dataflow.menu;
+
+import javax.swing.Action;
+
+import org.apache.taverna.activities.dataflow.actions.EditNestedDataflowAction;
+import org.apache.taverna.activities.dataflow.servicedescriptions.DataflowTemplateService;
+import org.apache.taverna.workbench.activitytools.AbstractConfigureActivityMenuAction;
+import org.apache.taverna.workbench.selection.SelectionManager;
+
+public class EditNestedDataflowMenuAction extends AbstractConfigureActivityMenuAction {
+
+	private SelectionManager selectionManager;
+
+	public EditNestedDataflowMenuAction() {
+		super(DataflowTemplateService.ACTIVITY_TYPE);
+	}
+
+	@Override
+	protected Action createAction() {
+		EditNestedDataflowAction configAction = new EditNestedDataflowAction(findActivity(), selectionManager);
+		return configAction;
+	}
+
+	public void setSelectionManager(SelectionManager selectionManager) {
+		this.selectionManager = selectionManager;
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-dataflow-activity-ui/src/main/java/org/apache/taverna/activities/dataflow/servicedescriptions/DataflowActivityIcon.java
----------------------------------------------------------------------
diff --git a/taverna-dataflow-activity-ui/src/main/java/org/apache/taverna/activities/dataflow/servicedescriptions/DataflowActivityIcon.java b/taverna-dataflow-activity-ui/src/main/java/org/apache/taverna/activities/dataflow/servicedescriptions/DataflowActivityIcon.java
new file mode 100644
index 0000000..2ce6ab9
--- /dev/null
+++ b/taverna-dataflow-activity-ui/src/main/java/org/apache/taverna/activities/dataflow/servicedescriptions/DataflowActivityIcon.java
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * 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 org.apache.taverna.activities.dataflow.servicedescriptions;
+
+import java.net.URI;
+
+import javax.swing.Icon;
+import javax.swing.ImageIcon;
+
+import org.apache.taverna.workbench.activityicons.ActivityIconSPI;
+
+/**
+ *
+ * @author Alex Nenadic
+ * @author alanrw
+ *
+ */
+public class DataflowActivityIcon implements ActivityIconSPI{
+
+	private static Icon icon;
+
+	public int canProvideIconScore(URI activityType) {
+		if (DataflowTemplateService.ACTIVITY_TYPE.equals(activityType))
+			return DEFAULT_ICON + 1;
+		else
+			return NO_ICON;
+	}
+
+	public Icon getIcon(URI activityType) {
+		return getDataflowIcon();
+	}
+
+	public static Icon getDataflowIcon() {
+		if (icon == null) {
+			icon = new ImageIcon(DataflowActivityIcon.class.getResource("/dataflow.png"));
+		}
+		return icon;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-dataflow-activity-ui/src/main/java/org/apache/taverna/activities/dataflow/servicedescriptions/DataflowTemplateService.java
----------------------------------------------------------------------
diff --git a/taverna-dataflow-activity-ui/src/main/java/org/apache/taverna/activities/dataflow/servicedescriptions/DataflowTemplateService.java b/taverna-dataflow-activity-ui/src/main/java/org/apache/taverna/activities/dataflow/servicedescriptions/DataflowTemplateService.java
new file mode 100644
index 0000000..bd16c05
--- /dev/null
+++ b/taverna-dataflow-activity-ui/src/main/java/org/apache/taverna/activities/dataflow/servicedescriptions/DataflowTemplateService.java
@@ -0,0 +1,60 @@
+package org.apache.taverna.activities.dataflow.servicedescriptions;
+
+import java.net.URI;
+
+import javax.swing.Icon;
+
+import org.apache.taverna.servicedescriptions.AbstractTemplateService;
+import org.apache.taverna.servicedescriptions.ServiceDescription;
+import org.apache.taverna.servicedescriptions.ServiceDescriptionProvider;
+import org.apache.taverna.scufl2.api.configurations.Configuration;
+
+public class DataflowTemplateService extends AbstractTemplateService {
+
+	public static final URI ACTIVITY_TYPE = URI.create("http://ns.taverna.org.uk/2010/activity/nested-workflow");
+
+	private static final String A_CONFIGURABLE_NESTED_WORKFLOW = "A service that allows you to have one workflow nested within another";
+	private static final String DATAFLOW = "Nested workflow";
+
+	private static final URI providerId = URI.create("http://taverna.sf.net/2010/service-provider/dataflow");
+
+	@Override
+	public URI getActivityType() {
+		return ACTIVITY_TYPE;
+	}
+
+	@Override
+	public Configuration getActivityConfiguration() {
+		Configuration configuration = new Configuration();
+		configuration.setType(ACTIVITY_TYPE.resolve("#Config"));
+		return configuration;
+	}
+
+	@Override
+	public Icon getIcon() {
+		return DataflowActivityIcon.getDataflowIcon();
+	}
+
+	public String getName() {
+		return DATAFLOW;
+	}
+
+	public String getDescription() {
+		return A_CONFIGURABLE_NESTED_WORKFLOW;
+	}
+
+	public static ServiceDescription getServiceDescription() {
+		DataflowTemplateService dts = new DataflowTemplateService();
+		return dts.templateService;
+	}
+
+	public String getId() {
+		return providerId.toString();
+	}
+
+    @Override
+    public ServiceDescriptionProvider newInstance() {
+        return new DataflowTemplateService();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-dataflow-activity-ui/src/main/java/org/apache/taverna/activities/dataflow/views/DataflowActivityContextualView.java
----------------------------------------------------------------------
diff --git a/taverna-dataflow-activity-ui/src/main/java/org/apache/taverna/activities/dataflow/views/DataflowActivityContextualView.java b/taverna-dataflow-activity-ui/src/main/java/org/apache/taverna/activities/dataflow/views/DataflowActivityContextualView.java
new file mode 100644
index 0000000..a0517c5
--- /dev/null
+++ b/taverna-dataflow-activity-ui/src/main/java/org/apache/taverna/activities/dataflow/views/DataflowActivityContextualView.java
@@ -0,0 +1,140 @@
+/*******************************************************************************
+ * 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 org.apache.taverna.activities.dataflow.views;
+
+import java.awt.BorderLayout;
+import java.awt.FlowLayout;
+import java.awt.Frame;
+
+import javax.swing.Action;
+import javax.swing.JButton;
+import javax.swing.JComponent;
+import javax.swing.JPanel;
+
+import org.apache.taverna.activities.dataflow.actions.EditNestedDataflowAction;
+import org.apache.taverna.servicedescriptions.ServiceDescriptionRegistry;
+import org.apache.taverna.ui.menu.MenuManager;
+import org.apache.taverna.workbench.activityicons.ActivityIconManager;
+import org.apache.taverna.workbench.configuration.colour.ColourManager;
+import org.apache.taverna.workbench.configuration.workbench.WorkbenchConfiguration;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.file.FileManager;
+import org.apache.taverna.workbench.file.importworkflow.actions.ReplaceNestedWorkflowAction;
+import org.apache.taverna.workbench.selection.SelectionManager;
+import org.apache.taverna.workbench.ui.actions.activity.HTMLBasedActivityContextualView;
+
+import org.apache.log4j.Logger;
+
+import org.apache.taverna.scufl2.api.activity.Activity;
+
+@SuppressWarnings("serial")
+public class DataflowActivityContextualView extends HTMLBasedActivityContextualView {
+
+	static Logger logger = Logger.getLogger(DataflowActivityContextualView.class);
+
+	private final EditManager editManager;
+	private final FileManager fileManager;
+	private final MenuManager menuManager;
+	private final ActivityIconManager activityIconManager;
+	private final ColourManager colourManager;
+	private final WorkbenchConfiguration workbenchConfiguration;
+	private final ServiceDescriptionRegistry serviceDescriptionRegistry;
+
+	private final SelectionManager selectionManager;
+
+	public DataflowActivityContextualView(Activity activity, EditManager editManager,
+			FileManager fileManager, MenuManager menuManager,
+			ActivityIconManager activityIconManager, ColourManager colourManager,
+			ServiceDescriptionRegistry serviceDescriptionRegistry,
+			WorkbenchConfiguration workbenchConfiguration, SelectionManager selectionManager) {
+		super(activity, colourManager);
+		this.editManager = editManager;
+		this.fileManager = fileManager;
+		this.menuManager = menuManager;
+		this.activityIconManager = activityIconManager;
+		this.colourManager = colourManager;
+		this.serviceDescriptionRegistry = serviceDescriptionRegistry;
+		this.workbenchConfiguration = workbenchConfiguration;
+		this.selectionManager = selectionManager;
+		addEditButtons();
+	}
+
+	@Override
+	public Activity getActivity() {
+		return super.getActivity();
+	}
+
+	public void addEditButtons() {
+		JComponent mainFrame = getMainFrame();
+		JButton viewWorkflowButton = new JButton("Edit workflow");
+		viewWorkflowButton.addActionListener(new EditNestedDataflowAction(getActivity(),
+				selectionManager));
+		JButton configureButton = new JButton(new ReplaceNestedWorkflowAction(getActivity(),
+				editManager, fileManager, menuManager, activityIconManager, colourManager,
+				serviceDescriptionRegistry, workbenchConfiguration, selectionManager));
+		configureButton.setIcon(null);
+		JPanel flowPanel = new JPanel(new FlowLayout());
+		flowPanel.add(viewWorkflowButton);
+		flowPanel.add(configureButton);
+		mainFrame.add(flowPanel, BorderLayout.SOUTH);
+		mainFrame.revalidate();
+	}
+
+//	@Override
+//	public JComponent getMainFrame() {
+//		JComponent mainFrame = super.getMainFrame();
+//		JButton viewWorkflowButton = new JButton("Edit workflow");
+//		viewWorkflowButton.addActionListener(new EditNestedDataflowAction(getActivity(),
+//				selectionManager));
+//		JButton configureButton = new JButton(new ReplaceNestedWorkflowAction(getActivity(),
+//				editManager, fileManager, menuManager, activityIconManager, colourManager,
+//				serviceDescriptionRegistry, workbenchConfiguration, selectionManager));
+//		configureButton.setIcon(null);
+//		JPanel flowPanel = new JPanel(new FlowLayout());
+//		flowPanel.add(viewWorkflowButton);
+//		flowPanel.add(configureButton);
+//		mainFrame.add(flowPanel, BorderLayout.SOUTH);
+//		return mainFrame;
+//	}
+
+	@Override
+	protected String getRawTableRowsHtml() {
+		return ("<tr><td colspan=2>" + getActivity().getName() + "</td></tr>");
+	}
+
+	@Override
+	public String getViewTitle() {
+		return "Nested workflow";
+	}
+
+	@Override
+	public Action getConfigureAction(Frame owner) {
+		return null;
+		// return new OpenNestedDataflowFromFileAction(
+		// (DataflowActivity) getActivity(), owner);
+	}
+
+	@Override
+	public int getPreferredPosition() {
+		return 100;
+	}
+
+}


[16/51] [partial] incubator-taverna-workbench git commit: all packages are moved to org.apache.taverna.*

Posted by re...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-graph-model/src/main/java/net/sf/taverna/t2/workbench/models/graph/svg/SVGGraph.java
----------------------------------------------------------------------
diff --git a/taverna-graph-model/src/main/java/net/sf/taverna/t2/workbench/models/graph/svg/SVGGraph.java b/taverna-graph-model/src/main/java/net/sf/taverna/t2/workbench/models/graph/svg/SVGGraph.java
deleted file mode 100644
index be92cdd..0000000
--- a/taverna-graph-model/src/main/java/net/sf/taverna/t2/workbench/models/graph/svg/SVGGraph.java
+++ /dev/null
@@ -1,439 +0,0 @@
-/*******************************************************************************
- * 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.models.graph.svg;
-
-import static net.sf.taverna.t2.workbench.models.graph.svg.SVGGraphSettings.COMPLETED_COLOUR;
-import static net.sf.taverna.t2.workbench.models.graph.svg.SVGUtil.animate;
-import static net.sf.taverna.t2.workbench.models.graph.svg.SVGUtil.calculatePoints;
-import static net.sf.taverna.t2.workbench.models.graph.svg.SVGUtil.createAnimationElement;
-import static org.apache.batik.util.CSSConstants.CSS_BLACK_VALUE;
-import static org.apache.batik.util.CSSConstants.CSS_NONE_VALUE;
-import static org.apache.batik.util.SVGConstants.SVG_ANIMATE_TAG;
-import static org.apache.batik.util.SVGConstants.SVG_ANIMATE_TRANSFORM_TAG;
-import static org.apache.batik.util.SVGConstants.SVG_CLICK_EVENT_TYPE;
-import static org.apache.batik.util.SVGConstants.SVG_END_VALUE;
-import static org.apache.batik.util.SVGConstants.SVG_FILL_ATTRIBUTE;
-import static org.apache.batik.util.SVGConstants.SVG_FONT_FAMILY_ATTRIBUTE;
-import static org.apache.batik.util.SVGConstants.SVG_FONT_SIZE_ATTRIBUTE;
-import static org.apache.batik.util.SVGConstants.SVG_MIDDLE_VALUE;
-import static org.apache.batik.util.SVGConstants.SVG_MOUSEMOVE_EVENT_TYPE;
-import static org.apache.batik.util.SVGConstants.SVG_MOUSEUP_EVENT_TYPE;
-import static org.apache.batik.util.SVGConstants.SVG_NONE_VALUE;
-import static org.apache.batik.util.SVGConstants.SVG_POINTS_ATTRIBUTE;
-import static org.apache.batik.util.SVGConstants.SVG_STROKE_ATTRIBUTE;
-import static org.apache.batik.util.SVGConstants.SVG_STROKE_DASHARRAY_ATTRIBUTE;
-import static org.apache.batik.util.SVGConstants.SVG_STROKE_WIDTH_ATTRIBUTE;
-import static org.apache.batik.util.SVGConstants.SVG_TEXT_ANCHOR_ATTRIBUTE;
-import static org.apache.batik.util.SVGConstants.SVG_TRANSFORM_ATTRIBUTE;
-import static org.apache.batik.util.SVGConstants.TRANSFORM_TRANSLATE;
-
-import java.awt.Color;
-import java.awt.Dimension;
-import java.awt.Point;
-
-import net.sf.taverna.t2.workbench.models.graph.Graph;
-import net.sf.taverna.t2.workbench.models.graph.GraphEdge;
-import net.sf.taverna.t2.workbench.models.graph.GraphNode;
-import net.sf.taverna.t2.workbench.models.graph.svg.event.SVGMouseClickEventListener;
-import net.sf.taverna.t2.workbench.models.graph.svg.event.SVGMouseMovedEventListener;
-import net.sf.taverna.t2.workbench.models.graph.svg.event.SVGMouseOutEventListener;
-import net.sf.taverna.t2.workbench.models.graph.svg.event.SVGMouseOverEventListener;
-import net.sf.taverna.t2.workbench.models.graph.svg.event.SVGMouseUpEventListener;
-
-import org.apache.batik.dom.svg.SVGOMAnimationElement;
-import org.apache.batik.dom.svg.SVGOMGElement;
-import org.apache.batik.dom.svg.SVGOMPolygonElement;
-import org.apache.batik.dom.svg.SVGOMTextElement;
-import org.w3c.dom.Text;
-import org.w3c.dom.events.EventTarget;
-import org.w3c.dom.svg.SVGElement;
-
-/**
- * SVG representation of a graph.
- * 
- * @author David Withers
- */
-public class SVGGraph extends Graph {
-	private SVGGraphController graphController;
-	private SVGGraphElementDelegate delegate;
-	private SVGMouseClickEventListener mouseClickAction;
-	private SVGMouseMovedEventListener mouseMovedAction;
-	private SVGMouseUpEventListener mouseUpAction;
-	@SuppressWarnings("unused")
-	private SVGMouseOverEventListener mouseOverAction;
-	@SuppressWarnings("unused")
-	private SVGMouseOutEventListener mouseOutAction;
-	private SVGOMGElement mainGroup, labelGroup;
-	private SVGOMPolygonElement polygon, completedPolygon;
-	private SVGOMTextElement label, iteration, error;
-	private Text labelText, iterationText, errorsText;
-	private SVGOMAnimationElement animateShape, animatePosition, animateLabel;
-
-	public SVGGraph(SVGGraphController graphController) {
-		super(graphController);
-		this.graphController = graphController;
-
-		mouseClickAction = new SVGMouseClickEventListener(this);
-		mouseMovedAction = new SVGMouseMovedEventListener(this);
-		mouseUpAction = new SVGMouseUpEventListener(this);
-		mouseOverAction = new SVGMouseOverEventListener(this);
-		mouseOutAction = new SVGMouseOutEventListener(this);
-
-		mainGroup = graphController.createGElem();
-		mainGroup.setAttribute(SVG_FONT_SIZE_ATTRIBUTE, "10");
-		mainGroup.setAttribute(SVG_FONT_FAMILY_ATTRIBUTE, "Helvetica");
-		mainGroup.setAttribute(SVG_STROKE_ATTRIBUTE, CSS_BLACK_VALUE);
-		mainGroup.setAttribute(SVG_STROKE_DASHARRAY_ATTRIBUTE, CSS_NONE_VALUE);
-		mainGroup.setAttribute(SVG_STROKE_WIDTH_ATTRIBUTE, "1");
-		mainGroup.setAttribute(SVG_FILL_ATTRIBUTE, CSS_NONE_VALUE);
-
-		EventTarget t = (EventTarget) mainGroup;
-		t.addEventListener(SVG_CLICK_EVENT_TYPE, mouseClickAction, false);
-		t.addEventListener(SVG_MOUSEMOVE_EVENT_TYPE, mouseMovedAction, false);
-		t.addEventListener(SVG_MOUSEUP_EVENT_TYPE, mouseUpAction, false);
-		// t.addEventListener(SVGConstants.SVG_MOUSEOVER_EVENT_TYPE, mouseOverAction, false);
-		// t.addEventListener(SVGConstants.SVG_MOUSEOUT_EVENT_TYPE, mouseOutAction, false);
-
-		polygon = graphController.createPolygon();
-		mainGroup.appendChild(polygon);
-
-		completedPolygon = graphController.createPolygon();
-		completedPolygon.setAttribute(SVG_POINTS_ATTRIBUTE,
-				calculatePoints(getShape(), 0, 0));
-		completedPolygon.setAttribute(SVG_FILL_ATTRIBUTE, COMPLETED_COLOUR);
-		// completedPolygon.setAttribute(SVGConstants.SVG_FILL_OPACITY_ATTRIBUTE, "0.8");
-		// completedPolygon.setAttribute(SVG_STROKE_ATTRIBUTE, SVG_NONE_VALUE);
-		mainGroup.appendChild(completedPolygon);
-
-		labelText = graphController.createText("");
-		label = graphController.createText(labelText);
-		label.setAttribute(SVG_TEXT_ANCHOR_ATTRIBUTE, SVG_MIDDLE_VALUE);
-		label.setAttribute(SVG_FILL_ATTRIBUTE, CSS_BLACK_VALUE);
-		label.setAttribute(SVG_STROKE_ATTRIBUTE, SVG_NONE_VALUE);
-		labelGroup = graphController.createGElem();
-		labelGroup.appendChild(label);
-		mainGroup.appendChild(labelGroup);
-
-		iterationText = graphController.createText("");
-		iteration = graphController.createText(iterationText);
-		iteration.setAttribute(SVG_TEXT_ANCHOR_ATTRIBUTE, SVG_END_VALUE);
-		iteration.setAttribute(SVG_FONT_SIZE_ATTRIBUTE, "6");
-		iteration.setAttribute(SVG_FONT_FAMILY_ATTRIBUTE, "sans-serif");
-		iteration.setAttribute(SVG_FILL_ATTRIBUTE, CSS_BLACK_VALUE);
-		iteration.setAttribute(SVG_STROKE_ATTRIBUTE, SVG_NONE_VALUE);
-		polygon.appendChild(iteration);
-
-		errorsText = graphController.createText("");
-		error = graphController.createText(errorsText);
-		error.setAttribute(SVG_TEXT_ANCHOR_ATTRIBUTE, SVG_END_VALUE);
-		error.setAttribute(SVG_FONT_SIZE_ATTRIBUTE, "6");
-		error.setAttribute(SVG_FONT_FAMILY_ATTRIBUTE, "sans-serif");
-		error.setAttribute(SVG_FILL_ATTRIBUTE, CSS_BLACK_VALUE);
-		error.setAttribute(SVG_STROKE_ATTRIBUTE, SVG_NONE_VALUE);
-		polygon.appendChild(error);
-
-		animateShape = createAnimationElement(graphController, SVG_ANIMATE_TAG,
-				SVG_POINTS_ATTRIBUTE, null);
-
-		animatePosition = createAnimationElement(graphController,
-				SVG_ANIMATE_TRANSFORM_TAG, SVG_TRANSFORM_ATTRIBUTE,
-				TRANSFORM_TRANSLATE);
-
-		animateLabel = createAnimationElement(graphController,
-				SVG_ANIMATE_TRANSFORM_TAG, SVG_TRANSFORM_ATTRIBUTE,
-				TRANSFORM_TRANSLATE);
-
-		delegate = new SVGGraphElementDelegate(graphController, this, mainGroup);
-	}
-
-	public SVGElement getSVGElement() {
-		return mainGroup;
-	}
-
-	@Override
-	public void addEdge(GraphEdge edge) {
-		if (edge instanceof SVGGraphEdge) {
-			final SVGGraphEdge svgGraphEdge = (SVGGraphEdge) edge;
-			graphController.updateSVGDocument(new Runnable() {
-				@Override
-				public void run() {
-				    float opacity = svgGraphEdge.getOpacity();
-					svgGraphEdge.setOpacity(0);
-					mainGroup.appendChild(svgGraphEdge.getSVGElement());
-					svgGraphEdge.setOpacity(opacity);
-				}
-			});
-		}
-		super.addEdge(edge);
-	}
-
-	@Override
-	public void addNode(GraphNode node) {
-		super.addNode(node);
-		if (node instanceof SVGGraphNode) {
-			final SVGGraphNode svgGraphNode = (SVGGraphNode) node;
-			graphController.updateSVGDocument(new Runnable() {
-				@Override
-				public void run() {
-				    float opacity = svgGraphNode.getOpacity();
-					svgGraphNode.setOpacity(0);
-					mainGroup.appendChild(svgGraphNode.getSVGElement());
-					svgGraphNode.setOpacity(opacity);
-				}
-			});
-		}
-	}
-
-	@Override
-	public void addSubgraph(Graph subgraph) {
-		super.addSubgraph(subgraph);
-		if (subgraph instanceof SVGGraph) {
-			final SVGGraph svgGraph = (SVGGraph) subgraph;
-			graphController.updateSVGDocument(new Runnable() {
-				@Override
-				public void run() {
-				    float opacity = svgGraph.getOpacity();
-					svgGraph.setOpacity(0);
-					mainGroup.appendChild(svgGraph.getSVGElement());
-					svgGraph.setOpacity(opacity);
-				}
-			});
-		}
-	}
-
-	@Override
-	public boolean removeEdge(GraphEdge edge) {
-		if (edge instanceof SVGGraphEdge) {
-			final SVGGraphEdge svgGraphEdge = (SVGGraphEdge) edge;
-			graphController.updateSVGDocument(new Runnable() {
-				@Override
-				public void run() {
-					mainGroup.removeChild(svgGraphEdge.getSVGElement());
-				}
-			});
-		}
-		return super.removeEdge(edge);
-	}
-
-	@Override
-	public boolean removeNode(GraphNode node) {
-		if (node instanceof SVGGraphNode) {
-			final SVGGraphNode svgGraphNode = (SVGGraphNode) node;
-			graphController.updateSVGDocument(new Runnable() {
-				@Override
-				public void run() {
-					mainGroup.removeChild(svgGraphNode.getSVGElement());
-				}
-			});
-		}
-		return super.removeNode(node);
-	}
-
-	@Override
-	public boolean removeSubgraph(Graph subgraph) {
-		if (subgraph instanceof SVGGraph) {
-			final SVGGraph svgGraph = (SVGGraph) subgraph;
-			graphController.updateSVGDocument(new Runnable() {
-				@Override
-				public void run() {
-					mainGroup.removeChild(svgGraph.getSVGElement());
-				}
-			});
-		}
-		return super.removeSubgraph(subgraph);
-	}
-
-	@Override
-	public void setPosition(final Point position) {
-		final Point oldPosition = getPosition();
-		if (position != null && !position.equals(oldPosition)) {
-			super.setPosition(position);
-			graphController.updateSVGDocument(new Runnable() {
-				@Override
-				public void run() {
-					if (graphController.isAnimatable())
-						animate(animatePosition, polygon,
-								graphController.getAnimationSpeed(),
-								oldPosition.x + ", " + oldPosition.y,
-								position.x + ", " + position.y);
-					else
-						polygon.setAttribute(SVG_TRANSFORM_ATTRIBUTE,
-								"translate(" + position.x + " " + position.y
-										+ ")");
-				}
-			});
-		}
-	}
-
-	@Override
-	public void setSize(final Dimension size) {
-		final Dimension oldSize = getSize();
-		if (size != null && !size.equals(oldSize)) {
-			super.setSize(size);
-			updateShape(oldSize.width, oldSize.height);
-		}
-	}
-
-	@Override
-	public void setShape(Shape shape) {
-		final Dimension oldSize = getSize();
-		final Shape currentShape = getShape();
-		if (shape != null && !shape.equals(currentShape)) {
-			super.setShape(shape);
-			updateShape(oldSize.width, oldSize.height);
-		}
-	}
-
-	@Override
-	public void setLabel(final String label) {
-		super.setLabel(label);
-		graphController.updateSVGDocument(new Runnable() {
-			@Override
-			public void run() {
-				labelText.setData(label);
-			}
-		});
-	}
-
-	@Override
-	public void setLabelPosition(final Point labelPosition) {
-		final Point oldLabelPosition = getLabelPosition();
-		if (labelPosition != null && !labelPosition.equals(oldLabelPosition)) {
-			super.setLabelPosition(labelPosition);
-			graphController.updateSVGDocument(new Runnable() {
-				@Override
-				public void run() {
-					if (graphController.isAnimatable()
-							&& oldLabelPosition != null)
-						animate(animateLabel, labelGroup,
-								graphController.getAnimationSpeed(),
-								oldLabelPosition.x + ", " + oldLabelPosition.y,
-								labelPosition.x + ", " + labelPosition.y);
-					else
-						labelGroup.setAttribute(SVG_TRANSFORM_ATTRIBUTE,
-								"translate(" + labelPosition.x + " "
-										+ labelPosition.y + ")");
-				}
-			});
-		}
-	}
-
-	@Override
-	public void setIteration(final int iteration) {
-		graphController.updateSVGDocument(new Runnable() {
-			@Override
-			public void run() {
-				if (iteration > 0)
-					iterationText.setData(String.valueOf(iteration));
-				else
-					iterationText.setData("");
-			}
-		});
-	}
-
-	@Override
-	public void setCompleted(final float complete) {
-		super.setCompleted(complete);
-		graphController.updateSVGDocument(new Runnable() {
-			@Override
-			public void run() {
-				Dimension size = getSize();
-				Point position = getPosition();
-				completedPolygon.setAttribute(
-						SVG_POINTS_ATTRIBUTE,
-						calculatePoints(getShape(),
-								(int) (size.width * complete), size.height));
-				completedPolygon.setAttribute(SVG_TRANSFORM_ATTRIBUTE,
-						"translate(" + position.x + " " + position.y + ")");
-			}
-		});
-	}
-
-	private void updateShape(final int oldWidth, final int oldHeight) {
-		if (getShape() != null && getWidth() > 0f && getHeight() > 0f) {
-			graphController.updateSVGDocument(new Runnable() {
-				@Override
-				public void run() {
-					if (graphController.isAnimatable())
-						animate(animateShape,
-								polygon,
-								graphController.getAnimationSpeed(),
-								calculatePoints(getShape(), oldWidth, oldHeight),
-								calculatePoints(getShape(), getWidth(),
-										getHeight()));
-					else {
-						polygon.setAttribute(
-								SVG_POINTS_ATTRIBUTE,
-								calculatePoints(getShape(), getWidth(),
-										getHeight()));
-						iteration.setAttribute(SVG_TRANSFORM_ATTRIBUTE,
-								"translate(" + (getWidth() - 1.5) + " 5.5)");
-						error.setAttribute(SVG_TRANSFORM_ATTRIBUTE,
-								"translate(" + (getWidth() - 1.5) + " "
-										+ (getHeight() - 1) + ")");
-					}
-				}
-			});
-		}
-	}
-
-	@Override
-	public void setSelected(final boolean selected) {
-		delegate.setSelected(selected);
-		super.setSelected(selected);
-	}
-
-	@Override
-	public void setLineStyle(final LineStyle lineStyle) {
-		delegate.setLineStyle(lineStyle);
-		super.setLineStyle(lineStyle);
-	}
-
-	@Override
-	public void setColor(final Color color) {
-		delegate.setColor(color);
-		super.setColor(color);
-	}
-
-	@Override
-	public void setFillColor(final Color fillColor) {
-		delegate.setFillColor(fillColor);
-		super.setFillColor(fillColor);
-	}
-
-	@Override
-	public void setVisible(final boolean visible) {
-		delegate.setVisible(visible);
-		super.setVisible(visible);
-	}
-
-	@Override
-	public void setFiltered(final boolean filtered) {
-		delegate.setFiltered(filtered);
-		super.setFiltered(filtered);
-	}
-
-	@Override
-	public void setOpacity(final float opacity) {
-		delegate.setOpacity(opacity);
-		super.setOpacity(opacity);
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-graph-model/src/main/java/net/sf/taverna/t2/workbench/models/graph/svg/SVGGraphController.java
----------------------------------------------------------------------
diff --git a/taverna-graph-model/src/main/java/net/sf/taverna/t2/workbench/models/graph/svg/SVGGraphController.java b/taverna-graph-model/src/main/java/net/sf/taverna/t2/workbench/models/graph/svg/SVGGraphController.java
deleted file mode 100644
index c35ae00..0000000
--- a/taverna-graph-model/src/main/java/net/sf/taverna/t2/workbench/models/graph/svg/SVGGraphController.java
+++ /dev/null
@@ -1,552 +0,0 @@
-/*******************************************************************************
- * 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.models.graph.svg;
-
-import static java.awt.Color.BLACK;
-import static java.awt.Color.GREEN;
-import static java.lang.Float.parseFloat;
-import static net.sf.taverna.t2.workbench.models.graph.svg.SVGUtil.animate;
-import static net.sf.taverna.t2.workbench.models.graph.svg.SVGUtil.calculateAngle;
-import static net.sf.taverna.t2.workbench.models.graph.svg.SVGUtil.createAnimationElement;
-import static net.sf.taverna.t2.workbench.models.graph.svg.SVGUtil.createSVGDocument;
-import static net.sf.taverna.t2.workbench.models.graph.svg.SVGUtil.getDot;
-import static net.sf.taverna.t2.workbench.models.graph.svg.SVGUtil.getHexValue;
-import static net.sf.taverna.t2.workbench.models.graph.svg.SVGUtil.svgNS;
-import static org.apache.batik.util.SVGConstants.SVG_ANIMATE_TAG;
-import static org.apache.batik.util.SVGConstants.SVG_ELLIPSE_TAG;
-import static org.apache.batik.util.SVGConstants.SVG_FILL_ATTRIBUTE;
-import static org.apache.batik.util.SVGConstants.SVG_FONT_FAMILY_ATTRIBUTE;
-import static org.apache.batik.util.SVGConstants.SVG_FONT_SIZE_ATTRIBUTE;
-import static org.apache.batik.util.SVGConstants.SVG_G_TAG;
-import static org.apache.batik.util.SVGConstants.SVG_LINE_TAG;
-import static org.apache.batik.util.SVGConstants.SVG_PATH_TAG;
-import static org.apache.batik.util.SVGConstants.SVG_POINTS_ATTRIBUTE;
-import static org.apache.batik.util.SVGConstants.SVG_POLYGON_TAG;
-import static org.apache.batik.util.SVGConstants.SVG_RECT_TAG;
-import static org.apache.batik.util.SVGConstants.SVG_STYLE_ATTRIBUTE;
-import static org.apache.batik.util.SVGConstants.SVG_TEXT_TAG;
-import static org.apache.batik.util.SVGConstants.SVG_TRANSFORM_ATTRIBUTE;
-import static org.apache.batik.util.SVGConstants.SVG_VIEW_BOX_ATTRIBUTE;
-import static org.apache.batik.util.SVGConstants.SVG_X1_ATTRIBUTE;
-import static org.apache.batik.util.SVGConstants.SVG_X2_ATTRIBUTE;
-import static org.apache.batik.util.SVGConstants.SVG_Y1_ATTRIBUTE;
-import static org.apache.batik.util.SVGConstants.SVG_Y2_ATTRIBUTE;
-import static org.apache.batik.util.SVGConstants.SVG_Y_ATTRIBUTE;
-
-import java.awt.Color;
-import java.awt.Point;
-import java.awt.Rectangle;
-import java.io.IOException;
-import java.io.StringWriter;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Timer;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-
-import net.sf.taverna.t2.ui.menu.MenuManager;
-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.models.graph.DotWriter;
-import net.sf.taverna.t2.workbench.models.graph.Graph;
-import net.sf.taverna.t2.workbench.models.graph.Graph.Alignment;
-import net.sf.taverna.t2.workbench.models.graph.GraphController;
-import net.sf.taverna.t2.workbench.models.graph.GraphEdge;
-import net.sf.taverna.t2.workbench.models.graph.GraphElement;
-import net.sf.taverna.t2.workbench.models.graph.GraphNode;
-import net.sf.taverna.t2.workbench.models.graph.dot.GraphLayout;
-
-import org.apache.batik.bridge.UpdateManager;
-import org.apache.batik.dom.svg.SVGOMAnimationElement;
-import org.apache.batik.dom.svg.SVGOMEllipseElement;
-import org.apache.batik.dom.svg.SVGOMGElement;
-import org.apache.batik.dom.svg.SVGOMPathElement;
-import org.apache.batik.dom.svg.SVGOMPolygonElement;
-import org.apache.batik.dom.svg.SVGOMRectElement;
-import org.apache.batik.dom.svg.SVGOMTextElement;
-import org.apache.batik.swing.JSVGCanvas;
-import org.apache.batik.swing.gvt.GVTTreeRendererAdapter;
-import org.apache.batik.swing.gvt.GVTTreeRendererEvent;
-import org.apache.log4j.Logger;
-import org.w3c.dom.Element;
-import org.w3c.dom.Text;
-import org.w3c.dom.svg.SVGDocument;
-import org.w3c.dom.svg.SVGElement;
-import org.w3c.dom.svg.SVGPoint;
-import org.w3c.dom.svg.SVGSVGElement;
-
-import org.apache.taverna.scufl2.api.core.Workflow;
-import org.apache.taverna.scufl2.api.profiles.Profile;
-
-public class SVGGraphController extends GraphController {
-	private static final Logger logger = Logger.getLogger(SVGGraphController.class);
-	@SuppressWarnings("unused")
-	private static final Timer timer = new Timer("SVG Graph controller timer", true);
-	private static final String dotErrorMessage = "Cannot draw diagram(s)\n" +
-			"\n" +
-			"Install dot as described\n" +
-			"at http://www.taverna.org.uk\n" +
-			"and specify its location\n" +
-			"in the workbench preferences";
-
-	private Map<String, List<SVGGraphEdge>> datalinkMap = new HashMap<>();
-	private final JSVGCanvas svgCanvas;
-	private SVGDocument svgDocument;
-	private GraphLayout graphLayout = new GraphLayout();
-	private EdgeLine edgeLine;
-	private UpdateManager updateManager;
-	private ExecutorService executor = Executors.newFixedThreadPool(1);
-	private boolean drawingDiagram = false;
-	private int animationSpeed;
-	private Rectangle bounds, oldBounds;
-	private SVGOMAnimationElement animateBounds;
-	private boolean dotMissing = false;
-	private final WorkbenchConfiguration workbenchConfiguration;
-
-	public SVGGraphController(Workflow dataflow, Profile profile,
-			boolean interactive, JSVGCanvas svgCanvas, EditManager editManager,
-			MenuManager menuManager, ColourManager colourManager,
-			WorkbenchConfiguration workbenchConfiguration) {
-		super(dataflow, profile, interactive, svgCanvas, editManager,
-				menuManager, colourManager);
-		this.svgCanvas = svgCanvas;
-		this.workbenchConfiguration = workbenchConfiguration;
-		installUpdateManager();
-		layoutSVGDocument(svgCanvas.getBounds());
-		svgCanvas.setDocument(getSVGDocument());
-	}
-
-	public SVGGraphController(Workflow dataflow, Profile profile,
-			boolean interactive, JSVGCanvas svgCanvas, Alignment alignment,
-			PortStyle portStyle, EditManager editManager,
-			MenuManager menuManager, ColourManager colourManager,
-			WorkbenchConfiguration workbenchConfiguration) {
-		super(dataflow, profile, interactive, svgCanvas, alignment, portStyle,
-				editManager, menuManager, colourManager);
-		this.svgCanvas = svgCanvas;
-		this.workbenchConfiguration = workbenchConfiguration;
-		installUpdateManager();
-		layoutSVGDocument(svgCanvas.getBounds());
-		svgCanvas.setDocument(getSVGDocument());
-	}
-
-	private void installUpdateManager() {
-		svgCanvas.addGVTTreeRendererListener(new GVTTreeRendererAdapter() {
-			@Override
-			public void gvtRenderingCompleted(GVTTreeRendererEvent ev) {
-				setUpdateManager(svgCanvas.getUpdateManager());
-			}
-		});
-	}
-	
-	@Override
-	public GraphEdge createGraphEdge() {
-		return new SVGGraphEdge(this);
-	}
-
-	@Override
-	public Graph createGraph() {
-		return new SVGGraph(this);
-	}
-
-	@Override
-	public GraphNode createGraphNode() {
-		return new SVGGraphNode(this);
-	}
-
-	public JSVGCanvas getSVGCanvas() {
-		return svgCanvas;
-	}
-
-	public synchronized SVGDocument getSVGDocument() {
-		if (svgDocument == null)
-			svgDocument = createSVGDocument();
-		return svgDocument;
-	}
-
-	@Override
-	public void redraw() {
-		Graph graph = generateGraph();
-		Rectangle actualBounds = layoutGraph(graph, svgCanvas.getBounds());
-		setBounds(actualBounds);
-		transformGraph(getGraph(), graph);
-	}
-
-	private void layoutSVGDocument(Rectangle bounds) {
-		animateBounds = createAnimationElement(this, SVG_ANIMATE_TAG,
-				SVG_VIEW_BOX_ATTRIBUTE, null);
-		updateManager = null;
-		datalinkMap.clear();
-
-		Graph graph = getGraph();
-		if (graph instanceof SVGGraph) {
-			SVGGraph svgGraph = (SVGGraph) graph;
-			SVGSVGElement svgElement = getSVGDocument().getRootElement();
-			SVGElement graphElement = svgGraph.getSVGElement();
-			svgElement.appendChild(graphElement);
-
-			setBounds(layoutGraph(graph, bounds));
-
-			edgeLine = EdgeLine.createAndAdd(getSVGDocument(), this);
-		}
-		drawingDiagram = true;
-	}
-
-	public Rectangle layoutGraph(Graph graph, Rectangle bounds) {
-		Rectangle actualBounds = null;
-		bounds = new Rectangle(bounds);
-		StringWriter stringWriter = new StringWriter();
-		DotWriter dotWriter = new DotWriter(stringWriter);
-		try {
-			dotWriter.writeGraph(graph);
-			String layout = getDot(stringWriter.toString(), workbenchConfiguration);
-			if (layout.isEmpty())
-				logger.warn("Invalid dot returned");
-			else
-				actualBounds = graphLayout.layoutGraph(this, graph, layout, bounds);
-		} catch (IOException e) {
-			outputMessage(dotErrorMessage);
-			setDotMissing(true);
-			logger.warn("Couldn't generate dot");
-		}
-		return actualBounds;
-	}
-
-	private void setDotMissing(boolean b) {
-		this.dotMissing = b;
-	}
-
-	public boolean isDotMissing() {
-		return dotMissing;
-	}
-
-	public void setBounds(final Rectangle bounds) {
-		oldBounds = this.bounds;
-		this.bounds = bounds;
-		updateSVGDocument(new Runnable() {
-			@Override
-			public void run() {
-				SVGSVGElement svgElement = getSVGDocument().getRootElement();
-				if (isAnimatable() && oldBounds != null) {
-					String from = "0 0 " + oldBounds.width + " "
-							+ oldBounds.height;
-					String to = "0 0 " + bounds.width + " " + bounds.height;
-					animate(animateBounds, svgElement, getAnimationSpeed(),
-							from, to);
-				} else if ((svgElement != null) && (bounds != null))
-					svgElement.setAttribute(SVG_VIEW_BOX_ATTRIBUTE,
-							"0 0 " + String.valueOf(bounds.width) + " "
-									+ String.valueOf(bounds.height));
-			}
-		});
-	}
-
-	private void outputMessage(final String message) {
-		SVGSVGElement svgElement = getSVGDocument().getRootElement();
-		String[] parts = message.split("\n");
-		int initialPosition = 200;
-		for (int i = 0; i < parts.length; i++) {
-			Text errorsText = createText(parts[i]);
-			SVGOMTextElement error = (SVGOMTextElement) createElement(SVG_TEXT_TAG);
-			error.setAttribute(SVG_Y_ATTRIBUTE,
-					Integer.toString(initialPosition + i * 60));
-			error.setAttribute(SVG_FONT_SIZE_ATTRIBUTE, "20");
-			error.setAttribute(SVG_FONT_FAMILY_ATTRIBUTE, "sans-serif");
-			error.setAttribute(SVG_FILL_ATTRIBUTE, "red");
-			error.appendChild(errorsText);
-			svgElement.appendChild(error);
-		}
-		bounds = new Rectangle(300, parts.length * 60 + 200);
-		svgCanvas.setDocument(getSVGDocument());
-	}
-
-	public void setUpdateManager(UpdateManager updateManager) {
-		this.updateManager = updateManager;
-		drawingDiagram = false;
-		resetSelection();
-	}
-
-	@Override
-	public boolean startEdgeCreation(GraphElement graphElement, Point point) {
-		boolean alreadyStarted = edgeCreationFromSource || edgeCreationFromSink;
-		boolean started = super.startEdgeCreation(graphElement, point);
-		if (!alreadyStarted && started) {
-			if (edgeMoveElement instanceof SVGGraphEdge) {
-				SVGGraphEdge svgGraphEdge = (SVGGraphEdge) edgeMoveElement;
-				SVGPoint sourcePoint = svgGraphEdge.getPathElement()
-						.getPointAtLength(0f);
-				edgeLine.setSourcePoint(new Point((int) sourcePoint.getX(),
-						(int) sourcePoint.getY()));
-			} else
-				edgeLine.setSourcePoint(point);
-			edgeLine.setTargetPoint(point);
-			edgeLine.setColour(Color.BLACK);
-			// edgeLine.setVisible(true);
-		}
-		return started;
-	}
-
-	@Override
-	public boolean moveEdgeCreationTarget(GraphElement graphElement, Point point) {
-		boolean linkValid = super.moveEdgeCreationTarget(graphElement, point);
-		if (edgeMoveElement instanceof SVGGraphEdge)
-			((SVGGraphEdge) edgeMoveElement).setVisible(false);
-		if (edgeCreationFromSink) {
-			edgeLine.setSourcePoint(point);
-			if (linkValid)
-				edgeLine.setColour(GREEN);
-			else
-				edgeLine.setColour(BLACK);
-			edgeLine.setVisible(true);
-		} else if (edgeCreationFromSource) {
-			edgeLine.setTargetPoint(point);
-			if (linkValid)
-				edgeLine.setColour(GREEN);
-			else
-				edgeLine.setColour(BLACK);
-			edgeLine.setVisible(true);
-		}
-		return linkValid;
-	}
-
-	@Override
-	public boolean stopEdgeCreation(GraphElement graphElement, Point point) {
-		GraphEdge movedEdge = edgeMoveElement;
-		boolean edgeCreated = super.stopEdgeCreation(graphElement, point);
-		if (!edgeCreated && movedEdge instanceof SVGGraphEdge)
-			((SVGGraphEdge) movedEdge).setVisible(true);
-		edgeLine.setVisible(false);
-		return edgeCreated;
-	}
-
-	@Override
-	public void setEdgeActive(String edgeId, boolean active) {
-		if (datalinkMap.containsKey(edgeId))
-			for (GraphEdge datalink : datalinkMap.get(edgeId))
-				datalink.setActive(active);
-	}
-
-	public Element createElement(String tag) {
-		return getSVGDocument().createElementNS(svgNS, tag);
-	}
-
-	SVGOMGElement createGElem() {
-		return (SVGOMGElement) createElement(SVG_G_TAG);
-	}
-
-	SVGOMPolygonElement createPolygon() {
-		return (SVGOMPolygonElement) createElement(SVG_POLYGON_TAG);
-	}
-
-	SVGOMEllipseElement createEllipse() {
-		return (SVGOMEllipseElement) createElement(SVG_ELLIPSE_TAG);
-	}
-
-	SVGOMPathElement createPath() {
-		return (SVGOMPathElement) createElement(SVG_PATH_TAG);
-	}
-
-	SVGOMRectElement createRect() {
-		return (SVGOMRectElement) createElement(SVG_RECT_TAG);
-	}
-
-	public Text createText(String text) {
-		return getSVGDocument().createTextNode(text);
-	}
-
-	SVGOMTextElement createText(Text text) {
-		SVGOMTextElement elem = (SVGOMTextElement) createElement(SVG_TEXT_TAG);
-		elem.appendChild(text);
-		return elem;
-	}
-
-	public void updateSVGDocument(final Runnable thread) {
-		if (updateManager == null && !drawingDiagram)
-			thread.run();
-		else if (!executor.isShutdown())
-			executor.execute(new Runnable() {
-				@Override
-				public void run() {
-					waitForUpdateManager();
-					try {
-						updateManager.getUpdateRunnableQueue().invokeLater(
-								thread);
-					} catch (IllegalStateException e) {
-						logger.error("Update of SVG failed", e);
-					}
-				}
-
-				private void waitForUpdateManager() {
-					try {
-						while (updateManager == null)
-							Thread.sleep(200);
-					} catch (InterruptedException e) {
-					}
-				}
-			});
-//		if (updateManager == null)
-//			thread.run();
-//		else
-//			updateManager.getUpdateRunnableQueue().invokeLater(thread);
-	}
-
-	public boolean isAnimatable() {
-		return animationSpeed > 0 && updateManager != null && !drawingDiagram;
-	}
-
-	/**
-	 * Returns the animation speed in milliseconds.
-	 *
-	 * @return the animation speed in milliseconds
-	 */
-	public int getAnimationSpeed() {
-		return animationSpeed;
-	}
-
-	/**
-	 * Sets the animation speed in milliseconds. A value of 0 turns off animation.
-	 *
-	 * @param animationSpeed the animation speed in milliseconds
-	 */
-	public void setAnimationSpeed(int animationSpeed) {
-		this.animationSpeed = animationSpeed;
-	}
-
-	@Override
-	public void shutdown() {
-		super.shutdown();
-		executor.execute(new Runnable() {
-			@Override
-			public void run() {
-				getSVGCanvas().stopProcessing();
-				executor.shutdown();
-			}
-		});
-	}
-
-}
-
-class EdgeLine {
-	private static final float arrowLength = 10f;
-	private static final float arrowWidth = 3f;
-
-	private Element line;
-	private Element pointer;
-	private SVGGraphController graphController;
-
-	private EdgeLine(SVGGraphController graphController) {
-		this.graphController = graphController;
-	}
-
-	public static EdgeLine createAndAdd(SVGDocument svgDocument, SVGGraphController graphController) {
-		EdgeLine edgeLine = new EdgeLine(graphController);
-		edgeLine.line = svgDocument.createElementNS(svgNS, SVG_LINE_TAG);
-		edgeLine.line.setAttribute(SVG_STYLE_ATTRIBUTE,
-				"fill:none;stroke:black");
-		edgeLine.line.setAttribute("pointer-events", "none");
-		edgeLine.line.setAttribute("visibility", "hidden");
-		edgeLine.line.setAttribute(SVG_X1_ATTRIBUTE, "0");
-		edgeLine.line.setAttribute(SVG_Y1_ATTRIBUTE, "0");
-		edgeLine.line.setAttribute(SVG_X2_ATTRIBUTE, "0");
-		edgeLine.line.setAttribute(SVG_Y2_ATTRIBUTE, "0");
-
-		edgeLine.pointer = svgDocument.createElementNS(svgNS, SVG_POLYGON_TAG);
-		edgeLine.pointer.setAttribute(SVG_STYLE_ATTRIBUTE,
-				"fill:black;stroke:black");
-		edgeLine.pointer.setAttribute(SVG_POINTS_ATTRIBUTE, "0,0 "
-				+ -arrowLength + "," + arrowWidth + " " + -arrowLength + ","
-				+ -arrowWidth + " 0,0");
-		edgeLine.pointer.setAttribute("pointer-events", "none");
-		edgeLine.pointer.setAttribute("visibility", "hidden");
-
-		Element svgRoot = svgDocument.getDocumentElement();
-		svgRoot.insertBefore(edgeLine.line, null);
-		svgRoot.insertBefore(edgeLine.pointer, null);
-
-		return edgeLine;
-	}
-
-	public void setSourcePoint(final Point point) {
-		graphController.updateSVGDocument(new Runnable() {
-			@Override
-			public void run() {
-				line.setAttribute(SVG_X1_ATTRIBUTE,
-						String.valueOf(point.getX()));
-				line.setAttribute(SVG_Y1_ATTRIBUTE,
-						String.valueOf(point.getY()));
-
-				float x = parseFloat(line.getAttribute(SVG_X2_ATTRIBUTE));
-				float y = parseFloat(line.getAttribute(SVG_Y2_ATTRIBUTE));
-				double angle = calculateAngle(line);
-
-				pointer.setAttribute(SVG_TRANSFORM_ATTRIBUTE, "translate(" + x
-						+ " " + y + ") rotate(" + angle + " 0 0) ");
-			}
-		});
-	}
-
-	public void setTargetPoint(final Point point) {
-		graphController.updateSVGDocument(new Runnable() {
-			@Override
-			public void run() {
-				line.setAttribute(SVG_X2_ATTRIBUTE,
-						String.valueOf(point.getX()));
-				line.setAttribute(SVG_Y2_ATTRIBUTE,
-						String.valueOf(point.getY()));
-
-				double angle = calculateAngle(line);
-				pointer.setAttribute(SVG_TRANSFORM_ATTRIBUTE, "translate("
-						+ point.x + " " + point.y + ") rotate(" + angle
-						+ " 0 0) ");
-			}
-		});
-	}
-
-	public void setColour(final Color colour) {
-		graphController.updateSVGDocument(new Runnable() {
-			@Override
-			public void run() {
-				String hexColour = getHexValue(colour);
-				line.setAttribute(SVG_STYLE_ATTRIBUTE, "fill:none;stroke:"
-						+ hexColour + ";");
-				pointer.setAttribute(SVG_STYLE_ATTRIBUTE, "fill:" + hexColour
-						+ ";stroke:" + hexColour + ";");
-			}
-		});
-	}
-
-	public void setVisible(final boolean visible) {
-		graphController.updateSVGDocument(new Runnable() {
-			@Override
-			public void run() {
-				if (visible) {
-					line.setAttribute("visibility", "visible");
-					pointer.setAttribute("visibility", "visible");
-				} else {
-					line.setAttribute("visibility", "hidden");
-					pointer.setAttribute("visibility", "hidden");
-				}
-			}
-		});
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-graph-model/src/main/java/net/sf/taverna/t2/workbench/models/graph/svg/SVGGraphEdge.java
----------------------------------------------------------------------
diff --git a/taverna-graph-model/src/main/java/net/sf/taverna/t2/workbench/models/graph/svg/SVGGraphEdge.java b/taverna-graph-model/src/main/java/net/sf/taverna/t2/workbench/models/graph/svg/SVGGraphEdge.java
deleted file mode 100644
index 7884d62..0000000
--- a/taverna-graph-model/src/main/java/net/sf/taverna/t2/workbench/models/graph/svg/SVGGraphEdge.java
+++ /dev/null
@@ -1,311 +0,0 @@
-/*******************************************************************************
- * 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.models.graph.svg;
-
-import static net.sf.taverna.t2.workbench.models.graph.svg.SVGGraphSettings.SELECTED_COLOUR;
-import static net.sf.taverna.t2.workbench.models.graph.svg.SVGUtil.adjustPathLength;
-import static net.sf.taverna.t2.workbench.models.graph.svg.SVGUtil.animate;
-import static net.sf.taverna.t2.workbench.models.graph.svg.SVGUtil.calculateAngle;
-import static net.sf.taverna.t2.workbench.models.graph.svg.SVGUtil.createAnimationElement;
-import static net.sf.taverna.t2.workbench.models.graph.svg.SVGUtil.getHexValue;
-import static org.apache.batik.util.CSSConstants.CSS_BLACK_VALUE;
-import static org.apache.batik.util.CSSConstants.CSS_DISPLAY_PROPERTY;
-import static org.apache.batik.util.CSSConstants.CSS_INLINE_VALUE;
-import static org.apache.batik.util.CSSConstants.CSS_NONE_VALUE;
-import static org.apache.batik.util.SMILConstants.SMIL_ADDITIVE_ATTRIBUTE;
-import static org.apache.batik.util.SMILConstants.SMIL_SUM_VALUE;
-import static org.apache.batik.util.SVGConstants.SVG_ANIMATE_TAG;
-import static org.apache.batik.util.SVGConstants.SVG_ANIMATE_TRANSFORM_TAG;
-import static org.apache.batik.util.SVGConstants.SVG_CLICK_EVENT_TYPE;
-import static org.apache.batik.util.SVGConstants.SVG_CX_ATTRIBUTE;
-import static org.apache.batik.util.SVGConstants.SVG_CY_ATTRIBUTE;
-import static org.apache.batik.util.SVGConstants.SVG_D_ATTRIBUTE;
-import static org.apache.batik.util.SVGConstants.SVG_FILL_ATTRIBUTE;
-import static org.apache.batik.util.SVGConstants.SVG_MOUSEDOWN_EVENT_TYPE;
-import static org.apache.batik.util.SVGConstants.SVG_NONE_VALUE;
-import static org.apache.batik.util.SVGConstants.SVG_POINTS_ATTRIBUTE;
-import static org.apache.batik.util.SVGConstants.SVG_RX_ATTRIBUTE;
-import static org.apache.batik.util.SVGConstants.SVG_RY_ATTRIBUTE;
-import static org.apache.batik.util.SVGConstants.SVG_STROKE_ATTRIBUTE;
-import static org.apache.batik.util.SVGConstants.SVG_STROKE_DASHARRAY_ATTRIBUTE;
-import static org.apache.batik.util.SVGConstants.SVG_STROKE_WIDTH_ATTRIBUTE;
-import static org.apache.batik.util.SVGConstants.SVG_TRANSFORM_ATTRIBUTE;
-import static org.apache.batik.util.SVGConstants.SVG_ZERO_VALUE;
-import static org.apache.batik.util.SVGConstants.TRANSFORM_ROTATE;
-import static org.apache.batik.util.SVGConstants.TRANSFORM_TRANSLATE;
-
-import java.awt.Color;
-import java.awt.Point;
-import java.util.List;
-
-import net.sf.taverna.t2.workbench.models.graph.GraphEdge;
-import net.sf.taverna.t2.workbench.models.graph.svg.event.SVGMouseClickEventListener;
-import net.sf.taverna.t2.workbench.models.graph.svg.event.SVGMouseDownEventListener;
-import net.sf.taverna.t2.workbench.models.graph.svg.event.SVGMouseOutEventListener;
-import net.sf.taverna.t2.workbench.models.graph.svg.event.SVGMouseOverEventListener;
-
-import org.apache.batik.dom.svg.SVGGraphicsElement;
-import org.apache.batik.dom.svg.SVGOMAnimationElement;
-import org.apache.batik.dom.svg.SVGOMEllipseElement;
-import org.apache.batik.dom.svg.SVGOMGElement;
-import org.apache.batik.dom.svg.SVGOMPathElement;
-import org.apache.batik.dom.svg.SVGOMPolygonElement;
-import org.w3c.dom.events.EventTarget;
-import org.w3c.dom.svg.SVGElement;
-
-/**
- * SVG representation of a graph edge.
- * 
- * @author David Withers
- */
-public class SVGGraphEdge extends GraphEdge {
-	private static final String ARROW_LENGTH = "8.5";
-	private static final String ARROW_WIDTH = "3";
-	private static final String ELLIPSE_RADIUS = "3.5";
-
-	private SVGGraphController graphController;
-	private SVGGraphElementDelegate delegate;
-	private SVGMouseClickEventListener mouseClickAction;
-	private SVGMouseDownEventListener mouseDownAction;
-	@SuppressWarnings("unused")
-	private SVGMouseOverEventListener mouseOverAction;
-	@SuppressWarnings("unused")
-	private SVGMouseOutEventListener mouseOutAction;
-	private SVGOMGElement mainGroup;
-	private SVGOMPathElement path, deleteButton;
-	private SVGOMPolygonElement polygon;
-	private SVGOMEllipseElement ellipse;
-	private SVGGraphicsElement arrowHead;
-	private SVGOMAnimationElement animatePath, animatePosition, animateRotation;
-
-	public SVGGraphEdge(SVGGraphController graphController) {
-		super(graphController);
-		this.graphController = graphController;
-
-		mouseClickAction = new SVGMouseClickEventListener(this);
-		mouseDownAction = new SVGMouseDownEventListener(this);
-		mouseOverAction = new SVGMouseOverEventListener(this);
-		mouseOutAction = new SVGMouseOutEventListener(this);
-
-		mainGroup = graphController.createGElem();
-		mainGroup.setAttribute(SVG_STROKE_ATTRIBUTE, CSS_BLACK_VALUE);
-		mainGroup.setAttribute(SVG_STROKE_DASHARRAY_ATTRIBUTE, CSS_NONE_VALUE);
-		mainGroup.setAttribute(SVG_STROKE_WIDTH_ATTRIBUTE, "1");
-
-		path = graphController.createPath();
-		path.setAttribute(SVG_FILL_ATTRIBUTE, SVG_NONE_VALUE);
-		EventTarget t = (EventTarget) path;
-		t.addEventListener(SVG_CLICK_EVENT_TYPE, mouseClickAction, false);
-		// t.addEventListener(SVGConstants.SVG_MOUSEOVER_EVENT_TYPE, mouseOverAction, false);
-		// t.addEventListener(SVGConstants.SVG_MOUSEOUT_EVENT_TYPE, mouseOutAction, false);
-		mainGroup.appendChild(path);
-
-		polygon = graphController.createPolygon();
-		polygon.setAttribute(SVG_POINTS_ATTRIBUTE, ARROW_LENGTH + ", 0"
-				+ " 0, -" + ARROW_WIDTH + " 0," + ARROW_WIDTH);
-		t = (EventTarget) polygon;
-		t.addEventListener(SVG_CLICK_EVENT_TYPE, mouseClickAction, false);
-		t.addEventListener(SVG_MOUSEDOWN_EVENT_TYPE, mouseDownAction, false);
-		// t.addEventListener(SVGConstants.SVG_MOUSEOVER_EVENT_TYPE, mouseOverAction, false);
-		// t.addEventListener(SVGConstants.SVG_MOUSEOUT_EVENT_TYPE, mouseOutAction, false);
-
-		ellipse = graphController.createEllipse();
-		ellipse.setAttribute(SVG_CX_ATTRIBUTE, ELLIPSE_RADIUS);
-		ellipse.setAttribute(SVG_CY_ATTRIBUTE, SVG_ZERO_VALUE);
-		ellipse.setAttribute(SVG_RX_ATTRIBUTE, ELLIPSE_RADIUS);
-		ellipse.setAttribute(SVG_RY_ATTRIBUTE, ELLIPSE_RADIUS);
-
-		arrowHead = polygon;
-		mainGroup.appendChild(arrowHead);
-
-		deleteButton = graphController.createPath();
-		deleteButton.setAttribute(SVG_STROKE_ATTRIBUTE, "red");
-		deleteButton.setAttribute(SVG_STROKE_WIDTH_ATTRIBUTE, "2");
-		deleteButton.setAttribute(SVG_D_ATTRIBUTE,
-				"M-3.5,-7L3.5,0M-3.5,0L3.5,-7");
-		deleteButton.setAttribute(CSS_DISPLAY_PROPERTY, CSS_NONE_VALUE);
-		mainGroup.appendChild(deleteButton);
-
-		animatePath = createAnimationElement(graphController, SVG_ANIMATE_TAG,
-				SVG_D_ATTRIBUTE, null);
-
-		animatePosition = createAnimationElement(graphController,
-				SVG_ANIMATE_TRANSFORM_TAG, SVG_TRANSFORM_ATTRIBUTE,
-				TRANSFORM_TRANSLATE);
-
-		animateRotation = createAnimationElement(graphController,
-				SVG_ANIMATE_TRANSFORM_TAG, SVG_TRANSFORM_ATTRIBUTE,
-				TRANSFORM_ROTATE);
-		animateRotation.setAttribute(SMIL_ADDITIVE_ATTRIBUTE, SMIL_SUM_VALUE);
-
-		delegate = new SVGGraphElementDelegate(graphController, this, mainGroup);
-	}
-
-	public SVGElement getSVGElement() {
-		return mainGroup;
-	}
-
-	/**
-	 * Returns the path.
-	 * 
-	 * @return the path
-	 */
-	public SVGOMPathElement getPathElement() {
-		return path;
-	}
-
-	@Override
-	public void setSelected(boolean selected) {
-		super.setSelected(selected);
-		final String color = selected ? SELECTED_COLOUR
-				: getHexValue(getColor());
-		graphController.updateSVGDocument(new Runnable() {
-			@Override
-			public void run() {
-				mainGroup.setAttribute(SVG_STROKE_ATTRIBUTE, color);
-				mainGroup.setAttribute(SVG_FILL_ATTRIBUTE, color);
-			}
-		});
-	}
-
-	@Override
-	public void setActive(final boolean active) {
-		super.setActive(active);
-		graphController.updateSVGDocument(new Runnable() {
-			@Override
-			public void run() {
-				if (active) {
-					path.setAttribute(SVG_STROKE_WIDTH_ATTRIBUTE, "2");
-					deleteButton.setAttribute(CSS_DISPLAY_PROPERTY,
-							CSS_INLINE_VALUE);
-				} else {
-					path.setAttribute(SVG_STROKE_WIDTH_ATTRIBUTE, "1");
-					deleteButton.setAttribute(CSS_DISPLAY_PROPERTY,
-							CSS_NONE_VALUE);
-				}
-			}
-		});
-	}
-
-	@Override
-	public void setArrowHeadStyle(final ArrowStyle arrowHeadStyle) {
-		super.setArrowHeadStyle(arrowHeadStyle);
-		graphController.updateSVGDocument(new Runnable() {
-			@Override
-			public void run() {
-				if (ArrowStyle.NONE.equals(arrowHeadStyle))
-					mainGroup.removeChild(arrowHead);
-				else if (ArrowStyle.NORMAL.equals(arrowHeadStyle)) {
-					mainGroup.removeChild(arrowHead);
-					arrowHead = polygon;
-					mainGroup.appendChild(arrowHead);
-				} else if (ArrowStyle.DOT.equals(arrowHeadStyle)) {
-					mainGroup.removeChild(arrowHead);
-					arrowHead = ellipse;
-					mainGroup.appendChild(arrowHead);
-				}
-			}
-		});
-	}
-
-	@Override
-	public void setPath(final List<Point> pointList) {
-		if (pointList == null)
-			return;
-
-		final List<Point> oldPointList = getPath();
-		super.setPath(pointList);
-		graphController.updateSVGDocument(new Runnable() {
-			@Override
-			public void run() {
-				Point lastPoint = pointList.get(pointList.size() - 1);
-				double angle = calculateAngle(pointList);
-				if (graphController.isAnimatable() && oldPointList != null) {
-					adjustPathLength(oldPointList, pointList.size());
-					Point oldLastPoint = oldPointList.get(oldPointList.size() - 1);
-					double oldAngle = calculateAngle(oldPointList);
-					animate(animatePath, path,
-							graphController.getAnimationSpeed(),
-							SVGUtil.getPath(oldPointList),
-							SVGUtil.getPath(pointList));
-
-					animate(animatePosition, polygon,
-							graphController.getAnimationSpeed(), oldLastPoint.x
-									+ ", " + oldLastPoint.y, lastPoint.x + ", "
-									+ lastPoint.y);
-
-					animate(animateRotation, polygon,
-							graphController.getAnimationSpeed(), oldAngle
-									+ " 0 0", angle + " 0 0");
-
-					ellipse.setAttribute(SVG_TRANSFORM_ATTRIBUTE, "translate("
-							+ lastPoint.x + " " + lastPoint.y + ") rotate("
-							+ angle + " 0 0) ");
-					deleteButton.setAttribute(SVG_TRANSFORM_ATTRIBUTE,
-							"translate(" + lastPoint.x + " " + lastPoint.y
-									+ ")");
-				} else {
-					path.setAttribute(SVG_D_ATTRIBUTE,
-							SVGUtil.getPath(pointList));
-					polygon.setAttribute(SVG_TRANSFORM_ATTRIBUTE, "translate("
-							+ lastPoint.x + " " + lastPoint.y + ") rotate("
-							+ angle + " 0 0) ");
-					ellipse.setAttribute(SVG_TRANSFORM_ATTRIBUTE, "translate("
-							+ lastPoint.x + " " + lastPoint.y + ") rotate("
-							+ angle + " 0 0) ");
-					deleteButton.setAttribute(SVG_TRANSFORM_ATTRIBUTE,
-							"translate(" + lastPoint.x + " " + lastPoint.y
-									+ ")");
-				}
-			}
-		});
-	}
-
-	@Override
-	public void setColor(final Color color) {
-		delegate.setColor(color);
-		super.setColor(color);
-	}
-
-	@Override
-	public void setFillColor(final Color fillColor) {
-		delegate.setFillColor(fillColor);
-		super.setFillColor(fillColor);
-	}
-
-	@Override
-	public void setVisible(final boolean visible) {
-		delegate.setVisible(visible);
-		super.setVisible(visible);
-	}
-
-	@Override
-	public void setFiltered(final boolean filtered) {
-		delegate.setFiltered(filtered);
-		super.setFiltered(filtered);
-	}
-
-	@Override
-	public void setOpacity(final float opacity) {
-		delegate.setOpacity(opacity);
-		super.setOpacity(opacity);
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-graph-model/src/main/java/net/sf/taverna/t2/workbench/models/graph/svg/SVGGraphElementDelegate.java
----------------------------------------------------------------------
diff --git a/taverna-graph-model/src/main/java/net/sf/taverna/t2/workbench/models/graph/svg/SVGGraphElementDelegate.java b/taverna-graph-model/src/main/java/net/sf/taverna/t2/workbench/models/graph/svg/SVGGraphElementDelegate.java
deleted file mode 100644
index cf7f852..0000000
--- a/taverna-graph-model/src/main/java/net/sf/taverna/t2/workbench/models/graph/svg/SVGGraphElementDelegate.java
+++ /dev/null
@@ -1,178 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 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.workbench.models.graph.svg;
-
-import static net.sf.taverna.t2.workbench.models.graph.GraphElement.LineStyle.NONE;
-import static net.sf.taverna.t2.workbench.models.graph.svg.SVGGraphSettings.SELECTED_COLOUR;
-import static net.sf.taverna.t2.workbench.models.graph.svg.SVGUtil.animate;
-import static net.sf.taverna.t2.workbench.models.graph.svg.SVGUtil.createAnimationElement;
-import static net.sf.taverna.t2.workbench.models.graph.svg.SVGUtil.getHexValue;
-import static org.apache.batik.util.CSSConstants.CSS_DISPLAY_PROPERTY;
-import static org.apache.batik.util.CSSConstants.CSS_INLINE_VALUE;
-import static org.apache.batik.util.CSSConstants.CSS_NONE_VALUE;
-import static org.apache.batik.util.CSSConstants.CSS_OPACITY_PROPERTY;
-import static org.apache.batik.util.CSSConstants.CSS_POINTER_EVENTS_PROPERTY;
-import static org.apache.batik.util.CSSConstants.CSS_VISIBLEPAINTED_VALUE;
-import static org.apache.batik.util.SVGConstants.SVG_ANIMATE_TAG;
-import static org.apache.batik.util.SVGConstants.SVG_FILL_ATTRIBUTE;
-import static org.apache.batik.util.SVGConstants.SVG_NONE_VALUE;
-import static org.apache.batik.util.SVGConstants.SVG_STROKE_ATTRIBUTE;
-import static org.apache.batik.util.SVGConstants.SVG_STROKE_DASHARRAY_ATTRIBUTE;
-import static org.apache.batik.util.SVGConstants.SVG_STROKE_WIDTH_ATTRIBUTE;
-
-import java.awt.Color;
-
-import net.sf.taverna.t2.workbench.models.graph.GraphElement;
-import net.sf.taverna.t2.workbench.models.graph.GraphElement.LineStyle;
-
-import org.apache.batik.dom.svg.SVGOMAnimationElement;
-import org.apache.batik.dom.svg.SVGOMElement;
-
-/**
- * Delegate for GraphElements. Logically a superclass of SVGGraph, SVGGraphNode
- * and SVGGraphEdge (if java had multiple inheritance).
- * 
- * @author David Withers
- */
-public class SVGGraphElementDelegate {
-	private SVGGraphController graphController;
-	private GraphElement graphElement;
-	private SVGOMElement mainGroup;
-	private SVGOMAnimationElement animateOpacity;
-
-	public SVGGraphElementDelegate(SVGGraphController graphController,
-			GraphElement graphElement, SVGOMElement mainGroup) {
-		this.graphController = graphController;
-		this.graphElement = graphElement;
-		this.mainGroup = mainGroup;
-
-		animateOpacity = createAnimationElement(graphController,
-				SVG_ANIMATE_TAG, CSS_OPACITY_PROPERTY, null);
-	}
-
-	public void setSelected(final boolean selected) {
-		boolean currentSelected = graphElement.isSelected();
-		if (currentSelected != selected
-				&& !LineStyle.NONE.equals(graphElement.getLineStyle()))
-			graphController.updateSVGDocument(new Runnable() {
-				@Override
-				public void run() {
-					mainGroup.setAttribute(SVG_STROKE_ATTRIBUTE,
-							selected ? SELECTED_COLOUR
-									: getHexValue(graphElement.getColor()));
-					mainGroup.setAttribute(SVG_STROKE_WIDTH_ATTRIBUTE,
-							selected ? "2" : "1");
-				}
-			});
-	}
-
-	public void setLineStyle(final LineStyle lineStyle) {
-		LineStyle currentLineStyle = graphElement.getLineStyle();
-		if (!currentLineStyle.equals(lineStyle))
-			graphController.updateSVGDocument(new Runnable() {
-				@Override
-				public void run() {
-					String stroke = SVG_NONE_VALUE, dash = SVG_NONE_VALUE;
-					switch (lineStyle) {
-					case DOTTED:
-						stroke = getHexValue(graphElement.getColor());
-						dash = "1,5";
-						break;
-					case SOLID:
-						stroke = getHexValue(graphElement.getColor());
-					default:
-						break;
-					}
-					mainGroup.setAttribute(SVG_STROKE_ATTRIBUTE, stroke);
-					mainGroup
-							.setAttribute(SVG_STROKE_DASHARRAY_ATTRIBUTE, dash);
-				}
-			});
-	}
-
-	public void setColor(final Color color) {
-		Color currentColor = graphElement.getColor();
-		if (currentColor != color && NONE != graphElement.getLineStyle())
-			graphController.updateSVGDocument(new Runnable() {
-				@Override
-				public void run() {
-					mainGroup.setAttribute(SVG_STROKE_ATTRIBUTE,
-							getHexValue(color));
-				}
-			});
-	}
-
-	public void setFillColor(final Color fillColor) {
-		Color currentFillColor = graphElement.getFillColor();
-		if (currentFillColor != fillColor)
-			graphController.updateSVGDocument(new Runnable() {
-				@Override
-				public void run() {
-					mainGroup.setAttribute(SVG_FILL_ATTRIBUTE,
-							getHexValue(fillColor));
-				}
-			});
-	}
-
-	public void setVisible(final boolean visible) {
-		boolean currentVisible = graphElement.isVisible();
-		if (currentVisible != visible)
-			graphController.updateSVGDocument(new Runnable() {
-				@Override
-				public void run() {
-					mainGroup.setAttribute(CSS_DISPLAY_PROPERTY,
-							visible ? CSS_INLINE_VALUE : CSS_NONE_VALUE);
-				}
-			});
-	}
-
-	public void setOpacity(final float opacity) {
-		final float currentOpacity = graphElement.getOpacity();
-		if (currentOpacity != opacity)
-			graphController.updateSVGDocument(new Runnable() {
-				@Override
-				public void run() {
-					if (graphController.isAnimatable())
-						animate(animateOpacity, mainGroup,
-								graphController.getAnimationSpeed(),
-								String.valueOf(currentOpacity),
-								String.valueOf(opacity));
-					else
-						mainGroup.setAttribute(CSS_OPACITY_PROPERTY,
-								String.valueOf(opacity));
-				}
-			});
-	}
-
-	public void setFiltered(final boolean filtered) {
-		boolean currentFiltered = graphElement.isFiltered();
-		if (currentFiltered != filtered)
-			graphController.updateSVGDocument(new Runnable() {
-				@Override
-				public void run() {
-					mainGroup.setAttribute(CSS_POINTER_EVENTS_PROPERTY,
-							filtered ? CSS_NONE_VALUE
-									: CSS_VISIBLEPAINTED_VALUE);
-					setOpacity(filtered ? 0.2f : 1f);
-				}
-			});
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-graph-model/src/main/java/net/sf/taverna/t2/workbench/models/graph/svg/SVGGraphNode.java
----------------------------------------------------------------------
diff --git a/taverna-graph-model/src/main/java/net/sf/taverna/t2/workbench/models/graph/svg/SVGGraphNode.java b/taverna-graph-model/src/main/java/net/sf/taverna/t2/workbench/models/graph/svg/SVGGraphNode.java
deleted file mode 100644
index 004b3f6..0000000
--- a/taverna-graph-model/src/main/java/net/sf/taverna/t2/workbench/models/graph/svg/SVGGraphNode.java
+++ /dev/null
@@ -1,611 +0,0 @@
-/*******************************************************************************
- * 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.models.graph.svg;
-
-import static net.sf.taverna.t2.workbench.models.graph.svg.SVGGraphSettings.COMPLETED_COLOUR;
-import static net.sf.taverna.t2.workbench.models.graph.svg.SVGGraphSettings.ERROR_COLOUR;
-import static net.sf.taverna.t2.workbench.models.graph.svg.SVGUtil.animate;
-import static net.sf.taverna.t2.workbench.models.graph.svg.SVGUtil.calculatePoints;
-import static net.sf.taverna.t2.workbench.models.graph.svg.SVGUtil.createAnimationElement;
-import static org.apache.batik.util.CSSConstants.CSS_ALL_VALUE;
-import static org.apache.batik.util.CSSConstants.CSS_BLACK_VALUE;
-import static org.apache.batik.util.CSSConstants.CSS_DISPLAY_PROPERTY;
-import static org.apache.batik.util.CSSConstants.CSS_HIDDEN_VALUE;
-import static org.apache.batik.util.CSSConstants.CSS_INLINE_VALUE;
-import static org.apache.batik.util.CSSConstants.CSS_NONE_VALUE;
-import static org.apache.batik.util.CSSConstants.CSS_POINTER_EVENTS_PROPERTY;
-import static org.apache.batik.util.CSSConstants.CSS_VISIBILITY_PROPERTY;
-import static org.apache.batik.util.CSSConstants.CSS_VISIBLE_VALUE;
-import static org.apache.batik.util.SVGConstants.SVG_ANIMATE_TAG;
-import static org.apache.batik.util.SVGConstants.SVG_ANIMATE_TRANSFORM_TAG;
-import static org.apache.batik.util.SVGConstants.SVG_CLICK_EVENT_TYPE;
-import static org.apache.batik.util.SVGConstants.SVG_CX_ATTRIBUTE;
-import static org.apache.batik.util.SVGConstants.SVG_CY_ATTRIBUTE;
-import static org.apache.batik.util.SVGConstants.SVG_D_ATTRIBUTE;
-import static org.apache.batik.util.SVGConstants.SVG_END_VALUE;
-import static org.apache.batik.util.SVGConstants.SVG_FILL_ATTRIBUTE;
-import static org.apache.batik.util.SVGConstants.SVG_FILL_OPACITY_ATTRIBUTE;
-import static org.apache.batik.util.SVGConstants.SVG_FONT_FAMILY_ATTRIBUTE;
-import static org.apache.batik.util.SVGConstants.SVG_FONT_SIZE_ATTRIBUTE;
-import static org.apache.batik.util.SVGConstants.SVG_HEIGHT_ATTRIBUTE;
-import static org.apache.batik.util.SVGConstants.SVG_MIDDLE_VALUE;
-import static org.apache.batik.util.SVGConstants.SVG_MOUSEDOWN_EVENT_TYPE;
-import static org.apache.batik.util.SVGConstants.SVG_MOUSEMOVE_EVENT_TYPE;
-import static org.apache.batik.util.SVGConstants.SVG_MOUSEOUT_EVENT_TYPE;
-import static org.apache.batik.util.SVGConstants.SVG_MOUSEOVER_EVENT_TYPE;
-import static org.apache.batik.util.SVGConstants.SVG_NONE_VALUE;
-import static org.apache.batik.util.SVGConstants.SVG_POINTS_ATTRIBUTE;
-import static org.apache.batik.util.SVGConstants.SVG_RX_ATTRIBUTE;
-import static org.apache.batik.util.SVGConstants.SVG_RY_ATTRIBUTE;
-import static org.apache.batik.util.SVGConstants.SVG_STROKE_ATTRIBUTE;
-import static org.apache.batik.util.SVGConstants.SVG_STROKE_DASHARRAY_ATTRIBUTE;
-import static org.apache.batik.util.SVGConstants.SVG_STROKE_WIDTH_ATTRIBUTE;
-import static org.apache.batik.util.SVGConstants.SVG_TEXT_ANCHOR_ATTRIBUTE;
-import static org.apache.batik.util.SVGConstants.SVG_TRANSFORM_ATTRIBUTE;
-import static org.apache.batik.util.SVGConstants.SVG_WIDTH_ATTRIBUTE;
-import static org.apache.batik.util.SVGConstants.SVG_X_ATTRIBUTE;
-import static org.apache.batik.util.SVGConstants.SVG_Y_ATTRIBUTE;
-import static org.apache.batik.util.SVGConstants.TRANSFORM_TRANSLATE;
-
-import java.awt.Color;
-import java.awt.Dimension;
-import java.awt.Point;
-
-import net.sf.taverna.t2.workbench.models.graph.Graph;
-import net.sf.taverna.t2.workbench.models.graph.GraphNode;
-import net.sf.taverna.t2.workbench.models.graph.svg.event.SVGMouseClickEventListener;
-import net.sf.taverna.t2.workbench.models.graph.svg.event.SVGMouseDownEventListener;
-import net.sf.taverna.t2.workbench.models.graph.svg.event.SVGMouseMovedEventListener;
-import net.sf.taverna.t2.workbench.models.graph.svg.event.SVGMouseOutEventListener;
-import net.sf.taverna.t2.workbench.models.graph.svg.event.SVGMouseOverEventListener;
-
-import org.apache.batik.dom.svg.SVGOMAnimationElement;
-import org.apache.batik.dom.svg.SVGOMEllipseElement;
-import org.apache.batik.dom.svg.SVGOMGElement;
-import org.apache.batik.dom.svg.SVGOMPathElement;
-import org.apache.batik.dom.svg.SVGOMPolygonElement;
-import org.apache.batik.dom.svg.SVGOMRectElement;
-import org.apache.batik.dom.svg.SVGOMTextElement;
-import org.apache.batik.util.CSSConstants;
-import org.apache.batik.util.SVGConstants;
-import org.w3c.dom.Text;
-import org.w3c.dom.events.Event;
-import org.w3c.dom.events.EventListener;
-import org.w3c.dom.events.EventTarget;
-import org.w3c.dom.svg.SVGElement;
-
-/**
- * SVG representation of a graph node.
- * 
- * @author David Withers
- */
-public class SVGGraphNode extends GraphNode {
-	private SVGGraphController graphController;
-	private SVGGraphElementDelegate delegate;
-	private SVGMouseClickEventListener mouseClickAction;
-	private SVGMouseMovedEventListener mouseMovedAction;
-	private SVGMouseDownEventListener mouseDownAction;
-	@SuppressWarnings("unused")
-	private SVGMouseOverEventListener mouseOverAction;
-	@SuppressWarnings("unused")
-	private SVGMouseOutEventListener mouseOutAction;
-	private SVGOMGElement mainGroup, labelGroup, portsGroup;
-	private SVGElement expandedElement, contractedElement;
-	private SVGOMPolygonElement polygon, completedPolygon;
-	private SVGOMEllipseElement ellipse;
-	private SVGOMTextElement label, iteration, error;
-	private Text labelText, iterationText, errorsText;
-	private SVGElement deleteButton;
-	private SVGOMAnimationElement animateShape, animatePosition, animateLabel, animateIteration,
-			animateErrors;
-
-	public SVGGraphNode(SVGGraphController graphController) {
-		super(graphController);
-		this.graphController = graphController;
-		mouseClickAction = new SVGMouseClickEventListener(this);
-		mouseDownAction = new SVGMouseDownEventListener(this);
-		mouseMovedAction = new SVGMouseMovedEventListener(this);
-		mouseOverAction = new SVGMouseOverEventListener(this);
-		mouseOutAction = new SVGMouseOutEventListener(this);
-
-		mainGroup = graphController.createGElem();
-		mainGroup.setAttribute("alignment-baseline", SVG_MIDDLE_VALUE);
-		mainGroup.setAttribute(SVG_STROKE_ATTRIBUTE, CSS_BLACK_VALUE);
-		mainGroup.setAttribute(SVG_STROKE_DASHARRAY_ATTRIBUTE, CSS_NONE_VALUE);
-		mainGroup.setAttribute(SVG_STROKE_WIDTH_ATTRIBUTE, "1");
-		mainGroup.setAttribute(SVG_FILL_ATTRIBUTE, CSS_NONE_VALUE);
-
-		EventTarget t = (EventTarget) mainGroup;
-		t.addEventListener(SVG_CLICK_EVENT_TYPE, mouseClickAction, false);
-		t.addEventListener(SVG_MOUSEMOVE_EVENT_TYPE, mouseMovedAction, false);
-		t.addEventListener(SVG_MOUSEDOWN_EVENT_TYPE, mouseDownAction, false);
-//		t.addEventListener(SVGConstants.SVG_MOUSEOVER_EVENT_TYPE, mouseOverAction, false);
-//		t.addEventListener(SVGConstants.SVG_MOUSEOUT_EVENT_TYPE, mouseOutAction, false);
-
-		expandedElement = graphController.createGElem();
-		contractedElement = graphController.createGElem();
-
-		portsGroup = graphController.createGElem();
-		portsGroup.setAttribute(CSS_DISPLAY_PROPERTY, CSS_NONE_VALUE);
-		contractedElement.appendChild(portsGroup);
-
-		mainGroup.appendChild(contractedElement);
-
-		polygon = graphController.createPolygon();
-		contractedElement.appendChild(polygon);
-
-		ellipse = graphController.createEllipse();
-		ellipse.setAttribute(CSS_DISPLAY_PROPERTY, CSS_NONE_VALUE);
-		ellipse.setAttribute(SVG_RX_ATTRIBUTE, String.valueOf(2));
-		ellipse.setAttribute(SVG_CX_ATTRIBUTE, String.valueOf(0));
-		ellipse.setAttribute(SVG_RY_ATTRIBUTE, String.valueOf(2));
-		ellipse.setAttribute(SVG_CY_ATTRIBUTE, String.valueOf(0));
-		contractedElement.appendChild(ellipse);
-
-		completedPolygon = graphController.createPolygon();
-		completedPolygon.setAttribute(SVG_POINTS_ATTRIBUTE,
-				calculatePoints(getShape(), 0, 0));
-		completedPolygon.setAttribute(SVG_FILL_ATTRIBUTE, COMPLETED_COLOUR);
-		completedPolygon.setAttribute(SVG_FILL_OPACITY_ATTRIBUTE, "0.8");
-		contractedElement.appendChild(completedPolygon);
-
-		labelText = graphController.createText("");
-		label = graphController.createText(labelText);
-		label.setAttribute(SVG_TEXT_ANCHOR_ATTRIBUTE, SVG_MIDDLE_VALUE);
-		label.setAttribute("baseline-shift", "-35%");
-		label.setAttribute(SVG_FILL_ATTRIBUTE, CSS_BLACK_VALUE);
-		label.setAttribute(SVG_STROKE_ATTRIBUTE, SVGConstants.SVG_NONE_VALUE);
-		labelGroup = graphController.createGElem();
-		labelGroup.appendChild(label);
-		contractedElement.appendChild(labelGroup);
-
-		iterationText = graphController.createText("");
-		iteration = graphController.createText(iterationText);
-		iteration.setAttribute(SVG_TEXT_ANCHOR_ATTRIBUTE, SVG_END_VALUE);
-		iteration.setAttribute(SVG_FONT_SIZE_ATTRIBUTE, "6");
-		iteration.setAttribute(SVG_FONT_FAMILY_ATTRIBUTE, "sans-serif");
-		iteration.setAttribute(SVG_FILL_ATTRIBUTE, CSS_BLACK_VALUE);
-		iteration.setAttribute(SVG_STROKE_ATTRIBUTE, SVG_NONE_VALUE);
-		contractedElement.appendChild(iteration);
-
-		errorsText = graphController.createText("");
-		error = graphController.createText(errorsText);
-		error.setAttribute(SVG_TEXT_ANCHOR_ATTRIBUTE, SVG_END_VALUE);
-		error.setAttribute(SVG_FONT_SIZE_ATTRIBUTE, "6");
-		error.setAttribute(SVG_FONT_FAMILY_ATTRIBUTE, "sans-serif");
-		error.setAttribute(SVG_FILL_ATTRIBUTE, CSSConstants.CSS_BLACK_VALUE);
-		error.setAttribute(SVG_STROKE_ATTRIBUTE, SVG_NONE_VALUE);
-		contractedElement.appendChild(error);
-
-		// deleteButton = createDeleteButton();
-		// g.appendChild(deleteButton);
-
-		animateShape = createAnimationElement(graphController, SVG_ANIMATE_TAG,
-				SVG_POINTS_ATTRIBUTE, null);
-
-		animatePosition = createAnimationElement(graphController,
-				SVG_ANIMATE_TRANSFORM_TAG, SVG_TRANSFORM_ATTRIBUTE,
-				TRANSFORM_TRANSLATE);
-
-		animateLabel = SVGUtil.createAnimationElement(graphController,
-				SVG_ANIMATE_TRANSFORM_TAG, SVG_TRANSFORM_ATTRIBUTE,
-				TRANSFORM_TRANSLATE);
-
-		animateIteration = createAnimationElement(graphController,
-				SVG_ANIMATE_TRANSFORM_TAG, SVG_TRANSFORM_ATTRIBUTE,
-				TRANSFORM_TRANSLATE);
-
-		animateErrors = createAnimationElement(graphController,
-				SVG_ANIMATE_TRANSFORM_TAG, SVG_TRANSFORM_ATTRIBUTE,
-				TRANSFORM_TRANSLATE);
-
-		delegate = new SVGGraphElementDelegate(graphController, this, mainGroup);
-	}
-
-	@SuppressWarnings("unused")
-	private SVGElement createDeleteButton() {
-		final SVGOMGElement button = graphController.createGElem();
-		button.setAttribute(CSS_VISIBILITY_PROPERTY, CSS_HIDDEN_VALUE);
-		button.setAttribute(CSS_POINTER_EVENTS_PROPERTY, CSS_ALL_VALUE);
-
-		SVGOMRectElement rect = graphController.createRect();
-		rect.setAttribute(SVG_X_ATTRIBUTE, "4");
-		rect.setAttribute(SVG_Y_ATTRIBUTE, "4");
-		rect.setAttribute(SVG_WIDTH_ATTRIBUTE, "13");
-		rect.setAttribute(SVG_HEIGHT_ATTRIBUTE, "13");
-		rect.setAttribute(SVG_FILL_ATTRIBUTE, "none");
-		button.appendChild(rect);
-
-		final SVGOMPathElement path = graphController.createPath();
-		path.setAttribute(SVG_STROKE_ATTRIBUTE, "white");
-		path.setAttribute(SVG_STROKE_WIDTH_ATTRIBUTE, "2");
-		path.setAttribute(SVG_D_ATTRIBUTE, "M5,5L12,12M5,12L12,5");
-		button.appendChild(path);
-
-		EventTarget t = (EventTarget) button;
-		t.addEventListener(SVG_MOUSEOVER_EVENT_TYPE, new EventListener() {
-			@Override
-			public void handleEvent(Event evt) {
-				if (isInteractive()) {
-					deleteButton.setAttribute(CSS_VISIBILITY_PROPERTY,
-							CSS_VISIBLE_VALUE);
-					path.setAttribute(SVG_STROKE_ATTRIBUTE, "red");
-					evt.stopPropagation();
-				}
-			}
-		}, false);
-		t.addEventListener(SVG_MOUSEOUT_EVENT_TYPE, new EventListener() {
-			@Override
-			public void handleEvent(Event evt) {
-				if (isInteractive()) {
-					path.setAttribute(SVG_STROKE_ATTRIBUTE, "white");
-					evt.stopPropagation();
-				}
-			}
-		}, false);
-
-		return button;
-	}
-
-	public SVGElement getSVGElement() {
-		return mainGroup;
-	}
-
-	@Override
-	public void setActive(final boolean active) {
-		super.setActive(active);
-		if (isInteractive())
-			graphController.updateSVGDocument(new Runnable() {
-				@Override
-				public void run() {
-					if (active) {
-						deleteButton.setAttribute(CSS_VISIBILITY_PROPERTY,
-								CSS_VISIBLE_VALUE);
-						// deleteButton.setAttribute(CSSConstants.CSS_DISPLAY_PROPERTY,
-						// CSSConstants.CSS_INLINE_VALUE);
-					} else {
-						deleteButton.setAttribute(CSS_VISIBILITY_PROPERTY,
-								CSS_HIDDEN_VALUE);
-						// button.setAttribute(CSSConstants.CSS_DISPLAY_PROPERTY,
-						// CSSConstants.CSS_NONE_VALUE);
-					}
-				}
-			});
-	}
-
-	@Override
-	public void setGraph(Graph graph) {
-		super.setGraph(graph);
-		if (graph instanceof SVGGraph) {
-			SVGGraph svgGraph = (SVGGraph) graph;
-			final SVGElement graphElement = svgGraph.getSVGElement();
-			if (isExpanded())
-				graphController.updateSVGDocument(new Runnable() {
-					@Override
-					public void run() {
-						mainGroup.replaceChild(expandedElement, graphElement);
-					}
-				});
-			expandedElement = graphElement;
-		}
-	}
-
-	@Override
-	public void setExpanded(final boolean expanded) {
-		if (isExpanded() != expanded)
-			graphController.updateSVGDocument(new Runnable() {
-				@Override
-				public void run() {
-					if (expanded)
-						mainGroup.replaceChild(expandedElement, contractedElement);
-					else
-						mainGroup.replaceChild(contractedElement, expandedElement);
-				}
-			});
-		super.setExpanded(expanded);
-	}
-
-	@Override
-	public void addSourceNode(final GraphNode sourceNode) {
-		super.addSourceNode(sourceNode);
-		if (sourceNode instanceof SVGGraphNode)
-			graphController.updateSVGDocument(new Runnable() {
-				@Override
-				public void run() {
-					SVGGraphNode svgGraphNode = (SVGGraphNode) sourceNode;
-					portsGroup.appendChild(svgGraphNode.getSVGElement());
-				}
-			});
-	}
-
-	@Override
-	public boolean removeSourceNode(final GraphNode sourceNode) {
-		if (sourceNode instanceof SVGGraphNode)
-			graphController.updateSVGDocument(new Runnable() {
-				@Override
-				public void run() {
-					SVGGraphNode svgGraphNode = (SVGGraphNode) sourceNode;
-					portsGroup.removeChild(svgGraphNode.getSVGElement());
-				}
-			});
-		return super.removeSourceNode(sourceNode);
-	}
-
-	@Override
-	public void addSinkNode(final GraphNode sinkNode) {
-		super.addSinkNode(sinkNode);
-		if (sinkNode instanceof SVGGraphNode)
-			graphController.updateSVGDocument(new Runnable() {
-				@Override
-				public void run() {
-					SVGGraphNode svgGraphNode = (SVGGraphNode) sinkNode;
-					portsGroup.appendChild(svgGraphNode.getSVGElement());
-				}
-			});
-	}
-
-	@Override
-	public boolean removeSinkNode(final GraphNode sinkNode) {
-		if (sinkNode instanceof SVGGraphNode)
-			graphController.updateSVGDocument(new Runnable() {
-				@Override
-				public void run() {
-					SVGGraphNode svgGraphNode = (SVGGraphNode) sinkNode;
-					portsGroup.removeChild(svgGraphNode.getSVGElement());
-				}
-			});
-		return super.removeSinkNode(sinkNode);
-	}
-
-	@Override
-	public void setPosition(final Point position) {
-		final Point oldPosition = getPosition();
-		if (position != null && !position.equals(oldPosition)) {
-			super.setPosition(position);
-			graphController.updateSVGDocument(new Runnable() {
-				@Override
-				public void run() {
-					if (graphController.isAnimatable())
-						animate(animatePosition, mainGroup,
-								graphController.getAnimationSpeed(),
-								oldPosition.x + ", " + oldPosition.y,
-								position.x + ", " + position.y);
-					else
-						mainGroup.setAttribute(SVG_TRANSFORM_ATTRIBUTE,
-								"translate(" + position.x + " " + position.y
-										+ ")");
-				}
-			});
-		}
-	}
-
-	@Override
-	public void setSize(final Dimension size) {
-		final Dimension oldSize = getSize();
-		if (size != null && !size.equals(oldSize)) {
-			super.setSize(size);
-			graphController.updateSVGDocument(new Runnable() {
-				@Override
-				public void run() {
-					adjustSize(size, oldSize);
-				}
-			});
-		}
-	}
-
-	/** core of implementation of {@link #setSize(Dimension)} */
-	private void adjustSize(Dimension size, Dimension oldSize) {
-		int oldWidth = oldSize.width;
-		int oldHeight = oldSize.height;
-		if (graphController.isAnimatable()) {
-			if (Shape.CIRCLE.equals(getShape())) {
-				ellipse.setAttribute(SVG_RX_ATTRIBUTE,
-						String.valueOf(size.width / 2f));
-				ellipse.setAttribute(SVG_CX_ATTRIBUTE,
-						String.valueOf(size.width / 2f));
-				ellipse.setAttribute(SVG_RY_ATTRIBUTE,
-						String.valueOf(size.height / 2f));
-				ellipse.setAttribute(SVG_CY_ATTRIBUTE,
-						String.valueOf(size.height / 2f));
-			} else
-				animate(animateShape, polygon,
-						graphController.getAnimationSpeed(),
-						calculatePoints(getShape(), oldWidth, oldHeight),
-						calculatePoints(getShape(), getWidth(), getHeight()));
-
-			if (getLabel() != null && !getLabel().isEmpty())
-				animate(animateLabel, labelGroup,
-						graphController.getAnimationSpeed(), (oldWidth / 2f)
-								+ ", " + (oldHeight / 2f), (getWidth() / 2f)
-								+ ", " + (getHeight() / 2f));
-			else
-				labelGroup.setAttribute(SVG_TRANSFORM_ATTRIBUTE,
-						"translate(" + getWidth() / 2f + " " + getHeight() / 2f + ")");
-
-			if (getIteration() > 0)
-				animate(animateIteration, iteration,
-						graphController.getAnimationSpeed(), (oldWidth - 1.5)
-								+ ", 5.5", (getWidth() - 1.5) + ", 5.5");
-			else
-				iteration.setAttribute(SVG_TRANSFORM_ATTRIBUTE, "translate("
-						+ (getWidth() - 1.5) + " 5.5)");
-
-			if (getErrors() > 0)
-				animate(animateErrors, error,
-						graphController.getAnimationSpeed(), (oldWidth - 1.5)
-								+ ", " + (oldHeight - 1), (getWidth() - 1.5)
-								+ ", " + (getHeight() - 1));
-			else
-				error.setAttribute(SVG_TRANSFORM_ATTRIBUTE, "translate("
-						+ (getWidth() - 1.5) + " " + (getHeight() - 1) + ")");
-		} else {
-			if (Shape.CIRCLE.equals(getShape())) {
-				ellipse.setAttribute(SVG_RX_ATTRIBUTE,
-						String.valueOf(size.width / 2f));
-				ellipse.setAttribute(SVG_CX_ATTRIBUTE,
-						String.valueOf(size.width / 2f));
-				ellipse.setAttribute(SVG_RY_ATTRIBUTE,
-						String.valueOf(size.height / 2f));
-				ellipse.setAttribute(SVG_CY_ATTRIBUTE,
-						String.valueOf(size.height / 2f));
-			} else
-				polygon.setAttribute(SVG_POINTS_ATTRIBUTE,
-						calculatePoints(getShape(), getWidth(), getHeight()));
-
-			labelGroup.setAttribute(SVG_TRANSFORM_ATTRIBUTE, "translate("
-					+ getWidth() / 2f + " " + getHeight() / 2f + ")");
-			iteration.setAttribute(SVG_TRANSFORM_ATTRIBUTE, "translate("
-					+ (getWidth() - 1.5) + " 5.5)");
-			error.setAttribute(SVG_TRANSFORM_ATTRIBUTE, "translate("
-					+ (getWidth() - 1.5) + " " + (getHeight() - 1) + ")");
-		}
-	}
-
-	@Override
-	public void setShape(final Shape shape) {
-		final Shape currentShape = getShape();
-		if (shape != null && !shape.equals(currentShape)) {
-			super.setShape(shape);
-			graphController.updateSVGDocument(new Runnable() {
-				@Override
-				public void run() {
-					if (Shape.CIRCLE.equals(shape)) {
-						ellipse.setAttribute(CSS_DISPLAY_PROPERTY,
-								CSS_INLINE_VALUE);
-						polygon.setAttribute(CSS_DISPLAY_PROPERTY,
-								CSS_NONE_VALUE);
-					} else if (Shape.CIRCLE.equals(currentShape)) {
-						ellipse.setAttribute(CSS_DISPLAY_PROPERTY,
-								CSS_NONE_VALUE);
-						polygon.setAttribute(CSS_DISPLAY_PROPERTY,
-								CSS_INLINE_VALUE);
-					}
-					if (Shape.RECORD.equals(shape))
-						portsGroup.setAttribute(CSS_DISPLAY_PROPERTY,
-								CSS_INLINE_VALUE);
-					else if (Shape.RECORD.equals(currentShape))
-						portsGroup.setAttribute(CSS_DISPLAY_PROPERTY,
-								CSS_NONE_VALUE);
-				}
-			});
-		}
-	}
-
-	@Override
-	public void setLabel(final String label) {
-		super.setLabel(label);
-		graphController.updateSVGDocument(new Runnable() {
-			@Override
-			public void run() {
-				labelText.setData(label);
-			}
-		});
-	}
-
-	@Override
-	public void setIteration(final int iteration) {
-		super.setIteration(iteration);
-		graphController.updateSVGDocument(new Runnable() {
-			@Override
-			public void run() {
-				if (iteration > 0)
-					iterationText.setData(String.valueOf(iteration));
-				else
-					iterationText.setData("");
-			}
-		});
-	}
-
-	@Override
-	public void setErrors(final int errors) {
-		super.setErrors(errors);
-		graphController.updateSVGDocument(new Runnable() {
-			@Override
-			public void run() {
-				if (errors > 0) {
-					errorsText.setData(String.valueOf(errors));
-					completedPolygon.setAttribute(SVG_FILL_ATTRIBUTE,
-							ERROR_COLOUR);
-				} else {
-					errorsText.setData("");
-					completedPolygon.setAttribute(SVG_FILL_ATTRIBUTE,
-							COMPLETED_COLOUR);
-				}
-			}
-		});
-	}
-
-	@Override
-	public void setCompleted(final float complete) {
-		super.setCompleted(complete);
-		graphController.updateSVGDocument(new Runnable() {
-			@Override
-			public void run() {
-				completedPolygon.setAttribute(
-						SVG_POINTS_ATTRIBUTE,
-						calculatePoints(getShape(),
-								(int) (getWidth() * complete), getHeight()));
-			}
-		});
-	}
-
-	@Override
-	public void setSelected(final boolean selected) {
-		delegate.setSelected(selected);
-		super.setSelected(selected);
-	}
-
-	@Override
-	public void setLineStyle(final LineStyle lineStyle) {
-		delegate.setLineStyle(lineStyle);
-		super.setLineStyle(lineStyle);
-	}
-
-	@Override
-	public void setColor(final Color color) {
-		delegate.setColor(color);
-		super.setColor(color);
-	}
-
-	@Override
-	public void setFillColor(final Color fillColor) {
-		delegate.setFillColor(fillColor);
-		super.setFillColor(fillColor);
-	}
-
-	@Override
-	public void setVisible(final boolean visible) {
-		delegate.setVisible(visible);
-		super.setVisible(visible);
-	}
-
-	@Override
-	public void setFiltered(final boolean filtered) {
-		delegate.setFiltered(filtered);
-		super.setFiltered(filtered);
-	}
-
-	@Override
-	public void setOpacity(final float opacity) {
-		delegate.setOpacity(opacity);
-		super.setOpacity(opacity);
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-graph-model/src/main/java/net/sf/taverna/t2/workbench/models/graph/svg/SVGGraphSettings.java
----------------------------------------------------------------------
diff --git a/taverna-graph-model/src/main/java/net/sf/taverna/t2/workbench/models/graph/svg/SVGGraphSettings.java b/taverna-graph-model/src/main/java/net/sf/taverna/t2/workbench/models/graph/svg/SVGGraphSettings.java
deleted file mode 100644
index 777102e..0000000
--- a/taverna-graph-model/src/main/java/net/sf/taverna/t2/workbench/models/graph/svg/SVGGraphSettings.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*******************************************************************************
- * 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.models.graph.svg;
-
-public interface SVGGraphSettings {
-	String COMPLETED_COLOUR = "grey";
-	String ERROR_COLOUR = "#dd3131";
-	String SELECTED_COLOUR = "#4377d3";
-	String NORMAL_COLOUR = "black";
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-graph-model/src/main/java/net/sf/taverna/t2/workbench/models/graph/svg/SVGMonitorShape.java
----------------------------------------------------------------------
diff --git a/taverna-graph-model/src/main/java/net/sf/taverna/t2/workbench/models/graph/svg/SVGMonitorShape.java b/taverna-graph-model/src/main/java/net/sf/taverna/t2/workbench/models/graph/svg/SVGMonitorShape.java
deleted file mode 100644
index 5aab55f..0000000
--- a/taverna-graph-model/src/main/java/net/sf/taverna/t2/workbench/models/graph/svg/SVGMonitorShape.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * 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.models.graph.svg;
-
-import org.apache.batik.dom.svg.SVGOMPolygonElement;
-
-public interface SVGMonitorShape extends SVGShape {
-	/**
-	 * Returns the polygon used to display the completed value.
-	 * 
-	 * @return the polygon used to display the completed value
-	 */
-	SVGOMPolygonElement getCompletedPolygon();
-
-	/**
-	 * Sets the polygon used to display the completed value.
-	 * 
-	 * @param polygon
-	 *            the new polygon used to display the completed value
-	 */
-	void setCompletedPolygon(SVGOMPolygonElement polygon);
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-graph-model/src/main/java/net/sf/taverna/t2/workbench/models/graph/svg/SVGShape.java
----------------------------------------------------------------------
diff --git a/taverna-graph-model/src/main/java/net/sf/taverna/t2/workbench/models/graph/svg/SVGShape.java b/taverna-graph-model/src/main/java/net/sf/taverna/t2/workbench/models/graph/svg/SVGShape.java
deleted file mode 100644
index 8ebc338..0000000
--- a/taverna-graph-model/src/main/java/net/sf/taverna/t2/workbench/models/graph/svg/SVGShape.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*******************************************************************************
- * 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.models.graph.svg;
-
-public interface SVGShape {
-	public void setIteration(final int iteration);
-
-	// public void setErrors(final int errors);
-
-	// public void setCompleted(final float complete);
-}


[13/51] [partial] incubator-taverna-workbench git commit: all packages are moved to org.apache.taverna.*

Posted by re...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-graph-model/src/main/java/org/apache/taverna/workbench/models/graph/svg/SVGGraph.java
----------------------------------------------------------------------
diff --git a/taverna-graph-model/src/main/java/org/apache/taverna/workbench/models/graph/svg/SVGGraph.java b/taverna-graph-model/src/main/java/org/apache/taverna/workbench/models/graph/svg/SVGGraph.java
new file mode 100644
index 0000000..1b1df78
--- /dev/null
+++ b/taverna-graph-model/src/main/java/org/apache/taverna/workbench/models/graph/svg/SVGGraph.java
@@ -0,0 +1,439 @@
+/*******************************************************************************
+ * 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 org.apache.taverna.workbench.models.graph.svg;
+
+import static org.apache.taverna.workbench.models.graph.svg.SVGGraphSettings.COMPLETED_COLOUR;
+import static org.apache.taverna.workbench.models.graph.svg.SVGUtil.animate;
+import static org.apache.taverna.workbench.models.graph.svg.SVGUtil.calculatePoints;
+import static org.apache.taverna.workbench.models.graph.svg.SVGUtil.createAnimationElement;
+import static org.apache.batik.util.CSSConstants.CSS_BLACK_VALUE;
+import static org.apache.batik.util.CSSConstants.CSS_NONE_VALUE;
+import static org.apache.batik.util.SVGConstants.SVG_ANIMATE_TAG;
+import static org.apache.batik.util.SVGConstants.SVG_ANIMATE_TRANSFORM_TAG;
+import static org.apache.batik.util.SVGConstants.SVG_CLICK_EVENT_TYPE;
+import static org.apache.batik.util.SVGConstants.SVG_END_VALUE;
+import static org.apache.batik.util.SVGConstants.SVG_FILL_ATTRIBUTE;
+import static org.apache.batik.util.SVGConstants.SVG_FONT_FAMILY_ATTRIBUTE;
+import static org.apache.batik.util.SVGConstants.SVG_FONT_SIZE_ATTRIBUTE;
+import static org.apache.batik.util.SVGConstants.SVG_MIDDLE_VALUE;
+import static org.apache.batik.util.SVGConstants.SVG_MOUSEMOVE_EVENT_TYPE;
+import static org.apache.batik.util.SVGConstants.SVG_MOUSEUP_EVENT_TYPE;
+import static org.apache.batik.util.SVGConstants.SVG_NONE_VALUE;
+import static org.apache.batik.util.SVGConstants.SVG_POINTS_ATTRIBUTE;
+import static org.apache.batik.util.SVGConstants.SVG_STROKE_ATTRIBUTE;
+import static org.apache.batik.util.SVGConstants.SVG_STROKE_DASHARRAY_ATTRIBUTE;
+import static org.apache.batik.util.SVGConstants.SVG_STROKE_WIDTH_ATTRIBUTE;
+import static org.apache.batik.util.SVGConstants.SVG_TEXT_ANCHOR_ATTRIBUTE;
+import static org.apache.batik.util.SVGConstants.SVG_TRANSFORM_ATTRIBUTE;
+import static org.apache.batik.util.SVGConstants.TRANSFORM_TRANSLATE;
+
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Point;
+
+import org.apache.taverna.workbench.models.graph.Graph;
+import org.apache.taverna.workbench.models.graph.GraphEdge;
+import org.apache.taverna.workbench.models.graph.GraphNode;
+import org.apache.taverna.workbench.models.graph.svg.event.SVGMouseClickEventListener;
+import org.apache.taverna.workbench.models.graph.svg.event.SVGMouseMovedEventListener;
+import org.apache.taverna.workbench.models.graph.svg.event.SVGMouseOutEventListener;
+import org.apache.taverna.workbench.models.graph.svg.event.SVGMouseOverEventListener;
+import org.apache.taverna.workbench.models.graph.svg.event.SVGMouseUpEventListener;
+
+import org.apache.batik.dom.svg.SVGOMAnimationElement;
+import org.apache.batik.dom.svg.SVGOMGElement;
+import org.apache.batik.dom.svg.SVGOMPolygonElement;
+import org.apache.batik.dom.svg.SVGOMTextElement;
+import org.w3c.dom.Text;
+import org.w3c.dom.events.EventTarget;
+import org.w3c.dom.svg.SVGElement;
+
+/**
+ * SVG representation of a graph.
+ * 
+ * @author David Withers
+ */
+public class SVGGraph extends Graph {
+	private SVGGraphController graphController;
+	private SVGGraphElementDelegate delegate;
+	private SVGMouseClickEventListener mouseClickAction;
+	private SVGMouseMovedEventListener mouseMovedAction;
+	private SVGMouseUpEventListener mouseUpAction;
+	@SuppressWarnings("unused")
+	private SVGMouseOverEventListener mouseOverAction;
+	@SuppressWarnings("unused")
+	private SVGMouseOutEventListener mouseOutAction;
+	private SVGOMGElement mainGroup, labelGroup;
+	private SVGOMPolygonElement polygon, completedPolygon;
+	private SVGOMTextElement label, iteration, error;
+	private Text labelText, iterationText, errorsText;
+	private SVGOMAnimationElement animateShape, animatePosition, animateLabel;
+
+	public SVGGraph(SVGGraphController graphController) {
+		super(graphController);
+		this.graphController = graphController;
+
+		mouseClickAction = new SVGMouseClickEventListener(this);
+		mouseMovedAction = new SVGMouseMovedEventListener(this);
+		mouseUpAction = new SVGMouseUpEventListener(this);
+		mouseOverAction = new SVGMouseOverEventListener(this);
+		mouseOutAction = new SVGMouseOutEventListener(this);
+
+		mainGroup = graphController.createGElem();
+		mainGroup.setAttribute(SVG_FONT_SIZE_ATTRIBUTE, "10");
+		mainGroup.setAttribute(SVG_FONT_FAMILY_ATTRIBUTE, "Helvetica");
+		mainGroup.setAttribute(SVG_STROKE_ATTRIBUTE, CSS_BLACK_VALUE);
+		mainGroup.setAttribute(SVG_STROKE_DASHARRAY_ATTRIBUTE, CSS_NONE_VALUE);
+		mainGroup.setAttribute(SVG_STROKE_WIDTH_ATTRIBUTE, "1");
+		mainGroup.setAttribute(SVG_FILL_ATTRIBUTE, CSS_NONE_VALUE);
+
+		EventTarget t = (EventTarget) mainGroup;
+		t.addEventListener(SVG_CLICK_EVENT_TYPE, mouseClickAction, false);
+		t.addEventListener(SVG_MOUSEMOVE_EVENT_TYPE, mouseMovedAction, false);
+		t.addEventListener(SVG_MOUSEUP_EVENT_TYPE, mouseUpAction, false);
+		// t.addEventListener(SVGConstants.SVG_MOUSEOVER_EVENT_TYPE, mouseOverAction, false);
+		// t.addEventListener(SVGConstants.SVG_MOUSEOUT_EVENT_TYPE, mouseOutAction, false);
+
+		polygon = graphController.createPolygon();
+		mainGroup.appendChild(polygon);
+
+		completedPolygon = graphController.createPolygon();
+		completedPolygon.setAttribute(SVG_POINTS_ATTRIBUTE,
+				calculatePoints(getShape(), 0, 0));
+		completedPolygon.setAttribute(SVG_FILL_ATTRIBUTE, COMPLETED_COLOUR);
+		// completedPolygon.setAttribute(SVGConstants.SVG_FILL_OPACITY_ATTRIBUTE, "0.8");
+		// completedPolygon.setAttribute(SVG_STROKE_ATTRIBUTE, SVG_NONE_VALUE);
+		mainGroup.appendChild(completedPolygon);
+
+		labelText = graphController.createText("");
+		label = graphController.createText(labelText);
+		label.setAttribute(SVG_TEXT_ANCHOR_ATTRIBUTE, SVG_MIDDLE_VALUE);
+		label.setAttribute(SVG_FILL_ATTRIBUTE, CSS_BLACK_VALUE);
+		label.setAttribute(SVG_STROKE_ATTRIBUTE, SVG_NONE_VALUE);
+		labelGroup = graphController.createGElem();
+		labelGroup.appendChild(label);
+		mainGroup.appendChild(labelGroup);
+
+		iterationText = graphController.createText("");
+		iteration = graphController.createText(iterationText);
+		iteration.setAttribute(SVG_TEXT_ANCHOR_ATTRIBUTE, SVG_END_VALUE);
+		iteration.setAttribute(SVG_FONT_SIZE_ATTRIBUTE, "6");
+		iteration.setAttribute(SVG_FONT_FAMILY_ATTRIBUTE, "sans-serif");
+		iteration.setAttribute(SVG_FILL_ATTRIBUTE, CSS_BLACK_VALUE);
+		iteration.setAttribute(SVG_STROKE_ATTRIBUTE, SVG_NONE_VALUE);
+		polygon.appendChild(iteration);
+
+		errorsText = graphController.createText("");
+		error = graphController.createText(errorsText);
+		error.setAttribute(SVG_TEXT_ANCHOR_ATTRIBUTE, SVG_END_VALUE);
+		error.setAttribute(SVG_FONT_SIZE_ATTRIBUTE, "6");
+		error.setAttribute(SVG_FONT_FAMILY_ATTRIBUTE, "sans-serif");
+		error.setAttribute(SVG_FILL_ATTRIBUTE, CSS_BLACK_VALUE);
+		error.setAttribute(SVG_STROKE_ATTRIBUTE, SVG_NONE_VALUE);
+		polygon.appendChild(error);
+
+		animateShape = createAnimationElement(graphController, SVG_ANIMATE_TAG,
+				SVG_POINTS_ATTRIBUTE, null);
+
+		animatePosition = createAnimationElement(graphController,
+				SVG_ANIMATE_TRANSFORM_TAG, SVG_TRANSFORM_ATTRIBUTE,
+				TRANSFORM_TRANSLATE);
+
+		animateLabel = createAnimationElement(graphController,
+				SVG_ANIMATE_TRANSFORM_TAG, SVG_TRANSFORM_ATTRIBUTE,
+				TRANSFORM_TRANSLATE);
+
+		delegate = new SVGGraphElementDelegate(graphController, this, mainGroup);
+	}
+
+	public SVGElement getSVGElement() {
+		return mainGroup;
+	}
+
+	@Override
+	public void addEdge(GraphEdge edge) {
+		if (edge instanceof SVGGraphEdge) {
+			final SVGGraphEdge svgGraphEdge = (SVGGraphEdge) edge;
+			graphController.updateSVGDocument(new Runnable() {
+				@Override
+				public void run() {
+				    float opacity = svgGraphEdge.getOpacity();
+					svgGraphEdge.setOpacity(0);
+					mainGroup.appendChild(svgGraphEdge.getSVGElement());
+					svgGraphEdge.setOpacity(opacity);
+				}
+			});
+		}
+		super.addEdge(edge);
+	}
+
+	@Override
+	public void addNode(GraphNode node) {
+		super.addNode(node);
+		if (node instanceof SVGGraphNode) {
+			final SVGGraphNode svgGraphNode = (SVGGraphNode) node;
+			graphController.updateSVGDocument(new Runnable() {
+				@Override
+				public void run() {
+				    float opacity = svgGraphNode.getOpacity();
+					svgGraphNode.setOpacity(0);
+					mainGroup.appendChild(svgGraphNode.getSVGElement());
+					svgGraphNode.setOpacity(opacity);
+				}
+			});
+		}
+	}
+
+	@Override
+	public void addSubgraph(Graph subgraph) {
+		super.addSubgraph(subgraph);
+		if (subgraph instanceof SVGGraph) {
+			final SVGGraph svgGraph = (SVGGraph) subgraph;
+			graphController.updateSVGDocument(new Runnable() {
+				@Override
+				public void run() {
+				    float opacity = svgGraph.getOpacity();
+					svgGraph.setOpacity(0);
+					mainGroup.appendChild(svgGraph.getSVGElement());
+					svgGraph.setOpacity(opacity);
+				}
+			});
+		}
+	}
+
+	@Override
+	public boolean removeEdge(GraphEdge edge) {
+		if (edge instanceof SVGGraphEdge) {
+			final SVGGraphEdge svgGraphEdge = (SVGGraphEdge) edge;
+			graphController.updateSVGDocument(new Runnable() {
+				@Override
+				public void run() {
+					mainGroup.removeChild(svgGraphEdge.getSVGElement());
+				}
+			});
+		}
+		return super.removeEdge(edge);
+	}
+
+	@Override
+	public boolean removeNode(GraphNode node) {
+		if (node instanceof SVGGraphNode) {
+			final SVGGraphNode svgGraphNode = (SVGGraphNode) node;
+			graphController.updateSVGDocument(new Runnable() {
+				@Override
+				public void run() {
+					mainGroup.removeChild(svgGraphNode.getSVGElement());
+				}
+			});
+		}
+		return super.removeNode(node);
+	}
+
+	@Override
+	public boolean removeSubgraph(Graph subgraph) {
+		if (subgraph instanceof SVGGraph) {
+			final SVGGraph svgGraph = (SVGGraph) subgraph;
+			graphController.updateSVGDocument(new Runnable() {
+				@Override
+				public void run() {
+					mainGroup.removeChild(svgGraph.getSVGElement());
+				}
+			});
+		}
+		return super.removeSubgraph(subgraph);
+	}
+
+	@Override
+	public void setPosition(final Point position) {
+		final Point oldPosition = getPosition();
+		if (position != null && !position.equals(oldPosition)) {
+			super.setPosition(position);
+			graphController.updateSVGDocument(new Runnable() {
+				@Override
+				public void run() {
+					if (graphController.isAnimatable())
+						animate(animatePosition, polygon,
+								graphController.getAnimationSpeed(),
+								oldPosition.x + ", " + oldPosition.y,
+								position.x + ", " + position.y);
+					else
+						polygon.setAttribute(SVG_TRANSFORM_ATTRIBUTE,
+								"translate(" + position.x + " " + position.y
+										+ ")");
+				}
+			});
+		}
+	}
+
+	@Override
+	public void setSize(final Dimension size) {
+		final Dimension oldSize = getSize();
+		if (size != null && !size.equals(oldSize)) {
+			super.setSize(size);
+			updateShape(oldSize.width, oldSize.height);
+		}
+	}
+
+	@Override
+	public void setShape(Shape shape) {
+		final Dimension oldSize = getSize();
+		final Shape currentShape = getShape();
+		if (shape != null && !shape.equals(currentShape)) {
+			super.setShape(shape);
+			updateShape(oldSize.width, oldSize.height);
+		}
+	}
+
+	@Override
+	public void setLabel(final String label) {
+		super.setLabel(label);
+		graphController.updateSVGDocument(new Runnable() {
+			@Override
+			public void run() {
+				labelText.setData(label);
+			}
+		});
+	}
+
+	@Override
+	public void setLabelPosition(final Point labelPosition) {
+		final Point oldLabelPosition = getLabelPosition();
+		if (labelPosition != null && !labelPosition.equals(oldLabelPosition)) {
+			super.setLabelPosition(labelPosition);
+			graphController.updateSVGDocument(new Runnable() {
+				@Override
+				public void run() {
+					if (graphController.isAnimatable()
+							&& oldLabelPosition != null)
+						animate(animateLabel, labelGroup,
+								graphController.getAnimationSpeed(),
+								oldLabelPosition.x + ", " + oldLabelPosition.y,
+								labelPosition.x + ", " + labelPosition.y);
+					else
+						labelGroup.setAttribute(SVG_TRANSFORM_ATTRIBUTE,
+								"translate(" + labelPosition.x + " "
+										+ labelPosition.y + ")");
+				}
+			});
+		}
+	}
+
+	@Override
+	public void setIteration(final int iteration) {
+		graphController.updateSVGDocument(new Runnable() {
+			@Override
+			public void run() {
+				if (iteration > 0)
+					iterationText.setData(String.valueOf(iteration));
+				else
+					iterationText.setData("");
+			}
+		});
+	}
+
+	@Override
+	public void setCompleted(final float complete) {
+		super.setCompleted(complete);
+		graphController.updateSVGDocument(new Runnable() {
+			@Override
+			public void run() {
+				Dimension size = getSize();
+				Point position = getPosition();
+				completedPolygon.setAttribute(
+						SVG_POINTS_ATTRIBUTE,
+						calculatePoints(getShape(),
+								(int) (size.width * complete), size.height));
+				completedPolygon.setAttribute(SVG_TRANSFORM_ATTRIBUTE,
+						"translate(" + position.x + " " + position.y + ")");
+			}
+		});
+	}
+
+	private void updateShape(final int oldWidth, final int oldHeight) {
+		if (getShape() != null && getWidth() > 0f && getHeight() > 0f) {
+			graphController.updateSVGDocument(new Runnable() {
+				@Override
+				public void run() {
+					if (graphController.isAnimatable())
+						animate(animateShape,
+								polygon,
+								graphController.getAnimationSpeed(),
+								calculatePoints(getShape(), oldWidth, oldHeight),
+								calculatePoints(getShape(), getWidth(),
+										getHeight()));
+					else {
+						polygon.setAttribute(
+								SVG_POINTS_ATTRIBUTE,
+								calculatePoints(getShape(), getWidth(),
+										getHeight()));
+						iteration.setAttribute(SVG_TRANSFORM_ATTRIBUTE,
+								"translate(" + (getWidth() - 1.5) + " 5.5)");
+						error.setAttribute(SVG_TRANSFORM_ATTRIBUTE,
+								"translate(" + (getWidth() - 1.5) + " "
+										+ (getHeight() - 1) + ")");
+					}
+				}
+			});
+		}
+	}
+
+	@Override
+	public void setSelected(final boolean selected) {
+		delegate.setSelected(selected);
+		super.setSelected(selected);
+	}
+
+	@Override
+	public void setLineStyle(final LineStyle lineStyle) {
+		delegate.setLineStyle(lineStyle);
+		super.setLineStyle(lineStyle);
+	}
+
+	@Override
+	public void setColor(final Color color) {
+		delegate.setColor(color);
+		super.setColor(color);
+	}
+
+	@Override
+	public void setFillColor(final Color fillColor) {
+		delegate.setFillColor(fillColor);
+		super.setFillColor(fillColor);
+	}
+
+	@Override
+	public void setVisible(final boolean visible) {
+		delegate.setVisible(visible);
+		super.setVisible(visible);
+	}
+
+	@Override
+	public void setFiltered(final boolean filtered) {
+		delegate.setFiltered(filtered);
+		super.setFiltered(filtered);
+	}
+
+	@Override
+	public void setOpacity(final float opacity) {
+		delegate.setOpacity(opacity);
+		super.setOpacity(opacity);
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-graph-model/src/main/java/org/apache/taverna/workbench/models/graph/svg/SVGGraphController.java
----------------------------------------------------------------------
diff --git a/taverna-graph-model/src/main/java/org/apache/taverna/workbench/models/graph/svg/SVGGraphController.java b/taverna-graph-model/src/main/java/org/apache/taverna/workbench/models/graph/svg/SVGGraphController.java
new file mode 100644
index 0000000..7eb6453
--- /dev/null
+++ b/taverna-graph-model/src/main/java/org/apache/taverna/workbench/models/graph/svg/SVGGraphController.java
@@ -0,0 +1,552 @@
+/*******************************************************************************
+ * 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 org.apache.taverna.workbench.models.graph.svg;
+
+import static java.awt.Color.BLACK;
+import static java.awt.Color.GREEN;
+import static java.lang.Float.parseFloat;
+import static org.apache.taverna.workbench.models.graph.svg.SVGUtil.animate;
+import static org.apache.taverna.workbench.models.graph.svg.SVGUtil.calculateAngle;
+import static org.apache.taverna.workbench.models.graph.svg.SVGUtil.createAnimationElement;
+import static org.apache.taverna.workbench.models.graph.svg.SVGUtil.createSVGDocument;
+import static org.apache.taverna.workbench.models.graph.svg.SVGUtil.getDot;
+import static org.apache.taverna.workbench.models.graph.svg.SVGUtil.getHexValue;
+import static org.apache.taverna.workbench.models.graph.svg.SVGUtil.svgNS;
+import static org.apache.batik.util.SVGConstants.SVG_ANIMATE_TAG;
+import static org.apache.batik.util.SVGConstants.SVG_ELLIPSE_TAG;
+import static org.apache.batik.util.SVGConstants.SVG_FILL_ATTRIBUTE;
+import static org.apache.batik.util.SVGConstants.SVG_FONT_FAMILY_ATTRIBUTE;
+import static org.apache.batik.util.SVGConstants.SVG_FONT_SIZE_ATTRIBUTE;
+import static org.apache.batik.util.SVGConstants.SVG_G_TAG;
+import static org.apache.batik.util.SVGConstants.SVG_LINE_TAG;
+import static org.apache.batik.util.SVGConstants.SVG_PATH_TAG;
+import static org.apache.batik.util.SVGConstants.SVG_POINTS_ATTRIBUTE;
+import static org.apache.batik.util.SVGConstants.SVG_POLYGON_TAG;
+import static org.apache.batik.util.SVGConstants.SVG_RECT_TAG;
+import static org.apache.batik.util.SVGConstants.SVG_STYLE_ATTRIBUTE;
+import static org.apache.batik.util.SVGConstants.SVG_TEXT_TAG;
+import static org.apache.batik.util.SVGConstants.SVG_TRANSFORM_ATTRIBUTE;
+import static org.apache.batik.util.SVGConstants.SVG_VIEW_BOX_ATTRIBUTE;
+import static org.apache.batik.util.SVGConstants.SVG_X1_ATTRIBUTE;
+import static org.apache.batik.util.SVGConstants.SVG_X2_ATTRIBUTE;
+import static org.apache.batik.util.SVGConstants.SVG_Y1_ATTRIBUTE;
+import static org.apache.batik.util.SVGConstants.SVG_Y2_ATTRIBUTE;
+import static org.apache.batik.util.SVGConstants.SVG_Y_ATTRIBUTE;
+
+import java.awt.Color;
+import java.awt.Point;
+import java.awt.Rectangle;
+import java.io.IOException;
+import java.io.StringWriter;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Timer;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+import org.apache.taverna.ui.menu.MenuManager;
+import org.apache.taverna.workbench.configuration.colour.ColourManager;
+import org.apache.taverna.workbench.configuration.workbench.WorkbenchConfiguration;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.models.graph.DotWriter;
+import org.apache.taverna.workbench.models.graph.Graph;
+import org.apache.taverna.workbench.models.graph.Graph.Alignment;
+import org.apache.taverna.workbench.models.graph.GraphController;
+import org.apache.taverna.workbench.models.graph.GraphEdge;
+import org.apache.taverna.workbench.models.graph.GraphElement;
+import org.apache.taverna.workbench.models.graph.GraphNode;
+import org.apache.taverna.workbench.models.graph.dot.GraphLayout;
+
+import org.apache.batik.bridge.UpdateManager;
+import org.apache.batik.dom.svg.SVGOMAnimationElement;
+import org.apache.batik.dom.svg.SVGOMEllipseElement;
+import org.apache.batik.dom.svg.SVGOMGElement;
+import org.apache.batik.dom.svg.SVGOMPathElement;
+import org.apache.batik.dom.svg.SVGOMPolygonElement;
+import org.apache.batik.dom.svg.SVGOMRectElement;
+import org.apache.batik.dom.svg.SVGOMTextElement;
+import org.apache.batik.swing.JSVGCanvas;
+import org.apache.batik.swing.gvt.GVTTreeRendererAdapter;
+import org.apache.batik.swing.gvt.GVTTreeRendererEvent;
+import org.apache.log4j.Logger;
+import org.w3c.dom.Element;
+import org.w3c.dom.Text;
+import org.w3c.dom.svg.SVGDocument;
+import org.w3c.dom.svg.SVGElement;
+import org.w3c.dom.svg.SVGPoint;
+import org.w3c.dom.svg.SVGSVGElement;
+
+import org.apache.taverna.scufl2.api.core.Workflow;
+import org.apache.taverna.scufl2.api.profiles.Profile;
+
+public class SVGGraphController extends GraphController {
+	private static final Logger logger = Logger.getLogger(SVGGraphController.class);
+	@SuppressWarnings("unused")
+	private static final Timer timer = new Timer("SVG Graph controller timer", true);
+	private static final String dotErrorMessage = "Cannot draw diagram(s)\n" +
+			"\n" +
+			"Install dot as described\n" +
+			"at http://www.taverna.org.uk\n" +
+			"and specify its location\n" +
+			"in the workbench preferences";
+
+	private Map<String, List<SVGGraphEdge>> datalinkMap = new HashMap<>();
+	private final JSVGCanvas svgCanvas;
+	private SVGDocument svgDocument;
+	private GraphLayout graphLayout = new GraphLayout();
+	private EdgeLine edgeLine;
+	private UpdateManager updateManager;
+	private ExecutorService executor = Executors.newFixedThreadPool(1);
+	private boolean drawingDiagram = false;
+	private int animationSpeed;
+	private Rectangle bounds, oldBounds;
+	private SVGOMAnimationElement animateBounds;
+	private boolean dotMissing = false;
+	private final WorkbenchConfiguration workbenchConfiguration;
+
+	public SVGGraphController(Workflow dataflow, Profile profile,
+			boolean interactive, JSVGCanvas svgCanvas, EditManager editManager,
+			MenuManager menuManager, ColourManager colourManager,
+			WorkbenchConfiguration workbenchConfiguration) {
+		super(dataflow, profile, interactive, svgCanvas, editManager,
+				menuManager, colourManager);
+		this.svgCanvas = svgCanvas;
+		this.workbenchConfiguration = workbenchConfiguration;
+		installUpdateManager();
+		layoutSVGDocument(svgCanvas.getBounds());
+		svgCanvas.setDocument(getSVGDocument());
+	}
+
+	public SVGGraphController(Workflow dataflow, Profile profile,
+			boolean interactive, JSVGCanvas svgCanvas, Alignment alignment,
+			PortStyle portStyle, EditManager editManager,
+			MenuManager menuManager, ColourManager colourManager,
+			WorkbenchConfiguration workbenchConfiguration) {
+		super(dataflow, profile, interactive, svgCanvas, alignment, portStyle,
+				editManager, menuManager, colourManager);
+		this.svgCanvas = svgCanvas;
+		this.workbenchConfiguration = workbenchConfiguration;
+		installUpdateManager();
+		layoutSVGDocument(svgCanvas.getBounds());
+		svgCanvas.setDocument(getSVGDocument());
+	}
+
+	private void installUpdateManager() {
+		svgCanvas.addGVTTreeRendererListener(new GVTTreeRendererAdapter() {
+			@Override
+			public void gvtRenderingCompleted(GVTTreeRendererEvent ev) {
+				setUpdateManager(svgCanvas.getUpdateManager());
+			}
+		});
+	}
+	
+	@Override
+	public GraphEdge createGraphEdge() {
+		return new SVGGraphEdge(this);
+	}
+
+	@Override
+	public Graph createGraph() {
+		return new SVGGraph(this);
+	}
+
+	@Override
+	public GraphNode createGraphNode() {
+		return new SVGGraphNode(this);
+	}
+
+	public JSVGCanvas getSVGCanvas() {
+		return svgCanvas;
+	}
+
+	public synchronized SVGDocument getSVGDocument() {
+		if (svgDocument == null)
+			svgDocument = createSVGDocument();
+		return svgDocument;
+	}
+
+	@Override
+	public void redraw() {
+		Graph graph = generateGraph();
+		Rectangle actualBounds = layoutGraph(graph, svgCanvas.getBounds());
+		setBounds(actualBounds);
+		transformGraph(getGraph(), graph);
+	}
+
+	private void layoutSVGDocument(Rectangle bounds) {
+		animateBounds = createAnimationElement(this, SVG_ANIMATE_TAG,
+				SVG_VIEW_BOX_ATTRIBUTE, null);
+		updateManager = null;
+		datalinkMap.clear();
+
+		Graph graph = getGraph();
+		if (graph instanceof SVGGraph) {
+			SVGGraph svgGraph = (SVGGraph) graph;
+			SVGSVGElement svgElement = getSVGDocument().getRootElement();
+			SVGElement graphElement = svgGraph.getSVGElement();
+			svgElement.appendChild(graphElement);
+
+			setBounds(layoutGraph(graph, bounds));
+
+			edgeLine = EdgeLine.createAndAdd(getSVGDocument(), this);
+		}
+		drawingDiagram = true;
+	}
+
+	public Rectangle layoutGraph(Graph graph, Rectangle bounds) {
+		Rectangle actualBounds = null;
+		bounds = new Rectangle(bounds);
+		StringWriter stringWriter = new StringWriter();
+		DotWriter dotWriter = new DotWriter(stringWriter);
+		try {
+			dotWriter.writeGraph(graph);
+			String layout = getDot(stringWriter.toString(), workbenchConfiguration);
+			if (layout.isEmpty())
+				logger.warn("Invalid dot returned");
+			else
+				actualBounds = graphLayout.layoutGraph(this, graph, layout, bounds);
+		} catch (IOException e) {
+			outputMessage(dotErrorMessage);
+			setDotMissing(true);
+			logger.warn("Couldn't generate dot");
+		}
+		return actualBounds;
+	}
+
+	private void setDotMissing(boolean b) {
+		this.dotMissing = b;
+	}
+
+	public boolean isDotMissing() {
+		return dotMissing;
+	}
+
+	public void setBounds(final Rectangle bounds) {
+		oldBounds = this.bounds;
+		this.bounds = bounds;
+		updateSVGDocument(new Runnable() {
+			@Override
+			public void run() {
+				SVGSVGElement svgElement = getSVGDocument().getRootElement();
+				if (isAnimatable() && oldBounds != null) {
+					String from = "0 0 " + oldBounds.width + " "
+							+ oldBounds.height;
+					String to = "0 0 " + bounds.width + " " + bounds.height;
+					animate(animateBounds, svgElement, getAnimationSpeed(),
+							from, to);
+				} else if ((svgElement != null) && (bounds != null))
+					svgElement.setAttribute(SVG_VIEW_BOX_ATTRIBUTE,
+							"0 0 " + String.valueOf(bounds.width) + " "
+									+ String.valueOf(bounds.height));
+			}
+		});
+	}
+
+	private void outputMessage(final String message) {
+		SVGSVGElement svgElement = getSVGDocument().getRootElement();
+		String[] parts = message.split("\n");
+		int initialPosition = 200;
+		for (int i = 0; i < parts.length; i++) {
+			Text errorsText = createText(parts[i]);
+			SVGOMTextElement error = (SVGOMTextElement) createElement(SVG_TEXT_TAG);
+			error.setAttribute(SVG_Y_ATTRIBUTE,
+					Integer.toString(initialPosition + i * 60));
+			error.setAttribute(SVG_FONT_SIZE_ATTRIBUTE, "20");
+			error.setAttribute(SVG_FONT_FAMILY_ATTRIBUTE, "sans-serif");
+			error.setAttribute(SVG_FILL_ATTRIBUTE, "red");
+			error.appendChild(errorsText);
+			svgElement.appendChild(error);
+		}
+		bounds = new Rectangle(300, parts.length * 60 + 200);
+		svgCanvas.setDocument(getSVGDocument());
+	}
+
+	public void setUpdateManager(UpdateManager updateManager) {
+		this.updateManager = updateManager;
+		drawingDiagram = false;
+		resetSelection();
+	}
+
+	@Override
+	public boolean startEdgeCreation(GraphElement graphElement, Point point) {
+		boolean alreadyStarted = edgeCreationFromSource || edgeCreationFromSink;
+		boolean started = super.startEdgeCreation(graphElement, point);
+		if (!alreadyStarted && started) {
+			if (edgeMoveElement instanceof SVGGraphEdge) {
+				SVGGraphEdge svgGraphEdge = (SVGGraphEdge) edgeMoveElement;
+				SVGPoint sourcePoint = svgGraphEdge.getPathElement()
+						.getPointAtLength(0f);
+				edgeLine.setSourcePoint(new Point((int) sourcePoint.getX(),
+						(int) sourcePoint.getY()));
+			} else
+				edgeLine.setSourcePoint(point);
+			edgeLine.setTargetPoint(point);
+			edgeLine.setColour(Color.BLACK);
+			// edgeLine.setVisible(true);
+		}
+		return started;
+	}
+
+	@Override
+	public boolean moveEdgeCreationTarget(GraphElement graphElement, Point point) {
+		boolean linkValid = super.moveEdgeCreationTarget(graphElement, point);
+		if (edgeMoveElement instanceof SVGGraphEdge)
+			((SVGGraphEdge) edgeMoveElement).setVisible(false);
+		if (edgeCreationFromSink) {
+			edgeLine.setSourcePoint(point);
+			if (linkValid)
+				edgeLine.setColour(GREEN);
+			else
+				edgeLine.setColour(BLACK);
+			edgeLine.setVisible(true);
+		} else if (edgeCreationFromSource) {
+			edgeLine.setTargetPoint(point);
+			if (linkValid)
+				edgeLine.setColour(GREEN);
+			else
+				edgeLine.setColour(BLACK);
+			edgeLine.setVisible(true);
+		}
+		return linkValid;
+	}
+
+	@Override
+	public boolean stopEdgeCreation(GraphElement graphElement, Point point) {
+		GraphEdge movedEdge = edgeMoveElement;
+		boolean edgeCreated = super.stopEdgeCreation(graphElement, point);
+		if (!edgeCreated && movedEdge instanceof SVGGraphEdge)
+			((SVGGraphEdge) movedEdge).setVisible(true);
+		edgeLine.setVisible(false);
+		return edgeCreated;
+	}
+
+	@Override
+	public void setEdgeActive(String edgeId, boolean active) {
+		if (datalinkMap.containsKey(edgeId))
+			for (GraphEdge datalink : datalinkMap.get(edgeId))
+				datalink.setActive(active);
+	}
+
+	public Element createElement(String tag) {
+		return getSVGDocument().createElementNS(svgNS, tag);
+	}
+
+	SVGOMGElement createGElem() {
+		return (SVGOMGElement) createElement(SVG_G_TAG);
+	}
+
+	SVGOMPolygonElement createPolygon() {
+		return (SVGOMPolygonElement) createElement(SVG_POLYGON_TAG);
+	}
+
+	SVGOMEllipseElement createEllipse() {
+		return (SVGOMEllipseElement) createElement(SVG_ELLIPSE_TAG);
+	}
+
+	SVGOMPathElement createPath() {
+		return (SVGOMPathElement) createElement(SVG_PATH_TAG);
+	}
+
+	SVGOMRectElement createRect() {
+		return (SVGOMRectElement) createElement(SVG_RECT_TAG);
+	}
+
+	public Text createText(String text) {
+		return getSVGDocument().createTextNode(text);
+	}
+
+	SVGOMTextElement createText(Text text) {
+		SVGOMTextElement elem = (SVGOMTextElement) createElement(SVG_TEXT_TAG);
+		elem.appendChild(text);
+		return elem;
+	}
+
+	public void updateSVGDocument(final Runnable thread) {
+		if (updateManager == null && !drawingDiagram)
+			thread.run();
+		else if (!executor.isShutdown())
+			executor.execute(new Runnable() {
+				@Override
+				public void run() {
+					waitForUpdateManager();
+					try {
+						updateManager.getUpdateRunnableQueue().invokeLater(
+								thread);
+					} catch (IllegalStateException e) {
+						logger.error("Update of SVG failed", e);
+					}
+				}
+
+				private void waitForUpdateManager() {
+					try {
+						while (updateManager == null)
+							Thread.sleep(200);
+					} catch (InterruptedException e) {
+					}
+				}
+			});
+//		if (updateManager == null)
+//			thread.run();
+//		else
+//			updateManager.getUpdateRunnableQueue().invokeLater(thread);
+	}
+
+	public boolean isAnimatable() {
+		return animationSpeed > 0 && updateManager != null && !drawingDiagram;
+	}
+
+	/**
+	 * Returns the animation speed in milliseconds.
+	 *
+	 * @return the animation speed in milliseconds
+	 */
+	public int getAnimationSpeed() {
+		return animationSpeed;
+	}
+
+	/**
+	 * Sets the animation speed in milliseconds. A value of 0 turns off animation.
+	 *
+	 * @param animationSpeed the animation speed in milliseconds
+	 */
+	public void setAnimationSpeed(int animationSpeed) {
+		this.animationSpeed = animationSpeed;
+	}
+
+	@Override
+	public void shutdown() {
+		super.shutdown();
+		executor.execute(new Runnable() {
+			@Override
+			public void run() {
+				getSVGCanvas().stopProcessing();
+				executor.shutdown();
+			}
+		});
+	}
+
+}
+
+class EdgeLine {
+	private static final float arrowLength = 10f;
+	private static final float arrowWidth = 3f;
+
+	private Element line;
+	private Element pointer;
+	private SVGGraphController graphController;
+
+	private EdgeLine(SVGGraphController graphController) {
+		this.graphController = graphController;
+	}
+
+	public static EdgeLine createAndAdd(SVGDocument svgDocument, SVGGraphController graphController) {
+		EdgeLine edgeLine = new EdgeLine(graphController);
+		edgeLine.line = svgDocument.createElementNS(svgNS, SVG_LINE_TAG);
+		edgeLine.line.setAttribute(SVG_STYLE_ATTRIBUTE,
+				"fill:none;stroke:black");
+		edgeLine.line.setAttribute("pointer-events", "none");
+		edgeLine.line.setAttribute("visibility", "hidden");
+		edgeLine.line.setAttribute(SVG_X1_ATTRIBUTE, "0");
+		edgeLine.line.setAttribute(SVG_Y1_ATTRIBUTE, "0");
+		edgeLine.line.setAttribute(SVG_X2_ATTRIBUTE, "0");
+		edgeLine.line.setAttribute(SVG_Y2_ATTRIBUTE, "0");
+
+		edgeLine.pointer = svgDocument.createElementNS(svgNS, SVG_POLYGON_TAG);
+		edgeLine.pointer.setAttribute(SVG_STYLE_ATTRIBUTE,
+				"fill:black;stroke:black");
+		edgeLine.pointer.setAttribute(SVG_POINTS_ATTRIBUTE, "0,0 "
+				+ -arrowLength + "," + arrowWidth + " " + -arrowLength + ","
+				+ -arrowWidth + " 0,0");
+		edgeLine.pointer.setAttribute("pointer-events", "none");
+		edgeLine.pointer.setAttribute("visibility", "hidden");
+
+		Element svgRoot = svgDocument.getDocumentElement();
+		svgRoot.insertBefore(edgeLine.line, null);
+		svgRoot.insertBefore(edgeLine.pointer, null);
+
+		return edgeLine;
+	}
+
+	public void setSourcePoint(final Point point) {
+		graphController.updateSVGDocument(new Runnable() {
+			@Override
+			public void run() {
+				line.setAttribute(SVG_X1_ATTRIBUTE,
+						String.valueOf(point.getX()));
+				line.setAttribute(SVG_Y1_ATTRIBUTE,
+						String.valueOf(point.getY()));
+
+				float x = parseFloat(line.getAttribute(SVG_X2_ATTRIBUTE));
+				float y = parseFloat(line.getAttribute(SVG_Y2_ATTRIBUTE));
+				double angle = calculateAngle(line);
+
+				pointer.setAttribute(SVG_TRANSFORM_ATTRIBUTE, "translate(" + x
+						+ " " + y + ") rotate(" + angle + " 0 0) ");
+			}
+		});
+	}
+
+	public void setTargetPoint(final Point point) {
+		graphController.updateSVGDocument(new Runnable() {
+			@Override
+			public void run() {
+				line.setAttribute(SVG_X2_ATTRIBUTE,
+						String.valueOf(point.getX()));
+				line.setAttribute(SVG_Y2_ATTRIBUTE,
+						String.valueOf(point.getY()));
+
+				double angle = calculateAngle(line);
+				pointer.setAttribute(SVG_TRANSFORM_ATTRIBUTE, "translate("
+						+ point.x + " " + point.y + ") rotate(" + angle
+						+ " 0 0) ");
+			}
+		});
+	}
+
+	public void setColour(final Color colour) {
+		graphController.updateSVGDocument(new Runnable() {
+			@Override
+			public void run() {
+				String hexColour = getHexValue(colour);
+				line.setAttribute(SVG_STYLE_ATTRIBUTE, "fill:none;stroke:"
+						+ hexColour + ";");
+				pointer.setAttribute(SVG_STYLE_ATTRIBUTE, "fill:" + hexColour
+						+ ";stroke:" + hexColour + ";");
+			}
+		});
+	}
+
+	public void setVisible(final boolean visible) {
+		graphController.updateSVGDocument(new Runnable() {
+			@Override
+			public void run() {
+				if (visible) {
+					line.setAttribute("visibility", "visible");
+					pointer.setAttribute("visibility", "visible");
+				} else {
+					line.setAttribute("visibility", "hidden");
+					pointer.setAttribute("visibility", "hidden");
+				}
+			}
+		});
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-graph-model/src/main/java/org/apache/taverna/workbench/models/graph/svg/SVGGraphEdge.java
----------------------------------------------------------------------
diff --git a/taverna-graph-model/src/main/java/org/apache/taverna/workbench/models/graph/svg/SVGGraphEdge.java b/taverna-graph-model/src/main/java/org/apache/taverna/workbench/models/graph/svg/SVGGraphEdge.java
new file mode 100644
index 0000000..736c6e5
--- /dev/null
+++ b/taverna-graph-model/src/main/java/org/apache/taverna/workbench/models/graph/svg/SVGGraphEdge.java
@@ -0,0 +1,311 @@
+/*******************************************************************************
+ * 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 org.apache.taverna.workbench.models.graph.svg;
+
+import static org.apache.taverna.workbench.models.graph.svg.SVGGraphSettings.SELECTED_COLOUR;
+import static org.apache.taverna.workbench.models.graph.svg.SVGUtil.adjustPathLength;
+import static org.apache.taverna.workbench.models.graph.svg.SVGUtil.animate;
+import static org.apache.taverna.workbench.models.graph.svg.SVGUtil.calculateAngle;
+import static org.apache.taverna.workbench.models.graph.svg.SVGUtil.createAnimationElement;
+import static org.apache.taverna.workbench.models.graph.svg.SVGUtil.getHexValue;
+import static org.apache.batik.util.CSSConstants.CSS_BLACK_VALUE;
+import static org.apache.batik.util.CSSConstants.CSS_DISPLAY_PROPERTY;
+import static org.apache.batik.util.CSSConstants.CSS_INLINE_VALUE;
+import static org.apache.batik.util.CSSConstants.CSS_NONE_VALUE;
+import static org.apache.batik.util.SMILConstants.SMIL_ADDITIVE_ATTRIBUTE;
+import static org.apache.batik.util.SMILConstants.SMIL_SUM_VALUE;
+import static org.apache.batik.util.SVGConstants.SVG_ANIMATE_TAG;
+import static org.apache.batik.util.SVGConstants.SVG_ANIMATE_TRANSFORM_TAG;
+import static org.apache.batik.util.SVGConstants.SVG_CLICK_EVENT_TYPE;
+import static org.apache.batik.util.SVGConstants.SVG_CX_ATTRIBUTE;
+import static org.apache.batik.util.SVGConstants.SVG_CY_ATTRIBUTE;
+import static org.apache.batik.util.SVGConstants.SVG_D_ATTRIBUTE;
+import static org.apache.batik.util.SVGConstants.SVG_FILL_ATTRIBUTE;
+import static org.apache.batik.util.SVGConstants.SVG_MOUSEDOWN_EVENT_TYPE;
+import static org.apache.batik.util.SVGConstants.SVG_NONE_VALUE;
+import static org.apache.batik.util.SVGConstants.SVG_POINTS_ATTRIBUTE;
+import static org.apache.batik.util.SVGConstants.SVG_RX_ATTRIBUTE;
+import static org.apache.batik.util.SVGConstants.SVG_RY_ATTRIBUTE;
+import static org.apache.batik.util.SVGConstants.SVG_STROKE_ATTRIBUTE;
+import static org.apache.batik.util.SVGConstants.SVG_STROKE_DASHARRAY_ATTRIBUTE;
+import static org.apache.batik.util.SVGConstants.SVG_STROKE_WIDTH_ATTRIBUTE;
+import static org.apache.batik.util.SVGConstants.SVG_TRANSFORM_ATTRIBUTE;
+import static org.apache.batik.util.SVGConstants.SVG_ZERO_VALUE;
+import static org.apache.batik.util.SVGConstants.TRANSFORM_ROTATE;
+import static org.apache.batik.util.SVGConstants.TRANSFORM_TRANSLATE;
+
+import java.awt.Color;
+import java.awt.Point;
+import java.util.List;
+
+import org.apache.taverna.workbench.models.graph.GraphEdge;
+import org.apache.taverna.workbench.models.graph.svg.event.SVGMouseClickEventListener;
+import org.apache.taverna.workbench.models.graph.svg.event.SVGMouseDownEventListener;
+import org.apache.taverna.workbench.models.graph.svg.event.SVGMouseOutEventListener;
+import org.apache.taverna.workbench.models.graph.svg.event.SVGMouseOverEventListener;
+
+import org.apache.batik.dom.svg.SVGGraphicsElement;
+import org.apache.batik.dom.svg.SVGOMAnimationElement;
+import org.apache.batik.dom.svg.SVGOMEllipseElement;
+import org.apache.batik.dom.svg.SVGOMGElement;
+import org.apache.batik.dom.svg.SVGOMPathElement;
+import org.apache.batik.dom.svg.SVGOMPolygonElement;
+import org.w3c.dom.events.EventTarget;
+import org.w3c.dom.svg.SVGElement;
+
+/**
+ * SVG representation of a graph edge.
+ * 
+ * @author David Withers
+ */
+public class SVGGraphEdge extends GraphEdge {
+	private static final String ARROW_LENGTH = "8.5";
+	private static final String ARROW_WIDTH = "3";
+	private static final String ELLIPSE_RADIUS = "3.5";
+
+	private SVGGraphController graphController;
+	private SVGGraphElementDelegate delegate;
+	private SVGMouseClickEventListener mouseClickAction;
+	private SVGMouseDownEventListener mouseDownAction;
+	@SuppressWarnings("unused")
+	private SVGMouseOverEventListener mouseOverAction;
+	@SuppressWarnings("unused")
+	private SVGMouseOutEventListener mouseOutAction;
+	private SVGOMGElement mainGroup;
+	private SVGOMPathElement path, deleteButton;
+	private SVGOMPolygonElement polygon;
+	private SVGOMEllipseElement ellipse;
+	private SVGGraphicsElement arrowHead;
+	private SVGOMAnimationElement animatePath, animatePosition, animateRotation;
+
+	public SVGGraphEdge(SVGGraphController graphController) {
+		super(graphController);
+		this.graphController = graphController;
+
+		mouseClickAction = new SVGMouseClickEventListener(this);
+		mouseDownAction = new SVGMouseDownEventListener(this);
+		mouseOverAction = new SVGMouseOverEventListener(this);
+		mouseOutAction = new SVGMouseOutEventListener(this);
+
+		mainGroup = graphController.createGElem();
+		mainGroup.setAttribute(SVG_STROKE_ATTRIBUTE, CSS_BLACK_VALUE);
+		mainGroup.setAttribute(SVG_STROKE_DASHARRAY_ATTRIBUTE, CSS_NONE_VALUE);
+		mainGroup.setAttribute(SVG_STROKE_WIDTH_ATTRIBUTE, "1");
+
+		path = graphController.createPath();
+		path.setAttribute(SVG_FILL_ATTRIBUTE, SVG_NONE_VALUE);
+		EventTarget t = (EventTarget) path;
+		t.addEventListener(SVG_CLICK_EVENT_TYPE, mouseClickAction, false);
+		// t.addEventListener(SVGConstants.SVG_MOUSEOVER_EVENT_TYPE, mouseOverAction, false);
+		// t.addEventListener(SVGConstants.SVG_MOUSEOUT_EVENT_TYPE, mouseOutAction, false);
+		mainGroup.appendChild(path);
+
+		polygon = graphController.createPolygon();
+		polygon.setAttribute(SVG_POINTS_ATTRIBUTE, ARROW_LENGTH + ", 0"
+				+ " 0, -" + ARROW_WIDTH + " 0," + ARROW_WIDTH);
+		t = (EventTarget) polygon;
+		t.addEventListener(SVG_CLICK_EVENT_TYPE, mouseClickAction, false);
+		t.addEventListener(SVG_MOUSEDOWN_EVENT_TYPE, mouseDownAction, false);
+		// t.addEventListener(SVGConstants.SVG_MOUSEOVER_EVENT_TYPE, mouseOverAction, false);
+		// t.addEventListener(SVGConstants.SVG_MOUSEOUT_EVENT_TYPE, mouseOutAction, false);
+
+		ellipse = graphController.createEllipse();
+		ellipse.setAttribute(SVG_CX_ATTRIBUTE, ELLIPSE_RADIUS);
+		ellipse.setAttribute(SVG_CY_ATTRIBUTE, SVG_ZERO_VALUE);
+		ellipse.setAttribute(SVG_RX_ATTRIBUTE, ELLIPSE_RADIUS);
+		ellipse.setAttribute(SVG_RY_ATTRIBUTE, ELLIPSE_RADIUS);
+
+		arrowHead = polygon;
+		mainGroup.appendChild(arrowHead);
+
+		deleteButton = graphController.createPath();
+		deleteButton.setAttribute(SVG_STROKE_ATTRIBUTE, "red");
+		deleteButton.setAttribute(SVG_STROKE_WIDTH_ATTRIBUTE, "2");
+		deleteButton.setAttribute(SVG_D_ATTRIBUTE,
+				"M-3.5,-7L3.5,0M-3.5,0L3.5,-7");
+		deleteButton.setAttribute(CSS_DISPLAY_PROPERTY, CSS_NONE_VALUE);
+		mainGroup.appendChild(deleteButton);
+
+		animatePath = createAnimationElement(graphController, SVG_ANIMATE_TAG,
+				SVG_D_ATTRIBUTE, null);
+
+		animatePosition = createAnimationElement(graphController,
+				SVG_ANIMATE_TRANSFORM_TAG, SVG_TRANSFORM_ATTRIBUTE,
+				TRANSFORM_TRANSLATE);
+
+		animateRotation = createAnimationElement(graphController,
+				SVG_ANIMATE_TRANSFORM_TAG, SVG_TRANSFORM_ATTRIBUTE,
+				TRANSFORM_ROTATE);
+		animateRotation.setAttribute(SMIL_ADDITIVE_ATTRIBUTE, SMIL_SUM_VALUE);
+
+		delegate = new SVGGraphElementDelegate(graphController, this, mainGroup);
+	}
+
+	public SVGElement getSVGElement() {
+		return mainGroup;
+	}
+
+	/**
+	 * Returns the path.
+	 * 
+	 * @return the path
+	 */
+	public SVGOMPathElement getPathElement() {
+		return path;
+	}
+
+	@Override
+	public void setSelected(boolean selected) {
+		super.setSelected(selected);
+		final String color = selected ? SELECTED_COLOUR
+				: getHexValue(getColor());
+		graphController.updateSVGDocument(new Runnable() {
+			@Override
+			public void run() {
+				mainGroup.setAttribute(SVG_STROKE_ATTRIBUTE, color);
+				mainGroup.setAttribute(SVG_FILL_ATTRIBUTE, color);
+			}
+		});
+	}
+
+	@Override
+	public void setActive(final boolean active) {
+		super.setActive(active);
+		graphController.updateSVGDocument(new Runnable() {
+			@Override
+			public void run() {
+				if (active) {
+					path.setAttribute(SVG_STROKE_WIDTH_ATTRIBUTE, "2");
+					deleteButton.setAttribute(CSS_DISPLAY_PROPERTY,
+							CSS_INLINE_VALUE);
+				} else {
+					path.setAttribute(SVG_STROKE_WIDTH_ATTRIBUTE, "1");
+					deleteButton.setAttribute(CSS_DISPLAY_PROPERTY,
+							CSS_NONE_VALUE);
+				}
+			}
+		});
+	}
+
+	@Override
+	public void setArrowHeadStyle(final ArrowStyle arrowHeadStyle) {
+		super.setArrowHeadStyle(arrowHeadStyle);
+		graphController.updateSVGDocument(new Runnable() {
+			@Override
+			public void run() {
+				if (ArrowStyle.NONE.equals(arrowHeadStyle))
+					mainGroup.removeChild(arrowHead);
+				else if (ArrowStyle.NORMAL.equals(arrowHeadStyle)) {
+					mainGroup.removeChild(arrowHead);
+					arrowHead = polygon;
+					mainGroup.appendChild(arrowHead);
+				} else if (ArrowStyle.DOT.equals(arrowHeadStyle)) {
+					mainGroup.removeChild(arrowHead);
+					arrowHead = ellipse;
+					mainGroup.appendChild(arrowHead);
+				}
+			}
+		});
+	}
+
+	@Override
+	public void setPath(final List<Point> pointList) {
+		if (pointList == null)
+			return;
+
+		final List<Point> oldPointList = getPath();
+		super.setPath(pointList);
+		graphController.updateSVGDocument(new Runnable() {
+			@Override
+			public void run() {
+				Point lastPoint = pointList.get(pointList.size() - 1);
+				double angle = calculateAngle(pointList);
+				if (graphController.isAnimatable() && oldPointList != null) {
+					adjustPathLength(oldPointList, pointList.size());
+					Point oldLastPoint = oldPointList.get(oldPointList.size() - 1);
+					double oldAngle = calculateAngle(oldPointList);
+					animate(animatePath, path,
+							graphController.getAnimationSpeed(),
+							SVGUtil.getPath(oldPointList),
+							SVGUtil.getPath(pointList));
+
+					animate(animatePosition, polygon,
+							graphController.getAnimationSpeed(), oldLastPoint.x
+									+ ", " + oldLastPoint.y, lastPoint.x + ", "
+									+ lastPoint.y);
+
+					animate(animateRotation, polygon,
+							graphController.getAnimationSpeed(), oldAngle
+									+ " 0 0", angle + " 0 0");
+
+					ellipse.setAttribute(SVG_TRANSFORM_ATTRIBUTE, "translate("
+							+ lastPoint.x + " " + lastPoint.y + ") rotate("
+							+ angle + " 0 0) ");
+					deleteButton.setAttribute(SVG_TRANSFORM_ATTRIBUTE,
+							"translate(" + lastPoint.x + " " + lastPoint.y
+									+ ")");
+				} else {
+					path.setAttribute(SVG_D_ATTRIBUTE,
+							SVGUtil.getPath(pointList));
+					polygon.setAttribute(SVG_TRANSFORM_ATTRIBUTE, "translate("
+							+ lastPoint.x + " " + lastPoint.y + ") rotate("
+							+ angle + " 0 0) ");
+					ellipse.setAttribute(SVG_TRANSFORM_ATTRIBUTE, "translate("
+							+ lastPoint.x + " " + lastPoint.y + ") rotate("
+							+ angle + " 0 0) ");
+					deleteButton.setAttribute(SVG_TRANSFORM_ATTRIBUTE,
+							"translate(" + lastPoint.x + " " + lastPoint.y
+									+ ")");
+				}
+			}
+		});
+	}
+
+	@Override
+	public void setColor(final Color color) {
+		delegate.setColor(color);
+		super.setColor(color);
+	}
+
+	@Override
+	public void setFillColor(final Color fillColor) {
+		delegate.setFillColor(fillColor);
+		super.setFillColor(fillColor);
+	}
+
+	@Override
+	public void setVisible(final boolean visible) {
+		delegate.setVisible(visible);
+		super.setVisible(visible);
+	}
+
+	@Override
+	public void setFiltered(final boolean filtered) {
+		delegate.setFiltered(filtered);
+		super.setFiltered(filtered);
+	}
+
+	@Override
+	public void setOpacity(final float opacity) {
+		delegate.setOpacity(opacity);
+		super.setOpacity(opacity);
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-graph-model/src/main/java/org/apache/taverna/workbench/models/graph/svg/SVGGraphElementDelegate.java
----------------------------------------------------------------------
diff --git a/taverna-graph-model/src/main/java/org/apache/taverna/workbench/models/graph/svg/SVGGraphElementDelegate.java b/taverna-graph-model/src/main/java/org/apache/taverna/workbench/models/graph/svg/SVGGraphElementDelegate.java
new file mode 100644
index 0000000..aaea6d1
--- /dev/null
+++ b/taverna-graph-model/src/main/java/org/apache/taverna/workbench/models/graph/svg/SVGGraphElementDelegate.java
@@ -0,0 +1,178 @@
+/*******************************************************************************
+ * Copyright (C) 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 org.apache.taverna.workbench.models.graph.svg;
+
+import static org.apache.taverna.workbench.models.graph.GraphElement.LineStyle.NONE;
+import static org.apache.taverna.workbench.models.graph.svg.SVGGraphSettings.SELECTED_COLOUR;
+import static org.apache.taverna.workbench.models.graph.svg.SVGUtil.animate;
+import static org.apache.taverna.workbench.models.graph.svg.SVGUtil.createAnimationElement;
+import static org.apache.taverna.workbench.models.graph.svg.SVGUtil.getHexValue;
+import static org.apache.batik.util.CSSConstants.CSS_DISPLAY_PROPERTY;
+import static org.apache.batik.util.CSSConstants.CSS_INLINE_VALUE;
+import static org.apache.batik.util.CSSConstants.CSS_NONE_VALUE;
+import static org.apache.batik.util.CSSConstants.CSS_OPACITY_PROPERTY;
+import static org.apache.batik.util.CSSConstants.CSS_POINTER_EVENTS_PROPERTY;
+import static org.apache.batik.util.CSSConstants.CSS_VISIBLEPAINTED_VALUE;
+import static org.apache.batik.util.SVGConstants.SVG_ANIMATE_TAG;
+import static org.apache.batik.util.SVGConstants.SVG_FILL_ATTRIBUTE;
+import static org.apache.batik.util.SVGConstants.SVG_NONE_VALUE;
+import static org.apache.batik.util.SVGConstants.SVG_STROKE_ATTRIBUTE;
+import static org.apache.batik.util.SVGConstants.SVG_STROKE_DASHARRAY_ATTRIBUTE;
+import static org.apache.batik.util.SVGConstants.SVG_STROKE_WIDTH_ATTRIBUTE;
+
+import java.awt.Color;
+
+import org.apache.taverna.workbench.models.graph.GraphElement;
+import org.apache.taverna.workbench.models.graph.GraphElement.LineStyle;
+
+import org.apache.batik.dom.svg.SVGOMAnimationElement;
+import org.apache.batik.dom.svg.SVGOMElement;
+
+/**
+ * Delegate for GraphElements. Logically a superclass of SVGGraph, SVGGraphNode
+ * and SVGGraphEdge (if java had multiple inheritance).
+ * 
+ * @author David Withers
+ */
+public class SVGGraphElementDelegate {
+	private SVGGraphController graphController;
+	private GraphElement graphElement;
+	private SVGOMElement mainGroup;
+	private SVGOMAnimationElement animateOpacity;
+
+	public SVGGraphElementDelegate(SVGGraphController graphController,
+			GraphElement graphElement, SVGOMElement mainGroup) {
+		this.graphController = graphController;
+		this.graphElement = graphElement;
+		this.mainGroup = mainGroup;
+
+		animateOpacity = createAnimationElement(graphController,
+				SVG_ANIMATE_TAG, CSS_OPACITY_PROPERTY, null);
+	}
+
+	public void setSelected(final boolean selected) {
+		boolean currentSelected = graphElement.isSelected();
+		if (currentSelected != selected
+				&& !LineStyle.NONE.equals(graphElement.getLineStyle()))
+			graphController.updateSVGDocument(new Runnable() {
+				@Override
+				public void run() {
+					mainGroup.setAttribute(SVG_STROKE_ATTRIBUTE,
+							selected ? SELECTED_COLOUR
+									: getHexValue(graphElement.getColor()));
+					mainGroup.setAttribute(SVG_STROKE_WIDTH_ATTRIBUTE,
+							selected ? "2" : "1");
+				}
+			});
+	}
+
+	public void setLineStyle(final LineStyle lineStyle) {
+		LineStyle currentLineStyle = graphElement.getLineStyle();
+		if (!currentLineStyle.equals(lineStyle))
+			graphController.updateSVGDocument(new Runnable() {
+				@Override
+				public void run() {
+					String stroke = SVG_NONE_VALUE, dash = SVG_NONE_VALUE;
+					switch (lineStyle) {
+					case DOTTED:
+						stroke = getHexValue(graphElement.getColor());
+						dash = "1,5";
+						break;
+					case SOLID:
+						stroke = getHexValue(graphElement.getColor());
+					default:
+						break;
+					}
+					mainGroup.setAttribute(SVG_STROKE_ATTRIBUTE, stroke);
+					mainGroup
+							.setAttribute(SVG_STROKE_DASHARRAY_ATTRIBUTE, dash);
+				}
+			});
+	}
+
+	public void setColor(final Color color) {
+		Color currentColor = graphElement.getColor();
+		if (currentColor != color && NONE != graphElement.getLineStyle())
+			graphController.updateSVGDocument(new Runnable() {
+				@Override
+				public void run() {
+					mainGroup.setAttribute(SVG_STROKE_ATTRIBUTE,
+							getHexValue(color));
+				}
+			});
+	}
+
+	public void setFillColor(final Color fillColor) {
+		Color currentFillColor = graphElement.getFillColor();
+		if (currentFillColor != fillColor)
+			graphController.updateSVGDocument(new Runnable() {
+				@Override
+				public void run() {
+					mainGroup.setAttribute(SVG_FILL_ATTRIBUTE,
+							getHexValue(fillColor));
+				}
+			});
+	}
+
+	public void setVisible(final boolean visible) {
+		boolean currentVisible = graphElement.isVisible();
+		if (currentVisible != visible)
+			graphController.updateSVGDocument(new Runnable() {
+				@Override
+				public void run() {
+					mainGroup.setAttribute(CSS_DISPLAY_PROPERTY,
+							visible ? CSS_INLINE_VALUE : CSS_NONE_VALUE);
+				}
+			});
+	}
+
+	public void setOpacity(final float opacity) {
+		final float currentOpacity = graphElement.getOpacity();
+		if (currentOpacity != opacity)
+			graphController.updateSVGDocument(new Runnable() {
+				@Override
+				public void run() {
+					if (graphController.isAnimatable())
+						animate(animateOpacity, mainGroup,
+								graphController.getAnimationSpeed(),
+								String.valueOf(currentOpacity),
+								String.valueOf(opacity));
+					else
+						mainGroup.setAttribute(CSS_OPACITY_PROPERTY,
+								String.valueOf(opacity));
+				}
+			});
+	}
+
+	public void setFiltered(final boolean filtered) {
+		boolean currentFiltered = graphElement.isFiltered();
+		if (currentFiltered != filtered)
+			graphController.updateSVGDocument(new Runnable() {
+				@Override
+				public void run() {
+					mainGroup.setAttribute(CSS_POINTER_EVENTS_PROPERTY,
+							filtered ? CSS_NONE_VALUE
+									: CSS_VISIBLEPAINTED_VALUE);
+					setOpacity(filtered ? 0.2f : 1f);
+				}
+			});
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-graph-model/src/main/java/org/apache/taverna/workbench/models/graph/svg/SVGGraphNode.java
----------------------------------------------------------------------
diff --git a/taverna-graph-model/src/main/java/org/apache/taverna/workbench/models/graph/svg/SVGGraphNode.java b/taverna-graph-model/src/main/java/org/apache/taverna/workbench/models/graph/svg/SVGGraphNode.java
new file mode 100644
index 0000000..49ee0e1
--- /dev/null
+++ b/taverna-graph-model/src/main/java/org/apache/taverna/workbench/models/graph/svg/SVGGraphNode.java
@@ -0,0 +1,611 @@
+/*******************************************************************************
+ * 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 org.apache.taverna.workbench.models.graph.svg;
+
+import static org.apache.taverna.workbench.models.graph.svg.SVGGraphSettings.COMPLETED_COLOUR;
+import static org.apache.taverna.workbench.models.graph.svg.SVGGraphSettings.ERROR_COLOUR;
+import static org.apache.taverna.workbench.models.graph.svg.SVGUtil.animate;
+import static org.apache.taverna.workbench.models.graph.svg.SVGUtil.calculatePoints;
+import static org.apache.taverna.workbench.models.graph.svg.SVGUtil.createAnimationElement;
+import static org.apache.batik.util.CSSConstants.CSS_ALL_VALUE;
+import static org.apache.batik.util.CSSConstants.CSS_BLACK_VALUE;
+import static org.apache.batik.util.CSSConstants.CSS_DISPLAY_PROPERTY;
+import static org.apache.batik.util.CSSConstants.CSS_HIDDEN_VALUE;
+import static org.apache.batik.util.CSSConstants.CSS_INLINE_VALUE;
+import static org.apache.batik.util.CSSConstants.CSS_NONE_VALUE;
+import static org.apache.batik.util.CSSConstants.CSS_POINTER_EVENTS_PROPERTY;
+import static org.apache.batik.util.CSSConstants.CSS_VISIBILITY_PROPERTY;
+import static org.apache.batik.util.CSSConstants.CSS_VISIBLE_VALUE;
+import static org.apache.batik.util.SVGConstants.SVG_ANIMATE_TAG;
+import static org.apache.batik.util.SVGConstants.SVG_ANIMATE_TRANSFORM_TAG;
+import static org.apache.batik.util.SVGConstants.SVG_CLICK_EVENT_TYPE;
+import static org.apache.batik.util.SVGConstants.SVG_CX_ATTRIBUTE;
+import static org.apache.batik.util.SVGConstants.SVG_CY_ATTRIBUTE;
+import static org.apache.batik.util.SVGConstants.SVG_D_ATTRIBUTE;
+import static org.apache.batik.util.SVGConstants.SVG_END_VALUE;
+import static org.apache.batik.util.SVGConstants.SVG_FILL_ATTRIBUTE;
+import static org.apache.batik.util.SVGConstants.SVG_FILL_OPACITY_ATTRIBUTE;
+import static org.apache.batik.util.SVGConstants.SVG_FONT_FAMILY_ATTRIBUTE;
+import static org.apache.batik.util.SVGConstants.SVG_FONT_SIZE_ATTRIBUTE;
+import static org.apache.batik.util.SVGConstants.SVG_HEIGHT_ATTRIBUTE;
+import static org.apache.batik.util.SVGConstants.SVG_MIDDLE_VALUE;
+import static org.apache.batik.util.SVGConstants.SVG_MOUSEDOWN_EVENT_TYPE;
+import static org.apache.batik.util.SVGConstants.SVG_MOUSEMOVE_EVENT_TYPE;
+import static org.apache.batik.util.SVGConstants.SVG_MOUSEOUT_EVENT_TYPE;
+import static org.apache.batik.util.SVGConstants.SVG_MOUSEOVER_EVENT_TYPE;
+import static org.apache.batik.util.SVGConstants.SVG_NONE_VALUE;
+import static org.apache.batik.util.SVGConstants.SVG_POINTS_ATTRIBUTE;
+import static org.apache.batik.util.SVGConstants.SVG_RX_ATTRIBUTE;
+import static org.apache.batik.util.SVGConstants.SVG_RY_ATTRIBUTE;
+import static org.apache.batik.util.SVGConstants.SVG_STROKE_ATTRIBUTE;
+import static org.apache.batik.util.SVGConstants.SVG_STROKE_DASHARRAY_ATTRIBUTE;
+import static org.apache.batik.util.SVGConstants.SVG_STROKE_WIDTH_ATTRIBUTE;
+import static org.apache.batik.util.SVGConstants.SVG_TEXT_ANCHOR_ATTRIBUTE;
+import static org.apache.batik.util.SVGConstants.SVG_TRANSFORM_ATTRIBUTE;
+import static org.apache.batik.util.SVGConstants.SVG_WIDTH_ATTRIBUTE;
+import static org.apache.batik.util.SVGConstants.SVG_X_ATTRIBUTE;
+import static org.apache.batik.util.SVGConstants.SVG_Y_ATTRIBUTE;
+import static org.apache.batik.util.SVGConstants.TRANSFORM_TRANSLATE;
+
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Point;
+
+import org.apache.taverna.workbench.models.graph.Graph;
+import org.apache.taverna.workbench.models.graph.GraphNode;
+import org.apache.taverna.workbench.models.graph.svg.event.SVGMouseClickEventListener;
+import org.apache.taverna.workbench.models.graph.svg.event.SVGMouseDownEventListener;
+import org.apache.taverna.workbench.models.graph.svg.event.SVGMouseMovedEventListener;
+import org.apache.taverna.workbench.models.graph.svg.event.SVGMouseOutEventListener;
+import org.apache.taverna.workbench.models.graph.svg.event.SVGMouseOverEventListener;
+
+import org.apache.batik.dom.svg.SVGOMAnimationElement;
+import org.apache.batik.dom.svg.SVGOMEllipseElement;
+import org.apache.batik.dom.svg.SVGOMGElement;
+import org.apache.batik.dom.svg.SVGOMPathElement;
+import org.apache.batik.dom.svg.SVGOMPolygonElement;
+import org.apache.batik.dom.svg.SVGOMRectElement;
+import org.apache.batik.dom.svg.SVGOMTextElement;
+import org.apache.batik.util.CSSConstants;
+import org.apache.batik.util.SVGConstants;
+import org.w3c.dom.Text;
+import org.w3c.dom.events.Event;
+import org.w3c.dom.events.EventListener;
+import org.w3c.dom.events.EventTarget;
+import org.w3c.dom.svg.SVGElement;
+
+/**
+ * SVG representation of a graph node.
+ * 
+ * @author David Withers
+ */
+public class SVGGraphNode extends GraphNode {
+	private SVGGraphController graphController;
+	private SVGGraphElementDelegate delegate;
+	private SVGMouseClickEventListener mouseClickAction;
+	private SVGMouseMovedEventListener mouseMovedAction;
+	private SVGMouseDownEventListener mouseDownAction;
+	@SuppressWarnings("unused")
+	private SVGMouseOverEventListener mouseOverAction;
+	@SuppressWarnings("unused")
+	private SVGMouseOutEventListener mouseOutAction;
+	private SVGOMGElement mainGroup, labelGroup, portsGroup;
+	private SVGElement expandedElement, contractedElement;
+	private SVGOMPolygonElement polygon, completedPolygon;
+	private SVGOMEllipseElement ellipse;
+	private SVGOMTextElement label, iteration, error;
+	private Text labelText, iterationText, errorsText;
+	private SVGElement deleteButton;
+	private SVGOMAnimationElement animateShape, animatePosition, animateLabel, animateIteration,
+			animateErrors;
+
+	public SVGGraphNode(SVGGraphController graphController) {
+		super(graphController);
+		this.graphController = graphController;
+		mouseClickAction = new SVGMouseClickEventListener(this);
+		mouseDownAction = new SVGMouseDownEventListener(this);
+		mouseMovedAction = new SVGMouseMovedEventListener(this);
+		mouseOverAction = new SVGMouseOverEventListener(this);
+		mouseOutAction = new SVGMouseOutEventListener(this);
+
+		mainGroup = graphController.createGElem();
+		mainGroup.setAttribute("alignment-baseline", SVG_MIDDLE_VALUE);
+		mainGroup.setAttribute(SVG_STROKE_ATTRIBUTE, CSS_BLACK_VALUE);
+		mainGroup.setAttribute(SVG_STROKE_DASHARRAY_ATTRIBUTE, CSS_NONE_VALUE);
+		mainGroup.setAttribute(SVG_STROKE_WIDTH_ATTRIBUTE, "1");
+		mainGroup.setAttribute(SVG_FILL_ATTRIBUTE, CSS_NONE_VALUE);
+
+		EventTarget t = (EventTarget) mainGroup;
+		t.addEventListener(SVG_CLICK_EVENT_TYPE, mouseClickAction, false);
+		t.addEventListener(SVG_MOUSEMOVE_EVENT_TYPE, mouseMovedAction, false);
+		t.addEventListener(SVG_MOUSEDOWN_EVENT_TYPE, mouseDownAction, false);
+//		t.addEventListener(SVGConstants.SVG_MOUSEOVER_EVENT_TYPE, mouseOverAction, false);
+//		t.addEventListener(SVGConstants.SVG_MOUSEOUT_EVENT_TYPE, mouseOutAction, false);
+
+		expandedElement = graphController.createGElem();
+		contractedElement = graphController.createGElem();
+
+		portsGroup = graphController.createGElem();
+		portsGroup.setAttribute(CSS_DISPLAY_PROPERTY, CSS_NONE_VALUE);
+		contractedElement.appendChild(portsGroup);
+
+		mainGroup.appendChild(contractedElement);
+
+		polygon = graphController.createPolygon();
+		contractedElement.appendChild(polygon);
+
+		ellipse = graphController.createEllipse();
+		ellipse.setAttribute(CSS_DISPLAY_PROPERTY, CSS_NONE_VALUE);
+		ellipse.setAttribute(SVG_RX_ATTRIBUTE, String.valueOf(2));
+		ellipse.setAttribute(SVG_CX_ATTRIBUTE, String.valueOf(0));
+		ellipse.setAttribute(SVG_RY_ATTRIBUTE, String.valueOf(2));
+		ellipse.setAttribute(SVG_CY_ATTRIBUTE, String.valueOf(0));
+		contractedElement.appendChild(ellipse);
+
+		completedPolygon = graphController.createPolygon();
+		completedPolygon.setAttribute(SVG_POINTS_ATTRIBUTE,
+				calculatePoints(getShape(), 0, 0));
+		completedPolygon.setAttribute(SVG_FILL_ATTRIBUTE, COMPLETED_COLOUR);
+		completedPolygon.setAttribute(SVG_FILL_OPACITY_ATTRIBUTE, "0.8");
+		contractedElement.appendChild(completedPolygon);
+
+		labelText = graphController.createText("");
+		label = graphController.createText(labelText);
+		label.setAttribute(SVG_TEXT_ANCHOR_ATTRIBUTE, SVG_MIDDLE_VALUE);
+		label.setAttribute("baseline-shift", "-35%");
+		label.setAttribute(SVG_FILL_ATTRIBUTE, CSS_BLACK_VALUE);
+		label.setAttribute(SVG_STROKE_ATTRIBUTE, SVGConstants.SVG_NONE_VALUE);
+		labelGroup = graphController.createGElem();
+		labelGroup.appendChild(label);
+		contractedElement.appendChild(labelGroup);
+
+		iterationText = graphController.createText("");
+		iteration = graphController.createText(iterationText);
+		iteration.setAttribute(SVG_TEXT_ANCHOR_ATTRIBUTE, SVG_END_VALUE);
+		iteration.setAttribute(SVG_FONT_SIZE_ATTRIBUTE, "6");
+		iteration.setAttribute(SVG_FONT_FAMILY_ATTRIBUTE, "sans-serif");
+		iteration.setAttribute(SVG_FILL_ATTRIBUTE, CSS_BLACK_VALUE);
+		iteration.setAttribute(SVG_STROKE_ATTRIBUTE, SVG_NONE_VALUE);
+		contractedElement.appendChild(iteration);
+
+		errorsText = graphController.createText("");
+		error = graphController.createText(errorsText);
+		error.setAttribute(SVG_TEXT_ANCHOR_ATTRIBUTE, SVG_END_VALUE);
+		error.setAttribute(SVG_FONT_SIZE_ATTRIBUTE, "6");
+		error.setAttribute(SVG_FONT_FAMILY_ATTRIBUTE, "sans-serif");
+		error.setAttribute(SVG_FILL_ATTRIBUTE, CSSConstants.CSS_BLACK_VALUE);
+		error.setAttribute(SVG_STROKE_ATTRIBUTE, SVG_NONE_VALUE);
+		contractedElement.appendChild(error);
+
+		// deleteButton = createDeleteButton();
+		// g.appendChild(deleteButton);
+
+		animateShape = createAnimationElement(graphController, SVG_ANIMATE_TAG,
+				SVG_POINTS_ATTRIBUTE, null);
+
+		animatePosition = createAnimationElement(graphController,
+				SVG_ANIMATE_TRANSFORM_TAG, SVG_TRANSFORM_ATTRIBUTE,
+				TRANSFORM_TRANSLATE);
+
+		animateLabel = SVGUtil.createAnimationElement(graphController,
+				SVG_ANIMATE_TRANSFORM_TAG, SVG_TRANSFORM_ATTRIBUTE,
+				TRANSFORM_TRANSLATE);
+
+		animateIteration = createAnimationElement(graphController,
+				SVG_ANIMATE_TRANSFORM_TAG, SVG_TRANSFORM_ATTRIBUTE,
+				TRANSFORM_TRANSLATE);
+
+		animateErrors = createAnimationElement(graphController,
+				SVG_ANIMATE_TRANSFORM_TAG, SVG_TRANSFORM_ATTRIBUTE,
+				TRANSFORM_TRANSLATE);
+
+		delegate = new SVGGraphElementDelegate(graphController, this, mainGroup);
+	}
+
+	@SuppressWarnings("unused")
+	private SVGElement createDeleteButton() {
+		final SVGOMGElement button = graphController.createGElem();
+		button.setAttribute(CSS_VISIBILITY_PROPERTY, CSS_HIDDEN_VALUE);
+		button.setAttribute(CSS_POINTER_EVENTS_PROPERTY, CSS_ALL_VALUE);
+
+		SVGOMRectElement rect = graphController.createRect();
+		rect.setAttribute(SVG_X_ATTRIBUTE, "4");
+		rect.setAttribute(SVG_Y_ATTRIBUTE, "4");
+		rect.setAttribute(SVG_WIDTH_ATTRIBUTE, "13");
+		rect.setAttribute(SVG_HEIGHT_ATTRIBUTE, "13");
+		rect.setAttribute(SVG_FILL_ATTRIBUTE, "none");
+		button.appendChild(rect);
+
+		final SVGOMPathElement path = graphController.createPath();
+		path.setAttribute(SVG_STROKE_ATTRIBUTE, "white");
+		path.setAttribute(SVG_STROKE_WIDTH_ATTRIBUTE, "2");
+		path.setAttribute(SVG_D_ATTRIBUTE, "M5,5L12,12M5,12L12,5");
+		button.appendChild(path);
+
+		EventTarget t = (EventTarget) button;
+		t.addEventListener(SVG_MOUSEOVER_EVENT_TYPE, new EventListener() {
+			@Override
+			public void handleEvent(Event evt) {
+				if (isInteractive()) {
+					deleteButton.setAttribute(CSS_VISIBILITY_PROPERTY,
+							CSS_VISIBLE_VALUE);
+					path.setAttribute(SVG_STROKE_ATTRIBUTE, "red");
+					evt.stopPropagation();
+				}
+			}
+		}, false);
+		t.addEventListener(SVG_MOUSEOUT_EVENT_TYPE, new EventListener() {
+			@Override
+			public void handleEvent(Event evt) {
+				if (isInteractive()) {
+					path.setAttribute(SVG_STROKE_ATTRIBUTE, "white");
+					evt.stopPropagation();
+				}
+			}
+		}, false);
+
+		return button;
+	}
+
+	public SVGElement getSVGElement() {
+		return mainGroup;
+	}
+
+	@Override
+	public void setActive(final boolean active) {
+		super.setActive(active);
+		if (isInteractive())
+			graphController.updateSVGDocument(new Runnable() {
+				@Override
+				public void run() {
+					if (active) {
+						deleteButton.setAttribute(CSS_VISIBILITY_PROPERTY,
+								CSS_VISIBLE_VALUE);
+						// deleteButton.setAttribute(CSSConstants.CSS_DISPLAY_PROPERTY,
+						// CSSConstants.CSS_INLINE_VALUE);
+					} else {
+						deleteButton.setAttribute(CSS_VISIBILITY_PROPERTY,
+								CSS_HIDDEN_VALUE);
+						// button.setAttribute(CSSConstants.CSS_DISPLAY_PROPERTY,
+						// CSSConstants.CSS_NONE_VALUE);
+					}
+				}
+			});
+	}
+
+	@Override
+	public void setGraph(Graph graph) {
+		super.setGraph(graph);
+		if (graph instanceof SVGGraph) {
+			SVGGraph svgGraph = (SVGGraph) graph;
+			final SVGElement graphElement = svgGraph.getSVGElement();
+			if (isExpanded())
+				graphController.updateSVGDocument(new Runnable() {
+					@Override
+					public void run() {
+						mainGroup.replaceChild(expandedElement, graphElement);
+					}
+				});
+			expandedElement = graphElement;
+		}
+	}
+
+	@Override
+	public void setExpanded(final boolean expanded) {
+		if (isExpanded() != expanded)
+			graphController.updateSVGDocument(new Runnable() {
+				@Override
+				public void run() {
+					if (expanded)
+						mainGroup.replaceChild(expandedElement, contractedElement);
+					else
+						mainGroup.replaceChild(contractedElement, expandedElement);
+				}
+			});
+		super.setExpanded(expanded);
+	}
+
+	@Override
+	public void addSourceNode(final GraphNode sourceNode) {
+		super.addSourceNode(sourceNode);
+		if (sourceNode instanceof SVGGraphNode)
+			graphController.updateSVGDocument(new Runnable() {
+				@Override
+				public void run() {
+					SVGGraphNode svgGraphNode = (SVGGraphNode) sourceNode;
+					portsGroup.appendChild(svgGraphNode.getSVGElement());
+				}
+			});
+	}
+
+	@Override
+	public boolean removeSourceNode(final GraphNode sourceNode) {
+		if (sourceNode instanceof SVGGraphNode)
+			graphController.updateSVGDocument(new Runnable() {
+				@Override
+				public void run() {
+					SVGGraphNode svgGraphNode = (SVGGraphNode) sourceNode;
+					portsGroup.removeChild(svgGraphNode.getSVGElement());
+				}
+			});
+		return super.removeSourceNode(sourceNode);
+	}
+
+	@Override
+	public void addSinkNode(final GraphNode sinkNode) {
+		super.addSinkNode(sinkNode);
+		if (sinkNode instanceof SVGGraphNode)
+			graphController.updateSVGDocument(new Runnable() {
+				@Override
+				public void run() {
+					SVGGraphNode svgGraphNode = (SVGGraphNode) sinkNode;
+					portsGroup.appendChild(svgGraphNode.getSVGElement());
+				}
+			});
+	}
+
+	@Override
+	public boolean removeSinkNode(final GraphNode sinkNode) {
+		if (sinkNode instanceof SVGGraphNode)
+			graphController.updateSVGDocument(new Runnable() {
+				@Override
+				public void run() {
+					SVGGraphNode svgGraphNode = (SVGGraphNode) sinkNode;
+					portsGroup.removeChild(svgGraphNode.getSVGElement());
+				}
+			});
+		return super.removeSinkNode(sinkNode);
+	}
+
+	@Override
+	public void setPosition(final Point position) {
+		final Point oldPosition = getPosition();
+		if (position != null && !position.equals(oldPosition)) {
+			super.setPosition(position);
+			graphController.updateSVGDocument(new Runnable() {
+				@Override
+				public void run() {
+					if (graphController.isAnimatable())
+						animate(animatePosition, mainGroup,
+								graphController.getAnimationSpeed(),
+								oldPosition.x + ", " + oldPosition.y,
+								position.x + ", " + position.y);
+					else
+						mainGroup.setAttribute(SVG_TRANSFORM_ATTRIBUTE,
+								"translate(" + position.x + " " + position.y
+										+ ")");
+				}
+			});
+		}
+	}
+
+	@Override
+	public void setSize(final Dimension size) {
+		final Dimension oldSize = getSize();
+		if (size != null && !size.equals(oldSize)) {
+			super.setSize(size);
+			graphController.updateSVGDocument(new Runnable() {
+				@Override
+				public void run() {
+					adjustSize(size, oldSize);
+				}
+			});
+		}
+	}
+
+	/** core of implementation of {@link #setSize(Dimension)} */
+	private void adjustSize(Dimension size, Dimension oldSize) {
+		int oldWidth = oldSize.width;
+		int oldHeight = oldSize.height;
+		if (graphController.isAnimatable()) {
+			if (Shape.CIRCLE.equals(getShape())) {
+				ellipse.setAttribute(SVG_RX_ATTRIBUTE,
+						String.valueOf(size.width / 2f));
+				ellipse.setAttribute(SVG_CX_ATTRIBUTE,
+						String.valueOf(size.width / 2f));
+				ellipse.setAttribute(SVG_RY_ATTRIBUTE,
+						String.valueOf(size.height / 2f));
+				ellipse.setAttribute(SVG_CY_ATTRIBUTE,
+						String.valueOf(size.height / 2f));
+			} else
+				animate(animateShape, polygon,
+						graphController.getAnimationSpeed(),
+						calculatePoints(getShape(), oldWidth, oldHeight),
+						calculatePoints(getShape(), getWidth(), getHeight()));
+
+			if (getLabel() != null && !getLabel().isEmpty())
+				animate(animateLabel, labelGroup,
+						graphController.getAnimationSpeed(), (oldWidth / 2f)
+								+ ", " + (oldHeight / 2f), (getWidth() / 2f)
+								+ ", " + (getHeight() / 2f));
+			else
+				labelGroup.setAttribute(SVG_TRANSFORM_ATTRIBUTE,
+						"translate(" + getWidth() / 2f + " " + getHeight() / 2f + ")");
+
+			if (getIteration() > 0)
+				animate(animateIteration, iteration,
+						graphController.getAnimationSpeed(), (oldWidth - 1.5)
+								+ ", 5.5", (getWidth() - 1.5) + ", 5.5");
+			else
+				iteration.setAttribute(SVG_TRANSFORM_ATTRIBUTE, "translate("
+						+ (getWidth() - 1.5) + " 5.5)");
+
+			if (getErrors() > 0)
+				animate(animateErrors, error,
+						graphController.getAnimationSpeed(), (oldWidth - 1.5)
+								+ ", " + (oldHeight - 1), (getWidth() - 1.5)
+								+ ", " + (getHeight() - 1));
+			else
+				error.setAttribute(SVG_TRANSFORM_ATTRIBUTE, "translate("
+						+ (getWidth() - 1.5) + " " + (getHeight() - 1) + ")");
+		} else {
+			if (Shape.CIRCLE.equals(getShape())) {
+				ellipse.setAttribute(SVG_RX_ATTRIBUTE,
+						String.valueOf(size.width / 2f));
+				ellipse.setAttribute(SVG_CX_ATTRIBUTE,
+						String.valueOf(size.width / 2f));
+				ellipse.setAttribute(SVG_RY_ATTRIBUTE,
+						String.valueOf(size.height / 2f));
+				ellipse.setAttribute(SVG_CY_ATTRIBUTE,
+						String.valueOf(size.height / 2f));
+			} else
+				polygon.setAttribute(SVG_POINTS_ATTRIBUTE,
+						calculatePoints(getShape(), getWidth(), getHeight()));
+
+			labelGroup.setAttribute(SVG_TRANSFORM_ATTRIBUTE, "translate("
+					+ getWidth() / 2f + " " + getHeight() / 2f + ")");
+			iteration.setAttribute(SVG_TRANSFORM_ATTRIBUTE, "translate("
+					+ (getWidth() - 1.5) + " 5.5)");
+			error.setAttribute(SVG_TRANSFORM_ATTRIBUTE, "translate("
+					+ (getWidth() - 1.5) + " " + (getHeight() - 1) + ")");
+		}
+	}
+
+	@Override
+	public void setShape(final Shape shape) {
+		final Shape currentShape = getShape();
+		if (shape != null && !shape.equals(currentShape)) {
+			super.setShape(shape);
+			graphController.updateSVGDocument(new Runnable() {
+				@Override
+				public void run() {
+					if (Shape.CIRCLE.equals(shape)) {
+						ellipse.setAttribute(CSS_DISPLAY_PROPERTY,
+								CSS_INLINE_VALUE);
+						polygon.setAttribute(CSS_DISPLAY_PROPERTY,
+								CSS_NONE_VALUE);
+					} else if (Shape.CIRCLE.equals(currentShape)) {
+						ellipse.setAttribute(CSS_DISPLAY_PROPERTY,
+								CSS_NONE_VALUE);
+						polygon.setAttribute(CSS_DISPLAY_PROPERTY,
+								CSS_INLINE_VALUE);
+					}
+					if (Shape.RECORD.equals(shape))
+						portsGroup.setAttribute(CSS_DISPLAY_PROPERTY,
+								CSS_INLINE_VALUE);
+					else if (Shape.RECORD.equals(currentShape))
+						portsGroup.setAttribute(CSS_DISPLAY_PROPERTY,
+								CSS_NONE_VALUE);
+				}
+			});
+		}
+	}
+
+	@Override
+	public void setLabel(final String label) {
+		super.setLabel(label);
+		graphController.updateSVGDocument(new Runnable() {
+			@Override
+			public void run() {
+				labelText.setData(label);
+			}
+		});
+	}
+
+	@Override
+	public void setIteration(final int iteration) {
+		super.setIteration(iteration);
+		graphController.updateSVGDocument(new Runnable() {
+			@Override
+			public void run() {
+				if (iteration > 0)
+					iterationText.setData(String.valueOf(iteration));
+				else
+					iterationText.setData("");
+			}
+		});
+	}
+
+	@Override
+	public void setErrors(final int errors) {
+		super.setErrors(errors);
+		graphController.updateSVGDocument(new Runnable() {
+			@Override
+			public void run() {
+				if (errors > 0) {
+					errorsText.setData(String.valueOf(errors));
+					completedPolygon.setAttribute(SVG_FILL_ATTRIBUTE,
+							ERROR_COLOUR);
+				} else {
+					errorsText.setData("");
+					completedPolygon.setAttribute(SVG_FILL_ATTRIBUTE,
+							COMPLETED_COLOUR);
+				}
+			}
+		});
+	}
+
+	@Override
+	public void setCompleted(final float complete) {
+		super.setCompleted(complete);
+		graphController.updateSVGDocument(new Runnable() {
+			@Override
+			public void run() {
+				completedPolygon.setAttribute(
+						SVG_POINTS_ATTRIBUTE,
+						calculatePoints(getShape(),
+								(int) (getWidth() * complete), getHeight()));
+			}
+		});
+	}
+
+	@Override
+	public void setSelected(final boolean selected) {
+		delegate.setSelected(selected);
+		super.setSelected(selected);
+	}
+
+	@Override
+	public void setLineStyle(final LineStyle lineStyle) {
+		delegate.setLineStyle(lineStyle);
+		super.setLineStyle(lineStyle);
+	}
+
+	@Override
+	public void setColor(final Color color) {
+		delegate.setColor(color);
+		super.setColor(color);
+	}
+
+	@Override
+	public void setFillColor(final Color fillColor) {
+		delegate.setFillColor(fillColor);
+		super.setFillColor(fillColor);
+	}
+
+	@Override
+	public void setVisible(final boolean visible) {
+		delegate.setVisible(visible);
+		super.setVisible(visible);
+	}
+
+	@Override
+	public void setFiltered(final boolean filtered) {
+		delegate.setFiltered(filtered);
+		super.setFiltered(filtered);
+	}
+
+	@Override
+	public void setOpacity(final float opacity) {
+		delegate.setOpacity(opacity);
+		super.setOpacity(opacity);
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-graph-model/src/main/java/org/apache/taverna/workbench/models/graph/svg/SVGGraphSettings.java
----------------------------------------------------------------------
diff --git a/taverna-graph-model/src/main/java/org/apache/taverna/workbench/models/graph/svg/SVGGraphSettings.java b/taverna-graph-model/src/main/java/org/apache/taverna/workbench/models/graph/svg/SVGGraphSettings.java
new file mode 100644
index 0000000..2e9e228
--- /dev/null
+++ b/taverna-graph-model/src/main/java/org/apache/taverna/workbench/models/graph/svg/SVGGraphSettings.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * 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 org.apache.taverna.workbench.models.graph.svg;
+
+public interface SVGGraphSettings {
+	String COMPLETED_COLOUR = "grey";
+	String ERROR_COLOUR = "#dd3131";
+	String SELECTED_COLOUR = "#4377d3";
+	String NORMAL_COLOUR = "black";
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-graph-model/src/main/java/org/apache/taverna/workbench/models/graph/svg/SVGMonitorShape.java
----------------------------------------------------------------------
diff --git a/taverna-graph-model/src/main/java/org/apache/taverna/workbench/models/graph/svg/SVGMonitorShape.java b/taverna-graph-model/src/main/java/org/apache/taverna/workbench/models/graph/svg/SVGMonitorShape.java
new file mode 100644
index 0000000..7944fc1
--- /dev/null
+++ b/taverna-graph-model/src/main/java/org/apache/taverna/workbench/models/graph/svg/SVGMonitorShape.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 org.apache.taverna.workbench.models.graph.svg;
+
+import org.apache.batik.dom.svg.SVGOMPolygonElement;
+
+public interface SVGMonitorShape extends SVGShape {
+	/**
+	 * Returns the polygon used to display the completed value.
+	 * 
+	 * @return the polygon used to display the completed value
+	 */
+	SVGOMPolygonElement getCompletedPolygon();
+
+	/**
+	 * Sets the polygon used to display the completed value.
+	 * 
+	 * @param polygon
+	 *            the new polygon used to display the completed value
+	 */
+	void setCompletedPolygon(SVGOMPolygonElement polygon);
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-graph-model/src/main/java/org/apache/taverna/workbench/models/graph/svg/SVGShape.java
----------------------------------------------------------------------
diff --git a/taverna-graph-model/src/main/java/org/apache/taverna/workbench/models/graph/svg/SVGShape.java b/taverna-graph-model/src/main/java/org/apache/taverna/workbench/models/graph/svg/SVGShape.java
new file mode 100644
index 0000000..2bf4bf9
--- /dev/null
+++ b/taverna-graph-model/src/main/java/org/apache/taverna/workbench/models/graph/svg/SVGShape.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * 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 org.apache.taverna.workbench.models.graph.svg;
+
+public interface SVGShape {
+	public void setIteration(final int iteration);
+
+	// public void setErrors(final int errors);
+
+	// public void setCompleted(final float complete);
+}


[45/51] [partial] incubator-taverna-workbench git commit: all packages are moved to org.apache.taverna.*

Posted by re...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-ui/src/main/java/org/apache/taverna/workbench/ui/servicepanel/ServiceTreePanel.java
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-ui/src/main/java/org/apache/taverna/workbench/ui/servicepanel/ServiceTreePanel.java b/taverna-activity-palette-ui/src/main/java/org/apache/taverna/workbench/ui/servicepanel/ServiceTreePanel.java
new file mode 100644
index 0000000..5d24027
--- /dev/null
+++ b/taverna-activity-palette-ui/src/main/java/org/apache/taverna/workbench/ui/servicepanel/ServiceTreePanel.java
@@ -0,0 +1,192 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.servicepanel;
+
+import static java.awt.datatransfer.DataFlavor.javaJVMLocalObjectMimeType;
+import static javax.swing.SwingUtilities.invokeLater;
+
+import java.awt.Component;
+import java.awt.FlowLayout;
+import java.awt.datatransfer.DataFlavor;
+import java.awt.datatransfer.Transferable;
+import java.awt.datatransfer.UnsupportedFlavorException;
+import java.io.IOException;
+
+import javax.swing.JComponent;
+import javax.swing.JPanel;
+import javax.swing.TransferHandler;
+import javax.swing.event.TreeExpansionEvent;
+import javax.swing.event.TreeWillExpandListener;
+import javax.swing.tree.ExpandVetoException;
+import javax.swing.tree.TreeCellRenderer;
+import javax.swing.tree.TreePath;
+
+import org.apache.taverna.servicedescriptions.ServiceDescription;
+import org.apache.taverna.servicedescriptions.ServiceDescriptionRegistry;
+import org.apache.taverna.ui.menu.MenuManager;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.selection.SelectionManager;
+import org.apache.taverna.workbench.ui.servicepanel.menu.AddServiceProviderMenu;
+import org.apache.taverna.workbench.ui.servicepanel.tree.Filter;
+import org.apache.taverna.workbench.ui.servicepanel.tree.FilterTreeModel;
+import org.apache.taverna.workbench.ui.servicepanel.tree.FilterTreeNode;
+import org.apache.taverna.workbench.ui.servicepanel.tree.TreePanel;
+
+import org.apache.log4j.Logger;
+
+import org.apache.taverna.commons.services.ServiceRegistry;
+
+public class ServiceTreePanel extends TreePanel {
+	private static final long serialVersionUID = 6611462684296693909L;
+	private static Logger logger = Logger.getLogger(ServiceTreePanel.class);
+
+	private final ServiceDescriptionRegistry serviceDescriptionRegistry;
+	private final EditManager editManager;
+	private final MenuManager menuManager;
+	private final SelectionManager selectionManager;
+	private final ServiceRegistry serviceRegistry;
+
+	public ServiceTreePanel(FilterTreeModel treeModel,
+			ServiceDescriptionRegistry serviceDescriptionRegistry, EditManager editManager,
+			MenuManager menuManager, SelectionManager selectionManager, ServiceRegistry serviceRegistry) {
+		super(treeModel);
+		this.serviceDescriptionRegistry = serviceDescriptionRegistry;
+		this.editManager = editManager;
+		this.menuManager = menuManager;
+		this.selectionManager = selectionManager;
+		this.serviceRegistry = serviceRegistry;
+		initialize();
+	}
+
+	@Override
+	protected void initialize() {
+		super.initialize();
+		tree.setDragEnabled(true);
+		tree.setTransferHandler(new ServiceTransferHandler());
+		tree.addTreeWillExpandListener(new AvoidRootCollapse());
+		tree.expandRow(0);
+
+		invokeLater(new Runnable() {
+			@Override
+			public void run() {
+				tree.addMouseListener(new ServiceTreeClickListener(tree,
+						ServiceTreePanel.this, serviceDescriptionRegistry,
+						editManager, menuManager, selectionManager,
+						serviceRegistry));
+			}
+		});
+	}
+
+	@Override
+	protected Component createExtraComponent() {
+		JComponent buttonPanel = new JPanel(new FlowLayout());
+		buttonPanel.add(new AddServiceProviderMenu(serviceDescriptionRegistry));
+		// buttonPanel.add(new JButton(new RefreshProviderRegistryAction()));
+		return buttonPanel;
+	}
+
+	@Override
+	public Filter createFilter(String text) {
+		return new ServiceFilter(text, filterTreeModel.getRoot());
+	}
+
+	@Override
+	protected TreeCellRenderer createCellRenderer() {
+		return new ServiceTreeCellRenderer();
+	}
+
+	public static class AvoidRootCollapse implements TreeWillExpandListener {
+		@Override
+		public void treeWillCollapse(TreeExpansionEvent event) throws ExpandVetoException {
+			if (event.getPath().getPathCount() == 1)
+				throw new ExpandVetoException(event, "Can't collapse root");
+		}
+
+		@Override
+		public void treeWillExpand(TreeExpansionEvent event) throws ExpandVetoException {
+		}
+	}
+
+	private final class ServiceTransferHandler extends TransferHandler {
+		private static final long serialVersionUID = 4347965626386951176L;
+
+		/**
+		 * Triggered when a node ie. an {@link ActivityItem} is dragged out of
+		 * the tree. Figures out what node it is being dragged and then starts a
+		 * drag action with it
+		 */
+		@Override
+		protected Transferable createTransferable(JComponent c) {
+			TreePath selectionPath = tree.getSelectionPath();
+			if (selectionPath == null)
+				return null;
+			FilterTreeNode lastPathComponent = (FilterTreeNode) selectionPath
+					.getLastPathComponent();
+			if (!(lastPathComponent.getUserObject() instanceof ServiceDescription))
+				return null;
+			final ServiceDescription serviceDescription = (ServiceDescription) lastPathComponent
+					.getUserObject();
+
+			return new Transferable() {
+				@Override
+				public Object getTransferData(DataFlavor flavor)
+						throws UnsupportedFlavorException, IOException {
+					return serviceDescription;
+				}
+
+				@Override
+				public DataFlavor[] getTransferDataFlavors() {
+					DataFlavor[] flavors = new DataFlavor[1];
+					try {
+						flavors[0] = getFlavorForClass(ServiceDescription.class);
+					} catch (ClassNotFoundException e) {
+						logger.error("Error casting Dataflavor", e);
+						flavors[0] = null;
+					}
+					return flavors;
+				}
+
+				@Override
+				public boolean isDataFlavorSupported(DataFlavor flavor) {
+					DataFlavor thisFlavor = null;
+					try {
+						thisFlavor = getFlavorForClass(ServiceDescription.class);
+					} catch (ClassNotFoundException e) {
+						logger.error("Error casting Dataflavor", e);
+					}
+					return flavor.equals(thisFlavor);
+				}
+			};
+		}
+
+		@Override
+		public int getSourceActions(JComponent c) {
+			return COPY_OR_MOVE;
+		}
+	}
+
+	private DataFlavor getFlavorForClass(Class<?> clazz)
+			throws ClassNotFoundException {
+		String name = clazz.getName();
+		return new DataFlavor(javaJVMLocalObjectMimeType + ";class=" + clazz,
+				name.substring(name.lastIndexOf('.') + 1),
+				clazz.getClassLoader());
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-ui/src/main/java/org/apache/taverna/workbench/ui/servicepanel/actions/AddServiceProviderAction.java
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-ui/src/main/java/org/apache/taverna/workbench/ui/servicepanel/actions/AddServiceProviderAction.java b/taverna-activity-palette-ui/src/main/java/org/apache/taverna/workbench/ui/servicepanel/actions/AddServiceProviderAction.java
new file mode 100644
index 0000000..ae1be4e
--- /dev/null
+++ b/taverna-activity-palette-ui/src/main/java/org/apache/taverna/workbench/ui/servicepanel/actions/AddServiceProviderAction.java
@@ -0,0 +1,255 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.servicepanel.actions;
+
+import static java.awt.BorderLayout.CENTER;
+import static java.awt.BorderLayout.NORTH;
+import static java.awt.BorderLayout.SOUTH;
+import static java.awt.BorderLayout.WEST;
+import static java.awt.event.KeyEvent.VK_ENTER;
+import static javax.swing.JOptionPane.ERROR_MESSAGE;
+import static javax.swing.JOptionPane.showMessageDialog;
+import static org.apache.taverna.workbench.MainWindow.getMainWindow;
+import static org.apache.commons.beanutils.PropertyUtils.getPropertyDescriptors;
+import static org.apache.log4j.Logger.getLogger;
+
+import java.awt.BorderLayout;
+import java.awt.Component;
+import java.awt.event.ActionEvent;
+import java.awt.event.KeyAdapter;
+import java.awt.event.KeyEvent;
+import java.beans.PropertyDescriptor;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.swing.AbstractAction;
+import javax.swing.JButton;
+import javax.swing.JDialog;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+
+import org.apache.taverna.lang.observer.Observable;
+import org.apache.taverna.lang.observer.Observer;
+import org.apache.taverna.lang.uibuilder.UIBuilder;
+import org.apache.taverna.servicedescriptions.ConfigurableServiceProvider;
+import org.apache.taverna.servicedescriptions.CustomizedConfigurePanelProvider;
+import org.apache.taverna.servicedescriptions.ServiceDescriptionRegistry;
+import org.apache.taverna.servicedescriptions.CustomizedConfigurePanelProvider.CustomizedConfigureCallBack;
+import org.apache.taverna.servicedescriptions.events.ProviderErrorNotification;
+import org.apache.taverna.servicedescriptions.events.ServiceDescriptionProvidedEvent;
+import org.apache.taverna.servicedescriptions.events.ServiceDescriptionRegistryEvent;
+import org.apache.taverna.workbench.helper.HelpEnabledDialog;
+
+import org.apache.log4j.Logger;
+
+import org.apache.taverna.scufl2.api.configurations.Configuration;
+
+/**
+ * Action for adding a service provider
+ * 
+ * @author Stian Soiland-Reyes
+ * @author Alan R Williams
+ */
+@SuppressWarnings("serial")
+public class AddServiceProviderAction extends AbstractAction {
+	private static Logger logger = getLogger(AddServiceProviderAction.class);
+
+	// protected static Dimension DIALOG_SIZE = new Dimension(400, 300);
+
+	private ServiceDescriptionRegistry serviceDescriptionRegistry;
+
+	private final ConfigurableServiceProvider confProvider;
+	private final Component owner;
+
+	public AddServiceProviderAction(ConfigurableServiceProvider confProvider,
+			Component owner) {
+		super(confProvider.getName() + "...", confProvider.getIcon());
+		this.confProvider = confProvider;
+		this.owner = owner;
+	}
+
+	@Override
+	public void actionPerformed(ActionEvent e) {
+		if (confProvider instanceof CustomizedConfigurePanelProvider) {
+			final CustomizedConfigurePanelProvider provider = (CustomizedConfigurePanelProvider) confProvider;
+			provider.createCustomizedConfigurePanel(new CustomizedConfigureCallBack() {
+				@Override
+				public Configuration getTemplateConfig() {
+					return (Configuration) provider.getConfiguration().clone();
+				}
+
+				@Override
+				public ServiceDescriptionRegistry getServiceDescriptionRegistry() {
+					return AddServiceProviderAction.this.getServiceDescriptionRegistry();
+				}
+
+				@Override
+				public void newProviderConfiguration(Configuration providerConfig) {
+					addNewProvider(providerConfig);
+				}
+			});
+			return;
+		}
+
+		Configuration configuration;
+		try {
+			configuration = (Configuration) confProvider.getConfiguration().clone();
+		} catch (Exception ex) {
+			throw new RuntimeException("Can't clone configuration bean", ex);
+		}
+		JPanel buildEditor = buildEditor(configuration);
+		String title = "Add " + confProvider.getName();
+		JDialog dialog = new HelpEnabledDialog(getMainWindow(), title, true, null);
+		JPanel iconPanel = new JPanel();
+		iconPanel.add(new JLabel(confProvider.getIcon()), NORTH);
+		dialog.add(iconPanel, WEST);
+		dialog.add(buildEditor, CENTER);
+		JPanel buttonPanel = new JPanel(new BorderLayout());
+		final AddProviderAction addProviderAction = new AddProviderAction(configuration,
+				dialog);
+		JButton addProviderButton = new JButton(addProviderAction);
+		buttonPanel.add(addProviderButton, WEST);
+		
+		dialog.add(buttonPanel, SOUTH);
+	    // When user presses "Return" key fire the action on the "Add" button
+		addProviderButton.addKeyListener(new KeyAdapter() {
+			@Override
+			public void keyPressed(KeyEvent evt) {
+				if (evt.getKeyCode() == VK_ENTER)
+					addProviderAction.actionPerformed(null);
+			}
+		});
+		dialog.getRootPane().setDefaultButton(addProviderButton);
+		
+		// dialog.setSize(buttonPanel.getPreferredSize());
+		dialog.pack();
+		dialog.setLocationRelativeTo(owner);
+//		dialog.setLocation(owner.getLocationOnScreen().x + owner.getWidth(),
+//				owner.getLocationOnScreen().y + owner.getHeight());
+		dialog.setVisible(true);
+	}
+
+	protected void addNewProvider(Configuration configurationBean) {
+		ConfigurableServiceProvider cloned = (ConfigurableServiceProvider) confProvider
+				.newInstance();
+		try {
+			cloned.configure(configurationBean);
+			getServiceDescriptionRegistry().addObserver(
+					new CheckAddedCorrectlyObserver(cloned));
+			getServiceDescriptionRegistry().addServiceDescriptionProvider(
+					cloned);
+		} catch (Exception ex) {
+			logger.warn("Can't configure provider " + cloned + " using "
+					+ configurationBean, ex);
+			showMessageDialog(owner, "Can't configure service provider "
+					+ cloned.getName(), "Can't add service provider",
+					ERROR_MESSAGE);
+		}
+	}
+
+	private PropertyDescriptor[] getProperties(Configuration configuration) {
+		// FIXME This is *so* wrong!
+		try {
+			return getPropertyDescriptors(configuration);
+		} catch (Exception ex) {
+			throw new RuntimeException("Can't inspect configuration bean", ex);
+		}
+	}
+
+	// TODO This is probably not right
+	protected JPanel buildEditor(Configuration configuration) {
+		List<String> uiBuilderConfig = new ArrayList<>();
+		int lastPreferred = 0;
+		for (PropertyDescriptor property : getProperties(configuration)) {
+			if (property.isHidden() || property.isExpert())
+				// TODO: Add support for expert properties
+				continue;
+			String propertySpec = property.getName() + ":name="
+					+ property.getDisplayName();
+			if (property.isPreferred())
+				// Add it to the front
+				uiBuilderConfig.add(lastPreferred++, propertySpec);
+			else
+				uiBuilderConfig.add(propertySpec);
+		}
+
+		return UIBuilder.buildEditor(configuration, uiBuilderConfig
+				.toArray(new String[0]));
+	}
+
+	public void setServiceDescriptionRegistry(
+			ServiceDescriptionRegistry serviceDescriptionRegistry) {
+		this.serviceDescriptionRegistry = serviceDescriptionRegistry;
+	}
+
+	public ServiceDescriptionRegistry getServiceDescriptionRegistry() {
+		return serviceDescriptionRegistry;
+	}
+
+	public class AddProviderAction extends AbstractAction {
+		private final Configuration configurationBean;
+		private final JDialog dialog;
+
+		private AddProviderAction(Configuration configurationBean, JDialog dialog) {
+			super("Add");
+			this.configurationBean = configurationBean;
+			this.dialog = dialog;
+		}
+
+		@Override
+		public void actionPerformed(ActionEvent e) {
+			addNewProvider(configurationBean);
+			dialog.setVisible(false);
+		}
+	}
+
+	public class CheckAddedCorrectlyObserver implements
+			Observer<ServiceDescriptionRegistryEvent> {
+		private final ConfigurableServiceProvider provider;
+
+		private CheckAddedCorrectlyObserver(ConfigurableServiceProvider provider) {
+			this.provider = provider;
+		}
+
+		@Override
+		public void notify(Observable<ServiceDescriptionRegistryEvent> sender,
+				ServiceDescriptionRegistryEvent message) throws Exception {
+			if (message instanceof ProviderErrorNotification)
+				notify((ProviderErrorNotification) message);
+			else if (message instanceof ServiceDescriptionProvidedEvent)
+				notify((ServiceDescriptionProvidedEvent) message);
+		}
+
+		private void notify(ServiceDescriptionProvidedEvent providedMsg) {
+			if (providedMsg.getProvider() == provider)
+				getServiceDescriptionRegistry().removeObserver(this);
+		}
+
+		private void notify(ProviderErrorNotification errorMsg) {
+			if (errorMsg.getProvider() != provider)
+				return;
+			getServiceDescriptionRegistry().removeObserver(this);
+			getServiceDescriptionRegistry().removeServiceDescriptionProvider(
+					provider);
+//			showMessageDialog(owner, errorMsg.getMessage(),
+//					"Can't add provider " + provider, ERROR_MESSAGE);
+		}
+	}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-ui/src/main/java/org/apache/taverna/workbench/ui/servicepanel/actions/ExportServiceDescriptionsAction.java
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-ui/src/main/java/org/apache/taverna/workbench/ui/servicepanel/actions/ExportServiceDescriptionsAction.java b/taverna-activity-palette-ui/src/main/java/org/apache/taverna/workbench/ui/servicepanel/actions/ExportServiceDescriptionsAction.java
new file mode 100644
index 0000000..2183854
--- /dev/null
+++ b/taverna-activity-palette-ui/src/main/java/org/apache/taverna/workbench/ui/servicepanel/actions/ExportServiceDescriptionsAction.java
@@ -0,0 +1,154 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.servicepanel.actions;
+
+import static javax.swing.JFileChooser.APPROVE_OPTION;
+import static javax.swing.JOptionPane.ERROR_MESSAGE;
+import static javax.swing.JOptionPane.NO_OPTION;
+import static javax.swing.JOptionPane.YES_NO_CANCEL_OPTION;
+import static javax.swing.JOptionPane.YES_OPTION;
+import static javax.swing.JOptionPane.showConfirmDialog;
+import static javax.swing.JOptionPane.showMessageDialog;
+
+import java.awt.event.ActionEvent;
+import java.io.File;
+import java.util.prefs.Preferences;
+
+import javax.swing.AbstractAction;
+import javax.swing.JButton;
+import javax.swing.JComponent;
+import javax.swing.JFileChooser;
+import javax.swing.filechooser.FileFilter;
+
+import org.apache.taverna.servicedescriptions.ServiceDescriptionRegistry;
+
+import org.apache.log4j.Logger;
+
+/**
+ * Action to export the current service descritpions from the Service
+ * Registry to an xml file.
+ *
+ * @author Alex Nenadic
+ */
+//FIXME this file assumes we're writing out as XML
+@SuppressWarnings("serial")
+public class ExportServiceDescriptionsAction extends AbstractAction {
+	private static final String EXTENSION = ".xml";
+	private static final String EXPORT_SERVICES = "Export services to file";
+	private static final String SERVICE_EXPORT_DIR_PROPERTY = "serviceExportDir";
+	private Logger logger = Logger.getLogger(ExportServiceDescriptionsAction.class);
+	private final ServiceDescriptionRegistry serviceDescriptionRegistry;
+
+	public ExportServiceDescriptionsAction(ServiceDescriptionRegistry serviceDescriptionRegistry) {
+		super(EXPORT_SERVICES);
+		this.serviceDescriptionRegistry = serviceDescriptionRegistry;
+	}
+
+	public static final boolean INHIBIT = true;
+
+	@Override
+	public void actionPerformed(ActionEvent e) {
+		JComponent parentComponent = null;
+		if (e.getSource() instanceof JComponent)
+			parentComponent = (JComponent) e.getSource();
+
+		if (INHIBIT) {
+			showMessageDialog(parentComponent,
+					"Operation not currently working correctly",
+					"Not Implemented", ERROR_MESSAGE);
+			return;
+		}
+
+		JFileChooser fileChooser = new JFileChooser();
+		Preferences prefs = Preferences.userNodeForPackage(getClass());
+		String curDir = prefs.get(SERVICE_EXPORT_DIR_PROPERTY,
+				System.getProperty("user.home"));
+		fileChooser.setDialogTitle("Select file to export services to");
+
+		fileChooser.setFileFilter(new FileFilter() {
+			@Override
+			public boolean accept(File f) {
+				return f.isDirectory()
+						|| f.getName().toLowerCase().endsWith(EXTENSION);
+			}
+
+			@Override
+			public String getDescription() {
+				return ".xml files";
+			}
+		});
+
+		fileChooser.setCurrentDirectory(new File(curDir));
+
+		boolean tryAgain = true;
+		while (tryAgain) {
+			tryAgain = false;
+			int returnVal = fileChooser.showSaveDialog(parentComponent);
+			if (returnVal == APPROVE_OPTION) {
+				prefs.put(SERVICE_EXPORT_DIR_PROPERTY, fileChooser.getCurrentDirectory()
+						.toString());
+				File file = fileChooser.getSelectedFile();
+				if (!file.getName().toLowerCase().endsWith(EXTENSION)) {
+					String newName = file.getName() + EXTENSION;
+					file = new File(file.getParentFile(), newName);
+				}
+
+				try {
+					if (file.exists()) {
+						String msg = "Are you sure you want to overwrite existing file "
+								+ file + "?";
+						int ret = showConfirmDialog(parentComponent, msg,
+								"File already exists", YES_NO_CANCEL_OPTION);
+						if (ret == NO_OPTION) {
+							tryAgain = true;
+							continue;
+						} else if (ret != YES_OPTION) {
+							logger.info("Service descriptions export: aborted overwrite of "
+									+ file.getAbsolutePath());
+							break;
+						}
+					}
+					exportServiceDescriptions(file);
+					break;
+				} catch (Exception ex) {
+					logger.error("Service descriptions export: failed to export services to "
+							+ file.getAbsolutePath(), ex);
+					showMessageDialog(
+							parentComponent,
+							"Failed to export services to "
+									+ file.getAbsolutePath(), "Error",
+							ERROR_MESSAGE);
+					break;
+				}
+			}
+		}
+
+		if (parentComponent instanceof JButton)
+			// lose the focus from the button after performing the action
+			parentComponent.requestFocusInWindow();
+	}
+
+	private void exportServiceDescriptions(File file) {
+		// TODO: Open in separate thread to avoid hanging UI
+		serviceDescriptionRegistry.exportCurrentServiceDescriptions(file);
+		logger.info("Service descriptions export: saved to file "
+				+ file.getAbsolutePath());
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-ui/src/main/java/org/apache/taverna/workbench/ui/servicepanel/actions/ImportServiceDescriptionsFromFileAction.java
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-ui/src/main/java/org/apache/taverna/workbench/ui/servicepanel/actions/ImportServiceDescriptionsFromFileAction.java b/taverna-activity-palette-ui/src/main/java/org/apache/taverna/workbench/ui/servicepanel/actions/ImportServiceDescriptionsFromFileAction.java
new file mode 100644
index 0000000..218df0f
--- /dev/null
+++ b/taverna-activity-palette-ui/src/main/java/org/apache/taverna/workbench/ui/servicepanel/actions/ImportServiceDescriptionsFromFileAction.java
@@ -0,0 +1,157 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.servicepanel.actions;
+
+import static javax.swing.JFileChooser.APPROVE_OPTION;
+import static javax.swing.JOptionPane.CANCEL_OPTION;
+import static javax.swing.JOptionPane.ERROR_MESSAGE;
+import static javax.swing.JOptionPane.QUESTION_MESSAGE;
+import static javax.swing.JOptionPane.YES_NO_CANCEL_OPTION;
+import static javax.swing.JOptionPane.YES_OPTION;
+import static javax.swing.JOptionPane.showMessageDialog;
+import static javax.swing.JOptionPane.showOptionDialog;
+
+import java.awt.event.ActionEvent;
+import java.io.File;
+import java.util.HashSet;
+import java.util.prefs.Preferences;
+
+import javax.swing.AbstractAction;
+import javax.swing.JButton;
+import javax.swing.JComponent;
+import javax.swing.JFileChooser;
+import javax.swing.filechooser.FileFilter;
+
+import org.apache.log4j.Logger;
+
+import org.apache.taverna.servicedescriptions.ConfigurableServiceProvider;
+import org.apache.taverna.servicedescriptions.ServiceDescriptionProvider;
+import org.apache.taverna.servicedescriptions.ServiceDescriptionRegistry;
+
+/**
+ * Action to import a list of service descriptions from an xml file
+ * into the Service Registry. Users have an option to completely
+ * replace the current services or just add the ones from the file
+ * to the current services.
+ *
+ * @author Alex Nenadic
+ */
+//FIXME this file assumes we're writing out as XML
+@SuppressWarnings("serial")
+public class ImportServiceDescriptionsFromFileAction extends AbstractAction{
+	private static final String EXTENSION = ".xml";
+	private static final String IMPORT_SERVICES = "Import services from file";
+	private static final String SERVICE_IMPORT_DIR_PROPERTY = "serviceImportDir";
+	private static final Logger logger = Logger.getLogger(ExportServiceDescriptionsAction.class);
+
+	private final ServiceDescriptionRegistry serviceDescriptionRegistry;
+
+	public ImportServiceDescriptionsFromFileAction(
+			ServiceDescriptionRegistry serviceDescriptionRegistry) {
+		super(IMPORT_SERVICES);
+		this.serviceDescriptionRegistry = serviceDescriptionRegistry;
+	}
+
+	private static final Object[] CHOICES = { "Add to current services",
+			"Replace current services", "Cancel" };
+
+	@Override
+	public void actionPerformed(ActionEvent e) {
+		JComponent parentComponent = null;
+		if (e.getSource() instanceof JComponent)
+			parentComponent = (JComponent) e.getSource();
+
+		if (ExportServiceDescriptionsAction.INHIBIT) {
+			showMessageDialog(parentComponent,
+					"Operation not currently working correctly",
+					"Not Implemented", ERROR_MESSAGE);
+			return;
+		}
+
+		int choice = showOptionDialog(
+				parentComponent,
+				"Do you want to add the imported services to the current ones or replace the current ones?",
+				"Import services", YES_NO_CANCEL_OPTION, QUESTION_MESSAGE,
+				null, CHOICES, CHOICES[0]);
+
+		if (choice != CANCEL_OPTION) {
+			JFileChooser fileChooser = new JFileChooser();
+			Preferences prefs = Preferences.userNodeForPackage(getClass());
+			String curDir = prefs.get(SERVICE_IMPORT_DIR_PROPERTY, System.getProperty("user.home"));
+
+			fileChooser.setDialogTitle("Select file to import services from");
+
+			fileChooser.setFileFilter(new FileFilter() {
+				@Override
+				public boolean accept(File f) {
+					return f.isDirectory()
+							|| f.getName().toLowerCase().endsWith(EXTENSION);
+				}
+
+				@Override
+				public String getDescription() {
+					return EXTENSION + " files";
+				}
+			});
+
+			fileChooser.setCurrentDirectory(new File(curDir));
+
+			if (fileChooser.showOpenDialog(parentComponent) == APPROVE_OPTION) {
+				prefs.put(SERVICE_IMPORT_DIR_PROPERTY, fileChooser
+						.getCurrentDirectory().toString());
+				File file = fileChooser.getSelectedFile();
+
+				try {
+					// Did user want to replace or add services?
+					importServices(file, choice == YES_OPTION);
+				} catch (Exception ex) {
+					logger.error(
+							"Service descriptions import: failed to import services from "
+									+ file.getAbsolutePath(), ex);
+					showMessageDialog(parentComponent,
+							"Failed to import services from " + file.getAbsolutePath(), "Error",
+							ERROR_MESSAGE);
+				}
+			}
+		}
+
+		if (parentComponent instanceof JButton)
+			// lose the focus from the button after performing the action
+			parentComponent.requestFocusInWindow();
+	}
+
+	private void importServices(final File file, final boolean addToCurrent)
+			throws Exception {
+		// TODO: Open in separate thread to avoid hanging UI
+
+		if (!addToCurrent)
+			for (ServiceDescriptionProvider provider : new HashSet<>(
+					serviceDescriptionRegistry.getServiceDescriptionProviders()))
+				// remove all configurable service providers
+				if (provider instanceof ConfigurableServiceProvider)
+					serviceDescriptionRegistry
+							.removeServiceDescriptionProvider(provider);
+
+		// import all providers from the file
+		serviceDescriptionRegistry.loadServiceProviders(file);
+		serviceDescriptionRegistry.saveServiceDescriptions();
+	}
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-ui/src/main/java/org/apache/taverna/workbench/ui/servicepanel/actions/ImportServiceDescriptionsFromURLAction.java
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-ui/src/main/java/org/apache/taverna/workbench/ui/servicepanel/actions/ImportServiceDescriptionsFromURLAction.java b/taverna-activity-palette-ui/src/main/java/org/apache/taverna/workbench/ui/servicepanel/actions/ImportServiceDescriptionsFromURLAction.java
new file mode 100644
index 0000000..af51ce1
--- /dev/null
+++ b/taverna-activity-palette-ui/src/main/java/org/apache/taverna/workbench/ui/servicepanel/actions/ImportServiceDescriptionsFromURLAction.java
@@ -0,0 +1,128 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.servicepanel.actions;
+
+import static javax.swing.JOptionPane.CANCEL_OPTION;
+import static javax.swing.JOptionPane.ERROR_MESSAGE;
+import static javax.swing.JOptionPane.QUESTION_MESSAGE;
+import static javax.swing.JOptionPane.YES_NO_CANCEL_OPTION;
+import static javax.swing.JOptionPane.YES_OPTION;
+import static javax.swing.JOptionPane.showInputDialog;
+import static javax.swing.JOptionPane.showMessageDialog;
+import static javax.swing.JOptionPane.showOptionDialog;
+
+import java.awt.event.ActionEvent;
+import java.net.URL;
+import java.util.HashSet;
+
+import javax.swing.AbstractAction;
+import javax.swing.JButton;
+import javax.swing.JComponent;
+
+import org.apache.taverna.servicedescriptions.ConfigurableServiceProvider;
+import org.apache.taverna.servicedescriptions.ServiceDescriptionProvider;
+import org.apache.taverna.servicedescriptions.ServiceDescriptionRegistry;
+
+import org.apache.log4j.Logger;
+
+/**
+ * Action to import a list of service descriptions from an URL pointing
+ * to an xml file into the Service Registry. Users have an option to
+ * completely replace the current services or just add the ones from the
+ * file to the current services.
+ *
+ * @author Alex Nenadic
+ */
+@SuppressWarnings("serial")
+public class ImportServiceDescriptionsFromURLAction extends AbstractAction{
+	private static final String IMPORT_SERVICES_FROM_URL = "Import services from URL";
+	private static final Logger logger = Logger.getLogger(ExportServiceDescriptionsAction.class);
+
+	private final ServiceDescriptionRegistry serviceDescriptionRegistry;
+
+	public ImportServiceDescriptionsFromURLAction(ServiceDescriptionRegistry serviceDescriptionRegistry) {
+		super(IMPORT_SERVICES_FROM_URL);
+		this.serviceDescriptionRegistry = serviceDescriptionRegistry;
+	}
+
+	private static final Object[] CHOICES = { "Add to current services",
+			"Replace current services", "Cancel" };
+
+	@Override
+	public void actionPerformed(ActionEvent e) {
+		JComponent parentComponent = null;
+		if (e.getSource() instanceof JComponent)
+			parentComponent = (JComponent) e.getSource();
+
+		if (ExportServiceDescriptionsAction.INHIBIT) {
+			showMessageDialog(parentComponent,
+					"Operation not currently working correctly",
+					"Not Implemented", ERROR_MESSAGE);
+			return;
+		}
+
+		int choice = showOptionDialog(
+				parentComponent,
+				"Do you want to add the imported services to the current ones or replace the current ones?",
+				"Import services", YES_NO_CANCEL_OPTION, QUESTION_MESSAGE,
+				null, CHOICES, CHOICES[0]);
+
+		if (choice != CANCEL_OPTION) {
+			final String urlString = (String) showInputDialog(parentComponent,
+					"Enter the URL of the service descriptions file to import",
+					"Service Descriptions URL", QUESTION_MESSAGE, null, null,
+					"http://");
+			try {
+				if (urlString != null && !urlString.isEmpty())
+					// Did user want to replace or add services?
+					importServices(urlString, choice == YES_OPTION);
+			} catch (Exception ex) {
+				logger.error(
+						"Service descriptions import: failed to import services from "
+								+ urlString, ex);
+				showMessageDialog(parentComponent,
+						"Failed to import services from " + urlString, "Error",
+						ERROR_MESSAGE);
+			}
+		}
+
+		if (parentComponent instanceof JButton)
+			// lose the focus from the button after performing the action
+			parentComponent.requestFocusInWindow();
+	}
+
+	private void importServices(final String urlString, final boolean addToCurrent)
+			throws Exception {
+		// TODO: Open in separate thread to avoid hanging UI
+		URL url = new URL(urlString);
+
+		if (!addToCurrent)
+			for (ServiceDescriptionProvider provider : new HashSet<>(
+					serviceDescriptionRegistry.getServiceDescriptionProviders()))
+				// remove all configurable service providers
+				if (provider instanceof ConfigurableServiceProvider)
+					serviceDescriptionRegistry
+							.removeServiceDescriptionProvider(provider);
+
+		// import all providers from the URL
+		serviceDescriptionRegistry.loadServiceProviders(url);
+		serviceDescriptionRegistry.saveServiceDescriptions();
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-ui/src/main/java/org/apache/taverna/workbench/ui/servicepanel/actions/RefreshProviderRegistryAction.java
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-ui/src/main/java/org/apache/taverna/workbench/ui/servicepanel/actions/RefreshProviderRegistryAction.java b/taverna-activity-palette-ui/src/main/java/org/apache/taverna/workbench/ui/servicepanel/actions/RefreshProviderRegistryAction.java
new file mode 100644
index 0000000..5cd6ddb
--- /dev/null
+++ b/taverna-activity-palette-ui/src/main/java/org/apache/taverna/workbench/ui/servicepanel/actions/RefreshProviderRegistryAction.java
@@ -0,0 +1,51 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.servicepanel.actions;
+
+import java.awt.event.ActionEvent;
+
+import javax.swing.AbstractAction;
+
+import org.apache.taverna.servicedescriptions.ServiceDescriptionRegistry;
+
+/**
+ * Action for refreshing the service provider registry.
+ * <p>
+ * This would typically re-parse WSDLs, etc.
+ * 
+ * @see ServiceDescriptionRegistry#refresh()
+ * @author Stian Soiland-Reyes
+ */
+@SuppressWarnings("serial")
+public class RefreshProviderRegistryAction extends AbstractAction {
+	private static final String REFRESH = "Reload services";
+	private final ServiceDescriptionRegistry serviceDescriptionRegistry;
+
+	public RefreshProviderRegistryAction(
+			ServiceDescriptionRegistry serviceDescriptionRegistry) {
+		super(REFRESH);
+		this.serviceDescriptionRegistry = serviceDescriptionRegistry;
+	}
+
+	@Override
+	public void actionPerformed(ActionEvent e) {
+		serviceDescriptionRegistry.refresh();
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-ui/src/main/java/org/apache/taverna/workbench/ui/servicepanel/actions/RemoveDefaultServicesAction.java
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-ui/src/main/java/org/apache/taverna/workbench/ui/servicepanel/actions/RemoveDefaultServicesAction.java b/taverna-activity-palette-ui/src/main/java/org/apache/taverna/workbench/ui/servicepanel/actions/RemoveDefaultServicesAction.java
new file mode 100644
index 0000000..0460004
--- /dev/null
+++ b/taverna-activity-palette-ui/src/main/java/org/apache/taverna/workbench/ui/servicepanel/actions/RemoveDefaultServicesAction.java
@@ -0,0 +1,50 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.servicepanel.actions;
+
+import java.awt.event.ActionEvent;
+
+import javax.swing.AbstractAction;
+
+import org.apache.taverna.servicedescriptions.ConfigurableServiceProvider;
+import org.apache.taverna.servicedescriptions.ServiceDescriptionProvider;
+import org.apache.taverna.servicedescriptions.ServiceDescriptionRegistry;
+
+@SuppressWarnings("serial")
+public class RemoveDefaultServicesAction extends AbstractAction {
+	private final ServiceDescriptionRegistry serviceDescriptionRegistry;
+
+	public RemoveDefaultServicesAction(
+			ServiceDescriptionRegistry serviceDescriptionRegistry) {
+		super("Remove default service providers");
+		this.serviceDescriptionRegistry = serviceDescriptionRegistry;
+	}
+
+	@Override
+	public void actionPerformed(ActionEvent e) {
+		for (ServiceDescriptionProvider provider : serviceDescriptionRegistry
+				.getDefaultServiceDescriptionProviders()) {
+			if (!(provider instanceof ConfigurableServiceProvider))
+				continue;
+			serviceDescriptionRegistry
+					.removeServiceDescriptionProvider(provider);
+		}
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-ui/src/main/java/org/apache/taverna/workbench/ui/servicepanel/actions/RemoveUserServicesAction.java
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-ui/src/main/java/org/apache/taverna/workbench/ui/servicepanel/actions/RemoveUserServicesAction.java b/taverna-activity-palette-ui/src/main/java/org/apache/taverna/workbench/ui/servicepanel/actions/RemoveUserServicesAction.java
new file mode 100644
index 0000000..43a43ba
--- /dev/null
+++ b/taverna-activity-palette-ui/src/main/java/org/apache/taverna/workbench/ui/servicepanel/actions/RemoveUserServicesAction.java
@@ -0,0 +1,58 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.servicepanel.actions;
+
+import static javax.swing.JOptionPane.YES_NO_OPTION;
+import static javax.swing.JOptionPane.YES_OPTION;
+import static javax.swing.JOptionPane.showConfirmDialog;
+
+import java.awt.event.ActionEvent;
+
+import javax.swing.AbstractAction;
+import javax.swing.JLabel;
+
+import org.apache.taverna.servicedescriptions.ServiceDescriptionProvider;
+import org.apache.taverna.servicedescriptions.ServiceDescriptionRegistry;
+
+@SuppressWarnings("serial")
+public class RemoveUserServicesAction extends AbstractAction {
+	private static final String CONFIRM_MESSAGE = "You are about to remove all services you have added. <br>"
+			+ "Are you <b>really</b> sure you want to do this?";
+	private final ServiceDescriptionRegistry serviceDescriptionRegistry;
+
+	public RemoveUserServicesAction(
+			ServiceDescriptionRegistry serviceDescriptionRegistry) {
+		super("Remove all user added service providers");
+		this.serviceDescriptionRegistry = serviceDescriptionRegistry;
+	}
+
+	@Override
+	public void actionPerformed(ActionEvent e) {
+		int option = showConfirmDialog(null, new JLabel("<html><body>"
+				+ CONFIRM_MESSAGE + "</body></html>"),
+				"Confirm service deletion", YES_NO_OPTION);
+
+		if (option == YES_OPTION)
+			for (ServiceDescriptionProvider provider : serviceDescriptionRegistry
+					.getUserAddedServiceProviders())
+				serviceDescriptionRegistry
+						.removeServiceDescriptionProvider(provider);
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-ui/src/main/java/org/apache/taverna/workbench/ui/servicepanel/actions/RestoreDefaultServicesAction.java
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-ui/src/main/java/org/apache/taverna/workbench/ui/servicepanel/actions/RestoreDefaultServicesAction.java b/taverna-activity-palette-ui/src/main/java/org/apache/taverna/workbench/ui/servicepanel/actions/RestoreDefaultServicesAction.java
new file mode 100644
index 0000000..e7a5f46
--- /dev/null
+++ b/taverna-activity-palette-ui/src/main/java/org/apache/taverna/workbench/ui/servicepanel/actions/RestoreDefaultServicesAction.java
@@ -0,0 +1,49 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.servicepanel.actions;
+
+import java.awt.event.ActionEvent;
+
+import javax.swing.AbstractAction;
+
+import org.apache.taverna.servicedescriptions.ConfigurableServiceProvider;
+import org.apache.taverna.servicedescriptions.ServiceDescriptionProvider;
+import org.apache.taverna.servicedescriptions.ServiceDescriptionRegistry;
+
+@SuppressWarnings("serial")
+public class RestoreDefaultServicesAction extends AbstractAction {
+	private final ServiceDescriptionRegistry serviceDescriptionRegistry;
+
+	public RestoreDefaultServicesAction(
+			ServiceDescriptionRegistry serviceDescriptionRegistry) {
+		super("Restore default service providers");
+		this.serviceDescriptionRegistry = serviceDescriptionRegistry;
+	}
+
+	@Override
+	public void actionPerformed(ActionEvent e) {
+		for (ServiceDescriptionProvider provider : serviceDescriptionRegistry
+				.getDefaultServiceDescriptionProviders()) {
+			if (!(provider instanceof ConfigurableServiceProvider))
+				continue;
+			serviceDescriptionRegistry.addServiceDescriptionProvider(provider);
+		}
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-ui/src/main/java/org/apache/taverna/workbench/ui/servicepanel/config/ServiceDescriptionConfigPanel.java
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-ui/src/main/java/org/apache/taverna/workbench/ui/servicepanel/config/ServiceDescriptionConfigPanel.java b/taverna-activity-palette-ui/src/main/java/org/apache/taverna/workbench/ui/servicepanel/config/ServiceDescriptionConfigPanel.java
new file mode 100644
index 0000000..61a7d1a
--- /dev/null
+++ b/taverna-activity-palette-ui/src/main/java/org/apache/taverna/workbench/ui/servicepanel/config/ServiceDescriptionConfigPanel.java
@@ -0,0 +1,181 @@
+/*******************************************************************************
+ * 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 org.apache.taverna.workbench.ui.servicepanel.config;
+
+import static java.awt.GridBagConstraints.HORIZONTAL;
+import static java.awt.GridBagConstraints.NONE;
+import static java.awt.GridBagConstraints.WEST;
+
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.Insets;
+import java.awt.event.ActionEvent;
+
+import javax.swing.AbstractAction;
+import javax.swing.JButton;
+import javax.swing.JCheckBox;
+import javax.swing.JPanel;
+import javax.swing.JTextArea;
+import javax.swing.border.EmptyBorder;
+
+import org.apache.taverna.servicedescriptions.ConfigurableServiceProvider;
+import org.apache.taverna.servicedescriptions.ServiceDescriptionProvider;
+import org.apache.taverna.servicedescriptions.ServiceDescriptionRegistry;
+import org.apache.taverna.servicedescriptions.ServiceDescriptionsConfiguration;
+import org.apache.taverna.workbench.helper.Helper;
+
+@SuppressWarnings("serial")
+public class ServiceDescriptionConfigPanel extends JPanel {
+	private static final String REMOVE_PERMANENTLY = "Allow permanent removal of default service providers";
+	private static final String INCLUDE_DEFAULTS = "Include default service providers";
+
+	private final ServiceDescriptionsConfiguration config;
+	private JCheckBox includeDefaults;
+	private JCheckBox removePermanently;
+	private final ServiceDescriptionRegistry serviceDescRegistry;
+
+	public ServiceDescriptionConfigPanel(ServiceDescriptionsConfiguration config,
+			ServiceDescriptionRegistry serviceDescRegistry) {
+		super(new GridBagLayout());
+		this.config = config;
+		this.serviceDescRegistry = serviceDescRegistry;
+		initialize();
+	}
+
+	private void initialize() {
+		removeAll();
+
+		GridBagConstraints gbc = new GridBagConstraints();
+
+		// Title describing what kind of settings we are configuring here
+		JTextArea descriptionText = new JTextArea(
+				"Configure behaviour of default service providers in Service Panel");
+        descriptionText.setLineWrap(true);
+        descriptionText.setWrapStyleWord(true);
+        descriptionText.setEditable(false);
+        descriptionText.setFocusable(false);
+        descriptionText.setBorder(new EmptyBorder(10, 10, 10, 10));
+		gbc.gridx = 0;
+		gbc.gridy = 0;
+		gbc.anchor = WEST;
+		gbc.fill = HORIZONTAL;
+		add(descriptionText, gbc);
+
+		includeDefaults = new JCheckBox(INCLUDE_DEFAULTS);
+		gbc.gridx = 0;
+		gbc.gridy = 1;
+		gbc.anchor = WEST;
+		gbc.fill = NONE;
+        gbc.insets = new Insets(10, 0, 0, 0);
+		add(includeDefaults, gbc);
+
+		removePermanently = new JCheckBox(REMOVE_PERMANENTLY);
+		gbc.gridx = 0;
+		gbc.gridy = 2;
+        gbc.insets = new Insets(0, 0, 0, 0);
+		add(removePermanently, gbc);
+
+		// Filler
+		gbc.gridx = 0;
+		gbc.gridy = 3;
+		gbc.weighty = 1;
+		gbc.weightx = 1;
+		gbc.fill = GridBagConstraints.BOTH;
+        gbc.insets = new Insets(10, 0, 0, 0);
+		add(createButtonPanel(), gbc);
+
+		setFields(config);
+	}
+
+	/**
+	 * Create the panel to contain the buttons
+	 *
+	 * @return
+	 */
+	private JPanel createButtonPanel() {
+		final JPanel panel = new JPanel();
+
+		/**
+		 * The helpButton shows help about the current component
+		 */
+		JButton helpButton = new JButton(new AbstractAction("Help") {
+			@Override
+			public void actionPerformed(ActionEvent arg0) {
+				Helper.showHelp(panel);
+			}
+		});
+		panel.add(helpButton);
+
+		/**
+		 * The resetButton changes the property values shown to those
+		 * corresponding to the configuration currently applied.
+		 */
+		JButton resetButton = new JButton(new AbstractAction("Reset") {
+			@Override
+			public void actionPerformed(ActionEvent arg0) {
+				setFields(config);
+			}
+		});
+		panel.add(resetButton);
+
+		/**
+		 * The applyButton applies the shown field values to the
+		 * {@link HttpProxyConfiguration} and saves them for future.
+		 */
+		JButton applyButton = new JButton(new AbstractAction("Apply") {
+			@Override
+			public void actionPerformed(ActionEvent arg0) {
+				applySettings();
+				setFields(config);
+			}
+		});
+		panel.add(applyButton);
+
+		return panel;
+	}
+
+	protected void applySettings() {
+		// Include default service providers
+		config.setIncludeDefaults(includeDefaults.isSelected());
+		for (ServiceDescriptionProvider provider : serviceDescRegistry
+				.getDefaultServiceDescriptionProviders()) {
+			if (! (provider instanceof ConfigurableServiceProvider))
+				continue;
+			if (config.isIncludeDefaults())
+				serviceDescRegistry.addServiceDescriptionProvider(provider);
+			else
+				serviceDescRegistry.removeServiceDescriptionProvider(provider);
+		}
+
+		// Allow permanent removal of default service providers
+		config.setRemovePermanently(removePermanently.isSelected());
+	}
+
+	/**
+	 * Set the shown configuration field values to those currently in use
+	 * (i.e. last saved configuration).
+	 *
+	 */
+	private void setFields(ServiceDescriptionsConfiguration configurable) {
+		includeDefaults.setSelected(configurable.isIncludeDefaults());
+		removePermanently.setSelected(configurable.isRemovePermanently());
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-ui/src/main/java/org/apache/taverna/workbench/ui/servicepanel/config/ServiceDescriptionConfigUIFactory.java
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-ui/src/main/java/org/apache/taverna/workbench/ui/servicepanel/config/ServiceDescriptionConfigUIFactory.java b/taverna-activity-palette-ui/src/main/java/org/apache/taverna/workbench/ui/servicepanel/config/ServiceDescriptionConfigUIFactory.java
new file mode 100644
index 0000000..a95b644
--- /dev/null
+++ b/taverna-activity-palette-ui/src/main/java/org/apache/taverna/workbench/ui/servicepanel/config/ServiceDescriptionConfigUIFactory.java
@@ -0,0 +1,56 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.servicepanel.config;
+
+import javax.swing.JPanel;
+
+import uk.org.taverna.configuration.Configurable;
+import uk.org.taverna.configuration.ConfigurationUIFactory;
+
+import org.apache.taverna.servicedescriptions.ServiceDescriptionRegistry;
+import org.apache.taverna.servicedescriptions.ServiceDescriptionsConfiguration;
+
+public class ServiceDescriptionConfigUIFactory implements ConfigurationUIFactory {
+	private ServiceDescriptionsConfiguration serviceDescriptionsConfiguration;
+	private ServiceDescriptionRegistry serviceDescriptionRegistry;
+
+	@Override
+	public boolean canHandle(String uuid) {
+		return uuid.equals(serviceDescriptionsConfiguration.getUUID());
+	}
+
+	@Override
+	public Configurable getConfigurable() {
+		return serviceDescriptionsConfiguration;
+	}
+
+	@Override
+	public JPanel getConfigurationPanel() {
+		return new ServiceDescriptionConfigPanel(serviceDescriptionsConfiguration, serviceDescriptionRegistry);
+	}
+
+	public void setServiceDescriptionRegistry(ServiceDescriptionRegistry serviceDescriptionRegistry) {
+		this.serviceDescriptionRegistry = serviceDescriptionRegistry;
+	}
+
+	public void setServiceDescriptionsConfiguration(ServiceDescriptionsConfiguration serviceDescriptionsConfiguration) {
+		this.serviceDescriptionsConfiguration = serviceDescriptionsConfiguration;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-ui/src/main/java/org/apache/taverna/workbench/ui/servicepanel/menu/AddServiceProviderMenu.java
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-ui/src/main/java/org/apache/taverna/workbench/ui/servicepanel/menu/AddServiceProviderMenu.java b/taverna-activity-palette-ui/src/main/java/org/apache/taverna/workbench/ui/servicepanel/menu/AddServiceProviderMenu.java
new file mode 100644
index 0000000..6ac89e2
--- /dev/null
+++ b/taverna-activity-palette-ui/src/main/java/org/apache/taverna/workbench/ui/servicepanel/menu/AddServiceProviderMenu.java
@@ -0,0 +1,112 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.servicepanel.menu;
+
+import java.awt.Component;
+import java.awt.event.ActionEvent;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+
+import javax.swing.AbstractAction;
+import javax.swing.JButton;
+import javax.swing.JPopupMenu;
+
+import org.apache.taverna.servicedescriptions.ConfigurableServiceProvider;
+import org.apache.taverna.servicedescriptions.ServiceDescription;
+import org.apache.taverna.servicedescriptions.ServiceDescriptionProvider;
+import org.apache.taverna.servicedescriptions.ServiceDescriptionRegistry;
+import org.apache.taverna.workbench.ui.servicepanel.ServicePanel;
+import org.apache.taverna.workbench.ui.servicepanel.actions.AddServiceProviderAction;
+
+/**
+ * A menu that provides a set up menu actions for adding new service providers
+ * to the Service Panel.
+ * <p>
+ * The Actions are discovered from the {@link ServiceDescriptionProvider}s found
+ * through the SPI.
+ *
+ * @author Stuart Owen
+ * @author Stian Soiland-Reyes
+ * @author Alan R Williams
+ *
+ * @see ServiceDescription
+ * @see ServicePanel
+ * @see ServiceDescriptionRegistry#addServiceDescriptionProvider(ServiceDescriptionProvider)
+ */
+@SuppressWarnings("serial")
+public class AddServiceProviderMenu extends JButton {
+	public static class ServiceProviderComparator implements
+			Comparator<ServiceDescriptionProvider> {
+		@Override
+		public int compare(ServiceDescriptionProvider o1,
+				ServiceDescriptionProvider o2) {
+			return o1.getName().toLowerCase().compareTo(
+					o2.getName().toLowerCase());
+		}
+	}
+
+	private final static String ADD_SERVICE_PROVIDER_MENU_NAME = "Import new services";
+
+	private final ServiceDescriptionRegistry serviceDescriptionRegistry;
+
+	public AddServiceProviderMenu(ServiceDescriptionRegistry serviceDescriptionRegistry) {
+		super();
+		this.serviceDescriptionRegistry = serviceDescriptionRegistry;
+
+		final Component c = createCustomComponent();
+		setAction(new AbstractAction(ADD_SERVICE_PROVIDER_MENU_NAME) {
+			@Override
+			public void actionPerformed(ActionEvent e) {
+				((JPopupMenu) c).show(AddServiceProviderMenu.this, 0,
+						AddServiceProviderMenu.this.getHeight());
+			}
+		});
+	}
+
+	private Component createCustomComponent() {
+		JPopupMenu addServiceMenu = new JPopupMenu(
+				ADD_SERVICE_PROVIDER_MENU_NAME);
+		addServiceMenu.setToolTipText("Add a new service provider");
+		boolean isEmpty = true;
+		List<ConfigurableServiceProvider> providers = new ArrayList<>(
+				serviceDescriptionRegistry.getUnconfiguredServiceProviders());
+		Collections.sort(providers,  new ServiceProviderComparator());
+		for (ConfigurableServiceProvider provider : providers) {
+			/*
+			 * Skip BioCatalogue's ConfigurableServiceProviderS as they should
+			 * not be used to add servcie directlry but rather though the
+			 * Service Catalogue perspective
+			 */
+			if (provider.getId().toLowerCase().contains("servicecatalogue"))
+				continue;
+
+			AddServiceProviderAction addAction = new AddServiceProviderAction(
+					provider, this);
+			addAction.setServiceDescriptionRegistry(serviceDescriptionRegistry);
+			addServiceMenu.add(addAction);
+			isEmpty = false;
+		}
+		if (isEmpty)
+			addServiceMenu.setEnabled(false);
+		return addServiceMenu;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-ui/src/main/java/org/apache/taverna/workbench/ui/servicepanel/tree/Filter.java
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-ui/src/main/java/org/apache/taverna/workbench/ui/servicepanel/tree/Filter.java b/taverna-activity-palette-ui/src/main/java/org/apache/taverna/workbench/ui/servicepanel/tree/Filter.java
new file mode 100644
index 0000000..476aa9c
--- /dev/null
+++ b/taverna-activity-palette-ui/src/main/java/org/apache/taverna/workbench/ui/servicepanel/tree/Filter.java
@@ -0,0 +1,32 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.servicepanel.tree;
+
+import javax.swing.tree.DefaultMutableTreeNode;
+
+public interface Filter {
+	boolean pass(DefaultMutableTreeNode node);
+
+	String filterRepresentation(String original);
+
+	void setSuperseded(boolean superseded);
+
+	boolean isSuperseded();
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-ui/src/main/java/org/apache/taverna/workbench/ui/servicepanel/tree/FilterTreeCellRenderer.java
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-ui/src/main/java/org/apache/taverna/workbench/ui/servicepanel/tree/FilterTreeCellRenderer.java b/taverna-activity-palette-ui/src/main/java/org/apache/taverna/workbench/ui/servicepanel/tree/FilterTreeCellRenderer.java
new file mode 100644
index 0000000..ce1f8cd
--- /dev/null
+++ b/taverna-activity-palette-ui/src/main/java/org/apache/taverna/workbench/ui/servicepanel/tree/FilterTreeCellRenderer.java
@@ -0,0 +1,58 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.servicepanel.tree;
+
+import static org.apache.taverna.workbench.icons.WorkbenchIcons.folderClosedIcon;
+import static org.apache.taverna.workbench.icons.WorkbenchIcons.folderOpenIcon;
+
+import java.awt.Component;
+
+import javax.swing.JTree;
+import javax.swing.tree.DefaultTreeCellRenderer;
+
+@SuppressWarnings("serial")
+public class FilterTreeCellRenderer extends DefaultTreeCellRenderer {
+	private Filter filter = null;
+
+	@Override
+	public Component getTreeCellRendererComponent(JTree tree, Object value,
+			boolean sel, boolean expanded, boolean leaf, int row,
+			boolean hasFocus) {
+
+		super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf,
+				row, hasFocus);
+		Filter filter = getFilter();
+		if (filter != null)
+			setText(filter.filterRepresentation(getText()));
+		if (expanded)
+			setIcon(folderOpenIcon);
+		else
+			setIcon(folderClosedIcon);
+		return this;
+	}
+
+	public Filter getFilter() {
+		return filter;
+	}
+
+	public void setFilter(Filter currentFilter) {
+		this.filter = currentFilter;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-ui/src/main/java/org/apache/taverna/workbench/ui/servicepanel/tree/FilterTreeModel.java
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-ui/src/main/java/org/apache/taverna/workbench/ui/servicepanel/tree/FilterTreeModel.java b/taverna-activity-palette-ui/src/main/java/org/apache/taverna/workbench/ui/servicepanel/tree/FilterTreeModel.java
new file mode 100644
index 0000000..e57701e
--- /dev/null
+++ b/taverna-activity-palette-ui/src/main/java/org/apache/taverna/workbench/ui/servicepanel/tree/FilterTreeModel.java
@@ -0,0 +1,91 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.servicepanel.tree;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.swing.tree.DefaultTreeModel;
+import javax.swing.tree.TreePath;
+
+import org.apache.log4j.Logger;
+
+public final class FilterTreeModel extends DefaultTreeModel {
+	private static final long serialVersionUID = -8931308369832839862L;
+	private static final Logger logger = Logger
+			.getLogger(FilterTreeModel.class);
+	
+	Filter currentFilter;
+
+	public FilterTreeModel(FilterTreeNode node) {
+		this(node, null);
+	}
+	
+	public FilterTreeModel(FilterTreeNode node, Filter filter) {
+		super(node);
+		currentFilter = filter;
+		node.setFilter(filter);
+	}
+
+	public void setFilter(Filter filter) {
+		if (root != null) {
+			currentFilter = filter;
+			((FilterTreeNode) root).setFilter(filter);
+			Object[] path = { root };
+			fireTreeStructureChanged(this, path, null, null);
+		}
+	}
+
+	@Override
+	public int getChildCount(Object parent) {
+		if (parent instanceof FilterTreeNode)
+			return (((FilterTreeNode) parent).getChildCount());
+		return 0;
+	}
+
+	@Override
+	public Object getChild(Object parent, int index) {
+		if (parent instanceof FilterTreeNode)
+			return (((FilterTreeNode) parent).getChildAt(index));
+		return null;
+	}
+
+	/**
+	 * @return the currentFilter
+	 */
+	public Filter getCurrentFilter() {
+		return currentFilter;
+	}
+
+	public TreePath getTreePathForObjectPath(List<Object> path) {
+		List<FilterTreeNode> resultList = new ArrayList<>();
+		FilterTreeNode current = (FilterTreeNode) root;
+		resultList.add(current);
+		for (int i = 1; (i < path.size()) && (current != null); i++) {
+			logger.debug("Looking in " + current.getUserObject() + " for " + path.get(i));
+			current = current.getChildForObject(path.get(i));
+			if (current != null)
+				resultList.add(current);
+		}
+		if (current != null)
+			return new TreePath(resultList.toArray());
+		return null;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-ui/src/main/java/org/apache/taverna/workbench/ui/servicepanel/tree/FilterTreeNode.java
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-ui/src/main/java/org/apache/taverna/workbench/ui/servicepanel/tree/FilterTreeNode.java b/taverna-activity-palette-ui/src/main/java/org/apache/taverna/workbench/ui/servicepanel/tree/FilterTreeNode.java
new file mode 100644
index 0000000..9df6423
--- /dev/null
+++ b/taverna-activity-palette-ui/src/main/java/org/apache/taverna/workbench/ui/servicepanel/tree/FilterTreeNode.java
@@ -0,0 +1,141 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.servicepanel.tree;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import javax.swing.tree.DefaultMutableTreeNode;
+
+import org.apache.log4j.Logger;
+
+public class FilterTreeNode extends DefaultMutableTreeNode {
+	private static final long serialVersionUID = 1933553584349932151L;
+	@SuppressWarnings("unused")
+	private static Logger logger = Logger.getLogger(FilterTreeNode.class);
+	
+	private Filter filter;
+	private boolean passed = true;
+	private List<FilterTreeNode> filteredChildren = new ArrayList<>();
+
+	public FilterTreeNode(Object userObject) {
+		super(userObject);
+		userObject.toString();
+	}
+
+	public Filter getFilter() {
+		return filter;
+	}
+	
+	public void setFilter(Filter filter) {
+		if ((filter == null) || !filter.isSuperseded()) {
+			this.filter = filter;
+			passed = false;
+			filteredChildren.clear();
+			if (filter == null) {
+				passed = true;
+				passFilterDown(null);
+			} else if (filter.pass(this)) {
+				passed = true;
+				passFilterDown(null);
+			} else {
+				passFilterDown(filter);
+				passed = filteredChildren.size() != 0;
+			}
+		}
+	}
+
+	private void passFilterDown(Filter filter) {
+		int realChildCount = super.getChildCount();
+		for (int i = 0; i < realChildCount; i++) {
+			FilterTreeNode realChild = (FilterTreeNode) super.getChildAt(i);
+			realChild.setFilter(filter);
+			if (realChild.isPassed())
+				filteredChildren.add(realChild);
+		}
+	}
+
+	public void add(FilterTreeNode node) {
+		super.add(node);
+		node.setFilter(filter);
+		// TODO work up
+		if (node.isPassed())
+			filteredChildren.add(node);
+	}
+	
+	@Override
+	public void remove(int childIndex) {
+		if (filter != null)
+			// as child indexes might be inconsistent..
+			throw new IllegalStateException("Can't remove while the filter is active");
+		super.remove(childIndex);
+	}
+
+	@Override
+	public int getChildCount() {
+		if (filter == null)
+			return super.getChildCount();
+		return filteredChildren.size();
+	}
+
+	@Override
+	public FilterTreeNode getChildAt(int index) {
+		if (filter == null)
+			return (FilterTreeNode) super.getChildAt(index);
+		return filteredChildren.get(index);
+	}
+
+	public boolean isPassed() {
+		return passed;
+	}
+	
+	public Set<FilterTreeNode> getLeaves() {
+		Set<FilterTreeNode> result = new HashSet<>();
+		if (super.getChildCount() == 0) {
+			result.add(this);
+			return result;
+		}
+
+		for (int i = 0; i < super.getChildCount(); i++) {
+			FilterTreeNode child = (FilterTreeNode) super.getChildAt(i);
+			result.addAll(child.getLeaves());
+		}
+		return result;
+	}
+
+	public FilterTreeNode getChildForObject(Object userObject) {
+		FilterTreeNode result = null;
+		for (int i=0; (i < super.getChildCount()) && (result == null); i++) {
+			FilterTreeNode child = (FilterTreeNode) super.getChildAt(i);
+			Object nodeObject = child.getUserObject();
+//			logger.info("nodeObject is a " + nodeObject.getClass() + " - " +
+//					"userObject is a " + userObject.getClass());
+			if (nodeObject.toString().equals(userObject.toString())) {
+				result = child;
+//				logger.info(nodeObject + " is equal to " + userObject);
+//			} else {
+//				logger.info(nodeObject + " is not equal to " + userObject);
+			}
+		}
+		return result;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-ui/src/main/java/org/apache/taverna/workbench/ui/servicepanel/tree/FilterTreeSelectionModel.java
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-ui/src/main/java/org/apache/taverna/workbench/ui/servicepanel/tree/FilterTreeSelectionModel.java b/taverna-activity-palette-ui/src/main/java/org/apache/taverna/workbench/ui/servicepanel/tree/FilterTreeSelectionModel.java
new file mode 100644
index 0000000..c9a1315
--- /dev/null
+++ b/taverna-activity-palette-ui/src/main/java/org/apache/taverna/workbench/ui/servicepanel/tree/FilterTreeSelectionModel.java
@@ -0,0 +1,45 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.servicepanel.tree;
+
+import javax.swing.tree.DefaultTreeSelectionModel;
+import javax.swing.tree.TreePath;
+import javax.swing.tree.TreeSelectionModel;
+
+public class FilterTreeSelectionModel extends DefaultTreeSelectionModel{
+	private static final long serialVersionUID = 3127644524735089630L;
+	
+	public FilterTreeSelectionModel(){
+		super();
+		setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
+	}
+	
+	@Override
+	public void setSelectionPath(TreePath path) {
+		/*
+		 * Nothing happens here - only calls to mySetSelectionPath() will have
+		 * the effect of a node being selected.
+		 */
+	}
+	
+	public void mySetSelectionPath(TreePath path) {
+		super.setSelectionPath(path);
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-ui/src/main/java/org/apache/taverna/workbench/ui/servicepanel/tree/MyFilter.java
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-ui/src/main/java/org/apache/taverna/workbench/ui/servicepanel/tree/MyFilter.java b/taverna-activity-palette-ui/src/main/java/org/apache/taverna/workbench/ui/servicepanel/tree/MyFilter.java
new file mode 100644
index 0000000..9c1a170
--- /dev/null
+++ b/taverna-activity-palette-ui/src/main/java/org/apache/taverna/workbench/ui/servicepanel/tree/MyFilter.java
@@ -0,0 +1,88 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.servicepanel.tree;
+
+import javax.swing.tree.DefaultMutableTreeNode;
+
+public class MyFilter implements Filter {
+	private static final String HTML_MATCH_END = "</font><font color=\"black\">";
+	private static final String HTML_MATCH_START = "</font><font color=\"red\">";
+	private static final String HTML_POSTFIX = "</font></html>";
+	private static final String HTML_PREFIX = "<html><font color=\"black\">";
+
+	private String filterString;
+	private boolean superseded;
+	private String filterLowerCase;
+
+	public MyFilter(String filterString) {
+		this.filterString = filterString;
+		this.filterLowerCase = filterString.toLowerCase();
+		this.superseded = false;
+	}
+
+	private boolean basicFilter(DefaultMutableTreeNode node) {
+		if (filterString.isEmpty())
+			return true;
+		return node.getUserObject().toString().toLowerCase()
+				.contains(filterLowerCase);
+	}
+
+	@Override
+	public boolean pass(DefaultMutableTreeNode node) {
+		return basicFilter(node);
+	}
+
+	@Override
+	public String filterRepresentation(String original) {
+		StringBuilder sb = new StringBuilder(HTML_PREFIX);
+		int from = 0;
+		String originalLowerCase = original.toLowerCase();
+		int index = originalLowerCase.indexOf(filterLowerCase, from);
+		while (index > -1) {
+			sb.append(original.substring(from, index));
+			sb.append(HTML_MATCH_START);
+			sb.append(original.substring(index,
+					index + filterLowerCase.length()));
+			sb.append(HTML_MATCH_END);
+			from = index + filterLowerCase.length();
+			index = originalLowerCase.indexOf(filterLowerCase, from);
+		}
+		if (from < original.length())
+			sb.append(original.substring(from, original.length()));
+		return sb.append(HTML_POSTFIX).toString();
+	}
+
+	/**
+	 * @return the superseded
+	 */
+	@Override
+	public boolean isSuperseded() {
+		return superseded;
+	}
+
+	/**
+	 * @param superseded
+	 *            the superseded to set
+	 */
+	@Override
+	public void setSuperseded(boolean superseded) {
+		this.superseded = superseded;
+	}
+}


[07/51] [partial] incubator-taverna-workbench git commit: all packages are moved to org.apache.taverna.*

Posted by re...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-loop-ui/src/main/java/net/sf/taverna/t2/workbench/loop/LoopConfigureMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-loop-ui/src/main/java/net/sf/taverna/t2/workbench/loop/LoopConfigureMenuAction.java b/taverna-loop-ui/src/main/java/net/sf/taverna/t2/workbench/loop/LoopConfigureMenuAction.java
deleted file mode 100644
index caf77f5..0000000
--- a/taverna-loop-ui/src/main/java/net/sf/taverna/t2/workbench/loop/LoopConfigureMenuAction.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/**********************************************************************
- * 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.workbench.loop;
-
-import java.awt.event.ActionEvent;
-import java.net.URI;
-
-import javax.swing.AbstractAction;
-import javax.swing.Action;
-
-import com.fasterxml.jackson.databind.node.ObjectNode;
-
-import org.apache.taverna.scufl2.api.core.Processor;
-
-import net.sf.taverna.t2.ui.menu.AbstractContextualMenuAction;
-import net.sf.taverna.t2.workbench.edits.EditManager;
-import net.sf.taverna.t2.workbench.file.FileManager;
-
-public class LoopConfigureMenuAction extends AbstractContextualMenuAction {
-
-	public static final URI configureRunningSection = URI
-	.create("http://taverna.sf.net/2009/contextMenu/configureRunning");
-
-	private static final URI LOOP_CONFIGURE_URI = URI
-	.create("http://taverna.sf.net/2008/t2workbench/loopConfigure");
-
-	private static final String LOOP_CONFIGURE = "Loop configure";
-
-	private EditManager editManager;
-
-	private FileManager fileManager;
-
-	public LoopConfigureMenuAction() {
-		super(configureRunningSection, 20, LOOP_CONFIGURE_URI);
-	}
-
-	@SuppressWarnings("serial")
-	@Override
-	protected Action createAction() {
-		return new AbstractAction("Looping...") {
-			public void actionPerformed(ActionEvent e) {
-				Processor p = (Processor) getContextualSelection().getSelection();
-				configureLoopLayer(p, e);
-			}
-		};
-	}
-
-	public void configureLoopLayer(Processor p, ActionEvent e) {
-	    ObjectNode loopLayer = getLoopLayer(p);
-		if (loopLayer != null) {
-			LoopConfigureAction loopConfigureAction = new LoopConfigureAction(null, null, loopLayer, editManager, fileManager);
-			loopConfigureAction.actionPerformed(e);
-		}
-	}
-
-	public static ObjectNode getLoopLayer(Processor p) {
-		for (DispatchLayer dl : p.getDispatchStack().getLayers()) {
-			if (dl instanceof Loop) {
-				result = (Loop) dl;
-				break;
-			}
-		}
-		return result;
-	}
-
-	public boolean isEnabled() {
-		Object selection = getContextualSelection().getSelection();
-		return (super.isEnabled() && (selection instanceof Processor) && (getLoopLayer((Processor)selection) != null));
-	}
-
-	public void setEditManager(EditManager editManager) {
-		this.editManager = editManager;
-	}
-
-	public void setFileManager(FileManager fileManager) {
-		this.fileManager = fileManager;
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-loop-ui/src/main/java/net/sf/taverna/t2/workbench/loop/LoopContextualView.java
----------------------------------------------------------------------
diff --git a/taverna-loop-ui/src/main/java/net/sf/taverna/t2/workbench/loop/LoopContextualView.java b/taverna-loop-ui/src/main/java/net/sf/taverna/t2/workbench/loop/LoopContextualView.java
deleted file mode 100644
index 98223da..0000000
--- a/taverna-loop-ui/src/main/java/net/sf/taverna/t2/workbench/loop/LoopContextualView.java
+++ /dev/null
@@ -1,172 +0,0 @@
-/*******************************************************************************
- * 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.Frame;
-import java.awt.GridBagConstraints;
-import java.awt.GridBagLayout;
-import java.util.Properties;
-
-import javax.swing.Action;
-import javax.swing.JComponent;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-
-import net.sf.taverna.t2.workbench.edits.EditManager;
-import net.sf.taverna.t2.workbench.file.FileManager;
-import net.sf.taverna.t2.workbench.loop.comparisons.Comparison;
-import net.sf.taverna.t2.workbench.ui.views.contextualviews.ContextualView;
-
-import org.apache.log4j.Logger;
-
-import org.apache.taverna.scufl2.api.core.Processor;
-
-/**
- * View of a processor, including it's iteration stack, activities, etc.
- *
- * @author Stian Soiland-Reyes
- *
- */
-public class LoopContextualView extends ContextualView {
-
-	private static final long serialVersionUID = 1L;
-
-	private static Logger logger = Logger.getLogger(LoopContextualView.class);
-
-	private EditManager editManager;
-	private FileManager fileManager;
-
-	private Loop loopLayer;
-
-	private JPanel panel;
-
-	private Processor processor;
-
-	public LoopContextualView(Processor processor, EditManager editManager, FileManager fileManager) {
-		super();
-		this.loopLayer = loopLayer;
-		this.editManager = editManager;
-		this.fileManager = fileManager;
-		this.processor = processor;
-		initialise();
-		initView();
-	}
-
-	@Override
-	public Action getConfigureAction(Frame owner) {
-		return new LoopConfigureAction(owner, this, processor, editManager, fileManager);
-	}
-
-	@Override
-	public void refreshView() {
-		initialise();
-	}
-
-	private void initialise() {
-		if (panel == null) {
-			panel = new JPanel();
-		} else {
-			panel.removeAll();
-		}
-		panel.setLayout(new GridBagLayout());
-		updateUIByConfig();
-	}
-
-	@Override
-	public JComponent getMainFrame() {
-		return panel;
-	}
-
-	@Override
-	public String getViewTitle() {
-		return "Loop of " + processor.getLocalName();
-	}
-
-	protected void updateUIByConfig() {
-		GridBagConstraints gbc = new GridBagConstraints();
-		gbc.gridx = 0;
-		gbc.gridy = 1;
-		gbc.weightx = 0.1;
-		gbc.fill = GridBagConstraints.HORIZONTAL;
-
-		StringBuilder description = new StringBuilder("<html><body>");
-		Properties properties = loopLayer.getConfiguration().getProperties();
-		if (properties.getProperty(ActivityGenerator.COMPARISON,
-				ActivityGenerator.CUSTOM_COMPARISON).equals(
-				ActivityGenerator.CUSTOM_COMPARISON)) {
-			Activity<?> condition = loopLayer.getConfiguration().getCondition();
-			if (condition != null) {
-				description.append("Looping using custom conditional ");
-				if (condition instanceof BeanshellActivity) {
-					String script = ((BeanshellActivity)condition).getConfiguration().getScript();
-					if (script != null) {
-						if (script.length() <= 100) {
-							description.append("<pre>\n");
-							description.append(script);
-							description.append("</pre>\n");
-						}
-					}
-				}
-			} else {
-				description.append("<i>Unconfigured, will not loop</i>");
-			}
-		} else {
-			description.append("The service will be invoked repeatedly ");
-			description.append("until<br> its output <strong>");
-			description.append(properties
-					.getProperty(ActivityGenerator.COMPARE_PORT));
-			description.append("</strong> ");
-
-			Comparison comparison = ActivityGenerator
-					.getComparisonById(properties
-							.getProperty(ActivityGenerator.COMPARISON));
-			description.append(comparison.getName());
-
-			description.append(" the " + comparison.getValueType() + ": <pre>");
-			description.append(properties
-					.getProperty(ActivityGenerator.COMPARE_VALUE));
-			description.append("</pre>");
-
-			String delay = properties.getProperty(ActivityGenerator.DELAY, "");
-			try {
-				if (Double.parseDouble(delay) > 0) {
-					description.append("adding a delay of " + delay
-							+ " seconds between loops.");
-				}
-			} catch (NumberFormatException ex) {
-			}
-		}
-		description.append("</body></html>");
-
-		panel.add(new JLabel(description.toString()), gbc);
-		gbc.gridy++;
-
-		revalidate();
-	}
-
-
-
-	@Override
-	public int getPreferredPosition() {
-		return 400;
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-loop-ui/src/main/java/net/sf/taverna/t2/workbench/loop/LoopContextualViewFactory.java
----------------------------------------------------------------------
diff --git a/taverna-loop-ui/src/main/java/net/sf/taverna/t2/workbench/loop/LoopContextualViewFactory.java b/taverna-loop-ui/src/main/java/net/sf/taverna/t2/workbench/loop/LoopContextualViewFactory.java
deleted file mode 100644
index 7c3451d..0000000
--- a/taverna-loop-ui/src/main/java/net/sf/taverna/t2/workbench/loop/LoopContextualViewFactory.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*******************************************************************************
- * 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.util.Arrays;
-import java.util.List;
-
-import org.apache.taverna.scufl2.api.core.Processor;
-
-import net.sf.taverna.t2.workbench.edits.EditManager;
-import net.sf.taverna.t2.workbench.file.FileManager;
-import net.sf.taverna.t2.workbench.ui.views.contextualviews.ContextualView;
-import net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory;
-
-public class LoopContextualViewFactory implements ContextualViewFactory<Processor> {
-
-	private EditManager editManager;
-	private FileManager fileManager;
-
-	public boolean canHandle(Object selection) {
-		return selection instanceof Processor;
-	}
-
-	public List<ContextualView> getViews(Processor selection) {
-		return Arrays.asList(new ContextualView[] {new LoopContextualView(selection, editManager, fileManager)});
-	}
-
-	public void setEditManager(EditManager editManager) {
-		this.editManager = editManager;
-	}
-
-	public void setFileManager(FileManager fileManager) {
-		this.fileManager = fileManager;
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-loop-ui/src/main/java/net/sf/taverna/t2/workbench/loop/LoopRemoveMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-loop-ui/src/main/java/net/sf/taverna/t2/workbench/loop/LoopRemoveMenuAction.java b/taverna-loop-ui/src/main/java/net/sf/taverna/t2/workbench/loop/LoopRemoveMenuAction.java
deleted file mode 100644
index 24a33bc..0000000
--- a/taverna-loop-ui/src/main/java/net/sf/taverna/t2/workbench/loop/LoopRemoveMenuAction.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/**********************************************************************
- * 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.workbench.loop;
-
-import java.awt.event.ActionEvent;
-import java.net.URI;
-
-import javax.swing.AbstractAction;
-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.file.FileManager;
-
-import org.apache.log4j.Logger;
-
-import org.apache.taverna.scufl2.api.core.Processor;
-
-public class LoopRemoveMenuAction extends AbstractContextualMenuAction {
-
-	private static Logger logger = Logger
-	.getLogger(LoopRemoveMenuAction.class);
-
-	public static final URI configureRunningSection = URI
-	.create("http://taverna.sf.net/2009/contextMenu/configureRunning");
-
-	private static final URI LOOP_REMOVE_URI = URI
-	.create("http://taverna.sf.net/2008/t2workbench/loopRemove");
-
-	private static final String LOOP_REMOVE = "Loop remove";
-
-	public LoopRemoveMenuAction() {
-		super(configureRunningSection, 25, LOOP_REMOVE_URI);
-	}
-
-	private EditManager editManager;
-	private FileManager fileManager;
-
-
-	@SuppressWarnings("serial")
-	@Override
-	protected Action createAction() {
-		return new AbstractAction("Disable looping") {
-			public void actionPerformed(ActionEvent e) {
-				Processor p = (Processor) getContextualSelection().getSelection();
-					Loop loopLayer = LoopConfigureMenuAction.getLoopLayer(p);
-					Edit<DispatchStack> deleteEdit = editManager.getEdits().getDeleteDispatchLayerEdit(
-							p.getDispatchStack(), loopLayer);
-					// TODO: Should warn before removing "essential" layers
-					try {
-						editManager.doDataflowEdit(fileManager.getCurrentDataflow(),
-								deleteEdit);
-					} catch (EditException ex) {
-						logger.warn("Could not remove layer " + loopLayer, ex);
-					}
-
-			}
-		};
-	}
-
-	public boolean isEnabled() {
-		Object selection = getContextualSelection().getSelection();
-		return (super.isEnabled() && (selection instanceof Processor) && (LoopConfigureMenuAction.getLoopLayer((Processor)selection) != null));
-	}
-
-	public void setEditManager(EditManager editManager) {
-		this.editManager = editManager;
-	}
-
-	public void setFileManager(FileManager fileManager) {
-		this.fileManager = fileManager;
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-loop-ui/src/main/java/net/sf/taverna/t2/workbench/loop/comparisons/Comparison.java
----------------------------------------------------------------------
diff --git a/taverna-loop-ui/src/main/java/net/sf/taverna/t2/workbench/loop/comparisons/Comparison.java b/taverna-loop-ui/src/main/java/net/sf/taverna/t2/workbench/loop/comparisons/Comparison.java
deleted file mode 100644
index 608030c..0000000
--- a/taverna-loop-ui/src/main/java/net/sf/taverna/t2/workbench/loop/comparisons/Comparison.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * 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;
-
-import net.sf.taverna.t2.workbench.loop.LoopConfigurationPanel;
-
-/**
- * A comparison beanshell template for {@link LoopConfigurationPanel}.
- * <p>
- * A comparison is a template for generating a beanshell that can be used for
- * comparisons in say the {@link Loop} layer.
- * 
- * @author Stian Soiland-Reyes
- * 
- */
-public abstract class Comparison {
-
-	public String toString() {
-		return getName();
-	}
-
-	public abstract String getId();
-
-	public abstract String getName();
-
-	public abstract String getValueType();
-
-	public abstract String getScriptTemplate();
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-loop-ui/src/main/java/net/sf/taverna/t2/workbench/loop/comparisons/EqualTo.java
----------------------------------------------------------------------
diff --git a/taverna-loop-ui/src/main/java/net/sf/taverna/t2/workbench/loop/comparisons/EqualTo.java b/taverna-loop-ui/src/main/java/net/sf/taverna/t2/workbench/loop/comparisons/EqualTo.java
deleted file mode 100644
index dbfb8f5..0000000
--- a/taverna-loop-ui/src/main/java/net/sf/taverna/t2/workbench/loop/comparisons/EqualTo.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * 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 EqualTo extends Comparison {
-
-	public String getId() {
-		return "EqualTo";
-	}
-
-	public String getName() {
-		return "is equal to";
-	}
-
-	public String getScriptTemplate() {
-		return "${loopPort} = \"\" + ! ${port}.equals(${value}); ";
-	}
-
-	public String getValueType() {
-		return "string";
-	}
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-loop-ui/src/main/java/net/sf/taverna/t2/workbench/loop/comparisons/IsGreaterThan.java
----------------------------------------------------------------------
diff --git a/taverna-loop-ui/src/main/java/net/sf/taverna/t2/workbench/loop/comparisons/IsGreaterThan.java b/taverna-loop-ui/src/main/java/net/sf/taverna/t2/workbench/loop/comparisons/IsGreaterThan.java
deleted file mode 100644
index fc6f56b..0000000
--- a/taverna-loop-ui/src/main/java/net/sf/taverna/t2/workbench/loop/comparisons/IsGreaterThan.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * 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 IsGreaterThan extends Comparison {
-
-	public String getId() {
-		return "IsGreaterThan";
-	}
-
-	public String getName() {
-		return "is greater than";
-	}
-
-	public String getScriptTemplate() {
-		return "${loopPort} = \"\" + (! (Double.parseDouble(${port}) > Double.parseDouble(${value})));";
-	}
-
-	public String getValueType() {
-		return "number";
-	}
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-loop-ui/src/main/java/net/sf/taverna/t2/workbench/loop/comparisons/IsLessThan.java
----------------------------------------------------------------------
diff --git a/taverna-loop-ui/src/main/java/net/sf/taverna/t2/workbench/loop/comparisons/IsLessThan.java b/taverna-loop-ui/src/main/java/net/sf/taverna/t2/workbench/loop/comparisons/IsLessThan.java
deleted file mode 100644
index d5fe38c..0000000
--- a/taverna-loop-ui/src/main/java/net/sf/taverna/t2/workbench/loop/comparisons/IsLessThan.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * 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 IsLessThan extends Comparison {
-
-	public String getId() {
-		return "IsLessThan";
-	}
-
-	public String getName() {
-		return "is less than";
-	}
-
-	public String getScriptTemplate() {
-		return "${loopPort} = \"\" + (! (Double.parseDouble(${port}) < Double.parseDouble(${value})));";
-	}
-
-	public String getValueType() {
-		return "number";
-	}
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-loop-ui/src/main/java/net/sf/taverna/t2/workbench/loop/comparisons/Matches.java
----------------------------------------------------------------------
diff --git a/taverna-loop-ui/src/main/java/net/sf/taverna/t2/workbench/loop/comparisons/Matches.java b/taverna-loop-ui/src/main/java/net/sf/taverna/t2/workbench/loop/comparisons/Matches.java
deleted file mode 100644
index fa84aeb..0000000
--- a/taverna-loop-ui/src/main/java/net/sf/taverna/t2/workbench/loop/comparisons/Matches.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * 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 Matches extends Comparison {
-
-	public String getId() {
-		return "Matches";
-	}
-
-	public String getName() {
-		return "matches";
-	}
-
-	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/a9a52bd5/taverna-loop-ui/src/main/java/net/sf/taverna/t2/workbench/loop/comparisons/NotEqualTo.java
----------------------------------------------------------------------
diff --git a/taverna-loop-ui/src/main/java/net/sf/taverna/t2/workbench/loop/comparisons/NotEqualTo.java b/taverna-loop-ui/src/main/java/net/sf/taverna/t2/workbench/loop/comparisons/NotEqualTo.java
deleted file mode 100644
index 9c73835..0000000
--- a/taverna-loop-ui/src/main/java/net/sf/taverna/t2/workbench/loop/comparisons/NotEqualTo.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * 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 NotEqualTo extends Comparison {
-
-	public String getId() {
-		return "NotEqualTo";
-	}
-
-	public String getName() {
-		return "is not equal to";
-	}
-
-	public String getScriptTemplate() {
-		return "${loopPort} = \"\" + ${port}.equals(${value});";
-	}
-
-	public String getValueType() {
-		return "string";
-	}
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/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
deleted file mode 100644
index 803d5d7..0000000
--- a/taverna-loop-ui/src/main/java/net/sf/taverna/t2/workbench/loop/comparisons/NotMatches.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * 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/a9a52bd5/taverna-loop-ui/src/main/java/org/apache/taverna/workbench/loop/ActivityGenerator.java
----------------------------------------------------------------------
diff --git a/taverna-loop-ui/src/main/java/org/apache/taverna/workbench/loop/ActivityGenerator.java b/taverna-loop-ui/src/main/java/org/apache/taverna/workbench/loop/ActivityGenerator.java
new file mode 100644
index 0000000..1239a2a
--- /dev/null
+++ b/taverna-loop-ui/src/main/java/org/apache/taverna/workbench/loop/ActivityGenerator.java
@@ -0,0 +1,194 @@
+/*******************************************************************************
+ * 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 org.apache.taverna.workbench.loop;
+
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+import java.util.Map.Entry;
+
+import org.apache.taverna.workbench.loop.comparisons.Comparison;
+import org.apache.taverna.workbench.loop.comparisons.EqualTo;
+import org.apache.taverna.workbench.loop.comparisons.IsGreaterThan;
+import org.apache.taverna.workbench.loop.comparisons.IsLessThan;
+import org.apache.taverna.workbench.loop.comparisons.Matches;
+import org.apache.taverna.workbench.loop.comparisons.NotEqualTo;
+import org.apache.taverna.workbench.loop.comparisons.NotMatches;
+
+import org.apache.log4j.Logger;
+
+import org.apache.taverna.scufl2.api.activity.Activity;
+import org.apache.taverna.scufl2.api.common.Scufl2Tools;
+import org.apache.taverna.scufl2.api.configurations.Configuration;
+import org.apache.taverna.scufl2.api.core.Processor;
+import org.apache.taverna.scufl2.api.port.InputActivityPort;
+import org.apache.taverna.scufl2.api.port.InputProcessorPort;
+import org.apache.taverna.scufl2.api.port.OutputActivityPort;
+import org.apache.taverna.scufl2.api.port.OutputProcessorPort;
+
+import com.fasterxml.jackson.databind.node.ObjectNode;
+
+public class ActivityGenerator {
+
+    private static final String LOOP_PORT = "loop";
+
+    private static final String SCRIPT = "script";
+
+    public static URI BEANSHELL_ACTIVITY = URI
+            .create("http://ns.taverna.org.uk/2010/activity/beanshell");
+
+    public static URI BEANSHELL_CONFIG = BEANSHELL_ACTIVITY.resolve("#Config");
+
+    
+	public static final double DEFAULT_DELAY_S = 0.2;
+	public static final String COMPARE_PORT = "comparePort";
+	public static final String COMPARISON = "comparison";
+	public static final String CUSTOM_COMPARISON = "custom";
+	public static final String COMPARE_VALUE = "compareValue";
+	public static final String IS_FEED_BACK = "isFeedBack";
+	public static final String DELAY = "delay";
+
+	private static Logger logger = Logger.getLogger(ActivityGenerator.class);
+	private final ObjectNode loopProperties;
+	private final Processor processorToCompare;
+	private static Scufl2Tools scufl2Tools = new Scufl2Tools();
+
+	public ActivityGenerator(ObjectNode configuration,
+			Processor processorToCompare) {
+		this.loopProperties = configuration;
+		this.processorToCompare = processorToCompare;
+	}
+
+	protected Activity generateActivity() {
+		Activity beanshell = new Activity();
+		beanshell.setType(BEANSHELL_ACTIVITY);
+		Configuration config = generateBeanshellConfig(beanshell);
+		// TODO: Where to put the config?
+		return beanshell;
+	}
+
+	private Configuration generateBeanshellConfig(Activity beanshell) {
+	    Configuration config = scufl2Tools.createConfigurationFor(beanshell, BEANSHELL_CONFIG);
+	    generateInputPorts(beanshell);
+	    generateOutputPorts(beanshell);
+	    config.getJsonAsObjectNode().put(SCRIPT, generateScript());
+		return config;
+	}
+
+	protected static List<Comparison> comparisons = Arrays.asList(
+			new EqualTo(), new NotEqualTo(), new Matches(), new NotMatches(),
+			new IsGreaterThan(), new IsLessThan());
+
+	protected static Comparison getComparisonById(String id) {
+	    if (id == null || id.isEmpty()) {
+	        return comparisons.get(0);
+	    }
+		for (Comparison potentialComparison : comparisons) {
+			if (potentialComparison.getId().equals(id)) {
+				return potentialComparison;
+			}
+		}
+		return null;
+	}
+
+	@SuppressWarnings("boxing")
+	private String generateScript() {
+		Map<String, String> replacements = new HashMap<String, String>();
+		replacements.put("${loopPort}", LOOP_PORT);
+		replacements.put("${port}", loopProperties.findValue(COMPARE_PORT).asText());
+		replacements.put("${value}", beanshellString(loopProperties
+				.findValue(COMPARE_VALUE).asText()));
+
+
+		// as seconds
+		Double delay = loopProperties.findPath(DELAY).asDouble(DEFAULT_DELAY_S);
+		// as milliseconds
+		delay = Math.max(0.0, delay) * 1000;
+		// as integer (for Thread.sleep)
+		replacements.put("${delay}", Integer.toString(delay.intValue()));
+
+		String template = getComparisonById(
+				loopProperties.findValue(COMPARISON).asText()).getScriptTemplate();
+
+		if (delay > 0.0) {
+    		template += "\nif (\"true\".matches(${loopPort})) {\n";
+    		template += "   Thread.sleep(${delay});\n";
+    		template += "}";
+		}
+
+		String script = template;
+		for (Entry<String, String> mapping : replacements.entrySet()) {
+			script = script.replace(mapping.getKey(), mapping.getValue());
+		}
+		return script;
+	}
+
+	private String beanshellString(String value) {
+		value = value.replace("\\", "\\\\");
+		value = value.replace("\n", "\\n");
+		value = value.replace("\"", "\\\"");
+		return '"' + value + '"';
+	}
+
+	private void generateInputPorts(Activity beanshell) {
+		if (processorToCompare == null) {
+		    return;
+		}
+		for (OutputProcessorPort procOut : processorToCompare.getOutputPorts()) {
+		    // Any of the outputs are available to the script, giving
+		    // a custom script that compares multiple outputs a better
+		    // starting point.
+			String portName = procOut.getName();
+			if (portName.equals(loopProperties.findValue(COMPARE_PORT).asText()) ||
+			        (loopProperties.findValue(IS_FEED_BACK).asBoolean())) {
+				InputActivityPort input = new InputActivityPort(beanshell, portName);
+				input.setDepth(procOut.getDepth());
+				input.setParent(beanshell);
+			}
+		}
+	}
+
+	private void generateOutputPorts(Activity beanshell) {
+	       OutputActivityPort loopPort = new OutputActivityPort(beanshell, LOOP_PORT);
+	        loopPort.setDepth(0);
+	        loopPort.setGranularDepth(0);
+	    if (processorToCompare == null) {
+            return;
+	    }	    
+	    if (! loopProperties.findValue(IS_FEED_BACK).asBoolean()) {
+           return;
+	    }
+	    for (InputProcessorPort procIn : processorToCompare.getInputPorts()) {
+            String portName = procIn.getName();
+            if (processorToCompare.getOutputPorts().containsName(portName)) {
+                OutputActivityPort actOut = new OutputActivityPort(beanshell, portName);
+                actOut.setDepth(procIn.getDepth());
+                actOut.setGranularDepth(procIn.getDepth());
+            }
+	    }
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-loop-ui/src/main/java/org/apache/taverna/workbench/loop/AddLoopFactory.java
----------------------------------------------------------------------
diff --git a/taverna-loop-ui/src/main/java/org/apache/taverna/workbench/loop/AddLoopFactory.java b/taverna-loop-ui/src/main/java/org/apache/taverna/workbench/loop/AddLoopFactory.java
new file mode 100644
index 0000000..087cba2
--- /dev/null
+++ b/taverna-loop-ui/src/main/java/org/apache/taverna/workbench/loop/AddLoopFactory.java
@@ -0,0 +1,125 @@
+/*******************************************************************************
+ * 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 org.apache.taverna.workbench.loop;
+
+import java.awt.event.ActionEvent;
+import java.net.URI;
+import java.util.List;
+
+import javax.swing.AbstractAction;
+import javax.swing.Action;
+
+import org.apache.taverna.workbench.MainWindow;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.file.FileManager;
+import org.apache.taverna.workbench.selection.SelectionManager;
+import org.apache.taverna.workbench.ui.views.contextualviews.AddLayerFactorySPI;
+
+import org.apache.log4j.Logger;
+
+import uk.org.taverna.configuration.app.ApplicationConfiguration;
+import org.apache.taverna.scufl2.api.common.Scufl2Tools;
+import org.apache.taverna.scufl2.api.configurations.Configuration;
+import org.apache.taverna.scufl2.api.core.Processor;
+
+import com.fasterxml.jackson.databind.node.JsonNodeFactory;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+
+public class AddLoopFactory implements AddLayerFactorySPI {
+
+    private static final URI LOOP_TYPE = URI.create("http://ns.taverna.org.uk/2010/scufl2/taverna/dispatchlayer/Loop");
+
+    
+    private static Logger logger = Logger.getLogger(AddLoopFactory.class);
+    private static final JsonNodeFactory JSON_NODE_FACTORY = JsonNodeFactory.instance;
+    private static Scufl2Tools scufl2Tools = new Scufl2Tools();
+    
+	private EditManager editManager;
+	private FileManager fileManager;
+	private SelectionManager selectionManager;
+	private ApplicationConfiguration applicationConfig;
+
+	public boolean canAddLayerFor(Processor processor) {
+	   return findLoopLayer(processor) == null;
+	}
+
+
+    public ObjectNode findLoopLayer(Processor processor) {
+        List<Configuration> configs = scufl2Tools.configurationsFor(processor, selectionManager.getSelectedProfile());
+        for (Configuration config : configs) {
+            if (config.getJson().has("loop")) {
+                return (ObjectNode) config.getJson().get("loop");
+            }
+        }
+        return null;
+    }
+	
+	@SuppressWarnings("serial")
+	public Action getAddLayerActionFor(final Processor processor) {
+		return new AbstractAction("Add looping") {
+
+            public void actionPerformed(ActionEvent e) {
+				    ObjectNode loopLayer = findLoopLayer(processor);
+				    if (loopLayer == null) {
+				        loopLayer = JSON_NODE_FACTORY.objectNode();
+				    }
+					// Pop up the configure loop dialog
+                LoopConfigureAction loopConfigureAction = new LoopConfigureAction(
+                        MainWindow.getMainWindow(), null, processor, loopLayer,
+                        selectionManager.getSelectedProfile(), editManager,
+                        fileManager, getApplicationConfig());
+					loopConfigureAction.actionPerformed(e);
+			}
+		};
+	}
+
+	@Override
+	public boolean canCreateLayerClass(URI dispatchLayerType) {
+	    return dispatchLayerType.equals(LOOP_TYPE);
+	}
+
+	public void setEditManager(EditManager editManager) {
+		this.editManager = editManager;
+	}
+
+	public void setFileManager(FileManager fileManager) {
+		this.fileManager = fileManager;
+	}
+
+    public SelectionManager getSelectionManager() {
+        return selectionManager;
+    }
+
+    public void setSelectionManager(SelectionManager selectionManager) {
+        this.selectionManager = selectionManager;
+    }
+
+
+    public ApplicationConfiguration getApplicationConfig() {
+        return applicationConfig;
+    }
+
+
+    public void setApplicationConfig(ApplicationConfiguration applicationConfig) {
+        this.applicationConfig = applicationConfig;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-loop-ui/src/main/java/org/apache/taverna/workbench/loop/LoopAddMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-loop-ui/src/main/java/org/apache/taverna/workbench/loop/LoopAddMenuAction.java b/taverna-loop-ui/src/main/java/org/apache/taverna/workbench/loop/LoopAddMenuAction.java
new file mode 100644
index 0000000..571bc8d
--- /dev/null
+++ b/taverna-loop-ui/src/main/java/org/apache/taverna/workbench/loop/LoopAddMenuAction.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 org.apache.taverna.workbench.loop;
+
+import java.awt.event.ActionEvent;
+import java.net.URI;
+
+import javax.swing.AbstractAction;
+import javax.swing.Action;
+
+import org.apache.taverna.scufl2.api.core.Processor;
+
+import org.apache.taverna.ui.menu.AbstractContextualMenuAction;
+
+public class LoopAddMenuAction extends AbstractContextualMenuAction {
+
+	public static final URI configureRunningSection = URI
+	.create("http://taverna.sf.net/2009/contextMenu/configureRunning");
+
+	private static final URI LOOP_ADD_URI = URI
+	.create("http://taverna.sf.net/2008/t2workbench/loopAdd");
+
+	private static final String LOOP_ADD = "Loop add";
+
+	public LoopAddMenuAction() {
+		super(configureRunningSection, 20, LOOP_ADD_URI);
+	}
+
+	private AddLoopFactory addLoopFactory;
+
+	@SuppressWarnings("serial")
+	@Override
+	protected Action createAction() {
+		return new AbstractAction("Looping...") {
+			public void actionPerformed(ActionEvent e) {
+				//Loop loopLayer = null;
+				Processor p = (Processor) getContextualSelection().getSelection();
+				addLoopFactory.getAddLayerActionFor(p).actionPerformed(e);
+				//LoopConfigureMenuAction.configureLoopLayer(p, e); // Configuration dialog pop up is now done from getAddLayerActionFor()
+			}
+		};
+	}
+
+	public boolean isEnabled() {
+		Object selection = getContextualSelection().getSelection();
+		return (super.isEnabled() && (selection instanceof Processor) && (LoopConfigureMenuAction.getLoopLayer((Processor)selection) == null));
+	}
+
+	public void setAddLoopFactory(AddLoopFactory addLoopFactory) {
+		this.addLoopFactory = addLoopFactory;
+	}
+
+
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-loop-ui/src/main/java/org/apache/taverna/workbench/loop/LoopConfigurationPanel.java
----------------------------------------------------------------------
diff --git a/taverna-loop-ui/src/main/java/org/apache/taverna/workbench/loop/LoopConfigurationPanel.java b/taverna-loop-ui/src/main/java/org/apache/taverna/workbench/loop/LoopConfigurationPanel.java
new file mode 100644
index 0000000..f9d768a
--- /dev/null
+++ b/taverna-loop-ui/src/main/java/org/apache/taverna/workbench/loop/LoopConfigurationPanel.java
@@ -0,0 +1,588 @@
+/*******************************************************************************
+ * 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 org.apache.taverna.workbench.loop;
+
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.FlowLayout;
+import java.awt.Frame;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.Insets;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Properties;
+
+import javax.swing.AbstractAction;
+import javax.swing.Box;
+import javax.swing.JButton;
+import javax.swing.JCheckBox;
+import javax.swing.JComboBox;
+import javax.swing.JDialog;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JTextField;
+import javax.swing.SwingConstants;
+import javax.swing.border.EmptyBorder;
+
+import net.sf.taverna.t2.activities.beanshell.views.BeanshellConfigurationPanel;
+import org.apache.taverna.workbench.helper.HelpEnabledDialog;
+import org.apache.taverna.workbench.loop.comparisons.Comparison;
+import org.apache.taverna.workbench.ui.Utils;
+
+import org.apache.log4j.Logger;
+
+import uk.org.taverna.configuration.app.ApplicationConfiguration;
+import org.apache.taverna.scufl2.api.activity.Activity;
+import org.apache.taverna.scufl2.api.common.Scufl2Tools;
+import org.apache.taverna.scufl2.api.configurations.Configuration;
+import org.apache.taverna.scufl2.api.core.Processor;
+import org.apache.taverna.scufl2.api.profiles.Profile;
+
+import com.fasterxml.jackson.databind.node.ObjectNode;
+
+/**
+ * UI for {@link LoopConfiguration}
+ *
+ * @author Stian Soiland-Reyes
+ *
+ */
+@SuppressWarnings("serial")
+public class LoopConfigurationPanel extends JPanel {
+
+	private static final String CONDITION_ACTIVITY = "conditionActivity";
+    private static final String DEFAULT_DELAY_S = "0.5";
+	protected ObjectNode configuration;
+
+	private static final Scufl2Tools scufl2tools = new Scufl2Tools();
+	private ApplicationConfiguration applicationConfig;
+
+	
+	protected final Processor processor;
+
+	protected JPanel headerPanel = new JPanel();
+	protected JPanel optionsPanel = new JPanel();
+	protected JPanel configPanel = new JPanel();
+	protected JPanel customPanel = new JPanel();
+
+	protected JLabel valueTypeLabel = new JLabel("the string");
+
+	protected JTextField valueField = new JTextField("", 15);
+
+	protected JLabel delayLabel = new JLabel("adding a delay of ");
+	protected JTextField delayField = new JTextField(
+			Double.toString(ActivityGenerator.DEFAULT_DELAY_S), 4);
+	protected JLabel secondsLabel = new JLabel(" seconds between the loops.");
+
+	private JComboBox<String> portCombo;
+	private JComboBox<Comparison> comparisonCombo;
+	private JButton customizeButton;
+
+	protected ObjectNode loopLayer;
+	private Object Comparison;
+	private Activity originalCondition = null;
+    private Profile profile;
+
+    public LoopConfigurationPanel(Processor processor, ObjectNode loopLayer,
+            Profile profile, ApplicationConfiguration applicationConfig) {
+		this.processor = processor;
+		this.loopLayer = loopLayer;
+        this.profile = profile;
+        this.applicationConfig = applicationConfig;
+		this.setBorder(new EmptyBorder(10,10,10,10));
+		initialise();
+		setConfiguration(loopLayer);
+	}
+
+	public ObjectNode getConfiguration() {
+		uiToConfig();
+		return loopLayer.deepCopy();
+	}
+
+	private static Logger logger = Logger
+			.getLogger(LoopConfigurationPanel.class);
+
+	protected void uiToConfig() {
+	    String comparisonStr = configuration.path(ActivityGenerator.COMPARISON).asText();
+	    if (comparisonStr.isEmpty()) {
+	        comparisonStr = ActivityGenerator.CUSTOM_COMPARISON;
+	    }
+		if (comparisonStr.equals(ActivityGenerator.CUSTOM_COMPARISON)
+				&& ! configuration.path(CONDITION_ACTIVITY).asText().isEmpty()) {
+			// Ignore values
+		} else {
+		    configuration.put("runFirst", true);
+			if (portCombo.getSelectedItem() == null) {
+			    // unconfigured port
+				configuration.remove(ActivityGenerator.COMPARE_PORT);
+				configuration.putNull(CONDITION_ACTIVITY);
+				return;
+			} else {
+				configuration.put(ActivityGenerator.COMPARE_PORT,
+						((String) portCombo.getSelectedItem()));
+			}
+
+			Comparison comparison = (Comparison) comparisonCombo
+					.getSelectedItem();
+			if (comparison == null) {
+				configuration.remove(ActivityGenerator.COMPARISON);
+				configuration.putNull(CONDITION_ACTIVITY);
+				return;
+			} else {
+				configuration
+						.put(ActivityGenerator.COMPARISON, comparison.getId());
+			}
+			configuration.put(ActivityGenerator.COMPARE_VALUE, valueField
+					.getText());
+			configuration.put(ActivityGenerator.DELAY, Double.parseDouble(delayField.getText()));
+			configuration.put(ActivityGenerator.IS_FEED_BACK, feedBackCheck.isSelected());
+
+			// Generate activity
+			ActivityGenerator activityGenerator = new ActivityGenerator(
+					configuration, processor);
+			configuration.put(CONDITION_ACTIVITY, activityGenerator.generateActivity().getName());
+		}
+	}
+
+	public class ResetAction extends AbstractAction {
+		public ResetAction() {
+			super("Clear");
+		}
+
+		public void actionPerformed(ActionEvent e) {
+			configuration.putNull(CONDITION_ACTIVITY);
+			configToUi();
+		}
+	}
+
+	private final class CustomizeAction implements ActionListener {
+
+
+//		public CustomizeAction() {
+//			super();
+//			//putValue(NAME, "Customise loop condition");
+//		}
+
+		public void actionPerformed(ActionEvent e) {
+			uiToConfig();
+
+			String conditionName = configuration.path(CONDITION_ACTIVITY).asText();
+			
+			Activity condition = profile.getActivities().getByName(conditionName);
+			if (condition == null) {
+			    condition = new Activity();
+			    profile.getActivities().add(condition);
+			    configuration.put(CONDITION_ACTIVITY, condition.getName());
+			    condition.setType(ActivityGenerator.BEANSHELL_ACTIVITY);
+			    Configuration config = scufl2tools.createConfigurationFor(condition, ActivityGenerator.BEANSHELL_CONFIG);
+			} else if (!(condition.getType().equals(ActivityGenerator.BEANSHELL_ACTIVITY))) {
+				logger.warn("Can't configure unsupported loop condition of service type "
+						+ condition.getType());
+				return;
+			}
+
+			Frame owner = Utils.getParentFrame(LoopConfigurationPanel.this);
+			
+			
+            final BeanshellConfigurationPanel beanshellConfigView = new BeanshellConfigurationPanel(
+                    condition, applicationConfig);
+			
+			final JDialog dialog = new HelpEnabledDialog(owner, "Customize looping", true);
+			dialog.setLayout(new BorderLayout());
+			dialog.add(beanshellConfigView, BorderLayout.NORTH);
+			dialog.setSize(600, 600);
+			JPanel buttonPanel = new JPanel();
+
+			buttonPanel.setLayout(new FlowLayout(FlowLayout.RIGHT));
+
+			JButton applyButton = new JButton(new AbstractAction() {
+
+				public void actionPerformed(ActionEvent e) {
+					if (beanshellConfigView.isConfigurationChanged()) {
+						beanshellConfigView.noteConfiguration();
+//							beanshellActivity.configure(beanshellConfigView
+//									.getConfiguration());
+//							configuration.setCondition(beanshellActivity);
+						Configuration config = beanshellConfigView.getConfiguration();
+						// TODO: Do we need to store this somehow?
+						configuration.put(
+								ActivityGenerator.COMPARISON,
+								ActivityGenerator.CUSTOM_COMPARISON);
+					}
+					dialog.setVisible(false);
+					configToUi();
+				}
+
+			});
+			applyButton.setText("Apply");
+
+			buttonPanel.add(applyButton);
+			JButton closeButton = new JButton(new AbstractAction() {
+
+				public void actionPerformed(ActionEvent e) {
+					dialog.setVisible(false);
+				}
+			});
+			closeButton.setText("Cancel");
+			buttonPanel.add(closeButton);
+			dialog.add(buttonPanel, BorderLayout.SOUTH);
+			dialog.setLocationRelativeTo(customizeButton);
+			dialog.setVisible(true);
+
+		}
+	}
+
+	public void setConfiguration(ObjectNode configuration) {
+		this.configuration = configuration.deepCopy();
+		configToUi();
+	}
+
+	protected void configToUi() {
+		
+
+		String comparisonId;
+		
+		if (configuration.has(ActivityGenerator.COMPARISON)) {
+            comparisonId = configuration.get(ActivityGenerator.COMPARISON)
+                    .asText();
+		} else {
+            comparisonId = ActivityGenerator.CUSTOM_COMPARISON;
+		}
+
+		if (comparisonId.equals(ActivityGenerator.CUSTOM_COMPARISON)
+				&& configuration.has("conditionalActivity")) {
+			configPanel.setVisible(false);
+			customPanel.setVisible(true);
+		} else {
+			configPanel.setVisible(true);
+			customPanel.setVisible(false);
+		}
+
+		portCombo.setSelectedItem(configuration.get(ActivityGenerator.COMPARE_PORT).asText());
+		if (portCombo.getSelectedIndex() == -1
+				&& portCombo.getModel().getSize() > 0) {
+			portCombo.setSelectedIndex(0);
+		}
+
+		Comparison comparison = ActivityGenerator
+				.getComparisonById(comparisonId);
+		comparisonCombo.setSelectedItem(comparison);
+		if (comparisonCombo.getSelectedIndex() == -1
+				&& comparisonCombo.getModel().getSize() > 0) {
+			comparisonCombo.setSelectedIndex(0);
+		}
+
+		valueField.setText(configuration.get(ActivityGenerator.COMPARE_VALUE).asText());
+
+		if (configuration.has(ActivityGenerator.DELAY)) {
+		    delayField.setText(configuration.get(ActivityGenerator.DELAY).asText());
+		} else {
+		    delayField.setText(DEFAULT_DELAY_S);
+		}
+
+		feedBackCheck.setSelected(configuration.get(ActivityGenerator.IS_FEED_BACK).asBoolean());
+		updateFeedbackHelp();
+	}
+
+	private void initialise() {
+		removeAll();
+		setLayout(new GridBagLayout());
+		GridBagConstraints gbc = new GridBagConstraints();
+		gbc.fill = GridBagConstraints.HORIZONTAL;
+		gbc.anchor = GridBagConstraints.FIRST_LINE_START;
+		gbc.gridx = 0;
+		gbc.weightx = 0.1;
+
+		makeHeader();
+		add(headerPanel, gbc);
+
+		makeConfigPanel();
+		gbc.weighty = 0.1;
+		gbc.anchor = GridBagConstraints.CENTER;
+		gbc.fill = GridBagConstraints.BOTH;
+		add(configPanel, gbc);
+
+		makeCustomPanel();
+		add(customPanel, gbc);
+
+		makeOptions();
+		add(optionsPanel, gbc);
+	}
+
+	protected void makeCustomPanel() {
+		customPanel.removeAll();
+		customPanel.setLayout(new GridBagLayout());
+
+		GridBagConstraints gbc = new GridBagConstraints();
+		gbc.anchor = GridBagConstraints.LINE_START;
+		gbc.gridx = 0;
+		gbc.gridy = 0;
+		gbc.gridwidth = 2;
+		gbc.weightx = 0.1;
+		gbc.fill = GridBagConstraints.HORIZONTAL;
+
+		JLabel helpLabel = new JLabel(
+				"<html><body>"
+						+ "The service <strong>" + processor.getName() +  "</strong> will be "
+						+ "invoked repeatedly as "
+						+ "long as the <em>customized loop condition service</em> returns a string equal "
+						+ "to <strong>\"true\"</strong> on its output port <code>loop</code>."
+//						+ "<br><br>"
+//						+ "Input ports of the condition service will be populated with values from "
+//						+ "the <em>corresponding output ports</em> of the main service invocation "
+//						+ "(as long as they are also "
+//						+ "<strong>connected</strong> in the containing workflow)."
+//						+ "<br><br> "
+//
+//						+ "Any <em>matching "
+//						+ "output ports</em> from the condition service will provide the corresponding "
+//						+ "<em>inputs</em> to the main service while looping. You will need to connect "
+//						+ "the <em>initial inputs</em> in the containing workflow."
+						+ "</body></html>");
+		customPanel.add(helpLabel, gbc);
+
+		gbc.weightx = 0.1;
+		gbc.fill = GridBagConstraints.NONE;
+		gbc.gridx = 0;
+		gbc.gridy++;
+		gbc.gridwidth = 1;
+		gbc.anchor = GridBagConstraints.EAST;
+		JPanel customiseButtonPanel = new JPanel(new FlowLayout());
+		customiseButtonPanel.setBorder(new EmptyBorder(10,0,0,0));
+		customizeButton = new JButton("Customize loop condition");
+		customizeButton.addActionListener(new CustomizeAction());
+		customiseButtonPanel.add(customizeButton);
+		customiseButtonPanel.add(new JButton(new ResetAction()));
+		customPanel.add(customiseButtonPanel, gbc);
+
+	}
+
+	protected void makeConfigPanel() {
+		configPanel.removeAll();
+		configPanel.setLayout(new GridBagLayout());
+
+		GridBagConstraints gbc = new GridBagConstraints();
+		gbc.anchor = GridBagConstraints.LINE_START;
+		gbc.gridx = 0;
+		gbc.gridy = 0;
+		gbc.gridwidth = 4;
+		gbc.weightx = 0.1;
+		gbc.fill = GridBagConstraints.HORIZONTAL;
+		JLabel invokedRepeatedlyLabel = new JLabel(
+
+				"<html><body>The service <strong>" + processor.getName() +  "</strong> " +
+						"will be invoked repeatedly <em>until</em> its output port</body></html>");
+		invokedRepeatedlyLabel.setBorder(new EmptyBorder(10,0,10,0)); // give some top and bottom border to the label
+		configPanel.add(invokedRepeatedlyLabel, gbc);
+		gbc.ipadx = 4;
+		gbc.ipady = 4;
+
+		gbc.weightx = 0.0;
+		gbc.fill = GridBagConstraints.HORIZONTAL;
+		gbc.gridx = 0;
+		gbc.gridy = 1;
+		gbc.gridwidth = 1;
+		List<String> activityOutputPorts = getActivityOutputPorts();
+		portCombo = new JComboBox(activityOutputPorts.toArray());
+		configPanel.add(portCombo, gbc);
+
+		comparisonCombo = new JComboBox(ActivityGenerator.comparisons.toArray());
+		comparisonCombo.addActionListener(new ActionListener() {
+			public void actionPerformed(ActionEvent e) {
+				Comparison selectedComparison = (Comparison) comparisonCombo
+						.getSelectedItem();
+				if (selectedComparison != null) {
+					valueTypeLabel.setText("the "
+							+ selectedComparison.getValueType());
+				}
+			}
+		});
+		if (comparisonCombo.getSelectedIndex() == -1) {
+			comparisonCombo.setSelectedIndex(0);
+		}
+		gbc.gridx = 1;
+		gbc.gridy = 1;
+		configPanel.add(comparisonCombo, gbc);
+
+		gbc.gridx = 2;
+		gbc.gridy = 1;
+		valueTypeLabel.setHorizontalAlignment(SwingConstants.RIGHT);
+		configPanel.add(valueTypeLabel, gbc);
+
+		gbc.gridx = 3;
+		gbc.gridy = 1;
+		gbc.weightx = 0.5; // request all extra space
+		gbc.fill = GridBagConstraints.HORIZONTAL;
+		configPanel.add(valueField, gbc);
+
+		gbc.gridx = 0;
+		gbc.gridy = 2;
+		gbc.weightx = 0.0;
+		configPanel.add(delayLabel, gbc);
+
+		gbc.gridx = 1;
+		gbc.gridx = 1;
+		gbc.gridy = 2;
+		gbc.weightx = 0.0;
+		delayField.setHorizontalAlignment(JTextField.RIGHT);
+		configPanel.add(delayField, gbc);
+
+		gbc.gridx = 2;
+		gbc.gridy = 2;
+		gbc.gridwidth = 2;
+		gbc.weightx = 0.5; // request all extra space
+		gbc.fill = GridBagConstraints.HORIZONTAL;
+		configPanel.add(secondsLabel, gbc);
+
+		if (activityOutputPorts.isEmpty()) {
+			JLabel warningLabel = new JLabel(
+					"<html><body><strong>Warning:</strong><br>"
+							+ "<i>No single value output ports detected on the main service, "
+							+ "cannot use built-in comparisons. You may still add a customized " +
+									"looping script</i></body></html>");
+			gbc.gridx = 0;
+			gbc.gridy++;
+			gbc.gridwidth = 4;
+			gbc.weightx = 0.1;
+			gbc.fill = GridBagConstraints.BOTH;
+			gbc.gridy++;
+			configPanel.add(warningLabel, gbc);
+			invokedRepeatedlyLabel.setVisible(false);
+			portCombo.setVisible(false);
+			comparisonCombo.setVisible(false);
+			portWarning.setVisible(false);
+			valueTypeLabel.setVisible(false);
+			valueField.setVisible(false);
+			delayField.setVisible(false);
+			delayLabel.setVisible(false);
+			secondsLabel.setVisible(false);
+		}
+
+		gbc.gridy++;
+		gbc.gridx = 0;
+		gbc.weightx = 0.1;
+		gbc.gridwidth = 4;
+		gbc.weightx = 0.1;
+		gbc.fill = GridBagConstraints.BOTH;
+		gbc.fill = GridBagConstraints.HORIZONTAL;
+		gbc.insets = new Insets(10, 0, 10, 0);
+		configPanel.add(portWarning, gbc);
+
+		gbc.insets = new Insets(0, 0, 0, 0);
+		gbc.weightx = 0.1;
+		gbc.fill = GridBagConstraints.NONE;
+		gbc.gridx = 0;
+		gbc.gridy++;
+		gbc.gridwidth = 4;
+		gbc.anchor = GridBagConstraints.LAST_LINE_END;
+		JPanel customiseButtonPanel = new JPanel(new FlowLayout());
+		customizeButton = new JButton("Customize loop condition");
+		customizeButton.addActionListener(new CustomizeAction());
+		customiseButtonPanel.add(customizeButton);
+		configPanel.add(customiseButtonPanel, gbc);
+
+		// filler
+		gbc.gridy++;
+		gbc.fill = GridBagConstraints.BOTH;
+		gbc.gridx = 4;
+		gbc.weightx = 0.1;
+		gbc.weighty = 0.1;
+		gbc.gridwidth = 4;
+		configPanel.add(Box.createGlue(), gbc);
+	}
+
+	private List<String> getActivityOutputPorts() {
+	    // Should already be sorted
+	    return new ArrayList<>(processor.getOutputPorts().getNames());
+    }
+
+    protected JCheckBox feedBackCheck = new JCheckBox(
+			"Enable output port to input port feedback");
+	private JLabel portWarning = new JLabel(
+			"<html><body><small>Note that for Taverna to be able to execute this loop, "
+					+ "the output port <strong>must</strong> be connected to an input of another service "
+					+ "or a workflow output port.</small></body></html>");
+
+	protected void makeOptions() {
+		optionsPanel.removeAll();
+		optionsPanel.setLayout(new GridBagLayout());
+		GridBagConstraints gbc = new GridBagConstraints();
+		gbc.gridx = 0;
+		gbc.gridy = 0;
+		gbc.weightx = 0.1;
+		gbc.anchor = GridBagConstraints.FIRST_LINE_START;
+		gbc.fill = GridBagConstraints.HORIZONTAL;
+		feedBackCheck.setBorder(new EmptyBorder(0,0,10,0));
+		optionsPanel.add(feedBackCheck, gbc);
+		feedBackCheck.addActionListener(new ActionListener() {
+			public void actionPerformed(ActionEvent e) {
+				updateFeedbackHelp();
+			}
+		});
+		updateFeedbackHelp();
+
+		gbc.gridy = 1;
+		gbc.fill = GridBagConstraints.HORIZONTAL;
+		optionsPanel.add(feedbackHelp, gbc);
+	}
+
+	protected void updateFeedbackHelp() {
+		feedbackHelp.setEnabled(feedBackCheck.isSelected());
+		Color color;
+		if (feedBackCheck.isSelected()) {
+			color = valueTypeLabel.getForeground();
+		} else {
+			// Work around
+			// http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4303706
+			// and assume gray is the 'disabled' colour in our Look n Feel
+			color = Color.gray;
+		}
+		feedbackHelp.setForeground(color);
+
+	}
+
+	JLabel feedbackHelp = new JLabel(
+			"<html><small>"
+					+ "<p>When feedback is enabled, the value of the output port is used as input " +
+							"the next time the loop in invoked. The input and output ports used for feedback "
+					+ "<strong>must</strong> have the same <strong>name</strong> and <strong>depth</strong>."
+					+ "</p><br>"
+
+					+ "<p>Feedback can be useful for looping over a nested workflow, "
+					+ "where the nested workflow's output determines its next input value.</p><br>"
+
+					+ "<p>In order to use feedback looping, you must provide an initial value to the input port by "
+					+ "connecting it to the output of a previous service or workflow input port."
+					+ "The output port used as feedback also has to be connected to a downstream service " +
+							"or a workflow output port.</p>"
+
+					+ "</small></html>");
+
+	protected void makeHeader() {
+		headerPanel.removeAll();
+		headerPanel.setLayout(new BorderLayout());
+		//headerPanel.add(new ShadedLabel("Looping for service"
+		//		+ processor.getLocalName(), ShadedLabel.ORANGE));
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-loop-ui/src/main/java/org/apache/taverna/workbench/loop/LoopConfigureAction.java
----------------------------------------------------------------------
diff --git a/taverna-loop-ui/src/main/java/org/apache/taverna/workbench/loop/LoopConfigureAction.java b/taverna-loop-ui/src/main/java/org/apache/taverna/workbench/loop/LoopConfigureAction.java
new file mode 100644
index 0000000..05b8a43
--- /dev/null
+++ b/taverna-loop-ui/src/main/java/org/apache/taverna/workbench/loop/LoopConfigureAction.java
@@ -0,0 +1,262 @@
+/**
+ *
+ */
+package org.apache.taverna.workbench.loop;
+
+import java.awt.BorderLayout;
+import java.awt.FlowLayout;
+import java.awt.Frame;
+import java.awt.event.ActionEvent;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.swing.AbstractAction;
+import javax.swing.JButton;
+import javax.swing.JDialog;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+
+import org.apache.log4j.Logger;
+
+import com.fasterxml.jackson.databind.node.ObjectNode;
+
+import uk.org.taverna.configuration.app.ApplicationConfiguration;
+import org.apache.taverna.scufl2.api.core.Processor;
+import org.apache.taverna.scufl2.api.profiles.Profile;
+
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.file.FileManager;
+import org.apache.taverna.workbench.helper.HelpEnabledDialog;
+
+/**
+ * @author Alan R Williams
+ * @author Stian Soiland-Reyes
+ *
+ */
+@SuppressWarnings("serial")
+public class LoopConfigureAction extends AbstractAction {
+
+	private static Logger logger = Logger.getLogger(LoopConfigureAction.class);
+
+	private final EditManager editManager;
+	private final FileManager fileManager;
+
+	private final Frame owner;
+	private final ObjectNode loopLayer;
+	private final LoopContextualView contextualView;
+	private final Processor processor;
+    private final Profile profile;
+
+    private ApplicationConfiguration applicationConfig;
+
+
+    protected LoopConfigureAction(Frame owner,
+            LoopContextualView contextualView, Processor processor,
+            ObjectNode loopLayer, Profile profile, EditManager editManager,
+            FileManager fileManager, ApplicationConfiguration applicationConfig) {
+		super("Configure");
+		this.owner = owner;
+		this.contextualView = contextualView;
+		this.loopLayer = loopLayer;
+        this.profile = profile;
+		this.editManager = editManager;
+		this.fileManager = fileManager;
+		this.processor = processor;
+        this.applicationConfig = applicationConfig;
+	}
+
+	public void actionPerformed(ActionEvent e) {
+		String title = "Looping for service " + processor.getName();
+		final JDialog dialog = new HelpEnabledDialog(owner, title, true);
+        LoopConfigurationPanel loopConfigurationPanel = new LoopConfigurationPanel(
+                processor, loopLayer, profile, applicationConfig);
+		dialog.add(loopConfigurationPanel, BorderLayout.CENTER);
+
+		JPanel buttonPanel = new JPanel();
+		buttonPanel.setLayout(new FlowLayout());
+
+		JButton okButton = new JButton(new OKAction(dialog, loopConfigurationPanel));
+		buttonPanel.add(okButton);
+
+		JButton resetButton = new JButton(new ResetAction(loopConfigurationPanel));
+		buttonPanel.add(resetButton);
+
+		JButton cancelButton = new JButton(new CancelAction(dialog));
+		buttonPanel.add(cancelButton);
+
+		dialog.add(buttonPanel, BorderLayout.SOUTH);
+		dialog.pack();
+		dialog.setSize(650, 430);
+		dialog.setLocationRelativeTo(null);
+		dialog.setVisible(true);
+	}
+
+	protected class CancelAction extends AbstractAction {
+		private final JDialog dialog;
+
+		protected CancelAction(JDialog dialog) {
+			super("Cancel");
+			this.dialog = dialog;
+		}
+
+		public void actionPerformed(ActionEvent e) {
+			dialog.setVisible(false);
+			if (contextualView != null) {
+				contextualView.refreshView();
+			}
+		}
+
+	}
+
+	protected class OKAction extends AbstractAction {
+		private final JDialog dialog;
+		private final LoopConfigurationPanel loopConfigurationPanel;
+
+		protected OKAction(JDialog dialog, LoopConfigurationPanel loopConfigurationPanel) {
+			super("OK");
+			this.dialog = dialog;
+			this.loopConfigurationPanel = loopConfigurationPanel;
+		}
+
+		public void actionPerformed(ActionEvent e) {
+			try {
+
+				List<Edit<?>> compoundEdit = new ArrayList<Edit<?>>();
+				LoopConfiguration configuration = loopConfigurationPanel.getConfiguration();
+				compoundEdit.add(edits.getConfigureEdit(loopLayer, configuration));
+				compoundEdit.addAll(checkPortMappings(configuration.getCondition()));
+
+				editManager.doDataflowEdit(fileManager.getCurrentDataflow(), new CompoundEdit(
+						compoundEdit));
+				dialog.setVisible(false);
+				if (contextualView != null) {
+					contextualView.refreshView();
+				}
+			} catch (RuntimeException ex) {
+				logger.warn("Could not configure looping", ex);
+				JOptionPane.showMessageDialog(owner, "Could not configure looping",
+						"An error occured when configuring looping: " + ex.getMessage(),
+						JOptionPane.ERROR_MESSAGE);
+			} catch (EditException ex) {
+				logger.warn("Could not configure looping", ex);
+				JOptionPane.showMessageDialog(owner, "Could not configure looping",
+						"An error occured when configuring looping: " + ex.getMessage(),
+						JOptionPane.ERROR_MESSAGE);
+			}
+		}
+
+		protected List<Edit<?>> checkPortMappings(Activity<?> conditionActivity) {
+
+			List<Edit<?>> compoundEdit = new ArrayList<Edit<?>>();
+			if (processor.getActivityList().isEmpty()) {
+				return compoundEdit;
+			}
+			Set<String> newInputs = new HashSet<String>();
+			Set<String> newOutputs = new HashSet<String>();
+
+			Activity<?> firstProcessorActivity;
+			firstProcessorActivity = processor.getActivityList().get(0);
+			if (conditionActivity != null) {
+				for (OutputPort condOutPort : conditionActivity.getOutputPorts()) {
+					String portName = condOutPort.getName();
+					Map<String, String> mapping = firstProcessorActivity.getInputPortMapping();
+					if (!mapping.containsKey(portName)) {
+						if (mapping.containsKey(portName)) {
+							logger.warn("Can't re-map input for " + "conditional output "
+									+ portName);
+						}
+						for (InputPort inputPort : firstProcessorActivity.getInputPorts()) {
+							if (inputPort.equals(portName)) {
+								Edit<Activity<?>> edit = edits.getAddActivityInputPortMappingEdit(
+										firstProcessorActivity, portName, portName);
+								compoundEdit.add(edit);
+								newInputs.add(portName);
+							}
+						}
+					}
+				}
+				for (InputPort condInPort : conditionActivity.getInputPorts()) {
+					String portName = condInPort.getName();
+					Map<String, String> mapping = firstProcessorActivity.getOutputPortMapping();
+					if (!mapping.containsValue(portName)) {
+						for (OutputPort outputPort : firstProcessorActivity.getOutputPorts()) {
+							if (outputPort.equals(portName)) {
+								if (mapping.containsKey(portName)) {
+									logger.warn("Can't re-map output for " + "conditional input "
+											+ portName);
+								}
+								Edit<Activity<?>> edit = edits.getAddActivityOutputPortMappingEdit(
+										firstProcessorActivity, portName, portName);
+								logger.info("Mapping for conditional non-outgoing activity port binding "
+										+ portName);
+								compoundEdit.add(edit);
+								newOutputs.add(portName);
+							}
+						}
+					}
+				}
+			}
+			// Remove any stale bindings that no longer match neither
+			// conditional activity or the processor output ports
+			for (String processorIn : firstProcessorActivity.getInputPortMapping().keySet()) {
+				if (newInputs.contains(processorIn)) {
+					continue;
+				}
+				boolean foundMatch = false;
+				for (InputPort processorPort : processor.getInputPorts()) {
+					if (processorPort.getName().equals(processorIn)) {
+						foundMatch = true;
+						break;
+					}
+				}
+				if (!foundMatch) {
+					Edit<Activity<?>> edit = edits.getRemoveActivityInputPortMappingEdit(
+							firstProcessorActivity, processorIn);
+					logger.info("Removing stale input port binding " + processorIn);
+					compoundEdit.add(edit);
+				}
+			}
+			for (String processorOut : firstProcessorActivity.getOutputPortMapping().keySet()) {
+				if (newInputs.contains(processorOut)) {
+					continue;
+				}
+				boolean foundMatch = false;
+				for (OutputPort processorPort : processor.getOutputPorts()) {
+					if (processorPort.getName().equals(processorOut)) {
+						foundMatch = true;
+						break;
+					}
+				}
+				if (!foundMatch) {
+					Edit<Activity<?>> edit = edits.getRemoveActivityOutputPortMappingEdit(
+							firstProcessorActivity, processorOut);
+					logger.info("Removing stale output port binding " + processorOut);
+					compoundEdit.add(edit);
+				}
+			}
+
+			return compoundEdit;
+		}
+	}
+
+	protected class ResetAction extends AbstractAction {
+		private LoopConfigurationPanel loopConfigurationPanel;
+
+		protected ResetAction(LoopConfigurationPanel loopConfigurationPanel) {
+			super("Reset");
+			this.loopConfigurationPanel = loopConfigurationPanel;
+		}
+
+		public void actionPerformed(ActionEvent e) {
+			if (contextualView != null) {
+				contextualView.refreshView();
+			}
+			loopConfigurationPanel.setConfiguration(loopLayer.getConfiguration());
+		}
+
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-loop-ui/src/main/java/org/apache/taverna/workbench/loop/LoopConfigureMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-loop-ui/src/main/java/org/apache/taverna/workbench/loop/LoopConfigureMenuAction.java b/taverna-loop-ui/src/main/java/org/apache/taverna/workbench/loop/LoopConfigureMenuAction.java
new file mode 100644
index 0000000..061c225
--- /dev/null
+++ b/taverna-loop-ui/src/main/java/org/apache/taverna/workbench/loop/LoopConfigureMenuAction.java
@@ -0,0 +1,97 @@
+/**********************************************************************
+ * 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 org.apache.taverna.workbench.loop;
+
+import java.awt.event.ActionEvent;
+import java.net.URI;
+
+import javax.swing.AbstractAction;
+import javax.swing.Action;
+
+import com.fasterxml.jackson.databind.node.ObjectNode;
+
+import org.apache.taverna.scufl2.api.core.Processor;
+
+import org.apache.taverna.ui.menu.AbstractContextualMenuAction;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.file.FileManager;
+
+public class LoopConfigureMenuAction extends AbstractContextualMenuAction {
+
+	public static final URI configureRunningSection = URI
+	.create("http://taverna.sf.net/2009/contextMenu/configureRunning");
+
+	private static final URI LOOP_CONFIGURE_URI = URI
+	.create("http://taverna.sf.net/2008/t2workbench/loopConfigure");
+
+	private static final String LOOP_CONFIGURE = "Loop configure";
+
+	private EditManager editManager;
+
+	private FileManager fileManager;
+
+	public LoopConfigureMenuAction() {
+		super(configureRunningSection, 20, LOOP_CONFIGURE_URI);
+	}
+
+	@SuppressWarnings("serial")
+	@Override
+	protected Action createAction() {
+		return new AbstractAction("Looping...") {
+			public void actionPerformed(ActionEvent e) {
+				Processor p = (Processor) getContextualSelection().getSelection();
+				configureLoopLayer(p, e);
+			}
+		};
+	}
+
+	public void configureLoopLayer(Processor p, ActionEvent e) {
+	    ObjectNode loopLayer = getLoopLayer(p);
+		if (loopLayer != null) {
+			LoopConfigureAction loopConfigureAction = new LoopConfigureAction(null, null, loopLayer, editManager, fileManager);
+			loopConfigureAction.actionPerformed(e);
+		}
+	}
+
+	public static ObjectNode getLoopLayer(Processor p) {
+		for (DispatchLayer dl : p.getDispatchStack().getLayers()) {
+			if (dl instanceof Loop) {
+				result = (Loop) dl;
+				break;
+			}
+		}
+		return result;
+	}
+
+	public boolean isEnabled() {
+		Object selection = getContextualSelection().getSelection();
+		return (super.isEnabled() && (selection instanceof Processor) && (getLoopLayer((Processor)selection) != null));
+	}
+
+	public void setEditManager(EditManager editManager) {
+		this.editManager = editManager;
+	}
+
+	public void setFileManager(FileManager fileManager) {
+		this.fileManager = fileManager;
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-loop-ui/src/main/java/org/apache/taverna/workbench/loop/LoopContextualView.java
----------------------------------------------------------------------
diff --git a/taverna-loop-ui/src/main/java/org/apache/taverna/workbench/loop/LoopContextualView.java b/taverna-loop-ui/src/main/java/org/apache/taverna/workbench/loop/LoopContextualView.java
new file mode 100644
index 0000000..fc5e837
--- /dev/null
+++ b/taverna-loop-ui/src/main/java/org/apache/taverna/workbench/loop/LoopContextualView.java
@@ -0,0 +1,172 @@
+/*******************************************************************************
+ * 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 org.apache.taverna.workbench.loop;
+
+import java.awt.Frame;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.util.Properties;
+
+import javax.swing.Action;
+import javax.swing.JComponent;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.file.FileManager;
+import org.apache.taverna.workbench.loop.comparisons.Comparison;
+import org.apache.taverna.workbench.ui.views.contextualviews.ContextualView;
+
+import org.apache.log4j.Logger;
+
+import org.apache.taverna.scufl2.api.core.Processor;
+
+/**
+ * View of a processor, including it's iteration stack, activities, etc.
+ *
+ * @author Stian Soiland-Reyes
+ *
+ */
+public class LoopContextualView extends ContextualView {
+
+	private static final long serialVersionUID = 1L;
+
+	private static Logger logger = Logger.getLogger(LoopContextualView.class);
+
+	private EditManager editManager;
+	private FileManager fileManager;
+
+	private Loop loopLayer;
+
+	private JPanel panel;
+
+	private Processor processor;
+
+	public LoopContextualView(Processor processor, EditManager editManager, FileManager fileManager) {
+		super();
+		this.loopLayer = loopLayer;
+		this.editManager = editManager;
+		this.fileManager = fileManager;
+		this.processor = processor;
+		initialise();
+		initView();
+	}
+
+	@Override
+	public Action getConfigureAction(Frame owner) {
+		return new LoopConfigureAction(owner, this, processor, editManager, fileManager);
+	}
+
+	@Override
+	public void refreshView() {
+		initialise();
+	}
+
+	private void initialise() {
+		if (panel == null) {
+			panel = new JPanel();
+		} else {
+			panel.removeAll();
+		}
+		panel.setLayout(new GridBagLayout());
+		updateUIByConfig();
+	}
+
+	@Override
+	public JComponent getMainFrame() {
+		return panel;
+	}
+
+	@Override
+	public String getViewTitle() {
+		return "Loop of " + processor.getLocalName();
+	}
+
+	protected void updateUIByConfig() {
+		GridBagConstraints gbc = new GridBagConstraints();
+		gbc.gridx = 0;
+		gbc.gridy = 1;
+		gbc.weightx = 0.1;
+		gbc.fill = GridBagConstraints.HORIZONTAL;
+
+		StringBuilder description = new StringBuilder("<html><body>");
+		Properties properties = loopLayer.getConfiguration().getProperties();
+		if (properties.getProperty(ActivityGenerator.COMPARISON,
+				ActivityGenerator.CUSTOM_COMPARISON).equals(
+				ActivityGenerator.CUSTOM_COMPARISON)) {
+			Activity<?> condition = loopLayer.getConfiguration().getCondition();
+			if (condition != null) {
+				description.append("Looping using custom conditional ");
+				if (condition instanceof BeanshellActivity) {
+					String script = ((BeanshellActivity)condition).getConfiguration().getScript();
+					if (script != null) {
+						if (script.length() <= 100) {
+							description.append("<pre>\n");
+							description.append(script);
+							description.append("</pre>\n");
+						}
+					}
+				}
+			} else {
+				description.append("<i>Unconfigured, will not loop</i>");
+			}
+		} else {
+			description.append("The service will be invoked repeatedly ");
+			description.append("until<br> its output <strong>");
+			description.append(properties
+					.getProperty(ActivityGenerator.COMPARE_PORT));
+			description.append("</strong> ");
+
+			Comparison comparison = ActivityGenerator
+					.getComparisonById(properties
+							.getProperty(ActivityGenerator.COMPARISON));
+			description.append(comparison.getName());
+
+			description.append(" the " + comparison.getValueType() + ": <pre>");
+			description.append(properties
+					.getProperty(ActivityGenerator.COMPARE_VALUE));
+			description.append("</pre>");
+
+			String delay = properties.getProperty(ActivityGenerator.DELAY, "");
+			try {
+				if (Double.parseDouble(delay) > 0) {
+					description.append("adding a delay of " + delay
+							+ " seconds between loops.");
+				}
+			} catch (NumberFormatException ex) {
+			}
+		}
+		description.append("</body></html>");
+
+		panel.add(new JLabel(description.toString()), gbc);
+		gbc.gridy++;
+
+		revalidate();
+	}
+
+
+
+	@Override
+	public int getPreferredPosition() {
+		return 400;
+	}
+
+}


[43/51] [partial] incubator-taverna-workbench git commit: all packages are moved to org.apache.taverna.*

Posted by re...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-configuration-impl/src/main/java/net/sf/taverna/t2/workbench/ui/impl/configuration/WorkbenchConfigurationPanel.java
----------------------------------------------------------------------
diff --git a/taverna-configuration-impl/src/main/java/net/sf/taverna/t2/workbench/ui/impl/configuration/WorkbenchConfigurationPanel.java b/taverna-configuration-impl/src/main/java/net/sf/taverna/t2/workbench/ui/impl/configuration/WorkbenchConfigurationPanel.java
deleted file mode 100644
index ecddc35..0000000
--- a/taverna-configuration-impl/src/main/java/net/sf/taverna/t2/workbench/ui/impl/configuration/WorkbenchConfigurationPanel.java
+++ /dev/null
@@ -1,266 +0,0 @@
-/*******************************************************************************
- * 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.configuration;
-
-import static java.awt.GridBagConstraints.*;
-import static javax.swing.JFileChooser.APPROVE_OPTION;
-import static javax.swing.JOptionPane.INFORMATION_MESSAGE;
-import static javax.swing.JOptionPane.WARNING_MESSAGE;
-import static javax.swing.JOptionPane.showMessageDialog;
-import static net.sf.taverna.t2.workbench.helper.Helper.showHelp;
-import static net.sf.taverna.t2.workbench.icons.WorkbenchIcons.openIcon;
-
-import java.awt.Component;
-import java.awt.FlowLayout;
-import java.awt.GridBagConstraints;
-import java.awt.GridBagLayout;
-import java.awt.Insets;
-import java.awt.event.ActionEvent;
-
-import javax.swing.AbstractAction;
-import javax.swing.JButton;
-import javax.swing.JCheckBox;
-import javax.swing.JFileChooser;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JTextArea;
-import javax.swing.JTextField;
-import javax.swing.border.EmptyBorder;
-
-import net.sf.taverna.t2.workbench.configuration.workbench.WorkbenchConfiguration;
-
-import org.apache.log4j.Logger;
-
-@SuppressWarnings("serial")
-public class WorkbenchConfigurationPanel extends JPanel {
-	private static final String RESTART_MSG = "For the new configuration to be fully applied, it is advised to restart Taverna.";
-	private static final String DOT_PATH_MSG = "Path to Graphviz executable <code>dot</code>:";
-	private static final String CONTEXT_MENU_SIZE_MSG = "Maximum number of services/ports in right-click menu:";
-	private static Logger logger = Logger
-			.getLogger(WorkbenchConfigurationUIFactory.class);
-
-	private JTextField dotLocation = new JTextField(25);
-	private JTextField menuItems = new JTextField(10);
-	private JCheckBox warnInternal = new JCheckBox("Warn on internal errors");
-	private JCheckBox captureConsole = new JCheckBox(
-			"Capture output on stdout/stderr to log file");
-
-	private final WorkbenchConfiguration workbenchConfiguration;
-
-	public WorkbenchConfigurationPanel(
-			WorkbenchConfiguration workbenchConfiguration) {
-		super();
-		this.workbenchConfiguration = workbenchConfiguration;
-		initComponents();
-	}
-
-	private static JLabel htmlLabel(String html) {
-		return new JLabel("<html><body>" + html + "</body></html>");
-	}
-
-	private void initComponents() {
-		this.setLayout(new GridBagLayout());
-		GridBagConstraints gbc = new GridBagConstraints();
-
-		// Title describing what kind of settings we are configuring here
-		JTextArea descriptionText = new JTextArea(
-				"General Workbench configuration");
-		descriptionText.setLineWrap(true);
-		descriptionText.setWrapStyleWord(true);
-		descriptionText.setEditable(false);
-		descriptionText.setFocusable(false);
-		descriptionText.setBorder(new EmptyBorder(10, 10, 10, 10));
-		gbc.anchor = WEST;
-		gbc.gridx = 0;
-		gbc.gridy = 0;
-		gbc.gridwidth = 2;
-		gbc.weightx = 1.0;
-		gbc.weighty = 0.0;
-		gbc.fill = HORIZONTAL;
-		this.add(descriptionText, gbc);
-
-		gbc.gridx = 0;
-		gbc.gridy = 1;
-		gbc.gridwidth = 2;
-		gbc.weightx = 0.0;
-		gbc.weighty = 0.0;
-		gbc.insets = new Insets(10, 5, 0, 0);
-		gbc.fill = NONE;
-		this.add(htmlLabel(DOT_PATH_MSG), gbc);
-
-		dotLocation.setText(workbenchConfiguration.getDotLocation());
-		gbc.gridy++;
-		gbc.gridwidth = 1;
-		gbc.weightx = 1.0;
-		gbc.insets = new Insets(0, 0, 0, 0);
-		gbc.fill = HORIZONTAL;
-		this.add(dotLocation, gbc);
-
-		JButton browseButton = new JButton();
-		gbc.gridx = 1;
-		gbc.weightx = 0.0;
-		gbc.fill = NONE;
-		this.add(browseButton, gbc);
-		browseButton.setAction(new AbstractAction() {
-			@Override
-			public void actionPerformed(ActionEvent e) {
-				System.setProperty("com.apple.macos.use-file-dialog-packages",
-						"false");
-				JFileChooser fileChooser = new JFileChooser();
-				fileChooser.putClientProperty(
-						"JFileChooser.appBundleIsTraversable", "always");
-				fileChooser.putClientProperty(
-						"JFileChooser.packageIsTraversable", "always");
-
-				fileChooser.setDialogTitle("Browse for dot");
-
-				fileChooser.resetChoosableFileFilters();
-				fileChooser.setAcceptAllFileFilterUsed(false);
-
-				fileChooser.setMultiSelectionEnabled(false);
-
-				int returnVal = fileChooser
-						.showOpenDialog(WorkbenchConfigurationPanel.this);
-				if (returnVal == APPROVE_OPTION)
-					dotLocation.setText(fileChooser.getSelectedFile()
-							.getAbsolutePath());
-			}
-		});
-		browseButton.setIcon(openIcon);
-
-		gbc.gridx = 0;
-		gbc.gridy++;
-		gbc.gridwidth = 2;
-		gbc.weightx = 0.0;
-		gbc.weighty = 0.0;
-		gbc.insets = new Insets(10, 5, 0, 0);
-		gbc.fill = HORIZONTAL;
-		this.add(htmlLabel(CONTEXT_MENU_SIZE_MSG), gbc);
-
-		menuItems.setText(Integer.toString(workbenchConfiguration
-				.getMaxMenuItems()));
-		gbc.gridy++;
-		gbc.weightx = 1.0;
-		gbc.gridwidth = 1;
-		gbc.insets = new Insets(0, 0, 0, 0);
-		gbc.fill = HORIZONTAL;
-		this.add(menuItems, gbc);
-
-		gbc.gridx = 0;
-		gbc.gridy++;
-		gbc.gridwidth = 2;
-		gbc.weightx = 1.0;
-		gbc.fill = HORIZONTAL;
-		gbc.insets = new Insets(10, 0, 0, 0);
-		warnInternal
-				.setSelected(workbenchConfiguration.getWarnInternalErrors());
-		this.add(warnInternal, gbc);
-
-		gbc.gridy++;
-		gbc.insets = new Insets(0, 0, 10, 0);
-		captureConsole.setSelected(workbenchConfiguration.getCaptureConsole());
-		this.add(captureConsole, gbc);
-
-		// Add the buttons panel
-		gbc.gridx = 0;
-		gbc.gridy++;
-		gbc.gridwidth = 3;
-		gbc.weightx = 1.0;
-		gbc.weighty = 1.0;
-		gbc.fill = BOTH;
-		gbc.anchor = SOUTH;
-		this.add(getButtonsPanel(), gbc);
-	}
-
-	private Component getButtonsPanel() {
-		final JPanel panel = new JPanel();
-		panel.setLayout(new FlowLayout(FlowLayout.CENTER));
-
-		/**
-		 * The helpButton shows help about the current component
-		 */
-		JButton helpButton = new JButton(new AbstractAction("Help") {
-			@Override
-			public void actionPerformed(ActionEvent arg0) {
-				showHelp(panel);
-			}
-		});
-		panel.add(helpButton);
-
-		/**
-		 * The resetButton changes the property values shown to those
-		 * corresponding to the configuration currently applied.
-		 */
-		JButton resetButton = new JButton(new AbstractAction("Reset") {
-			@Override
-			public void actionPerformed(ActionEvent arg0) {
-				resetFields();
-			}
-		});
-		panel.add(resetButton);
-
-		JButton applyButton = new JButton(new AbstractAction("Apply") {
-			@Override
-			public void actionPerformed(ActionEvent arg0) {
-				String menus = menuItems.getText();
-				try {
-					workbenchConfiguration.setMaxMenuItems(Integer
-							.valueOf(menus));
-				} catch (IllegalArgumentException e) {
-					String message = "Invalid menu items number " + menus
-							+ ":\n" + e.getLocalizedMessage();
-					showMessageDialog(panel, message, "Invalid menu items",
-							WARNING_MESSAGE);
-					return;
-				}
-
-				workbenchConfiguration.setCaptureConsole(captureConsole
-						.isSelected());
-				workbenchConfiguration.setWarnInternalErrors(warnInternal
-						.isSelected());
-				workbenchConfiguration.setDotLocation(dotLocation.getText());
-				try {
-					showMessageDialog(panel, RESTART_MSG, "Restart adviced",
-							INFORMATION_MESSAGE);
-				} catch (Exception e) {
-					logger.error("Error storing updated configuration", e);
-				}
-			}
-		});
-		panel.add(applyButton);
-		return panel;
-	}
-
-	/**
-	 * Resets the shown field values to those currently set (last saved) in the
-	 * configuration.
-	 * 
-	 * @param configurable
-	 */
-	private void resetFields() {
-		menuItems.setText(Integer.toString(workbenchConfiguration
-				.getMaxMenuItems()));
-		dotLocation.setText(workbenchConfiguration.getDotLocation());
-		warnInternal
-				.setSelected(workbenchConfiguration.getWarnInternalErrors());
-		captureConsole.setSelected(workbenchConfiguration.getCaptureConsole());
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-configuration-impl/src/main/java/net/sf/taverna/t2/workbench/ui/impl/configuration/WorkbenchConfigurationUIFactory.java
----------------------------------------------------------------------
diff --git a/taverna-configuration-impl/src/main/java/net/sf/taverna/t2/workbench/ui/impl/configuration/WorkbenchConfigurationUIFactory.java b/taverna-configuration-impl/src/main/java/net/sf/taverna/t2/workbench/ui/impl/configuration/WorkbenchConfigurationUIFactory.java
deleted file mode 100644
index 263233f..0000000
--- a/taverna-configuration-impl/src/main/java/net/sf/taverna/t2/workbench/ui/impl/configuration/WorkbenchConfigurationUIFactory.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*******************************************************************************
- * 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.configuration;
-
-import javax.swing.JPanel;
-
-import uk.org.taverna.configuration.Configurable;
-import uk.org.taverna.configuration.ConfigurationUIFactory;
-
-import net.sf.taverna.t2.workbench.configuration.workbench.WorkbenchConfiguration;
-
-public class WorkbenchConfigurationUIFactory implements ConfigurationUIFactory {
-	private WorkbenchConfiguration workbenchConfiguration;
-
-	@Override
-	public boolean canHandle(String uuid) {
-		return uuid.equals(workbenchConfiguration.getUUID());
-	}
-
-	@Override
-	public JPanel getConfigurationPanel() {
-		return new WorkbenchConfigurationPanel(workbenchConfiguration);
-	}
-
-	@Override
-	public Configurable getConfigurable() {
-		return workbenchConfiguration;
-	}
-
-	public void setWorkbenchConfiguration(
-			WorkbenchConfiguration workbenchConfiguration) {
-		this.workbenchConfiguration = workbenchConfiguration;
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-configuration-impl/src/main/java/net/sf/taverna/t2/workbench/ui/impl/configuration/colour/ColourManagerImpl.java
----------------------------------------------------------------------
diff --git a/taverna-configuration-impl/src/main/java/net/sf/taverna/t2/workbench/ui/impl/configuration/colour/ColourManagerImpl.java b/taverna-configuration-impl/src/main/java/net/sf/taverna/t2/workbench/ui/impl/configuration/colour/ColourManagerImpl.java
deleted file mode 100644
index 4c03dbe..0000000
--- a/taverna-configuration-impl/src/main/java/net/sf/taverna/t2/workbench/ui/impl/configuration/colour/ColourManagerImpl.java
+++ /dev/null
@@ -1,178 +0,0 @@
-/*******************************************************************************
- * 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.configuration.colour;
-
-import static java.awt.Color.WHITE;
-import static java.awt.Color.decode;
-
-import java.awt.Color;
-import java.util.HashMap;
-import java.util.Map;
-
-import uk.org.taverna.configuration.AbstractConfigurable;
-import uk.org.taverna.configuration.ConfigurationManager;
-import net.sf.taverna.t2.workbench.configuration.colour.ColourManager;
-
-/**
- * A factory class that determines the colour that a Colourable UI component
- * should be displayed as, according to a schema configured by the user.
- * 
- * @author Stuart Owen
- * @author Ian Dunlop
- * @see Colourable
- */
-public class ColourManagerImpl extends AbstractConfigurable implements
-		ColourManager {
-	// Names of things that may be coloured
-	private static final String WORKFLOW_PORT_OBJECT = "uk.org.taverna.scufl2.api.port.WorkflowPort";
-	private static final String PROCESSOR_PORT_OBJECT = "uk.org.taverna.scufl2.api.port.ProcessorPort";
-	private static final String PROCESSOR_OBJECT = "uk.org.taverna.scufl2.api.core.Processor";
-	private static final String MERGE_OBJECT = "net.sf.taverna.t2.workflowmodel.Merge";
-	private static final String NONEXECUTABLE_ACTIVITY = "http://ns.taverna.org.uk/2010/activity/nonExecutable";
-	private static final String XML_SPLITTER_OUT_ACTIVITY = "http://ns.taverna.org.uk/2010/activity/xml-splitter/out";
-	private static final String XML_SPLITTER_IN_ACTIVITY = "http://ns.taverna.org.uk/2010/activity/xml-splitter/in";
-	private static final String LOCALWORKER_ACTIVITY = "http://ns.taverna.org.uk/2010/activity/localworker";
-	private static final String WSDL_ACTIVITY = "http://ns.taverna.org.uk/2010/activity/wsdl";
-	private static final String CONSTANT_ACTIVITY = "http://ns.taverna.org.uk/2010/activity/constant";
-	private static final String SOAPLAB_ACTIVITY = "http://ns.taverna.org.uk/2010/activity/soaplab";
-	private static final String RSHELL_ACTIVITY = "http://ns.taverna.org.uk/2010/activity/rshell";
-	private static final String NESTED_WORKFLOW = "http://ns.taverna.org.uk/2010/activity/nested-workflow";
-	private static final String MOBY_PARSER_ACTIVITY = "http://ns.taverna.org.uk/2010/activity/biomoby/parser";
-	private static final String MOBY_OBJECT_ACTIVITY = "http://ns.taverna.org.uk/2010/activity/biomoby/object";
-	private static final String MOBY_SERVICE_ACTIVITY = "http://ns.taverna.org.uk/2010/activity/biomoby/service";
-	private static final String BIOMART_ACTIVITY = "http://ns.taverna.org.uk/2010/activity/biomart";
-	private static final String BEANSHELL_ACTIVITY = "http://ns.taverna.org.uk/2010/activity/beanshell";
-	private static final String APICONSUMER_ACTIVITY = "http://ns.taverna.org.uk/2010/activity/apiconsumer";
-
-	// Names of colours used
-	private static final String burlywood2 = "#deb887";
-	private static final String darkgoldenrod1 = "#ffb90f";
-	private static final String darkolivegreen3 = "#a2cd5a";
-	private static final String gold = "#ffd700";
-	private static final String grey = "#777777";
-	private static final String lightcyan2 = "#d1eeee";
-	private static final String lightgoldenrodyellow = "#fafad2";
-	// light purple non standard
-	private static final String lightpurple = "#ab92ea";
-	private static final String lightsteelblue = "#b0c4de";
-	private static final String mediumorchid2 = "#d15fee";
-	private static final String palegreen = "#98fb98";
-	private static final String pink = "#ffc0cb";
-	private static final String purplish = "#8070ff";
-	// ShadedLabel.Orange
-	private static final String shadedorange = "#eece8f";
-	// ShadedLabel.Green
-	private static final String shadedgreen = "#a1c69d";
-	// slightly lighter than the real steelblue4
-	private static final String steelblue4 = "#648faa";
-	private static final String turquoise = "#77aadd";
-	private static final String white = "#ffffff";
-
-	private Map<String, String> defaultPropertyMap;
-	private Map<Object, Color> cachedColours;
-
-	public ColourManagerImpl(ConfigurationManager configurationManager) {
-		super(configurationManager);
-		initialiseDefaults();
-	}
-
-	@Override
-	public String getCategory() {
-		return "colour";
-	}
-
-	@Override
-	public Map<String, String> getDefaultPropertyMap() {
-		if (defaultPropertyMap == null)
-			initialiseDefaults();
-		return defaultPropertyMap;
-	}
-
-	@Override
-	public String getDisplayName() {
-		return "Colour Management";
-	}
-
-	@Override
-	public String getFilePrefix() {
-		return "ColourManagement";
-	}
-
-	/**
-	 * Unique identifier for this ColourManager
-	 */
-	@Override
-	public String getUUID() {
-		return "a2148420-5967-11dd-ae16-0800200c9a66";
-	}
-
-	private void initialiseDefaults() {
-		defaultPropertyMap = new HashMap<>();
-		cachedColours = new HashMap<>();
-
-		defaultPropertyMap.put(APICONSUMER_ACTIVITY, palegreen);
-		defaultPropertyMap.put(BEANSHELL_ACTIVITY, burlywood2);
-		defaultPropertyMap.put(BIOMART_ACTIVITY, lightcyan2);
-		defaultPropertyMap.put(CONSTANT_ACTIVITY, lightsteelblue);
-		defaultPropertyMap.put(LOCALWORKER_ACTIVITY, mediumorchid2);
-		defaultPropertyMap.put(MOBY_SERVICE_ACTIVITY, darkgoldenrod1);
-		defaultPropertyMap.put(MOBY_OBJECT_ACTIVITY, gold);
-		defaultPropertyMap.put(MOBY_PARSER_ACTIVITY, white);
-		defaultPropertyMap.put(NESTED_WORKFLOW, pink);
-		defaultPropertyMap.put(RSHELL_ACTIVITY, steelblue4);
-		defaultPropertyMap.put(SOAPLAB_ACTIVITY, lightgoldenrodyellow);
-		defaultPropertyMap.put(WSDL_ACTIVITY, darkolivegreen3);
-		defaultPropertyMap.put(XML_SPLITTER_IN_ACTIVITY, lightpurple);
-		defaultPropertyMap.put(XML_SPLITTER_OUT_ACTIVITY, lightpurple);
-
-		defaultPropertyMap.put(NONEXECUTABLE_ACTIVITY, grey);
-
-		defaultPropertyMap.put(MERGE_OBJECT, turquoise);
-		defaultPropertyMap.put(PROCESSOR_OBJECT, shadedgreen);
-		defaultPropertyMap.put(PROCESSOR_PORT_OBJECT, purplish);
-		defaultPropertyMap.put(WORKFLOW_PORT_OBJECT, shadedorange);
-	}
-
-	@Override
-	public Color getPreferredColour(String itemKey) {
-		Color colour = cachedColours.get(itemKey);
-		if (colour == null) {
-			String colourString = (String) getProperty(itemKey);
-			colour = colourString == null ? WHITE : decode(colourString);
-			cachedColours.put(itemKey, colour);
-		}
-		return colour;
-	}
-
-	@Override
-	public void setPreferredColour(String itemKey, Color colour) {
-		cachedColours.put(itemKey, colour);
-	}
-
-	@Override
-	public void restoreDefaults() {
-		super.restoreDefaults();
-		if (cachedColours == null)
-			cachedColours = new HashMap<>();
-		else
-			cachedColours.clear();
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-configuration-impl/src/main/java/net/sf/taverna/t2/workbench/ui/impl/configuration/mimetype/MimeTypeManagerImpl.java
----------------------------------------------------------------------
diff --git a/taverna-configuration-impl/src/main/java/net/sf/taverna/t2/workbench/ui/impl/configuration/mimetype/MimeTypeManagerImpl.java b/taverna-configuration-impl/src/main/java/net/sf/taverna/t2/workbench/ui/impl/configuration/mimetype/MimeTypeManagerImpl.java
deleted file mode 100644
index 0ff6c65..0000000
--- a/taverna-configuration-impl/src/main/java/net/sf/taverna/t2/workbench/ui/impl/configuration/mimetype/MimeTypeManagerImpl.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*******************************************************************************
- * 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.configuration.mimetype;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import net.sf.taverna.t2.workbench.configuration.mimetype.MimeTypeManager;
-import uk.org.taverna.configuration.AbstractConfigurable;
-import uk.org.taverna.configuration.ConfigurationManager;
-
-public class MimeTypeManagerImpl extends AbstractConfigurable implements
-		MimeTypeManager {
-	/**
-	 * Constructs a new <code>MimeTypeManagerImpl</code>.
-	 * 
-	 * @param configurationManager
-	 */
-	public MimeTypeManagerImpl(ConfigurationManager configurationManager) {
-		super(configurationManager);
-	}
-
-	@Override
-	public String getCategory() {
-		return "Mime Type";
-	}
-
-	@Override
-	public Map<String, String> getDefaultPropertyMap() {
-		HashMap<String, String> map = new HashMap<>();
-		map.put("text/plain", "Plain Text");
-		map.put("text/xml", "XML Text");
-		map.put("text/html", "HTML Text");
-		map.put("text/rtf", "Rich Text Format");
-		map.put("text/x-graphviz", "Graphviz Dot File");
-		map.put("image/png", "PNG Image");
-		map.put("image/jpeg", "JPEG Image");
-		map.put("image/gif", "GIF Image");
-		map.put("application/octet-stream", "Binary Data");
-		map.put("application/zip", "Zip File");
-		map.put("chemical/x-swissprot", "SWISSPROT Flat File");
-		map.put("chemical/x-embl-dl-nucleotide", "EMBL Flat File");
-		map.put("chemical/x-ppd", "PPD File");
-		map.put("chemical/seq-aa-genpept", "Genpept Protein");
-		map.put("chemical/seq-na-genbank", "Genbank Nucleotide");
-		map.put("chemical/x-pdb", "PDB 3D Structure File");
-		return map;
-	}
-
-	@Override
-	public String getUUID() {
-		return "b9277fa0-5967-11dd-ae16-0800200c9a66";
-	}
-
-	@Override
-	public String getDisplayName() {
-		return "Mime Type Manager";
-	}
-
-	@Override
-	public String getFilePrefix() {
-		return "MimeTypeManagerImpl";
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-configuration-impl/src/main/java/net/sf/taverna/t2/workbench/ui/impl/configuration/ui/T2ConfigurationFrameImpl.java
----------------------------------------------------------------------
diff --git a/taverna-configuration-impl/src/main/java/net/sf/taverna/t2/workbench/ui/impl/configuration/ui/T2ConfigurationFrameImpl.java b/taverna-configuration-impl/src/main/java/net/sf/taverna/t2/workbench/ui/impl/configuration/ui/T2ConfigurationFrameImpl.java
deleted file mode 100644
index 4910f78..0000000
--- a/taverna-configuration-impl/src/main/java/net/sf/taverna/t2/workbench/ui/impl/configuration/ui/T2ConfigurationFrameImpl.java
+++ /dev/null
@@ -1,205 +0,0 @@
-/*******************************************************************************
- * 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.configuration.ui;
-
-import static javax.swing.JSplitPane.HORIZONTAL_SPLIT;
-import static net.sf.taverna.t2.workbench.helper.HelpCollator.registerComponent;
-import static net.sf.taverna.t2.workbench.helper.Helper.setKeyCatcher;
-
-import java.awt.BorderLayout;
-import java.awt.Dimension;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Comparator;
-import java.util.List;
-import java.util.Map;
-
-import javax.swing.JFrame;
-import javax.swing.JList;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JSplitPane;
-import javax.swing.ListModel;
-import javax.swing.border.EmptyBorder;
-import javax.swing.event.ListSelectionEvent;
-import javax.swing.event.ListSelectionListener;
-
-import net.sf.taverna.t2.workbench.configuration.workbench.ui.T2ConfigurationFrame;
-
-import org.apache.log4j.Logger;
-
-import uk.org.taverna.configuration.ConfigurationUIFactory;
-
-public class T2ConfigurationFrameImpl implements T2ConfigurationFrame {
-	private static Logger logger = Logger.getLogger(T2ConfigurationFrameImpl.class);
-	private static final int FRAME_WIDTH = 700;
-	private static final int FRAME_HEIGHT = 450;
-
-	private List<ConfigurationUIFactory> configurationUIFactories = new ArrayList<>();
-
-	private JFrame frame;
-	private JSplitPane splitPane;
-	private JList<ConfigurableItem> list;
-
-	public T2ConfigurationFrameImpl() {
-	}
-
-	@Override
-	public void showFrame() {
-		getFrame().setVisible(true);
-	}
-
-	@Override
-	public void showConfiguration(String name) {
-		showFrame();
-		ListModel<ConfigurableItem> lm = list.getModel();
-		for (int i = 0; i < lm.getSize(); i++)
-			if (lm.getElementAt(i).toString().equals(name)) {
-				list.setSelectedIndex(i);
-				break;
-			}
-	}
-
-	private JFrame getFrame() {
-		if (frame != null)
-			return frame;
-
-		frame = new JFrame();
-		setKeyCatcher(frame);
-		registerComponent(frame);
-		frame.setLayout(new BorderLayout());
-
-		/*
-		 * Split pane to hold list of properties (on the left) and their
-		 * configurable options (on the right)
-		 */
-		splitPane = new JSplitPane(HORIZONTAL_SPLIT);
-		splitPane.setBorder(null);
-
-		list = getConfigurationList();
-		JScrollPane jspList = new JScrollPane(list);
-		jspList.setBorder(new EmptyBorder(5, 5, 5, 5));
-		jspList.setMinimumSize(new Dimension(150,
-				jspList.getPreferredSize().height));
-
-		splitPane.setLeftComponent(jspList);
-		splitPane.setRightComponent(new JPanel());
-		splitPane.setDividerSize(1);
-
-		// select first item if one exists
-		if (list.getModel().getSize() > 0)
-			list.setSelectedValue(list.getModel().getElementAt(0), true);
-
-		frame.add(splitPane);
-		frame.setSize(new Dimension(FRAME_WIDTH, FRAME_HEIGHT));
-		return frame;
-	}
-
-	private JList<ConfigurableItem> getConfigurationList() {
-		if (list != null)
-			return list;
-
-		list = new JList<>();
-		list.addListSelectionListener(new ListSelectionListener() {
-			@Override
-			public void valueChanged(ListSelectionEvent e) {
-				if (list.getSelectedValue() instanceof ConfigurableItem) {
-					ConfigurableItem item = (ConfigurableItem) list
-							.getSelectedValue();
-					setMainPanel(item.getPanel());
-				}
-
-				/*
-				 * Keep the split pane's divider at its current position - but
-				 * looks ugly. The problem with divider moving from its current
-				 * position after selecting an item from the list on the left is
-				 * that the right hand side panels are loaded dynamically and it
-				 * seems there is nothing we can do about it - it's just the
-				 * JSplitPane's behaviour
-				 */
-				// splitPane.setDividerLocation(splitPane.getLastDividerLocation());
-			}
-		});
-		list.setListData(getListItems());
-		return list;
-	}
-
-	private void setMainPanel(JPanel panel) {
-		panel.setBorder(new EmptyBorder(15, 15, 15, 15));
-		splitPane.setRightComponent(panel);
-	}
-
-	public void setConfigurationUIFactories(
-			List<ConfigurationUIFactory> configurationUIFactories) {
-		this.configurationUIFactories = configurationUIFactories;
-	}
-
-	private ConfigurableItem[] getListItems() {
-		List<ConfigurableItem> arrayList = new ArrayList<>();
-		for (ConfigurationUIFactory fac : configurationUIFactories) {
-			String name = fac.getConfigurable().getDisplayName();
-			if (name != null) {
-				logger.info("Adding configurable for name: " + name);
-				arrayList.add(new ConfigurableItem(fac));
-			} else {
-				logger.warn("The configurable " + fac.getConfigurable().getClass()
-						+ " has a null name");
-			}
-		}
-		// Sort the list alphabetically
-		ConfigurableItem[] array = arrayList.toArray(new ConfigurableItem[0]);
-		Arrays.sort(array, new Comparator<ConfigurableItem>() {
-			@Override
-			public int compare(ConfigurableItem item1, ConfigurableItem item2) {
-				return item1.toString().compareToIgnoreCase(item2.toString());
-			}
-		});
-		return array;
-	}
-
-	public void update(Object service, Map<?, ?> properties) {
-		getConfigurationList().setListData(getListItems());
-		if (frame != null) {
-			frame.revalidate();
-			frame.repaint();
-			// select first item if one exists
-			if (list.getModel().getSize() > 0)
-				list.setSelectedValue(list.getModel().getElementAt(0), true);
-		}
-	}
-
-	class ConfigurableItem {
-		private final ConfigurationUIFactory factory;
-
-		public ConfigurableItem(ConfigurationUIFactory factory) {
-			this.factory = factory;
-		}
-
-		public JPanel getPanel() {
-			return factory.getConfigurationPanel();
-		}
-
-		@Override
-		public String toString() {
-			return factory.getConfigurable().getDisplayName();
-		}
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-configuration-impl/src/main/java/net/sf/taverna/t2/workbench/ui/impl/configuration/ui/WorkbenchConfigurationMenu.java
----------------------------------------------------------------------
diff --git a/taverna-configuration-impl/src/main/java/net/sf/taverna/t2/workbench/ui/impl/configuration/ui/WorkbenchConfigurationMenu.java b/taverna-configuration-impl/src/main/java/net/sf/taverna/t2/workbench/ui/impl/configuration/ui/WorkbenchConfigurationMenu.java
deleted file mode 100644
index 453f0c0..0000000
--- a/taverna-configuration-impl/src/main/java/net/sf/taverna/t2/workbench/ui/impl/configuration/ui/WorkbenchConfigurationMenu.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*******************************************************************************
- * 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.configuration.ui;
-
-import java.awt.event.ActionEvent;
-import java.net.URI;
-
-import javax.swing.AbstractAction;
-import javax.swing.Action;
-
-import net.sf.taverna.t2.ui.menu.AbstractMenuAction;
-import net.sf.taverna.t2.workbench.configuration.workbench.ui.T2ConfigurationFrame;
-
-public class WorkbenchConfigurationMenu extends AbstractMenuAction {
-	private static final String MAC_OS_X = "Mac OS X";
-
-	private T2ConfigurationFrame t2ConfigurationFrame;
-
-	public WorkbenchConfigurationMenu() {
-		super(URI.create("http://taverna.sf.net/2008/t2workbench/menu#preferences"),
-				100);
-	}
-
-	@SuppressWarnings("serial")
-	@Override
-	protected Action createAction() {
-		return new AbstractAction("Preferences") {
-			@Override
-			public void actionPerformed(ActionEvent event) {
-				t2ConfigurationFrame.showFrame();
-			}
-		};
-	}
-
-	@Override
-	public boolean isEnabled() {
-		return !MAC_OS_X.equalsIgnoreCase(System.getProperty("os.name"));
-	}
-
-	public void setT2ConfigurationFrame(T2ConfigurationFrame t2ConfigurationFrame) {
-		this.t2ConfigurationFrame = t2ConfigurationFrame;
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-configuration-impl/src/main/java/net/sf/taverna/t2/workbench/ui/impl/configuration/ui/WorkbenchPreferencesSection.java
----------------------------------------------------------------------
diff --git a/taverna-configuration-impl/src/main/java/net/sf/taverna/t2/workbench/ui/impl/configuration/ui/WorkbenchPreferencesSection.java b/taverna-configuration-impl/src/main/java/net/sf/taverna/t2/workbench/ui/impl/configuration/ui/WorkbenchPreferencesSection.java
deleted file mode 100644
index d131ac3..0000000
--- a/taverna-configuration-impl/src/main/java/net/sf/taverna/t2/workbench/ui/impl/configuration/ui/WorkbenchPreferencesSection.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*******************************************************************************
- * 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.configuration.ui;
-
-import java.net.URI;
-
-import net.sf.taverna.t2.ui.menu.AbstractMenuSection;
-
-public class WorkbenchPreferencesSection extends AbstractMenuSection {
-	private static final URI FILE_MENU = URI
-			.create("http://taverna.sf.net/2008/t2workbench/menu#file");
-	private static final URI PREFERENCES_MENU_ITEM = URI
-			.create("http://taverna.sf.net/2008/t2workbench/menu#preferences");
-
-	public WorkbenchPreferencesSection() {
-		super(FILE_MENU, 100, PREFERENCES_MENU_ITEM);
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-configuration-impl/src/main/java/org/apache/taverna/workbench/ui/impl/configuration/WorkbenchConfigurationImpl.java
----------------------------------------------------------------------
diff --git a/taverna-configuration-impl/src/main/java/org/apache/taverna/workbench/ui/impl/configuration/WorkbenchConfigurationImpl.java b/taverna-configuration-impl/src/main/java/org/apache/taverna/workbench/ui/impl/configuration/WorkbenchConfigurationImpl.java
new file mode 100644
index 0000000..b7bf1f2
--- /dev/null
+++ b/taverna-configuration-impl/src/main/java/org/apache/taverna/workbench/ui/impl/configuration/WorkbenchConfigurationImpl.java
@@ -0,0 +1,209 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.impl.configuration;
+
+import java.io.File;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.taverna.workbench.configuration.workbench.WorkbenchConfiguration;
+
+import org.apache.log4j.Logger;
+
+import uk.org.taverna.configuration.AbstractConfigurable;
+import uk.org.taverna.configuration.ConfigurationManager;
+import uk.org.taverna.configuration.app.ApplicationConfiguration;
+
+/**
+ * An implementation of Configurable for general Workbench configuration
+ * properties
+ * 
+ * @author Stuart Owen
+ * @author Stian Soiland-Reyes
+ */
+public class WorkbenchConfigurationImpl extends AbstractConfigurable implements
+		WorkbenchConfiguration {
+	private static Logger logger = Logger
+			.getLogger(WorkbenchConfiguration.class);
+	private static final int DEFAULT_MAX_MENU_ITEMS = 20;
+	public static final String TAVERNA_DOTLOCATION = "taverna.dotlocation";
+	public static final String MAX_MENU_ITEMS = "taverna.maxmenuitems";
+	public static final String WARN_INTERNAL_ERRORS = "taverna.warninternal";
+	public static final String CAPTURE_CONSOLE = "taverna.captureconsole";
+	private static final String BIN = "bin";
+	private static final String BUNDLE_CONTENTS = "Contents";
+	private static final String BUNDLE_MAC_OS = "MacOS";
+	private static final String DOT_EXE = "dot.exe";
+	private static final String DOT_FALLBACK = "dot";
+	public static String uuid = "c14856f0-5967-11dd-ae16-0800200c9a66";
+	private static final String MAC_OS_X = "Mac OS X";
+	private static final String WIN32I386 = "win32i386";
+	private static final String WINDOWS = "Windows";
+
+	private ApplicationConfiguration applicationConfiguration;
+
+	/**
+	 * Constructs a new <code>WorkbenchConfigurationImpl</code>.
+	 * 
+	 * @param configurationManager
+	 */
+	public WorkbenchConfigurationImpl(ConfigurationManager configurationManager) {
+		super(configurationManager);
+	}
+
+	Map<String, String> defaultWorkbenchProperties = null;
+	Map<String, String> workbenchProperties = new HashMap<String, String>();
+
+	@Override
+	public String getCategory() {
+		return "general";
+	}
+
+	@Override
+	public Map<String, String> getDefaultPropertyMap() {
+		if (defaultWorkbenchProperties == null) {
+			defaultWorkbenchProperties = new HashMap<>();
+			String dotLocation = System.getProperty(TAVERNA_DOTLOCATION) != null ? System
+					.getProperty(TAVERNA_DOTLOCATION) : getDefaultDotLocation();
+			if (dotLocation != null)
+				defaultWorkbenchProperties
+						.put(TAVERNA_DOTLOCATION, dotLocation);
+			defaultWorkbenchProperties.put(MAX_MENU_ITEMS,
+					Integer.toString(DEFAULT_MAX_MENU_ITEMS));
+			defaultWorkbenchProperties.put(WARN_INTERNAL_ERRORS,
+					Boolean.FALSE.toString());
+			defaultWorkbenchProperties.put(CAPTURE_CONSOLE,
+					Boolean.TRUE.toString());
+		}
+		return defaultWorkbenchProperties;
+	}
+
+	@Override
+	public String getDisplayName() {
+		return "Workbench";
+	}
+
+	@Override
+	public String getFilePrefix() {
+		return "Workbench";
+	}
+
+	@Override
+	public String getUUID() {
+		return uuid;
+	}
+
+	@Override
+	public boolean getWarnInternalErrors() {
+		String property = getProperty(WARN_INTERNAL_ERRORS);
+		return Boolean.parseBoolean(property);
+	}
+
+	@Override
+	public boolean getCaptureConsole() {
+		String property = getProperty(CAPTURE_CONSOLE);
+		return Boolean.parseBoolean(property);
+	}
+
+	@Override
+	public void setWarnInternalErrors(boolean warnInternalErrors) {
+		setProperty(WARN_INTERNAL_ERRORS, Boolean.toString(warnInternalErrors));
+	}
+
+	@Override
+	public void setCaptureConsole(boolean captureConsole) {
+		setProperty(CAPTURE_CONSOLE, Boolean.toString(captureConsole));
+	}
+
+	@Override
+	public void setMaxMenuItems(int maxMenuItems) {
+		if (maxMenuItems < 2)
+			throw new IllegalArgumentException(
+					"Maximum menu items must be at least 2");
+		setProperty(MAX_MENU_ITEMS, Integer.toString(maxMenuItems));
+	}
+
+	@Override
+	public int getMaxMenuItems() {
+		String property = getProperty(MAX_MENU_ITEMS);
+		try {
+			int maxMenuItems = Integer.parseInt(property);
+			if (maxMenuItems >= 2)
+				return maxMenuItems;
+			logger.warn(MAX_MENU_ITEMS + " can't be less than 2");
+		} catch (NumberFormatException ex) {
+			logger.warn("Invalid number for " + MAX_MENU_ITEMS + ": "
+					+ property);
+		}
+		// We'll return the default instead
+		return DEFAULT_MAX_MENU_ITEMS;
+	}
+
+	@Override
+	public String getDotLocation() {
+		return getProperty(TAVERNA_DOTLOCATION);
+	}
+
+	@Override
+	public void setDotLocation(String dotLocation) {
+		setProperty(TAVERNA_DOTLOCATION, dotLocation);
+	}
+
+	private String getDefaultDotLocation() {
+		if (applicationConfiguration == null)
+			return null;
+		File startupDir = applicationConfiguration.getStartupDir();
+		if (startupDir == null)
+			return DOT_FALLBACK;
+
+		String os = System.getProperty("os.name");
+		if (os.equals(MAC_OS_X))
+			if (startupDir.getParentFile() != null) {
+				File contentsDir = startupDir.getParentFile().getParentFile();
+				if (contentsDir != null
+						&& contentsDir.getName().equalsIgnoreCase(
+								BUNDLE_CONTENTS)) {
+					File dot = new File(new File(contentsDir, BUNDLE_MAC_OS),
+							DOT_FALLBACK);
+					if (dot.exists())
+						return dot.getAbsolutePath();
+				}
+			} else if (os.startsWith(WINDOWS)) {
+				File binWin386Dir = new File(new File(startupDir, BIN),
+						WIN32I386);
+				File dot = new File(binWin386Dir, DOT_EXE);
+				if (dot.exists())
+					return dot.getAbsolutePath();
+			}
+		return DOT_FALLBACK;
+	}
+
+	/**
+	 * Sets the applicationConfiguration.
+	 * 
+	 * @param applicationConfiguration
+	 *            the new value of applicationConfiguration
+	 */
+	public void setApplicationConfiguration(
+			ApplicationConfiguration applicationConfiguration) {
+		this.applicationConfiguration = applicationConfiguration;
+		defaultWorkbenchProperties = null;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-configuration-impl/src/main/java/org/apache/taverna/workbench/ui/impl/configuration/WorkbenchConfigurationPanel.java
----------------------------------------------------------------------
diff --git a/taverna-configuration-impl/src/main/java/org/apache/taverna/workbench/ui/impl/configuration/WorkbenchConfigurationPanel.java b/taverna-configuration-impl/src/main/java/org/apache/taverna/workbench/ui/impl/configuration/WorkbenchConfigurationPanel.java
new file mode 100644
index 0000000..dec3d13
--- /dev/null
+++ b/taverna-configuration-impl/src/main/java/org/apache/taverna/workbench/ui/impl/configuration/WorkbenchConfigurationPanel.java
@@ -0,0 +1,265 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.impl.configuration;
+
+import static java.awt.GridBagConstraints.*;
+import static javax.swing.JFileChooser.APPROVE_OPTION;
+import static javax.swing.JOptionPane.INFORMATION_MESSAGE;
+import static javax.swing.JOptionPane.WARNING_MESSAGE;
+import static javax.swing.JOptionPane.showMessageDialog;
+import static org.apache.taverna.workbench.helper.Helper.showHelp;
+import static org.apache.taverna.workbench.icons.WorkbenchIcons.openIcon;
+
+import java.awt.Component;
+import java.awt.FlowLayout;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.Insets;
+import java.awt.event.ActionEvent;
+
+import javax.swing.AbstractAction;
+import javax.swing.JButton;
+import javax.swing.JCheckBox;
+import javax.swing.JFileChooser;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JTextArea;
+import javax.swing.JTextField;
+import javax.swing.border.EmptyBorder;
+
+import org.apache.taverna.workbench.configuration.workbench.WorkbenchConfiguration;
+
+import org.apache.log4j.Logger;
+
+@SuppressWarnings("serial")
+public class WorkbenchConfigurationPanel extends JPanel {
+	private static final String RESTART_MSG = "For the new configuration to be fully applied, it is advised to restart Taverna.";
+	private static final String DOT_PATH_MSG = "Path to Graphviz executable <code>dot</code>:";
+	private static final String CONTEXT_MENU_SIZE_MSG = "Maximum number of services/ports in right-click menu:";
+	private static Logger logger = Logger
+			.getLogger(WorkbenchConfigurationUIFactory.class);
+
+	private JTextField dotLocation = new JTextField(25);
+	private JTextField menuItems = new JTextField(10);
+	private JCheckBox warnInternal = new JCheckBox("Warn on internal errors");
+	private JCheckBox captureConsole = new JCheckBox(
+			"Capture output on stdout/stderr to log file");
+
+	private final WorkbenchConfiguration workbenchConfiguration;
+
+	public WorkbenchConfigurationPanel(
+			WorkbenchConfiguration workbenchConfiguration) {
+		super();
+		this.workbenchConfiguration = workbenchConfiguration;
+		initComponents();
+	}
+
+	private static JLabel htmlLabel(String html) {
+		return new JLabel("<html><body>" + html + "</body></html>");
+	}
+
+	private void initComponents() {
+		this.setLayout(new GridBagLayout());
+		GridBagConstraints gbc = new GridBagConstraints();
+
+		// Title describing what kind of settings we are configuring here
+		JTextArea descriptionText = new JTextArea(
+				"General Workbench configuration");
+		descriptionText.setLineWrap(true);
+		descriptionText.setWrapStyleWord(true);
+		descriptionText.setEditable(false);
+		descriptionText.setFocusable(false);
+		descriptionText.setBorder(new EmptyBorder(10, 10, 10, 10));
+		gbc.anchor = WEST;
+		gbc.gridx = 0;
+		gbc.gridy = 0;
+		gbc.gridwidth = 2;
+		gbc.weightx = 1.0;
+		gbc.weighty = 0.0;
+		gbc.fill = HORIZONTAL;
+		this.add(descriptionText, gbc);
+
+		gbc.gridx = 0;
+		gbc.gridy = 1;
+		gbc.gridwidth = 2;
+		gbc.weightx = 0.0;
+		gbc.weighty = 0.0;
+		gbc.insets = new Insets(10, 5, 0, 0);
+		gbc.fill = NONE;
+		this.add(htmlLabel(DOT_PATH_MSG), gbc);
+
+		dotLocation.setText(workbenchConfiguration.getDotLocation());
+		gbc.gridy++;
+		gbc.gridwidth = 1;
+		gbc.weightx = 1.0;
+		gbc.insets = new Insets(0, 0, 0, 0);
+		gbc.fill = HORIZONTAL;
+		this.add(dotLocation, gbc);
+
+		JButton browseButton = new JButton();
+		gbc.gridx = 1;
+		gbc.weightx = 0.0;
+		gbc.fill = NONE;
+		this.add(browseButton, gbc);
+		browseButton.setAction(new AbstractAction() {
+			@Override
+			public void actionPerformed(ActionEvent e) {
+				System.setProperty("com.apple.macos.use-file-dialog-packages",
+						"false");
+				JFileChooser fileChooser = new JFileChooser();
+				fileChooser.putClientProperty(
+						"JFileChooser.appBundleIsTraversable", "always");
+				fileChooser.putClientProperty(
+						"JFileChooser.packageIsTraversable", "always");
+
+				fileChooser.setDialogTitle("Browse for dot");
+
+				fileChooser.resetChoosableFileFilters();
+				fileChooser.setAcceptAllFileFilterUsed(false);
+
+				fileChooser.setMultiSelectionEnabled(false);
+
+				int returnVal = fileChooser
+						.showOpenDialog(WorkbenchConfigurationPanel.this);
+				if (returnVal == APPROVE_OPTION)
+					dotLocation.setText(fileChooser.getSelectedFile()
+							.getAbsolutePath());
+			}
+		});
+		browseButton.setIcon(openIcon);
+
+		gbc.gridx = 0;
+		gbc.gridy++;
+		gbc.gridwidth = 2;
+		gbc.weightx = 0.0;
+		gbc.weighty = 0.0;
+		gbc.insets = new Insets(10, 5, 0, 0);
+		gbc.fill = HORIZONTAL;
+		this.add(htmlLabel(CONTEXT_MENU_SIZE_MSG), gbc);
+
+		menuItems.setText(Integer.toString(workbenchConfiguration
+				.getMaxMenuItems()));
+		gbc.gridy++;
+		gbc.weightx = 1.0;
+		gbc.gridwidth = 1;
+		gbc.insets = new Insets(0, 0, 0, 0);
+		gbc.fill = HORIZONTAL;
+		this.add(menuItems, gbc);
+
+		gbc.gridx = 0;
+		gbc.gridy++;
+		gbc.gridwidth = 2;
+		gbc.weightx = 1.0;
+		gbc.fill = HORIZONTAL;
+		gbc.insets = new Insets(10, 0, 0, 0);
+		warnInternal
+				.setSelected(workbenchConfiguration.getWarnInternalErrors());
+		this.add(warnInternal, gbc);
+
+		gbc.gridy++;
+		gbc.insets = new Insets(0, 0, 10, 0);
+		captureConsole.setSelected(workbenchConfiguration.getCaptureConsole());
+		this.add(captureConsole, gbc);
+
+		// Add the buttons panel
+		gbc.gridx = 0;
+		gbc.gridy++;
+		gbc.gridwidth = 3;
+		gbc.weightx = 1.0;
+		gbc.weighty = 1.0;
+		gbc.fill = BOTH;
+		gbc.anchor = SOUTH;
+		this.add(getButtonsPanel(), gbc);
+	}
+
+	private Component getButtonsPanel() {
+		final JPanel panel = new JPanel();
+		panel.setLayout(new FlowLayout(FlowLayout.CENTER));
+
+		/**
+		 * The helpButton shows help about the current component
+		 */
+		JButton helpButton = new JButton(new AbstractAction("Help") {
+			@Override
+			public void actionPerformed(ActionEvent arg0) {
+				showHelp(panel);
+			}
+		});
+		panel.add(helpButton);
+
+		/**
+		 * The resetButton changes the property values shown to those
+		 * corresponding to the configuration currently applied.
+		 */
+		JButton resetButton = new JButton(new AbstractAction("Reset") {
+			@Override
+			public void actionPerformed(ActionEvent arg0) {
+				resetFields();
+			}
+		});
+		panel.add(resetButton);
+
+		JButton applyButton = new JButton(new AbstractAction("Apply") {
+			@Override
+			public void actionPerformed(ActionEvent arg0) {
+				String menus = menuItems.getText();
+				try {
+					workbenchConfiguration.setMaxMenuItems(Integer
+							.valueOf(menus));
+				} catch (IllegalArgumentException e) {
+					String message = "Invalid menu items number " + menus
+							+ ":\n" + e.getLocalizedMessage();
+					showMessageDialog(panel, message, "Invalid menu items",
+							WARNING_MESSAGE);
+					return;
+				}
+
+				workbenchConfiguration.setCaptureConsole(captureConsole
+						.isSelected());
+				workbenchConfiguration.setWarnInternalErrors(warnInternal
+						.isSelected());
+				workbenchConfiguration.setDotLocation(dotLocation.getText());
+				try {
+					showMessageDialog(panel, RESTART_MSG, "Restart adviced",
+							INFORMATION_MESSAGE);
+				} catch (Exception e) {
+					logger.error("Error storing updated configuration", e);
+				}
+			}
+		});
+		panel.add(applyButton);
+		return panel;
+	}
+
+	/**
+	 * Resets the shown field values to those currently set (last saved) in the
+	 * configuration.
+	 * 
+	 * @param configurable
+	 */
+	private void resetFields() {
+		menuItems.setText(Integer.toString(workbenchConfiguration
+				.getMaxMenuItems()));
+		dotLocation.setText(workbenchConfiguration.getDotLocation());
+		warnInternal
+				.setSelected(workbenchConfiguration.getWarnInternalErrors());
+		captureConsole.setSelected(workbenchConfiguration.getCaptureConsole());
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-configuration-impl/src/main/java/org/apache/taverna/workbench/ui/impl/configuration/WorkbenchConfigurationUIFactory.java
----------------------------------------------------------------------
diff --git a/taverna-configuration-impl/src/main/java/org/apache/taverna/workbench/ui/impl/configuration/WorkbenchConfigurationUIFactory.java b/taverna-configuration-impl/src/main/java/org/apache/taverna/workbench/ui/impl/configuration/WorkbenchConfigurationUIFactory.java
new file mode 100644
index 0000000..7351462
--- /dev/null
+++ b/taverna-configuration-impl/src/main/java/org/apache/taverna/workbench/ui/impl/configuration/WorkbenchConfigurationUIFactory.java
@@ -0,0 +1,51 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.impl.configuration;
+
+import javax.swing.JPanel;
+
+import uk.org.taverna.configuration.Configurable;
+import uk.org.taverna.configuration.ConfigurationUIFactory;
+
+import org.apache.taverna.workbench.configuration.workbench.WorkbenchConfiguration;
+
+public class WorkbenchConfigurationUIFactory implements ConfigurationUIFactory {
+	private WorkbenchConfiguration workbenchConfiguration;
+
+	@Override
+	public boolean canHandle(String uuid) {
+		return uuid.equals(workbenchConfiguration.getUUID());
+	}
+
+	@Override
+	public JPanel getConfigurationPanel() {
+		return new WorkbenchConfigurationPanel(workbenchConfiguration);
+	}
+
+	@Override
+	public Configurable getConfigurable() {
+		return workbenchConfiguration;
+	}
+
+	public void setWorkbenchConfiguration(
+			WorkbenchConfiguration workbenchConfiguration) {
+		this.workbenchConfiguration = workbenchConfiguration;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-configuration-impl/src/main/java/org/apache/taverna/workbench/ui/impl/configuration/colour/ColourManagerImpl.java
----------------------------------------------------------------------
diff --git a/taverna-configuration-impl/src/main/java/org/apache/taverna/workbench/ui/impl/configuration/colour/ColourManagerImpl.java b/taverna-configuration-impl/src/main/java/org/apache/taverna/workbench/ui/impl/configuration/colour/ColourManagerImpl.java
new file mode 100644
index 0000000..1f5ccd6
--- /dev/null
+++ b/taverna-configuration-impl/src/main/java/org/apache/taverna/workbench/ui/impl/configuration/colour/ColourManagerImpl.java
@@ -0,0 +1,177 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.impl.configuration.colour;
+
+import static java.awt.Color.WHITE;
+import static java.awt.Color.decode;
+
+import java.awt.Color;
+import java.util.HashMap;
+import java.util.Map;
+
+import uk.org.taverna.configuration.AbstractConfigurable;
+import uk.org.taverna.configuration.ConfigurationManager;
+import org.apache.taverna.workbench.configuration.colour.ColourManager;
+
+/**
+ * A factory class that determines the colour that a Colourable UI component
+ * should be displayed as, according to a schema configured by the user.
+ * 
+ * @author Stuart Owen
+ * @author Ian Dunlop
+ * @see Colourable
+ */
+public class ColourManagerImpl extends AbstractConfigurable implements
+		ColourManager {
+	// Names of things that may be coloured
+	private static final String WORKFLOW_PORT_OBJECT = "org.apache.taverna.scufl2.api.port.WorkflowPort";
+	private static final String PROCESSOR_PORT_OBJECT = "org.apache.taverna.scufl2.api.port.ProcessorPort";
+	private static final String PROCESSOR_OBJECT = "org.apache.taverna.scufl2.api.core.Processor";
+	private static final String MERGE_OBJECT = "org.apache.taverna.workflowmodel.Merge";
+	private static final String NONEXECUTABLE_ACTIVITY = "http://ns.taverna.org.uk/2010/activity/nonExecutable";
+	private static final String XML_SPLITTER_OUT_ACTIVITY = "http://ns.taverna.org.uk/2010/activity/xml-splitter/out";
+	private static final String XML_SPLITTER_IN_ACTIVITY = "http://ns.taverna.org.uk/2010/activity/xml-splitter/in";
+	private static final String LOCALWORKER_ACTIVITY = "http://ns.taverna.org.uk/2010/activity/localworker";
+	private static final String WSDL_ACTIVITY = "http://ns.taverna.org.uk/2010/activity/wsdl";
+	private static final String CONSTANT_ACTIVITY = "http://ns.taverna.org.uk/2010/activity/constant";
+	private static final String SOAPLAB_ACTIVITY = "http://ns.taverna.org.uk/2010/activity/soaplab";
+	private static final String RSHELL_ACTIVITY = "http://ns.taverna.org.uk/2010/activity/rshell";
+	private static final String NESTED_WORKFLOW = "http://ns.taverna.org.uk/2010/activity/nested-workflow";
+	private static final String MOBY_PARSER_ACTIVITY = "http://ns.taverna.org.uk/2010/activity/biomoby/parser";
+	private static final String MOBY_OBJECT_ACTIVITY = "http://ns.taverna.org.uk/2010/activity/biomoby/object";
+	private static final String MOBY_SERVICE_ACTIVITY = "http://ns.taverna.org.uk/2010/activity/biomoby/service";
+	private static final String BIOMART_ACTIVITY = "http://ns.taverna.org.uk/2010/activity/biomart";
+	private static final String BEANSHELL_ACTIVITY = "http://ns.taverna.org.uk/2010/activity/beanshell";
+	private static final String APICONSUMER_ACTIVITY = "http://ns.taverna.org.uk/2010/activity/apiconsumer";
+
+	// Names of colours used
+	private static final String burlywood2 = "#deb887";
+	private static final String darkgoldenrod1 = "#ffb90f";
+	private static final String darkolivegreen3 = "#a2cd5a";
+	private static final String gold = "#ffd700";
+	private static final String grey = "#777777";
+	private static final String lightcyan2 = "#d1eeee";
+	private static final String lightgoldenrodyellow = "#fafad2";
+	// light purple non standard
+	private static final String lightpurple = "#ab92ea";
+	private static final String lightsteelblue = "#b0c4de";
+	private static final String mediumorchid2 = "#d15fee";
+	private static final String palegreen = "#98fb98";
+	private static final String pink = "#ffc0cb";
+	private static final String purplish = "#8070ff";
+	// ShadedLabel.Orange
+	private static final String shadedorange = "#eece8f";
+	// ShadedLabel.Green
+	private static final String shadedgreen = "#a1c69d";
+	// slightly lighter than the real steelblue4
+	private static final String steelblue4 = "#648faa";
+	private static final String turquoise = "#77aadd";
+	private static final String white = "#ffffff";
+
+	private Map<String, String> defaultPropertyMap;
+	private Map<Object, Color> cachedColours;
+
+	public ColourManagerImpl(ConfigurationManager configurationManager) {
+		super(configurationManager);
+		initialiseDefaults();
+	}
+
+	@Override
+	public String getCategory() {
+		return "colour";
+	}
+
+	@Override
+	public Map<String, String> getDefaultPropertyMap() {
+		if (defaultPropertyMap == null)
+			initialiseDefaults();
+		return defaultPropertyMap;
+	}
+
+	@Override
+	public String getDisplayName() {
+		return "Colour Management";
+	}
+
+	@Override
+	public String getFilePrefix() {
+		return "ColourManagement";
+	}
+
+	/**
+	 * Unique identifier for this ColourManager
+	 */
+	@Override
+	public String getUUID() {
+		return "a2148420-5967-11dd-ae16-0800200c9a66";
+	}
+
+	private void initialiseDefaults() {
+		defaultPropertyMap = new HashMap<>();
+		cachedColours = new HashMap<>();
+
+		defaultPropertyMap.put(APICONSUMER_ACTIVITY, palegreen);
+		defaultPropertyMap.put(BEANSHELL_ACTIVITY, burlywood2);
+		defaultPropertyMap.put(BIOMART_ACTIVITY, lightcyan2);
+		defaultPropertyMap.put(CONSTANT_ACTIVITY, lightsteelblue);
+		defaultPropertyMap.put(LOCALWORKER_ACTIVITY, mediumorchid2);
+		defaultPropertyMap.put(MOBY_SERVICE_ACTIVITY, darkgoldenrod1);
+		defaultPropertyMap.put(MOBY_OBJECT_ACTIVITY, gold);
+		defaultPropertyMap.put(MOBY_PARSER_ACTIVITY, white);
+		defaultPropertyMap.put(NESTED_WORKFLOW, pink);
+		defaultPropertyMap.put(RSHELL_ACTIVITY, steelblue4);
+		defaultPropertyMap.put(SOAPLAB_ACTIVITY, lightgoldenrodyellow);
+		defaultPropertyMap.put(WSDL_ACTIVITY, darkolivegreen3);
+		defaultPropertyMap.put(XML_SPLITTER_IN_ACTIVITY, lightpurple);
+		defaultPropertyMap.put(XML_SPLITTER_OUT_ACTIVITY, lightpurple);
+
+		defaultPropertyMap.put(NONEXECUTABLE_ACTIVITY, grey);
+
+		defaultPropertyMap.put(MERGE_OBJECT, turquoise);
+		defaultPropertyMap.put(PROCESSOR_OBJECT, shadedgreen);
+		defaultPropertyMap.put(PROCESSOR_PORT_OBJECT, purplish);
+		defaultPropertyMap.put(WORKFLOW_PORT_OBJECT, shadedorange);
+	}
+
+	@Override
+	public Color getPreferredColour(String itemKey) {
+		Color colour = cachedColours.get(itemKey);
+		if (colour == null) {
+			String colourString = (String) getProperty(itemKey);
+			colour = colourString == null ? WHITE : decode(colourString);
+			cachedColours.put(itemKey, colour);
+		}
+		return colour;
+	}
+
+	@Override
+	public void setPreferredColour(String itemKey, Color colour) {
+		cachedColours.put(itemKey, colour);
+	}
+
+	@Override
+	public void restoreDefaults() {
+		super.restoreDefaults();
+		if (cachedColours == null)
+			cachedColours = new HashMap<>();
+		else
+			cachedColours.clear();
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-configuration-impl/src/main/java/org/apache/taverna/workbench/ui/impl/configuration/mimetype/MimeTypeManagerImpl.java
----------------------------------------------------------------------
diff --git a/taverna-configuration-impl/src/main/java/org/apache/taverna/workbench/ui/impl/configuration/mimetype/MimeTypeManagerImpl.java b/taverna-configuration-impl/src/main/java/org/apache/taverna/workbench/ui/impl/configuration/mimetype/MimeTypeManagerImpl.java
new file mode 100644
index 0000000..a0a6b0f
--- /dev/null
+++ b/taverna-configuration-impl/src/main/java/org/apache/taverna/workbench/ui/impl/configuration/mimetype/MimeTypeManagerImpl.java
@@ -0,0 +1,81 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.impl.configuration.mimetype;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.taverna.workbench.configuration.mimetype.MimeTypeManager;
+import uk.org.taverna.configuration.AbstractConfigurable;
+import uk.org.taverna.configuration.ConfigurationManager;
+
+public class MimeTypeManagerImpl extends AbstractConfigurable implements
+		MimeTypeManager {
+	/**
+	 * Constructs a new <code>MimeTypeManagerImpl</code>.
+	 * 
+	 * @param configurationManager
+	 */
+	public MimeTypeManagerImpl(ConfigurationManager configurationManager) {
+		super(configurationManager);
+	}
+
+	@Override
+	public String getCategory() {
+		return "Mime Type";
+	}
+
+	@Override
+	public Map<String, String> getDefaultPropertyMap() {
+		HashMap<String, String> map = new HashMap<>();
+		map.put("text/plain", "Plain Text");
+		map.put("text/xml", "XML Text");
+		map.put("text/html", "HTML Text");
+		map.put("text/rtf", "Rich Text Format");
+		map.put("text/x-graphviz", "Graphviz Dot File");
+		map.put("image/png", "PNG Image");
+		map.put("image/jpeg", "JPEG Image");
+		map.put("image/gif", "GIF Image");
+		map.put("application/octet-stream", "Binary Data");
+		map.put("application/zip", "Zip File");
+		map.put("chemical/x-swissprot", "SWISSPROT Flat File");
+		map.put("chemical/x-embl-dl-nucleotide", "EMBL Flat File");
+		map.put("chemical/x-ppd", "PPD File");
+		map.put("chemical/seq-aa-genpept", "Genpept Protein");
+		map.put("chemical/seq-na-genbank", "Genbank Nucleotide");
+		map.put("chemical/x-pdb", "PDB 3D Structure File");
+		return map;
+	}
+
+	@Override
+	public String getUUID() {
+		return "b9277fa0-5967-11dd-ae16-0800200c9a66";
+	}
+
+	@Override
+	public String getDisplayName() {
+		return "Mime Type Manager";
+	}
+
+	@Override
+	public String getFilePrefix() {
+		return "MimeTypeManagerImpl";
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-configuration-impl/src/main/java/org/apache/taverna/workbench/ui/impl/configuration/ui/T2ConfigurationFrameImpl.java
----------------------------------------------------------------------
diff --git a/taverna-configuration-impl/src/main/java/org/apache/taverna/workbench/ui/impl/configuration/ui/T2ConfigurationFrameImpl.java b/taverna-configuration-impl/src/main/java/org/apache/taverna/workbench/ui/impl/configuration/ui/T2ConfigurationFrameImpl.java
new file mode 100644
index 0000000..678cdc3
--- /dev/null
+++ b/taverna-configuration-impl/src/main/java/org/apache/taverna/workbench/ui/impl/configuration/ui/T2ConfigurationFrameImpl.java
@@ -0,0 +1,204 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.impl.configuration.ui;
+
+import static javax.swing.JSplitPane.HORIZONTAL_SPLIT;
+import static org.apache.taverna.workbench.helper.HelpCollator.registerComponent;
+import static org.apache.taverna.workbench.helper.Helper.setKeyCatcher;
+
+import java.awt.BorderLayout;
+import java.awt.Dimension;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Comparator;
+import java.util.List;
+import java.util.Map;
+
+import javax.swing.JFrame;
+import javax.swing.JList;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JSplitPane;
+import javax.swing.ListModel;
+import javax.swing.border.EmptyBorder;
+import javax.swing.event.ListSelectionEvent;
+import javax.swing.event.ListSelectionListener;
+
+import org.apache.taverna.workbench.configuration.workbench.ui.T2ConfigurationFrame;
+
+import org.apache.log4j.Logger;
+
+import uk.org.taverna.configuration.ConfigurationUIFactory;
+
+public class T2ConfigurationFrameImpl implements T2ConfigurationFrame {
+	private static Logger logger = Logger.getLogger(T2ConfigurationFrameImpl.class);
+	private static final int FRAME_WIDTH = 700;
+	private static final int FRAME_HEIGHT = 450;
+
+	private List<ConfigurationUIFactory> configurationUIFactories = new ArrayList<>();
+
+	private JFrame frame;
+	private JSplitPane splitPane;
+	private JList<ConfigurableItem> list;
+
+	public T2ConfigurationFrameImpl() {
+	}
+
+	@Override
+	public void showFrame() {
+		getFrame().setVisible(true);
+	}
+
+	@Override
+	public void showConfiguration(String name) {
+		showFrame();
+		ListModel<ConfigurableItem> lm = list.getModel();
+		for (int i = 0; i < lm.getSize(); i++)
+			if (lm.getElementAt(i).toString().equals(name)) {
+				list.setSelectedIndex(i);
+				break;
+			}
+	}
+
+	private JFrame getFrame() {
+		if (frame != null)
+			return frame;
+
+		frame = new JFrame();
+		setKeyCatcher(frame);
+		registerComponent(frame);
+		frame.setLayout(new BorderLayout());
+
+		/*
+		 * Split pane to hold list of properties (on the left) and their
+		 * configurable options (on the right)
+		 */
+		splitPane = new JSplitPane(HORIZONTAL_SPLIT);
+		splitPane.setBorder(null);
+
+		list = getConfigurationList();
+		JScrollPane jspList = new JScrollPane(list);
+		jspList.setBorder(new EmptyBorder(5, 5, 5, 5));
+		jspList.setMinimumSize(new Dimension(150,
+				jspList.getPreferredSize().height));
+
+		splitPane.setLeftComponent(jspList);
+		splitPane.setRightComponent(new JPanel());
+		splitPane.setDividerSize(1);
+
+		// select first item if one exists
+		if (list.getModel().getSize() > 0)
+			list.setSelectedValue(list.getModel().getElementAt(0), true);
+
+		frame.add(splitPane);
+		frame.setSize(new Dimension(FRAME_WIDTH, FRAME_HEIGHT));
+		return frame;
+	}
+
+	private JList<ConfigurableItem> getConfigurationList() {
+		if (list != null)
+			return list;
+
+		list = new JList<>();
+		list.addListSelectionListener(new ListSelectionListener() {
+			@Override
+			public void valueChanged(ListSelectionEvent e) {
+				if (list.getSelectedValue() instanceof ConfigurableItem) {
+					ConfigurableItem item = (ConfigurableItem) list
+							.getSelectedValue();
+					setMainPanel(item.getPanel());
+				}
+
+				/*
+				 * Keep the split pane's divider at its current position - but
+				 * looks ugly. The problem with divider moving from its current
+				 * position after selecting an item from the list on the left is
+				 * that the right hand side panels are loaded dynamically and it
+				 * seems there is nothing we can do about it - it's just the
+				 * JSplitPane's behaviour
+				 */
+				// splitPane.setDividerLocation(splitPane.getLastDividerLocation());
+			}
+		});
+		list.setListData(getListItems());
+		return list;
+	}
+
+	private void setMainPanel(JPanel panel) {
+		panel.setBorder(new EmptyBorder(15, 15, 15, 15));
+		splitPane.setRightComponent(panel);
+	}
+
+	public void setConfigurationUIFactories(
+			List<ConfigurationUIFactory> configurationUIFactories) {
+		this.configurationUIFactories = configurationUIFactories;
+	}
+
+	private ConfigurableItem[] getListItems() {
+		List<ConfigurableItem> arrayList = new ArrayList<>();
+		for (ConfigurationUIFactory fac : configurationUIFactories) {
+			String name = fac.getConfigurable().getDisplayName();
+			if (name != null) {
+				logger.info("Adding configurable for name: " + name);
+				arrayList.add(new ConfigurableItem(fac));
+			} else {
+				logger.warn("The configurable " + fac.getConfigurable().getClass()
+						+ " has a null name");
+			}
+		}
+		// Sort the list alphabetically
+		ConfigurableItem[] array = arrayList.toArray(new ConfigurableItem[0]);
+		Arrays.sort(array, new Comparator<ConfigurableItem>() {
+			@Override
+			public int compare(ConfigurableItem item1, ConfigurableItem item2) {
+				return item1.toString().compareToIgnoreCase(item2.toString());
+			}
+		});
+		return array;
+	}
+
+	public void update(Object service, Map<?, ?> properties) {
+		getConfigurationList().setListData(getListItems());
+		if (frame != null) {
+			frame.revalidate();
+			frame.repaint();
+			// select first item if one exists
+			if (list.getModel().getSize() > 0)
+				list.setSelectedValue(list.getModel().getElementAt(0), true);
+		}
+	}
+
+	class ConfigurableItem {
+		private final ConfigurationUIFactory factory;
+
+		public ConfigurableItem(ConfigurationUIFactory factory) {
+			this.factory = factory;
+		}
+
+		public JPanel getPanel() {
+			return factory.getConfigurationPanel();
+		}
+
+		@Override
+		public String toString() {
+			return factory.getConfigurable().getDisplayName();
+		}
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-configuration-impl/src/main/java/org/apache/taverna/workbench/ui/impl/configuration/ui/WorkbenchConfigurationMenu.java
----------------------------------------------------------------------
diff --git a/taverna-configuration-impl/src/main/java/org/apache/taverna/workbench/ui/impl/configuration/ui/WorkbenchConfigurationMenu.java b/taverna-configuration-impl/src/main/java/org/apache/taverna/workbench/ui/impl/configuration/ui/WorkbenchConfigurationMenu.java
new file mode 100644
index 0000000..f5caf8d
--- /dev/null
+++ b/taverna-configuration-impl/src/main/java/org/apache/taverna/workbench/ui/impl/configuration/ui/WorkbenchConfigurationMenu.java
@@ -0,0 +1,60 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.impl.configuration.ui;
+
+import java.awt.event.ActionEvent;
+import java.net.URI;
+
+import javax.swing.AbstractAction;
+import javax.swing.Action;
+
+import org.apache.taverna.ui.menu.AbstractMenuAction;
+import org.apache.taverna.workbench.configuration.workbench.ui.T2ConfigurationFrame;
+
+public class WorkbenchConfigurationMenu extends AbstractMenuAction {
+	private static final String MAC_OS_X = "Mac OS X";
+
+	private T2ConfigurationFrame t2ConfigurationFrame;
+
+	public WorkbenchConfigurationMenu() {
+		super(URI.create("http://taverna.sf.net/2008/t2workbench/menu#preferences"),
+				100);
+	}
+
+	@SuppressWarnings("serial")
+	@Override
+	protected Action createAction() {
+		return new AbstractAction("Preferences") {
+			@Override
+			public void actionPerformed(ActionEvent event) {
+				t2ConfigurationFrame.showFrame();
+			}
+		};
+	}
+
+	@Override
+	public boolean isEnabled() {
+		return !MAC_OS_X.equalsIgnoreCase(System.getProperty("os.name"));
+	}
+
+	public void setT2ConfigurationFrame(T2ConfigurationFrame t2ConfigurationFrame) {
+		this.t2ConfigurationFrame = t2ConfigurationFrame;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-configuration-impl/src/main/java/org/apache/taverna/workbench/ui/impl/configuration/ui/WorkbenchPreferencesSection.java
----------------------------------------------------------------------
diff --git a/taverna-configuration-impl/src/main/java/org/apache/taverna/workbench/ui/impl/configuration/ui/WorkbenchPreferencesSection.java b/taverna-configuration-impl/src/main/java/org/apache/taverna/workbench/ui/impl/configuration/ui/WorkbenchPreferencesSection.java
new file mode 100644
index 0000000..02d11a0
--- /dev/null
+++ b/taverna-configuration-impl/src/main/java/org/apache/taverna/workbench/ui/impl/configuration/ui/WorkbenchPreferencesSection.java
@@ -0,0 +1,35 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.impl.configuration.ui;
+
+import java.net.URI;
+
+import org.apache.taverna.ui.menu.AbstractMenuSection;
+
+public class WorkbenchPreferencesSection extends AbstractMenuSection {
+	private static final URI FILE_MENU = URI
+			.create("http://taverna.sf.net/2008/t2workbench/menu#file");
+	private static final URI PREFERENCES_MENU_ITEM = URI
+			.create("http://taverna.sf.net/2008/t2workbench/menu#preferences");
+
+	public WorkbenchPreferencesSection() {
+		super(FILE_MENU, 100, PREFERENCES_MENU_ITEM);
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-configuration-impl/src/main/resources/META-INF/services/net.sf.taverna.t2.ui.menu.MenuComponent
----------------------------------------------------------------------
diff --git a/taverna-configuration-impl/src/main/resources/META-INF/services/net.sf.taverna.t2.ui.menu.MenuComponent b/taverna-configuration-impl/src/main/resources/META-INF/services/net.sf.taverna.t2.ui.menu.MenuComponent
deleted file mode 100644
index 3b51dd4..0000000
--- a/taverna-configuration-impl/src/main/resources/META-INF/services/net.sf.taverna.t2.ui.menu.MenuComponent
+++ /dev/null
@@ -1,2 +0,0 @@
-net.sf.taverna.t2.workbench.ui.impl.configuration.ui.WorkbenchPreferencesSection
-net.sf.taverna.t2.workbench.ui.impl.configuration.ui.WorkbenchConfigurationMenu

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-configuration-impl/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.configuration.ConfigurationUIFactory
----------------------------------------------------------------------
diff --git a/taverna-configuration-impl/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.configuration.ConfigurationUIFactory b/taverna-configuration-impl/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.configuration.ConfigurationUIFactory
deleted file mode 100644
index 4af55ec..0000000
--- a/taverna-configuration-impl/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.configuration.ConfigurationUIFactory
+++ /dev/null
@@ -1 +0,0 @@
-net.sf.taverna.t2.workbench.ui.impl.configuration.WorkbenchConfigurationUIFactory
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-configuration-impl/src/main/resources/META-INF/services/org.apache.taverna.ui.menu.MenuComponent
----------------------------------------------------------------------
diff --git a/taverna-configuration-impl/src/main/resources/META-INF/services/org.apache.taverna.ui.menu.MenuComponent b/taverna-configuration-impl/src/main/resources/META-INF/services/org.apache.taverna.ui.menu.MenuComponent
new file mode 100644
index 0000000..c3a2e75
--- /dev/null
+++ b/taverna-configuration-impl/src/main/resources/META-INF/services/org.apache.taverna.ui.menu.MenuComponent
@@ -0,0 +1,2 @@
+org.apache.taverna.workbench.ui.impl.configuration.ui.WorkbenchPreferencesSection
+org.apache.taverna.workbench.ui.impl.configuration.ui.WorkbenchConfigurationMenu

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-configuration-impl/src/main/resources/META-INF/services/org.apache.taverna.workbench.configuration.ConfigurationUIFactory
----------------------------------------------------------------------
diff --git a/taverna-configuration-impl/src/main/resources/META-INF/services/org.apache.taverna.workbench.configuration.ConfigurationUIFactory b/taverna-configuration-impl/src/main/resources/META-INF/services/org.apache.taverna.workbench.configuration.ConfigurationUIFactory
new file mode 100644
index 0000000..7c40f64
--- /dev/null
+++ b/taverna-configuration-impl/src/main/resources/META-INF/services/org.apache.taverna.workbench.configuration.ConfigurationUIFactory
@@ -0,0 +1 @@
+org.apache.taverna.workbench.ui.impl.configuration.WorkbenchConfigurationUIFactory
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-configuration-impl/src/main/resources/META-INF/spring/configuration-impl-context-osgi.xml
----------------------------------------------------------------------
diff --git a/taverna-configuration-impl/src/main/resources/META-INF/spring/configuration-impl-context-osgi.xml b/taverna-configuration-impl/src/main/resources/META-INF/spring/configuration-impl-context-osgi.xml
index 29aea44..0597ed6 100644
--- a/taverna-configuration-impl/src/main/resources/META-INF/spring/configuration-impl-context-osgi.xml
+++ b/taverna-configuration-impl/src/main/resources/META-INF/spring/configuration-impl-context-osgi.xml
@@ -6,16 +6,16 @@
                       http://www.springframework.org/schema/osgi
                       http://www.springframework.org/schema/osgi/spring-osgi.xsd">
 
-	<service ref="t2ConfigurationFrame" interface="net.sf.taverna.t2.workbench.configuration.workbench.ui.T2ConfigurationFrame" />
+	<service ref="t2ConfigurationFrame" interface="org.apache.taverna.workbench.configuration.workbench.ui.T2ConfigurationFrame" />
 
 	<service ref="WorkbenchConfigurationUIFactory" interface="uk.org.taverna.configuration.ConfigurationUIFactory" />
 
 	<service ref="WorkbenchPreferencesSection" auto-export="interfaces" />
 	<service ref="WorkbenchConfigurationMenu" auto-export="interfaces" />
 
-	<service ref="ColourManager" interface="net.sf.taverna.t2.workbench.configuration.colour.ColourManager" />
-	<service ref="WorkbenchConfiguration" interface="net.sf.taverna.t2.workbench.configuration.workbench.WorkbenchConfiguration" />
-	<service ref="MimeTypeManager" interface="net.sf.taverna.t2.workbench.configuration.mimetype.MimeTypeManager" />
+	<service ref="ColourManager" interface="org.apache.taverna.workbench.configuration.colour.ColourManager" />
+	<service ref="WorkbenchConfiguration" interface="org.apache.taverna.workbench.configuration.workbench.WorkbenchConfiguration" />
+	<service ref="MimeTypeManager" interface="org.apache.taverna.workbench.configuration.mimetype.MimeTypeManager" />
 
 	<reference id="configurationManager" interface="uk.org.taverna.configuration.ConfigurationManager" />
 	<reference id="applicationConfiguration" interface="uk.org.taverna.configuration.app.ApplicationConfiguration" />

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-configuration-impl/src/main/resources/META-INF/spring/configuration-impl-context.xml
----------------------------------------------------------------------
diff --git a/taverna-configuration-impl/src/main/resources/META-INF/spring/configuration-impl-context.xml b/taverna-configuration-impl/src/main/resources/META-INF/spring/configuration-impl-context.xml
index 40da7fd..9b6f529 100644
--- a/taverna-configuration-impl/src/main/resources/META-INF/spring/configuration-impl-context.xml
+++ b/taverna-configuration-impl/src/main/resources/META-INF/spring/configuration-impl-context.xml
@@ -3,31 +3,31 @@
 	xsi:schemaLocation="http://www.springframework.org/schema/beans
                       http://www.springframework.org/schema/beans/spring-beans.xsd">
 
-	<bean id="t2ConfigurationFrame" class="net.sf.taverna.t2.workbench.ui.impl.configuration.ui.T2ConfigurationFrameImpl">
+	<bean id="t2ConfigurationFrame" class="org.apache.taverna.workbench.ui.impl.configuration.ui.T2ConfigurationFrameImpl">
 		<property name="configurationUIFactories" ref="configurationUIFactories" />
 	</bean>
 
-	<bean id="WorkbenchConfigurationUIFactory" class="net.sf.taverna.t2.workbench.ui.impl.configuration.WorkbenchConfigurationUIFactory">
+	<bean id="WorkbenchConfigurationUIFactory" class="org.apache.taverna.workbench.ui.impl.configuration.WorkbenchConfigurationUIFactory">
 		<property name="workbenchConfiguration">
 			<ref local="WorkbenchConfiguration"/>
 		</property>
 	</bean>
 
-	<bean id="WorkbenchPreferencesSection" class="net.sf.taverna.t2.workbench.ui.impl.configuration.ui.WorkbenchPreferencesSection" />
-	<bean id="WorkbenchConfigurationMenu" class="net.sf.taverna.t2.workbench.ui.impl.configuration.ui.WorkbenchConfigurationMenu">
+	<bean id="WorkbenchPreferencesSection" class="org.apache.taverna.workbench.ui.impl.configuration.ui.WorkbenchPreferencesSection" />
+	<bean id="WorkbenchConfigurationMenu" class="org.apache.taverna.workbench.ui.impl.configuration.ui.WorkbenchConfigurationMenu">
 		<property name="t2ConfigurationFrame">
 			<ref local="t2ConfigurationFrame"/>
 		</property>
 	</bean>
 
-	<bean id="ColourManager" class="net.sf.taverna.t2.workbench.ui.impl.configuration.colour.ColourManagerImpl">
+	<bean id="ColourManager" class="org.apache.taverna.workbench.ui.impl.configuration.colour.ColourManagerImpl">
 		<constructor-arg ref="configurationManager"/>
 	</bean>
-	<bean id="WorkbenchConfiguration" class="net.sf.taverna.t2.workbench.ui.impl.configuration.WorkbenchConfigurationImpl">
+	<bean id="WorkbenchConfiguration" class="org.apache.taverna.workbench.ui.impl.configuration.WorkbenchConfigurationImpl">
 		<constructor-arg ref="configurationManager"/>
 		<property name="applicationConfiguration" ref="applicationConfiguration" />
 	</bean>
-	<bean id="MimeTypeManager" class="net.sf.taverna.t2.workbench.ui.impl.configuration.mimetype.MimeTypeManagerImpl">
+	<bean id="MimeTypeManager" class="org.apache.taverna.workbench.ui.impl.configuration.mimetype.MimeTypeManagerImpl">
 		<constructor-arg ref="configurationManager"/>
 	</bean>
 


[12/51] [partial] incubator-taverna-workbench git commit: all packages are moved to org.apache.taverna.*

Posted by re...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-graph-model/src/main/java/org/apache/taverna/workbench/models/graph/svg/SVGUtil.java
----------------------------------------------------------------------
diff --git a/taverna-graph-model/src/main/java/org/apache/taverna/workbench/models/graph/svg/SVGUtil.java b/taverna-graph-model/src/main/java/org/apache/taverna/workbench/models/graph/svg/SVGUtil.java
new file mode 100644
index 0000000..b165bb3
--- /dev/null
+++ b/taverna-graph-model/src/main/java/org/apache/taverna/workbench/models/graph/svg/SVGUtil.java
@@ -0,0 +1,477 @@
+/*******************************************************************************
+ * 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 org.apache.taverna.workbench.models.graph.svg;
+
+import static java.lang.Float.parseFloat;
+import static java.lang.Math.PI;
+import static java.lang.Math.atan2;
+import static org.apache.batik.dom.svg.SVGDOMImplementation.getDOMImplementation;
+import static org.apache.batik.util.SMILConstants.SMIL_ATTRIBUTE_NAME_ATTRIBUTE;
+import static org.apache.batik.util.SMILConstants.SMIL_DUR_ATTRIBUTE;
+import static org.apache.batik.util.SMILConstants.SMIL_FILL_ATTRIBUTE;
+import static org.apache.batik.util.SMILConstants.SMIL_FREEZE_VALUE;
+import static org.apache.batik.util.SMILConstants.SMIL_FROM_ATTRIBUTE;
+import static org.apache.batik.util.SMILConstants.SMIL_TO_ATTRIBUTE;
+import static org.apache.batik.util.SVGConstants.SVG_TYPE_ATTRIBUTE;
+import static org.apache.batik.util.SVGConstants.SVG_X1_ATTRIBUTE;
+import static org.apache.batik.util.SVGConstants.SVG_X2_ATTRIBUTE;
+import static org.apache.batik.util.SVGConstants.SVG_Y1_ATTRIBUTE;
+import static org.apache.batik.util.SVGConstants.SVG_Y2_ATTRIBUTE;
+import static org.apache.batik.util.XMLResourceDescriptor.getXMLParserClassName;
+
+import java.awt.Color;
+import java.awt.Point;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.io.StringReader;
+import java.util.List;
+
+import org.apache.taverna.lang.io.StreamDevourer;
+import org.apache.taverna.workbench.configuration.workbench.WorkbenchConfiguration;
+import org.apache.taverna.workbench.models.graph.GraphShapeElement.Shape;
+
+import org.apache.batik.dom.svg.SAXSVGDocumentFactory;
+import org.apache.batik.dom.svg.SVGDOMImplementation;
+import org.apache.batik.dom.svg.SVGOMAnimationElement;
+import org.apache.batik.dom.svg.SVGOMPoint;
+import org.apache.log4j.Logger;
+import org.w3c.dom.DOMImplementation;
+import org.w3c.dom.Element;
+import org.w3c.dom.svg.SVGDocument;
+import org.w3c.dom.svg.SVGElement;
+import org.w3c.dom.svg.SVGLocatable;
+import org.w3c.dom.svg.SVGMatrix;
+//import org.apache.batik.transcoder.TranscoderException;
+//import org.apache.batik.transcoder.svg2svg.PrettyPrinter;
+
+/**
+ * Utility methods.
+ *
+ * @author David Withers
+ */
+public class SVGUtil {
+	private static final String C = "C";
+	private static final String M = "M";
+	private static final String SPACE = " ";
+	private static final String COMMA = ",";
+	public static final String svgNS = SVGDOMImplementation.SVG_NAMESPACE_URI;
+	private static final String SVG = "svg";
+	private static final Logger logger = Logger.getLogger(SVGUtil.class);
+
+	private static SAXSVGDocumentFactory docFactory;
+
+	static {
+		String parser = getXMLParserClassName();
+		logger.info("Using XML parser " + parser);
+		docFactory = new SAXSVGDocumentFactory(parser);
+	}
+
+	/**
+	 * Creates a new SVGDocument.
+	 * 
+	 * @return a new SVGDocument
+	 */
+	public static SVGDocument createSVGDocument() {
+		DOMImplementation impl = getDOMImplementation();
+		return (SVGDocument) impl.createDocument(svgNS, SVG, null);
+	}
+
+	/**
+	 * Converts a point in screen coordinates to a point in document
+	 * coordinates.
+	 * 
+	 * @param locatable
+	 * @param screenPoint
+	 *            the point in screen coordinates
+	 * @return the point in document coordinates
+	 */
+	public static SVGOMPoint screenToDocument(SVGLocatable locatable,
+			SVGOMPoint screenPoint) {
+		SVGMatrix mat = ((SVGLocatable) locatable.getFarthestViewportElement())
+				.getScreenCTM().inverse();
+		return (SVGOMPoint) screenPoint.matrixTransform(mat);
+	}
+
+	/**
+	 * Writes SVG to the console. For debugging only.
+	 *
+	 * @param svgDocument
+	 *            the document to output
+	 */
+//	public static void writeSVG(SVGDocument svgDocument) {
+//		writeSVG(svgDocument, new OutputStreamWriter(System.out));
+//	}
+
+	/**
+	 * Writes SVG to an output stream.
+	 *
+	 * @param svgDocument
+	 *            the document to output
+	 * @param writer
+	 *            the stream to write the document to
+	 */
+//	public static void writeSVG(SVGDocument svgDocument, Writer writer) {
+//		StringWriter sw = new StringWriter();
+//		try {
+//			Transformer transformer = TransformerFactory.newInstance().newTransformer();
+//			Source src = new DOMSource(svgDocument.getDocumentElement());
+//			transformer.transform(src, new StreamResult(sw));
+//
+//			PrettyPrinter pp = new PrettyPrinter();
+//			pp.print(new StringReader(sw.toString()), writer);
+//		} catch (TransformerException | TranscoderException | IOException e) {
+//			e.printStackTrace(new PrintWriter(writer));
+//		}
+//	}
+
+	/**
+	 * Generates an SVGDocument from DOT text by calling out to GraphViz.
+	 * 
+	 * @param dotText
+	 * @return an SVGDocument
+	 * @throws IOException
+	 */
+	public static SVGDocument getSVG(String dotText,
+			WorkbenchConfiguration workbenchConfiguration) throws IOException {
+		String dotLocation = (String) workbenchConfiguration
+				.getProperty("taverna.dotlocation");
+		if (dotLocation == null)
+			dotLocation = "dot";
+		logger.debug("Invoking dot...");
+		Process dotProcess = exec(dotLocation, "-Tsvg");
+		StreamDevourer devourer = new StreamDevourer(
+				dotProcess.getInputStream());
+		devourer.start();
+		try (PrintWriter out = new PrintWriter(dotProcess.getOutputStream(),
+				true)) {
+			out.print(dotText);
+			out.flush();
+		}
+
+		String svgText = devourer.blockOnOutput();
+		/*
+		 * Avoid TAV-424, replace buggy SVG outputted by "modern" GraphViz
+		 * versions. http://www.graphviz.org/bugs/b1075.html
+		 * 
+		 * Contributed by Marko Ullgren
+		 */
+		svgText = svgText.replaceAll("font-weight:regular",
+				"font-weight:normal");
+		logger.info(svgText);
+		// Fake URI, just used for internal references like #fish
+		return docFactory.createSVGDocument(
+				"http://taverna.sf.net/diagram/generated.svg",
+				new StringReader(svgText));
+	}
+
+	/**
+	 * Generates DOT text with layout information from DOT text by calling out
+	 * to GraphViz.
+	 * 
+	 * @param dotText
+	 *            dot text
+	 * @return dot text with layout information
+	 * @throws IOException
+	 */
+	public static String getDot(String dotText,
+			WorkbenchConfiguration workbenchConfiguration) throws IOException {
+		String dotLocation = (String) workbenchConfiguration
+				.getProperty("taverna.dotlocation");
+		if (dotLocation == null)
+			dotLocation = "dot";
+		logger.debug("Invoking dot...");
+		Process dotProcess = exec(dotLocation, "-Tdot", "-Glp=0,0");
+		StreamDevourer devourer = new StreamDevourer(
+				dotProcess.getInputStream());
+		devourer.start();
+		try (PrintWriter out = new PrintWriter(dotProcess.getOutputStream(),
+				true)) {
+			out.print(dotText);
+			out.flush();
+		}
+
+		String dot = devourer.blockOnOutput();
+		// logger.info(dot);
+		return dot;
+	}
+
+	private static Process exec(String...args) throws IOException {
+		Process p = Runtime.getRuntime().exec(args);
+		/*
+		 * Must create an error devourer otherwise stderr fills up and the
+		 * process stalls!
+		 */
+		new StreamDevourer(p.getErrorStream()).start();
+		return p;
+	}
+
+	/**
+	 * Returns the hex value for a <code>Color</code>. If color is null "none"
+	 * is returned.
+	 *
+	 * @param color
+	 *            the <code>Color</code> to convert to hex code
+	 * @return the hex value
+	 */
+	public static String getHexValue(Color color) {
+		if (color == null)
+			return "none";
+
+		return String.format("#%02x%02x%02x", color.getRed(), color.getGreen(),
+				color.getBlue());
+	}
+
+	/**
+	 * Calculates the angle to rotate an arrow head to be placed on the end of a
+	 * line.
+	 *
+	 * @param line
+	 *            the line to calculate the arrow head angle from
+	 * @return the angle to rotate an arrow head
+	 */
+	public static double calculateAngle(Element line) {
+		float x1 = parseFloat(line.getAttribute(SVG_X1_ATTRIBUTE));
+		float y1 = parseFloat(line.getAttribute(SVG_Y1_ATTRIBUTE));
+		float x2 = parseFloat(line.getAttribute(SVG_X2_ATTRIBUTE));
+		float y2 = parseFloat(line.getAttribute(SVG_Y2_ATTRIBUTE));
+		return calculateAngle(x1, y1, x2, y2);
+	}
+
+	/**
+	 * Calculates the angle to rotate an arrow head to be placed on the end of a
+	 * line.
+	 *
+	 * @param pointList
+	 *            the list of <code>Point</code>s to calculate the arrow head
+	 *            angle from
+	 * @return the angle to rotate an arrow head
+	 */
+	public static double calculateAngle(List<Point> pointList) {
+		double angle = 0d;
+		if (pointList.size() > 1) {
+			int listSize = pointList.size();
+			Point a = pointList.get(listSize - 2);
+			Point b = pointList.get(listSize - 1);
+			/*
+			 * dot sometimes generates paths with the same point repeated at the
+			 * end of the path, so move back along the path until two different
+			 * points are found
+			 */
+			while (a.equals(b) && listSize > 2) {
+				b = a;
+				a = pointList.get(--listSize - 2);
+			}
+			angle = calculateAngle(a.x, a.y, b.x, b.y);
+		}
+		return angle;
+	}
+
+	/**
+	 * Calculates the angle to rotate an arrow head to be placed on the end of a
+	 * line.
+	 * 
+	 * @param x1
+	 *            the x coordinate of the start of the line
+	 * @param y1
+	 *            the y coordinate of the start of the line
+	 * @param x2
+	 *            the x coordinate of the end of the line
+	 * @param y2
+	 *            the y coordinate of the end of the line
+	 * @return the angle to rotate an arrow head
+	 */
+	public static double calculateAngle(float x1, float y1, float x2, float y2) {
+		return atan2(y2 - y1, x2 - x1) * 180 / PI;
+	}
+
+	/**
+	 * Calculates the points that make up the polygon for the specified
+	 * {@link Shape}.
+	 *
+	 * @param shape
+	 *            the <code>Shape</code> to calculate points for
+	 * @param width
+	 *            the width of the <code>Shape</code>
+	 * @param height
+	 *            the height of the <code>Shape</code>
+	 * @return the points that make up the polygon for the specified
+	 *         <code>Shape</code>
+	 */
+	public static String calculatePoints(Shape shape, int width, int height) {
+		StringBuilder sb = new StringBuilder();
+		switch (shape) {
+		case BOX:
+		case RECORD:
+			addPoint(sb, 0, 0);
+			addPoint(sb, width, 0);
+			addPoint(sb, width, height);
+			addPoint(sb, 0, height);
+			break;
+		case HOUSE:
+			addPoint(sb, width / 2f, 0);
+			addPoint(sb, width, height / 3f);
+			addPoint(sb, width, height - 3);
+			addPoint(sb, 0, height - 3);
+			addPoint(sb, 0, height / 3f);
+			break;
+		case INVHOUSE:
+			addPoint(sb, 0, 3);
+			addPoint(sb, width, 3);
+			addPoint(sb, width, height / 3f * 2f);
+			addPoint(sb, width / 2f, height);
+			addPoint(sb, 0, height / 3f * 2f);
+			break;
+		case TRIANGLE:
+			addPoint(sb, width / 2f, 0);
+			addPoint(sb, width, height);
+			addPoint(sb, 0, height);
+			break;
+		case INVTRIANGLE:
+			addPoint(sb, 0, 0);
+			addPoint(sb, width, 0);
+			addPoint(sb, width / 2f, height);
+			break;
+		default:
+			// Nothing to do for the others
+			break;
+		}
+		return sb.toString();
+	}
+
+	/**
+	 * Appends x y coordinates to a <code>StringBuilder</code> in the format
+	 * "x,y ".
+	 * 
+	 * @param stringBuilder
+	 *            the <code>StringBuilder</code> to append the point to
+	 * @param x
+	 *            the x coordinate
+	 * @param y
+	 *            the y coordinate
+	 */
+	public static void addPoint(StringBuilder stringBuilder, float x, float y) {
+		stringBuilder.append(x).append(COMMA).append(y).append(SPACE);
+	}
+
+	/**
+	 * Converts a list of points into a string format for a cubic Bezier curve.
+	 *
+	 * For example, "M100,200 C100,100 250,100 250,200". See
+	 * http://www.w3.org/TR/SVG11/paths.html#PathDataCubicBezierCommands.
+	 *
+	 * @param pointList
+	 *            a list of points that describes a cubic Bezier curve
+	 * @return a string that describes a cubic Bezier curve
+	 */
+	public static String getPath(List<Point> pointList) {
+		StringBuilder sb = new StringBuilder();
+		if (pointList != null && pointList.size() > 1) {
+			Point firstPoint = pointList.get(0);
+			sb.append(M).append(firstPoint.x).append(COMMA)
+					.append(firstPoint.y);
+			sb.append(SPACE);
+			Point secontPoint = pointList.get(1);
+			sb.append(C).append(secontPoint.x).append(COMMA)
+					.append(secontPoint.y);
+			for (int i = 2; i < pointList.size(); i++) {
+				Point point = pointList.get(i);
+				sb.append(SPACE).append(point.x).append(COMMA).append(point.y);
+			}
+		}
+		return sb.toString();
+	}
+
+	/**
+	 * Creates an animation element.
+	 *
+	 * @param graphController
+	 *            the SVGGraphController to use to create the animation element
+	 * @param elementType
+	 *            the type of animation element to create
+	 * @param attribute
+	 *            the attribute that the animation should affect
+	 * @param transformType
+	 *            the type of transform - use null not creating a transform
+	 *            animation
+	 * @return an new animation element
+	 */
+	public static SVGOMAnimationElement createAnimationElement(
+			SVGGraphController graphController, String elementType,
+			String attribute, String transformType) {
+		SVGOMAnimationElement animationElement = (SVGOMAnimationElement) graphController
+				.createElement(elementType);
+		animationElement.setAttribute(SMIL_ATTRIBUTE_NAME_ATTRIBUTE, attribute);
+		if (transformType != null)
+			animationElement.setAttribute(SVG_TYPE_ATTRIBUTE, transformType);
+		animationElement.setAttribute(SMIL_FILL_ATTRIBUTE, SMIL_FREEZE_VALUE);
+		return animationElement;
+	}
+
+	/**
+	 * Adds an animation to the SVG element and starts the animation.
+	 *
+	 * @param animate
+	 *            that animation element
+	 * @param element
+	 *            the element to animate
+	 * @param duration
+	 *            the duration of the animation in milliseconds
+	 * @param from
+	 *            the starting point for the animation, can be null
+	 * @param to
+	 *            the end point for the animation, cannot be null
+	 */
+	public static void animate(SVGOMAnimationElement animate, SVGElement element, int duration,
+			String from, String to) {
+		animate.setAttribute(SMIL_DUR_ATTRIBUTE, duration + "ms");
+		if (from != null)
+			animate.setAttribute(SMIL_FROM_ATTRIBUTE, from);
+		animate.setAttribute(SMIL_TO_ATTRIBUTE, to);
+		element.appendChild(animate);
+		try {
+			animate.beginElement();
+		} catch (NullPointerException e) {
+		}
+	}
+
+	/**
+	 * Adjusts the length of <code>pointList</code> by adding or removing points
+	 * to make the length equal to <code>size</code>. If <code>pointList</code>
+	 * is shorter than <code>size</code> the last point is repeated. If
+	 * <code>pointList</code> is longer than <code>size</code> points at the end
+	 * of the list are removed.
+	 *
+	 * @param pointList
+	 *            the path to adjust
+	 * @param size
+	 *            the required size for <code>pointList</code>
+	 */
+	public static void adjustPathLength(List<Point> pointList, int size) {
+		if (pointList.size() < size) {
+			Point lastPoint = pointList.get(pointList.size() - 1);
+			for (int i = pointList.size(); i < size; i++)
+				pointList.add(lastPoint);
+		} else if (pointList.size() > size) {
+			for (int i = pointList.size(); i > size; i--)
+				pointList.remove(i - 1);
+		}
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-graph-model/src/main/java/org/apache/taverna/workbench/models/graph/svg/event/SVGEventListener.java
----------------------------------------------------------------------
diff --git a/taverna-graph-model/src/main/java/org/apache/taverna/workbench/models/graph/svg/event/SVGEventListener.java b/taverna-graph-model/src/main/java/org/apache/taverna/workbench/models/graph/svg/event/SVGEventListener.java
new file mode 100644
index 0000000..e23474a
--- /dev/null
+++ b/taverna-graph-model/src/main/java/org/apache/taverna/workbench/models/graph/svg/event/SVGEventListener.java
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * 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 org.apache.taverna.workbench.models.graph.svg.event;
+
+import static org.apache.taverna.workbench.models.graph.svg.SVGUtil.screenToDocument;
+import org.apache.taverna.workbench.models.graph.GraphElement;
+
+import org.apache.batik.dom.svg.SVGOMPoint;
+import org.w3c.dom.events.Event;
+import org.w3c.dom.events.EventListener;
+import org.w3c.dom.events.MouseEvent;
+import org.w3c.dom.svg.SVGLocatable;
+
+/**
+ * Abstract superclass for SVG event listeners.
+ * 
+ * @author David Withers
+ */
+public abstract class SVGEventListener implements EventListener {
+	protected GraphElement graphElement;
+
+	public SVGEventListener(GraphElement graphElement) {
+		this.graphElement = graphElement;
+	}
+
+	protected abstract void event(SVGOMPoint point, MouseEvent evt);
+
+	@Override
+	public final void handleEvent(Event evt) {
+		if (evt instanceof MouseEvent) {
+			MouseEvent me = (MouseEvent) evt;
+			SVGOMPoint point = screenToDocument((SVGLocatable) me.getTarget(),
+					new SVGOMPoint(me.getClientX(), me.getClientY()));
+			event(point, me);
+			evt.stopPropagation();
+		}
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-graph-model/src/main/java/org/apache/taverna/workbench/models/graph/svg/event/SVGMouseClickEventListener.java
----------------------------------------------------------------------
diff --git a/taverna-graph-model/src/main/java/org/apache/taverna/workbench/models/graph/svg/event/SVGMouseClickEventListener.java b/taverna-graph-model/src/main/java/org/apache/taverna/workbench/models/graph/svg/event/SVGMouseClickEventListener.java
new file mode 100644
index 0000000..c9dc258
--- /dev/null
+++ b/taverna-graph-model/src/main/java/org/apache/taverna/workbench/models/graph/svg/event/SVGMouseClickEventListener.java
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * 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 org.apache.taverna.workbench.models.graph.svg.event;
+
+import org.apache.taverna.workbench.models.graph.GraphElement;
+
+import org.apache.batik.dom.svg.SVGOMPoint;
+import org.w3c.dom.events.MouseEvent;
+
+/**
+ * SVG event listener for handling mouse click events.
+ * 
+ * @author David Withers
+ */
+public class SVGMouseClickEventListener extends SVGEventListener {
+	public SVGMouseClickEventListener(GraphElement graphElement) {
+		super(graphElement);
+	}
+
+	@Override
+	protected void event(SVGOMPoint point, MouseEvent evt) {
+		graphElement.getEventManager().mouseClicked(graphElement,
+				evt.getButton(), evt.getAltKey(), evt.getCtrlKey(),
+				evt.getMetaKey(), (int) point.getX(), (int) point.getY(),
+				evt.getScreenX(), evt.getScreenY());
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-graph-model/src/main/java/org/apache/taverna/workbench/models/graph/svg/event/SVGMouseDownEventListener.java
----------------------------------------------------------------------
diff --git a/taverna-graph-model/src/main/java/org/apache/taverna/workbench/models/graph/svg/event/SVGMouseDownEventListener.java b/taverna-graph-model/src/main/java/org/apache/taverna/workbench/models/graph/svg/event/SVGMouseDownEventListener.java
new file mode 100644
index 0000000..d526d14
--- /dev/null
+++ b/taverna-graph-model/src/main/java/org/apache/taverna/workbench/models/graph/svg/event/SVGMouseDownEventListener.java
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * 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 org.apache.taverna.workbench.models.graph.svg.event;
+
+import org.apache.taverna.workbench.models.graph.GraphElement;
+
+import org.apache.batik.dom.svg.SVGOMPoint;
+import org.w3c.dom.events.MouseEvent;
+
+/**
+ * SVG event listener for handling mouse button down events.
+ * 
+ * @author David Withers
+ */
+public class SVGMouseDownEventListener extends SVGEventListener {
+	public SVGMouseDownEventListener(GraphElement graphElement) {
+		super(graphElement);
+	}
+
+	@Override
+	protected void event(SVGOMPoint point, MouseEvent evt) {
+		graphElement.getEventManager().mouseDown(graphElement, evt.getButton(),
+				evt.getAltKey(), evt.getCtrlKey(), evt.getMetaKey(),
+				(int) point.getX(), (int) point.getY(), evt.getScreenX(),
+				evt.getScreenY());
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-graph-model/src/main/java/org/apache/taverna/workbench/models/graph/svg/event/SVGMouseMovedEventListener.java
----------------------------------------------------------------------
diff --git a/taverna-graph-model/src/main/java/org/apache/taverna/workbench/models/graph/svg/event/SVGMouseMovedEventListener.java b/taverna-graph-model/src/main/java/org/apache/taverna/workbench/models/graph/svg/event/SVGMouseMovedEventListener.java
new file mode 100644
index 0000000..0a1a9f9
--- /dev/null
+++ b/taverna-graph-model/src/main/java/org/apache/taverna/workbench/models/graph/svg/event/SVGMouseMovedEventListener.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * 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 org.apache.taverna.workbench.models.graph.svg.event;
+
+import org.apache.taverna.workbench.models.graph.GraphElement;
+
+import org.apache.batik.dom.svg.SVGOMPoint;
+import org.w3c.dom.events.MouseEvent;
+
+/**
+ * SVG event listener for handling mouse movement events.
+ * 
+ * @author David Withers
+ */
+public class SVGMouseMovedEventListener extends SVGEventListener {
+	public SVGMouseMovedEventListener(GraphElement graphElement) {
+		super(graphElement);
+	}
+
+	@Override
+	protected void event(SVGOMPoint point, MouseEvent mouseEvent) {
+		graphElement.getEventManager().mouseMoved(graphElement,
+				mouseEvent.getButton(), mouseEvent.getAltKey(),
+				mouseEvent.getCtrlKey(), mouseEvent.getMetaKey(),
+				(int) point.getX(), (int) point.getY(),
+				mouseEvent.getScreenX(), mouseEvent.getScreenY());
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-graph-model/src/main/java/org/apache/taverna/workbench/models/graph/svg/event/SVGMouseOutEventListener.java
----------------------------------------------------------------------
diff --git a/taverna-graph-model/src/main/java/org/apache/taverna/workbench/models/graph/svg/event/SVGMouseOutEventListener.java b/taverna-graph-model/src/main/java/org/apache/taverna/workbench/models/graph/svg/event/SVGMouseOutEventListener.java
new file mode 100644
index 0000000..28651a7
--- /dev/null
+++ b/taverna-graph-model/src/main/java/org/apache/taverna/workbench/models/graph/svg/event/SVGMouseOutEventListener.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * 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 org.apache.taverna.workbench.models.graph.svg.event;
+
+import org.apache.taverna.workbench.models.graph.GraphElement;
+
+import org.apache.batik.dom.svg.SVGOMPoint;
+import org.w3c.dom.events.MouseEvent;
+
+/**
+ * SVG event listener for handling mouse button up events.
+ * 
+ * @author David Withers
+ */
+public class SVGMouseOutEventListener extends SVGEventListener {
+	public SVGMouseOutEventListener(GraphElement graphElement) {
+		super(graphElement);
+	}
+
+	@Override
+	protected void event(SVGOMPoint point, MouseEvent mouseEvent) {
+		graphElement.getEventManager().mouseOut(graphElement,
+				mouseEvent.getButton(), mouseEvent.getAltKey(),
+				mouseEvent.getCtrlKey(), mouseEvent.getMetaKey(),
+				(int) point.getX(), (int) point.getY(),
+				mouseEvent.getScreenX(), mouseEvent.getScreenY());
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-graph-model/src/main/java/org/apache/taverna/workbench/models/graph/svg/event/SVGMouseOverEventListener.java
----------------------------------------------------------------------
diff --git a/taverna-graph-model/src/main/java/org/apache/taverna/workbench/models/graph/svg/event/SVGMouseOverEventListener.java b/taverna-graph-model/src/main/java/org/apache/taverna/workbench/models/graph/svg/event/SVGMouseOverEventListener.java
new file mode 100644
index 0000000..2478a5d
--- /dev/null
+++ b/taverna-graph-model/src/main/java/org/apache/taverna/workbench/models/graph/svg/event/SVGMouseOverEventListener.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * 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 org.apache.taverna.workbench.models.graph.svg.event;
+
+import org.apache.taverna.workbench.models.graph.GraphElement;
+
+import org.apache.batik.dom.svg.SVGOMPoint;
+import org.w3c.dom.events.MouseEvent;
+
+/**
+ * SVG event listener for handling mouse button up events.
+ * 
+ * @author David Withers
+ */
+public class SVGMouseOverEventListener extends SVGEventListener {
+	public SVGMouseOverEventListener(GraphElement graphElement) {
+		super(graphElement);
+	}
+
+	@Override
+	protected void event(SVGOMPoint point, MouseEvent mouseEvent) {
+		graphElement.getEventManager().mouseOver(graphElement,
+				mouseEvent.getButton(), mouseEvent.getAltKey(),
+				mouseEvent.getCtrlKey(), mouseEvent.getMetaKey(),
+				(int) point.getX(), (int) point.getY(),
+				mouseEvent.getScreenX(), mouseEvent.getScreenY());
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-graph-model/src/main/java/org/apache/taverna/workbench/models/graph/svg/event/SVGMouseUpEventListener.java
----------------------------------------------------------------------
diff --git a/taverna-graph-model/src/main/java/org/apache/taverna/workbench/models/graph/svg/event/SVGMouseUpEventListener.java b/taverna-graph-model/src/main/java/org/apache/taverna/workbench/models/graph/svg/event/SVGMouseUpEventListener.java
new file mode 100644
index 0000000..e4a6f86
--- /dev/null
+++ b/taverna-graph-model/src/main/java/org/apache/taverna/workbench/models/graph/svg/event/SVGMouseUpEventListener.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * 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 org.apache.taverna.workbench.models.graph.svg.event;
+
+import org.apache.taverna.workbench.models.graph.GraphElement;
+
+import org.apache.batik.dom.svg.SVGOMPoint;
+import org.w3c.dom.events.MouseEvent;
+
+/**
+ * SVG event listener for handling mouse button up events.
+ * 
+ * @author David Withers
+ */
+public class SVGMouseUpEventListener extends SVGEventListener {
+	public SVGMouseUpEventListener(GraphElement graphElement) {
+		super(graphElement);
+	}
+
+	@Override
+	protected void event(SVGOMPoint point, MouseEvent mouseEvent) {
+		graphElement.getEventManager().mouseUp(graphElement,
+				mouseEvent.getButton(), mouseEvent.getAltKey(),
+				mouseEvent.getCtrlKey(), mouseEvent.getMetaKey(),
+				(int) point.getX(), (int) point.getY(),
+				mouseEvent.getScreenX(), mouseEvent.getScreenY());
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-graph-model/src/test/java/net/sf/taverna/t2/workbench/models/graph/GraphControllerTest.java
----------------------------------------------------------------------
diff --git a/taverna-graph-model/src/test/java/net/sf/taverna/t2/workbench/models/graph/GraphControllerTest.java b/taverna-graph-model/src/test/java/net/sf/taverna/t2/workbench/models/graph/GraphControllerTest.java
deleted file mode 100644
index 8ae5a9f..0000000
--- a/taverna-graph-model/src/test/java/net/sf/taverna/t2/workbench/models/graph/GraphControllerTest.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*******************************************************************************
- * 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.models.graph;
-
-import static org.junit.Assert.assertEquals;
-
-import java.io.IOException;
-
-import net.sf.taverna.t2.workbench.models.graph.GraphController.PortStyle;
-
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Test;
-
-import org.apache.taverna.scufl2.api.core.Workflow;
-
-public class GraphControllerTest {
-
-	Workflow dataflow;
-
-	GraphController graphController;
-
-	@Before
-	public void setUp() throws Exception {
-//		System.setProperty("raven.eclipse", "true");
-//		setUpRavenRepository();
-//		dataflow = WorkflowModelTranslator.doTranslation(loadScufl("nested_iteration.xml"));
-		graphController = new GraphController(dataflow, null, false, null, null, null, null) {
-
-			@Override
-			public GraphEdge createGraphEdge() {
-				return new GraphEdge(this);
-			}
-
-			@Override
-			public Graph createGraph() {
-				return new Graph(this);
-			}
-
-			@Override
-			public GraphNode createGraphNode() {
-				return new GraphNode(this);
-			}
-
-			@Override
-			public void redraw() {
-
-			}
-
-		};
-		graphController.setPortStyle(PortStyle.NONE);
-	}
-
-	@Test
-	@Ignore
-	public void testGenerateGraph() throws IOException, InterruptedException {
-		Graph graph = graphController.generateGraph();
-		assertEquals(5, graph.getNodes().size());
-		assertEquals(9, graph.getEdges().size());
-		assertEquals(1, graph.getSubgraphs().size());
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-graph-model/src/test/java/net/sf/taverna/t2/workbench/models/graph/GraphEdgeTest.java
----------------------------------------------------------------------
diff --git a/taverna-graph-model/src/test/java/net/sf/taverna/t2/workbench/models/graph/GraphEdgeTest.java b/taverna-graph-model/src/test/java/net/sf/taverna/t2/workbench/models/graph/GraphEdgeTest.java
deleted file mode 100644
index 10a3c20..0000000
--- a/taverna-graph-model/src/test/java/net/sf/taverna/t2/workbench/models/graph/GraphEdgeTest.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*******************************************************************************
- * 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.models.graph;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-import net.sf.taverna.t2.workbench.models.graph.GraphEdge.ArrowStyle;
-
-import org.junit.Before;
-import org.junit.Test;
-
-public class GraphEdgeTest {
-
-	private GraphEdge edge;
-
-	private GraphNode source;
-
-	private GraphNode sink;
-
-	private ArrowStyle arrowHeadStyle;
-
-	private ArrowStyle arrowTailStyle;
-
-	private GraphController graphController;
-
-	@Before
-	public void setUp() throws Exception {
-		source = new GraphNode(graphController);
-		sink = new GraphNode(graphController);
-		arrowHeadStyle = ArrowStyle.DOT;
-		arrowTailStyle = ArrowStyle.NORMAL;
-		edge = new GraphEdge(graphController);
-		edge.setArrowHeadStyle(arrowHeadStyle);
-		edge.setArrowTailStyle(arrowTailStyle);
-		edge.setSink(sink);
-		edge.setSource(source);
-	}
-
-	@Test
-	public void testEdge() {
-		edge = new GraphEdge(graphController);
-		assertNull(edge.getSource());
-		assertNull(edge.getSink());
-		assertNull(edge.getLabel());
-	}
-
-	@Test
-	public void testEdgeNodeNode() {
-		edge = new GraphEdge(graphController);
-		edge.setSource(source);
-		edge.setSink(sink);
-		assertEquals(source, edge.getSource());
-		assertEquals(sink, edge.getSink());
-		assertNull(edge.getLabel());
-	}
-
-	@Test
-	public void testGetSource() {
-		assertEquals(source, edge.getSource());
-	}
-
-	@Test
-	public void testSetSource() {
-		GraphNode node = new GraphNode(graphController);
-		edge.setSource(node);
-		assertEquals(node, edge.getSource());
-		edge.setSource(null);
-		assertNull(edge.getSource());
-	}
-
-	@Test
-	public void testGetSink() {
-		assertEquals(sink, edge.getSink());
-	}
-
-	@Test
-	public void testSetSink() {
-		GraphNode node = new GraphNode(graphController);
-		edge.setSink(node);
-		assertEquals(node, edge.getSink());
-		edge.setSink(null);
-		assertNull(edge.getSink());
-	}
-
-	@Test
-	public void testGetArrowHeadStyle() {
-		assertEquals(arrowHeadStyle, edge.getArrowHeadStyle());
-	}
-
-	@Test
-	public void testSetArrowHeadStyle() {
-		edge.setArrowHeadStyle(ArrowStyle.DOT);
-		assertEquals(ArrowStyle.DOT, edge.getArrowHeadStyle());
-		edge.setArrowHeadStyle(null);
-		assertNull(edge.getArrowHeadStyle());
-	}
-
-	@Test
-	public void testGetArrowTailStyle() {
-		assertEquals(arrowTailStyle, edge.getArrowTailStyle());
-	}
-
-	@Test
-	public void testSetArrowTailStyle() {
-		edge.setArrowTailStyle(ArrowStyle.NORMAL);
-		assertEquals(ArrowStyle.NORMAL, edge.getArrowTailStyle());
-		edge.setArrowTailStyle(null);
-		assertNull(edge.getArrowTailStyle());
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-graph-model/src/test/java/net/sf/taverna/t2/workbench/models/graph/GraphElementTest.java
----------------------------------------------------------------------
diff --git a/taverna-graph-model/src/test/java/net/sf/taverna/t2/workbench/models/graph/GraphElementTest.java b/taverna-graph-model/src/test/java/net/sf/taverna/t2/workbench/models/graph/GraphElementTest.java
deleted file mode 100644
index 8d6b7f8..0000000
--- a/taverna-graph-model/src/test/java/net/sf/taverna/t2/workbench/models/graph/GraphElementTest.java
+++ /dev/null
@@ -1,148 +0,0 @@
-/*******************************************************************************
- * 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.models.graph;
-
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-
-import java.awt.Color;
-
-import net.sf.taverna.t2.workbench.models.graph.GraphElement.LineStyle;
-
-import org.junit.Before;
-import org.junit.Test;
-
-public class GraphElementTest {
-
-	private GraphElement element;
-
-	private String id;
-
-	private String label;
-
-	private LineStyle lineStyle;
-
-	private Color color;
-
-	private Color fillColor;
-
-	private GraphElement parent;
-
-	private GraphController graphController;
-
-	@Before
-	public void setUp() throws Exception {
-		element = new GraphElement(graphController) {};
-		id = "element-id";
-		label = "element-label";
-		lineStyle = LineStyle.NONE;
-		color = Color.BLUE;
-		fillColor = Color.GREEN;
-		parent = new GraphNode(graphController);
-		element.setId(id);
-		element.setLabel(label);
-		element.setLineStyle(lineStyle);
-		element.setColor(color);
-		element.setFillColor(fillColor);
-		element.setParent(parent);
-	}
-
-	@Test
-	public void testGetParent() {
-		assertEquals(parent, element.getParent());
-	}
-
-	@Test
-	public void testSetParent() {
-		GraphNode newParent = new GraphNode(graphController);
-		element.setParent(newParent);
-		assertEquals(newParent, element.getParent());
-		element.setParent(null);
-		assertNull(element.getParent());
-	}
-
-	@Test
-	public void testGetLabel() {
-		assertEquals(label, element.getLabel());
-	}
-
-	@Test
-	public void testSetLabel() {
-		element.setLabel("new-label");
-		assertEquals("new-label", element.getLabel());
-		element.setLabel(null);
-		assertNull(element.getLabel());
-	}
-
-	@Test
-	public void testGetId() {
-		assertEquals(id, element.getId());
-	}
-
-	@Test
-	public void testSetId() {
-		element.setId("new-id");
-		assertEquals("new-id", element.getId());
-		element.setId(null);
-		assertNull(element.getId());
-	}
-
-	@Test
-	public void testGetColor() {
-		assertEquals(color, element.getColor());
-	}
-
-	@Test
-	public void testSetColor() {
-		element.setColor(Color.RED);
-		assertEquals(Color.RED, element.getColor());
-		element.setColor(null);
-		assertNull(element.getColor());
-	}
-
-	@Test
-	public void testGetFillColor() {
-		assertEquals(fillColor, element.getFillColor());
-	}
-
-	@Test
-	public void testSetFillColor() {
-		element.setFillColor(Color.RED);
-		assertEquals(Color.RED, element.getFillColor());
-		element.setFillColor(null);
-		assertNull(element.getFillColor());
-	}
-
-	@Test
-	public void testGetLineStyle() {
-		assertEquals(lineStyle, element.getLineStyle());
-	}
-
-	@Test
-	public void testSetLineStyle() {
-		element.setLineStyle(LineStyle.DOTTED);
-		assertEquals(LineStyle.DOTTED, element.getLineStyle());
-		element.setLineStyle(null);
-		assertNull(element.getLineStyle());
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-graph-model/src/test/java/net/sf/taverna/t2/workbench/models/graph/GraphNodeTest.java
----------------------------------------------------------------------
diff --git a/taverna-graph-model/src/test/java/net/sf/taverna/t2/workbench/models/graph/GraphNodeTest.java b/taverna-graph-model/src/test/java/net/sf/taverna/t2/workbench/models/graph/GraphNodeTest.java
deleted file mode 100644
index c5bcd6c..0000000
--- a/taverna-graph-model/src/test/java/net/sf/taverna/t2/workbench/models/graph/GraphNodeTest.java
+++ /dev/null
@@ -1,179 +0,0 @@
-/*******************************************************************************
- * 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.models.graph;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-import java.awt.Dimension;
-
-import net.sf.taverna.t2.workbench.models.graph.GraphShapeElement.Shape;
-
-import org.junit.Before;
-import org.junit.Test;
-
-public class GraphNodeTest {
-
-	private GraphNode node;
-
-	private Shape shape;
-
-	private Dimension size;
-
-	private Graph graph;
-
-	private boolean expanded;
-
-	private GraphController graphController;
-
-	@Before
-	public void setUp() throws Exception {
-		shape = Shape.HOUSE;
-		size = new Dimension(1, 2);
-		graph = new Graph(graphController);
-		expanded = false;
-		node = new GraphNode(graphController);
-		node.setShape(shape);
-		node.setSize(size);
-		node.setGraph(graph);
-		node.setExpanded(expanded);
-	}
-
-	@Test
-	public void testNode() {
-		assertNotNull(new GraphNode(graphController));
-	}
-
-	@Test
-	public void testAddSinkNode() {
-		GraphNode newNode = new GraphNode(graphController);
-		node.addSinkNode(newNode);
-		assertEquals(1, node.getSinkNodes().size());
-		assertTrue(node.getSinkNodes().contains(newNode));
-		assertEquals(node, newNode.getParent());
-	}
-
-	@Test
-	public void testAddSourceNode() {
-		GraphNode newNode = new GraphNode(graphController);
-		node.addSourceNode(newNode);
-		assertEquals(1, node.getSourceNodes().size());
-		assertTrue(node.getSourceNodes().contains(newNode));
-		assertEquals(node, newNode.getParent());
-	}
-
-	@Test
-	public void testGetGraph() {
-		assertEquals(graph, node.getGraph());
-	}
-
-	@Test
-	public void testGetHeight() {
-		assertEquals(size.height, node.getHeight(), 0);
-	}
-
-	@Test
-	public void testGetShape() {
-		assertEquals(shape, node.getShape());
-	}
-
-	@Test
-	public void testGetSinkNodes() {
-		assertNotNull(node.getSinkNodes());
-		assertEquals(0, node.getSinkNodes().size());
-	}
-
-	@Test
-	public void testGetSize() {
-		assertEquals(size, node.getSize());
-	}
-
-	@Test
-	public void testGetSourceNodes() {
-		assertNotNull(node.getSourceNodes());
-		assertEquals(0, node.getSourceNodes().size());
-	}
-
-	@Test
-	public void testGetWidth() {
-		assertEquals(size.width, node.getWidth(), 0);
-	}
-
-	@Test
-	public void testIsExpanded() {
-		assertEquals(expanded, node.isExpanded());
-	}
-
-	@Test
-	public void testRemoveSinkNode() {
-		GraphNode newNode = new GraphNode(graphController);
-		assertFalse(node.removeSinkNode(newNode));
-		node.addSinkNode(newNode);
-		assertTrue(node.removeSinkNode(newNode));
-		assertFalse(node.getSinkNodes().contains(newNode));
-	}
-
-	@Test
-	public void testRemoveSourceNode() {
-		GraphNode newNode = new GraphNode(graphController);
-		assertFalse(node.removeSourceNode(newNode));
-		node.addSourceNode(newNode);
-		assertTrue(node.removeSourceNode(newNode));
-		assertFalse(node.getSourceNodes().contains(newNode));
-	}
-
-	@Test
-	public void testSetExpanded() {
-		node.setExpanded(true);
-		assertEquals(true, node.isExpanded());
-		node.setExpanded(false);
-		assertEquals(false, node.isExpanded());
-	}
-
-	@Test
-	public void testSetGraph() {
-		Graph newGraph = new Graph(graphController);
-		node.setGraph(newGraph);
-		assertEquals(newGraph, node.getGraph());
-		node.setGraph(null);
-		assertNull(node.getGraph());
-	}
-
-	@Test
-	public void testSetShape() {
-		node.setShape(Shape.INVTRIANGLE);
-		assertEquals(Shape.INVTRIANGLE, node.getShape());
-		node.setShape(Shape.TRIANGLE);
-		assertEquals(Shape.TRIANGLE, node.getShape());
-	}
-
-	@Test
-	public void testSetSize() {
-		node.setSize(new Dimension(23, 6));
-		assertEquals(new Dimension(23, 6), node.getSize());
-		node.setSize(new Dimension(14, 4));
-		assertEquals(new Dimension(14, 4), node.getSize());
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-graph-model/src/test/java/net/sf/taverna/t2/workbench/models/graph/GraphTest.java
----------------------------------------------------------------------
diff --git a/taverna-graph-model/src/test/java/net/sf/taverna/t2/workbench/models/graph/GraphTest.java b/taverna-graph-model/src/test/java/net/sf/taverna/t2/workbench/models/graph/GraphTest.java
deleted file mode 100644
index 44a5aaf..0000000
--- a/taverna-graph-model/src/test/java/net/sf/taverna/t2/workbench/models/graph/GraphTest.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*******************************************************************************
- * 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.models.graph;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import net.sf.taverna.t2.workbench.models.graph.GraphEdge;
-import net.sf.taverna.t2.workbench.models.graph.Graph;
-import net.sf.taverna.t2.workbench.models.graph.GraphNode;
-import net.sf.taverna.t2.workbench.models.graph.Graph.Alignment;
-
-import org.junit.Before;
-import org.junit.Test;
-
-public class GraphTest {
-
-	private Graph graph;
-
-	private Alignment alignment;
-
-	private GraphController graphController;
-
-	@Before
-	public void setUp() throws Exception {
-		alignment = Alignment.VERTICAL;
-		graph = new Graph(graphController);
-	}
-
-	@Test
-	public void testGraph() {
-		assertNotNull(new Graph(graphController));
-	}
-
-	@Test
-	public void testAddEdge() {
-		GraphEdge newEdge = new GraphEdge(graphController);
-		graph.addEdge(newEdge);
-		assertEquals(1, graph.getEdges().size());
-		assertTrue(graph.getEdges().contains(newEdge));
-	}
-
-	@Test
-	public void testAddNode() {
-		GraphNode newNode = new GraphNode(graphController);
-		graph.addNode(newNode);
-		assertEquals(1, graph.getNodes().size());
-		assertTrue(graph.getNodes().contains(newNode));
-		assertEquals(graph, newNode.getParent());
-	}
-
-	@Test
-	public void testAddSubgraph() {
-		Graph newGraph = new Graph(graphController);
-		graph.addSubgraph(newGraph);
-		assertEquals(1, graph.getSubgraphs().size());
-		assertTrue(graph.getSubgraphs().contains(newGraph));
-		assertEquals(graph, newGraph.getParent());
-	}
-
-	@Test
-	public void testGetAlignment() {
-		assertEquals(alignment, graph.getAlignment());
-	}
-
-	@Test
-	public void testGetEdges() {
-		assertNotNull(graph.getNodes());
-		assertEquals(0, graph.getNodes().size());
-	}
-
-	@Test
-	public void testGetNodes() {
-		assertNotNull(graph.getEdges());
-		assertEquals(0, graph.getEdges().size());
-	}
-
-	@Test
-	public void testGetSubgraphs() {
-		assertNotNull(graph.getSubgraphs());
-		assertEquals(0, graph.getSubgraphs().size());
-	}
-
-	@Test
-	public void testRemoveEdge() {
-		GraphEdge newEdge = new GraphEdge(graphController);
-		assertFalse(graph.removeEdge(newEdge));
-		graph.addEdge(newEdge);
-		assertTrue(graph.removeEdge(newEdge));
-		assertFalse(graph.getNodes().contains(newEdge));
-	}
-
-	@Test
-	public void testRemoveNode() {
-		GraphNode newNode = new GraphNode(graphController);
-		assertFalse(graph.removeNode(newNode));
-		graph.addNode(newNode);
-		assertTrue(graph.removeNode(newNode));
-		assertFalse(graph.getNodes().contains(newNode));
-	}
-
-	@Test
-	public void testRemoveSubgraph() {
-		Graph newGraph = new Graph(graphController);
-		assertFalse(graph.removeSubgraph(newGraph));
-		graph.addSubgraph(newGraph);
-		assertTrue(graph.removeSubgraph(newGraph));
-		assertFalse(graph.getSubgraphs().contains(newGraph));
-	}
-
-	@Test
-	public void testSetAlignment() {
-		graph.setAlignment(Alignment.VERTICAL);
-		assertEquals(Alignment.VERTICAL, graph.getAlignment());
-		graph.setAlignment(Alignment.HORIZONTAL);
-		assertEquals(Alignment.HORIZONTAL, graph.getAlignment());
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-graph-model/src/test/java/org/apache/taverna/workbench/models/graph/GraphControllerTest.java
----------------------------------------------------------------------
diff --git a/taverna-graph-model/src/test/java/org/apache/taverna/workbench/models/graph/GraphControllerTest.java b/taverna-graph-model/src/test/java/org/apache/taverna/workbench/models/graph/GraphControllerTest.java
new file mode 100644
index 0000000..cda5aa8
--- /dev/null
+++ b/taverna-graph-model/src/test/java/org/apache/taverna/workbench/models/graph/GraphControllerTest.java
@@ -0,0 +1,85 @@
+/*******************************************************************************
+ * 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 org.apache.taverna.workbench.models.graph;
+
+import org.apache.taverna.workbench.models.graph.GraphNode;
+import org.apache.taverna.workbench.models.graph.Graph;
+import org.apache.taverna.workbench.models.graph.GraphEdge;
+import org.apache.taverna.workbench.models.graph.GraphController;
+import static org.junit.Assert.assertEquals;
+
+import java.io.IOException;
+
+import org.apache.taverna.workbench.models.graph.GraphController.PortStyle;
+
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+
+import org.apache.taverna.scufl2.api.core.Workflow;
+
+public class GraphControllerTest {
+
+	Workflow dataflow;
+
+	GraphController graphController;
+
+	@Before
+	public void setUp() throws Exception {
+//		System.setProperty("raven.eclipse", "true");
+//		setUpRavenRepository();
+//		dataflow = WorkflowModelTranslator.doTranslation(loadScufl("nested_iteration.xml"));
+		graphController = new GraphController(dataflow, null, false, null, null, null, null) {
+
+			@Override
+			public GraphEdge createGraphEdge() {
+				return new GraphEdge(this);
+			}
+
+			@Override
+			public Graph createGraph() {
+				return new Graph(this);
+			}
+
+			@Override
+			public GraphNode createGraphNode() {
+				return new GraphNode(this);
+			}
+
+			@Override
+			public void redraw() {
+
+			}
+
+		};
+		graphController.setPortStyle(PortStyle.NONE);
+	}
+
+	@Test
+	@Ignore
+	public void testGenerateGraph() throws IOException, InterruptedException {
+		Graph graph = graphController.generateGraph();
+		assertEquals(5, graph.getNodes().size());
+		assertEquals(9, graph.getEdges().size());
+		assertEquals(1, graph.getSubgraphs().size());
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-graph-model/src/test/java/org/apache/taverna/workbench/models/graph/GraphEdgeTest.java
----------------------------------------------------------------------
diff --git a/taverna-graph-model/src/test/java/org/apache/taverna/workbench/models/graph/GraphEdgeTest.java b/taverna-graph-model/src/test/java/org/apache/taverna/workbench/models/graph/GraphEdgeTest.java
new file mode 100644
index 0000000..ba47a35
--- /dev/null
+++ b/taverna-graph-model/src/test/java/org/apache/taverna/workbench/models/graph/GraphEdgeTest.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 org.apache.taverna.workbench.models.graph;
+
+import org.apache.taverna.workbench.models.graph.GraphNode;
+import org.apache.taverna.workbench.models.graph.GraphEdge;
+import org.apache.taverna.workbench.models.graph.GraphController;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import org.apache.taverna.workbench.models.graph.GraphEdge.ArrowStyle;
+
+import org.junit.Before;
+import org.junit.Test;
+
+public class GraphEdgeTest {
+
+	private GraphEdge edge;
+
+	private GraphNode source;
+
+	private GraphNode sink;
+
+	private ArrowStyle arrowHeadStyle;
+
+	private ArrowStyle arrowTailStyle;
+
+	private GraphController graphController;
+
+	@Before
+	public void setUp() throws Exception {
+		source = new GraphNode(graphController);
+		sink = new GraphNode(graphController);
+		arrowHeadStyle = ArrowStyle.DOT;
+		arrowTailStyle = ArrowStyle.NORMAL;
+		edge = new GraphEdge(graphController);
+		edge.setArrowHeadStyle(arrowHeadStyle);
+		edge.setArrowTailStyle(arrowTailStyle);
+		edge.setSink(sink);
+		edge.setSource(source);
+	}
+
+	@Test
+	public void testEdge() {
+		edge = new GraphEdge(graphController);
+		assertNull(edge.getSource());
+		assertNull(edge.getSink());
+		assertNull(edge.getLabel());
+	}
+
+	@Test
+	public void testEdgeNodeNode() {
+		edge = new GraphEdge(graphController);
+		edge.setSource(source);
+		edge.setSink(sink);
+		assertEquals(source, edge.getSource());
+		assertEquals(sink, edge.getSink());
+		assertNull(edge.getLabel());
+	}
+
+	@Test
+	public void testGetSource() {
+		assertEquals(source, edge.getSource());
+	}
+
+	@Test
+	public void testSetSource() {
+		GraphNode node = new GraphNode(graphController);
+		edge.setSource(node);
+		assertEquals(node, edge.getSource());
+		edge.setSource(null);
+		assertNull(edge.getSource());
+	}
+
+	@Test
+	public void testGetSink() {
+		assertEquals(sink, edge.getSink());
+	}
+
+	@Test
+	public void testSetSink() {
+		GraphNode node = new GraphNode(graphController);
+		edge.setSink(node);
+		assertEquals(node, edge.getSink());
+		edge.setSink(null);
+		assertNull(edge.getSink());
+	}
+
+	@Test
+	public void testGetArrowHeadStyle() {
+		assertEquals(arrowHeadStyle, edge.getArrowHeadStyle());
+	}
+
+	@Test
+	public void testSetArrowHeadStyle() {
+		edge.setArrowHeadStyle(ArrowStyle.DOT);
+		assertEquals(ArrowStyle.DOT, edge.getArrowHeadStyle());
+		edge.setArrowHeadStyle(null);
+		assertNull(edge.getArrowHeadStyle());
+	}
+
+	@Test
+	public void testGetArrowTailStyle() {
+		assertEquals(arrowTailStyle, edge.getArrowTailStyle());
+	}
+
+	@Test
+	public void testSetArrowTailStyle() {
+		edge.setArrowTailStyle(ArrowStyle.NORMAL);
+		assertEquals(ArrowStyle.NORMAL, edge.getArrowTailStyle());
+		edge.setArrowTailStyle(null);
+		assertNull(edge.getArrowTailStyle());
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-graph-model/src/test/java/org/apache/taverna/workbench/models/graph/GraphElementTest.java
----------------------------------------------------------------------
diff --git a/taverna-graph-model/src/test/java/org/apache/taverna/workbench/models/graph/GraphElementTest.java b/taverna-graph-model/src/test/java/org/apache/taverna/workbench/models/graph/GraphElementTest.java
new file mode 100644
index 0000000..623566a
--- /dev/null
+++ b/taverna-graph-model/src/test/java/org/apache/taverna/workbench/models/graph/GraphElementTest.java
@@ -0,0 +1,151 @@
+/*******************************************************************************
+ * 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 org.apache.taverna.workbench.models.graph;
+
+
+import org.apache.taverna.workbench.models.graph.GraphNode;
+import org.apache.taverna.workbench.models.graph.GraphController;
+import org.apache.taverna.workbench.models.graph.GraphElement;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+
+import java.awt.Color;
+
+import org.apache.taverna.workbench.models.graph.GraphElement.LineStyle;
+
+import org.junit.Before;
+import org.junit.Test;
+
+public class GraphElementTest {
+
+	private GraphElement element;
+
+	private String id;
+
+	private String label;
+
+	private LineStyle lineStyle;
+
+	private Color color;
+
+	private Color fillColor;
+
+	private GraphElement parent;
+
+	private GraphController graphController;
+
+	@Before
+	public void setUp() throws Exception {
+		element = new GraphElement(graphController) {};
+		id = "element-id";
+		label = "element-label";
+		lineStyle = LineStyle.NONE;
+		color = Color.BLUE;
+		fillColor = Color.GREEN;
+		parent = new GraphNode(graphController);
+		element.setId(id);
+		element.setLabel(label);
+		element.setLineStyle(lineStyle);
+		element.setColor(color);
+		element.setFillColor(fillColor);
+		element.setParent(parent);
+	}
+
+	@Test
+	public void testGetParent() {
+		assertEquals(parent, element.getParent());
+	}
+
+	@Test
+	public void testSetParent() {
+		GraphNode newParent = new GraphNode(graphController);
+		element.setParent(newParent);
+		assertEquals(newParent, element.getParent());
+		element.setParent(null);
+		assertNull(element.getParent());
+	}
+
+	@Test
+	public void testGetLabel() {
+		assertEquals(label, element.getLabel());
+	}
+
+	@Test
+	public void testSetLabel() {
+		element.setLabel("new-label");
+		assertEquals("new-label", element.getLabel());
+		element.setLabel(null);
+		assertNull(element.getLabel());
+	}
+
+	@Test
+	public void testGetId() {
+		assertEquals(id, element.getId());
+	}
+
+	@Test
+	public void testSetId() {
+		element.setId("new-id");
+		assertEquals("new-id", element.getId());
+		element.setId(null);
+		assertNull(element.getId());
+	}
+
+	@Test
+	public void testGetColor() {
+		assertEquals(color, element.getColor());
+	}
+
+	@Test
+	public void testSetColor() {
+		element.setColor(Color.RED);
+		assertEquals(Color.RED, element.getColor());
+		element.setColor(null);
+		assertNull(element.getColor());
+	}
+
+	@Test
+	public void testGetFillColor() {
+		assertEquals(fillColor, element.getFillColor());
+	}
+
+	@Test
+	public void testSetFillColor() {
+		element.setFillColor(Color.RED);
+		assertEquals(Color.RED, element.getFillColor());
+		element.setFillColor(null);
+		assertNull(element.getFillColor());
+	}
+
+	@Test
+	public void testGetLineStyle() {
+		assertEquals(lineStyle, element.getLineStyle());
+	}
+
+	@Test
+	public void testSetLineStyle() {
+		element.setLineStyle(LineStyle.DOTTED);
+		assertEquals(LineStyle.DOTTED, element.getLineStyle());
+		element.setLineStyle(null);
+		assertNull(element.getLineStyle());
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-graph-model/src/test/java/org/apache/taverna/workbench/models/graph/GraphNodeTest.java
----------------------------------------------------------------------
diff --git a/taverna-graph-model/src/test/java/org/apache/taverna/workbench/models/graph/GraphNodeTest.java b/taverna-graph-model/src/test/java/org/apache/taverna/workbench/models/graph/GraphNodeTest.java
new file mode 100644
index 0000000..20410f7
--- /dev/null
+++ b/taverna-graph-model/src/test/java/org/apache/taverna/workbench/models/graph/GraphNodeTest.java
@@ -0,0 +1,182 @@
+/*******************************************************************************
+ * 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 org.apache.taverna.workbench.models.graph;
+
+import org.apache.taverna.workbench.models.graph.GraphNode;
+import org.apache.taverna.workbench.models.graph.Graph;
+import org.apache.taverna.workbench.models.graph.GraphController;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import java.awt.Dimension;
+
+import org.apache.taverna.workbench.models.graph.GraphShapeElement.Shape;
+
+import org.junit.Before;
+import org.junit.Test;
+
+public class GraphNodeTest {
+
+	private GraphNode node;
+
+	private Shape shape;
+
+	private Dimension size;
+
+	private Graph graph;
+
+	private boolean expanded;
+
+	private GraphController graphController;
+
+	@Before
+	public void setUp() throws Exception {
+		shape = Shape.HOUSE;
+		size = new Dimension(1, 2);
+		graph = new Graph(graphController);
+		expanded = false;
+		node = new GraphNode(graphController);
+		node.setShape(shape);
+		node.setSize(size);
+		node.setGraph(graph);
+		node.setExpanded(expanded);
+	}
+
+	@Test
+	public void testNode() {
+		assertNotNull(new GraphNode(graphController));
+	}
+
+	@Test
+	public void testAddSinkNode() {
+		GraphNode newNode = new GraphNode(graphController);
+		node.addSinkNode(newNode);
+		assertEquals(1, node.getSinkNodes().size());
+		assertTrue(node.getSinkNodes().contains(newNode));
+		assertEquals(node, newNode.getParent());
+	}
+
+	@Test
+	public void testAddSourceNode() {
+		GraphNode newNode = new GraphNode(graphController);
+		node.addSourceNode(newNode);
+		assertEquals(1, node.getSourceNodes().size());
+		assertTrue(node.getSourceNodes().contains(newNode));
+		assertEquals(node, newNode.getParent());
+	}
+
+	@Test
+	public void testGetGraph() {
+		assertEquals(graph, node.getGraph());
+	}
+
+	@Test
+	public void testGetHeight() {
+		assertEquals(size.height, node.getHeight(), 0);
+	}
+
+	@Test
+	public void testGetShape() {
+		assertEquals(shape, node.getShape());
+	}
+
+	@Test
+	public void testGetSinkNodes() {
+		assertNotNull(node.getSinkNodes());
+		assertEquals(0, node.getSinkNodes().size());
+	}
+
+	@Test
+	public void testGetSize() {
+		assertEquals(size, node.getSize());
+	}
+
+	@Test
+	public void testGetSourceNodes() {
+		assertNotNull(node.getSourceNodes());
+		assertEquals(0, node.getSourceNodes().size());
+	}
+
+	@Test
+	public void testGetWidth() {
+		assertEquals(size.width, node.getWidth(), 0);
+	}
+
+	@Test
+	public void testIsExpanded() {
+		assertEquals(expanded, node.isExpanded());
+	}
+
+	@Test
+	public void testRemoveSinkNode() {
+		GraphNode newNode = new GraphNode(graphController);
+		assertFalse(node.removeSinkNode(newNode));
+		node.addSinkNode(newNode);
+		assertTrue(node.removeSinkNode(newNode));
+		assertFalse(node.getSinkNodes().contains(newNode));
+	}
+
+	@Test
+	public void testRemoveSourceNode() {
+		GraphNode newNode = new GraphNode(graphController);
+		assertFalse(node.removeSourceNode(newNode));
+		node.addSourceNode(newNode);
+		assertTrue(node.removeSourceNode(newNode));
+		assertFalse(node.getSourceNodes().contains(newNode));
+	}
+
+	@Test
+	public void testSetExpanded() {
+		node.setExpanded(true);
+		assertEquals(true, node.isExpanded());
+		node.setExpanded(false);
+		assertEquals(false, node.isExpanded());
+	}
+
+	@Test
+	public void testSetGraph() {
+		Graph newGraph = new Graph(graphController);
+		node.setGraph(newGraph);
+		assertEquals(newGraph, node.getGraph());
+		node.setGraph(null);
+		assertNull(node.getGraph());
+	}
+
+	@Test
+	public void testSetShape() {
+		node.setShape(Shape.INVTRIANGLE);
+		assertEquals(Shape.INVTRIANGLE, node.getShape());
+		node.setShape(Shape.TRIANGLE);
+		assertEquals(Shape.TRIANGLE, node.getShape());
+	}
+
+	@Test
+	public void testSetSize() {
+		node.setSize(new Dimension(23, 6));
+		assertEquals(new Dimension(23, 6), node.getSize());
+		node.setSize(new Dimension(14, 4));
+		assertEquals(new Dimension(14, 4), node.getSize());
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-graph-model/src/test/java/org/apache/taverna/workbench/models/graph/GraphTest.java
----------------------------------------------------------------------
diff --git a/taverna-graph-model/src/test/java/org/apache/taverna/workbench/models/graph/GraphTest.java b/taverna-graph-model/src/test/java/org/apache/taverna/workbench/models/graph/GraphTest.java
new file mode 100644
index 0000000..ec7f251
--- /dev/null
+++ b/taverna-graph-model/src/test/java/org/apache/taverna/workbench/models/graph/GraphTest.java
@@ -0,0 +1,139 @@
+/*******************************************************************************
+ * 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 org.apache.taverna.workbench.models.graph;
+
+import org.apache.taverna.workbench.models.graph.GraphController;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import org.apache.taverna.workbench.models.graph.GraphEdge;
+import org.apache.taverna.workbench.models.graph.Graph;
+import org.apache.taverna.workbench.models.graph.GraphNode;
+import org.apache.taverna.workbench.models.graph.Graph.Alignment;
+
+import org.junit.Before;
+import org.junit.Test;
+
+public class GraphTest {
+
+	private Graph graph;
+
+	private Alignment alignment;
+
+	private GraphController graphController;
+
+	@Before
+	public void setUp() throws Exception {
+		alignment = Alignment.VERTICAL;
+		graph = new Graph(graphController);
+	}
+
+	@Test
+	public void testGraph() {
+		assertNotNull(new Graph(graphController));
+	}
+
+	@Test
+	public void testAddEdge() {
+		GraphEdge newEdge = new GraphEdge(graphController);
+		graph.addEdge(newEdge);
+		assertEquals(1, graph.getEdges().size());
+		assertTrue(graph.getEdges().contains(newEdge));
+	}
+
+	@Test
+	public void testAddNode() {
+		GraphNode newNode = new GraphNode(graphController);
+		graph.addNode(newNode);
+		assertEquals(1, graph.getNodes().size());
+		assertTrue(graph.getNodes().contains(newNode));
+		assertEquals(graph, newNode.getParent());
+	}
+
+	@Test
+	public void testAddSubgraph() {
+		Graph newGraph = new Graph(graphController);
+		graph.addSubgraph(newGraph);
+		assertEquals(1, graph.getSubgraphs().size());
+		assertTrue(graph.getSubgraphs().contains(newGraph));
+		assertEquals(graph, newGraph.getParent());
+	}
+
+	@Test
+	public void testGetAlignment() {
+		assertEquals(alignment, graph.getAlignment());
+	}
+
+	@Test
+	public void testGetEdges() {
+		assertNotNull(graph.getNodes());
+		assertEquals(0, graph.getNodes().size());
+	}
+
+	@Test
+	public void testGetNodes() {
+		assertNotNull(graph.getEdges());
+		assertEquals(0, graph.getEdges().size());
+	}
+
+	@Test
+	public void testGetSubgraphs() {
+		assertNotNull(graph.getSubgraphs());
+		assertEquals(0, graph.getSubgraphs().size());
+	}
+
+	@Test
+	public void testRemoveEdge() {
+		GraphEdge newEdge = new GraphEdge(graphController);
+		assertFalse(graph.removeEdge(newEdge));
+		graph.addEdge(newEdge);
+		assertTrue(graph.removeEdge(newEdge));
+		assertFalse(graph.getNodes().contains(newEdge));
+	}
+
+	@Test
+	public void testRemoveNode() {
+		GraphNode newNode = new GraphNode(graphController);
+		assertFalse(graph.removeNode(newNode));
+		graph.addNode(newNode);
+		assertTrue(graph.removeNode(newNode));
+		assertFalse(graph.getNodes().contains(newNode));
+	}
+
+	@Test
+	public void testRemoveSubgraph() {
+		Graph newGraph = new Graph(graphController);
+		assertFalse(graph.removeSubgraph(newGraph));
+		graph.addSubgraph(newGraph);
+		assertTrue(graph.removeSubgraph(newGraph));
+		assertFalse(graph.getSubgraphs().contains(newGraph));
+	}
+
+	@Test
+	public void testSetAlignment() {
+		graph.setAlignment(Alignment.VERTICAL);
+		assertEquals(Alignment.VERTICAL, graph.getAlignment());
+		graph.setAlignment(Alignment.HORIZONTAL);
+		assertEquals(Alignment.HORIZONTAL, graph.getAlignment());
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/GraphViewComponent.java
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/GraphViewComponent.java b/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/GraphViewComponent.java
index ef1ac2c..dac96ab 100644
--- a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/GraphViewComponent.java
+++ b/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/GraphViewComponent.java
@@ -25,15 +25,15 @@ import static java.awt.BorderLayout.NORTH;
 import static javax.swing.Action.SHORT_DESCRIPTION;
 import static javax.swing.Action.SMALL_ICON;
 import static javax.swing.BoxLayout.PAGE_AXIS;
-import static net.sf.taverna.t2.workbench.icons.WorkbenchIcons.allportIcon;
-import static net.sf.taverna.t2.workbench.icons.WorkbenchIcons.blobIcon;
-import static net.sf.taverna.t2.workbench.icons.WorkbenchIcons.expandNestedIcon;
-import static net.sf.taverna.t2.workbench.icons.WorkbenchIcons.horizontalIcon;
-import static net.sf.taverna.t2.workbench.icons.WorkbenchIcons.noportIcon;
-import static net.sf.taverna.t2.workbench.icons.WorkbenchIcons.refreshIcon;
-import static net.sf.taverna.t2.workbench.icons.WorkbenchIcons.verticalIcon;
-import static net.sf.taverna.t2.workbench.icons.WorkbenchIcons.zoomInIcon;
-import static net.sf.taverna.t2.workbench.icons.WorkbenchIcons.zoomOutIcon;
+import static org.apache.taverna.workbench.icons.WorkbenchIcons.allportIcon;
+import static org.apache.taverna.workbench.icons.WorkbenchIcons.blobIcon;
+import static org.apache.taverna.workbench.icons.WorkbenchIcons.expandNestedIcon;
+import static org.apache.taverna.workbench.icons.WorkbenchIcons.horizontalIcon;
+import static org.apache.taverna.workbench.icons.WorkbenchIcons.noportIcon;
+import static org.apache.taverna.workbench.icons.WorkbenchIcons.refreshIcon;
+import static org.apache.taverna.workbench.icons.WorkbenchIcons.verticalIcon;
+import static org.apache.taverna.workbench.icons.WorkbenchIcons.zoomInIcon;
+import static org.apache.taverna.workbench.icons.WorkbenchIcons.zoomOutIcon;
 import static net.sf.taverna.t2.workbench.views.graph.config.GraphViewConfiguration.ALIGNMENT;
 import static net.sf.taverna.t2.workbench.views.graph.config.GraphViewConfiguration.ANIMATION_ENABLED;
 import static net.sf.taverna.t2.workbench.views.graph.config.GraphViewConfiguration.ANIMATION_SPEED;
@@ -65,25 +65,25 @@ import javax.swing.border.EmptyBorder;
 
 import org.apache.taverna.lang.observer.Observable;
 import org.apache.taverna.lang.observer.SwingAwareObserver;
-import net.sf.taverna.t2.ui.menu.MenuManager;
-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.edits.EditManager.AbstractDataflowEditEvent;
-import net.sf.taverna.t2.workbench.edits.EditManager.EditManagerEvent;
-import net.sf.taverna.t2.workbench.file.FileManager;
-import net.sf.taverna.t2.workbench.file.events.ClosedDataflowEvent;
-import net.sf.taverna.t2.workbench.file.events.FileManagerEvent;
-import net.sf.taverna.t2.workbench.models.graph.Graph.Alignment;
-import net.sf.taverna.t2.workbench.models.graph.GraphController;
-import net.sf.taverna.t2.workbench.models.graph.GraphController.PortStyle;
-import net.sf.taverna.t2.workbench.models.graph.svg.SVGGraphController;
-import net.sf.taverna.t2.workbench.selection.SelectionManager;
-import net.sf.taverna.t2.workbench.selection.events.SelectionManagerEvent;
-import net.sf.taverna.t2.workbench.selection.events.WorkflowBundleSelectionEvent;
-import net.sf.taverna.t2.workbench.selection.events.WorkflowSelectionEvent;
-import net.sf.taverna.t2.workbench.ui.dndhandler.ServiceTransferHandler;
-import net.sf.taverna.t2.workbench.ui.zaria.UIComponentSPI;
+import org.apache.taverna.ui.menu.MenuManager;
+import org.apache.taverna.workbench.configuration.colour.ColourManager;
+import org.apache.taverna.workbench.configuration.workbench.WorkbenchConfiguration;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.edits.EditManager.AbstractDataflowEditEvent;
+import org.apache.taverna.workbench.edits.EditManager.EditManagerEvent;
+import org.apache.taverna.workbench.file.FileManager;
+import org.apache.taverna.workbench.file.events.ClosedDataflowEvent;
+import org.apache.taverna.workbench.file.events.FileManagerEvent;
+import org.apache.taverna.workbench.models.graph.Graph.Alignment;
+import org.apache.taverna.workbench.models.graph.GraphController;
+import org.apache.taverna.workbench.models.graph.GraphController.PortStyle;
+import org.apache.taverna.workbench.models.graph.svg.SVGGraphController;
+import org.apache.taverna.workbench.selection.SelectionManager;
+import org.apache.taverna.workbench.selection.events.SelectionManagerEvent;
+import org.apache.taverna.workbench.selection.events.WorkflowBundleSelectionEvent;
+import org.apache.taverna.workbench.selection.events.WorkflowSelectionEvent;
+import org.apache.taverna.workbench.ui.dndhandler.ServiceTransferHandler;
+import org.apache.taverna.workbench.ui.zaria.UIComponentSPI;
 import net.sf.taverna.t2.workbench.views.graph.config.GraphViewConfiguration;
 import net.sf.taverna.t2.workbench.views.graph.menu.ResetDiagramAction;
 import net.sf.taverna.t2.workbench.views.graph.menu.ZoomInAction;

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/GraphViewComponentFactory.java
----------------------------------------------------------------------
diff --git a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/GraphViewComponentFactory.java b/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/GraphViewComponentFactory.java
index 388c874..4f603d6 100644
--- a/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/GraphViewComponentFactory.java
+++ b/taverna-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/GraphViewComponentFactory.java
@@ -24,14 +24,14 @@ import javax.swing.ImageIcon;
 
 import org.apache.taverna.commons.services.ServiceRegistry;
 
-import net.sf.taverna.t2.ui.menu.MenuManager;
-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.file.FileManager;
-import net.sf.taverna.t2.workbench.selection.SelectionManager;
-import net.sf.taverna.t2.workbench.ui.zaria.UIComponentFactorySPI;
-import net.sf.taverna.t2.workbench.ui.zaria.UIComponentSPI;
+import org.apache.taverna.ui.menu.MenuManager;
+import org.apache.taverna.workbench.configuration.colour.ColourManager;
+import org.apache.taverna.workbench.configuration.workbench.WorkbenchConfiguration;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.file.FileManager;
+import org.apache.taverna.workbench.selection.SelectionManager;
+import org.apache.taverna.workbench.ui.zaria.UIComponentFactorySPI;
+import org.apache.taverna.workbench.ui.zaria.UIComponentSPI;
 import net.sf.taverna.t2.workbench.views.graph.config.GraphViewConfiguration;
 
 /**


[51/51] [partial] incubator-taverna-workbench git commit: all packages are moved to org.apache.taverna.*

Posted by re...@apache.org.
all packages are moved to org.apache.taverna.*

Project: http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/commit/a9a52bd5
Tree: http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/tree/a9a52bd5
Diff: http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/diff/a9a52bd5

Branch: refs/heads/master
Commit: a9a52bd52cae2bdade18243a1444f2cdca3e68ad
Parents: ed0a8e1
Author: Dmitry Repchevsky <re...@list.ru>
Authored: Thu Mar 26 19:50:10 2015 +0100
Committer: Dmitry Repchevsky <re...@list.ru>
Committed: Thu Mar 26 19:50:10 2015 +0100

----------------------------------------------------------------------
 .../activityicons/ActivityIconManager.java      |   41 -
 .../activityicons/ActivityIconSPI.java          |   57 -
 .../activityicons/DefaultActivityIcon.java      |   54 -
 .../impl/ActivityIconManagerImpl.java           |   85 -
 .../activityicons/ActivityIconManager.java      |   40 +
 .../activityicons/ActivityIconSPI.java          |   56 +
 .../activityicons/DefaultActivityIcon.java      |   53 +
 .../impl/ActivityIconManagerImpl.java           |   84 +
 ...a.t2.workbench.activityicons.ActivityIconSPI |    1 -
 ...erna.workbench.activityicons.ActivityIconSPI |    1 +
 .../spring/activity-icons-api-context-osgi.xml  |    6 +-
 .../spring/activity-icons-api-context.xml       |    4 +-
 .../AbstractConfigurableServiceProvider.java    |   53 -
 .../AbstractTemplateService.java                |   85 -
 .../ConfigurableServiceProvider.java            |   10 -
 .../CustomizedConfigurePanelProvider.java       |   36 -
 .../servicedescriptions/IdentifiedObject.java   |   30 -
 .../servicedescriptions/ServiceDescription.java |   80 -
 .../ServiceDescriptionProvider.java             |   61 -
 .../ServiceDescriptionRegistry.java             |   50 -
 .../ServiceDescriptionsConfiguration.java       |   36 -
 .../events/AbstractProviderEvent.java           |   16 -
 .../events/AbstractProviderNotification.java    |   18 -
 .../events/AddedProviderEvent.java              |   10 -
 .../PartialServiceDescriptionsNotification.java |   22 -
 .../events/ProviderErrorNotification.java       |   19 -
 .../events/ProviderStatusNotification.java      |   12 -
 .../events/ProviderUpdatingNotification.java    |   11 -
 .../events/ProviderWarningNotification.java     |   12 -
 .../events/RemovedProviderEvent.java            |   10 -
 .../events/ServiceDescriptionProvidedEvent.java |   20 -
 .../events/ServiceDescriptionRegistryEvent.java |    4 -
 .../AbstractConfigurableServiceProvider.java    |   72 +
 .../AbstractTemplateService.java                |  104 +
 .../ConfigurableServiceProvider.java            |   29 +
 .../CustomizedConfigurePanelProvider.java       |   35 +
 .../servicedescriptions/IdentifiedObject.java   |   49 +
 .../servicedescriptions/ServiceDescription.java |   99 +
 .../ServiceDescriptionProvider.java             |   80 +
 .../ServiceDescriptionRegistry.java             |   69 +
 .../ServiceDescriptionsConfiguration.java       |   35 +
 .../events/AbstractProviderEvent.java           |   35 +
 .../events/AbstractProviderNotification.java    |   37 +
 .../events/AddedProviderEvent.java              |   29 +
 .../PartialServiceDescriptionsNotification.java |   41 +
 .../events/ProviderErrorNotification.java       |   38 +
 .../events/ProviderStatusNotification.java      |   31 +
 .../events/ProviderUpdatingNotification.java    |   30 +
 .../events/ProviderWarningNotification.java     |   31 +
 .../events/RemovedProviderEvent.java            |   29 +
 .../events/ServiceDescriptionProvidedEvent.java |   39 +
 .../events/ServiceDescriptionRegistryEvent.java |   23 +
 .../impl/ServiceDescriptionConstants.java       |   10 -
 .../impl/ServiceDescriptionDeserializer.java    |  167 --
 .../impl/ServiceDescriptionRegistryImpl.java    |  652 -------
 .../impl/ServiceDescriptionSerializer.java      |  102 -
 .../impl/ServiceDescriptionXMLConstants.java    |   15 -
 .../ServiceDescriptionsConfigurationImpl.java   |   92 -
 .../ActivityPaletteConfiguration.java           |   81 -
 .../ActivityPaletteConfigurationPanel.java      |  284 ---
 .../ActivityPaletteConfigurationUIFactory.java  |   52 -
 .../impl/ServiceDescriptionConstants.java       |   10 +
 .../impl/ServiceDescriptionDeserializer.java    |  167 ++
 .../impl/ServiceDescriptionRegistryImpl.java    |  652 +++++++
 .../impl/ServiceDescriptionSerializer.java      |  102 +
 .../impl/ServiceDescriptionXMLConstants.java    |   15 +
 .../ServiceDescriptionsConfigurationImpl.java   |   92 +
 .../ActivityPaletteConfiguration.java           |   81 +
 .../ActivityPaletteConfigurationPanel.java      |  284 +++
 .../ActivityPaletteConfigurationUIFactory.java  |   52 +
 ...rkbench.configuration.ConfigurationUIFactory |    1 -
 ...rkbench.configuration.ConfigurationUIFactory |    1 +
 .../activity-palette-impl-context-osgi.xml      |    6 +-
 .../spring/activity-palette-impl-context.xml    |    6 +-
 .../ActivityPaletteConfigurationTest.java       |   97 -
 .../ActivityPaletteConfigurationTest.java       |   98 +
 ...averna.t2.partition.PartitionAlgorithmSetSPI |    2 +-
 ...sf.taverna.t2.partition.PropertyExtractorSPI |    6 +-
 .../net.sf.taverna.t2.partition.QueryFactory    |    4 +-
 .../servicepanel/PathElementFilterTreeNode.java |   34 -
 .../ui/servicepanel/RootFilterTreeNode.java     |   34 -
 .../ui/servicepanel/ServiceFilter.java          |  158 --
 .../ui/servicepanel/ServiceFilterTreeNode.java  |   40 -
 .../workbench/ui/servicepanel/ServicePanel.java |  411 ----
 .../ServicePanelComponentFactory.java           |   82 -
 .../servicepanel/ServiceTreeCellRenderer.java   |   77 -
 .../servicepanel/ServiceTreeClickListener.java  |  252 ---
 .../ui/servicepanel/ServiceTreePanel.java       |  176 --
 .../actions/AddServiceProviderAction.java       |  256 ---
 .../ExportServiceDescriptionsAction.java        |  155 --
 ...ImportServiceDescriptionsFromFileAction.java |  158 --
 .../ImportServiceDescriptionsFromURLAction.java |  129 --
 .../actions/RefreshProviderRegistryAction.java  |   52 -
 .../actions/RemoveDefaultServicesAction.java    |   51 -
 .../actions/RemoveUserServicesAction.java       |   59 -
 .../actions/RestoreDefaultServicesAction.java   |   50 -
 .../config/ServiceDescriptionConfigPanel.java   |  181 --
 .../ServiceDescriptionConfigUIFactory.java      |   57 -
 .../menu/AddServiceProviderMenu.java            |  113 --
 .../workbench/ui/servicepanel/tree/Filter.java  |   33 -
 .../tree/FilterTreeCellRenderer.java            |   59 -
 .../ui/servicepanel/tree/FilterTreeModel.java   |   92 -
 .../ui/servicepanel/tree/FilterTreeNode.java    |  142 --
 .../tree/FilterTreeSelectionModel.java          |   46 -
 .../ui/servicepanel/tree/MyFilter.java          |   89 -
 .../ui/servicepanel/tree/TreePanel.java         |  371 ----
 .../servicepanel/PathElementFilterTreeNode.java |   33 +
 .../ui/servicepanel/RootFilterTreeNode.java     |   33 +
 .../ui/servicepanel/ServiceFilter.java          |  157 ++
 .../ui/servicepanel/ServiceFilterTreeNode.java  |   39 +
 .../workbench/ui/servicepanel/ServicePanel.java |  410 ++++
 .../ServicePanelComponentFactory.java           |   81 +
 .../servicepanel/ServiceTreeCellRenderer.java   |   76 +
 .../servicepanel/ServiceTreeClickListener.java  |  251 +++
 .../ui/servicepanel/ServiceTreePanel.java       |  192 ++
 .../actions/AddServiceProviderAction.java       |  255 +++
 .../ExportServiceDescriptionsAction.java        |  154 ++
 ...ImportServiceDescriptionsFromFileAction.java |  157 ++
 .../ImportServiceDescriptionsFromURLAction.java |  128 ++
 .../actions/RefreshProviderRegistryAction.java  |   51 +
 .../actions/RemoveDefaultServicesAction.java    |   50 +
 .../actions/RemoveUserServicesAction.java       |   58 +
 .../actions/RestoreDefaultServicesAction.java   |   49 +
 .../config/ServiceDescriptionConfigPanel.java   |  181 ++
 .../ServiceDescriptionConfigUIFactory.java      |   56 +
 .../menu/AddServiceProviderMenu.java            |  112 ++
 .../workbench/ui/servicepanel/tree/Filter.java  |   32 +
 .../tree/FilterTreeCellRenderer.java            |   58 +
 .../ui/servicepanel/tree/FilterTreeModel.java   |   91 +
 .../ui/servicepanel/tree/FilterTreeNode.java    |  141 ++
 .../tree/FilterTreeSelectionModel.java          |   45 +
 .../ui/servicepanel/tree/MyFilter.java          |   88 +
 .../ui/servicepanel/tree/TreePanel.java         |  370 ++++
 ....t2.workbench.ui.zaria.UIComponentFactorySPI |    1 -
 ...rna.workbench.ui.zaria.UIComponentFactorySPI |    1 +
 .../spring/activity-palette-ui-context-osgi.xml |   12 +-
 .../spring/activity-palette-ui-context.xml      |    4 +-
 .../AbstractConfigureActivityMenuAction.java    |   64 -
 .../AbstractConfigureActivityMenuAction.java    |   83 +
 .../t2/lang/beans/PropertyAnnotated.java        |   74 -
 .../t2/lang/beans/PropertyAnnotation.java       |  109 --
 .../lang/beans/PropertyAnnotationExtractor.java |  202 --
 .../taverna/lang/beans/PropertyAnnotated.java   |   73 +
 .../taverna/lang/beans/PropertyAnnotation.java  |  108 ++
 .../lang/beans/PropertyAnnotationExtractor.java |  201 ++
 .../configuration/colour/ColourManager.java     |   41 -
 .../configuration/mimetype/MimeTypeManager.java |   42 -
 .../workbench/WorkbenchConfiguration.java       |   44 -
 .../workbench/ui/T2ConfigurationFrame.java      |   30 -
 .../configuration/colour/ColourManager.java     |   40 +
 .../configuration/mimetype/MimeTypeManager.java |   41 +
 .../workbench/WorkbenchConfiguration.java       |   43 +
 .../workbench/ui/T2ConfigurationFrame.java      |   29 +
 .../WorkbenchConfigurationImpl.java             |  210 --
 .../WorkbenchConfigurationPanel.java            |  266 ---
 .../WorkbenchConfigurationUIFactory.java        |   52 -
 .../configuration/colour/ColourManagerImpl.java |  178 --
 .../mimetype/MimeTypeManagerImpl.java           |   82 -
 .../ui/T2ConfigurationFrameImpl.java            |  205 --
 .../ui/WorkbenchConfigurationMenu.java          |   61 -
 .../ui/WorkbenchPreferencesSection.java         |   36 -
 .../WorkbenchConfigurationImpl.java             |  209 ++
 .../WorkbenchConfigurationPanel.java            |  265 +++
 .../WorkbenchConfigurationUIFactory.java        |   51 +
 .../configuration/colour/ColourManagerImpl.java |  177 ++
 .../mimetype/MimeTypeManagerImpl.java           |   81 +
 .../ui/T2ConfigurationFrameImpl.java            |  204 ++
 .../ui/WorkbenchConfigurationMenu.java          |   60 +
 .../ui/WorkbenchPreferencesSection.java         |   35 +
 .../net.sf.taverna.t2.ui.menu.MenuComponent     |    2 -
 ...rkbench.configuration.ConfigurationUIFactory |    1 -
 .../org.apache.taverna.ui.menu.MenuComponent    |    2 +
 ...rkbench.configuration.ConfigurationUIFactory |    1 +
 .../spring/configuration-impl-context-osgi.xml  |    8 +-
 .../spring/configuration-impl-context.xml       |   14 +-
 .../configuration/ConfigurationManagerTest.java |  109 --
 .../configuration/colour/ColourManagerTest.java |   90 -
 .../configuration/ConfigurationManagerTest.java |  108 ++
 .../configuration/colour/ColourManagerTest.java |   89 +
 .../activity/ActivityConfigurationAction.java   |  167 --
 .../activity/ActivityContextualView.java        |   69 -
 .../HTMLBasedActivityContextualView.java        |   81 -
 .../contextualviews/AddLayerFactorySPI.java     |   43 -
 .../views/contextualviews/ContextualView.java   |  109 --
 .../activity/ActivityConfigurationDialog.java   |  474 -----
 .../activity/ActivityConfigurationPanel.java    |  214 ---
 .../activity/ActivityPortConfiguration.java     |   84 -
 .../activity/ContextualViewFactory.java         |   63 -
 .../activity/ContextualViewFactoryRegistry.java |   43 -
 .../activity/DependencyConfigurationPanel.java  |  293 ---
 .../activity/ListConfigurationComponent.java    |  119 --
 .../contextualviews/activity/ListLayout.java    |   92 -
 .../MultiPageActivityConfigurationPanel.java    |   65 -
 .../activity/ScriptConfigurationComponent.java  |  150 --
 .../activity/ValidatingTextField.java           |   53 -
 .../activity/ValidatingTextGroup.java           |  119 --
 .../activity/ActivityConfigurationAction.java   |  166 ++
 .../activity/ActivityContextualView.java        |   68 +
 .../HTMLBasedActivityContextualView.java        |   80 +
 .../contextualviews/AddLayerFactorySPI.java     |   42 +
 .../views/contextualviews/ContextualView.java   |  108 ++
 .../activity/ActivityConfigurationDialog.java   |  493 +++++
 .../activity/ActivityConfigurationPanel.java    |  230 +++
 .../activity/ActivityPortConfiguration.java     |   83 +
 .../activity/ContextualViewFactory.java         |   62 +
 .../activity/ContextualViewFactoryRegistry.java |   42 +
 .../activity/DependencyConfigurationPanel.java  |  292 +++
 .../activity/ListConfigurationComponent.java    |  118 ++
 .../contextualviews/activity/ListLayout.java    |   91 +
 .../MultiPageActivityConfigurationPanel.java    |   64 +
 .../activity/ScriptConfigurationComponent.java  |  149 ++
 .../activity/ValidatingTextField.java           |   52 +
 .../activity/ValidatingTextGroup.java           |  118 ++
 ....t2.workbench.ui.zaria.UIComponentFactorySPI |    2 -
 ...taverna.t2.workbench.ui.zaria.UIComponentSPI |    3 -
 ...rna.workbench.ui.zaria.UIComponentFactorySPI |    2 +
 ...he.taverna.workbench.ui.zaria.UIComponentSPI |    3 +
 .../impl/ContextualViewFactoryRegistryImpl.java |   75 -
 .../annotated/AnnotatedContextualView.java      |  263 ---
 .../AnnotatedContextualViewFactory.java         |   43 -
 .../condition/ConditionContextualView.java      |   74 -
 .../ConditionContextualViewFactory.java         |   51 -
 .../dataflow/DataflowContextualView.java        |  108 --
 .../dataflow/DataflowContextualViewFactory.java |   41 -
 .../DataflowInputPortContextualView.java        |   96 -
 .../DataflowInputPortContextualViewFactory.java |   54 -
 .../DataflowOutputPortContextualView.java       |  106 -
 ...DataflowOutputPortContextualViewFactory.java |   55 -
 .../datalink/DatalinkContextualView.java        |  106 -
 .../datalink/DatalinkContextualViewFactory.java |   55 -
 .../impl/ContextualViewComponent.java           |  389 ----
 .../impl/ContextualViewComponentFactory.java    |   64 -
 .../inputport/InputPortContextualView.java      |   76 -
 .../InputPortContextualViewFactory.java         |   48 -
 .../merge/MergeConfigurationAction.java         |   79 -
 .../merge/MergeConfigurationView.java           |  233 ---
 .../merge/MergeContextualView.java              |  150 --
 .../merge/MergeContextualViewFactory.java       |   66 -
 .../outputport/OutputPortContextualView.java    |   76 -
 .../OutputPortContextualViewFactory.java        |   48 -
 .../impl/ContextualViewFactoryRegistryImpl.java |   71 +
 .../annotated/AnnotatedContextualView.java      |  262 +++
 .../AnnotatedContextualViewFactory.java         |   62 +
 .../condition/ConditionContextualView.java      |   73 +
 .../ConditionContextualViewFactory.java         |   50 +
 .../dataflow/DataflowContextualView.java        |  124 ++
 .../dataflow/DataflowContextualViewFactory.java |   57 +
 .../DataflowInputPortContextualView.java        |   95 +
 .../DataflowInputPortContextualViewFactory.java |   53 +
 .../DataflowOutputPortContextualView.java       |  105 +
 ...DataflowOutputPortContextualViewFactory.java |   54 +
 .../datalink/DatalinkContextualView.java        |  105 +
 .../datalink/DatalinkContextualViewFactory.java |   54 +
 .../impl/ContextualViewComponent.java           |  408 ++++
 .../impl/ContextualViewComponentFactory.java    |   63 +
 .../inputport/InputPortContextualView.java      |   75 +
 .../InputPortContextualViewFactory.java         |   47 +
 .../merge/MergeConfigurationAction.java         |   78 +
 .../merge/MergeConfigurationView.java           |  252 +++
 .../merge/MergeContextualView.java              |  149 ++
 .../merge/MergeContextualViewFactory.java       |   65 +
 .../outputport/OutputPortContextualView.java    |   75 +
 .../OutputPortContextualViewFactory.java        |   47 +
 ...ntextualviews.activity.ContextualViewFactory |    9 -
 ....t2.workbench.ui.zaria.UIComponentFactorySPI |    1 -
 ...ntextualviews.activity.ContextualViewFactory |    9 +
 ...rna.workbench.ui.zaria.UIComponentFactorySPI |    1 +
 .../contextual-views-impl-context-osgi.xml      |   34 +-
 .../spring/contextual-views-impl-context.xml    |   22 +-
 .../ProcessorActivitiesContextualView.java      |  154 --
 ...rocessorActivitiesContextualViewFactory.java |   75 -
 ...rPredictedBehaviorContextualViewFactory.java |  177 --
 .../ProcessorActivitiesContextualView.java      |  153 ++
 ...rocessorActivitiesContextualViewFactory.java |   74 +
 ...rPredictedBehaviorContextualViewFactory.java |  176 ++
 ...ntextualviews.activity.ContextualViewFactory |    4 -
 ...ntextualviews.activity.ContextualViewFactory |    4 +
 .../spring/contextual-views-context-osgi.xml    |    8 +-
 .../spring/contextual-views-context.xml         |    4 +-
 .../ui/credentialmanager/CMStrings.java         |    7 -
 .../ChangeMasterPasswordDialog.java             |  234 ---
 .../ConfirmTrustedCertificateDialog.java        |  520 -----
 .../ConfirmTrustedCertificateUI.java            |   71 -
 .../credentialmanager/CredentialManagerUI.java  | 1512 ---------------
 .../CredentialManagerUILauncher.java            |   96 -
 .../ui/credentialmanager/CryptoFileFilter.java  |   73 -
 .../GetMasterPasswordDialog.java                |  169 --
 .../ui/credentialmanager/GetPasswordDialog.java |  168 --
 .../credentialmanager/KeyPairsTableModel.java   |  213 --
 .../NewEditPasswordEntryDialog.java             |  397 ----
 .../NewKeyPairEntryDialog.java                  |  304 ---
 .../credentialmanager/NewTrustCertsDialog.java  |  248 ---
 .../credentialmanager/PasswordsTableModel.java  |  227 ---
 .../SetMasterPasswordDialog.java                |  189 --
 .../ui/credentialmanager/TableCellRenderer.java |  113 --
 .../credentialmanager/TableHeaderRenderer.java  |  100 -
 .../TrustedCertsTableModel.java                 |  216 ---
 .../ViewCertDetailsDialog.java                  |  509 -----
 .../ViewUsernamePasswordEntryDialog.java        |  199 --
 .../WarnUserAboutJCEPolicyDialog.java           |  223 ---
 .../action/CredentialManagerAction.java         |   68 -
 .../menu/CredentialManagerMenu.java             |   70 -
 .../AskUserJavaTruststorePasswordProvider.java  |   46 -
 .../password/AskUserMasterPasswordProvider.java |   55 -
 ...kUserServiceUsernameAndPasswordProvider.java |   23 -
 .../AskUserTrustConfirmationProvider.java       |   35 -
 .../password/GetPasswordDialog.java             |  228 ---
 .../password/SimpleMasterPasswordProvider.java  |   54 -
 .../password/UIMasterPasswordProvider.java      |  126 --
 .../password/UIUsernamePasswordProvider.java    |   92 -
 .../startup/InitialiseSSLStartupHook.java       |   64 -
 .../SetCredManAuthenticatorStartupHook.java     |   24 -
 .../toolbar/CredentialManagerToolbarAction.java |   44 -
 .../CredentialManagerToolbarSection.java        |   38 -
 .../ui/credentialmanager/CMStrings.java         |   26 +
 .../ChangeMasterPasswordDialog.java             |  233 +++
 .../ConfirmTrustedCertificateDialog.java        |  519 +++++
 .../ConfirmTrustedCertificateUI.java            |   70 +
 .../credentialmanager/CredentialManagerUI.java  | 1511 +++++++++++++++
 .../CredentialManagerUILauncher.java            |   95 +
 .../ui/credentialmanager/CryptoFileFilter.java  |   72 +
 .../GetMasterPasswordDialog.java                |  168 ++
 .../ui/credentialmanager/GetPasswordDialog.java |  167 ++
 .../credentialmanager/KeyPairsTableModel.java   |  212 ++
 .../NewEditPasswordEntryDialog.java             |  396 ++++
 .../NewKeyPairEntryDialog.java                  |  303 +++
 .../credentialmanager/NewTrustCertsDialog.java  |  247 +++
 .../credentialmanager/PasswordsTableModel.java  |  226 +++
 .../SetMasterPasswordDialog.java                |  188 ++
 .../ui/credentialmanager/TableCellRenderer.java |  112 ++
 .../credentialmanager/TableHeaderRenderer.java  |   94 +
 .../TrustedCertsTableModel.java                 |  215 +++
 .../ViewCertDetailsDialog.java                  |  508 +++++
 .../ViewUsernamePasswordEntryDialog.java        |  198 ++
 .../WarnUserAboutJCEPolicyDialog.java           |  222 +++
 .../action/CredentialManagerAction.java         |   67 +
 .../menu/CredentialManagerMenu.java             |   69 +
 .../AskUserJavaTruststorePasswordProvider.java  |   45 +
 .../password/AskUserMasterPasswordProvider.java |   54 +
 ...kUserServiceUsernameAndPasswordProvider.java |   42 +
 .../AskUserTrustConfirmationProvider.java       |   34 +
 .../password/GetPasswordDialog.java             |  227 +++
 .../password/SimpleMasterPasswordProvider.java  |   53 +
 .../password/UIMasterPasswordProvider.java      |  125 ++
 .../password/UIUsernamePasswordProvider.java    |  111 ++
 .../startup/InitialiseSSLStartupHook.java       |   63 +
 .../SetCredManAuthenticatorStartupHook.java     |   43 +
 .../toolbar/CredentialManagerToolbarAction.java |   43 +
 .../CredentialManagerToolbarSection.java        |   37 +
 ...rity.credentialmanager.CredentialProviderSPI |    3 -
 .../net.sf.taverna.t2.ui.menu.MenuComponent     |    3 -
 .../net.sf.taverna.t2.workbench.StartupSPI      |    2 -
 ...rity.credentialmanager.CredentialProviderSPI |    3 +
 .../org.apache.taverna.ui.menu.MenuComponent    |    3 +
 .../org.apache.taverna.workbench.StartupSPI     |    2 +
 .../credential-manager-ui-context-osgi.xml      |   18 +-
 .../spring/credential-manager-ui-context.xml    |   24 +-
 .../DataManagementConfigurationPanel.java       |  304 ---
 .../DataManagementConfigurationUIFactory.java   |   64 -
 .../DataManagementConfigurationPanel.java       |  303 +++
 .../DataManagementConfigurationUIFactory.java   |   63 +
 ...rkbench.configuration.ConfigurationUIFactory |    1 -
 ...rkbench.configuration.ConfigurationUIFactory |    1 +
 .../data-management-config-ui-context-osgi.xml  |    2 +-
 .../data-management-config-ui-context.xml       |    2 +-
 .../actions/EditNestedDataflowAction.java       |   46 -
 .../menu/EditNestedDataflowMenuAction.java      |   28 -
 .../DataflowActivityIcon.java                   |   57 -
 .../DataflowTemplateService.java                |   54 -
 .../views/DataflowActivityContextualView.java   |  140 --
 .../views/DataflowActivityViewFactory.java      |   93 -
 .../file/importworkflow/DataflowMerger.java     |  124 --
 .../file/importworkflow/MergeException.java     |   22 -
 .../actions/AddNestedWorkflowAction.java        |   59 -
 .../actions/ImportWorkflowAction.java           |   59 -
 .../actions/MergeWorkflowAction.java            |   58 -
 .../actions/OpenSourceWorkflowAction.java       |  139 --
 .../actions/ReplaceNestedWorkflowAction.java    |   84 -
 .../gui/ImportWorkflowWizard.java               | 1272 ------------
 .../menu/AddNestedWorkflowMenuAction.java       |  104 -
 .../menu/ImportWorkflowMenuAction.java          |   98 -
 .../menu/MergeWorkflowMenuAction.java           |   65 -
 .../menu/ReplaceNestedWorkflowMenuAction.java   |   76 -
 .../actions/EditNestedDataflowAction.java       |   46 +
 .../menu/EditNestedDataflowMenuAction.java      |   28 +
 .../DataflowActivityIcon.java                   |   57 +
 .../DataflowTemplateService.java                |   60 +
 .../views/DataflowActivityContextualView.java   |  140 ++
 .../views/DataflowActivityViewFactory.java      |   93 +
 .../file/importworkflow/DataflowMerger.java     |  124 ++
 .../file/importworkflow/MergeException.java     |   22 +
 .../actions/AddNestedWorkflowAction.java        |   59 +
 .../actions/ImportWorkflowAction.java           |   59 +
 .../actions/MergeWorkflowAction.java            |   58 +
 .../actions/OpenSourceWorkflowAction.java       |  139 ++
 .../actions/ReplaceNestedWorkflowAction.java    |   84 +
 .../gui/ImportWorkflowWizard.java               | 1272 ++++++++++++
 .../menu/AddNestedWorkflowMenuAction.java       |  104 +
 .../menu/ImportWorkflowMenuAction.java          |   98 +
 .../menu/MergeWorkflowMenuAction.java           |   65 +
 .../menu/ReplaceNestedWorkflowMenuAction.java   |   76 +
 ...rvicedescriptions.ServiceDescriptionProvider |    1 -
 .../net.sf.taverna.t2.ui.menu.MenuComponent     |    9 -
 ...a.t2.workbench.activityicons.ActivityIconSPI |    1 -
 ...t2.workbench.file.DataflowPersistenceHandler |    1 -
 ...ntextualviews.activity.ContextualViewFactory |    1 -
 ...rvicedescriptions.ServiceDescriptionProvider |    1 +
 .../org.apache.taverna.ui.menu.MenuComponent    |    9 +
 ...erna.workbench.activityicons.ActivityIconSPI |    1 +
 ...na.workbench.file.DataflowPersistenceHandler |    1 +
 ...ntextualviews.activity.ContextualViewFactory |    1 +
 .../dataflow-activity-ui-context-osgi.xml       |   26 +-
 .../spring/dataflow-activity-ui-context.xml     |   18 +-
 .../file/importworkflow/AbstractTestHelper.java |  266 ---
 .../file/importworkflow/TestPortMerge.java      |   38 -
 .../file/importworkflow/TestRename.java         |   58 -
 .../file/importworkflow/TestSimpleMerge.java    |   98 -
 .../file/importworkflow/TestTestHelper.java     |   24 -
 .../gui/ImportWizardLauncher.java               |   24 -
 .../file/importworkflow/AbstractTestHelper.java |  266 +++
 .../file/importworkflow/TestPortMerge.java      |   39 +
 .../file/importworkflow/TestRename.java         |   59 +
 .../file/importworkflow/TestSimpleMerge.java    |   99 +
 .../file/importworkflow/TestTestHelper.java     |   24 +
 .../gui/ImportWizardLauncher.java               |   25 +
 .../design/actions/AddConditionAction.java      |   82 -
 .../design/actions/AddDataflowInputAction.java  |   96 -
 .../design/actions/AddDataflowOutputAction.java |   90 -
 .../design/actions/DataflowEditAction.java      |   57 -
 .../actions/EditDataflowInputPortAction.java    |  115 --
 .../actions/EditDataflowOutputPortAction.java   |   95 -
 .../design/actions/RemoveConditionAction.java   |   69 -
 .../actions/RemoveDataflowInputPortAction.java  |   85 -
 .../actions/RemoveDataflowOutputPortAction.java |   85 -
 .../design/actions/RemoveDatalinkAction.java    |   68 -
 .../design/actions/RemoveProcessorAction.java   |  136 --
 .../design/actions/RenameProcessorAction.java   |   97 -
 .../design/ui/DataflowInputPortPanel.java       |  203 --
 .../design/ui/DataflowOutputPortPanel.java      |  105 -
 .../t2/workbench/design/ui/ProcessorPanel.java  |  101 -
 .../design/actions/AddConditionAction.java      |   81 +
 .../design/actions/AddDataflowInputAction.java  |   95 +
 .../design/actions/AddDataflowOutputAction.java |   89 +
 .../design/actions/DataflowEditAction.java      |   56 +
 .../actions/EditDataflowInputPortAction.java    |  114 ++
 .../actions/EditDataflowOutputPortAction.java   |   94 +
 .../design/actions/RemoveConditionAction.java   |   68 +
 .../actions/RemoveDataflowInputPortAction.java  |   84 +
 .../actions/RemoveDataflowOutputPortAction.java |   84 +
 .../design/actions/RemoveDatalinkAction.java    |   67 +
 .../design/actions/RemoveProcessorAction.java   |  135 ++
 .../design/actions/RenameProcessorAction.java   |   96 +
 .../design/ui/DataflowInputPortPanel.java       |  202 ++
 .../design/ui/DataflowOutputPortPanel.java      |  104 +
 .../workbench/design/ui/ProcessorPanel.java     |  100 +
 .../DisabledActivityConfigurationAction.java    |  119 --
 .../menu/ConfigureDisabledMenuAction.java       |   52 -
 .../views/DisabledActivityViewFactory.java      |   80 -
 .../disabled/views/DisabledConfigView.java      |  142 --
 .../disabled/views/DisabledContextualView.java  |  128 --
 .../DisabledActivityConfigurationAction.java    |  119 ++
 .../menu/ConfigureDisabledMenuAction.java       |   52 +
 .../views/DisabledActivityViewFactory.java      |   80 +
 .../disabled/views/DisabledConfigView.java      |  142 ++
 .../disabled/views/DisabledContextualView.java  |  128 ++
 .../net.sf.taverna.t2.ui.menu.MenuComponent     |    1 -
 ...ntextualviews.activity.ContextualViewFactory |    1 -
 .../org.apache.taverna.ui.menu.MenuComponent    |    1 +
 ...ntextualviews.activity.ContextualViewFactory |    1 +
 .../disabled-activity-ui-context-osgi.xml       |   14 +-
 .../spring/disabled-activity-ui-context.xml     |    4 +-
 .../t2/workbench/edits/CompoundEdit.java        |  118 --
 .../net/sf/taverna/t2/workbench/edits/Edit.java |   66 -
 .../t2/workbench/edits/EditException.java       |   42 -
 .../taverna/t2/workbench/edits/EditManager.java |  222 ---
 .../t2/workbench/edits/package-info.java        |   48 -
 .../taverna/t2/workflow/edits/AbstractEdit.java |  119 --
 .../t2/workflow/edits/AddActivityEdit.java      |   55 -
 .../edits/AddActivityInputPortMappingEdit.java  |   59 -
 .../edits/AddActivityOutputPortMappingEdit.java |   59 -
 .../taverna/t2/workflow/edits/AddChildEdit.java |   52 -
 .../t2/workflow/edits/AddDataLinkEdit.java      |   90 -
 .../edits/AddIterationStrategyEdit.java         |   49 -
 .../AddIterationStrategyInputPortEdit.java      |   50 -
 .../t2/workflow/edits/AddProcessorEdit.java     |   45 -
 .../edits/AddProcessorInputPortEdit.java        |   45 -
 .../edits/AddProcessorOutputPortEdit.java       |   46 -
 .../edits/AddWorkflowInputPortEdit.java         |  110 --
 .../edits/AddWorkflowOutputPortEdit.java        |  111 --
 .../t2/workflow/edits/ChangeDepthEdit.java      |  104 -
 .../workflow/edits/ChangeGranularDepthEdit.java |   49 -
 .../t2/workflow/edits/ChangeJsonEdit.java       |   50 -
 .../edits/ClearIterationStrategyStackEdit.java  |   50 -
 .../t2/workflow/edits/ConfigureEdit.java        |   55 -
 .../t2/workflow/edits/RemoveActivityEdit.java   |   55 -
 .../RemoveActivityInputPortMappingEdit.java     |   51 -
 .../RemoveActivityOutputPortMappingEdit.java    |   51 -
 .../t2/workflow/edits/RemoveChildEdit.java      |   48 -
 .../t2/workflow/edits/RemoveDataLinkEdit.java   |  111 --
 .../edits/RemoveProcessorInputPortEdit.java     |   31 -
 .../edits/RemoveProcessorOutputPortEdit.java    |   31 -
 .../edits/RemoveWorkflowInputPortEdit.java      |  107 --
 .../edits/RemoveWorkflowOutputPortEdit.java     |  105 -
 .../taverna/t2/workflow/edits/RenameEdit.java   |  136 --
 .../edits/ReorderMergePositionsEdit.java        |   57 -
 .../edits/SetIterationStrategyStackEdit.java    |   51 -
 .../UpdateDataflowInternalIdentifierEdit.java   |   48 -
 .../taverna/workbench/edits/CompoundEdit.java   |  117 ++
 .../apache/taverna/workbench/edits/Edit.java    |   65 +
 .../taverna/workbench/edits/EditException.java  |   41 +
 .../taverna/workbench/edits/EditManager.java    |  221 +++
 .../taverna/workbench/edits/package-info.java   |   48 +
 .../taverna/workflow/edits/AbstractEdit.java    |  118 ++
 .../taverna/workflow/edits/AddActivityEdit.java |   54 +
 .../edits/AddActivityInputPortMappingEdit.java  |   58 +
 .../edits/AddActivityOutputPortMappingEdit.java |   58 +
 .../taverna/workflow/edits/AddChildEdit.java    |   51 +
 .../taverna/workflow/edits/AddDataLinkEdit.java |   89 +
 .../edits/AddIterationStrategyEdit.java         |   48 +
 .../AddIterationStrategyInputPortEdit.java      |   49 +
 .../workflow/edits/AddProcessorEdit.java        |   44 +
 .../edits/AddProcessorInputPortEdit.java        |   44 +
 .../edits/AddProcessorOutputPortEdit.java       |   45 +
 .../edits/AddWorkflowInputPortEdit.java         |  109 ++
 .../edits/AddWorkflowOutputPortEdit.java        |  110 ++
 .../taverna/workflow/edits/ChangeDepthEdit.java |  103 +
 .../workflow/edits/ChangeGranularDepthEdit.java |   48 +
 .../taverna/workflow/edits/ChangeJsonEdit.java  |   49 +
 .../edits/ClearIterationStrategyStackEdit.java  |   49 +
 .../taverna/workflow/edits/ConfigureEdit.java   |   54 +
 .../workflow/edits/RemoveActivityEdit.java      |   54 +
 .../RemoveActivityInputPortMappingEdit.java     |   50 +
 .../RemoveActivityOutputPortMappingEdit.java    |   50 +
 .../taverna/workflow/edits/RemoveChildEdit.java |   47 +
 .../workflow/edits/RemoveDataLinkEdit.java      |  110 ++
 .../edits/RemoveProcessorInputPortEdit.java     |   30 +
 .../edits/RemoveProcessorOutputPortEdit.java    |   30 +
 .../edits/RemoveWorkflowInputPortEdit.java      |  106 +
 .../edits/RemoveWorkflowOutputPortEdit.java     |  104 +
 .../taverna/workflow/edits/RenameEdit.java      |  135 ++
 .../edits/ReorderMergePositionsEdit.java        |   56 +
 .../edits/SetIterationStrategyStackEdit.java    |   50 +
 .../UpdateDataflowInternalIdentifierEdit.java   |   47 +
 .../workbench/edits/impl/EditManagerImpl.java   |  285 ---
 .../edits/impl/menu/AbstractUndoAction.java     |  166 --
 .../edits/impl/menu/RedoMenuAction.java         |   86 -
 .../edits/impl/menu/UndoMenuAction.java         |   86 -
 .../edits/impl/menu/UndoMenuSection.java        |   42 -
 .../edits/impl/toolbar/EditToolbarSection.java  |   36 -
 .../edits/impl/toolbar/RedoToolbarAction.java   |   46 -
 .../edits/impl/toolbar/UndoToolbarAction.java   |   46 -
 .../workbench/edits/impl/EditManagerImpl.java   |  284 +++
 .../edits/impl/menu/AbstractUndoAction.java     |  165 ++
 .../edits/impl/menu/RedoMenuAction.java         |   85 +
 .../edits/impl/menu/UndoMenuAction.java         |   85 +
 .../edits/impl/menu/UndoMenuSection.java        |   41 +
 .../edits/impl/toolbar/EditToolbarSection.java  |   35 +
 .../edits/impl/toolbar/RedoToolbarAction.java   |   45 +
 .../edits/impl/toolbar/UndoToolbarAction.java   |   45 +
 .../net.sf.taverna.t2.ui.menu.MenuComponent     |    6 -
 ...et.sf.taverna.t2.workbench.edits.EditManager |    1 -
 .../org.apache.taverna.ui.menu.MenuComponent    |    6 +
 ...g.apache.taverna.workbench.edits.EditManager |    1 +
 .../META-INF/spring/edits-impl-context-osgi.xml |    4 +-
 .../META-INF/spring/edits-impl-context.xml      |   14 +-
 .../edits/impl/TestEditManagerImpl.java         |  258 ---
 .../edits/impl/TestEditManagerImpl.java         |  257 +++
 .../AbstractDataflowPersistenceHandler.java     |   69 -
 .../taverna/t2/workbench/file/DataflowInfo.java |  108 --
 .../file/DataflowPersistenceHandler.java        |  152 --
 .../taverna/t2/workbench/file/FileManager.java  |  573 ------
 .../sf/taverna/t2/workbench/file/FileType.java  |   67 -
 .../file/events/AbstractDataflowEvent.java      |   45 -
 .../file/events/ClosedDataflowEvent.java        |   34 -
 .../file/events/ClosingDataflowEvent.java       |   45 -
 .../workbench/file/events/FileManagerEvent.java |   39 -
 .../file/events/OpenedDataflowEvent.java        |   34 -
 .../file/events/SavedDataflowEvent.java         |   34 -
 .../file/events/SetCurrentDataflowEvent.java    |   35 -
 .../file/exceptions/FileException.java          |   44 -
 .../file/exceptions/OpenException.java          |   40 -
 .../file/exceptions/OverwriteException.java     |   36 -
 .../file/exceptions/SaveException.java          |   40 -
 .../file/exceptions/UnsavedException.java       |   38 -
 .../AbstractDataflowPersistenceHandler.java     |   69 +
 .../taverna/workbench/file/DataflowInfo.java    |  108 ++
 .../file/DataflowPersistenceHandler.java        |  152 ++
 .../taverna/workbench/file/FileManager.java     |  573 ++++++
 .../apache/taverna/workbench/file/FileType.java |   67 +
 .../file/events/AbstractDataflowEvent.java      |   45 +
 .../file/events/ClosedDataflowEvent.java        |   34 +
 .../file/events/ClosingDataflowEvent.java       |   45 +
 .../workbench/file/events/FileManagerEvent.java |   39 +
 .../file/events/OpenedDataflowEvent.java        |   34 +
 .../file/events/SavedDataflowEvent.java         |   34 +
 .../file/events/SetCurrentDataflowEvent.java    |   35 +
 .../file/exceptions/FileException.java          |   44 +
 .../file/exceptions/OpenException.java          |   40 +
 .../file/exceptions/OverwriteException.java     |   36 +
 .../file/exceptions/SaveException.java          |   40 +
 .../file/exceptions/UnsavedException.java       |   38 +
 .../DataflowFromDataflowPersistenceHandler.java |   10 +-
 .../DataflowPersistenceHandlerRegistry.java     |    4 +-
 .../workbench/file/impl/FileDataflowInfo.java   |    6 +-
 .../t2/workbench/file/impl/FileManagerImpl.java |   34 +-
 .../workbench/file/impl/FileTypeFileFilter.java |    2 +-
 .../workbench/file/impl/MultipleFileTypes.java  |    2 +-
 .../file/impl/OpenDataflowInProgressDialog.java |    6 +-
 .../workbench/file/impl/OpenDataflowInfo.java   |    4 +-
 .../file/impl/OpenDataflowRunnable.java         |    6 +-
 .../file/impl/OpenDataflowSwingWorker.java      |    4 +-
 .../workbench/file/impl/T2DataflowOpener.java   |   10 +-
 .../t2/workbench/file/impl/T2FlowFileType.java  |    2 +-
 .../file/impl/WorkflowBundleFileType.java       |    2 +-
 .../file/impl/WorkflowBundleOpener.java         |   10 +-
 .../file/impl/WorkflowBundleSaver.java          |   10 +-
 .../impl/actions/CloseAllWorkflowsAction.java   |    6 +-
 .../file/impl/actions/CloseWorkflowAction.java  |    8 +-
 .../file/impl/actions/NewWorkflowAction.java    |    4 +-
 .../impl/actions/OpenNestedWorkflowAction.java  |    6 +-
 .../file/impl/actions/OpenWorkflowAction.java   |    8 +-
 .../impl/actions/OpenWorkflowFromURLAction.java |    4 +-
 .../file/impl/actions/PasswordInput.java        |    2 +-
 .../impl/actions/SaveAllWorkflowsAction.java    |    8 +-
 .../file/impl/actions/SaveWorkflowAction.java   |   20 +-
 .../file/impl/actions/SaveWorkflowAsAction.java |   14 +-
 .../impl/hooks/CloseWorkflowsOnShutdown.java    |    6 +-
 .../file/impl/menu/FileCloseAllMenuAction.java  |    6 +-
 .../file/impl/menu/FileCloseMenuAction.java     |    6 +-
 .../file/impl/menu/FileNewMenuAction.java       |    4 +-
 .../impl/menu/FileOpenFromURLMenuAction.java    |    4 +-
 .../file/impl/menu/FileOpenMenuAction.java      |    4 +-
 .../file/impl/menu/FileOpenMenuSection.java     |    2 +-
 .../impl/menu/FileOpenRecentMenuAction.java     |   18 +-
 .../file/impl/menu/FileSaveAllMenuAction.java   |    6 +-
 .../file/impl/menu/FileSaveAsMenuAction.java    |    4 +-
 .../file/impl/menu/FileSaveMenuAction.java      |    6 +-
 .../file/impl/menu/FileSaveMenuSection.java     |    2 +-
 .../workbench/file/impl/menu/WorkflowsMenu.java |   16 +-
 .../file/impl/toolbar/CloseToolbarAction.java   |    6 +-
 .../impl/toolbar/FileToolbarMenuSection.java    |    4 +-
 .../file/impl/toolbar/NewToolbarAction.java     |    4 +-
 .../file/impl/toolbar/OpenToolbarAction.java    |    4 +-
 .../OpenWorkflowFromURLToolbarAction.java       |    4 +-
 .../file/impl/toolbar/SaveToolbarAction.java    |    6 +-
 .../net.sf.taverna.t2.ui.menu.MenuComponent     |   20 -
 .../net.sf.taverna.t2.workbench.ShutdownSPI     |    1 -
 ...t2.workbench.file.DataflowPersistenceHandler |    2 -
 ...net.sf.taverna.t2.workbench.file.FileManager |    1 -
 .../org.apache.taverna.ui.menu.MenuComponent    |   20 +
 .../org.apache.taverna.workbench.ShutdownSPI    |    1 +
 ...na.workbench.file.DataflowPersistenceHandler |    2 +
 ...rg.apache.taverna.workbench.file.FileManager |    1 +
 .../META-INF/spring/file-impl-context-osgi.xml  |   14 +-
 .../META-INF/spring/file-impl-context.xml       |   48 +-
 .../t2/workbench/file/impl/FileManagerTest.java |   24 +-
 .../models/graph/DefaultGraphEventManager.java  |  271 ---
 .../t2/workbench/models/graph/DotWriter.java    |  253 ---
 .../t2/workbench/models/graph/Graph.java        |  165 --
 .../models/graph/GraphColorManager.java         |   75 -
 .../workbench/models/graph/GraphController.java | 1276 ------------
 .../t2/workbench/models/graph/GraphEdge.java    |  137 --
 .../t2/workbench/models/graph/GraphElement.java |  430 -----
 .../models/graph/GraphEventManager.java         |   47 -
 .../t2/workbench/models/graph/GraphNode.java    |  153 --
 .../models/graph/GraphShapeElement.java         |  119 --
 .../workbench/models/graph/dot/GraphLayout.java |  326 ----
 .../t2/workbench/models/graph/svg/SVGGraph.java |  439 -----
 .../models/graph/svg/SVGGraphController.java    |  552 ------
 .../models/graph/svg/SVGGraphEdge.java          |  311 ---
 .../graph/svg/SVGGraphElementDelegate.java      |  178 --
 .../models/graph/svg/SVGGraphNode.java          |  611 ------
 .../models/graph/svg/SVGGraphSettings.java      |   28 -
 .../models/graph/svg/SVGMonitorShape.java       |   40 -
 .../t2/workbench/models/graph/svg/SVGShape.java |   29 -
 .../t2/workbench/models/graph/svg/SVGUtil.java  |  477 -----
 .../graph/svg/event/SVGEventListener.java       |   56 -
 .../svg/event/SVGMouseClickEventListener.java   |   45 -
 .../svg/event/SVGMouseDownEventListener.java    |   45 -
 .../svg/event/SVGMouseMovedEventListener.java   |   46 -
 .../svg/event/SVGMouseOutEventListener.java     |   46 -
 .../svg/event/SVGMouseOverEventListener.java    |   46 -
 .../svg/event/SVGMouseUpEventListener.java      |   46 -
 .../models/graph/DefaultGraphEventManager.java  |  271 +++
 .../workbench/models/graph/DotWriter.java       |  253 +++
 .../taverna/workbench/models/graph/Graph.java   |  165 ++
 .../models/graph/GraphColorManager.java         |   75 +
 .../workbench/models/graph/GraphController.java | 1276 ++++++++++++
 .../workbench/models/graph/GraphEdge.java       |  137 ++
 .../workbench/models/graph/GraphElement.java    |  430 +++++
 .../models/graph/GraphEventManager.java         |   47 +
 .../workbench/models/graph/GraphNode.java       |  153 ++
 .../models/graph/GraphShapeElement.java         |  119 ++
 .../workbench/models/graph/dot/GraphLayout.java |  326 ++++
 .../workbench/models/graph/svg/SVGGraph.java    |  439 +++++
 .../models/graph/svg/SVGGraphController.java    |  552 ++++++
 .../models/graph/svg/SVGGraphEdge.java          |  311 +++
 .../graph/svg/SVGGraphElementDelegate.java      |  178 ++
 .../models/graph/svg/SVGGraphNode.java          |  611 ++++++
 .../models/graph/svg/SVGGraphSettings.java      |   28 +
 .../models/graph/svg/SVGMonitorShape.java       |   40 +
 .../workbench/models/graph/svg/SVGShape.java    |   29 +
 .../workbench/models/graph/svg/SVGUtil.java     |  477 +++++
 .../graph/svg/event/SVGEventListener.java       |   56 +
 .../svg/event/SVGMouseClickEventListener.java   |   45 +
 .../svg/event/SVGMouseDownEventListener.java    |   45 +
 .../svg/event/SVGMouseMovedEventListener.java   |   46 +
 .../svg/event/SVGMouseOutEventListener.java     |   46 +
 .../svg/event/SVGMouseOverEventListener.java    |   46 +
 .../svg/event/SVGMouseUpEventListener.java      |   46 +
 .../models/graph/GraphControllerTest.java       |   81 -
 .../workbench/models/graph/GraphEdgeTest.java   |  129 --
 .../models/graph/GraphElementTest.java          |  148 --
 .../workbench/models/graph/GraphNodeTest.java   |  179 --
 .../t2/workbench/models/graph/GraphTest.java    |  138 --
 .../models/graph/GraphControllerTest.java       |   85 +
 .../workbench/models/graph/GraphEdgeTest.java   |  132 ++
 .../models/graph/GraphElementTest.java          |  151 ++
 .../workbench/models/graph/GraphNodeTest.java   |  182 ++
 .../workbench/models/graph/GraphTest.java       |  139 ++
 .../views/graph/GraphViewComponent.java         |   56 +-
 .../views/graph/GraphViewComponentFactory.java  |   16 +-
 .../views/graph/actions/AddWFInputAction.java   |   10 +-
 .../views/graph/actions/AddWFOutputAction.java  |   10 +-
 .../actions/DeleteGraphComponentAction.java     |   26 +-
 .../RenameWFInputOutputProcessorAction.java     |   22 +-
 .../graph/config/GraphViewConfiguration.java    |    4 +-
 .../config/GraphViewConfigurationPanel.java     |   16 +-
 .../views/graph/menu/AddWFInputMenuAction.java  |    6 +-
 .../views/graph/menu/AddWFOutputMenuAction.java |    6 +-
 .../menu/DeleteGraphComponentMenuAction.java    |    6 +-
 .../workbench/views/graph/menu/DiagramMenu.java |    4 +-
 .../graph/menu/DiagramSaveMenuSection.java      |    2 +-
 .../graph/menu/DiagramZoomMenuSection.java      |    2 +-
 .../views/graph/menu/GraphCopyMenuSection.java  |    2 +-
 .../graph/menu/GraphDeleteMenuSection.java      |    2 +-
 .../graph/menu/GraphDetailsMenuSection.java     |    2 +-
 .../views/graph/menu/GraphEditMenuSection.java  |    2 +-
 .../views/graph/menu/GraphMenuSection.java      |    2 +-
 .../workbench/views/graph/menu/InsertMenu.java  |    4 +-
 .../RenameWFInputOutputProcessorMenuAction.java |    6 +-
 .../views/graph/menu/ResetDiagramAction.java    |    4 +-
 .../graph/menu/ResetDiagramMenuAction.java      |    2 +-
 .../views/graph/menu/SaveGraphImageSubMenu.java |   28 +-
 .../views/graph/menu/ZoomInAction.java          |    4 +-
 .../views/graph/menu/ZoomInMenuAction.java      |    2 +-
 .../views/graph/menu/ZoomOutAction.java         |    4 +-
 .../views/graph/menu/ZoomOutMenuAction.java     |    2 +-
 .../graph/toolbar/AddWFInputToolbarAction.java  |    6 +-
 .../graph/toolbar/AddWFOutputToolbarAction.java |    6 +-
 .../DeleteGraphComponentToolbarAction.java      |    6 +-
 .../toolbar/GraphDeleteToolbarSection.java      |    4 +-
 .../graph/toolbar/GraphEditToolbarSection.java  |    4 +-
 ...nameWFInputOutputProcessorToolbarAction.java |    6 +-
 .../net.sf.taverna.t2.ui.menu.MenuComponent     |   29 -
 ...rkbench.configuration.ConfigurationUIFactory |    1 -
 ....t2.workbench.ui.zaria.UIComponentFactorySPI |    1 -
 ...taverna.t2.workbench.ui.zaria.UIComponentSPI |    1 -
 .../org.apache.taverna.ui.menu.MenuComponent    |   29 +
 ...rkbench.configuration.ConfigurationUIFactory |    1 +
 ...rna.workbench.ui.zaria.UIComponentFactorySPI |    1 +
 ...he.taverna.workbench.ui.zaria.UIComponentSPI |    1 +
 .../META-INF/spring/graph-view-context-osgi.xml |   14 +-
 .../META-INF/spring/graph-view-context.xml      |   52 +-
 .../t2/workbench/helper/HelpCollator.java       |  307 ---
 .../t2/workbench/helper/HelpEnabledDialog.java  |  101 -
 .../sf/taverna/t2/workbench/helper/Helper.java  |  187 --
 .../helper/NonBlockedHelpEnabledDialog.java     |   40 -
 .../taverna/workbench/helper/HelpCollator.java  |  326 ++++
 .../workbench/helper/HelpEnabledDialog.java     |  117 ++
 .../apache/taverna/workbench/helper/Helper.java |  203 ++
 .../helper/NonBlockedHelpEnabledDialog.java     |   56 +
 .../config/HttpProxyConfigurationPanel.java     |  582 ------
 .../config/HttpProxyConfigurationUIFactory.java |   56 -
 .../config/HttpProxyConfigurationPanel.java     |  582 ++++++
 .../config/HttpProxyConfigurationUIFactory.java |   56 +
 ...rkbench.configuration.ConfigurationUIFactory |    1 -
 ...rkbench.configuration.ConfigurationUIFactory |    1 +
 .../spring/httpproxy-config-context.xml         |    2 +-
 .../net/sf/taverna/t2/lang/io/StreamCopier.java |   69 -
 .../sf/taverna/t2/lang/io/StreamDevourer.java   |  106 -
 .../apache/taverna/lang/io/StreamCopier.java    |   68 +
 .../apache/taverna/lang/io/StreamDevourer.java  |  105 +
 .../IterationStrategyIcons.java                 |   48 -
 .../IterationStrategyConfigurationDialog.java   |  148 --
 .../IterationStrategyContextualView.java        |  231 ---
 .../IterationStrategyContextualViewFactory.java |   54 -
 .../editor/IterationStrategyCellRenderer.java   |   74 -
 .../editor/IterationStrategyEditor.java         |  247 ---
 .../editor/IterationStrategyEditorControl.java  |  439 -----
 .../editor/IterationStrategyTree.java           |  106 -
 .../IterationStrategyConfigureMenuAction.java   |   65 -
 .../IterationStrategyIcons.java                 |   48 +
 .../IterationStrategyConfigurationDialog.java   |  148 ++
 .../IterationStrategyContextualView.java        |  231 +++
 .../IterationStrategyContextualViewFactory.java |   54 +
 .../editor/IterationStrategyCellRenderer.java   |   74 +
 .../editor/IterationStrategyEditor.java         |  247 +++
 .../editor/IterationStrategyEditorControl.java  |  439 +++++
 .../editor/IterationStrategyTree.java           |  106 +
 .../IterationStrategyConfigureMenuAction.java   |   65 +
 .../net.sf.taverna.t2.ui.menu.MenuComponent     |    1 -
 ...ntextualviews.activity.ContextualViewFactory |    1 -
 .../org.apache.taverna.ui.menu.MenuComponent    |    1 +
 ...ntextualviews.activity.ContextualViewFactory |    1 +
 .../iteration-strategy-ui-context-osgi.xml      |    6 +-
 .../spring/iteration-strategy-ui-context.xml    |    2 +-
 .../icons/crossproducticon.png                  |  Bin 831 -> 0 bytes
 .../iterationstrategy/icons/dotproducticon.png  |  Bin 663 -> 0 bytes
 .../iterationstrategy/icons/leafnodeicon.png    |  Bin 507 -> 0 bytes
 .../icons/crossproducticon.png                  |  Bin 0 -> 831 bytes
 .../iterationstrategy/icons/dotproducticon.png  |  Bin 0 -> 663 bytes
 .../iterationstrategy/icons/leafnodeicon.png    |  Bin 0 -> 507 bytes
 .../editor/RunIterationStrategyEditor.java      |   56 -
 .../editor/RunIterationStrategyEditor.java      |   57 +
 .../t2/workbench/loop/ActivityGenerator.java    |  194 --
 .../t2/workbench/loop/AddLoopFactory.java       |  125 --
 .../t2/workbench/loop/LoopAddMenuAction.java    |   73 -
 .../workbench/loop/LoopConfigurationPanel.java  |  588 ------
 .../t2/workbench/loop/LoopConfigureAction.java  |  262 ---
 .../workbench/loop/LoopConfigureMenuAction.java |   97 -
 .../t2/workbench/loop/LoopContextualView.java   |  172 --
 .../loop/LoopContextualViewFactory.java         |   53 -
 .../t2/workbench/loop/LoopRemoveMenuAction.java |   92 -
 .../workbench/loop/comparisons/Comparison.java  |   47 -
 .../t2/workbench/loop/comparisons/EqualTo.java  |   40 -
 .../loop/comparisons/IsGreaterThan.java         |   40 -
 .../workbench/loop/comparisons/IsLessThan.java  |   40 -
 .../t2/workbench/loop/comparisons/Matches.java  |   40 -
 .../workbench/loop/comparisons/NotEqualTo.java  |   40 -
 .../workbench/loop/comparisons/NotMatches.java  |   40 -
 .../workbench/loop/ActivityGenerator.java       |  194 ++
 .../taverna/workbench/loop/AddLoopFactory.java  |  125 ++
 .../workbench/loop/LoopAddMenuAction.java       |   73 +
 .../workbench/loop/LoopConfigurationPanel.java  |  588 ++++++
 .../workbench/loop/LoopConfigureAction.java     |  262 +++
 .../workbench/loop/LoopConfigureMenuAction.java |   97 +
 .../workbench/loop/LoopContextualView.java      |  172 ++
 .../loop/LoopContextualViewFactory.java         |   53 +
 .../workbench/loop/LoopRemoveMenuAction.java    |   92 +
 .../workbench/loop/comparisons/Comparison.java  |   47 +
 .../workbench/loop/comparisons/EqualTo.java     |   40 +
 .../loop/comparisons/IsGreaterThan.java         |   40 +
 .../workbench/loop/comparisons/IsLessThan.java  |   40 +
 .../workbench/loop/comparisons/Matches.java     |   40 +
 .../workbench/loop/comparisons/NotEqualTo.java  |   40 +
 .../workbench/loop/comparisons/NotMatches.java  |   40 +
 .../net.sf.taverna.t2.ui.menu.MenuComponent     |    3 -
 ....ui.views.contextualviews.AddLayerFactorySPI |    1 -
 ...ntextualviews.activity.ContextualViewFactory |    1 -
 .../org.apache.taverna.ui.menu.MenuComponent    |    3 +
 ....ui.views.contextualviews.AddLayerFactorySPI |    1 +
 ...ntextualviews.activity.ContextualViewFactory |    1 +
 .../META-INF/spring/loop-ui-context-osgi.xml    |   10 +-
 .../META-INF/spring/loop-ui-context.xml         |   10 +-
 .../t2/workbench/loop/ShowContextualView.java   |  121 --
 .../workbench/loop/ShowContextualView.java      |  121 ++
 .../ui/menu/AbstractContextualMenuAction.java   |   64 -
 .../net/sf/taverna/t2/ui/menu/AbstractMenu.java |  123 --
 .../taverna/t2/ui/menu/AbstractMenuAction.java  |  135 --
 .../taverna/t2/ui/menu/AbstractMenuCustom.java  |  144 --
 .../sf/taverna/t2/ui/menu/AbstractMenuItem.java |  144 --
 .../t2/ui/menu/AbstractMenuOptionGroup.java     |   79 -
 .../taverna/t2/ui/menu/AbstractMenuSection.java |  113 --
 .../taverna/t2/ui/menu/AbstractMenuToggle.java  |  132 --
 .../sf/taverna/t2/ui/menu/AbstractToolBar.java  |   74 -
 .../t2/ui/menu/ContextualMenuComponent.java     |   35 -
 .../taverna/t2/ui/menu/ContextualSelection.java |   48 -
 .../t2/ui/menu/DefaultContextualMenu.java       |   53 -
 .../sf/taverna/t2/ui/menu/DefaultMenuBar.java   |   50 -
 .../sf/taverna/t2/ui/menu/DefaultToolBar.java   |   51 -
 .../sf/taverna/t2/ui/menu/DesignOnlyAction.java |   32 -
 .../t2/ui/menu/DesignOrResultsAction.java       |   32 -
 .../sf/taverna/t2/ui/menu/MenuComponent.java    |  277 ---
 .../net/sf/taverna/t2/ui/menu/MenuManager.java  |  339 ----
 .../net/sf/taverna/t2/ui/menu/package-info.java |  141 --
 .../ui/menu/AbstractContextualMenuAction.java   |   63 +
 .../apache/taverna/ui/menu/AbstractMenu.java    |  122 ++
 .../taverna/ui/menu/AbstractMenuAction.java     |  134 ++
 .../taverna/ui/menu/AbstractMenuCustom.java     |  143 ++
 .../taverna/ui/menu/AbstractMenuItem.java       |  143 ++
 .../ui/menu/AbstractMenuOptionGroup.java        |   78 +
 .../taverna/ui/menu/AbstractMenuSection.java    |  112 ++
 .../taverna/ui/menu/AbstractMenuToggle.java     |  131 ++
 .../apache/taverna/ui/menu/AbstractToolBar.java |   73 +
 .../ui/menu/ContextualMenuComponent.java        |   54 +
 .../taverna/ui/menu/ContextualSelection.java    |   67 +
 .../taverna/ui/menu/DefaultContextualMenu.java  |   52 +
 .../apache/taverna/ui/menu/DefaultMenuBar.java  |   49 +
 .../apache/taverna/ui/menu/DefaultToolBar.java  |   50 +
 .../taverna/ui/menu/DesignOnlyAction.java       |   31 +
 .../taverna/ui/menu/DesignOrResultsAction.java  |   31 +
 .../apache/taverna/ui/menu/MenuComponent.java   |  276 +++
 .../org/apache/taverna/ui/menu/MenuManager.java |  338 ++++
 .../apache/taverna/ui/menu/package-info.java    |  141 ++
 .../net.sf.taverna.t2.ui.menu.MenuComponent     |    4 -
 .../org.apache.taverna.ui.menu.MenuComponent    |    4 +
 .../META-INF/spring/menu-api-context.xml        |    6 +-
 .../t2/ui/menu/impl/MenuManagerImpl.java        |  880 ---------
 .../t2/workbench/ui/impl/menu/AdvancedMenu.java |   44 -
 .../t2/workbench/ui/impl/menu/EditMenu.java     |   43 -
 .../ui/impl/menu/FeedbackMenuAction.java        |   75 -
 .../t2/workbench/ui/impl/menu/FileMenu.java     |   48 -
 .../t2/workbench/ui/impl/menu/HelpMenu.java     |   44 -
 .../ui/impl/menu/OnlineHelpMenuAction.java      |   68 -
 .../ui/impl/menu/ShowLogsAndDataMenuAction.java |   89 -
 .../ui/impl/menu/ViewShowMenuSection.java       |   40 -
 .../taverna/ui/menu/impl/MenuManagerImpl.java   |  879 +++++++++
 .../workbench/ui/impl/menu/AdvancedMenu.java    |   43 +
 .../workbench/ui/impl/menu/EditMenu.java        |   42 +
 .../ui/impl/menu/FeedbackMenuAction.java        |   74 +
 .../workbench/ui/impl/menu/FileMenu.java        |   47 +
 .../workbench/ui/impl/menu/HelpMenu.java        |   43 +
 .../ui/impl/menu/OnlineHelpMenuAction.java      |   67 +
 .../ui/impl/menu/ShowLogsAndDataMenuAction.java |  108 ++
 .../ui/impl/menu/ViewShowMenuSection.java       |   39 +
 .../net.sf.taverna.t2.ui.menu.MenuManager       |    1 -
 .../org.apache.taverna.ui.menu.MenuManager      |    1 +
 .../META-INF/spring/menu-impl-context-osgi.xml  |    6 +-
 .../META-INF/spring/menu-impl-context.xml       |   16 +-
 .../AbstractConnectPortMenuActions.java         |  267 ---
 .../activityport/ActivityInputPortSection.java  |   67 -
 .../activityport/ActivityOutputPortSection.java |   67 -
 .../AddInputPortDefaultValueAction.java         |  150 --
 .../ConnectInputPortMenuActions.java            |   41 -
 .../ConnectOutputPortMenuActions.java           |   41 -
 .../items/activityport/ConnectPortsAction.java  |   68 -
 .../CreateAndConnectDataflowPortAction.java     |  226 ---
 .../SetConstantInputPortValueMenuAction.java    |   73 -
 .../SetDefaultInputPortValueAction.java         |  171 --
 .../annotated/AnnotatedConfigureMenuAction.java |   77 -
 .../ConfigureRunningContextualMenuSection.java  |   50 -
 .../items/contextualviews/ConfigureSection.java |   61 -
 .../menu/items/contextualviews/EditSection.java |   73 -
 .../items/contextualviews/InsertSection.java    |   63 -
 .../items/contextualviews/PasteMenuAction.java  |   74 -
 .../ShowConfigureMenuAction.java                |  165 --
 .../ShowDetailsContextualMenuAction.java        |   65 -
 .../contextualviews/ShowDetailsMenuAction.java  |   81 -
 .../ShowReportsContextualMenuAction.java        |  103 -
 .../items/controllink/ConditionSection.java     |   70 -
 .../controllink/RemoveConditionMenuAction.java  |   67 -
 .../t2/ui/menu/items/datalink/LinkSection.java  |   73 -
 .../items/datalink/RemoveLinkMenuAction.java    |   66 -
 .../ConnectDataflowInputPortMenuActions.java    |   42 -
 .../ConnectDataflowOutputPortMenuActions.java   |   42 -
 .../ports/EditDataflowInputPortMenuAction.java  |   68 -
 .../ports/EditDataflowOutputPortMenuAction.java |   68 -
 .../RemoveDataflowInputPortMenuAction.java      |   68 -
 .../RemoveDataflowOutputPortMenuAction.java     |   68 -
 .../items/ports/WorkflowInputPortSection.java   |   73 -
 .../items/ports/WorkflowOutputPortSection.java  |   73 -
 .../items/processor/ConditionMenuActions.java   |  118 --
 .../menu/items/processor/ProcessorSection.java  |   58 -
 .../processor/RemoveProcessorMenuAction.java    |   67 -
 .../processor/RenameProcessorMenuAction.java    |   68 -
 .../items/workflow/CreateInputMenuAction.java   |   62 -
 .../items/workflow/CreateOutputMenuAction.java  |   62 -
 .../WorkflowServiceTemplatesSection.java        |   76 -
 .../AbstractConnectPortMenuActions.java         |  267 +++
 .../activityport/ActivityInputPortSection.java  |   67 +
 .../activityport/ActivityOutputPortSection.java |   67 +
 .../AddInputPortDefaultValueAction.java         |  150 ++
 .../ConnectInputPortMenuActions.java            |   41 +
 .../ConnectOutputPortMenuActions.java           |   41 +
 .../items/activityport/ConnectPortsAction.java  |   68 +
 .../CreateAndConnectDataflowPortAction.java     |  226 +++
 .../SetConstantInputPortValueMenuAction.java    |   73 +
 .../SetDefaultInputPortValueAction.java         |  171 ++
 .../annotated/AnnotatedConfigureMenuAction.java |   77 +
 .../ConfigureRunningContextualMenuSection.java  |   50 +
 .../items/contextualviews/ConfigureSection.java |   61 +
 .../menu/items/contextualviews/EditSection.java |   73 +
 .../items/contextualviews/InsertSection.java    |   63 +
 .../items/contextualviews/PasteMenuAction.java  |   74 +
 .../ShowConfigureMenuAction.java                |  165 ++
 .../ShowDetailsContextualMenuAction.java        |   65 +
 .../contextualviews/ShowDetailsMenuAction.java  |   81 +
 .../ShowReportsContextualMenuAction.java        |  103 +
 .../items/controllink/ConditionSection.java     |   70 +
 .../controllink/RemoveConditionMenuAction.java  |   67 +
 .../ui/menu/items/datalink/LinkSection.java     |   73 +
 .../items/datalink/RemoveLinkMenuAction.java    |   66 +
 .../ConnectDataflowInputPortMenuActions.java    |   42 +
 .../ConnectDataflowOutputPortMenuActions.java   |   42 +
 .../ports/EditDataflowInputPortMenuAction.java  |   68 +
 .../ports/EditDataflowOutputPortMenuAction.java |   68 +
 .../RemoveDataflowInputPortMenuAction.java      |   68 +
 .../RemoveDataflowOutputPortMenuAction.java     |   68 +
 .../items/ports/WorkflowInputPortSection.java   |   73 +
 .../items/ports/WorkflowOutputPortSection.java  |   73 +
 .../items/processor/ConditionMenuActions.java   |  118 ++
 .../menu/items/processor/ProcessorSection.java  |   58 +
 .../processor/RemoveProcessorMenuAction.java    |   67 +
 .../processor/RenameProcessorMenuAction.java    |   68 +
 .../items/workflow/CreateInputMenuAction.java   |   62 +
 .../items/workflow/CreateOutputMenuAction.java  |   62 +
 .../WorkflowServiceTemplatesSection.java        |   76 +
 .../net.sf.taverna.t2.ui.menu.MenuComponent     |   46 -
 .../org.apache.taverna.ui.menu.MenuComponent    |   46 +
 .../META-INF/spring/menu-items-context-osgi.xml |   20 +-
 .../META-INF/spring/menu-items-context.xml      |   68 +-
 .../views/monitor/MonitorViewComponent.java     |  168 --
 .../views/monitor/graph/GraphMonitor.java       |  140 --
 .../views/monitor/graph/GraphMonitorNode.java   |  115 --
 .../monitor/graph/MonitorGraphComponent.java    |  378 ----
 .../progressreport/TableMonitorComponent.java   |  100 -
 .../WorkflowRunProgressTreeCellRenderer.java    |   96 -
 .../WorkflowRunProgressTreeTable.java           |  112 --
 .../WorkflowRunProgressTreeTableModel.java      |  279 ---
 .../views/monitor/MonitorViewComponent.java     |  168 ++
 .../views/monitor/graph/GraphMonitor.java       |  140 ++
 .../views/monitor/graph/GraphMonitorNode.java   |  115 ++
 .../monitor/graph/MonitorGraphComponent.java    |  378 ++++
 .../progressreport/TableMonitorComponent.java   |  100 +
 .../WorkflowRunProgressTreeCellRenderer.java    |   96 +
 .../WorkflowRunProgressTreeTable.java           |  112 ++
 .../WorkflowRunProgressTreeTableModel.java      |  279 +++
 ....t2.workbench.ui.zaria.UIComponentFactorySPI |    1 -
 ...taverna.t2.workbench.ui.zaria.UIComponentSPI |    1 -
 ...rna.workbench.ui.zaria.UIComponentFactorySPI |    1 +
 ...he.taverna.workbench.ui.zaria.UIComponentSPI |    1 +
 .../ParallelizeConfigurationPanel.java          |   99 -
 .../parallelize/ParallelizeConfigureAction.java |  185 --
 .../ParallelizeConfigureMenuAction.java         |   77 -
 .../parallelize/ParallelizeContextualView.java  |  130 --
 .../ParallelizeContextualViewFactory.java       |   56 -
 .../ParallelizeConfigurationPanel.java          |  118 ++
 .../parallelize/ParallelizeConfigureAction.java |  201 ++
 .../ParallelizeConfigureMenuAction.java         |   76 +
 .../parallelize/ParallelizeContextualView.java  |  129 ++
 .../ParallelizeContextualViewFactory.java       |   55 +
 .../net.sf.taverna.t2.ui.menu.MenuComponent     |    1 -
 ...ntextualviews.activity.ContextualViewFactory |    1 -
 .../org.apache.taverna.ui.menu.MenuComponent    |    1 +
 ...ntextualviews.activity.ContextualViewFactory |    1 +
 .../spring/parallelize-ui-context-osgi.xml      |    6 +-
 .../META-INF/spring/parallelize-ui-context.xml  |    4 +-
 .../model/BioCataloguePluginConstants.java      |   77 -
 .../model/HTTPMethodInterpreter.java            |   46 -
 .../model/LoadingExpandedResource.java          |   41 -
 .../biocatalogue/model/LoadingResource.java     |   39 -
 .../net/sf/taverna/biocatalogue/model/Pair.java |   30 -
 .../sf/taverna/biocatalogue/model/Resource.java |  506 -----
 .../biocatalogue/model/ResourceManager.java     |  326 ----
 .../model/ResourcePreviewContent.java           |   38 -
 .../model/SoapOperationIdentity.java            |   77 -
 .../model/SoapOperationPortIdentity.java        |   26 -
 .../model/SoapProcessorIdentity.java            |   27 -
 .../biocatalogue/model/SoapServiceIdentity.java |   45 -
 .../net/sf/taverna/biocatalogue/model/Tag.java  |  218 ---
 .../net/sf/taverna/biocatalogue/model/Util.java |  793 --------
 .../BeanForPOSTToFilteredIndex.java             |   12 -
 .../model/connectivity/BeansForJSONLiteAPI.java |   84 -
 .../connectivity/BioCatalogueAPIRequest.java    |   47 -
 .../model/connectivity/BioCatalogueClient.java  |  785 --------
 .../model/connectivity/ServerResponse.java      |   40 -
 .../connectivity/ServerResponseStream.java      |   30 -
 .../biocatalogue/model/search/SearchEngine.java |  221 ---
 .../model/search/SearchInstance.java            |  490 -----
 .../model/search/SearchInstanceTracker.java     |   57 -
 .../model/search/SearchOptions.java             |   70 -
 .../model/search/SearchResults.java             |  214 ---
 .../model/search/ServiceFilteringSettings.java  |  184 --
 .../biocatalogue/test/AnnotationBean.java       |   52 -
 .../biocatalogue/test/DrawDefaultIconTest.java  |   38 -
 .../sf/taverna/biocatalogue/test/GSONTest.java  |   19 -
 .../test/GSONTest_exportingJSON.java            |   30 -
 .../test/GSONTest_forSoapOperationsIndex.java   |   27 -
 .../biocatalogue/test/JWaitDialogTest.java      |   36 -
 .../biocatalogue/test/LinkedListEqualsTest.java |   25 -
 .../biocatalogue/test/TestAPICaller.java        |  241 ---
 .../test/TestDoubleUsageOfSameSwingElement.java |   32 -
 .../biocatalogue/test/TestUtilURLHandling.java  |   87 -
 .../biocatalogue/test/TestXHTMLRenderer.java    |   42 -
 .../biocatalogue/test/WrappableJLabelTest.java  |   35 -
 .../taverna/biocatalogue/test/XStreamTest.java  |   32 -
 .../ui/BioCatalogueExplorationTab.java          |  131 --
 .../ui/HasDefaultFocusCapability.java           |   15 -
 .../biocatalogue/ui/JClickableLabel.java        |  172 --
 .../sf/taverna/biocatalogue/ui/JWaitDialog.java |  234 ---
 .../biocatalogue/ui/SearchOptionsPanel.java     |  167 --
 .../ui/filtertree/FilterTreeNode.java           |   91 -
 .../ui/filtertree/FilterTreePane.java           |  348 ----
 .../biocatalogue/ui/filtertree/JFilterTree.java |   69 -
 ...xpandableOnDemandLoadedListCellRenderer.java |  220 ---
 .../RESTMethodListCellRenderer.java             |  248 ---
 .../SOAPOperationListCellRenderer.java          |  257 ---
 .../SearchResultsListingPanel.java              |  870 ---------
 .../search_results/SearchResultsMainPanel.java  |  498 -----
 .../search_results/SearchResultsRenderer.java   |   47 -
 .../search_results/ServiceListCellRenderer.java |  291 ---
 .../ui/tristatetree/JTriStateTree.java          |  631 ------
 .../tristatetree/Swing - Tristate CheckBox.7z   |  Bin 108419 -> 0 bytes
 .../biocatalogue/ui/tristatetree/Test.java      |   67 -
 .../ui/tristatetree/TriStateCheckBox.java       |  172 --
 .../TriStateCheckBoxTreeCellRenderer.java       |   62 -
 .../TriStateTreeCheckingListener.java           |   12 -
 .../ui/tristatetree/TriStateTreeNode.java       |  246 ---
 .../biocatalogue/BioCataloguePerspective.java   |   70 -
 .../biocatalogue/MainComponent.java             |  285 ---
 .../biocatalogue/MainComponentFactory.java      |   46 -
 .../biocatalogue/MainComponentShutdownHook.java |   49 -
 .../biocatalogue/TestJFrameForLocalLaunch.java  |   68 -
 .../biocatalogue/integration/Integration.java   |  518 -----
 .../config/BioCataloguePluginConfiguration.java |   68 -
 .../BioCataloguePluginConfigurationPanel.java   |  448 -----
 ...ioCataloguePluginConfigurationUIFactory.java |   27 -
 ...aloguePluginInputPortContextViewFactory.java |   45 -
 ...loguePluginOutputPortContextViewFactory.java |   45 -
 ...aloguePluginProcessorContextViewFactory.java |   43 -
 .../ProcessorInputPortView.java                 |   52 -
 .../ProcessorOutputPortView.java                |   52 -
 .../contextual_views/ProcessorView.java         |  229 ---
 .../BioCatalogueWSDLActivityHealthCheck.java    |   40 -
 ...ueWSDLActivityHealthCheckVisitExplainer.java |  111 --
 .../BioCatalogueWSDLActivityHealthChecker.java  |  199 --
 .../health_check/ServiceHealthChecker.java      |  280 ---
 .../ServiceMonitoringStatusInterpreter.java     |   77 -
 .../BioCatalogueContextualMenuSection.java      |   62 -
 .../integration/menus/MenuActionInputPort.java  |   43 -
 .../menus/MenuActionProcessorHealthCheck.java   |   51 -
 .../BioCatalogueRESTServiceProvider.java        |  117 --
 .../BioCatalogueServiceProvider.java            |  274 ---
 ...ioCatalogueWSDLOperationServiceProvider.java |  215 ---
 .../RESTFromBioCatalogueServiceDescription.java |  194 --
 ...ationFromBioCatalogueServiceDescription.java |  116 --
 .../model/BioCataloguePluginConstants.java      |   77 +
 .../model/HTTPMethodInterpreter.java            |   46 +
 .../model/LoadingExpandedResource.java          |   41 +
 .../biocatalogue/model/LoadingResource.java     |   39 +
 .../apache/taverna/biocatalogue/model/Pair.java |   30 +
 .../taverna/biocatalogue/model/Resource.java    |  506 +++++
 .../biocatalogue/model/ResourceManager.java     |  326 ++++
 .../model/ResourcePreviewContent.java           |   38 +
 .../model/SoapOperationIdentity.java            |   77 +
 .../model/SoapOperationPortIdentity.java        |   26 +
 .../model/SoapProcessorIdentity.java            |   27 +
 .../biocatalogue/model/SoapServiceIdentity.java |   45 +
 .../apache/taverna/biocatalogue/model/Tag.java  |  218 +++
 .../apache/taverna/biocatalogue/model/Util.java |  793 ++++++++
 .../BeanForPOSTToFilteredIndex.java             |   12 +
 .../model/connectivity/BeansForJSONLiteAPI.java |   84 +
 .../connectivity/BioCatalogueAPIRequest.java    |   47 +
 .../model/connectivity/BioCatalogueClient.java  |  785 ++++++++
 .../model/connectivity/ServerResponse.java      |   40 +
 .../connectivity/ServerResponseStream.java      |   30 +
 .../biocatalogue/model/search/SearchEngine.java |  221 +++
 .../model/search/SearchInstance.java            |  490 +++++
 .../model/search/SearchInstanceTracker.java     |   57 +
 .../model/search/SearchOptions.java             |   70 +
 .../model/search/SearchResults.java             |  214 +++
 .../model/search/ServiceFilteringSettings.java  |  184 ++
 .../biocatalogue/test/AnnotationBean.java       |   52 +
 .../biocatalogue/test/DrawDefaultIconTest.java  |   38 +
 .../taverna/biocatalogue/test/GSONTest.java     |   19 +
 .../test/GSONTest_exportingJSON.java            |   30 +
 .../test/GSONTest_forSoapOperationsIndex.java   |   27 +
 .../biocatalogue/test/JWaitDialogTest.java      |   36 +
 .../biocatalogue/test/LinkedListEqualsTest.java |   25 +
 .../biocatalogue/test/TestAPICaller.java        |  241 +++
 .../test/TestDoubleUsageOfSameSwingElement.java |   32 +
 .../biocatalogue/test/TestUtilURLHandling.java  |   87 +
 .../biocatalogue/test/TestXHTMLRenderer.java    |   42 +
 .../biocatalogue/test/WrappableJLabelTest.java  |   35 +
 .../taverna/biocatalogue/test/XStreamTest.java  |   32 +
 .../ui/BioCatalogueExplorationTab.java          |  131 ++
 .../ui/HasDefaultFocusCapability.java           |   15 +
 .../biocatalogue/ui/JClickableLabel.java        |  172 ++
 .../taverna/biocatalogue/ui/JWaitDialog.java    |  234 +++
 .../biocatalogue/ui/SearchOptionsPanel.java     |  167 ++
 .../ui/filtertree/FilterTreeNode.java           |   91 +
 .../ui/filtertree/FilterTreePane.java           |  348 ++++
 .../biocatalogue/ui/filtertree/JFilterTree.java |   69 +
 ...xpandableOnDemandLoadedListCellRenderer.java |  220 +++
 .../RESTMethodListCellRenderer.java             |  248 +++
 .../SOAPOperationListCellRenderer.java          |  257 +++
 .../SearchResultsListingPanel.java              |  870 +++++++++
 .../search_results/SearchResultsMainPanel.java  |  498 +++++
 .../search_results/SearchResultsRenderer.java   |   47 +
 .../search_results/ServiceListCellRenderer.java |  291 +++
 .../ui/tristatetree/JTriStateTree.java          |  631 ++++++
 .../tristatetree/Swing - Tristate CheckBox.7z   |  Bin 0 -> 108419 bytes
 .../biocatalogue/ui/tristatetree/Test.java      |   67 +
 .../ui/tristatetree/TriStateCheckBox.java       |  172 ++
 .../TriStateCheckBoxTreeCellRenderer.java       |   62 +
 .../TriStateTreeCheckingListener.java           |   12 +
 .../ui/tristatetree/TriStateTreeNode.java       |  246 +++
 .../biocatalogue/BioCataloguePerspective.java   |   70 +
 .../biocatalogue/MainComponent.java             |  285 +++
 .../biocatalogue/MainComponentFactory.java      |   46 +
 .../biocatalogue/MainComponentShutdownHook.java |   49 +
 .../biocatalogue/TestJFrameForLocalLaunch.java  |   68 +
 .../biocatalogue/integration/Integration.java   |  518 +++++
 .../config/BioCataloguePluginConfiguration.java |   68 +
 .../BioCataloguePluginConfigurationPanel.java   |  448 +++++
 ...ioCataloguePluginConfigurationUIFactory.java |   27 +
 ...aloguePluginInputPortContextViewFactory.java |   45 +
 ...loguePluginOutputPortContextViewFactory.java |   45 +
 ...aloguePluginProcessorContextViewFactory.java |   43 +
 .../ProcessorInputPortView.java                 |   52 +
 .../ProcessorOutputPortView.java                |   52 +
 .../contextual_views/ProcessorView.java         |  229 +++
 .../BioCatalogueWSDLActivityHealthCheck.java    |   40 +
 ...ueWSDLActivityHealthCheckVisitExplainer.java |  111 ++
 .../BioCatalogueWSDLActivityHealthChecker.java  |  199 ++
 .../health_check/ServiceHealthChecker.java      |  280 +++
 .../ServiceMonitoringStatusInterpreter.java     |   77 +
 .../BioCatalogueContextualMenuSection.java      |   62 +
 .../integration/menus/MenuActionInputPort.java  |   43 +
 .../menus/MenuActionProcessorHealthCheck.java   |   51 +
 .../BioCatalogueRESTServiceProvider.java        |  117 ++
 .../BioCatalogueServiceProvider.java            |  274 +++
 ...ioCatalogueWSDLOperationServiceProvider.java |  215 +++
 .../RESTFromBioCatalogueServiceDescription.java |  194 ++
 ...ationFromBioCatalogueServiceDescription.java |  116 ++
 ...rvicedescriptions.ServiceDescriptionProvider |    4 +-
 .../net.sf.taverna.t2.ui.menu.MenuComponent     |    4 +-
 .../net.sf.taverna.t2.workbench.ShutdownSPI     |    2 +-
 ...rkbench.configuration.ConfigurationUIFactory |    2 +-
 ...t2.workbench.report.explainer.VisitExplainer |    2 +-
 ...ntextualviews.activity.ContextualViewFactory |    6 +-
 ...taverna.t2.workbench.ui.zaria.PerspectiveSPI |    2 +-
 ....t2.workbench.ui.zaria.UIComponentFactorySPI |    2 +-
 ...taverna.t2.workbench.ui.zaria.UIComponentSPI |    2 +-
 ...averna.t2.workflowmodel.health.HealthChecker |    2 +-
 .../perspectives/design/DesignPerspective.java  |  118 --
 .../design/DesignPerspectiveComponent.java      |  115 --
 .../design/WorkflowBundleSelectorComponent.java |  113 --
 .../design/WorkflowSelectorComponent.java       |  167 --
 .../t2/ui/perspectives/design/WorkflowTab.java  |  133 --
 .../perspectives/design/DesignPerspective.java  |  117 ++
 .../design/DesignPerspectiveComponent.java      |  114 ++
 .../design/WorkflowBundleSelectorComponent.java |  112 ++
 .../design/WorkflowSelectorComponent.java       |  166 ++
 .../ui/perspectives/design/WorkflowTab.java     |  132 ++
 ...taverna.t2.workbench.ui.zaria.PerspectiveSPI |    1 -
 ...he.taverna.workbench.ui.zaria.PerspectiveSPI |    1 +
 .../spring/perspective-design-context-osgi.xml  |   18 +-
 .../spring/perspective-design-context.xml       |    2 +-
 .../myexperiment/AddCommentDialog.java          |  330 ----
 .../myexperiment/AddRemoveFavouriteDialog.java  |  277 ---
 .../myexperiment/ExampleWorkflowsPanel.java     |  153 --
 .../HistoryBrowserTabContentPanel.java          |  541 ------
 .../myexperiment/JClickableLabel.java           |  127 --
 .../myexperiment/MainComponent.java             |  645 -------
 .../myexperiment/MainComponentFactory.java      |   60 -
 .../myexperiment/MainComponentShutdownHook.java |   84 -
 .../myexperiment/MyExperimentPerspective.java   |  190 --
 .../myexperiment/MyStuffContributionsPanel.java |  370 ----
 .../myexperiment/MyStuffSidebarPanel.java       |  359 ----
 .../myexperiment/MyStuffTabContentPanel.java    |  342 ----
 .../myexperiment/PluginPreferencesDialog.java   |  372 ----
 .../myexperiment/PluginStatusBar.java           |  195 --
 .../myexperiment/ResourceListPanel.java         |  182 --
 .../myexperiment/ResourcePreviewBrowser.java    |  711 -------
 .../myexperiment/ResourcePreviewContent.java    |   78 -
 .../myexperiment/ResourcePreviewFactory.java    | 1359 -------------
 .../myexperiment/SearchOptionsPanel.java        |  317 ---
 .../myexperiment/SearchResultsPanel.java        |  201 --
 .../myexperiment/SearchTabContentPanel.java     |  450 -----
 .../myexperiment/StyledHTMLEditorKit.java       |   19 -
 .../myexperiment/TagBrowserTabContentPanel.java |  226 ---
 .../myexperiment/TagCloudPanel.java             |  342 ----
 .../myexperiment/TestJFrameForLocalLaunch.java  |   48 -
 .../myexperiment/UploadWorkflowDialog.java      |  849 --------
 .../myexperiment/model/Base64$InputStream.class |  Bin 2083 -> 0 bytes
 .../model/Base64$OutputStream.class             |  Bin 2307 -> 0 bytes
 .../myexperiment/model/Base64.class             |  Bin 15458 -> 0 bytes
 .../perspectives/myexperiment/model/Base64.java | 1813 ------------------
 .../myexperiment/model/Comment.java             |  141 --
 .../perspectives/myexperiment/model/File.java   |  237 ---
 .../perspectives/myexperiment/model/Group.java  |  222 ---
 .../myexperiment/model/License.java             |   62 -
 .../myexperiment/model/MyExperimentClient.class |  Bin 3174 -> 0 bytes
 .../myexperiment/model/MyExperimentClient.java  | 1218 ------------
 .../perspectives/myexperiment/model/Pack.java   |  232 ---
 .../myexperiment/model/PackItem.java            |  186 --
 .../myexperiment/model/Resource.java            |  683 -------
 .../myexperiment/model/SearchEngine.java        |  321 ----
 .../myexperiment/model/ServerResponse.java      |   59 -
 .../ui/perspectives/myexperiment/model/Tag.java |  125 --
 .../myexperiment/model/TagCloud.java            |   47 -
 .../perspectives/myexperiment/model/User.java   |  297 ---
 .../perspectives/myexperiment/model/Util.java   |  624 ------
 .../myexperiment/model/Workflow.java            |  420 ----
 .../config/MyExperimentConfiguration.java       |   68 -
 .../config/MyExperimentConfigurationPanel.java  |  305 ---
 .../MyExperimentConfigurationUIFactory.java     |   62 -
 .../TestJFrameForPreferencesLocalLaunch.java    |   46 -
 .../myexperiment/AddCommentDialog.java          |  330 ++++
 .../myexperiment/AddRemoveFavouriteDialog.java  |  277 +++
 .../myexperiment/ExampleWorkflowsPanel.java     |  153 ++
 .../HistoryBrowserTabContentPanel.java          |  541 ++++++
 .../myexperiment/JClickableLabel.java           |  127 ++
 .../myexperiment/MainComponent.java             |  645 +++++++
 .../myexperiment/MainComponentFactory.java      |   60 +
 .../myexperiment/MainComponentShutdownHook.java |   84 +
 .../myexperiment/MyExperimentPerspective.java   |  190 ++
 .../myexperiment/MyStuffContributionsPanel.java |  370 ++++
 .../myexperiment/MyStuffSidebarPanel.java       |  359 ++++
 .../myexperiment/MyStuffTabContentPanel.java    |  342 ++++
 .../myexperiment/PluginPreferencesDialog.java   |  372 ++++
 .../myexperiment/PluginStatusBar.java           |  195 ++
 .../myexperiment/ResourceListPanel.java         |  182 ++
 .../myexperiment/ResourcePreviewBrowser.java    |  711 +++++++
 .../myexperiment/ResourcePreviewContent.java    |   78 +
 .../myexperiment/ResourcePreviewFactory.java    | 1359 +++++++++++++
 .../myexperiment/SearchOptionsPanel.java        |  317 +++
 .../myexperiment/SearchResultsPanel.java        |  201 ++
 .../myexperiment/SearchTabContentPanel.java     |  450 +++++
 .../myexperiment/StyledHTMLEditorKit.java       |   19 +
 .../myexperiment/TagBrowserTabContentPanel.java |  226 +++
 .../myexperiment/TagCloudPanel.java             |  342 ++++
 .../myexperiment/TestJFrameForLocalLaunch.java  |   48 +
 .../myexperiment/UploadWorkflowDialog.java      |  849 ++++++++
 .../myexperiment/model/Base64$InputStream.class |  Bin 0 -> 2083 bytes
 .../model/Base64$OutputStream.class             |  Bin 0 -> 2307 bytes
 .../myexperiment/model/Base64.class             |  Bin 0 -> 15458 bytes
 .../perspectives/myexperiment/model/Base64.java | 1813 ++++++++++++++++++
 .../myexperiment/model/Comment.java             |  141 ++
 .../perspectives/myexperiment/model/File.java   |  237 +++
 .../perspectives/myexperiment/model/Group.java  |  222 +++
 .../myexperiment/model/License.java             |   62 +
 .../myexperiment/model/MyExperimentClient.class |  Bin 0 -> 3174 bytes
 .../myexperiment/model/MyExperimentClient.java  | 1218 ++++++++++++
 .../perspectives/myexperiment/model/Pack.java   |  232 +++
 .../myexperiment/model/PackItem.java            |  186 ++
 .../myexperiment/model/Resource.java            |  683 +++++++
 .../myexperiment/model/SearchEngine.java        |  321 ++++
 .../myexperiment/model/ServerResponse.java      |   59 +
 .../ui/perspectives/myexperiment/model/Tag.java |  125 ++
 .../myexperiment/model/TagCloud.java            |   47 +
 .../perspectives/myexperiment/model/User.java   |  297 +++
 .../perspectives/myexperiment/model/Util.java   |  624 ++++++
 .../myexperiment/model/Workflow.java            |  420 ++++
 .../config/MyExperimentConfiguration.java       |   68 +
 .../config/MyExperimentConfigurationPanel.java  |  305 +++
 .../MyExperimentConfigurationUIFactory.java     |   62 +
 .../TestJFrameForPreferencesLocalLaunch.java    |   46 +
 .../net.sf.taverna.t2.workbench.ShutdownSPI     |    1 -
 ...rkbench.configuration.ConfigurationUIFactory |    1 -
 ...taverna.t2.workbench.ui.zaria.PerspectiveSPI |    1 -
 ....t2.workbench.ui.zaria.UIComponentFactorySPI |    1 -
 ...taverna.t2.workbench.ui.zaria.UIComponentSPI |    1 -
 .../org.apache.taverna.workbench.ShutdownSPI    |    1 +
 ...rkbench.configuration.ConfigurationUIFactory |    1 +
 ...he.taverna.workbench.ui.zaria.PerspectiveSPI |    1 +
 ...rna.workbench.ui.zaria.UIComponentFactorySPI |    1 +
 ...he.taverna.workbench.ui.zaria.UIComponentSPI |    1 +
 .../perspective-myexperiment-context-osgi.xml   |   10 +-
 .../spring/perspective-myexperiment-context.xml |    8 +-
 .../myexperiment/ajax-loader-still.gif          |  Bin 889 -> 0 bytes
 .../perspectives/myexperiment/ajax-loader.gif   |  Bin 1456 -> 0 bytes
 .../ui/perspectives/myexperiment/arrow_left.png |  Bin 557 -> 0 bytes
 .../perspectives/myexperiment/arrow_refresh.png |  Bin 685 -> 0 bytes
 .../perspectives/myexperiment/arrow_right.png   |  Bin 596 -> 0 bytes
 .../perspectives/myexperiment/comment_add.png   |  Bin 530 -> 0 bytes
 .../myexperiment/comment_delete.png             |  Bin 548 -> 0 bytes
 .../t2/ui/perspectives/myexperiment/cross.png   |  Bin 655 -> 0 bytes
 .../t2/ui/perspectives/myexperiment/denied.png  |  Bin 701 -> 0 bytes
 .../myexperiment/dummy-workflow.t2flow          |  157 --
 .../external_link_listing_small.png             |  Bin 456 -> 0 bytes
 .../perspectives/myexperiment/favourite_add.png |  Bin 701 -> 0 bytes
 .../myexperiment/favourite_delete.png           |  Bin 722 -> 0 bytes
 .../t2/ui/perspectives/myexperiment/file.png    |  Bin 562 -> 0 bytes
 .../t2/ui/perspectives/myexperiment/group.png   |  Bin 753 -> 0 bytes
 .../t2/ui/perspectives/myexperiment/login.png   |  Bin 693 -> 0 bytes
 .../t2/ui/perspectives/myexperiment/logout.png  |  Bin 688 -> 0 bytes
 .../ui/perspectives/myexperiment/myexp_icon.png |  Bin 1611 -> 0 bytes
 .../myexperiment/myexp_icon16x16.png            |  Bin 1057 -> 0 bytes
 .../myexperiment/myexperiment-perspective.xml   |   17 -
 .../myexperiment/open_in_myExperiment.png       |  Bin 621 -> 0 bytes
 .../t2/ui/perspectives/myexperiment/pack.png    |  Bin 565 -> 0 bytes
 .../myexperiment/remote_resource.png            |  Bin 957 -> 0 bytes
 .../t2/ui/perspectives/myexperiment/star.png    |  Bin 670 -> 0 bytes
 .../t2/ui/perspectives/myexperiment/styles.css  |  380 ----
 .../ui/perspectives/myexperiment/tag_blue.png   |  Bin 586 -> 0 bytes
 .../t2/ui/perspectives/myexperiment/tick.png    |  Bin 537 -> 0 bytes
 .../myexperiment/transparent_icon.png           |  Bin 1172 -> 0 bytes
 .../t2/ui/perspectives/myexperiment/user.png    |  Bin 741 -> 0 bytes
 .../ui/perspectives/myexperiment/workflow.png   |  Bin 975 -> 0 bytes
 .../myexperiment/ajax-loader-still.gif          |  Bin 0 -> 889 bytes
 .../perspectives/myexperiment/ajax-loader.gif   |  Bin 0 -> 1456 bytes
 .../ui/perspectives/myexperiment/arrow_left.png |  Bin 0 -> 557 bytes
 .../perspectives/myexperiment/arrow_refresh.png |  Bin 0 -> 685 bytes
 .../perspectives/myexperiment/arrow_right.png   |  Bin 0 -> 596 bytes
 .../perspectives/myexperiment/comment_add.png   |  Bin 0 -> 530 bytes
 .../myexperiment/comment_delete.png             |  Bin 0 -> 548 bytes
 .../ui/perspectives/myexperiment/cross.png      |  Bin 0 -> 655 bytes
 .../ui/perspectives/myexperiment/denied.png     |  Bin 0 -> 701 bytes
 .../myexperiment/dummy-workflow.t2flow          |  157 ++
 .../external_link_listing_small.png             |  Bin 0 -> 456 bytes
 .../perspectives/myexperiment/favourite_add.png |  Bin 0 -> 701 bytes
 .../myexperiment/favourite_delete.png           |  Bin 0 -> 722 bytes
 .../ui/perspectives/myexperiment/file.png       |  Bin 0 -> 562 bytes
 .../ui/perspectives/myexperiment/group.png      |  Bin 0 -> 753 bytes
 .../ui/perspectives/myexperiment/login.png      |  Bin 0 -> 693 bytes
 .../ui/perspectives/myexperiment/logout.png     |  Bin 0 -> 688 bytes
 .../ui/perspectives/myexperiment/myexp_icon.png |  Bin 0 -> 1611 bytes
 .../myexperiment/myexp_icon16x16.png            |  Bin 0 -> 1057 bytes
 .../myexperiment/myexperiment-perspective.xml   |   17 +
 .../myexperiment/open_in_myExperiment.png       |  Bin 0 -> 621 bytes
 .../ui/perspectives/myexperiment/pack.png       |  Bin 0 -> 565 bytes
 .../myexperiment/remote_resource.png            |  Bin 0 -> 957 bytes
 .../ui/perspectives/myexperiment/star.png       |  Bin 0 -> 670 bytes
 .../ui/perspectives/myexperiment/styles.css     |  380 ++++
 .../ui/perspectives/myexperiment/tag_blue.png   |  Bin 0 -> 586 bytes
 .../ui/perspectives/myexperiment/tick.png       |  Bin 0 -> 537 bytes
 .../myexperiment/transparent_icon.png           |  Bin 0 -> 1172 bytes
 .../ui/perspectives/myexperiment/user.png       |  Bin 0 -> 741 bytes
 .../ui/perspectives/myexperiment/workflow.png   |  Bin 0 -> 975 bytes
 .../results/ResultsPerspective.java             |  158 --
 .../results/ResultsPerspectiveComponent.java    |  221 ---
 .../t2/ui/perspectives/results/RunMonitor.java  |  171 --
 .../results/RunSelectorComponent.java           |   72 -
 .../t2/ui/perspectives/results/RunTab.java      |  133 --
 .../t2/ui/perspectives/results/WorkflowRun.java |   54 -
 .../results/WorkflowRunListCellRenderer.java    |   59 -
 .../results/WorkflowRunListModel.java           |   66 -
 .../results/ResultsPerspective.java             |  158 ++
 .../results/ResultsPerspectiveComponent.java    |  221 +++
 .../ui/perspectives/results/RunMonitor.java     |  171 ++
 .../results/RunSelectorComponent.java           |   72 +
 .../taverna/ui/perspectives/results/RunTab.java |  133 ++
 .../ui/perspectives/results/WorkflowRun.java    |   54 +
 .../results/WorkflowRunListCellRenderer.java    |   59 +
 .../results/WorkflowRunListModel.java           |   66 +
 ...taverna.t2.workbench.ui.zaria.PerspectiveSPI |    1 -
 ...he.taverna.workbench.ui.zaria.PerspectiveSPI |    1 +
 .../spring/perspective-results-context-osgi.xml |   14 +-
 .../spring/perspective-results-context.xml      |    2 +-
 .../plugin/impl/AvailablePluginPanel.java       |   72 -
 .../plugin/impl/InstalledPluginPanel.java       |   66 -
 .../plugin/impl/PluginManagerPanel.java         |  210 --
 .../plugin/impl/PluginManagerView.java          |   71 -
 .../t2/workbench/plugin/impl/PluginPanel.java   |  166 --
 .../plugin/impl/UpdatePluginPanel.java          |   72 -
 .../plugin/impl/menu/PluginMenuAction.java      |   56 -
 .../plugin/impl/AvailablePluginPanel.java       |   71 +
 .../plugin/impl/InstalledPluginPanel.java       |   65 +
 .../plugin/impl/PluginManagerPanel.java         |  209 ++
 .../plugin/impl/PluginManagerView.java          |   70 +
 .../workbench/plugin/impl/PluginPanel.java      |  165 ++
 .../plugin/impl/UpdatePluginPanel.java          |   71 +
 .../plugin/impl/menu/PluginMenuAction.java      |   55 +
 .../spring/plugin-manager-context-osgi.xml      |    4 +-
 .../META-INF/spring/plugin-manager-context.xml  |    4 +-
 .../raven/plugins/ui/AddPluginSiteFrame.java    |  273 ---
 .../plugins/ui/CheckForNoticeStartupHook.java   |  143 --
 .../raven/plugins/ui/CheckForUpdatesDialog.java |  122 --
 .../plugins/ui/CheckForUpdatesStartupHook.java  |   94 -
 .../plugins/ui/PluginListCellRenderer.java      |  214 ---
 .../raven/plugins/ui/PluginListModel.java       |  108 --
 .../raven/plugins/ui/PluginManagerFrame.java    |  516 -----
 .../plugins/ui/PluginRepositoryListener.java    |  148 --
 .../raven/plugins/ui/PluginSiteFrame.java       |  542 ------
 .../raven/plugins/ui/UpdatesAvailableIcon.java  |  205 --
 .../profile/ui/ProfileVersionCellRenderer.java  |  177 --
 .../profile/ui/ProfileVersionListFrame.java     |  260 ---
 .../profile/ui/ProfileVersionListModel.java     |  101 -
 .../raven/plugins/ui/AddPluginSiteFrame.java    |  273 +++
 .../plugins/ui/CheckForNoticeStartupHook.java   |  143 ++
 .../raven/plugins/ui/CheckForUpdatesDialog.java |  122 ++
 .../plugins/ui/CheckForUpdatesStartupHook.java  |   94 +
 .../plugins/ui/PluginListCellRenderer.java      |  214 +++
 .../raven/plugins/ui/PluginListModel.java       |  108 ++
 .../raven/plugins/ui/PluginManagerFrame.java    |  516 +++++
 .../plugins/ui/PluginRepositoryListener.java    |  148 ++
 .../raven/plugins/ui/PluginSiteFrame.java       |  542 ++++++
 .../raven/plugins/ui/UpdatesAvailableIcon.java  |  205 ++
 .../profile/ui/ProfileVersionCellRenderer.java  |  177 ++
 .../profile/ui/ProfileVersionListFrame.java     |  260 +++
 .../profile/ui/ProfileVersionListModel.java     |  101 +
 .../net.sf.taverna.t2.workbench.StartupSPI      |    2 -
 .../org.apache.taverna.workbench.StartupSPI     |    2 +
 .../spring/plugins-gui-context-osgi.xml         |    2 +-
 .../net/sf/taverna/raven/plugins/ui/update.png  |  Bin 689 -> 0 bytes
 .../raven/plugins/ui/updateRecommended.png      |  Bin 731 -> 0 bytes
 .../apache/taverna/raven/plugins/ui/update.png  |  Bin 0 -> 689 bytes
 .../raven/plugins/ui/updateRecommended.png      |  Bin 0 -> 731 bytes
 taverna-reference-ui/pom.xml                    |   12 +-
 .../t2/reference/ui/CheckWorkflowStatus.java    |   97 -
 .../ui/CopyWorkflowInProgressDialog.java        |   91 -
 .../reference/ui/CopyWorkflowSwingWorker.java   |   51 -
 .../t2/reference/ui/InvalidDataflowReport.java  |   95 -
 .../t2/reference/ui/RegistrationPanel.java      |  808 --------
 .../sf/taverna/t2/reference/ui/UrlPanel.java    |  100 -
 .../t2/reference/ui/WorkflowLaunchWindow.java   |  626 ------
 .../net/sf/taverna/t2/reference/ui/package.html |    4 -
 .../ui/referenceactions/LoadInputsFromXML.java  |  118 --
 .../ui/referenceactions/ReferenceActionSPI.java |   38 -
 .../ui/referenceactions/SaveInputsAsXML.java    |  205 --
 .../reference/ui/tree/PreRegistrationTree.java  |  217 ---
 .../tree/PreRegistrationTreeCellRenderer.java   |  115 --
 .../ui/tree/PreRegistrationTreeDnDHandler.java  |  268 ---
 .../ui/tree/PreRegistrationTreeModel.java       |  310 ---
 .../taverna/t2/reference/ui/tree/package.html   |    6 -
 .../reference/ui/CheckWorkflowStatus.java       |   97 +
 .../ui/CopyWorkflowInProgressDialog.java        |   91 +
 .../reference/ui/CopyWorkflowSwingWorker.java   |   51 +
 .../reference/ui/InvalidDataflowReport.java     |   95 +
 .../taverna/reference/ui/RegistrationPanel.java |  808 ++++++++
 .../apache/taverna/reference/ui/UrlPanel.java   |  100 +
 .../reference/ui/WorkflowLaunchWindow.java      |  626 ++++++
 .../apache/taverna/reference/ui/package.html    |    4 +
 .../ui/referenceactions/LoadInputsFromXML.java  |  118 ++
 .../ui/referenceactions/ReferenceActionSPI.java |   38 +
 .../ui/referenceactions/SaveInputsAsXML.java    |  205 ++
 .../reference/ui/tree/PreRegistrationTree.java  |  217 +++
 .../tree/PreRegistrationTreeCellRenderer.java   |  115 ++
 .../ui/tree/PreRegistrationTreeDnDHandler.java  |  268 +++
 .../ui/tree/PreRegistrationTreeModel.java       |  310 +++
 .../taverna/reference/ui/tree/package.html      |    6 +
 ...rence.ui.referenceactions.ReferenceActionSPI |    2 -
 ...rence.ui.referenceactions.ReferenceActionSPI |    2 +
 .../spring/reference-ui-context-osgi.xml        |    4 +-
 .../META-INF/spring/reference-ui-context.xml    |    4 +-
 .../net/sf/taverna/t2/renderers/Renderer.java   |   33 -
 .../taverna/t2/renderers/RendererException.java |   46 -
 .../taverna/t2/renderers/RendererRegistry.java  |   48 -
 .../sf/taverna/t2/renderers/RendererUtils.java  |   89 -
 .../org/apache/taverna/renderers/Renderer.java  |   32 +
 .../taverna/renderers/RendererException.java    |   45 +
 .../taverna/renderers/RendererRegistry.java     |   47 +
 .../apache/taverna/renderers/RendererUtils.java |   88 +
 .../t2/renderers/HTMLBrowserRenderer.java       |   95 -
 .../sf/taverna/t2/renderers/JMolRenderer.java   |  178 --
 .../sf/taverna/t2/renderers/PDFRenderer.java    |  124 --
 .../sf/taverna/t2/renderers/SVGRenderer.java    |  154 --
 .../taverna/t2/renderers/SeqVistaRenderer.java  |  167 --
 .../taverna/renderers/HTMLBrowserRenderer.java  |   97 +
 .../apache/taverna/renderers/JMolRenderer.java  |  181 ++
 .../apache/taverna/renderers/PDFRenderer.java   |  127 ++
 .../apache/taverna/renderers/SVGRenderer.java   |  157 ++
 .../taverna/renderers/SeqVistaRenderer.java     |  170 ++
 .../net.sf.taverna.t2.renderers.Renderer        |    5 -
 .../org.apache.taverna.renderers.Renderer       |    5 +
 .../spring/renderers-exts-context-osgi.xml      |   10 +-
 .../META-INF/spring/renderers-exts-context.xml  |   10 +-
 .../taverna/t2/renderers/TestRendererSPI.java   |  153 --
 .../taverna/renderers/TestRendererSPI.java      |  153 ++
 taverna-renderers-impl/pom.xml                  |    2 +-
 .../t2/renderers/impl/AbstractRenderer.java     |  124 --
 .../renderers/impl/AdvancedImageRenderer.java   |   94 -
 .../t2/renderers/impl/ExtensionFileFilter.java  |   77 -
 .../t2/renderers/impl/HexBinaryRenderer.java    |   77 -
 .../t2/renderers/impl/RendererConstants.java    |   13 -
 .../t2/renderers/impl/RendererRegistryImpl.java |   54 -
 .../taverna/t2/renderers/impl/TextRenderer.java |  137 --
 .../t2/renderers/impl/TextRtfRenderer.java      |   85 -
 .../t2/renderers/impl/TextXMLRenderer.java      |   86 -
 .../sf/taverna/t2/renderers/impl/XMLTree.java   |  329 ----
 .../renderers/impl/AbstractRenderer.java        |  143 ++
 .../renderers/impl/AdvancedImageRenderer.java   |   93 +
 .../renderers/impl/ExtensionFileFilter.java     |   71 +
 .../renderers/impl/HexBinaryRenderer.java       |   76 +
 .../renderers/impl/RendererConstants.java       |   32 +
 .../renderers/impl/RendererRegistryImpl.java    |   53 +
 .../taverna/renderers/impl/TextRenderer.java    |  136 ++
 .../taverna/renderers/impl/TextRtfRenderer.java |   84 +
 .../taverna/renderers/impl/TextXMLRenderer.java |   85 +
 .../apache/taverna/renderers/impl/XMLTree.java  |  328 ++++
 .../net.sf.taverna.t2.renderers.Renderer        |    7 -
 .../org.apache.taverna.renderers.Renderer       |    7 +
 .../spring/renderers-impl-context-osgi.xml      |   14 +-
 .../META-INF/spring/renderers-impl-context.xml  |   12 +-
 .../taverna/t2/renderers/TestRendererSPI.java   |  154 --
 .../taverna/renderers/TestRendererSPI.java      |  153 ++
 .../t2/workbench/report/ProfileReportEvent.java |   21 -
 .../t2/workbench/report/ReportManager.java      |   42 -
 .../t2/workbench/report/ReportManagerEvent.java |   10 -
 .../config/ReportManagerConfiguration.java      |   44 -
 .../workbench/report/ProfileReportEvent.java    |   37 +
 .../taverna/workbench/report/ReportManager.java |   61 +
 .../workbench/report/ReportManagerEvent.java    |   26 +
 .../config/ReportManagerConfiguration.java      |   43 +
 .../services/net.sf.taverna.t2.visit.VisitKind  |    1 -
 ....taverna.t2.visit.fragility.FragilityChecker |    1 -
 .../services/org.apache.taverna.visit.VisitKind |    1 +
 ...che.taverna.visit.fragility.FragilityChecker |    1 +
 .../META-INF/spring/report-api-context-osgi.xml |    4 +-
 .../META-INF/spring/report-api-context.xml      |    4 +-
 .../report/explainer/BasicExplainer.java        | 1294 -------------
 .../report/explainer/BasicExplainer.java        | 1294 +++++++++++++
 ...t2.workbench.report.explainer.VisitExplainer |    1 -
 ...na.workbench.report.explainer.VisitExplainer |    1 +
 .../spring/report-explainer-context-osgi.xml    |   12 +-
 .../spring/report-explainer-context.xml         |    2 +-
 .../impl/ReportManagerConfigurationImpl.java    |   71 -
 .../report/impl/ReportManagerImpl.java          |  564 ------
 .../impl/ReportManagerConfigurationImpl.java    |   71 +
 .../report/impl/ReportManagerImpl.java          |  564 ++++++
 .../spring/report-impl-context-osgi.xml         |   14 +-
 .../META-INF/spring/report-impl-context.xml     |    8 +-
 .../ui/ReportManagerConfigurationPanel.java     |  363 ----
 .../ui/ReportManagerConfigurationUIFactory.java |   55 -
 .../ReportOnObjectContextualMenuAction.java     |  189 --
 .../report/view/ReportOnWorkflowAction.java     |  177 --
 .../report/view/ReportViewComponent.java        |  574 ------
 .../report/view/ReportViewComponentFactory.java |   75 -
 .../report/view/ReportViewConfigureAction.java  |   45 -
 .../report/view/ReportViewTableModel.java       |  284 ---
 .../workbench/report/view/StatusRenderer.java   |   46 -
 .../report/view/ValidateInProgressDialog.java   |   92 -
 .../view/ValidateObjectInProgressDialog.java    |   93 -
 .../report/view/ValidateObjectSwingWorker.java  |   71 -
 .../report/view/ValidateSwingWorker.java        |  123 --
 .../workbench/report/view/VisitReportProxy.java |   42 -
 .../report/view/VisitReportProxySet.java        |   34 -
 .../ui/ReportManagerConfigurationPanel.java     |  363 ++++
 .../ui/ReportManagerConfigurationUIFactory.java |   55 +
 .../ReportOnObjectContextualMenuAction.java     |  189 ++
 .../report/view/ReportOnWorkflowAction.java     |  178 ++
 .../report/view/ReportViewComponent.java        |  574 ++++++
 .../report/view/ReportViewComponentFactory.java |   75 +
 .../report/view/ReportViewConfigureAction.java  |   45 +
 .../report/view/ReportViewTableModel.java       |  284 +++
 .../workbench/report/view/StatusRenderer.java   |   46 +
 .../report/view/ValidateInProgressDialog.java   |   92 +
 .../view/ValidateObjectInProgressDialog.java    |   93 +
 .../report/view/ValidateObjectSwingWorker.java  |   71 +
 .../report/view/ValidateSwingWorker.java        |  123 ++
 .../workbench/report/view/VisitReportProxy.java |   42 +
 .../report/view/VisitReportProxySet.java        |   34 +
 .../net.sf.taverna.t2.ui.menu.MenuComponent     |    1 -
 ...rkbench.configuration.ConfigurationUIFactory |    1 -
 ....t2.workbench.ui.zaria.UIComponentFactorySPI |    1 -
 .../org.apache.taverna.ui.menu.MenuComponent    |    1 +
 ...rkbench.configuration.ConfigurationUIFactory |    1 +
 ...rna.workbench.ui.zaria.UIComponentFactorySPI |    1 +
 .../spring/report-view-context-osgi.xml         |   18 +-
 .../META-INF/spring/report-view-context.xml     |    6 +-
 taverna-results-view/pom.xml                    |    6 +-
 .../views/results/InvocationTreeModel.java      |  103 -
 .../views/results/InvocationTreeNode.java       |  100 -
 .../workbench/views/results/InvocationView.java |  136 --
 .../t2/workbench/views/results/ReportView.java  |  420 ----
 .../views/results/ResultsComponent.java         |  233 ---
 .../views/results/SimpleFilteredTreeModel.java  |   68 -
 .../processor/FilteredIterationTreeModel.java   |   91 -
 .../FilteredProcessorValueTreeModel.java        |   70 -
 .../IntermediateValuesInProgressDialog.java     |   89 -
 .../IntermediateValuesSwingWorker.java          |   47 -
 .../results/processor/IterationTreeNode.java    |   99 -
 .../processor/ProcessorEnactmentsTreeModel.java |  189 --
 .../processor/ProcessorEnactmentsTreeNode.java  |   84 -
 .../processor/ProcessorPortResultsViewTab.java  |  229 ---
 .../processor/ProcessorResultCellRenderer.java  |   89 -
 .../processor/ProcessorResultTreeNode.java      |  181 --
 .../processor/ProcessorResultsComponent.java    | 1004 ----------
 .../processor/ProcessorResultsTreeModel.java    |   73 -
 .../RenderedProcessorResultComponent.java       |  575 ------
 .../saveactions/SaveAllResultsAsExcel.java      |  293 ---
 .../saveactions/SaveAllResultsAsXML.java        |   80 -
 .../results/saveactions/SaveAllResultsSPI.java  |  193 --
 .../saveactions/SaveAllResultsToFileSystem.java |   94 -
 .../saveactions/SaveIndividualResult.java       |  186 --
 .../saveactions/SaveIndividualResultSPI.java    |   48 -
 .../results/workflow/DataBundleTreeModel.java   |  136 --
 .../workflow/FilteredDataBundleTreeModel.java   |  147 --
 .../FilteredWorkflowResultTreeModel.java        |  126 --
 .../workflow/PortResultCellRenderer.java        |  100 -
 .../results/workflow/PortResultsViewTab.java    |  283 ---
 .../workflow/RenderedResultComponent.java       |  601 ------
 .../workflow/WorkflowResultTreeModel.java       |  197 --
 .../workflow/WorkflowResultTreeNode.java        |  120 --
 .../workflow/WorkflowResultsComponent.java      |  352 ----
 .../views/results/InvocationTreeModel.java      |  103 +
 .../views/results/InvocationTreeNode.java       |  100 +
 .../workbench/views/results/InvocationView.java |  136 ++
 .../workbench/views/results/ReportView.java     |  420 ++++
 .../views/results/ResultsComponent.java         |  233 +++
 .../views/results/SimpleFilteredTreeModel.java  |   68 +
 .../processor/FilteredIterationTreeModel.java   |   91 +
 .../FilteredProcessorValueTreeModel.java        |   70 +
 .../IntermediateValuesInProgressDialog.java     |   89 +
 .../IntermediateValuesSwingWorker.java          |   47 +
 .../results/processor/IterationTreeNode.java    |   99 +
 .../processor/ProcessorEnactmentsTreeModel.java |  189 ++
 .../processor/ProcessorEnactmentsTreeNode.java  |   84 +
 .../processor/ProcessorPortResultsViewTab.java  |  229 +++
 .../processor/ProcessorResultCellRenderer.java  |   89 +
 .../processor/ProcessorResultTreeNode.java      |  181 ++
 .../processor/ProcessorResultsComponent.java    | 1004 ++++++++++
 .../processor/ProcessorResultsTreeModel.java    |   73 +
 .../RenderedProcessorResultComponent.java       |  575 ++++++
 .../saveactions/SaveAllResultsAsExcel.java      |  293 +++
 .../saveactions/SaveAllResultsAsXML.java        |   80 +
 .../results/saveactions/SaveAllResultsSPI.java  |  193 ++
 .../saveactions/SaveAllResultsToFileSystem.java |   94 +
 .../saveactions/SaveIndividualResult.java       |  186 ++
 .../saveactions/SaveIndividualResultSPI.java    |   48 +
 .../results/workflow/DataBundleTreeModel.java   |  136 ++
 .../workflow/FilteredDataBundleTreeModel.java   |  147 ++
 .../FilteredWorkflowResultTreeModel.java        |  126 ++
 .../workflow/PortResultCellRenderer.java        |  100 +
 .../results/workflow/PortResultsViewTab.java    |  283 +++
 .../workflow/RenderedResultComponent.java       |  601 ++++++
 .../workflow/WorkflowResultTreeModel.java       |  197 ++
 .../workflow/WorkflowResultTreeNode.java        |  120 ++
 .../workflow/WorkflowResultsComponent.java      |  352 ++++
 ...taverna.t2.workbench.ui.zaria.UIComponentSPI |    1 -
 ....views.results.saveactions.SaveAllResultsSPI |    3 -
 ....results.saveactions.SaveIndividualResultSPI |    1 -
 ...he.taverna.workbench.ui.zaria.UIComponentSPI |    1 +
 ....views.results.saveactions.SaveAllResultsSPI |    3 +
 ....results.saveactions.SaveIndividualResultSPI |    1 +
 .../spring/results-view-context-osgi.xml        |    8 +-
 .../META-INF/spring/results-view-context.xml    |    8 +-
 .../retry/RetryConfigurationPanel.java          |  172 --
 .../workbench/retry/RetryConfigureAction.java   |  183 --
 .../retry/RetryConfigureMenuAction.java         |   77 -
 .../t2/workbench/retry/RetryContextualView.java |  165 --
 .../retry/RetryContextualViewFactory.java       |   58 -
 .../retry/RetryConfigurationPanel.java          |  191 ++
 .../workbench/retry/RetryConfigureAction.java   |  199 ++
 .../retry/RetryConfigureMenuAction.java         |   76 +
 .../workbench/retry/RetryContextualView.java    |  164 ++
 .../retry/RetryContextualViewFactory.java       |   57 +
 .../net.sf.taverna.t2.ui.menu.MenuComponent     |    1 -
 ...ntextualviews.activity.ContextualViewFactory |    1 -
 .../org.apache.taverna.ui.menu.MenuComponent    |    1 +
 ...ntextualviews.activity.ContextualViewFactory |    1 +
 .../META-INF/spring/retry-ui-context-osgi.xml   |    6 +-
 .../META-INF/spring/retry-ui-context.xml        |    4 +-
 .../run/actions/OpenWorkflowRunAction.java      |  135 --
 .../run/actions/RunWorkflowAction.java          |  299 ---
 .../run/actions/ValidateWorkflowAction.java     |   56 -
 .../WorkflowRunStatusShutdownDialog.java        |  153 --
 .../cleanup/WorkflowRunStatusShutdownHook.java  |  110 --
 .../run/menu/FileOpenRunMenuAction.java         |   63 -
 .../workbench/run/menu/FileRunMenuAction.java   |   82 -
 .../workbench/run/menu/FileRunMenuSection.java  |   36 -
 .../run/menu/FileValidateMenuAction.java        |   70 -
 .../workbench/run/toolbar/RunToolbarAction.java |   82 -
 .../run/toolbar/RunToolbarSection.java          |   36 -
 .../run/actions/OpenWorkflowRunAction.java      |  135 ++
 .../run/actions/RunWorkflowAction.java          |  299 +++
 .../run/actions/ValidateWorkflowAction.java     |   56 +
 .../WorkflowRunStatusShutdownDialog.java        |  153 ++
 .../cleanup/WorkflowRunStatusShutdownHook.java  |  110 ++
 .../run/menu/FileOpenRunMenuAction.java         |   63 +
 .../workbench/run/menu/FileRunMenuAction.java   |   82 +
 .../workbench/run/menu/FileRunMenuSection.java  |   36 +
 .../run/menu/FileValidateMenuAction.java        |   70 +
 .../workbench/run/toolbar/RunToolbarAction.java |   82 +
 .../run/toolbar/RunToolbarSection.java          |   36 +
 .../net.sf.taverna.t2.ui.menu.MenuComponent     |    6 -
 .../net.sf.taverna.t2.workbench.ShutdownSPI     |    5 -
 .../net.sf.taverna.t2.workbench.StartupSPI      |    1 -
 ....t2.workbench.ui.zaria.UIComponentFactorySPI |    1 -
 ...taverna.t2.workbench.ui.zaria.UIComponentSPI |    1 -
 .../org.apache.taverna.ui.menu.MenuComponent    |    6 +
 .../org.apache.taverna.workbench.ShutdownSPI    |    5 +
 .../org.apache.taverna.workbench.StartupSPI     |    1 +
 ...rna.workbench.ui.zaria.UIComponentFactorySPI |    1 +
 ...he.taverna.workbench.ui.zaria.UIComponentSPI |    1 +
 .../META-INF/spring/run-ui-context-osgi.xml     |   14 +-
 .../META-INF/spring/run-ui-context.xml          |   14 +-
 .../selection/DataflowSelectionModel.java       |   85 -
 .../workbench/selection/SelectionManager.java   |  112 --
 .../events/DataflowSelectionMessage.java        |   66 -
 .../events/PerspectiveSelectionEvent.java       |   59 -
 .../selection/events/ProfileSelectionEvent.java |   57 -
 .../selection/events/SelectionManagerEvent.java |   34 -
 .../events/WorkflowBundleSelectionEvent.java    |   59 -
 .../events/WorkflowRunSelectionEvent.java       |   51 -
 .../events/WorkflowSelectionEvent.java          |   57 -
 .../selection/DataflowSelectionModel.java       |   84 +
 .../workbench/selection/SelectionManager.java   |  131 ++
 .../events/DataflowSelectionMessage.java        |   65 +
 .../events/PerspectiveSelectionEvent.java       |   58 +
 .../selection/events/ProfileSelectionEvent.java |   56 +
 .../selection/events/SelectionManagerEvent.java |   33 +
 .../events/WorkflowBundleSelectionEvent.java    |   58 +
 .../events/WorkflowRunSelectionEvent.java       |   50 +
 .../events/WorkflowSelectionEvent.java          |   56 +
 .../impl/DataflowSelectionModelImpl.java        |  116 --
 .../selection/impl/SelectionManagerImpl.java    |  367 ----
 .../impl/DataflowSelectionModelImpl.java        |  115 ++
 .../selection/impl/SelectionManagerImpl.java    |  366 ++++
 .../spring/selection-impl-context-osgi.xml      |   10 +-
 .../META-INF/spring/selection-impl-context.xml  |    2 +-
 ...ringConstantActivityConfigurationAction.java |   71 -
 .../menu/AddStringConstantTemplateAction.java   |  112 --
 .../AddStringConstantTemplateMenuAction.java    |  124 --
 .../menu/ConfigureStringConstantMenuAction.java |   64 -
 .../StringConstantActivityIcon.java             |   58 -
 .../StringConstantTemplateService.java          |   84 -
 .../StringConstantActivityContextualView.java   |   93 -
 .../StringConstantActivityViewFactory.java      |   87 -
 .../views/StringConstantConfigView.java         |  243 ---
 ...ringConstantActivityConfigurationAction.java |   70 +
 .../menu/AddStringConstantTemplateAction.java   |  111 ++
 .../AddStringConstantTemplateMenuAction.java    |  123 ++
 .../menu/ConfigureStringConstantMenuAction.java |   83 +
 .../StringConstantActivityIcon.java             |   57 +
 .../StringConstantTemplateService.java          |   83 +
 .../StringConstantActivityContextualView.java   |   92 +
 .../StringConstantActivityViewFactory.java      |   86 +
 .../views/StringConstantConfigView.java         |  259 +++
 ...rvicedescriptions.ServiceDescriptionProvider |    1 -
 .../net.sf.taverna.t2.ui.menu.MenuComponent     |    3 -
 ...a.t2.workbench.activityicons.ActivityIconSPI |    1 -
 ...ntextualviews.activity.ContextualViewFactory |    1 -
 ...rvicedescriptions.ServiceDescriptionProvider |    1 +
 .../org.apache.taverna.ui.menu.MenuComponent    |    3 +
 ...erna.workbench.activityicons.ActivityIconSPI |    1 +
 ...ntextualviews.activity.ContextualViewFactory |    1 +
 .../stringconstant-activity-ui-context-osgi.xml |   20 +-
 .../stringconstant-activity-ui-context.xml      |   12 +-
 .../views/TestStringConstantContextualView.java |   53 -
 .../views/TestStringConstantContextualView.java |   52 +
 .../net/sf/taverna/t2/lang/ui/CArrowImage.java  |  198 --
 .../t2/lang/ui/CTransferableTreePath.java       |   66 -
 .../taverna/t2/lang/ui/DeselectingButton.java   |   45 -
 .../sf/taverna/t2/lang/ui/DialogTextArea.java   |   83 -
 .../sf/taverna/t2/lang/ui/EdgeLineBorder.java   |   91 -
 .../sf/taverna/t2/lang/ui/EditorKeySetUtil.java |   67 -
 .../taverna/t2/lang/ui/ExtensionFileFilter.java |  105 -
 .../net/sf/taverna/t2/lang/ui/FileTools.java    |  117 --
 .../net/sf/taverna/t2/lang/ui/HtmlUtils.java    |   87 -
 .../sf/taverna/t2/lang/ui/JSplitPaneExt.java    |   56 -
 .../sf/taverna/t2/lang/ui/KeywordDocument.java  |  568 ------
 .../t2/lang/ui/LineEnabledTextPanel.java        |  106 -
 .../net/sf/taverna/t2/lang/ui/LinePainter.java  |  163 --
 .../t2/lang/ui/LineWrappingTextArea.java        |  217 ---
 .../sf/taverna/t2/lang/ui/NoWrapEditorKit.java  |   77 -
 .../sf/taverna/t2/lang/ui/ReadOnlyTextArea.java |   50 -
 .../t2/lang/ui/SanitisingDocumentFilter.java    |   60 -
 .../net/sf/taverna/t2/lang/ui/ShadedLabel.java  |  126 --
 .../net/sf/taverna/t2/lang/ui/TableMap.java     |   69 -
 .../net/sf/taverna/t2/lang/ui/TableSorter.java  |  341 ----
 .../t2/lang/ui/ValidatingUserInputDialog.java   |  274 ---
 .../net/sf/taverna/t2/lang/ui/icons/Icons.java  |   48 -
 .../lang/ui/tabselector/ScrollController.java   |   85 -
 .../sf/taverna/t2/lang/ui/tabselector/Tab.java  |  200 --
 .../t2/lang/ui/tabselector/TabLayout.java       |  135 --
 .../ui/tabselector/TabSelectorComponent.java    |   99 -
 .../lang/ui/treetable/AbstractCellEditor.java   |   81 -
 .../ui/treetable/AbstractTreeTableModel.java    |  198 --
 .../t2/lang/ui/treetable/JTreeTable.LICENSE     |   59 -
 .../t2/lang/ui/treetable/JTreeTable.java        |  657 -------
 .../t2/lang/ui/treetable/LinesBorder.java       |  178 --
 .../t2/lang/ui/treetable/TreeTableModel.java    |   69 -
 .../ui/treetable/TreeTableModelAdapter.java     |  132 --
 .../org/apache/taverna/lang/ui/CArrowImage.java |  197 ++
 .../taverna/lang/ui/CTransferableTreePath.java  |   65 +
 .../taverna/lang/ui/DeselectingButton.java      |   61 +
 .../apache/taverna/lang/ui/DialogTextArea.java  |   99 +
 .../apache/taverna/lang/ui/EdgeLineBorder.java  |   90 +
 .../taverna/lang/ui/EditorKeySetUtil.java       |   59 +
 .../taverna/lang/ui/ExtensionFileFilter.java    |   99 +
 .../org/apache/taverna/lang/ui/FileTools.java   |  133 ++
 .../org/apache/taverna/lang/ui/HtmlUtils.java   |  103 +
 .../apache/taverna/lang/ui/JSplitPaneExt.java   |   72 +
 .../apache/taverna/lang/ui/KeywordDocument.java |  566 ++++++
 .../taverna/lang/ui/LineEnabledTextPanel.java   |  122 ++
 .../org/apache/taverna/lang/ui/LinePainter.java |  182 ++
 .../taverna/lang/ui/LineWrappingTextArea.java   |  216 +++
 .../apache/taverna/lang/ui/NoWrapEditorKit.java |   93 +
 .../taverna/lang/ui/ReadOnlyTextArea.java       |   66 +
 .../lang/ui/SanitisingDocumentFilter.java       |   76 +
 .../org/apache/taverna/lang/ui/ShadedLabel.java |  120 ++
 .../org/apache/taverna/lang/ui/TableMap.java    |   66 +
 .../org/apache/taverna/lang/ui/TableSorter.java |  338 ++++
 .../lang/ui/ValidatingUserInputDialog.java      |  273 +++
 .../org/apache/taverna/lang/ui/icons/Icons.java |   47 +
 .../lang/ui/tabselector/ScrollController.java   |   84 +
 .../apache/taverna/lang/ui/tabselector/Tab.java |  199 ++
 .../taverna/lang/ui/tabselector/TabLayout.java  |  134 ++
 .../ui/tabselector/TabSelectorComponent.java    |   98 +
 .../lang/ui/treetable/AbstractCellEditor.java   |   80 +
 .../ui/treetable/AbstractTreeTableModel.java    |  198 ++
 .../lang/ui/treetable/JTreeTable.LICENSE        |   59 +
 .../taverna/lang/ui/treetable/JTreeTable.java   |  657 +++++++
 .../taverna/lang/ui/treetable/LinesBorder.java  |  178 ++
 .../lang/ui/treetable/TreeTableModel.java       |   69 +
 .../ui/treetable/TreeTableModelAdapter.java     |  132 ++
 .../net/sf/taverna/t2/lang/ui/icons/ok.png      |  Bin 3318 -> 0 bytes
 .../net/sf/taverna/t2/lang/ui/icons/severe.png  |  Bin 867 -> 0 bytes
 .../net/sf/taverna/t2/lang/ui/icons/warning.png |  Bin 3459 -> 0 bytes
 .../org/apache/taverna/lang/ui/icons/ok.png     |  Bin 0 -> 3318 bytes
 .../org/apache/taverna/lang/ui/icons/severe.png |  Bin 0 -> 867 bytes
 .../apache/taverna/lang/ui/icons/warning.png    |  Bin 0 -> 3459 bytes
 .../lang/uibuilder/AbstractListComponent.java   |  521 -----
 .../t2/lang/uibuilder/AlignableComponent.java   |   29 -
 .../sf/taverna/t2/lang/uibuilder/Alignment.java |   66 -
 .../taverna/t2/lang/uibuilder/BeanCheckBox.java |   54 -
 .../t2/lang/uibuilder/BeanComponent.java        |  420 ----
 .../t2/lang/uibuilder/BeanEnumComboBox.java     |   89 -
 .../taverna/t2/lang/uibuilder/BeanTextArea.java |   89 -
 .../t2/lang/uibuilder/BeanTextComponent.java    |  174 --
 .../t2/lang/uibuilder/BeanTextField.java        |   60 -
 .../net/sf/taverna/t2/lang/uibuilder/Icons.java |   41 -
 .../taverna/t2/lang/uibuilder/ListHandler.java  |   67 -
 .../lang/uibuilder/RecursiveListComponent.java  |   98 -
 .../sf/taverna/t2/lang/uibuilder/UIBuilder.java |  236 ---
 .../lang/uibuilder/UIConstructionException.java |   29 -
 .../t2/lang/uibuilder/WrappedListComponent.java |  105 -
 .../sf/taverna/t2/lang/uibuilder/package.html   |    4 -
 .../lang/uibuilder/AbstractListComponent.java   |  540 ++++++
 .../lang/uibuilder/AlignableComponent.java      |   48 +
 .../taverna/lang/uibuilder/Alignment.java       |   85 +
 .../taverna/lang/uibuilder/BeanCheckBox.java    |   73 +
 .../taverna/lang/uibuilder/BeanComponent.java   |  439 +++++
 .../lang/uibuilder/BeanEnumComboBox.java        |  108 ++
 .../taverna/lang/uibuilder/BeanTextArea.java    |  108 ++
 .../lang/uibuilder/BeanTextComponent.java       |  193 ++
 .../taverna/lang/uibuilder/BeanTextField.java   |   79 +
 .../apache/taverna/lang/uibuilder/Icons.java    |   60 +
 .../taverna/lang/uibuilder/ListHandler.java     |   86 +
 .../lang/uibuilder/RecursiveListComponent.java  |  117 ++
 .../taverna/lang/uibuilder/UIBuilder.java       |  255 +++
 .../lang/uibuilder/UIConstructionException.java |   48 +
 .../lang/uibuilder/WrappedListComponent.java    |  124 ++
 .../apache/taverna/lang/uibuilder/package.html  |    4 +
 .../net/sf/taverna/t2/lang/uibuilder/delete.png |  Bin 1120 -> 0 bytes
 .../net/sf/taverna/t2/lang/uibuilder/down.png   |  Bin 1077 -> 0 bytes
 .../net/sf/taverna/t2/lang/uibuilder/new.png    |  Bin 1146 -> 0 bytes
 .../net/sf/taverna/t2/lang/uibuilder/up.png     |  Bin 1074 -> 0 bytes
 .../apache/taverna/lang/uibuilder/delete.png    |  Bin 0 -> 1120 bytes
 .../org/apache/taverna/lang/uibuilder/down.png  |  Bin 0 -> 1077 bytes
 .../org/apache/taverna/lang/uibuilder/new.png   |  Bin 0 -> 1146 bytes
 .../org/apache/taverna/lang/uibuilder/up.png    |  Bin 0 -> 1074 bytes
 .../taverna/t2/lang/uibuilder/Application.java  |   48 -
 .../taverna/t2/lang/uibuilder/Application2.java |   44 -
 .../t2/lang/uibuilder/BeanWithBoundProps.java   |   74 -
 .../lang/uibuilder/BeanWithListProperties.java  |   35 -
 .../t2/lang/uibuilder/BeanWithNestedList.java   |   28 -
 .../t2/lang/uibuilder/PrimitiveTypeBean.java    |  101 -
 .../taverna/t2/lang/uibuilder/SampleEnum.java   |   13 -
 .../taverna/t2/lang/uibuilder/TopLevelBean.java |   43 -
 .../taverna/lang/uibuilder/Application.java     |   67 +
 .../taverna/lang/uibuilder/Application2.java    |   63 +
 .../lang/uibuilder/BeanWithBoundProps.java      |   93 +
 .../lang/uibuilder/BeanWithListProperties.java  |   54 +
 .../lang/uibuilder/BeanWithNestedList.java      |   47 +
 .../lang/uibuilder/PrimitiveTypeBean.java       |  120 ++
 .../taverna/lang/uibuilder/SampleEnum.java      |   32 +
 .../taverna/lang/uibuilder/TopLevelBean.java    |   62 +
 .../views/UnrecognizedActivityViewFactory.java  |   48 -
 .../views/UnrecognizedContextualView.java       |   56 -
 .../views/UnrecognizedActivityViewFactory.java  |   67 +
 .../views/UnrecognizedContextualView.java       |   72 +
 ...ntextualviews.activity.ContextualViewFactory |    1 -
 ...ntextualviews.activity.ContextualViewFactory |    1 +
 .../unrecognized-activity-ui-context-osgi.xml   |    4 +-
 .../spring/unrecognized-activity-ui-context.xml |    2 +-
 .../update/impl/UpdateManagerView.java          |   45 -
 .../update/impl/menu/UpdateMenuAction.java      |   92 -
 .../updatemanager/PluginMenuAction.java         |   52 -
 .../UpdatesAvailableMenuAction.java             |   19 -
 .../updatemanager/UpdatesToolbarSection.java    |   16 -
 .../update/impl/UpdateManagerView.java          |   44 +
 .../update/impl/menu/UpdateMenuAction.java      |   91 +
 .../updatemanager/PluginMenuAction.java         |   71 +
 .../UpdatesAvailableMenuAction.java             |   38 +
 .../updatemanager/UpdatesToolbarSection.java    |   35 +
 .../META-INF/spring/update-manager-context.xml  |    2 +-
 .../net/sf/taverna/t2/workbench/MainWindow.java |   16 -
 .../taverna/t2/workbench/ModelMapConstants.java |   28 -
 .../sf/taverna/t2/workbench/ShutdownSPI.java    |   72 -
 .../net/sf/taverna/t2/workbench/StartupSPI.java |   65 -
 .../t2/workbench/icons/WorkbenchIcons.java      |  214 ---
 .../ui/SwingWorkerCompletionWaiter.java         |   33 -
 .../sf/taverna/t2/workbench/ui/Updatable.java   |   32 -
 .../net/sf/taverna/t2/workbench/ui/Utils.java   |   20 -
 .../sf/taverna/t2/workbench/ui/Workbench.java   |   33 -
 .../t2/workbench/ui/zaria/PerspectiveSPI.java   |   77 -
 .../ui/zaria/UIComponentFactorySPI.java         |   56 -
 .../t2/workbench/ui/zaria/UIComponentSPI.java   |   56 -
 .../apache/taverna/workbench/MainWindow.java    |   35 +
 .../taverna/workbench/ModelMapConstants.java    |   27 +
 .../apache/taverna/workbench/ShutdownSPI.java   |   71 +
 .../apache/taverna/workbench/StartupSPI.java    |   64 +
 .../taverna/workbench/icons/WorkbenchIcons.java |  213 ++
 .../ui/SwingWorkerCompletionWaiter.java         |   49 +
 .../apache/taverna/workbench/ui/Updatable.java  |   31 +
 .../org/apache/taverna/workbench/ui/Utils.java  |   39 +
 .../apache/taverna/workbench/ui/Workbench.java  |   32 +
 .../workbench/ui/zaria/PerspectiveSPI.java      |   76 +
 .../ui/zaria/UIComponentFactorySPI.java         |   55 +
 .../workbench/ui/zaria/UIComponentSPI.java      |   50 +
 .../t2/workbench/icons/explorer/biomoby.png     |  Bin 1218 -> 0 bytes
 .../t2/workbench/icons/explorer/constraint.gif  |  Bin 144 -> 0 bytes
 .../t2/workbench/icons/explorer/dataflow.png    |  Bin 814 -> 0 bytes
 .../t2/workbench/icons/explorer/datalink.gif    |  Bin 124 -> 0 bytes
 .../t2/workbench/icons/explorer/input.png       |  Bin 396 -> 0 bytes
 .../t2/workbench/icons/explorer/inputport.png   |  Bin 251 -> 0 bytes
 .../t2/workbench/icons/explorer/localworker.png |  Bin 706 -> 0 bytes
 .../t2/workbench/icons/explorer/merge.png       |  Bin 422 -> 0 bytes
 .../t2/workbench/icons/explorer/output.png      |  Bin 425 -> 0 bytes
 .../t2/workbench/icons/explorer/outputport.png  |  Bin 235 -> 0 bytes
 .../t2/workbench/icons/explorer/rserv.png       |  Bin 1235 -> 0 bytes
 .../t2/workbench/icons/explorer/seqhound.png    |  Bin 3603 -> 0 bytes
 .../t2/workbench/icons/explorer/soaplab.png     |  Bin 701 -> 0 bytes
 .../workbench/icons/explorer/stringconstant.png |  Bin 733 -> 0 bytes
 .../t2/workbench/icons/explorer/talisman.png    |  Bin 1214 -> 0 bytes
 .../icons/explorer/unknownprocessor.png         |  Bin 1060 -> 0 bytes
 .../icons/explorer/workflow-explorer-old.png    |  Bin 255 -> 0 bytes
 .../icons/explorer/workflow-explorer.png        |  Bin 267 -> 0 bytes
 .../t2/workbench/icons/explorer/workflow.png    |  Bin 1213 -> 0 bytes
 .../icons/explorer/workflowInputPort.png        |  Bin 718 -> 0 bytes
 .../icons/explorer/workflowOutputPort.png       |  Bin 636 -> 0 bytes
 .../t2/workbench/icons/explorer/wsdl.png        |  Bin 748 -> 0 bytes
 .../taverna/t2/workbench/icons/generic/bin.png  |  Bin 393 -> 0 bytes
 .../t2/workbench/icons/generic/break.gif        |  Bin 1120 -> 0 bytes
 .../t2/workbench/icons/generic/close.gif        |  Bin 351 -> 0 bytes
 .../t2/workbench/icons/generic/closeAll.gif     |  Bin 380 -> 0 bytes
 .../t2/workbench/icons/generic/configure.png    |  Bin 610 -> 0 bytes
 .../taverna/t2/workbench/icons/generic/copy.png |  Bin 389 -> 0 bytes
 .../taverna/t2/workbench/icons/generic/cut.png  |  Bin 710 -> 0 bytes
 .../t2/workbench/icons/generic/database.gif     |  Bin 1032 -> 0 bytes
 .../t2/workbench/icons/generic/delete.png       |  Bin 565 -> 0 bytes
 .../t2/workbench/icons/generic/down-arrow.png   |  Bin 331 -> 0 bytes
 .../taverna/t2/workbench/icons/generic/edit.gif |  Bin 579 -> 0 bytes
 .../t2/workbench/icons/generic/fileimport.png   |  Bin 851 -> 0 bytes
 .../taverna/t2/workbench/icons/generic/find.gif |  Bin 346 -> 0 bytes
 .../workbench/icons/generic/folder-closed.png   |  Bin 621 -> 0 bytes
 .../t2/workbench/icons/generic/folder-open.png  |  Bin 626 -> 0 bytes
 .../t2/workbench/icons/generic/greentick.png    |  Bin 331 -> 0 bytes
 .../t2/workbench/icons/generic/import.gif       |  Bin 929 -> 0 bytes
 .../t2/workbench/icons/generic/inputValue.gif   |  Bin 561 -> 0 bytes
 .../t2/workbench/icons/generic/janus.png        |  Bin 395 -> 0 bytes
 .../taverna/t2/workbench/icons/generic/leaf.gif |  Bin 194 -> 0 bytes
 .../t2/workbench/icons/generic/minus.png        |  Bin 214 -> 0 bytes
 .../t2/workbench/icons/generic/newinput.gif     |  Bin 357 -> 0 bytes
 .../t2/workbench/icons/generic/newlist.gif      |  Bin 350 -> 0 bytes
 .../t2/workbench/icons/generic/normalize.png    |  Bin 580 -> 0 bytes
 .../taverna/t2/workbench/icons/generic/open.gif |  Bin 216 -> 0 bytes
 .../t2/workbench/icons/generic/openmenu.gif     |  Bin 251 -> 0 bytes
 .../t2/workbench/icons/generic/openurl.gif      |  Bin 362 -> 0 bytes
 .../t2/workbench/icons/generic/opmIcon.png      |  Bin 376 -> 0 bytes
 .../t2/workbench/icons/generic/paste.png        |  Bin 490 -> 0 bytes
 .../t2/workbench/icons/generic/pause.png        |  Bin 385 -> 0 bytes
 .../taverna/t2/workbench/icons/generic/play.png |  Bin 341 -> 0 bytes
 .../taverna/t2/workbench/icons/generic/plus.png |  Bin 345 -> 0 bytes
 .../t2/workbench/icons/generic/rbreak.gif       |  Bin 1161 -> 0 bytes
 .../taverna/t2/workbench/icons/generic/redo.png |  Bin 513 -> 0 bytes
 .../t2/workbench/icons/generic/refresh.gif      |  Bin 336 -> 0 bytes
 .../t2/workbench/icons/generic/rename.png       |  Bin 212 -> 0 bytes
 .../icons/generic/results-perspective.png       |  Bin 542 -> 0 bytes
 .../taverna/t2/workbench/icons/generic/run.gif  |  Bin 318 -> 0 bytes
 .../taverna/t2/workbench/icons/generic/save.gif |  Bin 639 -> 0 bytes
 .../taverna/t2/workbench/icons/generic/save.png |  Bin 631 -> 0 bytes
 .../t2/workbench/icons/generic/saveAll.png      |  Bin 624 -> 0 bytes
 .../t2/workbench/icons/generic/saveAs.png       |  Bin 529 -> 0 bytes
 .../t2/workbench/icons/generic/savemenu.gif     |  Bin 661 -> 0 bytes
 .../t2/workbench/icons/generic/savepng.gif      |  Bin 988 -> 0 bytes
 .../t2/workbench/icons/generic/search.png       |  Bin 1023 -> 0 bytes
 .../taverna/t2/workbench/icons/generic/stop.gif |  Bin 268 -> 0 bytes
 .../taverna-wheel-message-dialog-error-icon.png |  Bin 11424 -> 0 bytes
 .../taverna-wheel-message-dialog-info-icon.png  |  Bin 11383 -> 0 bytes
 ...verna-wheel-message-dialog-question-icon.png |  Bin 11312 -> 0 bytes
 ...averna-wheel-message-dialog-warning-icon.png |  Bin 11254 -> 0 bytes
 .../icons/generic/taverna_cogs_32x32.png        |  Bin 3094 -> 0 bytes
 .../icons/generic/taverna_cogs_64x64.png        |  Bin 11014 -> 0 bytes
 .../taverna/t2/workbench/icons/generic/tick.png |  Bin 537 -> 0 bytes
 .../taverna/t2/workbench/icons/generic/undo.png |  Bin 548 -> 0 bytes
 .../t2/workbench/icons/generic/uninstall.png    |  Bin 639 -> 0 bytes
 .../t2/workbench/icons/generic/untick.png       |  Bin 664 -> 0 bytes
 .../t2/workbench/icons/generic/up-arrow.png     |  Bin 300 -> 0 bytes
 .../t2/workbench/icons/generic/update.png       |  Bin 689 -> 0 bytes
 .../icons/generic/updateRecommended.png         |  Bin 731 -> 0 bytes
 .../t2/workbench/icons/generic/urlimport.png    |  Bin 969 -> 0 bytes
 .../taverna/t2/workbench/icons/generic/web.gif  |  Bin 362 -> 0 bytes
 .../workbench/icons/generic/workflowResults.png |  Bin 736 -> 0 bytes
 .../t2/workbench/icons/generic/working.gif      |  Bin 673 -> 0 bytes
 .../workbench/icons/generic/workingStopped.png  |  Bin 258 -> 0 bytes
 .../t2/workbench/icons/generic/xml_node.gif     |  Bin 82 -> 0 bytes
 .../taverna/t2/workbench/icons/generic/zoom.gif |  Bin 545 -> 0 bytes
 .../t2/workbench/icons/generic/zoomin.gif       |   78 -
 .../t2/workbench/icons/generic/zoomin.png       |  Bin 659 -> 0 bytes
 .../t2/workbench/icons/generic/zoomout.png      |  Bin 607 -> 0 bytes
 .../t2/workbench/icons/graph/allport.png        |  Bin 652 -> 0 bytes
 .../t2/workbench/icons/graph/allport.svg        |  124 --
 .../taverna/t2/workbench/icons/graph/blob.png   |  Bin 468 -> 0 bytes
 .../taverna/t2/workbench/icons/graph/blob.svg   |   72 -
 .../t2/workbench/icons/graph/expandnested.png   |  Bin 718 -> 0 bytes
 .../t2/workbench/icons/graph/expandnested.svg   |  130 --
 .../t2/workbench/icons/graph/horizontal.png     |  Bin 380 -> 0 bytes
 .../t2/workbench/icons/graph/horizontal.svg     |  152 --
 .../taverna/t2/workbench/icons/graph/noport.png |  Bin 482 -> 0 bytes
 .../taverna/t2/workbench/icons/graph/noport.svg |   82 -
 .../t2/workbench/icons/graph/saveAsDOT.png      |  Bin 1105 -> 0 bytes
 .../t2/workbench/icons/graph/saveAsPNG.png      |  Bin 1337 -> 0 bytes
 .../t2/workbench/icons/graph/saveAsPS.png       |  Bin 1019 -> 0 bytes
 .../t2/workbench/icons/graph/saveAsPS2.png      |  Bin 1018 -> 0 bytes
 .../t2/workbench/icons/graph/saveAsSVG.png      |  Bin 1416 -> 0 bytes
 .../taverna/t2/workbench/icons/graph/trash.png  |  Bin 482 -> 0 bytes
 .../t2/workbench/icons/graph/vertical.png       |  Bin 383 -> 0 bytes
 .../t2/workbench/icons/graph/vertical.svg       |  150 --
 .../workbench/icons/explorer/biomoby.png        |  Bin 0 -> 1218 bytes
 .../workbench/icons/explorer/constraint.gif     |  Bin 0 -> 144 bytes
 .../workbench/icons/explorer/dataflow.png       |  Bin 0 -> 814 bytes
 .../workbench/icons/explorer/datalink.gif       |  Bin 0 -> 124 bytes
 .../taverna/workbench/icons/explorer/input.png  |  Bin 0 -> 396 bytes
 .../workbench/icons/explorer/inputport.png      |  Bin 0 -> 251 bytes
 .../workbench/icons/explorer/localworker.png    |  Bin 0 -> 706 bytes
 .../taverna/workbench/icons/explorer/merge.png  |  Bin 0 -> 422 bytes
 .../taverna/workbench/icons/explorer/output.png |  Bin 0 -> 425 bytes
 .../workbench/icons/explorer/outputport.png     |  Bin 0 -> 235 bytes
 .../taverna/workbench/icons/explorer/rserv.png  |  Bin 0 -> 1235 bytes
 .../workbench/icons/explorer/seqhound.png       |  Bin 0 -> 3603 bytes
 .../workbench/icons/explorer/soaplab.png        |  Bin 0 -> 701 bytes
 .../workbench/icons/explorer/stringconstant.png |  Bin 0 -> 733 bytes
 .../workbench/icons/explorer/talisman.png       |  Bin 0 -> 1214 bytes
 .../icons/explorer/unknownprocessor.png         |  Bin 0 -> 1060 bytes
 .../icons/explorer/workflow-explorer-old.png    |  Bin 0 -> 255 bytes
 .../icons/explorer/workflow-explorer.png        |  Bin 0 -> 267 bytes
 .../workbench/icons/explorer/workflow.png       |  Bin 0 -> 1213 bytes
 .../icons/explorer/workflowInputPort.png        |  Bin 0 -> 718 bytes
 .../icons/explorer/workflowOutputPort.png       |  Bin 0 -> 636 bytes
 .../taverna/workbench/icons/explorer/wsdl.png   |  Bin 0 -> 748 bytes
 .../taverna/workbench/icons/generic/bin.png     |  Bin 0 -> 393 bytes
 .../taverna/workbench/icons/generic/break.gif   |  Bin 0 -> 1120 bytes
 .../taverna/workbench/icons/generic/close.gif   |  Bin 0 -> 351 bytes
 .../workbench/icons/generic/closeAll.gif        |  Bin 0 -> 380 bytes
 .../workbench/icons/generic/configure.png       |  Bin 0 -> 610 bytes
 .../taverna/workbench/icons/generic/copy.png    |  Bin 0 -> 389 bytes
 .../taverna/workbench/icons/generic/cut.png     |  Bin 0 -> 710 bytes
 .../workbench/icons/generic/database.gif        |  Bin 0 -> 1032 bytes
 .../taverna/workbench/icons/generic/delete.png  |  Bin 0 -> 565 bytes
 .../workbench/icons/generic/down-arrow.png      |  Bin 0 -> 331 bytes
 .../taverna/workbench/icons/generic/edit.gif    |  Bin 0 -> 579 bytes
 .../workbench/icons/generic/fileimport.png      |  Bin 0 -> 851 bytes
 .../taverna/workbench/icons/generic/find.gif    |  Bin 0 -> 346 bytes
 .../workbench/icons/generic/folder-closed.png   |  Bin 0 -> 621 bytes
 .../workbench/icons/generic/folder-open.png     |  Bin 0 -> 626 bytes
 .../workbench/icons/generic/greentick.png       |  Bin 0 -> 331 bytes
 .../taverna/workbench/icons/generic/import.gif  |  Bin 0 -> 929 bytes
 .../workbench/icons/generic/inputValue.gif      |  Bin 0 -> 561 bytes
 .../taverna/workbench/icons/generic/janus.png   |  Bin 0 -> 395 bytes
 .../taverna/workbench/icons/generic/leaf.gif    |  Bin 0 -> 194 bytes
 .../taverna/workbench/icons/generic/minus.png   |  Bin 0 -> 214 bytes
 .../workbench/icons/generic/newinput.gif        |  Bin 0 -> 357 bytes
 .../taverna/workbench/icons/generic/newlist.gif |  Bin 0 -> 350 bytes
 .../workbench/icons/generic/normalize.png       |  Bin 0 -> 580 bytes
 .../taverna/workbench/icons/generic/open.gif    |  Bin 0 -> 216 bytes
 .../workbench/icons/generic/openmenu.gif        |  Bin 0 -> 251 bytes
 .../taverna/workbench/icons/generic/openurl.gif |  Bin 0 -> 362 bytes
 .../taverna/workbench/icons/generic/opmIcon.png |  Bin 0 -> 376 bytes
 .../taverna/workbench/icons/generic/paste.png   |  Bin 0 -> 490 bytes
 .../taverna/workbench/icons/generic/pause.png   |  Bin 0 -> 385 bytes
 .../taverna/workbench/icons/generic/play.png    |  Bin 0 -> 341 bytes
 .../taverna/workbench/icons/generic/plus.png    |  Bin 0 -> 345 bytes
 .../taverna/workbench/icons/generic/rbreak.gif  |  Bin 0 -> 1161 bytes
 .../taverna/workbench/icons/generic/redo.png    |  Bin 0 -> 513 bytes
 .../taverna/workbench/icons/generic/refresh.gif |  Bin 0 -> 336 bytes
 .../taverna/workbench/icons/generic/rename.png  |  Bin 0 -> 212 bytes
 .../icons/generic/results-perspective.png       |  Bin 0 -> 542 bytes
 .../taverna/workbench/icons/generic/run.gif     |  Bin 0 -> 318 bytes
 .../taverna/workbench/icons/generic/save.gif    |  Bin 0 -> 639 bytes
 .../taverna/workbench/icons/generic/save.png    |  Bin 0 -> 631 bytes
 .../taverna/workbench/icons/generic/saveAll.png |  Bin 0 -> 624 bytes
 .../taverna/workbench/icons/generic/saveAs.png  |  Bin 0 -> 529 bytes
 .../workbench/icons/generic/savemenu.gif        |  Bin 0 -> 661 bytes
 .../taverna/workbench/icons/generic/savepng.gif |  Bin 0 -> 988 bytes
 .../taverna/workbench/icons/generic/search.png  |  Bin 0 -> 1023 bytes
 .../taverna/workbench/icons/generic/stop.gif    |  Bin 0 -> 268 bytes
 .../taverna-wheel-message-dialog-error-icon.png |  Bin 0 -> 11424 bytes
 .../taverna-wheel-message-dialog-info-icon.png  |  Bin 0 -> 11383 bytes
 ...verna-wheel-message-dialog-question-icon.png |  Bin 0 -> 11312 bytes
 ...averna-wheel-message-dialog-warning-icon.png |  Bin 0 -> 11254 bytes
 .../icons/generic/taverna_cogs_32x32.png        |  Bin 0 -> 3094 bytes
 .../icons/generic/taverna_cogs_64x64.png        |  Bin 0 -> 11014 bytes
 .../taverna/workbench/icons/generic/tick.png    |  Bin 0 -> 537 bytes
 .../taverna/workbench/icons/generic/undo.png    |  Bin 0 -> 548 bytes
 .../workbench/icons/generic/uninstall.png       |  Bin 0 -> 639 bytes
 .../taverna/workbench/icons/generic/untick.png  |  Bin 0 -> 664 bytes
 .../workbench/icons/generic/up-arrow.png        |  Bin 0 -> 300 bytes
 .../taverna/workbench/icons/generic/update.png  |  Bin 0 -> 689 bytes
 .../icons/generic/updateRecommended.png         |  Bin 0 -> 731 bytes
 .../workbench/icons/generic/urlimport.png       |  Bin 0 -> 969 bytes
 .../taverna/workbench/icons/generic/web.gif     |  Bin 0 -> 362 bytes
 .../workbench/icons/generic/workflowResults.png |  Bin 0 -> 736 bytes
 .../taverna/workbench/icons/generic/working.gif |  Bin 0 -> 673 bytes
 .../workbench/icons/generic/workingStopped.png  |  Bin 0 -> 258 bytes
 .../workbench/icons/generic/xml_node.gif        |  Bin 0 -> 82 bytes
 .../taverna/workbench/icons/generic/zoom.gif    |  Bin 0 -> 545 bytes
 .../taverna/workbench/icons/generic/zoomin.gif  |   78 +
 .../taverna/workbench/icons/generic/zoomin.png  |  Bin 0 -> 659 bytes
 .../taverna/workbench/icons/generic/zoomout.png |  Bin 0 -> 607 bytes
 .../taverna/workbench/icons/graph/allport.png   |  Bin 0 -> 652 bytes
 .../taverna/workbench/icons/graph/allport.svg   |  124 ++
 .../taverna/workbench/icons/graph/blob.png      |  Bin 0 -> 468 bytes
 .../taverna/workbench/icons/graph/blob.svg      |   72 +
 .../workbench/icons/graph/expandnested.png      |  Bin 0 -> 718 bytes
 .../workbench/icons/graph/expandnested.svg      |  130 ++
 .../workbench/icons/graph/horizontal.png        |  Bin 0 -> 380 bytes
 .../workbench/icons/graph/horizontal.svg        |  152 ++
 .../taverna/workbench/icons/graph/noport.png    |  Bin 0 -> 482 bytes
 .../taverna/workbench/icons/graph/noport.svg    |   82 +
 .../taverna/workbench/icons/graph/saveAsDOT.png |  Bin 0 -> 1105 bytes
 .../taverna/workbench/icons/graph/saveAsPNG.png |  Bin 0 -> 1337 bytes
 .../taverna/workbench/icons/graph/saveAsPS.png  |  Bin 0 -> 1019 bytes
 .../taverna/workbench/icons/graph/saveAsPS2.png |  Bin 0 -> 1018 bytes
 .../taverna/workbench/icons/graph/saveAsSVG.png |  Bin 0 -> 1416 bytes
 .../taverna/workbench/icons/graph/trash.png     |  Bin 0 -> 482 bytes
 .../taverna/workbench/icons/graph/vertical.png  |  Bin 0 -> 383 bytes
 .../taverna/workbench/icons/graph/vertical.svg  |  150 ++
 .../ui/impl/DataflowEditsListener.java          |   93 -
 .../t2/workbench/ui/impl/LoggerStream.java      |  136 --
 .../ui/impl/SetConsoleLoggerStartup.java        |   62 -
 .../ui/impl/StoreWindowStateOnShutdown.java     |   58 -
 .../workbench/ui/impl/UserRegistrationData.java |  105 -
 .../workbench/ui/impl/UserRegistrationForm.java |  995 ----------
 .../workbench/ui/impl/UserRegistrationHook.java |  163 --
 .../t2/workbench/ui/impl/WorkbenchImpl.java     |  538 ------
 .../ui/impl/WorkbenchPerspectives.java          |  229 ---
 .../t2/workbench/ui/impl/menu/ExitAction.java   |   66 -
 .../ui/impl/DataflowEditsListener.java          |  112 ++
 .../taverna/workbench/ui/impl/LoggerStream.java |  136 ++
 .../ui/impl/SetConsoleLoggerStartup.java        |   81 +
 .../ui/impl/StoreWindowStateOnShutdown.java     |   57 +
 .../workbench/ui/impl/UserRegistrationData.java |  104 +
 .../workbench/ui/impl/UserRegistrationForm.java |  994 ++++++++++
 .../workbench/ui/impl/UserRegistrationHook.java |  162 ++
 .../workbench/ui/impl/WorkbenchImpl.java        |  537 ++++++
 .../ui/impl/WorkbenchPerspectives.java          |  228 +++
 .../workbench/ui/impl/menu/ExitAction.java      |   65 +
 .../net.sf.taverna.raven.launcher.Launchable    |    1 -
 .../net.sf.taverna.t2.ui.menu.MenuComponent     |   18 -
 .../net.sf.taverna.t2.workbench.ShutdownSPI     |    1 -
 .../net.sf.taverna.t2.workbench.StartupSPI      |    2 -
 ...org.apache.taverna.raven.launcher.Launchable |    1 +
 .../org.apache.taverna.ui.menu.MenuComponent    |   17 +
 .../org.apache.taverna.workbench.ShutdownSPI    |    1 +
 .../org.apache.taverna.workbench.StartupSPI     |    2 +
 .../spring/workbench-impl-context-osgi.xml      |   26 +-
 .../META-INF/spring/workbench-impl-context.xml  |   16 +-
 .../workbench/ui/impl/UserRegistrationTest.java |  190 --
 .../workbench/ui/impl/UserRegistrationTest.java |  189 ++
 .../ui/workflowexplorer/WorkflowExplorer.java   |  824 --------
 .../WorkflowExplorerFactory.java                |   95 -
 .../WorkflowExplorerTreeCellRenderer.java       |  216 ---
 .../WorkflowExplorerTreeModel.java              |  404 ----
 .../WorkflowExplorerTreeSelectionModel.java     |   45 -
 .../ui/workflowexplorer/WorkflowExplorer.java   |  822 ++++++++
 .../WorkflowExplorerFactory.java                |   94 +
 .../WorkflowExplorerTreeCellRenderer.java       |  214 +++
 .../WorkflowExplorerTreeModel.java              |  403 ++++
 .../WorkflowExplorerTreeSelectionModel.java     |   44 +
 ....t2.workbench.ui.zaria.UIComponentFactorySPI |    1 -
 ...taverna.t2.workbench.ui.zaria.UIComponentSPI |    1 -
 ...rna.workbench.ui.zaria.UIComponentFactorySPI |    1 +
 ...he.taverna.workbench.ui.zaria.UIComponentSPI |    1 +
 .../spring/workflow-explorer-context-osgi.xml   |   14 +-
 .../spring/workflow-explorer-context.xml        |    2 +-
 .../ui/actions/CopyGraphComponentAction.java    |  143 --
 .../ui/actions/CopyProcessorAction.java         |   53 -
 .../ui/actions/CutGraphComponentAction.java     |  153 --
 .../ui/actions/CutProcessorAction.java          |   69 -
 .../ui/actions/PasteGraphComponentAction.java   |   98 -
 .../ui/dndhandler/ServiceTransferHandler.java   |  119 --
 .../ui/menu/CopyGraphComponentMenuAction.java   |   54 -
 .../ui/menu/CopyProcessorMenuAction.java        |   56 -
 .../ui/menu/CutGraphComponentMenuAction.java    |   60 -
 .../ui/menu/CutProcessorMenuAction.java         |   69 -
 .../ui/menu/PasteGraphComponentMenuAction.java  |   73 -
 .../workbench/ui/toolbar/CopyToolbarAction.java |   51 -
 .../workbench/ui/toolbar/CutToolbarAction.java  |   57 -
 .../ui/toolbar/PasteToolbarAction.java          |   70 -
 .../ui/workflowview/ShowExceptionRunnable.java  |   26 -
 .../workbench/ui/workflowview/WorkflowView.java |  414 ----
 .../ui/actions/CopyGraphComponentAction.java    |  142 ++
 .../ui/actions/CopyProcessorAction.java         |   52 +
 .../ui/actions/CutGraphComponentAction.java     |  152 ++
 .../ui/actions/CutProcessorAction.java          |   68 +
 .../ui/actions/PasteGraphComponentAction.java   |   97 +
 .../ui/dndhandler/ServiceTransferHandler.java   |  118 ++
 .../ui/menu/CopyGraphComponentMenuAction.java   |   53 +
 .../ui/menu/CopyProcessorMenuAction.java        |   55 +
 .../ui/menu/CutGraphComponentMenuAction.java    |   59 +
 .../ui/menu/CutProcessorMenuAction.java         |   68 +
 .../ui/menu/PasteGraphComponentMenuAction.java  |   72 +
 .../workbench/ui/toolbar/CopyToolbarAction.java |   50 +
 .../workbench/ui/toolbar/CutToolbarAction.java  |   56 +
 .../ui/toolbar/PasteToolbarAction.java          |   69 +
 .../ui/workflowview/ShowExceptionRunnable.java  |   42 +
 .../workbench/ui/workflowview/WorkflowView.java |  433 +++++
 .../net.sf.taverna.t2.ui.menu.MenuComponent     |   10 -
 .../org.apache.taverna.ui.menu.MenuComponent    |   10 +
 .../spring/workflow-view-context-osgi.xml       |    6 +-
 .../META-INF/spring/workflow-view-context.xml   |   16 +-
 2287 files changed, 123952 insertions(+), 122524 deletions(-)
----------------------------------------------------------------------



[09/51] [partial] incubator-taverna-workbench git commit: all packages are moved to org.apache.taverna.*

Posted by re...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-iteration-strategy-ui/src/main/java/net/sf/taverna/t2/workbench/iterationstrategy/contextview/IterationStrategyConfigurationDialog.java
----------------------------------------------------------------------
diff --git a/taverna-iteration-strategy-ui/src/main/java/net/sf/taverna/t2/workbench/iterationstrategy/contextview/IterationStrategyConfigurationDialog.java b/taverna-iteration-strategy-ui/src/main/java/net/sf/taverna/t2/workbench/iterationstrategy/contextview/IterationStrategyConfigurationDialog.java
deleted file mode 100644
index cd87e58..0000000
--- a/taverna-iteration-strategy-ui/src/main/java/net/sf/taverna/t2/workbench/iterationstrategy/contextview/IterationStrategyConfigurationDialog.java
+++ /dev/null
@@ -1,148 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.workbench.iterationstrategy.contextview;
-
-import java.awt.BorderLayout;
-import java.awt.Dimension;
-import java.awt.FlowLayout;
-import java.awt.Frame;
-import java.awt.event.ActionEvent;
-
-import javax.swing.AbstractAction;
-import javax.swing.JButton;
-import javax.swing.JDialog;
-import javax.swing.JOptionPane;
-import javax.swing.JPanel;
-
-import net.sf.taverna.t2.workbench.edits.EditManager;
-import net.sf.taverna.t2.workbench.file.FileManager;
-import net.sf.taverna.t2.workbench.helper.HelpEnabledDialog;
-import net.sf.taverna.t2.workbench.iterationstrategy.editor.IterationStrategyEditorControl;
-import org.apache.taverna.workflowmodel.Edit;
-import org.apache.taverna.workflowmodel.EditException;
-import org.apache.taverna.workflowmodel.Edits;
-import org.apache.taverna.workflowmodel.Processor;
-import org.apache.taverna.workflowmodel.processor.iteration.IterationStrategy;
-import org.apache.taverna.workflowmodel.processor.iteration.IterationStrategyStack;
-
-import org.apache.log4j.Logger;
-
-/**
- * @author alanrw
- *
- */
-@SuppressWarnings("serial")
-public class IterationStrategyConfigurationDialog extends HelpEnabledDialog {
-
-	private static Logger logger = Logger
-	.getLogger(IterationStrategyConfigurationDialog.class);
-
-	private final EditManager editManager;
-	private final FileManager fileManager;
-
-
-	private final Frame owner;
-	private final Processor processor;
-	private final IterationStrategyStack originalStack;
-
-	private IterationStrategyStack workingStack;
-
-	public IterationStrategyConfigurationDialog(Frame owner, Processor processor, IterationStrategyStack iStack, EditManager editManager, FileManager fileManager) {
-		super (owner, "List handling for " + processor.getLocalName(), true, null);
-		this.owner = owner;
-		this.processor = processor;
-		this.originalStack = iStack;
-		this.editManager = editManager;
-		this.fileManager = fileManager;
-		this.workingStack = IterationStrategyContextualView.copyIterationStrategyStack(originalStack);
-		IterationStrategy iterationStrategy = IterationStrategyContextualView.getIterationStrategy(workingStack);
-		IterationStrategyEditorControl iterationStrategyEditorControl = new IterationStrategyEditorControl(
-				iterationStrategy);
-		this.add(iterationStrategyEditorControl, BorderLayout.CENTER);
-
-		JPanel buttonPanel = new JPanel();
-		buttonPanel.setLayout(new FlowLayout());
-
-		JButton okButton = new JButton(new OKAction(this));
-		buttonPanel.add(okButton);
-
-		JButton resetButton = new JButton(new ResetAction(
-				iterationStrategyEditorControl));
-		buttonPanel.add(resetButton);
-
-		JButton cancelButton = new JButton(new CancelAction(this));
-		buttonPanel.add(cancelButton);
-
-		this.add(buttonPanel, BorderLayout.SOUTH);
-		this.pack();
-		this.setSize(new Dimension(getPreferredSize().width, getPreferredSize().height > 400 ? 400 : getPreferredSize().height));
-	}
-
-	private final class OKAction extends AbstractAction {
-		private final JDialog dialog;
-
-		private OKAction(JDialog dialog) {
-			super("OK");
-			this.dialog = dialog;
-		}
-
-		public void actionPerformed(ActionEvent e) {
-			Edits edits = editManager.getEdits();
-			try {
-				Edit<?> edit = edits.getSetIterationStrategyStackEdit(
-						processor,
-						IterationStrategyContextualView.copyIterationStrategyStack(workingStack));
-				editManager.doDataflowEdit(
-						fileManager.getCurrentDataflow(), edit);
-				dialog.setVisible(false);
-			} catch (RuntimeException ex) {
-				logger.warn("Could not set list handling", ex);
-				JOptionPane.showMessageDialog(owner,
-						"Can't set list handling",
-						"An error occured when setting list handling: "
-								+ ex.getMessage(),
-						JOptionPane.ERROR_MESSAGE);
-			} catch (EditException ex) {
-				logger.warn("Could not set list handling", ex);
-				JOptionPane.showMessageDialog(owner,
-						"Can't set list handling",
-						"An error occured when setting list handling: "
-								+ ex.getMessage(),
-						JOptionPane.ERROR_MESSAGE);
-			}
-		}
-	}
-
-	private final class ResetAction extends AbstractAction {
-		private final IterationStrategyEditorControl strategyEditorControl;
-
-		private ResetAction(
-				IterationStrategyEditorControl strategyEditorControl) {
-			super("Reset");
-			this.strategyEditorControl = strategyEditorControl;
-		}
-
-		public void actionPerformed(ActionEvent e) {
-			workingStack = IterationStrategyContextualView.copyIterationStrategyStack(originalStack);
-			strategyEditorControl
-					.setIterationStrategy(IterationStrategyContextualView.getIterationStrategy(workingStack));
-		}
-
-	}
-
-	private final class CancelAction extends AbstractAction {
-		private final JDialog dialog;
-
-		private CancelAction(JDialog dialog) {
-			super("Cancel");
-			this.dialog = dialog;
-		}
-
-		public void actionPerformed(ActionEvent e) {
-			dialog.setVisible(false);
-		}
-
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-iteration-strategy-ui/src/main/java/net/sf/taverna/t2/workbench/iterationstrategy/contextview/IterationStrategyContextualView.java
----------------------------------------------------------------------
diff --git a/taverna-iteration-strategy-ui/src/main/java/net/sf/taverna/t2/workbench/iterationstrategy/contextview/IterationStrategyContextualView.java b/taverna-iteration-strategy-ui/src/main/java/net/sf/taverna/t2/workbench/iterationstrategy/contextview/IterationStrategyContextualView.java
deleted file mode 100644
index 4b0b602..0000000
--- a/taverna-iteration-strategy-ui/src/main/java/net/sf/taverna/t2/workbench/iterationstrategy/contextview/IterationStrategyContextualView.java
+++ /dev/null
@@ -1,231 +0,0 @@
-/*******************************************************************************
- * 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.iterationstrategy.contextview;
-
-import java.awt.Frame;
-import java.awt.event.ActionEvent;
-import java.util.List;
-
-import javax.swing.AbstractAction;
-import javax.swing.Action;
-import javax.swing.JComponent;
-
-import net.sf.taverna.t2.workbench.edits.EditManager;
-import net.sf.taverna.t2.workbench.file.FileManager;
-import net.sf.taverna.t2.workbench.helper.HelpEnabledDialog;
-import net.sf.taverna.t2.workbench.iterationstrategy.editor.IterationStrategyTree;
-import net.sf.taverna.t2.workbench.ui.views.contextualviews.ContextualView;
-import org.apache.taverna.workflowmodel.Processor;
-import org.apache.taverna.workflowmodel.processor.iteration.IterationStrategy;
-import org.apache.taverna.workflowmodel.processor.iteration.IterationStrategyStack;
-import org.apache.taverna.workflowmodel.processor.iteration.impl.IterationStrategyImpl;
-import org.apache.taverna.workflowmodel.processor.iteration.impl.IterationStrategyStackImpl;
-
-import org.apache.log4j.Logger;
-import org.jdom.Content;
-import org.jdom.Element;
-import org.jdom.filter.ElementFilter;
-
-/**
- * Contextual view of an {@link IterationStrategyStack}.
- *
- * @author Stian Soiland-Reyes
- *
- */
-public class IterationStrategyContextualView extends ContextualView {
-
-	private static Logger logger = Logger
-			.getLogger(IterationStrategyContextualView.class);
-
-	private EditManager editManager;
-
-	private FileManager fileManager;
-
-	private IterationStrategyStack iterationStack;
-
-	private final Processor processor;
-
-	private IterationStrategyTree strategyTree = new IterationStrategyTree();
-
-	static {
-
-// This should be enabled and modified for T2-822
-/*		editManager.addObserver(new Observer<EditManagerEvent> () {
-
-			private void examineEdit(Edit edit) {
-				if (edit instanceof ConnectDatalinkEdit) {
-					processConnectDatalinkEdit((ConnectDatalinkEdit) edit);
-				}
-				if (edit instanceof CompoundEdit) {
-					processCompoundEdit((CompoundEdit) edit);
-				}
-			}
-
-			private void processConnectDatalinkEdit(ConnectDatalinkEdit edit) {
-				Datalink d = ((ConnectDatalinkEdit) edit).getSubject();
-				EventHandlingInputPort sink = d.getSink();
-				if (sink instanceof ProcessorInputPort) {
-					ProcessorInputPort pip = (ProcessorInputPort) sink;
-					Processor p = pip.getProcessor();
-					final HelpEnabledDialog dialog = new IterationStrategyConfigurationDialog(null, p, copyIterationStrategyStack(p.getIterationStrategy()));
-					dialog.setVisible(true);
-				}
-			}
-
-			private void processCompoundEdit(CompoundEdit edit) {
-				for (Edit e : edit.getChildEdits()) {
-					examineEdit(e);
-				}
-			}
-
-			@Override
-			public void notify(Observable<EditManagerEvent> sender,
-					EditManagerEvent message) throws Exception {
-				if (!(message instanceof DataflowEditEvent)) {
-					return;
-				}
-				examineEdit(message.getEdit());
-			}});*/
-	}
-
-	public IterationStrategyContextualView(Processor processor, EditManager editManager, FileManager fileManager) {
-		if (processor == null || processor.getIterationStrategy() == null) {
-			throw new NullPointerException(
-					"Iteration strategy stack can't be null");
-		}
-		this.processor = processor;
-		this.editManager = editManager;
-		this.fileManager = fileManager;
-		refreshIterationStrategyStack();
-		initView();
-	}
-
-	@Override
-	public Action getConfigureAction(final Frame owner) {
-		return new ConfigureIterationStrategyAction(owner);
-	}
-
-	public Processor getProcessor() {
-		return processor;
-	}
-
-	@Override
-	public void refreshView() {
-		refreshIterationStrategyStack();
-		strategyTree.setIterationStrategy(getIterationStrategy(iterationStack));
-	}
-
-	public static IterationStrategyStack copyIterationStrategyStack(
-			IterationStrategyStack stack) {
-		Element asXML = ((IterationStrategyStackImpl)stack).asXML();
-		stripEmptyElements(asXML);
-		IterationStrategyStackImpl copyStack = new IterationStrategyStackImpl();
-		copyStack.configureFromElement(asXML);
-		if (copyStack.getStrategies().isEmpty()) {
-			copyStack.addStrategy(new IterationStrategyImpl());
-		}
-		return copyStack;
-	}
-
-	private static void stripEmptyElements(Element asXML) {
-		int childCount = asXML.getContent().size();
-		int index = 0;
-		while (index < childCount) {
-			Content child = asXML.getContent(index);
-			if (child instanceof Element) {
-				Element childElement = (Element) child;
-				if (childElement.getName().equals("port")) {
-					index++;
-				}
-				else if (childElement.getDescendants(new ElementFilter("port")).hasNext()) {
-					stripEmptyElements(childElement);
-					index++;
-				} else {
-					asXML.removeContent(childElement);
-					childCount--;
-				}
-			}
-		}
-	}
-
-	public static IterationStrategy getIterationStrategy(IterationStrategyStack iStack) {
-		List<? extends IterationStrategy> strategies = iStack
-				.getStrategies();
-		if (strategies.isEmpty()) {
-			throw new IllegalStateException("Empty iteration stack");
-		}
-		IterationStrategy strategy = strategies.get(0);
-		if (!(strategy instanceof IterationStrategyImpl)) {
-			throw new IllegalStateException(
-					"Can't edit unknown iteration strategy implementation "
-							+ strategy);
-		}
-		return (IterationStrategyImpl) strategy;
-	}
-
-	private void refreshIterationStrategyStack() {
-		IterationStrategyStack originalIterationStrategy = processor
-				.getIterationStrategy();
-		if (!(originalIterationStrategy instanceof IterationStrategyStackImpl)) {
-			throw new IllegalStateException(
-					"Unknown iteration strategy implementation "
-							+ originalIterationStrategy);
-		}
-		this.iterationStack = copyIterationStrategyStack((IterationStrategyStackImpl) originalIterationStrategy);
-	}
-
-	@Override
-	public JComponent getMainFrame() {
-		refreshView();
-		return strategyTree;
-	}
-
-	@Override
-	public String getViewTitle() {
-		return "List handling";
-	}
-
-	private final class ConfigureIterationStrategyAction extends AbstractAction {
-		private final Frame owner;
-
-		private ConfigureIterationStrategyAction(Frame owner) {
-			super("Configure");
-			this.owner = owner;
-		}
-
-		public void actionPerformed(ActionEvent e) {
-			final HelpEnabledDialog dialog = new IterationStrategyConfigurationDialog(owner, processor, iterationStack, editManager, fileManager);
-			dialog.setVisible(true);
-			refreshView();
-		}
-
-
-
-	}
-
-	@Override
-	public int getPreferredPosition() {
-		return 200;
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-iteration-strategy-ui/src/main/java/net/sf/taverna/t2/workbench/iterationstrategy/contextview/IterationStrategyContextualViewFactory.java
----------------------------------------------------------------------
diff --git a/taverna-iteration-strategy-ui/src/main/java/net/sf/taverna/t2/workbench/iterationstrategy/contextview/IterationStrategyContextualViewFactory.java b/taverna-iteration-strategy-ui/src/main/java/net/sf/taverna/t2/workbench/iterationstrategy/contextview/IterationStrategyContextualViewFactory.java
deleted file mode 100644
index c722983..0000000
--- a/taverna-iteration-strategy-ui/src/main/java/net/sf/taverna/t2/workbench/iterationstrategy/contextview/IterationStrategyContextualViewFactory.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * 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.iterationstrategy.contextview;
-
-import java.util.Arrays;
-import java.util.List;
-
-import net.sf.taverna.t2.workbench.edits.EditManager;
-import net.sf.taverna.t2.workbench.file.FileManager;
-import net.sf.taverna.t2.workbench.ui.views.contextualviews.ContextualView;
-import net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory;
-import org.apache.taverna.workflowmodel.Processor;
-
-public class IterationStrategyContextualViewFactory implements
-		ContextualViewFactory<Processor> {
-
-	private EditManager editManager;
-	private FileManager fileManager;
-
-	public boolean canHandle(Object selection) {
-		return selection instanceof Processor;
-	}
-
-	public List<ContextualView> getViews(Processor p) {
-		return Arrays.asList(new ContextualView[] {new IterationStrategyContextualView(p, editManager, fileManager)});
-	}
-
-	public void setEditManager(EditManager editManager) {
-		this.editManager = editManager;
-	}
-
-	public void setFileManager(FileManager fileManager) {
-		this.fileManager = fileManager;
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-iteration-strategy-ui/src/main/java/net/sf/taverna/t2/workbench/iterationstrategy/editor/IterationStrategyCellRenderer.java
----------------------------------------------------------------------
diff --git a/taverna-iteration-strategy-ui/src/main/java/net/sf/taverna/t2/workbench/iterationstrategy/editor/IterationStrategyCellRenderer.java b/taverna-iteration-strategy-ui/src/main/java/net/sf/taverna/t2/workbench/iterationstrategy/editor/IterationStrategyCellRenderer.java
deleted file mode 100644
index 5124c0d..0000000
--- a/taverna-iteration-strategy-ui/src/main/java/net/sf/taverna/t2/workbench/iterationstrategy/editor/IterationStrategyCellRenderer.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*******************************************************************************
- * 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.iterationstrategy.editor;
-
-import java.awt.Component;
-
-import javax.swing.JTree;
-import javax.swing.tree.DefaultTreeCellRenderer;
-
-import net.sf.taverna.t2.workbench.icons.WorkbenchIcons;
-import net.sf.taverna.t2.workbench.iterationstrategy.IterationStrategyIcons;
-import org.apache.taverna.workflowmodel.processor.iteration.CrossProduct;
-import org.apache.taverna.workflowmodel.processor.iteration.DotProduct;
-import org.apache.taverna.workflowmodel.processor.iteration.NamedInputPortNode;
-
-import org.apache.log4j.Logger;
-
-@SuppressWarnings("serial")
-final class IterationStrategyCellRenderer extends DefaultTreeCellRenderer {
-
-	@SuppressWarnings("unused")
-	private static Logger logger = Logger
-			.getLogger(IterationStrategyCellRenderer.class);
-
-	@Override
-	public Component getTreeCellRendererComponent(JTree tree, Object value,
-			boolean selected, boolean expanded, boolean leaf, int row,
-			boolean hasFocus) {
-		super.getTreeCellRendererComponent(tree, value, selected, expanded,
-				leaf, row, hasFocus);
-		if (value instanceof CrossProduct) {
-			setIcon(IterationStrategyIcons.joinIteratorIcon);
-			setText("Cross product");
-		} else if (value instanceof DotProduct) {
-			setIcon(IterationStrategyIcons.lockStepIteratorIcon);
-			setText("Dot product");
-		} else if (value instanceof NamedInputPortNode) {
-			setIcon(IterationStrategyIcons.leafnodeicon);
-			NamedInputPortNode namedInput = (NamedInputPortNode) value;
-			setText(namedInput.getPortName());
-		} else {
-			setText("List handling");
-			if (!leaf){
-				if (expanded) {
-					setIcon(WorkbenchIcons.folderOpenIcon);
-				} else {
-					setIcon(WorkbenchIcons.folderClosedIcon);
-				}
-			}
-		}
-		return this;
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-iteration-strategy-ui/src/main/java/net/sf/taverna/t2/workbench/iterationstrategy/editor/IterationStrategyEditor.java
----------------------------------------------------------------------
diff --git a/taverna-iteration-strategy-ui/src/main/java/net/sf/taverna/t2/workbench/iterationstrategy/editor/IterationStrategyEditor.java b/taverna-iteration-strategy-ui/src/main/java/net/sf/taverna/t2/workbench/iterationstrategy/editor/IterationStrategyEditor.java
deleted file mode 100644
index 3dce138..0000000
--- a/taverna-iteration-strategy-ui/src/main/java/net/sf/taverna/t2/workbench/iterationstrategy/editor/IterationStrategyEditor.java
+++ /dev/null
@@ -1,247 +0,0 @@
-/*******************************************************************************
- * 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.iterationstrategy.editor;
-
-import java.awt.GraphicsEnvironment;
-import java.awt.datatransfer.DataFlavor;
-import java.awt.datatransfer.Transferable;
-import java.awt.datatransfer.UnsupportedFlavorException;
-//import java.awt.image.BufferedImage;
-import java.io.IOException;
-
-import javax.swing.DropMode;
-import javax.swing.JComponent;
-import javax.swing.JTree;
-import javax.swing.TransferHandler;
-import javax.swing.tree.DefaultTreeModel;
-import javax.swing.tree.TreePath;
-import javax.swing.tree.TreeSelectionModel;
-
-import net.sf.taverna.t2.workbench.ui.zaria.UIComponentSPI;
-import org.apache.taverna.workflowmodel.processor.iteration.AbstractIterationStrategyNode;
-import org.apache.taverna.workflowmodel.processor.iteration.IterationStrategy;
-import org.apache.taverna.workflowmodel.processor.iteration.NamedInputPortNode;
-import org.apache.taverna.workflowmodel.processor.iteration.TerminalNode;
-
-import org.apache.log4j.Logger;
-
-@SuppressWarnings("serial")
-public class IterationStrategyEditor extends IterationStrategyTree implements
-		UIComponentSPI {
-
-	private static Logger logger = Logger
-			.getLogger(IterationStrategyEditor.class);
-
-	//private BufferedImage imgGhost; // The 'drag image'
-
-	// mouse was clicked
-
-	public IterationStrategyEditor() {
-		super();
-		// Make this a drag source
-		if (!GraphicsEnvironment.isHeadless()) {
-			this.setDragEnabled(true);  
-	        this.setDropMode(DropMode.ON_OR_INSERT);  
-	        this.setTransferHandler(new TreeTransferHandler());  
-	        this.getSelectionModel().setSelectionMode(  
-	                TreeSelectionModel.CONTIGUOUS_TREE_SELECTION);  
-	        expandTree();
-		}
-
-		//
-	}
-
-	public IterationStrategyEditor(IterationStrategy theStrategy) {
-		this();
-		setIterationStrategy(theStrategy);
-	}
-
-    /**
-     * 
-     * This code is freely adapted from code derived 
-     *
-     */
-    class TreeTransferHandler extends TransferHandler {  
-        DataFlavor nodesFlavor;
-        DataFlavor[] flavors = new DataFlavor[1];  
-       
-        public TreeTransferHandler() {
-        	getNodesFlavor();
-          }
-        
-        private DataFlavor getNodesFlavor() {
-        	if (nodesFlavor == null) {
-                try {  
-                     nodesFlavor = new DataFlavor(DataFlavor.javaJVMLocalObjectMimeType +
-                             ";class=" + AbstractIterationStrategyNode.class.getName(),
-                             "AbstractIterationStrategyNode",
-                             this.getClass().getClassLoader());  
-                    flavors[0] = nodesFlavor;  
-                } catch(Exception e) {  
-                    logger.error("Problem creating nodesFlavor:" + e);
-                }         		
-        	}
-        	return nodesFlavor;
-        }
-       
-        public boolean canImport(TransferHandler.TransferSupport support) {  
-            if(!support.isDrop()) {
-            	logger.error("isDrop not supported");
-                return false;  
-            }  
-
-            if(!support.isDataFlavorSupported(getNodesFlavor())) {
-            	logger.info("Not correct flavor");
-                return false;  
-            }  
-            // Do not allow a drop on the drag source selections.  
-            JTree.DropLocation dl =  
-                    (JTree.DropLocation)support.getDropLocation();  
-            TreePath dest = dl.getPath();  
-            AbstractIterationStrategyNode destination =  
-                (AbstractIterationStrategyNode)dest.getLastPathComponent();
-            Transferable t = support.getTransferable();
-            if (destination instanceof TerminalNode) {
-            	return false;
-            }
-            try {
-				AbstractIterationStrategyNode node = (AbstractIterationStrategyNode) t.getTransferData(getNodesFlavor());
-				if (node.isNodeDescendant(destination)) {
-					return false;
-				}
-			} catch (UnsupportedFlavorException e) {
-				return false;
-			} catch (IOException e) {
-				return false;
-			}  
-//			JTree tree = (JTree) support.getComponent();
-//			int dropRow = tree.getRowForPath(dl.getPath());
-//			int selRow = tree.getLeadSelectionRow();
-//			if (selRow == dropRow) {
-//				logger.info("Dragging to source");
-//				return false;
-//
-//			}
-			support.setShowDropLocation(true);  
-            return true;  
-        }  
-       
-         protected Transferable createTransferable(JComponent c) {  
-            JTree tree = (JTree)c;  
-            TreePath[] paths = tree.getSelectionPaths();  
-            if(paths != null) {  
-                AbstractIterationStrategyNode node =  
-                    (AbstractIterationStrategyNode)paths[0].getLastPathComponent();  
-                 return new NodeTransferable(node);  
-            }  
-            return null;  
-        }  
-              
-        protected void exportDone(JComponent source, Transferable data, int action) {  
-        }  
-       
-        public int getSourceActions(JComponent c) {  
-            return MOVE;  
-        }  
-       
-        public boolean importData(TransferHandler.TransferSupport support) { 
-            if(!canImport(support)) {
-            	logger.info("Cannot import");
-                return false;  
-            }  
-            // Extract transfer data.  
-            AbstractIterationStrategyNode node = null;  
-            try {  
-                Transferable t = support.getTransferable();  
-                node = (AbstractIterationStrategyNode) t.getTransferData(getNodesFlavor());  
-            } catch(UnsupportedFlavorException ufe) {  
-                logger.error("UnsupportedFlavor", ufe);  
-            } catch (Exception e) {
-            	logger.error("Problem getting transfer data", e);
-            }
-
-           // Get drop location info.  
-            JTree.DropLocation dl =  
-                    (JTree.DropLocation)support.getDropLocation();  
-            int childIndex = dl.getChildIndex();  
-            TreePath dest = dl.getPath();  
-            AbstractIterationStrategyNode parent =  
-                (AbstractIterationStrategyNode)dest.getLastPathComponent();
-            int index = childIndex;
-            logger.info ("parent is a " + parent.getClass().getName());
-            if (parent instanceof NamedInputPortNode) {
-            	AbstractIterationStrategyNode sibling = parent;
-            	parent = (AbstractIterationStrategyNode) sibling.getParent();
-            	index = parent.getIndex(sibling);
-            } else if (index == -1) {
-            	index = parent.getChildCount();
-            }
-            if (parent instanceof TerminalNode) {
-            	if (parent.getChildCount() > 0) {
-            		parent = (AbstractIterationStrategyNode) parent.getChildAt(0);
-            		index = parent.getChildCount();
-            	}
-            	
-            }
-            logger.info("parent is a " + parent.getClass().getName());
-
-			try {
-				// The parent insert removes from the oldParent
-				parent.insert(node, index++);
-				DefaultTreeModel model = IterationStrategyEditor.this
-						.getModel();
-				refreshModel();
-			} catch (IllegalStateException e) {
-				logger.error(e);
-			} catch (IllegalArgumentException e) {
-				logger.error(e);
-			}
-          return true;  
-        }  
-       
-        public String toString() {  
-            return getClass().getName();  
-        }  
-       
-        public class NodeTransferable implements Transferable {  
-            AbstractIterationStrategyNode node;  
-       
-            public NodeTransferable(AbstractIterationStrategyNode node) {  
-                this.node = node;  
-             }  
-       
-            public AbstractIterationStrategyNode getTransferData(DataFlavor flavor)  
-                                     throws UnsupportedFlavorException {  
-                if(!isDataFlavorSupported(flavor))  
-                    throw new UnsupportedFlavorException(flavor);  
-                return node;  
-            }  
-       
-            public DataFlavor[] getTransferDataFlavors() {  
-                return flavors;  
-            }  
-       
-            public boolean isDataFlavorSupported(DataFlavor flavor) {
-            	 return getNodesFlavor().equals(flavor);  
-            }  
-        }  
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-iteration-strategy-ui/src/main/java/net/sf/taverna/t2/workbench/iterationstrategy/editor/IterationStrategyEditorControl.java
----------------------------------------------------------------------
diff --git a/taverna-iteration-strategy-ui/src/main/java/net/sf/taverna/t2/workbench/iterationstrategy/editor/IterationStrategyEditorControl.java b/taverna-iteration-strategy-ui/src/main/java/net/sf/taverna/t2/workbench/iterationstrategy/editor/IterationStrategyEditorControl.java
deleted file mode 100644
index 6d80004..0000000
--- a/taverna-iteration-strategy-ui/src/main/java/net/sf/taverna/t2/workbench/iterationstrategy/editor/IterationStrategyEditorControl.java
+++ /dev/null
@@ -1,439 +0,0 @@
-/*******************************************************************************
- * 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
- ******************************************************************************/
-/**
- * This file is a component of the Taverna project,
- * and is licensed under the GNU LGPL.
- * Copyright Tom Oinn, EMBL-EBI
- */
-package net.sf.taverna.t2.workbench.iterationstrategy.editor;
-
-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 javax.swing.Action;
-import javax.swing.BoxLayout;
-import javax.swing.ImageIcon;
-import javax.swing.JButton;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JToolBar;
-import javax.swing.SwingConstants;
-import javax.swing.event.TreeSelectionEvent;
-import javax.swing.event.TreeSelectionListener;
-import javax.swing.tree.DefaultTreeModel;
-import javax.swing.tree.TreeNode;
-import javax.swing.tree.TreePath;
-
-import net.sf.taverna.t2.workbench.icons.WorkbenchIcons;
-import net.sf.taverna.t2.workbench.iterationstrategy.IterationStrategyIcons;
-import org.apache.taverna.workflowmodel.processor.iteration.CrossProduct;
-import org.apache.taverna.workflowmodel.processor.iteration.DotProduct;
-import org.apache.taverna.workflowmodel.processor.iteration.IterationStrategy;
-import org.apache.taverna.workflowmodel.processor.iteration.IterationStrategyNode;
-import org.apache.taverna.workflowmodel.processor.iteration.TerminalNode;
-
-import org.apache.log4j.Logger;
-
-/**
- * A control panel for the iteration tree editor allowing the user to manipulate
- * the tree, removing and adding nodes into the tree based on the context.
- * 
- * @author Tom Oinn
- * @author Stian Soiland-Reyes
- * 
- */
-@SuppressWarnings("serial")
-public class IterationStrategyEditorControl extends JPanel {
-
-	protected static Set<IterationStrategyNode> descendentsOfNode(
-			IterationStrategyNode node) {
-		Set<IterationStrategyNode> descendants = new HashSet<IterationStrategyNode>();
-		Set<IterationStrategyNode> nodesToVisit = new HashSet<IterationStrategyNode>();
-		Set<IterationStrategyNode> visitedNodes = new HashSet<IterationStrategyNode>();
-
-		// Note: Not added to descendants
-		nodesToVisit.add(node);
-		while (!nodesToVisit.isEmpty()) {
-			// pick the first one
-			IterationStrategyNode visiting = nodesToVisit.iterator().next();
-			visitedNodes.add(visiting);
-			nodesToVisit.remove(visiting);
-
-			// Find new and interesting children
-			List<IterationStrategyNode> children = visiting.getChildren();
-			Set<IterationStrategyNode> newNodes = new HashSet<IterationStrategyNode>(
-					children);
-			newNodes.removeAll(visitedNodes);
-
-			descendants.addAll(newNodes);
-			nodesToVisit.addAll(newNodes);
-		}
-		return descendants;
-	}
-
-	private static Logger logger = Logger
-			.getLogger(IterationStrategyEditorControl.class);
-
-	private IterationStrategyNode selectedNode = null;
-
-	private IterationStrategyTree tree;
-
-	protected AddCrossAction addCross = new AddCrossAction();
-	protected AddDotAction addDot = new AddDotAction();
-	protected ChangeAction change = new ChangeAction();
-	protected NormalizeAction normalize = new NormalizeAction();
-	protected RemoveAction remove = new RemoveAction();
-	protected MoveUpAction moveUp = new MoveUpAction();
-
-	//private static final int ICON_SIZE = 15;
-
-	protected ImageIcon arrowUpIcon = WorkbenchIcons.upArrowIcon;
-	protected ImageIcon arrowDownIcon = WorkbenchIcons.downArrowIcon;
-	//protected ImageIcon arrowLeft = WorkbenchIcons.leftArrowIcon;
-	//protected ImageIcon arrowRight = WorkbenchIcons.rightArrowIcon;
-	protected ImageIcon normalizeIcon = WorkbenchIcons.normalizeIcon;
-
-	private final IterationStrategy strategy;
-
-	/**
-	 * Create a new panel from the supplied iteration strategy
-	 */
-	public IterationStrategyEditorControl(IterationStrategy strategy) {
-
-		this.strategy = strategy;
-		setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS));
-
-		// Create the components
-		tree = new IterationStrategyEditor(strategy);
-
-		JButton addCrossButton = new JButton(addCross);
-		addCrossButton.setHorizontalAlignment(SwingConstants.LEFT);
-		JButton addDotButton = new JButton(addDot);
-		addDotButton.setHorizontalAlignment(SwingConstants.LEFT);
-		JButton normalizeButton = new JButton(normalize);
-		normalizeButton.setHorizontalAlignment(SwingConstants.LEFT);
-		normalizeButton.setIcon(normalizeIcon);
-		JButton removeButton = new JButton(remove);
-		removeButton.setHorizontalAlignment(SwingConstants.LEFT);
-		JButton changeButton = new JButton(change);
-		changeButton.setHorizontalAlignment(SwingConstants.LEFT);
-
-		JButton moveUpButton = new JButton(moveUp);
-		moveUpButton.setIcon(arrowUpIcon);
-		moveUpButton.setHorizontalAlignment(SwingConstants.LEFT);
-
-		// Set the default enabled state to off on all buttons other than the
-		// normalizeButton
-		// one.
-		disableButtons();
-
-		// Create a layout with the tree on the right and the buttons in a grid
-		// layout on the left
-		JToolBar toolbar = new JToolBar();
-		toolbar.setFloatable(false);
-		toolbar.setRollover(true);
-		// toolbar.setLayout(new GridLayout(2,2));
-		toolbar.add(normalizeButton);
-		toolbar.add(addCrossButton);
-		toolbar.add(addDotButton);
-		toolbar.add(removeButton);
-		toolbar.add(changeButton);
-		toolbar.add(moveUpButton);
-
-		toolbar.setAlignmentX(LEFT_ALIGNMENT);
-
-		// Listen to tree selection events and enable buttons appropriately
-		tree.addTreeSelectionListener(new ButtonEnabler());
-
-		// Add components to the control panel
-		add(toolbar);
-		JScrollPane treePane = new JScrollPane(tree);
-		//treePane.setPreferredSize(new Dimension(0, 0));
-		add(treePane);
-	}
-
-	public void setIterationStrategy(IterationStrategy iterationStrategy) {
-		tree.setIterationStrategy(iterationStrategy);
-		disableButtons();
-		selectNode(null);
-	}
-
-	private void disableButtons() {
-		remove.setEnabled(false);
-		addCross.setEnabled(false);
-		addDot.setEnabled(false);
-		change.setEnabled(false);
-	}
-
-	private IterationStrategyNode findRoot() {
-		IterationStrategyNode root = (IterationStrategyNode) tree.getModel()
-				.getRoot();
-		if (root.getChildCount() > 0) {
-			return root.getChildAt(0);
-		}
-		return root;
-	}
-
-	protected void selectNode(TreeNode newNode) {
-		DefaultTreeModel model = tree.getModel();
-		if (newNode == null) {
-			newNode = (TreeNode) model.getRoot();
-		}
-		TreeNode[] pathToRoot = model.getPathToRoot(newNode);
-		tree.setSelectionPath(new TreePath(pathToRoot));
-	}
-
-	/**
-	 * Add a cross product node as a child of the selected node
-	 */
-	protected class AddCrossAction extends AbstractAction {
-
-		public AddCrossAction() {
-			super("Add Cross", IterationStrategyIcons.joinIteratorIcon);
-		}
-
-		public void actionPerformed(ActionEvent e) {
-			CrossProduct newNode = new CrossProduct();
-			newNode.setParent(selectedNode);
-			tree.refreshModel();
-		}
-	}
-
-	/**
-	 * Add a dot product node as a child of the selected node
-	 * 
-	 * @author Stian Soiland-Reyes
-	 * 
-	 */
-	protected class AddDotAction extends AbstractAction {
-
-		public AddDotAction() {
-			super("Add Dot", IterationStrategyIcons.lockStepIteratorIcon);
-		}
-
-		public void actionPerformed(ActionEvent e) {
-			DotProduct newNode = new DotProduct();
-			newNode.setParent(selectedNode);
-			tree.refreshModel();
-		}
-	}
-
-	protected class ButtonEnabler implements TreeSelectionListener {
-		public void valueChanged(TreeSelectionEvent e) {
-			TreePath selectedPath = e.getPath();
-			IterationStrategyNode selectedObject = (IterationStrategyNode) selectedPath
-					.getLastPathComponent();
-			selectedNode = selectedObject;
-			if (selectedObject instanceof CrossProduct
-					|| selectedObject instanceof DotProduct) {
-				if ((selectedObject.getParent() == null) || (selectedObject.getParent() instanceof TerminalNode)) {
-					remove.setEnabled(false);
-				} else {
-					remove.setEnabled(true);
-				}
-				if (selectedObject instanceof CrossProduct) {
-					change.putValue(Action.NAME, "Change to Dot Product");
-					change.putValue(Action.SMALL_ICON,
-							IterationStrategyIcons.lockStepIteratorIcon);
-				} else {
-					change.putValue(Action.NAME, "Change to Cross Product");
-					change.putValue(Action.SMALL_ICON,
-							IterationStrategyIcons.joinIteratorIcon);
-				}
-				addCross.setEnabled(true);
-				addDot.setEnabled(true);
-				change.setEnabled(true);
-			} else {
-				// Top- or leaf node
-				remove.setEnabled(false);
-				addCross.setEnabled(false);
-				addDot.setEnabled(false);
-				change.setEnabled(false);
-			}
-		}
-	}
-
-	/**
-	 * Add a cross product node as a child of the selected node
-	 */
-	protected class ChangeAction extends AbstractAction {
-
-		public ChangeAction() {
-			super("Switch to...", IterationStrategyIcons.joinIteratorIcon);
-		}
-
-		public void actionPerformed(ActionEvent e) {
-			IterationStrategyNode newNode;
-			if (selectedNode instanceof CrossProduct) {
-				newNode = new DotProduct();
-			} else {
-				newNode = new CrossProduct();
-			}
-
-			List<IterationStrategyNode> children = new ArrayList<IterationStrategyNode>(
-					selectedNode.getChildren());
-			for (IterationStrategyNode child : children) {
-				child.setParent(newNode);
-			}
-
-			DefaultTreeModel model = tree.getModel();
-			if (selectedNode.getParent() == null) {
-				model.setRoot(newNode);
-				tree.refreshModel();
-				newNode.setParent(null);
-			} else {
-				IterationStrategyNode parent = selectedNode.getParent();
-				int index = parent.getIndex(selectedNode);
-				selectedNode.setParent(null);
-				parent.insert(newNode, index);
-				tree.refreshModel();
-			}
-
-			selectNode(newNode);
-		}
-
-	}
-
-	/**
-	 * Normalize the tree when the button is pressed
-	 * 
-	 */
-	protected class NormalizeAction extends AbstractAction {
-		public NormalizeAction() {
-			super("Normalize", normalizeIcon);
-		}
-
-		public void actionPerformed(ActionEvent e) {
-			strategy.normalize();
-			// Expand all the nodes in the tree
-			//DefaultTreeModel model = tree.getModel();
-			tree.refreshModel();
-		}
-	}
-
-	/**
-	 * Remove the selected node, moving any descendant leaf nodes to the parent
-	 * to prevent them getting lost
-	 */
-	protected class RemoveAction extends AbstractAction {
-		public RemoveAction() {
-			super("Remove node", WorkbenchIcons.deleteIcon);
-		}
-
-		public void actionPerformed(ActionEvent e) {
-			IterationStrategyNode nodeToBeRemoved = selectedNode;
-
-			//DefaultTreeModel model = tree.getModel();
-
-			// Now removeButton the candidate nodes from their parents and
-			// put them back into the root node
-			IterationStrategyNode root = findRoot();
-			if (root == selectedNode) {
-				return;
-			}
-			IterationStrategyNode oldParent = nodeToBeRemoved.getParent();
-
-			for (IterationStrategyNode nodeToMove : descendentsOfNode(nodeToBeRemoved)) {
-				nodeToMove.setParent(oldParent);
-			}
-			nodeToBeRemoved.setParent(null);
-			tree.refreshModel();
-			// Disable the various buttons, as the current selection
-			// is now invalid.
-			remove.setEnabled(false);
-			addCross.setEnabled(false);
-			addDot.setEnabled(false);
-			change.setEnabled(false);
-			selectNode(oldParent);
-		}
-	}
-
-	protected class MoveUpAction extends AbstractAction {
-
-		public MoveUpAction() {
-			super("Move up", arrowUpIcon);
-		}
-
-		public void actionPerformed(ActionEvent e) {
-			//DefaultTreeModel model = tree.getModel();
-
-			IterationStrategyNode aboveNode = aboveSelectedNode();
-			if ((aboveNode == null) || ((aboveNode instanceof TerminalNode) && (aboveNode.getChildCount() > 0))) {
-				logger.warn("Can't move above top");
-				return;
-			}
-			IterationStrategyNode selectedParent = selectedNode.getParent();
-			IterationStrategyNode aboveParent = aboveNode.getParent();
-			if (selectedParent != null && selectedParent.equals(aboveParent)) {
-				// Siblings
-				int aboveChildIndex = selectedParent.getIndex(aboveNode);
-				selectedParent.insert(selectedNode, aboveChildIndex);
-				tree.refreshModel();
-				selectNode(selectedNode);
-			} else if (aboveNode.equals(selectedParent)) {
-				if (aboveParent instanceof TerminalNode
-						&& selectedNode.getAllowsChildren()) {
-					aboveNode.setParent(selectedNode);
-					selectedNode.setParent(aboveParent);
-					tree.refreshModel();
-					selectNode(selectedNode);
-				} else if (!(aboveParent instanceof TerminalNode)){
-					int aboveChildIndex = aboveParent.getIndex(aboveNode);
-					aboveParent.insert(selectedNode, aboveChildIndex);
-					tree.refreshModel();
-					selectNode(selectedNode);
-				}
-			} else {
-
-			}
-
-		}
-
-	}
-
-	protected IterationStrategyNode belowSelectedNode() {
-		return offsetFromSelectedNode(1);
-	}
-
-	protected IterationStrategyNode offsetFromSelectedNode(int offset) {
-		int currentRow = tree.getRowForPath(tree.getSelectionPath());
-		int offsetRow = currentRow + offset;
-		TreePath offsetPath = tree.getPathForRow(offsetRow);
-		if (offsetPath == null) {
-			return null;
-		}
-		IterationStrategyNode offsetNode = (IterationStrategyNode) offsetPath
-				.getLastPathComponent();
-		if (offsetNode == tree.getModel().getRoot()) {
-			return null;
-		}
-		return offsetNode;
-	}
-
-	protected IterationStrategyNode aboveSelectedNode() {
-		return offsetFromSelectedNode(-1);
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-iteration-strategy-ui/src/main/java/net/sf/taverna/t2/workbench/iterationstrategy/editor/IterationStrategyTree.java
----------------------------------------------------------------------
diff --git a/taverna-iteration-strategy-ui/src/main/java/net/sf/taverna/t2/workbench/iterationstrategy/editor/IterationStrategyTree.java b/taverna-iteration-strategy-ui/src/main/java/net/sf/taverna/t2/workbench/iterationstrategy/editor/IterationStrategyTree.java
deleted file mode 100644
index 5230f87..0000000
--- a/taverna-iteration-strategy-ui/src/main/java/net/sf/taverna/t2/workbench/iterationstrategy/editor/IterationStrategyTree.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*******************************************************************************
- * 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.iterationstrategy.editor;
-
-import java.util.Enumeration;
-
-import javax.swing.ImageIcon;
-import javax.swing.JTree;
-import javax.swing.tree.DefaultMutableTreeNode;
-import javax.swing.tree.DefaultTreeModel;
-import javax.swing.tree.TreeModel;
-import javax.swing.tree.TreeNode;
-import javax.swing.tree.TreePath;
-import javax.swing.tree.TreeSelectionModel;
-
-import net.sf.taverna.t2.workbench.iterationstrategy.IterationStrategyIcons;
-import net.sf.taverna.t2.workbench.ui.zaria.UIComponentSPI;
-import org.apache.taverna.workflowmodel.processor.iteration.IterationStrategy;
-
-@SuppressWarnings("serial")
-public class IterationStrategyTree extends JTree implements UIComponentSPI {
-
-	private IterationStrategy strategy = null;
-
-	public IterationStrategyTree() {
-		super();
-		setCellRenderer(new IterationStrategyCellRenderer());
-	}
-
-	public ImageIcon getIcon() {
-		return IterationStrategyIcons.leafnodeicon;
-	}
-
-	public void onDisplay() {
-		// TODO Auto-generated method stub
-
-	}
-
-	public void onDispose() {
-		this.strategy = null;
-		setModel(null);
-	}
-
-	public synchronized void setIterationStrategy(
-			IterationStrategy theStrategy) {
-		if (theStrategy != this.strategy) {
-			this.strategy = theStrategy;
-			TreeNode terminal = theStrategy.getTerminalNode();
-			setModel(new DefaultTreeModel(terminal));
-			this.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
-			expandTree();
-			revalidate();
-		}
-	}
-	
-	protected synchronized void refreshModel() {
-		this.getModel().nodeStructureChanged(strategy.getTerminalNode());
-		expandTree();
-	}
-
-	@Override
-	public DefaultTreeModel getModel() {
-		return (DefaultTreeModel) super.getModel();
-	}
-
-	@Override
-	public void setModel(TreeModel newModel) {
-		if (newModel != null && !(newModel instanceof DefaultTreeModel)) {
-			throw new IllegalArgumentException(
-					"Model must be a DefaultTreeModel");
-		}
-		super.setModel(newModel);
-	}
-
-	protected void expandTree() {  
-		DefaultMutableTreeNode root =  
-	        (DefaultMutableTreeNode)this.getModel().getRoot();  
-	    Enumeration e = root.breadthFirstEnumeration();  
-	    while(e.hasMoreElements()) {  
-	        DefaultMutableTreeNode node =  
-	            (DefaultMutableTreeNode)e.nextElement();  
-	        if(node.isLeaf()) continue;  
-	        int row = this.getRowForPath(new TreePath(node.getPath()));  
-	        this.expandRow(row);  
-	    }  
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-iteration-strategy-ui/src/main/java/net/sf/taverna/t2/workbench/iterationstrategy/menu/IterationStrategyConfigureMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-iteration-strategy-ui/src/main/java/net/sf/taverna/t2/workbench/iterationstrategy/menu/IterationStrategyConfigureMenuAction.java b/taverna-iteration-strategy-ui/src/main/java/net/sf/taverna/t2/workbench/iterationstrategy/menu/IterationStrategyConfigureMenuAction.java
deleted file mode 100644
index cb1c9cb..0000000
--- a/taverna-iteration-strategy-ui/src/main/java/net/sf/taverna/t2/workbench/iterationstrategy/menu/IterationStrategyConfigureMenuAction.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/**********************************************************************
- * 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.workbench.iterationstrategy.menu;
-
-import java.awt.event.ActionEvent;
-import java.net.URI;
-
-import javax.swing.AbstractAction;
-import javax.swing.Action;
-
-import net.sf.taverna.t2.ui.menu.AbstractContextualMenuAction;
-import net.sf.taverna.t2.workbench.helper.HelpEnabledDialog;
-import net.sf.taverna.t2.workbench.iterationstrategy.contextview.IterationStrategyConfigurationDialog;
-import net.sf.taverna.t2.workbench.iterationstrategy.contextview.IterationStrategyContextualView;
-import org.apache.taverna.workflowmodel.Processor;
-
-public class IterationStrategyConfigureMenuAction extends AbstractContextualMenuAction {
-	
-	
-	
-	public static final URI configureRunningSection = URI
-	.create("http://taverna.sf.net/2009/contextMenu/configureRunning");
-	
-	private static final URI ITERATION_STRATEGY_CONFIGURE_URI = URI
-	.create("http://taverna.sf.net/2008/t2workbench/iterationStrategyConfigure");
-
-	public IterationStrategyConfigureMenuAction() {
-		super(configureRunningSection, 40, ITERATION_STRATEGY_CONFIGURE_URI);
-	}
-
-	@SuppressWarnings("serial")
-	@Override
-	protected Action createAction() {
-		return new AbstractAction("List handling...") {
-			public void actionPerformed(ActionEvent e) {
-				Processor p = (Processor) getContextualSelection().getSelection();
-				final HelpEnabledDialog dialog = new IterationStrategyConfigurationDialog(null, p, IterationStrategyContextualView.copyIterationStrategyStack(p.getIterationStrategy()));		
-				dialog.setVisible(true);
-			}
-		};
-	}
-	
-	public boolean isEnabled() {
-		return super.isEnabled() && (getContextualSelection().getSelection() instanceof Processor);
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-iteration-strategy-ui/src/main/java/org/apache/taverna/workbench/iterationstrategy/IterationStrategyIcons.java
----------------------------------------------------------------------
diff --git a/taverna-iteration-strategy-ui/src/main/java/org/apache/taverna/workbench/iterationstrategy/IterationStrategyIcons.java b/taverna-iteration-strategy-ui/src/main/java/org/apache/taverna/workbench/iterationstrategy/IterationStrategyIcons.java
new file mode 100644
index 0000000..bdfe724
--- /dev/null
+++ b/taverna-iteration-strategy-ui/src/main/java/org/apache/taverna/workbench/iterationstrategy/IterationStrategyIcons.java
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * 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 org.apache.taverna.workbench.iterationstrategy;
+
+import javax.swing.ImageIcon;
+
+import org.apache.log4j.Logger;
+
+public class IterationStrategyIcons {
+
+	private static Logger logger = Logger
+			.getLogger(IterationStrategyIcons.class);
+
+	public static ImageIcon joinIteratorIcon, lockStepIteratorIcon,
+			leafnodeicon;
+
+	static {
+		try {
+			Class<?> c = IterationStrategyIcons.class;
+			joinIteratorIcon = new ImageIcon(c
+					.getResource("icons/crossproducticon.png"));
+			lockStepIteratorIcon = new ImageIcon(c
+					.getResource("icons/dotproducticon.png"));
+			leafnodeicon = new ImageIcon(c
+					.getResource("icons/leafnodeicon.png"));
+		} catch (Exception ex) {
+			logger.warn("Could not find icon", ex);
+		}
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-iteration-strategy-ui/src/main/java/org/apache/taverna/workbench/iterationstrategy/contextview/IterationStrategyConfigurationDialog.java
----------------------------------------------------------------------
diff --git a/taverna-iteration-strategy-ui/src/main/java/org/apache/taverna/workbench/iterationstrategy/contextview/IterationStrategyConfigurationDialog.java b/taverna-iteration-strategy-ui/src/main/java/org/apache/taverna/workbench/iterationstrategy/contextview/IterationStrategyConfigurationDialog.java
new file mode 100644
index 0000000..ef45ec3
--- /dev/null
+++ b/taverna-iteration-strategy-ui/src/main/java/org/apache/taverna/workbench/iterationstrategy/contextview/IterationStrategyConfigurationDialog.java
@@ -0,0 +1,148 @@
+/**
+ *
+ */
+package org.apache.taverna.workbench.iterationstrategy.contextview;
+
+import java.awt.BorderLayout;
+import java.awt.Dimension;
+import java.awt.FlowLayout;
+import java.awt.Frame;
+import java.awt.event.ActionEvent;
+
+import javax.swing.AbstractAction;
+import javax.swing.JButton;
+import javax.swing.JDialog;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.file.FileManager;
+import org.apache.taverna.workbench.helper.HelpEnabledDialog;
+import org.apache.taverna.workbench.iterationstrategy.editor.IterationStrategyEditorControl;
+import org.apache.taverna.workflowmodel.Edit;
+import org.apache.taverna.workflowmodel.EditException;
+import org.apache.taverna.workflowmodel.Edits;
+import org.apache.taverna.workflowmodel.Processor;
+import org.apache.taverna.workflowmodel.processor.iteration.IterationStrategy;
+import org.apache.taverna.workflowmodel.processor.iteration.IterationStrategyStack;
+
+import org.apache.log4j.Logger;
+
+/**
+ * @author alanrw
+ *
+ */
+@SuppressWarnings("serial")
+public class IterationStrategyConfigurationDialog extends HelpEnabledDialog {
+
+	private static Logger logger = Logger
+	.getLogger(IterationStrategyConfigurationDialog.class);
+
+	private final EditManager editManager;
+	private final FileManager fileManager;
+
+
+	private final Frame owner;
+	private final Processor processor;
+	private final IterationStrategyStack originalStack;
+
+	private IterationStrategyStack workingStack;
+
+	public IterationStrategyConfigurationDialog(Frame owner, Processor processor, IterationStrategyStack iStack, EditManager editManager, FileManager fileManager) {
+		super (owner, "List handling for " + processor.getLocalName(), true, null);
+		this.owner = owner;
+		this.processor = processor;
+		this.originalStack = iStack;
+		this.editManager = editManager;
+		this.fileManager = fileManager;
+		this.workingStack = IterationStrategyContextualView.copyIterationStrategyStack(originalStack);
+		IterationStrategy iterationStrategy = IterationStrategyContextualView.getIterationStrategy(workingStack);
+		IterationStrategyEditorControl iterationStrategyEditorControl = new IterationStrategyEditorControl(
+				iterationStrategy);
+		this.add(iterationStrategyEditorControl, BorderLayout.CENTER);
+
+		JPanel buttonPanel = new JPanel();
+		buttonPanel.setLayout(new FlowLayout());
+
+		JButton okButton = new JButton(new OKAction(this));
+		buttonPanel.add(okButton);
+
+		JButton resetButton = new JButton(new ResetAction(
+				iterationStrategyEditorControl));
+		buttonPanel.add(resetButton);
+
+		JButton cancelButton = new JButton(new CancelAction(this));
+		buttonPanel.add(cancelButton);
+
+		this.add(buttonPanel, BorderLayout.SOUTH);
+		this.pack();
+		this.setSize(new Dimension(getPreferredSize().width, getPreferredSize().height > 400 ? 400 : getPreferredSize().height));
+	}
+
+	private final class OKAction extends AbstractAction {
+		private final JDialog dialog;
+
+		private OKAction(JDialog dialog) {
+			super("OK");
+			this.dialog = dialog;
+		}
+
+		public void actionPerformed(ActionEvent e) {
+			Edits edits = editManager.getEdits();
+			try {
+				Edit<?> edit = edits.getSetIterationStrategyStackEdit(
+						processor,
+						IterationStrategyContextualView.copyIterationStrategyStack(workingStack));
+				editManager.doDataflowEdit(
+						fileManager.getCurrentDataflow(), edit);
+				dialog.setVisible(false);
+			} catch (RuntimeException ex) {
+				logger.warn("Could not set list handling", ex);
+				JOptionPane.showMessageDialog(owner,
+						"Can't set list handling",
+						"An error occured when setting list handling: "
+								+ ex.getMessage(),
+						JOptionPane.ERROR_MESSAGE);
+			} catch (EditException ex) {
+				logger.warn("Could not set list handling", ex);
+				JOptionPane.showMessageDialog(owner,
+						"Can't set list handling",
+						"An error occured when setting list handling: "
+								+ ex.getMessage(),
+						JOptionPane.ERROR_MESSAGE);
+			}
+		}
+	}
+
+	private final class ResetAction extends AbstractAction {
+		private final IterationStrategyEditorControl strategyEditorControl;
+
+		private ResetAction(
+				IterationStrategyEditorControl strategyEditorControl) {
+			super("Reset");
+			this.strategyEditorControl = strategyEditorControl;
+		}
+
+		public void actionPerformed(ActionEvent e) {
+			workingStack = IterationStrategyContextualView.copyIterationStrategyStack(originalStack);
+			strategyEditorControl
+					.setIterationStrategy(IterationStrategyContextualView.getIterationStrategy(workingStack));
+		}
+
+	}
+
+	private final class CancelAction extends AbstractAction {
+		private final JDialog dialog;
+
+		private CancelAction(JDialog dialog) {
+			super("Cancel");
+			this.dialog = dialog;
+		}
+
+		public void actionPerformed(ActionEvent e) {
+			dialog.setVisible(false);
+		}
+
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-iteration-strategy-ui/src/main/java/org/apache/taverna/workbench/iterationstrategy/contextview/IterationStrategyContextualView.java
----------------------------------------------------------------------
diff --git a/taverna-iteration-strategy-ui/src/main/java/org/apache/taverna/workbench/iterationstrategy/contextview/IterationStrategyContextualView.java b/taverna-iteration-strategy-ui/src/main/java/org/apache/taverna/workbench/iterationstrategy/contextview/IterationStrategyContextualView.java
new file mode 100644
index 0000000..2f516ef
--- /dev/null
+++ b/taverna-iteration-strategy-ui/src/main/java/org/apache/taverna/workbench/iterationstrategy/contextview/IterationStrategyContextualView.java
@@ -0,0 +1,231 @@
+/*******************************************************************************
+ * 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 org.apache.taverna.workbench.iterationstrategy.contextview;
+
+import java.awt.Frame;
+import java.awt.event.ActionEvent;
+import java.util.List;
+
+import javax.swing.AbstractAction;
+import javax.swing.Action;
+import javax.swing.JComponent;
+
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.file.FileManager;
+import org.apache.taverna.workbench.helper.HelpEnabledDialog;
+import org.apache.taverna.workbench.iterationstrategy.editor.IterationStrategyTree;
+import org.apache.taverna.workbench.ui.views.contextualviews.ContextualView;
+import org.apache.taverna.workflowmodel.Processor;
+import org.apache.taverna.workflowmodel.processor.iteration.IterationStrategy;
+import org.apache.taverna.workflowmodel.processor.iteration.IterationStrategyStack;
+import org.apache.taverna.workflowmodel.processor.iteration.impl.IterationStrategyImpl;
+import org.apache.taverna.workflowmodel.processor.iteration.impl.IterationStrategyStackImpl;
+
+import org.apache.log4j.Logger;
+import org.jdom.Content;
+import org.jdom.Element;
+import org.jdom.filter.ElementFilter;
+
+/**
+ * Contextual view of an {@link IterationStrategyStack}.
+ *
+ * @author Stian Soiland-Reyes
+ *
+ */
+public class IterationStrategyContextualView extends ContextualView {
+
+	private static Logger logger = Logger
+			.getLogger(IterationStrategyContextualView.class);
+
+	private EditManager editManager;
+
+	private FileManager fileManager;
+
+	private IterationStrategyStack iterationStack;
+
+	private final Processor processor;
+
+	private IterationStrategyTree strategyTree = new IterationStrategyTree();
+
+	static {
+
+// This should be enabled and modified for T2-822
+/*		editManager.addObserver(new Observer<EditManagerEvent> () {
+
+			private void examineEdit(Edit edit) {
+				if (edit instanceof ConnectDatalinkEdit) {
+					processConnectDatalinkEdit((ConnectDatalinkEdit) edit);
+				}
+				if (edit instanceof CompoundEdit) {
+					processCompoundEdit((CompoundEdit) edit);
+				}
+			}
+
+			private void processConnectDatalinkEdit(ConnectDatalinkEdit edit) {
+				Datalink d = ((ConnectDatalinkEdit) edit).getSubject();
+				EventHandlingInputPort sink = d.getSink();
+				if (sink instanceof ProcessorInputPort) {
+					ProcessorInputPort pip = (ProcessorInputPort) sink;
+					Processor p = pip.getProcessor();
+					final HelpEnabledDialog dialog = new IterationStrategyConfigurationDialog(null, p, copyIterationStrategyStack(p.getIterationStrategy()));
+					dialog.setVisible(true);
+				}
+			}
+
+			private void processCompoundEdit(CompoundEdit edit) {
+				for (Edit e : edit.getChildEdits()) {
+					examineEdit(e);
+				}
+			}
+
+			@Override
+			public void notify(Observable<EditManagerEvent> sender,
+					EditManagerEvent message) throws Exception {
+				if (!(message instanceof DataflowEditEvent)) {
+					return;
+				}
+				examineEdit(message.getEdit());
+			}});*/
+	}
+
+	public IterationStrategyContextualView(Processor processor, EditManager editManager, FileManager fileManager) {
+		if (processor == null || processor.getIterationStrategy() == null) {
+			throw new NullPointerException(
+					"Iteration strategy stack can't be null");
+		}
+		this.processor = processor;
+		this.editManager = editManager;
+		this.fileManager = fileManager;
+		refreshIterationStrategyStack();
+		initView();
+	}
+
+	@Override
+	public Action getConfigureAction(final Frame owner) {
+		return new ConfigureIterationStrategyAction(owner);
+	}
+
+	public Processor getProcessor() {
+		return processor;
+	}
+
+	@Override
+	public void refreshView() {
+		refreshIterationStrategyStack();
+		strategyTree.setIterationStrategy(getIterationStrategy(iterationStack));
+	}
+
+	public static IterationStrategyStack copyIterationStrategyStack(
+			IterationStrategyStack stack) {
+		Element asXML = ((IterationStrategyStackImpl)stack).asXML();
+		stripEmptyElements(asXML);
+		IterationStrategyStackImpl copyStack = new IterationStrategyStackImpl();
+		copyStack.configureFromElement(asXML);
+		if (copyStack.getStrategies().isEmpty()) {
+			copyStack.addStrategy(new IterationStrategyImpl());
+		}
+		return copyStack;
+	}
+
+	private static void stripEmptyElements(Element asXML) {
+		int childCount = asXML.getContent().size();
+		int index = 0;
+		while (index < childCount) {
+			Content child = asXML.getContent(index);
+			if (child instanceof Element) {
+				Element childElement = (Element) child;
+				if (childElement.getName().equals("port")) {
+					index++;
+				}
+				else if (childElement.getDescendants(new ElementFilter("port")).hasNext()) {
+					stripEmptyElements(childElement);
+					index++;
+				} else {
+					asXML.removeContent(childElement);
+					childCount--;
+				}
+			}
+		}
+	}
+
+	public static IterationStrategy getIterationStrategy(IterationStrategyStack iStack) {
+		List<? extends IterationStrategy> strategies = iStack
+				.getStrategies();
+		if (strategies.isEmpty()) {
+			throw new IllegalStateException("Empty iteration stack");
+		}
+		IterationStrategy strategy = strategies.get(0);
+		if (!(strategy instanceof IterationStrategyImpl)) {
+			throw new IllegalStateException(
+					"Can't edit unknown iteration strategy implementation "
+							+ strategy);
+		}
+		return (IterationStrategyImpl) strategy;
+	}
+
+	private void refreshIterationStrategyStack() {
+		IterationStrategyStack originalIterationStrategy = processor
+				.getIterationStrategy();
+		if (!(originalIterationStrategy instanceof IterationStrategyStackImpl)) {
+			throw new IllegalStateException(
+					"Unknown iteration strategy implementation "
+							+ originalIterationStrategy);
+		}
+		this.iterationStack = copyIterationStrategyStack((IterationStrategyStackImpl) originalIterationStrategy);
+	}
+
+	@Override
+	public JComponent getMainFrame() {
+		refreshView();
+		return strategyTree;
+	}
+
+	@Override
+	public String getViewTitle() {
+		return "List handling";
+	}
+
+	private final class ConfigureIterationStrategyAction extends AbstractAction {
+		private final Frame owner;
+
+		private ConfigureIterationStrategyAction(Frame owner) {
+			super("Configure");
+			this.owner = owner;
+		}
+
+		public void actionPerformed(ActionEvent e) {
+			final HelpEnabledDialog dialog = new IterationStrategyConfigurationDialog(owner, processor, iterationStack, editManager, fileManager);
+			dialog.setVisible(true);
+			refreshView();
+		}
+
+
+
+	}
+
+	@Override
+	public int getPreferredPosition() {
+		return 200;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-iteration-strategy-ui/src/main/java/org/apache/taverna/workbench/iterationstrategy/contextview/IterationStrategyContextualViewFactory.java
----------------------------------------------------------------------
diff --git a/taverna-iteration-strategy-ui/src/main/java/org/apache/taverna/workbench/iterationstrategy/contextview/IterationStrategyContextualViewFactory.java b/taverna-iteration-strategy-ui/src/main/java/org/apache/taverna/workbench/iterationstrategy/contextview/IterationStrategyContextualViewFactory.java
new file mode 100644
index 0000000..412e081
--- /dev/null
+++ b/taverna-iteration-strategy-ui/src/main/java/org/apache/taverna/workbench/iterationstrategy/contextview/IterationStrategyContextualViewFactory.java
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * 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 org.apache.taverna.workbench.iterationstrategy.contextview;
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.file.FileManager;
+import org.apache.taverna.workbench.ui.views.contextualviews.ContextualView;
+import org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory;
+import org.apache.taverna.workflowmodel.Processor;
+
+public class IterationStrategyContextualViewFactory implements
+		ContextualViewFactory<Processor> {
+
+	private EditManager editManager;
+	private FileManager fileManager;
+
+	public boolean canHandle(Object selection) {
+		return selection instanceof Processor;
+	}
+
+	public List<ContextualView> getViews(Processor p) {
+		return Arrays.asList(new ContextualView[] {new IterationStrategyContextualView(p, editManager, fileManager)});
+	}
+
+	public void setEditManager(EditManager editManager) {
+		this.editManager = editManager;
+	}
+
+	public void setFileManager(FileManager fileManager) {
+		this.fileManager = fileManager;
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-iteration-strategy-ui/src/main/java/org/apache/taverna/workbench/iterationstrategy/editor/IterationStrategyCellRenderer.java
----------------------------------------------------------------------
diff --git a/taverna-iteration-strategy-ui/src/main/java/org/apache/taverna/workbench/iterationstrategy/editor/IterationStrategyCellRenderer.java b/taverna-iteration-strategy-ui/src/main/java/org/apache/taverna/workbench/iterationstrategy/editor/IterationStrategyCellRenderer.java
new file mode 100644
index 0000000..4be3997
--- /dev/null
+++ b/taverna-iteration-strategy-ui/src/main/java/org/apache/taverna/workbench/iterationstrategy/editor/IterationStrategyCellRenderer.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 org.apache.taverna.workbench.iterationstrategy.editor;
+
+import java.awt.Component;
+
+import javax.swing.JTree;
+import javax.swing.tree.DefaultTreeCellRenderer;
+
+import org.apache.taverna.workbench.icons.WorkbenchIcons;
+import org.apache.taverna.workbench.iterationstrategy.IterationStrategyIcons;
+import org.apache.taverna.workflowmodel.processor.iteration.CrossProduct;
+import org.apache.taverna.workflowmodel.processor.iteration.DotProduct;
+import org.apache.taverna.workflowmodel.processor.iteration.NamedInputPortNode;
+
+import org.apache.log4j.Logger;
+
+@SuppressWarnings("serial")
+final class IterationStrategyCellRenderer extends DefaultTreeCellRenderer {
+
+	@SuppressWarnings("unused")
+	private static Logger logger = Logger
+			.getLogger(IterationStrategyCellRenderer.class);
+
+	@Override
+	public Component getTreeCellRendererComponent(JTree tree, Object value,
+			boolean selected, boolean expanded, boolean leaf, int row,
+			boolean hasFocus) {
+		super.getTreeCellRendererComponent(tree, value, selected, expanded,
+				leaf, row, hasFocus);
+		if (value instanceof CrossProduct) {
+			setIcon(IterationStrategyIcons.joinIteratorIcon);
+			setText("Cross product");
+		} else if (value instanceof DotProduct) {
+			setIcon(IterationStrategyIcons.lockStepIteratorIcon);
+			setText("Dot product");
+		} else if (value instanceof NamedInputPortNode) {
+			setIcon(IterationStrategyIcons.leafnodeicon);
+			NamedInputPortNode namedInput = (NamedInputPortNode) value;
+			setText(namedInput.getPortName());
+		} else {
+			setText("List handling");
+			if (!leaf){
+				if (expanded) {
+					setIcon(WorkbenchIcons.folderOpenIcon);
+				} else {
+					setIcon(WorkbenchIcons.folderClosedIcon);
+				}
+			}
+		}
+		return this;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-iteration-strategy-ui/src/main/java/org/apache/taverna/workbench/iterationstrategy/editor/IterationStrategyEditor.java
----------------------------------------------------------------------
diff --git a/taverna-iteration-strategy-ui/src/main/java/org/apache/taverna/workbench/iterationstrategy/editor/IterationStrategyEditor.java b/taverna-iteration-strategy-ui/src/main/java/org/apache/taverna/workbench/iterationstrategy/editor/IterationStrategyEditor.java
new file mode 100644
index 0000000..695fd0b
--- /dev/null
+++ b/taverna-iteration-strategy-ui/src/main/java/org/apache/taverna/workbench/iterationstrategy/editor/IterationStrategyEditor.java
@@ -0,0 +1,247 @@
+/*******************************************************************************
+ * 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 org.apache.taverna.workbench.iterationstrategy.editor;
+
+import java.awt.GraphicsEnvironment;
+import java.awt.datatransfer.DataFlavor;
+import java.awt.datatransfer.Transferable;
+import java.awt.datatransfer.UnsupportedFlavorException;
+//import java.awt.image.BufferedImage;
+import java.io.IOException;
+
+import javax.swing.DropMode;
+import javax.swing.JComponent;
+import javax.swing.JTree;
+import javax.swing.TransferHandler;
+import javax.swing.tree.DefaultTreeModel;
+import javax.swing.tree.TreePath;
+import javax.swing.tree.TreeSelectionModel;
+
+import org.apache.taverna.workbench.ui.zaria.UIComponentSPI;
+import org.apache.taverna.workflowmodel.processor.iteration.AbstractIterationStrategyNode;
+import org.apache.taverna.workflowmodel.processor.iteration.IterationStrategy;
+import org.apache.taverna.workflowmodel.processor.iteration.NamedInputPortNode;
+import org.apache.taverna.workflowmodel.processor.iteration.TerminalNode;
+
+import org.apache.log4j.Logger;
+
+@SuppressWarnings("serial")
+public class IterationStrategyEditor extends IterationStrategyTree implements
+		UIComponentSPI {
+
+	private static Logger logger = Logger
+			.getLogger(IterationStrategyEditor.class);
+
+	//private BufferedImage imgGhost; // The 'drag image'
+
+	// mouse was clicked
+
+	public IterationStrategyEditor() {
+		super();
+		// Make this a drag source
+		if (!GraphicsEnvironment.isHeadless()) {
+			this.setDragEnabled(true);  
+	        this.setDropMode(DropMode.ON_OR_INSERT);  
+	        this.setTransferHandler(new TreeTransferHandler());  
+	        this.getSelectionModel().setSelectionMode(  
+	                TreeSelectionModel.CONTIGUOUS_TREE_SELECTION);  
+	        expandTree();
+		}
+
+		//
+	}
+
+	public IterationStrategyEditor(IterationStrategy theStrategy) {
+		this();
+		setIterationStrategy(theStrategy);
+	}
+
+    /**
+     * 
+     * This code is freely adapted from code derived 
+     *
+     */
+    class TreeTransferHandler extends TransferHandler {  
+        DataFlavor nodesFlavor;
+        DataFlavor[] flavors = new DataFlavor[1];  
+       
+        public TreeTransferHandler() {
+        	getNodesFlavor();
+          }
+        
+        private DataFlavor getNodesFlavor() {
+        	if (nodesFlavor == null) {
+                try {  
+                     nodesFlavor = new DataFlavor(DataFlavor.javaJVMLocalObjectMimeType +
+                             ";class=" + AbstractIterationStrategyNode.class.getName(),
+                             "AbstractIterationStrategyNode",
+                             this.getClass().getClassLoader());  
+                    flavors[0] = nodesFlavor;  
+                } catch(Exception e) {  
+                    logger.error("Problem creating nodesFlavor:" + e);
+                }         		
+        	}
+        	return nodesFlavor;
+        }
+       
+        public boolean canImport(TransferHandler.TransferSupport support) {  
+            if(!support.isDrop()) {
+            	logger.error("isDrop not supported");
+                return false;  
+            }  
+
+            if(!support.isDataFlavorSupported(getNodesFlavor())) {
+            	logger.info("Not correct flavor");
+                return false;  
+            }  
+            // Do not allow a drop on the drag source selections.  
+            JTree.DropLocation dl =  
+                    (JTree.DropLocation)support.getDropLocation();  
+            TreePath dest = dl.getPath();  
+            AbstractIterationStrategyNode destination =  
+                (AbstractIterationStrategyNode)dest.getLastPathComponent();
+            Transferable t = support.getTransferable();
+            if (destination instanceof TerminalNode) {
+            	return false;
+            }
+            try {
+				AbstractIterationStrategyNode node = (AbstractIterationStrategyNode) t.getTransferData(getNodesFlavor());
+				if (node.isNodeDescendant(destination)) {
+					return false;
+				}
+			} catch (UnsupportedFlavorException e) {
+				return false;
+			} catch (IOException e) {
+				return false;
+			}  
+//			JTree tree = (JTree) support.getComponent();
+//			int dropRow = tree.getRowForPath(dl.getPath());
+//			int selRow = tree.getLeadSelectionRow();
+//			if (selRow == dropRow) {
+//				logger.info("Dragging to source");
+//				return false;
+//
+//			}
+			support.setShowDropLocation(true);  
+            return true;  
+        }  
+       
+         protected Transferable createTransferable(JComponent c) {  
+            JTree tree = (JTree)c;  
+            TreePath[] paths = tree.getSelectionPaths();  
+            if(paths != null) {  
+                AbstractIterationStrategyNode node =  
+                    (AbstractIterationStrategyNode)paths[0].getLastPathComponent();  
+                 return new NodeTransferable(node);  
+            }  
+            return null;  
+        }  
+              
+        protected void exportDone(JComponent source, Transferable data, int action) {  
+        }  
+       
+        public int getSourceActions(JComponent c) {  
+            return MOVE;  
+        }  
+       
+        public boolean importData(TransferHandler.TransferSupport support) { 
+            if(!canImport(support)) {
+            	logger.info("Cannot import");
+                return false;  
+            }  
+            // Extract transfer data.  
+            AbstractIterationStrategyNode node = null;  
+            try {  
+                Transferable t = support.getTransferable();  
+                node = (AbstractIterationStrategyNode) t.getTransferData(getNodesFlavor());  
+            } catch(UnsupportedFlavorException ufe) {  
+                logger.error("UnsupportedFlavor", ufe);  
+            } catch (Exception e) {
+            	logger.error("Problem getting transfer data", e);
+            }
+
+           // Get drop location info.  
+            JTree.DropLocation dl =  
+                    (JTree.DropLocation)support.getDropLocation();  
+            int childIndex = dl.getChildIndex();  
+            TreePath dest = dl.getPath();  
+            AbstractIterationStrategyNode parent =  
+                (AbstractIterationStrategyNode)dest.getLastPathComponent();
+            int index = childIndex;
+            logger.info ("parent is a " + parent.getClass().getName());
+            if (parent instanceof NamedInputPortNode) {
+            	AbstractIterationStrategyNode sibling = parent;
+            	parent = (AbstractIterationStrategyNode) sibling.getParent();
+            	index = parent.getIndex(sibling);
+            } else if (index == -1) {
+            	index = parent.getChildCount();
+            }
+            if (parent instanceof TerminalNode) {
+            	if (parent.getChildCount() > 0) {
+            		parent = (AbstractIterationStrategyNode) parent.getChildAt(0);
+            		index = parent.getChildCount();
+            	}
+            	
+            }
+            logger.info("parent is a " + parent.getClass().getName());
+
+			try {
+				// The parent insert removes from the oldParent
+				parent.insert(node, index++);
+				DefaultTreeModel model = IterationStrategyEditor.this
+						.getModel();
+				refreshModel();
+			} catch (IllegalStateException e) {
+				logger.error(e);
+			} catch (IllegalArgumentException e) {
+				logger.error(e);
+			}
+          return true;  
+        }  
+       
+        public String toString() {  
+            return getClass().getName();  
+        }  
+       
+        public class NodeTransferable implements Transferable {  
+            AbstractIterationStrategyNode node;  
+       
+            public NodeTransferable(AbstractIterationStrategyNode node) {  
+                this.node = node;  
+             }  
+       
+            public AbstractIterationStrategyNode getTransferData(DataFlavor flavor)  
+                                     throws UnsupportedFlavorException {  
+                if(!isDataFlavorSupported(flavor))  
+                    throw new UnsupportedFlavorException(flavor);  
+                return node;  
+            }  
+       
+            public DataFlavor[] getTransferDataFlavors() {  
+                return flavors;  
+            }  
+       
+            public boolean isDataFlavorSupported(DataFlavor flavor) {
+            	 return getNodesFlavor().equals(flavor);  
+            }  
+        }  
+    }
+}


[23/51] [partial] incubator-taverna-workbench git commit: all packages are moved to org.apache.taverna.*

Posted by re...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/RemoveWorkflowOutputPortEdit.java
----------------------------------------------------------------------
diff --git a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/RemoveWorkflowOutputPortEdit.java b/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/RemoveWorkflowOutputPortEdit.java
deleted file mode 100644
index 35f3498..0000000
--- a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/RemoveWorkflowOutputPortEdit.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2013 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.workflow.edits;
-
-import static org.apache.taverna.scufl2.api.common.Scufl2Tools.NESTED_WORKFLOW;
-
-import java.util.List;
-
-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 org.apache.taverna.scufl2.api.activity.Activity;
-import org.apache.taverna.scufl2.api.configurations.Configuration;
-import org.apache.taverna.scufl2.api.container.WorkflowBundle;
-import org.apache.taverna.scufl2.api.core.Workflow;
-import org.apache.taverna.scufl2.api.port.OutputActivityPort;
-import org.apache.taverna.scufl2.api.port.OutputProcessorPort;
-import org.apache.taverna.scufl2.api.port.OutputWorkflowPort;
-import org.apache.taverna.scufl2.api.profiles.ProcessorBinding;
-import org.apache.taverna.scufl2.api.profiles.ProcessorOutputPortBinding;
-import org.apache.taverna.scufl2.api.profiles.Profile;
-
-import com.fasterxml.jackson.databind.JsonNode;
-
-/**
- * Removes an output port from a workflow.
- *
- * @author David Withers
- */
-public class RemoveWorkflowOutputPortEdit extends AbstractEdit<Workflow> {
-	private final OutputWorkflowPort port;
-	private final CompoundEdit nestedPortEdit = new CompoundEdit();
-
-	public RemoveWorkflowOutputPortEdit(Workflow workflow,
-			OutputWorkflowPort port) {
-		super(workflow);
-		this.port = port;
-		WorkflowBundle workflowBundle = workflow.getParent();
-		if (workflowBundle != null)
-			for (Profile profile : workflowBundle.getProfiles())
-				for (Activity activity : profile.getActivities())
-					if (activity.getType().equals(NESTED_WORKFLOW))
-						for (Configuration c : scufl2Tools.configurationsFor(
-								activity, profile))
-							defineEditsForConfiguration(workflow, port,
-									workflowBundle, activity, c);
-	}
-
-	private void defineEditsForConfiguration(Workflow workflow,
-			OutputWorkflowPort port, WorkflowBundle workflowBundle,
-			Activity activity, Configuration c) {
-		List<Edit<?>> edits = nestedPortEdit.getChildEdits();
-		JsonNode nested = c.getJson().get("nestedWorkflow");
-		Workflow nestedWorkflow = workflowBundle.getWorkflows().getByName(
-				nested.asText());
-		if (nestedWorkflow != workflow)
-			return;
-
-		OutputActivityPort activityPort = activity.getOutputPorts().getByName(
-				port.getName());
-		edits.add(new RemoveChildEdit<>(activity, activityPort));
-		for (ProcessorBinding processorBinding : scufl2Tools
-				.processorBindingsToActivity(activity))
-			for (ProcessorOutputPortBinding portBinding : processorBinding
-					.getOutputPortBindings())
-				if (portBinding.getBoundActivityPort() == activityPort) {
-					OutputProcessorPort processorPort = portBinding
-							.getBoundProcessorPort();
-					edits.add(new RemoveProcessorOutputPortEdit(
-							processorBinding.getBoundProcessor(), processorPort));
-					edits.add(new RemoveChildEdit<>(processorBinding,
-							portBinding));
-				}
-	}
-
-	@Override
-	protected void doEditAction(Workflow workflow) throws EditException {
-		port.setParent(null);
-		nestedPortEdit.doEdit();
-	}
-
-	@Override
-	protected void undoEditAction(Workflow workflow) {
-		port.setParent(workflow);
-		nestedPortEdit.undo();
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/RenameEdit.java
----------------------------------------------------------------------
diff --git a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/RenameEdit.java b/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/RenameEdit.java
deleted file mode 100644
index 2d54f1c..0000000
--- a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/RenameEdit.java
+++ /dev/null
@@ -1,136 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2012 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.workflow.edits;
-
-import static org.apache.taverna.scufl2.api.common.Scufl2Tools.NESTED_WORKFLOW;
-import org.apache.taverna.scufl2.api.activity.Activity;
-import org.apache.taverna.scufl2.api.common.Named;
-import org.apache.taverna.scufl2.api.configurations.Configuration;
-import org.apache.taverna.scufl2.api.container.WorkflowBundle;
-import org.apache.taverna.scufl2.api.core.Workflow;
-import org.apache.taverna.scufl2.api.port.ActivityPort;
-import org.apache.taverna.scufl2.api.port.InputPort;
-import org.apache.taverna.scufl2.api.port.ProcessorPort;
-import org.apache.taverna.scufl2.api.port.WorkflowPort;
-import org.apache.taverna.scufl2.api.profiles.ProcessorBinding;
-import org.apache.taverna.scufl2.api.profiles.ProcessorInputPortBinding;
-import org.apache.taverna.scufl2.api.profiles.ProcessorOutputPortBinding;
-import org.apache.taverna.scufl2.api.profiles.Profile;
-
-import com.fasterxml.jackson.databind.JsonNode;
-
-/**
- * Renames a Named WorkflowBean.
- *
- * @author David Withers
- */
-public class RenameEdit<T extends Named> extends AbstractEdit<T> {
-	private String oldName, newName;
-
-	public RenameEdit(T named, String newName) {
-		super(named);
-		this.newName = newName;
-		oldName = named.getName();
-	}
-
-	@Override
-	protected void doEditAction(T named) {
-		named.setName(newName);
-		if (named instanceof WorkflowPort)
-			checkNestedPortNames((WorkflowPort) named, oldName, newName);
-	}
-
-	@Override
-	protected void undoEditAction(T named) {
-		named.setName(oldName);
-		if (named instanceof WorkflowPort)
-			checkNestedPortNames((WorkflowPort) named, newName, oldName);
-	}
-
-	private void checkNestedPortNames(WorkflowPort workflowPort, String oldName, String newName) {
-		Workflow workflow = workflowPort.getParent();
-		if (workflow == null)
-			return;
-		WorkflowBundle workflowBundle = workflow.getParent();
-		if (workflowBundle == null)
-			return;
-		for (Profile profile : workflowBundle.getProfiles())
-			for (Activity activity : profile.getActivities())
-				if (activity.getType().equals(NESTED_WORKFLOW))
-					for (Configuration c : scufl2Tools.configurationsFor(activity, profile))
-						changeActivityPortName(workflowPort, oldName,
-								newName, workflow, workflowBundle, activity, c);
-	}
-
-	private void changeActivityPortName(WorkflowPort workflowPort,
-			String oldName, String newName, Workflow workflow,
-			WorkflowBundle workflowBundle, Activity activity, Configuration c) {
-		JsonNode nested = c.getJson().get("nestedWorkflow");
-		Workflow nestedWorkflow = workflowBundle.getWorkflows().getByName(
-				nested.asText());
-		if (nestedWorkflow != workflow)
-			return;
-
-		ActivityPort activityPort;
-		if (workflowPort instanceof InputPort) {
-			activityPort = activity.getInputPorts().getByName(oldName);
-			changeProcessorInputPortName(oldName, newName, activity,
-					activityPort);
-		} else {
-			activityPort = activity.getOutputPorts().getByName(oldName);
-			changeProcessorOutputPortName(oldName, newName, activity,
-					activityPort);
-		}
-		activityPort.setName(newName);
-	}
-
-	private void changeProcessorInputPortName(String oldName, String newName,
-			Activity activity, ActivityPort activityPort) {
-		bindings: for (ProcessorBinding binding : scufl2Tools
-				.processorBindingsToActivity(activity))
-			for (ProcessorInputPortBinding portBinding : binding
-					.getInputPortBindings())
-				if (portBinding.getBoundActivityPort() == activityPort) {
-					ProcessorPort processorPort = portBinding
-							.getBoundProcessorPort();
-					if (processorPort.getName().equals(oldName)) {
-						processorPort.setName(newName);
-						continue bindings;
-					}
-				}
-	}
-
-	private void changeProcessorOutputPortName(String oldName, String newName,
-			Activity activity, ActivityPort activityPort) {
-		bindings: for (ProcessorBinding binding : scufl2Tools
-				.processorBindingsToActivity(activity))
-			for (ProcessorOutputPortBinding portBinding : binding
-					.getOutputPortBindings())
-				if (portBinding.getBoundActivityPort() == activityPort) {
-					ProcessorPort processorPort = portBinding
-							.getBoundProcessorPort();
-					if (processorPort.getName().equals(oldName)) {
-						processorPort.setName(newName);
-						continue bindings;
-					}
-				}
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/ReorderMergePositionsEdit.java
----------------------------------------------------------------------
diff --git a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/ReorderMergePositionsEdit.java b/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/ReorderMergePositionsEdit.java
deleted file mode 100644
index dafcf9d..0000000
--- a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/ReorderMergePositionsEdit.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2012 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.workflow.edits;
-
-import java.util.List;
-
-import net.sf.taverna.t2.workbench.edits.EditException;
-import org.apache.taverna.scufl2.api.core.DataLink;
-import org.apache.taverna.scufl2.api.port.ReceiverPort;
-
-/**
- * Change datalink merge positions based on ordered list of data links.
- * 
- * @author David Withers
- * @author Stian Soiland-Reyes
- */
-public class ReorderMergePositionsEdit extends AbstractEdit<ReceiverPort> {
-	private List<DataLink> newMergePositions;
-	private final List<DataLink> oldMergePositions;
-
-	public ReorderMergePositionsEdit(List<DataLink> dataLinks,
-			List<DataLink> newMergePositions) {
-		super(dataLinks.get(0).getSendsTo());
-		this.oldMergePositions = dataLinks;
-		this.newMergePositions = newMergePositions;
-	}
-
-	@Override
-	protected void doEditAction(ReceiverPort subject) throws EditException {
-		for (int i = 0; i < newMergePositions.size(); i++)
-			newMergePositions.get(i).setMergePosition(i);
-	}
-
-	@Override
-	protected void undoEditAction(ReceiverPort subject) {
-		for (int i = 0; i < oldMergePositions.size(); i++)
-			oldMergePositions.get(i).setMergePosition(i);
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/SetIterationStrategyStackEdit.java
----------------------------------------------------------------------
diff --git a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/SetIterationStrategyStackEdit.java b/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/SetIterationStrategyStackEdit.java
deleted file mode 100644
index d2ed4ff..0000000
--- a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/SetIterationStrategyStackEdit.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * 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.workflow.edits;
-
-import org.apache.taverna.scufl2.api.core.Processor;
-import org.apache.taverna.scufl2.api.iterationstrategy.IterationStrategyStack;
-
-/**
- * Set the iteration strategy
- * 
- * @author Stian Soiland-Reyes
- */
-public class SetIterationStrategyStackEdit extends AbstractEdit<Processor> {
-	private final IterationStrategyStack iterationStrategyStack;
-	private IterationStrategyStack oldStrategyStack;
-
-	public SetIterationStrategyStackEdit(Processor processor,
-			IterationStrategyStack iterationStrategyStack) {
-		super(processor);
-		this.iterationStrategyStack = iterationStrategyStack;
-	}
-
-	@Override
-	protected void doEditAction(Processor processor) {
-		oldStrategyStack = processor.getIterationStrategyStack();
-		processor.setIterationStrategyStack(iterationStrategyStack);
-	}
-
-	@Override
-	protected void undoEditAction(Processor processor) {
-		processor.setIterationStrategyStack(oldStrategyStack);
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/UpdateDataflowInternalIdentifierEdit.java
----------------------------------------------------------------------
diff --git a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/UpdateDataflowInternalIdentifierEdit.java b/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/UpdateDataflowInternalIdentifierEdit.java
deleted file mode 100644
index 4936b98..0000000
--- a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workflow/edits/UpdateDataflowInternalIdentifierEdit.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * 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.workflow.edits;
-
-import java.net.URI;
-
-import org.apache.taverna.scufl2.api.container.WorkflowBundle;
-
-public class UpdateDataflowInternalIdentifierEdit extends
-		AbstractEdit<WorkflowBundle> {
-	private URI newId;
-	private URI oldId;
-
-	public UpdateDataflowInternalIdentifierEdit(WorkflowBundle dataflow,
-			URI newId) {
-		super(dataflow);
-		this.newId = newId;
-		this.oldId = dataflow.getGlobalBaseURI();
-	}
-
-	@Override
-	protected void doEditAction(WorkflowBundle dataflow) {
-		dataflow.setGlobalBaseURI(newId);
-	}
-
-	@Override
-	protected void undoEditAction(WorkflowBundle dataflow) {
-		dataflow.setGlobalBaseURI(oldId);
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-api/src/main/java/org/apache/taverna/workbench/edits/CompoundEdit.java
----------------------------------------------------------------------
diff --git a/taverna-edits-api/src/main/java/org/apache/taverna/workbench/edits/CompoundEdit.java b/taverna-edits-api/src/main/java/org/apache/taverna/workbench/edits/CompoundEdit.java
new file mode 100644
index 0000000..514042b
--- /dev/null
+++ b/taverna-edits-api/src/main/java/org/apache/taverna/workbench/edits/CompoundEdit.java
@@ -0,0 +1,117 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.edits;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.taverna.scufl2.api.common.WorkflowBean;
+
+/**
+ * Implementation of Edit which contains an ordered list of child edits. Child
+ * edits are applied collectively and in order, any failure in any child edit
+ * causes an undo of previously applied children and a propogation of the edit
+ * exception.
+ * 
+ * @author Tom Oinn
+ */
+public class CompoundEdit implements Edit<WorkflowBean> {
+	private final transient List<Edit<?>> childEdits;
+	private transient boolean applied = false;
+
+	/**
+	 * Create a new compound edit with no existing Edit objects.
+	 * 
+	 */
+	public CompoundEdit() {
+		this.childEdits = new ArrayList<>();
+	}
+
+	/**
+	 * Create a new compound edit with the specified edits as children.
+	 */
+	public CompoundEdit(List<Edit<?>> edits) {
+		this.childEdits = edits;
+	}
+
+	/**
+	 * Get the list of edits.
+	 * @return a live-editable list.
+	 */
+	public List<Edit<?>> getChildEdits() {
+		return childEdits;
+	}
+
+	/**
+	 * Attempts to call the doEdit method of all child edits. If any of those
+	 * children throws an EditException any successful edits are rolled back and
+	 * the exception is rethrown as the cause of a new EditException from the
+	 * CompoundEdit
+	 */
+	@Override
+	public synchronized WorkflowBean doEdit() throws EditException {
+		if (isApplied())
+			throw new EditException("Cannot apply an edit more than once!");
+		List<Edit<?>> doneEdits = new ArrayList<>();
+		try {
+			for (Edit<?> edit : childEdits) {
+				edit.doEdit();
+				/*
+				 * Insert the done edit at position 0 in the list so we can
+				 * iterate over the list in the normal order if we need to
+				 * rollback, this ensures that the most recent edit is first.
+				 */
+				doneEdits.add(0, edit);
+			}
+			applied = true;
+		} catch (EditException ee) {
+			for (Edit<?> undoMe : doneEdits)
+				undoMe.undo();
+			applied = false;
+			throw new EditException("Failed child of compound edit", ee);
+		}
+		return null;
+	}
+
+	/**
+	 * There is no explicit subject for a compound edit, so this method always
+	 * returns null.
+	 */
+	@Override
+	public Object getSubject() {
+		return null;
+	}
+
+	/**
+	 * Rolls back all child edits in reverse order
+	 */
+	@Override
+	public synchronized void undo() {
+		for (int i = childEdits.size() - 1; i >= 0; i--)
+			// Undo child edits in reverse order
+			childEdits.get(i).undo();
+		applied = false;
+	}
+
+	@Override
+	public boolean isApplied() {
+		return applied;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-api/src/main/java/org/apache/taverna/workbench/edits/Edit.java
----------------------------------------------------------------------
diff --git a/taverna-edits-api/src/main/java/org/apache/taverna/workbench/edits/Edit.java b/taverna-edits-api/src/main/java/org/apache/taverna/workbench/edits/Edit.java
new file mode 100644
index 0000000..63e9c77
--- /dev/null
+++ b/taverna-edits-api/src/main/java/org/apache/taverna/workbench/edits/Edit.java
@@ -0,0 +1,65 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.edits;
+
+import org.apache.taverna.scufl2.api.common.WorkflowBean;
+
+/**
+ * The workflow object model exposed by this API is read only. Properties of the
+ * model can only be changed through implementations of this interface, this
+ * ensures a consistant approach to grouped edits (transactions) and undo / redo
+ * support within the UI. It also potentially allows for capture of editing
+ * provenance where a workflow is repurposed or created from an aggregate of
+ * several others.
+ * 
+ * @author Tom Oinn
+ */
+public interface Edit<TargetType extends WorkflowBean> {
+	/**
+	 * Perform the edit
+	 * 
+	 * @throws EditException
+	 *             if the edit fails. If an edit throws EditException it should
+	 *             try to ensure the subject is unaltered. Where this is
+	 *             impossible consider breaking edits down into a compound edit.
+	 */
+	TargetType doEdit() throws EditException;
+
+	/**
+	 * Undo the edit, reverting the subject to the state it was in prior to the
+	 * edit
+	 */
+	void undo();
+
+	/**
+	 * Return the object to which this edit applies
+	 * 
+	 * @return
+	 */
+	Object getSubject();
+
+	/**
+	 * Has the edit been applied yet?
+	 * 
+	 * @return true if and only if the edit has been successfully applied to the
+	 *         subject
+	 */
+	boolean isApplied();
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-api/src/main/java/org/apache/taverna/workbench/edits/EditException.java
----------------------------------------------------------------------
diff --git a/taverna-edits-api/src/main/java/org/apache/taverna/workbench/edits/EditException.java b/taverna-edits-api/src/main/java/org/apache/taverna/workbench/edits/EditException.java
new file mode 100644
index 0000000..bd249d5
--- /dev/null
+++ b/taverna-edits-api/src/main/java/org/apache/taverna/workbench/edits/EditException.java
@@ -0,0 +1,41 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.edits;
+
+/**
+ * Superclass of all exceptions thrown when altering the workflow model through
+ * the edit manager.
+ * 
+ * @author Tom Oinn
+ */
+@SuppressWarnings("serial")
+public class EditException extends Exception {
+	public EditException(String string) {
+		super(string);
+	}
+
+	public EditException(String string, Throwable cause) {
+		super(string, cause);
+	}
+
+	public EditException(Throwable t) {
+		super(t);
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-api/src/main/java/org/apache/taverna/workbench/edits/EditManager.java
----------------------------------------------------------------------
diff --git a/taverna-edits-api/src/main/java/org/apache/taverna/workbench/edits/EditManager.java b/taverna-edits-api/src/main/java/org/apache/taverna/workbench/edits/EditManager.java
new file mode 100644
index 0000000..ca90a4b
--- /dev/null
+++ b/taverna-edits-api/src/main/java/org/apache/taverna/workbench/edits/EditManager.java
@@ -0,0 +1,221 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.edits;
+
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+import org.apache.taverna.lang.observer.Observable;
+import org.apache.taverna.lang.observer.Observer;
+import org.apache.taverna.workbench.edits.EditManager.EditManagerEvent;
+
+/**
+ * Manager that can handle {@link Edit edits} for a {@link WorkflowBundle}.
+ * <p>
+ * Edits to a workflow that are to be undoable or redoable should be created by
+ * using {@link EditManager#getEdits()} to get an {@link Edits} object. Using
+ * this to create {@link Edit}s, instead of calling {@link Edit#doEdit()}, use
+ * {@link EditManager#doDataflowEdit(WorkflowBundle, Edit)} to associate the
+ * edit with the specified Dataflow.
+ * <p>
+ * It is possible to undo a series of edits done on a particular dataflow in
+ * this way by using {@link #undoDataflowEdit(WorkflowBundle)}. If one or more
+ * undoes have been performed, they can be redone step by step using
+ * {@link #redoDataflowEdit(WorkflowBundle)}. Note that it is no longer possible
+ * to call {@link #redoDataflowEdit(WorkflowBundle)} after a
+ * {@link #doDataflowEdit(WorkflowBundle, Edit)}.
+ * <p>
+ * The EditManager is {@link Observable}. If you
+ * {@linkplain Observable#addObserver(net.sf.taverna.t2.lang.observer.Observer)
+ * add an observer} you can be notified on {@linkplain DataflowEditEvent edits},
+ * {@linkplain DataFlowUndoEvent undoes} and {@linkplain DataFlowRedoEvent
+ * redoes}.
+ * 
+ * @author Stian Soiland-Reyes
+ */
+public interface EditManager extends Observable<EditManagerEvent> {
+	/**
+	 * <code>true</code> if {@link #redoDataflowEdit(WorkflowBundle)} on the
+	 * given dataflow would redo the last undone edit. If there are no previous
+	 * edits, return <code>false</code>.
+	 * 
+	 * @param dataflow
+	 *            {@link WorkflowBundle} which last affecting edit is to be
+	 *            undone
+	 * @return <code>true</code if and only if
+	 *         {@link #redoDataflowEdit(WorkflowBundle)} would undo
+	 */
+	boolean canRedoDataflowEdit(WorkflowBundle dataflow);
+
+	/**
+	 * <code>true</code> if {@link #undoDataflowEdit(WorkflowBundle)} on the
+	 * given dataflow would undo the last edit. If there are no previous edits,
+	 * return <code>false</code>.
+	 * 
+	 * @param dataflow
+	 *            {@link WorkflowBundle} which last affecting edit is to be
+	 *            undone
+	 * @return <code>true</code if {@link #undoDataflowEdit(WorkflowBundle)}
+	 *         would undo
+	 */
+	boolean canUndoDataflowEdit(WorkflowBundle dataflow);
+
+	/**
+	 * Do an {@link Edit} affecting the given {@link WorkflowBundle}.
+	 * <p>
+	 * The edit is {@link Edit#doEdit() performed} and the edit can later be
+	 * undone using {@link EditManager#undoDataflowEdit(WorkflowBundle)}.
+	 * <p>
+	 * Note that any events previously undone with
+	 * {@link EditManager#undoDataflowEdit(WorkflowBundle)} for the given
+	 * dataflow can no longer be
+	 * {@link EditManager#redoDataflowEdit(WorkflowBundle) redone} after calling
+	 * this method.
+	 * 
+	 * @see EditManager#undoDataflowEdit(WorkflowBundle)
+	 * @param dataflow
+	 *            {@link WorkflowBundle} this edit is affecting
+	 * @param edit
+	 *            {@link Edit} that should be done using {@link Edit#doEdit()}.
+	 * @throws EditException
+	 *             If {@link Edit#doEdit()} fails
+	 */
+	void doDataflowEdit(WorkflowBundle dataflow, Edit<?> edit)
+			throws EditException;
+
+	/**
+	 * Redo the last {@link Edit} that was undone using
+	 * {@link #undoDataflowEdit(WorkflowBundle)}.
+	 * <p>
+	 * Note that the {@link EditManager} might only be able to redo a reasonable
+	 * number of steps.
+	 * <p>
+	 * It is not possible to use {@link #redoDataflowEdit(WorkflowBundle)} after
+	 * a {@link #doDataflowEdit(WorkflowBundle, Edit)} affecting the same
+	 * {@link WorkflowBundle}, or if no edits have been undone yet. No action
+	 * would be taken in these cases.
+	 * 
+	 * @param dataflow
+	 *            {@link WorkflowBundle} which last affecting edit is to be
+	 *            redone
+	 * @throws EditException
+	 *             If {@link Edit#doEdit()} fails
+	 */
+	void redoDataflowEdit(WorkflowBundle dataflow) throws EditException;
+
+	/**
+	 * Undo the last {@link Edit} affecting the given {@link WorkflowBundle}.
+	 * <p>
+	 * This can be called in succession until there are no more known undoes.
+	 * Note that the {@link EditManager} might only be able to undo a reasonable
+	 * number of steps.
+	 * <p>
+	 * The last edit must have been performed using
+	 * {@link EditManager#doDataflowEdit(WorkflowBundle, Edit)} or
+	 * {@link EditManager#redoDataflowEdit(WorkflowBundle)}. The undo is done
+	 * using {@link Edit#undo()}. If no edits have been performed for the
+	 * dataflow yet, no action is taken.
+	 * <p>
+	 * Undoes can be redone using {@link #redoDataflowEdit(WorkflowBundle)}.
+	 * 
+	 * @param dataflow
+	 *            {@link WorkflowBundle} which last affecting edit is to be
+	 *            undone
+	 */
+	void undoDataflowEdit(WorkflowBundle dataflow);
+
+	/**
+	 * An event about an {@link Edit} on a {@link WorkflowBundle}, accessible
+	 * through {@link AbstractDataflowEditEvent#getEdit()} and
+	 * {@link AbstractDataflowEditEvent#getDataFlow()}.
+	 */
+	public static abstract class AbstractDataflowEditEvent implements
+			EditManagerEvent {
+		private final WorkflowBundle dataFlow;
+		private final Edit<?> edit;
+
+		public AbstractDataflowEditEvent(WorkflowBundle dataFlow, Edit<?> edit) {
+			if (dataFlow == null || edit == null)
+				throw new NullPointerException(
+						"Dataflow and/or Edit can't be null");
+			this.dataFlow = dataFlow;
+			this.edit = edit;
+		}
+
+		/**
+		 * The {@link WorkflowBundle} this event affected.
+		 * 
+		 * @return A {@link WorkflowBundle}
+		 */
+		public WorkflowBundle getDataFlow() {
+			return dataFlow;
+		}
+
+		/**
+		 * The {@link Edit} that was performed, undoed or redone on the
+		 * {@link #getDataFlow() dataflow}.
+		 * 
+		 * @return An {@link Edit}
+		 */
+		@Override
+		public Edit<?> getEdit() {
+			return edit;
+		}
+	}
+
+	/**
+	 * An event sent when an {@link Edit} has been performed on a
+	 * {@link WorkflowBundle}.
+	 * 
+	 */
+	public static class DataflowEditEvent extends AbstractDataflowEditEvent {
+		public DataflowEditEvent(WorkflowBundle dataFlow, Edit<?> edit) {
+			super(dataFlow, edit);
+		}
+	}
+
+	/**
+	 * An event sent when a previously undone {@link Edit} has been redone on a
+	 * {@link WorkflowBundle}.
+	 * 
+	 */
+	public static class DataFlowRedoEvent extends AbstractDataflowEditEvent {
+		public DataFlowRedoEvent(WorkflowBundle dataFlow, Edit<?> edit) {
+			super(dataFlow, edit);
+		}
+	}
+
+	/**
+	 * An event sent when an {@link Edit} has been undone on a
+	 * {@link WorkflowBundle}.
+	 * 
+	 */
+	public static class DataFlowUndoEvent extends AbstractDataflowEditEvent {
+		public DataFlowUndoEvent(WorkflowBundle dataFlow, Edit<?> edit) {
+			super(dataFlow, edit);
+		}
+	}
+
+	/**
+	 * An event given to {@link Observer}s registered with
+	 * {@link Observable#addObserver(Observer)}.
+	 */
+	public interface EditManagerEvent {
+		public Edit<?> getEdit();
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-api/src/main/java/org/apache/taverna/workbench/edits/package-info.java
----------------------------------------------------------------------
diff --git a/taverna-edits-api/src/main/java/org/apache/taverna/workbench/edits/package-info.java b/taverna-edits-api/src/main/java/org/apache/taverna/workbench/edits/package-info.java
new file mode 100644
index 0000000..49e0e32
--- /dev/null
+++ b/taverna-edits-api/src/main/java/org/apache/taverna/workbench/edits/package-info.java
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * 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
+ ******************************************************************************/
+/**
+ * A {@link net.sf.taverna.t2.workbench.edits.EditManager} that can manage
+ * {@link net.sf.taverna.t2.workflowmodel.Edit}s performed from the UI.
+ * <p>
+ * To perform an edit that is to be undoable, use
+ * {@link EditManager#doDataflowEdit(net.sf.taverna.t2.workflowmodel.Dataflow, net.sf.taverna.t2.workflowmodel.Edit)}
+ * instead of {@link net.sf.taverna.t2.workflowmodel.Edit#doEdit()}. Such edits
+ * can be
+ * {@link EditManager#undoDataflowEdit(net.sf.taverna.t2.workflowmodel.Dataflow) undone}
+ * and
+ * {@link EditManager#redoDataflowEdit(net.sf.taverna.t2.workflowmodel.Dataflow) redone}.
+ * </p>
+ * <p>
+ * Edits are organised by {@link net.sf.taverna.t2.workflowmodel.Dataflow} so
+ * that if a user changes the active workflow in the Workbench and does "Undo" -
+ * that would undo the last undo done related to that workflow.
+ * </p>
+ * <p>
+ * The {@link net.sf.taverna.t2.workbench.edits.impl} implementation of the
+ * EditManager is discovered by {@link net.sf.taverna.t2.workbench.edits.EditManager#getInstance()}. The
+ * implementation also includes {@link net.sf.taverna.t2.ui.menu.MenuComponent}s
+ * for Undo and Redo.
+ * </p>
+ * 
+ * @author Stian Soiland-Reyes
+ * 
+ */
+package org.apache.taverna.workbench.edits;

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/AbstractEdit.java
----------------------------------------------------------------------
diff --git a/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/AbstractEdit.java b/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/AbstractEdit.java
new file mode 100644
index 0000000..afb3b54
--- /dev/null
+++ b/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/AbstractEdit.java
@@ -0,0 +1,118 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workflow.edits;
+
+import org.apache.taverna.workbench.edits.Edit;
+import org.apache.taverna.workbench.edits.EditException;
+import org.apache.taverna.scufl2.api.common.Scufl2Tools;
+import org.apache.taverna.scufl2.api.common.WorkflowBean;
+
+/**
+ * An abstract {@link Edit} implementation that checks if an edit has been
+ * applied or not.
+ *
+ * @author Stian Soiland-Reyes
+ *
+ * @param <Subject>
+ *            Subject of this edit
+ */
+public abstract class AbstractEdit<Subject extends WorkflowBean> implements
+		Edit<Subject> {
+	private boolean applied = false;
+	private final Subject subject;
+	protected final Scufl2Tools scufl2Tools = new Scufl2Tools();
+
+	/**
+	 * Construct an AbstractEdit.
+	 *
+	 * @param subjectType
+	 *            The expected implementation type of the subject. The edit will
+	 *            not go through unless the subject is an instance of this type.
+	 *            If the edit don't care about the implementation type, provide
+	 *            the official SubjectInterface instead.
+	 * @param subject
+	 *            The subject of this edit
+	 */
+	public AbstractEdit(Subject subject) {
+		if (subject == null && !isNullSubjectAllowed())
+			throw new IllegalArgumentException(
+					"Cannot construct an edit with null subject");
+		this.subject = subject;
+	}
+
+	protected boolean isNullSubjectAllowed() {
+		return false;
+	}
+
+	@Override
+	public final Subject doEdit() throws EditException {
+		if (applied)
+			throw new EditException("Edit has already been applied!");
+		try {
+			synchronized (subject) {
+				doEditAction(subject);
+				applied = true;
+				return this.subject;
+			}
+		} catch (EditException ee) {
+			applied = false;
+			throw ee;
+		}
+	}
+
+	/**
+	 * Do the actual edit here
+	 *
+	 * @param subject
+	 *            The instance to which the edit applies
+	 * @throws EditException
+	 */
+	protected abstract void doEditAction(Subject subject)
+			throws EditException;
+
+	/**
+	 * Undo any edit effects here
+	 *
+	 * @param subject
+	 *            The instance to which the edit applies
+	 */
+	protected abstract void undoEditAction(Subject subject);
+
+	@Override
+	public final Subject getSubject() {
+		return subject;
+	}
+
+	@Override
+	public final boolean isApplied() {
+		return applied;
+	}
+
+	@Override
+	public final void undo() {
+		if (!applied)
+			throw new RuntimeException(
+					"Attempt to undo edit that was never applied");
+		synchronized (subject) {
+			undoEditAction(subject);
+			applied = false;
+		}
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/AddActivityEdit.java
----------------------------------------------------------------------
diff --git a/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/AddActivityEdit.java b/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/AddActivityEdit.java
new file mode 100644
index 0000000..69b30f9
--- /dev/null
+++ b/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/AddActivityEdit.java
@@ -0,0 +1,54 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workflow.edits;
+
+import org.apache.taverna.scufl2.api.activity.Activity;
+import org.apache.taverna.scufl2.api.core.Processor;
+import org.apache.taverna.scufl2.api.profiles.ProcessorBinding;
+
+/**
+ * Creates a ProcessorBinding binding for the Activity and Processor and adds the binding to the
+ * Profile containing the Activity.
+ *
+ * @author David Withers
+ */
+public class AddActivityEdit extends AbstractEdit<Processor> {
+	private Activity activity;
+	private ProcessorBinding addedProcessorBinding;
+
+	public AddActivityEdit(Processor processor, Activity activity) {
+		super(processor);
+		this.activity = activity;
+	}
+
+	@Override
+	protected void doEditAction(Processor processor) {
+		ProcessorBinding binding = new ProcessorBinding();
+		binding.setBoundProcessor(processor);
+		binding.setBoundActivity(activity);
+		binding.setParent(activity.getParent());
+		addedProcessorBinding = binding;
+	}
+
+	@Override
+	protected void undoEditAction(Processor processor) {
+		addedProcessorBinding.setParent(null);
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/AddActivityInputPortMappingEdit.java
----------------------------------------------------------------------
diff --git a/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/AddActivityInputPortMappingEdit.java b/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/AddActivityInputPortMappingEdit.java
new file mode 100644
index 0000000..7125953
--- /dev/null
+++ b/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/AddActivityInputPortMappingEdit.java
@@ -0,0 +1,58 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workflow.edits;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.taverna.scufl2.api.activity.Activity;
+import org.apache.taverna.scufl2.api.port.InputActivityPort;
+import org.apache.taverna.scufl2.api.port.InputProcessorPort;
+import org.apache.taverna.scufl2.api.profiles.ProcessorBinding;
+import org.apache.taverna.scufl2.api.profiles.ProcessorInputPortBinding;
+
+public class AddActivityInputPortMappingEdit extends AbstractEdit<Activity> {
+	private final InputProcessorPort inputProcessorPort;
+	private final InputActivityPort inputActivityPort;
+	private List<ProcessorInputPortBinding> portBindings;
+
+	public AddActivityInputPortMappingEdit(Activity activity,
+			InputProcessorPort inputProcessorPort,
+			InputActivityPort inputActivityPort) {
+		super(activity);
+		this.inputProcessorPort = inputProcessorPort;
+		this.inputActivityPort = inputActivityPort;
+	}
+
+	@Override
+	protected void doEditAction(Activity activity) {
+		portBindings = new ArrayList<>();
+		for (ProcessorBinding binding : scufl2Tools
+				.processorBindingsToActivity(activity))
+			portBindings.add(new ProcessorInputPortBinding(binding,
+					inputProcessorPort, inputActivityPort));
+	}
+
+	@Override
+	protected void undoEditAction(Activity activity) {
+		for (ProcessorInputPortBinding binding : portBindings)
+			binding.setParent(null);
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/AddActivityOutputPortMappingEdit.java
----------------------------------------------------------------------
diff --git a/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/AddActivityOutputPortMappingEdit.java b/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/AddActivityOutputPortMappingEdit.java
new file mode 100644
index 0000000..75880be
--- /dev/null
+++ b/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/AddActivityOutputPortMappingEdit.java
@@ -0,0 +1,58 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workflow.edits;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.taverna.scufl2.api.activity.Activity;
+import org.apache.taverna.scufl2.api.port.OutputActivityPort;
+import org.apache.taverna.scufl2.api.port.OutputProcessorPort;
+import org.apache.taverna.scufl2.api.profiles.ProcessorBinding;
+import org.apache.taverna.scufl2.api.profiles.ProcessorOutputPortBinding;
+
+public class AddActivityOutputPortMappingEdit extends AbstractEdit<Activity> {
+	private final OutputProcessorPort outputProcessorPort;
+	private final OutputActivityPort outputActivityPort;
+	private List<ProcessorOutputPortBinding> portBindings;
+
+	public AddActivityOutputPortMappingEdit(Activity activity,
+			OutputProcessorPort outputProcessorPort,
+			OutputActivityPort outputActivityPort) {
+		super(activity);
+		this.outputProcessorPort = outputProcessorPort;
+		this.outputActivityPort = outputActivityPort;
+	}
+
+	@Override
+	protected void doEditAction(Activity activity) {
+		portBindings = new ArrayList<>();
+		for (ProcessorBinding binding : scufl2Tools
+				.processorBindingsToActivity(activity))
+			portBindings.add(new ProcessorOutputPortBinding(binding,
+					outputActivityPort, outputProcessorPort));
+	}
+
+	@Override
+	protected void undoEditAction(Activity activity) {
+		for (ProcessorOutputPortBinding binding : portBindings)
+			binding.setParent(null);
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/AddChildEdit.java
----------------------------------------------------------------------
diff --git a/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/AddChildEdit.java b/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/AddChildEdit.java
new file mode 100644
index 0000000..13d8c0b
--- /dev/null
+++ b/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/AddChildEdit.java
@@ -0,0 +1,51 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workflow.edits;
+
+import org.apache.taverna.scufl2.api.common.Child;
+import org.apache.taverna.scufl2.api.common.WorkflowBean;
+
+/**
+ * Adds a child to a parent.
+ *
+ * @author David Withers
+ */
+public class AddChildEdit<T extends WorkflowBean> extends AbstractEdit<T> {
+	private Child<T> child;
+
+	public AddChildEdit(T parent, Child<T> child) {
+		super(parent);
+		this.child = child;
+	}
+
+	@Override
+	protected void doEditAction(T parent) {
+		child.setParent(parent);
+	}
+
+	@Override
+	protected void undoEditAction(T parent) {
+		child.setParent(null);
+	}
+
+	public Child<T> getChild() {
+		return child;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/AddDataLinkEdit.java
----------------------------------------------------------------------
diff --git a/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/AddDataLinkEdit.java b/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/AddDataLinkEdit.java
new file mode 100644
index 0000000..9a8f848
--- /dev/null
+++ b/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/AddDataLinkEdit.java
@@ -0,0 +1,89 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workflow.edits;
+
+import java.util.List;
+
+import org.apache.taverna.scufl2.api.core.DataLink;
+import org.apache.taverna.scufl2.api.core.Workflow;
+import org.apache.taverna.scufl2.api.iterationstrategy.CrossProduct;
+import org.apache.taverna.scufl2.api.iterationstrategy.DotProduct;
+import org.apache.taverna.scufl2.api.iterationstrategy.IterationStrategyParent;
+import org.apache.taverna.scufl2.api.iterationstrategy.IterationStrategyTopNode;
+import org.apache.taverna.scufl2.api.iterationstrategy.PortNode;
+import org.apache.taverna.scufl2.api.port.InputProcessorPort;
+import org.apache.taverna.scufl2.api.port.ReceiverPort;
+
+/**
+ * Adds a DataLink to a Workflow.
+ * <p>
+ * Handles setting the merge position of all dataLinks with the same receiver port.
+ * <p>
+ * Modifies the processor's iteration strategy or when the first DataLink is added.
+ *
+ * @author David Withers
+ */
+public class AddDataLinkEdit extends AbstractEdit<Workflow> {
+	private DataLink dataLink;
+	private PortNode portNode;
+
+	public AddDataLinkEdit(Workflow workflow, DataLink dataLink) {
+		super(workflow);
+		this.dataLink = dataLink;
+	}
+
+	@Override
+	protected void doEditAction(Workflow workflow) {
+		ReceiverPort sink = dataLink.getSendsTo();
+		List<DataLink> datalinksTo = scufl2Tools.datalinksTo(sink);
+		if (datalinksTo.size() > 0) {
+			if (datalinksTo.size() == 1)
+				datalinksTo.get(0).setMergePosition(0);
+			dataLink.setMergePosition(datalinksTo.size());
+		} else {
+			dataLink.setMergePosition(null);
+			if (sink instanceof InputProcessorPort) {
+				InputProcessorPort inputProcessorPort = (InputProcessorPort) sink;
+				for (IterationStrategyTopNode node : inputProcessorPort.getParent().getIterationStrategyStack()) {
+					portNode = new PortNode(node, inputProcessorPort);
+					portNode.setDesiredDepth(inputProcessorPort.getDepth());
+					break;
+				}
+			}
+		}
+		dataLink.setParent(workflow);
+	}
+
+	@Override
+	protected void undoEditAction(Workflow workflow) {
+		dataLink.setParent(null);
+		ReceiverPort sink = dataLink.getSendsTo();
+		List<DataLink> datalinksTo = scufl2Tools.datalinksTo(sink);
+		if (datalinksTo.size() == 1)
+			datalinksTo.get(0).setMergePosition(null);
+		else if (datalinksTo.isEmpty()&&portNode != null) {
+			IterationStrategyParent parent = portNode.getParent();
+			if (parent instanceof DotProduct)
+				((DotProduct) parent).remove(portNode);
+			else if (parent instanceof CrossProduct)
+				((CrossProduct) parent).remove(portNode);
+		}
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/AddIterationStrategyEdit.java
----------------------------------------------------------------------
diff --git a/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/AddIterationStrategyEdit.java b/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/AddIterationStrategyEdit.java
new file mode 100644
index 0000000..27b0af0
--- /dev/null
+++ b/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/AddIterationStrategyEdit.java
@@ -0,0 +1,48 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workflow.edits;
+
+import org.apache.taverna.scufl2.api.iterationstrategy.IterationStrategyStack;
+import org.apache.taverna.scufl2.api.iterationstrategy.IterationStrategyTopNode;
+
+/**
+ * Adds an IterationStrategyTopNode to an IterationStrategyStack.
+ *
+ * @author David Withers
+ */
+public class AddIterationStrategyEdit extends AbstractEdit<IterationStrategyStack> {
+	private final IterationStrategyTopNode iterationStrategyTopNode;
+
+	public AddIterationStrategyEdit(IterationStrategyStack iterationStrategyStack,
+			IterationStrategyTopNode iterationStrategyTopNode) {
+		super(iterationStrategyStack);
+		this.iterationStrategyTopNode = iterationStrategyTopNode;
+	}
+
+	@Override
+	public void doEditAction(IterationStrategyStack iterationStrategyStack) {
+		iterationStrategyStack.add(iterationStrategyTopNode);
+	}
+
+	@Override
+	public void undoEditAction(IterationStrategyStack iterationStrategyStack) {
+		iterationStrategyStack.remove(iterationStrategyTopNode);
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/AddIterationStrategyInputPortEdit.java
----------------------------------------------------------------------
diff --git a/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/AddIterationStrategyInputPortEdit.java b/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/AddIterationStrategyInputPortEdit.java
new file mode 100644
index 0000000..d918445
--- /dev/null
+++ b/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/AddIterationStrategyInputPortEdit.java
@@ -0,0 +1,49 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workflow.edits;
+
+import org.apache.taverna.scufl2.api.iterationstrategy.IterationStrategyStack;
+import org.apache.taverna.scufl2.api.iterationstrategy.PortNode;
+
+/**
+ * Adds an iteration strategy input port node to an iteration strategy.
+ * 
+ * @author David Withers
+ */
+public class AddIterationStrategyInputPortEdit extends
+		AbstractEdit<IterationStrategyStack> {
+	private final PortNode portNode;
+
+	public AddIterationStrategyInputPortEdit(
+			IterationStrategyStack iterationStrategy, PortNode portNode) {
+		super(iterationStrategy);
+		this.portNode = portNode;
+	}
+
+	@Override
+	public void doEditAction(IterationStrategyStack iterationStrategy) {
+		portNode.setParent(iterationStrategy.get(0));
+	}
+
+	@Override
+	public void undoEditAction(IterationStrategyStack iterationStrategy) {
+		portNode.setParent(null);
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/AddProcessorEdit.java
----------------------------------------------------------------------
diff --git a/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/AddProcessorEdit.java b/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/AddProcessorEdit.java
new file mode 100644
index 0000000..e30a6a0
--- /dev/null
+++ b/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/AddProcessorEdit.java
@@ -0,0 +1,44 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workflow.edits;
+
+import org.apache.taverna.scufl2.api.core.Processor;
+import org.apache.taverna.scufl2.api.core.Workflow;
+
+/**
+ * Adds a Processor to a Workflow.
+ *
+ * @author Stuart Owen
+ * @author David Withers
+ */
+public class AddProcessorEdit extends AddChildEdit<Workflow> {
+	private Processor processor;
+
+	public AddProcessorEdit(Workflow workflow, Processor processor) {
+		super(workflow, processor);
+		this.processor = processor;
+	}
+
+	@Override
+	protected void doEditAction(Workflow workflow) {
+		getSubject().getProcessors().addWithUniqueName(processor);
+		super.doEditAction(workflow);
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/AddProcessorInputPortEdit.java
----------------------------------------------------------------------
diff --git a/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/AddProcessorInputPortEdit.java b/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/AddProcessorInputPortEdit.java
new file mode 100644
index 0000000..7a22491
--- /dev/null
+++ b/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/AddProcessorInputPortEdit.java
@@ -0,0 +1,44 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workflow.edits;
+
+import org.apache.taverna.scufl2.api.core.Processor;
+import org.apache.taverna.scufl2.api.port.InputProcessorPort;
+
+/**
+ * Adds an input port to a processor.
+ *
+ * @author Tom Oinn
+ * @author David Withers
+ */
+public class AddProcessorInputPortEdit extends AddChildEdit<Processor> {
+	private final InputProcessorPort port;
+
+	public AddProcessorInputPortEdit(Processor processor, InputProcessorPort port) {
+		super(processor, port);
+		this.port = port;
+	}
+
+	@Override
+	protected void doEditAction(Processor processor) {
+		processor.getInputPorts().addWithUniqueName(port);
+		super.doEditAction(processor);
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/AddProcessorOutputPortEdit.java
----------------------------------------------------------------------
diff --git a/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/AddProcessorOutputPortEdit.java b/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/AddProcessorOutputPortEdit.java
new file mode 100644
index 0000000..1cdfef2
--- /dev/null
+++ b/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/AddProcessorOutputPortEdit.java
@@ -0,0 +1,45 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workflow.edits;
+
+import org.apache.taverna.scufl2.api.core.Processor;
+import org.apache.taverna.scufl2.api.port.OutputProcessorPort;
+
+/**
+ * Adds an output port to a processor.
+ * 
+ * @author Tom Oinn
+ * @author David Withers
+ */
+public class AddProcessorOutputPortEdit extends AddChildEdit<Processor> {
+	private final OutputProcessorPort port;
+
+	public AddProcessorOutputPortEdit(Processor processor,
+			OutputProcessorPort port) {
+		super(processor, port);
+		this.port = port;
+	}
+
+	@Override
+	protected void doEditAction(Processor processor) {
+		processor.getOutputPorts().addWithUniqueName(port);
+		super.doEditAction(processor);
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/AddWorkflowInputPortEdit.java
----------------------------------------------------------------------
diff --git a/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/AddWorkflowInputPortEdit.java b/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/AddWorkflowInputPortEdit.java
new file mode 100644
index 0000000..7b407d6
--- /dev/null
+++ b/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/AddWorkflowInputPortEdit.java
@@ -0,0 +1,109 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workflow.edits;
+
+import static org.apache.taverna.scufl2.api.common.Scufl2Tools.NESTED_WORKFLOW;
+
+import java.util.List;
+
+import org.apache.taverna.workbench.edits.CompoundEdit;
+import org.apache.taverna.workbench.edits.Edit;
+import org.apache.taverna.workbench.edits.EditException;
+import org.apache.taverna.scufl2.api.activity.Activity;
+import org.apache.taverna.scufl2.api.configurations.Configuration;
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+import org.apache.taverna.scufl2.api.core.Processor;
+import org.apache.taverna.scufl2.api.core.Workflow;
+import org.apache.taverna.scufl2.api.port.InputActivityPort;
+import org.apache.taverna.scufl2.api.port.InputProcessorPort;
+import org.apache.taverna.scufl2.api.port.InputWorkflowPort;
+import org.apache.taverna.scufl2.api.profiles.ProcessorBinding;
+import org.apache.taverna.scufl2.api.profiles.ProcessorInputPortBinding;
+import org.apache.taverna.scufl2.api.profiles.Profile;
+
+import com.fasterxml.jackson.databind.JsonNode;
+
+/**
+ * Adds an input port to a workflow.
+ * 
+ * @author David Withers
+ */
+public class AddWorkflowInputPortEdit extends AbstractEdit<Workflow> {
+	private final InputWorkflowPort port;
+	private final CompoundEdit nestedPortEdit = new CompoundEdit();
+
+	public AddWorkflowInputPortEdit(Workflow workflow, InputWorkflowPort port) {
+		super(workflow);
+		this.port = port;
+		WorkflowBundle workflowBundle = workflow.getParent();
+		if (workflowBundle != null)
+			for (Profile profile : workflowBundle.getProfiles())
+				for (Activity activity : profile.getActivities())
+					if (activity.getType().equals(NESTED_WORKFLOW))
+						for (Configuration c : scufl2Tools.configurationsFor(
+								activity, profile))
+							defineEditsForOneConfiguration(workflow, port,
+									workflowBundle, activity, c);
+	}
+
+	private void defineEditsForOneConfiguration(Workflow workflow,
+			InputWorkflowPort port, WorkflowBundle workflowBundle,
+			Activity activity, Configuration c) {
+		List<Edit<?>> edits = nestedPortEdit.getChildEdits();
+		JsonNode nested = c.getJson().get("nestedWorkflow");
+		Workflow nestedWorkflow = workflowBundle.getWorkflows().getByName(
+				nested.asText());
+
+		if (nestedWorkflow == workflow) {
+			InputActivityPort activityPort = new InputActivityPort();
+			activityPort.setName(port.getName());
+			activityPort.setDepth(port.getDepth());
+			edits.add(new AddChildEdit<>(activity, activityPort));
+
+			for (ProcessorBinding binding : scufl2Tools
+					.processorBindingsToActivity(activity)) {
+				Processor processor = binding.getBoundProcessor();
+				InputProcessorPort processorPort = new InputProcessorPort();
+				processorPort.setName(port.getName());
+				processorPort.setDepth(port.getDepth());
+				edits.add(new AddProcessorInputPortEdit(processor,
+						processorPort));
+
+				ProcessorInputPortBinding portBinding = new ProcessorInputPortBinding();
+				portBinding.setBoundProcessorPort(processorPort);
+				portBinding.setBoundActivityPort(activityPort);
+				edits.add(new AddChildEdit<>(binding, portBinding));
+			}
+		}
+	}
+
+	@Override
+	protected void doEditAction(Workflow workflow) throws EditException {
+		workflow.getInputPorts().addWithUniqueName(port);
+		port.setParent(workflow);
+		nestedPortEdit.doEdit();
+	}
+
+	@Override
+	protected void undoEditAction(Workflow workflow) {
+		port.setParent(null);
+		nestedPortEdit.undo();
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/AddWorkflowOutputPortEdit.java
----------------------------------------------------------------------
diff --git a/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/AddWorkflowOutputPortEdit.java b/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/AddWorkflowOutputPortEdit.java
new file mode 100644
index 0000000..301754d
--- /dev/null
+++ b/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/AddWorkflowOutputPortEdit.java
@@ -0,0 +1,110 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workflow.edits;
+
+import static org.apache.taverna.scufl2.api.common.Scufl2Tools.NESTED_WORKFLOW;
+
+import java.util.List;
+
+import org.apache.taverna.workbench.edits.CompoundEdit;
+import org.apache.taverna.workbench.edits.Edit;
+import org.apache.taverna.workbench.edits.EditException;
+import org.apache.taverna.scufl2.api.activity.Activity;
+import org.apache.taverna.scufl2.api.configurations.Configuration;
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+import org.apache.taverna.scufl2.api.core.Processor;
+import org.apache.taverna.scufl2.api.core.Workflow;
+import org.apache.taverna.scufl2.api.port.OutputActivityPort;
+import org.apache.taverna.scufl2.api.port.OutputProcessorPort;
+import org.apache.taverna.scufl2.api.port.OutputWorkflowPort;
+import org.apache.taverna.scufl2.api.profiles.ProcessorBinding;
+import org.apache.taverna.scufl2.api.profiles.ProcessorOutputPortBinding;
+import org.apache.taverna.scufl2.api.profiles.Profile;
+
+import com.fasterxml.jackson.databind.JsonNode;
+
+/**
+ * Adds an output port to a workflow.
+ *
+ * @author David Withers
+ */
+public class AddWorkflowOutputPortEdit extends AbstractEdit<Workflow> {
+	private final OutputWorkflowPort port;
+	private final CompoundEdit nestedPortEdit = new CompoundEdit();
+
+	public AddWorkflowOutputPortEdit(Workflow workflow, OutputWorkflowPort port) {
+		super(workflow);
+		this.port = port;
+		WorkflowBundle workflowBundle = workflow.getParent();
+		if (workflowBundle != null)
+			for (Profile profile : workflowBundle.getProfiles())
+				for (Activity activity : profile.getActivities())
+					if (activity.getType().equals(NESTED_WORKFLOW))
+						for (Configuration c : scufl2Tools.configurationsFor(
+								activity, profile))
+							defineEditsForOneConfiguration(workflow, port,
+									workflowBundle, activity, c);
+	}
+
+	private void defineEditsForOneConfiguration(Workflow workflow,
+			OutputWorkflowPort port, WorkflowBundle workflowBundle,
+			Activity activity, Configuration c) {
+		List<Edit<?>> edits = nestedPortEdit.getChildEdits();
+		JsonNode nested = c.getJson().get("nestedWorkflow");
+		Workflow nestedWorkflow = workflowBundle.getWorkflows().getByName(
+				nested.asText());
+		if (nestedWorkflow == workflow) {
+			OutputActivityPort activityPort = new OutputActivityPort();
+			activityPort.setName(port.getName());
+			activityPort.setDepth(0);
+			activityPort.setGranularDepth(0);
+			edits.add(new AddChildEdit<>(activity, activityPort));
+
+			for (ProcessorBinding binding : scufl2Tools
+					.processorBindingsToActivity(activity)) {
+				Processor processor = binding.getBoundProcessor();
+				OutputProcessorPort processorPort = new OutputProcessorPort();
+				processorPort.setName(port.getName());
+				processorPort.setDepth(0);
+				processorPort.setGranularDepth(0);
+				edits.add(new AddProcessorOutputPortEdit(processor,
+						processorPort));
+
+				ProcessorOutputPortBinding portBinding = new ProcessorOutputPortBinding();
+				portBinding.setBoundProcessorPort(processorPort);
+				portBinding.setBoundActivityPort(activityPort);
+				edits.add(new AddChildEdit<>(binding, portBinding));
+			}
+		}
+	}
+
+	@Override
+	protected void doEditAction(Workflow workflow) throws EditException {
+		workflow.getOutputPorts().addWithUniqueName(port);
+		port.setParent(workflow);
+		nestedPortEdit.doEdit();
+	}
+
+	@Override
+	protected void undoEditAction(Workflow workflow) {
+		port.setParent(null);
+		nestedPortEdit.undo();
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/ChangeDepthEdit.java
----------------------------------------------------------------------
diff --git a/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/ChangeDepthEdit.java b/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/ChangeDepthEdit.java
new file mode 100644
index 0000000..1c48ac5
--- /dev/null
+++ b/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/ChangeDepthEdit.java
@@ -0,0 +1,103 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workflow.edits;
+
+import static org.apache.taverna.scufl2.api.common.Scufl2Tools.NESTED_WORKFLOW;
+import org.apache.taverna.scufl2.api.activity.Activity;
+import org.apache.taverna.scufl2.api.configurations.Configuration;
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+import org.apache.taverna.scufl2.api.core.Workflow;
+import org.apache.taverna.scufl2.api.port.ActivityPort;
+import org.apache.taverna.scufl2.api.port.DepthPort;
+import org.apache.taverna.scufl2.api.port.InputProcessorPort;
+import org.apache.taverna.scufl2.api.port.InputWorkflowPort;
+import org.apache.taverna.scufl2.api.profiles.ProcessorBinding;
+import org.apache.taverna.scufl2.api.profiles.ProcessorInputPortBinding;
+import org.apache.taverna.scufl2.api.profiles.Profile;
+
+import com.fasterxml.jackson.databind.JsonNode;
+
+/**
+ * Changes the depth of a port.
+ *
+ * @author David Withers
+ */
+public class ChangeDepthEdit<T extends DepthPort> extends AbstractEdit<T> {
+	private Integer newDepth, oldDepth;
+
+	public ChangeDepthEdit(T depthPort, Integer newDepth) {
+		super(depthPort);
+		this.newDepth = newDepth;
+		oldDepth = depthPort.getDepth();
+	}
+
+	@Override
+	protected void doEditAction(T depthPort) {
+		depthPort.setDepth(newDepth);
+		if (depthPort instanceof InputWorkflowPort)
+			checkNestedPortDepths((InputWorkflowPort) depthPort, newDepth);
+	}
+
+	@Override
+	protected void undoEditAction(T depthPort) {
+		depthPort.setDepth(oldDepth);
+		if (depthPort instanceof InputWorkflowPort)
+			checkNestedPortDepths((InputWorkflowPort) depthPort, oldDepth);
+	}
+
+	private void checkNestedPortDepths(InputWorkflowPort workflowPort,
+			Integer depth) {
+		Workflow workflow = workflowPort.getParent();
+		if (workflow != null) {
+			WorkflowBundle workflowBundle = workflow.getParent();
+			if (workflowBundle != null)
+				for (Profile profile : workflowBundle.getProfiles())
+					for (Activity activity : profile.getActivities())
+						if (activity.getType().equals(NESTED_WORKFLOW))
+							for (Configuration c : scufl2Tools
+									.configurationsFor(activity, profile))
+								checkOneConfiguration(workflowPort, depth,
+										workflow, workflowBundle, activity, c);
+		}
+	}
+
+	private void checkOneConfiguration(InputWorkflowPort workflowPort,
+			Integer depth, Workflow workflow, WorkflowBundle workflowBundle,
+			Activity activity, Configuration c) {
+		JsonNode nested = c.getJson().get("nestedWorkflow");
+		Workflow nestedWorkflow = workflowBundle.getWorkflows().getByName(
+				nested.asText());
+		if (nestedWorkflow != workflow)
+			return;
+
+		ActivityPort activityPort = activity.getInputPorts().getByName(
+				workflowPort.getName());
+		activityPort.setDepth(depth);
+		for (ProcessorBinding binding : scufl2Tools
+				.processorBindingsToActivity(activity))
+			for (ProcessorInputPortBinding portBinding : binding
+					.getInputPortBindings())
+				if (portBinding.getBoundActivityPort() == activityPort) {
+					InputProcessorPort processorPort = portBinding
+							.getBoundProcessorPort();
+					processorPort.setDepth(depth);
+				}
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/ChangeGranularDepthEdit.java
----------------------------------------------------------------------
diff --git a/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/ChangeGranularDepthEdit.java b/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/ChangeGranularDepthEdit.java
new file mode 100644
index 0000000..061525a
--- /dev/null
+++ b/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/ChangeGranularDepthEdit.java
@@ -0,0 +1,48 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workflow.edits;
+
+import org.apache.taverna.scufl2.api.port.GranularDepthPort;
+
+/**
+ * Changes the granular depth of a port.
+ * 
+ * @author David Withers
+ */
+public class ChangeGranularDepthEdit<T extends GranularDepthPort> extends
+		AbstractEdit<T> {
+	private Integer newGranularDepth, oldGranularDepth;
+
+	public ChangeGranularDepthEdit(T granularDepthPort, Integer newGranularDepth) {
+		super(granularDepthPort);
+		this.newGranularDepth = newGranularDepth;
+		oldGranularDepth = granularDepthPort.getGranularDepth();
+	}
+
+	@Override
+	protected void doEditAction(T granularDepthPort) {
+		granularDepthPort.setGranularDepth(newGranularDepth);
+	}
+
+	@Override
+	protected void undoEditAction(T granularDepthPort) {
+		granularDepthPort.setGranularDepth(oldGranularDepth);
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/ChangeJsonEdit.java
----------------------------------------------------------------------
diff --git a/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/ChangeJsonEdit.java b/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/ChangeJsonEdit.java
new file mode 100644
index 0000000..53c351d
--- /dev/null
+++ b/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/ChangeJsonEdit.java
@@ -0,0 +1,49 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workflow.edits;
+
+import org.apache.taverna.scufl2.api.configurations.Configuration;
+
+import com.fasterxml.jackson.databind.JsonNode;
+
+/**
+ * Changes the JSON of a configuration.
+ * 
+ * @author David Withers
+ */
+public class ChangeJsonEdit extends AbstractEdit<Configuration> {
+	private JsonNode oldJson, newJson;
+
+	public ChangeJsonEdit(Configuration configuration, JsonNode newJson) {
+		super(configuration);
+		this.newJson = newJson;
+		newJson = configuration.getJson();
+	}
+
+	@Override
+	protected void doEditAction(Configuration configuration) {
+		configuration.setJson(newJson);
+	}
+
+	@Override
+	protected void undoEditAction(Configuration configuration) {
+		configuration.setJson(oldJson);
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/ClearIterationStrategyStackEdit.java
----------------------------------------------------------------------
diff --git a/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/ClearIterationStrategyStackEdit.java b/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/ClearIterationStrategyStackEdit.java
new file mode 100644
index 0000000..fc39119
--- /dev/null
+++ b/taverna-edits-api/src/main/java/org/apache/taverna/workflow/edits/ClearIterationStrategyStackEdit.java
@@ -0,0 +1,49 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workflow.edits;
+
+import org.apache.taverna.scufl2.api.iterationstrategy.IterationStrategyStack;
+
+/**
+ * Removes all the iteration strategies from an iteration strategy stack.
+ * 
+ * @author David Withers
+ */
+public class ClearIterationStrategyStackEdit extends
+		AbstractEdit<IterationStrategyStack> {
+	private IterationStrategyStack oldIterationStrategyStack;
+
+	public ClearIterationStrategyStackEdit(
+			IterationStrategyStack iterationStrategyStack) {
+		super(iterationStrategyStack);
+	}
+
+	@Override
+	protected void doEditAction(IterationStrategyStack iterationStrategyStack) {
+		oldIterationStrategyStack = new IterationStrategyStack();
+		oldIterationStrategyStack.addAll(iterationStrategyStack);
+		iterationStrategyStack.clear();
+	}
+
+	@Override
+	public void undoEditAction(IterationStrategyStack iterationStrategyStack) {
+		iterationStrategyStack.addAll(oldIterationStrategyStack);
+	}
+}


[02/51] [partial] incubator-taverna-workbench git commit: all packages are moved to org.apache.taverna.*

Posted by re...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-menu-impl/src/main/java/org/apache/taverna/workbench/ui/impl/menu/FileMenu.java
----------------------------------------------------------------------
diff --git a/taverna-menu-impl/src/main/java/org/apache/taverna/workbench/ui/impl/menu/FileMenu.java b/taverna-menu-impl/src/main/java/org/apache/taverna/workbench/ui/impl/menu/FileMenu.java
new file mode 100644
index 0000000..a9ad154
--- /dev/null
+++ b/taverna-menu-impl/src/main/java/org/apache/taverna/workbench/ui/impl/menu/FileMenu.java
@@ -0,0 +1,47 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.impl.menu;
+
+import static java.awt.event.KeyEvent.VK_F;
+import static javax.swing.Action.MNEMONIC_KEY;
+import static org.apache.taverna.ui.menu.DefaultMenuBar.DEFAULT_MENU_BAR;
+
+import java.net.URI;
+
+import org.apache.taverna.ui.menu.AbstractMenu;
+
+/**
+ * File menu
+ * 
+ * @author Stian Soiland-Reyes
+ */
+public class FileMenu extends AbstractMenu {
+	public FileMenu() {
+		super(DEFAULT_MENU_BAR, 10, URI
+				.create("http://taverna.sf.net/2008/t2workbench/menu#file"),
+				makeAction());
+	}
+
+	public static DummyAction makeAction() {
+		DummyAction action = new DummyAction("File");
+		action.putValue(MNEMONIC_KEY, Integer.valueOf(VK_F));
+		return action;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-menu-impl/src/main/java/org/apache/taverna/workbench/ui/impl/menu/HelpMenu.java
----------------------------------------------------------------------
diff --git a/taverna-menu-impl/src/main/java/org/apache/taverna/workbench/ui/impl/menu/HelpMenu.java b/taverna-menu-impl/src/main/java/org/apache/taverna/workbench/ui/impl/menu/HelpMenu.java
new file mode 100644
index 0000000..a8520fc
--- /dev/null
+++ b/taverna-menu-impl/src/main/java/org/apache/taverna/workbench/ui/impl/menu/HelpMenu.java
@@ -0,0 +1,43 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.impl.menu;
+
+import static java.awt.event.KeyEvent.VK_H;
+import static javax.swing.Action.MNEMONIC_KEY;
+import static org.apache.taverna.ui.menu.DefaultMenuBar.DEFAULT_MENU_BAR;
+
+import java.net.URI;
+
+import org.apache.taverna.ui.menu.AbstractMenu;
+
+public class HelpMenu extends AbstractMenu {
+	public static final URI HELP_URI = URI
+			.create("http://taverna.sf.net/2008/t2workbench/menu#help");
+
+	public HelpMenu() {
+		super(DEFAULT_MENU_BAR, 1024, HELP_URI, makeAction());
+	}
+
+	public static DummyAction makeAction() {
+		DummyAction action = new DummyAction("Help");
+		action.putValue(MNEMONIC_KEY, Integer.valueOf(VK_H));
+		return action;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-menu-impl/src/main/java/org/apache/taverna/workbench/ui/impl/menu/OnlineHelpMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-menu-impl/src/main/java/org/apache/taverna/workbench/ui/impl/menu/OnlineHelpMenuAction.java b/taverna-menu-impl/src/main/java/org/apache/taverna/workbench/ui/impl/menu/OnlineHelpMenuAction.java
new file mode 100644
index 0000000..eec26af
--- /dev/null
+++ b/taverna-menu-impl/src/main/java/org/apache/taverna/workbench/ui/impl/menu/OnlineHelpMenuAction.java
@@ -0,0 +1,67 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.impl.menu;
+
+import static java.awt.event.KeyEvent.VK_F1;
+import static javax.swing.KeyStroke.getKeyStroke;
+import static org.apache.taverna.workbench.helper.Helper.displayDefaultHelp;
+import static org.apache.taverna.workbench.ui.impl.menu.HelpMenu.HELP_URI;
+
+import java.awt.AWTEvent;
+import java.awt.event.ActionEvent;
+
+import javax.swing.AbstractAction;
+import javax.swing.Action;
+
+import org.apache.taverna.ui.menu.AbstractMenuAction;
+
+/**
+ * MenuItem for help
+ * 
+ * @author alanrw
+ */
+public class OnlineHelpMenuAction extends AbstractMenuAction {
+	public OnlineHelpMenuAction() {
+		super(HELP_URI, 10);
+	}
+
+	@Override
+	protected Action createAction() {
+		return new OnlineHelpAction();
+	}
+
+	@SuppressWarnings("serial")
+	private final class OnlineHelpAction extends AbstractAction {
+		private OnlineHelpAction() {
+			super("Online help");
+			putValue(ACCELERATOR_KEY, getKeyStroke(VK_F1, 0));
+
+		}
+
+		/**
+		 * When selected, use the Helper to display the default help.
+		 */
+		@Override
+		public void actionPerformed(ActionEvent e) {
+			displayDefaultHelp((AWTEvent) e);
+			// TODO change helper to bean?
+		}
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-menu-impl/src/main/java/org/apache/taverna/workbench/ui/impl/menu/ShowLogsAndDataMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-menu-impl/src/main/java/org/apache/taverna/workbench/ui/impl/menu/ShowLogsAndDataMenuAction.java b/taverna-menu-impl/src/main/java/org/apache/taverna/workbench/ui/impl/menu/ShowLogsAndDataMenuAction.java
new file mode 100644
index 0000000..00d7817
--- /dev/null
+++ b/taverna-menu-impl/src/main/java/org/apache/taverna/workbench/ui/impl/menu/ShowLogsAndDataMenuAction.java
@@ -0,0 +1,108 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.impl.menu;
+
+import static java.lang.Runtime.getRuntime;
+import static javax.swing.JOptionPane.INFORMATION_MESSAGE;
+import static javax.swing.JOptionPane.showInputDialog;
+import static org.apache.taverna.workbench.MainWindow.getMainWindow;
+import static org.apache.taverna.workbench.ui.impl.menu.AdvancedMenu.ADVANCED_URI;
+
+import java.awt.event.ActionEvent;
+import java.io.File;
+
+import javax.swing.AbstractAction;
+import javax.swing.Action;
+
+import org.apache.taverna.ui.menu.AbstractMenuAction;
+
+import org.apache.log4j.Logger;
+
+import uk.org.taverna.configuration.app.ApplicationConfiguration;
+
+public class ShowLogsAndDataMenuAction extends AbstractMenuAction {
+	private static final String OPEN = "open";
+	private static final String EXPLORER = "explorer";
+	// TODO Consider using xdg-open instead of gnome-open
+	private static final String GNOME_OPEN = "gnome-open";
+	private static final String WINDOWS = "Windows";
+	private static final String MAC_OS_X = "Mac OS X";
+
+	private ApplicationConfiguration applicationConfiguration;
+
+	public ShowLogsAndDataMenuAction() {
+		super(ADVANCED_URI, 200);
+	}
+
+	private static Logger logger = Logger.getLogger(ShowLogsAndDataMenuAction.class);
+
+	@Override
+	protected Action createAction() {
+		return new AbstractAction("Show logs and data folder") {
+			private static final long serialVersionUID = 1L;
+
+			@Override
+			public void actionPerformed(ActionEvent e) {
+				File logsAndDataDir = applicationConfiguration.getApplicationHomeDir();
+				showDirectory(logsAndDataDir, "Taverna logs and data folder");
+			}
+		};
+	}
+
+	public static void showDirectory(File dir, String title) {
+		String path = dir.getAbsolutePath();
+		String os = System.getProperty("os.name");
+		String cmd;
+		boolean isWindows = false;
+		if (os.equals(MAC_OS_X))
+			cmd = OPEN;
+		else if (os.startsWith(WINDOWS)) {
+			cmd = EXPLORER;
+			isWindows = true;
+		} else
+			// Assume Unix - best option is gnome-open
+			cmd = GNOME_OPEN;
+
+		String[] cmdArray = new String[2];
+		cmdArray[0] = cmd;
+		cmdArray[1] = path;
+		try {
+			Process exec = getRuntime().exec(cmdArray);
+			Thread.sleep(300);
+			exec.getErrorStream().close();
+			exec.getInputStream().close();
+			exec.getOutputStream().close();
+			exec.waitFor();
+			if (exec.exitValue() == 0 || isWindows && exec.exitValue() == 1)
+				// explorer.exe thinks 1 means success
+				return;
+			logger.warn("Exit value from " + cmd + " " + path + ": " + exec.exitValue());
+		} catch (Exception ex) {
+			logger.warn("Could not call " + cmd + " " + path, ex);
+		}
+		// Fall-back - just show a dialogue with the path
+		showInputDialog(getMainWindow(), "Copy path from below:", title,
+				INFORMATION_MESSAGE, null, null, path);
+	}
+
+	public void setApplicationConfiguration(ApplicationConfiguration applicationConfiguration) {
+		this.applicationConfiguration = applicationConfiguration;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-menu-impl/src/main/java/org/apache/taverna/workbench/ui/impl/menu/ViewShowMenuSection.java
----------------------------------------------------------------------
diff --git a/taverna-menu-impl/src/main/java/org/apache/taverna/workbench/ui/impl/menu/ViewShowMenuSection.java b/taverna-menu-impl/src/main/java/org/apache/taverna/workbench/ui/impl/menu/ViewShowMenuSection.java
new file mode 100644
index 0000000..3acd0ae
--- /dev/null
+++ b/taverna-menu-impl/src/main/java/org/apache/taverna/workbench/ui/impl/menu/ViewShowMenuSection.java
@@ -0,0 +1,39 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.impl.menu;
+
+import java.net.URI;
+
+import org.apache.taverna.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/a9a52bd5/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
deleted file mode 100644
index 3b06fd9..0000000
--- a/taverna-menu-impl/src/main/resources/META-INF/services/net.sf.taverna.t2.ui.menu.MenuManager
+++ /dev/null
@@ -1 +0,0 @@
-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/a9a52bd5/taverna-menu-impl/src/main/resources/META-INF/services/org.apache.taverna.ui.menu.MenuManager
----------------------------------------------------------------------
diff --git a/taverna-menu-impl/src/main/resources/META-INF/services/org.apache.taverna.ui.menu.MenuManager b/taverna-menu-impl/src/main/resources/META-INF/services/org.apache.taverna.ui.menu.MenuManager
new file mode 100644
index 0000000..3b06fd9
--- /dev/null
+++ b/taverna-menu-impl/src/main/resources/META-INF/services/org.apache.taverna.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/a9a52bd5/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
index 3a1eadf..f2a3342 100644
--- 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
@@ -6,7 +6,7 @@
                       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="MenuManagerImpl" interface="org.apache.taverna.ui.menu.MenuManager" />
 
 	<service ref="FileMenu" auto-export="interfaces" />
 	<service ref="EditMenu" auto-export="interfaces" />
@@ -17,9 +17,9 @@
 	<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" />
+	<reference id="selectionManager" interface="org.apache.taverna.workbench.selection.SelectionManager" />
 
-	<list id="menuComponents" interface="net.sf.taverna.t2.ui.menu.MenuComponent" cardinality="0..N" greedy-proxying="true">
+	<list id="menuComponents" interface="org.apache.taverna.ui.menu.MenuComponent" cardinality="0..N" greedy-proxying="true">
 		<listener ref="MenuManagerImpl" bind-method="update" unbind-method="update" />
 	</list>
 

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/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
index 62fd24e..4c93185 100644
--- 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
@@ -4,21 +4,21 @@
 	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">
+	<bean id="MenuManagerImpl" class="org.apache.taverna.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="FileMenu" class="org.apache.taverna.workbench.ui.impl.menu.FileMenu" />
+	<bean id="EditMenu" class="org.apache.taverna.workbench.ui.impl.menu.EditMenu" />
+	<bean id="AdvancedMenu" class="org.apache.taverna.workbench.ui.impl.menu.AdvancedMenu" />
+	<bean id="HelpMenu" class="org.apache.taverna.workbench.ui.impl.menu.HelpMenu" />
 	<bean id="OnlineHelpMenuAction"
-		class="net.sf.taverna.t2.workbench.ui.impl.menu.OnlineHelpMenuAction" />
+		class="org.apache.taverna.workbench.ui.impl.menu.OnlineHelpMenuAction" />
 	<bean id="FeedbackMenuAction"
-		class="net.sf.taverna.t2.workbench.ui.impl.menu.FeedbackMenuAction" />
+		class="org.apache.taverna.workbench.ui.impl.menu.FeedbackMenuAction" />
 	<bean id="ShowLogsAndDataMenuAction"
-		class="net.sf.taverna.t2.workbench.ui.impl.menu.ShowLogsAndDataMenuAction">
+		class="org.apache.taverna.workbench.ui.impl.menu.ShowLogsAndDataMenuAction">
 		<property name="applicationConfiguration" ref="applicationConfiguration" />
 	</bean>
 

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/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
deleted file mode 100644
index 041b6be..0000000
--- a/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/activityport/AbstractConnectPortMenuActions.java
+++ /dev/null
@@ -1,267 +0,0 @@
-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 org.apache.taverna.scufl2.api.activity.Activity;
-import org.apache.taverna.scufl2.api.common.Scufl2Tools;
-import org.apache.taverna.scufl2.api.core.Processor;
-import org.apache.taverna.scufl2.api.core.Workflow;
-import org.apache.taverna.scufl2.api.port.InputPort;
-import org.apache.taverna.scufl2.api.port.InputProcessorPort;
-import org.apache.taverna.scufl2.api.port.InputWorkflowPort;
-import org.apache.taverna.scufl2.api.port.OutputProcessorPort;
-import org.apache.taverna.scufl2.api.port.OutputWorkflowPort;
-import org.apache.taverna.scufl2.api.port.Port;
-import org.apache.taverna.scufl2.api.port.ProcessorPort;
-import org.apache.taverna.scufl2.api.port.ReceiverPort;
-import org.apache.taverna.scufl2.api.port.SenderPort;
-import org.apache.taverna.scufl2.api.port.WorkflowPort;
-import org.apache.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/a9a52bd5/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
deleted file mode 100644
index d98bc1b..0000000
--- a/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/activityport/ActivityInputPortSection.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/**********************************************************************
- * 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 org.apache.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/a9a52bd5/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
deleted file mode 100644
index ba37860..0000000
--- a/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/activityport/ActivityOutputPortSection.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/**********************************************************************
- * 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 org.apache.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/a9a52bd5/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
deleted file mode 100644
index 2843008..0000000
--- a/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/activityport/AddInputPortDefaultValueAction.java
+++ /dev/null
@@ -1,150 +0,0 @@
-/*******************************************************************************
- * 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 org.apache.taverna.commons.services.ServiceRegistry;
-import org.apache.taverna.scufl2.api.activity.Activity;
-import org.apache.taverna.scufl2.api.configurations.Configuration;
-import org.apache.taverna.scufl2.api.core.DataLink;
-import org.apache.taverna.scufl2.api.core.Processor;
-import org.apache.taverna.scufl2.api.core.Workflow;
-import org.apache.taverna.scufl2.api.iterationstrategy.CrossProduct;
-import org.apache.taverna.scufl2.api.port.InputProcessorPort;
-import org.apache.taverna.scufl2.api.port.OutputActivityPort;
-import org.apache.taverna.scufl2.api.port.OutputProcessorPort;
-import org.apache.taverna.scufl2.api.profiles.ProcessorBinding;
-import org.apache.taverna.scufl2.api.profiles.ProcessorOutputPortBinding;
-import org.apache.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/a9a52bd5/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
deleted file mode 100644
index bd416ce..0000000
--- a/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/activityport/ConnectInputPortMenuActions.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/**********************************************************************
- * 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 org.apache.taverna.scufl2.api.core.Workflow;
-import org.apache.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/a9a52bd5/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
deleted file mode 100644
index 0d68970..0000000
--- a/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/activityport/ConnectOutputPortMenuActions.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/**********************************************************************
- * 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 org.apache.taverna.scufl2.api.core.Workflow;
-import org.apache.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/a9a52bd5/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
deleted file mode 100644
index 84f4291..0000000
--- a/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/activityport/ConnectPortsAction.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/**********************************************************************
- * 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 org.apache.taverna.scufl2.api.core.DataLink;
-import org.apache.taverna.scufl2.api.core.Workflow;
-import org.apache.taverna.scufl2.api.port.ReceiverPort;
-import org.apache.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/a9a52bd5/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
deleted file mode 100644
index c179f10..0000000
--- a/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/activityport/CreateAndConnectDataflowPortAction.java
+++ /dev/null
@@ -1,226 +0,0 @@
-/**********************************************************************
- * 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 org.apache.taverna.scufl2.api.core.DataLink;
-import org.apache.taverna.scufl2.api.core.Workflow;
-import org.apache.taverna.scufl2.api.port.DepthPort;
-import org.apache.taverna.scufl2.api.port.InputPort;
-import org.apache.taverna.scufl2.api.port.InputWorkflowPort;
-import org.apache.taverna.scufl2.api.port.OutputPort;
-import org.apache.taverna.scufl2.api.port.OutputWorkflowPort;
-import org.apache.taverna.scufl2.api.port.Port;
-import org.apache.taverna.scufl2.api.port.ReceiverPort;
-import org.apache.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/a9a52bd5/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
deleted file mode 100644
index 8bea960..0000000
--- a/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/activityport/SetConstantInputPortValueMenuAction.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/**********************************************************************
- * 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 org.apache.taverna.commons.services.ServiceRegistry;
-import org.apache.taverna.scufl2.api.core.Workflow;
-import org.apache.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/a9a52bd5/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
deleted file mode 100644
index bb40da7..0000000
--- a/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/activityport/SetDefaultInputPortValueAction.java
+++ /dev/null
@@ -1,171 +0,0 @@
-/*******************************************************************************
- * 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 org.apache.taverna.lang.observer.Observable;
-import org.apache.taverna.lang.observer.Observer;
-import org.apache.taverna.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 org.apache.taverna.commons.services.ServiceRegistry;
-import org.apache.taverna.scufl2.api.common.Scufl2Tools;
-import org.apache.taverna.scufl2.api.container.WorkflowBundle;
-import org.apache.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/a9a52bd5/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
deleted file mode 100644
index 0105f21..0000000
--- a/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/annotated/AnnotatedConfigureMenuAction.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/**********************************************************************
- * 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 org.apache.taverna.annotation.Annotated;
-import org.apache.taverna.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/a9a52bd5/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
deleted file mode 100644
index 9c459e2..0000000
--- a/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/contextualviews/ConfigureRunningContextualMenuSection.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/**********************************************************************
- * 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/a9a52bd5/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
deleted file mode 100644
index 0f1a17f..0000000
--- a/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/contextualviews/ConfigureSection.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/**********************************************************************
- * 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/a9a52bd5/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
deleted file mode 100644
index d23ec6e..0000000
--- a/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/contextualviews/EditSection.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/**********************************************************************
- * 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;
-	}
-}


[25/51] [partial] incubator-taverna-workbench git commit: all packages are moved to org.apache.taverna.*

Posted by re...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-design-ui/src/main/java/org/apache/taverna/workbench/design/actions/RenameProcessorAction.java
----------------------------------------------------------------------
diff --git a/taverna-design-ui/src/main/java/org/apache/taverna/workbench/design/actions/RenameProcessorAction.java b/taverna-design-ui/src/main/java/org/apache/taverna/workbench/design/actions/RenameProcessorAction.java
new file mode 100644
index 0000000..9807d85
--- /dev/null
+++ b/taverna-design-ui/src/main/java/org/apache/taverna/workbench/design/actions/RenameProcessorAction.java
@@ -0,0 +1,96 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.design.actions;
+
+import java.awt.Component;
+import java.awt.Dimension;
+import java.awt.event.ActionEvent;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.apache.taverna.lang.ui.ValidatingUserInputDialog;
+import org.apache.taverna.workbench.design.ui.ProcessorPanel;
+import org.apache.taverna.workbench.edits.EditException;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.icons.WorkbenchIcons;
+import org.apache.taverna.workbench.selection.SelectionManager;
+import org.apache.taverna.workflow.edits.RenameEdit;
+
+import org.apache.log4j.Logger;
+
+import org.apache.taverna.scufl2.api.core.Processor;
+import org.apache.taverna.scufl2.api.core.Workflow;
+
+/**
+ * Action for renaming a processor.
+ * 
+ * @author David Withers
+ */
+public class RenameProcessorAction extends DataflowEditAction {
+
+	private static final long serialVersionUID = 1L;
+
+	private static Logger logger = Logger
+			.getLogger(RenameProcessorAction.class);
+
+	private Processor processor;
+
+	public RenameProcessorAction(Workflow dataflow, Processor processor,
+			Component component, EditManager editManager,
+			SelectionManager selectionManager) {
+		super(dataflow, component, editManager, selectionManager);
+		this.processor = processor;
+		putValue(SMALL_ICON, WorkbenchIcons.renameIcon);
+		putValue(NAME, "Rename service...");
+	}
+
+	@Override
+	public void actionPerformed(ActionEvent e) {
+		Set<String> usedProcessors = new HashSet<>();
+		for (Processor usedProcessor : dataflow.getProcessors())
+			if (!usedProcessor.getName().equals(processor.getName()))
+				usedProcessors.add(usedProcessor.getName());
+
+		ProcessorPanel inputPanel = new ProcessorPanel();
+
+		ValidatingUserInputDialog vuid = new ValidatingUserInputDialog(
+				"Rename service", inputPanel);
+		vuid.addTextComponentValidation(inputPanel.getProcessorNameField(),
+				"Set the service name.", usedProcessors, "Duplicate service.",
+				"[\\p{L}\\p{Digit}_.]+", "Invalid service name.");
+		vuid.setSize(new Dimension(400, 200));
+
+		inputPanel.setProcessorName(processor.getName());
+
+		try {
+			if (vuid.show(component))
+				changeProcessorName(inputPanel);
+		} catch (EditException e1) {
+			logger.debug("Rename service (processor) failed", e1);
+		}
+	}
+
+	private void changeProcessorName(ProcessorPanel inputPanel)
+			throws EditException {
+		String processorName = inputPanel.getProcessorName();
+		editManager.doDataflowEdit(dataflow.getParent(), new RenameEdit<>(
+				processor, processorName));
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-design-ui/src/main/java/org/apache/taverna/workbench/design/ui/DataflowInputPortPanel.java
----------------------------------------------------------------------
diff --git a/taverna-design-ui/src/main/java/org/apache/taverna/workbench/design/ui/DataflowInputPortPanel.java b/taverna-design-ui/src/main/java/org/apache/taverna/workbench/design/ui/DataflowInputPortPanel.java
new file mode 100644
index 0000000..2c8f0c6
--- /dev/null
+++ b/taverna-design-ui/src/main/java/org/apache/taverna/workbench/design/ui/DataflowInputPortPanel.java
@@ -0,0 +1,202 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.design.ui;
+
+import static java.awt.GridBagConstraints.HORIZONTAL;
+import static java.awt.GridBagConstraints.NONE;
+import static java.awt.GridBagConstraints.NORTHWEST;
+import static java.awt.GridBagConstraints.WEST;
+import static java.awt.event.ItemEvent.SELECTED;
+
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.Insets;
+import java.awt.event.ItemEvent;
+import java.awt.event.ItemListener;
+
+import javax.swing.ButtonGroup;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JRadioButton;
+import javax.swing.JSpinner;
+import javax.swing.JTextField;
+import javax.swing.SpinnerNumberModel;
+import javax.swing.border.EmptyBorder;
+
+/**
+ * UI for creating/editing dataflow input ports.
+ * 
+ * @author David Withers
+ */
+public class DataflowInputPortPanel extends JPanel {
+	private static final long serialVersionUID = 2650486705615513458L;
+
+	private JTextField portNameField;
+	private JRadioButton singleValueButton;
+	private JRadioButton listValueButton;
+	private JSpinner listDepthSpinner;
+
+	public DataflowInputPortPanel() {
+		super(new GridBagLayout());
+
+		portNameField = new JTextField();
+		singleValueButton = new JRadioButton("Single value");
+		listValueButton = new JRadioButton("List of depth ");
+		listDepthSpinner = new JSpinner(new SpinnerNumberModel(1, 1, 100, 1));
+
+		setBorder(new EmptyBorder(10, 10, 10, 10));
+
+		GridBagConstraints constraints = new GridBagConstraints();
+
+		constraints.anchor = WEST;
+		constraints.gridx = 0;
+		constraints.gridy = 0;
+		constraints.ipadx = 10;
+		add(new JLabel("Name:"), constraints);
+
+		constraints.gridx = 1;
+		constraints.gridwidth = 2;
+		constraints.ipadx = 0;
+		constraints.weightx = 1d;
+		constraints.fill = HORIZONTAL;
+		add(portNameField, constraints);
+
+		constraints.gridx = 0;
+		constraints.gridy = 1;
+		constraints.gridwidth = 1;
+		constraints.weightx = 0d;
+		constraints.fill = NONE;
+		constraints.ipadx = 10;
+		constraints.insets = new Insets(10, 0, 0, 0);
+		add(new JLabel("Type:"), constraints);
+
+		ButtonGroup buttonGroup = new ButtonGroup();
+		buttonGroup.add(singleValueButton);
+		buttonGroup.add(listValueButton);
+
+		final JLabel helpLabel = new JLabel(
+				"Depth 1 is a list, 2 is a list of lists, etc.");
+		helpLabel.setFont(helpLabel.getFont().deriveFont(11f));
+
+		singleValueButton.addItemListener(new ItemListener() {
+			@Override
+			public void itemStateChanged(ItemEvent e) {
+				boolean selected = (e.getStateChange() == SELECTED);
+				listDepthSpinner.setEnabled(!selected);
+				helpLabel.setEnabled(!selected);
+			}
+		});
+
+		constraints.gridx = 1;
+		constraints.gridwidth = 2;
+		constraints.ipadx = 0;
+		add(singleValueButton, constraints);
+		constraints.gridy = 2;
+		constraints.gridwidth = 1;
+		constraints.insets = new Insets(0, 0, 0, 0);
+		add(listValueButton, constraints);
+		constraints.gridx = 2;
+		add(listDepthSpinner, constraints);
+		constraints.gridx = 1;
+		constraints.gridy = 3;
+		constraints.gridwidth = 2;
+		constraints.weighty = 1d;
+		constraints.anchor = NORTHWEST;
+		constraints.insets = new Insets(0, 20, 0, 0);
+		add(helpLabel, constraints);
+	}
+
+	/**
+	 * Returns the portNameField.
+	 * 
+	 * @return the portNameField
+	 */
+	public JTextField getPortNameField() {
+		return portNameField;
+	}
+
+	/**
+	 * Returns the singleValueButton.
+	 * 
+	 * @return the singleValueButton
+	 */
+	public JRadioButton getSingleValueButton() {
+		return singleValueButton;
+	}
+
+	/**
+	 * Returns the listValueButton.
+	 * 
+	 * @return the listValueButton
+	 */
+	public JRadioButton getListValueButton() {
+		return listValueButton;
+	}
+
+	/**
+	 * Returns the port name.
+	 * 
+	 * @return the port name
+	 */
+	public String getPortName() {
+		return portNameField.getText();
+	}
+
+	/**
+	 * Sets the port name.
+	 * 
+	 * @param name
+	 *            the name of the port
+	 */
+	public void setPortName(String name) {
+		portNameField.setText(name);
+		// Select the text
+		if (!name.isEmpty()) {
+			portNameField.setSelectionStart(0);
+			portNameField.setSelectionEnd(name.length());
+		}
+	}
+
+	/**
+	 * Returns the port depth.
+	 * 
+	 * @return the port depth
+	 */
+	public int getPortDepth() {
+		if (singleValueButton.isSelected())
+			return 0;
+		return (Integer) listDepthSpinner.getValue();
+	}
+
+	/**
+	 * Sets the port depth.
+	 * 
+	 * @param depth
+	 *            the depth of the port
+	 */
+	public void setPortDepth(int depth) {
+		if (depth == 0) {
+			singleValueButton.setSelected(true);
+		} else {
+			listValueButton.setSelected(true);
+			listDepthSpinner.setValue(depth);
+		}
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-design-ui/src/main/java/org/apache/taverna/workbench/design/ui/DataflowOutputPortPanel.java
----------------------------------------------------------------------
diff --git a/taverna-design-ui/src/main/java/org/apache/taverna/workbench/design/ui/DataflowOutputPortPanel.java b/taverna-design-ui/src/main/java/org/apache/taverna/workbench/design/ui/DataflowOutputPortPanel.java
new file mode 100644
index 0000000..b06bc04
--- /dev/null
+++ b/taverna-design-ui/src/main/java/org/apache/taverna/workbench/design/ui/DataflowOutputPortPanel.java
@@ -0,0 +1,104 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.design.ui;
+
+import static java.awt.GridBagConstraints.HORIZONTAL;
+import static java.awt.GridBagConstraints.VERTICAL;
+import static java.awt.GridBagConstraints.WEST;
+
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JTextField;
+import javax.swing.border.EmptyBorder;
+
+/**
+ * UI for creating/editing dataflow output ports.
+ * 
+ * @author David Withers
+ */
+public class DataflowOutputPortPanel extends JPanel {
+	private static final long serialVersionUID = -2542858679939965553L;
+
+	private JTextField portNameField;
+
+	public DataflowOutputPortPanel() {
+		super(new GridBagLayout());
+
+		portNameField = new JTextField();
+ 
+		setBorder(new EmptyBorder(10, 10, 10, 10));
+		
+		GridBagConstraints constraints = new GridBagConstraints();
+
+		constraints.anchor = WEST;
+		constraints.gridx = 0;
+		constraints.gridy = 0;
+		constraints.ipadx = 10;
+		add(new JLabel("Name:"), constraints);
+
+		constraints.gridx = 1;
+		constraints.gridwidth = 2;
+		constraints.ipadx = 0;
+		constraints.weightx = 1d;
+		constraints.fill = HORIZONTAL;
+		add(portNameField, constraints);
+
+		constraints.gridx = 0;
+		constraints.gridy = 1;
+		constraints.fill = VERTICAL;
+		constraints.weighty = 1d;
+		add(new JPanel(), constraints);
+	}
+	
+	/**
+	 * Returns the portNameField.
+	 *
+	 * @return the portNameField
+	 */
+	public JTextField getPortNameField() {
+		return portNameField;
+	}
+
+	/**
+	 * Returns the port name.
+	 *
+	 * @return the port name
+	 */
+	public String getPortName() {
+		return portNameField.getText();
+	}
+	
+	/**
+	 * Sets the port name.
+	 *
+	 * @param name the name of the port
+	 */
+	public void setPortName(String name) {
+		portNameField.setText(name);
+		// Select the text
+		if (!name.isEmpty()) {
+			portNameField.setSelectionStart(0);
+			portNameField.setSelectionEnd(name.length());
+		}
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-design-ui/src/main/java/org/apache/taverna/workbench/design/ui/ProcessorPanel.java
----------------------------------------------------------------------
diff --git a/taverna-design-ui/src/main/java/org/apache/taverna/workbench/design/ui/ProcessorPanel.java b/taverna-design-ui/src/main/java/org/apache/taverna/workbench/design/ui/ProcessorPanel.java
new file mode 100644
index 0000000..a656ee5
--- /dev/null
+++ b/taverna-design-ui/src/main/java/org/apache/taverna/workbench/design/ui/ProcessorPanel.java
@@ -0,0 +1,100 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.design.ui;
+
+import static java.awt.GridBagConstraints.HORIZONTAL;
+import static java.awt.GridBagConstraints.VERTICAL;
+import static java.awt.GridBagConstraints.WEST;
+
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JTextField;
+import javax.swing.border.EmptyBorder;
+
+/**
+ * UI for editing processors.
+ * 
+ * @author David Withers
+ */
+public class ProcessorPanel extends JPanel {
+	private static final long serialVersionUID = 260705376633425003L;
+
+	private JTextField processorNameField;
+
+	public ProcessorPanel() {
+		super(new GridBagLayout());
+
+		processorNameField = new JTextField();
+
+		setBorder(new EmptyBorder(10, 10, 10, 10));
+
+		GridBagConstraints constraints = new GridBagConstraints();
+
+		constraints.anchor = WEST;
+		constraints.gridx = 0;
+		constraints.gridy = 0;
+		constraints.ipadx = 10;
+		add(new JLabel("Name:"), constraints);
+
+		constraints.gridx = 1;
+		constraints.gridwidth = 2;
+		constraints.ipadx = 0;
+		constraints.weightx = 1d;
+		constraints.fill = HORIZONTAL;
+		add(processorNameField, constraints);
+
+		constraints.gridx = 0;
+		constraints.gridy = 1;
+		constraints.fill = VERTICAL;
+		constraints.weighty = 1d;
+		add(new JPanel(), constraints);
+	}
+
+	/**
+	 * Returns the processorNameField.
+	 * 
+	 * @return the processorNameField
+	 */
+	public JTextField getProcessorNameField() {
+		return processorNameField;
+	}
+
+	/**
+	 * Returns the processor name.
+	 * 
+	 * @return the processor name
+	 */
+	public String getProcessorName() {
+		return processorNameField.getText();
+	}
+
+	/**
+	 * Sets the processor name.
+	 * 
+	 * @param name
+	 *            the name of the processor
+	 */
+	public void setProcessorName(String name) {
+		processorNameField.setText(name);
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-disabled-activity-ui/src/main/java/net/sf/taverna/t2/activities/disabled/actions/DisabledActivityConfigurationAction.java
----------------------------------------------------------------------
diff --git a/taverna-disabled-activity-ui/src/main/java/net/sf/taverna/t2/activities/disabled/actions/DisabledActivityConfigurationAction.java b/taverna-disabled-activity-ui/src/main/java/net/sf/taverna/t2/activities/disabled/actions/DisabledActivityConfigurationAction.java
deleted file mode 100644
index 54354eb..0000000
--- a/taverna-disabled-activity-ui/src/main/java/net/sf/taverna/t2/activities/disabled/actions/DisabledActivityConfigurationAction.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*******************************************************************************
- * 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.activities.disabled.actions;
-
-import java.awt.Component;
-import java.awt.Frame;
-import java.awt.event.ActionEvent;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.swing.JOptionPane;
-
-import org.apache.taverna.scufl2.api.activity.Activity;
-
-import net.sf.taverna.t2.activities.disabled.views.DisabledConfigView;
-import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionRegistry;
-import net.sf.taverna.t2.workbench.activityicons.ActivityIconManager;
-import net.sf.taverna.t2.workbench.edits.EditManager;
-import net.sf.taverna.t2.workbench.file.FileManager;
-import net.sf.taverna.t2.workbench.report.ReportManager;
-import net.sf.taverna.t2.workbench.ui.actions.activity.ActivityConfigurationAction;
-import net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ActivityConfigurationDialog;
-
-
-@SuppressWarnings("serial")
-public class DisabledActivityConfigurationAction extends ActivityConfigurationAction {
-
-	public static final String FIX_DISABLED = "Edit properties";
-	private final EditManager editManager;
-	private final FileManager fileManager;
-	private final ReportManager reportManager;
-
-	public DisabledActivityConfigurationAction(Activity activity, Frame owner,
-			EditManager editManager, FileManager fileManager, ReportManager reportManager,
-			ActivityIconManager activityIconManager, ServiceDescriptionRegistry serviceDescriptionRegistry) {
-		super(activity, activityIconManager, serviceDescriptionRegistry);
-		this.editManager = editManager;
-		this.fileManager = fileManager;
-		this.reportManager = reportManager;
-		putValue(NAME, FIX_DISABLED);
-	}
-
-	public void actionPerformed(ActionEvent e) {
-		ActivityConfigurationDialog currentDialog = ActivityConfigurationAction
-				.getDialog(getActivity());
-		if (currentDialog != null) {
-			currentDialog.toFront();
-			return;
-		}
-		int answer = JOptionPane.showConfirmDialog((Component) e.getSource(),
-				"Directly editing properties can be dangerous. Are you sure you want to proceed?",
-				"Confirm editing", JOptionPane.YES_NO_OPTION);
-		if (answer != JOptionPane.YES_OPTION) {
-			return;
-		}
-
-		final DisabledConfigView disabledConfigView = new DisabledConfigView(getActivity());
-		final DisabledActivityConfigurationDialog dialog = new DisabledActivityConfigurationDialog(
-				getActivity(), disabledConfigView);
-
-		ActivityConfigurationAction.setDialog(getActivity(), dialog, fileManager);
-
-	}
-
-	private class DisabledActivityConfigurationDialog extends ActivityConfigurationDialog {
-		public DisabledActivityConfigurationDialog(Activity a, DisabledConfigView p) {
-			super(a, p, editManager);
-			this.setModal(true);
-			super.applyButton.setEnabled(false);
-			super.applyButton.setVisible(false);
-		}
-
-		public void configureActivity(Dataflow df, Activity a, Object bean) {
-			Edit<?> configureActivityEdit = editManager.getEdits()
-					.getConfigureActivityEdit(a, bean);
-			try {
-				List<Edit<?>> editList = new ArrayList<Edit<?>>();
-				editList.add(configureActivityEdit);
-				Processor p = findProcessor(df, a);
-				if (p != null && p.getActivityList().size() == 1) {
-					editList.add(editManager.getEdits().getMapProcessorPortsForActivityEdit(p));
-				}
-				Edit e = Tools.getEnableDisabledActivityEdit(super.owningProcessor, activity,
-						editManager.getEdits());
-				if (e != null) {
-					editList.add(e);
-					editManager.doDataflowEdit(df, new CompoundEdit(editList));
-					reportManager.updateObjectReport(super.owningDataflow, super.owningProcessor);
-
-				}
-			} catch (IllegalStateException e) {
-				// TODO Auto-generated catch block
-				logger.error(e);
-			} catch (EditException e) {
-				logger.error(e);
-			}
-		}
-
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-disabled-activity-ui/src/main/java/net/sf/taverna/t2/activities/disabled/menu/ConfigureDisabledMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-disabled-activity-ui/src/main/java/net/sf/taverna/t2/activities/disabled/menu/ConfigureDisabledMenuAction.java b/taverna-disabled-activity-ui/src/main/java/net/sf/taverna/t2/activities/disabled/menu/ConfigureDisabledMenuAction.java
deleted file mode 100644
index 68a906e..0000000
--- a/taverna-disabled-activity-ui/src/main/java/net/sf/taverna/t2/activities/disabled/menu/ConfigureDisabledMenuAction.java
+++ /dev/null
@@ -1,52 +0,0 @@
-package net.sf.taverna.t2.activities.disabled.menu;
-
-import javax.swing.Action;
-
-import net.sf.taverna.t2.activities.disabled.actions.DisabledActivityConfigurationAction;
-import net.sf.taverna.t2.activities.disabled.views.DisabledActivityViewFactory;
-import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionRegistry;
-import net.sf.taverna.t2.workbench.activityicons.ActivityIconManager;
-import net.sf.taverna.t2.workbench.activitytools.AbstractConfigureActivityMenuAction;
-import net.sf.taverna.t2.workbench.edits.EditManager;
-import net.sf.taverna.t2.workbench.file.FileManager;
-import net.sf.taverna.t2.workbench.report.ReportManager;
-
-public class ConfigureDisabledMenuAction extends AbstractConfigureActivityMenuAction {
-
-	private EditManager editManager;
-	private FileManager fileManager;
-	private ReportManager reportManager;
-	private ActivityIconManager activityIconManager;
-	private ServiceDescriptionRegistry serviceDescriptionRegistry;
-
-	public ConfigureDisabledMenuAction() {
-		super(DisabledActivityViewFactory.ACTIVITY_TYPE);
-	}
-
-	@Override
-	protected Action createAction() {
-		return new DisabledActivityConfigurationAction(findActivity(), getParentFrame(),
-				editManager, fileManager, reportManager, activityIconManager, serviceDescriptionRegistry);
-	}
-
-	public void setEditManager(EditManager editManager) {
-		this.editManager = editManager;
-	}
-
-	public void setFileManager(FileManager fileManager) {
-		this.fileManager = fileManager;
-	}
-
-	public void setReportManager(ReportManager reportManager) {
-		this.reportManager = reportManager;
-	}
-
-	public void setActivityIconManager(ActivityIconManager activityIconManager) {
-		this.activityIconManager = activityIconManager;
-	}
-
-	public void setServiceDescriptionRegistry(ServiceDescriptionRegistry serviceDescriptionRegistry) {
-		this.serviceDescriptionRegistry = serviceDescriptionRegistry;
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-disabled-activity-ui/src/main/java/net/sf/taverna/t2/activities/disabled/views/DisabledActivityViewFactory.java
----------------------------------------------------------------------
diff --git a/taverna-disabled-activity-ui/src/main/java/net/sf/taverna/t2/activities/disabled/views/DisabledActivityViewFactory.java b/taverna-disabled-activity-ui/src/main/java/net/sf/taverna/t2/activities/disabled/views/DisabledActivityViewFactory.java
deleted file mode 100644
index 81c02e7..0000000
--- a/taverna-disabled-activity-ui/src/main/java/net/sf/taverna/t2/activities/disabled/views/DisabledActivityViewFactory.java
+++ /dev/null
@@ -1,80 +0,0 @@
-package net.sf.taverna.t2.activities.disabled.views;
-
-import java.net.URI;
-import java.util.Arrays;
-import java.util.List;
-
-import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionRegistry;
-import net.sf.taverna.t2.workbench.activityicons.ActivityIconManager;
-import net.sf.taverna.t2.workbench.configuration.colour.ColourManager;
-import net.sf.taverna.t2.workbench.edits.EditManager;
-import net.sf.taverna.t2.workbench.file.FileManager;
-import net.sf.taverna.t2.workbench.report.ReportManager;
-import net.sf.taverna.t2.workbench.ui.views.contextualviews.ContextualView;
-import net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory;
-import org.apache.taverna.scufl2.api.activity.Activity;
-
-/**
- * This class generates a contextual view for a DisabledActivity
- *
- * @author alanrw
- * @author David Withers
- */
-public class DisabledActivityViewFactory implements ContextualViewFactory<Activity> {
-
-	public static final URI ACTIVITY_TYPE = URI.create("http://ns.taverna.org.uk/2010/activity/disabled");
-
-	private EditManager editManager;
-	private FileManager fileManager;
-	private ReportManager reportManager;
-	private ActivityIconManager activityIconManager;
-	private ColourManager colourManager;
-	private ServiceDescriptionRegistry serviceDescriptionRegistry;
-
-	/**
-	 * The factory can handle a DisabledActivity
-	 *
-	 * @param object
-	 * @return
-	 */
-	public boolean canHandle(Object object) {
-		return object instanceof Activity && ((Activity) object).getType().equals(ACTIVITY_TYPE);
-	}
-
-	/**
-	 * Return a contextual view that can display information about a DisabledActivity
-	 *
-	 * @param activity
-	 * @return
-	 */
-	public List<ContextualView> getViews(Activity activity) {
-		return Arrays.asList(new ContextualView[] { new DisabledContextualView(activity,
-				editManager, fileManager, reportManager, colourManager, activityIconManager,
-				serviceDescriptionRegistry) });
-	}
-
-	public void setEditManager(EditManager editManager) {
-		this.editManager = editManager;
-	}
-
-	public void setFileManager(FileManager fileManager) {
-		this.fileManager = fileManager;
-	}
-
-	public void setReportManager(ReportManager reportManager) {
-		this.reportManager = reportManager;
-	}
-
-	public void setActivityIconManager(ActivityIconManager activityIconManager) {
-		this.activityIconManager = activityIconManager;
-	}
-
-	public void setColourManager(ColourManager colourManager) {
-		this.colourManager = colourManager;
-	}
-
-	public void setServiceDescriptionRegistry(ServiceDescriptionRegistry serviceDescriptionRegistry) {
-		this.serviceDescriptionRegistry = serviceDescriptionRegistry;
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-disabled-activity-ui/src/main/java/net/sf/taverna/t2/activities/disabled/views/DisabledConfigView.java
----------------------------------------------------------------------
diff --git a/taverna-disabled-activity-ui/src/main/java/net/sf/taverna/t2/activities/disabled/views/DisabledConfigView.java b/taverna-disabled-activity-ui/src/main/java/net/sf/taverna/t2/activities/disabled/views/DisabledConfigView.java
deleted file mode 100644
index 38e2b82..0000000
--- a/taverna-disabled-activity-ui/src/main/java/net/sf/taverna/t2/activities/disabled/views/DisabledConfigView.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*******************************************************************************
- * 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.activities.disabled.views;
-
-import java.awt.BorderLayout;
-import java.beans.BeanInfo;
-import java.beans.IntrospectionException;
-import java.beans.Introspector;
-import java.beans.PropertyDescriptor;
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.help.CSH;
-import javax.swing.JOptionPane;
-import javax.swing.JPanel;
-
-import org.apache.taverna.scufl2.api.activity.Activity;
-
-import net.sf.taverna.t2.lang.uibuilder.UIBuilder;
-import net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ActivityConfigurationPanel;
-
-import com.thoughtworks.xstream.XStream;
-import com.thoughtworks.xstream.io.xml.DomDriver;
-
-@SuppressWarnings("serial")
-public class DisabledConfigView extends ActivityConfigurationPanel {
-
-    private ActivityAndBeanWrapper configuration;
-    private List<String> fieldNames;
-
-    private Object clonedConfig = null;
-    String origConfigXML = "";
-
-    public DisabledConfigView(Activity activity) {
-        super(activity);
-        setLayout(new BorderLayout());
-        fieldNames = null;
-        initialise();
-    }
-
-    @Override
-	protected void initialise() {
-		CSH.setHelpIDString(
-				    this,
-				    "net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.DisabledConfigView");
-		configuration = activity.getConfiguration();
-		XStream xstream = new XStream(new DomDriver());
-		Activity a = configuration.getActivity();
-		xstream.setClassLoader(a.getClass().getClassLoader());
-		Object origConfig = configuration.getBean();
-		if (fieldNames == null) {
-		    fieldNames = getFieldNames(origConfig);
-		}
-		origConfigXML = xstream.toXML(origConfig);
-		clonedConfig  = xstream.fromXML(origConfigXML);
-		JPanel panel = UIBuilder.buildEditor(clonedConfig, (String[]) fieldNames.toArray(new String[0]));
-		this.add(panel, BorderLayout.CENTER);
-		this.revalidate();
-	}
-
-	@Override
-	public void refreshConfiguration() {
-	    this.removeAll();
-	    initialise();
-	}
-
-	public boolean checkValues() {
-	    boolean result = false;
-		result = activity.configurationWouldWork(clonedConfig);
-		if (!result) {
-		    JOptionPane.showMessageDialog(
-						  this,
-						  "The new properties are invalid or not consistent with the workflow",
-						  "Invalid properties", JOptionPane.WARNING_MESSAGE);
-		}
-	    return result;
-	}
-
-    public void noteConfiguration() {
-	if (isConfigurationChanged()) {
-	    ActivityAndBeanWrapper newConfig = new ActivityAndBeanWrapper();
-	    newConfig.setActivity(configuration.getActivity());
-	    newConfig.setBean(clonedConfig);
-	    configuration = newConfig;
-
-	    XStream xstream = new XStream(new DomDriver());
-	    xstream.setClassLoader(configuration.getActivity().getClass().getClassLoader());
-
-	    origConfigXML = xstream.toXML(clonedConfig);
-	}
-    }
-
-    @Override
-	public ActivityAndBeanWrapper getConfiguration() {
-	return configuration;
-    }
-
-    public boolean isConfigurationChanged() {
-	XStream xstream = new XStream(new DomDriver());
-	xstream.setClassLoader(configuration.getActivity().getClass().getClassLoader());
-	return (!xstream.toXML(clonedConfig).equals(origConfigXML));
-    }
-
-    private List<String> getFieldNames(Object config) {
-	List<String> result = new ArrayList<String>();
-	try {
-	    BeanInfo beanInfo = Introspector.getBeanInfo(config.getClass());
-	    for (PropertyDescriptor pd : beanInfo.getPropertyDescriptors()) {
-		Method readMethod = pd.getReadMethod();
-		if ((readMethod != null) && !(pd.getName().equals("class"))) {
-		    try {
-			result.add(pd.getName());
-		    } catch (IllegalArgumentException ex) {
-			// ignore
-		    }
-		}
-	    }
-	} catch (IntrospectionException e) {
-	    // ignore
-	}
-	return result;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-disabled-activity-ui/src/main/java/net/sf/taverna/t2/activities/disabled/views/DisabledContextualView.java
----------------------------------------------------------------------
diff --git a/taverna-disabled-activity-ui/src/main/java/net/sf/taverna/t2/activities/disabled/views/DisabledContextualView.java b/taverna-disabled-activity-ui/src/main/java/net/sf/taverna/t2/activities/disabled/views/DisabledContextualView.java
deleted file mode 100644
index ca99430..0000000
--- a/taverna-disabled-activity-ui/src/main/java/net/sf/taverna/t2/activities/disabled/views/DisabledContextualView.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.activities.disabled.views;
-
-import java.awt.Frame;
-import java.beans.BeanInfo;
-import java.beans.IntrospectionException;
-import java.beans.Introspector;
-import java.beans.PropertyDescriptor;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.swing.Action;
-
-import net.sf.taverna.t2.activities.disabled.actions.DisabledActivityConfigurationAction;
-import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionRegistry;
-import net.sf.taverna.t2.workbench.activityicons.ActivityIconManager;
-import net.sf.taverna.t2.workbench.configuration.colour.ColourManager;
-import net.sf.taverna.t2.workbench.edits.EditManager;
-import net.sf.taverna.t2.workbench.file.FileManager;
-import net.sf.taverna.t2.workbench.report.ReportManager;
-import net.sf.taverna.t2.workbench.ui.actions.activity.HTMLBasedActivityContextualView;
-import org.apache.taverna.scufl2.api.activity.Activity;
-import org.apache.taverna.scufl2.api.port.InputActivityPort;
-import org.apache.taverna.scufl2.api.port.OutputActivityPort;
-
-import com.fasterxml.jackson.databind.JsonNode;
-
-/**
- * A DisabledContextualView displays information about a DisabledActivity
- *
- * @author alanrw
- * @author David Withers
- */
-@SuppressWarnings("serial")
-public class DisabledContextualView extends HTMLBasedActivityContextualView {
-
-	private List<String> fieldNames;
-
-	private final EditManager editManager;
-	private final FileManager fileManager;
-	private final ReportManager reportManager;
-	private final ActivityIconManager activityIconManager;
-	private final ServiceDescriptionRegistry serviceDescriptionRegistry;
-
-	public DisabledContextualView(Activity activity, EditManager editManager,
-			FileManager fileManager, ReportManager reportManager, ColourManager colourManager,
-			ActivityIconManager activityIconManager, ServiceDescriptionRegistry serviceDescriptionRegistry) {
-		super(activity, colourManager);
-		this.editManager = editManager;
-		this.fileManager = fileManager;
-		this.reportManager = reportManager;
-		this.activityIconManager = activityIconManager;
-		this.serviceDescriptionRegistry = serviceDescriptionRegistry;
-	}
-
-	/**
-	 * The table for the DisabledActivity shows its ports and the information within the offline
-	 * Activity's configuration.
-	 *
-	 * @return
-	 */
-	@Override
-	protected String getRawTableRowsHtml() {
-		StringBuilder html = new StringBuilder();
-		html.append("<tr><th>Input Port Name</th><th>Depth</th></tr>");
-		for (InputActivityPort inputActivityPort : getActivity().getInputPorts()) {
-			html.append("<tr><td>" + inputActivityPort.getName() + "</td><td>");
-			html.append(inputActivityPort.getDepth() + "</td></tr>");
-		}
-		html.append("<tr><th>Output Port Name</th><th>Depth</th></tr>");
-		for (OutputActivityPort outputActivityPort : getActivity().getOutputPorts()) {
-			html.append("<tr><td>" + outputActivityPort.getName() + "</td><td>");
-			html.append(outputActivityPort.getDepth() + "</td></tr>");
-		}
-
-		JsonNode config = getConfigBean().getJson();
-		try {
-			html.append("<tr><th>Property Name</th><th>Property Value</th></tr>");
-			BeanInfo beanInfo = Introspector.getBeanInfo(config.getClass());
-			for (PropertyDescriptor pd : beanInfo.getPropertyDescriptors()) {
-				Method readMethod = pd.getReadMethod();
-				if ((readMethod != null) && !(pd.getName().equals("class"))) {
-					try {
-						html.append("<tr><td>");
-						html.append(pd.getName());
-						html.append("</td><td>");
-						html.append(readMethod.invoke(config));
-						html.append("</td></tr>");
-						if (fieldNames == null) {
-							fieldNames = new ArrayList<String>();
-						}
-						fieldNames.add(pd.getName());
-					} catch (IllegalAccessException ex) {
-						// ignore
-					} catch (IllegalArgumentException ex) {
-						// ignore
-					} catch (InvocationTargetException ex) {
-						// ignore
-					}
-				}
-			}
-		} catch (IntrospectionException e) {
-			// ignore
-		}
-		return html.toString();
-	}
-
-	@Override
-	public String getViewTitle() {
-		return "Unavailable service";
-	}
-
-	@Override
-	public int getPreferredPosition() {
-		return 100;
-	}
-
-	@Override
-	public Action getConfigureAction(Frame owner) {
-		return new DisabledActivityConfigurationAction(getActivity(), owner,
-				editManager, fileManager, reportManager, activityIconManager, serviceDescriptionRegistry);
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-disabled-activity-ui/src/main/java/org/apache/taverna/activities/disabled/actions/DisabledActivityConfigurationAction.java
----------------------------------------------------------------------
diff --git a/taverna-disabled-activity-ui/src/main/java/org/apache/taverna/activities/disabled/actions/DisabledActivityConfigurationAction.java b/taverna-disabled-activity-ui/src/main/java/org/apache/taverna/activities/disabled/actions/DisabledActivityConfigurationAction.java
new file mode 100644
index 0000000..da38c6c
--- /dev/null
+++ b/taverna-disabled-activity-ui/src/main/java/org/apache/taverna/activities/disabled/actions/DisabledActivityConfigurationAction.java
@@ -0,0 +1,119 @@
+/*******************************************************************************
+ * 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 org.apache.taverna.activities.disabled.actions;
+
+import java.awt.Component;
+import java.awt.Frame;
+import java.awt.event.ActionEvent;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.swing.JOptionPane;
+
+import org.apache.taverna.scufl2.api.activity.Activity;
+
+import org.apache.taverna.activities.disabled.views.DisabledConfigView;
+import org.apache.taverna.servicedescriptions.ServiceDescriptionRegistry;
+import org.apache.taverna.workbench.activityicons.ActivityIconManager;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.file.FileManager;
+import org.apache.taverna.workbench.report.ReportManager;
+import org.apache.taverna.workbench.ui.actions.activity.ActivityConfigurationAction;
+import org.apache.taverna.workbench.ui.views.contextualviews.activity.ActivityConfigurationDialog;
+
+
+@SuppressWarnings("serial")
+public class DisabledActivityConfigurationAction extends ActivityConfigurationAction {
+
+	public static final String FIX_DISABLED = "Edit properties";
+	private final EditManager editManager;
+	private final FileManager fileManager;
+	private final ReportManager reportManager;
+
+	public DisabledActivityConfigurationAction(Activity activity, Frame owner,
+			EditManager editManager, FileManager fileManager, ReportManager reportManager,
+			ActivityIconManager activityIconManager, ServiceDescriptionRegistry serviceDescriptionRegistry) {
+		super(activity, activityIconManager, serviceDescriptionRegistry);
+		this.editManager = editManager;
+		this.fileManager = fileManager;
+		this.reportManager = reportManager;
+		putValue(NAME, FIX_DISABLED);
+	}
+
+	public void actionPerformed(ActionEvent e) {
+		ActivityConfigurationDialog currentDialog = ActivityConfigurationAction
+				.getDialog(getActivity());
+		if (currentDialog != null) {
+			currentDialog.toFront();
+			return;
+		}
+		int answer = JOptionPane.showConfirmDialog((Component) e.getSource(),
+				"Directly editing properties can be dangerous. Are you sure you want to proceed?",
+				"Confirm editing", JOptionPane.YES_NO_OPTION);
+		if (answer != JOptionPane.YES_OPTION) {
+			return;
+		}
+
+		final DisabledConfigView disabledConfigView = new DisabledConfigView(getActivity());
+		final DisabledActivityConfigurationDialog dialog = new DisabledActivityConfigurationDialog(
+				getActivity(), disabledConfigView);
+
+		ActivityConfigurationAction.setDialog(getActivity(), dialog, fileManager);
+
+	}
+
+	private class DisabledActivityConfigurationDialog extends ActivityConfigurationDialog {
+		public DisabledActivityConfigurationDialog(Activity a, DisabledConfigView p) {
+			super(a, p, editManager);
+			this.setModal(true);
+			super.applyButton.setEnabled(false);
+			super.applyButton.setVisible(false);
+		}
+
+		public void configureActivity(Dataflow df, Activity a, Object bean) {
+			Edit<?> configureActivityEdit = editManager.getEdits()
+					.getConfigureActivityEdit(a, bean);
+			try {
+				List<Edit<?>> editList = new ArrayList<Edit<?>>();
+				editList.add(configureActivityEdit);
+				Processor p = findProcessor(df, a);
+				if (p != null && p.getActivityList().size() == 1) {
+					editList.add(editManager.getEdits().getMapProcessorPortsForActivityEdit(p));
+				}
+				Edit e = Tools.getEnableDisabledActivityEdit(super.owningProcessor, activity,
+						editManager.getEdits());
+				if (e != null) {
+					editList.add(e);
+					editManager.doDataflowEdit(df, new CompoundEdit(editList));
+					reportManager.updateObjectReport(super.owningDataflow, super.owningProcessor);
+
+				}
+			} catch (IllegalStateException e) {
+				// TODO Auto-generated catch block
+				logger.error(e);
+			} catch (EditException e) {
+				logger.error(e);
+			}
+		}
+
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-disabled-activity-ui/src/main/java/org/apache/taverna/activities/disabled/menu/ConfigureDisabledMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-disabled-activity-ui/src/main/java/org/apache/taverna/activities/disabled/menu/ConfigureDisabledMenuAction.java b/taverna-disabled-activity-ui/src/main/java/org/apache/taverna/activities/disabled/menu/ConfigureDisabledMenuAction.java
new file mode 100644
index 0000000..b99d148
--- /dev/null
+++ b/taverna-disabled-activity-ui/src/main/java/org/apache/taverna/activities/disabled/menu/ConfigureDisabledMenuAction.java
@@ -0,0 +1,52 @@
+package org.apache.taverna.activities.disabled.menu;
+
+import javax.swing.Action;
+
+import org.apache.taverna.activities.disabled.actions.DisabledActivityConfigurationAction;
+import org.apache.taverna.activities.disabled.views.DisabledActivityViewFactory;
+import org.apache.taverna.servicedescriptions.ServiceDescriptionRegistry;
+import org.apache.taverna.workbench.activityicons.ActivityIconManager;
+import org.apache.taverna.workbench.activitytools.AbstractConfigureActivityMenuAction;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.file.FileManager;
+import org.apache.taverna.workbench.report.ReportManager;
+
+public class ConfigureDisabledMenuAction extends AbstractConfigureActivityMenuAction {
+
+	private EditManager editManager;
+	private FileManager fileManager;
+	private ReportManager reportManager;
+	private ActivityIconManager activityIconManager;
+	private ServiceDescriptionRegistry serviceDescriptionRegistry;
+
+	public ConfigureDisabledMenuAction() {
+		super(DisabledActivityViewFactory.ACTIVITY_TYPE);
+	}
+
+	@Override
+	protected Action createAction() {
+		return new DisabledActivityConfigurationAction(findActivity(), getParentFrame(),
+				editManager, fileManager, reportManager, activityIconManager, serviceDescriptionRegistry);
+	}
+
+	public void setEditManager(EditManager editManager) {
+		this.editManager = editManager;
+	}
+
+	public void setFileManager(FileManager fileManager) {
+		this.fileManager = fileManager;
+	}
+
+	public void setReportManager(ReportManager reportManager) {
+		this.reportManager = reportManager;
+	}
+
+	public void setActivityIconManager(ActivityIconManager activityIconManager) {
+		this.activityIconManager = activityIconManager;
+	}
+
+	public void setServiceDescriptionRegistry(ServiceDescriptionRegistry serviceDescriptionRegistry) {
+		this.serviceDescriptionRegistry = serviceDescriptionRegistry;
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-disabled-activity-ui/src/main/java/org/apache/taverna/activities/disabled/views/DisabledActivityViewFactory.java
----------------------------------------------------------------------
diff --git a/taverna-disabled-activity-ui/src/main/java/org/apache/taverna/activities/disabled/views/DisabledActivityViewFactory.java b/taverna-disabled-activity-ui/src/main/java/org/apache/taverna/activities/disabled/views/DisabledActivityViewFactory.java
new file mode 100644
index 0000000..02f875f
--- /dev/null
+++ b/taverna-disabled-activity-ui/src/main/java/org/apache/taverna/activities/disabled/views/DisabledActivityViewFactory.java
@@ -0,0 +1,80 @@
+package org.apache.taverna.activities.disabled.views;
+
+import java.net.URI;
+import java.util.Arrays;
+import java.util.List;
+
+import org.apache.taverna.servicedescriptions.ServiceDescriptionRegistry;
+import org.apache.taverna.workbench.activityicons.ActivityIconManager;
+import org.apache.taverna.workbench.configuration.colour.ColourManager;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.file.FileManager;
+import org.apache.taverna.workbench.report.ReportManager;
+import org.apache.taverna.workbench.ui.views.contextualviews.ContextualView;
+import org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory;
+import org.apache.taverna.scufl2.api.activity.Activity;
+
+/**
+ * This class generates a contextual view for a DisabledActivity
+ *
+ * @author alanrw
+ * @author David Withers
+ */
+public class DisabledActivityViewFactory implements ContextualViewFactory<Activity> {
+
+	public static final URI ACTIVITY_TYPE = URI.create("http://ns.taverna.org.uk/2010/activity/disabled");
+
+	private EditManager editManager;
+	private FileManager fileManager;
+	private ReportManager reportManager;
+	private ActivityIconManager activityIconManager;
+	private ColourManager colourManager;
+	private ServiceDescriptionRegistry serviceDescriptionRegistry;
+
+	/**
+	 * The factory can handle a DisabledActivity
+	 *
+	 * @param object
+	 * @return
+	 */
+	public boolean canHandle(Object object) {
+		return object instanceof Activity && ((Activity) object).getType().equals(ACTIVITY_TYPE);
+	}
+
+	/**
+	 * Return a contextual view that can display information about a DisabledActivity
+	 *
+	 * @param activity
+	 * @return
+	 */
+	public List<ContextualView> getViews(Activity activity) {
+		return Arrays.asList(new ContextualView[] { new DisabledContextualView(activity,
+				editManager, fileManager, reportManager, colourManager, activityIconManager,
+				serviceDescriptionRegistry) });
+	}
+
+	public void setEditManager(EditManager editManager) {
+		this.editManager = editManager;
+	}
+
+	public void setFileManager(FileManager fileManager) {
+		this.fileManager = fileManager;
+	}
+
+	public void setReportManager(ReportManager reportManager) {
+		this.reportManager = reportManager;
+	}
+
+	public void setActivityIconManager(ActivityIconManager activityIconManager) {
+		this.activityIconManager = activityIconManager;
+	}
+
+	public void setColourManager(ColourManager colourManager) {
+		this.colourManager = colourManager;
+	}
+
+	public void setServiceDescriptionRegistry(ServiceDescriptionRegistry serviceDescriptionRegistry) {
+		this.serviceDescriptionRegistry = serviceDescriptionRegistry;
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-disabled-activity-ui/src/main/java/org/apache/taverna/activities/disabled/views/DisabledConfigView.java
----------------------------------------------------------------------
diff --git a/taverna-disabled-activity-ui/src/main/java/org/apache/taverna/activities/disabled/views/DisabledConfigView.java b/taverna-disabled-activity-ui/src/main/java/org/apache/taverna/activities/disabled/views/DisabledConfigView.java
new file mode 100644
index 0000000..b3ec316
--- /dev/null
+++ b/taverna-disabled-activity-ui/src/main/java/org/apache/taverna/activities/disabled/views/DisabledConfigView.java
@@ -0,0 +1,142 @@
+/*******************************************************************************
+ * 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 org.apache.taverna.activities.disabled.views;
+
+import java.awt.BorderLayout;
+import java.beans.BeanInfo;
+import java.beans.IntrospectionException;
+import java.beans.Introspector;
+import java.beans.PropertyDescriptor;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.help.CSH;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+
+import org.apache.taverna.scufl2.api.activity.Activity;
+
+import org.apache.taverna.lang.uibuilder.UIBuilder;
+import org.apache.taverna.workbench.ui.views.contextualviews.activity.ActivityConfigurationPanel;
+
+import com.thoughtworks.xstream.XStream;
+import com.thoughtworks.xstream.io.xml.DomDriver;
+
+@SuppressWarnings("serial")
+public class DisabledConfigView extends ActivityConfigurationPanel {
+
+    private ActivityAndBeanWrapper configuration;
+    private List<String> fieldNames;
+
+    private Object clonedConfig = null;
+    String origConfigXML = "";
+
+    public DisabledConfigView(Activity activity) {
+        super(activity);
+        setLayout(new BorderLayout());
+        fieldNames = null;
+        initialise();
+    }
+
+    @Override
+	protected void initialise() {
+		CSH.setHelpIDString(
+				    this,
+				    "net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.DisabledConfigView");
+		configuration = activity.getConfiguration();
+		XStream xstream = new XStream(new DomDriver());
+		Activity a = configuration.getActivity();
+		xstream.setClassLoader(a.getClass().getClassLoader());
+		Object origConfig = configuration.getBean();
+		if (fieldNames == null) {
+		    fieldNames = getFieldNames(origConfig);
+		}
+		origConfigXML = xstream.toXML(origConfig);
+		clonedConfig  = xstream.fromXML(origConfigXML);
+		JPanel panel = UIBuilder.buildEditor(clonedConfig, (String[]) fieldNames.toArray(new String[0]));
+		this.add(panel, BorderLayout.CENTER);
+		this.revalidate();
+	}
+
+	@Override
+	public void refreshConfiguration() {
+	    this.removeAll();
+	    initialise();
+	}
+
+	public boolean checkValues() {
+	    boolean result = false;
+		result = activity.configurationWouldWork(clonedConfig);
+		if (!result) {
+		    JOptionPane.showMessageDialog(
+						  this,
+						  "The new properties are invalid or not consistent with the workflow",
+						  "Invalid properties", JOptionPane.WARNING_MESSAGE);
+		}
+	    return result;
+	}
+
+    public void noteConfiguration() {
+	if (isConfigurationChanged()) {
+	    ActivityAndBeanWrapper newConfig = new ActivityAndBeanWrapper();
+	    newConfig.setActivity(configuration.getActivity());
+	    newConfig.setBean(clonedConfig);
+	    configuration = newConfig;
+
+	    XStream xstream = new XStream(new DomDriver());
+	    xstream.setClassLoader(configuration.getActivity().getClass().getClassLoader());
+
+	    origConfigXML = xstream.toXML(clonedConfig);
+	}
+    }
+
+    @Override
+	public ActivityAndBeanWrapper getConfiguration() {
+	return configuration;
+    }
+
+    public boolean isConfigurationChanged() {
+	XStream xstream = new XStream(new DomDriver());
+	xstream.setClassLoader(configuration.getActivity().getClass().getClassLoader());
+	return (!xstream.toXML(clonedConfig).equals(origConfigXML));
+    }
+
+    private List<String> getFieldNames(Object config) {
+	List<String> result = new ArrayList<String>();
+	try {
+	    BeanInfo beanInfo = Introspector.getBeanInfo(config.getClass());
+	    for (PropertyDescriptor pd : beanInfo.getPropertyDescriptors()) {
+		Method readMethod = pd.getReadMethod();
+		if ((readMethod != null) && !(pd.getName().equals("class"))) {
+		    try {
+			result.add(pd.getName());
+		    } catch (IllegalArgumentException ex) {
+			// ignore
+		    }
+		}
+	    }
+	} catch (IntrospectionException e) {
+	    // ignore
+	}
+	return result;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-disabled-activity-ui/src/main/java/org/apache/taverna/activities/disabled/views/DisabledContextualView.java
----------------------------------------------------------------------
diff --git a/taverna-disabled-activity-ui/src/main/java/org/apache/taverna/activities/disabled/views/DisabledContextualView.java b/taverna-disabled-activity-ui/src/main/java/org/apache/taverna/activities/disabled/views/DisabledContextualView.java
new file mode 100644
index 0000000..78d7767
--- /dev/null
+++ b/taverna-disabled-activity-ui/src/main/java/org/apache/taverna/activities/disabled/views/DisabledContextualView.java
@@ -0,0 +1,128 @@
+/**
+ *
+ */
+package org.apache.taverna.activities.disabled.views;
+
+import java.awt.Frame;
+import java.beans.BeanInfo;
+import java.beans.IntrospectionException;
+import java.beans.Introspector;
+import java.beans.PropertyDescriptor;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.swing.Action;
+
+import org.apache.taverna.activities.disabled.actions.DisabledActivityConfigurationAction;
+import org.apache.taverna.servicedescriptions.ServiceDescriptionRegistry;
+import org.apache.taverna.workbench.activityicons.ActivityIconManager;
+import org.apache.taverna.workbench.configuration.colour.ColourManager;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.file.FileManager;
+import org.apache.taverna.workbench.report.ReportManager;
+import org.apache.taverna.workbench.ui.actions.activity.HTMLBasedActivityContextualView;
+import org.apache.taverna.scufl2.api.activity.Activity;
+import org.apache.taverna.scufl2.api.port.InputActivityPort;
+import org.apache.taverna.scufl2.api.port.OutputActivityPort;
+
+import com.fasterxml.jackson.databind.JsonNode;
+
+/**
+ * A DisabledContextualView displays information about a DisabledActivity
+ *
+ * @author alanrw
+ * @author David Withers
+ */
+@SuppressWarnings("serial")
+public class DisabledContextualView extends HTMLBasedActivityContextualView {
+
+	private List<String> fieldNames;
+
+	private final EditManager editManager;
+	private final FileManager fileManager;
+	private final ReportManager reportManager;
+	private final ActivityIconManager activityIconManager;
+	private final ServiceDescriptionRegistry serviceDescriptionRegistry;
+
+	public DisabledContextualView(Activity activity, EditManager editManager,
+			FileManager fileManager, ReportManager reportManager, ColourManager colourManager,
+			ActivityIconManager activityIconManager, ServiceDescriptionRegistry serviceDescriptionRegistry) {
+		super(activity, colourManager);
+		this.editManager = editManager;
+		this.fileManager = fileManager;
+		this.reportManager = reportManager;
+		this.activityIconManager = activityIconManager;
+		this.serviceDescriptionRegistry = serviceDescriptionRegistry;
+	}
+
+	/**
+	 * The table for the DisabledActivity shows its ports and the information within the offline
+	 * Activity's configuration.
+	 *
+	 * @return
+	 */
+	@Override
+	protected String getRawTableRowsHtml() {
+		StringBuilder html = new StringBuilder();
+		html.append("<tr><th>Input Port Name</th><th>Depth</th></tr>");
+		for (InputActivityPort inputActivityPort : getActivity().getInputPorts()) {
+			html.append("<tr><td>" + inputActivityPort.getName() + "</td><td>");
+			html.append(inputActivityPort.getDepth() + "</td></tr>");
+		}
+		html.append("<tr><th>Output Port Name</th><th>Depth</th></tr>");
+		for (OutputActivityPort outputActivityPort : getActivity().getOutputPorts()) {
+			html.append("<tr><td>" + outputActivityPort.getName() + "</td><td>");
+			html.append(outputActivityPort.getDepth() + "</td></tr>");
+		}
+
+		JsonNode config = getConfigBean().getJson();
+		try {
+			html.append("<tr><th>Property Name</th><th>Property Value</th></tr>");
+			BeanInfo beanInfo = Introspector.getBeanInfo(config.getClass());
+			for (PropertyDescriptor pd : beanInfo.getPropertyDescriptors()) {
+				Method readMethod = pd.getReadMethod();
+				if ((readMethod != null) && !(pd.getName().equals("class"))) {
+					try {
+						html.append("<tr><td>");
+						html.append(pd.getName());
+						html.append("</td><td>");
+						html.append(readMethod.invoke(config));
+						html.append("</td></tr>");
+						if (fieldNames == null) {
+							fieldNames = new ArrayList<String>();
+						}
+						fieldNames.add(pd.getName());
+					} catch (IllegalAccessException ex) {
+						// ignore
+					} catch (IllegalArgumentException ex) {
+						// ignore
+					} catch (InvocationTargetException ex) {
+						// ignore
+					}
+				}
+			}
+		} catch (IntrospectionException e) {
+			// ignore
+		}
+		return html.toString();
+	}
+
+	@Override
+	public String getViewTitle() {
+		return "Unavailable service";
+	}
+
+	@Override
+	public int getPreferredPosition() {
+		return 100;
+	}
+
+	@Override
+	public Action getConfigureAction(Frame owner) {
+		return new DisabledActivityConfigurationAction(getActivity(), owner,
+				editManager, fileManager, reportManager, activityIconManager, serviceDescriptionRegistry);
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-disabled-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.ui.menu.MenuComponent
----------------------------------------------------------------------
diff --git a/taverna-disabled-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.ui.menu.MenuComponent b/taverna-disabled-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.ui.menu.MenuComponent
deleted file mode 100644
index 022189a..0000000
--- a/taverna-disabled-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.ui.menu.MenuComponent
+++ /dev/null
@@ -1 +0,0 @@
-net.sf.taverna.t2.activities.disabled.menu.ConfigureDisabledMenuAction
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-disabled-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory
----------------------------------------------------------------------
diff --git a/taverna-disabled-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory b/taverna-disabled-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory
deleted file mode 100644
index 80b0bf3..0000000
--- a/taverna-disabled-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory
+++ /dev/null
@@ -1 +0,0 @@
-net.sf.taverna.t2.activities.disabled.views.DisabledActivityViewFactory

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-disabled-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.ui.menu.MenuComponent
----------------------------------------------------------------------
diff --git a/taverna-disabled-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.ui.menu.MenuComponent b/taverna-disabled-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.ui.menu.MenuComponent
new file mode 100644
index 0000000..729941e
--- /dev/null
+++ b/taverna-disabled-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.ui.menu.MenuComponent
@@ -0,0 +1 @@
+org.apache.taverna.activities.disabled.menu.ConfigureDisabledMenuAction
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-disabled-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory
----------------------------------------------------------------------
diff --git a/taverna-disabled-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory b/taverna-disabled-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory
new file mode 100644
index 0000000..87a3c78
--- /dev/null
+++ b/taverna-disabled-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory
@@ -0,0 +1 @@
+org.apache.taverna.activities.disabled.views.DisabledActivityViewFactory

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-disabled-activity-ui/src/main/resources/META-INF/spring/disabled-activity-ui-context-osgi.xml
----------------------------------------------------------------------
diff --git a/taverna-disabled-activity-ui/src/main/resources/META-INF/spring/disabled-activity-ui-context-osgi.xml b/taverna-disabled-activity-ui/src/main/resources/META-INF/spring/disabled-activity-ui-context-osgi.xml
index f938272..dcb97ea 100644
--- a/taverna-disabled-activity-ui/src/main/resources/META-INF/spring/disabled-activity-ui-context-osgi.xml
+++ b/taverna-disabled-activity-ui/src/main/resources/META-INF/spring/disabled-activity-ui-context-osgi.xml
@@ -8,13 +8,13 @@
 
 	<service ref="ConfigureDisabledMenuAction" auto-export="interfaces" />
 
-	<service ref="DisabledActivityViewFactory" interface="net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory" />
+	<service ref="DisabledActivityViewFactory" interface="org.apache.taverna.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="reportManager" interface="net.sf.taverna.t2.workbench.report.ReportManager" />
-	<reference id="activityIconManager" interface="net.sf.taverna.t2.workbench.activityicons.ActivityIconManager" />
-	<reference id="colourManager" interface="net.sf.taverna.t2.workbench.configuration.colour.ColourManager" />
-	<reference id="serviceDescriptionRegistry" interface="net.sf.taverna.t2.servicedescriptions.ServiceDescriptionRegistry" />
+	<reference id="editManager" interface="org.apache.taverna.workbench.edits.EditManager" />
+	<reference id="fileManager" interface="org.apache.taverna.workbench.file.FileManager" />
+	<reference id="reportManager" interface="org.apache.taverna.workbench.report.ReportManager" />
+	<reference id="activityIconManager" interface="org.apache.taverna.workbench.activityicons.ActivityIconManager" />
+	<reference id="colourManager" interface="org.apache.taverna.workbench.configuration.colour.ColourManager" />
+	<reference id="serviceDescriptionRegistry" interface="org.apache.taverna.servicedescriptions.ServiceDescriptionRegistry" />
 
 </beans:beans>

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-disabled-activity-ui/src/main/resources/META-INF/spring/disabled-activity-ui-context.xml
----------------------------------------------------------------------
diff --git a/taverna-disabled-activity-ui/src/main/resources/META-INF/spring/disabled-activity-ui-context.xml b/taverna-disabled-activity-ui/src/main/resources/META-INF/spring/disabled-activity-ui-context.xml
index fbc0aa0..555d2fe 100644
--- a/taverna-disabled-activity-ui/src/main/resources/META-INF/spring/disabled-activity-ui-context.xml
+++ b/taverna-disabled-activity-ui/src/main/resources/META-INF/spring/disabled-activity-ui-context.xml
@@ -3,7 +3,7 @@
 	xsi:schemaLocation="http://www.springframework.org/schema/beans
                       http://www.springframework.org/schema/beans/spring-beans.xsd">
 
-	<bean id="ConfigureDisabledMenuAction" class="net.sf.taverna.t2.activities.disabled.menu.ConfigureDisabledMenuAction">
+	<bean id="ConfigureDisabledMenuAction" class="org.apache.taverna.activities.disabled.menu.ConfigureDisabledMenuAction">
 			<property name="editManager" ref="editManager" />
 			<property name="fileManager" ref="fileManager" />
 			<property name="reportManager" ref="reportManager" />
@@ -11,7 +11,7 @@
 			<property name="serviceDescriptionRegistry" ref="serviceDescriptionRegistry" />
 	</bean>
 
-	<bean id="DisabledActivityViewFactory" class="net.sf.taverna.t2.activities.disabled.views.DisabledActivityViewFactory">
+	<bean id="DisabledActivityViewFactory" class="org.apache.taverna.activities.disabled.views.DisabledActivityViewFactory">
 			<property name="editManager" ref="editManager" />
 			<property name="fileManager" ref="fileManager" />
 			<property name="reportManager" ref="reportManager" />

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-api/src/main/java/net/sf/taverna/t2/workbench/edits/CompoundEdit.java
----------------------------------------------------------------------
diff --git a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workbench/edits/CompoundEdit.java b/taverna-edits-api/src/main/java/net/sf/taverna/t2/workbench/edits/CompoundEdit.java
deleted file mode 100644
index e753e1f..0000000
--- a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workbench/edits/CompoundEdit.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*******************************************************************************
- * 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.edits;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.taverna.scufl2.api.common.WorkflowBean;
-
-/**
- * Implementation of Edit which contains an ordered list of child edits. Child
- * edits are applied collectively and in order, any failure in any child edit
- * causes an undo of previously applied children and a propogation of the edit
- * exception.
- * 
- * @author Tom Oinn
- */
-public class CompoundEdit implements Edit<WorkflowBean> {
-	private final transient List<Edit<?>> childEdits;
-	private transient boolean applied = false;
-
-	/**
-	 * Create a new compound edit with no existing Edit objects.
-	 * 
-	 */
-	public CompoundEdit() {
-		this.childEdits = new ArrayList<>();
-	}
-
-	/**
-	 * Create a new compound edit with the specified edits as children.
-	 */
-	public CompoundEdit(List<Edit<?>> edits) {
-		this.childEdits = edits;
-	}
-
-	/**
-	 * Get the list of edits.
-	 * @return a live-editable list.
-	 */
-	public List<Edit<?>> getChildEdits() {
-		return childEdits;
-	}
-
-	/**
-	 * Attempts to call the doEdit method of all child edits. If any of those
-	 * children throws an EditException any successful edits are rolled back and
-	 * the exception is rethrown as the cause of a new EditException from the
-	 * CompoundEdit
-	 */
-	@Override
-	public synchronized WorkflowBean doEdit() throws EditException {
-		if (isApplied())
-			throw new EditException("Cannot apply an edit more than once!");
-		List<Edit<?>> doneEdits = new ArrayList<>();
-		try {
-			for (Edit<?> edit : childEdits) {
-				edit.doEdit();
-				/*
-				 * Insert the done edit at position 0 in the list so we can
-				 * iterate over the list in the normal order if we need to
-				 * rollback, this ensures that the most recent edit is first.
-				 */
-				doneEdits.add(0, edit);
-			}
-			applied = true;
-		} catch (EditException ee) {
-			for (Edit<?> undoMe : doneEdits)
-				undoMe.undo();
-			applied = false;
-			throw new EditException("Failed child of compound edit", ee);
-		}
-		return null;
-	}
-
-	/**
-	 * There is no explicit subject for a compound edit, so this method always
-	 * returns null.
-	 */
-	@Override
-	public Object getSubject() {
-		return null;
-	}
-
-	/**
-	 * Rolls back all child edits in reverse order
-	 */
-	@Override
-	public synchronized void undo() {
-		for (int i = childEdits.size() - 1; i >= 0; i--)
-			// Undo child edits in reverse order
-			childEdits.get(i).undo();
-		applied = false;
-	}
-
-	@Override
-	public boolean isApplied() {
-		return applied;
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-api/src/main/java/net/sf/taverna/t2/workbench/edits/Edit.java
----------------------------------------------------------------------
diff --git a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workbench/edits/Edit.java b/taverna-edits-api/src/main/java/net/sf/taverna/t2/workbench/edits/Edit.java
deleted file mode 100644
index 0e6a6d7..0000000
--- a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workbench/edits/Edit.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*******************************************************************************
- * 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.edits;
-
-import org.apache.taverna.scufl2.api.common.WorkflowBean;
-
-/**
- * The workflow object model exposed by this API is read only. Properties of the
- * model can only be changed through implementations of this interface, this
- * ensures a consistant approach to grouped edits (transactions) and undo / redo
- * support within the UI. It also potentially allows for capture of editing
- * provenance where a workflow is repurposed or created from an aggregate of
- * several others.
- * 
- * @author Tom Oinn
- */
-public interface Edit<TargetType extends WorkflowBean> {
-	/**
-	 * Perform the edit
-	 * 
-	 * @throws EditException
-	 *             if the edit fails. If an edit throws EditException it should
-	 *             try to ensure the subject is unaltered. Where this is
-	 *             impossible consider breaking edits down into a compound edit.
-	 */
-	TargetType doEdit() throws EditException;
-
-	/**
-	 * Undo the edit, reverting the subject to the state it was in prior to the
-	 * edit
-	 */
-	void undo();
-
-	/**
-	 * Return the object to which this edit applies
-	 * 
-	 * @return
-	 */
-	Object getSubject();
-
-	/**
-	 * Has the edit been applied yet?
-	 * 
-	 * @return true if and only if the edit has been successfully applied to the
-	 *         subject
-	 */
-	boolean isApplied();
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-api/src/main/java/net/sf/taverna/t2/workbench/edits/EditException.java
----------------------------------------------------------------------
diff --git a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workbench/edits/EditException.java b/taverna-edits-api/src/main/java/net/sf/taverna/t2/workbench/edits/EditException.java
deleted file mode 100644
index 3c61d84..0000000
--- a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workbench/edits/EditException.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*******************************************************************************
- * 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.edits;
-
-/**
- * Superclass of all exceptions thrown when altering the workflow model through
- * the edit manager.
- * 
- * @author Tom Oinn
- */
-@SuppressWarnings("serial")
-public class EditException extends Exception {
-	public EditException(String string) {
-		super(string);
-	}
-
-	public EditException(String string, Throwable cause) {
-		super(string, cause);
-	}
-
-	public EditException(Throwable t) {
-		super(t);
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-api/src/main/java/net/sf/taverna/t2/workbench/edits/EditManager.java
----------------------------------------------------------------------
diff --git a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workbench/edits/EditManager.java b/taverna-edits-api/src/main/java/net/sf/taverna/t2/workbench/edits/EditManager.java
deleted file mode 100644
index f497df9..0000000
--- a/taverna-edits-api/src/main/java/net/sf/taverna/t2/workbench/edits/EditManager.java
+++ /dev/null
@@ -1,222 +0,0 @@
-/*******************************************************************************
- * 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.edits;
-
-import org.apache.taverna.scufl2.api.container.WorkflowBundle;
-import org.apache.taverna.lang.observer.Observable;
-import org.apache.taverna.lang.observer.Observer;
-import net.sf.taverna.t2.workbench.edits.EditManager.EditManagerEvent;
-
-/**
- * Manager that can handle {@link Edit edits} for a {@link WorkflowBundle}.
- * <p>
- * Edits to a workflow that are to be undoable or redoable should be created by
- * using {@link EditManager#getEdits()} to get an {@link Edits} object. Using
- * this to create {@link Edit}s, instead of calling {@link Edit#doEdit()}, use
- * {@link EditManager#doDataflowEdit(WorkflowBundle, Edit)} to associate the
- * edit with the specified Dataflow.
- * <p>
- * It is possible to undo a series of edits done on a particular dataflow in
- * this way by using {@link #undoDataflowEdit(WorkflowBundle)}. If one or more
- * undoes have been performed, they can be redone step by step using
- * {@link #redoDataflowEdit(WorkflowBundle)}. Note that it is no longer possible
- * to call {@link #redoDataflowEdit(WorkflowBundle)} after a
- * {@link #doDataflowEdit(WorkflowBundle, Edit)}.
- * <p>
- * The EditManager is {@link Observable}. If you
- * {@linkplain Observable#addObserver(net.sf.taverna.t2.lang.observer.Observer)
- * add an observer} you can be notified on {@linkplain DataflowEditEvent edits},
- * {@linkplain DataFlowUndoEvent undoes} and {@linkplain DataFlowRedoEvent
- * redoes}.
- * 
- * @author Stian Soiland-Reyes
- */
-public interface EditManager extends Observable<EditManagerEvent> {
-	/**
-	 * <code>true</code> if {@link #redoDataflowEdit(WorkflowBundle)} on the
-	 * given dataflow would redo the last undone edit. If there are no previous
-	 * edits, return <code>false</code>.
-	 * 
-	 * @param dataflow
-	 *            {@link WorkflowBundle} which last affecting edit is to be
-	 *            undone
-	 * @return <code>true</code if and only if
-	 *         {@link #redoDataflowEdit(WorkflowBundle)} would undo
-	 */
-	boolean canRedoDataflowEdit(WorkflowBundle dataflow);
-
-	/**
-	 * <code>true</code> if {@link #undoDataflowEdit(WorkflowBundle)} on the
-	 * given dataflow would undo the last edit. If there are no previous edits,
-	 * return <code>false</code>.
-	 * 
-	 * @param dataflow
-	 *            {@link WorkflowBundle} which last affecting edit is to be
-	 *            undone
-	 * @return <code>true</code if {@link #undoDataflowEdit(WorkflowBundle)}
-	 *         would undo
-	 */
-	boolean canUndoDataflowEdit(WorkflowBundle dataflow);
-
-	/**
-	 * Do an {@link Edit} affecting the given {@link WorkflowBundle}.
-	 * <p>
-	 * The edit is {@link Edit#doEdit() performed} and the edit can later be
-	 * undone using {@link EditManager#undoDataflowEdit(WorkflowBundle)}.
-	 * <p>
-	 * Note that any events previously undone with
-	 * {@link EditManager#undoDataflowEdit(WorkflowBundle)} for the given
-	 * dataflow can no longer be
-	 * {@link EditManager#redoDataflowEdit(WorkflowBundle) redone} after calling
-	 * this method.
-	 * 
-	 * @see EditManager#undoDataflowEdit(WorkflowBundle)
-	 * @param dataflow
-	 *            {@link WorkflowBundle} this edit is affecting
-	 * @param edit
-	 *            {@link Edit} that should be done using {@link Edit#doEdit()}.
-	 * @throws EditException
-	 *             If {@link Edit#doEdit()} fails
-	 */
-	void doDataflowEdit(WorkflowBundle dataflow, Edit<?> edit)
-			throws EditException;
-
-	/**
-	 * Redo the last {@link Edit} that was undone using
-	 * {@link #undoDataflowEdit(WorkflowBundle)}.
-	 * <p>
-	 * Note that the {@link EditManager} might only be able to redo a reasonable
-	 * number of steps.
-	 * <p>
-	 * It is not possible to use {@link #redoDataflowEdit(WorkflowBundle)} after
-	 * a {@link #doDataflowEdit(WorkflowBundle, Edit)} affecting the same
-	 * {@link WorkflowBundle}, or if no edits have been undone yet. No action
-	 * would be taken in these cases.
-	 * 
-	 * @param dataflow
-	 *            {@link WorkflowBundle} which last affecting edit is to be
-	 *            redone
-	 * @throws EditException
-	 *             If {@link Edit#doEdit()} fails
-	 */
-	void redoDataflowEdit(WorkflowBundle dataflow) throws EditException;
-
-	/**
-	 * Undo the last {@link Edit} affecting the given {@link WorkflowBundle}.
-	 * <p>
-	 * This can be called in succession until there are no more known undoes.
-	 * Note that the {@link EditManager} might only be able to undo a reasonable
-	 * number of steps.
-	 * <p>
-	 * The last edit must have been performed using
-	 * {@link EditManager#doDataflowEdit(WorkflowBundle, Edit)} or
-	 * {@link EditManager#redoDataflowEdit(WorkflowBundle)}. The undo is done
-	 * using {@link Edit#undo()}. If no edits have been performed for the
-	 * dataflow yet, no action is taken.
-	 * <p>
-	 * Undoes can be redone using {@link #redoDataflowEdit(WorkflowBundle)}.
-	 * 
-	 * @param dataflow
-	 *            {@link WorkflowBundle} which last affecting edit is to be
-	 *            undone
-	 */
-	void undoDataflowEdit(WorkflowBundle dataflow);
-
-	/**
-	 * An event about an {@link Edit} on a {@link WorkflowBundle}, accessible
-	 * through {@link AbstractDataflowEditEvent#getEdit()} and
-	 * {@link AbstractDataflowEditEvent#getDataFlow()}.
-	 */
-	public static abstract class AbstractDataflowEditEvent implements
-			EditManagerEvent {
-		private final WorkflowBundle dataFlow;
-		private final Edit<?> edit;
-
-		public AbstractDataflowEditEvent(WorkflowBundle dataFlow, Edit<?> edit) {
-			if (dataFlow == null || edit == null)
-				throw new NullPointerException(
-						"Dataflow and/or Edit can't be null");
-			this.dataFlow = dataFlow;
-			this.edit = edit;
-		}
-
-		/**
-		 * The {@link WorkflowBundle} this event affected.
-		 * 
-		 * @return A {@link WorkflowBundle}
-		 */
-		public WorkflowBundle getDataFlow() {
-			return dataFlow;
-		}
-
-		/**
-		 * The {@link Edit} that was performed, undoed or redone on the
-		 * {@link #getDataFlow() dataflow}.
-		 * 
-		 * @return An {@link Edit}
-		 */
-		@Override
-		public Edit<?> getEdit() {
-			return edit;
-		}
-	}
-
-	/**
-	 * An event sent when an {@link Edit} has been performed on a
-	 * {@link WorkflowBundle}.
-	 * 
-	 */
-	public static class DataflowEditEvent extends AbstractDataflowEditEvent {
-		public DataflowEditEvent(WorkflowBundle dataFlow, Edit<?> edit) {
-			super(dataFlow, edit);
-		}
-	}
-
-	/**
-	 * An event sent when a previously undone {@link Edit} has been redone on a
-	 * {@link WorkflowBundle}.
-	 * 
-	 */
-	public static class DataFlowRedoEvent extends AbstractDataflowEditEvent {
-		public DataFlowRedoEvent(WorkflowBundle dataFlow, Edit<?> edit) {
-			super(dataFlow, edit);
-		}
-	}
-
-	/**
-	 * An event sent when an {@link Edit} has been undone on a
-	 * {@link WorkflowBundle}.
-	 * 
-	 */
-	public static class DataFlowUndoEvent extends AbstractDataflowEditEvent {
-		public DataFlowUndoEvent(WorkflowBundle dataFlow, Edit<?> edit) {
-			super(dataFlow, edit);
-		}
-	}
-
-	/**
-	 * An event given to {@link Observer}s registered with
-	 * {@link Observable#addObserver(Observer)}.
-	 */
-	public interface EditManagerEvent {
-		public Edit<?> getEdit();
-	}
-}


[10/51] [partial] incubator-taverna-workbench git commit: all packages are moved to org.apache.taverna.*

Posted by re...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-helper-api/src/main/java/org/apache/taverna/workbench/helper/HelpCollator.java
----------------------------------------------------------------------
diff --git a/taverna-helper-api/src/main/java/org/apache/taverna/workbench/helper/HelpCollator.java b/taverna-helper-api/src/main/java/org/apache/taverna/workbench/helper/HelpCollator.java
new file mode 100644
index 0000000..90f7874
--- /dev/null
+++ b/taverna-helper-api/src/main/java/org/apache/taverna/workbench/helper/HelpCollator.java
@@ -0,0 +1,326 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.helper;
+
+import java.awt.Component;
+import java.io.IOException;
+import java.net.HttpURLConnection;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.MissingResourceException;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import javax.help.BadIDException;
+import javax.help.HelpSet;
+import javax.help.HelpSetException;
+import javax.help.Map.ID;
+import javax.help.TryMap;
+import javax.swing.JTree;
+import javax.swing.tree.DefaultMutableTreeNode;
+import javax.swing.tree.TreePath;
+
+import org.apache.log4j.Logger;
+
+/**
+ * This class loads the {@link HelpSet} and also deals with the registration of
+ * ids and the decoding from a {@link Component} to the corresponding id. These
+ * two sets of functionality should possibly be separated.
+ * 
+ * @author alanrw
+ */
+// TODO Convert to a bean
+public final class HelpCollator {
+	private static Logger logger = Logger.getLogger(HelpCollator.class);
+	/**
+	 * The HelpSet that is being used.
+	 */
+	private static HelpSet hs = null;
+	/**
+	 * The mapping from components to ids. This is used because of problems with
+	 * CSH throwing exceptions because it tried to use ids that were not in the
+	 * map.
+	 */
+	private static Map<Component, String> idMap;
+	/**
+	 * Indicates whether the HelpCollator has been initialized.
+	 */
+	private static boolean initialized = false;
+	/**
+	 * A Pattern for normalizing the ids.
+	 */
+	private static Pattern nonAlphanumeric;
+	/**
+	 * The emptyHelp is set if the HelpCollator was unable to read the
+	 */
+	private static boolean emptyHelp = true;
+	private static int TIMEOUT = 5000;
+
+	private static String externalHelpSetURL = "http://www.mygrid.org.uk/taverna/helpset/"
+			+ version() + "/helpset.hs";
+
+	// private static Profile profile = ProfileFactory.getInstance().getProfile();
+	private static String version() {
+		return "NO-VERSION";//profile.getVersion();
+		// TODO find a better way to find the version
+	}
+
+	/**
+	 * Attempt to read the up-to-date HelpSet from the web
+	 */
+	private static void readExternalHelpSet() {
+		try {
+			URL url = new URL(externalHelpSetURL);
+			checkConnection(url);
+			hs = new HelpSet(null, url);
+			if (hs.getLocalMap() == null) {
+			    hs = null;
+				logger.error("Helpset from " + externalHelpSetURL
+						+ " local map was null");
+			} else
+				logger.info("Read external help set from " + externalHelpSetURL);
+		} catch (MissingResourceException e) {
+		    logger.error("No external HelpSet URL specified", e);
+		} catch (MalformedURLException e) {
+		    logger.error("External HelpSet URL is malformed", e);
+		} catch (HelpSetException e) {
+		    logger.error("External HelpSet could not be read", e);
+		} catch (IOException e) {
+			logger.error("IOException reading External HelpSet", e);
+		}
+	}
+
+	private static void checkConnection(URL url) throws IOException {
+		if (!url.getProtocol().startsWith("http"))
+			return;
+		HttpURLConnection connection = (HttpURLConnection) url.openConnection();
+		connection.setReadTimeout(TIMEOUT);
+		connection.setConnectTimeout(TIMEOUT);
+		connection.setRequestMethod("HEAD");
+		connection.getInputStream().close();
+		connection.disconnect();
+	}
+
+	/**
+	 * This methods creates a HelpSet based upon, in priority, the external
+	 * HelpSet, then a newly created empty HelpSet.
+	 */
+	private static void initialize() {
+		if (initialized)
+			return;
+		readExternalHelpSet();
+		if (hs == null) {
+			hs = new HelpSet();
+			hs.setLocalMap(new TryMap());
+		} else {
+			logger.trace("EmptyHelp set to false");
+			emptyHelp = false;
+		}
+		idMap = new HashMap<>();
+		nonAlphanumeric = Pattern.compile("[^a-z0-9\\.]");
+		initialized = true;
+	}
+
+	/**
+	 * Indicates if an empty HelpSet is being used
+	 *
+	 * @return
+	 */
+	public static boolean isEmptyHelp() {
+		return emptyHelp;
+	}
+
+	public static URL getURLFromID(String id) throws BadIDException,
+			MalformedURLException {
+		initialize();
+		logger.trace("Looking for id: " + id);
+		ID theId = ID.create(id, hs);
+		if (theId == null)
+			return null;
+		return hs.getCombinedMap().getURLFromID(theId);
+	}
+
+	/**
+	 * Register a component under the specified id. The method checks that the
+	 * id is known to the HelpSet's map.
+	 * 
+	 * @param component
+	 * @param id
+	 */
+	public static void registerComponent(Component component, String id) {
+		logger.trace("Attempting to register " + id);
+		initialize();
+		String normalizedId = normalizeString(id.toLowerCase());
+		if (idMap.containsKey(component)) {
+			logger.info("Registered " + normalizedId);
+			return;
+		}
+
+		/*
+		 * If Workbench is started up while there is no network connection -
+		 * hs.getLocalMap() is null for some reason
+		 */
+		if (hs != null && hs.getLocalMap() != null
+				&& hs.getLocalMap().isValidID(normalizedId, hs)) {
+			idMap.put(component, normalizedId);
+			logger.info("Registered " + normalizedId);
+		} else
+			logger.warn("Refused to register component as " + normalizedId
+					+ " not in map");
+	}
+
+	/**
+	 * Register a component. Since no id is specified, the HelpCollator takes
+	 * the canonical name of the component's class. This is useful when an
+	 * explicit hierarchy-based approach has been taken.
+	 *
+	 * @param component
+	 */
+	public static void registerComponent(Component component) {
+		String canonicalName = component.getClass().getCanonicalName();
+		if (canonicalName != null)
+			registerComponent(component, canonicalName);
+	}
+
+	/**
+	 * Register a component based upon its parent's class and a suffix
+	 * indicating the component's purpose in the parent.
+	 *
+	 * @param component
+	 * @param parent
+	 * @param suffix
+	 */
+	public static void registerComponent(Component component, Object parent,
+			String suffix) {
+		String canonicalName = parent.getClass().getCanonicalName();
+		if (canonicalName != null)
+			registerComponent(component, canonicalName + "-" + suffix);
+	}
+
+	/**
+	 * Try to find an id for the Component. This code should be re-written when
+	 * we have more experience in how to couple the UI and HelpSets.
+	 *
+	 * @param c
+	 * @return
+	 */
+	static String getHelpID(Component c) {
+		initialize();
+		boolean found = false;
+		String result = null;
+		if (c instanceof JTree) {
+			String idInTree = getHelpIDInTree((JTree) c);
+			if (idInTree != null) {
+				found = true;
+				result = idInTree;
+			}
+		}
+		Component working = c;
+		if (c != null)
+			logger.trace("Starting at a " + working.getClass());
+		while (!found && (working != null)) {
+			if (idMap.containsKey(working)) {
+				result = idMap.get(working);
+				found = true;
+				logger.trace("Found component id " + result);
+			} else {
+				String className = working.getClass().getCanonicalName();
+				if (hs.getLocalMap().isValidID(className, hs)) {
+					result = className;
+					found = true;
+					logger.trace("Found class name " + result);
+				}
+			}
+			if (!found) {
+				working = working.getParent();
+				if (working != null)
+					logger.trace("Moved up to a " + working.getClass());
+			}
+		}
+		return result;
+	}
+
+	/**
+	 * Change the input String into an id that contains only alphanumeric
+	 * characters or hyphens.
+	 *
+	 * @param input
+	 * @return
+	 */
+	private static String normalizeString(String input) {
+		Matcher m = nonAlphanumeric.matcher(input);
+		return m.replaceAll("-");
+	}
+
+	/**
+	 * If help is sought on part of a JTree, then this method attempts to find a
+	 * node of the tree that can be mapped to an id. The possibilities are ad
+	 * hoc and should be re-examined when more experience is gained.
+	 * 
+	 * @param c
+	 * @return
+	 */
+	private static String getHelpIDInTree(JTree c) {
+		initialize();
+
+		TreePath tp = c.getSelectionPath();
+		if (tp == null)
+			return null;
+
+		Object o = tp.getLastPathComponent();
+		if (o == null)
+			return null;
+
+		if (o instanceof DefaultMutableTreeNode) {
+			DefaultMutableTreeNode dmtn = (DefaultMutableTreeNode) o;
+			if (dmtn.getUserObject() != null)
+				o = dmtn.getUserObject();
+		}
+
+		String className = o.getClass().getCanonicalName();
+
+		logger.trace("Tree node as a string is " + o);
+
+		String possibility = normalizeString(o.toString().toLowerCase());
+
+		logger.trace("Normalized is " + possibility);
+		logger.trace("Tree node class name is " + className);
+
+		possibility = className + "-" + possibility;
+
+		logger.trace("Possibility is " + possibility);
+
+		String result;
+		if (hs.getLocalMap().isValidID(possibility, hs)) {
+			result = possibility;
+			logger.trace("Accepted tree node " + result);
+		} else if (hs.getLocalMap().isValidID(className, hs)) {
+			result = className;
+			logger.trace("Found tree node class name " + result);
+		} else {
+			result = null;
+		}
+
+		logger.debug("Tree node is a " + o.getClass());
+		return result;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-helper-api/src/main/java/org/apache/taverna/workbench/helper/HelpEnabledDialog.java
----------------------------------------------------------------------
diff --git a/taverna-helper-api/src/main/java/org/apache/taverna/workbench/helper/HelpEnabledDialog.java b/taverna-helper-api/src/main/java/org/apache/taverna/workbench/helper/HelpEnabledDialog.java
new file mode 100644
index 0000000..0d3bbdf
--- /dev/null
+++ b/taverna-helper-api/src/main/java/org/apache/taverna/workbench/helper/HelpEnabledDialog.java
@@ -0,0 +1,117 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.helper;
+
+import static org.apache.taverna.workbench.MainWindow.getMainWindow;
+import static org.apache.taverna.workbench.helper.HelpCollator.registerComponent;
+import static org.apache.taverna.workbench.helper.Helper.setKeyCatcher;
+
+import java.awt.Dialog;
+import java.awt.Frame;
+import java.awt.HeadlessException;
+
+import javax.swing.JDialog;
+
+/**
+ * This class extends JDialog to register the dialog and also attach a key
+ * catcher so that F1 is interpreted as help
+ *
+ * @author alanrw
+ */
+public class HelpEnabledDialog extends JDialog {
+	private static final long serialVersionUID = -5068807887477419800L;
+
+	/**
+	 * Create a HelpEnabledDialog, register it (if possible) with the
+	 * HelpCollator and attach a keycatcher.
+	 *
+	 * @param owner
+	 * @param title
+	 * @param modal
+	 * @param id
+	 * @throws HeadlessException
+	 */
+	public HelpEnabledDialog(Frame owner, String title, boolean modal, String id)
+			throws HeadlessException {
+		super(owner == null ? getMainWindow() : owner, title, modal);
+
+		if (id != null)
+			registerComponent(this, id);
+		else if (owner != null)
+			registerComponent(this, owner.getClass().getCanonicalName()
+					+ "-dialog");
+		else if (title != null && !title.isEmpty())
+			registerComponent(this, title);
+		setKeyCatcher(this);
+	}
+
+	/**
+	 * Create a HelpEnabledDialog, register it (if possible) with the
+	 * HelpCollator and attach a keycatcher.
+	 *
+	 * @param owner
+	 * @param title
+	 * @param modal
+	 * @param id
+	 * @throws HeadlessException
+	 */
+	public HelpEnabledDialog(Dialog owner, String title, boolean modal,
+			String id) throws HeadlessException {
+		super(owner, title, modal);
+		if (id != null)
+			registerComponent(this, id);
+		else if (owner != null)
+			registerComponent(this, owner.getClass().getCanonicalName()
+					+ "-dialog");
+		setKeyCatcher(this);
+	}
+
+	/**
+	 * Create a HelpEnabledDialog, register it (if possible) with the
+	 * HelpCollator and attach a keycatcher.
+	 *
+	 * @param owner
+	 * @param title
+	 * @param modal
+	 * @throws HeadlessException
+	 */
+	public HelpEnabledDialog(Frame parent, String title, boolean modal) {
+		this(parent, title, modal, null);
+	}
+
+	/**
+	 * Create a HelpEnabledDialog, register it (if possible) with the
+	 * HelpCollator and attach a keycatcher.
+	 *
+	 * @param owner
+	 * @param title
+	 * @param modal
+	 * @throws HeadlessException
+	 */
+	public HelpEnabledDialog(Dialog parent, String title, boolean modal) {
+		this(parent, title, modal, null);
+	}
+
+	@Override
+	public void setVisible(boolean b) {
+		setLocationRelativeTo(getParent());
+		super.setVisible(b);
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-helper-api/src/main/java/org/apache/taverna/workbench/helper/Helper.java
----------------------------------------------------------------------
diff --git a/taverna-helper-api/src/main/java/org/apache/taverna/workbench/helper/Helper.java b/taverna-helper-api/src/main/java/org/apache/taverna/workbench/helper/Helper.java
new file mode 100644
index 0000000..f5315d5
--- /dev/null
+++ b/taverna-helper-api/src/main/java/org/apache/taverna/workbench/helper/Helper.java
@@ -0,0 +1,203 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.helper;
+
+import static java.awt.Desktop.getDesktop;
+import static java.awt.MouseInfo.getPointerInfo;
+import static javax.swing.JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT;
+import static javax.swing.KeyStroke.getKeyStroke;
+import static org.apache.taverna.workbench.helper.HelpCollator.getHelpID;
+import static org.apache.taverna.workbench.helper.HelpCollator.getURLFromID;
+
+import java.awt.AWTEvent;
+import java.awt.Component;
+import java.awt.Container;
+import java.awt.Point;
+import java.awt.event.ActionEvent;
+import java.io.IOException;
+import java.net.URISyntaxException;
+import java.net.URL;
+
+import javax.help.BadIDException;
+import javax.swing.AbstractAction;
+import javax.swing.ActionMap;
+import javax.swing.InputMap;
+import javax.swing.JComponent;
+import javax.swing.JRootPane;
+import javax.swing.RootPaneContainer;
+
+import org.apache.log4j.Logger;
+
+/**
+ * This class creates the dialogs for the presentation of the HelpSet held by
+ * the HelpCollator.
+ *
+ * @author alanrw
+ */
+public final class Helper {
+	private static Helper instance;
+	private static Logger logger = Logger.getLogger(Helper.class);
+
+	/**
+	 * Create a Helper and initialize the static variables.
+	 */
+	private Helper() {
+	}
+
+	/**
+	 * Get the singleton instance of Helper. In theory there could be more than
+	 * one.
+	 *
+	 * @return
+	 */
+	private static Helper getInstance() {
+		if (instance == null)
+			instance = new Helper();
+		return instance;
+	}
+
+	/**
+	 * Show in the current dialog the entry (if any) corresponding to the
+	 * specified id.
+	 *
+	 * @param id
+	 */
+	private static void showID(String id) {
+		getInstance();
+		try {
+			URL result = getURLFromID(id);
+			if (result == null)
+				result = getURLFromID("home");
+			getDesktop().browse(result.toURI());
+		} catch (BadIDException | IOException | URISyntaxException e) {
+			logger.error(e);
+		}
+	}
+
+	/**
+	 * Show the most suitable help for the specified component.
+	 *
+	 * @param c
+	 */
+	public static void showHelp(Component c) {
+		showID(getHelpID(c));
+	}
+
+	/**
+	 * Display the default home page help.
+	 *
+	 * @param e
+	 */
+	public static void displayDefaultHelp(AWTEvent e) {
+		showID("home");
+	}
+
+	public static void displayFieldLevelHelp(ActionEvent e) {
+		//
+	}
+
+	private static final String HELP_KEY = "F1";
+
+	/**
+	 * Associated the specified action with key presses in the specified
+	 * component.
+	 * 
+	 * @param component
+	 * @param theAction
+	 */
+	public static void setKeyCatcher(final JComponent component,
+			final AbstractAction theAction) {
+		InputMap oldInputMap = component
+				.getInputMap(WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
+		InputMap newInputMap = new InputMap();
+		newInputMap.setParent(oldInputMap);
+		newInputMap.put(getKeyStroke(HELP_KEY), "doSomething");
+		component.setInputMap(WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, newInputMap);
+		ActionMap oldActionMap = component.getActionMap();
+		ActionMap newActionMap = new ActionMap();
+		newActionMap.setParent(oldActionMap);
+		newActionMap.put("doSomething", theAction);
+		component.setActionMap(newActionMap);
+	}
+
+	/**
+	 * Set up a key-press catcher for the specified component such that when F1
+	 * is pressed it should help for the component where the cursor is.
+	 *
+	 * @param rootpanecontainer
+	 */
+	public static void setKeyCatcher(final RootPaneContainer rootpanecontainer) {
+		@SuppressWarnings("serial")
+		AbstractAction theAction = new AbstractAction() {
+			@Override
+			public void actionPerformed(ActionEvent evt) {
+				Component component = (Component) rootpanecontainer;
+				Container container = (Container) rootpanecontainer;
+				logger.info("frame action F1 pressed with source "
+						+ evt.getSource().getClass().getName());
+				Point mousePosition = getPointerInfo().getLocation();
+				Point framePosition = component.getLocation();
+				Point relativePosition = (Point) mousePosition.clone();
+				relativePosition.translate(-framePosition.x, -framePosition.y);
+				Component c = container.findComponentAt(relativePosition);
+				if (c != null)
+					logger.info("F1 pressed in a " + c.getClass().getName());
+				showHelpWithinContainer(rootpanecontainer, c);
+			}
+		};
+
+		JRootPane pane = rootpanecontainer.getRootPane();
+		setKeyCatcher(pane, theAction);
+	}
+
+	/**
+	 * Show the help most associated with the specific component within the container.
+	 *
+	 * @param root
+	 * @param c
+	 */
+	static void showHelpWithinContainer(RootPaneContainer root, Component c) {
+		getInstance();
+		showHelp(c);
+	}
+
+	/**
+	 * Register a component with the {@link HelpCollator} under the specified
+	 * id.
+	 * 
+	 * @param component
+	 * @param id
+	 */
+	public static void registerComponent(Component component, final String id) {
+		HelpCollator.registerComponent(component, id);
+	}
+
+	/**
+	 * Register a component with the {@link HelpCollator}.
+	 *
+	 * @param component
+	 * @param parent
+	 * @param suffix
+	 */
+	public static void registerComponent(Component component, Object parent,
+			String suffix) {
+		HelpCollator.registerComponent(component, parent, suffix);
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-helper-api/src/main/java/org/apache/taverna/workbench/helper/NonBlockedHelpEnabledDialog.java
----------------------------------------------------------------------
diff --git a/taverna-helper-api/src/main/java/org/apache/taverna/workbench/helper/NonBlockedHelpEnabledDialog.java b/taverna-helper-api/src/main/java/org/apache/taverna/workbench/helper/NonBlockedHelpEnabledDialog.java
new file mode 100644
index 0000000..6e94ab2
--- /dev/null
+++ b/taverna-helper-api/src/main/java/org/apache/taverna/workbench/helper/NonBlockedHelpEnabledDialog.java
@@ -0,0 +1,56 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.helper;
+
+import static java.awt.Dialog.ModalExclusionType.APPLICATION_EXCLUDE;
+
+import java.awt.Dialog;
+import java.awt.Frame;
+import java.awt.HeadlessException;
+
+/**
+ * @author alanrw
+ */
+public class NonBlockedHelpEnabledDialog extends HelpEnabledDialog {
+	private static final long serialVersionUID = -2455471377333940417L;
+
+	public NonBlockedHelpEnabledDialog(Dialog owner, String title,
+			boolean modal, String id) throws HeadlessException {
+		super(owner, title, modal, id);
+		this.setModalExclusionType(APPLICATION_EXCLUDE);
+	}
+
+	public NonBlockedHelpEnabledDialog(Frame owner, String title,
+			boolean modal, String id) throws HeadlessException {
+		super(owner, title, modal, id);
+		this.setModalExclusionType(APPLICATION_EXCLUDE);
+	}
+
+	public NonBlockedHelpEnabledDialog(Frame parent, String title, boolean modal) {
+		super(parent, title, modal, null);
+		this.setModalExclusionType(APPLICATION_EXCLUDE);
+	}
+
+	public NonBlockedHelpEnabledDialog(Dialog parent, String title,
+			boolean modal) {
+		super(parent, title, modal, null);
+		this.setModalExclusionType(APPLICATION_EXCLUDE);
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-httpproxy-config/src/main/java/net/sf/taverna/t2/workbench/httpproxy/config/HttpProxyConfigurationPanel.java
----------------------------------------------------------------------
diff --git a/taverna-httpproxy-config/src/main/java/net/sf/taverna/t2/workbench/httpproxy/config/HttpProxyConfigurationPanel.java b/taverna-httpproxy-config/src/main/java/net/sf/taverna/t2/workbench/httpproxy/config/HttpProxyConfigurationPanel.java
deleted file mode 100644
index 18ceeb4..0000000
--- a/taverna-httpproxy-config/src/main/java/net/sf/taverna/t2/workbench/httpproxy/config/HttpProxyConfigurationPanel.java
+++ /dev/null
@@ -1,582 +0,0 @@
-/*******************************************************************************
- * 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.httpproxy.config;
-
-import static java.awt.GridBagConstraints.BOTH;
-import static java.awt.GridBagConstraints.CENTER;
-import static java.awt.GridBagConstraints.HORIZONTAL;
-import static java.awt.GridBagConstraints.NONE;
-import static java.awt.GridBagConstraints.WEST;
-import static javax.swing.JOptionPane.showMessageDialog;
-import static javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED;
-import static javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED;
-import static net.sf.taverna.t2.workbench.helper.Helper.showHelp;
-import static uk.org.taverna.configuration.proxy.HttpProxyConfiguration.PROXY_USE_OPTION;
-import static uk.org.taverna.configuration.proxy.HttpProxyConfiguration.SYSTEM_NON_PROXY_HOSTS;
-import static uk.org.taverna.configuration.proxy.HttpProxyConfiguration.SYSTEM_PROXY_HOST;
-import static uk.org.taverna.configuration.proxy.HttpProxyConfiguration.SYSTEM_PROXY_PASSWORD;
-import static uk.org.taverna.configuration.proxy.HttpProxyConfiguration.SYSTEM_PROXY_PORT;
-import static uk.org.taverna.configuration.proxy.HttpProxyConfiguration.SYSTEM_PROXY_USER;
-import static uk.org.taverna.configuration.proxy.HttpProxyConfiguration.TAVERNA_NON_PROXY_HOSTS;
-import static uk.org.taverna.configuration.proxy.HttpProxyConfiguration.TAVERNA_PROXY_HOST;
-import static uk.org.taverna.configuration.proxy.HttpProxyConfiguration.TAVERNA_PROXY_PASSWORD;
-import static uk.org.taverna.configuration.proxy.HttpProxyConfiguration.TAVERNA_PROXY_PORT;
-import static uk.org.taverna.configuration.proxy.HttpProxyConfiguration.TAVERNA_PROXY_USER;
-import static uk.org.taverna.configuration.proxy.HttpProxyConfiguration.USE_NO_PROXY_OPTION;
-import static uk.org.taverna.configuration.proxy.HttpProxyConfiguration.USE_SPECIFIED_VALUES_OPTION;
-import static uk.org.taverna.configuration.proxy.HttpProxyConfiguration.USE_SYSTEM_PROPERTIES_OPTION;
-
-import java.awt.GridBagConstraints;
-import java.awt.GridBagLayout;
-import java.awt.Insets;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-
-import javax.swing.AbstractAction;
-import javax.swing.ButtonGroup;
-import javax.swing.JButton;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JRadioButton;
-import javax.swing.JScrollPane;
-import javax.swing.JTextArea;
-import javax.swing.JTextField;
-import javax.swing.border.EmptyBorder;
-
-import net.sf.taverna.t2.lang.ui.DialogTextArea;
-import org..taverna.configuration.proxy.HttpProxyConfiguration;
-
-/**
- * The HttpProxyConfigurationPanel provides the user interface to a
- * {@link HttpProxyConfiguration} to determine how HTTP Connections are made by
- * Taverna.
- * 
- * @author alanrw
- * @author David Withers
- */
-public class HttpProxyConfigurationPanel extends JPanel {
-	static final long serialVersionUID = 3668473431971125038L;
-	/**
-	 * The size of the field for the JTextFields.
-	 */
-	private static int TEXTFIELD_SIZE = 25;
-
-	private final HttpProxyConfiguration httpProxyConfiguration;
-	/**
-	 * RadioButtons that are in a common ButtonGroup. Selecting one of them
-	 * indicates whether the system http proxy settings, the ad hoc specified
-	 * values or no proxy settings at all should be used.
-	 */
-	private JRadioButton useSystemProperties;
-	private JRadioButton useSpecifiedValues;
-	private JRadioButton useNoProxy;
-	/**
-	 * JTextFields and one DialogTextArea to hold the settings for the HTTP
-	 * proxy properties. The values are only editable if the user picks
-	 * useSpecifiedValues.
-	 */
-	private JTextField proxyHostField;
-	private JTextField proxyPortField;
-	private JTextField proxyUserField;
-	private JTextField proxyPasswordField;
-	private DialogTextArea nonProxyHostsArea;
-	private JScrollPane nonProxyScrollPane;
-	/**
-	 * A string that indicates which HTTP setting option the user has currently
-	 * picked. This does not necesarily match that which has been applied.
-	 */
-	private String shownOption = USE_SYSTEM_PROPERTIES_OPTION;
-
-	/**
-	 * The HttpProxyConfigurationPanel consists of a set of properties where the
-	 * configuration values for HTTP can be specified and a set of buttons where
-	 * the more general apply, help etc. appear.
-	 */
-	public HttpProxyConfigurationPanel(
-			HttpProxyConfiguration httpProxyConfiguration) {
-		this.httpProxyConfiguration = httpProxyConfiguration;
-		initComponents();
-	}
-
-	/**
-	 * Populates the panel with a representation of the current HTTP proxy
-	 * settings for the specified {@link HttpProxyConfiguration} and also the
-	 * capability to alter them.
-	 */
-	private void initComponents() {
-		shownOption = httpProxyConfiguration.getProperty(PROXY_USE_OPTION);
-
-		this.setLayout(new GridBagLayout());
-
-		GridBagConstraints gbc = new GridBagConstraints();
-
-		// Title describing what kind of settings we are configuring here
-		JTextArea descriptionText = new JTextArea("HTTP proxy configuration");
-		descriptionText.setLineWrap(true);
-		descriptionText.setWrapStyleWord(true);
-		descriptionText.setEditable(false);
-		descriptionText.setFocusable(false);
-		descriptionText.setBorder(new EmptyBorder(10, 10, 10, 10));
-		gbc.anchor = WEST;
-		gbc.gridx = 0;
-		gbc.gridy = 0;
-		gbc.gridwidth = 2;
-		gbc.weightx = 1.0;
-		gbc.weighty = 0.0;
-		gbc.fill = HORIZONTAL;
-		this.add(descriptionText, gbc);
-
-		/**
-		 * Generate the three radio buttons and put them in a group. Each button
-		 * is bound to an action that alters the shownOption and re-populates
-		 * the shown HTTP property fields.
-		 */
-		useNoProxy = new JRadioButton("Do not use a proxy");
-		useNoProxy.setAlignmentX(LEFT_ALIGNMENT);
-		gbc.gridx = 0;
-		gbc.gridy = 1;
-		gbc.gridwidth = 2;
-		gbc.weightx = 0.0;
-		gbc.weighty = 0.0;
-		gbc.fill = NONE;
-		gbc.insets = new Insets(10, 0, 0, 0);
-		this.add(useNoProxy, gbc);
-		ActionListener useNoProxyListener = new ActionListener() {
-			@Override
-			public void actionPerformed(ActionEvent arg0) {
-				shownOption = USE_NO_PROXY_OPTION;
-				populateFields();
-			}
-		};
-		useNoProxy.addActionListener(useNoProxyListener);
-
-		useSystemProperties = new JRadioButton("Use system properties");
-		useSystemProperties.setAlignmentX(LEFT_ALIGNMENT);
-		gbc.gridx = 0;
-		gbc.gridy = 2;
-		gbc.insets = new Insets(0, 0, 0, 0);
-		this.add(useSystemProperties, gbc);
-		ActionListener systemPropertiesListener = new ActionListener() {
-			@Override
-			public void actionPerformed(ActionEvent arg0) {
-				shownOption = USE_SYSTEM_PROPERTIES_OPTION;
-				populateFields();
-			}
-		};
-		useSystemProperties.addActionListener(systemPropertiesListener);
-
-		useSpecifiedValues = new JRadioButton("Use specified values");
-		useSpecifiedValues.setAlignmentX(LEFT_ALIGNMENT);
-		gbc.gridx = 0;
-		gbc.gridy = 3;
-		this.add(useSpecifiedValues, gbc);
-		ActionListener specifiedValuesListener = new ActionListener() {
-			@Override
-			public void actionPerformed(ActionEvent arg0) {
-				shownOption = USE_SPECIFIED_VALUES_OPTION;
-				populateFields();
-			}
-		};
-		useSpecifiedValues.addActionListener(specifiedValuesListener);
-
-		ButtonGroup bg = new ButtonGroup();
-		bg.add(useSystemProperties);
-		bg.add(useSpecifiedValues);
-		bg.add(useNoProxy);
-
-		/**
-		 * Create the fields to show the HTTP proxy property values. These
-		 * become editable if the shown option is to use specified values.
-		 */
-		proxyHostField = new JTextField(TEXTFIELD_SIZE);
-		gbc.gridx = 0;
-		gbc.gridy = 4;
-		gbc.gridwidth = 1;
-		gbc.fill = NONE;
-		gbc.insets = new Insets(10, 0, 0, 0);
-		this.add(new JLabel("Proxy host"), gbc);
-		gbc.gridx = 1;
-		gbc.gridy = 4;
-		gbc.gridwidth = 1;
-		gbc.fill = HORIZONTAL;
-		this.add(proxyHostField, gbc);
-
-		proxyPortField = new JTextField(TEXTFIELD_SIZE);
-		gbc.gridx = 0;
-		gbc.gridy = 5;
-		gbc.gridwidth = 1;
-		gbc.fill = NONE;
-		gbc.insets = new Insets(0, 0, 0, 0);
-		this.add(new JLabel("Proxy port"), gbc);
-		gbc.gridx = 1;
-		gbc.gridy = 5;
-		gbc.gridwidth = 1;
-		gbc.fill = HORIZONTAL;
-		this.add(proxyPortField, gbc);
-
-		proxyUserField = new JTextField(TEXTFIELD_SIZE);
-		gbc.gridx = 0;
-		gbc.gridy = 6;
-		gbc.gridwidth = 1;
-		gbc.fill = NONE;
-		this.add(new JLabel("Proxy user"), gbc);
-		gbc.gridx = 1;
-		gbc.gridy = 6;
-		gbc.gridwidth = 1;
-		gbc.fill = HORIZONTAL;
-		this.add(proxyUserField, gbc);
-
-		proxyPasswordField = new JTextField(TEXTFIELD_SIZE);
-		gbc.gridx = 0;
-		gbc.gridy = 7;
-		gbc.gridwidth = 1;
-		gbc.fill = NONE;
-		this.add(new JLabel("Proxy password"), gbc);
-		gbc.gridx = 1;
-		gbc.gridy = 7;
-		gbc.gridwidth = 1;
-		gbc.fill = HORIZONTAL;
-		this.add(proxyPasswordField, gbc);
-
-		nonProxyHostsArea = new DialogTextArea(10, 40);
-		nonProxyScrollPane = new JScrollPane(nonProxyHostsArea);
-		nonProxyScrollPane
-				.setHorizontalScrollBarPolicy(HORIZONTAL_SCROLLBAR_AS_NEEDED);
-		nonProxyScrollPane
-				.setVerticalScrollBarPolicy(VERTICAL_SCROLLBAR_AS_NEEDED);
-		// nonProxyScrollPane.setPreferredSize(new Dimension(300, 500));
-		gbc.gridx = 0;
-		gbc.gridy = 8;
-		gbc.gridwidth = 2;
-		gbc.fill = NONE;
-		gbc.insets = new Insets(10, 0, 0, 0);
-		this.add(new JLabel("Non-proxy hosts"), gbc);
-		gbc.gridx = 0;
-		gbc.gridy = 9;
-		gbc.weightx = 1.0;
-		gbc.weighty = 1.0;
-		gbc.gridwidth = 2;
-		gbc.insets = new Insets(0, 0, 0, 0);
-		gbc.fill = BOTH;
-		this.add(nonProxyScrollPane, gbc);
-
-		// Add buttons panel
-		gbc.gridx = 0;
-		gbc.gridy = 10;
-		gbc.weightx = 0.0;
-		gbc.weighty = 0.0;
-		gbc.gridwidth = 2;
-		gbc.fill = HORIZONTAL;
-		gbc.anchor = CENTER;
-		gbc.insets = new Insets(10, 0, 0, 0);
-		this.add(createButtonPanel(), gbc);
-
-		setFields();
-	}
-
-	/**
-	 * Populate the fields in the property panel according to which option is
-	 * being shown and the stored values within the
-	 * {@link HttpProxyConfiguration}.
-	 */
-	private void populateFields() {
-		/**
-		 * Editing of the property fields is only available when the option is
-		 * to use the specified values.
-		 */
-		boolean editingEnabled = shownOption
-				.equals(USE_SPECIFIED_VALUES_OPTION);
-
-		if (shownOption.equals(USE_SYSTEM_PROPERTIES_OPTION)) {
-			proxyHostField.setText(httpProxyConfiguration
-					.getProperty(SYSTEM_PROXY_HOST));
-			proxyPortField.setText(httpProxyConfiguration
-					.getProperty(SYSTEM_PROXY_PORT));
-			proxyUserField.setText(httpProxyConfiguration
-					.getProperty(SYSTEM_PROXY_USER));
-			proxyPasswordField.setText(httpProxyConfiguration
-					.getProperty(SYSTEM_PROXY_PASSWORD));
-			nonProxyHostsArea.setText(httpProxyConfiguration
-					.getProperty(SYSTEM_NON_PROXY_HOSTS));
-		} else if (shownOption.equals(USE_SPECIFIED_VALUES_OPTION)) {
-			proxyHostField.setText(httpProxyConfiguration
-					.getProperty(TAVERNA_PROXY_HOST));
-			proxyPortField.setText(httpProxyConfiguration
-					.getProperty(TAVERNA_PROXY_PORT));
-			proxyUserField.setText(httpProxyConfiguration
-					.getProperty(TAVERNA_PROXY_USER));
-			proxyPasswordField.setText(httpProxyConfiguration
-					.getProperty(TAVERNA_PROXY_PASSWORD));
-			nonProxyHostsArea.setText(httpProxyConfiguration
-					.getProperty(TAVERNA_NON_PROXY_HOSTS));
-		} else {
-			proxyHostField.setText(null);
-			proxyPortField.setText(null);
-			proxyUserField.setText(null);
-			proxyPasswordField.setText(null);
-			nonProxyHostsArea.setText(null);
-		}
-
-		proxyHostField.setEnabled(editingEnabled);
-		proxyPortField.setEnabled(editingEnabled);
-		proxyUserField.setEnabled(editingEnabled);
-		proxyPasswordField.setEnabled(editingEnabled);
-		nonProxyHostsArea.setEnabled(editingEnabled);
-		nonProxyHostsArea.setEditable(editingEnabled);
-		nonProxyScrollPane.setEnabled(editingEnabled);
-	}
-
-	/**
-	 * Create the panel to contain the buttons
-	 * 
-	 * @return
-	 */
-	@SuppressWarnings("serial")
-	private JPanel createButtonPanel() {
-		final JPanel panel = new JPanel();
-
-		/**
-		 * The helpButton shows help about the current component
-		 */
-		JButton helpButton = new JButton(new AbstractAction("Help") {
-			@Override
-			public void actionPerformed(ActionEvent arg0) {
-				showHelp(panel);
-			}
-		});
-		panel.add(helpButton);
-
-		/**
-		 * The resetButton changes the property values shown to those
-		 * corresponding to the configuration currently applied.
-		 */
-		JButton resetButton = new JButton(new AbstractAction("Reset") {
-			@Override
-			public void actionPerformed(ActionEvent arg0) {
-				setFields();
-			}
-		});
-		panel.add(resetButton);
-
-		/**
-		 * The applyButton applies the shown field values to the
-		 * {@link HttpProxyConfiguration} and saves them for future.
-		 */
-		JButton applyButton = new JButton(new AbstractAction("Apply") {
-			@Override
-			public void actionPerformed(ActionEvent arg0) {
-				applySettings();
-				setFields();
-			}
-		});
-		panel.add(applyButton);
-
-		return panel;
-	}
-
-	/**
-	 * Checks that the specified values for the HTTP properties are a valid
-	 * combination and, if so, saves them for future use. It does not apply them
-	 * to the currently executing Taverna.
-	 */
-	private void saveSettings() {
-		if (useSystemProperties.isSelected()) {
-			httpProxyConfiguration.setProperty(PROXY_USE_OPTION,
-					USE_SYSTEM_PROPERTIES_OPTION);
-		} else if (useNoProxy.isSelected()) {
-			httpProxyConfiguration.setProperty(PROXY_USE_OPTION,
-					USE_NO_PROXY_OPTION);
-		} else {
-			if (validateFields()) {
-				httpProxyConfiguration.setProperty(PROXY_USE_OPTION,
-						USE_SPECIFIED_VALUES_OPTION);
-				httpProxyConfiguration.setProperty(TAVERNA_PROXY_HOST,
-						proxyHostField.getText());
-				httpProxyConfiguration.setProperty(TAVERNA_PROXY_PORT,
-						proxyPortField.getText());
-				httpProxyConfiguration.setProperty(TAVERNA_PROXY_USER,
-						proxyUserField.getText());
-				httpProxyConfiguration.setProperty(TAVERNA_PROXY_PASSWORD,
-						proxyPasswordField.getText());
-				httpProxyConfiguration.setProperty(TAVERNA_NON_PROXY_HOSTS,
-						nonProxyHostsArea.getText());
-			}
-		}
-	}
-
-	/**
-	 * Validates and, where appropriate formats, the properties values specified
-	 * for HTTP Proxy configuration.
-	 * 
-	 * @return
-	 */
-	private boolean validateFields() {
-		boolean result = true;
-		result = result && validateHostField();
-		result = result && validatePortField();
-		result = result && validateUserField();
-		result = result && validatePasswordField();
-		result = result && validateNonProxyHostsArea();
-		return result;
-	}
-
-	/**
-	 * Checks that, if a value is specified for non-proxy hosts then a proxy
-	 * host has also been specified. Formats the non-proxy hosts string so that
-	 * if the user has entered the hosts on separate lines, then the stored
-	 * values are separated by bars.
-	 * 
-	 * @return
-	 */
-	private boolean validateNonProxyHostsArea() {
-		boolean result = true;
-		String value = nonProxyHostsArea.getText();
-		if ((value != null) && (!value.equals(""))) {
-			value = value.replaceAll("\\n", "|");
-			nonProxyHostsArea.setText(value);
-			result = result
-					&& dependsUpon("non-proxy host", "host",
-							proxyHostField.getText());
-		}
-		return result;
-	}
-
-	/**
-	 * Checks that, if a password has been specified, then a user has also been
-	 * specified.
-	 * 
-	 * @return
-	 */
-	private boolean validatePasswordField() {
-		boolean result = true;
-		String value = proxyPasswordField.getText();
-		if ((value != null) && !value.isEmpty())
-			result = result
-					&& dependsUpon("password", "user", proxyHostField.getText());
-		return result;
-	}
-
-	/**
-	 * Checks that if a user has been specified, then a host has also been
-	 * specified.
-	 * 
-	 * @return
-	 */
-	private boolean validateUserField() {
-		boolean result = true;
-		String value = proxyUserField.getText();
-		if ((value != null) && !value.isEmpty())
-			result = result
-					&& dependsUpon("user", "host", proxyHostField.getText());
-		return result;
-	}
-
-	/**
-	 * Checks that if a port has been specified then a host has also been
-	 * specified. Checks that the port number is a non-negative integer. If the
-	 * port has not been specified, then if a host has been specified, the
-	 * default value 80 is used.
-	 * 
-	 * @return
-	 */
-	private boolean validatePortField() {
-		boolean result = true;
-		String value = proxyPortField.getText();
-		if ((value != null) && (!value.equals(""))) {
-			result = result
-					&& dependsUpon("port", "host", proxyHostField.getText());
-			try {
-				int parsedNumber = Integer.parseInt(value);
-				if (parsedNumber <= 0) {
-					showMessageDialog(this, "The port must be non-negative");
-					result = false;
-				}
-			} catch (NumberFormatException e) {
-				showMessageDialog(this, "The port must be an integer");
-				result = false;
-			}
-		} else {
-			String hostField = proxyHostField.getText();
-			if ((hostField != null) && !hostField.isEmpty())
-				proxyPortField.setText("80");
-		}
-		return result;
-	}
-
-	/**
-	 * Checks if the targetValue has been specified. If not then a message is
-	 * displayed indicating that the dependent cannot be specified with the
-	 * target.
-	 * 
-	 * @param dependent
-	 * @param target
-	 * @param targetValue
-	 * @return
-	 */
-	private boolean dependsUpon(String dependent, String target,
-			String targetValue) {
-		boolean result = true;
-		if ((targetValue == null) || target.equals("")) {
-			showMessageDialog(this, "A " + dependent
-					+ " cannot be specified without a " + target);
-			result = false;
-		}
-		return result;
-	}
-
-	/**
-	 * Could validate the host field e.g. by establishing a connection.
-	 * Currently no validation is done.
-	 * 
-	 * @return
-	 */
-	private boolean validateHostField() {
-		boolean result = true;
-		// String value = proxyHostField.getText();
-		return result;
-	}
-
-	/**
-	 * Save the currently set field values (if valid) to the
-	 * {@link HttpProxyConfiguration}. Also applies those values to the
-	 * currently running Taverna.
-	 */
-	private void applySettings() {
-		if (validateFields()) {
-			saveSettings();
-			httpProxyConfiguration.changeProxySettings();
-		}
-	}
-
-	/**
-	 * Set the shown field values to those currently in use (i.e. last saved
-	 * configuration).
-	 */
-	private void setFields() {
-		shownOption = httpProxyConfiguration.getProperty(PROXY_USE_OPTION);
-		useSystemProperties.setSelected(shownOption
-				.equals(USE_SYSTEM_PROPERTIES_OPTION));
-		useSpecifiedValues.setSelected(shownOption
-				.equals(USE_SPECIFIED_VALUES_OPTION));
-		useNoProxy.setSelected(shownOption.equals(USE_NO_PROXY_OPTION));
-		populateFields();
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-httpproxy-config/src/main/java/net/sf/taverna/t2/workbench/httpproxy/config/HttpProxyConfigurationUIFactory.java
----------------------------------------------------------------------
diff --git a/taverna-httpproxy-config/src/main/java/net/sf/taverna/t2/workbench/httpproxy/config/HttpProxyConfigurationUIFactory.java b/taverna-httpproxy-config/src/main/java/net/sf/taverna/t2/workbench/httpproxy/config/HttpProxyConfigurationUIFactory.java
deleted file mode 100644
index 4cf3967..0000000
--- a/taverna-httpproxy-config/src/main/java/net/sf/taverna/t2/workbench/httpproxy/config/HttpProxyConfigurationUIFactory.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*******************************************************************************
- * 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.httpproxy.config;
-
-import javax.swing.JPanel;
-
-import org.apache.taverna.configuration.Configurable;
-import uk.org.taverna.configuration.ConfigurationUIFactory;
-import uk.org.taverna.configuration.proxy.HttpProxyConfiguration;
-
-/**
- * A Factory to create a HttpProxyConfiguration
- *
- * @author alanrw
- * @author David Withers
- */
-public class HttpProxyConfigurationUIFactory implements ConfigurationUIFactory {
-	private HttpProxyConfiguration httpProxyConfiguration;
-
-	@Override
-	public boolean canHandle(String uuid) {
-		return uuid.equals(getConfigurable().getUUID());
-	}
-
-	@Override
-	public JPanel getConfigurationPanel() {
-		return new HttpProxyConfigurationPanel(httpProxyConfiguration);
-	}
-
-	@Override
-	public Configurable getConfigurable() {
-		return httpProxyConfiguration;
-	}
-
-	public void setHttpProxyConfiguration(HttpProxyConfiguration httpProxyConfiguration) {
-		this.httpProxyConfiguration = httpProxyConfiguration;
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-httpproxy-config/src/main/java/org/apache/taverna/workbench/httpproxy/config/HttpProxyConfigurationPanel.java
----------------------------------------------------------------------
diff --git a/taverna-httpproxy-config/src/main/java/org/apache/taverna/workbench/httpproxy/config/HttpProxyConfigurationPanel.java b/taverna-httpproxy-config/src/main/java/org/apache/taverna/workbench/httpproxy/config/HttpProxyConfigurationPanel.java
new file mode 100644
index 0000000..4c57cb2
--- /dev/null
+++ b/taverna-httpproxy-config/src/main/java/org/apache/taverna/workbench/httpproxy/config/HttpProxyConfigurationPanel.java
@@ -0,0 +1,582 @@
+/*******************************************************************************
+ * 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 org.apache.taverna.workbench.httpproxy.config;
+
+import static java.awt.GridBagConstraints.BOTH;
+import static java.awt.GridBagConstraints.CENTER;
+import static java.awt.GridBagConstraints.HORIZONTAL;
+import static java.awt.GridBagConstraints.NONE;
+import static java.awt.GridBagConstraints.WEST;
+import static javax.swing.JOptionPane.showMessageDialog;
+import static javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED;
+import static javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED;
+import static org.apache.taverna.workbench.helper.Helper.showHelp;
+import static uk.org.taverna.configuration.proxy.HttpProxyConfiguration.PROXY_USE_OPTION;
+import static uk.org.taverna.configuration.proxy.HttpProxyConfiguration.SYSTEM_NON_PROXY_HOSTS;
+import static uk.org.taverna.configuration.proxy.HttpProxyConfiguration.SYSTEM_PROXY_HOST;
+import static uk.org.taverna.configuration.proxy.HttpProxyConfiguration.SYSTEM_PROXY_PASSWORD;
+import static uk.org.taverna.configuration.proxy.HttpProxyConfiguration.SYSTEM_PROXY_PORT;
+import static uk.org.taverna.configuration.proxy.HttpProxyConfiguration.SYSTEM_PROXY_USER;
+import static uk.org.taverna.configuration.proxy.HttpProxyConfiguration.TAVERNA_NON_PROXY_HOSTS;
+import static uk.org.taverna.configuration.proxy.HttpProxyConfiguration.TAVERNA_PROXY_HOST;
+import static uk.org.taverna.configuration.proxy.HttpProxyConfiguration.TAVERNA_PROXY_PASSWORD;
+import static uk.org.taverna.configuration.proxy.HttpProxyConfiguration.TAVERNA_PROXY_PORT;
+import static uk.org.taverna.configuration.proxy.HttpProxyConfiguration.TAVERNA_PROXY_USER;
+import static uk.org.taverna.configuration.proxy.HttpProxyConfiguration.USE_NO_PROXY_OPTION;
+import static uk.org.taverna.configuration.proxy.HttpProxyConfiguration.USE_SPECIFIED_VALUES_OPTION;
+import static uk.org.taverna.configuration.proxy.HttpProxyConfiguration.USE_SYSTEM_PROPERTIES_OPTION;
+
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.Insets;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+import javax.swing.AbstractAction;
+import javax.swing.ButtonGroup;
+import javax.swing.JButton;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JRadioButton;
+import javax.swing.JScrollPane;
+import javax.swing.JTextArea;
+import javax.swing.JTextField;
+import javax.swing.border.EmptyBorder;
+
+import org.apache.taverna.lang.ui.DialogTextArea;
+import org..taverna.configuration.proxy.HttpProxyConfiguration;
+
+/**
+ * The HttpProxyConfigurationPanel provides the user interface to a
+ * {@link HttpProxyConfiguration} to determine how HTTP Connections are made by
+ * Taverna.
+ * 
+ * @author alanrw
+ * @author David Withers
+ */
+public class HttpProxyConfigurationPanel extends JPanel {
+	static final long serialVersionUID = 3668473431971125038L;
+	/**
+	 * The size of the field for the JTextFields.
+	 */
+	private static int TEXTFIELD_SIZE = 25;
+
+	private final HttpProxyConfiguration httpProxyConfiguration;
+	/**
+	 * RadioButtons that are in a common ButtonGroup. Selecting one of them
+	 * indicates whether the system http proxy settings, the ad hoc specified
+	 * values or no proxy settings at all should be used.
+	 */
+	private JRadioButton useSystemProperties;
+	private JRadioButton useSpecifiedValues;
+	private JRadioButton useNoProxy;
+	/**
+	 * JTextFields and one DialogTextArea to hold the settings for the HTTP
+	 * proxy properties. The values are only editable if the user picks
+	 * useSpecifiedValues.
+	 */
+	private JTextField proxyHostField;
+	private JTextField proxyPortField;
+	private JTextField proxyUserField;
+	private JTextField proxyPasswordField;
+	private DialogTextArea nonProxyHostsArea;
+	private JScrollPane nonProxyScrollPane;
+	/**
+	 * A string that indicates which HTTP setting option the user has currently
+	 * picked. This does not necesarily match that which has been applied.
+	 */
+	private String shownOption = USE_SYSTEM_PROPERTIES_OPTION;
+
+	/**
+	 * The HttpProxyConfigurationPanel consists of a set of properties where the
+	 * configuration values for HTTP can be specified and a set of buttons where
+	 * the more general apply, help etc. appear.
+	 */
+	public HttpProxyConfigurationPanel(
+			HttpProxyConfiguration httpProxyConfiguration) {
+		this.httpProxyConfiguration = httpProxyConfiguration;
+		initComponents();
+	}
+
+	/**
+	 * Populates the panel with a representation of the current HTTP proxy
+	 * settings for the specified {@link HttpProxyConfiguration} and also the
+	 * capability to alter them.
+	 */
+	private void initComponents() {
+		shownOption = httpProxyConfiguration.getProperty(PROXY_USE_OPTION);
+
+		this.setLayout(new GridBagLayout());
+
+		GridBagConstraints gbc = new GridBagConstraints();
+
+		// Title describing what kind of settings we are configuring here
+		JTextArea descriptionText = new JTextArea("HTTP proxy configuration");
+		descriptionText.setLineWrap(true);
+		descriptionText.setWrapStyleWord(true);
+		descriptionText.setEditable(false);
+		descriptionText.setFocusable(false);
+		descriptionText.setBorder(new EmptyBorder(10, 10, 10, 10));
+		gbc.anchor = WEST;
+		gbc.gridx = 0;
+		gbc.gridy = 0;
+		gbc.gridwidth = 2;
+		gbc.weightx = 1.0;
+		gbc.weighty = 0.0;
+		gbc.fill = HORIZONTAL;
+		this.add(descriptionText, gbc);
+
+		/**
+		 * Generate the three radio buttons and put them in a group. Each button
+		 * is bound to an action that alters the shownOption and re-populates
+		 * the shown HTTP property fields.
+		 */
+		useNoProxy = new JRadioButton("Do not use a proxy");
+		useNoProxy.setAlignmentX(LEFT_ALIGNMENT);
+		gbc.gridx = 0;
+		gbc.gridy = 1;
+		gbc.gridwidth = 2;
+		gbc.weightx = 0.0;
+		gbc.weighty = 0.0;
+		gbc.fill = NONE;
+		gbc.insets = new Insets(10, 0, 0, 0);
+		this.add(useNoProxy, gbc);
+		ActionListener useNoProxyListener = new ActionListener() {
+			@Override
+			public void actionPerformed(ActionEvent arg0) {
+				shownOption = USE_NO_PROXY_OPTION;
+				populateFields();
+			}
+		};
+		useNoProxy.addActionListener(useNoProxyListener);
+
+		useSystemProperties = new JRadioButton("Use system properties");
+		useSystemProperties.setAlignmentX(LEFT_ALIGNMENT);
+		gbc.gridx = 0;
+		gbc.gridy = 2;
+		gbc.insets = new Insets(0, 0, 0, 0);
+		this.add(useSystemProperties, gbc);
+		ActionListener systemPropertiesListener = new ActionListener() {
+			@Override
+			public void actionPerformed(ActionEvent arg0) {
+				shownOption = USE_SYSTEM_PROPERTIES_OPTION;
+				populateFields();
+			}
+		};
+		useSystemProperties.addActionListener(systemPropertiesListener);
+
+		useSpecifiedValues = new JRadioButton("Use specified values");
+		useSpecifiedValues.setAlignmentX(LEFT_ALIGNMENT);
+		gbc.gridx = 0;
+		gbc.gridy = 3;
+		this.add(useSpecifiedValues, gbc);
+		ActionListener specifiedValuesListener = new ActionListener() {
+			@Override
+			public void actionPerformed(ActionEvent arg0) {
+				shownOption = USE_SPECIFIED_VALUES_OPTION;
+				populateFields();
+			}
+		};
+		useSpecifiedValues.addActionListener(specifiedValuesListener);
+
+		ButtonGroup bg = new ButtonGroup();
+		bg.add(useSystemProperties);
+		bg.add(useSpecifiedValues);
+		bg.add(useNoProxy);
+
+		/**
+		 * Create the fields to show the HTTP proxy property values. These
+		 * become editable if the shown option is to use specified values.
+		 */
+		proxyHostField = new JTextField(TEXTFIELD_SIZE);
+		gbc.gridx = 0;
+		gbc.gridy = 4;
+		gbc.gridwidth = 1;
+		gbc.fill = NONE;
+		gbc.insets = new Insets(10, 0, 0, 0);
+		this.add(new JLabel("Proxy host"), gbc);
+		gbc.gridx = 1;
+		gbc.gridy = 4;
+		gbc.gridwidth = 1;
+		gbc.fill = HORIZONTAL;
+		this.add(proxyHostField, gbc);
+
+		proxyPortField = new JTextField(TEXTFIELD_SIZE);
+		gbc.gridx = 0;
+		gbc.gridy = 5;
+		gbc.gridwidth = 1;
+		gbc.fill = NONE;
+		gbc.insets = new Insets(0, 0, 0, 0);
+		this.add(new JLabel("Proxy port"), gbc);
+		gbc.gridx = 1;
+		gbc.gridy = 5;
+		gbc.gridwidth = 1;
+		gbc.fill = HORIZONTAL;
+		this.add(proxyPortField, gbc);
+
+		proxyUserField = new JTextField(TEXTFIELD_SIZE);
+		gbc.gridx = 0;
+		gbc.gridy = 6;
+		gbc.gridwidth = 1;
+		gbc.fill = NONE;
+		this.add(new JLabel("Proxy user"), gbc);
+		gbc.gridx = 1;
+		gbc.gridy = 6;
+		gbc.gridwidth = 1;
+		gbc.fill = HORIZONTAL;
+		this.add(proxyUserField, gbc);
+
+		proxyPasswordField = new JTextField(TEXTFIELD_SIZE);
+		gbc.gridx = 0;
+		gbc.gridy = 7;
+		gbc.gridwidth = 1;
+		gbc.fill = NONE;
+		this.add(new JLabel("Proxy password"), gbc);
+		gbc.gridx = 1;
+		gbc.gridy = 7;
+		gbc.gridwidth = 1;
+		gbc.fill = HORIZONTAL;
+		this.add(proxyPasswordField, gbc);
+
+		nonProxyHostsArea = new DialogTextArea(10, 40);
+		nonProxyScrollPane = new JScrollPane(nonProxyHostsArea);
+		nonProxyScrollPane
+				.setHorizontalScrollBarPolicy(HORIZONTAL_SCROLLBAR_AS_NEEDED);
+		nonProxyScrollPane
+				.setVerticalScrollBarPolicy(VERTICAL_SCROLLBAR_AS_NEEDED);
+		// nonProxyScrollPane.setPreferredSize(new Dimension(300, 500));
+		gbc.gridx = 0;
+		gbc.gridy = 8;
+		gbc.gridwidth = 2;
+		gbc.fill = NONE;
+		gbc.insets = new Insets(10, 0, 0, 0);
+		this.add(new JLabel("Non-proxy hosts"), gbc);
+		gbc.gridx = 0;
+		gbc.gridy = 9;
+		gbc.weightx = 1.0;
+		gbc.weighty = 1.0;
+		gbc.gridwidth = 2;
+		gbc.insets = new Insets(0, 0, 0, 0);
+		gbc.fill = BOTH;
+		this.add(nonProxyScrollPane, gbc);
+
+		// Add buttons panel
+		gbc.gridx = 0;
+		gbc.gridy = 10;
+		gbc.weightx = 0.0;
+		gbc.weighty = 0.0;
+		gbc.gridwidth = 2;
+		gbc.fill = HORIZONTAL;
+		gbc.anchor = CENTER;
+		gbc.insets = new Insets(10, 0, 0, 0);
+		this.add(createButtonPanel(), gbc);
+
+		setFields();
+	}
+
+	/**
+	 * Populate the fields in the property panel according to which option is
+	 * being shown and the stored values within the
+	 * {@link HttpProxyConfiguration}.
+	 */
+	private void populateFields() {
+		/**
+		 * Editing of the property fields is only available when the option is
+		 * to use the specified values.
+		 */
+		boolean editingEnabled = shownOption
+				.equals(USE_SPECIFIED_VALUES_OPTION);
+
+		if (shownOption.equals(USE_SYSTEM_PROPERTIES_OPTION)) {
+			proxyHostField.setText(httpProxyConfiguration
+					.getProperty(SYSTEM_PROXY_HOST));
+			proxyPortField.setText(httpProxyConfiguration
+					.getProperty(SYSTEM_PROXY_PORT));
+			proxyUserField.setText(httpProxyConfiguration
+					.getProperty(SYSTEM_PROXY_USER));
+			proxyPasswordField.setText(httpProxyConfiguration
+					.getProperty(SYSTEM_PROXY_PASSWORD));
+			nonProxyHostsArea.setText(httpProxyConfiguration
+					.getProperty(SYSTEM_NON_PROXY_HOSTS));
+		} else if (shownOption.equals(USE_SPECIFIED_VALUES_OPTION)) {
+			proxyHostField.setText(httpProxyConfiguration
+					.getProperty(TAVERNA_PROXY_HOST));
+			proxyPortField.setText(httpProxyConfiguration
+					.getProperty(TAVERNA_PROXY_PORT));
+			proxyUserField.setText(httpProxyConfiguration
+					.getProperty(TAVERNA_PROXY_USER));
+			proxyPasswordField.setText(httpProxyConfiguration
+					.getProperty(TAVERNA_PROXY_PASSWORD));
+			nonProxyHostsArea.setText(httpProxyConfiguration
+					.getProperty(TAVERNA_NON_PROXY_HOSTS));
+		} else {
+			proxyHostField.setText(null);
+			proxyPortField.setText(null);
+			proxyUserField.setText(null);
+			proxyPasswordField.setText(null);
+			nonProxyHostsArea.setText(null);
+		}
+
+		proxyHostField.setEnabled(editingEnabled);
+		proxyPortField.setEnabled(editingEnabled);
+		proxyUserField.setEnabled(editingEnabled);
+		proxyPasswordField.setEnabled(editingEnabled);
+		nonProxyHostsArea.setEnabled(editingEnabled);
+		nonProxyHostsArea.setEditable(editingEnabled);
+		nonProxyScrollPane.setEnabled(editingEnabled);
+	}
+
+	/**
+	 * Create the panel to contain the buttons
+	 * 
+	 * @return
+	 */
+	@SuppressWarnings("serial")
+	private JPanel createButtonPanel() {
+		final JPanel panel = new JPanel();
+
+		/**
+		 * The helpButton shows help about the current component
+		 */
+		JButton helpButton = new JButton(new AbstractAction("Help") {
+			@Override
+			public void actionPerformed(ActionEvent arg0) {
+				showHelp(panel);
+			}
+		});
+		panel.add(helpButton);
+
+		/**
+		 * The resetButton changes the property values shown to those
+		 * corresponding to the configuration currently applied.
+		 */
+		JButton resetButton = new JButton(new AbstractAction("Reset") {
+			@Override
+			public void actionPerformed(ActionEvent arg0) {
+				setFields();
+			}
+		});
+		panel.add(resetButton);
+
+		/**
+		 * The applyButton applies the shown field values to the
+		 * {@link HttpProxyConfiguration} and saves them for future.
+		 */
+		JButton applyButton = new JButton(new AbstractAction("Apply") {
+			@Override
+			public void actionPerformed(ActionEvent arg0) {
+				applySettings();
+				setFields();
+			}
+		});
+		panel.add(applyButton);
+
+		return panel;
+	}
+
+	/**
+	 * Checks that the specified values for the HTTP properties are a valid
+	 * combination and, if so, saves them for future use. It does not apply them
+	 * to the currently executing Taverna.
+	 */
+	private void saveSettings() {
+		if (useSystemProperties.isSelected()) {
+			httpProxyConfiguration.setProperty(PROXY_USE_OPTION,
+					USE_SYSTEM_PROPERTIES_OPTION);
+		} else if (useNoProxy.isSelected()) {
+			httpProxyConfiguration.setProperty(PROXY_USE_OPTION,
+					USE_NO_PROXY_OPTION);
+		} else {
+			if (validateFields()) {
+				httpProxyConfiguration.setProperty(PROXY_USE_OPTION,
+						USE_SPECIFIED_VALUES_OPTION);
+				httpProxyConfiguration.setProperty(TAVERNA_PROXY_HOST,
+						proxyHostField.getText());
+				httpProxyConfiguration.setProperty(TAVERNA_PROXY_PORT,
+						proxyPortField.getText());
+				httpProxyConfiguration.setProperty(TAVERNA_PROXY_USER,
+						proxyUserField.getText());
+				httpProxyConfiguration.setProperty(TAVERNA_PROXY_PASSWORD,
+						proxyPasswordField.getText());
+				httpProxyConfiguration.setProperty(TAVERNA_NON_PROXY_HOSTS,
+						nonProxyHostsArea.getText());
+			}
+		}
+	}
+
+	/**
+	 * Validates and, where appropriate formats, the properties values specified
+	 * for HTTP Proxy configuration.
+	 * 
+	 * @return
+	 */
+	private boolean validateFields() {
+		boolean result = true;
+		result = result && validateHostField();
+		result = result && validatePortField();
+		result = result && validateUserField();
+		result = result && validatePasswordField();
+		result = result && validateNonProxyHostsArea();
+		return result;
+	}
+
+	/**
+	 * Checks that, if a value is specified for non-proxy hosts then a proxy
+	 * host has also been specified. Formats the non-proxy hosts string so that
+	 * if the user has entered the hosts on separate lines, then the stored
+	 * values are separated by bars.
+	 * 
+	 * @return
+	 */
+	private boolean validateNonProxyHostsArea() {
+		boolean result = true;
+		String value = nonProxyHostsArea.getText();
+		if ((value != null) && (!value.equals(""))) {
+			value = value.replaceAll("\\n", "|");
+			nonProxyHostsArea.setText(value);
+			result = result
+					&& dependsUpon("non-proxy host", "host",
+							proxyHostField.getText());
+		}
+		return result;
+	}
+
+	/**
+	 * Checks that, if a password has been specified, then a user has also been
+	 * specified.
+	 * 
+	 * @return
+	 */
+	private boolean validatePasswordField() {
+		boolean result = true;
+		String value = proxyPasswordField.getText();
+		if ((value != null) && !value.isEmpty())
+			result = result
+					&& dependsUpon("password", "user", proxyHostField.getText());
+		return result;
+	}
+
+	/**
+	 * Checks that if a user has been specified, then a host has also been
+	 * specified.
+	 * 
+	 * @return
+	 */
+	private boolean validateUserField() {
+		boolean result = true;
+		String value = proxyUserField.getText();
+		if ((value != null) && !value.isEmpty())
+			result = result
+					&& dependsUpon("user", "host", proxyHostField.getText());
+		return result;
+	}
+
+	/**
+	 * Checks that if a port has been specified then a host has also been
+	 * specified. Checks that the port number is a non-negative integer. If the
+	 * port has not been specified, then if a host has been specified, the
+	 * default value 80 is used.
+	 * 
+	 * @return
+	 */
+	private boolean validatePortField() {
+		boolean result = true;
+		String value = proxyPortField.getText();
+		if ((value != null) && (!value.equals(""))) {
+			result = result
+					&& dependsUpon("port", "host", proxyHostField.getText());
+			try {
+				int parsedNumber = Integer.parseInt(value);
+				if (parsedNumber <= 0) {
+					showMessageDialog(this, "The port must be non-negative");
+					result = false;
+				}
+			} catch (NumberFormatException e) {
+				showMessageDialog(this, "The port must be an integer");
+				result = false;
+			}
+		} else {
+			String hostField = proxyHostField.getText();
+			if ((hostField != null) && !hostField.isEmpty())
+				proxyPortField.setText("80");
+		}
+		return result;
+	}
+
+	/**
+	 * Checks if the targetValue has been specified. If not then a message is
+	 * displayed indicating that the dependent cannot be specified with the
+	 * target.
+	 * 
+	 * @param dependent
+	 * @param target
+	 * @param targetValue
+	 * @return
+	 */
+	private boolean dependsUpon(String dependent, String target,
+			String targetValue) {
+		boolean result = true;
+		if ((targetValue == null) || target.equals("")) {
+			showMessageDialog(this, "A " + dependent
+					+ " cannot be specified without a " + target);
+			result = false;
+		}
+		return result;
+	}
+
+	/**
+	 * Could validate the host field e.g. by establishing a connection.
+	 * Currently no validation is done.
+	 * 
+	 * @return
+	 */
+	private boolean validateHostField() {
+		boolean result = true;
+		// String value = proxyHostField.getText();
+		return result;
+	}
+
+	/**
+	 * Save the currently set field values (if valid) to the
+	 * {@link HttpProxyConfiguration}. Also applies those values to the
+	 * currently running Taverna.
+	 */
+	private void applySettings() {
+		if (validateFields()) {
+			saveSettings();
+			httpProxyConfiguration.changeProxySettings();
+		}
+	}
+
+	/**
+	 * Set the shown field values to those currently in use (i.e. last saved
+	 * configuration).
+	 */
+	private void setFields() {
+		shownOption = httpProxyConfiguration.getProperty(PROXY_USE_OPTION);
+		useSystemProperties.setSelected(shownOption
+				.equals(USE_SYSTEM_PROPERTIES_OPTION));
+		useSpecifiedValues.setSelected(shownOption
+				.equals(USE_SPECIFIED_VALUES_OPTION));
+		useNoProxy.setSelected(shownOption.equals(USE_NO_PROXY_OPTION));
+		populateFields();
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-httpproxy-config/src/main/java/org/apache/taverna/workbench/httpproxy/config/HttpProxyConfigurationUIFactory.java
----------------------------------------------------------------------
diff --git a/taverna-httpproxy-config/src/main/java/org/apache/taverna/workbench/httpproxy/config/HttpProxyConfigurationUIFactory.java b/taverna-httpproxy-config/src/main/java/org/apache/taverna/workbench/httpproxy/config/HttpProxyConfigurationUIFactory.java
new file mode 100644
index 0000000..dabe6a8
--- /dev/null
+++ b/taverna-httpproxy-config/src/main/java/org/apache/taverna/workbench/httpproxy/config/HttpProxyConfigurationUIFactory.java
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * 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 org.apache.taverna.workbench.httpproxy.config;
+
+import javax.swing.JPanel;
+
+import org.apache.taverna.configuration.Configurable;
+import uk.org.taverna.configuration.ConfigurationUIFactory;
+import uk.org.taverna.configuration.proxy.HttpProxyConfiguration;
+
+/**
+ * A Factory to create a HttpProxyConfiguration
+ *
+ * @author alanrw
+ * @author David Withers
+ */
+public class HttpProxyConfigurationUIFactory implements ConfigurationUIFactory {
+	private HttpProxyConfiguration httpProxyConfiguration;
+
+	@Override
+	public boolean canHandle(String uuid) {
+		return uuid.equals(getConfigurable().getUUID());
+	}
+
+	@Override
+	public JPanel getConfigurationPanel() {
+		return new HttpProxyConfigurationPanel(httpProxyConfiguration);
+	}
+
+	@Override
+	public Configurable getConfigurable() {
+		return httpProxyConfiguration;
+	}
+
+	public void setHttpProxyConfiguration(HttpProxyConfiguration httpProxyConfiguration) {
+		this.httpProxyConfiguration = httpProxyConfiguration;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-httpproxy-config/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.configuration.ConfigurationUIFactory
----------------------------------------------------------------------
diff --git a/taverna-httpproxy-config/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.configuration.ConfigurationUIFactory b/taverna-httpproxy-config/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.configuration.ConfigurationUIFactory
deleted file mode 100644
index d87772b..0000000
--- a/taverna-httpproxy-config/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.configuration.ConfigurationUIFactory
+++ /dev/null
@@ -1 +0,0 @@
-net.sf.taverna.t2.workbench.httpproxy.config.HttpProxyConfigurationUIFactory
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-httpproxy-config/src/main/resources/META-INF/services/org.apache.taverna.workbench.configuration.ConfigurationUIFactory
----------------------------------------------------------------------
diff --git a/taverna-httpproxy-config/src/main/resources/META-INF/services/org.apache.taverna.workbench.configuration.ConfigurationUIFactory b/taverna-httpproxy-config/src/main/resources/META-INF/services/org.apache.taverna.workbench.configuration.ConfigurationUIFactory
new file mode 100644
index 0000000..d6cdb0c
--- /dev/null
+++ b/taverna-httpproxy-config/src/main/resources/META-INF/services/org.apache.taverna.workbench.configuration.ConfigurationUIFactory
@@ -0,0 +1 @@
+org.apache.taverna.workbench.httpproxy.config.HttpProxyConfigurationUIFactory
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-httpproxy-config/src/main/resources/META-INF/spring/httpproxy-config-context.xml
----------------------------------------------------------------------
diff --git a/taverna-httpproxy-config/src/main/resources/META-INF/spring/httpproxy-config-context.xml b/taverna-httpproxy-config/src/main/resources/META-INF/spring/httpproxy-config-context.xml
index 6d6060f..4eb6820 100644
--- a/taverna-httpproxy-config/src/main/resources/META-INF/spring/httpproxy-config-context.xml
+++ b/taverna-httpproxy-config/src/main/resources/META-INF/spring/httpproxy-config-context.xml
@@ -3,7 +3,7 @@
 	xsi:schemaLocation="http://www.springframework.org/schema/beans
                       http://www.springframework.org/schema/beans/spring-beans.xsd">
 
-	<bean id="HttpProxyConfigurationUIFactory" class="net.sf.taverna.t2.workbench.httpproxy.config.HttpProxyConfigurationUIFactory">
+	<bean id="HttpProxyConfigurationUIFactory" class="org.apache.taverna.workbench.httpproxy.config.HttpProxyConfigurationUIFactory">
 		<property name="httpProxyConfiguration" ref="httpProxyConfiguration" />
 	</bean>
 

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-io/src/main/java/net/sf/taverna/t2/lang/io/StreamCopier.java
----------------------------------------------------------------------
diff --git a/taverna-io/src/main/java/net/sf/taverna/t2/lang/io/StreamCopier.java b/taverna-io/src/main/java/net/sf/taverna/t2/lang/io/StreamCopier.java
deleted file mode 100644
index b0d600d..0000000
--- a/taverna-io/src/main/java/net/sf/taverna/t2/lang/io/StreamCopier.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*******************************************************************************
- * 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.lang.io;
-
-import java.io.InputStream;
-import java.io.OutputStream;
-
-import org.apache.log4j.Logger;
-
-/**
- * Copies an InputStream to an OutputStream.
- * 
- * @author Tom Oinn
- */
-public class StreamCopier extends Thread {
-
-	private static Logger logger = Logger
-	.getLogger(StreamCopier.class);
-
-	InputStream is;
-
-	OutputStream os;
-
-	/**
-	 * Create a new StreamCopier which will, when started, copy the specified
-	 * InputStream to the specified OutputStream
-	 */
-	public StreamCopier(InputStream is, OutputStream os) {
-		super("StreamCopier");
-		this.is = is;
-		this.os = os;
-	}
-
-	/**
-	 * Start copying the stream, exits when the InputStream runs out of data
-	 */
-	public void run() {
-		try {
-			byte[] buffer = new byte[1024];
-			int bytesRead;
-			while ((bytesRead = is.read(buffer)) != -1) {
-				os.write(buffer, 0, bytesRead);
-			}
-			os.flush();
-			os.close();
-		} catch (Exception ex) {
-			logger.error("Could not copy stream", ex);
-		}
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-io/src/main/java/net/sf/taverna/t2/lang/io/StreamDevourer.java
----------------------------------------------------------------------
diff --git a/taverna-io/src/main/java/net/sf/taverna/t2/lang/io/StreamDevourer.java b/taverna-io/src/main/java/net/sf/taverna/t2/lang/io/StreamDevourer.java
deleted file mode 100644
index 8495e27..0000000
--- a/taverna-io/src/main/java/net/sf/taverna/t2/lang/io/StreamDevourer.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*******************************************************************************
- * 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.lang.io;
-
-import java.io.BufferedReader;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-
-import org.apache.log4j.Logger;
-
-/**
- * Devours an input stream and allows the contents to be read as a String once
- * the stream has completed.
- * 
- * @author Tom Oinn
- * @author Alan R Williams
- */
-public class StreamDevourer extends Thread {
-	
-	private static Logger logger = Logger.getLogger(StreamDevourer.class);
-
-	private static byte[] newLine = System.getProperty("line.separator").getBytes();
-
-	BufferedReader br;
-
-	ByteArrayOutputStream output;
-
-	/**
-	 * Returns the current value of the internal ByteArrayOutputStream
-	 */
-	@Override
-	public String toString() {
-		return output.toString();
-	}
-
-	/**
-	 * Waits for the stream to close then returns the String representation of
-	 * its contents (this is equivalent to doing a join then calling toString)
-	 */
-	public String blockOnOutput() {
-		try {
-			this.join();
-			return output.toString();
-		} catch (InterruptedException ie) {
-			logger.error("Interrupted", ie);
-			interrupt();
-			return "";
-		}
-	}
-
-	/**
-	 * Create the StreamDevourer and point it at an InputStream to consume
-	 */
-	public StreamDevourer(InputStream is) {
-		super("StreamDevourer");
-		this.br = new BufferedReader(new InputStreamReader(is));
-		this.output = new ByteArrayOutputStream();
-	}
-
-	/**
-	 * When started this Thread will copy all data from the InputStream into a
-	 * ByteArrayOutputStream via a BufferedReader. Because of the use of the
-	 * BufferedReader this is only really appropriate for streams of textual
-	 * data
-	 */
-	@Override
-	public void run() {
-		try {
-			String line = null;
-			while ((line = br.readLine()) != null) {
-				// && line.endsWith("</svg>") == false) {
-				if (line.endsWith("\\") && !line.endsWith("\\\\")) {
-					line = line.substring(0, line.length() - 1);
-					output.write(line.getBytes());
-				} else {
-					output.write(line.getBytes());
-					output.write(newLine);
-				}
-			}
-			br.close();
-		} catch (IOException ioe) {
-			logger.error(ioe);
-		}
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-io/src/main/java/org/apache/taverna/lang/io/StreamCopier.java
----------------------------------------------------------------------
diff --git a/taverna-io/src/main/java/org/apache/taverna/lang/io/StreamCopier.java b/taverna-io/src/main/java/org/apache/taverna/lang/io/StreamCopier.java
new file mode 100644
index 0000000..616b4f3
--- /dev/null
+++ b/taverna-io/src/main/java/org/apache/taverna/lang/io/StreamCopier.java
@@ -0,0 +1,68 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.lang.io;
+
+import java.io.InputStream;
+import java.io.OutputStream;
+
+import org.apache.log4j.Logger;
+
+/**
+ * Copies an InputStream to an OutputStream.
+ * 
+ * @author Tom Oinn
+ */
+public class StreamCopier extends Thread {
+
+	private static Logger logger = Logger
+	.getLogger(StreamCopier.class);
+
+	InputStream is;
+
+	OutputStream os;
+
+	/**
+	 * Create a new StreamCopier which will, when started, copy the specified
+	 * InputStream to the specified OutputStream
+	 */
+	public StreamCopier(InputStream is, OutputStream os) {
+		super("StreamCopier");
+		this.is = is;
+		this.os = os;
+	}
+
+	/**
+	 * Start copying the stream, exits when the InputStream runs out of data
+	 */
+	public void run() {
+		try {
+			byte[] buffer = new byte[1024];
+			int bytesRead;
+			while ((bytesRead = is.read(buffer)) != -1) {
+				os.write(buffer, 0, bytesRead);
+			}
+			os.flush();
+			os.close();
+		} catch (Exception ex) {
+			logger.error("Could not copy stream", ex);
+		}
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-io/src/main/java/org/apache/taverna/lang/io/StreamDevourer.java
----------------------------------------------------------------------
diff --git a/taverna-io/src/main/java/org/apache/taverna/lang/io/StreamDevourer.java b/taverna-io/src/main/java/org/apache/taverna/lang/io/StreamDevourer.java
new file mode 100644
index 0000000..a5d9a9f
--- /dev/null
+++ b/taverna-io/src/main/java/org/apache/taverna/lang/io/StreamDevourer.java
@@ -0,0 +1,105 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.lang.io;
+
+import java.io.BufferedReader;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+
+import org.apache.log4j.Logger;
+
+/**
+ * Devours an input stream and allows the contents to be read as a String once
+ * the stream has completed.
+ * 
+ * @author Tom Oinn
+ * @author Alan R Williams
+ */
+public class StreamDevourer extends Thread {
+	
+	private static Logger logger = Logger.getLogger(StreamDevourer.class);
+
+	private static byte[] newLine = System.getProperty("line.separator").getBytes();
+
+	BufferedReader br;
+
+	ByteArrayOutputStream output;
+
+	/**
+	 * Returns the current value of the internal ByteArrayOutputStream
+	 */
+	@Override
+	public String toString() {
+		return output.toString();
+	}
+
+	/**
+	 * Waits for the stream to close then returns the String representation of
+	 * its contents (this is equivalent to doing a join then calling toString)
+	 */
+	public String blockOnOutput() {
+		try {
+			this.join();
+			return output.toString();
+		} catch (InterruptedException ie) {
+			logger.error("Interrupted", ie);
+			interrupt();
+			return "";
+		}
+	}
+
+	/**
+	 * Create the StreamDevourer and point it at an InputStream to consume
+	 */
+	public StreamDevourer(InputStream is) {
+		super("StreamDevourer");
+		this.br = new BufferedReader(new InputStreamReader(is));
+		this.output = new ByteArrayOutputStream();
+	}
+
+	/**
+	 * When started this Thread will copy all data from the InputStream into a
+	 * ByteArrayOutputStream via a BufferedReader. Because of the use of the
+	 * BufferedReader this is only really appropriate for streams of textual
+	 * data
+	 */
+	@Override
+	public void run() {
+		try {
+			String line = null;
+			while ((line = br.readLine()) != null) {
+				// && line.endsWith("</svg>") == false) {
+				if (line.endsWith("\\") && !line.endsWith("\\\\")) {
+					line = line.substring(0, line.length() - 1);
+					output.write(line.getBytes());
+				} else {
+					output.write(line.getBytes());
+					output.write(newLine);
+				}
+			}
+			br.close();
+		} catch (IOException ioe) {
+			logger.error(ioe);
+		}
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-iteration-strategy-ui/src/main/java/net/sf/taverna/t2/workbench/iterationstrategy/IterationStrategyIcons.java
----------------------------------------------------------------------
diff --git a/taverna-iteration-strategy-ui/src/main/java/net/sf/taverna/t2/workbench/iterationstrategy/IterationStrategyIcons.java b/taverna-iteration-strategy-ui/src/main/java/net/sf/taverna/t2/workbench/iterationstrategy/IterationStrategyIcons.java
deleted file mode 100644
index 350c0cc..0000000
--- a/taverna-iteration-strategy-ui/src/main/java/net/sf/taverna/t2/workbench/iterationstrategy/IterationStrategyIcons.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * 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.iterationstrategy;
-
-import javax.swing.ImageIcon;
-
-import org.apache.log4j.Logger;
-
-public class IterationStrategyIcons {
-
-	private static Logger logger = Logger
-			.getLogger(IterationStrategyIcons.class);
-
-	public static ImageIcon joinIteratorIcon, lockStepIteratorIcon,
-			leafnodeicon;
-
-	static {
-		try {
-			Class<?> c = IterationStrategyIcons.class;
-			joinIteratorIcon = new ImageIcon(c
-					.getResource("icons/crossproducticon.png"));
-			lockStepIteratorIcon = new ImageIcon(c
-					.getResource("icons/dotproducticon.png"));
-			leafnodeicon = new ImageIcon(c
-					.getResource("icons/leafnodeicon.png"));
-		} catch (Exception ex) {
-			logger.warn("Could not find icon", ex);
-		}
-	}
-}


[21/51] [partial] incubator-taverna-workbench git commit: all packages are moved to org.apache.taverna.*

Posted by re...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-impl/src/main/java/org/apache/taverna/workbench/edits/impl/menu/AbstractUndoAction.java
----------------------------------------------------------------------
diff --git a/taverna-edits-impl/src/main/java/org/apache/taverna/workbench/edits/impl/menu/AbstractUndoAction.java b/taverna-edits-impl/src/main/java/org/apache/taverna/workbench/edits/impl/menu/AbstractUndoAction.java
new file mode 100644
index 0000000..0f024a1
--- /dev/null
+++ b/taverna-edits-impl/src/main/java/org/apache/taverna/workbench/edits/impl/menu/AbstractUndoAction.java
@@ -0,0 +1,165 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.edits.impl.menu;
+
+import static java.awt.Toolkit.getDefaultToolkit;
+import static java.awt.event.KeyEvent.VK_Y;
+import static java.awt.event.KeyEvent.VK_Z;
+import static javax.swing.KeyStroke.getKeyStroke;
+import static org.apache.taverna.workbench.icons.WorkbenchIcons.redoIcon;
+import static org.apache.taverna.workbench.icons.WorkbenchIcons.undoIcon;
+
+import java.awt.event.ActionEvent;
+
+import javax.swing.AbstractAction;
+
+import org.apache.taverna.lang.observer.Observable;
+import org.apache.taverna.lang.observer.Observer;
+import org.apache.taverna.lang.observer.SwingAwareObserver;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.edits.EditManager.AbstractDataflowEditEvent;
+import org.apache.taverna.workbench.edits.EditManager.EditManagerEvent;
+import org.apache.taverna.workbench.selection.SelectionManager;
+import org.apache.taverna.workbench.selection.events.PerspectiveSelectionEvent;
+import org.apache.taverna.workbench.selection.events.SelectionManagerEvent;
+import org.apache.taverna.workbench.selection.events.WorkflowBundleSelectionEvent;
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+
+/**
+ * @author David Withers
+ */
+@SuppressWarnings("serial")
+public abstract class AbstractUndoAction extends AbstractAction {
+	protected EditManager editManager;
+	private SelectionManager selectionManager;
+
+	public AbstractUndoAction(String label, EditManager editManager) {
+		super(label);
+		this.editManager = editManager;
+		if (label.equals("Undo")) {
+			this.putValue(SMALL_ICON, undoIcon);
+			this.putValue(SHORT_DESCRIPTION, "Undo an action");
+			putValue(
+					ACCELERATOR_KEY,
+					getKeyStroke(VK_Z, getDefaultToolkit()
+							.getMenuShortcutKeyMask()));
+		} else if (label.equals("Redo")) {
+			this.putValue(SMALL_ICON, redoIcon);
+			this.putValue(SHORT_DESCRIPTION, "Redo an action");
+			putValue(
+					ACCELERATOR_KEY,
+					getKeyStroke(VK_Y, getDefaultToolkit()
+							.getMenuShortcutKeyMask()));
+		}
+		editManager.addObserver(new EditManagerObserver());
+		updateStatus();
+	}
+
+	@Override
+	public void actionPerformed(ActionEvent e) {
+		WorkflowBundle workflowBundle = getCurrentDataflow();
+		if (workflowBundle != null)
+			performUndoOrRedo(workflowBundle);
+	}
+
+	/**
+	 * Check if action should be enabled or disabled and update its status.
+	 */
+	public void updateStatus() {
+		WorkflowBundle workflowBundle = getCurrentDataflow();
+		if (workflowBundle == null)
+			setEnabled(false);
+		setEnabled(isActive(workflowBundle));
+	}
+
+	/**
+	 * Retrieve the current dataflow from the {@link ModelMap}, or
+	 * <code>null</code> if no workflow is active.
+	 * 
+	 * @return The current {@link Dataflow}
+	 */
+	protected WorkflowBundle getCurrentDataflow() {
+		if (selectionManager == null)
+			return null;
+		return selectionManager.getSelectedWorkflowBundle();
+	}
+
+	/**
+	 * Return <code>true</code> if the action should be enabled when the given
+	 * {@link Dataflow} is the current, ie. if it's undoable or redoable.
+	 * 
+	 * @param dataflow
+	 *            Current {@link Dataflow}
+	 * @return <code>true</code> if the action should be enabled.
+	 */
+	protected abstract boolean isActive(WorkflowBundle workflowBundle);
+
+	/**
+	 * Called by {@link #actionPerformed(ActionEvent)} when the current dataflow
+	 * is not <code>null</code>.
+	 * 
+	 * @param dataflow
+	 *            {@link Dataflow} on which to undo or redo
+	 */
+	protected abstract void performUndoOrRedo(WorkflowBundle workflowBundle);
+
+	public void setSelectionManager(SelectionManager selectionManager) {
+		this.selectionManager = selectionManager;
+		if (selectionManager != null)
+			selectionManager.addObserver(new SelectionManagerObserver());
+	}
+
+	/**
+	 * Update the status if there's been an edit done on the current workflow.
+	 * 
+	 */
+	protected class EditManagerObserver implements Observer<EditManagerEvent> {
+		@Override
+		public void notify(Observable<EditManagerEvent> sender,
+				EditManagerEvent message) throws Exception {
+			if (!(message instanceof AbstractDataflowEditEvent))
+				return;
+			AbstractDataflowEditEvent dataflowEdit = (AbstractDataflowEditEvent) message;
+			if (dataflowEdit.getDataFlow().equals(dataflowEdit.getDataFlow()))
+				// It's an edit that could effect our undoability
+				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)
+				updateStatus();
+			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/a9a52bd5/taverna-edits-impl/src/main/java/org/apache/taverna/workbench/edits/impl/menu/RedoMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-edits-impl/src/main/java/org/apache/taverna/workbench/edits/impl/menu/RedoMenuAction.java b/taverna-edits-impl/src/main/java/org/apache/taverna/workbench/edits/impl/menu/RedoMenuAction.java
new file mode 100644
index 0000000..3696458
--- /dev/null
+++ b/taverna-edits-impl/src/main/java/org/apache/taverna/workbench/edits/impl/menu/RedoMenuAction.java
@@ -0,0 +1,85 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.edits.impl.menu;
+
+import static javax.swing.JOptionPane.ERROR_MESSAGE;
+import static javax.swing.JOptionPane.showMessageDialog;
+import static org.apache.taverna.workbench.edits.impl.menu.UndoMenuSection.UNDO_SECTION_URI;
+
+import javax.swing.Action;
+
+import org.apache.taverna.ui.menu.AbstractMenuAction;
+import org.apache.taverna.workbench.edits.Edit;
+import org.apache.taverna.workbench.edits.EditException;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.selection.SelectionManager;
+
+import org.apache.log4j.Logger;
+
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+
+/**
+ * Redo the previous {@link Edit} done on the current workflow using the
+ * {@link EditManager}.
+ *
+ * @author Stian Soiland-Reyes
+ */
+public class RedoMenuAction extends AbstractMenuAction {
+	private static Logger logger = Logger.getLogger(RedoMenuAction.class);
+	private final EditManager editManager;
+	private SelectionManager selectionManager;
+	private AbstractUndoAction undoAction;
+
+	public RedoMenuAction(EditManager editManager) {
+		super(UNDO_SECTION_URI, 20);
+		this.editManager = editManager;
+	}
+
+	@SuppressWarnings("serial")
+	@Override
+	protected Action createAction() {
+		undoAction = new AbstractUndoAction("Redo", editManager) {
+			@Override
+			protected boolean isActive(WorkflowBundle workflowBundle) {
+				return editManager.canRedoDataflowEdit(workflowBundle);
+			}
+
+			@Override
+			protected void performUndoOrRedo(WorkflowBundle workflowBundle) {
+				try {
+					editManager.redoDataflowEdit(workflowBundle);
+				} catch (EditException | RuntimeException e) {
+					logger.warn("Could not redo for " + workflowBundle, e);
+					showMessageDialog(null, "Could not redo for workflow "
+							+ workflowBundle + ":\n" + e, "Could not redo",
+							ERROR_MESSAGE);
+				}
+			}
+		};
+		undoAction.setSelectionManager(selectionManager);
+		return undoAction;
+	}
+
+	public void setSelectionManager(SelectionManager selectionManager) {
+		this.selectionManager = selectionManager;
+		if (undoAction != null)
+			undoAction.setSelectionManager(selectionManager);
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-impl/src/main/java/org/apache/taverna/workbench/edits/impl/menu/UndoMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-edits-impl/src/main/java/org/apache/taverna/workbench/edits/impl/menu/UndoMenuAction.java b/taverna-edits-impl/src/main/java/org/apache/taverna/workbench/edits/impl/menu/UndoMenuAction.java
new file mode 100644
index 0000000..7db7c6c
--- /dev/null
+++ b/taverna-edits-impl/src/main/java/org/apache/taverna/workbench/edits/impl/menu/UndoMenuAction.java
@@ -0,0 +1,85 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.edits.impl.menu;
+
+import static javax.swing.JOptionPane.ERROR_MESSAGE;
+import static javax.swing.JOptionPane.showMessageDialog;
+import static org.apache.taverna.workbench.edits.impl.menu.UndoMenuSection.UNDO_SECTION_URI;
+
+import javax.swing.Action;
+
+import org.apache.taverna.ui.menu.AbstractMenuAction;
+import org.apache.taverna.workbench.edits.Edit;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.selection.SelectionManager;
+
+import org.apache.log4j.Logger;
+
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+
+/**
+ * Undo the last {@link Edit} done on the current workflow using the
+ * {@link EditManager}.
+ * 
+ * @author Stian Soiland-Reyes
+ * 
+ */
+public class UndoMenuAction extends AbstractMenuAction {
+	private static Logger logger = Logger.getLogger(UndoMenuAction.class);
+	private final EditManager editManager;
+	private SelectionManager selectionManager;
+	private AbstractUndoAction undoAction;
+
+	public UndoMenuAction(EditManager editManager) {
+		super(UNDO_SECTION_URI, 10);
+		this.editManager = editManager;
+	}
+
+	@SuppressWarnings("serial")
+	@Override
+	protected Action createAction() {
+		undoAction = new AbstractUndoAction("Undo", editManager) {
+			@Override
+			protected boolean isActive(WorkflowBundle workflowBundle) {
+				return editManager.canUndoDataflowEdit(workflowBundle);
+			}
+
+			@Override
+			protected void performUndoOrRedo(WorkflowBundle workflowBundle) {
+				try {
+					editManager.undoDataflowEdit(workflowBundle);
+				} catch (RuntimeException e) {
+					logger.warn("Could not undo for " + workflowBundle, e);
+					showMessageDialog(null, "Could not undo for workflow "
+							+ workflowBundle + ":\n" + e, "Could not undo",
+							ERROR_MESSAGE);
+				}
+			}
+		};
+		undoAction.setSelectionManager(selectionManager);
+		return undoAction;
+	}
+
+	public void setSelectionManager(SelectionManager selectionManager) {
+		this.selectionManager = selectionManager;
+		if (undoAction != null)
+			undoAction.setSelectionManager(selectionManager);
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-impl/src/main/java/org/apache/taverna/workbench/edits/impl/menu/UndoMenuSection.java
----------------------------------------------------------------------
diff --git a/taverna-edits-impl/src/main/java/org/apache/taverna/workbench/edits/impl/menu/UndoMenuSection.java b/taverna-edits-impl/src/main/java/org/apache/taverna/workbench/edits/impl/menu/UndoMenuSection.java
new file mode 100644
index 0000000..dfed909
--- /dev/null
+++ b/taverna-edits-impl/src/main/java/org/apache/taverna/workbench/edits/impl/menu/UndoMenuSection.java
@@ -0,0 +1,41 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.edits.impl.menu;
+
+import java.net.URI;
+
+import org.apache.taverna.ui.menu.AbstractMenuSection;
+
+/**
+ * A section of the Edit menu that contains {@link UndoMenuSection undo} and
+ * {@link RedoMenuAction redo}.
+ * 
+ * @author Stian Soiland-Reyes
+ */
+public class UndoMenuSection extends AbstractMenuSection {
+	public static final URI UNDO_SECTION_URI = URI
+			.create("http://taverna.sf.net/2008/t2workbench/edits#undoSection");
+	public static final URI EDIT_MENU_URI = URI
+			.create("http://taverna.sf.net/2008/t2workbench/menu#edit");
+
+	public UndoMenuSection() {
+		super(EDIT_MENU_URI, 10, UNDO_SECTION_URI);
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-impl/src/main/java/org/apache/taverna/workbench/edits/impl/toolbar/EditToolbarSection.java
----------------------------------------------------------------------
diff --git a/taverna-edits-impl/src/main/java/org/apache/taverna/workbench/edits/impl/toolbar/EditToolbarSection.java b/taverna-edits-impl/src/main/java/org/apache/taverna/workbench/edits/impl/toolbar/EditToolbarSection.java
new file mode 100644
index 0000000..f83bfbc
--- /dev/null
+++ b/taverna-edits-impl/src/main/java/org/apache/taverna/workbench/edits/impl/toolbar/EditToolbarSection.java
@@ -0,0 +1,35 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.edits.impl.toolbar;
+
+import static org.apache.taverna.ui.menu.DefaultToolBar.DEFAULT_TOOL_BAR;
+
+import java.net.URI;
+
+import org.apache.taverna.ui.menu.AbstractMenuSection;
+
+public class EditToolbarSection extends AbstractMenuSection {
+	public static final URI EDIT_TOOLBAR_SECTION = URI
+			.create("http://taverna.sf.net/2008/t2workbench/menu#editToolbarSection");
+
+	public EditToolbarSection() {
+		super(DEFAULT_TOOL_BAR, 60, EDIT_TOOLBAR_SECTION);
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-impl/src/main/java/org/apache/taverna/workbench/edits/impl/toolbar/RedoToolbarAction.java
----------------------------------------------------------------------
diff --git a/taverna-edits-impl/src/main/java/org/apache/taverna/workbench/edits/impl/toolbar/RedoToolbarAction.java b/taverna-edits-impl/src/main/java/org/apache/taverna/workbench/edits/impl/toolbar/RedoToolbarAction.java
new file mode 100644
index 0000000..d95adb7
--- /dev/null
+++ b/taverna-edits-impl/src/main/java/org/apache/taverna/workbench/edits/impl/toolbar/RedoToolbarAction.java
@@ -0,0 +1,45 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.edits.impl.toolbar;
+
+import static org.apache.taverna.workbench.edits.impl.toolbar.EditToolbarSection.EDIT_TOOLBAR_SECTION;
+
+import java.net.URI;
+
+import javax.swing.Action;
+
+import org.apache.taverna.ui.menu.AbstractMenuAction;
+import org.apache.taverna.workbench.edits.impl.menu.RedoMenuAction;
+
+public class RedoToolbarAction extends AbstractMenuAction {
+	private static final URI EDIT_TOOLBAR_REDO_URI = URI
+			.create("http://taverna.sf.net/2008/t2workbench/menu#editToolbarRedo");
+	private final RedoMenuAction redoMenuAction;
+
+	public RedoToolbarAction(RedoMenuAction redoMenuAction) {
+		super(EDIT_TOOLBAR_SECTION, 20, EDIT_TOOLBAR_REDO_URI);
+		this.redoMenuAction = redoMenuAction;
+	}
+
+	@Override
+	protected Action createAction() {
+		return redoMenuAction.getAction();
+	}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-impl/src/main/java/org/apache/taverna/workbench/edits/impl/toolbar/UndoToolbarAction.java
----------------------------------------------------------------------
diff --git a/taverna-edits-impl/src/main/java/org/apache/taverna/workbench/edits/impl/toolbar/UndoToolbarAction.java b/taverna-edits-impl/src/main/java/org/apache/taverna/workbench/edits/impl/toolbar/UndoToolbarAction.java
new file mode 100644
index 0000000..2d9bcae
--- /dev/null
+++ b/taverna-edits-impl/src/main/java/org/apache/taverna/workbench/edits/impl/toolbar/UndoToolbarAction.java
@@ -0,0 +1,45 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.edits.impl.toolbar;
+
+import static org.apache.taverna.workbench.edits.impl.toolbar.EditToolbarSection.EDIT_TOOLBAR_SECTION;
+
+import java.net.URI;
+
+import javax.swing.Action;
+
+import org.apache.taverna.ui.menu.AbstractMenuAction;
+import org.apache.taverna.workbench.edits.impl.menu.UndoMenuAction;
+
+public class UndoToolbarAction extends AbstractMenuAction {
+	private static final URI EDIT_TOOLBAR_UNDO_URI = URI
+			.create("http://taverna.sf.net/2008/t2workbench/menu#editToolbarUndo");
+	private final UndoMenuAction undoMenuAction;
+
+	public UndoToolbarAction(UndoMenuAction undoMenuAction) {
+		super(EDIT_TOOLBAR_SECTION, 10, EDIT_TOOLBAR_UNDO_URI);
+		this.undoMenuAction = undoMenuAction;
+	}
+
+	@Override
+	protected Action createAction() {
+		return undoMenuAction.getAction();
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-impl/src/main/resources/META-INF/services/net.sf.taverna.t2.ui.menu.MenuComponent
----------------------------------------------------------------------
diff --git a/taverna-edits-impl/src/main/resources/META-INF/services/net.sf.taverna.t2.ui.menu.MenuComponent b/taverna-edits-impl/src/main/resources/META-INF/services/net.sf.taverna.t2.ui.menu.MenuComponent
deleted file mode 100644
index 6938308..0000000
--- a/taverna-edits-impl/src/main/resources/META-INF/services/net.sf.taverna.t2.ui.menu.MenuComponent
+++ /dev/null
@@ -1,6 +0,0 @@
-net.sf.taverna.t2.workbench.edits.impl.menu.UndoMenuSection
-net.sf.taverna.t2.workbench.edits.impl.menu.UndoMenuAction
-net.sf.taverna.t2.workbench.edits.impl.menu.RedoMenuAction
-net.sf.taverna.t2.workbench.edits.impl.toolbar.EditToolbarSection
-net.sf.taverna.t2.workbench.edits.impl.toolbar.UndoToolbarAction
-net.sf.taverna.t2.workbench.edits.impl.toolbar.RedoToolbarAction

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-impl/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.edits.EditManager
----------------------------------------------------------------------
diff --git a/taverna-edits-impl/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.edits.EditManager b/taverna-edits-impl/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.edits.EditManager
deleted file mode 100644
index 92ee088..0000000
--- a/taverna-edits-impl/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.edits.EditManager
+++ /dev/null
@@ -1 +0,0 @@
-net.sf.taverna.t2.workbench.edits.impl.EditManagerImpl

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-impl/src/main/resources/META-INF/services/org.apache.taverna.ui.menu.MenuComponent
----------------------------------------------------------------------
diff --git a/taverna-edits-impl/src/main/resources/META-INF/services/org.apache.taverna.ui.menu.MenuComponent b/taverna-edits-impl/src/main/resources/META-INF/services/org.apache.taverna.ui.menu.MenuComponent
new file mode 100644
index 0000000..1019470
--- /dev/null
+++ b/taverna-edits-impl/src/main/resources/META-INF/services/org.apache.taverna.ui.menu.MenuComponent
@@ -0,0 +1,6 @@
+org.apache.taverna.workbench.edits.impl.menu.UndoMenuSection
+org.apache.taverna.workbench.edits.impl.menu.UndoMenuAction
+org.apache.taverna.workbench.edits.impl.menu.RedoMenuAction
+org.apache.taverna.workbench.edits.impl.toolbar.EditToolbarSection
+org.apache.taverna.workbench.edits.impl.toolbar.UndoToolbarAction
+org.apache.taverna.workbench.edits.impl.toolbar.RedoToolbarAction

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-impl/src/main/resources/META-INF/services/org.apache.taverna.workbench.edits.EditManager
----------------------------------------------------------------------
diff --git a/taverna-edits-impl/src/main/resources/META-INF/services/org.apache.taverna.workbench.edits.EditManager b/taverna-edits-impl/src/main/resources/META-INF/services/org.apache.taverna.workbench.edits.EditManager
new file mode 100644
index 0000000..bd7f2d8
--- /dev/null
+++ b/taverna-edits-impl/src/main/resources/META-INF/services/org.apache.taverna.workbench.edits.EditManager
@@ -0,0 +1 @@
+org.apache.taverna.workbench.edits.impl.EditManagerImpl

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-impl/src/main/resources/META-INF/spring/edits-impl-context-osgi.xml
----------------------------------------------------------------------
diff --git a/taverna-edits-impl/src/main/resources/META-INF/spring/edits-impl-context-osgi.xml b/taverna-edits-impl/src/main/resources/META-INF/spring/edits-impl-context-osgi.xml
index 8eb7041..195b18e 100644
--- a/taverna-edits-impl/src/main/resources/META-INF/spring/edits-impl-context-osgi.xml
+++ b/taverna-edits-impl/src/main/resources/META-INF/spring/edits-impl-context-osgi.xml
@@ -13,8 +13,8 @@
 	<service ref="UndoToolbarAction" auto-export="interfaces" />
 	<service ref="RedoToolbarAction" auto-export="interfaces" />
 
-	<service ref="EditManagerImpl" interface="net.sf.taverna.t2.workbench.edits.EditManager" />
+	<service ref="EditManagerImpl" interface="org.apache.taverna.workbench.edits.EditManager" />
 
-	<reference id="selectionManager" interface="net.sf.taverna.t2.workbench.selection.SelectionManager" cardinality="0..1" />
+	<reference id="selectionManager" interface="org.apache.taverna.workbench.selection.SelectionManager" cardinality="0..1" />
 
 </beans:beans>

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-impl/src/main/resources/META-INF/spring/edits-impl-context.xml
----------------------------------------------------------------------
diff --git a/taverna-edits-impl/src/main/resources/META-INF/spring/edits-impl-context.xml b/taverna-edits-impl/src/main/resources/META-INF/spring/edits-impl-context.xml
index 33f0b7b..bba1db8 100644
--- a/taverna-edits-impl/src/main/resources/META-INF/spring/edits-impl-context.xml
+++ b/taverna-edits-impl/src/main/resources/META-INF/spring/edits-impl-context.xml
@@ -3,31 +3,31 @@
 	xsi:schemaLocation="http://www.springframework.org/schema/beans
                       http://www.springframework.org/schema/beans/spring-beans.xsd">
 
-	<bean id="UndoMenuSection" class="net.sf.taverna.t2.workbench.edits.impl.menu.UndoMenuSection" />
-	<bean id="UndoMenuAction" class="net.sf.taverna.t2.workbench.edits.impl.menu.UndoMenuAction">
+	<bean id="UndoMenuSection" class="org.apache.taverna.workbench.edits.impl.menu.UndoMenuSection" />
+	<bean id="UndoMenuAction" class="org.apache.taverna.workbench.edits.impl.menu.UndoMenuAction">
 		<constructor-arg name="editManager">
 			<ref local="EditManagerImpl" />
 		</constructor-arg>
 		<property name="selectionManager" ref="selectionManager" />
 	</bean>
-	<bean id="RedoMenuAction" class="net.sf.taverna.t2.workbench.edits.impl.menu.RedoMenuAction">
+	<bean id="RedoMenuAction" class="org.apache.taverna.workbench.edits.impl.menu.RedoMenuAction">
 		<constructor-arg name="editManager">
 			<ref local="EditManagerImpl" />
 		</constructor-arg>
 		<property name="selectionManager" ref="selectionManager" />
 	</bean>
-	<bean id="EditToolbarSection" class="net.sf.taverna.t2.workbench.edits.impl.toolbar.EditToolbarSection" />
-	<bean id="UndoToolbarAction" class="net.sf.taverna.t2.workbench.edits.impl.toolbar.UndoToolbarAction">
+	<bean id="EditToolbarSection" class="org.apache.taverna.workbench.edits.impl.toolbar.EditToolbarSection" />
+	<bean id="UndoToolbarAction" class="org.apache.taverna.workbench.edits.impl.toolbar.UndoToolbarAction">
 		<constructor-arg>
 			<ref local="UndoMenuAction" />
 		</constructor-arg>
 	</bean>
-	<bean id="RedoToolbarAction" class="net.sf.taverna.t2.workbench.edits.impl.toolbar.RedoToolbarAction">
+	<bean id="RedoToolbarAction" class="org.apache.taverna.workbench.edits.impl.toolbar.RedoToolbarAction">
 		<constructor-arg>
 			<ref local="RedoMenuAction" />
 		</constructor-arg>
 	</bean>
 
-	<bean id="EditManagerImpl" class="net.sf.taverna.t2.workbench.edits.impl.EditManagerImpl" />
+	<bean id="EditManagerImpl" class="org.apache.taverna.workbench.edits.impl.EditManagerImpl" />
 
 </beans>

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-impl/src/test/java/net/sf/taverna/t2/workbench/edits/impl/TestEditManagerImpl.java
----------------------------------------------------------------------
diff --git a/taverna-edits-impl/src/test/java/net/sf/taverna/t2/workbench/edits/impl/TestEditManagerImpl.java b/taverna-edits-impl/src/test/java/net/sf/taverna/t2/workbench/edits/impl/TestEditManagerImpl.java
deleted file mode 100644
index 27334b0..0000000
--- a/taverna-edits-impl/src/test/java/net/sf/taverna/t2/workbench/edits/impl/TestEditManagerImpl.java
+++ /dev/null
@@ -1,258 +0,0 @@
-/*******************************************************************************
- * 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.edits.impl;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.UUID;
-
-import org.apache.taverna.lang.observer.Observable;
-import org.apache.taverna.lang.observer.Observer;
-import net.sf.taverna.t2.workbench.edits.Edit;
-import net.sf.taverna.t2.workbench.edits.EditManager;
-import net.sf.taverna.t2.workbench.edits.EditManager.DataFlowRedoEvent;
-import net.sf.taverna.t2.workbench.edits.EditManager.DataFlowUndoEvent;
-import net.sf.taverna.t2.workbench.edits.EditManager.DataflowEditEvent;
-import net.sf.taverna.t2.workbench.edits.EditManager.EditManagerEvent;
-import net.sf.taverna.t2.workflow.edits.AddProcessorEdit;
-
-import org.junit.Before;
-import org.junit.Test;
-
-import org.apache.taverna.scufl2.api.container.WorkflowBundle;
-import org.apache.taverna.scufl2.api.core.Processor;
-import org.apache.taverna.scufl2.api.core.Workflow;
-
-public class TestEditManagerImpl {
-
-	private Workflow dataflow;
-
-	private EditManagerObserver editManagerObserver = new EditManagerObserver();
-
-	private Processor processor;
-
-	@Test
-	public void addProcessor() throws Exception {
-		EditManager editManager = new EditManagerImpl();
-		editManager.addObserver(editManagerObserver);
-
-		Edit<Workflow> edit = new AddProcessorEdit(dataflow, processor);
-		assertFalse("Edit was already applied", edit.isApplied());
-		assertTrue("Did already add processor", dataflow.getProcessors()
-				.isEmpty());
-
-		editManager.doDataflowEdit(dataflow.getParent(), edit);
-		assertTrue("Edit was not applied", edit.isApplied());
-		assertEquals("Did not add processor", processor, dataflow.getProcessors().first());
-
-		// Should have received the edit event
-		assertEquals("Incorrect number of events", 1,
-				editManagerObserver.events.size());
-		EditManagerEvent event = editManagerObserver.events.get(0);
-		assertTrue("Event was not a DataflowEditEvent",
-				event instanceof DataflowEditEvent);
-		DataflowEditEvent dataEditEvent = (DataflowEditEvent) event;
-		assertEquals("Event did not have correct workflow", dataflow,
-				dataEditEvent.getDataFlow().getWorkflows().first());
-		assertEquals("Event did not have correct edit", edit, dataEditEvent
-				.getEdit());
-
-	}
-
-	@Test
-	public void undoAddProcessor() throws Exception {
-		EditManager editManager = new EditManagerImpl();
-		editManager.addObserver(editManagerObserver);
-
-		Edit<Workflow> edit = new AddProcessorEdit(dataflow, processor);
-		editManager.doDataflowEdit(dataflow.getParent(), edit);
-
-		assertFalse("Did not add processor", dataflow.getProcessors().isEmpty());
-		editManager.undoDataflowEdit(dataflow.getParent());
-		assertTrue("Did not undo add processor", dataflow.getProcessors()
-				.isEmpty());
-
-		// Should have received the undo event
-		assertEquals("Incorrect number of events", 2,
-				editManagerObserver.events.size());
-		EditManagerEvent event = editManagerObserver.events.get(1);
-		assertTrue("Event was not a DataflowEditEvent",
-				event instanceof DataFlowUndoEvent);
-		DataFlowUndoEvent dataEditEvent = (DataFlowUndoEvent) event;
-		assertEquals("Event did not have correct workflow", dataflow,
-				dataEditEvent.getDataFlow().getWorkflows().first());
-		assertEquals("Event did not have correct edit", edit, dataEditEvent
-				.getEdit());
-		assertFalse("Edit was still applied", edit.isApplied());
-	}
-
-	@Test
-	public void multipleUndoesRedoes() throws Exception {
-		EditManager editManager = new EditManagerImpl();
-		editManager.addObserver(editManagerObserver);
-
-		Workflow dataflowA = createDataflow();
-		Workflow dataflowB = createDataflow();
-		Workflow dataflowC = createDataflow();
-
-		Processor processorA1 = createProcessor();
-		Processor processorA2 = createProcessor();
-		Processor processorA3 = createProcessor();
-		Processor processorB1 = createProcessor();
-		Processor processorC1 = createProcessor();
-
-		Edit<Workflow> edit = new AddProcessorEdit(dataflowA, processorA1);
-		editManager.doDataflowEdit(dataflowA.getParent(), edit);
-
-		edit = new AddProcessorEdit(dataflowB, processorB1);
-		editManager.doDataflowEdit(dataflowB.getParent(), edit);
-
-		edit = new AddProcessorEdit(dataflowA, processorA2);
-		editManager.doDataflowEdit(dataflowA.getParent(), edit);
-
-		edit = new AddProcessorEdit(dataflowC, processorC1);
-		editManager.doDataflowEdit(dataflowC.getParent(), edit);
-
-		edit = new AddProcessorEdit(dataflowA, processorA3);
-		editManager.doDataflowEdit(dataflowA.getParent(), edit);
-
-
-
-		assertFalse("Did not add processors", dataflowA.getProcessors().isEmpty());
-		assertEquals(3, dataflowA.getProcessors().size());
-		editManager.undoDataflowEdit(dataflowA.getParent());
-		assertEquals(2, dataflowA.getProcessors().size());
-		editManager.undoDataflowEdit(dataflowA.getParent());
-		assertEquals(1, dataflowA.getProcessors().size());
-		editManager.undoDataflowEdit(dataflowA.getParent());
-		assertEquals(0, dataflowA.getProcessors().size());
-
-		assertEquals(1, dataflowB.getProcessors().size());
-		assertEquals(1, dataflowC.getProcessors().size());
-
-		assertTrue(editManager.canUndoDataflowEdit(dataflowC.getParent()));
-		editManager.undoDataflowEdit(dataflowC.getParent());
-		assertFalse(editManager.canUndoDataflowEdit(dataflowC.getParent()));
-		editManager.undoDataflowEdit(dataflowC.getParent()); // extra one
-		assertFalse(editManager.canUndoDataflowEdit(dataflowC.getParent()));
-
-
-		assertEquals(1, dataflowB.getProcessors().size());
-		assertEquals(0, dataflowC.getProcessors().size());
-
-		editManager.undoDataflowEdit(dataflowB.getParent());
-		assertEquals(0, dataflowA.getProcessors().size());
-		assertEquals(0, dataflowB.getProcessors().size());
-		assertEquals(0, dataflowC.getProcessors().size());
-
-		editManager.redoDataflowEdit(dataflowA.getParent());
-		assertEquals(1, dataflowA.getProcessors().size());
-
-		editManager.redoDataflowEdit(dataflowA.getParent());
-		assertEquals(2, dataflowA.getProcessors().size());
-
-		editManager.redoDataflowEdit(dataflowA.getParent());
-		assertEquals(3, dataflowA.getProcessors().size());
-
-		// does not affect it
-		editManager.redoDataflowEdit(dataflowA.getParent());
-		assertEquals(3, dataflowA.getProcessors().size());
-		assertEquals(0, dataflowB.getProcessors().size());
-		assertEquals(0, dataflowC.getProcessors().size());
-	}
-
-	@Test
-	public void emptyUndoDoesNotFail() throws Exception {
-		EditManager editManager = new EditManagerImpl();
-		editManager.addObserver(editManagerObserver);
-		editManager.undoDataflowEdit(dataflow.getParent());
-	}
-
-	@Test
-	public void extraUndoesDoesNotFail() throws Exception {
-		EditManager editManager = new EditManagerImpl();
-		editManager.addObserver(editManagerObserver);
-
-		Edit<Workflow> edit = new AddProcessorEdit(dataflow, processor);
-		editManager.doDataflowEdit(dataflow.getParent(), edit);
-
-		assertFalse("Did not add processor", dataflow.getProcessors().isEmpty());
-		editManager.undoDataflowEdit(dataflow.getParent());
-		assertTrue("Did not undo add processor", dataflow.getProcessors()
-				.isEmpty());
-		editManager.undoDataflowEdit(dataflow.getParent());
-	}
-
-	@Before
-	public void makeDataflow() {
-		dataflow = createDataflow();
-	}
-
-	protected Workflow createDataflow() {
-		WorkflowBundle workflowBundle = new WorkflowBundle();
-		Workflow workflow = new Workflow();
-		workflow.setParent(workflowBundle);
-		return workflow;
-	}
-
-	protected Processor createProcessor() {
-		Processor processor = new Processor();
-		processor.setName("proc-" + UUID.randomUUID());
-		return processor;
-	}
-
-	@Before
-	public void makeProcessor() {
-		processor = createProcessor();
-	}
-
-	private class EditManagerObserver implements Observer<EditManagerEvent> {
-
-		public List<EditManagerEvent> events = new ArrayList<>();
-
-		@Override
-		public void notify(Observable<EditManagerEvent> sender,
-				EditManagerEvent message) throws Exception {
-			events.add(message);
-			if (message instanceof DataflowEditEvent) {
-				DataflowEditEvent dataflowEdit = (DataflowEditEvent) message;
-				assertTrue("Edit was not applied on edit event", dataflowEdit
-						.getEdit().isApplied());
-			} else if (message instanceof DataFlowUndoEvent) {
-				DataFlowUndoEvent dataflowUndo = (DataFlowUndoEvent) message;
-				assertFalse("Edit was applied on undo event", dataflowUndo
-						.getEdit().isApplied());
-			} else if (message instanceof DataFlowRedoEvent) {
-				DataFlowRedoEvent dataflowEdit = (DataFlowRedoEvent) message;
-				assertTrue("Edit was not applied on edit event", dataflowEdit
-						.getEdit().isApplied());
-			} else {
-				fail("Unknown event: " + message);
-			}
-		}
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-edits-impl/src/test/java/org/apache/taverna/workbench/edits/impl/TestEditManagerImpl.java
----------------------------------------------------------------------
diff --git a/taverna-edits-impl/src/test/java/org/apache/taverna/workbench/edits/impl/TestEditManagerImpl.java b/taverna-edits-impl/src/test/java/org/apache/taverna/workbench/edits/impl/TestEditManagerImpl.java
new file mode 100644
index 0000000..aed29cb
--- /dev/null
+++ b/taverna-edits-impl/src/test/java/org/apache/taverna/workbench/edits/impl/TestEditManagerImpl.java
@@ -0,0 +1,257 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.edits.impl;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.UUID;
+
+import org.apache.taverna.lang.observer.Observable;
+import org.apache.taverna.lang.observer.Observer;
+import org.apache.taverna.workbench.edits.Edit;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.edits.EditManager.DataFlowRedoEvent;
+import org.apache.taverna.workbench.edits.EditManager.DataFlowUndoEvent;
+import org.apache.taverna.workbench.edits.EditManager.DataflowEditEvent;
+import org.apache.taverna.workbench.edits.EditManager.EditManagerEvent;
+import org.apache.taverna.workflow.edits.AddProcessorEdit;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+import org.apache.taverna.scufl2.api.core.Processor;
+import org.apache.taverna.scufl2.api.core.Workflow;
+
+public class TestEditManagerImpl {
+
+	private Workflow dataflow;
+
+	private EditManagerObserver editManagerObserver = new EditManagerObserver();
+
+	private Processor processor;
+
+	@Test
+	public void addProcessor() throws Exception {
+		EditManager editManager = new EditManagerImpl();
+		editManager.addObserver(editManagerObserver);
+
+		Edit<Workflow> edit = new AddProcessorEdit(dataflow, processor);
+		assertFalse("Edit was already applied", edit.isApplied());
+		assertTrue("Did already add processor", dataflow.getProcessors()
+				.isEmpty());
+
+		editManager.doDataflowEdit(dataflow.getParent(), edit);
+		assertTrue("Edit was not applied", edit.isApplied());
+		assertEquals("Did not add processor", processor, dataflow.getProcessors().first());
+
+		// Should have received the edit event
+		assertEquals("Incorrect number of events", 1,
+				editManagerObserver.events.size());
+		EditManagerEvent event = editManagerObserver.events.get(0);
+		assertTrue("Event was not a DataflowEditEvent",
+				event instanceof DataflowEditEvent);
+		DataflowEditEvent dataEditEvent = (DataflowEditEvent) event;
+		assertEquals("Event did not have correct workflow", dataflow,
+				dataEditEvent.getDataFlow().getWorkflows().first());
+		assertEquals("Event did not have correct edit", edit, dataEditEvent
+				.getEdit());
+
+	}
+
+	@Test
+	public void undoAddProcessor() throws Exception {
+		EditManager editManager = new EditManagerImpl();
+		editManager.addObserver(editManagerObserver);
+
+		Edit<Workflow> edit = new AddProcessorEdit(dataflow, processor);
+		editManager.doDataflowEdit(dataflow.getParent(), edit);
+
+		assertFalse("Did not add processor", dataflow.getProcessors().isEmpty());
+		editManager.undoDataflowEdit(dataflow.getParent());
+		assertTrue("Did not undo add processor", dataflow.getProcessors()
+				.isEmpty());
+
+		// Should have received the undo event
+		assertEquals("Incorrect number of events", 2,
+				editManagerObserver.events.size());
+		EditManagerEvent event = editManagerObserver.events.get(1);
+		assertTrue("Event was not a DataflowEditEvent",
+				event instanceof DataFlowUndoEvent);
+		DataFlowUndoEvent dataEditEvent = (DataFlowUndoEvent) event;
+		assertEquals("Event did not have correct workflow", dataflow,
+				dataEditEvent.getDataFlow().getWorkflows().first());
+		assertEquals("Event did not have correct edit", edit, dataEditEvent
+				.getEdit());
+		assertFalse("Edit was still applied", edit.isApplied());
+	}
+
+	@Test
+	public void multipleUndoesRedoes() throws Exception {
+		EditManager editManager = new EditManagerImpl();
+		editManager.addObserver(editManagerObserver);
+
+		Workflow dataflowA = createDataflow();
+		Workflow dataflowB = createDataflow();
+		Workflow dataflowC = createDataflow();
+
+		Processor processorA1 = createProcessor();
+		Processor processorA2 = createProcessor();
+		Processor processorA3 = createProcessor();
+		Processor processorB1 = createProcessor();
+		Processor processorC1 = createProcessor();
+
+		Edit<Workflow> edit = new AddProcessorEdit(dataflowA, processorA1);
+		editManager.doDataflowEdit(dataflowA.getParent(), edit);
+
+		edit = new AddProcessorEdit(dataflowB, processorB1);
+		editManager.doDataflowEdit(dataflowB.getParent(), edit);
+
+		edit = new AddProcessorEdit(dataflowA, processorA2);
+		editManager.doDataflowEdit(dataflowA.getParent(), edit);
+
+		edit = new AddProcessorEdit(dataflowC, processorC1);
+		editManager.doDataflowEdit(dataflowC.getParent(), edit);
+
+		edit = new AddProcessorEdit(dataflowA, processorA3);
+		editManager.doDataflowEdit(dataflowA.getParent(), edit);
+
+
+
+		assertFalse("Did not add processors", dataflowA.getProcessors().isEmpty());
+		assertEquals(3, dataflowA.getProcessors().size());
+		editManager.undoDataflowEdit(dataflowA.getParent());
+		assertEquals(2, dataflowA.getProcessors().size());
+		editManager.undoDataflowEdit(dataflowA.getParent());
+		assertEquals(1, dataflowA.getProcessors().size());
+		editManager.undoDataflowEdit(dataflowA.getParent());
+		assertEquals(0, dataflowA.getProcessors().size());
+
+		assertEquals(1, dataflowB.getProcessors().size());
+		assertEquals(1, dataflowC.getProcessors().size());
+
+		assertTrue(editManager.canUndoDataflowEdit(dataflowC.getParent()));
+		editManager.undoDataflowEdit(dataflowC.getParent());
+		assertFalse(editManager.canUndoDataflowEdit(dataflowC.getParent()));
+		editManager.undoDataflowEdit(dataflowC.getParent()); // extra one
+		assertFalse(editManager.canUndoDataflowEdit(dataflowC.getParent()));
+
+
+		assertEquals(1, dataflowB.getProcessors().size());
+		assertEquals(0, dataflowC.getProcessors().size());
+
+		editManager.undoDataflowEdit(dataflowB.getParent());
+		assertEquals(0, dataflowA.getProcessors().size());
+		assertEquals(0, dataflowB.getProcessors().size());
+		assertEquals(0, dataflowC.getProcessors().size());
+
+		editManager.redoDataflowEdit(dataflowA.getParent());
+		assertEquals(1, dataflowA.getProcessors().size());
+
+		editManager.redoDataflowEdit(dataflowA.getParent());
+		assertEquals(2, dataflowA.getProcessors().size());
+
+		editManager.redoDataflowEdit(dataflowA.getParent());
+		assertEquals(3, dataflowA.getProcessors().size());
+
+		// does not affect it
+		editManager.redoDataflowEdit(dataflowA.getParent());
+		assertEquals(3, dataflowA.getProcessors().size());
+		assertEquals(0, dataflowB.getProcessors().size());
+		assertEquals(0, dataflowC.getProcessors().size());
+	}
+
+	@Test
+	public void emptyUndoDoesNotFail() throws Exception {
+		EditManager editManager = new EditManagerImpl();
+		editManager.addObserver(editManagerObserver);
+		editManager.undoDataflowEdit(dataflow.getParent());
+	}
+
+	@Test
+	public void extraUndoesDoesNotFail() throws Exception {
+		EditManager editManager = new EditManagerImpl();
+		editManager.addObserver(editManagerObserver);
+
+		Edit<Workflow> edit = new AddProcessorEdit(dataflow, processor);
+		editManager.doDataflowEdit(dataflow.getParent(), edit);
+
+		assertFalse("Did not add processor", dataflow.getProcessors().isEmpty());
+		editManager.undoDataflowEdit(dataflow.getParent());
+		assertTrue("Did not undo add processor", dataflow.getProcessors()
+				.isEmpty());
+		editManager.undoDataflowEdit(dataflow.getParent());
+	}
+
+	@Before
+	public void makeDataflow() {
+		dataflow = createDataflow();
+	}
+
+	protected Workflow createDataflow() {
+		WorkflowBundle workflowBundle = new WorkflowBundle();
+		Workflow workflow = new Workflow();
+		workflow.setParent(workflowBundle);
+		return workflow;
+	}
+
+	protected Processor createProcessor() {
+		Processor processor = new Processor();
+		processor.setName("proc-" + UUID.randomUUID());
+		return processor;
+	}
+
+	@Before
+	public void makeProcessor() {
+		processor = createProcessor();
+	}
+
+	private class EditManagerObserver implements Observer<EditManagerEvent> {
+
+		public List<EditManagerEvent> events = new ArrayList<>();
+
+		@Override
+		public void notify(Observable<EditManagerEvent> sender,
+				EditManagerEvent message) throws Exception {
+			events.add(message);
+			if (message instanceof DataflowEditEvent) {
+				DataflowEditEvent dataflowEdit = (DataflowEditEvent) message;
+				assertTrue("Edit was not applied on edit event", dataflowEdit
+						.getEdit().isApplied());
+			} else if (message instanceof DataFlowUndoEvent) {
+				DataFlowUndoEvent dataflowUndo = (DataFlowUndoEvent) message;
+				assertFalse("Edit was applied on undo event", dataflowUndo
+						.getEdit().isApplied());
+			} else if (message instanceof DataFlowRedoEvent) {
+				DataFlowRedoEvent dataflowEdit = (DataFlowRedoEvent) message;
+				assertTrue("Edit was not applied on edit event", dataflowEdit
+						.getEdit().isApplied());
+			} else {
+				fail("Unknown event: " + message);
+			}
+		}
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-file-api/src/main/java/net/sf/taverna/t2/workbench/file/AbstractDataflowPersistenceHandler.java
----------------------------------------------------------------------
diff --git a/taverna-file-api/src/main/java/net/sf/taverna/t2/workbench/file/AbstractDataflowPersistenceHandler.java b/taverna-file-api/src/main/java/net/sf/taverna/t2/workbench/file/AbstractDataflowPersistenceHandler.java
deleted file mode 100644
index a5e606b..0000000
--- a/taverna-file-api/src/main/java/net/sf/taverna/t2/workbench/file/AbstractDataflowPersistenceHandler.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*******************************************************************************
- * 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.file;
-
-import java.util.Collections;
-import java.util.List;
-
-import net.sf.taverna.t2.workbench.file.exceptions.OpenException;
-import net.sf.taverna.t2.workbench.file.exceptions.SaveException;
-import org.apache.taverna.scufl2.api.container.WorkflowBundle;
-
-public abstract class AbstractDataflowPersistenceHandler implements
-		DataflowPersistenceHandler {
-	@Override
-	public List<FileType> getOpenFileTypes() {
-		return Collections.emptyList();
-	}
-
-	@Override
-	public List<FileType> getSaveFileTypes() {
-		return Collections.emptyList();
-	}
-
-	@Override
-	public List<Class<?>> getOpenSourceTypes() {
-		return Collections.emptyList();
-	}
-
-	@Override
-	public List<Class<?>> getSaveDestinationTypes() {
-		return Collections.emptyList();
-	}
-
-	@Override
-	public DataflowInfo openDataflow(FileType fileType, Object source)
-			throws OpenException {
-		throw new UnsupportedOperationException();
-	}
-
-	@Override
-	public DataflowInfo saveDataflow(WorkflowBundle workflowBundle, FileType fileType,
-			Object destination) throws SaveException {
-		throw new UnsupportedOperationException();
-	}
-
-	@Override
-	public boolean wouldOverwriteDataflow(WorkflowBundle workflowBundle, FileType fileType,
-			Object destination, DataflowInfo lastDataflowInfo) {
-		throw new UnsupportedOperationException();
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-file-api/src/main/java/net/sf/taverna/t2/workbench/file/DataflowInfo.java
----------------------------------------------------------------------
diff --git a/taverna-file-api/src/main/java/net/sf/taverna/t2/workbench/file/DataflowInfo.java b/taverna-file-api/src/main/java/net/sf/taverna/t2/workbench/file/DataflowInfo.java
deleted file mode 100644
index 469d13b..0000000
--- a/taverna-file-api/src/main/java/net/sf/taverna/t2/workbench/file/DataflowInfo.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*******************************************************************************
- * 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.file;
-
-import java.util.Date;
-
-import org.apache.taverna.scufl2.api.container.WorkflowBundle;
-
-/**
- * Information about a WorkflowBundle that has been opened by the
- * {@link FileManager}.
- * <p>
- * This class, or a subclass of it, is used by
- * {@link DataflowPersistenceHandler}s to keep information about where a
- * {@link WorkflowBundle} came from or where it was saved to.
- * 
- * @author Stian Soiland-Reyes
- */
-public class DataflowInfo {
-	private final FileType fileType;
-	private final WorkflowBundle worflowBundle;
-	private final Date lastModified;
-	private final Object canonicalSource;
-
-	public DataflowInfo(FileType fileType, Object canonicalSource,
-			WorkflowBundle worflowBundle, Date lastModified) {
-		this.fileType = fileType;
-		this.canonicalSource = canonicalSource;
-		this.worflowBundle = worflowBundle;
-		this.lastModified = lastModified;
-	}
-
-	public DataflowInfo(FileType fileType, Object canonicalSource,
-			WorkflowBundle worflowBundle) {
-		this(fileType, canonicalSource, worflowBundle, null);
-	}
-
-	/**
-	 * Return the canonical source of where the WorkflowBundle was opened from
-	 * or saved to.
-	 * <p>
-	 * This is not necessarily the source provided to
-	 * {@link FileManager#openDataflow(FileType, Object)} or
-	 * {@link FileManager#saveDataflow(WorkflowBundle, FileType, Object, boolean)}
-	 * , but it's canonical version.
-	 * <p>
-	 * For instance, if a WorkflowBundle was opened from a
-	 * File("relative/something.wfbundle) this canonical source would resolve
-	 * the relative path.
-	 * 
-	 * @return
-	 */
-	public Object getCanonicalSource() {
-		return canonicalSource;
-	}
-
-	/**
-	 * Return the WorkflowBundle that is open.
-	 * 
-	 * @return The open WorkflowBundle
-	 */
-	public WorkflowBundle getDataflow() {
-		return worflowBundle;
-	}
-
-	/**
-	 * Get the last modified {@link Date} of the source at the time when it was
-	 * opened/saved.
-	 * <p>
-	 * It is important that this value is checked on creation time, and not on
-	 * demand.
-	 * 
-	 * @return The {@link Date} of the source/destination's last modified
-	 *         timestamp, or <code>null</code> if unknown.
-	 */
-	public Date getLastModified() {
-		return lastModified;
-	}
-
-	/**
-	 * The {@link FileType} of this {@link WorkflowBundle} serialisation used
-	 * for opening/saving.
-	 * 
-	 * @return The {@link FileType}, for instance
-	 *         {@link net.sf.taverna.t2.workbench.file.impl.WorkflowBundleFileType}
-	 */
-	public FileType getFileType() {
-		return fileType;
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-file-api/src/main/java/net/sf/taverna/t2/workbench/file/DataflowPersistenceHandler.java
----------------------------------------------------------------------
diff --git a/taverna-file-api/src/main/java/net/sf/taverna/t2/workbench/file/DataflowPersistenceHandler.java b/taverna-file-api/src/main/java/net/sf/taverna/t2/workbench/file/DataflowPersistenceHandler.java
deleted file mode 100644
index 4b9234a..0000000
--- a/taverna-file-api/src/main/java/net/sf/taverna/t2/workbench/file/DataflowPersistenceHandler.java
+++ /dev/null
@@ -1,152 +0,0 @@
-/*******************************************************************************
- * 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.file;
-
-import java.io.File;
-import java.net.URL;
-import java.util.Collection;
-
-import net.sf.taverna.t2.workbench.file.exceptions.OpenException;
-import net.sf.taverna.t2.workbench.file.exceptions.SaveException;
-import org.apache.taverna.scufl2.api.container.WorkflowBundle;
-
-/**
- * A handler for opening or saving {@link WorkflowBundle} from the
- * {@link FileManager}.
- * 
- * @author Stian Soiland-Reyes
- */
-public interface DataflowPersistenceHandler {
-	/**
-	 * A collection of supported file types for
-	 * {@link #openDataflow(FileType, Object)}, or an empty collection if
-	 * opening is not supported by this handler.
-	 * 
-	 * @return A collection of supported {@link FileType}s for opening.
-	 */
-	Collection<FileType> getOpenFileTypes();
-
-	/**
-	 * A collection of supported source classes for
-	 * {@link #openDataflow(FileType, Object)}, or an empty collection if
-	 * opening is not supported by this handler.
-	 * <p>
-	 * For example, a handler that supports sources opened from a {@link File}
-	 * and {@link URL} could return
-	 * <code>Arrays.asList(File.class, URL.class)</code>
-	 * 
-	 * @return A collection of supported {@link Class}es of the open source
-	 *         types.
-	 */
-	Collection<Class<?>> getOpenSourceTypes();
-
-	/**
-	 * A collection of supported destination classes for
-	 * {@link #saveDataflow(Dataflow, FileType, Object)}, or an empty collection
-	 * if saving is not supported by this handler.
-	 * <p>
-	 * For example, a handler that supports saving to destinations that are
-	 * instances of a {@link File} could return
-	 * <code>Arrays.asList(File.class)</code>
-	 * 
-	 * @return A collection of supported {{@link Class}es of the save
-	 *         destination types.
-	 */
-	Collection<Class<?>> getSaveDestinationTypes();
-
-	/**
-	 * A collection of supported file types for
-	 * {@link #saveDataflow(WorkflowBundle, FileType, Object)}, or an empty
-	 * collection if saving is not supported by this handler.
-	 * 
-	 * @return A collection of supported {@link FileType}s for saving.
-	 */
-	Collection<FileType> getSaveFileTypes();
-
-	/**
-	 * Open a dataflow from a source containing a dataflow of the given
-	 * {@link FileType}.
-	 * <p>
-	 * The {@link FileType} will be equal to one of the types from
-	 * {@link #getOpenFileTypes()}, and the source class will be one that is
-	 * assignable to one of the classes from {@link #getOpenSourceTypes()}.
-	 * 
-	 * @param fileType
-	 *            {@link FileType} determining which serialisation method has
-	 *            been used
-	 * @param source
-	 *            Source for reading the WorkflowBundle
-	 * @return {@link DataflowInfo} describing the opened WorkflowBundle,
-	 *         including the WorkflowBundle itself
-	 * @throws OpenException
-	 *             If the WorkflowBundle could not be read, parsed or opened for
-	 *             any reason.
-	 */
-	DataflowInfo openDataflow(FileType fileType, Object source)
-			throws OpenException;
-
-	/**
-	 * Save a WorkflowBundle to a destination of the given {@link FileType}.
-	 * <p>
-	 * The {@link FileType} will be equal to one of the types from
-	 * {@link #getSaveFileTypes()}, and the destination class will be one that
-	 * is assignable to one of the classes from
-	 * {@link #getSaveDestinationTypes()}.
-	 * 
-	 * @param dataflow
-	 *            {@link WorkflowBundle} to be saved
-	 * @param fileType
-	 *            {@link FileType} determining which serialisation method to use
-	 * @param destination
-	 *            Destination for writing the WorkflowBundle
-	 * @return {@link DataflowInfo} describing the saved WorkflowBundle,
-	 *         including the WorkflowBundle itself
-	 * @throws OpenException
-	 *             If the WorkflowBundle could not be read, parsed or opened for
-	 *             any reason.
-	 */
-	DataflowInfo saveDataflow(WorkflowBundle dataflow, FileType fileType,
-			Object destination) throws SaveException;
-
-	/**
-	 * Return <code>true</code> if a call to
-	 * {@link #saveDataflow(WorkflowBundle, FileType, Object)} would overwrite
-	 * the destination, and the destination is different from last
-	 * {@link #openDataflow(FileType, Object)} or
-	 * {@link #saveDataflow(WorkflowBundle, FileType, Object)} of the given
-	 * dataflow.
-	 * 
-	 * @param dataflow
-	 *            {@link WorkflowBundle} that is to be saved
-	 * @param fileType
-	 *            {@link FileType} for saving WorkflowBundle
-	 * @param destination
-	 *            destination for writing WorkflowBundle
-	 * @param lastDataflowInfo
-	 *            last provided {@link DataflowInfo} returned by
-	 *            {@link #openDataflow(FileType, Object)} or
-	 *            {@link #saveDataflow(WorkflowBundle, FileType, Object)}. (but
-	 *            not necessarily from this handler)
-	 * @return <code>true</code> if the save would overwrite
-	 */
-	boolean wouldOverwriteDataflow(WorkflowBundle dataflow, FileType fileType,
-			Object destination, DataflowInfo lastDataflowInfo);
-}


[17/51] [partial] incubator-taverna-workbench git commit: all packages are moved to org.apache.taverna.*

Posted by re...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-graph-model/src/main/java/net/sf/taverna/t2/workbench/models/graph/GraphController.java
----------------------------------------------------------------------
diff --git a/taverna-graph-model/src/main/java/net/sf/taverna/t2/workbench/models/graph/GraphController.java b/taverna-graph-model/src/main/java/net/sf/taverna/t2/workbench/models/graph/GraphController.java
deleted file mode 100644
index bc1b7cf..0000000
--- a/taverna-graph-model/src/main/java/net/sf/taverna/t2/workbench/models/graph/GraphController.java
+++ /dev/null
@@ -1,1276 +0,0 @@
-/*******************************************************************************
- * 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.models.graph;
-
-import static javax.swing.JOptionPane.PLAIN_MESSAGE;
-import static javax.swing.JOptionPane.showInputDialog;
-import static javax.swing.JOptionPane.showMessageDialog;
-
-import java.awt.Color;
-import java.awt.Component;
-import java.awt.Dimension;
-import java.awt.Point;
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Set;
-
-import org.apache.taverna.lang.observer.Observable;
-import org.apache.taverna.lang.observer.Observer;
-import net.sf.taverna.t2.ui.menu.MenuManager;
-import net.sf.taverna.t2.workbench.configuration.colour.ColourManager;
-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.models.graph.Graph.Alignment;
-import net.sf.taverna.t2.workbench.models.graph.GraphEdge.ArrowStyle;
-import net.sf.taverna.t2.workbench.models.graph.GraphElement.LineStyle;
-import net.sf.taverna.t2.workbench.models.graph.GraphShapeElement.Shape;
-import net.sf.taverna.t2.workbench.selection.DataflowSelectionModel;
-import net.sf.taverna.t2.workbench.selection.events.DataflowSelectionMessage;
-import net.sf.taverna.t2.workflow.edits.AddDataLinkEdit;
-import net.sf.taverna.t2.workflow.edits.RemoveDataLinkEdit;
-
-import org.apache.log4j.Logger;
-
-import org.apache.taverna.scufl2.api.activity.Activity;
-import org.apache.taverna.scufl2.api.common.NamedSet;
-import org.apache.taverna.scufl2.api.common.Scufl2Tools;
-import org.apache.taverna.scufl2.api.common.WorkflowBean;
-import org.apache.taverna.scufl2.api.core.BlockingControlLink;
-import org.apache.taverna.scufl2.api.core.ControlLink;
-import org.apache.taverna.scufl2.api.core.DataLink;
-import org.apache.taverna.scufl2.api.core.Processor;
-import org.apache.taverna.scufl2.api.core.Workflow;
-import org.apache.taverna.scufl2.api.port.InputActivityPort;
-import org.apache.taverna.scufl2.api.port.InputPort;
-import org.apache.taverna.scufl2.api.port.InputProcessorPort;
-import org.apache.taverna.scufl2.api.port.InputWorkflowPort;
-import org.apache.taverna.scufl2.api.port.OutputActivityPort;
-import org.apache.taverna.scufl2.api.port.OutputPort;
-import org.apache.taverna.scufl2.api.port.OutputProcessorPort;
-import org.apache.taverna.scufl2.api.port.OutputWorkflowPort;
-import org.apache.taverna.scufl2.api.port.Port;
-import org.apache.taverna.scufl2.api.port.ProcessorPort;
-import org.apache.taverna.scufl2.api.port.ReceiverPort;
-import org.apache.taverna.scufl2.api.port.SenderPort;
-import org.apache.taverna.scufl2.api.port.WorkflowPort;
-import org.apache.taverna.scufl2.api.profiles.ProcessorBinding;
-import org.apache.taverna.scufl2.api.profiles.Profile;
-
-/**
- * @author David Withers
- */
-public abstract class GraphController implements
-		Observer<DataflowSelectionMessage> {
-	public enum PortStyle {
-		ALL {
-			@Override
-			Shape inputShape() {
-				return Shape.INVHOUSE;
-			}
-
-			@Override
-			Shape outputShape() {
-				return Shape.HOUSE;
-			}
-
-			@Override
-			Shape processorShape() {
-				return Shape.RECORD;
-			}
-		},
-		BOUND {
-			@Override
-			Shape inputShape() {
-				return Shape.INVHOUSE;
-			}
-
-			@Override
-			Shape outputShape() {
-				return Shape.HOUSE;
-			}
-
-			@Override
-			Shape processorShape() {
-				return Shape.RECORD;
-			}
-		},
-		NONE {
-			@Override
-			Shape inputShape() {
-				return Shape.BOX;
-			}
-
-			@Override
-			Shape outputShape() {
-				return Shape.BOX;
-			}
-
-			@Override
-			Shape processorShape() {
-				return Shape.BOX;
-			}
-		},
-		BLOB {
-			@Override
-			Shape inputShape() {
-				return Shape.CIRCLE;
-			}
-
-			@Override
-			Shape outputShape() {
-				return Shape.CIRCLE;
-			}
-
-			@Override
-			Shape processorShape() {
-				return Shape.CIRCLE;
-			}
-		};
-
-		abstract Shape inputShape();
-
-		abstract Shape outputShape();
-
-		abstract Shape processorShape();
-
-		Shape mergeShape() {
-			return Shape.CIRCLE;
-		}
-	}
-
-	private static Logger logger = Logger.getLogger(GraphController.class);
-
-	private Map<String, GraphElement> idToElement = new HashMap<>();
-	private Map<WorkflowBean, GraphElement> workflowToGraph = new HashMap<>();
-	private Map<Port, GraphNode> ports = new HashMap<>();
-	private Map<Graph, GraphNode> inputControls = new HashMap<>();
-	private Map<Graph, GraphNode> outputControls = new HashMap<>();
-	private Map<Port, Port> nestedWorkflowPorts = new HashMap<>();
-	private Map<WorkflowPort, ProcessorPort> workflowPortToProcessorPort = new HashMap<>();
-	private Map<Port, Processor> portToProcessor = new HashMap<>();
-
-	private EditManager editManager;
-	private final Workflow workflow;
-	private final Profile profile;
-	private DataflowSelectionModel dataflowSelectionModel;
-	private GraphEventManager graphEventManager;
-	private Component componentForPopups;
-
-	// graph settings
-	private PortStyle portStyle = PortStyle.NONE;
-	private Map<Processor, PortStyle> processorPortStyle = new HashMap<>();
-	private Alignment alignment = Alignment.VERTICAL;
-	private boolean expandNestedDataflows = true;
-	private Map<Activity, Boolean> dataflowExpansion = new HashMap<>();
-	protected Map<String, GraphElement> graphElementMap = new HashMap<>();
-	protected GraphElement edgeCreationSource, edgeCreationSink;
-	protected GraphEdge edgeMoveElement;
-	protected boolean edgeCreationFromSource = false;
-	protected boolean edgeCreationFromSink = false;
-	private Graph graph;
-	private boolean interactive;
-	private final ColourManager colourManager;
-
-	private Scufl2Tools scufl2Tools = new Scufl2Tools();
-
-	public GraphController(Workflow workflow, Profile profile,
-			boolean interactive, Component componentForPopups,
-			EditManager editManager, MenuManager menuManager,
-			ColourManager colourManager) {
-		this(workflow, profile, interactive, componentForPopups,
-				Alignment.VERTICAL, PortStyle.NONE, editManager, menuManager,
-				colourManager);
-	}
-
-	public GraphController(Workflow workflow, Profile profile,
-			boolean interactive, Component componentForPopups,
-			Alignment alignment, PortStyle portStyle, EditManager editManager,
-			MenuManager menuManager, ColourManager colourManager) {
-		this.workflow = workflow;
-		this.profile = profile;
-		this.interactive = interactive;
-		this.componentForPopups = componentForPopups;
-		this.alignment = alignment;
-		this.portStyle = portStyle;
-		this.editManager = editManager;
-		this.colourManager = colourManager;
-		this.graphEventManager = new DefaultGraphEventManager(this,
-				componentForPopups, menuManager);
-		graph = generateGraph();
-	}
-
-	public abstract Graph createGraph();
-
-	public abstract GraphNode createGraphNode();
-
-	public abstract GraphEdge createGraphEdge();
-
-	public void mapElement(String id, GraphElement element) {
-		idToElement.put(id, element);
-	}
-
-	public GraphElement getElement(String id) {
-		return idToElement.get(id);
-	}
-
-	public Graph getGraph() {
-		return graph;
-	}
-
-	public abstract void redraw();
-
-	/**
-	 * Generates a graph model of a dataflow.
-	 * 
-	 * @return
-	 */
-	public Graph generateGraph() {
-		workflowToGraph.clear();
-		ports.clear();
-		inputControls.clear();
-		outputControls.clear();
-		nestedWorkflowPorts.clear();
-		workflowPortToProcessorPort.clear();
-		graphElementMap.clear();
-		portToProcessor.clear();
-		return generateGraph(workflow, "", workflow.getName(), 0);
-	}
-
-	private Graph generateGraph(Workflow dataflow, String prefix, String name,
-			int depth) {
-		Graph graph = createGraph();
-		graph.setId(prefix + name);
-		graph.setAlignment(getAlignment());
-		if (getPortStyle().equals(PortStyle.BLOB) || depth == 0)
-			graph.setLabel("");
-		else
-			graph.setLabel(name);
-		graph.setFillColor(GraphColorManager.getSubGraphFillColor(depth));
-		if (depth == 0)
-			graph.setLineStyle(LineStyle.NONE);
-		else
-			graph.setLineStyle(LineStyle.SOLID);
-		graph.setColor(Color.BLACK);
-		graph.setShape(Shape.BOX);
-
-		if (depth == 0)
-			graph.setWorkflowBean(dataflow);
-		if (interactive)
-			graph.setWorkflowBean(dataflow);
-
-		// processors
-		for (Processor processor : dataflow.getProcessors())
-			graph.addNode(generateProcessorNode(processor, graph.getId(), depth));
-
-		// dataflow outputs
-		NamedSet<OutputWorkflowPort> outputPorts = dataflow.getOutputPorts();
-		if (outputPorts.size() > 0 || depth > 0)
-			graph.addSubgraph(generateOutputsGraph(outputPorts, graph.getId(),
-					graph, depth));
-
-		// dataflow inputs
-		NamedSet<InputWorkflowPort> inputPorts = dataflow.getInputPorts();
-		if (inputPorts.size() > 0 || depth > 0)
-			graph.addSubgraph(generateInputsGraph(inputPorts, graph.getId(),
-					graph, depth));
-
-		// datalinks
-		for (DataLink datalink : dataflow.getDataLinks()) {
-			GraphEdge edge = generateDataLinkEdge(datalink, depth);
-			if (edge != null)
-				graph.addEdge(edge);
-		}
-
-		// controlLinks
-		for (ControlLink controlLink : dataflow.getControlLinks())
-			if (controlLink instanceof BlockingControlLink) {
-				GraphEdge edge = generateControlLinkEdge(
-						(BlockingControlLink) controlLink, depth);
-				if (edge != null)
-					graph.addEdge(edge);
-			}
-
-		graphElementMap.put(graph.getId(), graph);
-		return graph;
-	}
-
-	public void transformGraph(Graph oldGraph, Graph newGraph) {
-		oldGraph.setAlignment(newGraph.getAlignment());
-		transformGraphElement(oldGraph, newGraph);
-		List<GraphEdge> oldEdges = new ArrayList<>(oldGraph.getEdges());
-		List<GraphEdge> newEdges = new ArrayList<>(newGraph.getEdges());
-		for (GraphEdge oldEdge : oldEdges) {
-			int index = newEdges.indexOf(oldEdge);
-			if (index >= 0) {
-				GraphEdge newEdge = newEdges.remove(index);
-				oldEdge.setPath(newEdge.getPath());
-				workflowToGraph.put(oldEdge.getWorkflowBean(), oldEdge);
-			} else
-				oldGraph.removeEdge(oldEdge);
-		}
-		List<GraphNode> newNodes = new ArrayList<>(newGraph.getNodes());
-		List<GraphNode> oldNodes = new ArrayList<>(oldGraph.getNodes());
-		for (GraphNode oldNode : oldNodes) {
-			int index = newNodes.indexOf(oldNode);
-			if (index >= 0) {
-				GraphNode newNode = newNodes.remove(index);
-				oldNode.setExpanded(newNode.isExpanded());
-				List<GraphNode> newSourceNodes = new ArrayList<>(
-						newNode.getSourceNodes());
-				List<GraphNode> oldSourceNodes = new ArrayList<>(
-						oldNode.getSourceNodes());
-				for (GraphNode oldSourceNode : oldSourceNodes) {
-					int sourceNodeIndex = newSourceNodes.indexOf(oldSourceNode);
-					if (sourceNodeIndex >= 0) {
-						GraphNode newSourceNode = newSourceNodes
-								.remove(sourceNodeIndex);
-						transformGraphElement(oldSourceNode, newSourceNode);
-					} else
-						oldNode.removeSourceNode(oldSourceNode);
-				}
-				for (GraphNode sourceNode : newSourceNodes)
-					oldNode.addSourceNode(sourceNode);
-				List<GraphNode> newSinkNodes = new ArrayList<>(
-						newNode.getSinkNodes());
-				List<GraphNode> oldSinkNodes = new ArrayList<>(
-						oldNode.getSinkNodes());
-				for (GraphNode oldSinkNode : oldSinkNodes) {
-					int sinkNodeIndex = newSinkNodes.indexOf(oldSinkNode);
-					if (sinkNodeIndex >= 0) {
-						GraphNode newSinkNode = newSinkNodes
-								.remove(sinkNodeIndex);
-						transformGraphElement(oldSinkNode, newSinkNode);
-					} else
-						oldNode.removeSinkNode(oldSinkNode);
-				}
-				for (GraphNode sinkNode : newSinkNodes)
-					oldNode.addSinkNode(sinkNode);
-				Graph oldSubGraph = oldNode.getGraph();
-				Graph newSubGraph = newNode.getGraph();
-				if (oldSubGraph != null && newSubGraph != null)
-					transformGraph(oldSubGraph, newSubGraph);
-				transformGraphElement(oldNode, newNode);
-			} else
-				oldGraph.removeNode(oldNode);
-		}
-		List<Graph> newSubGraphs = new ArrayList<>(newGraph.getSubgraphs());
-		List<Graph> oldSubGraphs = new ArrayList<>(oldGraph.getSubgraphs());
-		for (Graph oldSubGraph : oldSubGraphs) {
-			int index = newSubGraphs.indexOf(oldSubGraph);
-			if (index >= 0) {
-				Graph newSubGraph = newSubGraphs.remove(index);
-				transformGraph(oldSubGraph, newSubGraph);
-			} else
-				oldGraph.removeSubgraph(oldSubGraph);
-		}
-		for (GraphNode node : newNodes)
-			oldGraph.addNode(node);
-		for (Graph graph : newSubGraphs)
-			oldGraph.addSubgraph(graph);
-		for (GraphEdge newEdge : newEdges)
-			oldGraph.addEdge(newEdge);
-	}
-
-	public void transformGraphElement(GraphShapeElement oldGraphElement,
-			GraphShapeElement newGraphElement) {
-		oldGraphElement.setWorkflowBean(newGraphElement.getWorkflowBean());
-		oldGraphElement.setShape(newGraphElement.getShape());
-		oldGraphElement.setSize(newGraphElement.getSize());
-		oldGraphElement.setPosition(newGraphElement.getPosition());
-		oldGraphElement.setLabel(newGraphElement.getLabel());
-		oldGraphElement.setLabelPosition(newGraphElement.getLabelPosition());
-		oldGraphElement.setLineStyle(newGraphElement.getLineStyle());
-		oldGraphElement.setOpacity(newGraphElement.getOpacity());
-		oldGraphElement.setVisible(newGraphElement.isVisible());
-		oldGraphElement.setColor(newGraphElement.getColor());
-		oldGraphElement.setFillColor(newGraphElement.getFillColor());
-		workflowToGraph.put(oldGraphElement.getWorkflowBean(), oldGraphElement);
-	}
-
-	public void filterGraph(Set<?> dataflowEntities) {
-		Set<GraphElement> graphElements = new HashSet<>();
-		for (Entry<WorkflowBean, GraphElement> entry : workflowToGraph
-				.entrySet())
-			if (!dataflowEntities.contains(entry.getKey()))
-				graphElements.add(entry.getValue());
-		filterGraph(getGraph(), graphElements);
-	}
-
-	private void filterGraph(Graph graph, Set<GraphElement> graphElements) {
-		for (GraphNode node : graph.getNodes()) {
-			node.setFiltered(graphElements.contains(node));
-			Graph subgraph = node.getGraph();
-			if (subgraph != null)
-				if (graphElements.contains(subgraph)) {
-					removeFilter(subgraph);
-					subgraph.setFiltered(true);
-				} else {
-					subgraph.setFiltered(false);
-					filterGraph(subgraph, graphElements);
-				}
-		}
-		for (GraphEdge edge : graph.getEdges())
-			edge.setFiltered(graphElements.contains(edge));
-		for (Graph subgraph : graph.getSubgraphs())
-			if (graphElements.contains(subgraph)) {
-				removeFilter(subgraph);
-				subgraph.setFiltered(true);
-			} else {
-				subgraph.setFiltered(false);
-				filterGraph(subgraph, graphElements);
-			}
-	}
-
-	public void removeFilter() {
-		for (Entry<WorkflowBean, GraphElement> entry : workflowToGraph
-				.entrySet())
-			entry.getValue().setFiltered(false);
-	}
-
-	private void removeFilter(Graph graph) {
-		for (GraphNode node : graph.getNodes()) {
-			node.setOpacity(1f);
-			Graph subgraph = node.getGraph();
-			if (subgraph != null) {
-				subgraph.setFiltered(false);
-				removeFilter(subgraph);
-			}
-		}
-		for (GraphEdge edge : graph.getEdges())
-			edge.setFiltered(false);
-		for (Graph subgraph : graph.getSubgraphs()) {
-			subgraph.setFiltered(false);
-			removeFilter(subgraph);
-		}
-	}
-
-	private GraphEdge generateControlLinkEdge(BlockingControlLink condition,
-			int depth) {
-		GraphEdge edge = null;
-		GraphElement source = workflowToGraph.get(condition.getUntilFinished());
-		GraphElement sink = workflowToGraph.get(condition.getBlock());
-		if (source != null && sink != null) {
-			edge = createGraphEdge();
-			if (source instanceof Graph)
-				edge.setSource(outputControls.get(source));
-			else if (source instanceof GraphNode)
-				edge.setSource((GraphNode) source);
-			if (sink instanceof Graph)
-				edge.setSink(inputControls.get(sink));
-			else if (sink instanceof GraphNode)
-				edge.setSink((GraphNode) sink);
-			String sourceId = edge.getSource().getId();
-			String sinkId = edge.getSink().getId();
-			edge.setId(sourceId + "->" + sinkId);
-			edge.setLineStyle(LineStyle.SOLID);
-			edge.setColor(Color.decode("#505050"));
-			edge.setFillColor(null);
-			edge.setArrowHeadStyle(ArrowStyle.DOT);
-			if (depth == 0)
-				edge.setWorkflowBean(condition);
-			if (interactive)
-				edge.setWorkflowBean(condition);
-			workflowToGraph.put(condition, edge);
-			graphElementMap.put(edge.getId(), edge);
-		}
-		return edge;
-	}
-
-	private GraphEdge generateDataLinkEdge(DataLink datalink, int depth) {
-		GraphEdge edge = null;
-		Port sourcePort = datalink.getReceivesFrom();
-		Port sinkPort = datalink.getSendsTo();
-		if (nestedWorkflowPorts.containsKey(sourcePort))
-			sourcePort = nestedWorkflowPorts.get(sourcePort);
-		if (nestedWorkflowPorts.containsKey(sinkPort))
-			sinkPort = nestedWorkflowPorts.get(sinkPort);
-		GraphNode sourceNode = ports.get(sourcePort);
-		GraphNode sinkNode = ports.get(sinkPort);
-		if (sourceNode != null && sinkNode != null) {
-			edge = createGraphEdge();
-			edge.setSource(sourceNode);
-			edge.setSink(sinkNode);
-
-			StringBuilder id = new StringBuilder();
-			if (sourceNode.getParent() instanceof GraphNode) {
-				id.append(sourceNode.getParent().getId());
-				id.append(":");
-				id.append(sourceNode.getId());
-			} else
-				id.append(sourceNode.getId());
-			id.append("->");
-			if (sinkNode.getParent() instanceof GraphNode) {
-				id.append(sinkNode.getParent().getId());
-				id.append(":");
-				id.append(sinkNode.getId());
-			} else
-				id.append(sinkNode.getId());
-			edge.setId(id.toString());
-			edge.setLineStyle(LineStyle.SOLID);
-			edge.setColor(Color.BLACK);
-			edge.setFillColor(Color.BLACK);
-			if (depth == 0)
-				edge.setWorkflowBean(datalink);
-			if (interactive)
-				edge.setWorkflowBean(datalink);
-			workflowToGraph.put(datalink, edge);
-			graphElementMap.put(edge.getId(), edge);
-		}
-		return edge;
-	}
-
-	private Graph generateInputsGraph(NamedSet<InputWorkflowPort> inputPorts,
-			String prefix, Graph graph, int depth) {
-		Graph inputs = createGraph();
-		inputs.setId(prefix + "sources");
-		inputs.setColor(Color.BLACK);
-		inputs.setFillColor(null);
-		inputs.setShape(Shape.BOX);
-		inputs.setLineStyle(LineStyle.DOTTED);
-		if (getPortStyle().equals(PortStyle.BLOB))
-			inputs.setLabel("");
-		else
-			inputs.setLabel("Workflow input ports");
-
-		GraphNode triangle = createGraphNode();
-		triangle.setId(prefix + "WORKFLOWINTERNALSOURCECONTROL");
-		triangle.setLabel("");
-		triangle.setShape(Shape.TRIANGLE);
-		triangle.setSize(new Dimension((int) (0.2f * 72), (int) ((Math.sin(Math
-				.toRadians(60)) * 0.2) * 72)));
-		triangle.setFillColor(Color.decode("#ff4040"));
-		triangle.setColor(Color.BLACK);
-		triangle.setLineStyle(LineStyle.SOLID);
-		inputs.addNode(triangle);
-		inputControls.put(graph, triangle);
-
-		for (InputWorkflowPort inputWorkflowPort : inputPorts) {
-			GraphNode inputNode = createGraphNode();
-			inputNode.setId(prefix + "WORKFLOWINTERNALSOURCE_"
-					+ inputWorkflowPort.getName());
-			if (getPortStyle().equals(PortStyle.BLOB)) {
-				inputNode.setLabel("");
-				inputNode.setSize(new Dimension((int) (0.3f * 72),
-						(int) (0.3f * 72)));
-			} else
-				inputNode.setLabel(inputWorkflowPort.getName());
-			inputNode.setShape(getPortStyle().inputShape());
-			inputNode.setColor(Color.BLACK);
-			inputNode.setLineStyle(LineStyle.SOLID);
-			inputNode.setFillColor(Color.decode("#8ed6f0"));
-			if (depth == 0)
-				inputNode.setInteractive(true);
-			if (interactive)
-				inputNode.setInteractive(true);
-			if (depth < 2) {
-				inputNode.setWorkflowBean(inputWorkflowPort);
-				if (workflowPortToProcessorPort.containsKey(inputWorkflowPort)) {
-					ProcessorPort port = workflowPortToProcessorPort
-							.get(inputWorkflowPort);
-					inputNode.setWorkflowBean(port);
-					workflowToGraph.put(port, inputNode);
-				} else {
-					inputNode.setWorkflowBean(inputWorkflowPort);
-					workflowToGraph.put(inputWorkflowPort, inputNode);
-				}
-			}
-			ports.put(inputWorkflowPort, inputNode);
-			inputs.addNode(inputNode);
-			graphElementMap.put(inputNode.getId(), inputNode);
-		}
-		return inputs;
-	}
-
-	private Graph generateOutputsGraph(
-			NamedSet<OutputWorkflowPort> outputPorts, String prefix,
-			Graph graph, int depth) {
-		Graph outputs = createGraph();
-		outputs.setId(prefix + "sinks");
-		outputs.setColor(Color.BLACK);
-		outputs.setFillColor(null);
-		outputs.setShape(Shape.BOX);
-		outputs.setLineStyle(LineStyle.DOTTED);
-		if (getPortStyle().equals(PortStyle.BLOB))
-			outputs.setLabel("");
-		else
-			outputs.setLabel("Workflow output ports");
-
-		GraphNode triangle = createGraphNode();
-		triangle.setId(prefix + "WORKFLOWINTERNALSINKCONTROL");
-		triangle.setLabel("");
-		triangle.setShape(Shape.INVTRIANGLE);
-		triangle.setSize(new Dimension((int) (0.2f * 72), (int) ((Math.sin(Math
-				.toRadians(60)) * 0.2) * 72)));
-		triangle.setFillColor(Color.decode("#66cd00"));
-		triangle.setColor(Color.BLACK);
-		triangle.setLineStyle(LineStyle.SOLID);
-		outputs.addNode(triangle);
-		outputControls.put(graph, triangle);
-
-		for (OutputWorkflowPort outputWorkflowPort : outputPorts) {
-			GraphNode outputNode = createGraphNode();
-			outputNode.setId(prefix + "WORKFLOWINTERNALSINK_"
-					+ outputWorkflowPort.getName());
-			if (getPortStyle().equals(PortStyle.BLOB)) {
-				outputNode.setLabel("");
-				outputNode.setSize(new Dimension((int) (0.3f * 72),
-						(int) (0.3f * 72)));
-			} else
-				outputNode.setLabel(outputWorkflowPort.getName());
-			outputNode.setShape(getPortStyle().outputShape());
-			outputNode.setColor(Color.BLACK);
-			outputNode.setLineStyle(LineStyle.SOLID);
-			outputNode.setFillColor(Color.decode("#8ed6f0"));
-			if (depth == 0)
-				outputNode.setInteractive(true);
-			if (interactive)
-				outputNode.setInteractive(true);
-			if (depth < 2) {
-				if (workflowPortToProcessorPort.containsKey(outputWorkflowPort)) {
-					ProcessorPort port = workflowPortToProcessorPort
-							.get(outputWorkflowPort);
-					outputNode.setWorkflowBean(port);
-					workflowToGraph.put(port, outputNode);
-				} else {
-					outputNode.setWorkflowBean(outputWorkflowPort);
-					workflowToGraph.put(outputWorkflowPort, outputNode);
-				}
-			}
-			ports.put(outputWorkflowPort, outputNode);
-			outputs.addNode(outputNode);
-			graphElementMap.put(outputNode.getId(), outputNode);
-		}
-		return outputs;
-	}
-
-	private GraphNode generateProcessorNode(Processor processor, String prefix,
-			int depth) {
-		// Blatantly ignoring any other activities for now
-		ProcessorBinding processorBinding = scufl2Tools
-				.processorBindingForProcessor(processor, profile);
-		Activity activity = processorBinding.getBoundActivity();
-		@SuppressWarnings("unused")
-		URI activityType = activity.getType();
-
-		GraphNode node = createGraphNode();
-		node.setId(prefix + processor.getName());
-		if (getPortStyle().equals(PortStyle.BLOB)) {
-			node.setLabel("");
-			node.setSize(new Dimension((int) (0.3f * 72), (int) (0.3f * 72)));
-		} else
-			node.setLabel(processor.getName());
-		node.setShape(getPortStyle(processor).processorShape());
-		node.setColor(Color.BLACK);
-		node.setLineStyle(LineStyle.SOLID);
-		// if (activityType.equals(URI.create(NonExecutableActivity.URI))) {
-		// if (activityType.equals(URI.create(DisabledActivity.URI))) {
-		// node.setFillColor(GraphColorManager
-		// .getFillColor(((DisabledActivity) activity)
-		// .getActivity(), colourManager));
-		// } else {
-		// node.setFillColor(GraphColorManager
-		// .getFillColor(activityType, colourManager));
-		// }
-		// node.setOpacity(0.3f);
-		// } else
-		node.setFillColor(GraphColorManager.getFillColor(activity,
-				colourManager));
-
-		// check whether the nested workflow processors should be clickable or
-		// not, if top level workflow then should be clickable regardless
-		if (depth == 0) {
-			node.setInteractive(true);
-			node.setWorkflowBean(processor);
-		}
-		if (interactive) {
-			node.setInteractive(true);
-			node.setWorkflowBean(processor);
-		}
-
-		if (scufl2Tools.containsNestedWorkflow(processor, profile)
-				&& expandNestedDataflow(activity)) {
-			Workflow subDataflow = scufl2Tools.nestedWorkflowForProcessor(
-					processor, profile);
-
-			NamedSet<InputWorkflowPort> inputWorkflowPorts = subDataflow
-					.getInputPorts();
-			for (InputActivityPort inputActivityPort : activity.getInputPorts()) {
-				InputWorkflowPort inputWorkflowPort = inputWorkflowPorts
-						.getByName(inputActivityPort.getName());
-				InputProcessorPort inputProcessorPort = scufl2Tools
-						.processorPortBindingForPort(inputActivityPort, profile)
-						.getBoundProcessorPort();
-				nestedWorkflowPorts.put(inputProcessorPort, inputWorkflowPort);
-				workflowPortToProcessorPort.put(inputWorkflowPort,
-						inputProcessorPort);
-				processorBinding.getInputPortBindings();
-			}
-
-			NamedSet<OutputWorkflowPort> outputWorkflowPorts = subDataflow
-					.getOutputPorts();
-			for (OutputActivityPort outputActivityPort : activity
-					.getOutputPorts()) {
-				OutputWorkflowPort outputWorkflowPort = outputWorkflowPorts
-						.getByName(outputActivityPort.getName());
-				OutputProcessorPort outputProcessorPort = scufl2Tools
-						.processorPortBindingForPort(outputActivityPort,
-								profile).getBoundProcessorPort();
-				nestedWorkflowPorts
-						.put(outputProcessorPort, outputWorkflowPort);
-				workflowPortToProcessorPort.put(outputWorkflowPort,
-						outputProcessorPort);
-			}
-
-			Graph subGraph = generateGraph(subDataflow, prefix,
-					processor.getName(), depth + 1);
-			// TODO why does this depth matter?
-			if (depth == 0)
-				subGraph.setWorkflowBean(processor);
-			if (interactive)
-				subGraph.setWorkflowBean(processor);
-			node.setGraph(subGraph);
-			node.setExpanded(true);
-
-			workflowToGraph.put(processor, subGraph);
-		} else {
-			graphElementMap.put(node.getId(), node);
-			workflowToGraph.put(processor, node);
-		}
-
-		NamedSet<InputProcessorPort> inputPorts = processor.getInputPorts();
-		if (inputPorts.size() == 0) {
-			GraphNode portNode = createGraphNode();
-			portNode.setShape(Shape.BOX);
-			portNode.setColor(Color.BLACK);
-			portNode.setFillColor(node.getFillColor());
-			portNode.setLineStyle(LineStyle.SOLID);
-			node.addSinkNode(portNode);
-		} else
-			for (InputPort inputPort : inputPorts) {
-				GraphNode portNode = createGraphNode();
-				portNode.setId("i" + inputPort.getName().replaceAll("\\.", ""));
-				portNode.setLabel(inputPort.getName());
-				portNode.setShape(Shape.BOX);
-				portNode.setColor(Color.BLACK);
-				portNode.setFillColor(node.getFillColor());
-				portNode.setLineStyle(LineStyle.SOLID);
-				if (depth == 0)
-					portNode.setWorkflowBean(inputPort);
-				if (interactive)
-					portNode.setWorkflowBean(inputPort);
-				if (!node.isExpanded())
-					workflowToGraph.put(inputPort, portNode);
-				ports.put(inputPort, portNode);
-				node.addSinkNode(portNode);
-				graphElementMap.put(portNode.getId(), portNode);
-				// portToActivity.put(inputPort, activity);
-				portToProcessor.put(inputPort, processor);
-			}
-
-		NamedSet<OutputProcessorPort> outputPorts = processor.getOutputPorts();
-		if (outputPorts.size() == 0) {
-			GraphNode portNode = createGraphNode();
-			portNode.setShape(Shape.BOX);
-			portNode.setColor(Color.BLACK);
-			portNode.setFillColor(node.getFillColor());
-			portNode.setLineStyle(LineStyle.SOLID);
-			node.addSourceNode(portNode);
-		} else
-			for (OutputPort outputPort : outputPorts) {
-				GraphNode portNode = createGraphNode();
-				portNode.setId("o" + outputPort.getName().replaceAll("\\.", ""));
-				portNode.setLabel(outputPort.getName());
-				portNode.setShape(Shape.BOX);
-				portNode.setColor(Color.BLACK);
-				portNode.setFillColor(node.getFillColor());
-				portNode.setLineStyle(LineStyle.SOLID);
-				if (depth == 0)
-					portNode.setWorkflowBean(outputPort);
-				if (interactive)
-					portNode.setWorkflowBean(outputPort);
-				if (!node.isExpanded())
-					workflowToGraph.put(outputPort, portNode);
-				ports.put(outputPort, portNode);
-				node.addSourceNode(portNode);
-				graphElementMap.put(portNode.getId(), portNode);
-				// portToActivity.put(outputPort, activity);
-				portToProcessor.put(outputPort, processor);
-			}
-
-		return node;
-	}
-
-	/**
-	 * Returns the dataflow.
-	 * 
-	 * @return the dataflow
-	 */
-	public Workflow getWorkflow() {
-		return workflow;
-	}
-
-	public Profile getProfile() {
-		return profile;
-	}
-
-	/**
-	 * Returns the dataflowSelectionModel.
-	 * 
-	 * @return the dataflowSelectionModel
-	 */
-	public DataflowSelectionModel getDataflowSelectionModel() {
-		return dataflowSelectionModel;
-	}
-
-	/**
-	 * Sets the dataflowSelectionModel.
-	 * 
-	 * @param dataflowSelectionModel
-	 *            the new dataflowSelectionModel
-	 */
-	public void setDataflowSelectionModel(
-			DataflowSelectionModel dataflowSelectionModel) {
-		if (this.dataflowSelectionModel != null)
-			this.dataflowSelectionModel.removeObserver(this);
-		this.dataflowSelectionModel = dataflowSelectionModel;
-		this.dataflowSelectionModel.addObserver(this);
-	}
-
-	/**
-	 * Sets the proportion of the node's jobs that have been completed.
-	 * 
-	 * @param nodeId
-	 *            the id of the node
-	 * @param complete
-	 *            the proportion of the nodes's jobs that have been completed, a
-	 *            value between 0.0 and 1.0
-	 */
-	public void setNodeCompleted(String nodeId, float complete) {
-		if (graphElementMap.containsKey(nodeId)) {
-			GraphElement graphElement = graphElementMap.get(nodeId);
-			graphElement.setCompleted(complete);
-		}
-	}
-
-	public void setEdgeActive(String edgeId, boolean active) {
-	}
-
-	/**
-	 * Returns the alignment.
-	 * 
-	 * @return the alignment
-	 */
-	public Alignment getAlignment() {
-		return alignment;
-	}
-
-	/**
-	 * Returns the portStyle.
-	 * 
-	 * @return the portStyle
-	 */
-	public PortStyle getPortStyle() {
-		return portStyle;
-	}
-
-	/**
-	 * Returns the portStyle for a processor.
-	 * 
-	 * @return the portStyle for a processor
-	 */
-	public PortStyle getPortStyle(Processor processor) {
-		if (processorPortStyle.containsKey(processor))
-			return processorPortStyle.get(processor);
-		return portStyle;
-	}
-
-	/**
-	 * Sets the alignment.
-	 * 
-	 * @param alignment
-	 *            the new alignment
-	 */
-	public void setAlignment(Alignment alignment) {
-		this.alignment = alignment;
-	}
-
-	/**
-	 * Sets the portStyle.
-	 * 
-	 * @param style
-	 *            the new portStyle
-	 */
-	public void setPortStyle(PortStyle portStyle) {
-		this.portStyle = portStyle;
-		processorPortStyle.clear();
-	}
-
-	/**
-	 * Sets the portStyle for a processor.
-	 * 
-	 * @param style
-	 *            the new portStyle for the processor
-	 */
-	public void setPortStyle(Processor processor, PortStyle portStyle) {
-		processorPortStyle.put(processor, portStyle);
-	}
-
-	/**
-	 * Shut down any processing and update threads related to this controller.
-	 * 
-	 */
-	public void shutdown() {
-	}
-
-	/**
-	 * Returns true if the default is to expand nested workflows.
-	 * 
-	 * @return true if the default is to expand nested workflows
-	 */
-	public boolean expandNestedDataflows() {
-		return expandNestedDataflows;
-	}
-
-	/**
-	 * Returns true if the nested dataflow should be expanded.
-	 * 
-	 * @param dataflow
-	 * @return true if the nested dataflow should be expanded
-	 */
-	public boolean expandNestedDataflow(Activity dataflow) {
-		if (dataflowExpansion.containsKey(dataflow))
-			return dataflowExpansion.get(dataflow);
-		return expandNestedDataflows;
-	}
-
-	/**
-	 * Sets the default for expanding nested workflows.
-	 * 
-	 * @param expand
-	 *            the default for expanding nested workflows
-	 */
-	public void setExpandNestedDataflows(boolean expand) {
-		dataflowExpansion.clear();
-		this.expandNestedDataflows = expand;
-	}
-
-	/**
-	 * Sets whether the nested dataflow should be expanded.
-	 * 
-	 * @param expand
-	 *            whether the nested dataflow should be expanded
-	 * @param dataflow
-	 *            the nested dataflow
-	 */
-	public void setExpandNestedDataflow(Activity dataflow, boolean expand) {
-		dataflowExpansion.put(dataflow, expand);
-	}
-
-	private boolean isSingleOutputProcessor(Object dataflowObject) {
-		boolean result = false;
-		if (dataflowObject instanceof Processor) {
-			Processor processor = (Processor) dataflowObject;
-			result = processor.getOutputPorts().size() == 1;
-		}
-		return result;
-	}
-
-	public boolean startEdgeCreation(GraphElement graphElement, Point point) {
-		if (!edgeCreationFromSource && !edgeCreationFromSink) {
-			Object dataflowObject = graphElement.getWorkflowBean();
-			if (dataflowObject instanceof ReceiverPort) {
-				edgeCreationSink = graphElement;
-				edgeCreationFromSink = true;
-			} else if (dataflowObject instanceof SenderPort
-					|| isSingleOutputProcessor(dataflowObject)) {
-				edgeCreationSource = graphElement;
-				edgeCreationFromSource = true;
-			} else if (graphElement instanceof GraphEdge) {
-				GraphEdge edge = (GraphEdge) graphElement;
-				edgeCreationSource = edge.getSource();
-				edgeCreationFromSource = true;
-				edgeMoveElement = edge;
-			}
-		}
-		return edgeCreationFromSource || edgeCreationFromSink;
-	}
-
-	public boolean moveEdgeCreationTarget(GraphElement graphElement, Point point) {
-		boolean edgeValid = false;
-		Object dataflowObject = graphElement.getWorkflowBean();
-		if (edgeCreationFromSink) {
-			if (graphElement instanceof GraphNode) {
-				Object sinkObject = edgeCreationSink.getWorkflowBean();
-				if (dataflowObject instanceof OutputPort) {
-					Processor sourceProcessor = portToProcessor
-							.get(dataflowObject);
-					if (sourceProcessor != null) {
-						Processor sinkProcessor = null;
-						if (sinkObject instanceof Processor)
-							sinkProcessor = (Processor) sinkObject;
-						else if (portToProcessor.containsKey(sinkObject))
-							sinkProcessor = portToProcessor.get(sinkObject);
-						if (sinkProcessor != null) {
-							Set<Processor> possibleSinkProcessors = scufl2Tools
-									.possibleDownStreamProcessors(workflow,
-											sourceProcessor);
-							if (possibleSinkProcessors.contains(sinkProcessor)) {
-								edgeCreationSource = graphElement;
-								edgeValid = true;
-							}
-						}
-						if (sinkObject instanceof OutputWorkflowPort) {
-							edgeCreationSource = graphElement;
-							edgeValid = true;
-						}
-					}
-				} else if (dataflowObject instanceof InputWorkflowPort) {
-					edgeCreationSource = graphElement;
-					edgeValid = true;
-				} else if (dataflowObject instanceof Processor) {
-					Processor sourceProcessor = (Processor) dataflowObject;
-					Processor sinkProcessor = null;
-					if (sinkObject instanceof Processor)
-						sinkProcessor = (Processor) sinkObject;
-					else if (portToProcessor.containsKey(sinkObject))
-						sinkProcessor = portToProcessor.get(sinkObject);
-					if (sinkProcessor != null) {
-						Set<Processor> possibleSinkProcessors = scufl2Tools
-								.possibleDownStreamProcessors(workflow,
-										sourceProcessor);
-						if (possibleSinkProcessors.contains(sinkProcessor)) {
-							edgeCreationSource = graphElement;
-							edgeValid = true;
-						}
-					}
-					if (sinkObject instanceof OutputWorkflowPort) {
-						edgeCreationSource = graphElement;
-						edgeValid = true;
-					}
-				}
-			}
-			if (!edgeValid)
-				edgeCreationSource = null;
-		} else if (edgeCreationFromSource) {
-			if (graphElement instanceof GraphNode) {
-				Object sourceObject = edgeCreationSource.getWorkflowBean();
-				if (dataflowObject instanceof InputPort) {
-					Processor sinkProcessor = portToProcessor
-							.get(dataflowObject);
-					if (sinkProcessor != null) {
-						Processor sourceProcessor = null;
-						if (sourceObject instanceof Processor)
-							sourceProcessor = (Processor) sourceObject;
-						else if (portToProcessor.containsKey(sourceObject))
-							sourceProcessor = portToProcessor.get(sourceObject);
-						if (sourceProcessor != null) {
-							Set<Processor> possibleSourceProcessors = scufl2Tools
-									.possibleUpStreamProcessors(workflow,
-											sinkProcessor);
-							if (possibleSourceProcessors
-									.contains(sourceProcessor)) {
-								edgeCreationSink = graphElement;
-								edgeValid = true;
-							}
-						}
-						if (sourceObject instanceof InputWorkflowPort) {
-							edgeCreationSink = graphElement;
-							edgeValid = true;
-						}
-					}
-				} else if (dataflowObject instanceof OutputWorkflowPort) {
-					if (sourceObject != null) {
-						edgeCreationSink = graphElement;
-						edgeValid = true;
-					}
-				} else if (dataflowObject instanceof Processor) {
-					Processor sinkProcessor = (Processor) dataflowObject;
-					Processor sourceProcessor = null;
-					if (sourceObject instanceof Processor)
-						sourceProcessor = (Processor) sourceObject;
-					else if (portToProcessor.containsKey(sourceObject))
-						sourceProcessor = portToProcessor.get(sourceObject);
-					if (sourceProcessor != null) {
-						Set<Processor> possibleSourceProcessors = scufl2Tools
-								.possibleUpStreamProcessors(workflow,
-										sinkProcessor);
-						if (possibleSourceProcessors.contains(sourceProcessor)) {
-							edgeCreationSink = graphElement;
-							edgeValid = true;
-						}
-					}
-					if (sourceObject instanceof InputWorkflowPort) {
-						edgeCreationSink = graphElement;
-						edgeValid = true;
-					}
-				}
-			}
-			if (!edgeValid)
-				edgeCreationSink = null;
-		}
-		return edgeValid;
-	}
-
-	public boolean stopEdgeCreation(GraphElement graphElement, Point point) {
-		boolean edgeCreated = false;
-		if (edgeCreationSource != null && edgeCreationSink != null) {
-			SenderPort source = null;
-			ReceiverPort sink = null;
-			Object sourceDataflowObject = edgeCreationSource.getWorkflowBean();
-			Object sinkDataflowObject = edgeCreationSink.getWorkflowBean();
-			if (sourceDataflowObject instanceof SenderPort)
-				source = (SenderPort) sourceDataflowObject;
-			else if (sourceDataflowObject instanceof Processor) {
-				Processor processor = (Processor) sourceDataflowObject;
-				source = showPortOptions(processor.getOutputPorts(), "output",
-						componentForPopups, point);
-			}
-			if (sinkDataflowObject instanceof ReceiverPort)
-				sink = (ReceiverPort) sinkDataflowObject;
-			else if (sinkDataflowObject instanceof Processor) {
-				Processor processor = (Processor) sinkDataflowObject;
-				sink = showPortOptions(processor.getInputPorts(), "input",
-						componentForPopups, point);
-			}
-			if (source != null && sink != null) {
-				Edit<?> edit = null;
-				if (edgeMoveElement == null) {
-					DataLink dataLink = new DataLink();
-					dataLink.setReceivesFrom(source);
-					dataLink.setSendsTo(sink);
-					edit = new AddDataLinkEdit(workflow, dataLink);
-				} else {
-					Object existingSink = edgeMoveElement.getSink()
-							.getWorkflowBean();
-					if (existingSink != sink) {
-						List<Edit<?>> editList = new ArrayList<Edit<?>>();
-						DataLink existingDataLink = (DataLink) edgeMoveElement
-								.getWorkflowBean();
-						DataLink newDataLink = new DataLink();
-						newDataLink.setReceivesFrom(existingDataLink
-								.getReceivesFrom());
-						newDataLink.setSendsTo(sink);
-						editList.add(new RemoveDataLinkEdit(workflow,
-								existingDataLink));
-						editList.add(new AddDataLinkEdit(workflow, newDataLink));
-						edit = new CompoundEdit(editList);
-					}
-				}
-				try {
-					if (edit != null) {
-						editManager.doDataflowEdit(workflow.getParent(), edit);
-						edgeCreated = true;
-					}
-				} catch (EditException e) {
-					logger.debug("Failed to create datalink from '"
-							+ source.getName() + "' to '" + sink.getName()
-							+ "'");
-				}
-			}
-		}
-		edgeCreationSource = null;
-		edgeCreationSink = null;
-		edgeMoveElement = null;
-		edgeCreationFromSource = false;
-		edgeCreationFromSink = false;
-
-		return edgeCreated;
-	}
-
-	private <T extends Port> T showPortOptions(NamedSet<T> ports,
-			String portType, Component component, Point point) {
-		T result = null;
-		if (ports.size() == 0) {
-			showMessageDialog(component, "Service has no " + portType
-					+ " ports to connect to");
-		} else if (ports.size() == 1)
-			result = ports.first();
-		else {
-			Object[] portNames = ports.getNames().toArray();
-			String portName = (String) showInputDialog(component, "Select an "
-					+ portType + " port", "Port Chooser", PLAIN_MESSAGE, null,
-					portNames, portNames[0]);
-			if (portName != null)
-				result = ports.getByName(portName);
-		}
-		return result;
-
-	}
-
-	public void resetSelection() {
-		if (dataflowSelectionModel != null)
-			for (Object dataflowElement : dataflowSelectionModel.getSelection()) {
-				GraphElement graphElement = workflowToGraph
-						.get(dataflowElement);
-				if (graphElement != null)
-					graphElement.setSelected(true);
-			}
-	}
-
-	public void setIteration(String nodeId, int iteration) {
-		if (graphElementMap.containsKey(nodeId)) {
-			GraphElement graphElement = graphElementMap.get(nodeId);
-			graphElement.setIteration(iteration);
-		}
-	}
-
-	public void setErrors(String nodeId, int errors) {
-		if (graphElementMap.containsKey(nodeId)) {
-			GraphElement graphElement = graphElementMap.get(nodeId);
-			graphElement.setErrors(errors);
-		}
-	}
-
-	@Override
-	public void notify(Observable<DataflowSelectionMessage> sender,
-			DataflowSelectionMessage message) throws Exception {
-		GraphElement graphElement = workflowToGraph.get(message.getElement());
-		if (graphElement != null)
-			graphElement.setSelected(message.getType().equals(
-					DataflowSelectionMessage.Type.ADDED));
-	}
-
-	/**
-	 * Returns the GraphEventManager.
-	 * 
-	 * @return the GraphEventManager
-	 */
-	public GraphEventManager getGraphEventManager() {
-		return graphEventManager;
-	}
-
-	/**
-	 * Sets the GraphEventManager.
-	 * 
-	 * @param graphEventManager
-	 *            the new GraphEventManager
-	 */
-	public void setGraphEventManager(GraphEventManager graphEventManager) {
-		this.graphEventManager = graphEventManager;
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-graph-model/src/main/java/net/sf/taverna/t2/workbench/models/graph/GraphEdge.java
----------------------------------------------------------------------
diff --git a/taverna-graph-model/src/main/java/net/sf/taverna/t2/workbench/models/graph/GraphEdge.java b/taverna-graph-model/src/main/java/net/sf/taverna/t2/workbench/models/graph/GraphEdge.java
deleted file mode 100644
index d1348d2..0000000
--- a/taverna-graph-model/src/main/java/net/sf/taverna/t2/workbench/models/graph/GraphEdge.java
+++ /dev/null
@@ -1,137 +0,0 @@
-/*******************************************************************************
- * 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.models.graph;
-
-import java.awt.Point;
-import java.util.List;
-
-/**
- * An edge connecting two nodes in a graph.
- *
- * @author David Withers
- */
-public class GraphEdge extends GraphElement {
-	public enum ArrowStyle {NONE, NORMAL, DOT}
-
-	private GraphNode source;
-	private GraphNode sink;
-	private ArrowStyle arrowHeadStyle = ArrowStyle.NORMAL;
-	private ArrowStyle arrowTailStyle = ArrowStyle.NONE;
-	private List<Point> path;
-
-	/**
-	 * Constructs a new instance of Edge.
-	 *
-	 */
-	public GraphEdge(GraphController graphController) {
-		super(graphController);
-	}
-
-	/**
-	 * Returns the source.
-	 *
-	 * @return the source
-	 */
-	public GraphNode getSource() {
-		return source;
-	}
-
-	/**
-	 * Sets the source.
-	 *
-	 * @param source the new source
-	 */
-	public void setSource(GraphNode source) {
-		this.source = source;
-	}
-
-	/**
-	 * Returns the sink.
-	 *
-	 * @return the sink
-	 */
-	public GraphNode getSink() {
-		return sink;
-	}
-
-	/**
-	 * Sets the sink.
-	 *
-	 * @param sink the new sink
-	 */
-	public void setSink(GraphNode sink) {
-		this.sink = sink;
-	}
-
-	/**
-	 * Returns the arrowHeadStyle.
-	 *
-	 * @return the arrowHeadStyle
-	 */
-	public ArrowStyle getArrowHeadStyle() {
-		return arrowHeadStyle;
-	}
-
-	/**
-	 * Sets the arrowHeadStyle.
-	 *
-	 * @param arrowHeadStyle the new arrowHeadStyle
-	 */
-	public void setArrowHeadStyle(ArrowStyle arrowHeadStyle) {
-		this.arrowHeadStyle = arrowHeadStyle;
-	}
-
-	/**
-	 * Returns the arrowTailStyle.
-	 *
-	 * @return the arrowTailStyle
-	 */
-	public ArrowStyle getArrowTailStyle() {
-		return arrowTailStyle;
-	}
-
-	/**
-	 * Sets the arrowTailStyle.
-	 *
-	 * @param arrowTailStyle the new arrowTailStyle
-	 */
-	public void setArrowTailStyle(ArrowStyle arrowTailStyle) {
-		this.arrowTailStyle = arrowTailStyle;
-	}
-
-	/**
-	 * Returns the path.
-	 *
-	 * @return the path
-	 */
-	public List<Point> getPath() {
-		return path;
-	}
-
-	/**
-	 * Sets the path.
-	 *
-	 * @param path the new path
-	 */
-	public void setPath(List<Point> path) {
-		this.path = path;
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-graph-model/src/main/java/net/sf/taverna/t2/workbench/models/graph/GraphElement.java
----------------------------------------------------------------------
diff --git a/taverna-graph-model/src/main/java/net/sf/taverna/t2/workbench/models/graph/GraphElement.java b/taverna-graph-model/src/main/java/net/sf/taverna/t2/workbench/models/graph/GraphElement.java
deleted file mode 100644
index ea968ce..0000000
--- a/taverna-graph-model/src/main/java/net/sf/taverna/t2/workbench/models/graph/GraphElement.java
+++ /dev/null
@@ -1,430 +0,0 @@
-/*******************************************************************************
- * 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.models.graph;
-
-import java.awt.Color;
-import java.awt.Point;
-
-import org.apache.taverna.scufl2.api.common.WorkflowBean;
-
-/**
- * An element of a graph.
- * 
- * @author David Withers
- */
-public abstract class GraphElement {
-	public enum LineStyle {
-		NONE, SOLID, DOTTED
-	}
-
-	private String id;
-	private String label;
-	private Point labelPosition;
-	private LineStyle lineStyle = LineStyle.SOLID;
-	private Color color = Color.BLACK;
-	private Color fillColor;
-	private float opacity = 1f;
-	private GraphElement parent;
-	private boolean selected;
-	private boolean active;
-	private boolean interactive;
-	private boolean visible = true;
-	private boolean filtered;
-	private WorkflowBean workflowBean;
-	protected GraphController graphController;
-	protected float completed;
-	protected int iteration;
-	protected int errors;
-
-	protected GraphElement(GraphController graphController) {
-		this.graphController = graphController;
-	}
-
-	/**
-	 * Returns the eventManager.
-	 * 
-	 * @return the eventManager
-	 */
-	public GraphEventManager getEventManager() {
-		if (graphController != null) {
-			return graphController.getGraphEventManager();
-		}
-		return null;
-	}
-
-	/**
-	 * Returns the workflowBean.
-	 * 
-	 * @return the workflowBean
-	 */
-	public WorkflowBean getWorkflowBean() {
-		return workflowBean;
-	}
-
-	/**
-	 * Sets the workflowBean.
-	 * 
-	 * @param workflowBean
-	 *            the new workflowBean
-	 */
-	public void setWorkflowBean(WorkflowBean workflowBean) {
-		this.workflowBean = workflowBean;
-	}
-
-	/**
-	 * Returns the parent.
-	 * 
-	 * @return the parent
-	 */
-	public GraphElement getParent() {
-		return parent;
-	}
-
-	/**
-	 * Sets the parent.
-	 * 
-	 * @param parent
-	 *            the new parent
-	 */
-	protected void setParent(GraphElement parent) {
-		this.parent = parent;
-	}
-
-	/**
-	 * Returns the label.
-	 * 
-	 * @return the label
-	 */
-	public String getLabel() {
-		return label;
-	}
-
-	/**
-	 * Sets the label.
-	 * 
-	 * @param label
-	 *            the new label
-	 */
-	public void setLabel(String label) {
-		this.label = label;
-	}
-
-	/**
-	 * Returns the labelPosition.
-	 * 
-	 * @return the labelPosition
-	 */
-	public Point getLabelPosition() {
-		return labelPosition;
-	}
-
-	/**
-	 * Sets the labelPosition.
-	 * 
-	 * @param labelPosition
-	 *            the new labelPosition
-	 */
-	public void setLabelPosition(Point labelPosition) {
-		this.labelPosition = labelPosition;
-	}
-
-	/**
-	 * Returns the id.
-	 * 
-	 * @return the id
-	 */
-	public String getId() {
-		return id;
-	}
-
-	/**
-	 * Sets the id.
-	 * 
-	 * @param id
-	 *            the new id
-	 */
-	public void setId(String id) {
-		if (graphController != null) {
-			graphController.mapElement(id, this);
-		}
-		this.id = id;
-	}
-
-	/**
-	 * Returns the colour.
-	 * 
-	 * @return the colour
-	 */
-	public Color getColor() {
-		return color;
-	}
-
-	/**
-	 * Sets the colour.
-	 * 
-	 * @param color
-	 *            the new colour
-	 */
-	public void setColor(Color color) {
-		this.color = color;
-	}
-
-	/**
-	 * Returns the fillColor.
-	 * 
-	 * @return the fillColor
-	 */
-	public Color getFillColor() {
-		return fillColor;
-	}
-
-	/**
-	 * Sets the fillColor.
-	 * 
-	 * @param fillColor
-	 *            the new fillColor
-	 */
-	public void setFillColor(Color fillColor) {
-		this.fillColor = fillColor;
-	}
-
-	/**
-	 * Returns the lineStyle.
-	 * 
-	 * @return the lineStyle
-	 */
-	public LineStyle getLineStyle() {
-		return lineStyle;
-	}
-
-	/**
-	 * Sets the lineStyle.
-	 * 
-	 * @param lineStyle
-	 *            the new lineStyle
-	 */
-	public void setLineStyle(LineStyle lineStyle) {
-		this.lineStyle = lineStyle;
-	}
-
-	@Override
-	public String toString() {
-		return id + "[" + label + "]";
-	}
-
-	/**
-	 * Returns the selected.
-	 * 
-	 * @return the selected
-	 */
-	public boolean isSelected() {
-		return selected;
-	}
-
-	/**
-	 * Sets the selected.
-	 * 
-	 * @param selected
-	 *            the new selected
-	 */
-	public void setSelected(boolean selected) {
-		this.selected = selected;
-	}
-
-	/**
-	 * Returns the iteration.
-	 * 
-	 * @return the value of iteration
-	 */
-	public int getIteration() {
-		return iteration;
-	}
-
-	/**
-	 * Sets the iteration.
-	 * 
-	 * @param iteration
-	 *            the new value for iteration
-	 */
-	public void setIteration(int iteration) {
-		this.iteration = iteration;
-	}
-
-	/**
-	 * Returns the errors.
-	 * 
-	 * @return the value of errors
-	 */
-	public int getErrors() {
-		return errors;
-	}
-
-	/**
-	 * Sets the errors.
-	 * 
-	 * @param errors
-	 *            the new value for errors
-	 */
-	public void setErrors(int errors) {
-		this.errors = errors;
-	}
-
-	/**
-	 * Returns the completed.
-	 * 
-	 * @return the value of completed
-	 */
-	public float getCompleted() {
-		return completed;
-	}
-
-	/**
-	 * Sets the completed value.
-	 * 
-	 * @param completed
-	 */
-	public void setCompleted(float completed) {
-		this.completed = completed;
-	}
-
-	/**
-	 * Returns <code>true</code> if the element is active. The default value is
-	 * <code>false</code>.
-	 * 
-	 * @return <code>true</code> if the element is active
-	 */
-	public boolean isActive() {
-		return active;
-	}
-
-	/**
-	 * Sets the value of active.
-	 * 
-	 * @param active
-	 *            the new active
-	 */
-	public void setActive(boolean active) {
-		this.active = active;
-	}
-
-	/**
-	 * Returns <code>true</code> if the element is interactive. The default
-	 * value is <code>false</code>.
-	 * 
-	 * @return <code>true</code> if the element is interactive
-	 */
-	public boolean isInteractive() {
-		return interactive;
-	}
-
-	/**
-	 * Sets the value of interactive.
-	 * 
-	 * @param interactive
-	 *            the new interactive
-	 */
-	public void setInteractive(boolean interactive) {
-		this.interactive = interactive;
-	}
-
-	/**
-	 * Returns <code>true</code> if the element is visible. The default value is
-	 * <code>true</code>.
-	 * 
-	 * @return <code>true</code> if the element is visible
-	 */
-	public boolean isVisible() {
-		return visible;
-	}
-
-	/**
-	 * Sets whether the element is visible.
-	 * 
-	 * @param visible
-	 *            the new value for visible
-	 */
-	public void setVisible(boolean visible) {
-		this.visible = visible;
-	}
-
-	/**
-	 * Returns the opacity value. The default value is 1.0
-	 * 
-	 * @return the opacity value
-	 */
-	public float getOpacity() {
-		return opacity;
-	}
-
-	/**
-	 * Sets the opacity of the element. Must be a value between 0.0 and 1.0.
-	 * 
-	 * @param opacity
-	 *            the new opacity value
-	 */
-	public void setOpacity(float opacity) {
-		this.opacity = opacity;
-	}
-
-	/**
-	 * Returns <code>true</code> if the element is filtered.
-	 * 
-	 * @return <code>true</code> if the element is filtered
-	 */
-	public boolean isFiltered() {
-		return filtered;
-	}
-
-	/**
-	 * Sets the value of filtered.
-	 * 
-	 * @param filtered
-	 *            the new value for filtered
-	 */
-	public void setFiltered(boolean filtered) {
-		this.filtered = filtered;
-	}
-
-	@Override
-	public int hashCode() {
-		final int prime = 31;
-		int result = 1;
-		result = prime * result + ((id == null) ? 0 : id.hashCode());
-		return result;
-	}
-
-	@Override
-	public boolean equals(Object obj) {
-		if (this == obj)
-			return true;
-		if (obj == null)
-			return false;
-		if (getClass() != obj.getClass())
-			return false;
-
-		// Equality by id
-		GraphElement other = (GraphElement) obj;
-		if (id == null)
-			return (other.id == null);
-		return id.equals(other.id);
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-graph-model/src/main/java/net/sf/taverna/t2/workbench/models/graph/GraphEventManager.java
----------------------------------------------------------------------
diff --git a/taverna-graph-model/src/main/java/net/sf/taverna/t2/workbench/models/graph/GraphEventManager.java b/taverna-graph-model/src/main/java/net/sf/taverna/t2/workbench/models/graph/GraphEventManager.java
deleted file mode 100644
index a6b9b0e..0000000
--- a/taverna-graph-model/src/main/java/net/sf/taverna/t2/workbench/models/graph/GraphEventManager.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * 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.models.graph;
-
-public interface GraphEventManager {
-	void mouseClicked(GraphElement graphElement, short button, boolean altKey,
-			boolean ctrlKey, boolean metaKey, int x, int y, int screenX,
-			int screenY);
-
-	void mouseDown(GraphElement graphElement, short button, boolean altKey,
-			boolean ctrlKey, boolean metaKey, int x, int y, int screenX,
-			int screenY);
-
-	void mouseUp(GraphElement graphElement, short button, boolean altKey,
-			boolean ctrlKey, boolean metaKey, final int x, final int y,
-			int screenX, int screenY);
-
-	void mouseMoved(GraphElement graphElement, short button, boolean altKey,
-			boolean ctrlKey, boolean metaKey, int x, int y, int screenX,
-			int screenY);
-
-	void mouseOver(GraphElement graphElement, short button, boolean altKey,
-			boolean ctrlKey, boolean metaKey, int x, int y, int screenX,
-			int screenY);
-
-	void mouseOut(GraphElement graphElement, short button, boolean altKey,
-			boolean ctrlKey, boolean metaKey, int x, int y, int screenX,
-			int screenY);
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-graph-model/src/main/java/net/sf/taverna/t2/workbench/models/graph/GraphNode.java
----------------------------------------------------------------------
diff --git a/taverna-graph-model/src/main/java/net/sf/taverna/t2/workbench/models/graph/GraphNode.java b/taverna-graph-model/src/main/java/net/sf/taverna/t2/workbench/models/graph/GraphNode.java
deleted file mode 100644
index 3f3f85f..0000000
--- a/taverna-graph-model/src/main/java/net/sf/taverna/t2/workbench/models/graph/GraphNode.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/*******************************************************************************
- * 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.models.graph;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * A node of a graph that can optionally contain other graphs.
- * 
- * @author David Withers
- */
-public class GraphNode extends GraphShapeElement {
-	private List<GraphNode> sourceNodes = new ArrayList<>();
-	private List<GraphNode> sinkNodes = new ArrayList<>();
-	private Graph graph;
-	private boolean expanded;
-
-	/**
-	 * Constructs a new instance of Node.
-	 * 
-	 */
-	public GraphNode(GraphController graphController) {
-		super(graphController);
-	}
-
-	/**
-	 * Adds a sink node.
-	 * 
-	 * @param sinkNode
-	 *            the sink node to add
-	 */
-	public void addSinkNode(GraphNode sinkNode) {
-		sinkNode.setParent(this);
-		sinkNodes.add(sinkNode);
-	}
-
-	/**
-	 * Adds a source node.
-	 * 
-	 * @param sourceNode
-	 *            the source node to add
-	 */
-	public void addSourceNode(GraphNode sourceNode) {
-		sourceNode.setParent(this);
-		sourceNodes.add(sourceNode);
-	}
-
-	/**
-	 * Returns the graph that this node contains.
-	 * 
-	 * @return the graph that this node contains
-	 */
-	public Graph getGraph() {
-		return graph;
-	}
-
-	/**
-	 * Returns the sinkNodes.
-	 * 
-	 * @return the sinkNodes
-	 */
-	public List<GraphNode> getSinkNodes() {
-		return sinkNodes;
-	}
-
-	/**
-	 * Returns the sourceNodes.
-	 * 
-	 * @return the sourceNodes
-	 */
-	public List<GraphNode> getSourceNodes() {
-		return sourceNodes;
-	}
-
-	/**
-	 * Returns true if this node is expanded to show the contained graph.
-	 * 
-	 * @return true if this node is expanded
-	 */
-	public boolean isExpanded() {
-		return expanded;
-	}
-
-	/**
-	 * Removes a sink node.
-	 * 
-	 * @param sinkNode
-	 *            the node to remove
-	 * @return true if the node was removed, false otherwise
-	 */
-	public boolean removeSinkNode(GraphNode sinkNode) {
-		return sinkNodes.remove(sinkNode);
-	}
-
-	/**
-	 * Removes a source node.
-	 * 
-	 * @param sourceNode
-	 *            the node to remove
-	 * @return true if the node was removed, false otherwise
-	 */
-	public boolean removeSourceNode(GraphNode sourceNode) {
-		return sourceNodes.remove(sourceNode);
-	}
-
-	/**
-	 * Sets whether this node is expanded to show the contained graph.
-	 * 
-	 * @param expanded
-	 *            true if this node is expanded
-	 */
-	public void setExpanded(boolean expanded) {
-		this.expanded = expanded;
-	}
-
-	/**
-	 * Sets the graph that this node contains.
-	 * 
-	 * @param graph
-	 *            the new graph
-	 */
-	public void setGraph(Graph graph) {
-		if (graph != null)
-			graph.setParent(this);
-		this.graph = graph;
-	}
-
-	@Override
-	public void setSelected(boolean selected) {
-		super.setSelected(selected);
-		if (isExpanded())
-			getGraph().setSelected(selected);
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-graph-model/src/main/java/net/sf/taverna/t2/workbench/models/graph/GraphShapeElement.java
----------------------------------------------------------------------
diff --git a/taverna-graph-model/src/main/java/net/sf/taverna/t2/workbench/models/graph/GraphShapeElement.java b/taverna-graph-model/src/main/java/net/sf/taverna/t2/workbench/models/graph/GraphShapeElement.java
deleted file mode 100644
index 1bb8b6d..0000000
--- a/taverna-graph-model/src/main/java/net/sf/taverna/t2/workbench/models/graph/GraphShapeElement.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*******************************************************************************
- * 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.models.graph;
-
-import java.awt.Dimension;
-import java.awt.Point;
-
-/**
- * A Graph element that has shape, size and position properties.
- * 
- * @author David Withers
- */
-public class GraphShapeElement extends GraphElement {
-	public enum Shape {
-		BOX, RECORD, HOUSE, INVHOUSE, DOT, CIRCLE, TRIANGLE, INVTRIANGLE
-	}
-
-	private Shape shape;
-	private int x, y, width, height;
-
-	public GraphShapeElement(GraphController graphController) {
-		super(graphController);
-	}
-
-	/**
-	 * Returns the height.
-	 * 
-	 * @return the height
-	 */
-	public int getHeight() {
-		return height;
-	}
-
-	/**
-	 * Returns the position.
-	 * 
-	 * @return the position
-	 */
-	public Point getPosition() {
-		return new Point(x, y);
-	}
-
-	/**
-	 * Returns the shape of the element.
-	 * 
-	 * @return the shape of the element
-	 */
-	public Shape getShape() {
-		return shape;
-	}
-
-	/**
-	 * Returns the width.
-	 * 
-	 * @return the width
-	 */
-	public int getWidth() {
-		return width;
-	}
-
-	/**
-	 * Sets the position.
-	 * 
-	 * @param position
-	 *            the new position
-	 */
-	public void setPosition(Point position) {
-		x = position.x;
-		y = position.y;
-	}
-
-	/**
-	 * Sets the shape of the element.
-	 * 
-	 * @param shape
-	 *            the new shape of the element
-	 */
-	public void setShape(Shape shape) {
-		this.shape = shape;
-	}
-
-	/**
-	 * Returns the size of the element.
-	 * 
-	 * @return the size of the element
-	 */
-	public Dimension getSize() {
-		return new Dimension(width, height);
-	}
-
-	/**
-	 * Sets the size of the element.
-	 * 
-	 * @param size
-	 *            the new size of the node
-	 */
-	public void setSize(Dimension size) {
-		width = size.width;
-		height = size.height;
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-graph-model/src/main/java/net/sf/taverna/t2/workbench/models/graph/dot/GraphLayout.java
----------------------------------------------------------------------
diff --git a/taverna-graph-model/src/main/java/net/sf/taverna/t2/workbench/models/graph/dot/GraphLayout.java b/taverna-graph-model/src/main/java/net/sf/taverna/t2/workbench/models/graph/dot/GraphLayout.java
deleted file mode 100644
index 1205953..0000000
--- a/taverna-graph-model/src/main/java/net/sf/taverna/t2/workbench/models/graph/dot/GraphLayout.java
+++ /dev/null
@@ -1,326 +0,0 @@
-/*******************************************************************************
- * 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.models.graph.dot;
-
-import static java.lang.Float.parseFloat;
-import static net.sf.taverna.t2.workbench.models.graph.Graph.Alignment.HORIZONTAL;
-
-import java.awt.Dimension;
-import java.awt.Point;
-import java.awt.Rectangle;
-import java.io.StringReader;
-import java.util.ArrayList;
-import java.util.List;
-
-import net.sf.taverna.t2.workbench.models.graph.Graph;
-import net.sf.taverna.t2.workbench.models.graph.GraphController;
-import net.sf.taverna.t2.workbench.models.graph.GraphEdge;
-import net.sf.taverna.t2.workbench.models.graph.GraphElement;
-import net.sf.taverna.t2.workbench.models.graph.GraphNode;
-
-import org.apache.log4j.Logger;
-
-/**
- * Lays out a graph from a DOT layout.
- * 
- * @author David Withers
- */
-public class GraphLayout implements DOTParserVisitor {
-	private static final Logger logger = Logger.getLogger(GraphLayout.class);
-	private static final int BORDER = 10;
-
-	private Rectangle bounds;
-	private Rectangle requiredBounds;
-	private GraphController graphController;
-	private int xOffset;
-	private int yOffset;
-
-	public Rectangle layoutGraph(GraphController graphController, Graph graph,
-			String laidOutDot, Rectangle requiredBounds) throws ParseException {
-		this.graphController = graphController;
-		this.requiredBounds = requiredBounds;
-
-		bounds = null;
-		xOffset = 0;
-		yOffset = 0;
-
-		logger.debug(laidOutDot);
-		DOTParser parser = new DOTParser(new StringReader(laidOutDot));
-		parser.parse().jjtAccept(this, graph);
-
-		// int xOffset = (bounds.width - bounds.width) / 2;
-		// int yOffset = (bounds.height - bounds.height) / 2;
-
-		return new Rectangle(xOffset, yOffset, bounds.width, bounds.height);
-	}
-
-	@Override
-	public Object visit(SimpleNode node, Object data) {
-		return node.childrenAccept(this, data);
-	}
-
-	@Override
-	public Object visit(ASTParse node, Object data) {
-		return node.childrenAccept(this, data);
-	}
-
-	@Override
-	public Object visit(ASTGraph node, Object data) {
-		return node.childrenAccept(this, data);
-	}
-
-	@Override
-	public Object visit(ASTStatementList node, Object data) {
-		return node.childrenAccept(this, data);
-	}
-
-	@Override
-	public Object visit(ASTStatement node, Object data) {
-		return node.childrenAccept(this, data);
-	}
-
-	@Override
-	public Object visit(ASTAttributeStatement node, Object data) {
-		return node.childrenAccept(this, data);
-	}
-
-	@Override
-	public Object visit(ASTNodeStatement node, Object data) {
-		GraphElement element = graphController.getElement(removeQuotes(node
-				.getName()));
-		if (element != null)
-			return node.childrenAccept(this, element);
-		return node.childrenAccept(this, data);
-	}
-
-	@Override
-	public Object visit(ASTNodeId node, Object data) {
-		return node.childrenAccept(this, data);
-	}
-
-	@Override
-	public Object visit(ASTPort node, Object data) {
-		return node.childrenAccept(this, data);
-	}
-
-	@Override
-	public Object visit(ASTEdgeStatement node, Object data) {
-		StringBuilder id = new StringBuilder();
-		id.append(removeQuotes(node.getName()));
-		if (node.getPort() != null) {
-			id.append(":");
-			id.append(removeQuotes(node.getPort()));
-		}
-		if (node.children != null)
-			for (Node child : node.children)
-				if (child instanceof ASTEdgeRHS) {
-					NamedNode rhsNode = (NamedNode) child.jjtAccept(this, data);
-					id.append("->");
-					id.append(removeQuotes(rhsNode.getName()));
-					if (rhsNode.getPort() != null) {
-						id.append(":");
-						id.append(removeQuotes(rhsNode.getPort()));
-					}
-				}
-		GraphElement element = graphController.getElement(id.toString());
-		if (element != null)
-			return node.childrenAccept(this, element);
-		return node.childrenAccept(this, data);
-	}
-
-	@Override
-	public Object visit(ASTSubgraph node, Object data) {
-		GraphElement element = graphController.getElement(removeQuotes(
-				node.getName()).substring("cluster_".length()));
-		if (element != null)
-			return node.childrenAccept(this, element);
-		return node.childrenAccept(this, data);
-	}
-
-	@Override
-	public Object visit(ASTEdgeRHS node, Object data) {
-		return node;
-	}
-
-	@Override
-	public Object visit(ASTAttributeList node, Object data) {
-		return node.childrenAccept(this, data);
-	}
-
-	@Override
-	public Object visit(ASTAList node, Object data) {
-		if (data instanceof Graph) {
-			Graph graph = (Graph) data;
-			if ("bb".equalsIgnoreCase(node.getName())) {
-				Rectangle rect = getRectangle(node.getValue());
-				if (rect.width == 0 && rect.height == 0) {
-					rect.width = 500;
-					rect.height = 500;
-				}
-				if (bounds == null) {
-					bounds = calculateBounds(rect);
-					rect = bounds;
-				}
-				graph.setSize(rect.getSize());
-				graph.setPosition(rect.getLocation());
-			} else if ("lp".equalsIgnoreCase(node.getName())) {
-				if (bounds != null)
-					graph.setLabelPosition(getPoint(node.getValue()));
-			}
-		} else if (data instanceof GraphNode) {
-			GraphNode graphNode = (GraphNode) data;
-			if ("width".equalsIgnoreCase(node.getName()))
-				graphNode.setSize(new Dimension(getSize(node.getValue()),
-						graphNode.getHeight()));
-			else if ("height".equalsIgnoreCase(node.getName()))
-				graphNode.setSize(new Dimension(graphNode.getWidth(),
-						getSize(node.getValue())));
-			else if ("pos".equalsIgnoreCase(node.getName())) {
-				Point position = getPoint(node.getValue());
-				position.x = position.x - (graphNode.getWidth() / 2);
-				position.y = position.y - (graphNode.getHeight() / 2);
-				graphNode.setPosition(position);
-			} else if ("rects".equalsIgnoreCase(node.getName())) {
-				List<Rectangle> rectangles = getRectangles(node.getValue());
-				List<GraphNode> sinkNodes = graphNode.getSinkNodes();
-				if (graphController.getAlignment().equals(HORIZONTAL)) {
-					Rectangle rect = rectangles.remove(0);
-					graphNode.setSize(rect.getSize());
-					graphNode.setPosition(rect.getLocation());
-				} else {
-					Rectangle rect = rectangles.remove(sinkNodes.size());
-					graphNode.setSize(rect.getSize());
-					graphNode.setPosition(rect.getLocation());
-				}
-				Point origin = graphNode.getPosition();
-				for (GraphNode sinkNode : sinkNodes) {
-					Rectangle rect = rectangles.remove(0);
-					rect.setLocation(rect.x - origin.x, rect.y - origin.y);
-					sinkNode.setSize(rect.getSize());
-					sinkNode.setPosition(rect.getLocation());
-				}
-				for (GraphNode sourceNode : graphNode.getSourceNodes()) {
-					Rectangle rect = rectangles.remove(0);
-					rect.setLocation(rect.x - origin.x, rect.y - origin.y);
-					sourceNode.setSize(rect.getSize());
-					sourceNode.setPosition(rect.getLocation());
-				}
-			}
-		} else if (data instanceof GraphEdge) {
-			GraphEdge graphEdge = (GraphEdge) data;
-			if ("pos".equalsIgnoreCase(node.getName()))
-				graphEdge.setPath(getPath(node.getValue()));
-		}
-		return node.childrenAccept(this, data);
-	}
-
-	private Rectangle calculateBounds(Rectangle bounds) {
-		bounds = new Rectangle(bounds);
-		bounds.width += BORDER;
-		bounds.height += BORDER;
-		Rectangle newBounds = new Rectangle(bounds);
-		double ratio = bounds.width / (float) bounds.height;
-		double requiredRatio = requiredBounds.width
-				/ (float) requiredBounds.height;
-		// adjust the bounds so they match the aspect ration of the required bounds
-		if (ratio > requiredRatio)
-			newBounds.height = (int) (ratio / requiredRatio * bounds.height);
-		else if (ratio < requiredRatio)
-			newBounds.width = (int) (requiredRatio / ratio * bounds.width);
-
-		xOffset = (newBounds.width - bounds.width) / 2;
-		yOffset = (newBounds.height - bounds.height) / 2;
-		// adjust the bounds and so they are not less than the required bounds
-		if (newBounds.width < requiredBounds.width) {
-			xOffset += (requiredBounds.width - newBounds.width) / 2;
-			newBounds.width = requiredBounds.width;
-		}
-		if (newBounds.height < requiredBounds.height) {
-			yOffset += (requiredBounds.height - newBounds.height) / 2;
-			newBounds.height = requiredBounds.height;
-		}
-		// adjust the offset for the border
-		xOffset += BORDER / 2;
-		yOffset += BORDER / 2;
-		return newBounds;
-	}
-
-	private List<Point> getPath(String value) {
-		List<Point> path = new ArrayList<>();
-		for (String point : removeQuotes(value).split(" ")) {
-			String[] coords = point.split(",");
-			if (coords.length == 2) {
-				int x = (int) parseFloat(coords[0]) + xOffset;
-				int y = (int) parseFloat(coords[1]) + yOffset;
-				path.add(new Point(x, flipY(y)));
-			}
-		}
-		return path;
-	}
-
-	private int flipY(int y) {
-		return bounds.height - y;
-	}
-
-	private List<Rectangle> getRectangles(String value) {
-		List<Rectangle> rectangles = new ArrayList<>();
-		String[] rects = value.split(" ");
-		for (String rectangle : rects)
-			rectangles.add(getRectangle(rectangle));
-		return rectangles;
-	}
-
-	private Rectangle getRectangle(String value) {
-		String[] coords = removeQuotes(value).split(",");
-		Rectangle rectangle = new Rectangle();
-		rectangle.x = (int) parseFloat(coords[0]);
-		rectangle.y = (int) parseFloat(coords[3]);
-		rectangle.width = (int) parseFloat(coords[2]) - rectangle.x;
-		rectangle.height = rectangle.y - (int) parseFloat(coords[1]);
-		rectangle.x += xOffset;
-		rectangle.y += yOffset;
-		if (bounds != null)
-			rectangle.y = flipY(rectangle.y);
-		else
-			rectangle.y = rectangle.height - rectangle.y;
-		return rectangle;
-	}
-
-	private Point getPoint(String value) {
-		String[] coords = removeQuotes(value).split(",");
-		return new Point(xOffset + (int) parseFloat(coords[0]), flipY(yOffset
-				+ (int) parseFloat(coords[1])));
-	}
-
-	private int getSize(String value) {
-		return (int) (parseFloat(removeQuotes(value)) * 72);
-	}
-
-	private String removeQuotes(String value) {
-		String result = value.trim();
-		if (result.startsWith("\""))
-			result = result.substring(1);
-		if (result.endsWith("\""))
-			result = result.substring(0, result.length() - 1);
-		result = result.replaceAll("\\\\", "");
-		return result;
-	}
-}


[18/51] [partial] incubator-taverna-workbench git commit: all packages are moved to org.apache.taverna.*

Posted by re...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/actions/SaveWorkflowAction.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/actions/SaveWorkflowAction.java b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/actions/SaveWorkflowAction.java
index dcb3120..f4291e7 100644
--- a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/actions/SaveWorkflowAction.java
+++ b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/actions/SaveWorkflowAction.java
@@ -29,7 +29,7 @@ import static javax.swing.JOptionPane.YES_OPTION;
 import static javax.swing.JOptionPane.showConfirmDialog;
 import static javax.swing.JOptionPane.showMessageDialog;
 import static javax.swing.KeyStroke.getKeyStroke;
-import static net.sf.taverna.t2.workbench.icons.WorkbenchIcons.saveIcon;
+import static org.apache.taverna.workbench.icons.WorkbenchIcons.saveIcon;
 
 import java.awt.Component;
 import java.awt.event.ActionEvent;
@@ -38,15 +38,15 @@ import javax.swing.AbstractAction;
 
 import org.apache.taverna.lang.observer.Observable;
 import org.apache.taverna.lang.observer.Observer;
-import net.sf.taverna.t2.workbench.edits.EditManager;
-import net.sf.taverna.t2.workbench.edits.EditManager.AbstractDataflowEditEvent;
-import net.sf.taverna.t2.workbench.edits.EditManager.EditManagerEvent;
-import net.sf.taverna.t2.workbench.file.FileManager;
-import net.sf.taverna.t2.workbench.file.events.FileManagerEvent;
-import net.sf.taverna.t2.workbench.file.events.SavedDataflowEvent;
-import net.sf.taverna.t2.workbench.file.events.SetCurrentDataflowEvent;
-import net.sf.taverna.t2.workbench.file.exceptions.OverwriteException;
-import net.sf.taverna.t2.workbench.file.exceptions.SaveException;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.edits.EditManager.AbstractDataflowEditEvent;
+import org.apache.taverna.workbench.edits.EditManager.EditManagerEvent;
+import org.apache.taverna.workbench.file.FileManager;
+import org.apache.taverna.workbench.file.events.FileManagerEvent;
+import org.apache.taverna.workbench.file.events.SavedDataflowEvent;
+import org.apache.taverna.workbench.file.events.SetCurrentDataflowEvent;
+import org.apache.taverna.workbench.file.exceptions.OverwriteException;
+import org.apache.taverna.workbench.file.exceptions.SaveException;
 
 import org.apache.log4j.Logger;
 

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/actions/SaveWorkflowAsAction.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/actions/SaveWorkflowAsAction.java b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/actions/SaveWorkflowAsAction.java
index 60d5aaa..8833e16 100644
--- a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/actions/SaveWorkflowAsAction.java
+++ b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/actions/SaveWorkflowAsAction.java
@@ -31,7 +31,7 @@ import static javax.swing.JOptionPane.YES_OPTION;
 import static javax.swing.JOptionPane.showConfirmDialog;
 import static javax.swing.JOptionPane.showMessageDialog;
 import static javax.swing.KeyStroke.getKeyStroke;
-import static net.sf.taverna.t2.workbench.icons.WorkbenchIcons.saveAsIcon;
+import static org.apache.taverna.workbench.icons.WorkbenchIcons.saveAsIcon;
 
 import java.awt.Component;
 import java.awt.event.ActionEvent;
@@ -46,12 +46,12 @@ import javax.swing.filechooser.FileFilter;
 
 import org.apache.taverna.lang.observer.Observable;
 import org.apache.taverna.lang.observer.Observer;
-import net.sf.taverna.t2.workbench.file.FileManager;
-import net.sf.taverna.t2.workbench.file.FileType;
-import net.sf.taverna.t2.workbench.file.events.FileManagerEvent;
-import net.sf.taverna.t2.workbench.file.events.SetCurrentDataflowEvent;
-import net.sf.taverna.t2.workbench.file.exceptions.OverwriteException;
-import net.sf.taverna.t2.workbench.file.exceptions.SaveException;
+import org.apache.taverna.workbench.file.FileManager;
+import org.apache.taverna.workbench.file.FileType;
+import org.apache.taverna.workbench.file.events.FileManagerEvent;
+import org.apache.taverna.workbench.file.events.SetCurrentDataflowEvent;
+import org.apache.taverna.workbench.file.exceptions.OverwriteException;
+import org.apache.taverna.workbench.file.exceptions.SaveException;
 import net.sf.taverna.t2.workbench.file.impl.FileTypeFileFilter;
 
 import org.apache.log4j.Logger;

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/hooks/CloseWorkflowsOnShutdown.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/hooks/CloseWorkflowsOnShutdown.java b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/hooks/CloseWorkflowsOnShutdown.java
index 6c0be19..99d326a 100644
--- a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/hooks/CloseWorkflowsOnShutdown.java
+++ b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/hooks/CloseWorkflowsOnShutdown.java
@@ -20,9 +20,9 @@
  ******************************************************************************/
 package net.sf.taverna.t2.workbench.file.impl.hooks;
 
-import net.sf.taverna.t2.workbench.ShutdownSPI;
-import net.sf.taverna.t2.workbench.edits.EditManager;
-import net.sf.taverna.t2.workbench.file.FileManager;
+import org.apache.taverna.workbench.ShutdownSPI;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.file.FileManager;
 import net.sf.taverna.t2.workbench.file.impl.actions.CloseAllWorkflowsAction;
 
 /**

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/menu/FileCloseAllMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/menu/FileCloseAllMenuAction.java b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/menu/FileCloseAllMenuAction.java
index e8e5252..68aade2 100644
--- a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/menu/FileCloseAllMenuAction.java
+++ b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/menu/FileCloseAllMenuAction.java
@@ -26,9 +26,9 @@ import java.net.URI;
 
 import javax.swing.Action;
 
-import net.sf.taverna.t2.ui.menu.AbstractMenuAction;
-import net.sf.taverna.t2.workbench.edits.EditManager;
-import net.sf.taverna.t2.workbench.file.FileManager;
+import org.apache.taverna.ui.menu.AbstractMenuAction;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.file.FileManager;
 import net.sf.taverna.t2.workbench.file.impl.actions.CloseAllWorkflowsAction;
 
 public class FileCloseAllMenuAction extends AbstractMenuAction {

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/menu/FileCloseMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/menu/FileCloseMenuAction.java b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/menu/FileCloseMenuAction.java
index a97219f..1af3d07 100644
--- a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/menu/FileCloseMenuAction.java
+++ b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/menu/FileCloseMenuAction.java
@@ -26,9 +26,9 @@ import java.net.URI;
 
 import javax.swing.Action;
 
-import net.sf.taverna.t2.ui.menu.AbstractMenuAction;
-import net.sf.taverna.t2.workbench.edits.EditManager;
-import net.sf.taverna.t2.workbench.file.FileManager;
+import org.apache.taverna.ui.menu.AbstractMenuAction;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.file.FileManager;
 import net.sf.taverna.t2.workbench.file.impl.actions.CloseWorkflowAction;
 
 public class FileCloseMenuAction extends AbstractMenuAction {

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/menu/FileNewMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/menu/FileNewMenuAction.java b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/menu/FileNewMenuAction.java
index 3a48e0d..5a3cd2f 100644
--- a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/menu/FileNewMenuAction.java
+++ b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/menu/FileNewMenuAction.java
@@ -26,8 +26,8 @@ import java.net.URI;
 
 import javax.swing.Action;
 
-import net.sf.taverna.t2.ui.menu.AbstractMenuAction;
-import net.sf.taverna.t2.workbench.file.FileManager;
+import org.apache.taverna.ui.menu.AbstractMenuAction;
+import org.apache.taverna.workbench.file.FileManager;
 import net.sf.taverna.t2.workbench.file.impl.actions.NewWorkflowAction;
 
 public class FileNewMenuAction extends AbstractMenuAction {

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/menu/FileOpenFromURLMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/menu/FileOpenFromURLMenuAction.java b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/menu/FileOpenFromURLMenuAction.java
index 9af1d6b..7dc3bbc 100644
--- a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/menu/FileOpenFromURLMenuAction.java
+++ b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/menu/FileOpenFromURLMenuAction.java
@@ -26,8 +26,8 @@ import java.net.URI;
 
 import javax.swing.Action;
 
-import net.sf.taverna.t2.ui.menu.AbstractMenuAction;
-import net.sf.taverna.t2.workbench.file.FileManager;
+import org.apache.taverna.ui.menu.AbstractMenuAction;
+import org.apache.taverna.workbench.file.FileManager;
 import net.sf.taverna.t2.workbench.file.impl.actions.OpenWorkflowFromURLAction;
 
 public class FileOpenFromURLMenuAction extends AbstractMenuAction {

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/menu/FileOpenMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/menu/FileOpenMenuAction.java b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/menu/FileOpenMenuAction.java
index 4ee4e39..d3c26ed 100644
--- a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/menu/FileOpenMenuAction.java
+++ b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/menu/FileOpenMenuAction.java
@@ -26,8 +26,8 @@ import java.net.URI;
 
 import javax.swing.Action;
 
-import net.sf.taverna.t2.ui.menu.AbstractMenuAction;
-import net.sf.taverna.t2.workbench.file.FileManager;
+import org.apache.taverna.ui.menu.AbstractMenuAction;
+import org.apache.taverna.workbench.file.FileManager;
 import net.sf.taverna.t2.workbench.file.impl.actions.OpenWorkflowAction;
 
 public class FileOpenMenuAction extends AbstractMenuAction {

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/menu/FileOpenMenuSection.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/menu/FileOpenMenuSection.java b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/menu/FileOpenMenuSection.java
index 46ef476..73bfa2b 100644
--- a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/menu/FileOpenMenuSection.java
+++ b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/menu/FileOpenMenuSection.java
@@ -22,7 +22,7 @@ package net.sf.taverna.t2.workbench.file.impl.menu;
 
 import java.net.URI;
 
-import net.sf.taverna.t2.ui.menu.AbstractMenuSection;
+import org.apache.taverna.ui.menu.AbstractMenuSection;
 
 public class FileOpenMenuSection extends AbstractMenuSection {
 	public static final URI FILE_URI = URI

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/menu/FileOpenRecentMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/menu/FileOpenRecentMenuAction.java b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/menu/FileOpenRecentMenuAction.java
index a64e538..3c49adf 100644
--- a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/menu/FileOpenRecentMenuAction.java
+++ b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/menu/FileOpenRecentMenuAction.java
@@ -31,15 +31,15 @@ import javax.swing.JMenuItem;
 
 import org.apache.taverna.lang.observer.Observable;
 import org.apache.taverna.lang.observer.Observer;
-import net.sf.taverna.t2.ui.menu.AbstractMenuCustom;
-import net.sf.taverna.t2.workbench.file.FileManager;
-import net.sf.taverna.t2.workbench.file.FileType;
-import net.sf.taverna.t2.workbench.file.events.AbstractDataflowEvent;
-import net.sf.taverna.t2.workbench.file.events.ClosedDataflowEvent;
-import net.sf.taverna.t2.workbench.file.events.FileManagerEvent;
-import net.sf.taverna.t2.workbench.file.events.OpenedDataflowEvent;
-import net.sf.taverna.t2.workbench.file.events.SavedDataflowEvent;
-import net.sf.taverna.t2.workbench.file.exceptions.OpenException;
+import org.apache.taverna.ui.menu.AbstractMenuCustom;
+import org.apache.taverna.workbench.file.FileManager;
+import org.apache.taverna.workbench.file.FileType;
+import org.apache.taverna.workbench.file.events.AbstractDataflowEvent;
+import org.apache.taverna.workbench.file.events.ClosedDataflowEvent;
+import org.apache.taverna.workbench.file.events.FileManagerEvent;
+import org.apache.taverna.workbench.file.events.OpenedDataflowEvent;
+import org.apache.taverna.workbench.file.events.SavedDataflowEvent;
+import org.apache.taverna.workbench.file.exceptions.OpenException;
 
 import org.apache.log4j.Logger;
 import org.jdom.Document;

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/menu/FileSaveAllMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/menu/FileSaveAllMenuAction.java b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/menu/FileSaveAllMenuAction.java
index 86edacb..4b1f3b8 100644
--- a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/menu/FileSaveAllMenuAction.java
+++ b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/menu/FileSaveAllMenuAction.java
@@ -24,9 +24,9 @@ import static net.sf.taverna.t2.workbench.file.impl.menu.FileSaveMenuSection.FIL
 
 import javax.swing.Action;
 
-import net.sf.taverna.t2.ui.menu.AbstractMenuAction;
-import net.sf.taverna.t2.workbench.edits.EditManager;
-import net.sf.taverna.t2.workbench.file.FileManager;
+import org.apache.taverna.ui.menu.AbstractMenuAction;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.file.FileManager;
 import net.sf.taverna.t2.workbench.file.impl.actions.SaveAllWorkflowsAction;
 
 public class FileSaveAllMenuAction extends AbstractMenuAction {

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/menu/FileSaveAsMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/menu/FileSaveAsMenuAction.java b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/menu/FileSaveAsMenuAction.java
index 77917c9..2459870 100644
--- a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/menu/FileSaveAsMenuAction.java
+++ b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/menu/FileSaveAsMenuAction.java
@@ -24,8 +24,8 @@ import static net.sf.taverna.t2.workbench.file.impl.menu.FileSaveMenuSection.FIL
 
 import javax.swing.Action;
 
-import net.sf.taverna.t2.ui.menu.AbstractMenuAction;
-import net.sf.taverna.t2.workbench.file.FileManager;
+import org.apache.taverna.ui.menu.AbstractMenuAction;
+import org.apache.taverna.workbench.file.FileManager;
 import net.sf.taverna.t2.workbench.file.impl.actions.SaveWorkflowAsAction;
 
 public class FileSaveAsMenuAction extends AbstractMenuAction {

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/menu/FileSaveMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/menu/FileSaveMenuAction.java b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/menu/FileSaveMenuAction.java
index eeaecb3..cb7462e 100644
--- a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/menu/FileSaveMenuAction.java
+++ b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/menu/FileSaveMenuAction.java
@@ -24,9 +24,9 @@ import static net.sf.taverna.t2.workbench.file.impl.menu.FileSaveMenuSection.FIL
 
 import javax.swing.Action;
 
-import net.sf.taverna.t2.ui.menu.AbstractMenuAction;
-import net.sf.taverna.t2.workbench.edits.EditManager;
-import net.sf.taverna.t2.workbench.file.FileManager;
+import org.apache.taverna.ui.menu.AbstractMenuAction;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.file.FileManager;
 import net.sf.taverna.t2.workbench.file.impl.actions.SaveWorkflowAction;
 
 public class FileSaveMenuAction extends AbstractMenuAction {

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/menu/FileSaveMenuSection.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/menu/FileSaveMenuSection.java b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/menu/FileSaveMenuSection.java
index a75a855..7d63a68 100644
--- a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/menu/FileSaveMenuSection.java
+++ b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/menu/FileSaveMenuSection.java
@@ -22,7 +22,7 @@ package net.sf.taverna.t2.workbench.file.impl.menu;
 
 import java.net.URI;
 
-import net.sf.taverna.t2.ui.menu.AbstractMenuSection;
+import org.apache.taverna.ui.menu.AbstractMenuSection;
 
 public class FileSaveMenuSection extends AbstractMenuSection {
 	public static final URI FILE_URI = URI

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/menu/WorkflowsMenu.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/menu/WorkflowsMenu.java b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/menu/WorkflowsMenu.java
index 9f6f355..1ba6f45 100644
--- a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/menu/WorkflowsMenu.java
+++ b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/menu/WorkflowsMenu.java
@@ -24,7 +24,7 @@ import static java.awt.event.KeyEvent.VK_0;
 import static java.awt.event.KeyEvent.VK_W;
 import static javax.swing.Action.MNEMONIC_KEY;
 import static javax.swing.SwingUtilities.invokeLater;
-import static net.sf.taverna.t2.ui.menu.DefaultMenuBar.DEFAULT_MENU_BAR;
+import static org.apache.taverna.ui.menu.DefaultMenuBar.DEFAULT_MENU_BAR;
 
 import java.awt.Component;
 import java.awt.event.ActionEvent;
@@ -36,13 +36,13 @@ import javax.swing.JRadioButtonMenuItem;
 
 import org.apache.taverna.lang.observer.Observable;
 import org.apache.taverna.lang.observer.Observer;
-import net.sf.taverna.t2.ui.menu.AbstractMenuCustom;
-import net.sf.taverna.t2.workbench.edits.EditManager;
-import net.sf.taverna.t2.workbench.edits.EditManager.AbstractDataflowEditEvent;
-import net.sf.taverna.t2.workbench.edits.EditManager.EditManagerEvent;
-import net.sf.taverna.t2.workbench.file.FileManager;
-import net.sf.taverna.t2.workbench.file.events.AbstractDataflowEvent;
-import net.sf.taverna.t2.workbench.file.events.FileManagerEvent;
+import org.apache.taverna.ui.menu.AbstractMenuCustom;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.edits.EditManager.AbstractDataflowEditEvent;
+import org.apache.taverna.workbench.edits.EditManager.EditManagerEvent;
+import org.apache.taverna.workbench.file.FileManager;
+import org.apache.taverna.workbench.file.events.AbstractDataflowEvent;
+import org.apache.taverna.workbench.file.events.FileManagerEvent;
 import org.apache.taverna.scufl2.api.container.WorkflowBundle;
 
 public class WorkflowsMenu extends AbstractMenuCustom {

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/toolbar/CloseToolbarAction.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/toolbar/CloseToolbarAction.java b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/toolbar/CloseToolbarAction.java
index 68ef3f9..19f3f59 100644
--- a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/toolbar/CloseToolbarAction.java
+++ b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/toolbar/CloseToolbarAction.java
@@ -26,9 +26,9 @@ import java.net.URI;
 
 import javax.swing.Action;
 
-import net.sf.taverna.t2.ui.menu.AbstractMenuAction;
-import net.sf.taverna.t2.workbench.edits.EditManager;
-import net.sf.taverna.t2.workbench.file.FileManager;
+import org.apache.taverna.ui.menu.AbstractMenuAction;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.file.FileManager;
 import net.sf.taverna.t2.workbench.file.impl.actions.CloseWorkflowAction;
 
 /**

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/toolbar/FileToolbarMenuSection.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/toolbar/FileToolbarMenuSection.java b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/toolbar/FileToolbarMenuSection.java
index 257d590..26bb7bb 100644
--- a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/toolbar/FileToolbarMenuSection.java
+++ b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/toolbar/FileToolbarMenuSection.java
@@ -20,11 +20,11 @@
  ******************************************************************************/
 package net.sf.taverna.t2.workbench.file.impl.toolbar;
 
-import static net.sf.taverna.t2.ui.menu.DefaultToolBar.DEFAULT_TOOL_BAR;
+import static org.apache.taverna.ui.menu.DefaultToolBar.DEFAULT_TOOL_BAR;
 
 import java.net.URI;
 
-import net.sf.taverna.t2.ui.menu.AbstractMenuSection;
+import org.apache.taverna.ui.menu.AbstractMenuSection;
 
 public class FileToolbarMenuSection extends AbstractMenuSection {
 	public static final URI FILE_TOOLBAR_SECTION = URI

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/toolbar/NewToolbarAction.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/toolbar/NewToolbarAction.java b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/toolbar/NewToolbarAction.java
index 2c8e922..b316459 100644
--- a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/toolbar/NewToolbarAction.java
+++ b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/toolbar/NewToolbarAction.java
@@ -26,8 +26,8 @@ import java.net.URI;
 
 import javax.swing.Action;
 
-import net.sf.taverna.t2.ui.menu.AbstractMenuAction;
-import net.sf.taverna.t2.workbench.file.FileManager;
+import org.apache.taverna.ui.menu.AbstractMenuAction;
+import org.apache.taverna.workbench.file.FileManager;
 import net.sf.taverna.t2.workbench.file.impl.actions.NewWorkflowAction;
 
 public class NewToolbarAction extends AbstractMenuAction {

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/toolbar/OpenToolbarAction.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/toolbar/OpenToolbarAction.java b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/toolbar/OpenToolbarAction.java
index ae99509..0605e47 100644
--- a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/toolbar/OpenToolbarAction.java
+++ b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/toolbar/OpenToolbarAction.java
@@ -26,8 +26,8 @@ import java.net.URI;
 
 import javax.swing.Action;
 
-import net.sf.taverna.t2.ui.menu.AbstractMenuAction;
-import net.sf.taverna.t2.workbench.file.FileManager;
+import org.apache.taverna.ui.menu.AbstractMenuAction;
+import org.apache.taverna.workbench.file.FileManager;
 import net.sf.taverna.t2.workbench.file.impl.actions.OpenWorkflowAction;
 
 public class OpenToolbarAction extends AbstractMenuAction {

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/toolbar/OpenWorkflowFromURLToolbarAction.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/toolbar/OpenWorkflowFromURLToolbarAction.java b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/toolbar/OpenWorkflowFromURLToolbarAction.java
index 2554063..df7415e 100644
--- a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/toolbar/OpenWorkflowFromURLToolbarAction.java
+++ b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/toolbar/OpenWorkflowFromURLToolbarAction.java
@@ -26,8 +26,8 @@ import java.net.URI;
 
 import javax.swing.Action;
 
-import net.sf.taverna.t2.ui.menu.AbstractMenuAction;
-import net.sf.taverna.t2.workbench.file.FileManager;
+import org.apache.taverna.ui.menu.AbstractMenuAction;
+import org.apache.taverna.workbench.file.FileManager;
 import net.sf.taverna.t2.workbench.file.impl.actions.OpenWorkflowFromURLAction;
 
 public class OpenWorkflowFromURLToolbarAction extends AbstractMenuAction {

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/toolbar/SaveToolbarAction.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/toolbar/SaveToolbarAction.java b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/toolbar/SaveToolbarAction.java
index 53ba720..df3046d 100644
--- a/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/toolbar/SaveToolbarAction.java
+++ b/taverna-file-impl/src/main/java/net/sf/taverna/t2/workbench/file/impl/toolbar/SaveToolbarAction.java
@@ -26,9 +26,9 @@ import java.net.URI;
 
 import javax.swing.Action;
 
-import net.sf.taverna.t2.ui.menu.AbstractMenuAction;
-import net.sf.taverna.t2.workbench.edits.EditManager;
-import net.sf.taverna.t2.workbench.file.FileManager;
+import org.apache.taverna.ui.menu.AbstractMenuAction;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.file.FileManager;
 import net.sf.taverna.t2.workbench.file.impl.actions.SaveWorkflowAction;
 
 public class SaveToolbarAction extends AbstractMenuAction {

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-file-impl/src/main/resources/META-INF/services/net.sf.taverna.t2.ui.menu.MenuComponent
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/resources/META-INF/services/net.sf.taverna.t2.ui.menu.MenuComponent b/taverna-file-impl/src/main/resources/META-INF/services/net.sf.taverna.t2.ui.menu.MenuComponent
deleted file mode 100644
index 100915c..0000000
--- a/taverna-file-impl/src/main/resources/META-INF/services/net.sf.taverna.t2.ui.menu.MenuComponent
+++ /dev/null
@@ -1,20 +0,0 @@
-net.sf.taverna.t2.workbench.file.impl.menu.FileCloseMenuAction
-net.sf.taverna.t2.workbench.file.impl.menu.FileNewMenuAction
-net.sf.taverna.t2.workbench.file.impl.menu.FileOpenMenuAction
-net.sf.taverna.t2.workbench.file.impl.menu.FileOpenFromURLMenuAction
-net.sf.taverna.t2.workbench.file.impl.menu.FileOpenMenuSection
-net.sf.taverna.t2.workbench.file.impl.menu.FileOpenRecentMenuAction
-net.sf.taverna.t2.workbench.file.impl.menu.FileSaveMenuSection
-net.sf.taverna.t2.workbench.file.impl.menu.FileSaveMenuAction
-net.sf.taverna.t2.workbench.file.impl.menu.FileSaveAllMenuAction
-net.sf.taverna.t2.workbench.file.impl.menu.FileSaveAsMenuAction
-
-net.sf.taverna.t2.workbench.file.impl.menu.WorkflowsMenu
-net.sf.taverna.t2.workbench.file.impl.menu.FileCloseAllMenuAction
-
-net.sf.taverna.t2.workbench.file.impl.toolbar.FileToolbarMenuSection
-net.sf.taverna.t2.workbench.file.impl.toolbar.NewToolbarAction
-net.sf.taverna.t2.workbench.file.impl.toolbar.OpenToolbarAction
-net.sf.taverna.t2.workbench.file.impl.toolbar.OpenWorkflowFromURLToolbarAction
-net.sf.taverna.t2.workbench.file.impl.toolbar.SaveToolbarAction
-net.sf.taverna.t2.workbench.file.impl.toolbar.CloseToolbarAction

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-file-impl/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.ShutdownSPI
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.ShutdownSPI b/taverna-file-impl/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.ShutdownSPI
deleted file mode 100644
index cc53d36..0000000
--- a/taverna-file-impl/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.ShutdownSPI
+++ /dev/null
@@ -1 +0,0 @@
-net.sf.taverna.t2.workbench.file.impl.hooks.CloseWorkflowsOnShutdown

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-file-impl/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.file.DataflowPersistenceHandler
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.file.DataflowPersistenceHandler b/taverna-file-impl/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.file.DataflowPersistenceHandler
deleted file mode 100644
index cfd1c7a..0000000
--- a/taverna-file-impl/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.file.DataflowPersistenceHandler
+++ /dev/null
@@ -1,2 +0,0 @@
-net.sf.taverna.t2.workbench.file.impl.T2DataflowOpener
-net.sf.taverna.t2.workbench.file.impl.DataflowFromDataflowPersistenceHandler
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-file-impl/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.file.FileManager
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.file.FileManager b/taverna-file-impl/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.file.FileManager
deleted file mode 100644
index 656feeb..0000000
--- a/taverna-file-impl/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.file.FileManager
+++ /dev/null
@@ -1 +0,0 @@
-net.sf.taverna.t2.workbench.file.impl.FileManagerImpl
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-file-impl/src/main/resources/META-INF/services/org.apache.taverna.ui.menu.MenuComponent
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/resources/META-INF/services/org.apache.taverna.ui.menu.MenuComponent b/taverna-file-impl/src/main/resources/META-INF/services/org.apache.taverna.ui.menu.MenuComponent
new file mode 100644
index 0000000..100915c
--- /dev/null
+++ b/taverna-file-impl/src/main/resources/META-INF/services/org.apache.taverna.ui.menu.MenuComponent
@@ -0,0 +1,20 @@
+net.sf.taverna.t2.workbench.file.impl.menu.FileCloseMenuAction
+net.sf.taverna.t2.workbench.file.impl.menu.FileNewMenuAction
+net.sf.taverna.t2.workbench.file.impl.menu.FileOpenMenuAction
+net.sf.taverna.t2.workbench.file.impl.menu.FileOpenFromURLMenuAction
+net.sf.taverna.t2.workbench.file.impl.menu.FileOpenMenuSection
+net.sf.taverna.t2.workbench.file.impl.menu.FileOpenRecentMenuAction
+net.sf.taverna.t2.workbench.file.impl.menu.FileSaveMenuSection
+net.sf.taverna.t2.workbench.file.impl.menu.FileSaveMenuAction
+net.sf.taverna.t2.workbench.file.impl.menu.FileSaveAllMenuAction
+net.sf.taverna.t2.workbench.file.impl.menu.FileSaveAsMenuAction
+
+net.sf.taverna.t2.workbench.file.impl.menu.WorkflowsMenu
+net.sf.taverna.t2.workbench.file.impl.menu.FileCloseAllMenuAction
+
+net.sf.taverna.t2.workbench.file.impl.toolbar.FileToolbarMenuSection
+net.sf.taverna.t2.workbench.file.impl.toolbar.NewToolbarAction
+net.sf.taverna.t2.workbench.file.impl.toolbar.OpenToolbarAction
+net.sf.taverna.t2.workbench.file.impl.toolbar.OpenWorkflowFromURLToolbarAction
+net.sf.taverna.t2.workbench.file.impl.toolbar.SaveToolbarAction
+net.sf.taverna.t2.workbench.file.impl.toolbar.CloseToolbarAction

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-file-impl/src/main/resources/META-INF/services/org.apache.taverna.workbench.ShutdownSPI
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/resources/META-INF/services/org.apache.taverna.workbench.ShutdownSPI b/taverna-file-impl/src/main/resources/META-INF/services/org.apache.taverna.workbench.ShutdownSPI
new file mode 100644
index 0000000..cc53d36
--- /dev/null
+++ b/taverna-file-impl/src/main/resources/META-INF/services/org.apache.taverna.workbench.ShutdownSPI
@@ -0,0 +1 @@
+net.sf.taverna.t2.workbench.file.impl.hooks.CloseWorkflowsOnShutdown

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-file-impl/src/main/resources/META-INF/services/org.apache.taverna.workbench.file.DataflowPersistenceHandler
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/resources/META-INF/services/org.apache.taverna.workbench.file.DataflowPersistenceHandler b/taverna-file-impl/src/main/resources/META-INF/services/org.apache.taverna.workbench.file.DataflowPersistenceHandler
new file mode 100644
index 0000000..cfd1c7a
--- /dev/null
+++ b/taverna-file-impl/src/main/resources/META-INF/services/org.apache.taverna.workbench.file.DataflowPersistenceHandler
@@ -0,0 +1,2 @@
+net.sf.taverna.t2.workbench.file.impl.T2DataflowOpener
+net.sf.taverna.t2.workbench.file.impl.DataflowFromDataflowPersistenceHandler
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-file-impl/src/main/resources/META-INF/services/org.apache.taverna.workbench.file.FileManager
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/resources/META-INF/services/org.apache.taverna.workbench.file.FileManager b/taverna-file-impl/src/main/resources/META-INF/services/org.apache.taverna.workbench.file.FileManager
new file mode 100644
index 0000000..656feeb
--- /dev/null
+++ b/taverna-file-impl/src/main/resources/META-INF/services/org.apache.taverna.workbench.file.FileManager
@@ -0,0 +1 @@
+net.sf.taverna.t2.workbench.file.impl.FileManagerImpl
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-file-impl/src/main/resources/META-INF/spring/file-impl-context-osgi.xml
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/resources/META-INF/spring/file-impl-context-osgi.xml b/taverna-file-impl/src/main/resources/META-INF/spring/file-impl-context-osgi.xml
index 7c6e290..edecfd6 100644
--- a/taverna-file-impl/src/main/resources/META-INF/spring/file-impl-context-osgi.xml
+++ b/taverna-file-impl/src/main/resources/META-INF/spring/file-impl-context-osgi.xml
@@ -81,20 +81,20 @@
 		</service-properties>
 	</service>
 
-	<service ref="T2DataflowOpener" interface="net.sf.taverna.t2.workbench.file.DataflowPersistenceHandler" />
+	<service ref="T2DataflowOpener" interface="org.apache.taverna.workbench.file.DataflowPersistenceHandler" />
 
-	<service ref="WorkflowBundleOpener" interface="net.sf.taverna.t2.workbench.file.DataflowPersistenceHandler" />
-	<service ref="WorkflowBundleSaver" interface="net.sf.taverna.t2.workbench.file.DataflowPersistenceHandler" />
+	<service ref="WorkflowBundleOpener" interface="org.apache.taverna.workbench.file.DataflowPersistenceHandler" />
+	<service ref="WorkflowBundleSaver" interface="org.apache.taverna.workbench.file.DataflowPersistenceHandler" />
 
-	<service ref="CloseWorkflowsOnShutdown" interface="net.sf.taverna.t2.workbench.ShutdownSPI" />
+	<service ref="CloseWorkflowsOnShutdown" interface="org.apache.taverna.workbench.ShutdownSPI" />
 
-	<service ref="FileManagerImpl" interface="net.sf.taverna.t2.workbench.file.FileManager" />
+	<service ref="FileManagerImpl" interface="org.apache.taverna.workbench.file.FileManager" />
 
-	<reference id="editManager" interface="net.sf.taverna.t2.workbench.edits.EditManager" />
+	<reference id="editManager" interface="org.apache.taverna.workbench.edits.EditManager" />
 	<reference id="applicationConfiguration" interface="uk.org.taverna.configuration.app.ApplicationConfiguration" />
 	<reference id="workflowBundleIO" interface="uk.org.taverna.scufl2.api.io.WorkflowBundleIO" />
 
-	<list id="dataflowPersistenceHandlers" interface="net.sf.taverna.t2.workbench.file.DataflowPersistenceHandler" cardinality="0..N">
+	<list id="dataflowPersistenceHandlers" interface="org.apache.taverna.workbench.file.DataflowPersistenceHandler" cardinality="0..N">
 		<listener ref="DataflowPersistenceHandlerRegistry" bind-method="update" unbind-method="update" />
 	</list>
 </beans:beans>

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-file-impl/src/main/resources/META-INF/spring/file-impl-context.xml
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/main/resources/META-INF/spring/file-impl-context.xml b/taverna-file-impl/src/main/resources/META-INF/spring/file-impl-context.xml
index 493df5f..5b171b4 100644
--- a/taverna-file-impl/src/main/resources/META-INF/spring/file-impl-context.xml
+++ b/taverna-file-impl/src/main/resources/META-INF/spring/file-impl-context.xml
@@ -3,119 +3,119 @@
 	xsi:schemaLocation="http://www.springframework.org/schema/beans
                       http://www.springframework.org/schema/beans/spring-beans.xsd">
 
-	<bean id="FileCloseMenuAction" class="net.sf.taverna.t2.workbench.file.impl.menu.FileCloseMenuAction">
+	<bean id="FileCloseMenuAction" class="org.apache.taverna.workbench.file.impl.menu.FileCloseMenuAction">
     	<constructor-arg ref="editManager" />
     	<constructor-arg>
 			<ref local="FileManagerImpl" />
 		</constructor-arg>
     </bean>
-	<bean id="FileNewMenuAction" class="net.sf.taverna.t2.workbench.file.impl.menu.FileNewMenuAction">
+	<bean id="FileNewMenuAction" class="org.apache.taverna.workbench.file.impl.menu.FileNewMenuAction">
     	<constructor-arg>
 			<ref local="FileManagerImpl" />
 		</constructor-arg>
     </bean>
-	<bean id="FileOpenMenuAction" class="net.sf.taverna.t2.workbench.file.impl.menu.FileOpenMenuAction">
+	<bean id="FileOpenMenuAction" class="org.apache.taverna.workbench.file.impl.menu.FileOpenMenuAction">
     	<constructor-arg>
 			<ref local="FileManagerImpl" />
 		</constructor-arg>
     </bean>
-	<bean id="FileOpenFromURLMenuAction" class="net.sf.taverna.t2.workbench.file.impl.menu.FileOpenFromURLMenuAction">
+	<bean id="FileOpenFromURLMenuAction" class="org.apache.taverna.workbench.file.impl.menu.FileOpenFromURLMenuAction">
     	<constructor-arg>
 			<ref local="FileManagerImpl" />
 		</constructor-arg>
     </bean>
-	<bean id="FileOpenMenuSection" class="net.sf.taverna.t2.workbench.file.impl.menu.FileOpenMenuSection" />
-	<bean id="FileOpenRecentMenuAction" class="net.sf.taverna.t2.workbench.file.impl.menu.FileOpenRecentMenuAction">
+	<bean id="FileOpenMenuSection" class="org.apache.taverna.workbench.file.impl.menu.FileOpenMenuSection" />
+	<bean id="FileOpenRecentMenuAction" class="org.apache.taverna.workbench.file.impl.menu.FileOpenRecentMenuAction">
     	<constructor-arg>
 			<ref local="FileManagerImpl" />
 		</constructor-arg>
  		<property name="applicationConfiguration" ref="applicationConfiguration"/>
     </bean>
-	<bean id="FileSaveMenuSection" class="net.sf.taverna.t2.workbench.file.impl.menu.FileSaveMenuSection" />
-	<bean id="FileSaveMenuAction" class="net.sf.taverna.t2.workbench.file.impl.menu.FileSaveMenuAction">
+	<bean id="FileSaveMenuSection" class="org.apache.taverna.workbench.file.impl.menu.FileSaveMenuSection" />
+	<bean id="FileSaveMenuAction" class="org.apache.taverna.workbench.file.impl.menu.FileSaveMenuAction">
     	<constructor-arg ref="editManager" />
     	<constructor-arg>
 			<ref local="FileManagerImpl" />
 		</constructor-arg>
     </bean>
-	<bean id="FileSaveAllMenuAction" class="net.sf.taverna.t2.workbench.file.impl.menu.FileSaveAllMenuAction">
+	<bean id="FileSaveAllMenuAction" class="org.apache.taverna.workbench.file.impl.menu.FileSaveAllMenuAction">
     	<constructor-arg ref="editManager" />
     	<constructor-arg>
 			<ref local="FileManagerImpl" />
 		</constructor-arg>
     </bean>
-	<bean id="FileSaveAsMenuAction" class="net.sf.taverna.t2.workbench.file.impl.menu.FileSaveAsMenuAction">
+	<bean id="FileSaveAsMenuAction" class="org.apache.taverna.workbench.file.impl.menu.FileSaveAsMenuAction">
     	<constructor-arg>
 			<ref local="FileManagerImpl" />
 		</constructor-arg>
     </bean>
-	<bean id="WorkflowsMenu" class="net.sf.taverna.t2.workbench.file.impl.menu.WorkflowsMenu">
+	<bean id="WorkflowsMenu" class="org.apache.taverna.workbench.file.impl.menu.WorkflowsMenu">
 	    <constructor-arg ref="editManager" />
     	<constructor-arg>
 			<ref local="FileManagerImpl" />
 		</constructor-arg>
 	</bean>
-	<bean id="FileCloseAllMenuAction" class="net.sf.taverna.t2.workbench.file.impl.menu.FileCloseAllMenuAction">
+	<bean id="FileCloseAllMenuAction" class="org.apache.taverna.workbench.file.impl.menu.FileCloseAllMenuAction">
     	<constructor-arg ref="editManager" />
     	<constructor-arg>
 			<ref local="FileManagerImpl" />
 		</constructor-arg>
     </bean>
-	<bean id="FileToolbarMenuSection" class="net.sf.taverna.t2.workbench.file.impl.toolbar.FileToolbarMenuSection" />
-	<bean id="NewToolbarAction" class="net.sf.taverna.t2.workbench.file.impl.toolbar.NewToolbarAction">
+	<bean id="FileToolbarMenuSection" class="org.apache.taverna.workbench.file.impl.toolbar.FileToolbarMenuSection" />
+	<bean id="NewToolbarAction" class="org.apache.taverna.workbench.file.impl.toolbar.NewToolbarAction">
     	<constructor-arg>
 			<ref local="FileManagerImpl" />
 		</constructor-arg>
     </bean>
-	<bean id="OpenToolbarAction" class="net.sf.taverna.t2.workbench.file.impl.toolbar.OpenToolbarAction">
+	<bean id="OpenToolbarAction" class="org.apache.taverna.workbench.file.impl.toolbar.OpenToolbarAction">
     	<constructor-arg>
 			<ref local="FileManagerImpl" />
 		</constructor-arg>
     </bean>
-	<bean id="OpenWorkflowFromURLToolbarAction" class="net.sf.taverna.t2.workbench.file.impl.toolbar.OpenWorkflowFromURLToolbarAction">
+	<bean id="OpenWorkflowFromURLToolbarAction" class="org.apache.taverna.workbench.file.impl.toolbar.OpenWorkflowFromURLToolbarAction">
     	<constructor-arg>
 			<ref local="FileManagerImpl" />
 		</constructor-arg>
     </bean>
-	<bean id="SaveToolbarAction" class="net.sf.taverna.t2.workbench.file.impl.toolbar.SaveToolbarAction">
+	<bean id="SaveToolbarAction" class="org.apache.taverna.workbench.file.impl.toolbar.SaveToolbarAction">
     	<constructor-arg ref="editManager" />
     	<constructor-arg>
 			<ref local="FileManagerImpl" />
 		</constructor-arg>
     </bean>
-	<bean id="CloseToolbarAction" class="net.sf.taverna.t2.workbench.file.impl.toolbar.CloseToolbarAction">
+	<bean id="CloseToolbarAction" class="org.apache.taverna.workbench.file.impl.toolbar.CloseToolbarAction">
     	<constructor-arg ref="editManager" />
     	<constructor-arg>
 			<ref local="FileManagerImpl" />
 		</constructor-arg>
     </bean>
 
-	<bean id="T2DataflowOpener" class="net.sf.taverna.t2.workbench.file.impl.T2DataflowOpener">
+	<bean id="T2DataflowOpener" class="org.apache.taverna.workbench.file.impl.T2DataflowOpener">
 			<property name="workflowBundleIO" ref="workflowBundleIO"/>
 	</bean>
 
-	<bean id="WorkflowBundleOpener" class="net.sf.taverna.t2.workbench.file.impl.WorkflowBundleOpener">
+	<bean id="WorkflowBundleOpener" class="org.apache.taverna.workbench.file.impl.WorkflowBundleOpener">
 			<property name="workflowBundleIO" ref="workflowBundleIO"/>
 	</bean>
-	<bean id="WorkflowBundleSaver" class="net.sf.taverna.t2.workbench.file.impl.WorkflowBundleSaver">
+	<bean id="WorkflowBundleSaver" class="org.apache.taverna.workbench.file.impl.WorkflowBundleSaver">
 			<property name="workflowBundleIO" ref="workflowBundleIO"/>
 	</bean>
 
-	<bean id="CloseWorkflowsOnShutdown" class="net.sf.taverna.t2.workbench.file.impl.hooks.CloseWorkflowsOnShutdown">
+	<bean id="CloseWorkflowsOnShutdown" class="org.apache.taverna.workbench.file.impl.hooks.CloseWorkflowsOnShutdown">
     	<constructor-arg ref="editManager" />
     	<constructor-arg>
 			<ref local="FileManagerImpl" />
 		</constructor-arg>
     </bean>
 
-	<bean id="FileManagerImpl" class="net.sf.taverna.t2.workbench.file.impl.FileManagerImpl">
+	<bean id="FileManagerImpl" class="org.apache.taverna.workbench.file.impl.FileManagerImpl">
     	<constructor-arg name="editManager" ref="editManager" />
     	<property name="dataflowPersistenceHandlerRegistry">
     		<ref local="DataflowPersistenceHandlerRegistry"/>
     	</property>
 	</bean>
 
-	<bean id="DataflowPersistenceHandlerRegistry" class="net.sf.taverna.t2.workbench.file.impl.DataflowPersistenceHandlerRegistry">
+	<bean id="DataflowPersistenceHandlerRegistry" class="org.apache.taverna.workbench.file.impl.DataflowPersistenceHandlerRegistry">
     	<property name="dataflowPersistenceHandlers" ref="dataflowPersistenceHandlers" />
 	</bean>
 

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-file-impl/src/test/java/net/sf/taverna/t2/workbench/file/impl/FileManagerTest.java
----------------------------------------------------------------------
diff --git a/taverna-file-impl/src/test/java/net/sf/taverna/t2/workbench/file/impl/FileManagerTest.java b/taverna-file-impl/src/test/java/net/sf/taverna/t2/workbench/file/impl/FileManagerTest.java
index 4683399..d31825a 100644
--- a/taverna-file-impl/src/test/java/net/sf/taverna/t2/workbench/file/impl/FileManagerTest.java
+++ b/taverna-file-impl/src/test/java/net/sf/taverna/t2/workbench/file/impl/FileManagerTest.java
@@ -35,18 +35,18 @@ import java.util.List;
 
 import org.apache.taverna.lang.observer.Observable;
 import org.apache.taverna.lang.observer.Observer;
-import net.sf.taverna.t2.workbench.edits.Edit;
-import net.sf.taverna.t2.workbench.edits.EditManager;
-import net.sf.taverna.t2.workbench.edits.impl.EditManagerImpl;
-import net.sf.taverna.t2.workbench.file.DataflowInfo;
-import net.sf.taverna.t2.workbench.file.DataflowPersistenceHandler;
-import net.sf.taverna.t2.workbench.file.FileManager;
-import net.sf.taverna.t2.workbench.file.events.FileManagerEvent;
-import net.sf.taverna.t2.workbench.file.events.SetCurrentDataflowEvent;
-import net.sf.taverna.t2.workbench.file.exceptions.OpenException;
-import net.sf.taverna.t2.workbench.file.exceptions.OverwriteException;
-import net.sf.taverna.t2.workflow.edits.AddProcessorEdit;
-import net.sf.taverna.t2.workflow.edits.RenameEdit;
+import org.apache.taverna.workbench.edits.Edit;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.edits.impl.EditManagerImpl;
+import org.apache.taverna.workbench.file.DataflowInfo;
+import org.apache.taverna.workbench.file.DataflowPersistenceHandler;
+import org.apache.taverna.workbench.file.FileManager;
+import org.apache.taverna.workbench.file.events.FileManagerEvent;
+import org.apache.taverna.workbench.file.events.SetCurrentDataflowEvent;
+import org.apache.taverna.workbench.file.exceptions.OpenException;
+import org.apache.taverna.workbench.file.exceptions.OverwriteException;
+import org.apache.taverna.workflow.edits.AddProcessorEdit;
+import org.apache.taverna.workflow.edits.RenameEdit;
 
 import org.junit.After;
 import org.junit.Before;

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-graph-model/src/main/java/net/sf/taverna/t2/workbench/models/graph/DefaultGraphEventManager.java
----------------------------------------------------------------------
diff --git a/taverna-graph-model/src/main/java/net/sf/taverna/t2/workbench/models/graph/DefaultGraphEventManager.java b/taverna-graph-model/src/main/java/net/sf/taverna/t2/workbench/models/graph/DefaultGraphEventManager.java
deleted file mode 100644
index 8dc4731..0000000
--- a/taverna-graph-model/src/main/java/net/sf/taverna/t2/workbench/models/graph/DefaultGraphEventManager.java
+++ /dev/null
@@ -1,271 +0,0 @@
-/*******************************************************************************
- * 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.models.graph;
-
-import static javax.swing.SwingUtilities.convertPointFromScreen;
-import static javax.swing.SwingUtilities.invokeLater;
-import static net.sf.taverna.t2.workbench.models.graph.GraphController.PortStyle.ALL;
-import static net.sf.taverna.t2.workbench.models.graph.GraphController.PortStyle.NONE;
-
-import java.awt.Component;
-import java.awt.Point;
-import java.awt.event.ActionEvent;
-import java.net.URI;
-import java.util.List;
-
-import javax.swing.AbstractAction;
-import javax.swing.JMenu;
-import javax.swing.JMenuItem;
-import javax.swing.JPopupMenu;
-
-import net.sf.taverna.t2.ui.menu.MenuManager;
-import org.apache.taverna.scufl2.api.activity.Activity;
-import org.apache.taverna.scufl2.api.common.Scufl2Tools;
-import org.apache.taverna.scufl2.api.core.Processor;
-import org.apache.taverna.scufl2.api.profiles.ProcessorBinding;
-
-/**
- * Manager for handling UI events on GraphElements.
- *
- * @author David Withers
- */
-public class DefaultGraphEventManager implements GraphEventManager {
-	private static final URI NESTED_WORKFLOW_URI = URI
-			.create("http://ns.taverna.org.uk/2010/activity/nested-workflow");
-
-	private GraphController graphController;
-	private Component component;
-	private JPopupMenu menu;
-	private MenuManager menuManager;
-
-	private Scufl2Tools scufl2Tools = new Scufl2Tools();
-
-	/**
-	 * Constructs a new instance of GraphEventManager.
-	 *
-	 * @param graphController
-	 * @param component
-	 *            component to use when displaying popup menus
-	 */
-	public DefaultGraphEventManager(GraphController graphController, Component component,
-			MenuManager menuManager) {
-		this.graphController = graphController;
-		this.component = component;
-		this.menuManager = menuManager;
-	}
-
-	@Override
-	public void mouseClicked(final GraphElement graphElement, short button, boolean altKey,
-			boolean ctrlKey, boolean metaKey, final int x, final int y, int screenX, int screenY) {
-		Object dataflowObject = graphElement.getWorkflowBean();
-
-		// For both left and right click - add to selection model
-		if (graphController.getDataflowSelectionModel() != null)
-			graphController.getDataflowSelectionModel().addSelection(dataflowObject);
-
-		if ((button != 2) && !ctrlKey)return;
-
-		// If this was a right click - show a pop-up as well
-		if (dataflowObject == null)
-			menu = menuManager.createContextMenu(graphController.getWorkflow(),
-					graphController.getWorkflow(), component);
-		else {
-			menu = menuManager.createContextMenu(graphController.getWorkflow(),
-					dataflowObject, component);
-			if (dataflowObject instanceof Processor) {
-				final Processor processor = (Processor) dataflowObject;
-				ProcessorBinding processorBinding = scufl2Tools
-						.processorBindingForProcessor(processor,
-								graphController.getProfile());
-				final Activity activity = processorBinding.getBoundActivity();
-				if (menu == null)
-					menu = new JPopupMenu();
-				if (graphElement instanceof GraphNode) {
-					defineMenuForGraphElement(graphElement, x, y, processor,
-							activity);
-				} else if (graphElement instanceof Graph) {
-					defineMenuForGraphBackground(activity);
-				}
-			}
-		}
-
-		if (menu != null) {
-			final Point p = new Point(screenX, screenY);
-			convertPointFromScreen(p, component);
-			invokeLater(new Runnable() {
-				@Override
-				public void run() {
-					menu.show(component, p.x, p.y);
-				}
-			});
-		}
-	}
-
-	@SuppressWarnings("serial")
-	private void defineMenuForGraphBackground(final Activity activity) {
-		if (activity.getType().equals(NESTED_WORKFLOW_URI)) {
-			menu.addSeparator();
-			menu.add(new JMenuItem(new AbstractAction("Hide nested workflow") {
-				@Override
-				public void actionPerformed(ActionEvent ev) {
-					graphController.setExpandNestedDataflow(activity, false);
-					graphController.redraw();
-				}
-			}));
-		}
-	}
-
-	@SuppressWarnings("serial")
-	private void defineMenuForGraphElement(final GraphElement graphElement,
-			final int x, final int y, final Processor processor,
-			final Activity activity) {
-		if (graphController.getPortStyle(processor).equals(NONE)) {
-			menu.addSeparator();
-			menu.add(new JMenuItem(new AbstractAction("Show ports") {
-				@Override
-				public void actionPerformed(ActionEvent ev) {
-					graphController.setPortStyle(processor, ALL);
-					graphController.redraw();
-				}
-			}));
-		} else if (graphController.getPortStyle(processor).equals(ALL)) {
-			menu.addSeparator();
-			menu.add(new JMenuItem(new AbstractAction("Hide ports") {
-				@Override
-				public void actionPerformed(ActionEvent arg0) {
-					graphController.setPortStyle(processor, NONE);
-					graphController.redraw();
-				}
-			}));
-		}
-
-		if (activity.getType().equals(NESTED_WORKFLOW_URI)) {
-			menu.addSeparator();
-			menu.add(new JMenuItem(new AbstractAction("Show nested workflow") {
-				@Override
-				public void actionPerformed(ActionEvent arg0) {
-					graphController.setExpandNestedDataflow(activity, true);
-					graphController.redraw();
-				}
-			}));
-		}
-
-		menu.addSeparator();
-
-		GraphNode graphNode = (GraphNode) graphElement;
-
-		List<GraphNode> sourceNodes = graphNode.getSourceNodes();
-		if (sourceNodes.size() == 1) {
-			final GraphNode sourceNode = sourceNodes.get(0);
-			if (sourceNode.getLabel() != null) {
-				menu.add(new JMenuItem(new AbstractAction("Link from output '"
-						+ sourceNode.getLabel() + "'") {
-					@Override
-					public void actionPerformed(ActionEvent arg0) {
-						graphController.startEdgeCreation(sourceNode,
-								new Point(x, y));
-					}
-				}));
-			}
-		} else if (sourceNodes.size() > 0) {
-			JMenu linkMenu = new JMenu("Link from output...");
-			menu.add(linkMenu);
-			for (final GraphNode sourceNode : sourceNodes) {
-				linkMenu.add(new JMenuItem(new AbstractAction(sourceNode
-						.getLabel()) {
-					@Override
-					public void actionPerformed(ActionEvent arg0) {
-						graphController.startEdgeCreation(sourceNode,
-								new Point(x, y));
-					}
-				}));
-			}
-		}
-
-		List<GraphNode> sinkNodes = graphNode.getSinkNodes();
-		if (sinkNodes.size() == 1) {
-			final GraphNode sinkNode = sinkNodes.get(0);
-			if (sinkNode.getLabel() != null) {
-				menu.add(new JMenuItem(new AbstractAction("Link to input '"
-						+ sinkNode.getLabel() + "'") {
-					@Override
-					public void actionPerformed(ActionEvent arg0) {
-						graphController.startEdgeCreation(sinkNode, new Point(
-								x, y));
-					}
-				}));
-			}
-		} else if (sinkNodes.size() > 0) {
-			JMenu linkMenu = new JMenu("Link to input...");
-			menu.add(linkMenu);
-			for (final GraphNode sinkNode : sinkNodes) {
-				linkMenu.add(new JMenuItem(new AbstractAction(sinkNode
-						.getLabel()) {
-					@Override
-					public void actionPerformed(ActionEvent arg0) {
-						graphController.startEdgeCreation(sinkNode, new Point(
-								x, y));
-					}
-				}));
-			}
-		}
-	}
-
-	@Override
-	public void mouseDown(GraphElement graphElement, short button,
-			boolean altKey, boolean ctrlKey, boolean metaKey, int x, int y,
-			int screenX, int screenY) {
-		if (button == 0)
-			graphController.startEdgeCreation(graphElement, new Point(x, y));
-	}
-
-	@Override
-	public void mouseUp(GraphElement graphElement, short button,
-			boolean altKey, boolean ctrlKey, boolean metaKey, final int x,
-			final int y, int screenX, int screenY) {
-		if (button == 0)
-			graphController.stopEdgeCreation(graphElement, new Point(screenX,
-					screenY));
-	}
-
-	@Override
-	public void mouseMoved(GraphElement graphElement, short button,
-			boolean altKey, boolean ctrlKey, boolean metaKey, int x, int y,
-			int screenX, int screenY) {
-		graphController.moveEdgeCreationTarget(graphElement, new Point(x, y));
-	}
-
-	@Override
-	public void mouseOver(GraphElement graphElement, short button,
-			boolean altKey, boolean ctrlKey, boolean metaKey, int x, int y,
-			int screenX, int screenY) {
-		if (graphElement.getWorkflowBean() != null)
-			graphElement.setActive(true);
-	}
-
-	@Override
-	public void mouseOut(GraphElement graphElement, short button,
-			boolean altKey, boolean ctrlKey, boolean metaKey, int x, int y,
-			int screenX, int screenY) {
-		if (graphElement.getWorkflowBean() != null)
-			graphElement.setActive(false);
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-graph-model/src/main/java/net/sf/taverna/t2/workbench/models/graph/DotWriter.java
----------------------------------------------------------------------
diff --git a/taverna-graph-model/src/main/java/net/sf/taverna/t2/workbench/models/graph/DotWriter.java b/taverna-graph-model/src/main/java/net/sf/taverna/t2/workbench/models/graph/DotWriter.java
deleted file mode 100644
index 07cdbad..0000000
--- a/taverna-graph-model/src/main/java/net/sf/taverna/t2/workbench/models/graph/DotWriter.java
+++ /dev/null
@@ -1,253 +0,0 @@
-/*******************************************************************************
- * 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.models.graph;
-
-import static java.lang.String.format;
-import static net.sf.taverna.t2.workbench.models.graph.Graph.Alignment.HORIZONTAL;
-import static net.sf.taverna.t2.workbench.models.graph.Graph.Alignment.VERTICAL;
-import static net.sf.taverna.t2.workbench.models.graph.GraphElement.LineStyle.NONE;
-import static net.sf.taverna.t2.workbench.models.graph.GraphShapeElement.Shape.RECORD;
-
-import java.awt.Color;
-import java.io.IOException;
-import java.io.Writer;
-import java.util.List;
-
-import net.sf.taverna.t2.workbench.models.graph.Graph.Alignment;
-
-/**
- * Writer for creating a graphical representation of a Graph in the DOT language.
- * 
- * @author David Withers
- */
-public class DotWriter {
-	private static final String EOL = System.getProperty("line.separator");
-
-	private Writer writer;
-
-	/**
-	 * Constructs a new instance of DotWriter.
-	 *
-	 * @param writer
-	 */
-	public DotWriter(Writer writer) {
-		this.writer = writer;
-	}
-
-	/**
-	 * Writes a graphical representation of a Graph in the DOT language to a Writer.
-	 * 
-	 * @param graph
-	 * @throws IOException
-	 */
-	public void writeGraph(Graph graph) throws IOException {
-		writeLine("digraph \"" + graph.getId() + "\" {");
-
-		// Overall graph style
-		writeLine(" graph [");
-		writeLine("  bgcolor=\"" + getHexValue(graph.getFillColor()) + "\"");
-		writeLine("  color=\"black\"");
-		writeLine("  fontsize=\"10\"");
-		writeLine("  labeljust=\"left\"");
-		writeLine("  clusterrank=\"local\"");
-		writeLine("  ranksep=\"0.22\"");
-		writeLine("  nodesep=\"0.05\"");
-		// Set left to right view if alignment is horizontal
-		if (graph.getAlignment().equals(HORIZONTAL))
-			writeLine("  rankdir=\"LR\"");
-		writeLine(" ]");
-
-		// Overall node style
-		writeLine(" node [");
-		writeLine("  fontname=\"Helvetica\"");
-		writeLine("  fontsize=\"10\"");
-		writeLine("  fontcolor=\"black\"");
-		writeLine("  shape=\"record\"");
-		writeLine("  height=\"0\"");
-		writeLine("  width=\"0\"");
-		writeLine("  color=\"black\"");
-		writeLine("  fillcolor=\"lightgoldenrodyellow\"");
-		writeLine("  style=\"filled\"");
-		writeLine(" ];");
-
-		// Overall edge style
-		writeLine(" edge [");
-		writeLine("  fontname=\"Helvetica\"");
-		writeLine("  fontsize=\"8\"");
-		writeLine("  fontcolor=\"black\"");
-		writeLine("  color=\"black\"");
-		writeLine(" ];");
-
-		for (GraphNode node : graph.getNodes()) {
-			if (node.isExpanded())
-				writeSubGraph(node.getGraph(), " ");
-			else
-				writeNode(node, graph.getAlignment(), " ");
-		}
-
-		for (Graph subGraph : graph.getSubgraphs())
-			writeSubGraph(subGraph, " ");
-
-		for (GraphEdge edge : graph.getEdges())
-			writeEdges(edge, graph.getAlignment(), " ");
-
-		writeLine("}");
-	}
-
-	private void writeSubGraph(Graph graph, String indent) throws IOException {
-		writeLine(format("%ssubgraph \"cluster_%s\" {", indent, graph.getId()));
-		writeLine(format("%s rank=\"same\"", indent));
-
-		StringBuilder style = new StringBuilder();
-		if (graph.getFillColor() != null) {
-			writeLine(format("%s fillcolor=\"%s\"", indent,
-					getHexValue(graph.getFillColor())));
-			style.append("filled");
-		}
-		if (graph.getLineStyle() != null) {
-			style.append(style.length() == 0 ? "" : ",");
-			if (graph.getLineStyle().equals(NONE))
-				style.append("invis");
-			else
-				style.append(graph.getLineStyle().toString().toLowerCase());
-		}
-		writeLine(format("%s style=\"%s\"", indent, style));
-
-		if (graph.getLabel() != null)
-			writeLine(format("%s label=\"%s\"", indent, graph.getLabel()));
-
-		for(GraphNode node : graph.getNodes()) {
-			if (node.isExpanded())
-				writeSubGraph(node.getGraph(), indent + " ");
-			else
-				writeNode(node, graph.getAlignment(), indent + " ");
-		}
-
-		for (Graph subGraph : graph.getSubgraphs())
-			writeSubGraph(subGraph, indent + " ");
-
-		for (GraphEdge edge : graph.getEdges())
-			writeEdges(edge, graph.getAlignment(), indent + " ");
-
-		writeLine(indent + "}");
-	}
-
-	private void writeEdges(GraphEdge edge, Alignment alignment, String indent) throws IOException {
-		GraphNode source = edge.getSource();
-		GraphNode sink = edge.getSink();
-		String sourceId = "\"" + source.getId() + "\"";
-		String sinkId = "\"" + sink.getId() + "\"";
-		
-		if (source.getParent() instanceof GraphNode) {
-			GraphNode parent = (GraphNode) source.getParent();
-			sourceId = "\"" + parent.getId() + "\":" + sourceId;
-		}
-		if (sink.getParent() instanceof GraphNode) {
-			GraphNode parent = (GraphNode) sink.getParent();
-			sinkId = "\"" + parent.getId() + "\":" + sinkId;
-		}
-		/*
-		 * the compass point is required with newer versions of dot (e.g.
-		 * 2.26.3) but is not compatible with older versions (e.g. 1.3)
-		 */
-		if (alignment.equals(HORIZONTAL)) {
-			sourceId = sourceId + ":e";
-			sinkId = sinkId + ":w";
-		} else {
-			sourceId = sourceId + ":s";
-			sinkId = sinkId + ":n";			
-		}
-		writeLine(format("%s%s -> %s [", indent, sourceId, sinkId));
-		writeLine(format("%s arrowhead=\"%s\"", indent, edge
-				.getArrowHeadStyle().toString().toLowerCase()));
-		writeLine(format("%s, arrowtail=\"%s\"", indent, edge
-				.getArrowTailStyle().toString().toLowerCase()));
-		if (edge.getColor() != null)
-			writeLine(format("%s color=\"%s\"", indent,
-					getHexValue(edge.getColor())));
-		writeLine(format("%s]", indent));
-	}
-
-	private void writeNode(GraphNode node, Alignment alignment, String indent) throws IOException {
-		writeLine(format("%s\"%s\" [", indent, node.getId()));
-
-		StringBuilder style = new StringBuilder();
-		if (node.getFillColor() != null) {
-			writeLine(format("%s fillcolor=\"%s\"", indent,
-					getHexValue(node.getFillColor())));
-			style.append("filled");
-		}
-		if (node.getLineStyle() != null) {
-			style.append(style.length() == 0 ? "" : ",");
-			style.append(node.getLineStyle().toString().toLowerCase());
-		}
-		writeLine(format("%s style=\"%s\"", indent, style));
-
-		writeLine(format("%s shape=\"%s\"", indent, node.getShape().toString().toLowerCase()));
-		writeLine(format("%s width=\"%s\"", indent, node.getWidth() / 72f));
-		writeLine(format("%s height=\"%s\"", indent, node.getHeight() / 72f));
-
-		if (node.getShape().equals(RECORD)) {
-			StringBuilder labelString = new StringBuilder();
-			if (alignment.equals(VERTICAL)) {
-				labelString.append("{{");
-				addNodeLabels(node.getSinkNodes(), labelString);
-				labelString.append("}|").append(node.getLabel()).append("|{");
-				addNodeLabels(node.getSourceNodes(), labelString);
-				labelString.append("}}");
-			} else {
-				labelString.append(node.getLabel()).append("|{{");
-				addNodeLabels(node.getSinkNodes(), labelString);
-				labelString.append("}|{");
-				addNodeLabels(node.getSourceNodes(), labelString);
-				labelString.append("}}");
-			}
-			writeLine(format("%s label=\"%s\"", indent, labelString));
-		} else {
-			writeLine(format("%s label=\"%s\"", indent, node.getLabel()));
-		}
-
-		writeLine(format("%s];", indent));
-	}
-
-	private void addNodeLabels(List<GraphNode> nodes, StringBuilder labelString) {
-		String sep = "";
-		for (GraphNode node : nodes)
-			if (node.getLabel() != null) {
-				labelString.append(sep);
-				labelString.append("<");
-				labelString.append(node.getId());
-				labelString.append(">");
-				labelString.append(node.getLabel());
-				sep = "|";
-			}
-	}
-
-	private String getHexValue(Color color) {
-		return format("#%02x%02x%02x", color.getRed(), color.getGreen(),
-				color.getBlue());
-	}
-
-	private void writeLine(String line) throws IOException {
-		writer.write(line);
-		writer.write(EOL);
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-graph-model/src/main/java/net/sf/taverna/t2/workbench/models/graph/Graph.java
----------------------------------------------------------------------
diff --git a/taverna-graph-model/src/main/java/net/sf/taverna/t2/workbench/models/graph/Graph.java b/taverna-graph-model/src/main/java/net/sf/taverna/t2/workbench/models/graph/Graph.java
deleted file mode 100644
index 0ff3852..0000000
--- a/taverna-graph-model/src/main/java/net/sf/taverna/t2/workbench/models/graph/Graph.java
+++ /dev/null
@@ -1,165 +0,0 @@
-/*******************************************************************************
- * 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.models.graph;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-/**
- * A graph model of a dataflow.
- * 
- * @author David Withers
- */
-public class Graph extends GraphShapeElement {
-	public enum Alignment {
-		HORIZONTAL, VERTICAL
-	}
-
-	private List<GraphNode> nodes = new ArrayList<>();
-	private Set<GraphEdge> edges = new HashSet<>();
-	private Set<Graph> subgraphs = new HashSet<>();
-	private Alignment alignment = Alignment.VERTICAL;
-
-	/**
-	 * Constructs a Graph that uses the specified GraphEventManager to handle
-	 * any user generated events on GraphElements.
-	 * 
-	 * @param eventManager
-	 */
-	public Graph(GraphController graphController) {
-		super(graphController);
-	}
-
-	/**
-	 * Adds an edge to the Graph and sets its parent to be this Graph.
-	 * 
-	 * @param edge
-	 *            the edge to add
-	 */
-	public void addEdge(GraphEdge edge) {
-		edge.setParent(this);
-		edges.add(edge);
-	}
-
-	/**
-	 * Adds a node to the Graph and sets its parent to be this Graph.
-	 * 
-	 * @param node
-	 *            the node to add
-	 */
-	public void addNode(GraphNode node) {
-		node.setParent(this);
-		nodes.add(node);
-	}
-
-	/**
-	 * Adds a subgraph to the Graph and sets its parent to be this Graph.
-	 * 
-	 * @param subgraph
-	 *            the subgraph to add
-	 */
-	public void addSubgraph(Graph subgraph) {
-		subgraph.setParent(this);
-		subgraphs.add(subgraph);
-	}
-
-	/**
-	 * Returns the alignment of the Graph.
-	 * 
-	 * @return the alignment of the Graph
-	 */
-	public Alignment getAlignment() {
-		return alignment;
-	}
-
-	/**
-	 * Returns the edges contained in the Graph.
-	 * 
-	 * @return the edges contained in the Graph
-	 */
-	public Set<GraphEdge> getEdges() {
-		return Collections.unmodifiableSet(edges);
-	}
-
-	/**
-	 * Returns the nodes contained in the Graph.
-	 * 
-	 * @return the nodes contained in the Graph
-	 */
-	public List<GraphNode> getNodes() {
-		return Collections.unmodifiableList(nodes);
-	}
-
-	/**
-	 * Returns the subgraphs contained in the Graph.
-	 * 
-	 * @return the subgraphs contained in the Graph
-	 */
-	public Set<Graph> getSubgraphs() {
-		return Collections.unmodifiableSet(subgraphs);
-	}
-
-	/**
-	 * Removes an edge from the Graph.
-	 * 
-	 * @param edge
-	 *            the edge to remove
-	 * @return true if the edge is removed from the Graph
-	 */
-	public boolean removeEdge(GraphEdge edge) {
-		return edges.remove(edge);
-	}
-
-	/**
-	 * Removes a node from the Graph.
-	 * 
-	 * @param node
-	 *            the node to remove
-	 * @return true if the node is removed from the Graph
-	 */
-	public boolean removeNode(GraphNode node) {
-		return nodes.remove(node);
-	}
-
-	/**
-	 * Removes a subgraph from the Graph.
-	 * 
-	 * @param subgraph
-	 *            the subgraph to remove
-	 * @return true if the subgraph is removed from the Graph
-	 */
-	public boolean removeSubgraph(Graph subgraph) {
-		return subgraphs.remove(subgraph);
-	}
-
-	/**
-	 * Sets the alignment of the Graph.
-	 * 
-	 * @param alignment
-	 *            the new alignment
-	 */
-	public void setAlignment(Alignment alignment) {
-		this.alignment = alignment;
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-graph-model/src/main/java/net/sf/taverna/t2/workbench/models/graph/GraphColorManager.java
----------------------------------------------------------------------
diff --git a/taverna-graph-model/src/main/java/net/sf/taverna/t2/workbench/models/graph/GraphColorManager.java b/taverna-graph-model/src/main/java/net/sf/taverna/t2/workbench/models/graph/GraphColorManager.java
deleted file mode 100644
index 603b553..0000000
--- a/taverna-graph-model/src/main/java/net/sf/taverna/t2/workbench/models/graph/GraphColorManager.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*******************************************************************************
- * 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.models.graph;
-
-import java.awt.Color;
-import java.lang.reflect.InvocationTargetException;
-
-import net.sf.taverna.t2.workbench.configuration.colour.ColourManager;
-
-import org.apache.commons.beanutils.PropertyUtils;
-
-import org.apache.taverna.scufl2.api.activity.Activity;
-
-/**
- * Manages the colour of elements in a graph.
- *
- * @author David Withers
- * @author Start Owen
- */
-public class GraphColorManager {
-	private static final String BEANSHELL = "http://ns.taverna.org.uk/2010/activity/beanshell";
-	private static final String LOCALWORKER = "http://ns.taverna.org.uk/2010/activity/localworker";
-
-	private static Color[] subGraphFillColors = new Color[] {
-			Color.decode("#ffffff"), Color.decode("#f0f8ff"),
-			Color.decode("#faebd7"), Color.decode("#f5f5dc") };
-
-	/**
-	 * Returns the colour associated with the Activity.
-	 *
-	 * For unknown activities Color.WHITE is returned.
-	 *
-	 * For {@link LocalworkerActivity} which have been user configured use the
-	 * BeanshellActivity colour
-	 *
-	 * @return the colour associated with the Activity
-	 */
-	public static Color getFillColor(Activity activity, ColourManager colourManager) {
-		try {
-			if (activity.getType().equals(LOCALWORKER)) {
-				// To avoid compile time dependency - read isAltered property as bean
-				if (Boolean.TRUE.equals(PropertyUtils.getProperty(activity, "altered"))) {
-					Color colour = colourManager.getPreferredColour(BEANSHELL);
-					return colour;
-				}
-			}
-		} catch (IllegalAccessException | InvocationTargetException
-				| NoSuchMethodException e) {
-		}
-		Color colour = colourManager.getPreferredColour(activity.getType().toASCIIString());
-		return colour;
-	}
-
-	public static Color getSubGraphFillColor(int depth) {
-		return subGraphFillColors[depth % subGraphFillColors.length];
-	}
-}


[31/51] [partial] incubator-taverna-workbench git commit: all packages are moved to org.apache.taverna.*

Posted by re...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/TrustedCertsTableModel.java
----------------------------------------------------------------------
diff --git a/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/TrustedCertsTableModel.java b/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/TrustedCertsTableModel.java
new file mode 100644
index 0000000..489d7b2
--- /dev/null
+++ b/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/TrustedCertsTableModel.java
@@ -0,0 +1,215 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.credentialmanager;
+
+import static javax.swing.JOptionPane.ERROR_MESSAGE;
+import static javax.swing.JOptionPane.showMessageDialog;
+import static org.apache.taverna.security.credentialmanager.CredentialManager.KeystoreType.TRUSTSTORE;
+import static org.apache.taverna.workbench.ui.credentialmanager.CMStrings.ERROR_TITLE;
+import static org.apache.taverna.workbench.ui.credentialmanager.CredentialManagerUI.TRUST_CERT_ENTRY_TYPE;
+
+import java.util.Set;
+import java.util.TreeSet;
+
+import javax.swing.JFrame;
+import javax.swing.table.AbstractTableModel;
+
+import org.apache.taverna.lang.observer.Observable;
+import org.apache.taverna.lang.observer.Observer;
+import org.apache.taverna.security.credentialmanager.CMException;
+import org.apache.taverna.security.credentialmanager.CredentialManager;
+import org.apache.taverna.security.credentialmanager.KeystoreChangedEvent;
+
+import org.apache.log4j.Logger;
+
+/**
+ * The table model used to display the Keystore's trusted certificate entries.
+ * 
+ * @author Alex Nenadic
+ */
+@SuppressWarnings("serial")
+public class TrustedCertsTableModel extends AbstractTableModel implements
+		Observer<KeystoreChangedEvent> {
+	private static final Logger logger = Logger
+			.getLogger(TrustedCertsTableModel.class);
+
+	// Column names
+	private String[] columnNames;
+	// Table data
+	private Object[][] data;
+	private CredentialManager credManager;
+
+	public TrustedCertsTableModel(CredentialManager credentialManager) {
+		credManager = credentialManager;
+		if (credentialManager == null) {
+			// Failed to instantiate Credential Manager - warn the user and exit
+			String sMessage = "Failed to instantiate Credential Manager. ";
+			logger.error("CM GUI: "+ sMessage);
+			showMessageDialog(new JFrame(), sMessage, ERROR_TITLE,
+					ERROR_MESSAGE);
+			return;
+        }
+
+       	data = new Object[0][0];
+        columnNames = new String[] {
+        	"Entry Type", // type of the Keystore entry
+        	"Owner", // owner's common name
+        	"Issuer", // issuer's common name
+        	"Serial Number", // public key certificate's serial number
+            "Last Modified", // last modified date of the entry
+            "Alias" // the invisible column holding the actual alias in the Keystore
+        };
+
+        try {
+			load();
+		} catch (CMException cme) {
+			String sMessage = "Failed to load trusted certificates";
+			logger.error(sMessage);
+			showMessageDialog(new JFrame(), sMessage, ERROR_TITLE,
+					ERROR_MESSAGE);
+			return;
+		}
+
+        // Start observing changes to the Keystore
+        credManager.addObserver(this);
+    }
+
+    /**
+     * Load the TrustCertsTableModel with trusted certificate entries from the Keystore.
+     */
+	public void load() throws CMException {
+		/*
+		 * Place trusted certificate entries' aliases in a tree map to sort them
+		 */
+		Set<String> aliases = new TreeSet<>();
+		for (String alias : credManager.getAliases(TRUSTSTORE))
+			/*
+			 * We are only interested in trusted certificate entries here. Alias
+			 * for such entries is constructed as
+			 * "trustedcert#<CERT_SERIAL_NUMBER>#<CERT_COMMON_NAME>"
+			 */
+			if (alias.startsWith("trustedcert#"))
+				aliases.add(alias);
+
+		/*
+		 * Create one table row for each trusted certificate entry Each row has
+		 * 4 fields - type, owner name, last modified data and the invisible
+		 * alias
+		 */
+		data = new Object[aliases.size()][6];
+
+		/*
+		 * Iterate through the sorted aliases, retrieving the trusted
+		 * certificate entries and populating the table model
+		 */
+		int i = 0;
+		for (String alias : aliases) {
+			/*
+			 * Populate the type column - it is set with an integer but a custom
+			 * cell renderer will cause a suitable icon to be displayed
+			 */
+			data[i][0] = TRUST_CERT_ENTRY_TYPE;
+
+			/*
+			 * Split the alias string to extract owner, issuer and serial number
+			 * alias =
+			 * "trustedcert#<CERT_SUBJECT_COMMON_NAME>"#"<CERT_ISSUER_COMMON_NAME>"
+			 * #"<CERT_SERIAL_NUMBER>
+			 */
+			String[] aliasComponents = alias.split("#");
+
+			// Populate the owner column extracted from the alias
+			data[i][1] = aliasComponents[1];
+
+			// Populate the issuer column extracted from the alias
+			data[i][2] = aliasComponents[2];
+
+			// Populate the serial number column extracted from the alias
+			data[i][3] = aliasComponents[3];
+
+			// Populate the modified date column
+			//data[iCnt][4] = credManager.getEntryCreationDate(CredentialManager.TRUSTSTORE, alias);
+
+			// Populate the invisible alias column
+			data[i][5] = alias;
+
+			i++;
+		}
+
+        fireTableDataChanged();
+    }
+
+	/**
+	 * Get the number of columns in the table.
+	 */
+	@Override
+	public int getColumnCount() {
+		return columnNames.length;
+	}
+
+	/**
+	 * Get the number of rows in the table.
+	 */
+	@Override
+	public int getRowCount() {
+		return data.length;
+	}
+
+	/**
+	 * Get the name of the column at the given position.
+	 */
+	@Override
+	public String getColumnName(int iCol) {
+		return columnNames[iCol];
+	}
+
+	/**
+	 * Get the cell value at the given row and column position.
+	 */
+	@Override
+	public Object getValueAt(int iRow, int iCol) {
+		return data[iRow][iCol];
+	}
+
+	/**
+	 * Get the class at of the cells at the given column position.
+	 */
+	@Override
+	public Class<? extends Object> getColumnClass(int iCol) {
+		return getValueAt(0, iCol).getClass();
+	}
+
+	/**
+	 * Is the cell at the given row and column position editable?
+	 */
+	@Override
+	public boolean isCellEditable(int iRow, int iCol) {
+		// The table is always read-only
+		return false;
+	}
+
+	@Override
+	public void notify(Observable<KeystoreChangedEvent> sender,
+			KeystoreChangedEvent message) throws Exception {
+		// reload the table
+		if (message.keystoreType.equals(TRUSTSTORE))
+			load();
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/ViewCertDetailsDialog.java
----------------------------------------------------------------------
diff --git a/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/ViewCertDetailsDialog.java b/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/ViewCertDetailsDialog.java
new file mode 100644
index 0000000..ee6f1a7
--- /dev/null
+++ b/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/ViewCertDetailsDialog.java
@@ -0,0 +1,508 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.credentialmanager;
+
+import static java.awt.BorderLayout.CENTER;
+import static java.awt.BorderLayout.NORTH;
+import static java.awt.BorderLayout.SOUTH;
+import static java.awt.Font.BOLD;
+import static java.awt.Font.PLAIN;
+import static java.awt.GridBagConstraints.LINE_START;
+import static javax.security.auth.x500.X500Principal.RFC2253;
+import static javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED;
+import static javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED;
+import static javax.swing.SwingUtilities.invokeLater;
+
+import java.awt.BorderLayout;
+import java.awt.FlowLayout;
+import java.awt.Font;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.Insets;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import java.math.BigInteger;
+import java.security.cert.CertificateEncodingException;
+import java.security.cert.X509Certificate;
+import java.util.ArrayList;
+
+import javax.swing.DefaultListModel;
+import javax.swing.JButton;
+import javax.swing.JDialog;
+import javax.swing.JFrame;
+import javax.swing.JLabel;
+import javax.swing.JList;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.border.CompoundBorder;
+import javax.swing.border.EmptyBorder;
+import javax.swing.border.EtchedBorder;
+
+import org.apache.taverna.security.credentialmanager.CMException;
+import org.apache.taverna.security.credentialmanager.DistinguishedNameParser;
+import org.apache.taverna.security.credentialmanager.ParsedDistinguishedName;
+import org.apache.taverna.workbench.helper.NonBlockedHelpEnabledDialog;
+
+/**
+ * Displays the details of a X.509 certificate.
+ * 
+ * Inspired by the Portlecle tool (http://portecle.sourceforge.net/). and the
+ * view certificate dialog from Firefox's Certificate Manager.
+ */
+@SuppressWarnings("serial")
+public class ViewCertDetailsDialog extends NonBlockedHelpEnabledDialog {
+	// Logger
+	//private static Logger logger = Logger.getLogger(ViewCertDetailsDialog.class);
+	
+	/** Stores certificate to display*/
+	private X509Certificate cert;
+	/** Stores list of serviceURLs to display*/
+	private ArrayList<String> serviceURLs;
+	private final DistinguishedNameParser dnParser;
+
+    /**
+     * Creates new ViewCertDetailsDialog dialog where the parent is a frame.
+     */
+	public ViewCertDetailsDialog(JFrame parent, String title, boolean modal,
+			X509Certificate crt, ArrayList<String> serviceURLs,
+			DistinguishedNameParser dnParser) throws CMException {
+		super(parent, title, modal);
+		this.cert = crt;
+		this.serviceURLs = serviceURLs;
+		this.dnParser = dnParser;
+		initComponents();
+	}
+
+	/**
+	 * Creates new ViewCertDetailsDialog dialog where the parent is a dialog.
+	 */
+	public ViewCertDetailsDialog(JDialog parent, String title, boolean modal,
+			X509Certificate crt, ArrayList<String> urlList,
+			DistinguishedNameParser dnParser) throws CMException {
+		super(parent, title, modal);
+		cert = crt;
+		serviceURLs = urlList;
+		this.dnParser = dnParser;
+		initComponents();
+	}
+
+	/**
+	 * Initialise the dialog's GUI components.
+	 * 
+	 * @throws CMException
+	 *             A problem was encountered getting the certificates' details
+	 */
+	private void initComponents() throws CMException {
+        // Certificate details:
+
+        // Grid Bag Constraints templates for labels (column 1) and 
+    	// values (column 2) of certificate details
+        GridBagConstraints gbcLabel = new GridBagConstraints();
+        gbcLabel.gridx = 0;
+        gbcLabel.ipadx = 20;
+        gbcLabel.gridwidth = 1;
+        gbcLabel.gridheight = 1;
+        gbcLabel.insets = new Insets(2, 15, 2, 2);
+        gbcLabel.anchor = LINE_START;
+
+        GridBagConstraints gbcValue = new GridBagConstraints();
+        gbcValue.gridx = 1;
+        gbcValue.gridwidth = 1;
+        gbcValue.gridheight = 1;
+        gbcValue.insets = new Insets(2, 5, 2, 2);
+        gbcValue.anchor = LINE_START;
+
+        /*
+		 * Netscape Certificate Type non-critical extension (if any) defines the
+		 * intended uses of the certificate - to make it look like firefox's
+		 * view certificate dialog. From openssl's documentation: "The [above]
+		 * extension is non standard, Netscape specific and largely obsolete.
+		 * Their use in new applications is discouraged."
+		 * 
+		 * TODO replace with "basicConstraints, keyUsage and extended key usage
+		 * extensions which are now used instead."
+		 */
+//        byte[] intendedUses = cert.getExtensionValue("2.16.840.1.113730.1.1"); //Netscape Certificate Type OID/*
+//        JLabel jlIntendedUses = null;
+//        JTextField jtfIntendedUsesValue = null;
+//        JPanel jpUses = null;
+//        GridBagConstraints gbc_jpUses = null;
+//        if (intendedUses != null)
+//        {
+//         	jlIntendedUses = new JLabel("This certificate has been approved for the following uses:");
+//         	jlIntendedUses.setFont(new Font(null, Font.BOLD, 11));
+//         	jlIntendedUses.setBorder(new EmptyBorder(5,5,5,5));
+//         	
+//         	jtfIntendedUsesValue = new JTextField(45);
+//         	jtfIntendedUsesValue.setText(CMUtils.getIntendedCertificateUses(intendedUses));
+//        	jtfIntendedUsesValue.setEditable(false);
+//        	jtfIntendedUsesValue.setFont(new Font(null, Font.PLAIN, 11));
+//             
+//        	jpUses = new JPanel(new BorderLayout()); 
+//        	jpUses.add(jlIntendedUses, BorderLayout.NORTH);
+//        	jpUses.add(jtfIntendedUsesValue, BorderLayout.CENTER);
+//        	JSeparator jsp = new JSeparator(JSeparator.HORIZONTAL);
+//        	jpUses.add(jsp, BorderLayout.SOUTH);
+//        	
+//        	gbc_jpUses = (GridBagConstraints) gbcLabel.clone();
+//        	gbc_jpUses.gridy = 0;
+//        	gbc_jpUses.gridwidth = 2; //takes two columns
+//        	gbc_jpUses.insets = new Insets(5, 5, 5, 5);//has slightly bigger insets
+//
+//        }
+
+        //Issued To
+        JLabel jlIssuedTo = new JLabel("Issued To");
+        jlIssuedTo.setFont(new Font(null, Font.BOLD, 11));
+        GridBagConstraints gbc_jlIssuedTo = (GridBagConstraints) gbcLabel.clone();
+        gbc_jlIssuedTo.gridy = 1;
+        gbc_jlIssuedTo.gridwidth = 2; //takes two columns
+        gbc_jlIssuedTo.insets = new Insets(5, 5, 5, 5);//has slightly bigger insets
+
+        // Distinguished Name (DN)
+        String sDN = cert.getSubjectX500Principal().getName(RFC2253);
+        ParsedDistinguishedName parsedDN = dnParser.parseDN(sDN);       
+        // Extract the CN, O, OU and EMAILADDRESS fields
+        String sCN = parsedDN.getCN();
+        String sOrg = parsedDN.getO();
+        String sOU = parsedDN.getOU();
+        //String sEMAILADDRESS = CMX509Util.getEmilAddress();
+
+        // Common Name (CN)
+        JLabel jlCN = new JLabel("Common Name (CN)");
+        jlCN.setFont(new Font(null, PLAIN, 11));
+        GridBagConstraints gbc_jlCN = (GridBagConstraints) gbcLabel.clone();
+        gbc_jlCN.gridy = 2;
+        JLabel jlCNValue = new JLabel(sCN);
+        jlCNValue.setFont(new Font(null, PLAIN, 11));
+        GridBagConstraints gbc_jlCNValue = (GridBagConstraints) gbcValue.clone();
+        gbc_jlCNValue.gridy = 2;
+
+        // Organisation (O)
+        JLabel jlOrg = new JLabel("Organisation (O)");
+        jlOrg.setFont(new Font(null, PLAIN, 11));
+        GridBagConstraints gbc_jlOrg = (GridBagConstraints) gbcLabel.clone();
+        gbc_jlOrg.gridy = 3;
+        JLabel jlOrgValue = new JLabel(sOrg);
+        jlOrgValue.setFont(new Font(null, PLAIN, 11));
+        GridBagConstraints gbc_jlOrgValue = (GridBagConstraints) gbcValue.clone();
+        gbc_jlOrgValue.gridy = 3;
+
+        // Organisation Unit (OU)
+        JLabel jlOU = new JLabel("Organisation Unit (OU)");
+        jlOU.setFont(new Font(null, PLAIN, 11));
+        GridBagConstraints gbc_jlOU = (GridBagConstraints) gbcLabel.clone();
+        gbc_jlOU.gridy = 4;
+        JLabel jlOUValue = new JLabel(sOU);
+        jlOUValue.setFont(new Font(null, PLAIN, 11));
+        GridBagConstraints gbc_jlOUValue = (GridBagConstraints) gbcValue.clone();
+        gbc_jlOUValue.gridy = 4;
+
+        // E-mail Address
+        //JLabel jlEmail = new JLabel("E-mail Address");
+        //jlEmail.setFont(new Font(null, PLAIN, 11));
+        //GridBagConstraints gbc_jlEmail = (GridBagConstraints) gbcLabel.clone();
+        //gbc_jlEmail.gridy = 5;
+        //JLabel jlEmailValue = new JLabel(sEMAILADDRESS);
+        //jlEmailValue.setFont(new Font(null, PLAIN, 11));
+        //GridBagConstraints gbc_jlEmailValue = (GridBagConstraints) gbcValue.clone();
+        //gbc_jlEmailValue.gridy = 5;
+
+        // Serial Number
+        JLabel jlSN = new JLabel("Serial Number");
+        jlSN.setFont(new Font(null, PLAIN, 11));
+        GridBagConstraints gbc_jlSN = (GridBagConstraints) gbcLabel.clone();
+        gbc_jlSN.gridy = 6;
+        JLabel jlSNValue = new JLabel();
+        // Get the hexadecimal serial number
+        StringBuilder strBuff = new StringBuilder(new BigInteger(1,
+                cert.getSerialNumber().toByteArray()).toString(16).toUpperCase());
+        // Place colons at every two hexadecimal characters
+        if (strBuff.length() > 2)
+            for (int iCnt = 2; iCnt < strBuff.length(); iCnt += 3)
+                strBuff.insert(iCnt, ':');
+        jlSNValue.setText(strBuff.toString());
+        jlSNValue.setFont(new Font(null, PLAIN, 11));
+        GridBagConstraints gbc_jlSNValue = (GridBagConstraints) gbcValue.clone();
+        gbc_jlSNValue.gridy = 6;
+
+        // Version
+        JLabel jlVersion = new JLabel("Version");
+        jlVersion.setFont(new Font(null, PLAIN, 11));
+        GridBagConstraints gbc_jlVersion = (GridBagConstraints) gbcLabel.clone();
+        gbc_jlVersion.gridy = 7;
+        JLabel jlVersionValue = new JLabel(Integer.toString(cert.getVersion()));
+        jlVersionValue.setFont(new Font(null, PLAIN, 11));
+        GridBagConstraints gbc_jlVersionValue = (GridBagConstraints) gbcValue.clone();
+        gbc_jlVersionValue.gridy = 7;
+
+        // Issued By
+        JLabel jlIssuedBy = new JLabel("Issued By");
+        jlIssuedBy.setFont(new Font(null, BOLD, 11));
+        GridBagConstraints gbc_jlIssuedBy = (GridBagConstraints) gbcLabel.clone();
+        gbc_jlIssuedBy.gridy = 8;
+        gbc_jlIssuedBy.gridwidth = 2; //takes two columns 
+        gbc_jlIssuedBy.insets = new Insets(5, 5, 5, 5);//has slightly bigger insets        
+
+        // Distinguished Name (DN)
+		String iDN = cert.getIssuerX500Principal().getName(RFC2253);
+		parsedDN = dnParser.parseDN(iDN);
+		// Extract the CN, O and OU fields
+		String iCN = parsedDN.getCN();
+		String iOrg = parsedDN.getO();
+		String iOU = parsedDN.getOU();
+
+		// Common Name (CN)
+		JLabel jlICN = new JLabel("Common Name (CN)");
+		jlICN.setFont(new Font(null, PLAIN, 11));
+		GridBagConstraints gbc_jlICN = (GridBagConstraints) gbcLabel.clone();
+		gbc_jlICN.gridy = 9;
+		JLabel jlICNValue = new JLabel(iCN);
+		jlICNValue.setFont(new Font(null, PLAIN, 11));
+		GridBagConstraints gbc_jlICNValue = (GridBagConstraints) gbcValue
+				.clone();
+		gbc_jlICNValue.gridy = 9;
+
+		// Organisation (O)
+		JLabel jlIOrg = new JLabel("Organisation (O)");
+		jlIOrg.setFont(new Font(null, PLAIN, 11));
+		GridBagConstraints gbc_jlIOrg = (GridBagConstraints) gbcLabel.clone();
+		gbc_jlIOrg.gridy = 10;
+		JLabel jlIOrgValue = new JLabel(iOrg);
+		jlIOrgValue.setFont(new Font(null, PLAIN, 11));
+		GridBagConstraints gbc_jlIOrgValue = (GridBagConstraints) gbcValue
+				.clone();
+		gbc_jlIOrgValue.gridy = 10;
+
+		// Organisation Unit (OU)
+		JLabel jlIOU = new JLabel("Organisation Unit (OU)");
+		jlIOU.setFont(new Font(null, PLAIN, 11));
+		GridBagConstraints gbc_jlIOU = (GridBagConstraints) gbcLabel.clone();
+		gbc_jlIOU.gridy = 11;
+		JLabel jlIOUValue = new JLabel(iOU);
+		jlIOUValue.setFont(new Font(null, PLAIN, 11));
+		GridBagConstraints gbc_jlIOUValue = (GridBagConstraints) gbcValue
+				.clone();
+		gbc_jlIOUValue.gridy = 11;
+
+		// Validity
+		JLabel jlValidity = new JLabel("Validity");
+		jlValidity.setFont(new Font(null, BOLD, 11));
+		GridBagConstraints gbc_jlValidity = (GridBagConstraints) gbcLabel
+				.clone();
+		gbc_jlValidity.gridy = 12;
+		gbc_jlValidity.gridwidth = 2; // takes two columns
+		gbc_jlValidity.insets = new Insets(5, 5, 5, 5);// has slightly bigger insets
+
+		// Issued On
+		JLabel jlIssuedOn = new JLabel("Issued On");
+		jlIssuedOn.setFont(new Font(null, PLAIN, 11));
+		GridBagConstraints gbc_jlIssuedOn = (GridBagConstraints) gbcLabel
+				.clone();
+		gbc_jlIssuedOn.gridy = 13;
+		JLabel jlIssuedOnValue = new JLabel(cert.getNotBefore().toString());
+		jlIssuedOnValue.setFont(new Font(null, PLAIN, 11));
+		GridBagConstraints gbc_jlIssuedOnValue = (GridBagConstraints) gbcValue
+				.clone();
+		gbc_jlIssuedOnValue.gridy = 13;
+
+		// Expires On
+		JLabel jlExpiresOn = new JLabel("Expires On");
+		jlExpiresOn.setFont(new Font(null, PLAIN, 11));
+		GridBagConstraints gbc_jlExpiresOn = (GridBagConstraints) gbcLabel
+				.clone();
+		gbc_jlExpiresOn.gridy = 14;
+		JLabel jlExpiresOnValue = new JLabel(cert.getNotAfter().toString());
+		jlExpiresOnValue.setFont(new Font(null, PLAIN, 11));
+		GridBagConstraints gbc_jlExpiresOnValue = (GridBagConstraints) gbcValue
+				.clone();
+		gbc_jlExpiresOnValue.gridy = 14;
+
+		// Fingerprints
+		byte[] certBinaryEncoding;
+		try {
+			certBinaryEncoding = cert.getEncoded();
+		} catch (CertificateEncodingException ex) {
+			throw new CMException(
+					"Could not get the encoded form of the certificate.", ex);
+		}
+        JLabel jlFingerprints = new JLabel("Fingerprints");
+        jlFingerprints.setFont(new Font(null, BOLD, 11));
+        GridBagConstraints gbc_jlFingerprints = (GridBagConstraints) gbcLabel.clone();
+        gbc_jlFingerprints.gridy = 15;
+        gbc_jlFingerprints.gridwidth = 2; //takes two columns  
+        gbc_jlFingerprints.insets = new Insets(5, 5, 5, 5);//has slightly bigger insets
+
+        // SHA-1 Fingerprint
+        JLabel jlSHA1Fingerprint = new JLabel("SHA1 Fingerprint");
+        jlSHA1Fingerprint.setFont(new Font(null, PLAIN, 11));
+        GridBagConstraints gbc_jlSHA1Fingerprint = (GridBagConstraints) gbcLabel.clone();
+        gbc_jlSHA1Fingerprint.gridy = 16;
+        JLabel jlSHA1FingerprintValue = new JLabel(dnParser.getMessageDigestAsFormattedString(certBinaryEncoding, "SHA1"));
+        jlSHA1FingerprintValue.setFont(new Font(null, PLAIN, 11));
+        GridBagConstraints gbc_jlSHA1FingerprintValue = (GridBagConstraints) gbcValue.clone();
+        gbc_jlSHA1FingerprintValue.gridy = 16;
+
+        // MD5 Fingerprint
+        JLabel jlMD5Fingerprint = new JLabel("MD5 Fingerprint");
+        jlMD5Fingerprint.setFont(new Font(null, PLAIN, 11));
+        GridBagConstraints gbc_jlMD5Fingerprint = (GridBagConstraints) gbcLabel.clone();
+        gbc_jlMD5Fingerprint.gridy = 17;
+        JLabel jlMD5FingerprintValue = new JLabel(dnParser.getMessageDigestAsFormattedString(certBinaryEncoding, "MD5"));
+        jlMD5FingerprintValue.setFont(new Font(null, PLAIN, 11));
+        GridBagConstraints gbc_jlMD5FingerprintValue = (GridBagConstraints) gbcValue.clone();
+        gbc_jlMD5FingerprintValue.gridy = 17;
+        
+		/*
+		 * Empty label to add a bit space at the bottom of the panel to make it
+		 * look like firefox's view certificate dialog
+		 */
+        JLabel jlEmpty = new JLabel("");
+		GridBagConstraints gbc_jlEmpty = (GridBagConstraints) gbcLabel.clone();
+		gbc_jlEmpty.gridy = 18;
+		gbc_jlEmpty.gridwidth = 2; // takes two columns
+		gbc_jlEmpty.ipady = 40;
+
+		JPanel jpCertificate = new JPanel(new GridBagLayout());
+		jpCertificate.setBorder(new CompoundBorder(new EmptyBorder(15, 15, 15,
+				15), new EtchedBorder()));
+
+//        if (intendedUses != null){
+//        	jpCertificate.add(jpUses, gbc_jpUses);
+//        }
+        jpCertificate.add(jlIssuedTo, gbc_jlIssuedTo); // Issued To
+        jpCertificate.add(jlCN, gbc_jlCN);
+        jpCertificate.add(jlCNValue, gbc_jlCNValue);
+        jpCertificate.add(jlOrg, gbc_jlOrg);
+        jpCertificate.add(jlOrgValue, gbc_jlOrgValue);        
+        jpCertificate.add(jlOU, gbc_jlOU);
+        jpCertificate.add(jlOUValue, gbc_jlOUValue);
+        //jpCertificate.add(jlEmail, gbc_jlEmail);
+        //jpCertificate.add(jlEmailValue, gbc_jlEmailValue);
+        jpCertificate.add(jlSN, gbc_jlSN);
+        jpCertificate.add(jlSNValue, gbc_jlSNValue);
+        jpCertificate.add(jlVersion, gbc_jlVersion);
+        jpCertificate.add(jlVersionValue, gbc_jlVersionValue);
+        jpCertificate.add(jlIssuedBy, gbc_jlIssuedBy); //Issued By
+        jpCertificate.add(jlICN, gbc_jlICN);
+        jpCertificate.add(jlICNValue, gbc_jlICNValue);
+        jpCertificate.add(jlIOrg, gbc_jlIOrg);
+        jpCertificate.add(jlIOrgValue, gbc_jlIOrgValue);        
+        jpCertificate.add(jlIOU, gbc_jlIOU);
+        jpCertificate.add(jlIOUValue, gbc_jlIOUValue);
+        jpCertificate.add(jlValidity, gbc_jlValidity); //Validity
+        jpCertificate.add(jlIssuedOn, gbc_jlIssuedOn);
+        jpCertificate.add(jlIssuedOnValue, gbc_jlIssuedOnValue);
+        jpCertificate.add(jlExpiresOn, gbc_jlExpiresOn);
+        jpCertificate.add(jlExpiresOnValue, gbc_jlExpiresOnValue); 
+        jpCertificate.add(jlFingerprints, gbc_jlFingerprints); //Fingerprints
+        jpCertificate.add(jlSHA1Fingerprint, gbc_jlSHA1Fingerprint);
+        jpCertificate.add(jlSHA1FingerprintValue, gbc_jlSHA1FingerprintValue);
+        jpCertificate.add(jlMD5Fingerprint, gbc_jlMD5Fingerprint);
+        jpCertificate.add(jlMD5FingerprintValue, gbc_jlMD5FingerprintValue);
+        jpCertificate.add(jlEmpty, gbc_jlEmpty); //Empty label to get some vertical space on the frame
+
+        // List of serviceURLs
+        JPanel jpURLs  = null; // Panel to hold the URL list
+		if (serviceURLs != null) { //if service serviceURLs are not null (even if empty - show empty list)
+
+        	jpURLs = new JPanel(new BorderLayout());
+        	jpURLs.setBorder(new CompoundBorder(
+                    new EmptyBorder(0, 15, 0, 15), new EtchedBorder()));
+            // Label
+            JLabel jlServiceURLs = new JLabel ("Service URLs this key pair will be used for:");
+            jlServiceURLs.setFont(new Font(null, Font.BOLD, 11));
+            jlServiceURLs.setBorder(new EmptyBorder(5,5,5,5));    
+      
+            // New empty service serviceURLs list
+			DefaultListModel<String> jltModel = new DefaultListModel<>();
+			JList<String> jltServiceURLs = new JList<>(jltModel);
+			for (String url : serviceURLs)
+				jltModel.addElement(url);
+			// don't show more than 5 otherwise the window is too big
+            jltServiceURLs.setVisibleRowCount(5);
+            
+			// Scroll pane for service serviceURLs
+			JScrollPane jspServiceURLs = new JScrollPane(jltServiceURLs,
+					VERTICAL_SCROLLBAR_AS_NEEDED,
+					HORIZONTAL_SCROLLBAR_AS_NEEDED);
+			jspServiceURLs.getViewport().setBackground(
+					jltServiceURLs.getBackground());
+
+			jpURLs.add(jlServiceURLs, NORTH);
+			jpURLs.add(jspServiceURLs, CENTER);
+
+			// Put it on the main content pane
+			getContentPane().add(jpURLs, CENTER);
+		}
+
+		// OK button
+		JPanel jpOK = new JPanel(new FlowLayout(FlowLayout.CENTER));
+
+		final JButton jbOK = new JButton("OK");
+		jbOK.addActionListener(new ActionListener() {
+			@Override
+			public void actionPerformed(ActionEvent evt) {
+				okPressed();
+			}
+		});
+
+		jpOK.add(jbOK);
+
+		/*
+		 * Put it all together (panel with URL list is already added, if it was
+		 * not null)
+		 */
+		getContentPane().add(jpCertificate, NORTH);
+		getContentPane().add(jpOK, SOUTH);
+
+		// Resizing wreaks havoc
+		setResizable(false);
+
+		addWindowListener(new WindowAdapter() {
+			@Override
+			public void windowClosing(WindowEvent evt) {
+				closeDialog();
+			}
+		});
+
+		getRootPane().setDefaultButton(jbOK);
+
+		pack();
+
+		invokeLater(new Runnable() {
+			@Override
+			public void run() {
+				jbOK.requestFocus();
+			}
+		});
+	}
+
+	private void okPressed() {
+		closeDialog();
+	}
+
+	private void closeDialog() {
+		setVisible(false);
+		dispose();
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/ViewUsernamePasswordEntryDialog.java
----------------------------------------------------------------------
diff --git a/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/ViewUsernamePasswordEntryDialog.java b/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/ViewUsernamePasswordEntryDialog.java
new file mode 100644
index 0000000..a9f1847
--- /dev/null
+++ b/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/ViewUsernamePasswordEntryDialog.java
@@ -0,0 +1,198 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.credentialmanager;
+
+import static java.awt.BorderLayout.CENTER;
+import static java.awt.BorderLayout.SOUTH;
+import static java.awt.GridBagConstraints.HORIZONTAL;
+import static java.awt.GridBagConstraints.NONE;
+import static java.awt.GridBagConstraints.WEST;
+
+import java.awt.BorderLayout;
+import java.awt.FlowLayout;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.Insets;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+
+import javax.swing.JButton;
+import javax.swing.JDialog;
+import javax.swing.JFrame;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JTextField;
+import javax.swing.border.CompoundBorder;
+import javax.swing.border.EmptyBorder;
+import javax.swing.border.EtchedBorder;
+
+import org.apache.taverna.workbench.helper.NonBlockedHelpEnabledDialog;
+
+/**
+ * Dialog used for viewing service URL, username and password.
+ * 
+ * @author Alex Nenadic
+ */
+@SuppressWarnings("serial")
+public class ViewUsernamePasswordEntryDialog extends
+		NonBlockedHelpEnabledDialog {
+	/** Service URL field */
+	private JTextField serviceURLField;
+	/** Username field */
+	private JTextField usernameField;
+	/** Password field */
+	private JTextField passwordField;
+	/** Service URL value */
+	private String serviceURL;
+	/** Service username value */
+	private String username;
+	/** Service password value */
+	private String password;
+
+	public ViewUsernamePasswordEntryDialog(JFrame parent, String currentURL,
+			String currentUsername, String currentPassword) {
+		super(parent, "View username and password for a service", true);
+		serviceURL = currentURL;
+		username = currentUsername;
+		password = currentPassword;
+		initComponents();
+	}
+
+	public ViewUsernamePasswordEntryDialog(JDialog parent, String currentURL,
+			String currentUsername, String currentPassword) {
+		super(parent, "View username and password for a service", true);
+		serviceURL = currentURL;
+		username = currentUsername;
+		password = currentPassword;
+		initComponents();
+	}
+
+	private void initComponents() {
+		getContentPane().setLayout(new BorderLayout());
+
+		JLabel serviceURLLabel = new JLabel("Service URL");
+		serviceURLLabel.setBorder(new EmptyBorder(0, 5, 0, 0));
+		JLabel usernameLabel = new JLabel("Username");
+		usernameLabel.setBorder(new EmptyBorder(0, 5, 0, 0));
+		JLabel passwordLabel = new JLabel("Password");
+		passwordLabel.setBorder(new EmptyBorder(0, 5, 0, 0));
+
+		// Populate the fields with values and disable user input
+		serviceURLField = new JTextField();
+		serviceURLField.setText(serviceURL);
+		serviceURLField.setEditable(false);
+
+		usernameField = new JTextField(15);
+		usernameField.setText(username);
+		usernameField.setEditable(false);
+
+		passwordField = new JTextField(15);
+		passwordField.setText(password);
+		passwordField.setEditable(false);
+
+		JButton okButton = new JButton("OK");
+		okButton.addActionListener(new ActionListener() {
+			@Override
+			public void actionPerformed(ActionEvent evt) {
+				closeDialog();
+			}
+		});
+
+		JPanel fieldsPanel = new JPanel(new GridBagLayout());
+
+		GridBagConstraints gbc = new GridBagConstraints();
+		gbc.weighty = 0.0;
+
+		gbc.weightx = 0.0;
+		gbc.gridx = 0;
+		gbc.gridy = 0;
+		gbc.fill = NONE;
+		gbc.anchor = WEST;
+		gbc.insets = new Insets(5, 10, 0, 0);
+		fieldsPanel.add(serviceURLLabel, gbc);
+
+		gbc.weightx = 1.0;
+		gbc.gridx = 1;
+		gbc.gridy = 0;
+		gbc.fill = HORIZONTAL;
+		gbc.anchor = WEST;
+		gbc.insets = new Insets(5, 10, 0, 5);
+		fieldsPanel.add(serviceURLField, gbc);
+
+		gbc.weightx = 0.0;
+		gbc.gridx = 0;
+		gbc.gridy = 1;
+		gbc.fill = NONE;
+		gbc.anchor = WEST;
+		gbc.insets = new Insets(5, 10, 0, 0);
+		fieldsPanel.add(usernameLabel, gbc);
+
+		gbc.weightx = 1.0;
+		gbc.gridx = 1;
+		gbc.gridy = 1;
+		gbc.fill = HORIZONTAL;
+		gbc.anchor = WEST;
+		gbc.insets = new Insets(5, 10, 0, 5);
+		fieldsPanel.add(usernameField, gbc);
+
+		gbc.weightx = 0.0;
+		gbc.gridx = 0;
+		gbc.gridy = 2;
+		gbc.fill = NONE;
+		gbc.anchor = WEST;
+		gbc.insets = new Insets(5, 10, 0, 0);
+		fieldsPanel.add(passwordLabel, gbc);
+
+		gbc.weightx = 1.0;
+		gbc.gridx = 1;
+		gbc.gridy = 2;
+		gbc.fill = HORIZONTAL;
+		gbc.anchor = WEST;
+		gbc.insets = new Insets(5, 10, 0, 5);
+		fieldsPanel.add(passwordField, gbc);
+
+		fieldsPanel.setBorder(new CompoundBorder(
+				new EmptyBorder(10, 10, 10, 10), new EtchedBorder()));
+
+		JPanel buttonsPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
+		buttonsPanel.add(okButton);
+
+		getContentPane().add(fieldsPanel, CENTER);
+		getContentPane().add(buttonsPanel, SOUTH);
+
+		addWindowListener(new WindowAdapter() {
+			@Override
+			public void windowClosing(WindowEvent evt) {
+				closeDialog();
+			}
+		});
+
+		// setResizable(false);
+		getRootPane().setDefaultButton(okButton);
+		pack();
+	}
+
+	private void closeDialog() {
+		setVisible(false);
+		dispose();
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/WarnUserAboutJCEPolicyDialog.java
----------------------------------------------------------------------
diff --git a/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/WarnUserAboutJCEPolicyDialog.java b/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/WarnUserAboutJCEPolicyDialog.java
new file mode 100644
index 0000000..1bdf288
--- /dev/null
+++ b/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/WarnUserAboutJCEPolicyDialog.java
@@ -0,0 +1,222 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.credentialmanager;
+
+import static java.awt.BorderLayout.CENTER;
+import static java.awt.BorderLayout.SOUTH;
+import static java.awt.Desktop.getDesktop;
+import static javax.swing.border.EtchedBorder.LOWERED;
+import static javax.swing.event.HyperlinkEvent.EventType.ACTIVATED;
+import static org.apache.commons.io.FileUtils.touch;
+
+import java.awt.BorderLayout;
+import java.awt.Dimension;
+import java.awt.FlowLayout;
+import java.awt.Font;
+import java.awt.Frame;
+import java.awt.GraphicsEnvironment;
+import java.awt.Rectangle;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.io.File;
+import java.io.IOException;
+
+import javax.swing.JButton;
+import javax.swing.JCheckBox;
+import javax.swing.JEditorPane;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.border.CompoundBorder;
+import javax.swing.border.EmptyBorder;
+import javax.swing.border.EtchedBorder;
+import javax.swing.event.HyperlinkEvent;
+import javax.swing.event.HyperlinkListener;
+import javax.swing.text.Document;
+import javax.swing.text.html.HTMLEditorKit;
+import javax.swing.text.html.StyleSheet;
+
+import org.apache.taverna.security.credentialmanager.DistinguishedNameParser;
+import org.apache.taverna.workbench.helper.NonBlockedHelpEnabledDialog;
+
+import org.apache.log4j.Logger;
+
+import uk.org.taverna.configuration.app.ApplicationConfiguration;
+
+/**
+ * Dialog that warns user that they need to install unlimited cryptography
+ * strength policy for Java.
+ * 
+ * @author Alex Nenadic
+ */
+@SuppressWarnings("serial")
+public class WarnUserAboutJCEPolicyDialog extends NonBlockedHelpEnabledDialog {
+	private static final Logger logger = Logger
+			.getLogger(WarnUserAboutJCEPolicyDialog.class);
+
+	private JCheckBox doNotWarnMeAgainCheckBox;
+	private final ApplicationConfiguration applicationConfiguration;
+	private final DistinguishedNameParser dnParser;
+
+	public WarnUserAboutJCEPolicyDialog(
+			ApplicationConfiguration applicationConfiguration,
+			DistinguishedNameParser dnParser) {
+		super((Frame) null,
+				"Java Unlimited Strength Cryptography Policy Warning", true);
+		this.applicationConfiguration = applicationConfiguration;
+		this.dnParser = dnParser;
+		initComponents();
+	}
+
+	// For testing
+	public static void main(String[] args) {
+		WarnUserAboutJCEPolicyDialog dialog = new WarnUserAboutJCEPolicyDialog(
+				null, null);
+		dialog.setVisible(true);
+	}
+
+	private void initComponents() {
+		// Base font for all components on the form
+		Font baseFont = new JLabel("base font").getFont().deriveFont(11f);
+
+		// Message saying that updates are available
+		JPanel messagePanel = new JPanel(new BorderLayout());
+		messagePanel.setBorder(new CompoundBorder(new EmptyBorder(10, 10, 10,
+				10), new EtchedBorder(LOWERED)));
+
+		JEditorPane message = new JEditorPane();
+		message.setEditable(false);
+		message.setBackground(this.getBackground());
+		message.setFocusable(false);
+		HTMLEditorKit kit = new HTMLEditorKit();
+		message.setEditorKit(kit);
+		StyleSheet styleSheet = kit.getStyleSheet();
+		//styleSheet.addRule("body {font-family:"+baseFont.getFamily()+"; font-size:"+baseFont.getSize()+";}"); // base font looks bigger when rendered as HTML
+		styleSheet.addRule("body {font-family:" + baseFont.getFamily()
+				+ "; font-size:10px;}");
+		Document doc = kit.createDefaultDocument();
+		message.setDocument(doc);
+		message.setText("<html><body>In order for Taverna's security features to function properly - you need to install<br>"
+				+ "'Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy'. <br><br>"
+				+ "If you do not already have it, for <b>Java 6</b> you can get it from:<br>"
+				+ "<a href=\"http://www.oracle.com/technetwork/java/javase/downloads/index.html\">http://www.oracle.com/technetwork/java/javase/downloads/index.html</a><br<br>"
+				+ "Installation instructions are contained in the bundle you download."
+				+ "</body><html>");
+		message.addHyperlinkListener(new HyperlinkListener() {
+			@Override
+			public void hyperlinkUpdate(HyperlinkEvent he) {
+				HyperlinkEvent.EventType type = he.getEventType();
+				if (type == ACTIVATED)
+					// Open a Web browser
+					try {
+						getDesktop().browse(he.getURL().toURI());
+//						BrowserLauncher launcher = new BrowserLauncher();
+//						launcher.openURLinBrowser(he.getURL().toString());
+					} catch (Exception ex) {
+						logger.error("Failed to launch browser to fetch JCE "
+								+ he.getURL());
+					}
+			}
+		});
+		message.setBorder(new EmptyBorder(5, 5, 5, 5));
+		messagePanel.add(message, CENTER);
+
+		doNotWarnMeAgainCheckBox = new JCheckBox("Do not warn me again");
+		doNotWarnMeAgainCheckBox.setFont(baseFont.deriveFont(12f));
+		messagePanel.add(doNotWarnMeAgainCheckBox, SOUTH);
+
+		// Buttons
+		JPanel buttonsPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
+		JButton okButton = new JButton("OK");
+		okButton.setFont(baseFont);
+		okButton.addActionListener(new ActionListener() {
+			@Override
+			public void actionPerformed(ActionEvent e) {
+				okPressed();
+			}
+		});
+
+		buttonsPanel.add(okButton);
+
+		getContentPane().setLayout(new BorderLayout());
+		getContentPane().add(messagePanel, CENTER);
+		getContentPane().add(buttonsPanel, SOUTH);
+
+		pack();
+		setResizable(false);
+		// Center the dialog on the screen (we do not have the parent)
+		Dimension dimension = getToolkit().getScreenSize();
+		Rectangle abounds = getBounds();
+		setLocation((dimension.width - abounds.width) / 2,
+				(dimension.height - abounds.height) / 2);
+		setSize(getPreferredSize());
+	}
+
+	private static final String DO_NOT_WARN_ABOUT_JCE_POLICY = "do_not_warn_about_JCE_policy";
+	public static boolean warnedUser = false; // have we already warned user for
+												// this run
+
+	/**
+	 * Warn user that they need to install Java Cryptography Extension (JCE)
+	 * Unlimited Strength Jurisdiction Policy if they want Credential Manager to
+	 * function properly.
+	 */
+	public static void warnUserAboutJCEPolicy(
+			ApplicationConfiguration applicationConfiguration,
+			DistinguishedNameParser dnParser) {
+		/*
+		 * Do not pop up a dialog if we are running headlessly. If we have
+		 * warned the user and they do not want us to remind them again - exit.
+		 */
+		if (warnedUser || GraphicsEnvironment.isHeadless()
+				|| doNotWarnFile(applicationConfiguration, dnParser).exists())
+			return;
+
+		WarnUserAboutJCEPolicyDialog warnDialog = new WarnUserAboutJCEPolicyDialog(
+				applicationConfiguration, dnParser);
+		warnDialog.setVisible(true);
+		warnedUser = true;
+	}
+
+	private static File doNotWarnFile(
+			ApplicationConfiguration applicationConfiguration,
+			DistinguishedNameParser dnParser) {
+		return new File(
+				dnParser.getCredentialManagerDefaultDirectory(applicationConfiguration),
+				DO_NOT_WARN_ABOUT_JCE_POLICY);
+	}
+
+	protected void okPressed() {
+		try {
+			if (doNotWarnMeAgainCheckBox.isSelected())
+				touch(doNotWarnFile(applicationConfiguration, dnParser));
+		} catch (IOException e) {
+			logger.error(
+					"Failed to touch the 'Do not want me about JCE unilimited security policy' file.",
+					e);
+		}
+		closeDialog();
+	}
+
+	private void closeDialog() {
+		setVisible(false);
+		dispose();
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/action/CredentialManagerAction.java
----------------------------------------------------------------------
diff --git a/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/action/CredentialManagerAction.java b/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/action/CredentialManagerAction.java
new file mode 100644
index 0000000..038f69a
--- /dev/null
+++ b/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/action/CredentialManagerAction.java
@@ -0,0 +1,67 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.credentialmanager.action;
+
+import static javax.swing.SwingUtilities.invokeLater;
+
+import java.awt.event.ActionEvent;
+
+import javax.swing.AbstractAction;
+import javax.swing.ImageIcon;
+
+import org.apache.taverna.security.credentialmanager.CredentialManager;
+import org.apache.taverna.security.credentialmanager.DistinguishedNameParser;
+import org.apache.taverna.workbench.ui.credentialmanager.CredentialManagerUI;
+
+//import javax.swing.SwingUtilities;
+
+@SuppressWarnings("serial")
+public class CredentialManagerAction extends AbstractAction {
+	private static ImageIcon ICON = new ImageIcon(
+			CredentialManagerAction.class
+					.getResource("/images/cred_manager16x16.png"));
+
+	private CredentialManagerUI cmUI;
+	private final CredentialManager credentialManager;
+	private final DistinguishedNameParser dnParser;
+
+	public CredentialManagerAction(CredentialManager credentialManager,
+			DistinguishedNameParser dnParser) {
+		super("Credential Manager", ICON);
+		this.credentialManager = credentialManager;
+		this.dnParser = dnParser;
+	}
+
+	@Override
+	public void actionPerformed(ActionEvent e) {
+		if (cmUI != null) {
+			cmUI.setVisible(true);
+			return;
+		}
+
+		invokeLater(new Runnable() {
+			@Override
+			public void run() {
+				cmUI = new CredentialManagerUI(credentialManager, dnParser);
+				cmUI.setVisible(true);
+			}
+		});
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/menu/CredentialManagerMenu.java
----------------------------------------------------------------------
diff --git a/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/menu/CredentialManagerMenu.java b/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/menu/CredentialManagerMenu.java
new file mode 100644
index 0000000..eb6cd88
--- /dev/null
+++ b/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/menu/CredentialManagerMenu.java
@@ -0,0 +1,69 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.credentialmanager.menu;
+
+import java.net.URI;
+
+import javax.swing.Action;
+
+//import org.apache.log4j.Logger;
+
+import org.apache.taverna.security.credentialmanager.CredentialManager;
+import org.apache.taverna.security.credentialmanager.DistinguishedNameParser;
+import org.apache.taverna.ui.menu.AbstractMenuAction;
+import org.apache.taverna.workbench.ui.credentialmanager.action.CredentialManagerAction;
+
+public class CredentialManagerMenu extends AbstractMenuAction {
+	private static final String MENU_URI = "http://taverna.sf.net/2008/t2workbench/menu#advanced";
+
+	private CredentialManager credentialManager;
+	private DistinguishedNameParser dnParser;
+
+	// private static Logger logger = Logger.getLogger(CredentialManagerMenu.class);
+
+	public CredentialManagerMenu() {
+		super(URI.create(MENU_URI), 60);
+		/* This is now done in the initialise SSL startup hook - no need to do it here.
+		// Force initialisation at startup
+		try {
+			CredentialManager.getInstance();
+		} catch (CMException e) {
+			logger.error("Could not initialise SSL properties for SSL connections from Taverna.", e);
+		}
+		*/
+	}
+
+	@Override
+	protected Action createAction() {
+		return new CredentialManagerAction(credentialManager, dnParser);
+	}
+
+	public void setCredentialManager(CredentialManager credentialManager) {
+		this.credentialManager = credentialManager;
+	}
+
+	/**
+	 * @param dnParser
+	 *            the dnParser to set
+	 */
+	public void setDistinguishedNameParser(DistinguishedNameParser dnParser) {
+		this.dnParser = dnParser;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/password/AskUserJavaTruststorePasswordProvider.java
----------------------------------------------------------------------
diff --git a/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/password/AskUserJavaTruststorePasswordProvider.java b/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/password/AskUserJavaTruststorePasswordProvider.java
new file mode 100644
index 0000000..4d0cc03
--- /dev/null
+++ b/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/password/AskUserJavaTruststorePasswordProvider.java
@@ -0,0 +1,45 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.credentialmanager.password;
+
+import org.apache.taverna.security.credentialmanager.JavaTruststorePasswordProvider;
+
+/**
+ * An implementation of the {@link JavaTruststorePasswordProvider} that pops up a
+ * dialog and asks the user to provide the password.
+ * 
+ * @author Alex Nenadic
+ *
+ */
+public class AskUserJavaTruststorePasswordProvider implements JavaTruststorePasswordProvider{
+
+	@Override
+	public String getJavaTruststorePassword() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public void setJavaTruststorePassword(String password) {
+		// TODO Auto-generated method stub
+		
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/password/AskUserMasterPasswordProvider.java
----------------------------------------------------------------------
diff --git a/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/password/AskUserMasterPasswordProvider.java b/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/password/AskUserMasterPasswordProvider.java
new file mode 100644
index 0000000..fc62f51
--- /dev/null
+++ b/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/password/AskUserMasterPasswordProvider.java
@@ -0,0 +1,54 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.credentialmanager.password;
+
+import org.apache.taverna.security.credentialmanager.MasterPasswordProvider;
+
+public class AskUserMasterPasswordProvider implements MasterPasswordProvider{
+
+//	@Override
+//	public boolean canProvideMasterPassword() {
+//		// TODO Auto-generated method stub
+//		return false;
+//	}
+	private int priority = 100;
+
+	@Override
+	public String getMasterPassword(boolean firstTime) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public int getProviderPriority() {
+		return priority;
+	}
+
+	@Override
+	public void setMasterPassword(String password) {
+		// TODO Auto-generated method stub	
+	}
+	
+//	@Override
+//	public void setProviderPriority(int priority) {
+//		this.priority = priority;
+//	}
+	
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/password/AskUserServiceUsernameAndPasswordProvider.java
----------------------------------------------------------------------
diff --git a/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/password/AskUserServiceUsernameAndPasswordProvider.java b/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/password/AskUserServiceUsernameAndPasswordProvider.java
new file mode 100644
index 0000000..4c6f046
--- /dev/null
+++ b/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/password/AskUserServiceUsernameAndPasswordProvider.java
@@ -0,0 +1,42 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.credentialmanager.password;
+
+import java.net.URI;
+
+import org.apache.taverna.security.credentialmanager.ServiceUsernameAndPasswordProvider;
+import org.apache.taverna.security.credentialmanager.UsernamePassword;
+
+public class AskUserServiceUsernameAndPasswordProvider implements ServiceUsernameAndPasswordProvider{
+
+	@Override
+	public UsernamePassword getServiceUsernameAndPassword(URI serviceURI, String requestMessage) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public void setServiceUsernameAndPassword(URI serviceURI,
+			UsernamePassword usernamePassword) {
+		// TODO Auto-generated method stub
+		
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/password/AskUserTrustConfirmationProvider.java
----------------------------------------------------------------------
diff --git a/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/password/AskUserTrustConfirmationProvider.java b/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/password/AskUserTrustConfirmationProvider.java
new file mode 100644
index 0000000..8523207
--- /dev/null
+++ b/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/password/AskUserTrustConfirmationProvider.java
@@ -0,0 +1,34 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.credentialmanager.password;
+
+import java.security.cert.X509Certificate;
+
+import org.apache.taverna.security.credentialmanager.TrustConfirmationProvider;
+
+public class AskUserTrustConfirmationProvider implements TrustConfirmationProvider {
+
+	@Override
+	public Boolean shouldTrustCertificate(X509Certificate[] chain) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/password/GetPasswordDialog.java
----------------------------------------------------------------------
diff --git a/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/password/GetPasswordDialog.java b/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/password/GetPasswordDialog.java
new file mode 100644
index 0000000..74b1446
--- /dev/null
+++ b/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/password/GetPasswordDialog.java
@@ -0,0 +1,227 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.credentialmanager.password;
+
+import static java.awt.BorderLayout.CENTER;
+import static java.awt.BorderLayout.NORTH;
+import static java.awt.BorderLayout.SOUTH;
+import static java.awt.FlowLayout.LEFT;
+import static java.awt.FlowLayout.RIGHT;
+import static javax.swing.JOptionPane.WARNING_MESSAGE;
+import static javax.swing.JOptionPane.showMessageDialog;
+
+import java.awt.BorderLayout;
+import java.awt.Dimension;
+import java.awt.FlowLayout;
+import java.awt.Frame;
+import java.awt.GridLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+
+import javax.swing.JButton;
+import javax.swing.JCheckBox;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JPasswordField;
+import javax.swing.JTextField;
+import javax.swing.border.CompoundBorder;
+import javax.swing.border.EmptyBorder;
+import javax.swing.border.EtchedBorder;
+
+import org.apache.taverna.workbench.helper.NonBlockedHelpEnabledDialog;
+
+/**
+ * Dialog for entering user's username and password.
+ * 
+ * @author Alex Nenadic
+ */
+@SuppressWarnings("serial")
+public class GetPasswordDialog extends NonBlockedHelpEnabledDialog {
+	/**
+	 * Whether we should ask user to save their username and password using
+	 * Credential Manager
+	 */
+	private boolean shouldAskUserToSave;
+	/** Username field */
+	private JTextField usernameField;
+	/** Password field */
+	private JPasswordField passwordField;
+	/**
+	 * Whether user wished to save the username and password using Credential
+	 * Manager
+	 */
+	private JCheckBox saveCheckBox;
+	/** The entered username */
+	private String username;
+	/** The entered password */
+	private String password;
+	/** Instructions to the user */
+	private String instructions;
+
+	public GetPasswordDialog(String instructions, boolean shouldAskUserToSave) {
+		super((Frame) null, "Enter username and password", true);
+		this.instructions = instructions;
+		this.shouldAskUserToSave = shouldAskUserToSave;
+		initComponents();
+	}
+
+	private void initComponents() {
+		getContentPane().setLayout(new BorderLayout());
+
+		JLabel instructionsLabel = new JLabel(instructions);
+		instructionsLabel.setBorder(new EmptyBorder(5, 5, 5, 5));
+		JPanel jpInstructions = new JPanel(new FlowLayout(LEFT));
+		jpInstructions.add(instructionsLabel);
+
+		JLabel usernameLabel = new JLabel("Username");
+		usernameLabel.setBorder(new EmptyBorder(5, 5, 5, 5));
+		JLabel passwordLabel = new JLabel("Password");
+		passwordLabel.setBorder(new EmptyBorder(5, 5, 5, 5));
+
+		usernameField = new JTextField(15);
+		passwordField = new JPasswordField(15);
+
+		JButton okButton = new JButton("OK");
+		okButton.addActionListener(new ActionListener() {
+			@Override
+			public void actionPerformed(ActionEvent evt) {
+				okPressed();
+			}
+		});
+
+		JButton cancelButton = new JButton("Cancel");
+		cancelButton.addActionListener(new ActionListener() {
+			@Override
+			public void actionPerformed(ActionEvent evt) {
+				cancelPressed();
+			}
+		});
+
+        // Central panel with username/password fields and a "Do you want to Save?" checkbox
+		JPanel mainPanel = new JPanel(new BorderLayout());
+
+		JPanel passwordPanel = new JPanel(new GridLayout(2, 2, 5, 5));
+		passwordPanel.add(usernameLabel);
+		passwordPanel.add(usernameField);
+		passwordPanel.add(passwordLabel);
+		passwordPanel.add(passwordField);
+		mainPanel.add(passwordPanel, CENTER);
+
+		// If user wants to save this username and password
+		saveCheckBox = new JCheckBox();
+		saveCheckBox.setBorder(new EmptyBorder(5, 5, 5, 5));
+		saveCheckBox.setSelected(true);
+		saveCheckBox
+				.setText("Use Credential Manager to save this username and password");
+		if (shouldAskUserToSave) {
+			JPanel jpSaveCheckBox = new JPanel(new FlowLayout(LEFT));
+			jpSaveCheckBox.add(saveCheckBox);
+			mainPanel.add(jpSaveCheckBox, SOUTH);
+		}
+
+		passwordPanel.setBorder(new CompoundBorder(new EmptyBorder(10, 10, 10,
+				10), new EtchedBorder()));
+
+		JPanel buttonsPanel = new JPanel(new FlowLayout(RIGHT));
+		buttonsPanel.add(okButton);
+		buttonsPanel.add(cancelButton);
+
+		passwordPanel.setMinimumSize(new Dimension(300, 100));
+
+		getContentPane().add(jpInstructions, NORTH);
+		getContentPane().add(mainPanel, CENTER);
+		getContentPane().add(buttonsPanel, SOUTH);
+
+		addWindowListener(new WindowAdapter() {
+			@Override
+			public void windowClosing(WindowEvent evt) {
+				closeDialog();
+			}
+		});
+
+		setResizable(false);
+		getRootPane().setDefaultButton(okButton);
+		pack();
+	}
+
+	public String getUsername() {
+		return username;
+	}
+
+	public String getPassword() {
+		return password;
+	}
+
+	/**
+	 * Check if user wishes to save username and pasword using the Credential
+	 * Manager.
+	 */
+	public boolean shouldSaveUsernameAndPassword() {
+		return saveCheckBox.isSelected();
+	}
+
+	private boolean checkControls() {
+		username = usernameField.getText();
+		if (username.length() == 0) {
+			showMessageDialog(this, "Username cannot be empty", "Warning",
+					WARNING_MESSAGE);
+			return false;
+		}
+
+		password = new String(passwordField.getPassword());
+		if (password.length() == 0) { // password empty
+			showMessageDialog(this, "Password cannot be empty", "Warning",
+					WARNING_MESSAGE);
+
+			return false;
+		}
+
+		return true;
+	}
+
+	private void okPressed() {
+		if (checkControls())
+			closeDialog();
+	}
+
+	private void cancelPressed() {
+		// Set all fields to null to indicate that cancel button was pressed
+		username = null;
+		password = null;
+		closeDialog();
+	}
+
+	private void closeDialog() {
+		setVisible(false);
+		dispose();
+	}
+
+	public void setUsername(String username) {
+		this.username = username;
+		usernameField.setText(username);
+	}
+
+	public void setPassword(String password) {
+		this.password = password;
+		passwordField.setText(password);
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/password/SimpleMasterPasswordProvider.java
----------------------------------------------------------------------
diff --git a/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/password/SimpleMasterPasswordProvider.java b/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/password/SimpleMasterPasswordProvider.java
new file mode 100644
index 0000000..0b04984
--- /dev/null
+++ b/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/password/SimpleMasterPasswordProvider.java
@@ -0,0 +1,53 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.credentialmanager.password;
+
+import org.apache.taverna.security.credentialmanager.MasterPasswordProvider;
+
+/**
+ * A simple implementation of {@link MasterPasswordProvider} that just provides
+ * a master password that can be obtained and set from outside the provider.
+ * 
+ * @author Alex Nenadic
+ */
+public class SimpleMasterPasswordProvider implements MasterPasswordProvider {
+	private String masterPassword;
+	private int priority = 200;
+	
+	@Override
+	public String getMasterPassword(boolean firstTime) {
+		return masterPassword;
+	}
+	
+	@Override
+	public void setMasterPassword(String masterPassword){
+		this.masterPassword = masterPassword;
+	}
+
+	@Override
+	public int getProviderPriority() {
+		return priority;
+	}
+
+//	@Override
+//	public void setProviderPriority(int priority) {
+//		this.priority = priority;		
+//	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/password/UIMasterPasswordProvider.java
----------------------------------------------------------------------
diff --git a/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/password/UIMasterPasswordProvider.java b/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/password/UIMasterPasswordProvider.java
new file mode 100644
index 0000000..8f76a37
--- /dev/null
+++ b/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/password/UIMasterPasswordProvider.java
@@ -0,0 +1,125 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.credentialmanager.password;
+
+import java.awt.GraphicsEnvironment;
+
+import javax.swing.JFrame;
+import org.apache.taverna.security.credentialmanager.DistinguishedNameParser;
+
+import uk.org.taverna.configuration.app.ApplicationConfiguration;
+
+import org.apache.taverna.security.credentialmanager.JavaTruststorePasswordProvider;
+import org.apache.taverna.security.credentialmanager.MasterPasswordProvider;
+import org.apache.taverna.workbench.ui.credentialmanager.GetMasterPasswordDialog;
+import org.apache.taverna.workbench.ui.credentialmanager.SetMasterPasswordDialog;
+import org.apache.taverna.workbench.ui.credentialmanager.WarnUserAboutJCEPolicyDialog;
+
+/**
+ * A UI pop-up that asks user for a master password for Credential Manager.
+ *
+ * @author Alex Nenadic
+ * @author Stian Soiland-Reyes
+ *
+ */
+public class UIMasterPasswordProvider implements MasterPasswordProvider, JavaTruststorePasswordProvider {
+
+	private ApplicationConfiguration applicationConfiguration;
+
+        private DistinguishedNameParser dnParser;
+        
+	@Override
+	public String getJavaTruststorePassword() {
+		if (GraphicsEnvironment.isHeadless()) {
+			return null;
+		}
+
+		GetMasterPasswordDialog getPasswordDialog = new GetMasterPasswordDialog(
+				"Credential Manager needs to copy certificates from Java truststore. "
+						+ "Please enter your password.");
+		getPasswordDialog.setLocationRelativeTo(null);
+		getPasswordDialog.setVisible(true);
+		String javaTruststorePassword = getPasswordDialog.getPassword();
+		return javaTruststorePassword;
+	}
+
+	@Override
+	public void setJavaTruststorePassword(String password) {
+	}
+
+	@Override
+	public String getMasterPassword(boolean firstTime) {
+
+		// Check if this Taverna run is headless (i.e. Taverna Server or Taverna
+		// from command line) - do not do anything here if it is as we do not
+		// want
+		// any windows popping up even if they could
+		if (GraphicsEnvironment.isHeadless()) {
+			return null;
+		}
+
+		// Pop up a warning about Java Cryptography Extension (JCE)
+		// Unlimited Strength Jurisdiction Policy
+		WarnUserAboutJCEPolicyDialog.warnUserAboutJCEPolicy(applicationConfiguration, dnParser);
+
+		if (firstTime) {
+			// Ask user to set the master password for Credential Manager (only
+			// the first time)
+			SetMasterPasswordDialog setPasswordDialog = new SetMasterPasswordDialog(
+					(JFrame) null, "Set master password", true,
+					"Set master password for Credential Manager");
+			setPasswordDialog.setLocationRelativeTo(null);
+			setPasswordDialog.setVisible(true);
+			return setPasswordDialog.getPassword();
+		} else {
+			// Ask user to provide a master password for Credential Manager
+			GetMasterPasswordDialog getPasswordDialog = new GetMasterPasswordDialog(
+			"Enter master password for Credential Manager");
+			getPasswordDialog.setLocationRelativeTo(null);
+			getPasswordDialog.setVisible(true);
+			return getPasswordDialog.getPassword();
+		}
+	}
+
+	@Override
+	public void setMasterPassword(String password) {
+	}
+
+	@Override
+	public int getProviderPriority() {
+		return 100;
+	}
+
+	/**
+	 * Sets the applicationConfiguration.
+	 *
+	 * @param applicationConfiguration the new value of applicationConfiguration
+	 */
+	public void setApplicationConfiguration(ApplicationConfiguration applicationConfiguration) {
+		this.applicationConfiguration = applicationConfiguration;
+	}
+        
+        /**
+	 * @param dnParser the dnParser to set
+	 */
+	public void setDistinguishedNameParser(DistinguishedNameParser dnParser) {
+		this.dnParser = dnParser;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/password/UIUsernamePasswordProvider.java
----------------------------------------------------------------------
diff --git a/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/password/UIUsernamePasswordProvider.java b/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/password/UIUsernamePasswordProvider.java
new file mode 100644
index 0000000..c92535c
--- /dev/null
+++ b/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/password/UIUsernamePasswordProvider.java
@@ -0,0 +1,111 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.credentialmanager.password;
+
+import static java.awt.GraphicsEnvironment.isHeadless;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+
+import org.apache.taverna.security.credentialmanager.DistinguishedNameParser;
+import org.apache.taverna.security.credentialmanager.ServiceUsernameAndPasswordProvider;
+import org.apache.taverna.security.credentialmanager.UsernamePassword;
+
+import org.apache.log4j.Logger;
+
+public class UIUsernamePasswordProvider implements
+		ServiceUsernameAndPasswordProvider {
+	private static final Logger logger = Logger
+			.getLogger(UIUsernamePasswordProvider.class);
+
+	private DistinguishedNameParser dnParser;
+
+	public boolean canProvideUsernamePassword(URI serviceURI) {
+		return !isHeadless();
+	}
+
+	@Override
+	public UsernamePassword getServiceUsernameAndPassword(URI serviceURI,
+			String requestingPrompt) {
+		URI displayURI = serviceURI;
+
+		try {
+			displayURI = dnParser.setFragmentForURI(displayURI, null);
+			displayURI = dnParser.setUserInfoForURI(displayURI, null);
+		} catch (URISyntaxException e) {
+			logger.warn("Could not strip fragment/userinfo from " + serviceURI,
+					e);
+		}
+
+		StringBuilder message = new StringBuilder();
+		message.append("<html><body>The Taverna Credential Manager could not find a ");
+		message.append("username and password for the service at:");
+		message.append("<br><br><code>");
+		message.append(displayURI);
+		message.append("</code>");
+		if (requestingPrompt != null && !requestingPrompt.isEmpty()) {
+			message.append("<p><i>");
+			message.append(requestingPrompt);
+			message.append("</i>");
+		}
+		message.append("<br><br>Please provide the username and password.</body></html>");
+
+		GetPasswordDialog getPasswordDialog = new GetPasswordDialog(
+				message.toString(), true);
+		getPasswordDialog.setLocationRelativeTo(null);
+		if (serviceURI.getRawUserInfo() != null
+				&& serviceURI.getRawUserInfo().length() > 1) {
+			String userInfo = serviceURI.getRawUserInfo();
+			String[] userPassword = userInfo.split(":", 2);
+			if (userPassword.length == 2) {
+				getPasswordDialog.setUsername(userPassword[0]);
+				getPasswordDialog.setPassword(userPassword[1]);
+			}
+		}
+		getPasswordDialog.setVisible(true);
+
+		String username = getPasswordDialog.getUsername(); // get username
+		String password = getPasswordDialog.getPassword(); // get password
+		boolean shouldSaveUsernameAndPassword = getPasswordDialog
+				.shouldSaveUsernameAndPassword();
+		if (username == null || password == null)
+			// user cancelled - any of the above two variables is null
+			return null;
+
+		UsernamePassword credential = new UsernamePassword();
+		credential.setUsername(username);
+		credential.setPassword(password.toCharArray());
+		credential.setShouldSave(shouldSaveUsernameAndPassword);
+		return credential;
+	}
+
+	@Override
+	public void setServiceUsernameAndPassword(URI serviceURI,
+			UsernamePassword usernamePassword) {
+	}
+
+	/**
+	 * @param dnParser
+	 *            the dnParser to set
+	 */
+	public void setDistinguishedNameParser(DistinguishedNameParser dnParser) {
+		this.dnParser = dnParser;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/startup/InitialiseSSLStartupHook.java
----------------------------------------------------------------------
diff --git a/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/startup/InitialiseSSLStartupHook.java b/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/startup/InitialiseSSLStartupHook.java
new file mode 100644
index 0000000..6453556
--- /dev/null
+++ b/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/startup/InitialiseSSLStartupHook.java
@@ -0,0 +1,63 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.credentialmanager.startup;
+
+import org.apache.log4j.Logger;
+
+import org.apache.taverna.security.credentialmanager.CMException;
+import org.apache.taverna.security.credentialmanager.CredentialManager;
+import org.apache.taverna.workbench.StartupSPI;
+
+/**
+ * 
+ * Startup hook to initialise SSL socket factory used by Taverna for creating
+ * HTTPS connections.
+ * 
+ * @author Alex Nenadic
+ * @author Stian Soiland-Reyes
+ */
+public class InitialiseSSLStartupHook implements StartupSPI {
+	private static final Logger logger = Logger
+			.getLogger(InitialiseSSLStartupHook.class);
+
+	private CredentialManager credManager;
+
+	@Override
+	public int positionHint() {
+		return 25;
+	}
+
+	@Override
+	public boolean startup() {
+		logger.info("Initialising SSL socket factory for SSL connections from Taverna.");
+		try {
+			credManager.initializeSSL();
+		} catch (CMException e) {
+			logger.error(
+					"Could not initialise the SSL socket factory (for creating SSL connections)"
+							+ " using Taverna's keystores.", e);
+		}
+		return true;
+	}
+
+	public void setCredentialManager(CredentialManager credManager) {
+		this.credManager = credManager;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/startup/SetCredManAuthenticatorStartupHook.java
----------------------------------------------------------------------
diff --git a/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/startup/SetCredManAuthenticatorStartupHook.java b/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/startup/SetCredManAuthenticatorStartupHook.java
new file mode 100644
index 0000000..23f006e
--- /dev/null
+++ b/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/startup/SetCredManAuthenticatorStartupHook.java
@@ -0,0 +1,43 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.credentialmanager.startup;
+
+import java.net.Authenticator;
+import org.apache.taverna.security.credentialmanager.CredentialManager;
+import org.apache.taverna.workbench.StartupSPI;
+
+public class SetCredManAuthenticatorStartupHook implements StartupSPI {
+	private CredentialManager credManager;
+
+	@Override
+	public int positionHint() {
+		return 50;
+	}
+
+	@Override
+	public boolean startup() {
+		Authenticator.setDefault(credManager.getAuthenticator());
+		return true;
+	}
+
+	public void setCredentialManager(CredentialManager credManager) {
+		this.credManager = credManager;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/toolbar/CredentialManagerToolbarAction.java
----------------------------------------------------------------------
diff --git a/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/toolbar/CredentialManagerToolbarAction.java b/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/toolbar/CredentialManagerToolbarAction.java
new file mode 100644
index 0000000..ca83468
--- /dev/null
+++ b/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/toolbar/CredentialManagerToolbarAction.java
@@ -0,0 +1,43 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.credentialmanager.toolbar;
+
+import static org.apache.taverna.workbench.ui.credentialmanager.toolbar.CredentialManagerToolbarSection.CREDENTIAL_MANAGER_TOOLBAR_SECTION;
+
+import java.net.URI;
+
+import javax.swing.Action;
+
+import org.apache.taverna.ui.menu.AbstractMenuAction;
+import org.apache.taverna.workbench.ui.credentialmanager.action.CredentialManagerAction;
+
+public class CredentialManagerToolbarAction extends AbstractMenuAction {
+	private static final String ENTRY_URI = "http://taverna.sf.net/2008/t2workbench/toolbar#credentialManagerAction";
+
+	public CredentialManagerToolbarAction() {
+		super(CREDENTIAL_MANAGER_TOOLBAR_SECTION, 100, URI.create(ENTRY_URI));
+	}
+
+	@Override
+	protected Action createAction() {
+		// need to add CredentialManager if toolbar is ever used
+		return new CredentialManagerAction(null, null);
+	}
+}


[41/51] [partial] incubator-taverna-workbench git commit: all packages are moved to org.apache.taverna.*

Posted by re...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-contextual-views-api/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/activity/ListConfigurationComponent.java
----------------------------------------------------------------------
diff --git a/taverna-contextual-views-api/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/activity/ListConfigurationComponent.java b/taverna-contextual-views-api/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/activity/ListConfigurationComponent.java
deleted file mode 100644
index c0e3aab..0000000
--- a/taverna-contextual-views-api/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/activity/ListConfigurationComponent.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2012 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.views.contextualviews.activity;
-
-import static java.awt.BorderLayout.CENTER;
-import static java.awt.BorderLayout.EAST;
-import static java.awt.BorderLayout.SOUTH;
-import static java.awt.FlowLayout.RIGHT;
-
-import java.awt.BorderLayout;
-import java.awt.Component;
-import java.awt.FlowLayout;
-import java.awt.event.ActionEvent;
-import java.util.List;
-
-import javax.swing.AbstractAction;
-import javax.swing.Action;
-import javax.swing.JButton;
-import javax.swing.JComponent;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-
-/**
- * @author David Withers
- */
-@SuppressWarnings("serial")
-public abstract class ListConfigurationComponent<T> extends JPanel {
-	private static final String REMOVE = "Remove";
-	private static final String ADD = "Add";
-
-	private String name;
-	private List<T> items;
-	private JPanel listPanel;
-
-	public ListConfigurationComponent(String name, List<T> items) {
-		this.name = name;
-		setLayout(new BorderLayout());
-
-		listPanel = new JPanel(new ListLayout());
-		JPanel buttonPanel = new JPanel(new FlowLayout(RIGHT));
-		buttonPanel.add(new JButton(createAddAction()));
-
-		add(new JScrollPane(listPanel), CENTER);
-		add(buttonPanel, SOUTH);
-
-		setItems(items);
-	}
-
-	protected void setItems(List<T> items) {
-		this.items = items;
-		listPanel.removeAll();
-		for (T item : items)
-			addItemComponent(item);
-	}
-
-	protected void addItem(T item) {
-		items.add(item);
-		addItemComponent(item);
-	}
-
-	protected void addItemComponent(T item) {
-		JComponent itemPanel = new JPanel(new BorderLayout());
-		itemPanel.add(createItemComponent(item), CENTER);
-		itemPanel.add(new JButton(createRemoveAction(item)), EAST);
-		listPanel.add(itemPanel);
-		listPanel.revalidate();
-		listPanel.repaint();
-	}
-
-	protected void removeItem(T item) {
-		int index = items.indexOf(item);
-		if (index >= 0) {
-			items.remove(index);
-			listPanel.remove(index);
-			listPanel.revalidate();
-			listPanel.repaint();
-		}
-	}
-
-	private Action createRemoveAction(final T item) {
-		return new AbstractAction(REMOVE) {
-			@Override
-			public void actionPerformed(ActionEvent e) {
-				removeItem(item);
-			}
-		};
-	}
-
-	private Action createAddAction() {
-		return new AbstractAction(ADD + " " + name) {
-			@Override
-			public void actionPerformed(ActionEvent e) {
-				addItem(createDefaultItem());
-			}
-		};
-	}
-
-	protected abstract Component createItemComponent(T item);
-
-	protected abstract T createDefaultItem();
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-contextual-views-api/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/activity/ListLayout.java
----------------------------------------------------------------------
diff --git a/taverna-contextual-views-api/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/activity/ListLayout.java b/taverna-contextual-views-api/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/activity/ListLayout.java
deleted file mode 100644
index 0ce35b5..0000000
--- a/taverna-contextual-views-api/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/activity/ListLayout.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2012 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.views.contextualviews.activity;
-
-import java.awt.Component;
-import java.awt.Container;
-import java.awt.Dimension;
-import java.awt.Insets;
-import java.awt.LayoutManager;
-
-/**
- * Lays out components vertically using their preferred height and the available
- * width.
- * 
- * @author David Withers
- */
-public class ListLayout implements LayoutManager {
-	private static final int DEFAULT_GAP = 5;
-	private final int gap;
-
-	public ListLayout() {
-		this(DEFAULT_GAP);
-	}
-
-	public ListLayout(int gap) {
-		this.gap = gap;
-	}
-
-	@Override
-	public void removeLayoutComponent(Component comp) {
-	}
-
-	@Override
-	public void addLayoutComponent(String name, Component comp) {
-	}
-
-	@Override
-	public void layoutContainer(Container parent) {
-		Insets insets = parent.getInsets();
-		int x = insets.left;
-		int y = insets.top;
-		int width = parent.getWidth() - insets.left - insets.right;
-		Component[] components = parent.getComponents();
-		for (int i = 0; i < components.length; i++) {
-			components[i].setLocation(x, y);
-			components[i].setSize(width,
-					components[i].getPreferredSize().height);
-			y = y + gap + components[i].getHeight();
-		}
-	}
-
-	@Override
-	public Dimension minimumLayoutSize(Container parent) {
-		Insets insets = parent.getInsets();
-		int minimumWidth = 0;
-		int minimumHeight = 0;
-		Component[] components = parent.getComponents();
-		for (int i = 0; i < components.length; i++) {
-			Dimension size = components[i].getPreferredSize();
-			if (size.width > minimumWidth)
-				minimumWidth = size.width;
-			minimumHeight = minimumHeight + size.height + gap;
-		}
-		minimumWidth = minimumWidth + insets.left + insets.right;
-		minimumHeight = minimumHeight + insets.top + insets.bottom;
-
-		return new Dimension(minimumWidth, minimumHeight);
-	}
-
-	@Override
-	public Dimension preferredLayoutSize(Container parent) {
-		return minimumLayoutSize(parent);
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-contextual-views-api/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/activity/MultiPageActivityConfigurationPanel.java
----------------------------------------------------------------------
diff --git a/taverna-contextual-views-api/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/activity/MultiPageActivityConfigurationPanel.java b/taverna-contextual-views-api/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/activity/MultiPageActivityConfigurationPanel.java
deleted file mode 100644
index c6862ff..0000000
--- a/taverna-contextual-views-api/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/activity/MultiPageActivityConfigurationPanel.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2012 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.views.contextualviews.activity;
-
-import static java.awt.BorderLayout.CENTER;
-
-import java.awt.BorderLayout;
-import java.awt.Component;
-
-import javax.swing.JTabbedPane;
-
-import org.apache.taverna.scufl2.api.activity.Activity;
-
-/**
- * Component for configuring activities that have multiple configuration pages.
- * 
- * @author David Withers
- */
-@SuppressWarnings("serial")
-public abstract class MultiPageActivityConfigurationPanel extends
-		ActivityConfigurationPanel {
-	private JTabbedPane tabbedPane;
-
-	/**
-	 * Constructs a new <code>MultiPageActivityConfigurationPanel</code>.
-	 * 
-	 * @param activity
-	 */
-	public MultiPageActivityConfigurationPanel(Activity activity) {
-		super(activity);
-		setLayout(new BorderLayout());
-		tabbedPane = new JTabbedPane();
-		add(tabbedPane, CENTER);
-	}
-
-	public void addPage(String name, Component component) {
-		tabbedPane.addTab(name, component);
-	}
-
-	public void removePage(String name) {
-		tabbedPane.removeTabAt(tabbedPane.indexOfTab(name));
-	}
-
-	public void removeAllPages() {
-		tabbedPane.removeAll();
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-contextual-views-api/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/activity/ScriptConfigurationComponent.java
----------------------------------------------------------------------
diff --git a/taverna-contextual-views-api/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/activity/ScriptConfigurationComponent.java b/taverna-contextual-views-api/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/activity/ScriptConfigurationComponent.java
deleted file mode 100644
index 8cb7652..0000000
--- a/taverna-contextual-views-api/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/activity/ScriptConfigurationComponent.java
+++ /dev/null
@@ -1,150 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2012 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.views.contextualviews.activity;
-
-import static java.awt.BorderLayout.CENTER;
-import static java.awt.BorderLayout.SOUTH;
-import static java.awt.Color.WHITE;
-import static java.awt.Font.PLAIN;
-import static javax.swing.JOptionPane.INFORMATION_MESSAGE;
-import static javax.swing.JOptionPane.YES_NO_OPTION;
-import static javax.swing.JOptionPane.YES_OPTION;
-import static javax.swing.JOptionPane.showConfirmDialog;
-import static javax.swing.JOptionPane.showMessageDialog;
-import static net.sf.taverna.t2.lang.ui.FileTools.readStringFromFile;
-import static net.sf.taverna.t2.lang.ui.FileTools.saveStringToFile;
-
-import java.awt.BorderLayout;
-import java.awt.Dimension;
-import java.awt.FlowLayout;
-import java.awt.Font;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.util.Set;
-
-import javax.swing.JButton;
-import javax.swing.JPanel;
-import javax.swing.JTextPane;
-
-import net.sf.taverna.t2.lang.ui.KeywordDocument;
-import net.sf.taverna.t2.lang.ui.LineEnabledTextPanel;
-import net.sf.taverna.t2.lang.ui.LinePainter;
-import net.sf.taverna.t2.lang.ui.NoWrapEditorKit;
-
-/**
- * Component for configuring activities that have scripts.
- *
- * @author David Withers
- */
-@SuppressWarnings("serial")
-public class ScriptConfigurationComponent extends JPanel {
-	private JTextPane scriptTextArea;
-
-	public ScriptConfigurationComponent(String script, Set<String> keywords,
-			Set<String> ports, final String scriptType,
-			final String fileExtension) {
-		this(script, keywords, ports, scriptType, fileExtension, "");
-	}
-
-	public ScriptConfigurationComponent(String script, Set<String> keywords,
-			Set<String> ports, final String scriptType,
-			final String fileExtension, final String resetScript) {
-		super(new BorderLayout());
-		scriptTextArea = new JTextPane();
-		new LinePainter(scriptTextArea, WHITE);
-
-		final KeywordDocument doc = new KeywordDocument(keywords, ports);
-
-		// NOTE: Due to T2-1145 - always set editor kit BEFORE setDocument
-		scriptTextArea.setEditorKit(new NoWrapEditorKit());
-		scriptTextArea.setFont(new Font("Monospaced", PLAIN, 14));
-		scriptTextArea.setDocument(doc);
-		scriptTextArea.setText(script);
-		scriptTextArea.setCaretPosition(0);
-		scriptTextArea.setPreferredSize(new Dimension(200, 100));
-
-		add(new LineEnabledTextPanel(scriptTextArea), CENTER);
-
-		final JButton checkScriptButton = new JButton("Check script");
-		checkScriptButton.setToolTipText("Check the " + scriptType + " script");
-		checkScriptButton.addActionListener(new ActionListener() {
-			@Override
-			public void actionPerformed(ActionEvent ex) {
-				showMessageDialog(ScriptConfigurationComponent.this, scriptType
-						+ " script check not implemented", scriptType
-						+ " script check", INFORMATION_MESSAGE);
-			}
-		});
-
-		JButton loadScriptButton = new JButton("Load script");
-		loadScriptButton.setToolTipText("Load a " + scriptType
-				+ " script from a file");
-		loadScriptButton.addActionListener(new ActionListener() {
-			@Override
-			public void actionPerformed(ActionEvent e) {
-				String newScript = readStringFromFile(
-						ScriptConfigurationComponent.this, "Load " + scriptType
-								+ " script", fileExtension);
-				if (newScript != null) {
-					scriptTextArea.setText(newScript);
-					scriptTextArea.setCaretPosition(0);
-				}
-			}
-		});
-
-		JButton saveRScriptButton = new JButton("Save script");
-		saveRScriptButton.setToolTipText("Save the " + scriptType
-				+ " script to a file");
-		saveRScriptButton.addActionListener(new ActionListener() {
-			@Override
-			public void actionPerformed(ActionEvent e) {
-				saveStringToFile(ScriptConfigurationComponent.this, "Save "
-						+ scriptType + " script", fileExtension,
-						scriptTextArea.getText());
-			}
-		});
-
-		JButton clearScriptButton = new JButton("Clear script");
-		clearScriptButton.setToolTipText("Clear current script from the edit area");
-		clearScriptButton.addActionListener(new ActionListener() {
-			@Override
-			public void actionPerformed(ActionEvent e) {
-				if (showConfirmDialog(ScriptConfigurationComponent.this,
-						"Do you really want to clear the script?",
-						"Clearing the script", YES_NO_OPTION) == YES_OPTION)
-					scriptTextArea.setText(resetScript);
-			}
-		});
-
-		JPanel buttonPanel = new JPanel();
-		buttonPanel.setLayout(new FlowLayout());
-		buttonPanel.add(checkScriptButton);
-		buttonPanel.add(loadScriptButton);
-		buttonPanel.add(saveRScriptButton);
-		buttonPanel.add(clearScriptButton);
-
-		add(buttonPanel, SOUTH);
-	}
-
-	public String getScript() {
-		return scriptTextArea.getText();
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-contextual-views-api/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/activity/ValidatingTextField.java
----------------------------------------------------------------------
diff --git a/taverna-contextual-views-api/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/activity/ValidatingTextField.java b/taverna-contextual-views-api/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/activity/ValidatingTextField.java
deleted file mode 100644
index cf1ff96..0000000
--- a/taverna-contextual-views-api/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/activity/ValidatingTextField.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2012 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.views.contextualviews.activity;
-
-import javax.swing.JTextField;
-
-/**
- * Adds a "<tt>valid</tt>" property to a JTextField.
- * 
- * @author David Withers
- */
-@SuppressWarnings("serial")
-public class ValidatingTextField extends JTextField {
-	private boolean valid = true;
-
-	public ValidatingTextField() {
-	}
-
-	public ValidatingTextField(String text) {
-		super(text);
-	}
-
-	@Override
-	public boolean isValid() {
-		return valid;
-	}
-
-	public void setValid(boolean valid) {
-		if (this.valid != valid) {
-			boolean old = this.valid;
-			this.valid = valid;
-			firePropertyChange("valid", old, valid);
-		}
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-contextual-views-api/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/activity/ValidatingTextGroup.java
----------------------------------------------------------------------
diff --git a/taverna-contextual-views-api/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/activity/ValidatingTextGroup.java b/taverna-contextual-views-api/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/activity/ValidatingTextGroup.java
deleted file mode 100644
index 7597f7c..0000000
--- a/taverna-contextual-views-api/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/activity/ValidatingTextGroup.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2012 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.views.contextualviews.activity;
-
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-import javax.swing.event.DocumentEvent;
-import javax.swing.event.DocumentListener;
-
-/**
- *
- *
- * @author David Withers
- */
-public class ValidatingTextGroup {
-	private Map<ValidatingTextField, DocumentListener> textComponents;
-
-	public ValidatingTextGroup() {
-		textComponents = new HashMap<>();
-	}
-
-	public void addValidTextComponent(ValidatingTextField textComponent) {
-		setUniqueText(textComponent);
-		DocumentListener documentListener = new ValidatorDocumentListener();
-		textComponent.getDocument().addDocumentListener(documentListener);
-		textComponents.put(textComponent, documentListener);
-	}
-
-	public void addTextComponent(ValidatingTextField textComponent) {
-		DocumentListener documentListener = new ValidatorDocumentListener();
-		textComponent.getDocument().addDocumentListener(documentListener);
-		textComponents.put(textComponent, documentListener);
-		validate();
-	}
-
-	public void removeTextComponent(ValidatingTextField textComponent) {
-		textComponent.getDocument().removeDocumentListener(
-				textComponents.remove(textComponent));
-		validate();
-	}
-
-	private void setUniqueText(ValidatingTextField textComponent) {
-		String text = textComponent.getText();
-		if (textExists(text)) {
-			// Remove any existing number suffix
-			String nameTemplate = text.replaceAll("_\\d+$", "_");
-			long i = 1;
-			do {
-				text = nameTemplate + i++;
-			} while (textExists(text));
-
-			textComponent.setText(text);
-		}
-	}
-
-	private void validate() {
-		Map<String, ValidatingTextField> textValues = new HashMap<>();
-		Set<ValidatingTextField> maybeValid = new HashSet<>();
-		for (ValidatingTextField textComponent : textComponents.keySet()) {
-			ValidatingTextField duplicate = textValues.get(textComponent
-					.getText());
-			if (duplicate != null) {
-				duplicate.setValid(false);
-				maybeValid.remove(duplicate);
-				textComponent.setValid(false);
-			} else {
-				textValues.put(textComponent.getText(), textComponent);
-				maybeValid.add(textComponent);
-			}
-		}
-		for (ValidatingTextField textComponent : maybeValid)
-			textComponent.setValid(true);
-	}
-
-	private boolean textExists(String text) {
-		for (ValidatingTextField currentTextComponent : textComponents.keySet())
-			if (text.equals(currentTextComponent.getText()))
-				return true;
-		return false;
-	}
-
-	class ValidatorDocumentListener implements DocumentListener {
-		@Override
-		public void insertUpdate(DocumentEvent e) {
-			validate();
-		}
-
-		@Override
-		public void removeUpdate(DocumentEvent e) {
-			validate();
-		}
-
-		@Override
-		public void changedUpdate(DocumentEvent e) {
-			validate();
-		}
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-contextual-views-api/src/main/java/org/apache/taverna/workbench/ui/actions/activity/ActivityConfigurationAction.java
----------------------------------------------------------------------
diff --git a/taverna-contextual-views-api/src/main/java/org/apache/taverna/workbench/ui/actions/activity/ActivityConfigurationAction.java b/taverna-contextual-views-api/src/main/java/org/apache/taverna/workbench/ui/actions/activity/ActivityConfigurationAction.java
new file mode 100644
index 0000000..23fae78
--- /dev/null
+++ b/taverna-contextual-views-api/src/main/java/org/apache/taverna/workbench/ui/actions/activity/ActivityConfigurationAction.java
@@ -0,0 +1,166 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.actions.activity;
+
+import java.util.List;
+import java.util.WeakHashMap;
+
+import javax.swing.AbstractAction;
+import javax.swing.JDialog;
+
+import org.apache.taverna.lang.observer.Observable;
+import org.apache.taverna.lang.observer.Observer;
+import org.apache.taverna.servicedescriptions.ServiceDescription;
+import org.apache.taverna.servicedescriptions.ServiceDescriptionRegistry;
+import org.apache.taverna.workbench.activityicons.ActivityIconManager;
+import org.apache.taverna.workbench.file.FileManager;
+import org.apache.taverna.workbench.file.events.ClosingDataflowEvent;
+import org.apache.taverna.workbench.file.events.FileManagerEvent;
+import org.apache.taverna.workbench.ui.views.contextualviews.activity.ActivityConfigurationDialog;
+import org.apache.taverna.scufl2.api.activity.Activity;
+import org.apache.taverna.scufl2.api.common.Scufl2Tools;
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+import org.apache.taverna.scufl2.api.core.Processor;
+import org.apache.taverna.scufl2.api.core.Workflow;
+import org.apache.taverna.scufl2.api.profiles.ProcessorBinding;
+import org.apache.taverna.scufl2.api.profiles.Profile;
+
+@SuppressWarnings("serial")
+public abstract class ActivityConfigurationAction extends AbstractAction {
+	private static WeakHashMap<Activity, ActivityConfigurationDialog> configurationDialogs = new WeakHashMap<>();
+	private static DataflowCloseListener listener;
+
+	protected Activity activity;
+	private final ServiceDescriptionRegistry serviceDescriptionRegistry;
+
+	public ActivityConfigurationAction(Activity activity,
+			ActivityIconManager activityIconManager,
+			ServiceDescriptionRegistry serviceDescriptionRegistry) {
+		this.activity = activity;
+		this.serviceDescriptionRegistry = serviceDescriptionRegistry;
+		putValue(SMALL_ICON,
+				activityIconManager.iconForActivity(activity.getType()));
+	}
+
+	protected Activity getActivity() {
+		return activity;
+	}
+
+	protected ServiceDescription getServiceDescription() {
+		return serviceDescriptionRegistry.getServiceDescription(activity
+				.getType());
+	}
+
+	protected static void setDialog(Activity activity,
+			ActivityConfigurationDialog dialog, FileManager fileManager) {
+		if (listener == null) {
+			listener = new DataflowCloseListener();
+			/*
+			 * Ensure that the DataflowCloseListener is the first notified
+			 * listener. Otherwise you cannot save the configurations.
+			 */
+			List<Observer<FileManagerEvent>> existingListeners = fileManager
+					.getObservers();
+			fileManager.addObserver(listener);
+			for (Observer<FileManagerEvent> observer : existingListeners)
+				if (!observer.equals(listener)) {
+					fileManager.removeObserver(observer);
+					fileManager.addObserver(observer);
+				}
+		}
+		if (configurationDialogs.containsKey(activity)) {
+			ActivityConfigurationDialog currentDialog = configurationDialogs
+					.get(activity);
+			if (!currentDialog.equals(dialog) && currentDialog.isVisible())
+				currentDialog.setVisible(false);
+		}
+		configurationDialogs.put(activity, dialog);
+		dialog.setVisible(true);
+	}
+
+	public static void clearDialog(Activity activity) {
+		if (configurationDialogs.containsKey(activity)) {
+			ActivityConfigurationDialog currentDialog = configurationDialogs
+					.get(activity);
+			if (currentDialog.isVisible())
+				currentDialog.setVisible(false);
+			configurationDialogs.remove(activity);
+			currentDialog.dispose();
+		}
+	}
+
+	protected static void clearDialog(JDialog dialog) {
+		if (configurationDialogs.containsValue(dialog)) {
+			if (dialog.isVisible())
+				dialog.setVisible(false);
+			for (Activity activity : configurationDialogs.keySet())
+				if (configurationDialogs.get(activity).equals(dialog))
+					configurationDialogs.remove(activity);
+			dialog.dispose();
+		}
+	}
+
+	public static boolean closeDialog(Activity activity) {
+		boolean closeIt = true;
+		if (configurationDialogs.containsKey(activity)) {
+			ActivityConfigurationDialog currentDialog = configurationDialogs
+					.get(activity);
+			if (currentDialog.isVisible())
+				closeIt = currentDialog.closeDialog();
+			if (closeIt)
+				configurationDialogs.remove(activity);
+		}
+		return closeIt;
+	}
+
+	public static ActivityConfigurationDialog getDialog(Activity activity) {
+		return configurationDialogs.get(activity);
+	}
+
+	private static class DataflowCloseListener implements
+			Observer<FileManagerEvent> {
+		private Scufl2Tools scufl2Tools = new Scufl2Tools();
+
+		@Override
+		public void notify(Observable<FileManagerEvent> sender,
+				FileManagerEvent message) throws Exception {
+			if (message instanceof ClosingDataflowEvent) {
+				ClosingDataflowEvent closingDataflowEvent = (ClosingDataflowEvent) message;
+				if (closingDataflowEvent.isAbortClose())
+					return;
+				closingDataflow(closingDataflowEvent,
+						((ClosingDataflowEvent) message).getDataflow());
+			}
+		}
+
+		private void closingDataflow(ClosingDataflowEvent event,
+				WorkflowBundle bundle) {
+			Profile profile = bundle.getMainProfile();
+			for (Workflow workflow : bundle.getWorkflows())
+				for (Processor p : workflow.getProcessors()) {
+					ProcessorBinding processorBinding = scufl2Tools
+							.processorBindingForProcessor(p, profile);
+					Activity activity = processorBinding.getBoundActivity();
+					if (!closeDialog(activity))
+						event.setAbortClose(true);
+				}
+		}
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-contextual-views-api/src/main/java/org/apache/taverna/workbench/ui/actions/activity/ActivityContextualView.java
----------------------------------------------------------------------
diff --git a/taverna-contextual-views-api/src/main/java/org/apache/taverna/workbench/ui/actions/activity/ActivityContextualView.java b/taverna-contextual-views-api/src/main/java/org/apache/taverna/workbench/ui/actions/activity/ActivityContextualView.java
new file mode 100644
index 0000000..58323d6
--- /dev/null
+++ b/taverna-contextual-views-api/src/main/java/org/apache/taverna/workbench/ui/actions/activity/ActivityContextualView.java
@@ -0,0 +1,68 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.actions.activity;
+
+import org.apache.taverna.workbench.ui.views.contextualviews.ContextualView;
+import org.apache.taverna.scufl2.api.activity.Activity;
+import org.apache.taverna.scufl2.api.common.Scufl2Tools;
+import org.apache.taverna.scufl2.api.configurations.Configuration;
+
+/**
+ * A contextual view specific to an Activity. Concrete subclasses must
+ * initialise the view by calling {@link #initView()}.
+ * <p>
+ * The implementation provides a view based upon the properties set in the
+ * Configuration
+ * 
+ * @author Stuart Owen
+ * @author Ian Dunlop
+ * 
+ * @see Activity
+ * @see ContextualView
+ */
+@SuppressWarnings("serial")
+public abstract class ActivityContextualView extends ContextualView {
+	private Activity activity;
+	private Scufl2Tools scufl2Tools = new Scufl2Tools();
+
+	/**
+	 * Constructs an instance of the view.
+	 * <p>
+	 * The constructor parameter for the implementation of this class should
+	 * define the specific Activity type itself.
+	 * 
+	 * @param activity
+	 */
+	protected ActivityContextualView(Activity activity) {
+		super();
+		this.activity = activity;
+	}
+
+	public Activity getActivity() {
+		return activity;
+	}
+
+	public Configuration getConfigBean() {
+		return scufl2Tools.configurationFor(activity, activity.getParent());
+	}
+
+	@Override
+	public abstract void refreshView();
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-contextual-views-api/src/main/java/org/apache/taverna/workbench/ui/actions/activity/HTMLBasedActivityContextualView.java
----------------------------------------------------------------------
diff --git a/taverna-contextual-views-api/src/main/java/org/apache/taverna/workbench/ui/actions/activity/HTMLBasedActivityContextualView.java b/taverna-contextual-views-api/src/main/java/org/apache/taverna/workbench/ui/actions/activity/HTMLBasedActivityContextualView.java
new file mode 100644
index 0000000..1d649cf
--- /dev/null
+++ b/taverna-contextual-views-api/src/main/java/org/apache/taverna/workbench/ui/actions/activity/HTMLBasedActivityContextualView.java
@@ -0,0 +1,80 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.actions.activity;
+
+import static org.apache.taverna.lang.ui.HtmlUtils.buildTableOpeningTag;
+import static org.apache.taverna.lang.ui.HtmlUtils.createEditorPane;
+import static org.apache.taverna.lang.ui.HtmlUtils.getHtmlHead;
+import static org.apache.taverna.lang.ui.HtmlUtils.panelForHtml;
+
+import javax.swing.JComponent;
+import javax.swing.JEditorPane;
+
+import org.apache.taverna.workbench.configuration.colour.ColourManager;
+import org.apache.taverna.scufl2.api.activity.Activity;
+
+@SuppressWarnings("serial")
+public abstract class HTMLBasedActivityContextualView extends ActivityContextualView {
+	private static final String BEANSHELL_URI = "http://ns.taverna.org.uk/2010/activity/beanshell";
+	private static final String LOCALWORKER_URI = "http://ns.taverna.org.uk/2010/activity/localworker";
+	private JEditorPane editorPane;
+	private final ColourManager colourManager;
+
+	public HTMLBasedActivityContextualView(Activity activity, ColourManager colourManager) {
+		super(activity);
+		this.colourManager = colourManager;
+		initView();
+	}
+
+	@Override
+	public JComponent getMainFrame() {
+		editorPane = createEditorPane(buildHtml());
+		return panelForHtml(editorPane);
+	}
+
+	private String buildHtml() {
+		StringBuilder html = new StringBuilder(getHtmlHead(getBackgroundColour()));
+		html.append(buildTableOpeningTag());
+		html.append("<tr><th colspan=\"2\">").append(getViewTitle()).append("</th></tr>");
+		html.append(getRawTableRowsHtml()).append("</table>");
+		html.append("</body></html>");
+		return html.toString();
+	}
+
+	protected abstract String getRawTableRowsHtml();
+
+	public String getBackgroundColour() {
+		String activityType = getActivity().getType().toString();
+		if (LOCALWORKER_URI.equals(activityType))
+			if (getConfigBean().getJson().get("isAltered").booleanValue())
+				return (String) colourManager.getProperty(BEANSHELL_URI);
+		String colour = (String) colourManager.getProperty(activityType);
+		return colour == null ? "#ffffff" : colour;
+	}
+
+	/**
+	 * Update the html view with the latest information in the configuration
+	 * bean
+	 */
+	@Override
+	public void refreshView() {
+		editorPane.setText(buildHtml());
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-contextual-views-api/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/AddLayerFactorySPI.java
----------------------------------------------------------------------
diff --git a/taverna-contextual-views-api/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/AddLayerFactorySPI.java b/taverna-contextual-views-api/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/AddLayerFactorySPI.java
new file mode 100644
index 0000000..91aad6c
--- /dev/null
+++ b/taverna-contextual-views-api/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/AddLayerFactorySPI.java
@@ -0,0 +1,42 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.views.contextualviews;
+
+import java.net.URI;
+
+import javax.swing.Action;
+
+import org.apache.taverna.scufl2.api.core.Processor;
+
+/**
+ * SPI for adding dispatch stack layers to a processor, such as
+ * {@link org.apache.taverna.workflowmodel.processor.dispatch.layers.Loop}.
+ * <p>
+ * Buttons or similar will be added in the processor contextual view.
+ * 
+ * @author Stian Soiland-Reyes
+ */
+public interface AddLayerFactorySPI {
+	boolean canAddLayerFor(Processor proc);
+
+	Action getAddLayerActionFor(Processor proc);
+
+	boolean canCreateLayerClass(URI dispatchLayerType);
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-contextual-views-api/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/ContextualView.java
----------------------------------------------------------------------
diff --git a/taverna-contextual-views-api/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/ContextualView.java b/taverna-contextual-views-api/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/ContextualView.java
new file mode 100644
index 0000000..394f2a9
--- /dev/null
+++ b/taverna-contextual-views-api/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/ContextualView.java
@@ -0,0 +1,108 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.views.contextualviews;
+
+import static java.awt.BorderLayout.CENTER;
+
+import java.awt.BorderLayout;
+import java.awt.Frame;
+
+import javax.swing.Action;
+import javax.swing.JComponent;
+import javax.swing.JPanel;
+
+/**
+ * An abstract class defining the base container to hold a contextual view over
+ * Dataflow element.
+ * <p>
+ * The specific implementation of this class to support a given dataflow element
+ * needs to implement the {@link #getMainFrame()} and {@link #getViewTitle()}.
+ * <p>
+ * If a view is associated with an action handler to configure this component,
+ * then the {@link #getConfigureAction(Frame) getConfigureAction} handler must
+ * be over-ridden. If this returns null then the configure button is left
+ * disabled and it is not possible to configure the element.
+ * 
+ * @author Stuart Owen
+ * @author Ian Dunlop
+ * @author Alan R Williams
+ */
+@SuppressWarnings("serial")
+public abstract class ContextualView extends JPanel {
+	/**
+	 * When implemented, this method should define the main frame that is placed
+	 * in this container, and provides a static view of the Dataflow element.
+	 * 
+	 * @return a JComponent that represents the dataflow element.
+	 */
+	public abstract JComponent getMainFrame();
+
+	/**
+	 * @return a String providing a title for the view
+	 */
+	public abstract String getViewTitle();
+
+	/**
+	 * Allows the item to be configured, but returning an action handler that
+	 * will be invoked when selecting to configure. By default this is provided
+	 * by a button.
+	 * <p>
+	 * If there is no ability to configure the given item, then this should
+	 * return null.
+	 * 
+	 * @param owner
+	 *            the owning dialog to be used when displaying dialogues for
+	 *            configuration options
+	 * @return an action that allows the element being viewed to be configured.
+	 */
+	public Action getConfigureAction(Frame owner) {
+		return null;
+	}
+
+	/**
+	 * This <i>must</i> be called by any sub-classes after they have initialised
+	 * their own view since it gets their main panel and adds it to the main
+	 * contextual view. If you don't do this you will get a very empty frame
+	 * popping up!
+	 */
+	public void initView() {
+		setLayout(new BorderLayout());
+		add(getMainFrame(), CENTER);
+		setName(getViewTitle());
+	}
+
+	public abstract void refreshView();
+
+	public abstract int getPreferredPosition();
+
+	public static String getTextFromDepth(String kind, Integer depth) {
+		String labelText = "The last prediction said the " + kind;
+		if (depth == null) {
+			labelText += " would not transmit a value";
+		} else if (depth == -1) {
+			labelText += " was invalid/unpredicted";
+		} else if (depth == 0) {
+			labelText += " would carry a single value";
+		} else {
+			labelText += " would carry a list of depth " + depth;
+		}
+		return labelText;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-contextual-views-api/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/activity/ActivityConfigurationDialog.java
----------------------------------------------------------------------
diff --git a/taverna-contextual-views-api/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/activity/ActivityConfigurationDialog.java b/taverna-contextual-views-api/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/activity/ActivityConfigurationDialog.java
new file mode 100644
index 0000000..372bba5
--- /dev/null
+++ b/taverna-contextual-views-api/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/activity/ActivityConfigurationDialog.java
@@ -0,0 +1,493 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.views.contextualviews.activity;
+
+import static java.awt.BorderLayout.SOUTH;
+import static java.awt.Cursor.DEFAULT_CURSOR;
+import static java.awt.Cursor.WAIT_CURSOR;
+import static java.awt.Cursor.getPredefinedCursor;
+import static java.lang.Math.max;
+import static javax.swing.JOptionPane.CANCEL_OPTION;
+import static javax.swing.JOptionPane.NO_OPTION;
+import static javax.swing.JOptionPane.YES_NO_CANCEL_OPTION;
+import static javax.swing.JOptionPane.YES_NO_OPTION;
+import static javax.swing.JOptionPane.YES_OPTION;
+import static javax.swing.JOptionPane.showConfirmDialog;
+import static org.apache.taverna.workbench.MainWindow.getMainWindow;
+import static org.apache.taverna.workbench.helper.Helper.showHelp;
+import static org.apache.taverna.workbench.ui.actions.activity.ActivityConfigurationAction.clearDialog;
+
+import java.awt.BorderLayout;
+import java.awt.Dimension;
+import java.awt.FlowLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ComponentAdapter;
+import java.awt.event.ComponentEvent;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import javax.swing.AbstractAction;
+import javax.swing.JButton;
+import javax.swing.JPanel;
+import javax.swing.border.EmptyBorder;
+
+import org.apache.taverna.lang.observer.Observable;
+import org.apache.taverna.lang.observer.Observer;
+import org.apache.taverna.lang.ui.DeselectingButton;
+import org.apache.taverna.workbench.edits.CompoundEdit;
+import org.apache.taverna.workbench.edits.Edit;
+import org.apache.taverna.workbench.edits.EditException;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.edits.EditManager.DataFlowRedoEvent;
+import org.apache.taverna.workbench.edits.EditManager.DataFlowUndoEvent;
+import org.apache.taverna.workbench.edits.EditManager.EditManagerEvent;
+import org.apache.taverna.workbench.helper.HelpEnabledDialog;
+import org.apache.taverna.workflow.edits.AddChildEdit;
+import org.apache.taverna.workflow.edits.AddProcessorInputPortEdit;
+import org.apache.taverna.workflow.edits.AddProcessorOutputPortEdit;
+import org.apache.taverna.workflow.edits.ChangeDepthEdit;
+import org.apache.taverna.workflow.edits.ChangeGranularDepthEdit;
+import org.apache.taverna.workflow.edits.ChangeJsonEdit;
+import org.apache.taverna.workflow.edits.RemoveChildEdit;
+import org.apache.taverna.workflow.edits.RemoveProcessorInputPortEdit;
+import org.apache.taverna.workflow.edits.RemoveProcessorOutputPortEdit;
+import org.apache.taverna.workflow.edits.RenameEdit;
+
+import org.apache.log4j.Logger;
+
+import org.apache.taverna.scufl2.api.activity.Activity;
+import org.apache.taverna.scufl2.api.common.Scufl2Tools;
+import org.apache.taverna.scufl2.api.configurations.Configuration;
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+import org.apache.taverna.scufl2.api.core.Processor;
+import org.apache.taverna.scufl2.api.core.Workflow;
+import org.apache.taverna.scufl2.api.port.ActivityPort;
+import org.apache.taverna.scufl2.api.port.InputActivityPort;
+import org.apache.taverna.scufl2.api.port.InputProcessorPort;
+import org.apache.taverna.scufl2.api.port.OutputActivityPort;
+import org.apache.taverna.scufl2.api.port.OutputProcessorPort;
+import org.apache.taverna.scufl2.api.profiles.ProcessorBinding;
+import org.apache.taverna.scufl2.api.profiles.ProcessorInputPortBinding;
+import org.apache.taverna.scufl2.api.profiles.ProcessorOutputPortBinding;
+import org.apache.taverna.scufl2.api.profiles.Profile;
+
+import com.fasterxml.jackson.databind.node.ObjectNode;
+
+@SuppressWarnings("serial")
+public class ActivityConfigurationDialog extends HelpEnabledDialog {
+	private enum PortType {
+		INPUT, OUTPUT
+	}
+	
+	protected static Logger logger = Logger.getLogger(ActivityConfigurationDialog.class);
+	private static final Scufl2Tools scufl2Tools = new Scufl2Tools();
+
+	private final EditManager editManager;
+
+	private Activity activity;
+	private ActivityConfigurationPanel panel;
+	protected WorkflowBundle owningWorkflowBundle;
+	protected Processor owningProcessor;
+	private Observer<EditManagerEvent> observer;
+	Dimension minimalSize = null;
+	Dimension buttonPanelSize = null;
+	JPanel buttonPanel;
+	protected JButton applyButton;
+
+	public ActivityConfigurationDialog(Activity a, ActivityConfigurationPanel p,
+			EditManager editManager) {
+		super(getMainWindow(), "Configuring " + a.getClass().getSimpleName(),
+				false, null);
+		this.activity = a;
+		this.panel = p;
+		this.editManager = editManager;
+
+		owningWorkflowBundle = activity.getParent().getParent();
+		owningProcessor = findProcessor(a);
+
+		setTitle(getRelativeName(owningWorkflowBundle, activity));
+		setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
+		setLayout(new BorderLayout());
+
+		add(panel, BorderLayout.CENTER);
+
+		buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
+		buttonPanel.setBorder(new EmptyBorder(5, 20, 5, 5));
+
+		JButton helpButton = new DeselectingButton("Help", new AbstractAction() {
+			@Override
+			public void actionPerformed(ActionEvent e) {
+				showHelp(panel);
+			}
+		});
+		buttonPanel.add(helpButton);
+
+		applyButton = new DeselectingButton("Apply", new AbstractAction() {
+			@Override
+			public void actionPerformed(ActionEvent e) {
+				/*
+				 * For the moment it always does an apply as what should be
+				 * happening is that the apply button only becomes available
+				 * when the configuration has changed. However, many
+				 * configuration panels are not set up to detected changes
+				 */
+				// if (panel.isConfigurationChanged()) {
+				if (checkPanelValues())
+					applyConfiguration();
+				// } else {
+				// logger.info("Ignoring apply");
+				// }
+			}
+		});
+		buttonPanel.add(applyButton);
+
+		JButton closeButton = new DeselectingButton("Close", new AbstractAction() {
+			@Override
+			public void actionPerformed(ActionEvent e) {
+				closeDialog();
+			}
+		});
+		buttonPanel.add(closeButton);
+
+		add(buttonPanel, SOUTH);
+
+		this.addWindowListener(new WindowAdapter() {
+			@Override
+			public void windowOpened(WindowEvent e) {
+				requestFocusInWindow();
+				panel.whenOpened();
+			}
+
+			@Override
+			public void windowClosing(WindowEvent e) {
+				closeDialog();
+			}
+		});
+		pack();
+		minimalSize = getSize();
+		setLocationRelativeTo(null);
+		setResizable(true);
+		addComponentListener(new ComponentAdapter() {
+			@Override
+			public void componentResized(ComponentEvent e) {
+				int newWidth = max(getWidth(), minimalSize.width);
+				int newHeight = max(getHeight(), minimalSize.height);
+				setSize(new Dimension(newWidth, newHeight));
+			}
+		});
+
+		observer = new Observer<EditManagerEvent>() {
+			@Override
+			public void notify(Observable<EditManagerEvent> sender, EditManagerEvent message)
+					throws Exception {
+				logger.info("sender is a " + sender.getClass().getCanonicalName());
+				logger.info("message is a " + message.getClass().getCanonicalName());
+				Edit<?> edit = message.getEdit();
+				logger.info(edit.getClass().getCanonicalName());
+				considerEdit(message, edit);
+			}
+		};
+		editManager.addObserver(observer);
+	}
+
+	private boolean checkPanelValues() {
+		boolean result = false;
+		try {
+			setCursor(getPredefinedCursor(WAIT_CURSOR));
+			result = panel.checkValues();
+		} finally {
+			setCursor(getPredefinedCursor(DEFAULT_CURSOR));
+		}
+		return result;
+	}
+
+	private void considerEdit(EditManagerEvent message, Edit<?> edit) {
+		// boolean result = false;
+		if (edit instanceof CompoundEdit) {
+			for (Edit<?> subEdit : ((CompoundEdit) edit).getChildEdits())
+				considerEdit(message, subEdit);
+			return;
+		}
+
+		Object subject = edit.getSubject();
+		if (subject == owningProcessor) {
+			// panel.reevaluate();
+			setTitle(getRelativeName(owningWorkflowBundle, activity));
+		} else if (subject == owningWorkflowBundle) {
+			for (Workflow workflow : owningWorkflowBundle.getWorkflows())
+				if (!workflow.getProcessors().contains(owningProcessor))
+					clearDialog(activity);
+		} else if (subject == activity) {
+			if (message instanceof DataFlowUndoEvent) {
+				logger.info("undo of activity edit found");
+				panel.refreshConfiguration();
+			} else if (message instanceof DataFlowRedoEvent) {
+				logger.info("redo of activity edit found");
+				panel.refreshConfiguration();
+			}
+		}
+	}
+
+	protected void configureActivity(ObjectNode json, List<ActivityPortConfiguration> inputPorts,
+			List<ActivityPortConfiguration> outputPorts) {
+		configureActivity(owningWorkflowBundle, activity, json, inputPorts, outputPorts);
+	}
+
+	public void configureActivity(WorkflowBundle workflowBundle, Activity activity,
+			ObjectNode json, List<ActivityPortConfiguration> inputPorts,
+			List<ActivityPortConfiguration> outputPorts) {
+		try {
+			List<Edit<?>> editList = new ArrayList<Edit<?>>();
+			Profile profile = activity.getParent();
+			List<ProcessorBinding> processorBindings = scufl2Tools
+					.processorBindingsToActivity(activity);
+			Configuration configuration = scufl2Tools.configurationFor(activity, profile);
+			editList.add(new ChangeJsonEdit(configuration, json));
+
+			configurePorts(activity, editList, processorBindings, inputPorts, PortType.INPUT);
+			configurePorts(activity, editList, processorBindings, outputPorts, PortType.OUTPUT);
+			editManager.doDataflowEdit(workflowBundle, new CompoundEdit(editList));
+		} catch (IllegalStateException | EditException e) {
+			logger.error(e);
+		}
+	}
+
+	private void configurePorts(Activity activity, List<Edit<?>> editList,
+			List<ProcessorBinding> processorBindings,
+			List<ActivityPortConfiguration> portDefinitions, PortType portType) {
+		Set<ActivityPort> ports = new HashSet<>();
+		for (ActivityPort activityPort : portType == PortType.INPUT ? activity
+				.getInputPorts() : activity.getOutputPorts())
+			ports.add(activityPort);
+		for (ActivityPortConfiguration portDefinition : portDefinitions) {
+			String portName = portDefinition.getName();
+			int portDepth = portDefinition.getDepth();
+			int granularPortDepth = portDefinition.getGranularDepth();
+			ActivityPort activityPort = portDefinition.getActivityPort();
+			if (activityPort == null) {
+				// no activity port so add a new one
+				if (portType == PortType.INPUT)
+					createInputPort(activity, editList, processorBindings, portDefinition);
+				else
+					createOutputPort(activity, editList, processorBindings, portDefinition);
+			} else {
+				ports.remove(activityPort);
+				// check if port has changed
+				for (ProcessorBinding processorBinding : processorBindings)
+					if (portType == PortType.INPUT)
+						for (ProcessorInputPortBinding portBinding : processorBinding
+								.getInputPortBindings()) {
+							if (!portBinding.getBoundActivityPort().equals(
+									activityPort))
+								continue;
+							InputProcessorPort processorPort = portBinding
+									.getBoundProcessorPort();
+							if (!activityPort.getName().equals(portName))
+								// port name changed
+								if (processorPort.getName().equals(activityPort.getName()))
+									// default mapping so change processor port
+									editList.add(new RenameEdit<>(processorPort, portName));
+							if (!processorPort.getDepth().equals(portDepth))
+								// port depth changed
+								editList.add(new ChangeDepthEdit<>(
+										processorPort, portDepth));
+						}
+					else
+						for (ProcessorOutputPortBinding portBinding : processorBinding
+								.getOutputPortBindings()) {
+							if (!portBinding.getBoundActivityPort().equals(
+									activityPort))
+								continue;
+							OutputProcessorPort processorPort = portBinding
+									.getBoundProcessorPort();
+							if (!activityPort.getName().equals(portName))
+								// port name changed
+								if (processorPort.getName().equals(
+										activityPort.getName()))
+									// default mapping so change processor port
+									editList.add(new RenameEdit<>(
+											processorPort, portName));
+							if (!processorPort.getDepth().equals(portDepth))
+								// port depth changed
+								editList.add(new ChangeDepthEdit<>(
+										processorPort, portDepth));
+							if (!processorPort.getGranularDepth().equals(
+									granularPortDepth))
+								// port granular depth changed
+								editList.add(new ChangeGranularDepthEdit<>(
+										processorPort, granularPortDepth));
+						}
+				if (!activityPort.getName().equals(portName))
+					// port name changed
+					editList.add(new RenameEdit<>(activityPort, portName));
+				if (!activityPort.getDepth().equals(portDepth))
+					// port depth changed
+					editList.add(new ChangeDepthEdit<>(activityPort, portDepth));
+				if (activityPort instanceof OutputActivityPort) {
+					OutputActivityPort outputActivityPort = (OutputActivityPort) activityPort;
+					Integer granularDepth = outputActivityPort
+							.getGranularDepth();
+					if (granularDepth == null
+							|| !granularDepth.equals(granularPortDepth))
+						// granular port depth changed
+						editList.add(new ChangeGranularDepthEdit<>(
+								outputActivityPort, granularPortDepth));
+				}
+			}
+		}
+
+		// remove any unconfigured ports
+		for (ActivityPort activityPort : ports) {
+			// remove processor ports and bindings
+			for (ProcessorBinding processorBinding : processorBindings)
+				if (portType.equals(PortType.INPUT))
+					for (ProcessorInputPortBinding portBinding : processorBinding
+							.getInputPortBindings()) {
+						if (portBinding.getBoundActivityPort().equals(activityPort)) {
+							editList.add(new RemoveProcessorInputPortEdit(processorBinding
+									.getBoundProcessor(), portBinding.getBoundProcessorPort()));
+							editList.add(new RemoveChildEdit<>(processorBinding,
+									portBinding));
+						}
+					}
+				else
+					for (ProcessorOutputPortBinding portBinding : processorBinding
+							.getOutputPortBindings())
+						if (portBinding.getBoundActivityPort().equals(activityPort)) {
+							editList.add(new RemoveProcessorOutputPortEdit(processorBinding
+									.getBoundProcessor(), portBinding.getBoundProcessorPort()));
+							editList.add(new RemoveChildEdit<>(processorBinding,
+									portBinding));
+						}
+			// remove activity port
+			editList.add(new RemoveChildEdit<Activity>(activity, activityPort));
+		}
+	}
+
+	private void createInputPort(Activity activity, List<Edit<?>> editList,
+			List<ProcessorBinding> processorBindings,
+			ActivityPortConfiguration portDefinition) {
+		InputActivityPort actPort = new InputActivityPort(null,
+				portDefinition.getName());
+		actPort.setDepth(portDefinition.getDepth());
+		// add port to activity
+		editList.add(new AddChildEdit<>(activity, actPort));
+		for (ProcessorBinding processorBinding : processorBindings) {
+			Processor processor = processorBinding.getBoundProcessor();
+			// add a new processor port
+			InputProcessorPort procPort = new InputProcessorPort();
+			procPort.setName(portDefinition.getName());
+			procPort.setDepth(portDefinition.getDepth());
+			editList.add(new AddProcessorInputPortEdit(processor, procPort));
+			// add a new port binding
+			ProcessorInputPortBinding binding = new ProcessorInputPortBinding();
+			binding.setBoundProcessorPort(procPort);
+			binding.setBoundActivityPort(actPort);
+			editList.add(new AddChildEdit<>(processorBinding, binding));
+		}
+	}
+
+	private void createOutputPort(Activity activity, List<Edit<?>> editList,
+			List<ProcessorBinding> processorBindings,
+			ActivityPortConfiguration portDefinition) {
+		OutputActivityPort actPort = new OutputActivityPort(null,
+				portDefinition.getName());
+		actPort.setDepth(portDefinition.getDepth());
+		actPort.setGranularDepth(portDefinition.getGranularDepth());
+		// add port to activity
+		editList.add(new AddChildEdit<Activity>(activity, actPort));
+		for (ProcessorBinding processorBinding : processorBindings) {
+			Processor processor = processorBinding.getBoundProcessor();
+			// add a new processor port
+			OutputProcessorPort procPort = new OutputProcessorPort();
+			procPort.setName(portDefinition.getName());
+			procPort.setDepth(portDefinition.getDepth());
+			procPort.setGranularDepth(portDefinition.getGranularDepth());
+			editList.add(new AddProcessorOutputPortEdit(processor, procPort));
+			// add a new port binding
+			ProcessorOutputPortBinding binding = new ProcessorOutputPortBinding();
+			binding.setBoundProcessorPort(procPort);
+			binding.setBoundActivityPort(actPort);
+			editList.add(new AddChildEdit<>(processorBinding, binding));
+		}
+	}
+
+	protected static Processor findProcessor(Activity activity) {
+		for (ProcessorBinding processorBinding : scufl2Tools
+				.processorBindingsToActivity(activity))
+			return processorBinding.getBoundProcessor();
+		return null;
+	}
+
+	public static String getRelativeName(WorkflowBundle workflowBundle, Activity activity) {
+		StringBuilder relativeName = new StringBuilder("");
+		if (workflowBundle != null) {
+			Workflow workflow = workflowBundle.getMainWorkflow();
+			if (workflow != null) {
+				relativeName.append(workflow.getName());
+				relativeName.append(":");
+			}
+		}
+		Processor processor = findProcessor(activity);
+		if (processor != null)
+			relativeName.append(processor.getName());
+		return relativeName.toString();
+	}
+
+	public boolean closeDialog() {
+		if (panel.isConfigurationChanged()) {
+			String relativeName = getRelativeName(owningWorkflowBundle, activity);
+			if (checkPanelValues()) {
+				int answer = showConfirmDialog(this,
+						"Do you want to save the configuration of " + relativeName + "?",
+						relativeName, YES_NO_CANCEL_OPTION);
+				if (answer == YES_OPTION) {
+					applyConfiguration();
+				} else if (answer == CANCEL_OPTION) {
+					return false;
+				}
+			} else if (showConfirmDialog(
+					this,
+					"New configuration could not be saved. Do you still want to close?",
+					relativeName, YES_NO_OPTION) == NO_OPTION)
+				return false;
+		}
+		panel.whenClosed();
+		clearDialog(activity);
+		return true;
+	}
+
+	private void applyConfiguration() {
+		panel.noteConfiguration();
+		configureActivity(panel.getJson(), panel.getInputPorts(),
+				panel.getOutputPorts());
+		panel.refreshConfiguration();
+	}
+
+	@Override
+	public void dispose() {
+		super.dispose();
+		editManager.removeObserver(observer);
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-contextual-views-api/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/activity/ActivityConfigurationPanel.java
----------------------------------------------------------------------
diff --git a/taverna-contextual-views-api/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/activity/ActivityConfigurationPanel.java b/taverna-contextual-views-api/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/activity/ActivityConfigurationPanel.java
new file mode 100644
index 0000000..b0a6fa9
--- /dev/null
+++ b/taverna-contextual-views-api/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/activity/ActivityConfigurationPanel.java
@@ -0,0 +1,230 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.views.contextualviews.activity;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.swing.JPanel;
+
+import org.apache.log4j.Logger;
+
+import org.apache.taverna.commons.services.ActivityTypeNotFoundException;
+import org.apache.taverna.commons.services.InvalidConfigurationException;
+import org.apache.taverna.commons.services.ServiceRegistry;
+import org.apache.taverna.scufl2.api.activity.Activity;
+import org.apache.taverna.scufl2.api.common.Scufl2Tools;
+import org.apache.taverna.scufl2.api.configurations.Configuration;
+import org.apache.taverna.scufl2.api.port.ActivityPort;
+import org.apache.taverna.scufl2.api.port.InputActivityPort;
+import org.apache.taverna.scufl2.api.port.OutputActivityPort;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+
+/**
+ * @author alanrw
+ */
+@SuppressWarnings("serial")
+public abstract class ActivityConfigurationPanel extends JPanel {
+	private static final Logger logger = Logger.getLogger(ActivityConfigurationPanel.class);
+	private final static Scufl2Tools scufl2Tools = new Scufl2Tools();
+
+	// protected final URITools uriTools = new URITools();
+	private final Activity activity;
+	private final Configuration configuration;
+	private final List<ActivityPortConfiguration> inputPorts;
+	private final List<ActivityPortConfiguration> outputPorts;
+	protected ObjectNode json;
+
+	public ActivityConfigurationPanel(Activity activity) {
+		this(activity, scufl2Tools.configurationFor(activity,
+				activity.getParent()));
+	}
+
+	public ActivityConfigurationPanel(Activity activity,
+			Configuration configuration) {
+		this.activity = activity;
+		this.configuration = configuration;
+		inputPorts = new ArrayList<>();
+		outputPorts = new ArrayList<>();
+	}
+
+	/**
+	 * Initializes the configuration panel. This method is also used to discard
+	 * any changes and reset the panel to its initial state. Subclasses should
+	 * implement this method to set up the panel and must call
+	 * <tt>super.initialise()</tt> first.
+	 */
+	protected void initialise() {
+		json = configuration.getJson().deepCopy();
+		inputPorts.clear();
+		for (InputActivityPort activityPort : activity.getInputPorts())
+			inputPorts.add(new ActivityPortConfiguration(activityPort));
+		outputPorts.clear();
+		for (OutputActivityPort activityPort : activity.getOutputPorts())
+			outputPorts.add(new ActivityPortConfiguration(activityPort));
+	}
+
+	public abstract boolean checkValues();
+
+	public abstract void noteConfiguration();
+
+	public boolean isConfigurationChanged() {
+		noteConfiguration();
+		if (portsChanged(inputPorts, activity.getInputPorts().size()))
+			return true;
+		if (portsChanged(outputPorts, activity.getOutputPorts().size()))
+			return true;
+		return !json.equals(configuration.getJson());
+	}
+
+	public Configuration getConfiguration() {
+		return configuration;
+	}
+
+	public ObjectNode getJson() {
+		return json;
+	}
+
+	protected void setJson(ObjectNode json) {
+		this.json = json;
+	}
+
+	public void refreshConfiguration() {
+		initialise();
+	}
+
+	public void whenOpened() {
+	}
+
+	public void whenClosed() {
+	}
+
+	/**
+	 * Convenience method for getting simple String property values.
+	 *
+	 * @param name
+	 *            the property name
+	 * @return the property value
+	 */
+	protected String getProperty(String name) {
+		JsonNode jsonNode = json.get(name);
+		if (jsonNode == null)
+			return null;
+		return json.get(name).asText();
+	}
+
+	/**
+	 * Convenience method for setting simple String property values.
+	 *
+	 * @param name
+	 *            the property name
+	 * @param value
+	 *            the property value
+	 */
+	protected void setProperty(String name, String value) {
+		json.put(name, value);
+	}
+
+	public List<ActivityPortConfiguration> getInputPorts() {
+		return inputPorts;
+	}
+
+	public List<ActivityPortConfiguration> getOutputPorts() {
+		return outputPorts;
+	}
+
+	protected void configureInputPorts(ServiceRegistry serviceRegistry) {
+		try {
+			Map<String, InputActivityPort> newInputPorts = new HashMap<>();
+			for (InputActivityPort port : serviceRegistry
+					.getActivityInputPorts(getActivity().getType(), getJson()))
+				newInputPorts.put(port.getName(), port);
+			List<ActivityPortConfiguration> inputPorts = getInputPorts();
+			for (ActivityPortConfiguration portConfig : new ArrayList<>(
+					inputPorts))
+				if (newInputPorts.containsKey(portConfig.getName())) {
+					InputActivityPort port = newInputPorts.remove(portConfig
+							.getName());
+					portConfig.setDepth(port.getDepth());
+				} else
+					inputPorts.remove(portConfig);
+			for (InputActivityPort newPort : newInputPorts.values())
+				inputPorts.add(new ActivityPortConfiguration(newPort.getName(),
+						newPort.getDepth()));
+		} catch (InvalidConfigurationException | ActivityTypeNotFoundException e) {
+			logger.warn("Error configuring input ports", e);
+		}
+	}
+
+	protected void configureOutputPorts(ServiceRegistry serviceRegistry) {
+		try {
+			Map<String, OutputActivityPort> newOutputPorts = new HashMap<>();
+			for (OutputActivityPort port : serviceRegistry
+					.getActivityOutputPorts(getActivity().getType(), getJson()))
+				newOutputPorts.put(port.getName(), port);
+			List<ActivityPortConfiguration> outputPorts = getOutputPorts();
+			for (ActivityPortConfiguration portConfig : new ArrayList<>(
+					outputPorts))
+				if (newOutputPorts.containsKey(portConfig.getName())) {
+					OutputActivityPort port = newOutputPorts.remove(portConfig
+							.getName());
+					portConfig.setDepth(port.getDepth());
+					portConfig.setGranularDepth(port.getGranularDepth());
+				} else
+					outputPorts.remove(portConfig);
+			for (OutputActivityPort newPort : newOutputPorts.values())
+				outputPorts.add(new ActivityPortConfiguration(
+						newPort.getName(), newPort.getDepth()));
+		} catch (InvalidConfigurationException | ActivityTypeNotFoundException e) {
+			logger.warn("Error configuring output ports", e);
+		}
+	}
+
+	private boolean portsChanged(List<ActivityPortConfiguration> portDefinitions, int ports) {
+		int checkedPorts = 0;
+		for (ActivityPortConfiguration portDefinition : portDefinitions) {
+			String portName = portDefinition.getName();
+			int portDepth = portDefinition.getDepth();
+			ActivityPort activityPort = portDefinition.getActivityPort();
+			if (activityPort == null)
+				// new port added
+				return true;
+			if (!activityPort.getName().equals(portName))
+				// port name changed
+				return true;
+			if (!activityPort.getDepth().equals(portDepth))
+				// port depth changed
+				return true;
+			checkedPorts++;
+		}
+		if (checkedPorts < ports)
+			// ports deleted
+			return true;
+		return false;
+	}
+
+	public Activity getActivity() {
+		return activity;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-contextual-views-api/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/activity/ActivityPortConfiguration.java
----------------------------------------------------------------------
diff --git a/taverna-contextual-views-api/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/activity/ActivityPortConfiguration.java b/taverna-contextual-views-api/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/activity/ActivityPortConfiguration.java
new file mode 100644
index 0000000..f3ea920
--- /dev/null
+++ b/taverna-contextual-views-api/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/activity/ActivityPortConfiguration.java
@@ -0,0 +1,83 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.views.contextualviews.activity;
+
+import org.apache.taverna.scufl2.api.port.ActivityPort;
+
+/**
+ *
+ *
+ * @author David Withers
+ */
+public class ActivityPortConfiguration {
+
+	private ActivityPort activityPort;
+
+	private String name;
+
+	private int depth;
+
+	private int granularDepth;
+
+	public ActivityPortConfiguration(ActivityPort activityPort) {
+		this.activityPort = activityPort;
+		name = activityPort.getName();
+		depth = activityPort.getDepth();
+	}
+
+	public ActivityPortConfiguration(String name, int depth) {
+		this(name, depth, depth);
+	}
+
+	public ActivityPortConfiguration(String name, int depth, int granularDepth) {
+		this.name = name;
+		this.depth = depth;
+		this.granularDepth = granularDepth;
+	}
+
+	public ActivityPort getActivityPort() {
+		return activityPort;
+	}
+
+	public String getName() {
+		return name;
+	}
+
+	public void setName(String name) {
+		this.name = name;
+	}
+
+	public int getDepth() {
+		return depth;
+	}
+
+	public void setDepth(int depth) {
+		this.depth = depth;
+	}
+
+	public int getGranularDepth() {
+		return granularDepth;
+	}
+
+	public void setGranularDepth(int granularDepth) {
+		this.granularDepth = granularDepth;
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-contextual-views-api/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/activity/ContextualViewFactory.java
----------------------------------------------------------------------
diff --git a/taverna-contextual-views-api/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/activity/ContextualViewFactory.java b/taverna-contextual-views-api/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/activity/ContextualViewFactory.java
new file mode 100644
index 0000000..926268f
--- /dev/null
+++ b/taverna-contextual-views-api/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/activity/ContextualViewFactory.java
@@ -0,0 +1,62 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.views.contextualviews.activity;
+
+import java.util.List;
+
+import org.apache.taverna.workbench.ui.views.contextualviews.ContextualView;
+
+/**
+ * Defines a factory class that when associated with a selected object creates a
+ * {@link ContextualView} for that selection.
+ * <p>
+ * This factory acts as an SPI to find {@link ContextualView}s for a given
+ * Activity and other workflow components.
+ * </p>
+ * 
+ * @author Stuart Owen
+ * @author Ian Dunlop
+ * @author Stian Soiland-Reyes
+ * 
+ * 
+ * @param <SelectionType>
+ *            - the selection type this factory is associated with
+ * 
+ * @see ContextualView
+ * @see ContextualViewFactoryRegistry
+ */
+public interface ContextualViewFactory<SelectionType> {
+	/**
+	 * @param selection
+	 *            - the object for which ContextualViews needs to be generated
+	 * @return instance of {@link ContextualView}
+	 */
+	public List<ContextualView> getViews(SelectionType selection);
+
+	/**
+	 * Used by the SPI system to find the correct factory that can handle the
+	 * given object type. 
+	 * 
+	 * @param selection
+	 * @return true if this factory relates to the given selection type
+	 * @see ContextualViewFactoryRegistry
+	 */
+	public boolean canHandle(Object selection);
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-contextual-views-api/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/activity/ContextualViewFactoryRegistry.java
----------------------------------------------------------------------
diff --git a/taverna-contextual-views-api/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/activity/ContextualViewFactoryRegistry.java b/taverna-contextual-views-api/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/activity/ContextualViewFactoryRegistry.java
new file mode 100644
index 0000000..735302d
--- /dev/null
+++ b/taverna-contextual-views-api/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/activity/ContextualViewFactoryRegistry.java
@@ -0,0 +1,42 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.views.contextualviews.activity;
+
+import java.util.List;
+
+/**
+ * A registry for discovering ActivityViewFactories for a given object,
+ * like an {@link org.apache.taverna.workflowmodel.processor.activity.Activity}.
+ *
+ * @author David Withers
+ */
+public interface ContextualViewFactoryRegistry {
+	/**
+	 * Discover and return the ContextualViewFactory associated to the provided
+	 * object. This is accomplished by returning the discovered
+	 * {@link ContextualViewFactory#canHandle(Object)} that returns true for
+	 * that Object.
+	 *
+	 * @param object
+	 * @return
+	 * @see ContextualViewFactory#canHandle(Object)
+	 */
+	public <T> List<ContextualViewFactory<? super T>> getViewFactoriesForObject(T object);
+}


[37/51] [partial] incubator-taverna-workbench git commit: all packages are moved to org.apache.taverna.*

Posted by re...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-contextual-views/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/processor/ProcessorActivitiesContextualViewFactory.java
----------------------------------------------------------------------
diff --git a/taverna-contextual-views/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/processor/ProcessorActivitiesContextualViewFactory.java b/taverna-contextual-views/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/processor/ProcessorActivitiesContextualViewFactory.java
deleted file mode 100644
index e942d3a..0000000
--- a/taverna-contextual-views/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/processor/ProcessorActivitiesContextualViewFactory.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007-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.ui.views.contextualviews.processor;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import net.sf.taverna.t2.workbench.selection.SelectionManager;
-import net.sf.taverna.t2.workbench.ui.views.contextualviews.ContextualView;
-import net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory;
-import net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactoryRegistry;
-import org.apache.taverna.scufl2.api.activity.Activity;
-import org.apache.taverna.scufl2.api.common.Scufl2Tools;
-import org.apache.taverna.scufl2.api.core.Processor;
-import org.apache.taverna.scufl2.api.profiles.ProcessorBinding;
-
-/**
- * SPI factory for creating a {@link ProcessorContextualView}.
- * 
- * @author Stian Soiland-Reyes
- * @author Alan R Williams
- */
-public class ProcessorActivitiesContextualViewFactory implements
-		ContextualViewFactory<Processor> {
-	private Scufl2Tools scufl2Tools = new Scufl2Tools();
-	private ContextualViewFactoryRegistry contextualViewFactoryRegistry;
-	private SelectionManager selectionManager;
-
-	@Override
-	public boolean canHandle(Object selection) {
-		return selection instanceof Processor;
-	}
-
-	@Override
-	public List<ContextualView> getViews(Processor selection) {
-		List<ContextualView> result = new ArrayList<>();
-		List<ProcessorBinding> processorBindings = scufl2Tools
-				.processorBindingsForProcessor(selection,
-						selectionManager.getSelectedProfile());
-		for (ProcessorBinding processorBinding : processorBindings) {
-			Activity activity = processorBinding.getBoundActivity();
-			for (ContextualViewFactory<? super Activity> cvf : contextualViewFactoryRegistry
-					.getViewFactoriesForObject(activity))
-				result.addAll(cvf.getViews(activity));
-		}
-		return result;
-	}
-
-	public void setContextualViewFactoryRegistry(
-			ContextualViewFactoryRegistry contextualViewFactoryRegistry) {
-		this.contextualViewFactoryRegistry = contextualViewFactoryRegistry;
-	}
-
-	public void setSelectionManager(SelectionManager selectionManager) {
-		this.selectionManager = selectionManager;
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-contextual-views/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/processor/ProcessorPredictedBehaviorContextualViewFactory.java
----------------------------------------------------------------------
diff --git a/taverna-contextual-views/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/processor/ProcessorPredictedBehaviorContextualViewFactory.java b/taverna-contextual-views/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/processor/ProcessorPredictedBehaviorContextualViewFactory.java
deleted file mode 100644
index 2a3fae7..0000000
--- a/taverna-contextual-views/src/main/java/net/sf/taverna/t2/workbench/ui/views/contextualviews/processor/ProcessorPredictedBehaviorContextualViewFactory.java
+++ /dev/null
@@ -1,177 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007-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.ui.views.contextualviews.processor;
-
-import static java.util.Collections.singletonList;
-import static javax.swing.BoxLayout.Y_AXIS;
-
-import java.util.List;
-
-import javax.swing.BoxLayout;
-import javax.swing.JComponent;
-import javax.swing.JEditorPane;
-import javax.swing.JPanel;
-
-import net.sf.taverna.t2.workbench.ui.views.contextualviews.ContextualView;
-import net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory;
-import org.apache.taverna.scufl2.api.common.NamedSet;
-import org.apache.taverna.scufl2.api.common.Scufl2Tools;
-import org.apache.taverna.scufl2.api.core.DataLink;
-import org.apache.taverna.scufl2.api.core.Processor;
-import org.apache.taverna.scufl2.api.port.InputProcessorPort;
-import org.apache.taverna.scufl2.api.port.OutputProcessorPort;
-
-/**
- * How to get a panel describing what Taverna predicts the depth of the ports of
- * a processor to be.
- * 
- * @author Stian Soiland-Reyes
- */
-public class ProcessorPredictedBehaviorContextualViewFactory implements
-		ContextualViewFactory<Processor> {
-	private Scufl2Tools scufl2Tools = new Scufl2Tools();
-
-	@Override
-	public boolean canHandle(Object selection) {
-		return selection instanceof Processor;
-	}
-
-	@Override
-	@SuppressWarnings("serial")
-	public List<ContextualView> getViews(final Processor selection) {
-		class ProcessorPredictedBehaviorContextualView extends ContextualView {
-			protected JPanel mainPanel = new JPanel();
-			protected Processor processor;
-
-			public ProcessorPredictedBehaviorContextualView() {
-				super();
-				refreshView();
-				initView();
-			}
-
-			@Override
-			public void refreshView() {
-				initialise();
-				this.revalidate();
-			}
-
-			private synchronized void initialise() {
-				mainPanel.removeAll();
-				mainPanel.setLayout(new BoxLayout(mainPanel, Y_AXIS));
-
-				StringBuilder html = new StringBuilder("<html><head>");
-				addStyle(html);
-				html.append("</head><body>");
-
-				NamedSet<InputProcessorPort> inputs = processor.getInputPorts();
-				if (!inputs.isEmpty()) {
-					html.append("<table border=1><tr><th>Input Port Name</th>")
-							.append("<th>Size of data</th>").append("</tr>");
-					for (InputProcessorPort ip : inputs) {
-						html.append("<tr><td>").append(ip.getName())
-								.append("</td><td>");
-						List<DataLink> incomingDataLinks = scufl2Tools
-								.datalinksTo(ip);
-						if (incomingDataLinks.isEmpty())
-							html.append("No value");
-						else {
-							int depth = getDepth(incomingDataLinks.get(0));
-							if (depth == -1)
-								html.append("Invalid");
-							else if (depth == 0)
-								html.append("Single value");
-							else
-								html.append("List of depth ").append(depth);
-						}
-						html.append("</td></tr>");
-					}
-					html.append("</table>");
-				}
-				NamedSet<OutputProcessorPort> outputs = processor
-						.getOutputPorts();
-				if (!outputs.isEmpty()) {
-					html.append("<table border=1><tr><th>Output Port Name</th>")
-							.append("<th>Size of data</th>").append("</tr>");
-					for (OutputProcessorPort op : outputs) {
-						html.append("<tr><td>").append(op.getName())
-								.append("</td><td>");
-						List<DataLink> outgoingDataLinks = scufl2Tools
-								.datalinksFrom(op);
-						if (outgoingDataLinks.isEmpty())
-							html.append("No value");
-						else {
-							int depth = getDepth(outgoingDataLinks.get(0));
-							if (depth == -1)
-								html.append("Invalid/unpredicted");
-							else if (depth == 0)
-								html.append("Single value");
-							else
-								html.append("List of depth ").append(depth);
-						}
-						html.append("</td></tr>");
-					}
-					html.append("</table>");
-				}
-				if (inputs.isEmpty() && outputs.isEmpty())
-					html.append("<p>No port behavior predicted</p>");
-				html.append("</body></html>");
-				JEditorPane editorPane = new JEditorPane("text/html",
-						html.toString());
-				editorPane.setEditable(false);
-				mainPanel.add(editorPane);
-
-				mainPanel.revalidate();
-				mainPanel.repaint();
-				this.revalidate();
-				this.repaint();
-			}
-
-			protected void addStyle(StringBuilder html) {
-				html.append("<style type='text/css'>")
-						.append("table {align:center; border:solid black 1px;")
-						.append("width:100%; height:100%; overflow:auto;}")
-						.append("</style>");
-			}
-
-			@Override
-			public JComponent getMainFrame() {
-				return mainPanel;
-			}
-
-			@Override
-			public String getViewTitle() {
-				return "Predicted behavior";
-			}
-
-			@Override
-			public int getPreferredPosition() {
-				return 300;
-			}
-		}
-
-		return singletonList((ContextualView) new ProcessorPredictedBehaviorContextualView());
-	}
-
-	private int getDepth(DataLink datalink) {
-		// TODO calculate actual depth
-		return -1;
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-contextual-views/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/processor/ProcessorActivitiesContextualView.java
----------------------------------------------------------------------
diff --git a/taverna-contextual-views/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/processor/ProcessorActivitiesContextualView.java b/taverna-contextual-views/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/processor/ProcessorActivitiesContextualView.java
new file mode 100644
index 0000000..964cae6
--- /dev/null
+++ b/taverna-contextual-views/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/processor/ProcessorActivitiesContextualView.java
@@ -0,0 +1,153 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.views.contextualviews.processor;
+
+import static java.awt.GridBagConstraints.CENTER;
+import static java.awt.GridBagConstraints.HORIZONTAL;
+import static java.awt.GridBagConstraints.LINE_START;
+import static java.awt.GridBagConstraints.NONE;
+import static org.apache.taverna.workbench.ui.Utils.getParentFrame;
+
+import java.awt.Frame;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.util.List;
+
+import javax.swing.Action;
+import javax.swing.JButton;
+import javax.swing.JComponent;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+
+import org.apache.taverna.workbench.selection.SelectionManager;
+import org.apache.taverna.workbench.ui.views.contextualviews.ContextualView;
+import org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory;
+import org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactoryRegistry;
+
+import org.apache.taverna.scufl2.api.activity.Activity;
+import org.apache.taverna.scufl2.api.common.Scufl2Tools;
+import org.apache.taverna.scufl2.api.core.Processor;
+import org.apache.taverna.scufl2.api.profiles.ProcessorBinding;
+
+/**
+ * View of a processor, including it's iteration stack, activities, etc.
+ *
+ * @author Stian Soiland-Reyes
+ * @author Alan R Williams
+ */
+@SuppressWarnings("serial")
+public class ProcessorActivitiesContextualView extends ContextualView {
+	private static final String ABSTRACT_PROCESSOR_MSG = "<strong>Abstract processor</strong><br>"
+			+ "<i>No services. This will not execute.</i>";
+	private Scufl2Tools scufl2Tools = new Scufl2Tools();
+	protected JPanel mainPanel = new JPanel();
+	protected Processor processor;
+	private final ContextualViewFactoryRegistry contextualViewFactoryRegistry;
+	private final SelectionManager selectionManager;
+
+	public ProcessorActivitiesContextualView(Processor processor,
+			ContextualViewFactoryRegistry contextualViewFactoryRegistry,
+			SelectionManager selectionManager) {
+		super();
+		this.processor = processor;
+		this.contextualViewFactoryRegistry = contextualViewFactoryRegistry;
+		this.selectionManager = selectionManager;
+		initialise();
+		initView();
+	}
+
+	@Override
+	public void refreshView() {
+		initialise();
+		this.revalidate();
+	}
+
+	private synchronized void initialise() {
+		mainPanel.removeAll();
+		mainPanel.setLayout(new GridBagLayout());
+
+		GridBagConstraints constraints = new GridBagConstraints();
+		constraints.gridx = 0;
+		constraints.gridy = 0;
+		constraints.weightx = 0.1;
+		constraints.weighty = 0;
+
+		List<ProcessorBinding> processorBindings = scufl2Tools
+				.processorBindingsForProcessor(processor,
+						selectionManager.getSelectedProfile());
+		if (processorBindings.isEmpty()) {
+			JLabel noActivitiesLabel = new JLabel("<html>"
+					+ ABSTRACT_PROCESSOR_MSG + "</html>");
+			constraints.fill = NONE;
+			constraints.anchor = LINE_START;
+			mainPanel.add(noActivitiesLabel, constraints);
+		} else
+			for (ProcessorBinding processorBinding : processorBindings)
+				addViewForBinding(constraints, processorBinding);
+		mainPanel.revalidate();
+		mainPanel.repaint();
+		this.revalidate();
+		this.repaint();
+	}
+
+	private void addViewForBinding(GridBagConstraints constraints,
+			ProcessorBinding processorBinding) {
+		Activity activity = processorBinding.getBoundActivity();
+		List<ContextualViewFactory<? super Activity>> viewFactoryForBeanType = contextualViewFactoryRegistry
+				.getViewFactoriesForObject(activity);
+		if (viewFactoryForBeanType.isEmpty())
+			return;
+		// TODO why a list when we only use the first, twice, and assume non-empty too?
+		ContextualView view = (ContextualView) viewFactoryForBeanType.get(0)
+				.getViews(activity).get(0);
+
+		constraints.anchor = CENTER;
+		constraints.fill = HORIZONTAL;
+		mainPanel.add(view, constraints);
+		Frame frame = getParentFrame(this);
+		Action configureAction = view.getConfigureAction(frame);
+		if (configureAction != null) {
+			constraints.gridy++;
+			constraints.fill = NONE;
+			constraints.anchor = LINE_START;
+			JButton configureButton = new JButton(configureAction);
+			if (configureButton.getText() == null
+					|| configureButton.getText().isEmpty())
+				configureButton.setText("Configure");
+			mainPanel.add(configureButton, constraints);
+		}
+		constraints.gridy++;
+	}
+
+	@Override
+	public JComponent getMainFrame() {
+		return mainPanel;
+	}
+
+	@Override
+	public String getViewTitle() {
+		return "Service";
+	}
+
+	@Override
+	public int getPreferredPosition() {
+		return 100;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-contextual-views/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/processor/ProcessorActivitiesContextualViewFactory.java
----------------------------------------------------------------------
diff --git a/taverna-contextual-views/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/processor/ProcessorActivitiesContextualViewFactory.java b/taverna-contextual-views/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/processor/ProcessorActivitiesContextualViewFactory.java
new file mode 100644
index 0000000..0f26d5e
--- /dev/null
+++ b/taverna-contextual-views/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/processor/ProcessorActivitiesContextualViewFactory.java
@@ -0,0 +1,74 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.views.contextualviews.processor;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.taverna.workbench.selection.SelectionManager;
+import org.apache.taverna.workbench.ui.views.contextualviews.ContextualView;
+import org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory;
+import org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactoryRegistry;
+import org.apache.taverna.scufl2.api.activity.Activity;
+import org.apache.taverna.scufl2.api.common.Scufl2Tools;
+import org.apache.taverna.scufl2.api.core.Processor;
+import org.apache.taverna.scufl2.api.profiles.ProcessorBinding;
+
+/**
+ * SPI factory for creating a {@link ProcessorContextualView}.
+ * 
+ * @author Stian Soiland-Reyes
+ * @author Alan R Williams
+ */
+public class ProcessorActivitiesContextualViewFactory implements
+		ContextualViewFactory<Processor> {
+	private Scufl2Tools scufl2Tools = new Scufl2Tools();
+	private ContextualViewFactoryRegistry contextualViewFactoryRegistry;
+	private SelectionManager selectionManager;
+
+	@Override
+	public boolean canHandle(Object selection) {
+		return selection instanceof Processor;
+	}
+
+	@Override
+	public List<ContextualView> getViews(Processor selection) {
+		List<ContextualView> result = new ArrayList<>();
+		List<ProcessorBinding> processorBindings = scufl2Tools
+				.processorBindingsForProcessor(selection,
+						selectionManager.getSelectedProfile());
+		for (ProcessorBinding processorBinding : processorBindings) {
+			Activity activity = processorBinding.getBoundActivity();
+			for (ContextualViewFactory<? super Activity> cvf : contextualViewFactoryRegistry
+					.getViewFactoriesForObject(activity))
+				result.addAll(cvf.getViews(activity));
+		}
+		return result;
+	}
+
+	public void setContextualViewFactoryRegistry(
+			ContextualViewFactoryRegistry contextualViewFactoryRegistry) {
+		this.contextualViewFactoryRegistry = contextualViewFactoryRegistry;
+	}
+
+	public void setSelectionManager(SelectionManager selectionManager) {
+		this.selectionManager = selectionManager;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-contextual-views/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/processor/ProcessorPredictedBehaviorContextualViewFactory.java
----------------------------------------------------------------------
diff --git a/taverna-contextual-views/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/processor/ProcessorPredictedBehaviorContextualViewFactory.java b/taverna-contextual-views/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/processor/ProcessorPredictedBehaviorContextualViewFactory.java
new file mode 100644
index 0000000..66bc931
--- /dev/null
+++ b/taverna-contextual-views/src/main/java/org/apache/taverna/workbench/ui/views/contextualviews/processor/ProcessorPredictedBehaviorContextualViewFactory.java
@@ -0,0 +1,176 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.views.contextualviews.processor;
+
+import static java.util.Collections.singletonList;
+import static javax.swing.BoxLayout.Y_AXIS;
+
+import java.util.List;
+
+import javax.swing.BoxLayout;
+import javax.swing.JComponent;
+import javax.swing.JEditorPane;
+import javax.swing.JPanel;
+
+import org.apache.taverna.workbench.ui.views.contextualviews.ContextualView;
+import org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory;
+import org.apache.taverna.scufl2.api.common.NamedSet;
+import org.apache.taverna.scufl2.api.common.Scufl2Tools;
+import org.apache.taverna.scufl2.api.core.DataLink;
+import org.apache.taverna.scufl2.api.core.Processor;
+import org.apache.taverna.scufl2.api.port.InputProcessorPort;
+import org.apache.taverna.scufl2.api.port.OutputProcessorPort;
+
+/**
+ * How to get a panel describing what Taverna predicts the depth of the ports of
+ * a processor to be.
+ * 
+ * @author Stian Soiland-Reyes
+ */
+public class ProcessorPredictedBehaviorContextualViewFactory implements
+		ContextualViewFactory<Processor> {
+	private Scufl2Tools scufl2Tools = new Scufl2Tools();
+
+	@Override
+	public boolean canHandle(Object selection) {
+		return selection instanceof Processor;
+	}
+
+	@Override
+	@SuppressWarnings("serial")
+	public List<ContextualView> getViews(final Processor selection) {
+		class ProcessorPredictedBehaviorContextualView extends ContextualView {
+			protected JPanel mainPanel = new JPanel();
+			protected Processor processor;
+
+			public ProcessorPredictedBehaviorContextualView() {
+				super();
+				refreshView();
+				initView();
+			}
+
+			@Override
+			public void refreshView() {
+				initialise();
+				this.revalidate();
+			}
+
+			private synchronized void initialise() {
+				mainPanel.removeAll();
+				mainPanel.setLayout(new BoxLayout(mainPanel, Y_AXIS));
+
+				StringBuilder html = new StringBuilder("<html><head>");
+				addStyle(html);
+				html.append("</head><body>");
+
+				NamedSet<InputProcessorPort> inputs = processor.getInputPorts();
+				if (!inputs.isEmpty()) {
+					html.append("<table border=1><tr><th>Input Port Name</th>")
+							.append("<th>Size of data</th>").append("</tr>");
+					for (InputProcessorPort ip : inputs) {
+						html.append("<tr><td>").append(ip.getName())
+								.append("</td><td>");
+						List<DataLink> incomingDataLinks = scufl2Tools
+								.datalinksTo(ip);
+						if (incomingDataLinks.isEmpty())
+							html.append("No value");
+						else {
+							int depth = getDepth(incomingDataLinks.get(0));
+							if (depth == -1)
+								html.append("Invalid");
+							else if (depth == 0)
+								html.append("Single value");
+							else
+								html.append("List of depth ").append(depth);
+						}
+						html.append("</td></tr>");
+					}
+					html.append("</table>");
+				}
+				NamedSet<OutputProcessorPort> outputs = processor
+						.getOutputPorts();
+				if (!outputs.isEmpty()) {
+					html.append("<table border=1><tr><th>Output Port Name</th>")
+							.append("<th>Size of data</th>").append("</tr>");
+					for (OutputProcessorPort op : outputs) {
+						html.append("<tr><td>").append(op.getName())
+								.append("</td><td>");
+						List<DataLink> outgoingDataLinks = scufl2Tools
+								.datalinksFrom(op);
+						if (outgoingDataLinks.isEmpty())
+							html.append("No value");
+						else {
+							int depth = getDepth(outgoingDataLinks.get(0));
+							if (depth == -1)
+								html.append("Invalid/unpredicted");
+							else if (depth == 0)
+								html.append("Single value");
+							else
+								html.append("List of depth ").append(depth);
+						}
+						html.append("</td></tr>");
+					}
+					html.append("</table>");
+				}
+				if (inputs.isEmpty() && outputs.isEmpty())
+					html.append("<p>No port behavior predicted</p>");
+				html.append("</body></html>");
+				JEditorPane editorPane = new JEditorPane("text/html",
+						html.toString());
+				editorPane.setEditable(false);
+				mainPanel.add(editorPane);
+
+				mainPanel.revalidate();
+				mainPanel.repaint();
+				this.revalidate();
+				this.repaint();
+			}
+
+			protected void addStyle(StringBuilder html) {
+				html.append("<style type='text/css'>")
+						.append("table {align:center; border:solid black 1px;")
+						.append("width:100%; height:100%; overflow:auto;}")
+						.append("</style>");
+			}
+
+			@Override
+			public JComponent getMainFrame() {
+				return mainPanel;
+			}
+
+			@Override
+			public String getViewTitle() {
+				return "Predicted behavior";
+			}
+
+			@Override
+			public int getPreferredPosition() {
+				return 300;
+			}
+		}
+
+		return singletonList((ContextualView) new ProcessorPredictedBehaviorContextualView());
+	}
+
+	private int getDepth(DataLink datalink) {
+		// TODO calculate actual depth
+		return -1;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-contextual-views/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory
----------------------------------------------------------------------
diff --git a/taverna-contextual-views/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory b/taverna-contextual-views/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory
deleted file mode 100644
index 3aa7ee0..0000000
--- a/taverna-contextual-views/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory
+++ /dev/null
@@ -1,4 +0,0 @@
-#net.sf.taverna.t2.workbench.ui.views.contextualviews.processor.ProcessorContextualViewFactory
-net.sf.taverna.t2.workbench.ui.views.contextualviews.processor.ProcessorDispatchStackContextualViewFactory
-net.sf.taverna.t2.workbench.ui.views.contextualviews.processor.ProcessorPredictedBehaviorContextualViewFactory
-net.sf.taverna.t2.workbench.ui.views.contextualviews.processor.ProcessorActivitiesContextualViewFactory
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-contextual-views/src/main/resources/META-INF/services/org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory
----------------------------------------------------------------------
diff --git a/taverna-contextual-views/src/main/resources/META-INF/services/org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory b/taverna-contextual-views/src/main/resources/META-INF/services/org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory
new file mode 100644
index 0000000..d312589
--- /dev/null
+++ b/taverna-contextual-views/src/main/resources/META-INF/services/org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory
@@ -0,0 +1,4 @@
+#org.apache.taverna.workbench.ui.views.contextualviews.processor.ProcessorContextualViewFactory
+org.apache.taverna.workbench.ui.views.contextualviews.processor.ProcessorDispatchStackContextualViewFactory
+org.apache.taverna.workbench.ui.views.contextualviews.processor.ProcessorPredictedBehaviorContextualViewFactory
+org.apache.taverna.workbench.ui.views.contextualviews.processor.ProcessorActivitiesContextualViewFactory
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-contextual-views/src/main/resources/META-INF/spring/contextual-views-context-osgi.xml
----------------------------------------------------------------------
diff --git a/taverna-contextual-views/src/main/resources/META-INF/spring/contextual-views-context-osgi.xml b/taverna-contextual-views/src/main/resources/META-INF/spring/contextual-views-context-osgi.xml
index 932b541..601c74a 100644
--- a/taverna-contextual-views/src/main/resources/META-INF/spring/contextual-views-context-osgi.xml
+++ b/taverna-contextual-views/src/main/resources/META-INF/spring/contextual-views-context-osgi.xml
@@ -6,10 +6,10 @@
                       http://www.springframework.org/schema/osgi
                       http://www.springframework.org/schema/osgi/spring-osgi.xsd">
 
-	<service ref="ProcessorPredictedBehaviorContextualViewFactory" interface="net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory" />
-	<service ref="ProcessorActivitiesContextualViewFactory" interface="net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory" />
+	<service ref="ProcessorPredictedBehaviorContextualViewFactory" interface="org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory" />
+	<service ref="ProcessorActivitiesContextualViewFactory" interface="org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory" />
 
-	<reference id="contextualViewFactoryRegistry" interface="net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactoryRegistry" />
-	<reference id="selectionManager" interface="net.sf.taverna.t2.workbench.selection.SelectionManager" />
+	<reference id="contextualViewFactoryRegistry" interface="org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactoryRegistry" />
+	<reference id="selectionManager" interface="org.apache.taverna.workbench.selection.SelectionManager" />
 
 </beans:beans>

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-contextual-views/src/main/resources/META-INF/spring/contextual-views-context.xml
----------------------------------------------------------------------
diff --git a/taverna-contextual-views/src/main/resources/META-INF/spring/contextual-views-context.xml b/taverna-contextual-views/src/main/resources/META-INF/spring/contextual-views-context.xml
index 7f53cb8..e967ac7 100644
--- a/taverna-contextual-views/src/main/resources/META-INF/spring/contextual-views-context.xml
+++ b/taverna-contextual-views/src/main/resources/META-INF/spring/contextual-views-context.xml
@@ -3,8 +3,8 @@
 	xsi:schemaLocation="http://www.springframework.org/schema/beans
                       http://www.springframework.org/schema/beans/spring-beans.xsd">
 
-	<bean id="ProcessorPredictedBehaviorContextualViewFactory" class="net.sf.taverna.t2.workbench.ui.views.contextualviews.processor.ProcessorPredictedBehaviorContextualViewFactory" />
-	<bean id="ProcessorActivitiesContextualViewFactory" class="net.sf.taverna.t2.workbench.ui.views.contextualviews.processor.ProcessorActivitiesContextualViewFactory">
+	<bean id="ProcessorPredictedBehaviorContextualViewFactory" class="org.apache.taverna.workbench.ui.views.contextualviews.processor.ProcessorPredictedBehaviorContextualViewFactory" />
+	<bean id="ProcessorActivitiesContextualViewFactory" class="org.apache.taverna.workbench.ui.views.contextualviews.processor.ProcessorActivitiesContextualViewFactory">
 			<property name="contextualViewFactoryRegistry" ref="contextualViewFactoryRegistry" />
 			<property name="selectionManager" ref="selectionManager" />
 	</bean>

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/CMStrings.java
----------------------------------------------------------------------
diff --git a/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/CMStrings.java b/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/CMStrings.java
deleted file mode 100644
index 3f6664c..0000000
--- a/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/CMStrings.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package net.sf.taverna.t2.workbench.ui.credentialmanager;
-
-interface CMStrings {
-	String ALERT_TITLE = "Credential Manager Alert";
-	String ERROR_TITLE = "Credential Manager Error";
-	String WARN_TITLE = "Credential Manager Warning";
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/ChangeMasterPasswordDialog.java
----------------------------------------------------------------------
diff --git a/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/ChangeMasterPasswordDialog.java b/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/ChangeMasterPasswordDialog.java
deleted file mode 100644
index 9277c0e..0000000
--- a/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/ChangeMasterPasswordDialog.java
+++ /dev/null
@@ -1,234 +0,0 @@
-/*******************************************************************************
- * 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.credentialmanager;
-
-import static java.awt.BorderLayout.CENTER;
-import static java.awt.BorderLayout.NORTH;
-import static java.awt.BorderLayout.SOUTH;
-import static java.awt.Font.PLAIN;
-import static javax.swing.BoxLayout.Y_AXIS;
-import static javax.swing.JOptionPane.WARNING_MESSAGE;
-import static javax.swing.JOptionPane.showMessageDialog;
-import static net.sf.taverna.t2.workbench.ui.credentialmanager.CMStrings.WARN_TITLE;
-
-import java.awt.BorderLayout;
-import java.awt.FlowLayout;
-import java.awt.Font;
-import java.awt.GridLayout;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.WindowAdapter;
-import java.awt.event.WindowEvent;
-
-import javax.swing.BoxLayout;
-import javax.swing.JButton;
-import javax.swing.JFrame;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JPasswordField;
-import javax.swing.border.CompoundBorder;
-import javax.swing.border.EmptyBorder;
-import javax.swing.border.EtchedBorder;
-
-import org.apache.taverna.security.credentialmanager.CredentialManager;
-import net.sf.taverna.t2.workbench.helper.NonBlockedHelpEnabledDialog;
-
-/**
- * Dialog used by users to change their master password for the Credential
- * Manager.
- */
-@SuppressWarnings("serial")
-public class ChangeMasterPasswordDialog extends NonBlockedHelpEnabledDialog {
-	/** Old password entry field */
-	private JPasswordField oldPasswordField;
-	/** New password entry field */
-	private JPasswordField newPasswordField;
-	/** New password confirmation entry field */
-	private JPasswordField newPasswordConfirmField;
-	/** The entered new password */
-	private String password = null;
-	/** Instructions to the users as to what to do in the dialog */
-	private String instructions;
-	private final CredentialManager credentialManager;
-
-	public ChangeMasterPasswordDialog(JFrame parent, String title,
-			boolean modal, String instructions,
-			CredentialManager credentialManager) {
-		super(parent, title, modal, null);
-		this.instructions = instructions;
-		this.credentialManager = credentialManager;
-		initComponents();
-	}
-
-	private void initComponents() {
-		getContentPane().setLayout(new BorderLayout());
-
-		JLabel instructionsLabel = new JLabel(instructions);
-		instructionsLabel.setFont(new Font(null, PLAIN, 11));
-
-		JPanel instructionsPanel = new JPanel();
-		instructionsPanel.setLayout(new BoxLayout(instructionsPanel, Y_AXIS));
-		instructionsPanel.add(instructionsLabel);
-		instructionsPanel.setBorder(new EmptyBorder(10, 5, 10, 0));
-
-		JLabel oldPasswordLabel = new JLabel("Old master password");
-		oldPasswordLabel.setBorder(new EmptyBorder(0, 5, 0, 0));
-
-		JLabel newPasswordLabel = new JLabel("New master password");
-		newPasswordLabel.setBorder(new EmptyBorder(0, 5, 0, 0));
-
-		JLabel newPasswordConfirmLabel = new JLabel(
-				"Confirm new master password");
-		newPasswordConfirmLabel.setBorder(new EmptyBorder(0, 5, 0, 0));
-
-		oldPasswordField = new JPasswordField(15);
-		newPasswordField = new JPasswordField(15);
-		newPasswordConfirmField = new JPasswordField(15);
-
-		JPanel jpPassword = new JPanel(new GridLayout(0, 2, 5, 5));
-		jpPassword.add(oldPasswordLabel);
-		jpPassword.add(oldPasswordField);
-		jpPassword.add(newPasswordLabel);
-		jpPassword.add(newPasswordField);
-		jpPassword.add(newPasswordConfirmLabel);
-		jpPassword.add(newPasswordConfirmField);
-
-		JPanel mainPanel = new JPanel(new BorderLayout());
-		mainPanel.setBorder(new CompoundBorder(new EmptyBorder(10, 10, 10, 10),
-				new EtchedBorder()));
-		mainPanel.add(instructionsPanel, NORTH);
-		mainPanel.add(jpPassword, CENTER);
-
-		JButton okButton = new JButton("OK");
-		okButton.addActionListener(new ActionListener() {
-			@Override
-			public void actionPerformed(ActionEvent evt) {
-				okPressed();
-			}
-		});
-
-		JButton cancelButton = new JButton("Cancel");
-		cancelButton.addActionListener(new ActionListener() {
-			@Override
-			public void actionPerformed(ActionEvent evt) {
-				cancelPressed();
-			}
-		});
-		JPanel buttonsPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
-		buttonsPanel.add(okButton);
-		buttonsPanel.add(cancelButton);
-
-		getContentPane().add(mainPanel, CENTER);
-		getContentPane().add(buttonsPanel, SOUTH);
-
-		addWindowListener(new WindowAdapter() {
-			@Override
-			public void windowClosing(WindowEvent evt) {
-				closeDialog();
-			}
-		});
-
-		setResizable(false);
-		getRootPane().setDefaultButton(okButton);
-		pack();
-	}
-
-	/**
-	 * Get the password set in the dialog or null if none was set.
-	 */
-	public String getPassword() {
-		return password;
-	}
-
-	/**
-	 * Check that the user has provided the correct old master password, that
-	 * the user has supplied the new password and confirmed it and that it is
-	 * not empty. If all is OK, stores the new password in the password field.
-	 * 
-	 */
-	private boolean checkPassword() {
-		String oldPassword = new String(oldPasswordField.getPassword());
-
-		if (oldPassword.length() == 0) {
-			// old password must not be empty
-			showMessageDialog(this,
-					"You must provide your current master password",
-					WARN_TITLE, WARNING_MESSAGE);
-			return false;
-		}
-
-		try {
-			if (!credentialManager.confirmMasterPassword(oldPassword)) {
-				showMessageDialog(this,
-						"You have provided an incorrect master password",
-						WARN_TITLE, WARNING_MESSAGE);
-				return false;
-			}
-		} catch (Exception e) {
-			showMessageDialog(
-					this,
-					"Credential Manager could not verify your current master password",
-					WARN_TITLE, WARNING_MESSAGE);
-			return false;
-		}
-
-		String newPassword = new String(newPasswordField.getPassword());
-		String newPasswordConfirm = new String(
-				newPasswordConfirmField.getPassword());
-
-		if (!newPassword.equals(newPasswordConfirm)) {
-			// passwords do not match
-			showMessageDialog(this, "Passwords do not match", WARN_TITLE,
-					WARNING_MESSAGE);
-			return false;
-		}
-
-		if (newPassword.isEmpty()) {
-			// passwords match but are empty
-			showMessageDialog(this, "The new master password cannot be empty",
-					WARN_TITLE, WARNING_MESSAGE);
-			return false;
-		}
-
-		// passwords match and not empty
-		password = newPassword;
-		return true;
-	}
-
-	private void okPressed() {
-		if (checkPassword())
-			closeDialog();
-	}
-
-	private void cancelPressed() {
-		/*
-		 * Set the password to null as it might have changed in the meantime if
-		 * user entered something then cancelled.
-		 */
-		password = null;
-		closeDialog();
-	}
-
-	private void closeDialog() {
-		setVisible(false);
-		dispose();
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/ConfirmTrustedCertificateDialog.java
----------------------------------------------------------------------
diff --git a/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/ConfirmTrustedCertificateDialog.java b/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/ConfirmTrustedCertificateDialog.java
deleted file mode 100644
index 5dbb697..0000000
--- a/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/ConfirmTrustedCertificateDialog.java
+++ /dev/null
@@ -1,520 +0,0 @@
-/*******************************************************************************
- * 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.credentialmanager;
-
-import static java.awt.BorderLayout.CENTER;
-import static java.awt.BorderLayout.NORTH;
-import static java.awt.BorderLayout.SOUTH;
-import static java.awt.Color.WHITE;
-import static java.awt.Font.BOLD;
-import static java.awt.Font.PLAIN;
-import static java.awt.GridBagConstraints.LINE_START;
-import static javax.security.auth.x500.X500Principal.RFC2253;
-
-import java.awt.BorderLayout;
-import java.awt.Dialog;
-import java.awt.FlowLayout;
-import java.awt.Font;
-import java.awt.Frame;
-import java.awt.GridBagConstraints;
-import java.awt.GridBagLayout;
-import java.awt.Insets;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.WindowAdapter;
-import java.awt.event.WindowEvent;
-import java.math.BigInteger;
-import java.security.cert.CertificateEncodingException;
-import java.security.cert.X509Certificate;
-
-import javax.swing.JButton;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.border.CompoundBorder;
-import javax.swing.border.EmptyBorder;
-import javax.swing.border.EtchedBorder;
-
-import net.sf.taverna.t2.lang.ui.DialogTextArea;
-import org.apache.taverna.security.credentialmanager.CMException;
-import org.apache.taverna.security.credentialmanager.DistinguishedNameParser;
-import org.apache.taverna.security.credentialmanager.ParsedDistinguishedName;
-import net.sf.taverna.t2.workbench.helper.NonBlockedHelpEnabledDialog;
-
-import org.apache.log4j.Logger;
-
-/**
- * Displays the details of a X.509 certificate and asks user if they want to
- * trust it. This is normally invoked by the Taverna's TrustManager when trying 
- * to confirm the trust in the remote server during SSL handshake.
- */
-@SuppressWarnings("serial")
-public class ConfirmTrustedCertificateDialog extends NonBlockedHelpEnabledDialog {
-	private static Logger logger = Logger.getLogger(ConfirmTrustedCertificateDialog.class);
-
-	/** The certificate to display */
-	private X509Certificate cert;
-	/** User's decision as whether to trust this service's certificate or not */
-	private boolean shouldTrust;
-	/**
-	 * Should the decision also be saved in Credential Manager? Actually - it is
-	 * always saved now as it was really hard to implement trusting for one
-	 * connection only - so we can either "trust" or "not" trust but not
-	 * "trust once".
-	 */
-	private boolean shouldSave = false;
-	private final DistinguishedNameParser dnParser;
-
-	public ConfirmTrustedCertificateDialog(Frame parent, String title,
-			boolean modal, X509Certificate crt, DistinguishedNameParser dnParser) {
-		super(parent, title, modal);
-		this.cert = crt;
-		this.dnParser = dnParser;
-		initComponents();
-	}
-
-	public ConfirmTrustedCertificateDialog(Dialog parent, String title,
-			boolean modal, X509Certificate crt, DistinguishedNameParser dnParser)
-			throws CMException {
-		super(parent, title, modal);
-		this.cert = crt;
-		this.dnParser = dnParser;
-		initComponents();
-	}
-
-	private void initComponents(){		
-		// title panel
-		JPanel titlePanel = new JPanel(new BorderLayout());
-		titlePanel.setBackground(WHITE);
-		JLabel titleLabel = new JLabel("View service's certificate");
-		titleLabel.setFont(titleLabel.getFont().deriveFont(BOLD, 13.5f));
-		titleLabel.setBorder(new EmptyBorder(10, 10, 0, 10));
-
-		DialogTextArea titleMessage = new DialogTextArea();
-		titleMessage.setMargin(new Insets(5, 20, 10, 10));
-		titleMessage.setFont(titleMessage.getFont().deriveFont(11f));
-		titleMessage.setEditable(false);
-		titleMessage.setFocusable(false);
-		titlePanel.setBorder( new EmptyBorder(10, 10, 0, 10));
-		titlePanel.add(titleLabel, NORTH);
-		titlePanel.add(titleMessage, CENTER);
-		
-		// Certificate details:
-
-		ParsedDistinguishedName subjectDN = dnParser.parseDN(cert
-				.getSubjectX500Principal().getName(RFC2253));
-		ParsedDistinguishedName issuerDN = dnParser.parseDN(cert
-				.getIssuerX500Principal().getName(RFC2253));
-		JPanel certificatePanel = createCertificateDetailsPanel(subjectDN, issuerDN);
-		titleMessage.setText("The service host " + subjectDN.getCN() + " requires HTTPS connection and has identified itself with the certificate below.\n" +
-				"Do you want to trust this service? (Refusing to trust means you will not be able to invoke services on this host from a workflow.)");
-
-		// OK button
-		JPanel buttonsPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
-
-//		final JButton trustButton = new JButton("Trust once");
-//		trustButton.addActionListener(new ActionListener() {
-//			public void actionPerformed(ActionEvent evt) {
-//				trustPressed();
-//			}
-//		});
-		
-		//final JButton trustAlwaysButton = new JButton("Trust always");
-		final JButton trustAlwaysButton = new JButton("Trust");
-		trustAlwaysButton.addActionListener(new ActionListener() {
-			@Override
-			public void actionPerformed(ActionEvent evt) {
-				trustAlwaysPressed();
-			}
-		});
-		
-		final JButton dontTrustButton = new JButton("Do not trust");
-		dontTrustButton.addActionListener(new ActionListener() {
-			@Override
-			public void actionPerformed(ActionEvent evt) {
-				dontTrustPressed();
-			}
-		});
-
-		//jpButtons.add(trustButton);
-		buttonsPanel.add(trustAlwaysButton);
-		buttonsPanel.add(dontTrustButton);
-
-		getContentPane().add(titlePanel, NORTH);
-		getContentPane().add(certificatePanel, CENTER);
-		getContentPane().add(buttonsPanel, SOUTH);
-
-		setResizable(false);
-
-		addWindowListener(new WindowAdapter() {
-			@Override
-			public void windowClosing(WindowEvent evt) {
-				closeDialog();
-			}
-		});
-
-		getRootPane().setDefaultButton(trustAlwaysButton);
-		pack();
-	}
-
-	private JPanel createCertificateDetailsPanel(ParsedDistinguishedName subjectDN, ParsedDistinguishedName issuerDN) {
-		/*
-		 * Grid Bag Constraints templates for labels (column 1) and values
-		 * (column 2) of certificate details
-		 */
-		GridBagConstraints gbc_labels = new GridBagConstraints();
-		gbc_labels.gridx = 0;
-		gbc_labels.ipadx = 20;
-		gbc_labels.gridwidth = 1;
-		gbc_labels.gridheight = 1;
-		gbc_labels.insets = new Insets(2, 15, 2, 2);
-		gbc_labels.anchor = LINE_START;
-
-		GridBagConstraints gbc_values = new GridBagConstraints();
-		gbc_values.gridx = 1;
-		gbc_values.gridwidth = 1;
-		gbc_values.gridheight = 1;
-		gbc_values.insets = new Insets(2, 5, 2, 2);
-		gbc_values.anchor = LINE_START;
-
-		/*
-		 * Netscape Certificate Type non-critical extension (if any) defines the
-		 * intended uses of the certificate - to make it look like Firefox's
-		 * view certificate dialog
-		 * 
-		 * From openssl's documentation: "The [above] extension is non standard,
-		 * Netscape specific and largely obsolete. Their use in new applications
-		 * is discouraged."
-		 * 
-		 * TODO replace with "basicConstraints, keyUsage and extended key usage
-		 * extensions which are now used instead."
-		 */
-//		byte[] intendedUses = cert.getExtensionValue("2.16.840.1.113730.1.1"); // Netscape Certificate Type OID
-//		JLabel intendedUsesLabel = null;
-//		JTextField intendedUsesTextField = null;
-//		JPanel intendedUsesPanel = null;
-//		GridBagConstraints gbc_intendedUsesLabel = null;
-//		if (intendedUses != null) {
-//			intendedUsesLabel = new JLabel(
-//					"This certificate has been approved for the following uses:");
-//			intendedUsesLabel.setFont(new Font(null, Font.BOLD, 11));
-//			intendedUsesLabel.setBorder(new EmptyBorder(5, 5, 5, 5));
-//
-//			intendedUsesTextField = new JTextField(45);
-//			intendedUsesTextField.setText(CMUtils.getIntendedCertificateUses(intendedUses));
-//			intendedUsesTextField.setEditable(false);
-//			intendedUsesTextField.setFont(new Font(null, Font.PLAIN, 11));
-//
-//			intendedUsesPanel = new JPanel(new BorderLayout());
-//			intendedUsesPanel.add(intendedUsesLabel, BorderLayout.NORTH);
-//			intendedUsesPanel.add(intendedUsesTextField, BorderLayout.CENTER);
-//			JSeparator separator = new JSeparator(JSeparator.HORIZONTAL);
-//			intendedUsesPanel.add(separator, BorderLayout.SOUTH);
-//
-//			gbc_intendedUsesLabel = (GridBagConstraints) gbc_labels.clone();
-//			gbc_intendedUsesLabel.gridy = 0;
-//			gbc_intendedUsesLabel.gridwidth = 2; // takes two columns
-//			gbc_intendedUsesLabel.insets = new Insets(5, 5, 5, 5);// has slightly bigger insets
-//		}
-
-		// Issued To
-		JLabel issuedToLabel = new JLabel("Issued To");
-		issuedToLabel.setFont(new Font(null, BOLD, 11));
-		GridBagConstraints gbc_issuedTo = (GridBagConstraints) gbc_labels
-				.clone();
-		gbc_issuedTo.gridy = 1;
-		gbc_issuedTo.gridwidth = 2; // takes two columns
-		gbc_issuedTo.insets = new Insets(5, 5, 5, 5);// has slightly bigger insets
-		// Subject's Distinguished Name (DN)
-		// Extract the CN, O, OU and EMAILADDRESS fields
-		String subjectCN = subjectDN.getCN();
-		String subjectOrg = subjectDN.getO();
-		String subjectOU = subjectDN.getOU();
-		// String sEMAILADDRESS = CMUtils.getEmilAddress();
-		// Subject's Common Name (CN)
-		JLabel subjectCNLabel = new JLabel("Common Name (CN)");
-		subjectCNLabel.setFont(new Font(null, PLAIN, 11));
-		GridBagConstraints gbc_subjectCNLabel = (GridBagConstraints) gbc_labels.clone();
-		gbc_subjectCNLabel.gridy = 2;
-		JLabel subjectCNValue = new JLabel(subjectCN);
-		subjectCNValue.setFont(new Font(null, PLAIN, 11));
-		GridBagConstraints gbc_subjectCNValue = (GridBagConstraints) gbc_values
-				.clone();
-		gbc_subjectCNValue.gridy = 2;
-		// Subject's Organisation (O)
-		JLabel subjectOrgLabel = new JLabel("Organisation (O)");
-		subjectOrgLabel.setFont(new Font(null, PLAIN, 11));
-		GridBagConstraints gbc_subjectOrgLabel = (GridBagConstraints) gbc_labels.clone();
-		gbc_subjectOrgLabel.gridy = 3;
-		JLabel subjectOrgValue = new JLabel(subjectOrg);
-		subjectOrgValue.setFont(new Font(null, PLAIN, 11));
-		GridBagConstraints gbc_subjectOrgValue = (GridBagConstraints) gbc_values
-				.clone();
-		gbc_subjectOrgValue.gridy = 3;
-		// Subject's Organisation Unit (OU)
-		JLabel subjectOULabel = new JLabel("Organisation Unit (OU)");
-		subjectOULabel.setFont(new Font(null, PLAIN, 11));
-		GridBagConstraints gbc_subjectOULabel = (GridBagConstraints) gbc_labels.clone();
-		gbc_subjectOULabel.gridy = 4;
-		JLabel subjectOUValue = new JLabel(subjectOU);
-		subjectOUValue.setFont(new Font(null, PLAIN, 11));
-		GridBagConstraints gbc_subjectOUValue = (GridBagConstraints) gbc_values
-				.clone();
-		gbc_subjectOUValue.gridy = 4;
-		// E-mail Address
-		// JLabel jlEmail = new JLabel("E-mail Address");
-		// jlEmail.setFont(new Font(null, Font.PLAIN, 11));
-		// GridBagConstraints gbc_jlEmail = (GridBagConstraints)
-		// gbcLabel.clone();
-		// gbc_jlEmail.gridy = 5;
-		// JLabel jlEmailValue = new JLabel(sEMAILADDRESS);
-		// jlEmailValue.setFont(new Font(null, Font.PLAIN, 11));
-		// GridBagConstraints gbc_jlEmailValue = (GridBagConstraints)
-		// gbcValue.clone();
-		// gbc_jlEmailValue.gridy = 5;
-		// Serial Number
-		JLabel snLabel = new JLabel("Serial Number");
-		snLabel.setFont(new Font(null, PLAIN, 11));
-		GridBagConstraints gbc_snLabel = (GridBagConstraints) gbc_labels.clone();
-		gbc_snLabel.gridy = 6;
-		JLabel snValue = new JLabel();
-		// Get the hexadecimal serial number
-		StringBuilder strBuff = new StringBuilder(new BigInteger(1, cert
-				.getSerialNumber().toByteArray()).toString(16).toUpperCase());
-		// Place colons at every two hexadecimal characters
-		if (strBuff.length() > 2)
-			for (int iCnt = 2; iCnt < strBuff.length(); iCnt += 3)
-				strBuff.insert(iCnt, ':');
-		snValue.setText(strBuff.toString());
-		snValue.setFont(new Font(null, PLAIN, 11));
-		GridBagConstraints gbc_snValue = (GridBagConstraints) gbc_values
-				.clone();
-		gbc_snValue.gridy = 6;
-		// Certificate version number
-		JLabel versionLabel = new JLabel("Version");
-		versionLabel.setFont(new Font(null, PLAIN, 11));
-		GridBagConstraints gbc_versionLabel = (GridBagConstraints) gbc_labels
-				.clone();
-		gbc_versionLabel.gridy = 7;
-		JLabel versionValue = new JLabel(Integer.toString(cert.getVersion()));
-		versionValue.setFont(new Font(null, PLAIN, 11));
-		GridBagConstraints gbc_versionValue = (GridBagConstraints) gbc_values
-				.clone();
-		gbc_versionValue.gridy = 7;
-
-		// Issued By
-		JLabel issuedByLabel = new JLabel("Issued By");
-		issuedByLabel.setFont(new Font(null, BOLD, 11));
-		GridBagConstraints gbc_issuedByLabel = (GridBagConstraints) gbc_labels
-				.clone();
-		gbc_issuedByLabel.gridy = 8;
-		gbc_issuedByLabel.gridwidth = 2; // takes two columns
-		gbc_issuedByLabel.insets = new Insets(5, 5, 5, 5);// has slightly bigger insets
-		// Issuer's Distinguished Name (DN)
-		// Extract the CN, O and OU fields for the issuer
-		String issuerCN = issuerDN.getCN();
-		String issuerOrg = issuerDN.getO();
-		String issuerOU = issuerDN.getOU();
-		// Issuer's Common Name (CN)
-		JLabel issuerCNLabel = new JLabel("Common Name (CN)");
-		issuerCNLabel.setFont(new Font(null, PLAIN, 11));
-		GridBagConstraints gbc_issuerCNLabel = (GridBagConstraints) gbc_labels.clone();
-		gbc_issuerCNLabel.gridy = 9;
-		JLabel issuerCNValue = new JLabel(issuerCN);
-		issuerCNValue.setFont(new Font(null, PLAIN, 11));
-		GridBagConstraints gbc_issuerCNValue = (GridBagConstraints) gbc_values
-				.clone();
-		gbc_issuerCNValue.gridy = 9;
-		// Issuer's Organisation (O)
-		JLabel issuerOrgLabel = new JLabel("Organisation (O)");
-		issuerOrgLabel.setFont(new Font(null, PLAIN, 11));
-		GridBagConstraints gbc_issuerOrgLabel = (GridBagConstraints) gbc_labels.clone();
-		gbc_issuerOrgLabel.gridy = 10;
-		JLabel issuerOrgValue = new JLabel(issuerOrg);
-		issuerOrgValue.setFont(new Font(null, PLAIN, 11));
-		GridBagConstraints gbc_issuerOrgValue = (GridBagConstraints) gbc_values
-				.clone();
-		gbc_issuerOrgValue.gridy = 10;
-		// Issuer's Organisation Unit (OU)
-		JLabel issuerOULabel = new JLabel("Organisation Unit (OU)");
-		issuerOULabel.setFont(new Font(null, PLAIN, 11));
-		GridBagConstraints gbc_issuerOULabel = (GridBagConstraints) gbc_labels.clone();
-		gbc_issuerOULabel.gridy = 11;
-		JLabel issuerOUValue = new JLabel(issuerOU);
-		issuerOUValue.setFont(new Font(null, PLAIN, 11));
-		GridBagConstraints gbc_issuerOUValue = (GridBagConstraints) gbc_values
-				.clone();
-		gbc_issuerOUValue.gridy = 11;
-		
-		// Validity
-		JLabel validityLabel = new JLabel("Validity");
-		validityLabel.setFont(new Font(null, BOLD, 11));
-		GridBagConstraints gbc_validityLabel = (GridBagConstraints) gbc_labels
-				.clone();
-		gbc_validityLabel.gridy = 12;
-		gbc_validityLabel.gridwidth = 2; // takes two columns
-		gbc_validityLabel.insets = new Insets(5, 5, 5, 5);// has slightly bigger insets
-		// Issued On
-		JLabel issuedOnLabel = new JLabel("Issued On");
-		issuedOnLabel.setFont(new Font(null, PLAIN, 11));
-		GridBagConstraints gbc_issuedOnLabel = (GridBagConstraints) gbc_labels
-				.clone();
-		gbc_issuedOnLabel.gridy = 13;
-		JLabel issuedOnValue = new JLabel(cert.getNotBefore().toString());
-		issuedOnValue.setFont(new Font(null, PLAIN, 11));
-		GridBagConstraints gbc_issuedOnValue = (GridBagConstraints) gbc_values
-				.clone();
-		gbc_issuedOnValue.gridy = 13;
-		// Expires On
-		JLabel expiresOnLabel = new JLabel("Expires On");
-		expiresOnLabel.setFont(new Font(null, PLAIN, 11));
-		GridBagConstraints gbc_expiresOnLabel = (GridBagConstraints) gbc_labels
-				.clone();
-		gbc_expiresOnLabel.gridy = 14;
-		JLabel expiresOnValue = new JLabel(cert.getNotAfter().toString());
-		expiresOnValue.setFont(new Font(null, PLAIN, 11));
-		GridBagConstraints gbc_expiresOnValue = (GridBagConstraints) gbc_values
-				.clone();
-		gbc_expiresOnValue.gridy = 14;
-
-		// Fingerprints
-		byte[] binaryCertificateEncoding = new byte[0];
-		try {
-			// each certificate has one binary encoding; for X.509 certs it is DER
-			binaryCertificateEncoding = cert.getEncoded();
-		} catch (CertificateEncodingException ex) {
-			logger.error("Could not get the encoded form of the certificate.", ex);
-		}
-		JLabel fingerprintsLabel = new JLabel("Fingerprints");
-		fingerprintsLabel.setFont(new Font(null, BOLD, 11));
-		GridBagConstraints gbc_fingerprintsLabel = (GridBagConstraints) gbc_labels
-				.clone();
-		gbc_fingerprintsLabel.gridy = 15;
-		gbc_fingerprintsLabel.gridwidth = 2; // takes two columns
-		gbc_fingerprintsLabel.insets = new Insets(5, 5, 5, 5);// has slightly bigger insets
-		// SHA-1 Fingerprint
-		JLabel sha1FingerprintLabel = new JLabel("SHA1 Fingerprint");
-		sha1FingerprintLabel.setFont(new Font(null, PLAIN, 11));
-		GridBagConstraints gbc_sha1FingerprintLabel = (GridBagConstraints) gbc_labels
-				.clone();
-		gbc_sha1FingerprintLabel.gridy = 16;
-		JLabel sha1FingerprintValue = new JLabel(
-				dnParser.getMessageDigestAsFormattedString(
-						binaryCertificateEncoding, "SHA1"));
-		sha1FingerprintValue.setFont(new Font(null, PLAIN, 11));
-		GridBagConstraints gbc_sha1FingerprintValue = (GridBagConstraints) gbc_values
-				.clone();
-		gbc_sha1FingerprintValue.gridy = 16;
-		// MD5 Fingerprint
-		JLabel md5FingerprintLabel = new JLabel("MD5 Fingerprint");
-		md5FingerprintLabel.setFont(new Font(null, PLAIN, 11));
-		GridBagConstraints gbc_md5FingerprinLabel = (GridBagConstraints) gbc_labels
-				.clone();
-		gbc_md5FingerprinLabel.gridy = 17;
-		JLabel md5FingerprintValue = new JLabel(
-				dnParser.getMessageDigestAsFormattedString(
-						binaryCertificateEncoding, "MD5"));
-		md5FingerprintValue.setFont(new Font(null, PLAIN, 11));
-		GridBagConstraints gbc_md5FingerprintValue = (GridBagConstraints) gbc_values
-				.clone();
-		gbc_md5FingerprintValue.gridy = 17;
-
-		/*
-		 * Empty label to add a bit space at the bottom of the panel to make it
-		 * look like Firefox's view certificate dialog
-		 */
-		JLabel emptyLabel = new JLabel("");
-		GridBagConstraints gbc_emptyLabel = (GridBagConstraints) gbc_labels.clone();
-		gbc_emptyLabel.gridy = 18;
-		gbc_emptyLabel.gridwidth = 2; // takes two columns
-		gbc_emptyLabel.ipady = 40;
-
-		JPanel certificatePanel = new JPanel(new GridBagLayout());
-		certificatePanel.setBorder(new CompoundBorder(new EmptyBorder(15, 15, 15,
-				15), new EtchedBorder()));
-
-//		if (intendedUses != null)
-//			certificatePanel.add(intendedUsesPanel, gbc_intendedUsesLabel);
-		certificatePanel.add(issuedToLabel, gbc_issuedTo); // Issued To
-		certificatePanel.add(subjectCNLabel, gbc_subjectCNLabel);
-		certificatePanel.add(subjectCNValue, gbc_subjectCNValue);
-		certificatePanel.add(subjectOrgLabel, gbc_subjectOrgLabel);
-		certificatePanel.add(subjectOrgValue, gbc_subjectOrgValue);
-		certificatePanel.add(subjectOULabel, gbc_subjectOULabel);
-		certificatePanel.add(subjectOUValue, gbc_subjectOUValue);
-		// jpCertificate.add(jlEmail, gbc_jlEmail);
-		// jpCertificate.add(jlEmailValue, gbc_jlEmailValue);
-		certificatePanel.add(snLabel, gbc_snLabel);
-		certificatePanel.add(snValue, gbc_snValue);
-		certificatePanel.add(versionLabel, gbc_versionLabel);
-		certificatePanel.add(versionValue, gbc_versionValue);
-		certificatePanel.add(issuedByLabel, gbc_issuedByLabel); // Issued By
-		certificatePanel.add(issuerCNLabel, gbc_issuerCNLabel);
-		certificatePanel.add(issuerCNValue, gbc_issuerCNValue);
-		certificatePanel.add(issuerOrgLabel, gbc_issuerOrgLabel);
-		certificatePanel.add(issuerOrgValue, gbc_issuerOrgValue);
-		certificatePanel.add(issuerOULabel, gbc_issuerOULabel);
-		certificatePanel.add(issuerOUValue, gbc_issuerOUValue);
-		certificatePanel.add(validityLabel, gbc_validityLabel); // Validity
-		certificatePanel.add(issuedOnLabel, gbc_issuedOnLabel);
-		certificatePanel.add(issuedOnValue, gbc_issuedOnValue);
-		certificatePanel.add(expiresOnLabel, gbc_expiresOnLabel);
-		certificatePanel.add(expiresOnValue, gbc_expiresOnValue);
-		certificatePanel.add(fingerprintsLabel, gbc_fingerprintsLabel); // Fingerprints
-		certificatePanel.add(sha1FingerprintLabel, gbc_sha1FingerprintLabel);
-		certificatePanel.add(sha1FingerprintValue, gbc_sha1FingerprintValue);
-		certificatePanel.add(md5FingerprintLabel, gbc_md5FingerprinLabel);
-		certificatePanel.add(md5FingerprintValue, gbc_md5FingerprintValue);
-		// Empty label to get some vertical space on the frame
-		certificatePanel.add(emptyLabel, gbc_emptyLabel);
-		return certificatePanel;
-	}
-
-//	private void trustPressed() {
-//		shouldTrust = true;
-//		shouldSave = false;
-//		closeDialog();
-//	}
-
-	private void trustAlwaysPressed() {
-		shouldTrust = true;
-		shouldSave = true;
-		closeDialog();
-	}
-
-	private void dontTrustPressed() {
-		shouldTrust = false;
-		shouldSave = false;
-		closeDialog();
-	}
-
-	public void closeDialog() {
-		setVisible(false);
-		dispose();
-	}
-
-	public boolean shouldTrust() {
-		return shouldTrust;
-	}
-
-	public boolean shouldSave() {
-		return shouldSave;
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/ConfirmTrustedCertificateUI.java
----------------------------------------------------------------------
diff --git a/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/ConfirmTrustedCertificateUI.java b/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/ConfirmTrustedCertificateUI.java
deleted file mode 100644
index c7eaef5..0000000
--- a/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/ConfirmTrustedCertificateUI.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*******************************************************************************
- * 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.credentialmanager;
-
-import static javax.swing.JOptionPane.INFORMATION_MESSAGE;
-import static javax.swing.JOptionPane.showMessageDialog;
-
-import java.awt.Frame;
-import java.security.cert.X509Certificate;
-
-import org.apache.taverna.security.credentialmanager.DistinguishedNameParser;
-import org.apache.taverna.security.credentialmanager.TrustConfirmationProvider;
-
-import org.apache.log4j.Logger;
-
-/**
- * @author Stian Soiland-Reyes
- */
-public class ConfirmTrustedCertificateUI implements TrustConfirmationProvider {
-	private static Logger logger = Logger
-			.getLogger(ConfirmTrustedCertificateUI.class);
-
-	private DistinguishedNameParser dnParser;
-
-	@Override
-	public Boolean shouldTrustCertificate(X509Certificate[] chain) {
-		boolean trustConfirm = false;
-		logger.info("Asking the user if they want to trust a certificate.");
-		// Ask user if they want to trust this service
-		ConfirmTrustedCertificateDialog confirmCertTrustDialog = new ConfirmTrustedCertificateDialog(
-				(Frame) null, "Untrusted HTTPS connection", true,
-				(X509Certificate) chain[0], dnParser);
-		confirmCertTrustDialog.setLocationRelativeTo(null);
-		confirmCertTrustDialog.setVisible(true);
-		trustConfirm = confirmCertTrustDialog.shouldTrust();
-//		trustConfirm.setShouldSave(confirmCertTrustDialog.shouldSave());
-		if (!confirmCertTrustDialog.shouldTrust())
-			showMessageDialog(
-					null,
-					"As you refused to trust this host, you will not be able to use its services from a workflow.",
-					"Untrusted HTTPS connection", INFORMATION_MESSAGE);
-
-		return trustConfirm;
-	}
-
-	/**
-	 * @param dnParser
-	 *            the dnParser to set
-	 */
-	public void setDistinguishedNameParser(DistinguishedNameParser dnParser) {
-		this.dnParser = dnParser;
-	}
-}


[28/51] [partial] incubator-taverna-workbench git commit: all packages are moved to org.apache.taverna.*

Posted by re...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-dataflow-activity-ui/src/main/java/org/apache/taverna/activities/dataflow/views/DataflowActivityViewFactory.java
----------------------------------------------------------------------
diff --git a/taverna-dataflow-activity-ui/src/main/java/org/apache/taverna/activities/dataflow/views/DataflowActivityViewFactory.java b/taverna-dataflow-activity-ui/src/main/java/org/apache/taverna/activities/dataflow/views/DataflowActivityViewFactory.java
new file mode 100644
index 0000000..e4a6ba0
--- /dev/null
+++ b/taverna-dataflow-activity-ui/src/main/java/org/apache/taverna/activities/dataflow/views/DataflowActivityViewFactory.java
@@ -0,0 +1,93 @@
+/*******************************************************************************
+ * 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 org.apache.taverna.activities.dataflow.views;
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.apache.taverna.activities.dataflow.servicedescriptions.DataflowTemplateService;
+import org.apache.taverna.servicedescriptions.ServiceDescriptionRegistry;
+import org.apache.taverna.ui.menu.MenuManager;
+import org.apache.taverna.workbench.activityicons.ActivityIconManager;
+import org.apache.taverna.workbench.configuration.colour.ColourManager;
+import org.apache.taverna.workbench.configuration.workbench.WorkbenchConfiguration;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.file.FileManager;
+import org.apache.taverna.workbench.selection.SelectionManager;
+import org.apache.taverna.workbench.ui.views.contextualviews.ContextualView;
+import org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory;
+import org.apache.taverna.scufl2.api.activity.Activity;
+
+public class DataflowActivityViewFactory implements ContextualViewFactory<Activity> {
+
+	private EditManager editManager;
+	private FileManager fileManager;
+	private MenuManager menuManager;
+	private ColourManager colourManager;
+	private ActivityIconManager activityIconManager;
+	private WorkbenchConfiguration workbenchConfiguration;
+	private ServiceDescriptionRegistry serviceDescriptionRegistry;
+	private SelectionManager selectionManager;
+
+	public boolean canHandle(Object object) {
+		return object instanceof Activity
+				&& ((Activity) object).getType().equals(DataflowTemplateService.ACTIVITY_TYPE);
+	}
+
+	public List<ContextualView> getViews(Activity activity) {
+		return Arrays.asList(new ContextualView[] { new DataflowActivityContextualView(activity,
+				editManager, fileManager, menuManager, activityIconManager, colourManager,
+				serviceDescriptionRegistry, workbenchConfiguration, selectionManager) });
+	}
+
+	public void setEditManager(EditManager editManager) {
+		this.editManager = editManager;
+	}
+
+	public void setFileManager(FileManager fileManager) {
+		this.fileManager = fileManager;
+	}
+
+	public void setMenuManager(MenuManager menuManager) {
+		this.menuManager = menuManager;
+	}
+
+	public void setActivityIconManager(ActivityIconManager activityIconManager) {
+		this.activityIconManager = activityIconManager;
+	}
+
+	public void setColourManager(ColourManager colourManager) {
+		this.colourManager = colourManager;
+	}
+
+	public void setServiceDescriptionRegistry(ServiceDescriptionRegistry serviceDescriptionRegistry) {
+		this.serviceDescriptionRegistry = serviceDescriptionRegistry;
+	}
+
+	public void setWorkbenchConfiguration(WorkbenchConfiguration workbenchConfiguration) {
+		this.workbenchConfiguration = workbenchConfiguration;
+	}
+
+	public void setSelectionManager(SelectionManager selectionManager) {
+		this.selectionManager = selectionManager;
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-dataflow-activity-ui/src/main/java/org/apache/taverna/workbench/file/importworkflow/DataflowMerger.java
----------------------------------------------------------------------
diff --git a/taverna-dataflow-activity-ui/src/main/java/org/apache/taverna/workbench/file/importworkflow/DataflowMerger.java b/taverna-dataflow-activity-ui/src/main/java/org/apache/taverna/workbench/file/importworkflow/DataflowMerger.java
new file mode 100644
index 0000000..b1a839a
--- /dev/null
+++ b/taverna-dataflow-activity-ui/src/main/java/org/apache/taverna/workbench/file/importworkflow/DataflowMerger.java
@@ -0,0 +1,124 @@
+package org.apache.taverna.workbench.file.importworkflow;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.taverna.workbench.edits.CompoundEdit;
+import org.apache.taverna.workbench.edits.Edit;
+import org.apache.taverna.workflow.edits.AddChildEdit;
+import org.apache.taverna.workflow.edits.AddDataLinkEdit;
+import org.apache.taverna.workflow.edits.AddProcessorEdit;
+import org.apache.taverna.workflow.edits.AddWorkflowInputPortEdit;
+import org.apache.taverna.workflow.edits.AddWorkflowOutputPortEdit;
+import org.apache.taverna.scufl2.api.common.AbstractCloneable;
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+import org.apache.taverna.scufl2.api.core.ControlLink;
+import org.apache.taverna.scufl2.api.core.DataLink;
+import org.apache.taverna.scufl2.api.core.Processor;
+import org.apache.taverna.scufl2.api.core.Workflow;
+import org.apache.taverna.scufl2.api.port.InputWorkflowPort;
+import org.apache.taverna.scufl2.api.port.OutputWorkflowPort;
+
+/**
+ * A tool that allows merging of two workflow.
+ * <p>
+ * The merge is performed as a series of edit, inserting a copy of the source
+ * workflow into the destination workflow.
+ *
+ * @author Stian Soiland-Reyes
+ * @author David Withers
+ */
+public class DataflowMerger {
+
+	/**
+	 * Make a copy of a workflow.
+	 *
+	 * @param source
+	 *            workflow to copy
+	 * @return A copy of the workflow.
+	 */
+	public static Workflow copyWorkflow(Workflow source) {
+		WorkflowBundle workflowBundle = AbstractCloneable.cloneWorkflowBean(source.getParent());
+		return workflowBundle.getWorkflows().getByName(source.getName());
+	}
+
+	private final Workflow destinationWorkflow;
+
+	/**
+	 * Construct a {@link DataflowMerger} for the given destination workflow.
+	 *
+	 * @param destinationWorkflow
+	 *            Workflow to be merged into
+	 */
+	public DataflowMerger(Workflow destinationWorkflow) {
+		this.destinationWorkflow = destinationWorkflow;
+	}
+
+	/**
+	 * Make an {@link Edit} that when performed merges the given source dataflow
+	 * into the destination dataflow.
+	 * <p>
+	 * Internally a copy is made of the source dataflow, to avoid modifying the
+	 * links and processors.
+	 *
+	 * @param sourceDataflow
+	 *            Dataflow to merge from
+	 * @return An edit that can perform and undo the insertion of the components
+	 *         from the source dataflow.
+	 * @throws MergeException
+	 *             If the merge cannot be performed.
+	 */
+	public CompoundEdit getMergeEdit(Workflow sourceDataflow)
+			throws MergeException {
+		return getMergeEdit(sourceDataflow, "");
+	}
+
+	/**
+	 * Make an {@link Edit} that when performed merges the given source dataflow
+	 * into the destination dataflow.
+	 * <p>
+	 * Internally a copy is made of the source dataflow, to avoid modifying the
+	 * links and processors.
+	 *
+	 * @param sourceWorkflow
+	 *            Dataflow to merge from
+	 * @param prefix
+	 *            A prefix which will be inserted in front of the names for the
+	 *            merged workflow components.
+	 * @return An edit that can perform and undo the insertion of the components
+	 *         from the source dataflow.
+	 * @throws MergeException
+	 *             If the merge cannot be performed.
+	 */
+	public CompoundEdit getMergeEdit(Workflow sourceWorkflow, String prefix)
+			throws MergeException {
+		List<Edit<?>> compoundEdit = new ArrayList<>();
+
+		Workflow workflow = copyWorkflow(sourceWorkflow);
+
+		for (InputWorkflowPort input : workflow.getInputPorts()) {
+			destinationWorkflow.getInputPorts().addWithUniqueName(input);
+			destinationWorkflow.getInputPorts().remove(input);
+			compoundEdit.add(new AddWorkflowInputPortEdit(destinationWorkflow, input));
+		}
+		for (OutputWorkflowPort output : workflow.getOutputPorts()) {
+			destinationWorkflow.getOutputPorts().addWithUniqueName(output);
+			destinationWorkflow.getOutputPorts().remove(output);
+			compoundEdit.add(new AddWorkflowOutputPortEdit(destinationWorkflow, output));
+		}
+		for (Processor processor : workflow.getProcessors()) {
+			processor.setName(prefix + processor.getName());
+			compoundEdit.add(new AddProcessorEdit(destinationWorkflow, processor));
+		}
+		for (DataLink dataLink : workflow.getDataLinks()) {
+			compoundEdit.add(new AddDataLinkEdit(destinationWorkflow, dataLink));
+		}
+		for (ControlLink controlLink : workflow.getControlLinks()) {
+			compoundEdit.add(new AddChildEdit<Workflow>(destinationWorkflow, controlLink));
+		}
+
+		return new CompoundEdit(compoundEdit);
+
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-dataflow-activity-ui/src/main/java/org/apache/taverna/workbench/file/importworkflow/MergeException.java
----------------------------------------------------------------------
diff --git a/taverna-dataflow-activity-ui/src/main/java/org/apache/taverna/workbench/file/importworkflow/MergeException.java b/taverna-dataflow-activity-ui/src/main/java/org/apache/taverna/workbench/file/importworkflow/MergeException.java
new file mode 100644
index 0000000..889ebde
--- /dev/null
+++ b/taverna-dataflow-activity-ui/src/main/java/org/apache/taverna/workbench/file/importworkflow/MergeException.java
@@ -0,0 +1,22 @@
+package org.apache.taverna.workbench.file.importworkflow;
+
+public class MergeException extends Exception {
+	private static final long serialVersionUID = 6018700359518335402L;
+
+	public MergeException() {
+		super();
+	}
+
+	public MergeException(String message, Throwable cause) {
+		super(message, cause);
+	}
+
+	public MergeException(String message) {
+		super(message);
+	}
+
+	public MergeException(Throwable cause) {
+		super(cause);
+	}
+	
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-dataflow-activity-ui/src/main/java/org/apache/taverna/workbench/file/importworkflow/actions/AddNestedWorkflowAction.java
----------------------------------------------------------------------
diff --git a/taverna-dataflow-activity-ui/src/main/java/org/apache/taverna/workbench/file/importworkflow/actions/AddNestedWorkflowAction.java b/taverna-dataflow-activity-ui/src/main/java/org/apache/taverna/workbench/file/importworkflow/actions/AddNestedWorkflowAction.java
new file mode 100644
index 0000000..1286c71
--- /dev/null
+++ b/taverna-dataflow-activity-ui/src/main/java/org/apache/taverna/workbench/file/importworkflow/actions/AddNestedWorkflowAction.java
@@ -0,0 +1,59 @@
+package org.apache.taverna.workbench.file.importworkflow.actions;
+
+import java.awt.Component;
+import java.awt.event.ActionEvent;
+
+import javax.swing.AbstractAction;
+
+import org.apache.taverna.activities.dataflow.servicedescriptions.DataflowActivityIcon;
+import org.apache.taverna.ui.menu.MenuManager;
+import org.apache.taverna.workbench.configuration.colour.ColourManager;
+import org.apache.taverna.workbench.configuration.workbench.WorkbenchConfiguration;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.file.FileManager;
+import org.apache.taverna.workbench.file.importworkflow.gui.ImportWorkflowWizard;
+import org.apache.taverna.workbench.selection.SelectionManager;
+import org.apache.taverna.workbench.ui.Utils;
+
+/**
+ * An action for adding a nested workflow.
+ *
+ * @author Stian Soiland-Reyes
+ *
+ */
+public class AddNestedWorkflowAction extends AbstractAction {
+	private static final long serialVersionUID = -2242979457902699028L;
+	private final EditManager editManager;
+	private final FileManager fileManager;
+	private final MenuManager menuManager;
+	private final ColourManager colourManager;
+	private final WorkbenchConfiguration workbenchConfiguration;
+	private final SelectionManager selectionManager;
+
+	public AddNestedWorkflowAction(EditManager editManager, FileManager fileManager,
+			MenuManager menuManager, ColourManager colourManager,
+			WorkbenchConfiguration workbenchConfiguration, SelectionManager selectionManager) {
+		super("Add nested workflow", DataflowActivityIcon.getDataflowIcon());
+		this.editManager = editManager;
+		this.fileManager = fileManager;
+		this.menuManager = menuManager;
+		this.colourManager = colourManager;
+		this.workbenchConfiguration = workbenchConfiguration;
+		this.selectionManager = selectionManager;
+	}
+
+	public void actionPerformed(ActionEvent e) {
+		final Component parentComponent;
+		if (e.getSource() instanceof Component) {
+			parentComponent = (Component) e.getSource();
+		} else {
+			parentComponent = null;
+		}
+		ImportWorkflowWizard wizard = new ImportWorkflowWizard(
+				Utils.getParentFrame(parentComponent), editManager, fileManager, menuManager,
+				colourManager, workbenchConfiguration, selectionManager);
+		wizard.setMergeEnabled(false);
+		wizard.setVisible(true);
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-dataflow-activity-ui/src/main/java/org/apache/taverna/workbench/file/importworkflow/actions/ImportWorkflowAction.java
----------------------------------------------------------------------
diff --git a/taverna-dataflow-activity-ui/src/main/java/org/apache/taverna/workbench/file/importworkflow/actions/ImportWorkflowAction.java b/taverna-dataflow-activity-ui/src/main/java/org/apache/taverna/workbench/file/importworkflow/actions/ImportWorkflowAction.java
new file mode 100644
index 0000000..81774b3
--- /dev/null
+++ b/taverna-dataflow-activity-ui/src/main/java/org/apache/taverna/workbench/file/importworkflow/actions/ImportWorkflowAction.java
@@ -0,0 +1,59 @@
+package org.apache.taverna.workbench.file.importworkflow.actions;
+
+import java.awt.Component;
+import java.awt.event.ActionEvent;
+
+import javax.swing.AbstractAction;
+
+import org.apache.taverna.activities.dataflow.servicedescriptions.DataflowActivityIcon;
+import org.apache.taverna.ui.menu.MenuManager;
+import org.apache.taverna.workbench.configuration.colour.ColourManager;
+import org.apache.taverna.workbench.configuration.workbench.WorkbenchConfiguration;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.file.FileManager;
+import org.apache.taverna.workbench.file.importworkflow.gui.ImportWorkflowWizard;
+import org.apache.taverna.workbench.selection.SelectionManager;
+import org.apache.taverna.workbench.ui.Utils;
+
+/**
+ * A general version of {@link AddNestedWorkflowAction} and {@link MergeWorkflowAction} that allows
+ * the user to choose which action to perform.
+ *
+ * @author Stian Soiland-Reyes
+ *
+ */
+public class ImportWorkflowAction extends AbstractAction {
+	private static final long serialVersionUID = -2242979457902699028L;
+	private final EditManager editManager;
+	private final FileManager fileManager;
+	private final MenuManager menuManager;
+	private final ColourManager colourManager;
+	private final WorkbenchConfiguration workbenchConfiguration;
+	private final SelectionManager selectionManager;
+
+	public ImportWorkflowAction(EditManager editManager, FileManager fileManager,
+			MenuManager menuManager, ColourManager colourManager,
+			WorkbenchConfiguration workbenchConfiguration, SelectionManager selectionManager) {
+		super("Import workflow", DataflowActivityIcon.getDataflowIcon());
+		this.editManager = editManager;
+		this.fileManager = fileManager;
+		this.menuManager = menuManager;
+		this.colourManager = colourManager;
+		this.workbenchConfiguration = workbenchConfiguration;
+		this.selectionManager = selectionManager;
+	}
+
+	public void actionPerformed(ActionEvent e) {
+		final Component parentComponent;
+		if (e.getSource() instanceof Component) {
+			parentComponent = (Component) e.getSource();
+		} else {
+			parentComponent = null;
+		}
+		ImportWorkflowWizard wizard = new ImportWorkflowWizard(
+				Utils.getParentFrame(parentComponent), editManager, fileManager, menuManager,
+				colourManager, workbenchConfiguration, selectionManager);
+		wizard.setVisible(true);
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-dataflow-activity-ui/src/main/java/org/apache/taverna/workbench/file/importworkflow/actions/MergeWorkflowAction.java
----------------------------------------------------------------------
diff --git a/taverna-dataflow-activity-ui/src/main/java/org/apache/taverna/workbench/file/importworkflow/actions/MergeWorkflowAction.java b/taverna-dataflow-activity-ui/src/main/java/org/apache/taverna/workbench/file/importworkflow/actions/MergeWorkflowAction.java
new file mode 100644
index 0000000..136490b
--- /dev/null
+++ b/taverna-dataflow-activity-ui/src/main/java/org/apache/taverna/workbench/file/importworkflow/actions/MergeWorkflowAction.java
@@ -0,0 +1,58 @@
+package org.apache.taverna.workbench.file.importworkflow.actions;
+
+import java.awt.Component;
+import java.awt.event.ActionEvent;
+
+import javax.swing.AbstractAction;
+
+import org.apache.taverna.ui.menu.MenuManager;
+import org.apache.taverna.workbench.configuration.colour.ColourManager;
+import org.apache.taverna.workbench.configuration.workbench.WorkbenchConfiguration;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.file.FileManager;
+import org.apache.taverna.workbench.file.importworkflow.gui.ImportWorkflowWizard;
+import org.apache.taverna.workbench.selection.SelectionManager;
+import org.apache.taverna.workbench.ui.Utils;
+
+/**
+ * An action for merging two workflows
+ *
+ * @author Stian Soiland-Reyes
+ *
+ */
+public class MergeWorkflowAction extends AbstractAction {
+	private static final long serialVersionUID = -2242979457902699028L;
+	private final EditManager editManager;
+	private final FileManager fileManager;
+	private final MenuManager menuManager;
+	private final ColourManager colourManager;
+	private final WorkbenchConfiguration workbenchConfiguration;
+	private final SelectionManager selectionManager;
+
+	public MergeWorkflowAction(EditManager editManager, FileManager fileManager,
+			MenuManager menuManager, ColourManager colourManager,
+			WorkbenchConfiguration workbenchConfiguration, SelectionManager selectionManager) {
+		super("Merge workflow");
+		this.editManager = editManager;
+		this.fileManager = fileManager;
+		this.menuManager = menuManager;
+		this.colourManager = colourManager;
+		this.workbenchConfiguration = workbenchConfiguration;
+		this.selectionManager = selectionManager;
+	}
+
+	public void actionPerformed(ActionEvent e) {
+		final Component parentComponent;
+		if (e.getSource() instanceof Component) {
+			parentComponent = (Component) e.getSource();
+		} else {
+			parentComponent = null;
+		}
+		ImportWorkflowWizard wizard = new ImportWorkflowWizard(
+				Utils.getParentFrame(parentComponent), editManager, fileManager, menuManager,
+				colourManager, workbenchConfiguration, selectionManager);
+		wizard.setNestedEnabled(false);
+		wizard.setVisible(true);
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-dataflow-activity-ui/src/main/java/org/apache/taverna/workbench/file/importworkflow/actions/OpenSourceWorkflowAction.java
----------------------------------------------------------------------
diff --git a/taverna-dataflow-activity-ui/src/main/java/org/apache/taverna/workbench/file/importworkflow/actions/OpenSourceWorkflowAction.java b/taverna-dataflow-activity-ui/src/main/java/org/apache/taverna/workbench/file/importworkflow/actions/OpenSourceWorkflowAction.java
new file mode 100644
index 0000000..d3a110b
--- /dev/null
+++ b/taverna-dataflow-activity-ui/src/main/java/org/apache/taverna/workbench/file/importworkflow/actions/OpenSourceWorkflowAction.java
@@ -0,0 +1,139 @@
+/*******************************************************************************
+ * Copyright (C) 2013 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 org.apache.taverna.workbench.file.importworkflow.actions;
+
+import java.awt.Component;
+import java.awt.event.ActionEvent;
+import java.io.File;
+import java.util.Arrays;
+import java.util.List;
+import java.util.prefs.Preferences;
+
+import javax.swing.AbstractAction;
+import javax.swing.JFileChooser;
+import javax.swing.JOptionPane;
+import javax.swing.filechooser.FileFilter;
+
+import org.apache.taverna.workbench.file.FileManager;
+import org.apache.taverna.workbench.icons.WorkbenchIcons;
+
+import org.apache.log4j.Logger;
+
+/**
+ * @author David Withers
+ */
+@SuppressWarnings("serial")
+public abstract class OpenSourceWorkflowAction extends AbstractAction {
+
+	private static Logger logger = Logger.getLogger(OpenSourceWorkflowAction.class);
+
+	private static final String OPEN_WORKFLOW = "Open workflow...";
+
+	protected FileManager fileManager;
+
+	public OpenSourceWorkflowAction(FileManager fileManager) {
+		super(OPEN_WORKFLOW, WorkbenchIcons.openIcon);
+		this.fileManager = fileManager;
+	}
+
+	public void actionPerformed(ActionEvent e) {
+		final Component parentComponent;
+		if (e.getSource() instanceof Component) {
+			parentComponent = (Component) e.getSource();
+		} else {
+			parentComponent = null;
+		}
+		openWorkflows(parentComponent);
+	}
+
+	public abstract void openWorkflows(Component parentComponent, File[] files);
+
+	/**
+	 * Pop up an Open-dialogue to select one or more workflow files to open.
+	 *
+	 * @param parentComponent
+	 *            The UI parent component to use for pop up dialogues
+	 * @param openCallback
+	 *            An {@link OpenCallback} to be called during the file opening.
+	 *            The callback will be invoked for each file that has been
+	 *            opened, as file opening happens in a separate thread that
+	 *            might execute after the return of this method.
+	 * @return <code>false</code> if no files were selected or the dialogue was
+	 *         cancelled, or <code>true</code> if the process of opening one or
+	 *         more files has been started.
+	 */
+	public boolean openWorkflows(final Component parentComponent) {
+		JFileChooser fileChooser = new JFileChooser();
+		Preferences prefs = Preferences.userNodeForPackage(getClass());
+		String curDir = prefs.get("currentDir", System.getProperty("user.home"));
+		fileChooser.setDialogTitle(OPEN_WORKFLOW);
+
+		fileChooser.resetChoosableFileFilters();
+		fileChooser.setAcceptAllFileFilterUsed(false);
+		List<FileFilter> fileFilters = fileManager.getOpenFileFilters();
+		if (fileFilters.isEmpty()) {
+			logger.warn("No file types found for opening workflow");
+			JOptionPane
+					.showMessageDialog(parentComponent,
+							"No file types found for opening workflow.", "Error",
+							JOptionPane.ERROR_MESSAGE);
+			return false;
+		}
+		for (FileFilter fileFilter : fileFilters) {
+			fileChooser.addChoosableFileFilter(fileFilter);
+		}
+
+		fileChooser.setFileFilter(fileFilters.get(0));
+
+		fileChooser.setCurrentDirectory(new File(curDir));
+		fileChooser.setMultiSelectionEnabled(true);
+
+		int returnVal = fileChooser.showOpenDialog(parentComponent);
+		if (returnVal == JFileChooser.APPROVE_OPTION) {
+			prefs.put("currentDir", fileChooser.getCurrentDirectory().toString());
+			final File[] selectedFiles = fileChooser.getSelectedFiles();
+			if (selectedFiles.length == 0) {
+				logger.warn("No files selected");
+				return false;
+			}
+			new FileOpenerThread(parentComponent, selectedFiles).start();
+			return true;
+		}
+		return false;
+	}
+
+	private final class FileOpenerThread extends Thread {
+		private final File[] files;
+		private final Component parentComponent;
+
+		private FileOpenerThread(Component parentComponent, File[] selectedFiles) {
+			super("Opening workflows(s) " + Arrays.asList(selectedFiles));
+			this.parentComponent = parentComponent;
+			this.files = selectedFiles;
+		}
+
+		@Override
+		public void run() {
+			openWorkflows(parentComponent, files);
+		}
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-dataflow-activity-ui/src/main/java/org/apache/taverna/workbench/file/importworkflow/actions/ReplaceNestedWorkflowAction.java
----------------------------------------------------------------------
diff --git a/taverna-dataflow-activity-ui/src/main/java/org/apache/taverna/workbench/file/importworkflow/actions/ReplaceNestedWorkflowAction.java b/taverna-dataflow-activity-ui/src/main/java/org/apache/taverna/workbench/file/importworkflow/actions/ReplaceNestedWorkflowAction.java
new file mode 100644
index 0000000..7209ce7
--- /dev/null
+++ b/taverna-dataflow-activity-ui/src/main/java/org/apache/taverna/workbench/file/importworkflow/actions/ReplaceNestedWorkflowAction.java
@@ -0,0 +1,84 @@
+package org.apache.taverna.workbench.file.importworkflow.actions;
+
+import java.awt.Component;
+import java.awt.event.ActionEvent;
+
+import org.apache.taverna.servicedescriptions.ServiceDescriptionRegistry;
+import org.apache.taverna.ui.menu.MenuManager;
+import org.apache.taverna.workbench.activityicons.ActivityIconManager;
+import org.apache.taverna.workbench.configuration.colour.ColourManager;
+import org.apache.taverna.workbench.configuration.workbench.WorkbenchConfiguration;
+import org.apache.taverna.workbench.edits.Edit;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.file.FileManager;
+import org.apache.taverna.workbench.file.importworkflow.gui.ImportWorkflowWizard;
+import org.apache.taverna.workbench.selection.SelectionManager;
+import org.apache.taverna.workbench.ui.Utils;
+import org.apache.taverna.workbench.ui.actions.activity.ActivityConfigurationAction;
+import org.apache.taverna.workflow.edits.ConfigureEdit;
+import org.apache.taverna.scufl2.api.activity.Activity;
+import org.apache.taverna.scufl2.api.configurations.Configuration;
+import org.apache.taverna.scufl2.api.core.Workflow;
+
+public class ReplaceNestedWorkflowAction extends ActivityConfigurationAction {
+	private static final long serialVersionUID = 1L;
+
+	private final EditManager editManager;
+	private final FileManager fileManager;
+	private final MenuManager menuManager;
+
+	private final ColourManager colourManager;
+
+	private final WorkbenchConfiguration workbenchConfiguration;
+
+	private final SelectionManager selectionManager;
+
+	public ReplaceNestedWorkflowAction(Activity activity, EditManager editManager,
+			FileManager fileManager, MenuManager menuManager,
+			ActivityIconManager activityIconManager, ColourManager colourManager,
+			ServiceDescriptionRegistry serviceDescriptionRegistry,
+			WorkbenchConfiguration workbenchConfiguration, SelectionManager selectionManager) {
+		super(activity, activityIconManager, serviceDescriptionRegistry);
+		this.editManager = editManager;
+		this.fileManager = fileManager;
+		this.menuManager = menuManager;
+		this.colourManager = colourManager;
+		this.workbenchConfiguration = workbenchConfiguration;
+		this.selectionManager = selectionManager;
+		putValue(NAME, "Replace nested workflow");
+	}
+
+	public void actionPerformed(ActionEvent e) {
+		final Component parentComponent;
+		if (e.getSource() instanceof Component) {
+			parentComponent = (Component) e.getSource();
+		} else {
+			parentComponent = null;
+		}
+		ImportWorkflowWizard wizard = new ImportWorkflowWizard(
+				Utils.getParentFrame(parentComponent), editManager, fileManager, menuManager,
+				colourManager, workbenchConfiguration, selectionManager) {
+			private static final long serialVersionUID = 1L;
+
+//			@Override
+//			protected Edit<?> makeInsertNestedWorkflowEdit(Workflow nestedFlow, String name) {
+//				Configuration configuration = new Configuration();
+//				configuration.setType(null);
+//				// TODO use service registry
+//				return new ConfigureEdit<Activity>(getActivity(), null, configuration);
+//			}
+
+//			@Override
+//			protected Activity getInsertedActivity() {
+//				return getActivity();
+//			}
+		};
+
+		wizard.setMergeEnabled(false);
+//		wizard.setCustomDestinationDataflow(fileManager.getCurrentDataflow(),
+//				"Existing nested workflow");
+//		wizard.setDestinationEnabled(false);
+		wizard.setVisible(true);
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-dataflow-activity-ui/src/main/java/org/apache/taverna/workbench/file/importworkflow/gui/ImportWorkflowWizard.java
----------------------------------------------------------------------
diff --git a/taverna-dataflow-activity-ui/src/main/java/org/apache/taverna/workbench/file/importworkflow/gui/ImportWorkflowWizard.java b/taverna-dataflow-activity-ui/src/main/java/org/apache/taverna/workbench/file/importworkflow/gui/ImportWorkflowWizard.java
new file mode 100644
index 0000000..6bf4cab
--- /dev/null
+++ b/taverna-dataflow-activity-ui/src/main/java/org/apache/taverna/workbench/file/importworkflow/gui/ImportWorkflowWizard.java
@@ -0,0 +1,1272 @@
+package org.apache.taverna.workbench.file.importworkflow.gui;
+
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.Container;
+import java.awt.Frame;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.FocusAdapter;
+import java.awt.event.FocusEvent;
+import java.awt.event.ItemEvent;
+import java.awt.event.ItemListener;
+import java.io.File;
+import java.lang.reflect.InvocationTargetException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import javax.swing.AbstractAction;
+import javax.swing.BorderFactory;
+import javax.swing.ButtonGroup;
+import javax.swing.ButtonModel;
+import javax.swing.JButton;
+import javax.swing.JComboBox;
+import javax.swing.JLabel;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import javax.swing.JRadioButton;
+import javax.swing.JTextField;
+import javax.swing.ProgressMonitor;
+import javax.swing.SwingUtilities;
+
+import org.apache.taverna.activities.dataflow.servicedescriptions.DataflowTemplateService;
+import org.apache.taverna.ui.menu.MenuManager;
+import org.apache.taverna.workbench.MainWindow;
+import org.apache.taverna.workbench.configuration.colour.ColourManager;
+import org.apache.taverna.workbench.configuration.workbench.WorkbenchConfiguration;
+import org.apache.taverna.workbench.edits.CompoundEdit;
+import org.apache.taverna.workbench.edits.Edit;
+import org.apache.taverna.workbench.edits.EditException;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.file.DataflowInfo;
+import org.apache.taverna.workbench.file.FileManager;
+import org.apache.taverna.workbench.file.exceptions.OpenException;
+import org.apache.taverna.workbench.file.importworkflow.DataflowMerger;
+import org.apache.taverna.workbench.file.importworkflow.MergeException;
+import org.apache.taverna.workbench.file.importworkflow.actions.OpenSourceWorkflowAction;
+import org.apache.taverna.workbench.helper.HelpEnabledDialog;
+import net.sf.taverna.t2.workbench.models.graph.svg.SVGGraphController;
+import org.apache.taverna.workbench.selection.SelectionManager;
+import org.apache.taverna.workflow.edits.AddChildEdit;
+import org.apache.taverna.workflow.edits.AddProcessorEdit;
+
+import org.apache.batik.swing.JSVGCanvas;
+import org.apache.log4j.Logger;
+
+import org.apache.taverna.scufl2.api.activity.Activity;
+import org.apache.taverna.scufl2.api.common.Scufl2Tools;
+import org.apache.taverna.scufl2.api.configurations.Configuration;
+import org.apache.taverna.scufl2.api.container.WorkflowBundle;
+import org.apache.taverna.scufl2.api.core.Processor;
+import org.apache.taverna.scufl2.api.core.Workflow;
+import org.apache.taverna.scufl2.api.iterationstrategy.CrossProduct;
+import org.apache.taverna.scufl2.api.port.InputActivityPort;
+import org.apache.taverna.scufl2.api.port.InputProcessorPort;
+import org.apache.taverna.scufl2.api.port.InputWorkflowPort;
+import org.apache.taverna.scufl2.api.port.OutputActivityPort;
+import org.apache.taverna.scufl2.api.port.OutputProcessorPort;
+import org.apache.taverna.scufl2.api.port.OutputWorkflowPort;
+import org.apache.taverna.scufl2.api.profiles.ProcessorBinding;
+import org.apache.taverna.scufl2.api.profiles.ProcessorInputPortBinding;
+import org.apache.taverna.scufl2.api.profiles.ProcessorOutputPortBinding;
+import org.apache.taverna.scufl2.api.profiles.Profile;
+
+import com.fasterxml.jackson.databind.node.ObjectNode;
+
+@SuppressWarnings("serial")
+public class ImportWorkflowWizard extends HelpEnabledDialog {
+
+	private static Logger logger = Logger.getLogger(ImportWorkflowWizard.class);
+
+	private Scufl2Tools scufl2Tools = new Scufl2Tools();
+
+	protected BrowseFileOnClick browseFileOnClick = new BrowseFileOnClick();
+	protected JButton buttonBrowse;
+	protected JComboBox chooseDataflow;
+	protected DataflowOpenerThread dataflowOpenerThread;
+
+	private WorkflowBundle destinationWorkflowBundle;
+	private Workflow destinationWorkflow;
+	private Profile destinationProfile;
+	private Workflow sourceWorkflow;
+
+	protected JTextField fieldFile;
+
+	protected JTextField fieldUrl;
+	protected boolean mergeEnabled = true;
+	protected boolean nestedEnabled = true;
+	protected JSVGCanvas previewSource = new JSVGCanvas(null, false, false);
+	protected JSVGCanvas previewDestination = new JSVGCanvas(null, false, false);
+	protected JTextField prefixField;
+	protected JRadioButton radioFile;
+	protected JRadioButton radioNew;
+	protected JRadioButton radioOpened;
+	protected JRadioButton radioUrl;
+	protected ButtonGroup sourceSelection;
+	protected ActionListener updateChosenListener = new UpdateChosenListener();
+	protected Thread updatePreviewsThread;
+	protected Component sourceSelectionPanel;
+	protected JLabel prefixLabel;
+	protected JLabel prefixHelp;
+//	protected JPanel destinationSelectionPanel;
+//	protected ButtonGroup destinationSelection;
+//	protected JRadioButton radioNewDestination;
+//	protected JRadioButton radioOpenDestination;
+//	protected JComboBox destinationAlreadyOpen;
+	protected JPanel introductionPanel;
+	protected ButtonGroup actionSelection;
+	protected JRadioButton actionNested;
+	protected JRadioButton actionMerge;
+	protected JRadioButton radioCustomSource;
+	protected JRadioButton radioCustomDestination;
+
+	private final EditManager editManager;
+	private final FileManager fileManager;
+	private final MenuManager menuManager;
+	private final ColourManager colourManager;
+	private final WorkbenchConfiguration workbenchConfiguration;
+	private final SelectionManager selectionManager;
+
+	private WorkflowBundle customSourceDataFlow = null;
+//	private Workflow customDestinationDataflow = null;
+	private String customSourceName = "";
+//	private String customDestinationName = "";
+
+	private boolean sourceEnabled = true;
+//	private boolean destinationEnabled = true;
+	private Activity insertedActivity;
+
+	public ImportWorkflowWizard(Frame parentFrame, EditManager editManager,
+			FileManager fileManager, MenuManager menuManager, ColourManager colourManager,
+			WorkbenchConfiguration workbenchConfiguration, SelectionManager selectionManager) {
+		super(parentFrame, "Import workflow", true, null);
+		this.selectionManager = selectionManager;
+		destinationWorkflow = selectionManager.getSelectedWorkflow();
+		destinationProfile = selectionManager.getSelectedProfile();
+		destinationWorkflowBundle = selectionManager.getSelectedWorkflowBundle();
+
+		this.editManager = editManager;
+		this.fileManager = fileManager;
+		this.menuManager = menuManager;
+		this.colourManager = colourManager;
+		this.workbenchConfiguration = workbenchConfiguration;
+
+		setSize(600, 600);
+		add(makeContentPane(), BorderLayout.CENTER);
+		// Add some space
+		add(new JPanel(), BorderLayout.WEST);
+		add(new JPanel(), BorderLayout.NORTH);
+		add(new JPanel(), BorderLayout.SOUTH);
+		add(new JPanel(), BorderLayout.EAST);
+		findChosenDataflow(this, true);
+		updateAll();
+	}
+
+	public void setMergeEnabled(boolean importEnabled) {
+		this.mergeEnabled = importEnabled;
+		updateAll();
+	}
+
+	public void setNestedEnabled(boolean nestedEnabled) {
+		this.nestedEnabled = nestedEnabled;
+		updateAll();
+	}
+
+	/**
+	 * Silly workaround to avoid "Cannot call invokeAndWait from the event dispatcher thread"
+	 * exception.
+	 *
+	 * @param runnable
+	 */
+	public static void invokeAndWait(Runnable runnable) {
+		if (SwingUtilities.isEventDispatchThread()) {
+			runnable.run();
+			return;
+		}
+		try {
+			SwingUtilities.invokeAndWait(runnable);
+		} catch (InterruptedException ex) {
+			// logger.warn("Runnable " + runnable + " was interrupted " + runnable, ex);
+		} catch (InvocationTargetException e) {
+			logger.warn("Can't invoke " + runnable, e);
+		}
+	}
+
+	protected Component makeWorkflowImage() {
+		JPanel workflowImages = new JPanel(new GridBagLayout());
+		GridBagConstraints gbc = new GridBagConstraints();
+		gbc.gridy = 0;
+		gbc.fill = GridBagConstraints.BOTH;
+		gbc.weighty = 0.1;
+
+		gbc.weightx = 0.1;
+		workflowImages.add(new JPanel(), gbc);// filler
+
+		gbc.weightx = 0.0;
+		previewSource.setBackground(workflowImages.getBackground());
+		workflowImages.add(previewSource, gbc);
+
+		JLabel arrow = new JLabel("\u2192");
+		arrow.setFont(arrow.getFont().deriveFont(48f));
+		workflowImages.add(arrow, gbc);
+
+		previewDestination.setBackground(workflowImages.getBackground());
+		workflowImages.add(previewDestination, gbc);
+
+		gbc.weightx = 0.1;
+		workflowImages.add(new JPanel(), gbc);
+		gbc.weightx = 0.0;
+
+		return workflowImages;
+	}
+
+	protected void updateAll() {
+		updatePreviews(); // will go in separate thread anyway, do it first
+		updateHeader();
+		updateSourceSection();
+//		updateDestinationSection();
+		updateFooter();
+	}
+
+//	protected void updateDestinationSection() {
+//
+//		radioNewDestination.setVisible(false);
+//
+//		radioCustomDestination.setText(customDestinationName);
+//		radioCustomDestination.setVisible(customDestinationDataflow != null);
+//
+//		// radioNewDestination.setVisible(nestedEnabled);
+//		// radioNewDestination.setEnabled(actionNested.isSelected());
+//
+//		destinationSelectionPanel.setVisible(destinationEnabled);
+//
+//	}
+
+	protected synchronized void updatePreviews() {
+		if (updatePreviewsThread != null && updatePreviewsThread.isAlive()) {
+			updatePreviewsThread.interrupt();
+		}
+		updatePreviewsThread = new UpdatePreviewsThread();
+		updatePreviewsThread.start();
+	}
+
+	protected void updateDestinationPreview() {
+		updateWorkflowGraphic(previewDestination, destinationWorkflow, destinationProfile);
+	}
+
+	protected void updateSourcePreview() {
+		Profile sourceProfile = null;
+		if (sourceWorkflow != null) {
+			sourceProfile = sourceWorkflow.getParent().getMainProfile();
+		}
+		updateWorkflowGraphic(previewSource, sourceWorkflow, sourceProfile);
+	}
+
+	protected void updateFooter() {
+		prefixField.setVisible(mergeEnabled);
+		prefixLabel.setVisible(mergeEnabled);
+		prefixHelp.setVisible(mergeEnabled);
+
+		prefixField.setEnabled(actionMerge.isSelected());
+		prefixLabel.setEnabled(actionMerge.isSelected());
+		prefixHelp.setEnabled(actionMerge.isSelected());
+		if (actionMerge.isSelected()) {
+			prefixHelp.setForeground(prefixLabel.getForeground());
+		} else {
+			// Work around
+			// http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4303706
+			// and assume gray is the 'disabled' colour in our Look n Feel
+			prefixHelp.setForeground(Color.gray);
+		}
+
+	}
+
+	protected void updateHeader() {
+		makeIntroductionPanel();
+	}
+
+	protected void updateSourceSection() {
+		radioCustomSource.setText(customSourceName);
+		radioCustomSource.setVisible(customSourceDataFlow != null);
+
+		radioNew.setVisible(nestedEnabled);
+		radioNew.setEnabled(actionNested.isSelected());
+
+		if (actionNested.isSelected() && sourceSelection.getSelection() == null) {
+			// Preselect the new workflow
+			radioNew.setSelected(true);
+		}
+
+		sourceSelectionPanel.setVisible(sourceEnabled);
+	}
+
+	/**
+	 * Create a PNG image of the workflow and place inside an ImageIcon
+	 *
+	 * @param dataflow
+	 * @return
+	 * @throws InvocationTargetException
+	 * @throws InterruptedException
+	 */
+	protected void updateWorkflowGraphic(final JSVGCanvas svgCanvas, final Workflow workflow, final Profile profile) {
+		try {
+			SwingUtilities.invokeAndWait(new Runnable() {
+				public void run() {
+					// Set it to blank while reloading
+					svgCanvas.setSVGDocument(null);
+					if (workflow != null) {
+						SVGGraphController currentWfGraphController = new SVGGraphController(
+								workflow, profile, false, svgCanvas,
+								editManager, menuManager, colourManager, workbenchConfiguration);
+					}
+				}
+			});
+		} catch (InterruptedException e) {
+			// logger.error(e);
+		} catch (InvocationTargetException e) {
+			// logger.error(e);
+		}
+	}
+
+	/**
+	 * Open the selected source and destination workflows. If background is true, this method will
+	 * return immediately while a {@link DataflowOpenerThread} performs the updates. If a
+	 * DataflowOpenerThread is already running, it will be interrupted and stopped.
+	 *
+	 * @param parentComponent
+	 *            The parent component for showing dialogues
+	 * @param background
+	 *            If true, will run in separate thread.
+	 * @return <code>false</code> if running in the background, or if a dialogue was shown and the
+	 *         operation is aborted by the user, or <code>true</code> if not running in the
+	 *         background and the method completed without user interruption.
+	 */
+	protected synchronized boolean findChosenDataflow(Component parentComponent, boolean background) {
+		if (dataflowOpenerThread != null && dataflowOpenerThread.isAlive()) {
+			if (background) {
+				// We've changed our mind
+				dataflowOpenerThread.interrupt();
+			} else {
+				// We'll let it finish, we don't need to do it again
+				try {
+					dataflowOpenerThread.join();
+				} catch (InterruptedException e) {
+					Thread.currentThread().interrupt();
+				}
+				return !dataflowOpenerThread.shownWarning;
+			}
+		}
+		dataflowOpenerThread = new DataflowOpenerThread(parentComponent, background);
+
+		if (background) {
+			dataflowOpenerThread.start();
+			return false;
+		} else {
+			dataflowOpenerThread.run();
+			return !dataflowOpenerThread.shownWarning;
+		}
+
+	}
+
+	protected Container makeContentPane() {
+		JPanel panel = new JPanel(new GridBagLayout());
+		GridBagConstraints gbc = new GridBagConstraints();
+
+		gbc.ipadx = 5;
+		gbc.ipady = 5;
+
+		gbc.gridx = 0;
+		gbc.weightx = 0.1;
+		gbc.fill = GridBagConstraints.BOTH;
+
+		introductionPanel = makeIntroductionPanel();
+		panel.add(introductionPanel, gbc);
+
+		sourceSelectionPanel = makeSourceSelectionPanel();
+		panel.add(sourceSelectionPanel, gbc);
+
+//		destinationSelectionPanel = makeDestinationSelectionPanel();
+//		panel.add(destinationSelectionPanel, gbc);
+
+		gbc.weighty = 0.1;
+		panel.add(makeImportStylePanel(), gbc);
+
+		return panel;
+	}
+
+	protected JPanel makeIntroductionPanel() {
+		if (introductionPanel == null) {
+			introductionPanel = new JPanel(new GridBagLayout());
+		} else {
+			introductionPanel.removeAll();
+		}
+		boolean bothEnabled = mergeEnabled && nestedEnabled;
+		if (bothEnabled) {
+			introductionPanel.setBorder(BorderFactory.createTitledBorder("Import method"));
+		} else {
+			introductionPanel.setBorder(BorderFactory.createEmptyBorder());
+		}
+		GridBagConstraints gbc = new GridBagConstraints();
+		gbc.gridx = 0;
+		// gbc.gridy = 0;
+		gbc.weightx = 0.1;
+		gbc.fill = GridBagConstraints.BOTH;
+		gbc.anchor = GridBagConstraints.FIRST_LINE_START;
+
+		StringBuilder nestedHelp = new StringBuilder();
+		nestedHelp.append("<html><small>");
+		nestedHelp.append("Add a <strong>nested workflow</strong> ");
+		nestedHelp.append("into the ");
+		nestedHelp.append("destination workflow as a single service. ");
+		nestedHelp.append("The nested workflow ");
+		nestedHelp.append("can be <em>edited separately</em>, but is shown ");
+		nestedHelp.append("expanded in the diagram of the parent  ");
+		nestedHelp.append("workflow. In the parent workflow you can ");
+		nestedHelp.append("connect to the input and output ports of the nested ");
+		nestedHelp.append("workflow. ");
+		nestedHelp.append("</small></html>");
+
+		StringBuilder mergeHelp = new StringBuilder();
+		mergeHelp.append("<html><small>");
+		mergeHelp.append("<strong>Merge</strong> a workflow ");
+		mergeHelp.append("by copying all services, ports and links ");
+		mergeHelp.append("directly into the destination workflow. This can be  ");
+		mergeHelp.append("useful for merging smaller workflow fragments. For ");
+		mergeHelp.append("inclusion of larger workflows you might find using ");
+		mergeHelp.append("<em>nested workflows</em> more beneficial.");
+		mergeHelp.append("</small></html>");
+
+		actionSelection = new ButtonGroup();
+		actionNested = new JRadioButton(nestedHelp.toString());
+		ActionListener updateListener = new ActionListener() {
+			public void actionPerformed(ActionEvent e) {
+				updateSourceSection();
+//				updateDestinationSection();
+				updateFooter();
+			}
+		};
+		actionNested.addActionListener(updateListener);
+		actionSelection.add(actionNested);
+
+		actionMerge = new JRadioButton(mergeHelp.toString());
+		actionMerge.addActionListener(updateListener);
+		actionSelection.add(actionMerge);
+
+		if (bothEnabled) {
+			introductionPanel.add(actionNested, gbc);
+			introductionPanel.add(actionMerge, gbc);
+			actionNested.setSelected(true);
+		} else if (nestedEnabled) {
+			introductionPanel.add(new JLabel(nestedHelp.toString()), gbc);
+			actionNested.setSelected(true);
+		} else if (mergeEnabled) {
+			introductionPanel.add(new JLabel(mergeHelp.toString()), gbc);
+			actionMerge.setSelected(true);
+		}
+		return introductionPanel;
+	}
+
+//	protected JPanel makeDestinationSelectionPanel() {
+//		JPanel j = new JPanel(new GridBagLayout());
+//		j.setBorder(BorderFactory.createTitledBorder("Workflow destination"));
+//
+//		GridBagConstraints gbc = new GridBagConstraints();
+//		gbc.gridx = 0;
+//		gbc.gridy = 0;
+//		gbc.fill = GridBagConstraints.BOTH;
+//
+//		destinationSelection = new ButtonGroup();
+//		radioNewDestination = new JRadioButton("New workflow");
+//		gbc.gridy = 0;
+//		j.add(radioNewDestination, gbc);
+//		destinationSelection.add(radioNewDestination);
+//		radioNewDestination.addActionListener(updateChosenListener);
+//
+//		radioOpenDestination = new JRadioButton("Already opened workflow");
+//		gbc.gridy = 2;
+//		j.add(radioOpenDestination, gbc);
+//		destinationSelection.add(radioOpenDestination);
+//		radioOpenDestination.addActionListener(updateChosenListener);
+//		gbc.weightx = 0.1;
+//		gbc.gridx = 1;
+//		destinationAlreadyOpen = makeSelectOpenWorkflowComboBox(true);
+//		j.add(destinationAlreadyOpen, gbc);
+//
+//		radioCustomDestination = new JRadioButton(customDestinationName);
+//		radioCustomDestination.setVisible(customDestinationName != null);
+//		gbc.gridx = 0;
+//		gbc.gridy = 3;
+//		gbc.gridwidth = 2;
+//		j.add(radioCustomDestination, gbc);
+//		destinationSelection.add(radioCustomDestination);
+//		radioCustomDestination.addActionListener(updateChosenListener);
+//		gbc.gridwidth = 1;
+//
+//		radioOpenDestination.setSelected(true);
+//		return j;
+//	}
+
+	protected Component makeImportStylePanel() {
+		JPanel j = new JPanel(new GridBagLayout());
+		GridBagConstraints gbc = new GridBagConstraints();
+		gbc.gridx = 0;
+		gbc.gridy = 0;
+		gbc.fill = GridBagConstraints.BOTH;
+
+		j.setBorder(BorderFactory.createTitledBorder("Import"));
+
+		prefixLabel = new JLabel("Prefix");
+		j.add(prefixLabel, gbc);
+		gbc.weightx = 0.1;
+		gbc.gridx = 1;
+
+		prefixField = new JTextField(10);
+		prefixLabel.setLabelFor(prefixField);
+		j.add(prefixField, gbc);
+
+		gbc.gridx = 0;
+		gbc.gridy = 1;
+		gbc.gridwidth = 2;
+
+		prefixHelp = new JLabel(
+				"<html><small>Optional prefix to be prepended to the name of the "
+						+ "inserted services and workflow ports. Even if no prefix is given, duplicate names will be "
+						+ "resolved by adding numbers, for instance <code>my_service_2</code> if <code>my_service</code> already "
+						+ "existed." + "</small></html>");
+		prefixHelp.setLabelFor(prefixField);
+		j.add(prefixHelp, gbc);
+
+		gbc.gridy = 2;
+		gbc.weightx = 0.1;
+		gbc.weighty = 0.1;
+
+		j.add(makeWorkflowImage(), gbc);
+
+		gbc.gridy = 3;
+		gbc.weighty = 0.0;
+		j.add(new JPanel(), gbc);
+
+		gbc.gridy = 4;
+		gbc.fill = GridBagConstraints.NONE;
+		JButton comp = new JButton(new ImportWorkflowAction());
+		j.add(comp, gbc);
+		return j;
+
+	}
+
+	protected Component makeSelectFile() {
+		JPanel j = new JPanel(new GridBagLayout());
+		j.setBorder(BorderFactory.createEtchedBorder());
+
+		GridBagConstraints gbc = new GridBagConstraints();
+		gbc.gridx = 0;
+		gbc.gridy = 0;
+		gbc.fill = GridBagConstraints.BOTH;
+		gbc.weightx = 0.1;
+
+		fieldFile = new JTextField(20);
+		fieldFile.setEditable(false);
+		fieldFile.addFocusListener(new FocusAdapter() {
+			public void focusGained(FocusEvent e) {
+				radioFile.setSelected(true);
+			}
+
+			@Override
+			public void focusLost(FocusEvent e) {
+				findChosenDataflow(e.getComponent(), true);
+			}
+		});
+		j.add(fieldFile, gbc);
+		radioFile.addItemListener(new ItemListener() {
+
+			public void itemStateChanged(ItemEvent e) {
+				if (e.getStateChange() == ItemEvent.SELECTED) {
+					browseFileOnClick.checkEmptyFile();
+				}
+			}
+		});
+
+		gbc.gridx = 1;
+		gbc.weightx = 0.0;
+		gbc.fill = GridBagConstraints.NONE;
+		buttonBrowse = new JButton(new OpenSourceWorkflowAction(fileManager) {
+			@Override
+			public void openWorkflows(Component parentComponent, File[] files) {
+				if (files.length == 0) {
+					radioFile.setSelected(false);
+					fieldFile.setText("");
+					radioFile.requestFocus();
+					return;
+				}
+				fieldFile.setText(files[0].getPath());
+				if (!radioFile.isSelected()) {
+					radioFile.setSelected(true);
+				}
+				findChosenDataflow(parentComponent, true);
+			}
+		});
+		buttonBrowse.setText("Browse");
+		j.add(buttonBrowse, gbc);
+
+		// This just duplicates things - we already have actions on
+		// the radioFile and fieldFile that will handle the events
+		// radioFile.addActionListener(browseFileOnClick);
+		// fieldFile.addActionListener(browseFileOnClick);
+		return j;
+	}
+
+	protected JComboBox makeSelectOpenWorkflowComboBox(boolean selectCurrent) {
+		List<DataflowSelection> openDataflows = new ArrayList<DataflowSelection>();
+		DataflowSelection current = null;
+		for (WorkflowBundle df : fileManager.getOpenDataflows()) {
+			String name = df.getMainWorkflow().getName();
+			boolean isCurrent = df.equals(fileManager.getCurrentDataflow());
+			if (isCurrent) {
+				// Wrapping as HTML causes weird drop-down box under MAC, so
+				// we just use normal text
+				// name = "<html><body>" + name
+				// + " <i>(current)</i></body></html>";
+				name = name + " (current)";
+			}
+			DataflowSelection selection = new DataflowSelection(df, name);
+			openDataflows.add(selection);
+			if (isCurrent) {
+				current = selection;
+			}
+		}
+		JComboBox chooseDataflow = new JComboBox(openDataflows.toArray());
+		if (selectCurrent) {
+			chooseDataflow.setSelectedItem(current);
+		}
+		chooseDataflow.addActionListener(updateChosenListener);
+		return chooseDataflow;
+
+	}
+
+	protected Component makeSourceSelectionPanel() {
+		JPanel j = new JPanel(new GridBagLayout());
+		j.setBorder(BorderFactory.createTitledBorder("Workflow source"));
+
+		GridBagConstraints gbc = new GridBagConstraints();
+		gbc.gridx = 0;
+		gbc.gridy = 0;
+		gbc.fill = GridBagConstraints.BOTH;
+
+		sourceSelection = new ButtonGroup();
+		radioNew = new JRadioButton("New workflow");
+		gbc.gridy = 0;
+		j.add(radioNew, gbc);
+		sourceSelection.add(radioNew);
+
+		radioNew.addActionListener(updateChosenListener);
+
+		radioFile = new JRadioButton("Import from file");
+		gbc.gridy = 1;
+		j.add(radioFile, gbc);
+		sourceSelection.add(radioFile);
+		radioFile.addActionListener(updateChosenListener);
+
+		radioUrl = new JRadioButton("Import from URL");
+		gbc.gridy = 2;
+		j.add(radioUrl, gbc);
+		sourceSelection.add(radioUrl);
+		radioUrl.addActionListener(updateChosenListener);
+
+		radioOpened = new JRadioButton("Already opened workflow");
+		gbc.gridy = 3;
+		j.add(radioOpened, gbc);
+		sourceSelection.add(radioOpened);
+		radioOpened.addActionListener(updateChosenListener);
+
+		radioCustomSource = new JRadioButton(customSourceName);
+		radioCustomSource.setVisible(customSourceDataFlow != null);
+		gbc.gridy = 4;
+		gbc.gridwidth = 2;
+		j.add(radioCustomSource, gbc);
+		sourceSelection.add(radioCustomSource);
+		radioCustomSource.addActionListener(updateChosenListener);
+		gbc.gridwidth = 1;
+
+		gbc.gridx = 1;
+		gbc.gridy = 1;
+		gbc.weightx = 0.1;
+		j.add(makeSelectFile(), gbc);
+
+		gbc.gridy = 2;
+		fieldUrl = new JTextField(20);
+		j.add(fieldUrl, gbc);
+		fieldUrl.addFocusListener(new FocusAdapter() {
+			@Override
+			public void focusGained(FocusEvent e) {
+				radioUrl.setSelected(true);
+			}
+
+			@Override
+			public void focusLost(FocusEvent e) {
+				findChosenDataflow(e.getComponent(), true);
+			}
+		});
+
+		gbc.gridy = 3;
+		chooseDataflow = makeSelectOpenWorkflowComboBox(false);
+		chooseDataflow.addFocusListener(new FocusAdapter() {
+			@Override
+			public void focusGained(FocusEvent e) {
+				radioOpened.setSelected(true);
+			}
+		});
+		j.add(chooseDataflow, gbc);
+
+		return j;
+	}
+
+	protected Edit<?> makeInsertNestedWorkflowEdit(Workflow nestedFlow) {
+		Processor processor = new Processor();
+		processor.setName("nestedWorkflow");
+
+		CrossProduct crossProduct = new CrossProduct();
+		crossProduct.setParent(processor.getIterationStrategyStack());
+
+		Activity activity = new Activity();
+		activity.setType(DataflowTemplateService.ACTIVITY_TYPE);
+		Configuration configuration = new Configuration();
+		configuration.setType(DataflowTemplateService.ACTIVITY_TYPE.resolve("#Config"));
+		destinationWorkflowBundle.getWorkflows().addWithUniqueName(nestedFlow);
+		((ObjectNode) configuration.getJson()).put("nestedWorkflow", nestedFlow.getName());
+		destinationWorkflowBundle.getWorkflows().remove(nestedFlow);
+		configuration.setConfigures(activity);
+
+		ProcessorBinding processorBinding = new ProcessorBinding();
+		processorBinding.setBoundProcessor(processor);
+		processorBinding.setBoundActivity(activity);
+
+		for (InputWorkflowPort workflowPort : nestedFlow.getInputPorts()) {
+			InputActivityPort activityPort = new InputActivityPort(activity, workflowPort.getName());
+			activityPort.setDepth(workflowPort.getDepth());
+			// create processor port
+			InputProcessorPort processorPort = new InputProcessorPort(processor, activityPort.getName());
+			processorPort.setDepth(activityPort.getDepth());
+			// add a new port binding
+			new ProcessorInputPortBinding(processorBinding, processorPort, activityPort);
+		}
+		for (OutputWorkflowPort workflowPort : nestedFlow.getOutputPorts()) {
+			OutputActivityPort activityPort = new OutputActivityPort(activity, workflowPort.getName());
+			// TODO calculate output depth
+			activityPort.setDepth(0);
+			activityPort.setGranularDepth(0);
+			// create processor port
+			OutputProcessorPort processorPort = new OutputProcessorPort(processor, activityPort.getName());
+			processorPort.setDepth(activityPort.getDepth());
+			processorPort.setGranularDepth(activityPort.getGranularDepth());
+			// add a new port binding
+			new ProcessorOutputPortBinding(processorBinding, activityPort, processorPort);
+		}
+
+		List<Edit<?>> editList = new ArrayList<Edit<?>>();
+		editList.add(new AddChildEdit<Profile>(destinationProfile, activity));
+		editList.add(new AddChildEdit<Profile>(destinationProfile, configuration));
+		editList.add(new AddChildEdit<Profile>(destinationProfile, processorBinding));
+		editList.add(new AddProcessorEdit(destinationWorkflow, processor));
+
+		editList.add(makeInsertWorkflowEdit(nestedFlow, nestedFlow.getParent().getMainProfile()));
+
+		return new CompoundEdit(editList);
+	}
+
+	protected Edit<?> makeInsertWorkflowEdit(Workflow nestedFlow, Profile profile) {
+		return makeInsertWorkflowEdit(nestedFlow, profile, new HashSet<>());
+	}
+
+	protected Edit<?> makeInsertWorkflowEdit(Workflow nestedFlow, Profile profile, Set<Object> seen) {
+		List<Edit<?>> editList = new ArrayList<Edit<?>>();
+		// add the nested workflow to the workflow bundle
+		editList.add(new AddChildEdit<WorkflowBundle>(destinationWorkflowBundle, nestedFlow));
+		seen.add(nestedFlow);
+		for (Processor processor : nestedFlow.getProcessors()) {
+			// add processor bindings to the profile
+			List<ProcessorBinding> processorBindings = scufl2Tools.processorBindingsForProcessor(processor, profile);
+			for (ProcessorBinding processorBinding : processorBindings) {
+				editList.add(new AddChildEdit<Profile>(destinationProfile, processorBinding));
+				// add activity to the profile
+				Activity activity = processorBinding.getBoundActivity();
+				if (!seen.contains(activity)) {
+					editList.add(new AddChildEdit<Profile>(destinationProfile, activity));
+					// add activity configurations to the profile
+					for (Configuration configuration : scufl2Tools.configurationsFor(activity, profile)) {
+						editList.add(new AddChildEdit<Profile>(destinationProfile, configuration));
+					}
+					seen.add(activity);
+				}
+			}
+			// add processor configurations to the profile
+			List<Configuration> configurations = scufl2Tools.configurationsFor(processor, profile);
+			for (Configuration configuration : configurations) {
+				editList.add(new AddChildEdit<Profile>(destinationProfile, configuration));
+			}
+
+			for (Workflow workflow : scufl2Tools.nestedWorkflowsForProcessor(processor, profile)) {
+				if (!seen.contains(workflow)) {
+					// recursively add nested workflows
+					editList.add(makeInsertWorkflowEdit(workflow, profile, seen));
+				}
+			}
+		}
+		return new CompoundEdit(editList);
+	}
+
+//	protected Activity getInsertedActivity() {
+//		return insertedActivity;
+//	}
+
+	protected class ImportWorkflowAction extends AbstractAction implements Runnable {
+		private static final String VALID_NAME_REGEX = "[\\p{L}\\p{Digit}_.]+";
+		private Component parentComponent;
+		private ProgressMonitor progressMonitor;
+
+		protected ImportWorkflowAction() {
+			super("Import workflow");
+		}
+
+		public void actionPerformed(ActionEvent e) {
+			/*
+			 * if (e.getSource() instanceof Component) { parentComponent = (Component)
+			 * e.getSource(); } else { parentComponent = null; }
+			 */
+			parentComponent = MainWindow.getMainWindow();
+			Thread t = new Thread(this, "Import workflow");
+			progressMonitor = new ProgressMonitor(parentComponent, "Importing workflow", "", 0, 100);
+			progressMonitor.setMillisToDecideToPopup(200);
+			progressMonitor.setProgress(5);
+			t.start();
+			setVisible(false);
+		}
+
+		protected void nested() {
+			if (progressMonitor.isCanceled()) {
+				return;
+			}
+			progressMonitor.setProgress(15);
+			selectionManager.setSelectedWorkflowBundle(destinationWorkflowBundle);
+			if (progressMonitor.isCanceled()) {
+				return;
+			}
+
+			progressMonitor.setNote("Copying source workflow");
+			Workflow nestedFlow;
+			try {
+				nestedFlow = DataflowMerger.copyWorkflow(sourceWorkflow);
+			} catch (Exception ex) {
+				logger.warn("Could not copy nested workflow", ex);
+				progressMonitor.setProgress(100);
+				JOptionPane.showMessageDialog(parentComponent,
+						"An error occured while copying workflow:\n" + ex.getLocalizedMessage(),
+						"Could not copy nested workflow", JOptionPane.WARNING_MESSAGE);
+				return;
+			}
+			if (progressMonitor.isCanceled()) {
+				return;
+			}
+
+			progressMonitor.setNote("Creating nested workflow");
+			progressMonitor.setProgress(45);
+
+			Edit<?> edit = makeInsertNestedWorkflowEdit(nestedFlow);
+			if (progressMonitor.isCanceled()) {
+				return;
+			}
+
+			progressMonitor.setNote("Inserting nested workflow");
+			progressMonitor.setProgress(65);
+
+			try {
+				editManager.doDataflowEdit(destinationWorkflowBundle, edit);
+			} catch (EditException e) {
+				progressMonitor.setProgress(100);
+				logger.warn("Could not import nested workflow", e);
+				JOptionPane.showMessageDialog(parentComponent,
+						"An error occured while importing workflow:\n" + e.getLocalizedMessage(),
+						"Could not import workflows", JOptionPane.WARNING_MESSAGE);
+				return;
+			}
+
+			if (radioNew.isSelected()) {
+				progressMonitor.setNote("Opening new nested workflow for editing");
+				progressMonitor.setProgress(90);
+				selectionManager.setSelectedWorkflow(nestedFlow);
+			}
+			progressMonitor.setProgress(100);
+		}
+
+		protected void merge() {
+			progressMonitor.setProgress(10);
+			DataflowMerger merger = new DataflowMerger(destinationWorkflow);
+			progressMonitor.setProgress(25);
+			progressMonitor.setNote("Planning workflow merging");
+
+			String prefix = prefixField.getText();
+			if (!prefix.equals("")) {
+				if (!prefix.matches("[_.]$")) {
+					prefix = prefix + "_";
+				}
+				if (!prefix.matches(VALID_NAME_REGEX)) {
+					progressMonitor.setProgress(100);
+					final String wrongPrefix = prefix;
+					SwingUtilities.invokeLater(new Runnable() {
+						public void run() {
+							JOptionPane.showMessageDialog(parentComponent, "The merge prefix '"
+									+ wrongPrefix + "' is not valid. Try "
+									+ "using only letters, numbers, " + "underscore and dot.",
+									"Invalid merge prefix", JOptionPane.ERROR_MESSAGE);
+							prefixField.requestFocus();
+							ImportWorkflowWizard.this.setVisible(true);
+						}
+					});
+					return;
+				}
+			}
+
+			CompoundEdit mergeEdit;
+			try {
+				mergeEdit = merger.getMergeEdit(ImportWorkflowWizard.this.sourceWorkflow, prefix);
+			} catch (MergeException e1) {
+				progressMonitor.setProgress(100);
+				logger.warn("Could not merge workflow", e1);
+				JOptionPane.showMessageDialog(parentComponent,
+						"An error occured while merging workflows:\n" + e1.getLocalizedMessage(),
+						"Could not merge workflows", JOptionPane.WARNING_MESSAGE);
+				return;
+			}
+
+			progressMonitor.setProgress(55);
+			selectionManager.setSelectedWorkflowBundle(destinationWorkflowBundle);
+
+			progressMonitor.setNote("Merging workflows");
+			progressMonitor.setProgress(75);
+
+			if (progressMonitor.isCanceled()) {
+				return;
+			}
+
+			try {
+				editManager.doDataflowEdit(destinationWorkflowBundle, mergeEdit);
+			} catch (EditException e1) {
+				progressMonitor.setProgress(100);
+				JOptionPane.showMessageDialog(parentComponent,
+						"An error occured while merging workflows:\n" + e1.getLocalizedMessage(),
+						"Could not merge workflows", JOptionPane.WARNING_MESSAGE);
+				return;
+			}
+			progressMonitor.setProgress(100);
+
+		}
+
+		public void run() {
+			boolean completed = findChosenDataflow(parentComponent, false);
+			if (!completed) {
+				return;
+			}
+			if (actionMerge.isSelected()) {
+				merge();
+			} else if (actionNested.isSelected()) {
+				nested();
+			}
+		}
+	}
+
+	protected class UpdatePreviewsThread extends Thread {
+		protected UpdatePreviewsThread() {
+			super("Updating destination previews");
+		}
+
+		public void run() {
+			if (Thread.interrupted()) {
+				return;
+			}
+			updateSourcePreview();
+
+			if (Thread.interrupted()) {
+				return;
+			}
+			updateDestinationPreview();
+		}
+	}
+
+	protected class BrowseFileOnClick implements ActionListener {
+		public void actionPerformed(ActionEvent e) {
+			checkEmptyFile();
+		}
+
+		public void checkEmptyFile() {
+			if (radioFile.isSelected() && fieldFile.getText().equals("")) {
+				// On first label click pop up Browse dialogue.
+				buttonBrowse.doClick();
+			}
+		}
+	}
+
+	protected class DataflowOpenerThread extends Thread {
+		private final boolean background;
+		private final Component parentComponent;
+		private boolean shouldStop = false;
+		private boolean shownWarning = false;
+
+		protected DataflowOpenerThread(Component parentComponent, boolean background) {
+			super("Inspecting selected workflow");
+			this.parentComponent = parentComponent;
+			this.background = background;
+		}
+
+		@Override
+		public void interrupt() {
+			this.shouldStop = true;
+			super.interrupt();
+		}
+
+		public void run() {
+			updateSource();
+//			updateDestination();
+		}
+
+//		public void updateDestination() {
+//			ButtonModel selection = destinationSelection.getSelection();
+//			Workflow chosenDataflow = null;
+//			if (selection == null) {
+//				chosenDataflow = null;
+//			} else if (selection.equals(radioNewDestination.getModel())) {
+//				chosenDataflow = new Workflow();
+//			} else if (selection.equals(radioOpenDestination.getModel())) {
+//				DataflowSelection chosen = (DataflowSelection) destinationAlreadyOpen
+//						.getSelectedItem();
+//				chosenDataflow = chosen.getDataflow();
+//			} else if (selection.equals(radioCustomDestination.getModel())) {
+//				chosenDataflow = customDestinationDataflow;
+//			} else {
+//				logger.error("Unknown selection " + selection);
+//			}
+//
+//			if (chosenDataflow == null) {
+//				if (!background && !shownWarning) {
+//					shownWarning = true;
+//					SwingUtilities.invokeLater(new Runnable() {
+//						public void run() {
+//							JOptionPane.showMessageDialog(parentComponent,
+//									"You need to choose a destination workflow",
+//									"No destination workflow chosen", JOptionPane.ERROR_MESSAGE);
+//							setVisible(true);
+//						}
+//					});
+//					return;
+//				}
+//			}
+//			if (checkInterrupted()) {
+//				return;
+//			}
+//			if (chosenDataflow != ImportWorkflowWizard.this.destinationDataflow) {
+//				updateWorkflowGraphic(previewDestination, chosenDataflow);
+//				if (checkInterrupted()) {
+//					return;
+//				}
+//				ImportWorkflowWizard.this.destinationDataflow = chosenDataflow;
+//			}
+//
+//		}
+
+		public void updateSource() {
+			ButtonModel selection = sourceSelection.getSelection();
+			Workflow chosenDataflow = null;
+			if (selection == null) {
+				chosenDataflow = null;
+			} else if (selection.equals(radioNew.getModel())) {
+				WorkflowBundle workflowBundle = new WorkflowBundle();
+				workflowBundle.setMainWorkflow(new Workflow());
+				workflowBundle.getMainWorkflow().setName(fileManager.getDefaultWorkflowName());
+				workflowBundle.setMainProfile(new Profile());
+				scufl2Tools.setParents(workflowBundle);
+				chosenDataflow = workflowBundle.getMainWorkflow();
+			} else if (selection.equals(radioFile.getModel())) {
+				final String filePath = fieldFile.getText();
+				try {
+					DataflowInfo opened = fileManager
+							.openDataflowSilently(null, new File(filePath));
+					if (checkInterrupted()) {
+						return;
+					}
+					chosenDataflow = opened.getDataflow().getMainWorkflow();
+				} catch (final OpenException e1) {
+					if (!background && !shownWarning) {
+						shownWarning = true;
+						logger.warn("Could not open workflow for merging: " + filePath, e1);
+						SwingUtilities.invokeLater(new Runnable() {
+							public void run() {
+								radioFile.requestFocus();
+								JOptionPane.showMessageDialog(parentComponent,
+										"An error occured while trying to open " + filePath + "\n"
+												+ e1.getMessage(), "Could not open workflow",
+										JOptionPane.WARNING_MESSAGE);
+								setVisible(true);
+							}
+						});
+					}
+				}
+			} else if (selection.equals(radioUrl.getModel())) {
+				final String url = fieldUrl.getText();
+				try {
+					DataflowInfo opened = fileManager.openDataflowSilently(null, new URL(url));
+					if (checkInterrupted()) {
+						return;
+					}
+					chosenDataflow = opened.getDataflow().getMainWorkflow();
+				} catch (final OpenException e1) {
+					if (!background && !shownWarning) {
+						logger.warn("Could not open source workflow: " + url, e1);
+						shownWarning = true;
+						SwingUtilities.invokeLater(new Runnable() {
+							public void run() {
+								fieldUrl.requestFocus();
+								JOptionPane.showMessageDialog(
+										parentComponent,
+										"An error occured while trying to open " + url + "\n"
+												+ e1.getMessage(), "Could not open workflow",
+										JOptionPane.WARNING_MESSAGE);
+								setVisible(true);
+							}
+						});
+
+					}
+					if (checkInterrupted()) {
+						return;
+					}
+				} catch (final MalformedURLException e1) {
+					if (!background && !shownWarning) {
+						logger.warn("Invalid workflow URL: " + url, e1);
+						shownWarning = true;
+						SwingUtilities.invokeLater(new Runnable() {
+							public void run() {
+								fieldUrl.requestFocus();
+								JOptionPane.showMessageDialog(
+										parentComponent,
+										"The workflow location " + url + " is invalid\n"
+												+ e1.getLocalizedMessage(), "Invalid URL",
+										JOptionPane.ERROR_MESSAGE);
+								setVisible(true);
+							}
+						});
+					}
+					if (checkInterrupted()) {
+						return;
+					}
+				}
+			} else if (selection.equals(radioOpened.getModel())) {
+				DataflowSelection chosen = (DataflowSelection) chooseDataflow.getSelectedItem();
+				chosenDataflow = chosen.getDataflow().getMainWorkflow();
+			} else if (selection.equals(radioCustomSource.getModel())) {
+				chosenDataflow = customSourceDataFlow.getMainWorkflow();
+			} else {
+				logger.error("Unknown selection " + selection);
+			}
+			if (checkInterrupted()) {
+				return;
+			}
+			if (chosenDataflow != ImportWorkflowWizard.this.sourceWorkflow) {
+				Profile chosenProfile = null;
+				if (chosenDataflow != null) {
+					chosenProfile = chosenDataflow.getParent().getMainProfile();
+				}
+				updateWorkflowGraphic(previewSource, chosenDataflow, chosenProfile);
+				if (checkInterrupted()) {
+					return;
+				}
+				ImportWorkflowWizard.this.sourceWorkflow = chosenDataflow;
+			}
+			if (chosenDataflow == null) {
+				if (!background && !shownWarning) {
+					shownWarning = true;
+					SwingUtilities.invokeLater(new Runnable() {
+						public void run() {
+							JOptionPane.showMessageDialog(parentComponent,
+									"You need to choose a workflow for merging",
+									"No workflow chosen", JOptionPane.ERROR_MESSAGE);
+							setVisible(true);
+						}
+					});
+				}
+			}
+		}
+
+		private boolean checkInterrupted() {
+			if (Thread.interrupted() || this.shouldStop) {
+				// ImportWorkflowWizard.this.chosenDataflow = null;
+				return true;
+			}
+			return false;
+		}
+	}
+
+	public static class DataflowSelection {
+		private final WorkflowBundle dataflow;
+		private final String name;
+
+		public DataflowSelection(WorkflowBundle dataflow, String name) {
+			this.dataflow = dataflow;
+			this.name = name;
+		}
+
+		public WorkflowBundle getDataflow() {
+			return dataflow;
+		}
+
+		public String getName() {
+			return name;
+		}
+
+		@Override
+		public String toString() {
+			return name;
+		}
+
+	}
+
+	protected class UpdateChosenListener implements ActionListener {
+		public void actionPerformed(ActionEvent e) {
+			Component parentComponent;
+			if (e.getSource() instanceof Component) {
+				parentComponent = (Component) e.getSource();
+			} else {
+				parentComponent = null;
+			}
+			findChosenDataflow(parentComponent, true);
+
+		}
+	}
+
+	public void setCustomSourceDataflow(WorkflowBundle sourceDataflow, String label) {
+		this.customSourceDataFlow = sourceDataflow;
+		this.customSourceName = label;
+		updateSourceSection();
+		radioCustomSource.doClick();
+	}
+
+//	public void setCustomDestinationDataflow(Workflow destinationDataflow, String label) {
+//		this.customDestinationDataflow = destinationDataflow;
+//		this.customDestinationName = label;
+//		updateDestinationSection();
+//		radioCustomDestination.doClick();
+//	}
+
+//	public void setDestinationEnabled(boolean destinationEnabled) {
+//		this.destinationEnabled = destinationEnabled;
+//		updateDestinationSection();
+//	}
+
+	public void setSourceEnabled(boolean sourceEnabled) {
+		this.sourceEnabled = sourceEnabled;
+		updateSourceSection();
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-dataflow-activity-ui/src/main/java/org/apache/taverna/workbench/file/importworkflow/menu/AddNestedWorkflowMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-dataflow-activity-ui/src/main/java/org/apache/taverna/workbench/file/importworkflow/menu/AddNestedWorkflowMenuAction.java b/taverna-dataflow-activity-ui/src/main/java/org/apache/taverna/workbench/file/importworkflow/menu/AddNestedWorkflowMenuAction.java
new file mode 100644
index 0000000..759d24a
--- /dev/null
+++ b/taverna-dataflow-activity-ui/src/main/java/org/apache/taverna/workbench/file/importworkflow/menu/AddNestedWorkflowMenuAction.java
@@ -0,0 +1,104 @@
+/*******************************************************************************
+ * 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 org.apache.taverna.workbench.file.importworkflow.menu;
+
+import java.awt.event.InputEvent;
+import java.awt.event.KeyEvent;
+import java.net.URI;
+
+import javax.swing.Action;
+import javax.swing.KeyStroke;
+
+import org.apache.taverna.ui.menu.AbstractMenuAction;
+import org.apache.taverna.ui.menu.MenuManager;
+import org.apache.taverna.workbench.configuration.colour.ColourManager;
+import org.apache.taverna.workbench.configuration.workbench.WorkbenchConfiguration;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.file.FileManager;
+import org.apache.taverna.workbench.file.importworkflow.actions.AddNestedWorkflowAction;
+import org.apache.taverna.workbench.selection.SelectionManager;
+import net.sf.taverna.t2.workbench.views.graph.menu.InsertMenu;
+
+/**
+ * An action to add a nested workflow activity + a wrapping processor to the
+ * workflow.
+ *
+ * @author Alex Nenadic
+ * @author Stian Soiland-Reyes
+ *
+ */
+public class AddNestedWorkflowMenuAction extends AbstractMenuAction {
+
+	private static final String ADD_NESTED_WORKFLOW = "Nested workflow";
+
+	private static final URI ADD_NESTED_WORKFLOW_URI = URI
+			.create("http://taverna.sf.net/2008/t2workbench/menu#graphMenuAddNestedWorkflow");
+
+	private EditManager editManager;
+	private FileManager fileManager;
+	private MenuManager menuManager;
+	private ColourManager colourManager;
+	private WorkbenchConfiguration workbenchConfiguration;
+	private SelectionManager selectionManager;
+
+	public AddNestedWorkflowMenuAction() {
+		super(InsertMenu.INSERT, 400, ADD_NESTED_WORKFLOW_URI);
+	}
+
+	@Override
+	protected Action createAction() {
+		AddNestedWorkflowAction a = new AddNestedWorkflowAction(editManager, fileManager,
+				menuManager, colourManager, workbenchConfiguration, selectionManager);
+		// Override name to avoid "Add "
+		a.putValue(Action.NAME, ADD_NESTED_WORKFLOW);
+		a.putValue(Action.SHORT_DESCRIPTION, ADD_NESTED_WORKFLOW);
+		a.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(
+				KeyEvent.VK_N, InputEvent.SHIFT_DOWN_MASK
+						| InputEvent.ALT_DOWN_MASK));
+		return a;
+
+	}
+
+	public void setEditManager(EditManager editManager) {
+		this.editManager = editManager;
+	}
+
+	public void setFileManager(FileManager fileManager) {
+		this.fileManager = fileManager;
+	}
+
+	public void setMenuManager(MenuManager menuManager) {
+		this.menuManager = menuManager;
+	}
+
+	public void setColourManager(ColourManager colourManager) {
+		this.colourManager = colourManager;
+	}
+
+	public void setWorkbenchConfiguration(WorkbenchConfiguration workbenchConfiguration) {
+		this.workbenchConfiguration = workbenchConfiguration;
+	}
+
+	public void setSelectionManager(SelectionManager selectionManager) {
+		this.selectionManager = selectionManager;
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-dataflow-activity-ui/src/main/java/org/apache/taverna/workbench/file/importworkflow/menu/ImportWorkflowMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-dataflow-activity-ui/src/main/java/org/apache/taverna/workbench/file/importworkflow/menu/ImportWorkflowMenuAction.java b/taverna-dataflow-activity-ui/src/main/java/org/apache/taverna/workbench/file/importworkflow/menu/ImportWorkflowMenuAction.java
new file mode 100644
index 0000000..48870ca
--- /dev/null
+++ b/taverna-dataflow-activity-ui/src/main/java/org/apache/taverna/workbench/file/importworkflow/menu/ImportWorkflowMenuAction.java
@@ -0,0 +1,98 @@
+/*******************************************************************************
+ * 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 org.apache.taverna.workbench.file.importworkflow.menu;
+
+import java.net.URI;
+
+import javax.swing.Action;
+
+import org.apache.taverna.ui.menu.AbstractContextualMenuAction;
+import org.apache.taverna.ui.menu.MenuManager;
+import org.apache.taverna.workbench.configuration.colour.ColourManager;
+import org.apache.taverna.workbench.configuration.workbench.WorkbenchConfiguration;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.file.FileManager;
+import org.apache.taverna.workbench.file.importworkflow.actions.ImportWorkflowAction;
+import org.apache.taverna.workbench.selection.SelectionManager;
+import org.apache.taverna.scufl2.api.core.Workflow;
+
+/**
+ * An action to import nested/merged workflows.
+ *
+ * @author Alex Nenadic
+ * @author Stian Soiland-Reyes
+ *
+ */
+public class ImportWorkflowMenuAction extends AbstractContextualMenuAction {
+
+	private static final URI insertSection = URI
+			.create("http://taverna.sf.net/2009/contextMenu/insert");
+
+	private EditManager editManager;
+	private FileManager fileManager;
+	private MenuManager menuManager;
+	private ColourManager colourManager;
+	private WorkbenchConfiguration workbenchConfiguration;
+	private SelectionManager selectionManager;
+
+	public ImportWorkflowMenuAction() {
+		super(insertSection, 400);
+	}
+
+	@Override
+	public boolean isEnabled() {
+		return super.isEnabled() && getContextualSelection().getSelection() instanceof Workflow;
+	}
+
+	@Override
+	protected Action createAction() {
+		ImportWorkflowAction myAction = new ImportWorkflowAction(editManager, fileManager,
+				menuManager, colourManager, workbenchConfiguration, selectionManager);
+		// Just "Workflow" as we go under the "Insert" menu
+		myAction.putValue(Action.NAME, "Nested workflow");
+		return myAction;
+	}
+
+	public void setEditManager(EditManager editManager) {
+		this.editManager = editManager;
+	}
+
+	public void setFileManager(FileManager fileManager) {
+		this.fileManager = fileManager;
+	}
+
+	public void setMenuManager(MenuManager menuManager) {
+		this.menuManager = menuManager;
+	}
+
+	public void setColourManager(ColourManager colourManager) {
+		this.colourManager = colourManager;
+	}
+
+	public void setWorkbenchConfiguration(WorkbenchConfiguration workbenchConfiguration) {
+		this.workbenchConfiguration = workbenchConfiguration;
+	}
+
+	public void setSelectionManager(SelectionManager selectionManager) {
+		this.selectionManager = selectionManager;
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-dataflow-activity-ui/src/main/java/org/apache/taverna/workbench/file/importworkflow/menu/MergeWorkflowMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-dataflow-activity-ui/src/main/java/org/apache/taverna/workbench/file/importworkflow/menu/MergeWorkflowMenuAction.java b/taverna-dataflow-activity-ui/src/main/java/org/apache/taverna/workbench/file/importworkflow/menu/MergeWorkflowMenuAction.java
new file mode 100644
index 0000000..05cf1f5
--- /dev/null
+++ b/taverna-dataflow-activity-ui/src/main/java/org/apache/taverna/workbench/file/importworkflow/menu/MergeWorkflowMenuAction.java
@@ -0,0 +1,65 @@
+package org.apache.taverna.workbench.file.importworkflow.menu;
+
+import java.net.URI;
+
+import javax.swing.Action;
+
+import org.apache.taverna.ui.menu.AbstractMenuAction;
+import org.apache.taverna.ui.menu.MenuManager;
+import org.apache.taverna.workbench.configuration.colour.ColourManager;
+import org.apache.taverna.workbench.configuration.workbench.WorkbenchConfiguration;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.file.FileManager;
+import org.apache.taverna.workbench.file.importworkflow.actions.MergeWorkflowAction;
+import org.apache.taverna.workbench.selection.SelectionManager;
+
+public class MergeWorkflowMenuAction extends AbstractMenuAction {
+
+	public static final URI INSERT_URI = URI
+			.create("http://taverna.sf.net/2008/t2workbench/menu#insert");
+
+	public static final URI IMPORT_URI = URI
+			.create("http://taverna.sf.net/2008/t2workbench/menu#insert");
+
+	private EditManager editManager;
+	private FileManager fileManager;
+	private MenuManager menuManager;
+	private ColourManager colourManager;
+	private WorkbenchConfiguration workbenchConfiguration;
+	private SelectionManager selectionManager;
+
+	public MergeWorkflowMenuAction() {
+		super(INSERT_URI, 2000, IMPORT_URI);
+	}
+
+	@Override
+	protected Action createAction() {
+		return new MergeWorkflowAction(editManager, fileManager, menuManager, colourManager,
+				workbenchConfiguration, selectionManager);
+	}
+
+	public void setEditManager(EditManager editManager) {
+		this.editManager = editManager;
+	}
+
+	public void setFileManager(FileManager fileManager) {
+		this.fileManager = fileManager;
+	}
+
+	public void setMenuManager(MenuManager menuManager) {
+		this.menuManager = menuManager;
+	}
+
+	public void setColourManager(ColourManager colourManager) {
+		this.colourManager = colourManager;
+	}
+
+	public void setWorkbenchConfiguration(WorkbenchConfiguration workbenchConfiguration) {
+		this.workbenchConfiguration = workbenchConfiguration;
+	}
+
+	public void setSelectionManager(SelectionManager selectionManager) {
+		this.selectionManager = selectionManager;
+	}
+
+}


[14/51] [partial] incubator-taverna-workbench git commit: all packages are moved to org.apache.taverna.*

Posted by re...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-graph-model/src/main/java/org/apache/taverna/workbench/models/graph/GraphController.java
----------------------------------------------------------------------
diff --git a/taverna-graph-model/src/main/java/org/apache/taverna/workbench/models/graph/GraphController.java b/taverna-graph-model/src/main/java/org/apache/taverna/workbench/models/graph/GraphController.java
new file mode 100644
index 0000000..fd002f3
--- /dev/null
+++ b/taverna-graph-model/src/main/java/org/apache/taverna/workbench/models/graph/GraphController.java
@@ -0,0 +1,1276 @@
+/*******************************************************************************
+ * 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 org.apache.taverna.workbench.models.graph;
+
+import static javax.swing.JOptionPane.PLAIN_MESSAGE;
+import static javax.swing.JOptionPane.showInputDialog;
+import static javax.swing.JOptionPane.showMessageDialog;
+
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.Dimension;
+import java.awt.Point;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+
+import org.apache.taverna.lang.observer.Observable;
+import org.apache.taverna.lang.observer.Observer;
+import org.apache.taverna.ui.menu.MenuManager;
+import org.apache.taverna.workbench.configuration.colour.ColourManager;
+import org.apache.taverna.workbench.edits.CompoundEdit;
+import org.apache.taverna.workbench.edits.Edit;
+import org.apache.taverna.workbench.edits.EditException;
+import org.apache.taverna.workbench.edits.EditManager;
+import org.apache.taverna.workbench.models.graph.Graph.Alignment;
+import org.apache.taverna.workbench.models.graph.GraphEdge.ArrowStyle;
+import org.apache.taverna.workbench.models.graph.GraphElement.LineStyle;
+import org.apache.taverna.workbench.models.graph.GraphShapeElement.Shape;
+import org.apache.taverna.workbench.selection.DataflowSelectionModel;
+import org.apache.taverna.workbench.selection.events.DataflowSelectionMessage;
+import org.apache.taverna.workflow.edits.AddDataLinkEdit;
+import org.apache.taverna.workflow.edits.RemoveDataLinkEdit;
+
+import org.apache.log4j.Logger;
+
+import org.apache.taverna.scufl2.api.activity.Activity;
+import org.apache.taverna.scufl2.api.common.NamedSet;
+import org.apache.taverna.scufl2.api.common.Scufl2Tools;
+import org.apache.taverna.scufl2.api.common.WorkflowBean;
+import org.apache.taverna.scufl2.api.core.BlockingControlLink;
+import org.apache.taverna.scufl2.api.core.ControlLink;
+import org.apache.taverna.scufl2.api.core.DataLink;
+import org.apache.taverna.scufl2.api.core.Processor;
+import org.apache.taverna.scufl2.api.core.Workflow;
+import org.apache.taverna.scufl2.api.port.InputActivityPort;
+import org.apache.taverna.scufl2.api.port.InputPort;
+import org.apache.taverna.scufl2.api.port.InputProcessorPort;
+import org.apache.taverna.scufl2.api.port.InputWorkflowPort;
+import org.apache.taverna.scufl2.api.port.OutputActivityPort;
+import org.apache.taverna.scufl2.api.port.OutputPort;
+import org.apache.taverna.scufl2.api.port.OutputProcessorPort;
+import org.apache.taverna.scufl2.api.port.OutputWorkflowPort;
+import org.apache.taverna.scufl2.api.port.Port;
+import org.apache.taverna.scufl2.api.port.ProcessorPort;
+import org.apache.taverna.scufl2.api.port.ReceiverPort;
+import org.apache.taverna.scufl2.api.port.SenderPort;
+import org.apache.taverna.scufl2.api.port.WorkflowPort;
+import org.apache.taverna.scufl2.api.profiles.ProcessorBinding;
+import org.apache.taverna.scufl2.api.profiles.Profile;
+
+/**
+ * @author David Withers
+ */
+public abstract class GraphController implements
+		Observer<DataflowSelectionMessage> {
+	public enum PortStyle {
+		ALL {
+			@Override
+			Shape inputShape() {
+				return Shape.INVHOUSE;
+			}
+
+			@Override
+			Shape outputShape() {
+				return Shape.HOUSE;
+			}
+
+			@Override
+			Shape processorShape() {
+				return Shape.RECORD;
+			}
+		},
+		BOUND {
+			@Override
+			Shape inputShape() {
+				return Shape.INVHOUSE;
+			}
+
+			@Override
+			Shape outputShape() {
+				return Shape.HOUSE;
+			}
+
+			@Override
+			Shape processorShape() {
+				return Shape.RECORD;
+			}
+		},
+		NONE {
+			@Override
+			Shape inputShape() {
+				return Shape.BOX;
+			}
+
+			@Override
+			Shape outputShape() {
+				return Shape.BOX;
+			}
+
+			@Override
+			Shape processorShape() {
+				return Shape.BOX;
+			}
+		},
+		BLOB {
+			@Override
+			Shape inputShape() {
+				return Shape.CIRCLE;
+			}
+
+			@Override
+			Shape outputShape() {
+				return Shape.CIRCLE;
+			}
+
+			@Override
+			Shape processorShape() {
+				return Shape.CIRCLE;
+			}
+		};
+
+		abstract Shape inputShape();
+
+		abstract Shape outputShape();
+
+		abstract Shape processorShape();
+
+		Shape mergeShape() {
+			return Shape.CIRCLE;
+		}
+	}
+
+	private static Logger logger = Logger.getLogger(GraphController.class);
+
+	private Map<String, GraphElement> idToElement = new HashMap<>();
+	private Map<WorkflowBean, GraphElement> workflowToGraph = new HashMap<>();
+	private Map<Port, GraphNode> ports = new HashMap<>();
+	private Map<Graph, GraphNode> inputControls = new HashMap<>();
+	private Map<Graph, GraphNode> outputControls = new HashMap<>();
+	private Map<Port, Port> nestedWorkflowPorts = new HashMap<>();
+	private Map<WorkflowPort, ProcessorPort> workflowPortToProcessorPort = new HashMap<>();
+	private Map<Port, Processor> portToProcessor = new HashMap<>();
+
+	private EditManager editManager;
+	private final Workflow workflow;
+	private final Profile profile;
+	private DataflowSelectionModel dataflowSelectionModel;
+	private GraphEventManager graphEventManager;
+	private Component componentForPopups;
+
+	// graph settings
+	private PortStyle portStyle = PortStyle.NONE;
+	private Map<Processor, PortStyle> processorPortStyle = new HashMap<>();
+	private Alignment alignment = Alignment.VERTICAL;
+	private boolean expandNestedDataflows = true;
+	private Map<Activity, Boolean> dataflowExpansion = new HashMap<>();
+	protected Map<String, GraphElement> graphElementMap = new HashMap<>();
+	protected GraphElement edgeCreationSource, edgeCreationSink;
+	protected GraphEdge edgeMoveElement;
+	protected boolean edgeCreationFromSource = false;
+	protected boolean edgeCreationFromSink = false;
+	private Graph graph;
+	private boolean interactive;
+	private final ColourManager colourManager;
+
+	private Scufl2Tools scufl2Tools = new Scufl2Tools();
+
+	public GraphController(Workflow workflow, Profile profile,
+			boolean interactive, Component componentForPopups,
+			EditManager editManager, MenuManager menuManager,
+			ColourManager colourManager) {
+		this(workflow, profile, interactive, componentForPopups,
+				Alignment.VERTICAL, PortStyle.NONE, editManager, menuManager,
+				colourManager);
+	}
+
+	public GraphController(Workflow workflow, Profile profile,
+			boolean interactive, Component componentForPopups,
+			Alignment alignment, PortStyle portStyle, EditManager editManager,
+			MenuManager menuManager, ColourManager colourManager) {
+		this.workflow = workflow;
+		this.profile = profile;
+		this.interactive = interactive;
+		this.componentForPopups = componentForPopups;
+		this.alignment = alignment;
+		this.portStyle = portStyle;
+		this.editManager = editManager;
+		this.colourManager = colourManager;
+		this.graphEventManager = new DefaultGraphEventManager(this,
+				componentForPopups, menuManager);
+		graph = generateGraph();
+	}
+
+	public abstract Graph createGraph();
+
+	public abstract GraphNode createGraphNode();
+
+	public abstract GraphEdge createGraphEdge();
+
+	public void mapElement(String id, GraphElement element) {
+		idToElement.put(id, element);
+	}
+
+	public GraphElement getElement(String id) {
+		return idToElement.get(id);
+	}
+
+	public Graph getGraph() {
+		return graph;
+	}
+
+	public abstract void redraw();
+
+	/**
+	 * Generates a graph model of a dataflow.
+	 * 
+	 * @return
+	 */
+	public Graph generateGraph() {
+		workflowToGraph.clear();
+		ports.clear();
+		inputControls.clear();
+		outputControls.clear();
+		nestedWorkflowPorts.clear();
+		workflowPortToProcessorPort.clear();
+		graphElementMap.clear();
+		portToProcessor.clear();
+		return generateGraph(workflow, "", workflow.getName(), 0);
+	}
+
+	private Graph generateGraph(Workflow dataflow, String prefix, String name,
+			int depth) {
+		Graph graph = createGraph();
+		graph.setId(prefix + name);
+		graph.setAlignment(getAlignment());
+		if (getPortStyle().equals(PortStyle.BLOB) || depth == 0)
+			graph.setLabel("");
+		else
+			graph.setLabel(name);
+		graph.setFillColor(GraphColorManager.getSubGraphFillColor(depth));
+		if (depth == 0)
+			graph.setLineStyle(LineStyle.NONE);
+		else
+			graph.setLineStyle(LineStyle.SOLID);
+		graph.setColor(Color.BLACK);
+		graph.setShape(Shape.BOX);
+
+		if (depth == 0)
+			graph.setWorkflowBean(dataflow);
+		if (interactive)
+			graph.setWorkflowBean(dataflow);
+
+		// processors
+		for (Processor processor : dataflow.getProcessors())
+			graph.addNode(generateProcessorNode(processor, graph.getId(), depth));
+
+		// dataflow outputs
+		NamedSet<OutputWorkflowPort> outputPorts = dataflow.getOutputPorts();
+		if (outputPorts.size() > 0 || depth > 0)
+			graph.addSubgraph(generateOutputsGraph(outputPorts, graph.getId(),
+					graph, depth));
+
+		// dataflow inputs
+		NamedSet<InputWorkflowPort> inputPorts = dataflow.getInputPorts();
+		if (inputPorts.size() > 0 || depth > 0)
+			graph.addSubgraph(generateInputsGraph(inputPorts, graph.getId(),
+					graph, depth));
+
+		// datalinks
+		for (DataLink datalink : dataflow.getDataLinks()) {
+			GraphEdge edge = generateDataLinkEdge(datalink, depth);
+			if (edge != null)
+				graph.addEdge(edge);
+		}
+
+		// controlLinks
+		for (ControlLink controlLink : dataflow.getControlLinks())
+			if (controlLink instanceof BlockingControlLink) {
+				GraphEdge edge = generateControlLinkEdge(
+						(BlockingControlLink) controlLink, depth);
+				if (edge != null)
+					graph.addEdge(edge);
+			}
+
+		graphElementMap.put(graph.getId(), graph);
+		return graph;
+	}
+
+	public void transformGraph(Graph oldGraph, Graph newGraph) {
+		oldGraph.setAlignment(newGraph.getAlignment());
+		transformGraphElement(oldGraph, newGraph);
+		List<GraphEdge> oldEdges = new ArrayList<>(oldGraph.getEdges());
+		List<GraphEdge> newEdges = new ArrayList<>(newGraph.getEdges());
+		for (GraphEdge oldEdge : oldEdges) {
+			int index = newEdges.indexOf(oldEdge);
+			if (index >= 0) {
+				GraphEdge newEdge = newEdges.remove(index);
+				oldEdge.setPath(newEdge.getPath());
+				workflowToGraph.put(oldEdge.getWorkflowBean(), oldEdge);
+			} else
+				oldGraph.removeEdge(oldEdge);
+		}
+		List<GraphNode> newNodes = new ArrayList<>(newGraph.getNodes());
+		List<GraphNode> oldNodes = new ArrayList<>(oldGraph.getNodes());
+		for (GraphNode oldNode : oldNodes) {
+			int index = newNodes.indexOf(oldNode);
+			if (index >= 0) {
+				GraphNode newNode = newNodes.remove(index);
+				oldNode.setExpanded(newNode.isExpanded());
+				List<GraphNode> newSourceNodes = new ArrayList<>(
+						newNode.getSourceNodes());
+				List<GraphNode> oldSourceNodes = new ArrayList<>(
+						oldNode.getSourceNodes());
+				for (GraphNode oldSourceNode : oldSourceNodes) {
+					int sourceNodeIndex = newSourceNodes.indexOf(oldSourceNode);
+					if (sourceNodeIndex >= 0) {
+						GraphNode newSourceNode = newSourceNodes
+								.remove(sourceNodeIndex);
+						transformGraphElement(oldSourceNode, newSourceNode);
+					} else
+						oldNode.removeSourceNode(oldSourceNode);
+				}
+				for (GraphNode sourceNode : newSourceNodes)
+					oldNode.addSourceNode(sourceNode);
+				List<GraphNode> newSinkNodes = new ArrayList<>(
+						newNode.getSinkNodes());
+				List<GraphNode> oldSinkNodes = new ArrayList<>(
+						oldNode.getSinkNodes());
+				for (GraphNode oldSinkNode : oldSinkNodes) {
+					int sinkNodeIndex = newSinkNodes.indexOf(oldSinkNode);
+					if (sinkNodeIndex >= 0) {
+						GraphNode newSinkNode = newSinkNodes
+								.remove(sinkNodeIndex);
+						transformGraphElement(oldSinkNode, newSinkNode);
+					} else
+						oldNode.removeSinkNode(oldSinkNode);
+				}
+				for (GraphNode sinkNode : newSinkNodes)
+					oldNode.addSinkNode(sinkNode);
+				Graph oldSubGraph = oldNode.getGraph();
+				Graph newSubGraph = newNode.getGraph();
+				if (oldSubGraph != null && newSubGraph != null)
+					transformGraph(oldSubGraph, newSubGraph);
+				transformGraphElement(oldNode, newNode);
+			} else
+				oldGraph.removeNode(oldNode);
+		}
+		List<Graph> newSubGraphs = new ArrayList<>(newGraph.getSubgraphs());
+		List<Graph> oldSubGraphs = new ArrayList<>(oldGraph.getSubgraphs());
+		for (Graph oldSubGraph : oldSubGraphs) {
+			int index = newSubGraphs.indexOf(oldSubGraph);
+			if (index >= 0) {
+				Graph newSubGraph = newSubGraphs.remove(index);
+				transformGraph(oldSubGraph, newSubGraph);
+			} else
+				oldGraph.removeSubgraph(oldSubGraph);
+		}
+		for (GraphNode node : newNodes)
+			oldGraph.addNode(node);
+		for (Graph graph : newSubGraphs)
+			oldGraph.addSubgraph(graph);
+		for (GraphEdge newEdge : newEdges)
+			oldGraph.addEdge(newEdge);
+	}
+
+	public void transformGraphElement(GraphShapeElement oldGraphElement,
+			GraphShapeElement newGraphElement) {
+		oldGraphElement.setWorkflowBean(newGraphElement.getWorkflowBean());
+		oldGraphElement.setShape(newGraphElement.getShape());
+		oldGraphElement.setSize(newGraphElement.getSize());
+		oldGraphElement.setPosition(newGraphElement.getPosition());
+		oldGraphElement.setLabel(newGraphElement.getLabel());
+		oldGraphElement.setLabelPosition(newGraphElement.getLabelPosition());
+		oldGraphElement.setLineStyle(newGraphElement.getLineStyle());
+		oldGraphElement.setOpacity(newGraphElement.getOpacity());
+		oldGraphElement.setVisible(newGraphElement.isVisible());
+		oldGraphElement.setColor(newGraphElement.getColor());
+		oldGraphElement.setFillColor(newGraphElement.getFillColor());
+		workflowToGraph.put(oldGraphElement.getWorkflowBean(), oldGraphElement);
+	}
+
+	public void filterGraph(Set<?> dataflowEntities) {
+		Set<GraphElement> graphElements = new HashSet<>();
+		for (Entry<WorkflowBean, GraphElement> entry : workflowToGraph
+				.entrySet())
+			if (!dataflowEntities.contains(entry.getKey()))
+				graphElements.add(entry.getValue());
+		filterGraph(getGraph(), graphElements);
+	}
+
+	private void filterGraph(Graph graph, Set<GraphElement> graphElements) {
+		for (GraphNode node : graph.getNodes()) {
+			node.setFiltered(graphElements.contains(node));
+			Graph subgraph = node.getGraph();
+			if (subgraph != null)
+				if (graphElements.contains(subgraph)) {
+					removeFilter(subgraph);
+					subgraph.setFiltered(true);
+				} else {
+					subgraph.setFiltered(false);
+					filterGraph(subgraph, graphElements);
+				}
+		}
+		for (GraphEdge edge : graph.getEdges())
+			edge.setFiltered(graphElements.contains(edge));
+		for (Graph subgraph : graph.getSubgraphs())
+			if (graphElements.contains(subgraph)) {
+				removeFilter(subgraph);
+				subgraph.setFiltered(true);
+			} else {
+				subgraph.setFiltered(false);
+				filterGraph(subgraph, graphElements);
+			}
+	}
+
+	public void removeFilter() {
+		for (Entry<WorkflowBean, GraphElement> entry : workflowToGraph
+				.entrySet())
+			entry.getValue().setFiltered(false);
+	}
+
+	private void removeFilter(Graph graph) {
+		for (GraphNode node : graph.getNodes()) {
+			node.setOpacity(1f);
+			Graph subgraph = node.getGraph();
+			if (subgraph != null) {
+				subgraph.setFiltered(false);
+				removeFilter(subgraph);
+			}
+		}
+		for (GraphEdge edge : graph.getEdges())
+			edge.setFiltered(false);
+		for (Graph subgraph : graph.getSubgraphs()) {
+			subgraph.setFiltered(false);
+			removeFilter(subgraph);
+		}
+	}
+
+	private GraphEdge generateControlLinkEdge(BlockingControlLink condition,
+			int depth) {
+		GraphEdge edge = null;
+		GraphElement source = workflowToGraph.get(condition.getUntilFinished());
+		GraphElement sink = workflowToGraph.get(condition.getBlock());
+		if (source != null && sink != null) {
+			edge = createGraphEdge();
+			if (source instanceof Graph)
+				edge.setSource(outputControls.get(source));
+			else if (source instanceof GraphNode)
+				edge.setSource((GraphNode) source);
+			if (sink instanceof Graph)
+				edge.setSink(inputControls.get(sink));
+			else if (sink instanceof GraphNode)
+				edge.setSink((GraphNode) sink);
+			String sourceId = edge.getSource().getId();
+			String sinkId = edge.getSink().getId();
+			edge.setId(sourceId + "->" + sinkId);
+			edge.setLineStyle(LineStyle.SOLID);
+			edge.setColor(Color.decode("#505050"));
+			edge.setFillColor(null);
+			edge.setArrowHeadStyle(ArrowStyle.DOT);
+			if (depth == 0)
+				edge.setWorkflowBean(condition);
+			if (interactive)
+				edge.setWorkflowBean(condition);
+			workflowToGraph.put(condition, edge);
+			graphElementMap.put(edge.getId(), edge);
+		}
+		return edge;
+	}
+
+	private GraphEdge generateDataLinkEdge(DataLink datalink, int depth) {
+		GraphEdge edge = null;
+		Port sourcePort = datalink.getReceivesFrom();
+		Port sinkPort = datalink.getSendsTo();
+		if (nestedWorkflowPorts.containsKey(sourcePort))
+			sourcePort = nestedWorkflowPorts.get(sourcePort);
+		if (nestedWorkflowPorts.containsKey(sinkPort))
+			sinkPort = nestedWorkflowPorts.get(sinkPort);
+		GraphNode sourceNode = ports.get(sourcePort);
+		GraphNode sinkNode = ports.get(sinkPort);
+		if (sourceNode != null && sinkNode != null) {
+			edge = createGraphEdge();
+			edge.setSource(sourceNode);
+			edge.setSink(sinkNode);
+
+			StringBuilder id = new StringBuilder();
+			if (sourceNode.getParent() instanceof GraphNode) {
+				id.append(sourceNode.getParent().getId());
+				id.append(":");
+				id.append(sourceNode.getId());
+			} else
+				id.append(sourceNode.getId());
+			id.append("->");
+			if (sinkNode.getParent() instanceof GraphNode) {
+				id.append(sinkNode.getParent().getId());
+				id.append(":");
+				id.append(sinkNode.getId());
+			} else
+				id.append(sinkNode.getId());
+			edge.setId(id.toString());
+			edge.setLineStyle(LineStyle.SOLID);
+			edge.setColor(Color.BLACK);
+			edge.setFillColor(Color.BLACK);
+			if (depth == 0)
+				edge.setWorkflowBean(datalink);
+			if (interactive)
+				edge.setWorkflowBean(datalink);
+			workflowToGraph.put(datalink, edge);
+			graphElementMap.put(edge.getId(), edge);
+		}
+		return edge;
+	}
+
+	private Graph generateInputsGraph(NamedSet<InputWorkflowPort> inputPorts,
+			String prefix, Graph graph, int depth) {
+		Graph inputs = createGraph();
+		inputs.setId(prefix + "sources");
+		inputs.setColor(Color.BLACK);
+		inputs.setFillColor(null);
+		inputs.setShape(Shape.BOX);
+		inputs.setLineStyle(LineStyle.DOTTED);
+		if (getPortStyle().equals(PortStyle.BLOB))
+			inputs.setLabel("");
+		else
+			inputs.setLabel("Workflow input ports");
+
+		GraphNode triangle = createGraphNode();
+		triangle.setId(prefix + "WORKFLOWINTERNALSOURCECONTROL");
+		triangle.setLabel("");
+		triangle.setShape(Shape.TRIANGLE);
+		triangle.setSize(new Dimension((int) (0.2f * 72), (int) ((Math.sin(Math
+				.toRadians(60)) * 0.2) * 72)));
+		triangle.setFillColor(Color.decode("#ff4040"));
+		triangle.setColor(Color.BLACK);
+		triangle.setLineStyle(LineStyle.SOLID);
+		inputs.addNode(triangle);
+		inputControls.put(graph, triangle);
+
+		for (InputWorkflowPort inputWorkflowPort : inputPorts) {
+			GraphNode inputNode = createGraphNode();
+			inputNode.setId(prefix + "WORKFLOWINTERNALSOURCE_"
+					+ inputWorkflowPort.getName());
+			if (getPortStyle().equals(PortStyle.BLOB)) {
+				inputNode.setLabel("");
+				inputNode.setSize(new Dimension((int) (0.3f * 72),
+						(int) (0.3f * 72)));
+			} else
+				inputNode.setLabel(inputWorkflowPort.getName());
+			inputNode.setShape(getPortStyle().inputShape());
+			inputNode.setColor(Color.BLACK);
+			inputNode.setLineStyle(LineStyle.SOLID);
+			inputNode.setFillColor(Color.decode("#8ed6f0"));
+			if (depth == 0)
+				inputNode.setInteractive(true);
+			if (interactive)
+				inputNode.setInteractive(true);
+			if (depth < 2) {
+				inputNode.setWorkflowBean(inputWorkflowPort);
+				if (workflowPortToProcessorPort.containsKey(inputWorkflowPort)) {
+					ProcessorPort port = workflowPortToProcessorPort
+							.get(inputWorkflowPort);
+					inputNode.setWorkflowBean(port);
+					workflowToGraph.put(port, inputNode);
+				} else {
+					inputNode.setWorkflowBean(inputWorkflowPort);
+					workflowToGraph.put(inputWorkflowPort, inputNode);
+				}
+			}
+			ports.put(inputWorkflowPort, inputNode);
+			inputs.addNode(inputNode);
+			graphElementMap.put(inputNode.getId(), inputNode);
+		}
+		return inputs;
+	}
+
+	private Graph generateOutputsGraph(
+			NamedSet<OutputWorkflowPort> outputPorts, String prefix,
+			Graph graph, int depth) {
+		Graph outputs = createGraph();
+		outputs.setId(prefix + "sinks");
+		outputs.setColor(Color.BLACK);
+		outputs.setFillColor(null);
+		outputs.setShape(Shape.BOX);
+		outputs.setLineStyle(LineStyle.DOTTED);
+		if (getPortStyle().equals(PortStyle.BLOB))
+			outputs.setLabel("");
+		else
+			outputs.setLabel("Workflow output ports");
+
+		GraphNode triangle = createGraphNode();
+		triangle.setId(prefix + "WORKFLOWINTERNALSINKCONTROL");
+		triangle.setLabel("");
+		triangle.setShape(Shape.INVTRIANGLE);
+		triangle.setSize(new Dimension((int) (0.2f * 72), (int) ((Math.sin(Math
+				.toRadians(60)) * 0.2) * 72)));
+		triangle.setFillColor(Color.decode("#66cd00"));
+		triangle.setColor(Color.BLACK);
+		triangle.setLineStyle(LineStyle.SOLID);
+		outputs.addNode(triangle);
+		outputControls.put(graph, triangle);
+
+		for (OutputWorkflowPort outputWorkflowPort : outputPorts) {
+			GraphNode outputNode = createGraphNode();
+			outputNode.setId(prefix + "WORKFLOWINTERNALSINK_"
+					+ outputWorkflowPort.getName());
+			if (getPortStyle().equals(PortStyle.BLOB)) {
+				outputNode.setLabel("");
+				outputNode.setSize(new Dimension((int) (0.3f * 72),
+						(int) (0.3f * 72)));
+			} else
+				outputNode.setLabel(outputWorkflowPort.getName());
+			outputNode.setShape(getPortStyle().outputShape());
+			outputNode.setColor(Color.BLACK);
+			outputNode.setLineStyle(LineStyle.SOLID);
+			outputNode.setFillColor(Color.decode("#8ed6f0"));
+			if (depth == 0)
+				outputNode.setInteractive(true);
+			if (interactive)
+				outputNode.setInteractive(true);
+			if (depth < 2) {
+				if (workflowPortToProcessorPort.containsKey(outputWorkflowPort)) {
+					ProcessorPort port = workflowPortToProcessorPort
+							.get(outputWorkflowPort);
+					outputNode.setWorkflowBean(port);
+					workflowToGraph.put(port, outputNode);
+				} else {
+					outputNode.setWorkflowBean(outputWorkflowPort);
+					workflowToGraph.put(outputWorkflowPort, outputNode);
+				}
+			}
+			ports.put(outputWorkflowPort, outputNode);
+			outputs.addNode(outputNode);
+			graphElementMap.put(outputNode.getId(), outputNode);
+		}
+		return outputs;
+	}
+
+	private GraphNode generateProcessorNode(Processor processor, String prefix,
+			int depth) {
+		// Blatantly ignoring any other activities for now
+		ProcessorBinding processorBinding = scufl2Tools
+				.processorBindingForProcessor(processor, profile);
+		Activity activity = processorBinding.getBoundActivity();
+		@SuppressWarnings("unused")
+		URI activityType = activity.getType();
+
+		GraphNode node = createGraphNode();
+		node.setId(prefix + processor.getName());
+		if (getPortStyle().equals(PortStyle.BLOB)) {
+			node.setLabel("");
+			node.setSize(new Dimension((int) (0.3f * 72), (int) (0.3f * 72)));
+		} else
+			node.setLabel(processor.getName());
+		node.setShape(getPortStyle(processor).processorShape());
+		node.setColor(Color.BLACK);
+		node.setLineStyle(LineStyle.SOLID);
+		// if (activityType.equals(URI.create(NonExecutableActivity.URI))) {
+		// if (activityType.equals(URI.create(DisabledActivity.URI))) {
+		// node.setFillColor(GraphColorManager
+		// .getFillColor(((DisabledActivity) activity)
+		// .getActivity(), colourManager));
+		// } else {
+		// node.setFillColor(GraphColorManager
+		// .getFillColor(activityType, colourManager));
+		// }
+		// node.setOpacity(0.3f);
+		// } else
+		node.setFillColor(GraphColorManager.getFillColor(activity,
+				colourManager));
+
+		// check whether the nested workflow processors should be clickable or
+		// not, if top level workflow then should be clickable regardless
+		if (depth == 0) {
+			node.setInteractive(true);
+			node.setWorkflowBean(processor);
+		}
+		if (interactive) {
+			node.setInteractive(true);
+			node.setWorkflowBean(processor);
+		}
+
+		if (scufl2Tools.containsNestedWorkflow(processor, profile)
+				&& expandNestedDataflow(activity)) {
+			Workflow subDataflow = scufl2Tools.nestedWorkflowForProcessor(
+					processor, profile);
+
+			NamedSet<InputWorkflowPort> inputWorkflowPorts = subDataflow
+					.getInputPorts();
+			for (InputActivityPort inputActivityPort : activity.getInputPorts()) {
+				InputWorkflowPort inputWorkflowPort = inputWorkflowPorts
+						.getByName(inputActivityPort.getName());
+				InputProcessorPort inputProcessorPort = scufl2Tools
+						.processorPortBindingForPort(inputActivityPort, profile)
+						.getBoundProcessorPort();
+				nestedWorkflowPorts.put(inputProcessorPort, inputWorkflowPort);
+				workflowPortToProcessorPort.put(inputWorkflowPort,
+						inputProcessorPort);
+				processorBinding.getInputPortBindings();
+			}
+
+			NamedSet<OutputWorkflowPort> outputWorkflowPorts = subDataflow
+					.getOutputPorts();
+			for (OutputActivityPort outputActivityPort : activity
+					.getOutputPorts()) {
+				OutputWorkflowPort outputWorkflowPort = outputWorkflowPorts
+						.getByName(outputActivityPort.getName());
+				OutputProcessorPort outputProcessorPort = scufl2Tools
+						.processorPortBindingForPort(outputActivityPort,
+								profile).getBoundProcessorPort();
+				nestedWorkflowPorts
+						.put(outputProcessorPort, outputWorkflowPort);
+				workflowPortToProcessorPort.put(outputWorkflowPort,
+						outputProcessorPort);
+			}
+
+			Graph subGraph = generateGraph(subDataflow, prefix,
+					processor.getName(), depth + 1);
+			// TODO why does this depth matter?
+			if (depth == 0)
+				subGraph.setWorkflowBean(processor);
+			if (interactive)
+				subGraph.setWorkflowBean(processor);
+			node.setGraph(subGraph);
+			node.setExpanded(true);
+
+			workflowToGraph.put(processor, subGraph);
+		} else {
+			graphElementMap.put(node.getId(), node);
+			workflowToGraph.put(processor, node);
+		}
+
+		NamedSet<InputProcessorPort> inputPorts = processor.getInputPorts();
+		if (inputPorts.size() == 0) {
+			GraphNode portNode = createGraphNode();
+			portNode.setShape(Shape.BOX);
+			portNode.setColor(Color.BLACK);
+			portNode.setFillColor(node.getFillColor());
+			portNode.setLineStyle(LineStyle.SOLID);
+			node.addSinkNode(portNode);
+		} else
+			for (InputPort inputPort : inputPorts) {
+				GraphNode portNode = createGraphNode();
+				portNode.setId("i" + inputPort.getName().replaceAll("\\.", ""));
+				portNode.setLabel(inputPort.getName());
+				portNode.setShape(Shape.BOX);
+				portNode.setColor(Color.BLACK);
+				portNode.setFillColor(node.getFillColor());
+				portNode.setLineStyle(LineStyle.SOLID);
+				if (depth == 0)
+					portNode.setWorkflowBean(inputPort);
+				if (interactive)
+					portNode.setWorkflowBean(inputPort);
+				if (!node.isExpanded())
+					workflowToGraph.put(inputPort, portNode);
+				ports.put(inputPort, portNode);
+				node.addSinkNode(portNode);
+				graphElementMap.put(portNode.getId(), portNode);
+				// portToActivity.put(inputPort, activity);
+				portToProcessor.put(inputPort, processor);
+			}
+
+		NamedSet<OutputProcessorPort> outputPorts = processor.getOutputPorts();
+		if (outputPorts.size() == 0) {
+			GraphNode portNode = createGraphNode();
+			portNode.setShape(Shape.BOX);
+			portNode.setColor(Color.BLACK);
+			portNode.setFillColor(node.getFillColor());
+			portNode.setLineStyle(LineStyle.SOLID);
+			node.addSourceNode(portNode);
+		} else
+			for (OutputPort outputPort : outputPorts) {
+				GraphNode portNode = createGraphNode();
+				portNode.setId("o" + outputPort.getName().replaceAll("\\.", ""));
+				portNode.setLabel(outputPort.getName());
+				portNode.setShape(Shape.BOX);
+				portNode.setColor(Color.BLACK);
+				portNode.setFillColor(node.getFillColor());
+				portNode.setLineStyle(LineStyle.SOLID);
+				if (depth == 0)
+					portNode.setWorkflowBean(outputPort);
+				if (interactive)
+					portNode.setWorkflowBean(outputPort);
+				if (!node.isExpanded())
+					workflowToGraph.put(outputPort, portNode);
+				ports.put(outputPort, portNode);
+				node.addSourceNode(portNode);
+				graphElementMap.put(portNode.getId(), portNode);
+				// portToActivity.put(outputPort, activity);
+				portToProcessor.put(outputPort, processor);
+			}
+
+		return node;
+	}
+
+	/**
+	 * Returns the dataflow.
+	 * 
+	 * @return the dataflow
+	 */
+	public Workflow getWorkflow() {
+		return workflow;
+	}
+
+	public Profile getProfile() {
+		return profile;
+	}
+
+	/**
+	 * Returns the dataflowSelectionModel.
+	 * 
+	 * @return the dataflowSelectionModel
+	 */
+	public DataflowSelectionModel getDataflowSelectionModel() {
+		return dataflowSelectionModel;
+	}
+
+	/**
+	 * Sets the dataflowSelectionModel.
+	 * 
+	 * @param dataflowSelectionModel
+	 *            the new dataflowSelectionModel
+	 */
+	public void setDataflowSelectionModel(
+			DataflowSelectionModel dataflowSelectionModel) {
+		if (this.dataflowSelectionModel != null)
+			this.dataflowSelectionModel.removeObserver(this);
+		this.dataflowSelectionModel = dataflowSelectionModel;
+		this.dataflowSelectionModel.addObserver(this);
+	}
+
+	/**
+	 * Sets the proportion of the node's jobs that have been completed.
+	 * 
+	 * @param nodeId
+	 *            the id of the node
+	 * @param complete
+	 *            the proportion of the nodes's jobs that have been completed, a
+	 *            value between 0.0 and 1.0
+	 */
+	public void setNodeCompleted(String nodeId, float complete) {
+		if (graphElementMap.containsKey(nodeId)) {
+			GraphElement graphElement = graphElementMap.get(nodeId);
+			graphElement.setCompleted(complete);
+		}
+	}
+
+	public void setEdgeActive(String edgeId, boolean active) {
+	}
+
+	/**
+	 * Returns the alignment.
+	 * 
+	 * @return the alignment
+	 */
+	public Alignment getAlignment() {
+		return alignment;
+	}
+
+	/**
+	 * Returns the portStyle.
+	 * 
+	 * @return the portStyle
+	 */
+	public PortStyle getPortStyle() {
+		return portStyle;
+	}
+
+	/**
+	 * Returns the portStyle for a processor.
+	 * 
+	 * @return the portStyle for a processor
+	 */
+	public PortStyle getPortStyle(Processor processor) {
+		if (processorPortStyle.containsKey(processor))
+			return processorPortStyle.get(processor);
+		return portStyle;
+	}
+
+	/**
+	 * Sets the alignment.
+	 * 
+	 * @param alignment
+	 *            the new alignment
+	 */
+	public void setAlignment(Alignment alignment) {
+		this.alignment = alignment;
+	}
+
+	/**
+	 * Sets the portStyle.
+	 * 
+	 * @param style
+	 *            the new portStyle
+	 */
+	public void setPortStyle(PortStyle portStyle) {
+		this.portStyle = portStyle;
+		processorPortStyle.clear();
+	}
+
+	/**
+	 * Sets the portStyle for a processor.
+	 * 
+	 * @param style
+	 *            the new portStyle for the processor
+	 */
+	public void setPortStyle(Processor processor, PortStyle portStyle) {
+		processorPortStyle.put(processor, portStyle);
+	}
+
+	/**
+	 * Shut down any processing and update threads related to this controller.
+	 * 
+	 */
+	public void shutdown() {
+	}
+
+	/**
+	 * Returns true if the default is to expand nested workflows.
+	 * 
+	 * @return true if the default is to expand nested workflows
+	 */
+	public boolean expandNestedDataflows() {
+		return expandNestedDataflows;
+	}
+
+	/**
+	 * Returns true if the nested dataflow should be expanded.
+	 * 
+	 * @param dataflow
+	 * @return true if the nested dataflow should be expanded
+	 */
+	public boolean expandNestedDataflow(Activity dataflow) {
+		if (dataflowExpansion.containsKey(dataflow))
+			return dataflowExpansion.get(dataflow);
+		return expandNestedDataflows;
+	}
+
+	/**
+	 * Sets the default for expanding nested workflows.
+	 * 
+	 * @param expand
+	 *            the default for expanding nested workflows
+	 */
+	public void setExpandNestedDataflows(boolean expand) {
+		dataflowExpansion.clear();
+		this.expandNestedDataflows = expand;
+	}
+
+	/**
+	 * Sets whether the nested dataflow should be expanded.
+	 * 
+	 * @param expand
+	 *            whether the nested dataflow should be expanded
+	 * @param dataflow
+	 *            the nested dataflow
+	 */
+	public void setExpandNestedDataflow(Activity dataflow, boolean expand) {
+		dataflowExpansion.put(dataflow, expand);
+	}
+
+	private boolean isSingleOutputProcessor(Object dataflowObject) {
+		boolean result = false;
+		if (dataflowObject instanceof Processor) {
+			Processor processor = (Processor) dataflowObject;
+			result = processor.getOutputPorts().size() == 1;
+		}
+		return result;
+	}
+
+	public boolean startEdgeCreation(GraphElement graphElement, Point point) {
+		if (!edgeCreationFromSource && !edgeCreationFromSink) {
+			Object dataflowObject = graphElement.getWorkflowBean();
+			if (dataflowObject instanceof ReceiverPort) {
+				edgeCreationSink = graphElement;
+				edgeCreationFromSink = true;
+			} else if (dataflowObject instanceof SenderPort
+					|| isSingleOutputProcessor(dataflowObject)) {
+				edgeCreationSource = graphElement;
+				edgeCreationFromSource = true;
+			} else if (graphElement instanceof GraphEdge) {
+				GraphEdge edge = (GraphEdge) graphElement;
+				edgeCreationSource = edge.getSource();
+				edgeCreationFromSource = true;
+				edgeMoveElement = edge;
+			}
+		}
+		return edgeCreationFromSource || edgeCreationFromSink;
+	}
+
+	public boolean moveEdgeCreationTarget(GraphElement graphElement, Point point) {
+		boolean edgeValid = false;
+		Object dataflowObject = graphElement.getWorkflowBean();
+		if (edgeCreationFromSink) {
+			if (graphElement instanceof GraphNode) {
+				Object sinkObject = edgeCreationSink.getWorkflowBean();
+				if (dataflowObject instanceof OutputPort) {
+					Processor sourceProcessor = portToProcessor
+							.get(dataflowObject);
+					if (sourceProcessor != null) {
+						Processor sinkProcessor = null;
+						if (sinkObject instanceof Processor)
+							sinkProcessor = (Processor) sinkObject;
+						else if (portToProcessor.containsKey(sinkObject))
+							sinkProcessor = portToProcessor.get(sinkObject);
+						if (sinkProcessor != null) {
+							Set<Processor> possibleSinkProcessors = scufl2Tools
+									.possibleDownStreamProcessors(workflow,
+											sourceProcessor);
+							if (possibleSinkProcessors.contains(sinkProcessor)) {
+								edgeCreationSource = graphElement;
+								edgeValid = true;
+							}
+						}
+						if (sinkObject instanceof OutputWorkflowPort) {
+							edgeCreationSource = graphElement;
+							edgeValid = true;
+						}
+					}
+				} else if (dataflowObject instanceof InputWorkflowPort) {
+					edgeCreationSource = graphElement;
+					edgeValid = true;
+				} else if (dataflowObject instanceof Processor) {
+					Processor sourceProcessor = (Processor) dataflowObject;
+					Processor sinkProcessor = null;
+					if (sinkObject instanceof Processor)
+						sinkProcessor = (Processor) sinkObject;
+					else if (portToProcessor.containsKey(sinkObject))
+						sinkProcessor = portToProcessor.get(sinkObject);
+					if (sinkProcessor != null) {
+						Set<Processor> possibleSinkProcessors = scufl2Tools
+								.possibleDownStreamProcessors(workflow,
+										sourceProcessor);
+						if (possibleSinkProcessors.contains(sinkProcessor)) {
+							edgeCreationSource = graphElement;
+							edgeValid = true;
+						}
+					}
+					if (sinkObject instanceof OutputWorkflowPort) {
+						edgeCreationSource = graphElement;
+						edgeValid = true;
+					}
+				}
+			}
+			if (!edgeValid)
+				edgeCreationSource = null;
+		} else if (edgeCreationFromSource) {
+			if (graphElement instanceof GraphNode) {
+				Object sourceObject = edgeCreationSource.getWorkflowBean();
+				if (dataflowObject instanceof InputPort) {
+					Processor sinkProcessor = portToProcessor
+							.get(dataflowObject);
+					if (sinkProcessor != null) {
+						Processor sourceProcessor = null;
+						if (sourceObject instanceof Processor)
+							sourceProcessor = (Processor) sourceObject;
+						else if (portToProcessor.containsKey(sourceObject))
+							sourceProcessor = portToProcessor.get(sourceObject);
+						if (sourceProcessor != null) {
+							Set<Processor> possibleSourceProcessors = scufl2Tools
+									.possibleUpStreamProcessors(workflow,
+											sinkProcessor);
+							if (possibleSourceProcessors
+									.contains(sourceProcessor)) {
+								edgeCreationSink = graphElement;
+								edgeValid = true;
+							}
+						}
+						if (sourceObject instanceof InputWorkflowPort) {
+							edgeCreationSink = graphElement;
+							edgeValid = true;
+						}
+					}
+				} else if (dataflowObject instanceof OutputWorkflowPort) {
+					if (sourceObject != null) {
+						edgeCreationSink = graphElement;
+						edgeValid = true;
+					}
+				} else if (dataflowObject instanceof Processor) {
+					Processor sinkProcessor = (Processor) dataflowObject;
+					Processor sourceProcessor = null;
+					if (sourceObject instanceof Processor)
+						sourceProcessor = (Processor) sourceObject;
+					else if (portToProcessor.containsKey(sourceObject))
+						sourceProcessor = portToProcessor.get(sourceObject);
+					if (sourceProcessor != null) {
+						Set<Processor> possibleSourceProcessors = scufl2Tools
+								.possibleUpStreamProcessors(workflow,
+										sinkProcessor);
+						if (possibleSourceProcessors.contains(sourceProcessor)) {
+							edgeCreationSink = graphElement;
+							edgeValid = true;
+						}
+					}
+					if (sourceObject instanceof InputWorkflowPort) {
+						edgeCreationSink = graphElement;
+						edgeValid = true;
+					}
+				}
+			}
+			if (!edgeValid)
+				edgeCreationSink = null;
+		}
+		return edgeValid;
+	}
+
+	public boolean stopEdgeCreation(GraphElement graphElement, Point point) {
+		boolean edgeCreated = false;
+		if (edgeCreationSource != null && edgeCreationSink != null) {
+			SenderPort source = null;
+			ReceiverPort sink = null;
+			Object sourceDataflowObject = edgeCreationSource.getWorkflowBean();
+			Object sinkDataflowObject = edgeCreationSink.getWorkflowBean();
+			if (sourceDataflowObject instanceof SenderPort)
+				source = (SenderPort) sourceDataflowObject;
+			else if (sourceDataflowObject instanceof Processor) {
+				Processor processor = (Processor) sourceDataflowObject;
+				source = showPortOptions(processor.getOutputPorts(), "output",
+						componentForPopups, point);
+			}
+			if (sinkDataflowObject instanceof ReceiverPort)
+				sink = (ReceiverPort) sinkDataflowObject;
+			else if (sinkDataflowObject instanceof Processor) {
+				Processor processor = (Processor) sinkDataflowObject;
+				sink = showPortOptions(processor.getInputPorts(), "input",
+						componentForPopups, point);
+			}
+			if (source != null && sink != null) {
+				Edit<?> edit = null;
+				if (edgeMoveElement == null) {
+					DataLink dataLink = new DataLink();
+					dataLink.setReceivesFrom(source);
+					dataLink.setSendsTo(sink);
+					edit = new AddDataLinkEdit(workflow, dataLink);
+				} else {
+					Object existingSink = edgeMoveElement.getSink()
+							.getWorkflowBean();
+					if (existingSink != sink) {
+						List<Edit<?>> editList = new ArrayList<Edit<?>>();
+						DataLink existingDataLink = (DataLink) edgeMoveElement
+								.getWorkflowBean();
+						DataLink newDataLink = new DataLink();
+						newDataLink.setReceivesFrom(existingDataLink
+								.getReceivesFrom());
+						newDataLink.setSendsTo(sink);
+						editList.add(new RemoveDataLinkEdit(workflow,
+								existingDataLink));
+						editList.add(new AddDataLinkEdit(workflow, newDataLink));
+						edit = new CompoundEdit(editList);
+					}
+				}
+				try {
+					if (edit != null) {
+						editManager.doDataflowEdit(workflow.getParent(), edit);
+						edgeCreated = true;
+					}
+				} catch (EditException e) {
+					logger.debug("Failed to create datalink from '"
+							+ source.getName() + "' to '" + sink.getName()
+							+ "'");
+				}
+			}
+		}
+		edgeCreationSource = null;
+		edgeCreationSink = null;
+		edgeMoveElement = null;
+		edgeCreationFromSource = false;
+		edgeCreationFromSink = false;
+
+		return edgeCreated;
+	}
+
+	private <T extends Port> T showPortOptions(NamedSet<T> ports,
+			String portType, Component component, Point point) {
+		T result = null;
+		if (ports.size() == 0) {
+			showMessageDialog(component, "Service has no " + portType
+					+ " ports to connect to");
+		} else if (ports.size() == 1)
+			result = ports.first();
+		else {
+			Object[] portNames = ports.getNames().toArray();
+			String portName = (String) showInputDialog(component, "Select an "
+					+ portType + " port", "Port Chooser", PLAIN_MESSAGE, null,
+					portNames, portNames[0]);
+			if (portName != null)
+				result = ports.getByName(portName);
+		}
+		return result;
+
+	}
+
+	public void resetSelection() {
+		if (dataflowSelectionModel != null)
+			for (Object dataflowElement : dataflowSelectionModel.getSelection()) {
+				GraphElement graphElement = workflowToGraph
+						.get(dataflowElement);
+				if (graphElement != null)
+					graphElement.setSelected(true);
+			}
+	}
+
+	public void setIteration(String nodeId, int iteration) {
+		if (graphElementMap.containsKey(nodeId)) {
+			GraphElement graphElement = graphElementMap.get(nodeId);
+			graphElement.setIteration(iteration);
+		}
+	}
+
+	public void setErrors(String nodeId, int errors) {
+		if (graphElementMap.containsKey(nodeId)) {
+			GraphElement graphElement = graphElementMap.get(nodeId);
+			graphElement.setErrors(errors);
+		}
+	}
+
+	@Override
+	public void notify(Observable<DataflowSelectionMessage> sender,
+			DataflowSelectionMessage message) throws Exception {
+		GraphElement graphElement = workflowToGraph.get(message.getElement());
+		if (graphElement != null)
+			graphElement.setSelected(message.getType().equals(
+					DataflowSelectionMessage.Type.ADDED));
+	}
+
+	/**
+	 * Returns the GraphEventManager.
+	 * 
+	 * @return the GraphEventManager
+	 */
+	public GraphEventManager getGraphEventManager() {
+		return graphEventManager;
+	}
+
+	/**
+	 * Sets the GraphEventManager.
+	 * 
+	 * @param graphEventManager
+	 *            the new GraphEventManager
+	 */
+	public void setGraphEventManager(GraphEventManager graphEventManager) {
+		this.graphEventManager = graphEventManager;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-graph-model/src/main/java/org/apache/taverna/workbench/models/graph/GraphEdge.java
----------------------------------------------------------------------
diff --git a/taverna-graph-model/src/main/java/org/apache/taverna/workbench/models/graph/GraphEdge.java b/taverna-graph-model/src/main/java/org/apache/taverna/workbench/models/graph/GraphEdge.java
new file mode 100644
index 0000000..f781d63
--- /dev/null
+++ b/taverna-graph-model/src/main/java/org/apache/taverna/workbench/models/graph/GraphEdge.java
@@ -0,0 +1,137 @@
+/*******************************************************************************
+ * 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 org.apache.taverna.workbench.models.graph;
+
+import java.awt.Point;
+import java.util.List;
+
+/**
+ * An edge connecting two nodes in a graph.
+ *
+ * @author David Withers
+ */
+public class GraphEdge extends GraphElement {
+	public enum ArrowStyle {NONE, NORMAL, DOT}
+
+	private GraphNode source;
+	private GraphNode sink;
+	private ArrowStyle arrowHeadStyle = ArrowStyle.NORMAL;
+	private ArrowStyle arrowTailStyle = ArrowStyle.NONE;
+	private List<Point> path;
+
+	/**
+	 * Constructs a new instance of Edge.
+	 *
+	 */
+	public GraphEdge(GraphController graphController) {
+		super(graphController);
+	}
+
+	/**
+	 * Returns the source.
+	 *
+	 * @return the source
+	 */
+	public GraphNode getSource() {
+		return source;
+	}
+
+	/**
+	 * Sets the source.
+	 *
+	 * @param source the new source
+	 */
+	public void setSource(GraphNode source) {
+		this.source = source;
+	}
+
+	/**
+	 * Returns the sink.
+	 *
+	 * @return the sink
+	 */
+	public GraphNode getSink() {
+		return sink;
+	}
+
+	/**
+	 * Sets the sink.
+	 *
+	 * @param sink the new sink
+	 */
+	public void setSink(GraphNode sink) {
+		this.sink = sink;
+	}
+
+	/**
+	 * Returns the arrowHeadStyle.
+	 *
+	 * @return the arrowHeadStyle
+	 */
+	public ArrowStyle getArrowHeadStyle() {
+		return arrowHeadStyle;
+	}
+
+	/**
+	 * Sets the arrowHeadStyle.
+	 *
+	 * @param arrowHeadStyle the new arrowHeadStyle
+	 */
+	public void setArrowHeadStyle(ArrowStyle arrowHeadStyle) {
+		this.arrowHeadStyle = arrowHeadStyle;
+	}
+
+	/**
+	 * Returns the arrowTailStyle.
+	 *
+	 * @return the arrowTailStyle
+	 */
+	public ArrowStyle getArrowTailStyle() {
+		return arrowTailStyle;
+	}
+
+	/**
+	 * Sets the arrowTailStyle.
+	 *
+	 * @param arrowTailStyle the new arrowTailStyle
+	 */
+	public void setArrowTailStyle(ArrowStyle arrowTailStyle) {
+		this.arrowTailStyle = arrowTailStyle;
+	}
+
+	/**
+	 * Returns the path.
+	 *
+	 * @return the path
+	 */
+	public List<Point> getPath() {
+		return path;
+	}
+
+	/**
+	 * Sets the path.
+	 *
+	 * @param path the new path
+	 */
+	public void setPath(List<Point> path) {
+		this.path = path;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-graph-model/src/main/java/org/apache/taverna/workbench/models/graph/GraphElement.java
----------------------------------------------------------------------
diff --git a/taverna-graph-model/src/main/java/org/apache/taverna/workbench/models/graph/GraphElement.java b/taverna-graph-model/src/main/java/org/apache/taverna/workbench/models/graph/GraphElement.java
new file mode 100644
index 0000000..2c4263f
--- /dev/null
+++ b/taverna-graph-model/src/main/java/org/apache/taverna/workbench/models/graph/GraphElement.java
@@ -0,0 +1,430 @@
+/*******************************************************************************
+ * 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 org.apache.taverna.workbench.models.graph;
+
+import java.awt.Color;
+import java.awt.Point;
+
+import org.apache.taverna.scufl2.api.common.WorkflowBean;
+
+/**
+ * An element of a graph.
+ * 
+ * @author David Withers
+ */
+public abstract class GraphElement {
+	public enum LineStyle {
+		NONE, SOLID, DOTTED
+	}
+
+	private String id;
+	private String label;
+	private Point labelPosition;
+	private LineStyle lineStyle = LineStyle.SOLID;
+	private Color color = Color.BLACK;
+	private Color fillColor;
+	private float opacity = 1f;
+	private GraphElement parent;
+	private boolean selected;
+	private boolean active;
+	private boolean interactive;
+	private boolean visible = true;
+	private boolean filtered;
+	private WorkflowBean workflowBean;
+	protected GraphController graphController;
+	protected float completed;
+	protected int iteration;
+	protected int errors;
+
+	protected GraphElement(GraphController graphController) {
+		this.graphController = graphController;
+	}
+
+	/**
+	 * Returns the eventManager.
+	 * 
+	 * @return the eventManager
+	 */
+	public GraphEventManager getEventManager() {
+		if (graphController != null) {
+			return graphController.getGraphEventManager();
+		}
+		return null;
+	}
+
+	/**
+	 * Returns the workflowBean.
+	 * 
+	 * @return the workflowBean
+	 */
+	public WorkflowBean getWorkflowBean() {
+		return workflowBean;
+	}
+
+	/**
+	 * Sets the workflowBean.
+	 * 
+	 * @param workflowBean
+	 *            the new workflowBean
+	 */
+	public void setWorkflowBean(WorkflowBean workflowBean) {
+		this.workflowBean = workflowBean;
+	}
+
+	/**
+	 * Returns the parent.
+	 * 
+	 * @return the parent
+	 */
+	public GraphElement getParent() {
+		return parent;
+	}
+
+	/**
+	 * Sets the parent.
+	 * 
+	 * @param parent
+	 *            the new parent
+	 */
+	protected void setParent(GraphElement parent) {
+		this.parent = parent;
+	}
+
+	/**
+	 * Returns the label.
+	 * 
+	 * @return the label
+	 */
+	public String getLabel() {
+		return label;
+	}
+
+	/**
+	 * Sets the label.
+	 * 
+	 * @param label
+	 *            the new label
+	 */
+	public void setLabel(String label) {
+		this.label = label;
+	}
+
+	/**
+	 * Returns the labelPosition.
+	 * 
+	 * @return the labelPosition
+	 */
+	public Point getLabelPosition() {
+		return labelPosition;
+	}
+
+	/**
+	 * Sets the labelPosition.
+	 * 
+	 * @param labelPosition
+	 *            the new labelPosition
+	 */
+	public void setLabelPosition(Point labelPosition) {
+		this.labelPosition = labelPosition;
+	}
+
+	/**
+	 * Returns the id.
+	 * 
+	 * @return the id
+	 */
+	public String getId() {
+		return id;
+	}
+
+	/**
+	 * Sets the id.
+	 * 
+	 * @param id
+	 *            the new id
+	 */
+	public void setId(String id) {
+		if (graphController != null) {
+			graphController.mapElement(id, this);
+		}
+		this.id = id;
+	}
+
+	/**
+	 * Returns the colour.
+	 * 
+	 * @return the colour
+	 */
+	public Color getColor() {
+		return color;
+	}
+
+	/**
+	 * Sets the colour.
+	 * 
+	 * @param color
+	 *            the new colour
+	 */
+	public void setColor(Color color) {
+		this.color = color;
+	}
+
+	/**
+	 * Returns the fillColor.
+	 * 
+	 * @return the fillColor
+	 */
+	public Color getFillColor() {
+		return fillColor;
+	}
+
+	/**
+	 * Sets the fillColor.
+	 * 
+	 * @param fillColor
+	 *            the new fillColor
+	 */
+	public void setFillColor(Color fillColor) {
+		this.fillColor = fillColor;
+	}
+
+	/**
+	 * Returns the lineStyle.
+	 * 
+	 * @return the lineStyle
+	 */
+	public LineStyle getLineStyle() {
+		return lineStyle;
+	}
+
+	/**
+	 * Sets the lineStyle.
+	 * 
+	 * @param lineStyle
+	 *            the new lineStyle
+	 */
+	public void setLineStyle(LineStyle lineStyle) {
+		this.lineStyle = lineStyle;
+	}
+
+	@Override
+	public String toString() {
+		return id + "[" + label + "]";
+	}
+
+	/**
+	 * Returns the selected.
+	 * 
+	 * @return the selected
+	 */
+	public boolean isSelected() {
+		return selected;
+	}
+
+	/**
+	 * Sets the selected.
+	 * 
+	 * @param selected
+	 *            the new selected
+	 */
+	public void setSelected(boolean selected) {
+		this.selected = selected;
+	}
+
+	/**
+	 * Returns the iteration.
+	 * 
+	 * @return the value of iteration
+	 */
+	public int getIteration() {
+		return iteration;
+	}
+
+	/**
+	 * Sets the iteration.
+	 * 
+	 * @param iteration
+	 *            the new value for iteration
+	 */
+	public void setIteration(int iteration) {
+		this.iteration = iteration;
+	}
+
+	/**
+	 * Returns the errors.
+	 * 
+	 * @return the value of errors
+	 */
+	public int getErrors() {
+		return errors;
+	}
+
+	/**
+	 * Sets the errors.
+	 * 
+	 * @param errors
+	 *            the new value for errors
+	 */
+	public void setErrors(int errors) {
+		this.errors = errors;
+	}
+
+	/**
+	 * Returns the completed.
+	 * 
+	 * @return the value of completed
+	 */
+	public float getCompleted() {
+		return completed;
+	}
+
+	/**
+	 * Sets the completed value.
+	 * 
+	 * @param completed
+	 */
+	public void setCompleted(float completed) {
+		this.completed = completed;
+	}
+
+	/**
+	 * Returns <code>true</code> if the element is active. The default value is
+	 * <code>false</code>.
+	 * 
+	 * @return <code>true</code> if the element is active
+	 */
+	public boolean isActive() {
+		return active;
+	}
+
+	/**
+	 * Sets the value of active.
+	 * 
+	 * @param active
+	 *            the new active
+	 */
+	public void setActive(boolean active) {
+		this.active = active;
+	}
+
+	/**
+	 * Returns <code>true</code> if the element is interactive. The default
+	 * value is <code>false</code>.
+	 * 
+	 * @return <code>true</code> if the element is interactive
+	 */
+	public boolean isInteractive() {
+		return interactive;
+	}
+
+	/**
+	 * Sets the value of interactive.
+	 * 
+	 * @param interactive
+	 *            the new interactive
+	 */
+	public void setInteractive(boolean interactive) {
+		this.interactive = interactive;
+	}
+
+	/**
+	 * Returns <code>true</code> if the element is visible. The default value is
+	 * <code>true</code>.
+	 * 
+	 * @return <code>true</code> if the element is visible
+	 */
+	public boolean isVisible() {
+		return visible;
+	}
+
+	/**
+	 * Sets whether the element is visible.
+	 * 
+	 * @param visible
+	 *            the new value for visible
+	 */
+	public void setVisible(boolean visible) {
+		this.visible = visible;
+	}
+
+	/**
+	 * Returns the opacity value. The default value is 1.0
+	 * 
+	 * @return the opacity value
+	 */
+	public float getOpacity() {
+		return opacity;
+	}
+
+	/**
+	 * Sets the opacity of the element. Must be a value between 0.0 and 1.0.
+	 * 
+	 * @param opacity
+	 *            the new opacity value
+	 */
+	public void setOpacity(float opacity) {
+		this.opacity = opacity;
+	}
+
+	/**
+	 * Returns <code>true</code> if the element is filtered.
+	 * 
+	 * @return <code>true</code> if the element is filtered
+	 */
+	public boolean isFiltered() {
+		return filtered;
+	}
+
+	/**
+	 * Sets the value of filtered.
+	 * 
+	 * @param filtered
+	 *            the new value for filtered
+	 */
+	public void setFiltered(boolean filtered) {
+		this.filtered = filtered;
+	}
+
+	@Override
+	public int hashCode() {
+		final int prime = 31;
+		int result = 1;
+		result = prime * result + ((id == null) ? 0 : id.hashCode());
+		return result;
+	}
+
+	@Override
+	public boolean equals(Object obj) {
+		if (this == obj)
+			return true;
+		if (obj == null)
+			return false;
+		if (getClass() != obj.getClass())
+			return false;
+
+		// Equality by id
+		GraphElement other = (GraphElement) obj;
+		if (id == null)
+			return (other.id == null);
+		return id.equals(other.id);
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-graph-model/src/main/java/org/apache/taverna/workbench/models/graph/GraphEventManager.java
----------------------------------------------------------------------
diff --git a/taverna-graph-model/src/main/java/org/apache/taverna/workbench/models/graph/GraphEventManager.java b/taverna-graph-model/src/main/java/org/apache/taverna/workbench/models/graph/GraphEventManager.java
new file mode 100644
index 0000000..5a0eaa8
--- /dev/null
+++ b/taverna-graph-model/src/main/java/org/apache/taverna/workbench/models/graph/GraphEventManager.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * 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 org.apache.taverna.workbench.models.graph;
+
+public interface GraphEventManager {
+	void mouseClicked(GraphElement graphElement, short button, boolean altKey,
+			boolean ctrlKey, boolean metaKey, int x, int y, int screenX,
+			int screenY);
+
+	void mouseDown(GraphElement graphElement, short button, boolean altKey,
+			boolean ctrlKey, boolean metaKey, int x, int y, int screenX,
+			int screenY);
+
+	void mouseUp(GraphElement graphElement, short button, boolean altKey,
+			boolean ctrlKey, boolean metaKey, final int x, final int y,
+			int screenX, int screenY);
+
+	void mouseMoved(GraphElement graphElement, short button, boolean altKey,
+			boolean ctrlKey, boolean metaKey, int x, int y, int screenX,
+			int screenY);
+
+	void mouseOver(GraphElement graphElement, short button, boolean altKey,
+			boolean ctrlKey, boolean metaKey, int x, int y, int screenX,
+			int screenY);
+
+	void mouseOut(GraphElement graphElement, short button, boolean altKey,
+			boolean ctrlKey, boolean metaKey, int x, int y, int screenX,
+			int screenY);
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-graph-model/src/main/java/org/apache/taverna/workbench/models/graph/GraphNode.java
----------------------------------------------------------------------
diff --git a/taverna-graph-model/src/main/java/org/apache/taverna/workbench/models/graph/GraphNode.java b/taverna-graph-model/src/main/java/org/apache/taverna/workbench/models/graph/GraphNode.java
new file mode 100644
index 0000000..5730ef0
--- /dev/null
+++ b/taverna-graph-model/src/main/java/org/apache/taverna/workbench/models/graph/GraphNode.java
@@ -0,0 +1,153 @@
+/*******************************************************************************
+ * 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 org.apache.taverna.workbench.models.graph;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * A node of a graph that can optionally contain other graphs.
+ * 
+ * @author David Withers
+ */
+public class GraphNode extends GraphShapeElement {
+	private List<GraphNode> sourceNodes = new ArrayList<>();
+	private List<GraphNode> sinkNodes = new ArrayList<>();
+	private Graph graph;
+	private boolean expanded;
+
+	/**
+	 * Constructs a new instance of Node.
+	 * 
+	 */
+	public GraphNode(GraphController graphController) {
+		super(graphController);
+	}
+
+	/**
+	 * Adds a sink node.
+	 * 
+	 * @param sinkNode
+	 *            the sink node to add
+	 */
+	public void addSinkNode(GraphNode sinkNode) {
+		sinkNode.setParent(this);
+		sinkNodes.add(sinkNode);
+	}
+
+	/**
+	 * Adds a source node.
+	 * 
+	 * @param sourceNode
+	 *            the source node to add
+	 */
+	public void addSourceNode(GraphNode sourceNode) {
+		sourceNode.setParent(this);
+		sourceNodes.add(sourceNode);
+	}
+
+	/**
+	 * Returns the graph that this node contains.
+	 * 
+	 * @return the graph that this node contains
+	 */
+	public Graph getGraph() {
+		return graph;
+	}
+
+	/**
+	 * Returns the sinkNodes.
+	 * 
+	 * @return the sinkNodes
+	 */
+	public List<GraphNode> getSinkNodes() {
+		return sinkNodes;
+	}
+
+	/**
+	 * Returns the sourceNodes.
+	 * 
+	 * @return the sourceNodes
+	 */
+	public List<GraphNode> getSourceNodes() {
+		return sourceNodes;
+	}
+
+	/**
+	 * Returns true if this node is expanded to show the contained graph.
+	 * 
+	 * @return true if this node is expanded
+	 */
+	public boolean isExpanded() {
+		return expanded;
+	}
+
+	/**
+	 * Removes a sink node.
+	 * 
+	 * @param sinkNode
+	 *            the node to remove
+	 * @return true if the node was removed, false otherwise
+	 */
+	public boolean removeSinkNode(GraphNode sinkNode) {
+		return sinkNodes.remove(sinkNode);
+	}
+
+	/**
+	 * Removes a source node.
+	 * 
+	 * @param sourceNode
+	 *            the node to remove
+	 * @return true if the node was removed, false otherwise
+	 */
+	public boolean removeSourceNode(GraphNode sourceNode) {
+		return sourceNodes.remove(sourceNode);
+	}
+
+	/**
+	 * Sets whether this node is expanded to show the contained graph.
+	 * 
+	 * @param expanded
+	 *            true if this node is expanded
+	 */
+	public void setExpanded(boolean expanded) {
+		this.expanded = expanded;
+	}
+
+	/**
+	 * Sets the graph that this node contains.
+	 * 
+	 * @param graph
+	 *            the new graph
+	 */
+	public void setGraph(Graph graph) {
+		if (graph != null)
+			graph.setParent(this);
+		this.graph = graph;
+	}
+
+	@Override
+	public void setSelected(boolean selected) {
+		super.setSelected(selected);
+		if (isExpanded())
+			getGraph().setSelected(selected);
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-graph-model/src/main/java/org/apache/taverna/workbench/models/graph/GraphShapeElement.java
----------------------------------------------------------------------
diff --git a/taverna-graph-model/src/main/java/org/apache/taverna/workbench/models/graph/GraphShapeElement.java b/taverna-graph-model/src/main/java/org/apache/taverna/workbench/models/graph/GraphShapeElement.java
new file mode 100644
index 0000000..955ec08
--- /dev/null
+++ b/taverna-graph-model/src/main/java/org/apache/taverna/workbench/models/graph/GraphShapeElement.java
@@ -0,0 +1,119 @@
+/*******************************************************************************
+ * 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 org.apache.taverna.workbench.models.graph;
+
+import java.awt.Dimension;
+import java.awt.Point;
+
+/**
+ * A Graph element that has shape, size and position properties.
+ * 
+ * @author David Withers
+ */
+public class GraphShapeElement extends GraphElement {
+	public enum Shape {
+		BOX, RECORD, HOUSE, INVHOUSE, DOT, CIRCLE, TRIANGLE, INVTRIANGLE
+	}
+
+	private Shape shape;
+	private int x, y, width, height;
+
+	public GraphShapeElement(GraphController graphController) {
+		super(graphController);
+	}
+
+	/**
+	 * Returns the height.
+	 * 
+	 * @return the height
+	 */
+	public int getHeight() {
+		return height;
+	}
+
+	/**
+	 * Returns the position.
+	 * 
+	 * @return the position
+	 */
+	public Point getPosition() {
+		return new Point(x, y);
+	}
+
+	/**
+	 * Returns the shape of the element.
+	 * 
+	 * @return the shape of the element
+	 */
+	public Shape getShape() {
+		return shape;
+	}
+
+	/**
+	 * Returns the width.
+	 * 
+	 * @return the width
+	 */
+	public int getWidth() {
+		return width;
+	}
+
+	/**
+	 * Sets the position.
+	 * 
+	 * @param position
+	 *            the new position
+	 */
+	public void setPosition(Point position) {
+		x = position.x;
+		y = position.y;
+	}
+
+	/**
+	 * Sets the shape of the element.
+	 * 
+	 * @param shape
+	 *            the new shape of the element
+	 */
+	public void setShape(Shape shape) {
+		this.shape = shape;
+	}
+
+	/**
+	 * Returns the size of the element.
+	 * 
+	 * @return the size of the element
+	 */
+	public Dimension getSize() {
+		return new Dimension(width, height);
+	}
+
+	/**
+	 * Sets the size of the element.
+	 * 
+	 * @param size
+	 *            the new size of the node
+	 */
+	public void setSize(Dimension size) {
+		width = size.width;
+		height = size.height;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-graph-model/src/main/java/org/apache/taverna/workbench/models/graph/dot/GraphLayout.java
----------------------------------------------------------------------
diff --git a/taverna-graph-model/src/main/java/org/apache/taverna/workbench/models/graph/dot/GraphLayout.java b/taverna-graph-model/src/main/java/org/apache/taverna/workbench/models/graph/dot/GraphLayout.java
new file mode 100644
index 0000000..4d1b4bf
--- /dev/null
+++ b/taverna-graph-model/src/main/java/org/apache/taverna/workbench/models/graph/dot/GraphLayout.java
@@ -0,0 +1,326 @@
+/*******************************************************************************
+ * 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 org.apache.taverna.workbench.models.graph.dot;
+
+import static java.lang.Float.parseFloat;
+import static org.apache.taverna.workbench.models.graph.Graph.Alignment.HORIZONTAL;
+
+import java.awt.Dimension;
+import java.awt.Point;
+import java.awt.Rectangle;
+import java.io.StringReader;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.taverna.workbench.models.graph.Graph;
+import org.apache.taverna.workbench.models.graph.GraphController;
+import org.apache.taverna.workbench.models.graph.GraphEdge;
+import org.apache.taverna.workbench.models.graph.GraphElement;
+import org.apache.taverna.workbench.models.graph.GraphNode;
+
+import org.apache.log4j.Logger;
+
+/**
+ * Lays out a graph from a DOT layout.
+ * 
+ * @author David Withers
+ */
+public class GraphLayout implements DOTParserVisitor {
+	private static final Logger logger = Logger.getLogger(GraphLayout.class);
+	private static final int BORDER = 10;
+
+	private Rectangle bounds;
+	private Rectangle requiredBounds;
+	private GraphController graphController;
+	private int xOffset;
+	private int yOffset;
+
+	public Rectangle layoutGraph(GraphController graphController, Graph graph,
+			String laidOutDot, Rectangle requiredBounds) throws ParseException {
+		this.graphController = graphController;
+		this.requiredBounds = requiredBounds;
+
+		bounds = null;
+		xOffset = 0;
+		yOffset = 0;
+
+		logger.debug(laidOutDot);
+		DOTParser parser = new DOTParser(new StringReader(laidOutDot));
+		parser.parse().jjtAccept(this, graph);
+
+		// int xOffset = (bounds.width - bounds.width) / 2;
+		// int yOffset = (bounds.height - bounds.height) / 2;
+
+		return new Rectangle(xOffset, yOffset, bounds.width, bounds.height);
+	}
+
+	@Override
+	public Object visit(SimpleNode node, Object data) {
+		return node.childrenAccept(this, data);
+	}
+
+	@Override
+	public Object visit(ASTParse node, Object data) {
+		return node.childrenAccept(this, data);
+	}
+
+	@Override
+	public Object visit(ASTGraph node, Object data) {
+		return node.childrenAccept(this, data);
+	}
+
+	@Override
+	public Object visit(ASTStatementList node, Object data) {
+		return node.childrenAccept(this, data);
+	}
+
+	@Override
+	public Object visit(ASTStatement node, Object data) {
+		return node.childrenAccept(this, data);
+	}
+
+	@Override
+	public Object visit(ASTAttributeStatement node, Object data) {
+		return node.childrenAccept(this, data);
+	}
+
+	@Override
+	public Object visit(ASTNodeStatement node, Object data) {
+		GraphElement element = graphController.getElement(removeQuotes(node
+				.getName()));
+		if (element != null)
+			return node.childrenAccept(this, element);
+		return node.childrenAccept(this, data);
+	}
+
+	@Override
+	public Object visit(ASTNodeId node, Object data) {
+		return node.childrenAccept(this, data);
+	}
+
+	@Override
+	public Object visit(ASTPort node, Object data) {
+		return node.childrenAccept(this, data);
+	}
+
+	@Override
+	public Object visit(ASTEdgeStatement node, Object data) {
+		StringBuilder id = new StringBuilder();
+		id.append(removeQuotes(node.getName()));
+		if (node.getPort() != null) {
+			id.append(":");
+			id.append(removeQuotes(node.getPort()));
+		}
+		if (node.children != null)
+			for (Node child : node.children)
+				if (child instanceof ASTEdgeRHS) {
+					NamedNode rhsNode = (NamedNode) child.jjtAccept(this, data);
+					id.append("->");
+					id.append(removeQuotes(rhsNode.getName()));
+					if (rhsNode.getPort() != null) {
+						id.append(":");
+						id.append(removeQuotes(rhsNode.getPort()));
+					}
+				}
+		GraphElement element = graphController.getElement(id.toString());
+		if (element != null)
+			return node.childrenAccept(this, element);
+		return node.childrenAccept(this, data);
+	}
+
+	@Override
+	public Object visit(ASTSubgraph node, Object data) {
+		GraphElement element = graphController.getElement(removeQuotes(
+				node.getName()).substring("cluster_".length()));
+		if (element != null)
+			return node.childrenAccept(this, element);
+		return node.childrenAccept(this, data);
+	}
+
+	@Override
+	public Object visit(ASTEdgeRHS node, Object data) {
+		return node;
+	}
+
+	@Override
+	public Object visit(ASTAttributeList node, Object data) {
+		return node.childrenAccept(this, data);
+	}
+
+	@Override
+	public Object visit(ASTAList node, Object data) {
+		if (data instanceof Graph) {
+			Graph graph = (Graph) data;
+			if ("bb".equalsIgnoreCase(node.getName())) {
+				Rectangle rect = getRectangle(node.getValue());
+				if (rect.width == 0 && rect.height == 0) {
+					rect.width = 500;
+					rect.height = 500;
+				}
+				if (bounds == null) {
+					bounds = calculateBounds(rect);
+					rect = bounds;
+				}
+				graph.setSize(rect.getSize());
+				graph.setPosition(rect.getLocation());
+			} else if ("lp".equalsIgnoreCase(node.getName())) {
+				if (bounds != null)
+					graph.setLabelPosition(getPoint(node.getValue()));
+			}
+		} else if (data instanceof GraphNode) {
+			GraphNode graphNode = (GraphNode) data;
+			if ("width".equalsIgnoreCase(node.getName()))
+				graphNode.setSize(new Dimension(getSize(node.getValue()),
+						graphNode.getHeight()));
+			else if ("height".equalsIgnoreCase(node.getName()))
+				graphNode.setSize(new Dimension(graphNode.getWidth(),
+						getSize(node.getValue())));
+			else if ("pos".equalsIgnoreCase(node.getName())) {
+				Point position = getPoint(node.getValue());
+				position.x = position.x - (graphNode.getWidth() / 2);
+				position.y = position.y - (graphNode.getHeight() / 2);
+				graphNode.setPosition(position);
+			} else if ("rects".equalsIgnoreCase(node.getName())) {
+				List<Rectangle> rectangles = getRectangles(node.getValue());
+				List<GraphNode> sinkNodes = graphNode.getSinkNodes();
+				if (graphController.getAlignment().equals(HORIZONTAL)) {
+					Rectangle rect = rectangles.remove(0);
+					graphNode.setSize(rect.getSize());
+					graphNode.setPosition(rect.getLocation());
+				} else {
+					Rectangle rect = rectangles.remove(sinkNodes.size());
+					graphNode.setSize(rect.getSize());
+					graphNode.setPosition(rect.getLocation());
+				}
+				Point origin = graphNode.getPosition();
+				for (GraphNode sinkNode : sinkNodes) {
+					Rectangle rect = rectangles.remove(0);
+					rect.setLocation(rect.x - origin.x, rect.y - origin.y);
+					sinkNode.setSize(rect.getSize());
+					sinkNode.setPosition(rect.getLocation());
+				}
+				for (GraphNode sourceNode : graphNode.getSourceNodes()) {
+					Rectangle rect = rectangles.remove(0);
+					rect.setLocation(rect.x - origin.x, rect.y - origin.y);
+					sourceNode.setSize(rect.getSize());
+					sourceNode.setPosition(rect.getLocation());
+				}
+			}
+		} else if (data instanceof GraphEdge) {
+			GraphEdge graphEdge = (GraphEdge) data;
+			if ("pos".equalsIgnoreCase(node.getName()))
+				graphEdge.setPath(getPath(node.getValue()));
+		}
+		return node.childrenAccept(this, data);
+	}
+
+	private Rectangle calculateBounds(Rectangle bounds) {
+		bounds = new Rectangle(bounds);
+		bounds.width += BORDER;
+		bounds.height += BORDER;
+		Rectangle newBounds = new Rectangle(bounds);
+		double ratio = bounds.width / (float) bounds.height;
+		double requiredRatio = requiredBounds.width
+				/ (float) requiredBounds.height;
+		// adjust the bounds so they match the aspect ration of the required bounds
+		if (ratio > requiredRatio)
+			newBounds.height = (int) (ratio / requiredRatio * bounds.height);
+		else if (ratio < requiredRatio)
+			newBounds.width = (int) (requiredRatio / ratio * bounds.width);
+
+		xOffset = (newBounds.width - bounds.width) / 2;
+		yOffset = (newBounds.height - bounds.height) / 2;
+		// adjust the bounds and so they are not less than the required bounds
+		if (newBounds.width < requiredBounds.width) {
+			xOffset += (requiredBounds.width - newBounds.width) / 2;
+			newBounds.width = requiredBounds.width;
+		}
+		if (newBounds.height < requiredBounds.height) {
+			yOffset += (requiredBounds.height - newBounds.height) / 2;
+			newBounds.height = requiredBounds.height;
+		}
+		// adjust the offset for the border
+		xOffset += BORDER / 2;
+		yOffset += BORDER / 2;
+		return newBounds;
+	}
+
+	private List<Point> getPath(String value) {
+		List<Point> path = new ArrayList<>();
+		for (String point : removeQuotes(value).split(" ")) {
+			String[] coords = point.split(",");
+			if (coords.length == 2) {
+				int x = (int) parseFloat(coords[0]) + xOffset;
+				int y = (int) parseFloat(coords[1]) + yOffset;
+				path.add(new Point(x, flipY(y)));
+			}
+		}
+		return path;
+	}
+
+	private int flipY(int y) {
+		return bounds.height - y;
+	}
+
+	private List<Rectangle> getRectangles(String value) {
+		List<Rectangle> rectangles = new ArrayList<>();
+		String[] rects = value.split(" ");
+		for (String rectangle : rects)
+			rectangles.add(getRectangle(rectangle));
+		return rectangles;
+	}
+
+	private Rectangle getRectangle(String value) {
+		String[] coords = removeQuotes(value).split(",");
+		Rectangle rectangle = new Rectangle();
+		rectangle.x = (int) parseFloat(coords[0]);
+		rectangle.y = (int) parseFloat(coords[3]);
+		rectangle.width = (int) parseFloat(coords[2]) - rectangle.x;
+		rectangle.height = rectangle.y - (int) parseFloat(coords[1]);
+		rectangle.x += xOffset;
+		rectangle.y += yOffset;
+		if (bounds != null)
+			rectangle.y = flipY(rectangle.y);
+		else
+			rectangle.y = rectangle.height - rectangle.y;
+		return rectangle;
+	}
+
+	private Point getPoint(String value) {
+		String[] coords = removeQuotes(value).split(",");
+		return new Point(xOffset + (int) parseFloat(coords[0]), flipY(yOffset
+				+ (int) parseFloat(coords[1])));
+	}
+
+	private int getSize(String value) {
+		return (int) (parseFloat(removeQuotes(value)) * 72);
+	}
+
+	private String removeQuotes(String value) {
+		String result = value.trim();
+		if (result.startsWith("\""))
+			result = result.substring(1);
+		if (result.endsWith("\""))
+			result = result.substring(0, result.length() - 1);
+		result = result.replaceAll("\\\\", "");
+		return result;
+	}
+}


[34/51] [partial] incubator-taverna-workbench git commit: all packages are moved to org.apache.taverna.*

Posted by re...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/ViewCertDetailsDialog.java
----------------------------------------------------------------------
diff --git a/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/ViewCertDetailsDialog.java b/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/ViewCertDetailsDialog.java
deleted file mode 100644
index 8cbed53..0000000
--- a/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/ViewCertDetailsDialog.java
+++ /dev/null
@@ -1,509 +0,0 @@
-/*******************************************************************************
- * 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.credentialmanager;
-
-import static java.awt.BorderLayout.CENTER;
-import static java.awt.BorderLayout.NORTH;
-import static java.awt.BorderLayout.SOUTH;
-import static java.awt.Font.BOLD;
-import static java.awt.Font.PLAIN;
-import static java.awt.GridBagConstraints.LINE_START;
-import static javax.security.auth.x500.X500Principal.RFC2253;
-import static javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED;
-import static javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED;
-import static javax.swing.SwingUtilities.invokeLater;
-
-import java.awt.BorderLayout;
-import java.awt.FlowLayout;
-import java.awt.Font;
-import java.awt.GridBagConstraints;
-import java.awt.GridBagLayout;
-import java.awt.Insets;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.WindowAdapter;
-import java.awt.event.WindowEvent;
-import java.math.BigInteger;
-import java.security.cert.CertificateEncodingException;
-import java.security.cert.X509Certificate;
-import java.util.ArrayList;
-
-import javax.swing.DefaultListModel;
-import javax.swing.JButton;
-import javax.swing.JDialog;
-import javax.swing.JFrame;
-import javax.swing.JLabel;
-import javax.swing.JList;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.border.CompoundBorder;
-import javax.swing.border.EmptyBorder;
-import javax.swing.border.EtchedBorder;
-
-import org.apache.taverna.security.credentialmanager.CMException;
-import org.apache.taverna.security.credentialmanager.DistinguishedNameParser;
-import org.apache.taverna.security.credentialmanager.ParsedDistinguishedName;
-import net.sf.taverna.t2.workbench.helper.NonBlockedHelpEnabledDialog;
-
-/**
- * Displays the details of a X.509 certificate.
- * 
- * Inspired by the Portlecle tool (http://portecle.sourceforge.net/). and the
- * view certificate dialog from Firefox's Certificate Manager.
- */
-@SuppressWarnings("serial")
-public class ViewCertDetailsDialog extends NonBlockedHelpEnabledDialog {
-	// Logger
-	//private static Logger logger = Logger.getLogger(ViewCertDetailsDialog.class);
-	
-	/** Stores certificate to display*/
-	private X509Certificate cert;
-	/** Stores list of serviceURLs to display*/
-	private ArrayList<String> serviceURLs;
-	private final DistinguishedNameParser dnParser;
-
-    /**
-     * Creates new ViewCertDetailsDialog dialog where the parent is a frame.
-     */
-	public ViewCertDetailsDialog(JFrame parent, String title, boolean modal,
-			X509Certificate crt, ArrayList<String> serviceURLs,
-			DistinguishedNameParser dnParser) throws CMException {
-		super(parent, title, modal);
-		this.cert = crt;
-		this.serviceURLs = serviceURLs;
-		this.dnParser = dnParser;
-		initComponents();
-	}
-
-	/**
-	 * Creates new ViewCertDetailsDialog dialog where the parent is a dialog.
-	 */
-	public ViewCertDetailsDialog(JDialog parent, String title, boolean modal,
-			X509Certificate crt, ArrayList<String> urlList,
-			DistinguishedNameParser dnParser) throws CMException {
-		super(parent, title, modal);
-		cert = crt;
-		serviceURLs = urlList;
-		this.dnParser = dnParser;
-		initComponents();
-	}
-
-	/**
-	 * Initialise the dialog's GUI components.
-	 * 
-	 * @throws CMException
-	 *             A problem was encountered getting the certificates' details
-	 */
-	private void initComponents() throws CMException {
-        // Certificate details:
-
-        // Grid Bag Constraints templates for labels (column 1) and 
-    	// values (column 2) of certificate details
-        GridBagConstraints gbcLabel = new GridBagConstraints();
-        gbcLabel.gridx = 0;
-        gbcLabel.ipadx = 20;
-        gbcLabel.gridwidth = 1;
-        gbcLabel.gridheight = 1;
-        gbcLabel.insets = new Insets(2, 15, 2, 2);
-        gbcLabel.anchor = LINE_START;
-
-        GridBagConstraints gbcValue = new GridBagConstraints();
-        gbcValue.gridx = 1;
-        gbcValue.gridwidth = 1;
-        gbcValue.gridheight = 1;
-        gbcValue.insets = new Insets(2, 5, 2, 2);
-        gbcValue.anchor = LINE_START;
-
-        /*
-		 * Netscape Certificate Type non-critical extension (if any) defines the
-		 * intended uses of the certificate - to make it look like firefox's
-		 * view certificate dialog. From openssl's documentation: "The [above]
-		 * extension is non standard, Netscape specific and largely obsolete.
-		 * Their use in new applications is discouraged."
-		 * 
-		 * TODO replace with "basicConstraints, keyUsage and extended key usage
-		 * extensions which are now used instead."
-		 */
-//        byte[] intendedUses = cert.getExtensionValue("2.16.840.1.113730.1.1"); //Netscape Certificate Type OID/*
-//        JLabel jlIntendedUses = null;
-//        JTextField jtfIntendedUsesValue = null;
-//        JPanel jpUses = null;
-//        GridBagConstraints gbc_jpUses = null;
-//        if (intendedUses != null)
-//        {
-//         	jlIntendedUses = new JLabel("This certificate has been approved for the following uses:");
-//         	jlIntendedUses.setFont(new Font(null, Font.BOLD, 11));
-//         	jlIntendedUses.setBorder(new EmptyBorder(5,5,5,5));
-//         	
-//         	jtfIntendedUsesValue = new JTextField(45);
-//         	jtfIntendedUsesValue.setText(CMUtils.getIntendedCertificateUses(intendedUses));
-//        	jtfIntendedUsesValue.setEditable(false);
-//        	jtfIntendedUsesValue.setFont(new Font(null, Font.PLAIN, 11));
-//             
-//        	jpUses = new JPanel(new BorderLayout()); 
-//        	jpUses.add(jlIntendedUses, BorderLayout.NORTH);
-//        	jpUses.add(jtfIntendedUsesValue, BorderLayout.CENTER);
-//        	JSeparator jsp = new JSeparator(JSeparator.HORIZONTAL);
-//        	jpUses.add(jsp, BorderLayout.SOUTH);
-//        	
-//        	gbc_jpUses = (GridBagConstraints) gbcLabel.clone();
-//        	gbc_jpUses.gridy = 0;
-//        	gbc_jpUses.gridwidth = 2; //takes two columns
-//        	gbc_jpUses.insets = new Insets(5, 5, 5, 5);//has slightly bigger insets
-//
-//        }
-
-        //Issued To
-        JLabel jlIssuedTo = new JLabel("Issued To");
-        jlIssuedTo.setFont(new Font(null, Font.BOLD, 11));
-        GridBagConstraints gbc_jlIssuedTo = (GridBagConstraints) gbcLabel.clone();
-        gbc_jlIssuedTo.gridy = 1;
-        gbc_jlIssuedTo.gridwidth = 2; //takes two columns
-        gbc_jlIssuedTo.insets = new Insets(5, 5, 5, 5);//has slightly bigger insets
-
-        // Distinguished Name (DN)
-        String sDN = cert.getSubjectX500Principal().getName(RFC2253);
-        ParsedDistinguishedName parsedDN = dnParser.parseDN(sDN);       
-        // Extract the CN, O, OU and EMAILADDRESS fields
-        String sCN = parsedDN.getCN();
-        String sOrg = parsedDN.getO();
-        String sOU = parsedDN.getOU();
-        //String sEMAILADDRESS = CMX509Util.getEmilAddress();
-
-        // Common Name (CN)
-        JLabel jlCN = new JLabel("Common Name (CN)");
-        jlCN.setFont(new Font(null, PLAIN, 11));
-        GridBagConstraints gbc_jlCN = (GridBagConstraints) gbcLabel.clone();
-        gbc_jlCN.gridy = 2;
-        JLabel jlCNValue = new JLabel(sCN);
-        jlCNValue.setFont(new Font(null, PLAIN, 11));
-        GridBagConstraints gbc_jlCNValue = (GridBagConstraints) gbcValue.clone();
-        gbc_jlCNValue.gridy = 2;
-
-        // Organisation (O)
-        JLabel jlOrg = new JLabel("Organisation (O)");
-        jlOrg.setFont(new Font(null, PLAIN, 11));
-        GridBagConstraints gbc_jlOrg = (GridBagConstraints) gbcLabel.clone();
-        gbc_jlOrg.gridy = 3;
-        JLabel jlOrgValue = new JLabel(sOrg);
-        jlOrgValue.setFont(new Font(null, PLAIN, 11));
-        GridBagConstraints gbc_jlOrgValue = (GridBagConstraints) gbcValue.clone();
-        gbc_jlOrgValue.gridy = 3;
-
-        // Organisation Unit (OU)
-        JLabel jlOU = new JLabel("Organisation Unit (OU)");
-        jlOU.setFont(new Font(null, PLAIN, 11));
-        GridBagConstraints gbc_jlOU = (GridBagConstraints) gbcLabel.clone();
-        gbc_jlOU.gridy = 4;
-        JLabel jlOUValue = new JLabel(sOU);
-        jlOUValue.setFont(new Font(null, PLAIN, 11));
-        GridBagConstraints gbc_jlOUValue = (GridBagConstraints) gbcValue.clone();
-        gbc_jlOUValue.gridy = 4;
-
-        // E-mail Address
-        //JLabel jlEmail = new JLabel("E-mail Address");
-        //jlEmail.setFont(new Font(null, PLAIN, 11));
-        //GridBagConstraints gbc_jlEmail = (GridBagConstraints) gbcLabel.clone();
-        //gbc_jlEmail.gridy = 5;
-        //JLabel jlEmailValue = new JLabel(sEMAILADDRESS);
-        //jlEmailValue.setFont(new Font(null, PLAIN, 11));
-        //GridBagConstraints gbc_jlEmailValue = (GridBagConstraints) gbcValue.clone();
-        //gbc_jlEmailValue.gridy = 5;
-
-        // Serial Number
-        JLabel jlSN = new JLabel("Serial Number");
-        jlSN.setFont(new Font(null, PLAIN, 11));
-        GridBagConstraints gbc_jlSN = (GridBagConstraints) gbcLabel.clone();
-        gbc_jlSN.gridy = 6;
-        JLabel jlSNValue = new JLabel();
-        // Get the hexadecimal serial number
-        StringBuilder strBuff = new StringBuilder(new BigInteger(1,
-                cert.getSerialNumber().toByteArray()).toString(16).toUpperCase());
-        // Place colons at every two hexadecimal characters
-        if (strBuff.length() > 2)
-            for (int iCnt = 2; iCnt < strBuff.length(); iCnt += 3)
-                strBuff.insert(iCnt, ':');
-        jlSNValue.setText(strBuff.toString());
-        jlSNValue.setFont(new Font(null, PLAIN, 11));
-        GridBagConstraints gbc_jlSNValue = (GridBagConstraints) gbcValue.clone();
-        gbc_jlSNValue.gridy = 6;
-
-        // Version
-        JLabel jlVersion = new JLabel("Version");
-        jlVersion.setFont(new Font(null, PLAIN, 11));
-        GridBagConstraints gbc_jlVersion = (GridBagConstraints) gbcLabel.clone();
-        gbc_jlVersion.gridy = 7;
-        JLabel jlVersionValue = new JLabel(Integer.toString(cert.getVersion()));
-        jlVersionValue.setFont(new Font(null, PLAIN, 11));
-        GridBagConstraints gbc_jlVersionValue = (GridBagConstraints) gbcValue.clone();
-        gbc_jlVersionValue.gridy = 7;
-
-        // Issued By
-        JLabel jlIssuedBy = new JLabel("Issued By");
-        jlIssuedBy.setFont(new Font(null, BOLD, 11));
-        GridBagConstraints gbc_jlIssuedBy = (GridBagConstraints) gbcLabel.clone();
-        gbc_jlIssuedBy.gridy = 8;
-        gbc_jlIssuedBy.gridwidth = 2; //takes two columns 
-        gbc_jlIssuedBy.insets = new Insets(5, 5, 5, 5);//has slightly bigger insets        
-
-        // Distinguished Name (DN)
-		String iDN = cert.getIssuerX500Principal().getName(RFC2253);
-		parsedDN = dnParser.parseDN(iDN);
-		// Extract the CN, O and OU fields
-		String iCN = parsedDN.getCN();
-		String iOrg = parsedDN.getO();
-		String iOU = parsedDN.getOU();
-
-		// Common Name (CN)
-		JLabel jlICN = new JLabel("Common Name (CN)");
-		jlICN.setFont(new Font(null, PLAIN, 11));
-		GridBagConstraints gbc_jlICN = (GridBagConstraints) gbcLabel.clone();
-		gbc_jlICN.gridy = 9;
-		JLabel jlICNValue = new JLabel(iCN);
-		jlICNValue.setFont(new Font(null, PLAIN, 11));
-		GridBagConstraints gbc_jlICNValue = (GridBagConstraints) gbcValue
-				.clone();
-		gbc_jlICNValue.gridy = 9;
-
-		// Organisation (O)
-		JLabel jlIOrg = new JLabel("Organisation (O)");
-		jlIOrg.setFont(new Font(null, PLAIN, 11));
-		GridBagConstraints gbc_jlIOrg = (GridBagConstraints) gbcLabel.clone();
-		gbc_jlIOrg.gridy = 10;
-		JLabel jlIOrgValue = new JLabel(iOrg);
-		jlIOrgValue.setFont(new Font(null, PLAIN, 11));
-		GridBagConstraints gbc_jlIOrgValue = (GridBagConstraints) gbcValue
-				.clone();
-		gbc_jlIOrgValue.gridy = 10;
-
-		// Organisation Unit (OU)
-		JLabel jlIOU = new JLabel("Organisation Unit (OU)");
-		jlIOU.setFont(new Font(null, PLAIN, 11));
-		GridBagConstraints gbc_jlIOU = (GridBagConstraints) gbcLabel.clone();
-		gbc_jlIOU.gridy = 11;
-		JLabel jlIOUValue = new JLabel(iOU);
-		jlIOUValue.setFont(new Font(null, PLAIN, 11));
-		GridBagConstraints gbc_jlIOUValue = (GridBagConstraints) gbcValue
-				.clone();
-		gbc_jlIOUValue.gridy = 11;
-
-		// Validity
-		JLabel jlValidity = new JLabel("Validity");
-		jlValidity.setFont(new Font(null, BOLD, 11));
-		GridBagConstraints gbc_jlValidity = (GridBagConstraints) gbcLabel
-				.clone();
-		gbc_jlValidity.gridy = 12;
-		gbc_jlValidity.gridwidth = 2; // takes two columns
-		gbc_jlValidity.insets = new Insets(5, 5, 5, 5);// has slightly bigger insets
-
-		// Issued On
-		JLabel jlIssuedOn = new JLabel("Issued On");
-		jlIssuedOn.setFont(new Font(null, PLAIN, 11));
-		GridBagConstraints gbc_jlIssuedOn = (GridBagConstraints) gbcLabel
-				.clone();
-		gbc_jlIssuedOn.gridy = 13;
-		JLabel jlIssuedOnValue = new JLabel(cert.getNotBefore().toString());
-		jlIssuedOnValue.setFont(new Font(null, PLAIN, 11));
-		GridBagConstraints gbc_jlIssuedOnValue = (GridBagConstraints) gbcValue
-				.clone();
-		gbc_jlIssuedOnValue.gridy = 13;
-
-		// Expires On
-		JLabel jlExpiresOn = new JLabel("Expires On");
-		jlExpiresOn.setFont(new Font(null, PLAIN, 11));
-		GridBagConstraints gbc_jlExpiresOn = (GridBagConstraints) gbcLabel
-				.clone();
-		gbc_jlExpiresOn.gridy = 14;
-		JLabel jlExpiresOnValue = new JLabel(cert.getNotAfter().toString());
-		jlExpiresOnValue.setFont(new Font(null, PLAIN, 11));
-		GridBagConstraints gbc_jlExpiresOnValue = (GridBagConstraints) gbcValue
-				.clone();
-		gbc_jlExpiresOnValue.gridy = 14;
-
-		// Fingerprints
-		byte[] certBinaryEncoding;
-		try {
-			certBinaryEncoding = cert.getEncoded();
-		} catch (CertificateEncodingException ex) {
-			throw new CMException(
-					"Could not get the encoded form of the certificate.", ex);
-		}
-        JLabel jlFingerprints = new JLabel("Fingerprints");
-        jlFingerprints.setFont(new Font(null, BOLD, 11));
-        GridBagConstraints gbc_jlFingerprints = (GridBagConstraints) gbcLabel.clone();
-        gbc_jlFingerprints.gridy = 15;
-        gbc_jlFingerprints.gridwidth = 2; //takes two columns  
-        gbc_jlFingerprints.insets = new Insets(5, 5, 5, 5);//has slightly bigger insets
-
-        // SHA-1 Fingerprint
-        JLabel jlSHA1Fingerprint = new JLabel("SHA1 Fingerprint");
-        jlSHA1Fingerprint.setFont(new Font(null, PLAIN, 11));
-        GridBagConstraints gbc_jlSHA1Fingerprint = (GridBagConstraints) gbcLabel.clone();
-        gbc_jlSHA1Fingerprint.gridy = 16;
-        JLabel jlSHA1FingerprintValue = new JLabel(dnParser.getMessageDigestAsFormattedString(certBinaryEncoding, "SHA1"));
-        jlSHA1FingerprintValue.setFont(new Font(null, PLAIN, 11));
-        GridBagConstraints gbc_jlSHA1FingerprintValue = (GridBagConstraints) gbcValue.clone();
-        gbc_jlSHA1FingerprintValue.gridy = 16;
-
-        // MD5 Fingerprint
-        JLabel jlMD5Fingerprint = new JLabel("MD5 Fingerprint");
-        jlMD5Fingerprint.setFont(new Font(null, PLAIN, 11));
-        GridBagConstraints gbc_jlMD5Fingerprint = (GridBagConstraints) gbcLabel.clone();
-        gbc_jlMD5Fingerprint.gridy = 17;
-        JLabel jlMD5FingerprintValue = new JLabel(dnParser.getMessageDigestAsFormattedString(certBinaryEncoding, "MD5"));
-        jlMD5FingerprintValue.setFont(new Font(null, PLAIN, 11));
-        GridBagConstraints gbc_jlMD5FingerprintValue = (GridBagConstraints) gbcValue.clone();
-        gbc_jlMD5FingerprintValue.gridy = 17;
-        
-		/*
-		 * Empty label to add a bit space at the bottom of the panel to make it
-		 * look like firefox's view certificate dialog
-		 */
-        JLabel jlEmpty = new JLabel("");
-		GridBagConstraints gbc_jlEmpty = (GridBagConstraints) gbcLabel.clone();
-		gbc_jlEmpty.gridy = 18;
-		gbc_jlEmpty.gridwidth = 2; // takes two columns
-		gbc_jlEmpty.ipady = 40;
-
-		JPanel jpCertificate = new JPanel(new GridBagLayout());
-		jpCertificate.setBorder(new CompoundBorder(new EmptyBorder(15, 15, 15,
-				15), new EtchedBorder()));
-
-//        if (intendedUses != null){
-//        	jpCertificate.add(jpUses, gbc_jpUses);
-//        }
-        jpCertificate.add(jlIssuedTo, gbc_jlIssuedTo); // Issued To
-        jpCertificate.add(jlCN, gbc_jlCN);
-        jpCertificate.add(jlCNValue, gbc_jlCNValue);
-        jpCertificate.add(jlOrg, gbc_jlOrg);
-        jpCertificate.add(jlOrgValue, gbc_jlOrgValue);        
-        jpCertificate.add(jlOU, gbc_jlOU);
-        jpCertificate.add(jlOUValue, gbc_jlOUValue);
-        //jpCertificate.add(jlEmail, gbc_jlEmail);
-        //jpCertificate.add(jlEmailValue, gbc_jlEmailValue);
-        jpCertificate.add(jlSN, gbc_jlSN);
-        jpCertificate.add(jlSNValue, gbc_jlSNValue);
-        jpCertificate.add(jlVersion, gbc_jlVersion);
-        jpCertificate.add(jlVersionValue, gbc_jlVersionValue);
-        jpCertificate.add(jlIssuedBy, gbc_jlIssuedBy); //Issued By
-        jpCertificate.add(jlICN, gbc_jlICN);
-        jpCertificate.add(jlICNValue, gbc_jlICNValue);
-        jpCertificate.add(jlIOrg, gbc_jlIOrg);
-        jpCertificate.add(jlIOrgValue, gbc_jlIOrgValue);        
-        jpCertificate.add(jlIOU, gbc_jlIOU);
-        jpCertificate.add(jlIOUValue, gbc_jlIOUValue);
-        jpCertificate.add(jlValidity, gbc_jlValidity); //Validity
-        jpCertificate.add(jlIssuedOn, gbc_jlIssuedOn);
-        jpCertificate.add(jlIssuedOnValue, gbc_jlIssuedOnValue);
-        jpCertificate.add(jlExpiresOn, gbc_jlExpiresOn);
-        jpCertificate.add(jlExpiresOnValue, gbc_jlExpiresOnValue); 
-        jpCertificate.add(jlFingerprints, gbc_jlFingerprints); //Fingerprints
-        jpCertificate.add(jlSHA1Fingerprint, gbc_jlSHA1Fingerprint);
-        jpCertificate.add(jlSHA1FingerprintValue, gbc_jlSHA1FingerprintValue);
-        jpCertificate.add(jlMD5Fingerprint, gbc_jlMD5Fingerprint);
-        jpCertificate.add(jlMD5FingerprintValue, gbc_jlMD5FingerprintValue);
-        jpCertificate.add(jlEmpty, gbc_jlEmpty); //Empty label to get some vertical space on the frame
-
-        // List of serviceURLs
-        JPanel jpURLs  = null; // Panel to hold the URL list
-		if (serviceURLs != null) { //if service serviceURLs are not null (even if empty - show empty list)
-
-        	jpURLs = new JPanel(new BorderLayout());
-        	jpURLs.setBorder(new CompoundBorder(
-                    new EmptyBorder(0, 15, 0, 15), new EtchedBorder()));
-            // Label
-            JLabel jlServiceURLs = new JLabel ("Service URLs this key pair will be used for:");
-            jlServiceURLs.setFont(new Font(null, Font.BOLD, 11));
-            jlServiceURLs.setBorder(new EmptyBorder(5,5,5,5));    
-      
-            // New empty service serviceURLs list
-			DefaultListModel<String> jltModel = new DefaultListModel<>();
-			JList<String> jltServiceURLs = new JList<>(jltModel);
-			for (String url : serviceURLs)
-				jltModel.addElement(url);
-			// don't show more than 5 otherwise the window is too big
-            jltServiceURLs.setVisibleRowCount(5);
-            
-			// Scroll pane for service serviceURLs
-			JScrollPane jspServiceURLs = new JScrollPane(jltServiceURLs,
-					VERTICAL_SCROLLBAR_AS_NEEDED,
-					HORIZONTAL_SCROLLBAR_AS_NEEDED);
-			jspServiceURLs.getViewport().setBackground(
-					jltServiceURLs.getBackground());
-
-			jpURLs.add(jlServiceURLs, NORTH);
-			jpURLs.add(jspServiceURLs, CENTER);
-
-			// Put it on the main content pane
-			getContentPane().add(jpURLs, CENTER);
-		}
-
-		// OK button
-		JPanel jpOK = new JPanel(new FlowLayout(FlowLayout.CENTER));
-
-		final JButton jbOK = new JButton("OK");
-		jbOK.addActionListener(new ActionListener() {
-			@Override
-			public void actionPerformed(ActionEvent evt) {
-				okPressed();
-			}
-		});
-
-		jpOK.add(jbOK);
-
-		/*
-		 * Put it all together (panel with URL list is already added, if it was
-		 * not null)
-		 */
-		getContentPane().add(jpCertificate, NORTH);
-		getContentPane().add(jpOK, SOUTH);
-
-		// Resizing wreaks havoc
-		setResizable(false);
-
-		addWindowListener(new WindowAdapter() {
-			@Override
-			public void windowClosing(WindowEvent evt) {
-				closeDialog();
-			}
-		});
-
-		getRootPane().setDefaultButton(jbOK);
-
-		pack();
-
-		invokeLater(new Runnable() {
-			@Override
-			public void run() {
-				jbOK.requestFocus();
-			}
-		});
-	}
-
-	private void okPressed() {
-		closeDialog();
-	}
-
-	private void closeDialog() {
-		setVisible(false);
-		dispose();
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/ViewUsernamePasswordEntryDialog.java
----------------------------------------------------------------------
diff --git a/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/ViewUsernamePasswordEntryDialog.java b/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/ViewUsernamePasswordEntryDialog.java
deleted file mode 100644
index 7c92842..0000000
--- a/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/ViewUsernamePasswordEntryDialog.java
+++ /dev/null
@@ -1,199 +0,0 @@
-/*******************************************************************************
- * 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.credentialmanager;
-
-import static java.awt.BorderLayout.CENTER;
-import static java.awt.BorderLayout.SOUTH;
-import static java.awt.GridBagConstraints.HORIZONTAL;
-import static java.awt.GridBagConstraints.NONE;
-import static java.awt.GridBagConstraints.WEST;
-
-import java.awt.BorderLayout;
-import java.awt.FlowLayout;
-import java.awt.GridBagConstraints;
-import java.awt.GridBagLayout;
-import java.awt.Insets;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.WindowAdapter;
-import java.awt.event.WindowEvent;
-
-import javax.swing.JButton;
-import javax.swing.JDialog;
-import javax.swing.JFrame;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JTextField;
-import javax.swing.border.CompoundBorder;
-import javax.swing.border.EmptyBorder;
-import javax.swing.border.EtchedBorder;
-
-import net.sf.taverna.t2.workbench.helper.NonBlockedHelpEnabledDialog;
-
-/**
- * Dialog used for viewing service URL, username and password.
- * 
- * @author Alex Nenadic
- */
-@SuppressWarnings("serial")
-public class ViewUsernamePasswordEntryDialog extends
-		NonBlockedHelpEnabledDialog {
-	/** Service URL field */
-	private JTextField serviceURLField;
-	/** Username field */
-	private JTextField usernameField;
-	/** Password field */
-	private JTextField passwordField;
-	/** Service URL value */
-	private String serviceURL;
-	/** Service username value */
-	private String username;
-	/** Service password value */
-	private String password;
-
-	public ViewUsernamePasswordEntryDialog(JFrame parent, String currentURL,
-			String currentUsername, String currentPassword) {
-		super(parent, "View username and password for a service", true);
-		serviceURL = currentURL;
-		username = currentUsername;
-		password = currentPassword;
-		initComponents();
-	}
-
-	public ViewUsernamePasswordEntryDialog(JDialog parent, String currentURL,
-			String currentUsername, String currentPassword) {
-		super(parent, "View username and password for a service", true);
-		serviceURL = currentURL;
-		username = currentUsername;
-		password = currentPassword;
-		initComponents();
-	}
-
-	private void initComponents() {
-		getContentPane().setLayout(new BorderLayout());
-
-		JLabel serviceURLLabel = new JLabel("Service URL");
-		serviceURLLabel.setBorder(new EmptyBorder(0, 5, 0, 0));
-		JLabel usernameLabel = new JLabel("Username");
-		usernameLabel.setBorder(new EmptyBorder(0, 5, 0, 0));
-		JLabel passwordLabel = new JLabel("Password");
-		passwordLabel.setBorder(new EmptyBorder(0, 5, 0, 0));
-
-		// Populate the fields with values and disable user input
-		serviceURLField = new JTextField();
-		serviceURLField.setText(serviceURL);
-		serviceURLField.setEditable(false);
-
-		usernameField = new JTextField(15);
-		usernameField.setText(username);
-		usernameField.setEditable(false);
-
-		passwordField = new JTextField(15);
-		passwordField.setText(password);
-		passwordField.setEditable(false);
-
-		JButton okButton = new JButton("OK");
-		okButton.addActionListener(new ActionListener() {
-			@Override
-			public void actionPerformed(ActionEvent evt) {
-				closeDialog();
-			}
-		});
-
-		JPanel fieldsPanel = new JPanel(new GridBagLayout());
-
-		GridBagConstraints gbc = new GridBagConstraints();
-		gbc.weighty = 0.0;
-
-		gbc.weightx = 0.0;
-		gbc.gridx = 0;
-		gbc.gridy = 0;
-		gbc.fill = NONE;
-		gbc.anchor = WEST;
-		gbc.insets = new Insets(5, 10, 0, 0);
-		fieldsPanel.add(serviceURLLabel, gbc);
-
-		gbc.weightx = 1.0;
-		gbc.gridx = 1;
-		gbc.gridy = 0;
-		gbc.fill = HORIZONTAL;
-		gbc.anchor = WEST;
-		gbc.insets = new Insets(5, 10, 0, 5);
-		fieldsPanel.add(serviceURLField, gbc);
-
-		gbc.weightx = 0.0;
-		gbc.gridx = 0;
-		gbc.gridy = 1;
-		gbc.fill = NONE;
-		gbc.anchor = WEST;
-		gbc.insets = new Insets(5, 10, 0, 0);
-		fieldsPanel.add(usernameLabel, gbc);
-
-		gbc.weightx = 1.0;
-		gbc.gridx = 1;
-		gbc.gridy = 1;
-		gbc.fill = HORIZONTAL;
-		gbc.anchor = WEST;
-		gbc.insets = new Insets(5, 10, 0, 5);
-		fieldsPanel.add(usernameField, gbc);
-
-		gbc.weightx = 0.0;
-		gbc.gridx = 0;
-		gbc.gridy = 2;
-		gbc.fill = NONE;
-		gbc.anchor = WEST;
-		gbc.insets = new Insets(5, 10, 0, 0);
-		fieldsPanel.add(passwordLabel, gbc);
-
-		gbc.weightx = 1.0;
-		gbc.gridx = 1;
-		gbc.gridy = 2;
-		gbc.fill = HORIZONTAL;
-		gbc.anchor = WEST;
-		gbc.insets = new Insets(5, 10, 0, 5);
-		fieldsPanel.add(passwordField, gbc);
-
-		fieldsPanel.setBorder(new CompoundBorder(
-				new EmptyBorder(10, 10, 10, 10), new EtchedBorder()));
-
-		JPanel buttonsPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
-		buttonsPanel.add(okButton);
-
-		getContentPane().add(fieldsPanel, CENTER);
-		getContentPane().add(buttonsPanel, SOUTH);
-
-		addWindowListener(new WindowAdapter() {
-			@Override
-			public void windowClosing(WindowEvent evt) {
-				closeDialog();
-			}
-		});
-
-		// setResizable(false);
-		getRootPane().setDefaultButton(okButton);
-		pack();
-	}
-
-	private void closeDialog() {
-		setVisible(false);
-		dispose();
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/WarnUserAboutJCEPolicyDialog.java
----------------------------------------------------------------------
diff --git a/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/WarnUserAboutJCEPolicyDialog.java b/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/WarnUserAboutJCEPolicyDialog.java
deleted file mode 100644
index 56b2f5b..0000000
--- a/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/WarnUserAboutJCEPolicyDialog.java
+++ /dev/null
@@ -1,223 +0,0 @@
-/*******************************************************************************
- * 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.credentialmanager;
-
-import static java.awt.BorderLayout.CENTER;
-import static java.awt.BorderLayout.SOUTH;
-import static java.awt.Desktop.getDesktop;
-import static javax.swing.border.EtchedBorder.LOWERED;
-import static javax.swing.event.HyperlinkEvent.EventType.ACTIVATED;
-import static org.apache.commons.io.FileUtils.touch;
-
-import java.awt.BorderLayout;
-import java.awt.Dimension;
-import java.awt.FlowLayout;
-import java.awt.Font;
-import java.awt.Frame;
-import java.awt.GraphicsEnvironment;
-import java.awt.Rectangle;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.io.File;
-import java.io.IOException;
-
-import javax.swing.JButton;
-import javax.swing.JCheckBox;
-import javax.swing.JEditorPane;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.border.CompoundBorder;
-import javax.swing.border.EmptyBorder;
-import javax.swing.border.EtchedBorder;
-import javax.swing.event.HyperlinkEvent;
-import javax.swing.event.HyperlinkListener;
-import javax.swing.text.Document;
-import javax.swing.text.html.HTMLEditorKit;
-import javax.swing.text.html.StyleSheet;
-
-import org.apache.taverna.security.credentialmanager.DistinguishedNameParser;
-import net.sf.taverna.t2.workbench.helper.NonBlockedHelpEnabledDialog;
-
-import org.apache.log4j.Logger;
-
-import uk.org.taverna.configuration.app.ApplicationConfiguration;
-
-/**
- * Dialog that warns user that they need to install unlimited cryptography
- * strength policy for Java.
- * 
- * @author Alex Nenadic
- */
-@SuppressWarnings("serial")
-public class WarnUserAboutJCEPolicyDialog extends NonBlockedHelpEnabledDialog {
-	private static final Logger logger = Logger
-			.getLogger(WarnUserAboutJCEPolicyDialog.class);
-
-	private JCheckBox doNotWarnMeAgainCheckBox;
-	private final ApplicationConfiguration applicationConfiguration;
-	private final DistinguishedNameParser dnParser;
-
-	public WarnUserAboutJCEPolicyDialog(
-			ApplicationConfiguration applicationConfiguration,
-			DistinguishedNameParser dnParser) {
-		super((Frame) null,
-				"Java Unlimited Strength Cryptography Policy Warning", true);
-		this.applicationConfiguration = applicationConfiguration;
-		this.dnParser = dnParser;
-		initComponents();
-	}
-
-	// For testing
-	public static void main(String[] args) {
-		WarnUserAboutJCEPolicyDialog dialog = new WarnUserAboutJCEPolicyDialog(
-				null, null);
-		dialog.setVisible(true);
-	}
-
-	private void initComponents() {
-		// Base font for all components on the form
-		Font baseFont = new JLabel("base font").getFont().deriveFont(11f);
-
-		// Message saying that updates are available
-		JPanel messagePanel = new JPanel(new BorderLayout());
-		messagePanel.setBorder(new CompoundBorder(new EmptyBorder(10, 10, 10,
-				10), new EtchedBorder(LOWERED)));
-
-		JEditorPane message = new JEditorPane();
-		message.setEditable(false);
-		message.setBackground(this.getBackground());
-		message.setFocusable(false);
-		HTMLEditorKit kit = new HTMLEditorKit();
-		message.setEditorKit(kit);
-		StyleSheet styleSheet = kit.getStyleSheet();
-		//styleSheet.addRule("body {font-family:"+baseFont.getFamily()+"; font-size:"+baseFont.getSize()+";}"); // base font looks bigger when rendered as HTML
-		styleSheet.addRule("body {font-family:" + baseFont.getFamily()
-				+ "; font-size:10px;}");
-		Document doc = kit.createDefaultDocument();
-		message.setDocument(doc);
-		message.setText("<html><body>In order for Taverna's security features to function properly - you need to install<br>"
-				+ "'Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy'. <br><br>"
-				+ "If you do not already have it, for <b>Java 6</b> you can get it from:<br>"
-				+ "<a href=\"http://www.oracle.com/technetwork/java/javase/downloads/index.html\">http://www.oracle.com/technetwork/java/javase/downloads/index.html</a><br<br>"
-				+ "Installation instructions are contained in the bundle you download."
-				+ "</body><html>");
-		message.addHyperlinkListener(new HyperlinkListener() {
-			@Override
-			public void hyperlinkUpdate(HyperlinkEvent he) {
-				HyperlinkEvent.EventType type = he.getEventType();
-				if (type == ACTIVATED)
-					// Open a Web browser
-					try {
-						getDesktop().browse(he.getURL().toURI());
-//						BrowserLauncher launcher = new BrowserLauncher();
-//						launcher.openURLinBrowser(he.getURL().toString());
-					} catch (Exception ex) {
-						logger.error("Failed to launch browser to fetch JCE "
-								+ he.getURL());
-					}
-			}
-		});
-		message.setBorder(new EmptyBorder(5, 5, 5, 5));
-		messagePanel.add(message, CENTER);
-
-		doNotWarnMeAgainCheckBox = new JCheckBox("Do not warn me again");
-		doNotWarnMeAgainCheckBox.setFont(baseFont.deriveFont(12f));
-		messagePanel.add(doNotWarnMeAgainCheckBox, SOUTH);
-
-		// Buttons
-		JPanel buttonsPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
-		JButton okButton = new JButton("OK");
-		okButton.setFont(baseFont);
-		okButton.addActionListener(new ActionListener() {
-			@Override
-			public void actionPerformed(ActionEvent e) {
-				okPressed();
-			}
-		});
-
-		buttonsPanel.add(okButton);
-
-		getContentPane().setLayout(new BorderLayout());
-		getContentPane().add(messagePanel, CENTER);
-		getContentPane().add(buttonsPanel, SOUTH);
-
-		pack();
-		setResizable(false);
-		// Center the dialog on the screen (we do not have the parent)
-		Dimension dimension = getToolkit().getScreenSize();
-		Rectangle abounds = getBounds();
-		setLocation((dimension.width - abounds.width) / 2,
-				(dimension.height - abounds.height) / 2);
-		setSize(getPreferredSize());
-	}
-
-	private static final String DO_NOT_WARN_ABOUT_JCE_POLICY = "do_not_warn_about_JCE_policy";
-	public static boolean warnedUser = false; // have we already warned user for
-												// this run
-
-	/**
-	 * Warn user that they need to install Java Cryptography Extension (JCE)
-	 * Unlimited Strength Jurisdiction Policy if they want Credential Manager to
-	 * function properly.
-	 */
-	public static void warnUserAboutJCEPolicy(
-			ApplicationConfiguration applicationConfiguration,
-			DistinguishedNameParser dnParser) {
-		/*
-		 * Do not pop up a dialog if we are running headlessly. If we have
-		 * warned the user and they do not want us to remind them again - exit.
-		 */
-		if (warnedUser || GraphicsEnvironment.isHeadless()
-				|| doNotWarnFile(applicationConfiguration, dnParser).exists())
-			return;
-
-		WarnUserAboutJCEPolicyDialog warnDialog = new WarnUserAboutJCEPolicyDialog(
-				applicationConfiguration, dnParser);
-		warnDialog.setVisible(true);
-		warnedUser = true;
-	}
-
-	private static File doNotWarnFile(
-			ApplicationConfiguration applicationConfiguration,
-			DistinguishedNameParser dnParser) {
-		return new File(
-				dnParser.getCredentialManagerDefaultDirectory(applicationConfiguration),
-				DO_NOT_WARN_ABOUT_JCE_POLICY);
-	}
-
-	protected void okPressed() {
-		try {
-			if (doNotWarnMeAgainCheckBox.isSelected())
-				touch(doNotWarnFile(applicationConfiguration, dnParser));
-		} catch (IOException e) {
-			logger.error(
-					"Failed to touch the 'Do not want me about JCE unilimited security policy' file.",
-					e);
-		}
-		closeDialog();
-	}
-
-	private void closeDialog() {
-		setVisible(false);
-		dispose();
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/action/CredentialManagerAction.java
----------------------------------------------------------------------
diff --git a/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/action/CredentialManagerAction.java b/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/action/CredentialManagerAction.java
deleted file mode 100644
index 229fc11..0000000
--- a/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/action/CredentialManagerAction.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*******************************************************************************
- * 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.credentialmanager.action;
-
-import static javax.swing.SwingUtilities.invokeLater;
-
-import java.awt.event.ActionEvent;
-
-import javax.swing.AbstractAction;
-import javax.swing.ImageIcon;
-
-import org.apache.taverna.security.credentialmanager.CredentialManager;
-import org.apache.taverna.security.credentialmanager.DistinguishedNameParser;
-import net.sf.taverna.t2.workbench.ui.credentialmanager.CredentialManagerUI;
-
-//import javax.swing.SwingUtilities;
-
-@SuppressWarnings("serial")
-public class CredentialManagerAction extends AbstractAction {
-	private static ImageIcon ICON = new ImageIcon(
-			CredentialManagerAction.class
-					.getResource("/images/cred_manager16x16.png"));
-
-	private CredentialManagerUI cmUI;
-	private final CredentialManager credentialManager;
-	private final DistinguishedNameParser dnParser;
-
-	public CredentialManagerAction(CredentialManager credentialManager,
-			DistinguishedNameParser dnParser) {
-		super("Credential Manager", ICON);
-		this.credentialManager = credentialManager;
-		this.dnParser = dnParser;
-	}
-
-	@Override
-	public void actionPerformed(ActionEvent e) {
-		if (cmUI != null) {
-			cmUI.setVisible(true);
-			return;
-		}
-
-		invokeLater(new Runnable() {
-			@Override
-			public void run() {
-				cmUI = new CredentialManagerUI(credentialManager, dnParser);
-				cmUI.setVisible(true);
-			}
-		});
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/menu/CredentialManagerMenu.java
----------------------------------------------------------------------
diff --git a/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/menu/CredentialManagerMenu.java b/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/menu/CredentialManagerMenu.java
deleted file mode 100644
index 5cbc10d..0000000
--- a/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/menu/CredentialManagerMenu.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*******************************************************************************
- * 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.credentialmanager.menu;
-
-import java.net.URI;
-
-import javax.swing.Action;
-
-//import org.apache.log4j.Logger;
-
-import org.apache.taverna.security.credentialmanager.CredentialManager;
-import org.apache.taverna.security.credentialmanager.DistinguishedNameParser;
-import net.sf.taverna.t2.ui.menu.AbstractMenuAction;
-import net.sf.taverna.t2.workbench.ui.credentialmanager.action.CredentialManagerAction;
-
-public class CredentialManagerMenu extends AbstractMenuAction {
-	private static final String MENU_URI = "http://taverna.sf.net/2008/t2workbench/menu#advanced";
-
-	private CredentialManager credentialManager;
-	private DistinguishedNameParser dnParser;
-
-	// private static Logger logger = Logger.getLogger(CredentialManagerMenu.class);
-
-	public CredentialManagerMenu() {
-		super(URI.create(MENU_URI), 60);
-		/* This is now done in the initialise SSL startup hook - no need to do it here.
-		// Force initialisation at startup
-		try {
-			CredentialManager.getInstance();
-		} catch (CMException e) {
-			logger.error("Could not initialise SSL properties for SSL connections from Taverna.", e);
-		}
-		*/
-	}
-
-	@Override
-	protected Action createAction() {
-		return new CredentialManagerAction(credentialManager, dnParser);
-	}
-
-	public void setCredentialManager(CredentialManager credentialManager) {
-		this.credentialManager = credentialManager;
-	}
-
-	/**
-	 * @param dnParser
-	 *            the dnParser to set
-	 */
-	public void setDistinguishedNameParser(DistinguishedNameParser dnParser) {
-		this.dnParser = dnParser;
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/password/AskUserJavaTruststorePasswordProvider.java
----------------------------------------------------------------------
diff --git a/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/password/AskUserJavaTruststorePasswordProvider.java b/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/password/AskUserJavaTruststorePasswordProvider.java
deleted file mode 100644
index 7cbdc4c..0000000
--- a/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/password/AskUserJavaTruststorePasswordProvider.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2008-2010 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.credentialmanager.password;
-
-import org.apache.taverna.security.credentialmanager.JavaTruststorePasswordProvider;
-
-/**
- * An implementation of the {@link JavaTruststorePasswordProvider} that pops up a
- * dialog and asks the user to provide the password.
- * 
- * @author Alex Nenadic
- *
- */
-public class AskUserJavaTruststorePasswordProvider implements JavaTruststorePasswordProvider{
-
-	@Override
-	public String getJavaTruststorePassword() {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	@Override
-	public void setJavaTruststorePassword(String password) {
-		// TODO Auto-generated method stub
-		
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/password/AskUserMasterPasswordProvider.java
----------------------------------------------------------------------
diff --git a/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/password/AskUserMasterPasswordProvider.java b/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/password/AskUserMasterPasswordProvider.java
deleted file mode 100644
index 1df5dad..0000000
--- a/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/password/AskUserMasterPasswordProvider.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2008-2010 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.credentialmanager.password;
-
-import org.apache.taverna.security.credentialmanager.MasterPasswordProvider;
-
-public class AskUserMasterPasswordProvider implements MasterPasswordProvider{
-
-//	@Override
-//	public boolean canProvideMasterPassword() {
-//		// TODO Auto-generated method stub
-//		return false;
-//	}
-	private int priority = 100;
-
-	@Override
-	public String getMasterPassword(boolean firstTime) {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	@Override
-	public int getProviderPriority() {
-		return priority;
-	}
-
-	@Override
-	public void setMasterPassword(String password) {
-		// TODO Auto-generated method stub	
-	}
-	
-//	@Override
-//	public void setProviderPriority(int priority) {
-//		this.priority = priority;
-//	}
-	
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/password/AskUserServiceUsernameAndPasswordProvider.java
----------------------------------------------------------------------
diff --git a/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/password/AskUserServiceUsernameAndPasswordProvider.java b/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/password/AskUserServiceUsernameAndPasswordProvider.java
deleted file mode 100644
index 10a771a..0000000
--- a/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/password/AskUserServiceUsernameAndPasswordProvider.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package net.sf.taverna.t2.workbench.ui.credentialmanager.password;
-
-import java.net.URI;
-
-import org.apache.taverna.security.credentialmanager.ServiceUsernameAndPasswordProvider;
-import org.apache.taverna.security.credentialmanager.UsernamePassword;
-
-public class AskUserServiceUsernameAndPasswordProvider implements ServiceUsernameAndPasswordProvider{
-
-	@Override
-	public UsernamePassword getServiceUsernameAndPassword(URI serviceURI, String requestMessage) {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	@Override
-	public void setServiceUsernameAndPassword(URI serviceURI,
-			UsernamePassword usernamePassword) {
-		// TODO Auto-generated method stub
-		
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/password/AskUserTrustConfirmationProvider.java
----------------------------------------------------------------------
diff --git a/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/password/AskUserTrustConfirmationProvider.java b/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/password/AskUserTrustConfirmationProvider.java
deleted file mode 100644
index b114763..0000000
--- a/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/password/AskUserTrustConfirmationProvider.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2008-2010 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.credentialmanager.password;
-
-import java.security.cert.X509Certificate;
-
-import org.apache.taverna.security.credentialmanager.TrustConfirmationProvider;
-
-public class AskUserTrustConfirmationProvider implements TrustConfirmationProvider {
-
-	@Override
-	public Boolean shouldTrustCertificate(X509Certificate[] chain) {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/password/GetPasswordDialog.java
----------------------------------------------------------------------
diff --git a/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/password/GetPasswordDialog.java b/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/password/GetPasswordDialog.java
deleted file mode 100644
index 851e900..0000000
--- a/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/password/GetPasswordDialog.java
+++ /dev/null
@@ -1,228 +0,0 @@
-/*******************************************************************************
- * 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.credentialmanager.password;
-
-import static java.awt.BorderLayout.CENTER;
-import static java.awt.BorderLayout.NORTH;
-import static java.awt.BorderLayout.SOUTH;
-import static java.awt.FlowLayout.LEFT;
-import static java.awt.FlowLayout.RIGHT;
-import static javax.swing.JOptionPane.WARNING_MESSAGE;
-import static javax.swing.JOptionPane.showMessageDialog;
-
-import java.awt.BorderLayout;
-import java.awt.Dimension;
-import java.awt.FlowLayout;
-import java.awt.Frame;
-import java.awt.GridLayout;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.WindowAdapter;
-import java.awt.event.WindowEvent;
-
-import javax.swing.JButton;
-import javax.swing.JCheckBox;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JPasswordField;
-import javax.swing.JTextField;
-import javax.swing.border.CompoundBorder;
-import javax.swing.border.EmptyBorder;
-import javax.swing.border.EtchedBorder;
-
-import net.sf.taverna.t2.workbench.helper.NonBlockedHelpEnabledDialog;
-
-/**
- * Dialog for entering user's username and password.
- * 
- * @author Alex Nenadic
- */
-@SuppressWarnings("serial")
-public class GetPasswordDialog extends NonBlockedHelpEnabledDialog {
-	/**
-	 * Whether we should ask user to save their username and password using
-	 * Credential Manager
-	 */
-	private boolean shouldAskUserToSave;
-	/** Username field */
-	private JTextField usernameField;
-	/** Password field */
-	private JPasswordField passwordField;
-	/**
-	 * Whether user wished to save the username and password using Credential
-	 * Manager
-	 */
-	private JCheckBox saveCheckBox;
-	/** The entered username */
-	private String username;
-	/** The entered password */
-	private String password;
-	/** Instructions to the user */
-	private String instructions;
-
-	public GetPasswordDialog(String instructions, boolean shouldAskUserToSave) {
-		super((Frame) null, "Enter username and password", true);
-		this.instructions = instructions;
-		this.shouldAskUserToSave = shouldAskUserToSave;
-		initComponents();
-	}
-
-	private void initComponents() {
-		getContentPane().setLayout(new BorderLayout());
-
-		JLabel instructionsLabel = new JLabel(instructions);
-		instructionsLabel.setBorder(new EmptyBorder(5, 5, 5, 5));
-		JPanel jpInstructions = new JPanel(new FlowLayout(LEFT));
-		jpInstructions.add(instructionsLabel);
-
-		JLabel usernameLabel = new JLabel("Username");
-		usernameLabel.setBorder(new EmptyBorder(5, 5, 5, 5));
-		JLabel passwordLabel = new JLabel("Password");
-		passwordLabel.setBorder(new EmptyBorder(5, 5, 5, 5));
-
-		usernameField = new JTextField(15);
-		passwordField = new JPasswordField(15);
-
-		JButton okButton = new JButton("OK");
-		okButton.addActionListener(new ActionListener() {
-			@Override
-			public void actionPerformed(ActionEvent evt) {
-				okPressed();
-			}
-		});
-
-		JButton cancelButton = new JButton("Cancel");
-		cancelButton.addActionListener(new ActionListener() {
-			@Override
-			public void actionPerformed(ActionEvent evt) {
-				cancelPressed();
-			}
-		});
-
-        // Central panel with username/password fields and a "Do you want to Save?" checkbox
-		JPanel mainPanel = new JPanel(new BorderLayout());
-
-		JPanel passwordPanel = new JPanel(new GridLayout(2, 2, 5, 5));
-		passwordPanel.add(usernameLabel);
-		passwordPanel.add(usernameField);
-		passwordPanel.add(passwordLabel);
-		passwordPanel.add(passwordField);
-		mainPanel.add(passwordPanel, CENTER);
-
-		// If user wants to save this username and password
-		saveCheckBox = new JCheckBox();
-		saveCheckBox.setBorder(new EmptyBorder(5, 5, 5, 5));
-		saveCheckBox.setSelected(true);
-		saveCheckBox
-				.setText("Use Credential Manager to save this username and password");
-		if (shouldAskUserToSave) {
-			JPanel jpSaveCheckBox = new JPanel(new FlowLayout(LEFT));
-			jpSaveCheckBox.add(saveCheckBox);
-			mainPanel.add(jpSaveCheckBox, SOUTH);
-		}
-
-		passwordPanel.setBorder(new CompoundBorder(new EmptyBorder(10, 10, 10,
-				10), new EtchedBorder()));
-
-		JPanel buttonsPanel = new JPanel(new FlowLayout(RIGHT));
-		buttonsPanel.add(okButton);
-		buttonsPanel.add(cancelButton);
-
-		passwordPanel.setMinimumSize(new Dimension(300, 100));
-
-		getContentPane().add(jpInstructions, NORTH);
-		getContentPane().add(mainPanel, CENTER);
-		getContentPane().add(buttonsPanel, SOUTH);
-
-		addWindowListener(new WindowAdapter() {
-			@Override
-			public void windowClosing(WindowEvent evt) {
-				closeDialog();
-			}
-		});
-
-		setResizable(false);
-		getRootPane().setDefaultButton(okButton);
-		pack();
-	}
-
-	public String getUsername() {
-		return username;
-	}
-
-	public String getPassword() {
-		return password;
-	}
-
-	/**
-	 * Check if user wishes to save username and pasword using the Credential
-	 * Manager.
-	 */
-	public boolean shouldSaveUsernameAndPassword() {
-		return saveCheckBox.isSelected();
-	}
-
-	private boolean checkControls() {
-		username = usernameField.getText();
-		if (username.length() == 0) {
-			showMessageDialog(this, "Username cannot be empty", "Warning",
-					WARNING_MESSAGE);
-			return false;
-		}
-
-		password = new String(passwordField.getPassword());
-		if (password.length() == 0) { // password empty
-			showMessageDialog(this, "Password cannot be empty", "Warning",
-					WARNING_MESSAGE);
-
-			return false;
-		}
-
-		return true;
-	}
-
-	private void okPressed() {
-		if (checkControls())
-			closeDialog();
-	}
-
-	private void cancelPressed() {
-		// Set all fields to null to indicate that cancel button was pressed
-		username = null;
-		password = null;
-		closeDialog();
-	}
-
-	private void closeDialog() {
-		setVisible(false);
-		dispose();
-	}
-
-	public void setUsername(String username) {
-		this.username = username;
-		usernameField.setText(username);
-	}
-
-	public void setPassword(String password) {
-		this.password = password;
-		passwordField.setText(password);
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/password/SimpleMasterPasswordProvider.java
----------------------------------------------------------------------
diff --git a/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/password/SimpleMasterPasswordProvider.java b/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/password/SimpleMasterPasswordProvider.java
deleted file mode 100644
index bfa9841..0000000
--- a/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/password/SimpleMasterPasswordProvider.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2008-2010 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.credentialmanager.password;
-
-import org.apache.taverna.security.credentialmanager.MasterPasswordProvider;
-
-/**
- * A simple implementation of {@link MasterPasswordProvider} that just provides
- * a master password that can be obtained and set from outside the provider.
- * 
- * @author Alex Nenadic
- */
-public class SimpleMasterPasswordProvider implements MasterPasswordProvider {
-	private String masterPassword;
-	private int priority = 200;
-	
-	@Override
-	public String getMasterPassword(boolean firstTime) {
-		return masterPassword;
-	}
-	
-	@Override
-	public void setMasterPassword(String masterPassword){
-		this.masterPassword = masterPassword;
-	}
-
-	@Override
-	public int getProviderPriority() {
-		return priority;
-	}
-
-//	@Override
-//	public void setProviderPriority(int priority) {
-//		this.priority = priority;		
-//	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/password/UIMasterPasswordProvider.java
----------------------------------------------------------------------
diff --git a/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/password/UIMasterPasswordProvider.java b/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/password/UIMasterPasswordProvider.java
deleted file mode 100644
index 27aee05..0000000
--- a/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/password/UIMasterPasswordProvider.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2009-2010 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.credentialmanager.password;
-
-import java.awt.GraphicsEnvironment;
-
-import javax.swing.JFrame;
-import org.apache.taverna.security.credentialmanager.DistinguishedNameParser;
-
-import uk.org.taverna.configuration.app.ApplicationConfiguration;
-
-import org.apache.taverna.security.credentialmanager.JavaTruststorePasswordProvider;
-import org.apache.taverna.security.credentialmanager.MasterPasswordProvider;
-import net.sf.taverna.t2.workbench.ui.credentialmanager.GetMasterPasswordDialog;
-import net.sf.taverna.t2.workbench.ui.credentialmanager.SetMasterPasswordDialog;
-import net.sf.taverna.t2.workbench.ui.credentialmanager.WarnUserAboutJCEPolicyDialog;
-
-/**
- * A UI pop-up that asks user for a master password for Credential Manager.
- *
- * @author Alex Nenadic
- * @author Stian Soiland-Reyes
- *
- */
-public class UIMasterPasswordProvider implements MasterPasswordProvider, JavaTruststorePasswordProvider {
-
-	private ApplicationConfiguration applicationConfiguration;
-
-        private DistinguishedNameParser dnParser;
-        
-	@Override
-	public String getJavaTruststorePassword() {
-		if (GraphicsEnvironment.isHeadless()) {
-			return null;
-		}
-
-		GetMasterPasswordDialog getPasswordDialog = new GetMasterPasswordDialog(
-				"Credential Manager needs to copy certificates from Java truststore. "
-						+ "Please enter your password.");
-		getPasswordDialog.setLocationRelativeTo(null);
-		getPasswordDialog.setVisible(true);
-		String javaTruststorePassword = getPasswordDialog.getPassword();
-		return javaTruststorePassword;
-	}
-
-	@Override
-	public void setJavaTruststorePassword(String password) {
-	}
-
-	@Override
-	public String getMasterPassword(boolean firstTime) {
-
-		// Check if this Taverna run is headless (i.e. Taverna Server or Taverna
-		// from command line) - do not do anything here if it is as we do not
-		// want
-		// any windows popping up even if they could
-		if (GraphicsEnvironment.isHeadless()) {
-			return null;
-		}
-
-		// Pop up a warning about Java Cryptography Extension (JCE)
-		// Unlimited Strength Jurisdiction Policy
-		WarnUserAboutJCEPolicyDialog.warnUserAboutJCEPolicy(applicationConfiguration, dnParser);
-
-		if (firstTime) {
-			// Ask user to set the master password for Credential Manager (only
-			// the first time)
-			SetMasterPasswordDialog setPasswordDialog = new SetMasterPasswordDialog(
-					(JFrame) null, "Set master password", true,
-					"Set master password for Credential Manager");
-			setPasswordDialog.setLocationRelativeTo(null);
-			setPasswordDialog.setVisible(true);
-			return setPasswordDialog.getPassword();
-		} else {
-			// Ask user to provide a master password for Credential Manager
-			GetMasterPasswordDialog getPasswordDialog = new GetMasterPasswordDialog(
-			"Enter master password for Credential Manager");
-			getPasswordDialog.setLocationRelativeTo(null);
-			getPasswordDialog.setVisible(true);
-			return getPasswordDialog.getPassword();
-		}
-	}
-
-	@Override
-	public void setMasterPassword(String password) {
-	}
-
-	@Override
-	public int getProviderPriority() {
-		return 100;
-	}
-
-	/**
-	 * Sets the applicationConfiguration.
-	 *
-	 * @param applicationConfiguration the new value of applicationConfiguration
-	 */
-	public void setApplicationConfiguration(ApplicationConfiguration applicationConfiguration) {
-		this.applicationConfiguration = applicationConfiguration;
-	}
-        
-        /**
-	 * @param dnParser the dnParser to set
-	 */
-	public void setDistinguishedNameParser(DistinguishedNameParser dnParser) {
-		this.dnParser = dnParser;
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/password/UIUsernamePasswordProvider.java
----------------------------------------------------------------------
diff --git a/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/password/UIUsernamePasswordProvider.java b/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/password/UIUsernamePasswordProvider.java
deleted file mode 100644
index d0740df..0000000
--- a/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/password/UIUsernamePasswordProvider.java
+++ /dev/null
@@ -1,92 +0,0 @@
-package net.sf.taverna.t2.workbench.ui.credentialmanager.password;
-
-import static java.awt.GraphicsEnvironment.isHeadless;
-
-import java.net.URI;
-import java.net.URISyntaxException;
-
-import org.apache.taverna.security.credentialmanager.DistinguishedNameParser;
-import org.apache.taverna.security.credentialmanager.ServiceUsernameAndPasswordProvider;
-import org.apache.taverna.security.credentialmanager.UsernamePassword;
-
-import org.apache.log4j.Logger;
-
-public class UIUsernamePasswordProvider implements
-		ServiceUsernameAndPasswordProvider {
-	private static final Logger logger = Logger
-			.getLogger(UIUsernamePasswordProvider.class);
-
-	private DistinguishedNameParser dnParser;
-
-	public boolean canProvideUsernamePassword(URI serviceURI) {
-		return !isHeadless();
-	}
-
-	@Override
-	public UsernamePassword getServiceUsernameAndPassword(URI serviceURI,
-			String requestingPrompt) {
-		URI displayURI = serviceURI;
-
-		try {
-			displayURI = dnParser.setFragmentForURI(displayURI, null);
-			displayURI = dnParser.setUserInfoForURI(displayURI, null);
-		} catch (URISyntaxException e) {
-			logger.warn("Could not strip fragment/userinfo from " + serviceURI,
-					e);
-		}
-
-		StringBuilder message = new StringBuilder();
-		message.append("<html><body>The Taverna Credential Manager could not find a ");
-		message.append("username and password for the service at:");
-		message.append("<br><br><code>");
-		message.append(displayURI);
-		message.append("</code>");
-		if (requestingPrompt != null && !requestingPrompt.isEmpty()) {
-			message.append("<p><i>");
-			message.append(requestingPrompt);
-			message.append("</i>");
-		}
-		message.append("<br><br>Please provide the username and password.</body></html>");
-
-		GetPasswordDialog getPasswordDialog = new GetPasswordDialog(
-				message.toString(), true);
-		getPasswordDialog.setLocationRelativeTo(null);
-		if (serviceURI.getRawUserInfo() != null
-				&& serviceURI.getRawUserInfo().length() > 1) {
-			String userInfo = serviceURI.getRawUserInfo();
-			String[] userPassword = userInfo.split(":", 2);
-			if (userPassword.length == 2) {
-				getPasswordDialog.setUsername(userPassword[0]);
-				getPasswordDialog.setPassword(userPassword[1]);
-			}
-		}
-		getPasswordDialog.setVisible(true);
-
-		String username = getPasswordDialog.getUsername(); // get username
-		String password = getPasswordDialog.getPassword(); // get password
-		boolean shouldSaveUsernameAndPassword = getPasswordDialog
-				.shouldSaveUsernameAndPassword();
-		if (username == null || password == null)
-			// user cancelled - any of the above two variables is null
-			return null;
-
-		UsernamePassword credential = new UsernamePassword();
-		credential.setUsername(username);
-		credential.setPassword(password.toCharArray());
-		credential.setShouldSave(shouldSaveUsernameAndPassword);
-		return credential;
-	}
-
-	@Override
-	public void setServiceUsernameAndPassword(URI serviceURI,
-			UsernamePassword usernamePassword) {
-	}
-
-	/**
-	 * @param dnParser
-	 *            the dnParser to set
-	 */
-	public void setDistinguishedNameParser(DistinguishedNameParser dnParser) {
-		this.dnParser = dnParser;
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/startup/InitialiseSSLStartupHook.java
----------------------------------------------------------------------
diff --git a/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/startup/InitialiseSSLStartupHook.java b/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/startup/InitialiseSSLStartupHook.java
deleted file mode 100644
index 4805fbd..0000000
--- a/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/startup/InitialiseSSLStartupHook.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*******************************************************************************
- *  Copyright (C) 2007-2010 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.credentialmanager.startup;
-
-import org.apache.log4j.Logger;
-
-import org.apache.taverna.security.credentialmanager.CMException;
-import org.apache.taverna.security.credentialmanager.CredentialManager;
-import net.sf.taverna.t2.workbench.StartupSPI;
-
-/**
- * 
- * Startup hook to initialise SSL socket factory used by Taverna for creating
- * HTTPS connections.
- * 
- * @author Alex Nenadic
- * @author Stian Soiland-Reyes
- */
-public class InitialiseSSLStartupHook implements StartupSPI {
-	private static final Logger logger = Logger
-			.getLogger(InitialiseSSLStartupHook.class);
-
-	private CredentialManager credManager;
-
-	@Override
-	public int positionHint() {
-		return 25;
-	}
-
-	@Override
-	public boolean startup() {
-		logger.info("Initialising SSL socket factory for SSL connections from Taverna.");
-		try {
-			credManager.initializeSSL();
-		} catch (CMException e) {
-			logger.error(
-					"Could not initialise the SSL socket factory (for creating SSL connections)"
-							+ " using Taverna's keystores.", e);
-		}
-		return true;
-	}
-
-	public void setCredentialManager(CredentialManager credManager) {
-		this.credManager = credManager;
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/startup/SetCredManAuthenticatorStartupHook.java
----------------------------------------------------------------------
diff --git a/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/startup/SetCredManAuthenticatorStartupHook.java b/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/startup/SetCredManAuthenticatorStartupHook.java
deleted file mode 100644
index 64e607a..0000000
--- a/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/startup/SetCredManAuthenticatorStartupHook.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package net.sf.taverna.t2.workbench.ui.credentialmanager.startup;
-
-import java.net.Authenticator;
-import org.apache.taverna.security.credentialmanager.CredentialManager;
-import net.sf.taverna.t2.workbench.StartupSPI;
-
-public class SetCredManAuthenticatorStartupHook implements StartupSPI {
-	private CredentialManager credManager;
-
-	@Override
-	public int positionHint() {
-		return 50;
-	}
-
-	@Override
-	public boolean startup() {
-		Authenticator.setDefault(credManager.getAuthenticator());
-		return true;
-	}
-
-	public void setCredentialManager(CredentialManager credManager) {
-		this.credManager = credManager;
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/toolbar/CredentialManagerToolbarAction.java
----------------------------------------------------------------------
diff --git a/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/toolbar/CredentialManagerToolbarAction.java b/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/toolbar/CredentialManagerToolbarAction.java
deleted file mode 100644
index d515809..0000000
--- a/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/toolbar/CredentialManagerToolbarAction.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * 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.credentialmanager.toolbar;
-
-import static net.sf.taverna.t2.workbench.ui.credentialmanager.toolbar.CredentialManagerToolbarSection.CREDENTIAL_MANAGER_TOOLBAR_SECTION;
-
-import java.net.URI;
-
-import javax.swing.Action;
-
-import net.sf.taverna.t2.ui.menu.AbstractMenuAction;
-import net.sf.taverna.t2.workbench.ui.credentialmanager.action.CredentialManagerAction;
-
-public class CredentialManagerToolbarAction extends AbstractMenuAction {
-	private static final String ENTRY_URI = "http://taverna.sf.net/2008/t2workbench/toolbar#credentialManagerAction";
-
-	public CredentialManagerToolbarAction() {
-		super(CREDENTIAL_MANAGER_TOOLBAR_SECTION, 100, URI.create(ENTRY_URI));
-	}
-
-	@Override
-	protected Action createAction() {
-		// need to add CredentialManager if toolbar is ever used
-		return new CredentialManagerAction(null, null);
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/toolbar/CredentialManagerToolbarSection.java
----------------------------------------------------------------------
diff --git a/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/toolbar/CredentialManagerToolbarSection.java b/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/toolbar/CredentialManagerToolbarSection.java
deleted file mode 100644
index e5367be..0000000
--- a/taverna-credential-manager-ui/src/main/java/net/sf/taverna/t2/workbench/ui/credentialmanager/toolbar/CredentialManagerToolbarSection.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*******************************************************************************
- * 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.credentialmanager.toolbar;
-
-import static net.sf.taverna.t2.ui.menu.DefaultToolBar.DEFAULT_TOOL_BAR;
-
-import java.net.URI;
-
-import net.sf.taverna.t2.ui.menu.AbstractMenuSection;
-
-public class CredentialManagerToolbarSection extends AbstractMenuSection {
-	private static final String ENTRY_URI = "http://taverna.sf.net/2008/t2workbench/toolbar#credentialManagerSection";
-	/** {@value #ENTRY_URI} */
-	public static URI CREDENTIAL_MANAGER_TOOLBAR_SECTION = URI
-			.create(ENTRY_URI);
-
-	public CredentialManagerToolbarSection() {
-		super(DEFAULT_TOOL_BAR, 300, CREDENTIAL_MANAGER_TOOLBAR_SECTION);
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/CMStrings.java
----------------------------------------------------------------------
diff --git a/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/CMStrings.java b/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/CMStrings.java
new file mode 100644
index 0000000..849fb96
--- /dev/null
+++ b/taverna-credential-manager-ui/src/main/java/org/apache/taverna/workbench/ui/credentialmanager/CMStrings.java
@@ -0,0 +1,26 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.workbench.ui.credentialmanager;
+
+interface CMStrings {
+	String ALERT_TITLE = "Credential Manager Alert";
+	String ERROR_TITLE = "Credential Manager Error";
+	String WARN_TITLE = "Credential Manager Warning";
+}


[48/51] [partial] incubator-taverna-workbench git commit: all packages are moved to org.apache.taverna.*

Posted by re...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-impl/src/main/java/org/apache/taverna/servicedescriptions/impl/ServiceDescriptionRegistryImpl.java
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-impl/src/main/java/org/apache/taverna/servicedescriptions/impl/ServiceDescriptionRegistryImpl.java b/taverna-activity-palette-impl/src/main/java/org/apache/taverna/servicedescriptions/impl/ServiceDescriptionRegistryImpl.java
new file mode 100644
index 0000000..878cb19
--- /dev/null
+++ b/taverna-activity-palette-impl/src/main/java/org/apache/taverna/servicedescriptions/impl/ServiceDescriptionRegistryImpl.java
@@ -0,0 +1,652 @@
+/*******************************************************************************
+ * 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 org.apache.taverna.servicedescriptions.impl;
+
+import static java.lang.System.currentTimeMillis;
+import static java.lang.Thread.MIN_PRIORITY;
+import static java.lang.Thread.currentThread;
+
+import java.io.File;
+import java.io.IOException;
+import java.lang.Thread.UncaughtExceptionHandler;
+import java.lang.reflect.InvocationTargetException;
+import java.net.URI;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.taverna.lang.observer.MultiCaster;
+import org.apache.taverna.lang.observer.Observer;
+import org.apache.taverna.servicedescriptions.ConfigurableServiceProvider;
+import org.apache.taverna.servicedescriptions.ServiceDescription;
+import org.apache.taverna.servicedescriptions.ServiceDescriptionProvider;
+import org.apache.taverna.servicedescriptions.ServiceDescriptionsConfiguration;
+import org.apache.taverna.servicedescriptions.ServiceDescriptionProvider.FindServiceDescriptionsCallBack;
+import org.apache.taverna.servicedescriptions.ServiceDescriptionRegistry;
+import org.apache.taverna.servicedescriptions.events.AddedProviderEvent;
+import org.apache.taverna.servicedescriptions.events.PartialServiceDescriptionsNotification;
+import org.apache.taverna.servicedescriptions.events.ProviderErrorNotification;
+import org.apache.taverna.servicedescriptions.events.ProviderStatusNotification;
+import org.apache.taverna.servicedescriptions.events.ProviderUpdatingNotification;
+import org.apache.taverna.servicedescriptions.events.ProviderWarningNotification;
+import org.apache.taverna.servicedescriptions.events.RemovedProviderEvent;
+import org.apache.taverna.servicedescriptions.events.ServiceDescriptionProvidedEvent;
+import org.apache.taverna.servicedescriptions.events.ServiceDescriptionRegistryEvent;
+import org.apache.taverna.servicedescriptions.impl.ServiceDescriptionDeserializer.DeserializationException;
+
+import org.apache.commons.beanutils.BeanUtils;
+import org.apache.log4j.Logger;
+
+import uk.org.taverna.configuration.app.ApplicationConfiguration;
+
+public class ServiceDescriptionRegistryImpl implements ServiceDescriptionRegistry {
+	/**
+	 * If a writable property of this name on a provider exists (ie. the provider has a method
+	 * setServiceDescriptionRegistry(ServiceDescriptionRegistry registry) - then this property will
+	 * be set to the current registry.
+	 */
+	public static final String SERVICE_DESCRIPTION_REGISTRY = "serviceDescriptionRegistry";
+	public static Logger logger = Logger.getLogger(ServiceDescriptionRegistryImpl.class);
+	public static final ThreadGroup threadGroup = new ThreadGroup("Service description providers");
+	/**
+	 * Total maximum timeout while waiting for description threads to finish
+	 */
+	private static final long DESCRIPTION_THREAD_TIMEOUT_MS = 3000;
+	protected static final String CONF_DIR = "conf";
+	protected static final String SERVICE_PROVIDERS_FILENAME = "service_providers.xml";
+	private static final String DEFAULT_CONFIGURABLE_SERVICE_PROVIDERS_FILENAME = "default_service_providers.xml";
+
+	private ServiceDescriptionsConfiguration serviceDescriptionsConfig;
+	private ApplicationConfiguration applicationConfiguration;
+	/**
+	 * <code>false</code> until first call to {@link #loadServiceProviders()} - which is done by
+	 * first call to {@link #getServiceDescriptionProviders()}.
+	 */
+	private boolean hasLoadedProviders = false;
+	/**
+	 * <code>true</code> while {@link #loadServiceProviders(File)},
+	 * {@link #loadServiceProviders(URL)} or {@link #loadServiceProviders()} is in progress, avoids
+	 * triggering {@link #saveServiceDescriptions()} on
+	 * {@link #addServiceDescriptionProvider(ServiceDescriptionProvider)} calls.
+	 */
+	private boolean loading = false;
+	private MultiCaster<ServiceDescriptionRegistryEvent> observers = new MultiCaster<>(this);
+	private List<ServiceDescriptionProvider> serviceDescriptionProviders;
+	private Set<ServiceDescriptionProvider> allServiceProviders;
+	private Map<ServiceDescriptionProvider, Set<ServiceDescription>> providerDescriptions = new HashMap<>();
+	private Map<ServiceDescriptionProvider, Thread> serviceDescriptionThreads = new HashMap<>();
+	/**
+	 * Service providers added by the user, should be saved
+	 */
+	private Set<ServiceDescriptionProvider> userAddedProviders = new HashSet<>();
+	private Set<ServiceDescriptionProvider> userRemovedProviders = new HashSet<>();
+	private Set<ServiceDescriptionProvider> defaultServiceDescriptionProviders;
+	/**
+	 * File containing a list of configured ConfigurableServiceProviders which is used to get the
+	 * default set of service descriptions together with those provided by AbstractTemplateServiceS.
+	 * This file is located in the conf directory of the Taverna startup directory.
+	 */
+	private File defaultConfigurableServiceProvidersFile;
+	private boolean defaultSystemConfigurableProvidersLoaded = false;
+
+	static {
+		threadGroup.setMaxPriority(MIN_PRIORITY);
+	}
+
+	public ServiceDescriptionRegistryImpl(
+			ApplicationConfiguration applicationConfiguration) {
+		this.applicationConfiguration = applicationConfiguration;
+		defaultConfigurableServiceProvidersFile = new File(
+				getTavernaStartupConfigurationDirectory(),
+				DEFAULT_CONFIGURABLE_SERVICE_PROVIDERS_FILENAME);
+	}
+
+	/**
+	 * Get the Taverna distribution (startup) configuration directory.
+	 */
+	private File getTavernaStartupConfigurationDirectory() {
+		File distroHome = null;
+		File configDirectory = null;
+		distroHome = applicationConfiguration.getStartupDir();
+		configDirectory = new File(distroHome, "conf");
+		if (!configDirectory.exists())
+			configDirectory.mkdir();
+		return configDirectory;
+	}
+
+	private static void joinThreads(Collection<? extends Thread> threads,
+			long descriptionThreadTimeoutMs) {
+		long finishJoinBy = currentTimeMillis() + descriptionThreadTimeoutMs;
+		for (Thread thread : threads) {
+			// No shorter timeout than 1 ms (thread.join(0) waits forever!)
+			long timeout = Math.max(1, finishJoinBy - currentTimeMillis());
+			try {
+				thread.join(timeout);
+			} catch (InterruptedException e) {
+				currentThread().interrupt();
+				return;
+			}
+			if (thread.isAlive())
+				logger.debug("Thread did not finish " + thread);
+		}
+	}
+
+
+	@Override
+	public void addObserver(Observer<ServiceDescriptionRegistryEvent> observer) {
+		observers.addObserver(observer);
+	}
+
+	@Override
+	public void addServiceDescriptionProvider(ServiceDescriptionProvider provider) {
+		synchronized (this) {
+			userRemovedProviders.remove(provider);
+			if (!getDefaultServiceDescriptionProviders().contains(provider))
+				userAddedProviders.add(provider);
+			allServiceProviders.add(provider);
+		}
+
+		// Spring-like auto-config
+		try {
+			// BeanUtils should ignore this if provider does not have that property
+			BeanUtils.setProperty(provider, SERVICE_DESCRIPTION_REGISTRY, this);
+		} catch (IllegalAccessException | InvocationTargetException e) {
+			logger.warn("Could not set serviceDescriptionRegistry on "
+					+ provider, e);
+		}
+
+		if (!loading)
+			saveServiceDescriptions();
+		observers.notify(new AddedProviderEvent(provider));
+		updateServiceDescriptions(false, false);
+	}
+
+	private File findServiceDescriptionsFile() {
+		File confDir = new File(
+				applicationConfiguration.getApplicationHomeDir(), CONF_DIR);
+		confDir.mkdirs();
+		if (!confDir.isDirectory())
+			throw new RuntimeException("Invalid directory: " + confDir);
+		File serviceDescriptionsFile = new File(confDir,
+				SERVICE_PROVIDERS_FILENAME);
+		return serviceDescriptionsFile;
+	}
+
+	@Override
+	public List<Observer<ServiceDescriptionRegistryEvent>> getObservers() {
+		return observers.getObservers();
+	}
+
+	// Fallback to this method that uses hardcoded default services if you cannot read them from
+	// the file.
+//	@SuppressWarnings("unchecked")
+//	public synchronized Set<ServiceDescriptionProvider> getDefaultServiceDescriptionProvidersFallback() {
+//		/*if (defaultServiceDescriptionProviders != null) {
+//	 return defaultServiceDescriptionProviders;
+//	 }
+//	 defaultServiceDescriptionProviders = new HashSet<ServiceDescriptionProvider>();
+//		 */
+//		for (ServiceDescriptionProvider provider : serviceDescriptionProviders) {
+//
+//			/* We do not need these - already loaded them from getDefaultServiceDescriptionProviders()
+//	 if (!(provider instanceof ConfigurableServiceProvider)) {
+//	 defaultServiceDescriptionProviders.add(provider);
+//	 continue;
+//	 }*/
+//
+//			// Just load the hard coded default configurable service providers
+//			if (provider instanceof ConfigurableServiceProvider){
+//				ConfigurableServiceProvider<Object> template = ((ConfigurableServiceProvider<Object>)
+//						provider);
+//				// Get configurations
+//				List<Object> configurables = template.getDefaultConfigurations();
+//				for (Object config : configurables) {
+//					// Make a copy that we can configure
+//					ConfigurableServiceProvider<Object> configurableProvider = template.clone();
+//					try {
+//						configurableProvider.configure(config);
+//					} catch (ConfigurationException e) {
+//						logger.warn("Can't configure provider "
+//								+ configurableProvider + " with " + config);
+//						continue;
+//					}
+//					defaultServiceDescriptionProviders.add(configurableProvider);
+//				}
+//			}
+//		}
+//		return defaultServiceDescriptionProviders;
+//	}
+
+	// Get the default services.
+	@Override
+	public synchronized Set<ServiceDescriptionProvider> getDefaultServiceDescriptionProviders() {
+		if (defaultServiceDescriptionProviders != null)
+			return defaultServiceDescriptionProviders;
+		defaultServiceDescriptionProviders = new HashSet<>();
+
+		/*
+		 * Add default configurable service description providers from the
+		 * default_service_providers.xml file
+		 */
+		if (defaultConfigurableServiceProvidersFile.exists()) {
+			try {
+				ServiceDescriptionDeserializer deserializer = new ServiceDescriptionDeserializer(
+						serviceDescriptionProviders);
+				defaultServiceDescriptionProviders.addAll(deserializer
+						.deserializeDefaults(this,
+								defaultConfigurableServiceProvidersFile));
+				/*
+				 * We have successfully loaded the defaults for system
+				 * configurable providers. Note that there are still defaults
+				 * for third party configurable providers, which will be loaded
+				 * below using getDefaultConfigurations().
+				 */
+				defaultSystemConfigurableProvidersLoaded = true;
+			} catch (Exception e) {
+				logger.error("Could not load default service providers from "
+						+ defaultConfigurableServiceProvidersFile.getAbsolutePath(), e);
+
+				/*
+				 * Fallback on the old hardcoded method of loading default
+				 * system configurable service providers using
+				 * getDefaultConfigurations().
+				 */
+				defaultSystemConfigurableProvidersLoaded = false;
+			}
+		} else {
+			logger.warn("Could not find the file "
+					+ defaultConfigurableServiceProvidersFile.getAbsolutePath()
+					+ " containing default system service providers. "
+					+ "Using the hardcoded list of default system providers.");
+
+			/*
+			 * Fallback on the old hardcoded method of loading default system
+			 * configurable service providers using getDefaultConfigurations().
+			 */
+			defaultSystemConfigurableProvidersLoaded = false;
+		}
+
+		/*
+		 * Load other default service description providers - template, local
+		 * workers and third party configurable service providers
+		 */
+		for (ServiceDescriptionProvider provider : serviceDescriptionProviders) {
+			/*
+			 * Template service providers (beanshell, string constant, etc. )
+			 * and providers of local workers.
+			 */
+			if (!(provider instanceof ConfigurableServiceProvider)) {
+				defaultServiceDescriptionProviders.add(provider);
+				continue;
+			}
+
+			/*
+			 * Default system or third party configurable service description
+			 * provider. System ones are read from the
+			 * default_service_providers.xml file so getDefaultConfigurations()
+			 * on them will not have much effect here unless
+			 * defaultSystemConfigurableProvidersLoaded is set to false.
+			 */
+			//FIXME needs to be designed to work using Configuration instances
+			//FIXME needs to get configurations via OSGi discovery
+			/*
+			ConfigurableServiceProvider template = (ConfigurableServiceProvider) provider;
+			// Get configurations
+			for (ObjectNode config : template.getDefaultConfigurations()) {
+				// Make a copy that we can configure
+				ConfigurableServiceProvider configurableProvider = template.clone();
+				try {
+					configurableProvider.configure(config);
+				} catch (ConfigurationException e) {
+					logger.warn("Can't configure provider "
+							+ configurableProvider + " with " + config);
+					continue;
+				}
+				defaultServiceDescriptionProviders.add(configurableProvider);
+			}
+			*/
+		}
+
+		return defaultServiceDescriptionProviders;
+	}
+
+	@Override
+	public synchronized Set<ServiceDescriptionProvider> getServiceDescriptionProviders() {
+		if (allServiceProviders != null)
+			return new HashSet<>(allServiceProviders);
+		allServiceProviders = new HashSet<>(userAddedProviders);
+		synchronized (this) {
+			if (!hasLoadedProviders)
+				try {
+					loadServiceProviders();
+				} catch (Exception e) {
+					logger.error("Could not load service providers", e);
+				} finally {
+					hasLoadedProviders = true;
+				}
+		}
+		for (ServiceDescriptionProvider provider : getDefaultServiceDescriptionProviders()) {
+			if (userRemovedProviders.contains(provider))
+				continue;
+			if (provider instanceof ConfigurableServiceProvider
+					&& !serviceDescriptionsConfig.isIncludeDefaults())
+				// We'll skip the default configurable service provders
+				continue;
+			allServiceProviders.add(provider);
+		}
+		return new HashSet<>(allServiceProviders);
+	}
+
+	@Override
+	public Set<ServiceDescriptionProvider> getServiceDescriptionProviders(
+			ServiceDescription sd) {
+		Set<ServiceDescriptionProvider> result = new HashSet<>();
+		for (ServiceDescriptionProvider sdp : providerDescriptions.keySet())
+			if (providerDescriptions.get(sdp).contains(sd))
+				result.add(sdp);
+		return result;
+	}
+
+	@Override
+	public Set<ServiceDescription> getServiceDescriptions() {
+		updateServiceDescriptions(false, true);
+		Set<ServiceDescription> serviceDescriptions = new HashSet<>();
+		synchronized (providerDescriptions) {
+			for (Set<ServiceDescription> providerDesc : providerDescriptions
+					.values())
+				serviceDescriptions.addAll(providerDesc);
+		}
+		return serviceDescriptions;
+	}
+
+	@Override
+	public ServiceDescription getServiceDescription(URI serviceType) {
+		for (ServiceDescription serviceDescription : getServiceDescriptions())
+			if (serviceDescription.getActivityType().equals(serviceType))
+				return serviceDescription;
+		return null;
+	}
+
+	@Override
+	public List<ConfigurableServiceProvider> getUnconfiguredServiceProviders() {
+		List<ConfigurableServiceProvider> providers = new ArrayList<>();
+		for (ServiceDescriptionProvider provider : serviceDescriptionProviders)
+			if (provider instanceof ConfigurableServiceProvider)
+				providers.add((ConfigurableServiceProvider) provider);
+		return providers;
+	}
+
+	@Override
+	public Set<ServiceDescriptionProvider> getUserAddedServiceProviders() {
+		return new HashSet<>(userAddedProviders);
+	}
+
+	@Override
+	public Set<ServiceDescriptionProvider> getUserRemovedServiceProviders() {
+		return new HashSet<>(userRemovedProviders);
+	}
+
+	@Override
+	public void loadServiceProviders() {
+		File serviceProviderFile = findServiceDescriptionsFile();
+		if (serviceProviderFile.isFile())
+			loadServiceProviders(serviceProviderFile);
+		hasLoadedProviders = true;
+	}
+
+	@Override
+	public void loadServiceProviders(File serviceProvidersFile) {
+		ServiceDescriptionDeserializer deserializer = new ServiceDescriptionDeserializer(
+				serviceDescriptionProviders);
+		loading = true;
+		try {
+			deserializer.deserialize(this, serviceProvidersFile);
+		} catch (DeserializationException e) {
+			logger.error("failed to deserialize configuration", e);
+		}
+		loading = false;
+	}
+
+	@Override
+	public void loadServiceProviders(URL serviceProvidersURL) {
+		ServiceDescriptionDeserializer deserializer = new ServiceDescriptionDeserializer(
+				serviceDescriptionProviders);
+		loading = true;
+		try {
+			deserializer.deserialize(this, serviceProvidersURL);
+		} catch (DeserializationException e) {
+			logger.error("failed to deserialize configuration", e);
+		}
+		loading = false;
+	}
+
+	@Override
+	public void refresh() {
+		updateServiceDescriptions(true, false);
+	}
+
+	@Override
+	public void removeObserver(Observer<ServiceDescriptionRegistryEvent> observer) {
+		observers.removeObserver(observer);
+	}
+
+	@Override
+	public synchronized void removeServiceDescriptionProvider(
+			ServiceDescriptionProvider provider) {
+		if (!userAddedProviders.remove(provider))
+			// Not previously added - must be a default one.. but should we remove it?
+			if (loading || serviceDescriptionsConfig.isRemovePermanently()
+					&& serviceDescriptionsConfig.isIncludeDefaults())
+				userRemovedProviders.add(provider);
+		if (allServiceProviders.remove(provider)) {
+			synchronized (providerDescriptions) {
+				Thread thread = serviceDescriptionThreads.remove(provider);
+				if (thread != null)
+					thread.interrupt();
+				providerDescriptions.remove(provider);
+			}
+			observers.notify(new RemovedProviderEvent(provider));
+		}
+		if (!loading)
+			saveServiceDescriptions();
+	}
+
+	@Override
+	public void saveServiceDescriptions() {
+		File serviceDescriptionsFile = findServiceDescriptionsFile();
+		saveServiceDescriptions(serviceDescriptionsFile);
+	}
+
+	@Override
+	public void saveServiceDescriptions(File serviceDescriptionsFile) {
+		ServiceDescriptionSerializer serializer = new ServiceDescriptionSerializer();
+		try {
+			serializer.serializeRegistry(this, serviceDescriptionsFile);
+		} catch (IOException e) {
+			throw new RuntimeException("Can't save service descriptions to "
+					+ serviceDescriptionsFile);
+		}
+	}
+
+	/**
+	 * Exports all configurable service providers (that give service
+	 * descriptions) currently found in the Service Registry (apart from service
+	 * templates and local services) regardless of who added them (user or
+	 * default system providers).
+	 * <p>
+	 * Unlike {@link #saveServiceDescriptions}, this export does not have the
+	 * "ignored providers" section as this is just a plain export of everything
+	 * in the Service Registry.
+	 * 
+	 * @param serviceDescriptionsFile
+	 */
+	@Override
+	public void exportCurrentServiceDescriptions(File serviceDescriptionsFile) {
+		ServiceDescriptionSerializer serializer = new ServiceDescriptionSerializer();
+		try {
+			serializer.serializeFullRegistry(this, serviceDescriptionsFile);
+		} catch (IOException e) {
+			throw new RuntimeException("Could not save service descriptions to "
+					+ serviceDescriptionsFile);
+		}
+	}
+
+	public void setServiceDescriptionProvidersList(
+			List<ServiceDescriptionProvider> serviceDescriptionProviders) {
+		this.serviceDescriptionProviders = serviceDescriptionProviders;
+	}
+
+	private void updateServiceDescriptions(boolean refreshAll, boolean waitFor) {
+		List<Thread> threads = new ArrayList<>();
+		for (ServiceDescriptionProvider provider : getServiceDescriptionProviders()) {
+			synchronized (providerDescriptions) {
+				if (providerDescriptions.containsKey(provider) && !refreshAll)
+					// We'll used the cached values
+					continue;
+				Thread oldThread = serviceDescriptionThreads.get(provider);
+				if (oldThread != null && oldThread.isAlive()) {
+					if (refreshAll)
+						// New thread will override the old thread
+						oldThread.interrupt();
+					else {
+						// observers.notify(new ProviderStatusNotification(provider, "Waiting for provider"));
+						continue;
+					}
+				}
+				// Not run yet - we'll start a new tread
+				Thread thread = new FindServiceDescriptionsThread(provider);
+				threads.add(thread);
+				serviceDescriptionThreads.put(provider, thread);
+				thread.start();
+			}
+		}
+		if (waitFor)
+			joinThreads(threads, DESCRIPTION_THREAD_TIMEOUT_MS);
+	}
+
+	@Override
+	public boolean isDefaultSystemConfigurableProvidersLoaded() {
+		return defaultSystemConfigurableProvidersLoaded;
+	}
+
+	/**
+	 * Sets the serviceDescriptionsConfig.
+	 * 
+	 * @param serviceDescriptionsConfig
+	 *            the new value of serviceDescriptionsConfig
+	 */
+	public void setServiceDescriptionsConfig(
+			ServiceDescriptionsConfiguration serviceDescriptionsConfig) {
+		this.serviceDescriptionsConfig = serviceDescriptionsConfig;
+	}
+
+	class FindServiceDescriptionsThread extends Thread implements
+			UncaughtExceptionHandler, FindServiceDescriptionsCallBack {
+		private final ServiceDescriptionProvider provider;
+		private boolean aborting = false;
+		private final Set<ServiceDescription> providerDescs = new HashSet<>();
+
+		FindServiceDescriptionsThread(ServiceDescriptionProvider provider) {
+			super(threadGroup, "Find service descriptions from " + provider);
+			this.provider = provider;
+			setUncaughtExceptionHandler(this);
+			setDaemon(true);
+		}
+
+		@Override
+		public void fail(String message, Throwable ex) {
+			logger.warn("Provider " + getProvider() + ": " + message, ex);
+			if (aborting)
+				return;
+			observers.notify(new ProviderErrorNotification(getProvider(),
+					message, ex));
+		}
+
+		@Override
+		public void finished() {
+			if (aborting)
+				return;
+			synchronized (providerDescriptions) {
+				providerDescriptions.put(getProvider(), providerDescs);
+			}
+			observers.notify(new ServiceDescriptionProvidedEvent(getProvider(),
+					providerDescs));
+		}
+
+		@Override
+		public void partialResults(
+				Collection<? extends ServiceDescription> serviceDescriptions) {
+			if (aborting)
+				return;
+			providerDescs.addAll(serviceDescriptions);
+			synchronized (providerDescriptions) {
+				providerDescriptions.put(getProvider(), providerDescs);
+			}
+			observers.notify(new PartialServiceDescriptionsNotification(
+					getProvider(), serviceDescriptions));
+		}
+
+		@Override
+		public void status(String message) {
+			logger.debug("Provider " + getProvider() + ": " + message);
+			if (aborting)
+				return;
+			observers.notify(new ProviderStatusNotification(getProvider(),
+					message));
+		}
+
+		@Override
+		public void warning(String message) {
+			logger.warn("Provider " + getProvider() + ": " + message);
+			if (aborting)
+				return;
+			observers.notify(new ProviderWarningNotification(getProvider(),
+					message));
+		}
+
+		public ServiceDescriptionProvider getProvider() {
+			return provider;
+		}
+
+		@Override
+		public void interrupt() {
+			aborting = true;
+			super.interrupt();
+		}
+
+		@Override
+		public void run() {
+			observers.notify(new ProviderUpdatingNotification(provider));
+			getProvider().findServiceDescriptionsAsync(this);
+		}
+
+		@Override
+		public void uncaughtException(Thread t, Throwable ex) {
+			logger.error("Uncaught exception in " + t, ex);
+			fail("Uncaught exception", ex);
+		}
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-impl/src/main/java/org/apache/taverna/servicedescriptions/impl/ServiceDescriptionSerializer.java
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-impl/src/main/java/org/apache/taverna/servicedescriptions/impl/ServiceDescriptionSerializer.java b/taverna-activity-palette-impl/src/main/java/org/apache/taverna/servicedescriptions/impl/ServiceDescriptionSerializer.java
new file mode 100644
index 0000000..f7465f7
--- /dev/null
+++ b/taverna-activity-palette-impl/src/main/java/org/apache/taverna/servicedescriptions/impl/ServiceDescriptionSerializer.java
@@ -0,0 +1,102 @@
+package org.apache.taverna.servicedescriptions.impl;
+
+import static org.apache.taverna.servicedescriptions.impl.ServiceDescriptionConstants.CONFIGURATION;
+import static org.apache.taverna.servicedescriptions.impl.ServiceDescriptionConstants.IGNORED;
+import static org.apache.taverna.servicedescriptions.impl.ServiceDescriptionConstants.PROVIDERS;
+import static org.apache.taverna.servicedescriptions.impl.ServiceDescriptionConstants.PROVIDER_ID;
+import static org.apache.taverna.servicedescriptions.impl.ServiceDescriptionConstants.SERVICE_PANEL_CONFIGURATION;
+import static org.apache.taverna.servicedescriptions.impl.ServiceDescriptionConstants.TYPE;
+
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.util.Set;
+
+import org.apache.taverna.servicedescriptions.ConfigurableServiceProvider;
+import org.apache.taverna.servicedescriptions.ServiceDescriptionProvider;
+import org.apache.taverna.servicedescriptions.ServiceDescriptionRegistry;
+
+import org.apache.log4j.Logger;
+import org.jdom.JDOMException;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.node.ArrayNode;
+import com.fasterxml.jackson.databind.node.JsonNodeFactory;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+
+class ServiceDescriptionSerializer {
+	private static Logger logger = Logger
+			.getLogger(ServiceDescriptionSerializer.class);
+
+	public void serializeRegistry(ServiceDescriptionRegistry registry, File file)
+			throws IOException {
+		Set<ServiceDescriptionProvider> ignoreProviders = registry
+				.getUserRemovedServiceProviders();
+		JsonNode registryElement = serializeRegistry(registry, ignoreProviders);
+		try (BufferedOutputStream bufferedOutStream = new BufferedOutputStream(
+				new FileOutputStream(file))) {
+			bufferedOutStream.write(registryElement.toString()
+					.getBytes("UTF-8"));
+		}
+	}
+
+	/**
+	 * Export the whole service registry to an xml file, regardless of who added
+	 * the service provider (user or system default). In this case there will be
+	 * no "ignored providers" in the saved file.
+	 */
+	public void serializeFullRegistry(ServiceDescriptionRegistry registry,
+			File file) throws IOException {
+		JsonNode registryElement = serializeRegistry(registry, ALL_PROVIDERS);
+		try (BufferedOutputStream bufferedOutStream = new BufferedOutputStream(
+				new FileOutputStream(file))) {
+			bufferedOutStream.write(registryElement.toString()
+					.getBytes("UTF-8"));
+		}
+	}
+
+	private static final JsonNodeFactory factory = JsonNodeFactory.instance;
+	private static final Set<ServiceDescriptionProvider> ALL_PROVIDERS = null;
+
+	private JsonNode serializeRegistry(ServiceDescriptionRegistry registry,
+			Set<ServiceDescriptionProvider> ignoreProviders) {
+		ObjectNode overallConfiguration = factory.objectNode();
+		overallConfiguration.put(SERVICE_PANEL_CONFIGURATION,
+				ignoreProviders != ALL_PROVIDERS ? "full" : "defaults only");
+		ArrayNode providers = overallConfiguration.putArray(PROVIDERS);
+
+		for (ServiceDescriptionProvider provider : registry
+				.getUserAddedServiceProviders())
+			try {
+				providers.add(serializeProvider(provider));
+			} catch (JDOMException | IOException e) {
+				logger.warn("Could not serialize " + provider, e);
+			}
+
+		if (ignoreProviders != ALL_PROVIDERS) {
+			ArrayNode ignored = overallConfiguration.putArray(IGNORED);
+			for (ServiceDescriptionProvider provider : ignoreProviders)
+				try {
+					ignored.add(serializeProvider(provider));
+				} catch (JDOMException | IOException e) {
+					logger.warn("Could not serialize " + provider, e);
+				}
+		}
+
+		return overallConfiguration;
+	}
+
+	private JsonNode serializeProvider(ServiceDescriptionProvider provider)
+			throws JDOMException, IOException {
+		ObjectNode node = factory.objectNode();
+		node.put(PROVIDER_ID, provider.getId());
+
+		if (provider instanceof ConfigurableServiceProvider) {
+			ConfigurableServiceProvider configurable = (ConfigurableServiceProvider) provider;
+			node.put(TYPE, configurable.getConfiguration().getType().toString());
+			node.put(CONFIGURATION, configurable.getConfiguration().getJson());
+		}
+		return node;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-impl/src/main/java/org/apache/taverna/servicedescriptions/impl/ServiceDescriptionXMLConstants.java
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-impl/src/main/java/org/apache/taverna/servicedescriptions/impl/ServiceDescriptionXMLConstants.java b/taverna-activity-palette-impl/src/main/java/org/apache/taverna/servicedescriptions/impl/ServiceDescriptionXMLConstants.java
new file mode 100644
index 0000000..be44022
--- /dev/null
+++ b/taverna-activity-palette-impl/src/main/java/org/apache/taverna/servicedescriptions/impl/ServiceDescriptionXMLConstants.java
@@ -0,0 +1,15 @@
+package org.apache.taverna.servicedescriptions.impl;
+
+import org.jdom.Namespace;
+
+public interface ServiceDescriptionXMLConstants {
+
+	public static final Namespace SERVICE_DESCRIPTION_NS = Namespace
+			.getNamespace("http://taverna.sf.net/2009/xml/servicedescription");
+	public static final String PROVIDER = "provider";
+	public static final String PROVIDERS = "providers";
+	public static final String SERVICE_DESCRIPTIONS = "serviceDescriptions";
+	public static final String IGNORED_PROVIDERS = "ignoredProviders";
+	public static final String PROVIDER_IDENTIFIER = "providerId";
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-impl/src/main/java/org/apache/taverna/servicedescriptions/impl/ServiceDescriptionsConfigurationImpl.java
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-impl/src/main/java/org/apache/taverna/servicedescriptions/impl/ServiceDescriptionsConfigurationImpl.java b/taverna-activity-palette-impl/src/main/java/org/apache/taverna/servicedescriptions/impl/ServiceDescriptionsConfigurationImpl.java
new file mode 100644
index 0000000..2ed4b82
--- /dev/null
+++ b/taverna-activity-palette-impl/src/main/java/org/apache/taverna/servicedescriptions/impl/ServiceDescriptionsConfigurationImpl.java
@@ -0,0 +1,92 @@
+/*******************************************************************************
+ * 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 org.apache.taverna.servicedescriptions.impl;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.taverna.servicedescriptions.ServiceDescriptionsConfiguration;
+
+import uk.org.taverna.configuration.AbstractConfigurable;
+import uk.org.taverna.configuration.ConfigurationManager;
+
+public class ServiceDescriptionsConfigurationImpl extends AbstractConfigurable
+		implements ServiceDescriptionsConfiguration {
+	private static final String INCLUDE_DEFAULTS = "includeDefaults";
+	private static final String SERVICE_PALETTE = "Service providers";
+	private static final String SERVICE_PALETTE_PREFIX = "ServiceProviders";
+	private static final String CATEGORY = "Services";
+	private static final String UUID = "f0d1ef24-9337-412f-b2c3-220a01e2efd0";
+	private static final String REMOVE_PERMANENTLY = "removePermanently";
+
+	public ServiceDescriptionsConfigurationImpl(
+			ConfigurationManager configurationManager) {
+		super(configurationManager);
+	}
+
+	@Override
+	public String getCategory() {
+		return CATEGORY;
+	}
+
+	@Override
+	public Map<String, String> getDefaultPropertyMap() {
+		Map<String, String> defaults = new HashMap<String, String>();
+		defaults.put(INCLUDE_DEFAULTS, "true");
+		defaults.put(REMOVE_PERMANENTLY, "true");
+		return defaults;
+	}
+
+	@Override
+	public String getDisplayName() {
+		return SERVICE_PALETTE;
+	}
+
+	@Override
+	public String getFilePrefix() {
+		return SERVICE_PALETTE_PREFIX;
+	}
+
+	@Override
+	public String getUUID() {
+		return UUID;
+	}
+
+	@Override
+	public boolean isIncludeDefaults() {
+		return Boolean.parseBoolean(getProperty(INCLUDE_DEFAULTS));
+	}
+
+	@Override
+	public void setIncludeDefaults(boolean includeDefaults) {
+		setProperty(INCLUDE_DEFAULTS, Boolean.toString(includeDefaults));
+	}
+
+	@Override
+	public boolean isRemovePermanently() {
+		return Boolean.parseBoolean(getProperty(REMOVE_PERMANENTLY));
+	}
+
+	@Override
+	public void setRemovePermanently(boolean removePermanently) {
+		setProperty(REMOVE_PERMANENTLY, Boolean.toString(removePermanently));
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-impl/src/main/java/org/apache/taverna/workbench/ui/activitypalette/ActivityPaletteConfiguration.java
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-impl/src/main/java/org/apache/taverna/workbench/ui/activitypalette/ActivityPaletteConfiguration.java b/taverna-activity-palette-impl/src/main/java/org/apache/taverna/workbench/ui/activitypalette/ActivityPaletteConfiguration.java
new file mode 100644
index 0000000..7ea1a8c
--- /dev/null
+++ b/taverna-activity-palette-impl/src/main/java/org/apache/taverna/workbench/ui/activitypalette/ActivityPaletteConfiguration.java
@@ -0,0 +1,81 @@
+/*******************************************************************************
+ * 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 org.apache.taverna.workbench.ui.activitypalette;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import uk.org.taverna.configuration.AbstractConfigurable;
+import uk.org.taverna.configuration.ConfigurationManager;
+
+public class ActivityPaletteConfiguration extends AbstractConfigurable {
+	private Map<String,String> defaultPropertyMap;
+
+	public ActivityPaletteConfiguration(ConfigurationManager configurationManager) {
+		super(configurationManager);
+	}
+
+	@Override
+	public String getCategory() {
+		return "Services";
+	}
+
+	@Override
+	public Map<String, String> getDefaultPropertyMap() {
+		if (defaultPropertyMap == null) {
+			defaultPropertyMap = new HashMap<>();
+
+			// //wsdl
+			//defaultPropertyMap.put("taverna.defaultwsdl", "http://www.ebi.ac.uk/xembl/XEMBL.wsdl,"+
+			//                    "http://soap.genome.jp/KEGG.wsdl,"+
+			//                    "http://eutils.ncbi.nlm.nih.gov/entrez/eutils/soap/eutils.wsdl,"+
+			//                    "http://soap.bind.ca/wsdl/bind.wsdl,"+
+			//                    "http://www.ebi.ac.uk/ws/services/urn:Dbfetch?wsdl");
+
+			// //soaplab
+			//defaultPropertyMap.put("taverna.defaultsoaplab", "http://www.ebi.ac.uk/soaplab/services/");
+
+			// //biomart
+			//defaultPropertyMap.put("taverna.defaultmartregistry","http://www.biomart.org/biomart");
+
+			//add property names
+			//defaultPropertyMap.put("name.taverna.defaultwsdl", "WSDL");
+			//defaultPropertyMap.put("name.taverna.defaultsoaplab","Soaplab");
+			//defaultPropertyMap.put("name.taverna.defaultmartregistry", "Biomart");
+		}
+		return defaultPropertyMap;
+	}
+
+	@Override
+	public String getDisplayName() {
+		return "Activity Palette";
+	}
+
+	@Override
+	public String getFilePrefix() {
+		return "ActivityPalette";
+	}
+
+	@Override
+	public String getUUID() {
+		return "ad9f3a60-5967-11dd-ae16-0800200c9a66";
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-impl/src/main/java/org/apache/taverna/workbench/ui/activitypalette/ActivityPaletteConfigurationPanel.java
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-impl/src/main/java/org/apache/taverna/workbench/ui/activitypalette/ActivityPaletteConfigurationPanel.java b/taverna-activity-palette-impl/src/main/java/org/apache/taverna/workbench/ui/activitypalette/ActivityPaletteConfigurationPanel.java
new file mode 100644
index 0000000..791e456
--- /dev/null
+++ b/taverna-activity-palette-impl/src/main/java/org/apache/taverna/workbench/ui/activitypalette/ActivityPaletteConfigurationPanel.java
@@ -0,0 +1,284 @@
+/*******************************************************************************
+ * 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 org.apache.taverna.workbench.ui.activitypalette;
+
+import static java.awt.BorderLayout.CENTER;
+import static java.awt.BorderLayout.EAST;
+import static java.awt.BorderLayout.NORTH;
+import static java.awt.BorderLayout.SOUTH;
+import static java.awt.FlowLayout.LEFT;
+import static java.awt.FlowLayout.RIGHT;
+import static javax.swing.BoxLayout.Y_AXIS;
+import static javax.swing.JOptionPane.INFORMATION_MESSAGE;
+import static javax.swing.JOptionPane.WARNING_MESSAGE;
+import static javax.swing.JOptionPane.YES_NO_OPTION;
+import static javax.swing.JOptionPane.YES_OPTION;
+import static javax.swing.JOptionPane.showConfirmDialog;
+import static javax.swing.JOptionPane.showInputDialog;
+import static javax.swing.border.BevelBorder.LOWERED;
+
+import java.awt.BorderLayout;
+import java.awt.Component;
+import java.awt.FlowLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.swing.BoxLayout;
+import javax.swing.DefaultComboBoxModel;
+import javax.swing.DefaultListCellRenderer;
+import javax.swing.DefaultListModel;
+import javax.swing.JButton;
+import javax.swing.JComboBox;
+import javax.swing.JLabel;
+import javax.swing.JList;
+import javax.swing.JPanel;
+import javax.swing.border.BevelBorder;
+
+import org.apache.log4j.Logger;
+
+@SuppressWarnings("serial")
+public class ActivityPaletteConfigurationPanel extends JPanel {
+	private static Logger logger = Logger
+			.getLogger(ActivityPaletteConfigurationPanel.class);
+
+	private Map<String,List<String>> values = new HashMap<>();
+	private Map<String,String> names = new HashMap<>();
+	private DefaultComboBoxModel<String> model;
+	private DefaultListModel<String> listModel;
+	private JList<String> propertyListItems;
+	private String selectedKey;
+	private JButton deleteTypeButton;
+	private final ActivityPaletteConfiguration config;
+
+	public ActivityPaletteConfigurationPanel(ActivityPaletteConfiguration config) {
+		super(new BorderLayout());
+		this.config = config;
+
+		model = new DefaultComboBoxModel<>();
+		for (String key : config.getInternalPropertyMap().keySet()) {
+			if (key.startsWith("taverna.")
+					&& config.getPropertyStringList(key) != null) {
+				model.addElement(key);
+				values.put(key,
+						new ArrayList<>(config.getPropertyStringList(key)));
+			}
+			if (key.startsWith("name.taverna."))
+				names.put(key, config.getProperty(key).toString());
+		}
+		deleteTypeButton = new JButton("Delete");
+
+		final JButton addTypeButton = new JButton("Add");
+		final JComboBox<String> comboBox = new JComboBox<>(model);
+		comboBox.setRenderer(new DefaultListCellRenderer() {
+			@Override
+			public Component getListCellRendererComponent(JList<?> list,
+					Object value, int index, boolean isSelected,
+					boolean cellHasFocus) {
+				if (value != null && value instanceof String) {
+					String name = names.get("name." + value);
+					if (name != null)
+						value = name;
+				}
+				return super.getListCellRendererComponent(list, value, index,
+						isSelected, cellHasFocus);
+			}
+		});
+
+		deleteTypeButton.addActionListener(new ActionListener() {
+			@Override
+			public void actionPerformed(ActionEvent e) {
+				String displayText = names.get("name." + selectedKey);
+				if (displayText == null)
+					displayText = selectedKey;
+				if (confirm("Confirm removal",
+						"Are you sure you wish to remove the type "
+								+ displayText + "?")) {
+					names.remove("name." + selectedKey);
+					values.remove(selectedKey);
+					model.removeElement(selectedKey);
+					comboBox.setSelectedIndex(0);
+				}
+			}
+		});
+
+		addTypeButton.addActionListener(new ActionListener() {
+			@Override
+			public void actionPerformed(ActionEvent e) {
+				String key = input("New key", "Provide the new key.");
+				if (key == null)
+					return;
+				String name = input("Name for the key",
+						"Provide the name for the key: " + key);
+				if (name == null)
+					return;
+
+				values.put(key, new ArrayList<String>());
+				names.put("name." + key, name);
+				model.addElement(key);
+				comboBox.setSelectedItem(key);
+			}
+		});
+
+		comboBox.addActionListener(new ActionListener() {
+			@Override
+			public void actionPerformed(ActionEvent e) {
+				if (comboBox.getSelectedItem() != null
+						&& comboBox.getSelectedItem() instanceof String) {
+					selectedKey = (String) comboBox.getSelectedItem();
+					List<String> selectedList = values.get(selectedKey);
+					populateList(selectedList);
+					deleteTypeButton.setEnabled(selectedList.size() == 0);
+				}
+			}
+		});
+
+		JPanel propertySelectionPanel = new JPanel(new FlowLayout(LEFT));
+		propertySelectionPanel.add(new JLabel("Activity type:"));
+		propertySelectionPanel.add(comboBox);
+		propertySelectionPanel.add(addTypeButton);
+		propertySelectionPanel.add(deleteTypeButton);
+		add(propertySelectionPanel, NORTH);
+
+		JPanel listPanel = new JPanel(new BorderLayout());
+		listModel = new DefaultListModel<>();
+		propertyListItems = new JList<>(listModel);
+		propertyListItems.setBorder(new BevelBorder(LOWERED));
+
+		listPanel.add(propertyListItems, CENTER);
+		listPanel.add(listButtons(), EAST);
+
+		add(listPanel, CENTER);
+
+		add(applyButtonPanel(), SOUTH);
+
+		if (model.getSize() > 0)
+			comboBox.setSelectedItem(model.getElementAt(0));
+	}
+
+	private void populateList(List<String> selectedList) {
+		listModel.removeAllElements();
+		for (String item : selectedList)
+			listModel.addElement(item);
+	}
+
+	private JPanel applyButtonPanel() {
+		JPanel applyPanel = new JPanel(new FlowLayout(RIGHT));
+		JButton applyButton = new JButton("Apply");
+
+		applyButton.addActionListener(new ActionListener() {
+			@Override
+			public void actionPerformed(ActionEvent e) {
+				config.getInternalPropertyMap().clear();
+				for (String key : values.keySet()) {
+					List<String> properties = values.get(key);
+					config.setPropertyStringList(key, new ArrayList<>(
+							properties));
+				}
+				for (String key : names.keySet())
+					config.setProperty(key, names.get(key));
+				store();
+			}
+		});
+
+		applyPanel.add(applyButton);
+		return applyPanel;
+	}
+
+	private void store() {
+		try {
+			//FIXME
+			//ConfigurationManager.getInstance().store(config);
+		} catch (Exception e1) {
+			logger.error("There was an error storing the configuration:"
+					+ config.getFilePrefix() + " (UUID=" + config.getUUID()
+					+ ")", e1);
+		}
+	}
+
+	private JPanel listButtons() {
+		JPanel panel = new JPanel();
+		panel.setLayout(new BoxLayout(panel, Y_AXIS));
+		JButton addButton = new JButton("+");
+		addButton.addActionListener(new ActionListener() {
+			@Override
+			public void actionPerformed(ActionEvent e) {
+				String value = input("New property", "Provide new value for: "
+						+ selectedKey);
+				if (value != null) {
+					listModel.addElement(value);
+					values.get(selectedKey).add(value);
+					deleteTypeButton.setEnabled(false);
+				}
+			}
+		});
+
+		JButton deleteButton = new JButton("-");
+		deleteButton.addActionListener(new ActionListener() {
+			@Override
+			public void actionPerformed(ActionEvent e) {
+				Object value = propertyListItems.getSelectedValue();
+				if (confirm("Confirm removal",
+						"Are you sure you wish to remove " + value + "?")) {
+					listModel.removeElement(value);
+					values.get(selectedKey).remove(value);
+					if (values.get(selectedKey).size() == 0)
+						deleteTypeButton.setEnabled(true);
+				}
+			}
+		});
+
+		panel.add(addButton);
+		panel.add(deleteButton);
+
+		return panel;
+	}
+
+	private boolean confirm(String title, String message) {
+		return showConfirmDialog(this, message, title, YES_NO_OPTION,
+				WARNING_MESSAGE) == YES_OPTION;
+	}
+
+	private String input(String title, String message) {
+		return showInputDialog(this, message, title, INFORMATION_MESSAGE);
+	}
+
+/*	private JButton getAddTypeButton() {
+		JButton result = new JButton("Add");
+		result.addActionListener(new ActionListener() {
+			public void actionPerformed(ActionEvent e) {
+				String val = input("New property value","New property value");
+				if (val!=null) {
+					if (values.get(val) == null) {
+						model.addElement(val);
+						values.put(val, new ArrayList<String>());
+					} else
+						showMessageDialog(ActivityPaletteConfigurationPanel.this, "This property already exists");
+				}
+			}
+		});
+		return result;
+	}
+*/
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-impl/src/main/java/org/apache/taverna/workbench/ui/activitypalette/ActivityPaletteConfigurationUIFactory.java
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-impl/src/main/java/org/apache/taverna/workbench/ui/activitypalette/ActivityPaletteConfigurationUIFactory.java b/taverna-activity-palette-impl/src/main/java/org/apache/taverna/workbench/ui/activitypalette/ActivityPaletteConfigurationUIFactory.java
new file mode 100644
index 0000000..c522197
--- /dev/null
+++ b/taverna-activity-palette-impl/src/main/java/org/apache/taverna/workbench/ui/activitypalette/ActivityPaletteConfigurationUIFactory.java
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * 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 org.apache.taverna.workbench.ui.activitypalette;
+
+import javax.swing.JPanel;
+
+import uk.org.taverna.configuration.Configurable;
+import uk.org.taverna.configuration.ConfigurationUIFactory;
+
+public class ActivityPaletteConfigurationUIFactory implements
+		ConfigurationUIFactory {
+	private ActivityPaletteConfiguration activityPaletteConfiguration;
+
+	@Override
+	public boolean canHandle(String uuid) {
+		return uuid != null && uuid.equals(getConfigurable().getUUID());
+	}
+
+	@Override
+	public Configurable getConfigurable() {
+		return activityPaletteConfiguration;
+	}
+
+	@Override
+	public JPanel getConfigurationPanel() {
+		return new ActivityPaletteConfigurationPanel(
+				activityPaletteConfiguration);
+	}
+
+	public void setActivityPaletteConfiguration(
+			ActivityPaletteConfiguration activityPaletteConfiguration) {
+		this.activityPaletteConfiguration = activityPaletteConfiguration;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-impl/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.configuration.ConfigurationUIFactory
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-impl/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.configuration.ConfigurationUIFactory b/taverna-activity-palette-impl/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.configuration.ConfigurationUIFactory
deleted file mode 100644
index 6c9fed9..0000000
--- a/taverna-activity-palette-impl/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.configuration.ConfigurationUIFactory
+++ /dev/null
@@ -1 +0,0 @@
-#net.sf.taverna.t2.workbench.ui.activitypalette.ActivityPaletteConfigurationUIFactory
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-impl/src/main/resources/META-INF/services/org.apache.taverna.workbench.configuration.ConfigurationUIFactory
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-impl/src/main/resources/META-INF/services/org.apache.taverna.workbench.configuration.ConfigurationUIFactory b/taverna-activity-palette-impl/src/main/resources/META-INF/services/org.apache.taverna.workbench.configuration.ConfigurationUIFactory
new file mode 100644
index 0000000..446b370
--- /dev/null
+++ b/taverna-activity-palette-impl/src/main/resources/META-INF/services/org.apache.taverna.workbench.configuration.ConfigurationUIFactory
@@ -0,0 +1 @@
+#org.apache.taverna.workbench.ui.activitypalette.ActivityPaletteConfigurationUIFactory
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-impl/src/main/resources/META-INF/spring/activity-palette-impl-context-osgi.xml
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-impl/src/main/resources/META-INF/spring/activity-palette-impl-context-osgi.xml b/taverna-activity-palette-impl/src/main/resources/META-INF/spring/activity-palette-impl-context-osgi.xml
index 34921f5..215562a 100644
--- a/taverna-activity-palette-impl/src/main/resources/META-INF/spring/activity-palette-impl-context-osgi.xml
+++ b/taverna-activity-palette-impl/src/main/resources/META-INF/spring/activity-palette-impl-context-osgi.xml
@@ -6,12 +6,12 @@
                       http://www.springframework.org/schema/osgi
                       http://www.springframework.org/schema/osgi/spring-osgi.xsd">
 
-	<service ref="ServiceDescriptionRegistryImpl" interface="net.sf.taverna.t2.servicedescriptions.ServiceDescriptionRegistry"/>
-	<service ref="ServiceDescriptionsConfigurationImpl" interface="net.sf.taverna.t2.servicedescriptions.ServiceDescriptionsConfiguration"/>
+	<service ref="ServiceDescriptionRegistryImpl" interface="org.apache.taverna.servicedescriptions.ServiceDescriptionRegistry"/>
+	<service ref="ServiceDescriptionsConfigurationImpl" interface="org.apache.taverna.servicedescriptions.ServiceDescriptionsConfiguration"/>
 
 	<reference id="configurationManager" interface="uk.org.taverna.configuration.ConfigurationManager" />
 	<reference id="applicationConfiguration" interface="uk.org.taverna.configuration.app.ApplicationConfiguration" />
 
-	<list id="serviceDescriptionProviders" interface="net.sf.taverna.t2.servicedescriptions.ServiceDescriptionProvider" cardinality="0..N" greedy-proxying="true"/>
+	<list id="serviceDescriptionProviders" interface="org.apache.taverna.servicedescriptions.ServiceDescriptionProvider" cardinality="0..N" greedy-proxying="true"/>
 
 </beans:beans>

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-impl/src/main/resources/META-INF/spring/activity-palette-impl-context.xml
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-impl/src/main/resources/META-INF/spring/activity-palette-impl-context.xml b/taverna-activity-palette-impl/src/main/resources/META-INF/spring/activity-palette-impl-context.xml
index 9f7110f..a91d0ce 100644
--- a/taverna-activity-palette-impl/src/main/resources/META-INF/spring/activity-palette-impl-context.xml
+++ b/taverna-activity-palette-impl/src/main/resources/META-INF/spring/activity-palette-impl-context.xml
@@ -3,7 +3,7 @@
 	xsi:schemaLocation="http://www.springframework.org/schema/beans
                       http://www.springframework.org/schema/beans/spring-beans.xsd">
 
-	<bean name="ServiceDescriptionRegistryImpl" class="net.sf.taverna.t2.servicedescriptions.impl.ServiceDescriptionRegistryImpl">
+	<bean name="ServiceDescriptionRegistryImpl" class="org.apache.taverna.servicedescriptions.impl.ServiceDescriptionRegistryImpl">
 		<constructor-arg name="applicationConfiguration" ref="applicationConfiguration" />
 		<property name="serviceDescriptionProvidersList" ref="serviceDescriptionProviders" />
 		<property name="serviceDescriptionsConfig">
@@ -11,12 +11,12 @@
 		</property>
 	</bean>
 
-	<bean id="ServiceDescriptionsConfigurationImpl" class="net.sf.taverna.t2.servicedescriptions.impl.ServiceDescriptionsConfigurationImpl">
+	<bean id="ServiceDescriptionsConfigurationImpl" class="org.apache.taverna.servicedescriptions.impl.ServiceDescriptionsConfigurationImpl">
 		<constructor-arg ref="configurationManager"/>
 	</bean>
 
 	<!-- Don't think ActivityPalette is still used -->
-	<!-- <bean id="ActivityPaletteConfiguration" class="net.sf.taverna.t2.workbench.ui.activitypalette.ActivityPaletteConfiguration">
+	<!-- <bean id="ActivityPaletteConfiguration" class="org.apache.taverna.workbench.ui.activitypalette.ActivityPaletteConfiguration">
 		<constructor-arg ref="configurationManager"/>
 	</bean> -->
 

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-impl/src/test/java/net/sf/taverna/t2/workbench/ui/activitypalette/ActivityPaletteConfigurationTest.java
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-impl/src/test/java/net/sf/taverna/t2/workbench/ui/activitypalette/ActivityPaletteConfigurationTest.java b/taverna-activity-palette-impl/src/test/java/net/sf/taverna/t2/workbench/ui/activitypalette/ActivityPaletteConfigurationTest.java
deleted file mode 100644
index 081a9af..0000000
--- a/taverna-activity-palette-impl/src/test/java/net/sf/taverna/t2/workbench/ui/activitypalette/ActivityPaletteConfigurationTest.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*******************************************************************************
- * 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.activitypalette;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.UUID;
-
-import org.junit.Before;
-import org.junit.Test;
-
-import uk.org.taverna.configuration.app.impl.ApplicationConfigurationImpl;
-import uk.org.taverna.configuration.impl.ConfigurationManagerImpl;
-
-public class ActivityPaletteConfigurationTest {
-
-	private ActivityPaletteConfiguration conf;
-	private ConfigurationManagerImpl manager;
-
-	@Before
-	public void setup() {
-		File f = new File(System.getProperty("java.io.tmpdir"));
-		final File d = new File(f,UUID.randomUUID().toString());
-		d.mkdir();
-		manager = new ConfigurationManagerImpl(new ApplicationConfigurationImpl() {
-			@Override
-			public File getApplicationHomeDir() {
-				return d;
-			}
-		});
-		conf=new ActivityPaletteConfiguration(manager);
-		conf.restoreDefaults();
-	}
-
-	@Test
-	public void testEmptyList() throws Exception {
-		conf.setPropertyStringList("list", new ArrayList<String>());
-		assertTrue("Result was not a list but was:"+conf.getProperty("list"),conf.getPropertyStringList("list") instanceof List);
-		assertTrue("Result was not a list but was:"+conf.getPropertyStringList("list"),conf.getPropertyStringList("list") instanceof List);
-		List<String> list = conf.getPropertyStringList("list");
-		assertEquals("There should be 0 elements",0,list.size());
-	}
-
-	@Test
-	public void testSingleItem() throws Exception {
-		List<String> list = new ArrayList<>();
-		list.add("fred");
-		conf.setPropertyStringList("single", list);
-
-		assertTrue("should be an ArrayList",conf.getPropertyStringList("single") instanceof List);
-		List<String> l = conf.getPropertyStringList("single");
-		assertEquals("There should be 1 element",1,l.size());
-		assertEquals("Its value should be fred","fred",l.get(0));
-	}
-
-	@Test
-	public void testList() throws Exception {
-		List<String> list = new ArrayList<>();
-		list.add("fred");
-		list.add("bloggs");
-		conf.setPropertyStringList("list", list);
-
-		assertTrue("should be an ArrayList",conf.getPropertyStringList("list") instanceof List);
-		List<String> l = conf.getPropertyStringList("list");
-		assertEquals("There should be 1 element",2,l.size());
-		assertEquals("Its value should be fred","fred",l.get(0));
-		assertEquals("Its value should be bloggs","bloggs",l.get(1));
-	}
-
-	@Test
-	public void testNull() throws Exception {
-		assertNull("Should return null",conf.getProperty("blah blah blah"));
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-impl/src/test/java/org/apache/taverna/workbench/ui/activitypalette/ActivityPaletteConfigurationTest.java
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-impl/src/test/java/org/apache/taverna/workbench/ui/activitypalette/ActivityPaletteConfigurationTest.java b/taverna-activity-palette-impl/src/test/java/org/apache/taverna/workbench/ui/activitypalette/ActivityPaletteConfigurationTest.java
new file mode 100644
index 0000000..51dcacb
--- /dev/null
+++ b/taverna-activity-palette-impl/src/test/java/org/apache/taverna/workbench/ui/activitypalette/ActivityPaletteConfigurationTest.java
@@ -0,0 +1,98 @@
+/*******************************************************************************
+ * 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 org.apache.taverna.workbench.ui.activitypalette;
+
+import org.apache.taverna.workbench.ui.activitypalette.ActivityPaletteConfiguration;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.UUID;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import uk.org.taverna.configuration.app.impl.ApplicationConfigurationImpl;
+import uk.org.taverna.configuration.impl.ConfigurationManagerImpl;
+
+public class ActivityPaletteConfigurationTest {
+
+	private ActivityPaletteConfiguration conf;
+	private ConfigurationManagerImpl manager;
+
+	@Before
+	public void setup() {
+		File f = new File(System.getProperty("java.io.tmpdir"));
+		final File d = new File(f,UUID.randomUUID().toString());
+		d.mkdir();
+		manager = new ConfigurationManagerImpl(new ApplicationConfigurationImpl() {
+			@Override
+			public File getApplicationHomeDir() {
+				return d;
+			}
+		});
+		conf=new ActivityPaletteConfiguration(manager);
+		conf.restoreDefaults();
+	}
+
+	@Test
+	public void testEmptyList() throws Exception {
+		conf.setPropertyStringList("list", new ArrayList<String>());
+		assertTrue("Result was not a list but was:"+conf.getProperty("list"),conf.getPropertyStringList("list") instanceof List);
+		assertTrue("Result was not a list but was:"+conf.getPropertyStringList("list"),conf.getPropertyStringList("list") instanceof List);
+		List<String> list = conf.getPropertyStringList("list");
+		assertEquals("There should be 0 elements",0,list.size());
+	}
+
+	@Test
+	public void testSingleItem() throws Exception {
+		List<String> list = new ArrayList<>();
+		list.add("fred");
+		conf.setPropertyStringList("single", list);
+
+		assertTrue("should be an ArrayList",conf.getPropertyStringList("single") instanceof List);
+		List<String> l = conf.getPropertyStringList("single");
+		assertEquals("There should be 1 element",1,l.size());
+		assertEquals("Its value should be fred","fred",l.get(0));
+	}
+
+	@Test
+	public void testList() throws Exception {
+		List<String> list = new ArrayList<>();
+		list.add("fred");
+		list.add("bloggs");
+		conf.setPropertyStringList("list", list);
+
+		assertTrue("should be an ArrayList",conf.getPropertyStringList("list") instanceof List);
+		List<String> l = conf.getPropertyStringList("list");
+		assertEquals("There should be 1 element",2,l.size());
+		assertEquals("Its value should be fred","fred",l.get(0));
+		assertEquals("Its value should be bloggs","bloggs",l.get(1));
+	}
+
+	@Test
+	public void testNull() throws Exception {
+		assertNull("Should return null",conf.getProperty("blah blah blah"));
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-impl/src/test/resources/META-INF/services/net.sf.taverna.t2.partition.PartitionAlgorithmSetSPI
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-impl/src/test/resources/META-INF/services/net.sf.taverna.t2.partition.PartitionAlgorithmSetSPI b/taverna-activity-palette-impl/src/test/resources/META-INF/services/net.sf.taverna.t2.partition.PartitionAlgorithmSetSPI
index 9f3c02d..a9a162f 100644
--- a/taverna-activity-palette-impl/src/test/resources/META-INF/services/net.sf.taverna.t2.partition.PartitionAlgorithmSetSPI
+++ b/taverna-activity-palette-impl/src/test/resources/META-INF/services/net.sf.taverna.t2.partition.PartitionAlgorithmSetSPI
@@ -1 +1 @@
-net.sf.taverna.t2.partition.DummyPartitionAlgorithmSet
\ No newline at end of file
+org.apache.taverna.partition.DummyPartitionAlgorithmSet
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-impl/src/test/resources/META-INF/services/net.sf.taverna.t2.partition.PropertyExtractorSPI
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-impl/src/test/resources/META-INF/services/net.sf.taverna.t2.partition.PropertyExtractorSPI b/taverna-activity-palette-impl/src/test/resources/META-INF/services/net.sf.taverna.t2.partition.PropertyExtractorSPI
index f5e7226..ca99b00 100644
--- a/taverna-activity-palette-impl/src/test/resources/META-INF/services/net.sf.taverna.t2.partition.PropertyExtractorSPI
+++ b/taverna-activity-palette-impl/src/test/resources/META-INF/services/net.sf.taverna.t2.partition.PropertyExtractorSPI
@@ -1,3 +1,3 @@
-net.sf.taverna.t2.partition.DummyExtractor1
-net.sf.taverna.t2.partition.DummyExtractor2
-net.sf.taverna.t2.partition.DummyExtractor3
\ No newline at end of file
+org.apache.taverna.partition.DummyExtractor1
+org.apache.taverna.partition.DummyExtractor2
+org.apache.taverna.partition.DummyExtractor3
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-impl/src/test/resources/META-INF/services/net.sf.taverna.t2.partition.QueryFactory
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-impl/src/test/resources/META-INF/services/net.sf.taverna.t2.partition.QueryFactory b/taverna-activity-palette-impl/src/test/resources/META-INF/services/net.sf.taverna.t2.partition.QueryFactory
index 2d26d31a..d34c5a5 100644
--- a/taverna-activity-palette-impl/src/test/resources/META-INF/services/net.sf.taverna.t2.partition.QueryFactory
+++ b/taverna-activity-palette-impl/src/test/resources/META-INF/services/net.sf.taverna.t2.partition.QueryFactory
@@ -1,2 +1,2 @@
-net.sf.taverna.t2.partition.DummyActivityQueryFactory
-net.sf.taverna.t2.partition.DummyQueryFactory
\ No newline at end of file
+org.apache.taverna.partition.DummyActivityQueryFactory
+org.apache.taverna.partition.DummyQueryFactory
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-ui/src/main/java/net/sf/taverna/t2/workbench/ui/servicepanel/PathElementFilterTreeNode.java
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-ui/src/main/java/net/sf/taverna/t2/workbench/ui/servicepanel/PathElementFilterTreeNode.java b/taverna-activity-palette-ui/src/main/java/net/sf/taverna/t2/workbench/ui/servicepanel/PathElementFilterTreeNode.java
deleted file mode 100644
index 5c65bc0..0000000
--- a/taverna-activity-palette-ui/src/main/java/net/sf/taverna/t2/workbench/ui/servicepanel/PathElementFilterTreeNode.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*******************************************************************************
- * 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.workbench.ui.servicepanel;
-
-import net.sf.taverna.t2.workbench.ui.servicepanel.tree.FilterTreeNode;
-
-/**
- * @author alanrw
- */
-public class PathElementFilterTreeNode extends FilterTreeNode {
-	private static final long serialVersionUID = 6491242031931630314L;
-
-	public PathElementFilterTreeNode(String userObject) {
-		super(userObject);
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-ui/src/main/java/net/sf/taverna/t2/workbench/ui/servicepanel/RootFilterTreeNode.java
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-ui/src/main/java/net/sf/taverna/t2/workbench/ui/servicepanel/RootFilterTreeNode.java b/taverna-activity-palette-ui/src/main/java/net/sf/taverna/t2/workbench/ui/servicepanel/RootFilterTreeNode.java
deleted file mode 100644
index 86fca05..0000000
--- a/taverna-activity-palette-ui/src/main/java/net/sf/taverna/t2/workbench/ui/servicepanel/RootFilterTreeNode.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*******************************************************************************
- * 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.workbench.ui.servicepanel;
-
-import net.sf.taverna.t2.workbench.ui.servicepanel.tree.FilterTreeNode;
-
-/**
- * @author alanrw
- */
-public class RootFilterTreeNode extends FilterTreeNode {
-	private static final long serialVersionUID = 1047743498806473971L;
-
-	public RootFilterTreeNode(String userObject) {
-		super(userObject);
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-ui/src/main/java/net/sf/taverna/t2/workbench/ui/servicepanel/ServiceFilter.java
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-ui/src/main/java/net/sf/taverna/t2/workbench/ui/servicepanel/ServiceFilter.java b/taverna-activity-palette-ui/src/main/java/net/sf/taverna/t2/workbench/ui/servicepanel/ServiceFilter.java
deleted file mode 100644
index a83ac2d..0000000
--- a/taverna-activity-palette-ui/src/main/java/net/sf/taverna/t2/workbench/ui/servicepanel/ServiceFilter.java
+++ /dev/null
@@ -1,158 +0,0 @@
-/*******************************************************************************
- * 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.workbench.ui.servicepanel;
-
-import static java.beans.Introspector.getBeanInfo;
-
-import java.beans.BeanInfo;
-import java.beans.IntrospectionException;
-import java.beans.PropertyDescriptor;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-
-import javax.swing.tree.DefaultMutableTreeNode;
-
-import net.sf.taverna.t2.servicedescriptions.ServiceDescription;
-import net.sf.taverna.t2.workbench.ui.servicepanel.tree.Filter;
-
-import org.apache.log4j.Logger;
-
-public class ServiceFilter implements Filter {
-	private static Logger logger = Logger.getLogger(ServiceFilter.class);
-
-	private String filterString;
-	private boolean superseded;
-	private String[] filterLowerCaseSplit;
-	private final Object rootToIgnore;
-
-	public ServiceFilter(String filterString, Object rootToIgnore) {
-		this.filterString = filterString;
-		this.rootToIgnore = rootToIgnore;
-		this.filterLowerCaseSplit = filterString.toLowerCase().split(" ");
-		this.superseded = false;
-	}
-
-	private boolean basicFilter(DefaultMutableTreeNode node) {
-		if (node == rootToIgnore)
-			return false;
-		if (filterString.isEmpty())
-			return true;
-
-		if (node.getUserObject() instanceof ServiceDescription) {
-			ServiceDescription serviceDescription = (ServiceDescription) node
-					.getUserObject();
-			for (String searchTerm : filterLowerCaseSplit) {
-				if (superseded)
-					return false;
-				String[] typeSplit = searchTerm.split(":", 2);
-				String type;
-				String keyword;
-				if (typeSplit.length == 2) {
-					type = typeSplit[0];
-					keyword = typeSplit[1].toLowerCase();
-				} else {
-					type = null;
-					keyword = searchTerm.toLowerCase();
-				}
-				try {
-					if (!doesPropertySatisfy(serviceDescription, type, keyword))
-						return false;
-				} catch (IntrospectionException | IllegalArgumentException
-						| IllegalAccessException | InvocationTargetException e) {
-					logger.error(
-							"failed to get properties of service description",
-							e);
-					return false;
-				}
-			}
-			return true;
-		}
-		for (String searchString : filterLowerCaseSplit)
-			if (!node.getUserObject().toString().toLowerCase().contains(
-					searchString))
-				return false;
-		return true;
-	}
-
-	/**
-	 * Determine whether a service description satisfies a search term.
-	 * 
-	 * @param serviceDescription
-	 *            The service description bean to look in.
-	 * @param type
-	 *            The name of the property to look in, or <tt>null</tt> to
-	 *            search in all public non-expert properties.
-	 * @param searchTerm
-	 *            The string to search for.
-	 * @return <tt>true</tt> if-and-only-if the description matches.
-	 */
-	private boolean doesPropertySatisfy(ServiceDescription serviceDescription,
-			String type, String searchTerm) throws IllegalAccessException,
-			IllegalArgumentException, InvocationTargetException,
-			IntrospectionException {
-		BeanInfo beanInfo = getBeanInfo(serviceDescription.getClass());
-		for (PropertyDescriptor property : beanInfo.getPropertyDescriptors()) {
-			if (superseded)
-				return false;
-			if ((type == null && !property.isHidden() && !property.isExpert())
-					|| property.getName().equalsIgnoreCase(type)) {
-				Method readMethod = property.getReadMethod();
-				if (readMethod == null)
-					continue;
-				Object readProperty = readMethod.invoke(serviceDescription,
-						new Object[0]);
-				if (readProperty == null)
-					continue;
-				if (readProperty.toString().toLowerCase().contains(searchTerm))
-					return true;
-				// Dig deeper?
-			}
-		}
-		return false;
-	}
-
-	@Override
-	public boolean pass(DefaultMutableTreeNode node) {
-		return basicFilter(node);
-	}
-
-	@Override
-	public String filterRepresentation(String original) {
-		return original;
-	}
-
-	/**
-	 * @return the superseded
-	 */
-	@Override
-	public boolean isSuperseded() {
-		return superseded;
-	}
-
-	/**
-	 * @param superseded
-	 *            the superseded to set
-	 */
-	@Override
-	public void setSuperseded(boolean superseded) {
-		this.superseded = superseded;
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-activity-palette-ui/src/main/java/net/sf/taverna/t2/workbench/ui/servicepanel/ServiceFilterTreeNode.java
----------------------------------------------------------------------
diff --git a/taverna-activity-palette-ui/src/main/java/net/sf/taverna/t2/workbench/ui/servicepanel/ServiceFilterTreeNode.java b/taverna-activity-palette-ui/src/main/java/net/sf/taverna/t2/workbench/ui/servicepanel/ServiceFilterTreeNode.java
deleted file mode 100644
index 0e559ce..0000000
--- a/taverna-activity-palette-ui/src/main/java/net/sf/taverna/t2/workbench/ui/servicepanel/ServiceFilterTreeNode.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * 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.workbench.ui.servicepanel;
-
-import net.sf.taverna.t2.servicedescriptions.ServiceDescription;
-import net.sf.taverna.t2.workbench.ui.servicepanel.tree.FilterTreeNode;
-
-/**
- * @author alanrw
- */
-public class ServiceFilterTreeNode extends FilterTreeNode {
-	private static final long serialVersionUID = 6066698619971305454L;
-	
-	public ServiceFilterTreeNode(ServiceDescription userObject) {
-		super(userObject);
-	}
-
-	@Override
-	public ServiceDescription getUserObject() {
-		return (ServiceDescription) super.getUserObject();
-	}
-}


[04/51] [partial] incubator-taverna-workbench git commit: all packages are moved to org.apache.taverna.*

Posted by re...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-menu-api/src/main/java/org/apache/taverna/ui/menu/AbstractMenuSection.java
----------------------------------------------------------------------
diff --git a/taverna-menu-api/src/main/java/org/apache/taverna/ui/menu/AbstractMenuSection.java b/taverna-menu-api/src/main/java/org/apache/taverna/ui/menu/AbstractMenuSection.java
new file mode 100644
index 0000000..9966d0f
--- /dev/null
+++ b/taverna-menu-api/src/main/java/org/apache/taverna/ui/menu/AbstractMenuSection.java
@@ -0,0 +1,112 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.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/a9a52bd5/taverna-menu-api/src/main/java/org/apache/taverna/ui/menu/AbstractMenuToggle.java
----------------------------------------------------------------------
diff --git a/taverna-menu-api/src/main/java/org/apache/taverna/ui/menu/AbstractMenuToggle.java b/taverna-menu-api/src/main/java/org/apache/taverna/ui/menu/AbstractMenuToggle.java
new file mode 100644
index 0000000..70c47f5
--- /dev/null
+++ b/taverna-menu-api/src/main/java/org/apache/taverna/ui/menu/AbstractMenuToggle.java
@@ -0,0 +1,131 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.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/a9a52bd5/taverna-menu-api/src/main/java/org/apache/taverna/ui/menu/AbstractToolBar.java
----------------------------------------------------------------------
diff --git a/taverna-menu-api/src/main/java/org/apache/taverna/ui/menu/AbstractToolBar.java b/taverna-menu-api/src/main/java/org/apache/taverna/ui/menu/AbstractToolBar.java
new file mode 100644
index 0000000..c3fe045
--- /dev/null
+++ b/taverna-menu-api/src/main/java/org/apache/taverna/ui/menu/AbstractToolBar.java
@@ -0,0 +1,73 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.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/a9a52bd5/taverna-menu-api/src/main/java/org/apache/taverna/ui/menu/ContextualMenuComponent.java
----------------------------------------------------------------------
diff --git a/taverna-menu-api/src/main/java/org/apache/taverna/ui/menu/ContextualMenuComponent.java b/taverna-menu-api/src/main/java/org/apache/taverna/ui/menu/ContextualMenuComponent.java
new file mode 100644
index 0000000..ec729cf
--- /dev/null
+++ b/taverna-menu-api/src/main/java/org/apache/taverna/ui/menu/ContextualMenuComponent.java
@@ -0,0 +1,54 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.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/a9a52bd5/taverna-menu-api/src/main/java/org/apache/taverna/ui/menu/ContextualSelection.java
----------------------------------------------------------------------
diff --git a/taverna-menu-api/src/main/java/org/apache/taverna/ui/menu/ContextualSelection.java b/taverna-menu-api/src/main/java/org/apache/taverna/ui/menu/ContextualSelection.java
new file mode 100644
index 0000000..19ef657
--- /dev/null
+++ b/taverna-menu-api/src/main/java/org/apache/taverna/ui/menu/ContextualSelection.java
@@ -0,0 +1,67 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.ui.menu;
+
+import java.awt.Component;
+
+import javax.swing.JPopupMenu;
+
+import org.apache.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/a9a52bd5/taverna-menu-api/src/main/java/org/apache/taverna/ui/menu/DefaultContextualMenu.java
----------------------------------------------------------------------
diff --git a/taverna-menu-api/src/main/java/org/apache/taverna/ui/menu/DefaultContextualMenu.java b/taverna-menu-api/src/main/java/org/apache/taverna/ui/menu/DefaultContextualMenu.java
new file mode 100644
index 0000000..57e1f53
--- /dev/null
+++ b/taverna-menu-api/src/main/java/org/apache/taverna/ui/menu/DefaultContextualMenu.java
@@ -0,0 +1,52 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.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/a9a52bd5/taverna-menu-api/src/main/java/org/apache/taverna/ui/menu/DefaultMenuBar.java
----------------------------------------------------------------------
diff --git a/taverna-menu-api/src/main/java/org/apache/taverna/ui/menu/DefaultMenuBar.java b/taverna-menu-api/src/main/java/org/apache/taverna/ui/menu/DefaultMenuBar.java
new file mode 100644
index 0000000..2ddef45
--- /dev/null
+++ b/taverna-menu-api/src/main/java/org/apache/taverna/ui/menu/DefaultMenuBar.java
@@ -0,0 +1,49 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.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/a9a52bd5/taverna-menu-api/src/main/java/org/apache/taverna/ui/menu/DefaultToolBar.java
----------------------------------------------------------------------
diff --git a/taverna-menu-api/src/main/java/org/apache/taverna/ui/menu/DefaultToolBar.java b/taverna-menu-api/src/main/java/org/apache/taverna/ui/menu/DefaultToolBar.java
new file mode 100644
index 0000000..7aab590
--- /dev/null
+++ b/taverna-menu-api/src/main/java/org/apache/taverna/ui/menu/DefaultToolBar.java
@@ -0,0 +1,50 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.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/a9a52bd5/taverna-menu-api/src/main/java/org/apache/taverna/ui/menu/DesignOnlyAction.java
----------------------------------------------------------------------
diff --git a/taverna-menu-api/src/main/java/org/apache/taverna/ui/menu/DesignOnlyAction.java b/taverna-menu-api/src/main/java/org/apache/taverna/ui/menu/DesignOnlyAction.java
new file mode 100644
index 0000000..8614e64
--- /dev/null
+++ b/taverna-menu-api/src/main/java/org/apache/taverna/ui/menu/DesignOnlyAction.java
@@ -0,0 +1,31 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.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/a9a52bd5/taverna-menu-api/src/main/java/org/apache/taverna/ui/menu/DesignOrResultsAction.java
----------------------------------------------------------------------
diff --git a/taverna-menu-api/src/main/java/org/apache/taverna/ui/menu/DesignOrResultsAction.java b/taverna-menu-api/src/main/java/org/apache/taverna/ui/menu/DesignOrResultsAction.java
new file mode 100644
index 0000000..a922b46
--- /dev/null
+++ b/taverna-menu-api/src/main/java/org/apache/taverna/ui/menu/DesignOrResultsAction.java
@@ -0,0 +1,31 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.ui.menu;
+
+/**
+ * Marker interface for actions that are valid the design or result perspectives
+ * are selected.
+ * 
+ * @author alanrw
+ * @author David Withers
+ */
+public interface DesignOrResultsAction {
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-menu-api/src/main/java/org/apache/taverna/ui/menu/MenuComponent.java
----------------------------------------------------------------------
diff --git a/taverna-menu-api/src/main/java/org/apache/taverna/ui/menu/MenuComponent.java b/taverna-menu-api/src/main/java/org/apache/taverna/ui/menu/MenuComponent.java
new file mode 100644
index 0000000..4ac1d7d
--- /dev/null
+++ b/taverna-menu-api/src/main/java/org/apache/taverna/ui/menu/MenuComponent.java
@@ -0,0 +1,276 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.ui.menu;
+
+import java.awt.Component;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.net.URI;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.swing.Action;
+import javax.swing.ButtonGroup;
+import javax.swing.JCheckBox;
+import javax.swing.JMenu;
+import javax.swing.JToolBar;
+import javax.swing.MenuElement;
+
+/**
+ * A menu component, including sub menus, toolbars, and menu items.
+ * <p>
+ * This is an {@link net.sf.taverna.t2.spi.SPIRegistry SPI}, and implementations
+ * should list their fully qualified classnames in
+ * <tt>META-INF/services/net.sf.taverna.t2.ui.menu.MenuComponent</tt> to be
+ * discovered by the {@link MenuManager}.
+ * 
+ * @author Stian Soiland-Reyes
+ * @author David Withers
+ */
+public interface MenuComponent {
+	/**
+	 * The {@link Action} describing this menu item, used for creating the UI
+	 * representation of this item.
+	 * <p>
+	 * As a minimum the action should contain a name, and optionally an icon, a
+	 * description and a keyboard shortcut. For {@linkplain MenuType#action
+	 * actions} and {@linkplain MenuType#toggle toggles} the {@link Action}'s
+	 * {@link ActionListener#actionPerformed(ActionEvent)} method is called when
+	 * the item is clicked/selected.
+	 * <p>
+	 * This action is ignored and should be <code>null</code> for items of type
+	 * {@link MenuType#optionGroup} and {@link MenuType#custom}. The action is
+	 * optional for {@linkplain MenuType#toolBar toolbars} and
+	 * {@linkplain MenuType#section sections}, where the action's name would be
+	 * used as a label.
+	 * 
+	 * @return The {@link Action} describing this menu item, or
+	 *         <code>null</code> if the {@link #getType()} is
+	 *         {@link MenuType#section}, {@link MenuType#optionGroup} or
+	 *         {@link MenuType#custom}.
+	 */
+	public Action getAction();
+
+	/**
+	 * Get a custom {@link Component} to be inserted into the parent
+	 * menu/toolbar.
+	 * <p>
+	 * Used instead of creating menu elements from the {@link #getAction()} if
+	 * the {@link #getType()} is {@link MenuType#custom}. This can be used to
+	 * include dynamic menus.
+	 * <p>
+	 * This value is ignored and should be <code>null</code> for all other types
+	 * except {@link MenuType#custom}.
+	 * 
+	 * @return A {@link Component} to be inserted into the parent menu/toolbar.
+	 */
+	public Component getCustomComponent();
+
+	/**
+	 * The {@link URI} to identify this menu item.
+	 * <p>
+	 * This identifier can be used with other menu item's {@link #getParentId()}
+	 * if this item has a {@link #getType()} of {@link MenuType#menu},
+	 * {@link MenuType#toolBar}, {@link MenuType#section} or
+	 * {@link MenuType#optionGroup}.
+	 * <p>
+	 * Leaf menu items of {@link #getType()} {@link MenuType#toggle},
+	 * {@link MenuType#custom} and {@link MenuType#action} don't need an
+	 * identifier as they can't have children, and may return <code>null</code>
+	 * instead. However, a valid identifier might be used to look up the
+	 * MenuItem with {@link MenuManager#getComponentByURI(URI)}
+	 * <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.
+	 * 
+	 * @return The {@link URI} to identify this menu item.
+	 */
+	public URI getId();
+
+	/**
+	 * The {@link URI} of the parent menu item, as returned by the parent's
+	 * {@link #getId()}.
+	 * <p>
+	 * If this is the {@link DefaultMenuBar#DEFAULT_MENU_BAR}, then this menu
+	 * item will be one of the top level menus of the main application window,
+	 * like "File" or "Edit", and must have {@link #getType()}
+	 * {@link MenuType#menu}.
+	 * <p>
+	 * This value should be <code>null</code> if this item is of
+	 * {@link #getType()} {@link MenuType#toolBar}, and could be
+	 * <code>null</code> if this is an independent root menu of type
+	 * {@link MenuType#menu} (to be used outside the main window).
+	 * <p>
+	 * <strong>Note:</strong> To avoid compile time and runtime dependency on
+	 * the parent menu item, always construct this URI directly using
+	 * {@link URI#create(String)}.
+	 * 
+	 * @return The {@link URI} of the parent menu item.
+	 */
+	public URI getParentId();
+
+	/**
+	 * A hint on how to position this item below the parent.
+	 * <p>
+	 * Menu items within the same parent menu/group/toolBar are ordered
+	 * according to this position hint. If several items have the same position
+	 * hint, their internal order is undefined, although generally it will be
+	 * the order in which they were loaded.
+	 * <p>
+	 * <strong>Tip:</strong> Number the position hints in BASIC style, such as
+	 * 10, 20, etc. so that plugins can use position hint such as 19 or 21 to be
+	 * immediately before or after your item.
+	 * 
+	 * @return A position hint
+	 */
+	public int getPositionHint();
+
+	/**
+	 * The {@link MenuType type} of menu item.
+	 * <p>
+	 * In the simple case of a "File -> New" menu structure, the "File" menu
+	 * item has a type of {@link MenuType#menu}, while the "New" has a type of
+	 * {@link MenuType#action}.
+	 * <p>
+	 * The menu item can only have children (i.e., items with
+	 * {@link #getParentId()} equalling to this item's {@link #getId()}) if the
+	 * type is not a leaf type, i.e., not {@link MenuType#toggle} or
+	 * {@link MenuType#action}.
+	 * 
+	 * @return A {@link MenuType} to specify the role of this menu item.
+	 */
+	public MenuType getType();
+
+	/**
+	 * True if this menu component is to be included in the menu/toolbar.
+	 * 
+	 * @return True is this menu component is to be included
+	 */
+	public boolean isEnabled();
+
+	/**
+	 * The type of menu item, such as {@link #action}, {@link #menu} or
+	 * {@link #toolBar}.
+	 * <p>
+	 * Some types are {@linkplain #isParentType() parent types} - that means
+	 * URIs to menu components of that type can be used as a
+	 * {@linkplain MenuComponent#getParentId() parent id}.
+	 * 
+	 * @author Stian Soiland-Reyes
+	 * 
+	 */
+	public static enum MenuType {
+		/**
+		 * A normal {@link Action} as part of a {@link #menu}, {@link #toolBar},
+		 * {@link #section} or {@link #optionGroup}. Such menu items are leaf
+		 * nodes, which no {@link MenuComponent}s can have this as it's
+		 * {@link MenuComponent#getParentId()}. The action's
+		 * {@link ActionListener#actionPerformed(ActionEvent)} will be called
+		 * when choosing/clicking the menu item from the menu or toolBar.
+		 */
+		action,
+		/**
+		 * Provide a customised {@link MenuElement} from
+		 * {@link MenuComponent#getCustomComponent()} that is to be used instead
+		 * of creating an element from {@link MenuComponent#getAction()}.
+		 */
+		custom,
+		/**
+		 * A group containing mutually exclusive choices (as {@link #action}s),
+		 * to be grouped in a {@link ButtonGroup}, separated using
+		 * {@link JMenu#addSeparator()} or {@link JToolBar#addSeparator()} when
+		 * needed. The {@link MenuComponent#getAction()} is ignored and should
+		 * be <code>null</code>.
+		 */
+		optionGroup,
+		/**
+		 * A section of menu items within {@link #menu} or {@link #toolBar}.
+		 * Sections are separated using {@link JMenu#addSeparator()} or
+		 * {@link JToolBar#addSeparator()} when needed. The
+		 * {@link MenuComponent#getAction()} is ignored and should be
+		 * <code>null</code>.
+		 */
+		section,
+		/**
+		 * A (sub)menu that contain other menu items, including deeper
+		 * {@link #menu}s. The {@link Action} from
+		 * {@link MenuComponent#getAction()} is used to find the name, icon,
+		 * etc., for the sub-menu, while its
+		 * {@link ActionListener#actionPerformed(ActionEvent)} method is
+		 * ignored. The {@link DefaultMenuBar} is the default top level menu,
+		 * although others can be created with <code>null</code> as their
+		 * parent.
+		 */
+		menu,
+		/**
+		 * A boolean toggle action, the action will be shown as a
+		 * {@link JCheckBox} on a menu or toolBar. Such menu items are leaf
+		 * nodes, which no {@link MenuComponent}s can have this as it's
+		 * {@link MenuComponent#getParentId()}. The action's
+		 * {@link ActionListener#actionPerformed(ActionEvent)} will be called
+		 * when toggling the action.
+		 */
+		toggle,
+		/**
+		 * A toolBar containing {@link #optionGroup}s, {@link #toggle}s or
+		 * {@link #action}s. The toolBar can be shown as a {@link JToolBar}. The
+		 * {@link MenuComponent#getAction()} and
+		 * {@link MenuComponent#getParentId()} are ignored and should be
+		 * <code>null</code>.
+		 */
+		toolBar;
+
+		private static final Set<MenuType> parentTypes = defineParentTypes();
+
+		/**
+		 * True if the menu type is a parent type such as {@link #optionGroup},
+		 * {@link #section}, {@link #menu} or {@link #toolBar}. If the type of a
+		 * menu component is a a parent type it can (should) have children,
+		 * i.e., the children has a {@link MenuComponent#getParentId()} that
+		 * equals the parent's {@link MenuComponent#getId()}.
+		 * 
+		 * @return True if the menu type is a parent type.
+		 */
+		public boolean isParentType() {
+			return parentTypes.contains(this);
+		}
+
+		/**
+		 * Create the set of {@link MenuType}s that {@link #isParentType()}
+		 * would return <code>true</code> for.
+		 * 
+		 * @return A {@link Set} of {@link MenuType}s.
+		 */
+		private static Set<MenuType> defineParentTypes() {
+			HashSet<MenuType> types = new HashSet<>();
+			types.add(optionGroup);
+			types.add(section);
+			types.add(menu);
+			types.add(toolBar);
+			return types;
+		}
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-menu-api/src/main/java/org/apache/taverna/ui/menu/MenuManager.java
----------------------------------------------------------------------
diff --git a/taverna-menu-api/src/main/java/org/apache/taverna/ui/menu/MenuManager.java b/taverna-menu-api/src/main/java/org/apache/taverna/ui/menu/MenuManager.java
new file mode 100644
index 0000000..7195164
--- /dev/null
+++ b/taverna-menu-api/src/main/java/org/apache/taverna/ui/menu/MenuManager.java
@@ -0,0 +1,338 @@
+/*
+* 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.
+*/
+
+package org.apache.taverna.ui.menu;
+
+import java.awt.Component;
+import java.lang.ref.WeakReference;
+import java.net.URI;
+import java.util.List;
+
+import javax.swing.JLabel;
+import javax.swing.JMenu;
+import javax.swing.JMenuBar;
+import javax.swing.JMenuItem;
+import javax.swing.JPopupMenu;
+import javax.swing.JToolBar;
+
+import org.apache.taverna.scufl2.api.core.Workflow;
+import org.apache.taverna.lang.observer.Observable;
+import org.apache.taverna.lang.observer.Observer;
+import org.apache.taverna.ui.menu.MenuComponent.MenuType;
+import org.apache.taverna.ui.menu.MenuManager.MenuManagerEvent;
+
+/**
+ * Create {@link JMenuBar}s and {@link JToolBar}s based on SPI instances of
+ * {@link MenuComponent}.
+ * <p>
+ * Elements of menus are discovered automatically using an {@link SPIRegistry}.
+ * The elements specify their internal relationship through
+ * {@link MenuComponent#getParentId()} and
+ * {@link MenuComponent#getPositionHint()}. {@link MenuComponent#getType()}
+ * specifies how the component is to be rendered or grouped.
+ * <p>
+ * The menu manager is {@link Observable}, you can
+ * {@linkplain #addObserver(Observer) add an observer} to be notified when the
+ * menus have changed, i.e. when {@link #update()} has been called, for instance
+ * when the {@link SPIRegistry} (which the menu manager observes) has been
+ * updated due to a plugin installation.
+ * <p>
+ * {@link #createMenuBar()} creates the default menu bar, ie. the menu bar
+ * containing all the items with {@link DefaultMenuBar#DEFAULT_MENU_BAR} as
+ * their parent. Alternate menu bars can be created using
+ * {@link #createMenuBar(URI)}.
+ * <p>
+ * Similary {@link #createToolBar()} creates the default tool bar, containing
+ * the items that has {@link DefaultToolBar#DEFAULT_TOOL_BAR} as their parent.
+ * Alternate toolbars can be created using {@link #createToolBar(URI)}.
+ * <p>
+ * The menu manager keeps weak references to the created (published) menu bars
+ * and tool bars, and will attempt to update them when {@link #update()} is
+ * called.
+ * <p>
+ * See the package level documentation for more information about how to specify
+ * menu elements.
+ * 
+ * @author Stian Soiland-Reyes
+ */
+public interface MenuManager extends Observable<MenuManagerEvent> {
+	/**
+	 * Add the items from the list of menu items to the parent menu with
+	 * expansion sub-menus if needed.
+	 * <p>
+	 * If the list contains more than <tt>maxItemsInMenu</tt> items, a series of
+	 * sub-menus will be created and added to the parentMenu instead, each
+	 * containing a maximum of <tt>maxItemsInMenu</tt> items. (Note that if
+	 * menuItems contains more than <tt>maxItemsInMenu*maxItemsInMenu</tt>
+	 * items, there might be more than <tt>maxItemsInMenu</tt> sub-menus added
+	 * to the parent).
+	 * <p>
+	 * The sub-menus are titled according to the {@link JMenuItem#getText()} of
+	 * the first and last menu item it contains - assuming that they are already
+	 * sorted.
+	 * <p>
+	 * The optional {@link ComponentFactory} headerItemFactory, if not
+	 * <code>null</code>, will be invoked to create a header item that will be
+	 * inserted on top of the sub-menus. This item does not count towards
+	 * <tt>maxItemsInMenu</tt>.
+	 * <p>
+	 * Note that this is a utility method that does not mandate the use of the
+	 * {@link MenuManager} structure for the menu.
+	 * 
+	 * @param menuItems
+	 *            {@link JMenuItem}s to be inserted
+	 * @param parentMenu
+	 *            Menu to insert items to
+	 * @param maxItemsInMenu
+	 *            Maximum number of items in parent menu or created sub-menus
+	 * @param headerItemFactory
+	 *            If not <code>null</code>, a {@link ComponentFactory} to create
+	 *            a header item to insert at top of created sub-menus
+	 */
+	abstract void addMenuItemsWithExpansion(List<JMenuItem> menuItems,
+			JMenu parentMenu, int maxItemsInMenu,
+			ComponentFactory headerItemFactory);
+
+	/**
+	 * Create a contextual menu for a selected object.
+	 * <p>
+	 * Items for the contextual menues are discovered in a similar to fashion as
+	 * with {@link #createMenuBar()}, but using {@link DefaultContextualMenu} as
+	 * the root.
+	 * <p>
+	 * Additionally, items implementing {@link ContextualMenuComponent} will be
+	 * {@linkplain ContextualMenuComponent#setContextualSelection(Object, Object, Component)
+	 * informed} about what is the current selection, as passed to this method.
+	 * <p>
+	 * Thus, the items can choose if they want to be
+	 * {@link MenuComponent#isEnabled() visible} or not for a given selection,
+	 * and return an action that is bound it to the selection.
+	 * 
+	 * @param parent
+	 *            The parent object of the selected object, for instance a
+	 *            {@link Workflow}.
+	 * @param selection
+	 *            The selected object which actions in the contextual menu
+	 *            relate to, for instance a {@link Processor}
+	 * @param relativeToComponent
+	 *            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.
+	 * @return An empty or populated {@link JPopupMenu} depending on the
+	 *         selected objects.
+	 */
+	abstract JPopupMenu createContextMenu(Object parent, Object selection,
+			Component relativeToComponent);
+
+	/**
+	 * Create the {@link JMenuBar} containing menu elements defining
+	 * {@link DefaultMenuBar#DEFAULT_MENU_BAR} as their
+	 * {@linkplain MenuComponent#getParentId() parent}.
+	 * <p>
+	 * A {@linkplain WeakReference weak reference} is kept in the menu manager
+	 * to update the menubar if {@link #update()} is called (manually or
+	 * automatically when the SPI is updated).
+	 * 
+	 * @return A {@link JMenuBar} populated with the items belonging to the
+	 *         default menu bar
+	 */
+	abstract JMenuBar createMenuBar();
+
+	/**
+	 * Create the {@link JMenuBar} containing menu elements defining the given
+	 * <code>id</code> as their {@linkplain MenuComponent#getParentId() parent}.
+	 * <p>
+	 * Note that the parent itself also needs to exist as a registered SPI
+	 * instance og {@link MenuComponent#getType()} equal to
+	 * {@link MenuType#menu}, for instance by subclassing {@link AbstractMenu}.
+	 * <p>
+	 * A {@linkplain WeakReference weak reference} is kept in the menu manager
+	 * to update the menubar if {@link #update()} is called (manually or
+	 * automatically when the SPI is updated).
+	 * 
+	 * @param id
+	 *            The {@link URI} identifying the menu bar
+	 * @return A {@link JMenuBar} populated with the items belonging to the
+	 *         given parent id.
+	 */
+	abstract JMenuBar createMenuBar(URI id);
+
+	/**
+	 * Create the {@link JToolBar} containing elements defining
+	 * {@link DefaultToolBar#DEFAULT_TOOL_BAR} as their
+	 * {@linkplain MenuComponent#getParentId() parent}.
+	 * <p>
+	 * A {@linkplain WeakReference weak reference} is kept in the menu manager
+	 * to update the toolbar if {@link #update()} is called (manually or
+	 * automatically when the SPI is updated).
+	 * 
+	 * @return A {@link JToolBar} populated with the items belonging to the
+	 *         default tool bar
+	 */
+	abstract JToolBar createToolBar();
+
+	/**
+	 * Create the {@link JToolBar} containing menu elements defining the given
+	 * <code>id</code> as their {@linkplain MenuComponent#getParentId() parent}.
+	 * <p>
+	 * Note that the parent itself also needs to exist as a registered SPI
+	 * instance of {@link MenuComponent#getType()} equal to
+	 * {@link MenuType#toolBar}, for instance by subclassing
+	 * {@link AbstractToolBar}.
+	 * <p>
+	 * A {@linkplain WeakReference weak reference} is kept in the menu manager
+	 * to update the toolbar if {@link #update()} is called (manually or
+	 * automatically when the SPI is updated).
+	 * 
+	 * @param id
+	 *            The {@link URI} identifying the tool bar
+	 * @return A {@link JToolBar} populated with the items belonging to the
+	 *         given parent id.
+	 */
+	abstract JToolBar createToolBar(URI id);
+
+	/**
+	 * Get a menu item identified by the given URI.
+	 * <p>
+	 * Return the UI {@link Component} last created for a {@link MenuComponent},
+	 * through {@link #createMenuBar()}, {@link #createMenuBar(URI)},
+	 * {@link #createToolBar()} or {@link #createToolBar(URI)}.
+	 * <p>
+	 * For instance, if {@link #createMenuBar()} created a menu bar containing a
+	 * "File" menu with {@link MenuComponent#getId() getId()} ==
+	 * <code>http://example.com/menu#file</code>, calling:
+	 * 
+	 * <pre>
+	 * Component fileMenu = getComponentByURI(URI
+	 * 		.create(&quot;http://example.com/menu#file&quot;));
+	 * </pre>
+	 * 
+	 * would return the {@link JMenu} last created for "File". Note that "last
+	 * created" could mean both the last call to {@link #createMenuBar()} and
+	 * last call to {@link #update()} - which could have happened because the
+	 * SPI registry was updated. To be notified when
+	 * {@link #getComponentByURI(URI)} might return a new Component because the
+	 * menues have been reconstructed, {@linkplain #addObserver(Observer) add an
+	 * observer} to the MenuManager.
+	 * <p>
+	 * If the URI is unknown, has not yet been rendered as a {@link Component},
+	 * or the Component is no longer in use outside the menu manager's
+	 * {@linkplain WeakReference weak references}, <code>null</code> is returned
+	 * instead.
+	 * 
+	 * @see #getURIByComponent(Component)
+	 * @param id
+	 *            {@link URI} of menu item as returned by
+	 *            {@link MenuComponent#getId()}
+	 * @return {@link Component} as previously generated by
+	 *         {@link #createMenuBar()}/{@link #createToolBar()}, or
+	 *         <code>null</code> if the URI is unknown, or if the
+	 *         {@link Component} no longer exists.
+	 */
+	public abstract Component getComponentByURI(URI id);
+
+	/**
+	 * Get the URI of the {@link MenuComponent} this menu/toolbar
+	 * {@link Component} was created from.
+	 * <p>
+	 * If the component was created by the MenuManager, through
+	 * {@link #createMenuBar()}, {@link #createMenuBar(URI)},
+	 * {@link #createToolBar()} or {@link #createToolBar(URI)}, the URI
+	 * identifying the defining {@link MenuComponent} is returned. This will be
+	 * the same URI as returned by {@link MenuComponent#getId()}.
+	 * <p>
+	 * Note that if {@link #update()} has been invoked, the {@link MenuManager}
+	 * might have rebuilt the menu structure and replaced the components since
+	 * the given <code>component</code> was created. The newest
+	 * {@link Component} for the given URI can be retrieved using
+	 * {@link #getComponentByURI(URI)}.
+	 * <p>
+	 * If the component is unknown, <code>null</code> is returned instead.
+	 * 
+	 * @see #getComponentByURI(URI)
+	 * @param component
+	 *            {@link Component} that was previously created by the
+	 *            {@link MenuManager}
+	 * @return {@link URI} identifying the menu component, as returned by
+	 *         {@link MenuComponent#getId()}, or <code>null</code> if the
+	 *         component is unknown.
+	 */
+	abstract URI getURIByComponent(Component component);
+
+	/**
+	 * Update and rebuild the menu structure.
+	 * <p>
+	 * Rebuild menu structure as defined by the {@link MenuComponent}s retrieved
+	 * from the MenuComponent {@link SPIRegistry}.
+	 * <p>
+	 * Rebuilds previously published menubars and toolbars created with
+	 * {@link #createMenuBar()}, {@link #createMenuBar(URI)},
+	 * {@link #createToolBar()} and {@link #createToolBar(URI)}. Note that the
+	 * rebuild will do a removeAll() on the menubar/toolbar, so all components
+	 * will be reconstructed. You can use {@link #getComponentByURI(URI)} to
+	 * look up individual components within the menu and toolbars.
+	 * <p>
+	 * Note that the menu manager is observing the {@link SPIRegistry}, so if a
+	 * plugin gets installed and the SPI registry is updated, this update method
+	 * will be called by the SPI registry observer.
+	 * <p>
+	 * If there are several concurrent calls to {@link #update()}, the calls
+	 * from the other thread will return immediately, while the first thread to
+	 * get the synchronization lock on the menu manager will do the actual
+	 * update. If you want to ensure that {@link #update()} does not return
+	 * before the update has been performed fully, synchronize on the menu
+	 * manager:
+	 * 
+	 * <pre>
+	 * MenuManager menuManager = MenuManager.getInstance();
+	 * synchronized (menuManager) {
+	 * 	menuManager.update();
+	 * }
+	 * doSomethingAfterUpdateFinished();
+	 * </pre>
+	 */
+	abstract void update();
+
+	/**
+	 * Abstract class for events sent to {@linkplain Observer observers} of the
+	 * menu manager.
+	 * 
+	 * @see UpdatedMenuManagerEvent
+	 * @author Stian Soiland-Reyes
+	 */
+	static abstract class MenuManagerEvent {
+	}
+
+	/**
+	 * Event sent to observers registered by
+	 * {@link MenuManager#addObserver(Observer)} when the menus have been
+	 * updated, i.e. when {@link MenuManager#update()} has been called.
+	 */
+	static class UpdatedMenuManagerEvent extends MenuManagerEvent {
+	}
+
+	/**
+	 * A factory for making {@link Component}s, in particular for making headers
+	 * (like {@link JLabel}s) for
+	 * {@link MenuManager#addMenuItemsWithExpansion(List, JMenu, int, ComponentFactory)}
+	 */
+	interface ComponentFactory {
+		public Component makeComponent();
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-menu-api/src/main/java/org/apache/taverna/ui/menu/package-info.java
----------------------------------------------------------------------
diff --git a/taverna-menu-api/src/main/java/org/apache/taverna/ui/menu/package-info.java b/taverna-menu-api/src/main/java/org/apache/taverna/ui/menu/package-info.java
new file mode 100644
index 0000000..f2b39a8
--- /dev/null
+++ b/taverna-menu-api/src/main/java/org/apache/taverna/ui/menu/package-info.java
@@ -0,0 +1,141 @@
+/*******************************************************************************
+ * 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
+ ******************************************************************************/
+/**
+ * An {@link net.sf.taverna.t2.spi.SPIRegistry SPI} based system for creating
+ * {@link javax.swing.JMenuBar menues} and {@link javax.swing.JToolBar toolbars}.
+ * <p>
+ * Each element of a menu and/or toolbar is created by making an SPI
+ * implementation class of {@link net.sf.taverna.t2.ui.menu.MenuComponent} and listing the fully qualified
+ * class name in the SPI description resource file
+ * <code>/META-INF/services/net.sf.taverna.t2.ui.menu.MenuComponent</code>
+ * </p>
+ * <p>
+ * The {@link net.sf.taverna.t2.ui.menu.MenuManager} discovers all menu components using an SPI registry,
+ * and builds the {@link javax.swing.JMenuBar menu bar} using
+ * {@link net.sf.taverna.t2.ui.menu.MenuManager#createMenuBar()} or the
+ * {@link javax.swing.JToolBar toolbar} using
+ * {@link net.sf.taverna.t2.ui.menu.MenuManager#createToolBar()}.
+ * </p>
+ * <p>
+ * This allows plugins to provide actions (menu items) and submenues that can be
+ * inserted at any points in the generated menu. All parts of the menues are
+ * described through a parent/child relationship using
+ * {@link net.sf.taverna.t2.ui.menu.MenuComponent#getId()} and {@link net.sf.taverna.t2.ui.menu.MenuComponent#getParentId()}. The
+ * components are identified using {@link java.net.URI}s to avoid compile time
+ * dependencies, so a plugin can for instance add something to the existing
+ * "Edit" menu without depending on the actual implementation of the
+ * {@link net.sf.taverna.t2.ui.menu.MenuComponent} describing "Edit", as long as it refers to the same
+ * URI. The use of URIs instead of pure strings is to encourage the use of
+ * unique identifiers, for instance plugins should use an URI base that is
+ * derived from their package name to avoid collision with other plugins.
+ * </p>
+ * <p>
+ * A set of abstract classes, with a common parent {@link net.sf.taverna.t2.ui.menu.AbstractMenuItem},
+ * make it more convenient to create simple SPI implementations. Two default top
+ * level implementations {@link net.sf.taverna.t2.ui.menu.DefaultMenuBar} and {@link net.sf.taverna.t2.ui.menu.DefaultToolBar} can
+ * be used as parents for items that are to be included in
+ * {@link net.sf.taverna.t2.ui.menu.MenuManager#createMenuBar()} and {@link net.sf.taverna.t2.ui.menu.MenuManager#createToolBar()},
+ * but it's possible to have other parents - such menu trees would have to be
+ * created by providing the URI of the top level parent to
+ * {@link net.sf.taverna.t2.ui.menu.MenuManager#createMenuBar(URI)} or
+ * {@link net.sf.taverna.t2.ui.menu.MenuManager#createToolBar(URI)}.
+ * </p> 
+ * <p>
+ * In the simplest form a menu structure can be built by subclassing
+ * {@link net.sf.taverna.t2.ui.menu.AbstractMenu} and {@link net.sf.taverna.t2.ui.menu.AbstractMenuAction}, but more complex menus
+ * can be built by including submenus (AbstractMenu with an AbstractMenu as a
+ * parent), grouping similar actions in a {@link net.sf.taverna.t2.ui.menu.AbstractMenuSection section},
+ * or making {@link net.sf.taverna.t2.ui.menu.AbstractMenuToggle toggle actions} and
+ * {@link net.sf.taverna.t2.ui.menu.AbstractMenuOptionGroup option groups}. You can add arbitrary "real"
+ * {@link javax.swing.JMenuBar} / {@link javax.swing.JToolBar} compatible items
+ * (such as {@link javax.swing.JMenu}s, {@link javax.swing.JMenuItem}s and
+ * {@link javax.swing.JButton}s) using
+ * {@link net.sf.taverna.t2.ui.menu.AbstractMenuCustom custom menu items}.
+ * </p>
+ * 
+ * <p>
+ * Example showing how <code>File-&gt;Open</code> could be implemented using
+ * two SPI implementations net.sf.taverna.t2.ui.perspectives.hello.FileMenu and
+ * net.sf.taverna.t2.ui.perspectives.hello.FileOpenAction:
+ * </p>
+ * 
+ * <pre>
+ * package net.sf.taverna.t2.ui.perspectives.hello;
+ * 
+ * import java.net.URI;
+ * 
+ * import net.sf.taverna.t2.ui.menu.AbstractMenu;
+ * import net.sf.taverna.t2.ui.menu.DefaultMenuBar;
+ * 
+ * public class FileMenu extends AbstractMenu {
+ * 
+ * 	private static final URI FILE_URI = URI
+ * 			.create(&quot;http://taverna.sf.net/2008/t2workbench/test#file&quot;);
+ * 
+ * 	public FileMenu() {
+ * 		super(DefaultMenuBar.DEFAULT_MENU_BAR, 10, FILE_URI, &quot;File&quot;);
+ * 	}
+ * 
+ * }
+ * </pre>
+ * <pre>
+ * package net.sf.taverna.t2.ui.perspectives.hello;
+ * 
+ * import java.awt.event.ActionEvent;
+ * import java.net.URI;
+ * 
+ * import javax.swing.AbstractAction;
+ * import javax.swing.Action;
+ * import javax.swing.JOptionPane;
+ * 
+ * import net.sf.taverna.t2.ui.menu.AbstractMenuAction;
+ * 
+ * public class FileOpenAction extends AbstractMenuAction {
+ *     public FileOpenAction() {
+ *         super(URI.create(&quot;http://taverna.sf.net/2008/t2workbench/test#file&quot;),
+ *                 20);
+ *     }
+ * 
+ *     &#064;Override
+ *     public Action createAction() {
+ *         return new AbstractAction(&quot;Open&quot;) {
+ *             public void actionPerformed(ActionEvent arg0) {
+ *                 JOptionPane.showMessageDialog(null, &quot;Open&quot;);
+ *             }
+ *         };
+ *     }
+ * }
+ * </pre>
+ * 
+ * <p>
+ * The implementation of the {@link net.sf.taverna.t2.ui.menu.MenuManager} itself is discovered by an
+ * internal SPI registry through {@link net.sf.taverna.t2.ui.menu.MenuManager#getInstance()}. The menu
+ * manager is observing the SPI registry, so that any updates to the registry
+ * from installing plugins etc. are reflected in an automatic rebuild of the
+ * menus. This update can also be triggered manually by calling
+ * {@link net.sf.taverna.t2.ui.menu.MenuManager#update()}.
+ * </p>
+ * 
+ * @author Stian Soiland-Reyes
+ * 
+ */
+package org.apache.taverna.ui.menu;
+

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-menu-api/src/main/resources/META-INF/services/net.sf.taverna.t2.ui.menu.MenuComponent
----------------------------------------------------------------------
diff --git a/taverna-menu-api/src/main/resources/META-INF/services/net.sf.taverna.t2.ui.menu.MenuComponent b/taverna-menu-api/src/main/resources/META-INF/services/net.sf.taverna.t2.ui.menu.MenuComponent
deleted file mode 100644
index c137386..0000000
--- a/taverna-menu-api/src/main/resources/META-INF/services/net.sf.taverna.t2.ui.menu.MenuComponent
+++ /dev/null
@@ -1,4 +0,0 @@
-net.sf.taverna.t2.ui.menu.DefaultMenuBar
-net.sf.taverna.t2.ui.menu.DefaultToolBar
-net.sf.taverna.t2.ui.menu.DefaultContextualMenu
- 

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-menu-api/src/main/resources/META-INF/services/org.apache.taverna.ui.menu.MenuComponent
----------------------------------------------------------------------
diff --git a/taverna-menu-api/src/main/resources/META-INF/services/org.apache.taverna.ui.menu.MenuComponent b/taverna-menu-api/src/main/resources/META-INF/services/org.apache.taverna.ui.menu.MenuComponent
new file mode 100644
index 0000000..8335f7e
--- /dev/null
+++ b/taverna-menu-api/src/main/resources/META-INF/services/org.apache.taverna.ui.menu.MenuComponent
@@ -0,0 +1,4 @@
+org.apache.taverna.ui.menu.DefaultMenuBar
+org.apache.taverna.ui.menu.DefaultToolBar
+org.apache.taverna.ui.menu.DefaultContextualMenu
+ 

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-menu-api/src/main/resources/META-INF/spring/menu-api-context.xml
----------------------------------------------------------------------
diff --git a/taverna-menu-api/src/main/resources/META-INF/spring/menu-api-context.xml b/taverna-menu-api/src/main/resources/META-INF/spring/menu-api-context.xml
index 734dbbe..1e8a1eb 100644
--- a/taverna-menu-api/src/main/resources/META-INF/spring/menu-api-context.xml
+++ b/taverna-menu-api/src/main/resources/META-INF/spring/menu-api-context.xml
@@ -3,8 +3,8 @@
 	xsi:schemaLocation="http://www.springframework.org/schema/beans 
                       http://www.springframework.org/schema/beans/spring-beans.xsd">
 
-	<bean id="DefaultMenuBar" class="net.sf.taverna.t2.ui.menu.DefaultMenuBar" />
-	<bean id="DefaultToolBar" class="net.sf.taverna.t2.ui.menu.DefaultToolBar" />
-	<bean id="DefaultContextualMenu" class="net.sf.taverna.t2.ui.menu.DefaultContextualMenu" />
+	<bean id="DefaultMenuBar" class="org.apache.taverna.ui.menu.DefaultMenuBar" />
+	<bean id="DefaultToolBar" class="org.apache.taverna.ui.menu.DefaultToolBar" />
+	<bean id="DefaultContextualMenu" class="org.apache.taverna.ui.menu.DefaultContextualMenu" />
 
 </beans>