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());
-               }
-
-       }
-
-}

Reply via email to