You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@taverna.apache.org by st...@apache.org on 2015/03/20 15:22:35 UTC
[21/51] [abbrv] [partial] incubator-taverna-workbench git commit:
taverna-workbench-* -> taverna-*
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/52fd79dd/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/contextualviews/ShowConfigureMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/contextualviews/ShowConfigureMenuAction.java b/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/contextualviews/ShowConfigureMenuAction.java
new file mode 100644
index 0000000..49c07a2
--- /dev/null
+++ b/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/contextualviews/ShowConfigureMenuAction.java
@@ -0,0 +1,165 @@
+/**********************************************************************
+ * Copyright (C) 2007-2009 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ **********************************************************************/
+package net.sf.taverna.t2.ui.menu.items.contextualviews;
+
+import java.awt.KeyboardFocusManager;
+import java.awt.event.ActionEvent;
+import java.awt.event.KeyEvent;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.net.URI;
+import java.util.List;
+import java.util.Set;
+
+import javax.swing.AbstractAction;
+import javax.swing.Action;
+import javax.swing.KeyStroke;
+import javax.swing.text.JTextComponent;
+
+import net.sf.taverna.t2.ui.menu.AbstractMenuAction;
+import net.sf.taverna.t2.ui.menu.DesignOnlyAction;
+import net.sf.taverna.t2.ui.menu.MenuManager;
+import net.sf.taverna.t2.workbench.design.actions.EditDataflowInputPortAction;
+import net.sf.taverna.t2.workbench.design.actions.EditDataflowOutputPortAction;
+import net.sf.taverna.t2.workbench.edits.EditManager;
+import net.sf.taverna.t2.workbench.selection.DataflowSelectionModel;
+import net.sf.taverna.t2.workbench.selection.SelectionManager;
+import net.sf.taverna.t2.workbench.ui.views.contextualviews.merge.MergeConfigurationView;
+import net.sf.taverna.t2.workbench.ui.workflowview.WorkflowView;
+
+import org.apache.log4j.Logger;
+
+import uk.org.taverna.scufl2.api.common.Scufl2Tools;
+import uk.org.taverna.scufl2.api.container.WorkflowBundle;
+import uk.org.taverna.scufl2.api.core.DataLink;
+import uk.org.taverna.scufl2.api.core.Processor;
+import uk.org.taverna.scufl2.api.port.InputWorkflowPort;
+import uk.org.taverna.scufl2.api.port.OutputWorkflowPort;
+
+public class ShowConfigureMenuAction extends AbstractMenuAction {
+
+ private static Logger logger = Logger.getLogger(ShowConfigureMenuAction.class);
+
+ public static final URI GRAPH_DETAILS_MENU_SECTION = URI
+ .create("http://taverna.sf.net/2008/t2workbench/menu#graphDetailsMenuSection");
+
+ private static final URI SHOW_CONFIGURE_URI = URI
+ .create("http://taverna.sf.net/2008/t2workbench/menu#graphMenuShowConfigureComponent");
+
+ private EditManager editManager;
+
+ private SelectionManager selectionManager;
+
+ private MenuManager menuManager;
+
+ private Scufl2Tools scufl2Tools = new Scufl2Tools();
+
+ public ShowConfigureMenuAction() {
+ super(GRAPH_DETAILS_MENU_SECTION, 20, SHOW_CONFIGURE_URI);
+ }
+
+ @Override
+ protected Action createAction() {
+ return new ShowConfigureAction();
+ }
+
+ @SuppressWarnings("serial")
+ protected class ShowConfigureAction extends AbstractAction implements DesignOnlyAction {
+
+ private boolean enabled;
+
+ ShowConfigureAction() {
+ super();
+ putValue(NAME, "Configure");
+ putValue(SHORT_DESCRIPTION, "Configure selected component");
+ putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0, false));
+
+ KeyboardFocusManager focusManager = KeyboardFocusManager
+ .getCurrentKeyboardFocusManager();
+ focusManager.addPropertyChangeListener(new PropertyChangeListener() {
+ public void propertyChange(PropertyChangeEvent e) {
+ String prop = e.getPropertyName();
+ if ("focusOwner".equals(prop)) {
+ if (e.getNewValue() instanceof JTextComponent) {
+ ShowConfigureAction.super.setEnabled(false);
+ } else {
+ ShowConfigureAction.this.setEnabled(enabled);
+ }
+ }
+ }
+ });
+ }
+
+ @Override
+ public void setEnabled(boolean enabled) {
+ this.enabled = enabled;
+ super.setEnabled(enabled);
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ WorkflowBundle workflowBundle = selectionManager.getSelectedWorkflowBundle();
+ DataflowSelectionModel dataFlowSelectionModel = selectionManager
+ .getDataflowSelectionModel(workflowBundle);
+ // Get selected port
+ Set<Object> selectedWFComponents = dataFlowSelectionModel.getSelection();
+ if (selectedWFComponents.size() > 0) {
+ Object component = selectedWFComponents.iterator().next();
+ if (component instanceof Processor) {
+ Action action = WorkflowView.getConfigureAction((Processor) component,
+ menuManager);
+ if (action != null) {
+ action.actionPerformed(e);
+ }
+ } else if (component instanceof DataLink) {
+ DataLink dataLink = (DataLink) component;
+ if (dataLink.getMergePosition() != null) {
+ List<DataLink> datalinks = scufl2Tools.datalinksTo(dataLink.getSendsTo());
+ MergeConfigurationView mergeConfigurationView = new MergeConfigurationView(
+ datalinks, editManager, selectionManager);
+ mergeConfigurationView.setLocationRelativeTo(null);
+ mergeConfigurationView.setVisible(true);
+ }
+ } else if (component instanceof InputWorkflowPort) {
+ InputWorkflowPort port = (InputWorkflowPort) component;
+ new EditDataflowInputPortAction(port.getParent(), port, null, editManager,
+ selectionManager).actionPerformed(e);
+ } else if (component instanceof OutputWorkflowPort) {
+ OutputWorkflowPort port = (OutputWorkflowPort) component;
+ new EditDataflowOutputPortAction(port.getParent(), port, null, editManager,
+ selectionManager).actionPerformed(e);
+ }
+ }
+ }
+ }
+
+ public void setEditManager(EditManager editManager) {
+ this.editManager = editManager;
+ }
+
+ public void setMenuManager(MenuManager menuManager) {
+ this.menuManager = menuManager;
+ }
+
+ public void setSelectionManager(SelectionManager selectionManager) {
+ this.selectionManager = selectionManager;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/52fd79dd/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/contextualviews/ShowDetailsContextualMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/contextualviews/ShowDetailsContextualMenuAction.java b/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/contextualviews/ShowDetailsContextualMenuAction.java
new file mode 100644
index 0000000..27a47de
--- /dev/null
+++ b/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/contextualviews/ShowDetailsContextualMenuAction.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 net.sf.taverna.t2.ui.menu.items.contextualviews;
+
+import java.awt.event.ActionEvent;
+
+import javax.swing.AbstractAction;
+import javax.swing.Action;
+
+import net.sf.taverna.t2.ui.menu.AbstractContextualMenuAction;
+import net.sf.taverna.t2.workbench.ui.Workbench;
+
+import org.apache.log4j.Logger;
+
+public class ShowDetailsContextualMenuAction extends AbstractContextualMenuAction {
+ private static final String SHOW_DETAILS = "Show details";
+ private String namedComponent = "contextualView";
+
+ private static Logger logger = Logger.getLogger(ShowDetailsContextualMenuAction.class);
+ private Workbench workbench;
+
+ public ShowDetailsContextualMenuAction() {
+ super(ConfigureSection.configureSection, 40);
+ }
+
+ @Override
+ public boolean isEnabled() {
+ return super.isEnabled();
+ // FIXME: Should we list all the applicable types here?
+ // && getContextualSelection().getSelection() instanceof Processor;
+ }
+
+ @SuppressWarnings("serial")
+ @Override
+ protected Action createAction() {
+ return new AbstractAction(SHOW_DETAILS) {
+ public void actionPerformed(ActionEvent e) {
+ workbench.makeNamedComponentVisible(namedComponent);
+ }
+ };
+ }
+
+ public void setWorkbench(Workbench workbench) {
+ this.workbench = workbench;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/52fd79dd/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/contextualviews/ShowDetailsMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/contextualviews/ShowDetailsMenuAction.java b/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/contextualviews/ShowDetailsMenuAction.java
new file mode 100644
index 0000000..ae9fee3
--- /dev/null
+++ b/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/contextualviews/ShowDetailsMenuAction.java
@@ -0,0 +1,81 @@
+/**********************************************************************
+ * Copyright (C) 2007-2009 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ **********************************************************************/
+package net.sf.taverna.t2.ui.menu.items.contextualviews;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.InputEvent;
+import java.awt.event.KeyEvent;
+import java.net.URI;
+
+import javax.swing.AbstractAction;
+import javax.swing.Action;
+import javax.swing.KeyStroke;
+
+import net.sf.taverna.t2.ui.menu.AbstractMenuAction;
+import net.sf.taverna.t2.ui.menu.DesignOnlyAction;
+import net.sf.taverna.t2.workbench.ui.Workbench;
+
+public class ShowDetailsMenuAction extends AbstractMenuAction {
+ private static final URI SHOW_DETAILS_URI = URI
+ .create("http://taverna.sf.net/2008/t2workbench/menu#graphMenuShowDetailsComponent");
+
+ private static final String SHOW_DETAILS = "Details";
+ private String namedComponent = "contextualView";
+
+ private Workbench workbench;
+
+ public ShowDetailsMenuAction() {
+ super(ShowConfigureMenuAction.GRAPH_DETAILS_MENU_SECTION, 20, SHOW_DETAILS_URI);
+ }
+
+ @Override
+ public boolean isEnabled() {
+ return super.isEnabled();
+ // FIXME: Should we list all the applicable types here?
+ // && getContextualSelection().getSelection() instanceof Processor;
+ }
+
+ @Override
+ protected Action createAction() {
+ return new ShowDetailsAction();
+ }
+
+ protected class ShowDetailsAction extends AbstractAction implements DesignOnlyAction {
+
+ ShowDetailsAction() {
+ super();
+ putValue(NAME, "Show details");
+ putValue(SHORT_DESCRIPTION, "Show details of selected component");
+ putValue(Action.ACCELERATOR_KEY,
+ KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, InputEvent.SHIFT_DOWN_MASK));
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ workbench.makeNamedComponentVisible(namedComponent);
+ }
+
+ }
+
+ public void setWorkbench(Workbench workbench) {
+ this.workbench = workbench;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/52fd79dd/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/contextualviews/ShowReportsContextualMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/contextualviews/ShowReportsContextualMenuAction.java b/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/contextualviews/ShowReportsContextualMenuAction.java
new file mode 100644
index 0000000..c9d7279
--- /dev/null
+++ b/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/contextualviews/ShowReportsContextualMenuAction.java
@@ -0,0 +1,103 @@
+/**********************************************************************
+ * Copyright (C) 2007-2009 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ **********************************************************************/
+package net.sf.taverna.t2.ui.menu.items.contextualviews;
+
+import java.awt.event.ActionEvent;
+
+import javax.swing.AbstractAction;
+import javax.swing.Action;
+import javax.swing.Icon;
+
+import net.sf.taverna.t2.lang.ui.icons.Icons;
+import net.sf.taverna.t2.ui.menu.AbstractContextualMenuAction;
+import net.sf.taverna.t2.workbench.report.ReportManager;
+import net.sf.taverna.t2.workbench.selection.SelectionManager;
+import net.sf.taverna.t2.workbench.ui.Workbench;
+
+import org.apache.log4j.Logger;
+
+import uk.org.taverna.scufl2.api.container.WorkflowBundle;
+import uk.org.taverna.scufl2.api.core.Workflow;
+import uk.org.taverna.scufl2.validation.Status;
+
+public class ShowReportsContextualMenuAction extends AbstractContextualMenuAction {
+
+ private static final String SHOW_REPORTS = "Show validation report";
+ private String namedComponent = "reportView";
+ private ReportManager reportManager;
+ private Workbench workbench;
+ private SelectionManager selectionManager;
+
+ @SuppressWarnings("unused")
+ private static Logger logger = Logger.getLogger(ShowReportsContextualMenuAction.class);
+
+ public ShowReportsContextualMenuAction() {
+ /** Right below ShowDetailsContextualMenuAction
+ */
+ super(ConfigureSection.configureSection, 41);
+ }
+
+ @Override
+ public boolean isEnabled() {
+ return super.isEnabled();
+ }
+
+ @SuppressWarnings("serial")
+ @Override
+ protected Action createAction() {
+ WorkflowBundle parent;
+ if (getContextualSelection().getParent() instanceof Workflow) {
+ parent = ((Workflow)getContextualSelection().getParent()).getParent();
+ } else {
+ parent = selectionManager.getSelectedWorkflowBundle();
+ }
+ Status status = Status.OK;
+ if (reportManager != null) {
+// status = reportManager.getStatus(parent.getMainProfile(), (WorkflowBean) getContextualSelection().getSelection());
+ }
+
+ Icon icon = null;
+ if (status == Status.WARNING) {
+ icon = Icons.warningIcon;
+ } else if (status == Status.SEVERE) {
+ icon = Icons.severeIcon;
+ }
+
+ return new AbstractAction(SHOW_REPORTS, icon) {
+ public void actionPerformed(ActionEvent e) {
+ workbench.makeNamedComponentVisible(namedComponent);
+ }
+ };
+ }
+
+ public void setSelectionManager(SelectionManager selectionManager) {
+ this.selectionManager = selectionManager;
+ }
+
+ public void setReportManager(ReportManager reportManager) {
+ this.reportManager = reportManager;
+ }
+
+ public void setWorkbench(Workbench workbench) {
+ this.workbench = workbench;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/52fd79dd/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/controllink/ConditionSection.java
----------------------------------------------------------------------
diff --git a/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/controllink/ConditionSection.java b/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/controllink/ConditionSection.java
new file mode 100644
index 0000000..3f67def
--- /dev/null
+++ b/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/controllink/ConditionSection.java
@@ -0,0 +1,71 @@
+/**********************************************************************
+ * Copyright (C) 2007-2009 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ **********************************************************************/
+package net.sf.taverna.t2.ui.menu.items.controllink;
+
+import java.net.URI;
+
+import javax.swing.Action;
+
+import uk.org.taverna.scufl2.api.core.BlockingControlLink;
+import uk.org.taverna.scufl2.api.core.ControlLink;
+
+import net.sf.taverna.t2.ui.menu.AbstractMenuSection;
+import net.sf.taverna.t2.ui.menu.ContextualMenuComponent;
+import net.sf.taverna.t2.ui.menu.ContextualSelection;
+import net.sf.taverna.t2.ui.menu.DefaultContextualMenu;
+
+public class ConditionSection extends AbstractMenuSection implements
+ ContextualMenuComponent {
+
+ private static final String CONTROL_LINK = "Control link: ";
+ public static final URI conditionSection = URI
+ .create("http://taverna.sf.net/2009/contextMenu/condition");
+ private ContextualSelection contextualSelection;
+
+ public ConditionSection() {
+ super(DefaultContextualMenu.DEFAULT_CONTEXT_MENU, 10, conditionSection);
+ }
+
+ public ContextualSelection getContextualSelection() {
+ return contextualSelection;
+ }
+
+ @Override
+ public boolean isEnabled() {
+ return super.isEnabled()
+ && getContextualSelection().getSelection() instanceof BlockingControlLink;
+ }
+
+ public void setContextualSelection(ContextualSelection contextualSelection) {
+ this.contextualSelection = contextualSelection;
+ this.action = null;
+ }
+
+ @Override
+ protected Action createAction() {
+ BlockingControlLink controllink = (BlockingControlLink) getContextualSelection()
+ .getSelection();
+ String name = CONTROL_LINK + controllink.getBlock().getName()
+ + " RUNS_AFTER " + controllink.getUntilFinished().getName();
+ return new DummyAction(name);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/52fd79dd/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/controllink/RemoveConditionMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/controllink/RemoveConditionMenuAction.java b/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/controllink/RemoveConditionMenuAction.java
new file mode 100644
index 0000000..68e32e2
--- /dev/null
+++ b/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/controllink/RemoveConditionMenuAction.java
@@ -0,0 +1,67 @@
+/**********************************************************************
+ * Copyright (C) 2007-2009 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ **********************************************************************/
+package net.sf.taverna.t2.ui.menu.items.controllink;
+
+import java.awt.Component;
+
+import javax.swing.Action;
+
+import net.sf.taverna.t2.ui.menu.AbstractContextualMenuAction;
+import net.sf.taverna.t2.workbench.design.actions.RemoveConditionAction;
+import net.sf.taverna.t2.workbench.edits.EditManager;
+import net.sf.taverna.t2.workbench.selection.SelectionManager;
+import uk.org.taverna.scufl2.api.core.ControlLink;
+import uk.org.taverna.scufl2.api.core.Workflow;
+
+public class RemoveConditionMenuAction extends AbstractContextualMenuAction {
+
+ private EditManager editManager;
+ private SelectionManager selectionManager;
+
+ public RemoveConditionMenuAction() {
+ super(ConditionSection.conditionSection, 10);
+ }
+
+ @Override
+ public boolean isEnabled() {
+ return super.isEnabled()
+ && getContextualSelection().getSelection() instanceof ControlLink
+ && getContextualSelection().getParent() instanceof Workflow;
+ }
+
+ @Override
+ protected Action createAction() {
+ Workflow dataflow = (Workflow) getContextualSelection().getParent();
+ ControlLink controlLink = (ControlLink) getContextualSelection()
+ .getSelection();
+ Component component = getContextualSelection().getRelativeToComponent();
+ return new RemoveConditionAction(dataflow, controlLink, component, editManager, selectionManager);
+ }
+
+ public void setEditManager(EditManager editManager) {
+ this.editManager = editManager;
+ }
+
+ public void setSelectionManager(SelectionManager selectionManager) {
+ this.selectionManager = selectionManager;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/52fd79dd/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/datalink/LinkSection.java
----------------------------------------------------------------------
diff --git a/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/datalink/LinkSection.java b/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/datalink/LinkSection.java
new file mode 100644
index 0000000..aee08ea
--- /dev/null
+++ b/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/datalink/LinkSection.java
@@ -0,0 +1,73 @@
+/**********************************************************************
+ * Copyright (C) 2007-2009 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ **********************************************************************/
+package net.sf.taverna.t2.ui.menu.items.datalink;
+
+import java.awt.event.ActionEvent;
+import java.net.URI;
+
+import javax.swing.AbstractAction;
+import javax.swing.Action;
+
+import uk.org.taverna.scufl2.api.core.DataLink;
+
+import net.sf.taverna.t2.ui.menu.AbstractMenuSection;
+import net.sf.taverna.t2.ui.menu.ContextualMenuComponent;
+import net.sf.taverna.t2.ui.menu.ContextualSelection;
+import net.sf.taverna.t2.ui.menu.DefaultContextualMenu;
+
+public class LinkSection extends AbstractMenuSection implements
+ ContextualMenuComponent {
+
+ public static final URI linkSection = URI
+ .create("http://taverna.sf.net/2009/contextMenu/link");
+ private ContextualSelection contextualSelection;
+
+ public LinkSection() {
+ super(DefaultContextualMenu.DEFAULT_CONTEXT_MENU, 10, linkSection);
+ }
+
+ public ContextualSelection getContextualSelection() {
+ return contextualSelection;
+ }
+
+ @Override
+ public boolean isEnabled() {
+ return super.isEnabled()
+ && getContextualSelection().getSelection() instanceof DataLink;
+ }
+
+ public void setContextualSelection(ContextualSelection contextualSelection) {
+ this.contextualSelection = contextualSelection;
+ this.action = null;
+ }
+
+ @SuppressWarnings("serial")
+ @Override
+ protected Action createAction() {
+ DataLink link = (DataLink) getContextualSelection().getSelection();
+ String name = "Data link: " + link.getReceivesFrom().getName() + " -> " + link.getSendsTo().getName();
+ return new AbstractAction(name) {
+ public void actionPerformed(ActionEvent e) {
+ }
+ };
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/52fd79dd/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/datalink/RemoveLinkMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/datalink/RemoveLinkMenuAction.java b/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/datalink/RemoveLinkMenuAction.java
new file mode 100644
index 0000000..c672f99
--- /dev/null
+++ b/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/datalink/RemoveLinkMenuAction.java
@@ -0,0 +1,66 @@
+/**********************************************************************
+ * Copyright (C) 2007-2009 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ **********************************************************************/
+package net.sf.taverna.t2.ui.menu.items.datalink;
+
+import java.awt.Component;
+
+import javax.swing.Action;
+
+import net.sf.taverna.t2.ui.menu.AbstractContextualMenuAction;
+import net.sf.taverna.t2.workbench.design.actions.RemoveDatalinkAction;
+import net.sf.taverna.t2.workbench.edits.EditManager;
+import net.sf.taverna.t2.workbench.selection.SelectionManager;
+import uk.org.taverna.scufl2.api.core.DataLink;
+import uk.org.taverna.scufl2.api.core.Workflow;
+
+public class RemoveLinkMenuAction extends AbstractContextualMenuAction {
+
+ private EditManager editManager;
+ private SelectionManager selectionManager;
+
+ public RemoveLinkMenuAction() {
+ super(LinkSection.linkSection, 10);
+ }
+
+ @Override
+ public boolean isEnabled() {
+ return super.isEnabled()
+ && getContextualSelection().getSelection() instanceof DataLink
+ && getContextualSelection().getParent() instanceof Workflow;
+ }
+
+ @Override
+ protected Action createAction() {
+ Workflow workflow = (Workflow) getContextualSelection().getParent();
+ DataLink datalink = (DataLink) getContextualSelection().getSelection();
+ Component component = getContextualSelection().getRelativeToComponent();
+ return new RemoveDatalinkAction(workflow, datalink, component, editManager, selectionManager);
+ }
+
+ public void setEditManager(EditManager editManager) {
+ this.editManager = editManager;
+ }
+
+ public void setSelectionManager(SelectionManager selectionManager) {
+ this.selectionManager = selectionManager;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/52fd79dd/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/ports/ConnectDataflowInputPortMenuActions.java
----------------------------------------------------------------------
diff --git a/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/ports/ConnectDataflowInputPortMenuActions.java b/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/ports/ConnectDataflowInputPortMenuActions.java
new file mode 100644
index 0000000..15e8424
--- /dev/null
+++ b/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/ports/ConnectDataflowInputPortMenuActions.java
@@ -0,0 +1,42 @@
+/**********************************************************************
+ * Copyright (C) 2007-2009 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ **********************************************************************/
+package net.sf.taverna.t2.ui.menu.items.ports;
+
+import uk.org.taverna.scufl2.api.core.Workflow;
+import uk.org.taverna.scufl2.api.port.InputWorkflowPort;
+import net.sf.taverna.t2.ui.menu.ContextualMenuComponent;
+import net.sf.taverna.t2.ui.menu.items.activityport.AbstractConnectPortMenuActions;
+
+public class ConnectDataflowInputPortMenuActions extends
+ AbstractConnectPortMenuActions implements ContextualMenuComponent {
+
+ public ConnectDataflowInputPortMenuActions() {
+ super(WorkflowInputPortSection.inputPort, 20);
+ }
+
+ @Override
+ public boolean isEnabled() {
+ return super.isEnabled()
+ && getContextualSelection().getSelection() instanceof InputWorkflowPort
+ && getContextualSelection().getParent() instanceof Workflow;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/52fd79dd/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/ports/ConnectDataflowOutputPortMenuActions.java
----------------------------------------------------------------------
diff --git a/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/ports/ConnectDataflowOutputPortMenuActions.java b/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/ports/ConnectDataflowOutputPortMenuActions.java
new file mode 100644
index 0000000..d99a361
--- /dev/null
+++ b/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/ports/ConnectDataflowOutputPortMenuActions.java
@@ -0,0 +1,42 @@
+/**********************************************************************
+ * Copyright (C) 2007-2009 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ **********************************************************************/
+package net.sf.taverna.t2.ui.menu.items.ports;
+
+import uk.org.taverna.scufl2.api.core.Workflow;
+import uk.org.taverna.scufl2.api.port.OutputWorkflowPort;
+import net.sf.taverna.t2.ui.menu.ContextualMenuComponent;
+import net.sf.taverna.t2.ui.menu.items.activityport.AbstractConnectPortMenuActions;
+
+public class ConnectDataflowOutputPortMenuActions extends
+ AbstractConnectPortMenuActions implements ContextualMenuComponent {
+
+ public ConnectDataflowOutputPortMenuActions() {
+ super(WorkflowOutputPortSection.outputPort, 20);
+ }
+
+ @Override
+ public boolean isEnabled() {
+ return super.isEnabled()
+ && getContextualSelection().getSelection() instanceof OutputWorkflowPort
+ && getContextualSelection().getParent() instanceof Workflow;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/52fd79dd/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/ports/EditDataflowInputPortMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/ports/EditDataflowInputPortMenuAction.java b/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/ports/EditDataflowInputPortMenuAction.java
new file mode 100644
index 0000000..77c25f5
--- /dev/null
+++ b/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/ports/EditDataflowInputPortMenuAction.java
@@ -0,0 +1,68 @@
+/**********************************************************************
+ * Copyright (C) 2007-2009 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ **********************************************************************/
+package net.sf.taverna.t2.ui.menu.items.ports;
+
+import java.awt.Component;
+
+import javax.swing.Action;
+
+import net.sf.taverna.t2.ui.menu.AbstractContextualMenuAction;
+import net.sf.taverna.t2.workbench.design.actions.EditDataflowInputPortAction;
+import net.sf.taverna.t2.workbench.edits.EditManager;
+import net.sf.taverna.t2.workbench.selection.SelectionManager;
+import uk.org.taverna.scufl2.api.core.Workflow;
+import uk.org.taverna.scufl2.api.port.InputWorkflowPort;
+
+public class EditDataflowInputPortMenuAction extends
+ AbstractContextualMenuAction {
+
+ private EditManager editManager;
+ private SelectionManager selectionManager;
+
+ public EditDataflowInputPortMenuAction() {
+ super(WorkflowInputPortSection.inputPort, 10);
+ }
+
+ @Override
+ public boolean isEnabled() {
+ return super.isEnabled()
+ && getContextualSelection().getSelection() instanceof InputWorkflowPort
+ && getContextualSelection().getParent() instanceof Workflow;
+ }
+
+ @Override
+ protected Action createAction() {
+ Workflow workflow = (Workflow) getContextualSelection().getParent();
+ InputWorkflowPort inport = (InputWorkflowPort) getContextualSelection()
+ .getSelection();
+ Component component = getContextualSelection().getRelativeToComponent();
+ return new EditDataflowInputPortAction(workflow, inport, component, editManager, selectionManager);
+ }
+
+ public void setEditManager(EditManager editManager) {
+ this.editManager = editManager;
+ }
+
+ public void setSelectionManager(SelectionManager selectionManager) {
+ this.selectionManager = selectionManager;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/52fd79dd/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/ports/EditDataflowOutputPortMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/ports/EditDataflowOutputPortMenuAction.java b/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/ports/EditDataflowOutputPortMenuAction.java
new file mode 100644
index 0000000..0f406dd
--- /dev/null
+++ b/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/ports/EditDataflowOutputPortMenuAction.java
@@ -0,0 +1,68 @@
+/**********************************************************************
+ * Copyright (C) 2007-2009 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ **********************************************************************/
+package net.sf.taverna.t2.ui.menu.items.ports;
+
+import java.awt.Component;
+
+import javax.swing.Action;
+
+import net.sf.taverna.t2.ui.menu.AbstractContextualMenuAction;
+import net.sf.taverna.t2.workbench.design.actions.EditDataflowOutputPortAction;
+import net.sf.taverna.t2.workbench.edits.EditManager;
+import net.sf.taverna.t2.workbench.selection.SelectionManager;
+import uk.org.taverna.scufl2.api.core.Workflow;
+import uk.org.taverna.scufl2.api.port.OutputWorkflowPort;
+
+public class EditDataflowOutputPortMenuAction extends
+ AbstractContextualMenuAction {
+
+ private EditManager editManager;
+ private SelectionManager selectionManager;
+
+ public EditDataflowOutputPortMenuAction() {
+ super(WorkflowOutputPortSection.outputPort, 10);
+ }
+
+ @Override
+ public boolean isEnabled() {
+ return super.isEnabled()
+ && getContextualSelection().getSelection() instanceof OutputWorkflowPort
+ && getContextualSelection().getParent() instanceof Workflow;
+ }
+
+ @Override
+ protected Action createAction() {
+ Workflow workflow = (Workflow) getContextualSelection().getParent();
+ OutputWorkflowPort outport = (OutputWorkflowPort) getContextualSelection()
+ .getSelection();
+ Component component = getContextualSelection().getRelativeToComponent();
+ return new EditDataflowOutputPortAction(workflow, outport, component, editManager, selectionManager);
+ }
+
+ public void setEditManager(EditManager editManager) {
+ this.editManager = editManager;
+ }
+
+ public void setSelectionManager(SelectionManager selectionManager) {
+ this.selectionManager = selectionManager;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/52fd79dd/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/ports/RemoveDataflowInputPortMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/ports/RemoveDataflowInputPortMenuAction.java b/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/ports/RemoveDataflowInputPortMenuAction.java
new file mode 100644
index 0000000..f5e2fc1
--- /dev/null
+++ b/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/ports/RemoveDataflowInputPortMenuAction.java
@@ -0,0 +1,68 @@
+/**********************************************************************
+ * Copyright (C) 2007-2009 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ **********************************************************************/
+package net.sf.taverna.t2.ui.menu.items.ports;
+
+import java.awt.Component;
+
+import javax.swing.Action;
+
+import net.sf.taverna.t2.ui.menu.AbstractContextualMenuAction;
+import net.sf.taverna.t2.workbench.design.actions.RemoveDataflowInputPortAction;
+import net.sf.taverna.t2.workbench.edits.EditManager;
+import net.sf.taverna.t2.workbench.selection.SelectionManager;
+import uk.org.taverna.scufl2.api.core.Workflow;
+import uk.org.taverna.scufl2.api.port.InputWorkflowPort;
+
+public class RemoveDataflowInputPortMenuAction extends
+ AbstractContextualMenuAction {
+
+ private EditManager editManager;
+ private SelectionManager selectionManager;
+
+ public RemoveDataflowInputPortMenuAction() {
+ super(WorkflowInputPortSection.inputPort, 10);
+ }
+
+ @Override
+ public boolean isEnabled() {
+ return super.isEnabled()
+ && getContextualSelection().getSelection() instanceof InputWorkflowPort
+ && getContextualSelection().getParent() instanceof Workflow;
+ }
+
+ @Override
+ protected Action createAction() {
+ Workflow workflow = (Workflow) getContextualSelection().getParent();
+ InputWorkflowPort inport = (InputWorkflowPort) getContextualSelection()
+ .getSelection();
+ Component component = getContextualSelection().getRelativeToComponent();
+ return new RemoveDataflowInputPortAction(workflow, inport, component, editManager, selectionManager);
+ }
+
+ public void setEditManager(EditManager editManager) {
+ this.editManager = editManager;
+ }
+
+ public void setSelectionManager(SelectionManager selectionManager) {
+ this.selectionManager = selectionManager;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/52fd79dd/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/ports/RemoveDataflowOutputPortMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/ports/RemoveDataflowOutputPortMenuAction.java b/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/ports/RemoveDataflowOutputPortMenuAction.java
new file mode 100644
index 0000000..da775a5
--- /dev/null
+++ b/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/ports/RemoveDataflowOutputPortMenuAction.java
@@ -0,0 +1,68 @@
+/**********************************************************************
+ * Copyright (C) 2007-2009 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ **********************************************************************/
+package net.sf.taverna.t2.ui.menu.items.ports;
+
+import java.awt.Component;
+
+import javax.swing.Action;
+
+import net.sf.taverna.t2.ui.menu.AbstractContextualMenuAction;
+import net.sf.taverna.t2.workbench.design.actions.RemoveDataflowOutputPortAction;
+import net.sf.taverna.t2.workbench.edits.EditManager;
+import net.sf.taverna.t2.workbench.selection.SelectionManager;
+import uk.org.taverna.scufl2.api.core.Workflow;
+import uk.org.taverna.scufl2.api.port.OutputWorkflowPort;
+
+public class RemoveDataflowOutputPortMenuAction extends
+ AbstractContextualMenuAction {
+
+ private EditManager editManager;
+ private SelectionManager selectionManager;
+
+ public RemoveDataflowOutputPortMenuAction() {
+ super(WorkflowOutputPortSection.outputPort, 10);
+ }
+
+ @Override
+ public boolean isEnabled() {
+ return super.isEnabled()
+ && getContextualSelection().getSelection() instanceof OutputWorkflowPort
+ && getContextualSelection().getParent() instanceof Workflow;
+ }
+
+ @Override
+ protected Action createAction() {
+ Workflow workflow = (Workflow) getContextualSelection().getParent();
+ OutputWorkflowPort outport = (OutputWorkflowPort) getContextualSelection()
+ .getSelection();
+ Component component = getContextualSelection().getRelativeToComponent();
+ return new RemoveDataflowOutputPortAction(workflow, outport, component, editManager, selectionManager);
+ }
+
+ public void setEditManager(EditManager editManager) {
+ this.editManager = editManager;
+ }
+
+ public void setSelectionManager(SelectionManager selectionManager) {
+ this.selectionManager = selectionManager;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/52fd79dd/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/ports/WorkflowInputPortSection.java
----------------------------------------------------------------------
diff --git a/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/ports/WorkflowInputPortSection.java b/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/ports/WorkflowInputPortSection.java
new file mode 100644
index 0000000..1a0d8ef
--- /dev/null
+++ b/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/ports/WorkflowInputPortSection.java
@@ -0,0 +1,73 @@
+/**********************************************************************
+ * Copyright (C) 2007-2009 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ **********************************************************************/
+package net.sf.taverna.t2.ui.menu.items.ports;
+
+import java.awt.event.ActionEvent;
+import java.net.URI;
+
+import javax.swing.AbstractAction;
+import javax.swing.Action;
+
+import uk.org.taverna.scufl2.api.port.InputWorkflowPort;
+
+import net.sf.taverna.t2.ui.menu.AbstractMenuSection;
+import net.sf.taverna.t2.ui.menu.ContextualMenuComponent;
+import net.sf.taverna.t2.ui.menu.ContextualSelection;
+import net.sf.taverna.t2.ui.menu.DefaultContextualMenu;
+
+public class WorkflowInputPortSection extends AbstractMenuSection implements
+ ContextualMenuComponent {
+
+ public static final URI inputPort = URI
+ .create("http://taverna.sf.net/2009/contextMenu/inputPort");
+ private ContextualSelection contextualSelection;
+
+ public WorkflowInputPortSection() {
+ super(DefaultContextualMenu.DEFAULT_CONTEXT_MENU, 10, inputPort);
+ }
+
+ public ContextualSelection getContextualSelection() {
+ return contextualSelection;
+ }
+
+ @Override
+ public boolean isEnabled() {
+ return super.isEnabled()
+ && getContextualSelection().getSelection() instanceof InputWorkflowPort;
+ }
+
+ public void setContextualSelection(ContextualSelection contextualSelection) {
+ this.contextualSelection = contextualSelection;
+ this.action = null;
+ }
+
+ @SuppressWarnings("serial")
+ @Override
+ protected Action createAction() {
+ InputWorkflowPort proc = (InputWorkflowPort) getContextualSelection().getSelection();
+ String name = "Workflow input port: " + proc.getName();
+ return new AbstractAction(name) {
+ public void actionPerformed(ActionEvent e) {
+ }
+ };
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/52fd79dd/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/ports/WorkflowOutputPortSection.java
----------------------------------------------------------------------
diff --git a/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/ports/WorkflowOutputPortSection.java b/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/ports/WorkflowOutputPortSection.java
new file mode 100644
index 0000000..e387f9e
--- /dev/null
+++ b/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/ports/WorkflowOutputPortSection.java
@@ -0,0 +1,73 @@
+/**********************************************************************
+ * Copyright (C) 2007-2009 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ **********************************************************************/
+package net.sf.taverna.t2.ui.menu.items.ports;
+
+import java.awt.event.ActionEvent;
+import java.net.URI;
+
+import javax.swing.AbstractAction;
+import javax.swing.Action;
+
+import uk.org.taverna.scufl2.api.port.OutputWorkflowPort;
+
+import net.sf.taverna.t2.ui.menu.AbstractMenuSection;
+import net.sf.taverna.t2.ui.menu.ContextualMenuComponent;
+import net.sf.taverna.t2.ui.menu.ContextualSelection;
+import net.sf.taverna.t2.ui.menu.DefaultContextualMenu;
+
+public class WorkflowOutputPortSection extends AbstractMenuSection implements
+ ContextualMenuComponent {
+
+ public static final URI outputPort = URI
+ .create("http://taverna.sf.net/2009/contextMenu/outputPort");
+ private ContextualSelection contextualSelection;
+
+ public WorkflowOutputPortSection() {
+ super(DefaultContextualMenu.DEFAULT_CONTEXT_MENU, 10, outputPort);
+ }
+
+ public ContextualSelection getContextualSelection() {
+ return contextualSelection;
+ }
+
+ @Override
+ public boolean isEnabled() {
+ return super.isEnabled()
+ && getContextualSelection().getSelection() instanceof OutputWorkflowPort;
+ }
+
+ public void setContextualSelection(ContextualSelection contextualSelection) {
+ this.contextualSelection = contextualSelection;
+ this.action = null;
+ }
+
+ @SuppressWarnings("serial")
+ @Override
+ protected Action createAction() {
+ OutputWorkflowPort proc = (OutputWorkflowPort) getContextualSelection().getSelection();
+ String name = "Workflow output port: " + proc.getName();
+ return new AbstractAction(name) {
+ public void actionPerformed(ActionEvent e) {
+ }
+ };
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/52fd79dd/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/processor/ConditionMenuActions.java
----------------------------------------------------------------------
diff --git a/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/processor/ConditionMenuActions.java b/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/processor/ConditionMenuActions.java
new file mode 100644
index 0000000..a3e569b
--- /dev/null
+++ b/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/processor/ConditionMenuActions.java
@@ -0,0 +1,118 @@
+/**********************************************************************
+ * Copyright (C) 2007-2009 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ **********************************************************************/
+package net.sf.taverna.t2.ui.menu.items.processor;
+
+import java.awt.Component;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.swing.JMenu;
+import javax.swing.JMenuItem;
+
+import net.sf.taverna.t2.lang.ui.ShadedLabel;
+import net.sf.taverna.t2.ui.menu.AbstractMenuCustom;
+import net.sf.taverna.t2.ui.menu.ContextualMenuComponent;
+import net.sf.taverna.t2.ui.menu.ContextualSelection;
+import net.sf.taverna.t2.ui.menu.items.contextualviews.ConfigureSection;
+import net.sf.taverna.t2.workbench.activityicons.ActivityIconManager;
+import net.sf.taverna.t2.workbench.design.actions.AddConditionAction;
+import net.sf.taverna.t2.workbench.edits.EditManager;
+import net.sf.taverna.t2.workbench.icons.WorkbenchIcons;
+import net.sf.taverna.t2.workbench.selection.SelectionManager;
+import uk.org.taverna.scufl2.api.common.Scufl2Tools;
+import uk.org.taverna.scufl2.api.core.Processor;
+import uk.org.taverna.scufl2.api.core.Workflow;
+
+public class ConditionMenuActions extends AbstractMenuCustom implements
+ ContextualMenuComponent {
+
+ private ContextualSelection contextualSelection;
+ private EditManager editManager;
+ private SelectionManager selectionManager;
+ private ActivityIconManager activityIconManager;
+ private Scufl2Tools scufl2Tools = new Scufl2Tools();
+
+ public ConditionMenuActions() {
+ super(ConfigureSection.configureSection, 80 );
+ }
+
+ public ContextualSelection getContextualSelection() {
+ return contextualSelection;
+ }
+
+ @Override
+ public boolean isEnabled() {
+ return super.isEnabled()
+ && getContextualSelection().getSelection() instanceof Processor
+ && getContextualSelection().getParent() instanceof Workflow;
+ }
+
+ public void setContextualSelection(ContextualSelection contextualSelection) {
+ this.contextualSelection = contextualSelection;
+ this.customComponent = null;
+ }
+
+ @Override
+ protected Component createCustomComponent() {
+
+ Workflow workflow = (Workflow) getContextualSelection().getParent();
+ Processor processor = (Processor) getContextualSelection()
+ .getSelection();
+ Component component = getContextualSelection().getRelativeToComponent();
+
+ List<AddConditionAction> conditions = getAddConditionActions(workflow,
+ processor, component);
+ if (conditions.isEmpty()) {
+ return null;
+ }
+ JMenu conditionMenu = new JMenu("Run after");
+ conditionMenu.setIcon(WorkbenchIcons.controlLinkIcon);
+ conditionMenu.add(new ShadedLabel("Services:", ShadedLabel.ORANGE));
+ conditionMenu.addSeparator();
+ for (AddConditionAction addConditionAction : conditions) {
+ conditionMenu.add(new JMenuItem(addConditionAction));
+ }
+ return conditionMenu;
+ }
+
+ protected List<AddConditionAction> getAddConditionActions(
+ Workflow workflow, Processor targetProcessor, Component component) {
+ List<AddConditionAction> actions = new ArrayList<AddConditionAction>();
+ for (Processor processor : scufl2Tools.possibleUpStreamProcessors(workflow, targetProcessor)) {
+ actions.add(new AddConditionAction(workflow, processor,
+ targetProcessor, component, editManager, selectionManager, activityIconManager));
+ }
+ return actions;
+ }
+
+ public void setEditManager(EditManager editManager) {
+ this.editManager = editManager;
+ }
+
+ public void setSelectionManager(SelectionManager selectionManager) {
+ this.selectionManager = selectionManager;
+ }
+
+ public void setActivityIconManager(ActivityIconManager activityIconManager) {
+ this.activityIconManager = activityIconManager;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/52fd79dd/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/processor/ProcessorSection.java
----------------------------------------------------------------------
diff --git a/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/processor/ProcessorSection.java b/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/processor/ProcessorSection.java
new file mode 100644
index 0000000..b2bde61
--- /dev/null
+++ b/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/processor/ProcessorSection.java
@@ -0,0 +1,58 @@
+/**********************************************************************
+ * Copyright (C) 2007-2009 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ **********************************************************************/
+package net.sf.taverna.t2.ui.menu.items.processor;
+
+import java.net.URI;
+
+import uk.org.taverna.scufl2.api.core.Processor;
+
+import net.sf.taverna.t2.ui.menu.AbstractMenuSection;
+import net.sf.taverna.t2.ui.menu.ContextualMenuComponent;
+import net.sf.taverna.t2.ui.menu.ContextualSelection;
+import net.sf.taverna.t2.ui.menu.items.contextualviews.EditSection;
+
+public class ProcessorSection extends AbstractMenuSection implements
+ ContextualMenuComponent {
+
+ public static final URI processorSection = URI
+ .create("http://taverna.sf.net/2009/contextMenu/processor");
+ private ContextualSelection contextualSelection;
+
+ public ProcessorSection() {
+ super(EditSection.editSection, 200, processorSection);
+ }
+
+ public ContextualSelection getContextualSelection() {
+ return contextualSelection;
+ }
+
+ @Override
+ public boolean isEnabled() {
+ return super.isEnabled()
+ && getContextualSelection().getSelection() instanceof Processor;
+ }
+
+ public void setContextualSelection(ContextualSelection contextualSelection) {
+ this.contextualSelection = contextualSelection;
+ this.action = null;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/52fd79dd/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/processor/RemoveProcessorMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/processor/RemoveProcessorMenuAction.java b/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/processor/RemoveProcessorMenuAction.java
new file mode 100644
index 0000000..e9c8fb4
--- /dev/null
+++ b/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/processor/RemoveProcessorMenuAction.java
@@ -0,0 +1,67 @@
+/**********************************************************************
+ * Copyright (C) 2007-2009 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ **********************************************************************/
+package net.sf.taverna.t2.ui.menu.items.processor;
+
+import java.awt.Component;
+
+import javax.swing.Action;
+
+import net.sf.taverna.t2.ui.menu.AbstractContextualMenuAction;
+import net.sf.taverna.t2.workbench.design.actions.RemoveProcessorAction;
+import net.sf.taverna.t2.workbench.edits.EditManager;
+import net.sf.taverna.t2.workbench.selection.SelectionManager;
+import uk.org.taverna.scufl2.api.core.Processor;
+import uk.org.taverna.scufl2.api.core.Workflow;
+
+public class RemoveProcessorMenuAction extends AbstractContextualMenuAction {
+
+ private EditManager editManager;
+ private SelectionManager selectionManager;
+
+ public RemoveProcessorMenuAction() {
+ super(ProcessorSection.processorSection, 100);
+ }
+
+ @Override
+ public boolean isEnabled() {
+ return super.isEnabled()
+ && getContextualSelection().getSelection() instanceof Processor
+ && getContextualSelection().getParent() instanceof Workflow;
+ }
+
+ @Override
+ protected Action createAction() {
+ Workflow workflow = (Workflow) getContextualSelection().getParent();
+ Processor processor = (Processor) getContextualSelection()
+ .getSelection();
+ Component component = getContextualSelection().getRelativeToComponent();
+ return new RemoveProcessorAction(workflow, processor, component, editManager, selectionManager);
+ }
+
+ public void setEditManager(EditManager editManager) {
+ this.editManager = editManager;
+ }
+
+ public void setSelectionManager(SelectionManager selectionManager) {
+ this.selectionManager = selectionManager;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/52fd79dd/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/processor/RenameProcessorMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/processor/RenameProcessorMenuAction.java b/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/processor/RenameProcessorMenuAction.java
new file mode 100644
index 0000000..a077726
--- /dev/null
+++ b/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/processor/RenameProcessorMenuAction.java
@@ -0,0 +1,68 @@
+/**********************************************************************
+ * Copyright (C) 2007-2009 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ **********************************************************************/
+package net.sf.taverna.t2.ui.menu.items.processor;
+
+import java.awt.Component;
+
+import javax.swing.Action;
+
+import net.sf.taverna.t2.ui.menu.AbstractContextualMenuAction;
+import net.sf.taverna.t2.ui.menu.items.contextualviews.ConfigureSection;
+import net.sf.taverna.t2.workbench.design.actions.RenameProcessorAction;
+import net.sf.taverna.t2.workbench.edits.EditManager;
+import net.sf.taverna.t2.workbench.selection.SelectionManager;
+import uk.org.taverna.scufl2.api.core.Processor;
+import uk.org.taverna.scufl2.api.core.Workflow;
+
+public class RenameProcessorMenuAction extends AbstractContextualMenuAction {
+
+ private EditManager editManager;
+ private SelectionManager selectionManager;
+
+ public RenameProcessorMenuAction() {
+ super(ConfigureSection.configureSection, 60);
+ }
+
+ @Override
+ public boolean isEnabled() {
+ return super.isEnabled()
+ && getContextualSelection().getSelection() instanceof Processor
+ && getContextualSelection().getParent() instanceof Workflow;
+ }
+
+ @Override
+ protected Action createAction() {
+ Workflow workflow = (Workflow) getContextualSelection().getParent();
+ Processor processor = (Processor) getContextualSelection()
+ .getSelection();
+ Component component = getContextualSelection().getRelativeToComponent();
+ return new RenameProcessorAction(workflow, processor, component, editManager, selectionManager);
+ }
+
+ public void setEditManager(EditManager editManager) {
+ this.editManager = editManager;
+ }
+
+ public void setSelectionManager(SelectionManager selectionManager) {
+ this.selectionManager = selectionManager;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/52fd79dd/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/workflow/CreateInputMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/workflow/CreateInputMenuAction.java b/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/workflow/CreateInputMenuAction.java
new file mode 100644
index 0000000..6a3b880
--- /dev/null
+++ b/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/workflow/CreateInputMenuAction.java
@@ -0,0 +1,62 @@
+/**********************************************************************
+ * Copyright (C) 2007-2009 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ **********************************************************************/
+package net.sf.taverna.t2.ui.menu.items.workflow;
+
+import javax.swing.Action;
+
+import net.sf.taverna.t2.ui.menu.AbstractContextualMenuAction;
+import net.sf.taverna.t2.ui.menu.items.contextualviews.InsertSection;
+import net.sf.taverna.t2.workbench.design.actions.AddDataflowInputAction;
+import net.sf.taverna.t2.workbench.edits.EditManager;
+import net.sf.taverna.t2.workbench.selection.SelectionManager;
+import uk.org.taverna.scufl2.api.core.Workflow;
+
+public class CreateInputMenuAction extends AbstractContextualMenuAction {
+
+ private EditManager editManager;
+ private SelectionManager selectionManager;
+
+ public CreateInputMenuAction() {
+ super(InsertSection.insertSection, 10);
+ }
+
+ @Override
+ public boolean isEnabled() {
+ return super.isEnabled()
+ && getContextualSelection().getSelection() instanceof Workflow;
+ }
+
+ @Override
+ protected Action createAction() {
+ return new AddDataflowInputAction((Workflow) getContextualSelection()
+ .getSelection(), getContextualSelection()
+ .getRelativeToComponent(), editManager, selectionManager);
+ }
+
+ public void setEditManager(EditManager editManager) {
+ this.editManager = editManager;
+ }
+
+ public void setSelectionManager(SelectionManager selectionManager) {
+ this.selectionManager = selectionManager;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/52fd79dd/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/workflow/CreateOutputMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/workflow/CreateOutputMenuAction.java b/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/workflow/CreateOutputMenuAction.java
new file mode 100644
index 0000000..226258c
--- /dev/null
+++ b/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/workflow/CreateOutputMenuAction.java
@@ -0,0 +1,62 @@
+/**********************************************************************
+ * Copyright (C) 2007-2009 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ **********************************************************************/
+package net.sf.taverna.t2.ui.menu.items.workflow;
+
+import javax.swing.Action;
+
+import net.sf.taverna.t2.ui.menu.AbstractContextualMenuAction;
+import net.sf.taverna.t2.ui.menu.items.contextualviews.InsertSection;
+import net.sf.taverna.t2.workbench.design.actions.AddDataflowOutputAction;
+import net.sf.taverna.t2.workbench.edits.EditManager;
+import net.sf.taverna.t2.workbench.selection.SelectionManager;
+import uk.org.taverna.scufl2.api.core.Workflow;
+
+public class CreateOutputMenuAction extends AbstractContextualMenuAction {
+
+ private EditManager editManager;
+ private SelectionManager selectionManager;
+
+ public CreateOutputMenuAction() {
+ super(InsertSection.insertSection, 20);
+ }
+
+ @Override
+ public boolean isEnabled() {
+ return super.isEnabled()
+ && getContextualSelection().getSelection() instanceof Workflow;
+ }
+
+ @Override
+ protected Action createAction() {
+ return new AddDataflowOutputAction((Workflow) getContextualSelection()
+ .getSelection(), getContextualSelection()
+ .getRelativeToComponent(), editManager, selectionManager);
+ }
+
+ public void setEditManager(EditManager editManager) {
+ this.editManager = editManager;
+ }
+
+ public void setSelectionManager(SelectionManager selectionManager) {
+ this.selectionManager = selectionManager;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/52fd79dd/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/workflow/WorkflowServiceTemplatesSection.java
----------------------------------------------------------------------
diff --git a/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/workflow/WorkflowServiceTemplatesSection.java b/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/workflow/WorkflowServiceTemplatesSection.java
new file mode 100644
index 0000000..d461b5e
--- /dev/null
+++ b/taverna-menu-items/src/main/java/net/sf/taverna/t2/ui/menu/items/workflow/WorkflowServiceTemplatesSection.java
@@ -0,0 +1,76 @@
+/**********************************************************************
+ * Copyright (C) 2007-2009 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ **********************************************************************/
+package net.sf.taverna.t2.ui.menu.items.workflow;
+
+import java.net.URI;
+
+import javax.swing.Action;
+
+import uk.org.taverna.scufl2.api.core.Workflow;
+
+import net.sf.taverna.t2.lang.ui.ShadedLabel;
+import net.sf.taverna.t2.ui.menu.AbstractMenuSection;
+import net.sf.taverna.t2.ui.menu.ContextualMenuComponent;
+import net.sf.taverna.t2.ui.menu.ContextualSelection;
+import net.sf.taverna.t2.ui.menu.DefaultContextualMenu;
+
+/**
+ * Menu section containing the actions to add service templates, i.e. activities
+ * than are not readily runnable but need to be configured first. The actual actions that
+ * go into this menu can be found in the ui modules for the activities.
+ *
+ * @author Alex Nenadic
+ *
+ */
+public class WorkflowServiceTemplatesSection extends AbstractMenuSection
+ implements ContextualMenuComponent {
+
+ private static final String SERVICE_TEMPLATES = "Service templates";
+ public static final URI serviceTemplatesSection = URI
+ .create("http://taverna.sf.net/2009/contextMenu/serviceTemplates");
+ private ContextualSelection contextualSelection;
+
+ public WorkflowServiceTemplatesSection() {
+ super(DefaultContextualMenu.DEFAULT_CONTEXT_MENU, 30, serviceTemplatesSection);
+ }
+
+ public ContextualSelection getContextualSelection() {
+ return contextualSelection;
+ }
+
+ @Override
+ public boolean isEnabled() {
+ return super.isEnabled()
+ && getContextualSelection().getSelection() instanceof Workflow;
+ }
+
+ public void setContextualSelection(ContextualSelection contextualSelection) {
+ this.contextualSelection = contextualSelection;
+ }
+
+ @Override
+ protected Action createAction() {
+ DummyAction action = new DummyAction(SERVICE_TEMPLATES);
+ // Set the colour for the section
+ action.putValue(AbstractMenuSection.SECTION_COLOR, ShadedLabel.ORANGE);
+ return action;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/52fd79dd/taverna-menu-items/src/main/resources/META-INF/services/net.sf.taverna.t2.ui.menu.MenuComponent
----------------------------------------------------------------------
diff --git a/taverna-menu-items/src/main/resources/META-INF/services/net.sf.taverna.t2.ui.menu.MenuComponent b/taverna-menu-items/src/main/resources/META-INF/services/net.sf.taverna.t2.ui.menu.MenuComponent
new file mode 100644
index 0000000..47f3e0e
--- /dev/null
+++ b/taverna-menu-items/src/main/resources/META-INF/services/net.sf.taverna.t2.ui.menu.MenuComponent
@@ -0,0 +1,46 @@
+net.sf.taverna.t2.ui.menu.items.activityport.ActivityInputPortSection
+net.sf.taverna.t2.ui.menu.items.activityport.SetConstantInputPortValueMenuAction
+net.sf.taverna.t2.ui.menu.items.activityport.ConnectInputPortMenuActions
+
+net.sf.taverna.t2.ui.menu.items.activityport.ActivityOutputPortSection
+net.sf.taverna.t2.ui.menu.items.activityport.ConnectOutputPortMenuActions
+
+net.sf.taverna.t2.ui.menu.items.controllink.ConditionSection
+net.sf.taverna.t2.ui.menu.items.controllink.RemoveConditionMenuAction
+
+net.sf.taverna.t2.ui.menu.items.contextualviews.ConfigureRunningContextualMenuSection
+net.sf.taverna.t2.ui.menu.items.contextualviews.ShowDetailsMenuAction
+net.sf.taverna.t2.ui.menu.items.contextualviews.ShowDetailsContextualMenuAction
+net.sf.taverna.t2.ui.menu.items.contextualviews.ShowConfigureMenuAction
+net.sf.taverna.t2.ui.menu.items.contextualviews.ShowReportsContextualMenuAction
+
+net.sf.taverna.t2.ui.menu.items.workflow.CreateInputMenuAction
+net.sf.taverna.t2.ui.menu.items.workflow.CreateOutputMenuAction
+net.sf.taverna.t2.ui.menu.items.contextualviews.InsertSection
+net.sf.taverna.t2.ui.menu.items.workflow.WorkflowServiceTemplatesSection
+net.sf.taverna.t2.ui.menu.items.contextualviews.EditSection
+net.sf.taverna.t2.ui.menu.items.contextualviews.ConfigureSection
+net.sf.taverna.t2.ui.menu.items.contextualviews.PasteMenuAction
+
+net.sf.taverna.t2.ui.menu.items.datalink.LinkSection
+net.sf.taverna.t2.ui.menu.items.datalink.RemoveLinkMenuAction
+
+net.sf.taverna.t2.ui.menu.items.merge.MergeSection
+net.sf.taverna.t2.ui.menu.items.merge.RemoveMergeMenuAction
+
+net.sf.taverna.t2.ui.menu.items.ports.ConnectDataflowInputPortMenuActions
+net.sf.taverna.t2.ui.menu.items.ports.ConnectDataflowOutputPortMenuActions
+net.sf.taverna.t2.ui.menu.items.ports.EditDataflowInputPortMenuAction
+net.sf.taverna.t2.ui.menu.items.ports.EditDataflowOutputPortMenuAction
+net.sf.taverna.t2.ui.menu.items.ports.RemoveDataflowInputPortMenuAction
+net.sf.taverna.t2.ui.menu.items.ports.RemoveDataflowOutputPortMenuAction
+net.sf.taverna.t2.ui.menu.items.ports.WorkflowInputPortSection
+net.sf.taverna.t2.ui.menu.items.ports.WorkflowOutputPortSection
+
+net.sf.taverna.t2.ui.menu.items.processor.ConditionMenuActions
+net.sf.taverna.t2.ui.menu.items.processor.ProcessorSection
+net.sf.taverna.t2.ui.menu.items.processor.RenameProcessorMenuAction
+net.sf.taverna.t2.ui.menu.items.processor.RemoveProcessorMenuAction
+
+net.sf.taverna.t2.ui.menu.items.annotated.AnnotatedConfigureMenuAction
+
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/52fd79dd/taverna-menu-items/src/main/resources/META-INF/spring/menu-items-context-osgi.xml
----------------------------------------------------------------------
diff --git a/taverna-menu-items/src/main/resources/META-INF/spring/menu-items-context-osgi.xml b/taverna-menu-items/src/main/resources/META-INF/spring/menu-items-context-osgi.xml
new file mode 100644
index 0000000..b7ba9e4
--- /dev/null
+++ b/taverna-menu-items/src/main/resources/META-INF/spring/menu-items-context-osgi.xml
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans:beans xmlns="http://www.springframework.org/schema/osgi" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:beans="http://www.springframework.org/schema/beans"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans
+ http://www.springframework.org/schema/beans/spring-beans.xsd
+ http://www.springframework.org/schema/osgi
+ http://www.springframework.org/schema/osgi/spring-osgi.xsd">
+
+ <service ref="ActivityInputPortSection" auto-export="interfaces" />
+ <service ref="ActivityOutputPortSection" auto-export="interfaces" />
+ <service ref="AnnotatedConfigureMenuAction" auto-export="interfaces" />
+ <service ref="ConditionMenuActions" auto-export="interfaces" />
+ <service ref="ConditionSection" auto-export="interfaces" />
+ <service ref="ConfigureRunningContextualMenuSection" auto-export="interfaces" />
+ <service ref="ConfigureSection" auto-export="interfaces" />
+ <service ref="ConnectDataflowInputPortMenuActions" auto-export="interfaces" />
+ <service ref="ConnectDataflowOutputPortMenuActions" auto-export="interfaces" />
+ <service ref="ConnectInputPortMenuActions" auto-export="interfaces" />
+ <service ref="ConnectOutputPortMenuActions" auto-export="interfaces" />
+ <service ref="CreateInputMenuAction" auto-export="interfaces" />
+ <service ref="CreateOutputMenuAction" auto-export="interfaces" />
+ <service ref="EditDataflowInputPortMenuAction" auto-export="interfaces" />
+ <service ref="EditDataflowOutputPortMenuAction" auto-export="interfaces" />
+ <service ref="EditSection" auto-export="interfaces" />
+ <service ref="InsertSection" auto-export="interfaces" />
+ <service ref="LinkSection" auto-export="interfaces" />
+ <service ref="PasteMenuAction" auto-export="interfaces" />
+ <service ref="ProcessorSection" auto-export="interfaces" />
+ <service ref="RemoveConditionMenuAction" auto-export="interfaces" />
+ <service ref="RemoveDataflowInputPortMenuAction" auto-export="interfaces" />
+ <service ref="RemoveDataflowOutputPortMenuAction" auto-export="interfaces" />
+ <service ref="RemoveLinkMenuAction" auto-export="interfaces" />
+ <service ref="RemoveProcessorMenuAction" auto-export="interfaces" />
+ <service ref="RenameProcessorMenuAction" auto-export="interfaces" />
+ <service ref="SetConstantInputPortValueMenuAction" auto-export="interfaces" />
+ <service ref="ShowConfigureMenuAction" auto-export="interfaces" />
+ <service ref="ShowDetailsContextualMenuAction" auto-export="interfaces" />
+ <service ref="ShowDetailsMenuAction" auto-export="interfaces" />
+ <service ref="ShowReportsContextualMenuAction" auto-export="interfaces" />
+ <service ref="WorkflowInputPortSection" auto-export="interfaces" />
+ <service ref="WorkflowOutputPortSection" auto-export="interfaces" />
+ <service ref="WorkflowServiceTemplatesSection" auto-export="interfaces" />
+
+ <reference id="editManager" interface="net.sf.taverna.t2.workbench.edits.EditManager" />
+ <reference id="fileManager" interface="net.sf.taverna.t2.workbench.file.FileManager" />
+ <reference id="menuManager" interface="net.sf.taverna.t2.ui.menu.MenuManager" />
+ <reference id="reportManager" interface="net.sf.taverna.t2.workbench.report.ReportManager" cardinality="0..1" />
+ <reference id="selectionManager" interface="net.sf.taverna.t2.workbench.selection.SelectionManager" />
+ <reference id="workbench" interface="net.sf.taverna.t2.workbench.ui.Workbench" cardinality="0..1" />
+ <reference id="workbenchConfiguration" interface="net.sf.taverna.t2.workbench.configuration.workbench.WorkbenchConfiguration" />
+ <reference id="activityIconManager" interface="net.sf.taverna.t2.workbench.activityicons.ActivityIconManager" />
+ <reference id="colourManager" interface="net.sf.taverna.t2.workbench.configuration.colour.ColourManager" />
+ <reference id="serviceRegistry" interface="uk.org.taverna.commons.services.ServiceRegistry" />
+
+ <list id="annotationBeans" interface="net.sf.taverna.t2.annotation.AnnotationBeanSPI"/>
+
+</beans:beans>