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/02/17 12:48:33 UTC
[14/50] [abbrv] incubator-taverna-workbench-common-activities git
commit: taverna-external-tool-activity-ui/
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/e48c3199/src/main/java/net/sf/taverna/t2/activities/externaltool/views/FilePanel.java
----------------------------------------------------------------------
diff --git a/src/main/java/net/sf/taverna/t2/activities/externaltool/views/FilePanel.java b/src/main/java/net/sf/taverna/t2/activities/externaltool/views/FilePanel.java
deleted file mode 100644
index 678711c..0000000
--- a/src/main/java/net/sf/taverna/t2/activities/externaltool/views/FilePanel.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.activities.externaltool.views;
-
-import java.awt.BorderLayout;
-import java.awt.GridBagConstraints;
-import java.awt.GridBagLayout;
-import java.awt.Insets;
-import java.awt.event.ActionEvent;
-import java.util.List;
-
-import javax.swing.AbstractAction;
-import javax.swing.JButton;
-import javax.swing.JComponent;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTextArea;
-import javax.swing.border.EmptyBorder;
-
-import net.sf.taverna.t2.activities.externaltool.utils.Tools;
-import net.sf.taverna.t2.lang.ui.DeselectingButton;
-import net.sf.taverna.t2.lang.ui.ReadOnlyTextArea;
-
-/**
- * @author alanrw
- *
- */
-public class FilePanel extends JPanel {
-
- private int outputGridy = 1;
- private final ExternalToolConfigView view;
-
- public FilePanel(final ExternalToolConfigView view,
- final List<ExternalToolFileViewer> viewList,
- String fileHeader, String typeHeader, final String portPrefix,
- final String description, String addText) {
- super();
- this.view = view;
- this.setLayout(new BorderLayout());
- final JPanel fileEditPanel = new JPanel(new GridBagLayout());
-
- final GridBagConstraints fileConstraint = new GridBagConstraints();
- fileConstraint.insets = new Insets(5, 5, 5, 5);
- fileConstraint.anchor = GridBagConstraints.FIRST_LINE_START;
- fileConstraint.gridx = 0;
- fileConstraint.gridy = 0;
- fileConstraint.weightx = 0.1;
- fileConstraint.fill = GridBagConstraints.BOTH;
-
- final String[] elementLabels = new String[] {"Taverna port name",
- "Use port name for file",
- fileHeader,
- typeHeader
- };
-
- fileConstraint.gridx = 0;
- synchronized (viewList) {
- for (ExternalToolFileViewer outputView : viewList) {
- addFileViewer(viewList, this, fileEditPanel,
- outputView, elementLabels);
- }
- }
- JButton addFilePortButton = new DeselectingButton(addText,
- new AbstractAction() {
- public void actionPerformed(ActionEvent e) {
-
- int portNumber = 1;
-
- String name2 = portPrefix + portNumber++;
- boolean nameExists = true;
- while (nameExists == true) {
- nameExists = view.portNameExists(name2);
- if (nameExists) {
- name2 = portPrefix + portNumber++;
- }
- }
-
- ExternalToolFileViewer newViewer = new ExternalToolFileViewer(
- name2);
- synchronized (viewList) {
- viewList.add(newViewer);
- addFileViewer(viewList, FilePanel.this, fileEditPanel,
- newViewer, elementLabels);
- fileEditPanel.revalidate();
- fileEditPanel.repaint();
- }
- }
-
- });
- JTextArea descriptionText = new ReadOnlyTextArea(description);
- descriptionText.setEditable(false);
- descriptionText.setFocusable(false);
- descriptionText.setBorder(new EmptyBorder(5, 5, 10, 5));
-
- this.add(descriptionText, BorderLayout.NORTH);
-
- this.add(new JScrollPane(fileEditPanel), BorderLayout.CENTER);
-
- JPanel buttonPanel = new JPanel(new BorderLayout());
-
- buttonPanel.add(addFilePortButton, BorderLayout.EAST);
-
- this.add(buttonPanel, BorderLayout.SOUTH);
-
- }
-
- private void addFileViewer(final List<ExternalToolFileViewer> viewList,
- final JPanel outerPanel, final JPanel panel,
- ExternalToolFileViewer viewer, String[] elementLabels) {
- Tools.addViewer(panel,
- elementLabels,
- new JComponent[] {viewer.getNameField(), viewer.getValueFromField(), viewer.getValueField(), viewer.getTypeSelector()},
- viewList,
- viewer,
- outerPanel);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/e48c3199/src/main/java/net/sf/taverna/t2/activities/externaltool/views/InvocationPanel.java
----------------------------------------------------------------------
diff --git a/src/main/java/net/sf/taverna/t2/activities/externaltool/views/InvocationPanel.java b/src/main/java/net/sf/taverna/t2/activities/externaltool/views/InvocationPanel.java
deleted file mode 100644
index 803328b..0000000
--- a/src/main/java/net/sf/taverna/t2/activities/externaltool/views/InvocationPanel.java
+++ /dev/null
@@ -1,396 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.activities.externaltool.views;
-
-import java.awt.BorderLayout;
-import java.awt.Component;
-import java.awt.FlowLayout;
-import java.awt.GridLayout;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.util.Arrays;
-import java.util.Comparator;
-
-import javax.swing.AbstractAction;
-import javax.swing.Box;
-import javax.swing.BoxLayout;
-import javax.swing.ButtonGroup;
-import javax.swing.DefaultComboBoxModel;
-import javax.swing.DefaultListCellRenderer;
-import javax.swing.JButton;
-import javax.swing.JComboBox;
-import javax.swing.JList;
-import javax.swing.JPanel;
-import javax.swing.JRadioButton;
-import javax.swing.JTextArea;
-import javax.swing.SwingUtilities;
-import javax.swing.border.EmptyBorder;
-
-import net.sf.taverna.t2.activities.externaltool.ExternalToolActivityConfigurationBean;
-import net.sf.taverna.t2.activities.externaltool.ExternalToolActivityHealthChecker;
-import net.sf.taverna.t2.activities.externaltool.configuration.ToolInvocationConfiguration;
-import net.sf.taverna.t2.activities.externaltool.manager.InvocationGroup;
-import net.sf.taverna.t2.activities.externaltool.manager.InvocationGroupAddedEvent;
-import net.sf.taverna.t2.activities.externaltool.manager.InvocationGroupRemovedEvent;
-import net.sf.taverna.t2.activities.externaltool.manager.InvocationManagerEvent;
-import net.sf.taverna.t2.activities.externaltool.manager.InvocationMechanism;
-import net.sf.taverna.t2.activities.externaltool.manager.InvocationMechanismAddedEvent;
-import net.sf.taverna.t2.activities.externaltool.manager.InvocationMechanismRemovedEvent;
-import net.sf.taverna.t2.activities.externaltool.manager.ToolInvocationConfigurationPanel;
-import net.sf.taverna.t2.activities.externaltool.manager.impl.InvocationGroupManagerImpl;
-import net.sf.taverna.t2.lang.observer.Observable;
-import net.sf.taverna.t2.lang.observer.Observer;
-import net.sf.taverna.t2.lang.ui.DeselectingButton;
-import net.sf.taverna.t2.workbench.ui.impl.configuration.ui.T2ConfigurationFrame;
-
-import org.apache.log4j.Logger;
-
-/**
- * @author alanrw
- *
- */
-public class InvocationPanel extends JPanel implements Observer<InvocationManagerEvent> {
-
- private static final String LOCATION_DESCRIPTION = ToolInvocationConfigurationPanel.HEADER_TEXT;
- private final JComboBox mechanismSelection;
- private final JComboBox groupSelection;
-
- private DefaultComboBoxModel mechanismSelectionModel = new DefaultComboBoxModel();
- private DefaultComboBoxModel groupSelectionModel = new DefaultComboBoxModel();
-
- private static InvocationGroupManagerImpl manager = InvocationGroupManagerImpl.getInstance();
-
- private static Logger logger = Logger
- .getLogger(InvocationPanel.class);
-
- private JRadioButton unmanagedLocation;
- private JRadioButton groupSelected;
- private JRadioButton mechanismSelected;
- private JButton manageInvocation;
- private ButtonGroup mechanismOrGroup;
- private ExternalToolActivityConfigurationBean configuration;
-
- private ActionListener radioChangeListener;
-
- boolean unmanagedShown = false;
-
- public InvocationPanel(ExternalToolActivityConfigurationBean configuration) {
- super();
- manager.addObserver(this);
-
- mechanismSelection = new JComboBox();
- populateMechanismList();
- mechanismSelection.setModel(mechanismSelectionModel);
-
- groupSelection = new JComboBox();
- populateGroupList();
- groupSelection.setModel(groupSelectionModel);
- populateInvocationPanel(configuration);
-
- radioChangeListener = new AbstractAction() {
-
- @Override
- public void actionPerformed(ActionEvent e) {
- if (unmanagedShown && unmanagedLocation.isSelected()) {
- setUnmanagedLocationSelectability(true);
- setMechanismSelectability(false);
- setGroupSelectability(false);
- return;
- }
- if (mechanismSelected.isSelected()) {
- if (unmanagedShown) {
- setUnmanagedLocationSelectability(false);
- }
- setMechanismSelectability(true);
- setGroupSelectability(false);
- return;
- }
- if (unmanagedShown) {
- setUnmanagedLocationSelectability(false);
- }
- setMechanismSelectability(false);
- setGroupSelectability(true);
- return; }
-
- };
- if (unmanagedShown) {
- unmanagedLocation.addActionListener(radioChangeListener);
- }
- groupSelected.addActionListener(radioChangeListener);
- mechanismSelected.addActionListener(radioChangeListener);
- }
-
- private void populateMechanismList() {
- InvocationMechanism currentSelection = (InvocationMechanism) mechanismSelection.getSelectedItem();
- InvocationMechanism[] mechanisms = InvocationGroupManagerImpl.getInstance()
- .getMechanisms().toArray(new InvocationMechanism[] {});
- Arrays.sort(mechanisms, new Comparator<InvocationMechanism>() {
-
- @Override
- public int compare(InvocationMechanism arg0, InvocationMechanism arg1) {
- return arg0.getName().compareTo(
- arg1.getName());
- }
- });
- mechanismSelectionModel.removeAllElements();
- for (InvocationMechanism mechanism : mechanisms) {
- mechanismSelectionModel.addElement(mechanism);
- logger.info("Added mechanism " + mechanism.hashCode());
- }
- if (currentSelection != null) {
- mechanismSelection.setSelectedItem(currentSelection);
- }
-
- }
-
- private void populateGroupList() {
- InvocationGroup currentSelection = (InvocationGroup) groupSelection.getSelectedItem();
- InvocationGroup[] groups = InvocationGroupManagerImpl.getInstance()
- .getInvocationGroups().toArray(new InvocationGroup[] {});
- Arrays.sort(groups, new Comparator<InvocationGroup>() {
-
- @Override
- public int compare(InvocationGroup arg0, InvocationGroup arg1) {
- return arg0.getName().compareTo(
- arg1.getName());
- }
- });
- groupSelectionModel.removeAllElements();
- for (InvocationGroup group : groups) {
- groupSelectionModel.addElement(group);
- logger.info("Added group " + group.hashCode());
- }
- if (currentSelection != null) {
- groupSelection.setSelectedItem(currentSelection);
- }
-
- }
-
-
- private void populateInvocationPanel(ExternalToolActivityConfigurationBean configuration) {
- this.configuration = configuration;
- this.removeAll();
- this.setLayout(new BorderLayout());
-
- JTextArea descriptionText = new JTextArea(
- LOCATION_DESCRIPTION);
- descriptionText.setEditable(false);
- descriptionText.setFocusable(false);
- descriptionText.setBorder(new EmptyBorder(5, 5, 10, 5));
- descriptionText.setLineWrap(true);
- descriptionText.setWrapStyleWord(true);
- descriptionText.setRows(3);
- this.add(descriptionText, BorderLayout.NORTH);
-
- JPanel innerPanel = new JPanel(new BorderLayout());
-
- mechanismOrGroup = new ButtonGroup();
-
- JPanel subPanel = new JPanel(new GridLayout(4,1));
-
- if (isUnmanaged(configuration)) {
- createUnmanagedLocation(subPanel);
- unmanagedShown = true;
- }
-
- subPanel.add(createMechanismPanel());
-
- subPanel.add(createGroupPanel());
-
- subPanel.add(createButtonPanel());
-
- innerPanel.add(subPanel, BorderLayout.NORTH);
- innerPanel.add(new JPanel(), BorderLayout.CENTER);
-
- initializeSelectability();
- this.add(innerPanel, BorderLayout.CENTER);
- this.repaint();
- }
-
- private boolean isUnmanaged(
- ExternalToolActivityConfigurationBean configuration2) {
- return (!ExternalToolActivityHealthChecker.updateLocation(configuration2));
- }
-
- private void initializeSelectability() {
- if (isUnmanaged(configuration)) {
- unmanagedLocation.setSelected(true);
- setUnmanagedLocationSelectability(true);
- setMechanismSelectability(false);
- setGroupSelectability(false);
- return;
- }
- if (configuration.getInvocationGroup() == null) {
- mechanismSelected.setSelected(true);
- if (unmanagedShown) {
- setUnmanagedLocationSelectability(false);
- }
- setMechanismSelectability(true);
- setGroupSelectability(false);
- return;
- }
- groupSelected.setSelected(true);
- if (unmanagedShown) {
- setUnmanagedLocationSelectability(false);
- }
- setMechanismSelectability(false);
- setGroupSelectability(true);
- return;
- }
-
- private void setGroupSelectability(boolean b) {
- groupSelection.setEnabled(b);
- }
-
- private void setMechanismSelectability(boolean b) {
- mechanismSelection.setEnabled(b);
- }
-
- private void setUnmanagedLocationSelectability(boolean b) {
- // Nothing to do
- }
-
- private JPanel createGroupPanel() {
- JPanel groupPanel = new JPanel(new BorderLayout());
-
- JPanel groupSelectionPanel = new JPanel(new GridLayout(1, 2));
- groupSelected = new JRadioButton("Select a symbolic location");
- mechanismOrGroup.add(groupSelected);
- groupSelected.setBorder(new EmptyBorder(10, 10, 10, 10));
- groupSelectionPanel.add(groupSelected);
-
- groupSelection.setRenderer(new DefaultListCellRenderer() {
-
- @Override
- public Component getListCellRendererComponent(JList arg0,
- Object arg1, int arg2, boolean arg3, boolean arg4) {
- if (arg1 instanceof InvocationGroup) {
- return super.getListCellRendererComponent(arg0,
- ((InvocationGroup) arg1).getName(),
- arg2, arg3, arg4);
- }
- return super.getListCellRendererComponent(arg0, arg1, arg2,
- arg3, arg4);
- }
- });
-
- groupSelectionPanel.add(groupSelection);
-
- groupPanel.add(groupSelectionPanel, BorderLayout.CENTER);
-
- if (configuration.getInvocationGroup() != null) {
- groupSelection.setSelectedItem(configuration.getInvocationGroup());
- } else {
- groupSelection.setSelectedItem(manager.getDefaultGroup());
- }
-
- return groupPanel;
- }
-
- private JPanel createMechanismPanel() {
- JPanel mechanismPanel = new JPanel(new BorderLayout());
- JPanel mechanismSelectionPanel = new JPanel(new GridLayout(1, 3));
- mechanismSelected = new JRadioButton("Select an explicit location");
- mechanismOrGroup.add(mechanismSelected);
- mechanismSelected.setBorder(new EmptyBorder(10, 10, 10, 10));
- mechanismSelectionPanel.add(mechanismSelected);
-
- mechanismSelection.setRenderer(new DefaultListCellRenderer() {
-
- @Override
- public Component getListCellRendererComponent(JList arg0,
- Object arg1, int arg2, boolean arg3, boolean arg4) {
- if (arg1 instanceof InvocationMechanism) {
- return super.getListCellRendererComponent(arg0,
- ((InvocationMechanism) arg1).getName(),
- arg2, arg3, arg4);
- }
- return super.getListCellRendererComponent(arg0, arg1, arg2,
- arg3, arg4);
- }
- });
-
- mechanismSelectionPanel.add(mechanismSelection);
-
- mechanismPanel.add(mechanismSelectionPanel, BorderLayout.CENTER);
- if (configuration.getMechanism() != null) {
- mechanismSelection.setSelectedItem(configuration.getMechanism());
- } else {
- mechanismSelection.setSelectedItem(manager.getDefaultMechanism());
- }
- return mechanismPanel;
-
- }
-
- private JPanel createButtonPanel() {
- JPanel buttonPanel = new JPanel(new FlowLayout());
- manageInvocation = new DeselectingButton("Manage locations",
- new AbstractAction() {
-
- @Override
- public void actionPerformed(ActionEvent e) {
- T2ConfigurationFrame.showConfiguration(ToolInvocationConfiguration.getInstance().getDisplayName());
- }});
- buttonPanel.add(manageInvocation);
- return buttonPanel;
- }
-
- private void createUnmanagedLocation(JPanel subPanel) {
- unmanagedLocation = new JRadioButton("Continue using unmanaged location");
- subPanel.add(unmanagedLocation);
- mechanismOrGroup.add(unmanagedLocation);
- }
-
- private void handleInvocationManagerMessage(InvocationManagerEvent message) {
- if (message instanceof InvocationMechanismRemovedEvent) {
- InvocationMechanism removedMechanism = ((InvocationMechanismRemovedEvent) message).getRemovedMechanism();
- InvocationMechanism replacementMechanism = ((InvocationMechanismRemovedEvent) message).getReplacementMechanism();
- if (mechanismSelection.getSelectedItem().equals(removedMechanism)) {
- mechanismSelection.setSelectedItem(replacementMechanism);
- }
- mechanismSelectionModel.removeElement(removedMechanism);
- } else if (message instanceof InvocationMechanismAddedEvent) {
- populateMechanismList();
- }
- else if (message instanceof InvocationGroupRemovedEvent) {
- InvocationGroup removedGroup = ((InvocationGroupRemovedEvent) message).getRemovedGroup();
- InvocationGroup replacementGroup = ((InvocationGroupRemovedEvent) message).getReplacementGroup();
- if (groupSelection.getSelectedItem().equals(removedGroup)) {
- groupSelection.setSelectedItem(replacementGroup);
- }
- groupSelectionModel.removeElement(removedGroup);
- } else if (message instanceof InvocationGroupAddedEvent) {
- populateGroupList();
- }
- }
-
- @Override
- public void notify(Observable<InvocationManagerEvent> sender,
- final InvocationManagerEvent message) throws Exception {
- if (SwingUtilities.isEventDispatchThread()) {
- handleInvocationManagerMessage(message);
- } else {
- SwingUtilities.invokeLater(new Runnable() {
- public void run() {
- handleInvocationManagerMessage(message);
- }
- });
- } }
-
- public void fillInConfiguration(
- ExternalToolActivityConfigurationBean newConfiguration) {
- if (unmanagedShown && unmanagedLocation.isSelected()) {
- return;
- }
- if (mechanismSelected.isSelected()) {
- newConfiguration.setMechanism((InvocationMechanism) mechanismSelection.getSelectedItem());
- return;
- }
- newConfiguration.setInvocationGroup((InvocationGroup) groupSelection.getSelectedItem());
- }
-
- public void stopObserving() {
- manager.removeObserver(this);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/e48c3199/src/main/java/net/sf/taverna/t2/activities/externaltool/views/LoadDescriptionAction.java
----------------------------------------------------------------------
diff --git a/src/main/java/net/sf/taverna/t2/activities/externaltool/views/LoadDescriptionAction.java b/src/main/java/net/sf/taverna/t2/activities/externaltool/views/LoadDescriptionAction.java
deleted file mode 100644
index 7f0d82f..0000000
--- a/src/main/java/net/sf/taverna/t2/activities/externaltool/views/LoadDescriptionAction.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.activities.externaltool.views;
-
-import java.awt.event.ActionEvent;
-import java.io.IOException;
-import java.io.StringBufferInputStream;
-import java.io.StringReader;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import javax.swing.AbstractAction;
-import javax.swing.JOptionPane;
-
-import net.sf.taverna.t2.lang.ui.FileTools;
-
-import org.jdom.Document;
-import org.jdom.JDOMException;
-
-import de.uni_luebeck.inb.knowarc.usecases.UseCaseDescription;
-import de.uni_luebeck.inb.knowarc.usecases.UseCaseEnumeration;
-
-final class LoadDescriptionAction extends AbstractAction {
- /**
- *
- */
- private final ScriptPanel scriptPanel;
- private final ExternalToolConfigView view;
-
- LoadDescriptionAction(ScriptPanel scriptPanel, ExternalToolConfigView view) {
- this.scriptPanel = scriptPanel;
- this.view = view;
- }
-
- public void actionPerformed(ActionEvent e) {
- String descriptionsString = FileTools.readStringFromFile(
- this.scriptPanel, "Load tool description",
- ".xml");
- if (descriptionsString != null) {
- String errorMessage = null;
- try {
- Document doc = ScriptPanel.builder
- .build(new StringReader(descriptionsString));
- List<UseCaseDescription> descriptions = UseCaseEnumeration.readDescriptionsFromStream(new StringBufferInputStream(descriptionsString));
- if (descriptions.isEmpty()) {
- JOptionPane.showMessageDialog(this.scriptPanel, "No tool descriptions found", "File content", JOptionPane.ERROR_MESSAGE);
- return;
- }
-
- if (descriptions.size() == 1) {
- view.getConfiguration().setUseCaseDescription(descriptions.get(0));
- view.refreshConfiguration(view.getConfiguration());
- return;
- }
-
- List<String> descriptionNames = new ArrayList();
- for (UseCaseDescription ud : descriptions) {
- descriptionNames.add(ud.getUsecaseid());
- }
- Collections.sort(descriptionNames);
- String chosenName = (String) JOptionPane.showInputDialog(this.scriptPanel, "Please select a tool description",
- "Select tool description", JOptionPane.PLAIN_MESSAGE, null, descriptionNames.toArray(), descriptionNames.get(0));
- if (chosenName != null) {
- for (UseCaseDescription ud : descriptions) {
- if (ud.getUsecaseid().equals(chosenName)) {
- view.getConfiguration().setUseCaseDescription(ud);
- view.refreshConfiguration(view.getConfiguration());
- return;
-
- }
- }
- }
- } catch (JDOMException e1) {
- errorMessage = e1.getMessage();
- } catch (IOException e1) {
- errorMessage = e1.getMessage();
- } catch (Exception e1) {
- errorMessage = e1.getMessage();
- }
- if (errorMessage != null) {
- JOptionPane.showMessageDialog(null, errorMessage,
- "Tool description load error",
- JOptionPane.ERROR_MESSAGE);
- }
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/e48c3199/src/main/java/net/sf/taverna/t2/activities/externaltool/views/SaveDescriptionAction.java
----------------------------------------------------------------------
diff --git a/src/main/java/net/sf/taverna/t2/activities/externaltool/views/SaveDescriptionAction.java b/src/main/java/net/sf/taverna/t2/activities/externaltool/views/SaveDescriptionAction.java
deleted file mode 100644
index 31266b4..0000000
--- a/src/main/java/net/sf/taverna/t2/activities/externaltool/views/SaveDescriptionAction.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.activities.externaltool.views;
-
-import java.awt.Component;
-import java.awt.event.ActionEvent;
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.prefs.Preferences;
-
-import javax.swing.AbstractAction;
-import javax.swing.JFileChooser;
-import javax.swing.JOptionPane;
-
-import net.sf.taverna.t2.lang.ui.ExtensionFileFilter;
-import net.sf.taverna.t2.lang.ui.FileTools;
-
-import org.apache.log4j.Logger;
-import org.jdom.Element;
-import org.jdom.output.Format;
-import org.jdom.output.XMLOutputter;
-
-import de.uni_luebeck.inb.knowarc.usecases.UseCaseDescription;
-import de.uni_luebeck.inb.knowarc.usecases.UseCaseEnumeration;
-
-final class SaveDescriptionAction extends AbstractAction {
- /**
- *
- */
- private final ScriptPanel scriptPanel;
- private final ExternalToolConfigView view;
-
- private static Logger logger = Logger.getLogger(SaveDescriptionAction.class);
-
- private static XMLOutputter outputter = new XMLOutputter(Format
- .getPrettyFormat());
-
- SaveDescriptionAction(ScriptPanel scriptPanel, ExternalToolConfigView view) {
- this.scriptPanel = scriptPanel;
- this.view = view;
- }
-
- public void actionPerformed(ActionEvent e) {
- UseCaseDescription currentDescription = view.makeConfiguration().getUseCaseDescription();
- String usecaseid = currentDescription.getUsecaseid();
- String description = currentDescription.getDescription();
- String group = currentDescription.getGroup();
- if ((usecaseid == null) || usecaseid.isEmpty() || (description == null) || description.isEmpty() || (group == null) || group.isEmpty()) {
- JOptionPane.showMessageDialog(view, "Please fill in the tool annotation and\nthen re-export the description", "Missing annotation", JOptionPane.PLAIN_MESSAGE, null);
- view.showAnnotationPanel();
- } else {
- saveStringToFile(this.scriptPanel,
- "Save tool description", ".xml", currentDescription);
- }
- }
-
- public static boolean saveStringToFile(Component parent, String dialogTitle, String extension, UseCaseDescription description) {
- JFileChooser fileChooser = new JFileChooser();
- fileChooser.setDialogTitle(dialogTitle);
-
- fileChooser.resetChoosableFileFilters();
- fileChooser.setAcceptAllFileFilterUsed(true);
-
- fileChooser.setFileFilter(new ExtensionFileFilter(new String[] { extension }));
-
- Preferences prefs = Preferences.userNodeForPackage(FileTools.class);
- String curDir = prefs
- .get("currentDir", System.getProperty("user.home"));
- fileChooser.setCurrentDirectory(new File(curDir));
-
- boolean tryAgain = true;
- while (tryAgain) {
- tryAgain = false;
- int returnVal = fileChooser.showSaveDialog(parent);
- if (returnVal == JFileChooser.APPROVE_OPTION) {
- prefs.put("currentDir", fileChooser.getCurrentDirectory()
- .toString());
- File file = fileChooser.getSelectedFile();
- if (!file.getName().contains(".")) {
- String newName = file.getName() + extension;
- file = new File(file.getParentFile(), newName);
- }
-
- // TODO: Open in separate thread to avoid hanging UI
- try {
- List<UseCaseDescription> currentDescriptions;
- if (file.exists()) {
- currentDescriptions = UseCaseEnumeration.readDescriptionsFromStream(new FileInputStream(file));
- } else {
- currentDescriptions = new ArrayList<UseCaseDescription>();
- }
- Element overallElement = new Element("usecases");
- for (UseCaseDescription ud : currentDescriptions) {
- if (!ud.getUsecaseid().equals(description.getUsecaseid())) {
- overallElement.addContent(ud.writeToXMLElement());
- }
- }
-
- overallElement.addContent(description.writeToXMLElement());
- BufferedWriter out = new BufferedWriter(new FileWriter(file));
- out.write(outputter.outputString(overallElement));
- out.close();
- logger.info("Saved content by overwriting " + file);
- return true;
- } catch (IOException ex) {
- logger.warn("Could not save content to " + file, ex);
- JOptionPane.showMessageDialog(parent,
- "Could not save to " + file + ": \n\n"
- + ex.getMessage(), "Warning",
- JOptionPane.WARNING_MESSAGE);
- return false;
- }
- }
- }
- return false;
- }
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/e48c3199/src/main/java/net/sf/taverna/t2/activities/externaltool/views/ScriptPanel.java
----------------------------------------------------------------------
diff --git a/src/main/java/net/sf/taverna/t2/activities/externaltool/views/ScriptPanel.java b/src/main/java/net/sf/taverna/t2/activities/externaltool/views/ScriptPanel.java
deleted file mode 100644
index ba15219..0000000
--- a/src/main/java/net/sf/taverna/t2/activities/externaltool/views/ScriptPanel.java
+++ /dev/null
@@ -1,149 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.activities.externaltool.views;
-
-import java.awt.BorderLayout;
-import java.awt.FlowLayout;
-import java.awt.GridLayout;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.io.IOException;
-
-import javax.swing.AbstractAction;
-import javax.swing.JButton;
-import javax.swing.JCheckBox;
-import javax.swing.JLabel;
-import javax.swing.JOptionPane;
-import javax.swing.JPanel;
-import javax.swing.JTextArea;
-import javax.swing.JTextField;
-import javax.swing.border.EmptyBorder;
-import javax.swing.text.JTextComponent;
-
-import net.sf.taverna.t2.activities.externaltool.ExternalToolActivityConfigurationBean;
-import net.sf.taverna.t2.lang.ui.DeselectingButton;
-import net.sf.taverna.t2.lang.ui.LineEnabledTextPanel;
-
-import org.jdom.input.SAXBuilder;
-
-import de.uni_luebeck.inb.knowarc.usecases.UseCaseDescription;
-import de.uni_luebeck.inb.knowarc.usecases.UseCaseEnumeration;
-
-
-/**
- * @author alanrw
- *
- */
-public class ScriptPanel extends JPanel {
-
- private static final String SCRIPT_DESCRIPTION = "Specify the commands that you want to run. You can use data arriving at an input port to replace parts of the command or to write to a file. You can also take data written to a file and send it to an output port.";
- static SAXBuilder builder = new SAXBuilder();
- private final JTextComponent scriptTextArea;
-
- public ScriptPanel(final ExternalToolConfigView view, JTextComponent scriptTextArea, JCheckBox stdInCheckBox, JCheckBox stdOutCheckBox, JCheckBox stdErrCheckBox, JTextField returnCodesField) {
- super();
- this.setLayout(new BorderLayout());
-
- JTextArea descriptionText = new JTextArea(
- SCRIPT_DESCRIPTION);
- descriptionText.setEditable(false);
- descriptionText.setFocusable(false);
- descriptionText.setBorder(new EmptyBorder(5, 5, 10, 5));
- descriptionText.setLineWrap(true);
- descriptionText.setWrapStyleWord(true);
- this.add(descriptionText, BorderLayout.NORTH);
-
- this.scriptTextArea = scriptTextArea;
-
- this.add(new LineEnabledTextPanel(scriptTextArea),
- BorderLayout.CENTER);
-
-
- UseCaseDescription useCaseDescription = view.getConfiguration().getUseCaseDescription();
- stdInCheckBox.setSelected(useCaseDescription.isIncludeStdIn());
- stdOutCheckBox.setSelected(useCaseDescription.isIncludeStdOut());
- stdErrCheckBox.setSelected(useCaseDescription.isIncludeStdErr());
- returnCodesField.setText(useCaseDescription.getReturnCodesAsText());
-
- JPanel codesPanel = new JPanel(new FlowLayout());
- codesPanel.add(new JLabel("Valid return codes:"));
- codesPanel.add(returnCodesField);
-
- JPanel streamPanel = new JPanel(new FlowLayout());
- streamPanel.add(stdInCheckBox);
- streamPanel.add(stdOutCheckBox);
- streamPanel.add(stdErrCheckBox);
-
- JPanel buttonPanel = new JPanel(new FlowLayout());
- if (view.isOriginallyFromRepository()) {
- JButton revertButton = new DeselectingButton("Revert to original description",
- new AbstractAction(){
-
- @Override
- public void actionPerformed(ActionEvent e) {
- ExternalToolActivityConfigurationBean bean = view.makeConfiguration();
- String repositoryUrl = bean.getRepositoryUrl();
- String id = bean.getExternaltoolid();
- UseCaseDescription usecase = null;
- try {
- usecase = UseCaseEnumeration.readDescriptionFromUrl(
- repositoryUrl, id);
- }
- catch (IOException ex) {
- // Already logged
- }
- if (usecase != null) {
- bean.setUseCaseDescription(usecase);
- view.setEditable(false, bean);
- } else {
- JOptionPane.showMessageDialog(view, "Unable to find tool description " + id, "Missing tool description", JOptionPane.ERROR_MESSAGE);
- }
- }});
- revertButton.setToolTipText("Revert to the tool description from the repository");
- buttonPanel.add(revertButton);
- }
- JButton loadScriptButton = new DeselectingButton("Load description",
- new LoadDescriptionAction(this, view));
- loadScriptButton.setToolTipText("Load tool description from a file");
-
- JButton saveScriptButton = new DeselectingButton("Export description",
- new SaveDescriptionAction(this, view));
- saveScriptButton.setToolTipText("Export the tool description to a file");
-
- JButton clearScriptButton = new DeselectingButton("Clear script",
- new AbstractAction() {
-
- public void actionPerformed(ActionEvent e) {
- clearScript();
- }
-
- });
- clearScriptButton.setToolTipText("Clear the script from the edit area");
-
- buttonPanel.add(loadScriptButton);
- buttonPanel.add(saveScriptButton);
- buttonPanel.add(clearScriptButton);
-
- JPanel subPanel = new JPanel(new GridLayout(3,1));
- subPanel.add(codesPanel);
- subPanel.add(streamPanel);
- subPanel.add(buttonPanel);
-
- this.add(subPanel, BorderLayout.SOUTH);
- }
-
- /**
- * Method for clearing the script
- *
- */
- private void clearScript() {
- if (JOptionPane.showConfirmDialog(this,
- "Do you really want to clear the tool description?",
- "Clearing the tool description", JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
- scriptTextArea.setText("");
- }
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/e48c3199/src/main/java/net/sf/taverna/t2/activities/externaltool/views/StaticStringPanel.java
----------------------------------------------------------------------
diff --git a/src/main/java/net/sf/taverna/t2/activities/externaltool/views/StaticStringPanel.java b/src/main/java/net/sf/taverna/t2/activities/externaltool/views/StaticStringPanel.java
deleted file mode 100644
index 885cab5..0000000
--- a/src/main/java/net/sf/taverna/t2/activities/externaltool/views/StaticStringPanel.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.activities.externaltool.views;
-
-import java.awt.BorderLayout;
-import java.awt.GridBagConstraints;
-import java.awt.GridBagLayout;
-import java.awt.Insets;
-import java.awt.event.ActionEvent;
-import java.util.List;
-
-import javax.swing.AbstractAction;
-import javax.swing.JButton;
-import javax.swing.JComponent;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTextArea;
-import javax.swing.JTextField;
-import javax.swing.border.EmptyBorder;
-
-import net.sf.taverna.t2.activities.externaltool.utils.Tools;
-import net.sf.taverna.t2.lang.ui.DeselectingButton;
-import net.sf.taverna.t2.lang.ui.ReadOnlyTextArea;
-
-/**
- * @author alanrw
- *
- */
-public class StaticStringPanel extends JPanel {
-
- private static final String STATIC_STRING_DESCRIPTION = "A fixed string can be written to the specified file.";
- private final List<ExternalToolStaticStringViewer> staticStringViewList;
-
- int staticGridy = 1;
-
- private static String[] elementLabels = new String[] {"String to copy", "To file"};
-
- public StaticStringPanel(final List<ExternalToolStaticStringViewer> staticStringViewList) {
- super(new BorderLayout());
- this.staticStringViewList = staticStringViewList;
- final JPanel staticEditPanel = new JPanel(new GridBagLayout());
-
- final GridBagConstraints staticConstraint = new GridBagConstraints();
- staticConstraint.insets = new Insets(5, 5, 5, 5);
- staticConstraint.anchor = GridBagConstraints.FIRST_LINE_START;
- staticConstraint.gridx = 0;
- staticConstraint.gridy = 0;
- staticConstraint.weightx = 0.1;
- staticConstraint.fill = GridBagConstraints.BOTH;
-
- staticConstraint.gridx = 0;
- synchronized (staticStringViewList) {
- for (ExternalToolStaticStringViewer staticView : staticStringViewList) {
- addStaticStringViewer(StaticStringPanel.this, staticEditPanel,
- staticView);
- }
- }
-
- JTextArea descriptionText = new ReadOnlyTextArea(
- STATIC_STRING_DESCRIPTION);
- descriptionText.setEditable(false);
- descriptionText.setFocusable(false);
- descriptionText.setBorder(new EmptyBorder(5, 5, 10, 5));
- this.add(descriptionText, BorderLayout.NORTH);
-
- this.add(new JScrollPane(staticEditPanel),
- BorderLayout.CENTER);
- JButton addStaticStringButton = new DeselectingButton("Add string",
- new AbstractAction() {
- // FIXME refactor this into a method
- public void actionPerformed(ActionEvent e) {
-
- ExternalToolStaticStringViewer newViewer = new ExternalToolStaticStringViewer();
- synchronized (staticStringViewList) {
- staticStringViewList.add(newViewer);
- addStaticStringViewer(StaticStringPanel.this, staticEditPanel,
- newViewer);
- staticEditPanel.revalidate();
- staticEditPanel.repaint();
- }
- }
-
- });
-
- JPanel buttonPanel = new JPanel(new BorderLayout());
-
- buttonPanel.add(addStaticStringButton, BorderLayout.EAST);
-
- this.add(buttonPanel, BorderLayout.SOUTH);
-
- }
-
- private void addStaticStringViewer(final JPanel outerPanel,
- final JPanel panel, ExternalToolStaticStringViewer viewer) {
- Tools.addViewer(panel,
- elementLabels,
- new JComponent[] {new JScrollPane(viewer.getContentField()), viewer.getValueField()},
- staticStringViewList,
- viewer,
- outerPanel);
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/e48c3199/src/main/java/net/sf/taverna/t2/activities/externaltool/views/StaticUrlPanel.java
----------------------------------------------------------------------
diff --git a/src/main/java/net/sf/taverna/t2/activities/externaltool/views/StaticUrlPanel.java b/src/main/java/net/sf/taverna/t2/activities/externaltool/views/StaticUrlPanel.java
deleted file mode 100644
index ba441f4..0000000
--- a/src/main/java/net/sf/taverna/t2/activities/externaltool/views/StaticUrlPanel.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.activities.externaltool.views;
-
-import java.awt.BorderLayout;
-import java.awt.GridBagConstraints;
-import java.awt.GridBagLayout;
-import java.awt.Insets;
-import java.awt.event.ActionEvent;
-import java.util.List;
-
-import javax.swing.AbstractAction;
-import javax.swing.JButton;
-import javax.swing.JComponent;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTextArea;
-import javax.swing.JTextField;
-import javax.swing.border.EmptyBorder;
-
-import net.sf.taverna.t2.activities.externaltool.utils.Tools;
-import net.sf.taverna.t2.lang.ui.DeselectingButton;
-import net.sf.taverna.t2.lang.ui.ReadOnlyTextArea;
-
-/**
- * @author alanrw
- *
- */
-public class StaticUrlPanel extends JPanel {
-
- private static final String STATIC_URL_DESCRIPTION = "The data at a URL can be downloaded and stored in the specified file.";
- private final List<ExternalToolStaticUrlViewer> staticUrlViewList;
- private int staticGridy = 1;
-
- private static String[] elementLabels = new String[] {"Copy from URL", "To file"};
-
-
- public StaticUrlPanel(final List<ExternalToolStaticUrlViewer> staticUrlViewList) {
-
- super(new BorderLayout());
- this.staticUrlViewList = staticUrlViewList;
- final JPanel staticEditPanel = new JPanel(new GridBagLayout());
-
- final GridBagConstraints staticConstraint = new GridBagConstraints();
- staticConstraint.insets = new Insets(5, 5, 5, 5);
- staticConstraint.anchor = GridBagConstraints.FIRST_LINE_START;
- staticConstraint.gridx = 0;
- staticConstraint.gridy = 0;
- staticConstraint.weightx = 0.1;
- staticConstraint.fill = GridBagConstraints.BOTH;
-
- staticConstraint.gridx = 0;
- synchronized (staticUrlViewList) {
- for (ExternalToolStaticUrlViewer staticView : staticUrlViewList) {
- addStaticUrlViewer(this, staticEditPanel,
- staticView);
- }
- }
-
- this.add(new JScrollPane(staticEditPanel),
- BorderLayout.CENTER);
-
- JTextArea descriptionText = new ReadOnlyTextArea(
- STATIC_URL_DESCRIPTION);
- descriptionText.setEditable(false);
- descriptionText.setFocusable(false);
- descriptionText.setBorder(new EmptyBorder(5, 5, 10, 5));
-
- this.add(descriptionText, BorderLayout.NORTH);
-
- JButton addstaticPortButton = new DeselectingButton("Add URL",
- new AbstractAction() {
- // FIXME refactor this into a method
- public void actionPerformed(ActionEvent e) {
-
- ExternalToolStaticUrlViewer newViewer = new ExternalToolStaticUrlViewer();
- synchronized (staticUrlViewList) {
- staticUrlViewList.add(newViewer);
- addStaticUrlViewer(StaticUrlPanel.this, staticEditPanel,
- newViewer);
- staticEditPanel.revalidate();
- staticEditPanel.repaint();
- }
- }
-
- });
- JPanel buttonPanel = new JPanel(new BorderLayout());
-
- buttonPanel.add(addstaticPortButton, BorderLayout.EAST);
-
- this.add(buttonPanel, BorderLayout.SOUTH);
-
- }
-
- private void addStaticUrlViewer(final JPanel outerPanel,
- final JPanel panel, ExternalToolStaticUrlViewer viewer) {
- Tools.addViewer(panel,
- elementLabels,
- new JComponent[] {viewer.getContentField(), viewer.getValueField()},
- staticUrlViewList,
- viewer,
- outerPanel);
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/e48c3199/src/main/java/net/sf/taverna/t2/activities/externaltool/views/StringReplacementPanel.java
----------------------------------------------------------------------
diff --git a/src/main/java/net/sf/taverna/t2/activities/externaltool/views/StringReplacementPanel.java b/src/main/java/net/sf/taverna/t2/activities/externaltool/views/StringReplacementPanel.java
deleted file mode 100644
index 1f85d3a..0000000
--- a/src/main/java/net/sf/taverna/t2/activities/externaltool/views/StringReplacementPanel.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.activities.externaltool.views;
-
-import java.awt.BorderLayout;
-import java.awt.Color;
-import java.awt.GridBagConstraints;
-import java.awt.GridBagLayout;
-import java.awt.Insets;
-import java.awt.event.ActionEvent;
-import java.util.List;
-
-import javax.swing.AbstractAction;
-import javax.swing.BorderFactory;
-import javax.swing.JButton;
-import javax.swing.JCheckBox;
-import javax.swing.JComponent;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTextArea;
-import javax.swing.JTextField;
-import javax.swing.border.CompoundBorder;
-import javax.swing.border.EmptyBorder;
-
-import net.sf.taverna.t2.activities.externaltool.manager.ssh.ExternalToolSshNodeViewer;
-import net.sf.taverna.t2.activities.externaltool.utils.Tools;
-import net.sf.taverna.t2.lang.ui.DeselectingButton;
-
-/**
- * @author alanrw
- *
- */
-public class StringReplacementPanel extends JPanel {
-
- private static final String STRING_REPLACEMENT_DESCRIPTION = "You can use a string replacement to " +
- "feed data into the service via an input port and have that data replace part of the " +
- "command.";
- private final List<ExternalToolStringReplacementViewer> stringReplacementViewList;
- private int stringReplacementGridy = 1;
- private final ExternalToolConfigView view;
-
- private static Insets insets = new Insets(1,5,1,5);
-
- private static String[] elementLabels = new String[] {"Taverna port name", "Replace port name", "String to replace"};
-
- private static CompoundBorder border = BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(5,5,5,5), BorderFactory.createLineBorder(Color.BLACK, 1));
-
-
- public StringReplacementPanel(final ExternalToolConfigView view, final List<ExternalToolStringReplacementViewer> stringReplacementViewList) {
- super(new BorderLayout());
- this.view = view;
- this.stringReplacementViewList = stringReplacementViewList;
-
- final JPanel inputEditPanel = new JPanel(new GridBagLayout());
-
- final GridBagConstraints inputConstraint = new GridBagConstraints();
-
- inputConstraint.anchor = GridBagConstraints.FIRST_LINE_START;
- inputConstraint.gridx = 0;
- inputConstraint.gridy = 0;
- inputConstraint.weightx = 0.1;
- inputConstraint.fill = GridBagConstraints.BOTH;
-
- inputConstraint.gridx = 0;
- synchronized (stringReplacementViewList) {
- for (ExternalToolStringReplacementViewer inputView : stringReplacementViewList) {
- addStringReplacementViewer(this, inputEditPanel,
- inputView, elementLabels);
-
- }
- }
-
- JTextArea descriptionText = new JTextArea(
- STRING_REPLACEMENT_DESCRIPTION);
- descriptionText.setEditable(false);
- descriptionText.setFocusable(false);
- descriptionText.setBorder(new EmptyBorder(5, 5, 10, 5));
- descriptionText.setLineWrap(true);
- descriptionText.setWrapStyleWord(true);
-
- this.add(descriptionText, BorderLayout.NORTH);
- this.add(new JScrollPane(inputEditPanel),
- BorderLayout.CENTER);
- JButton addInputPortButton = new DeselectingButton("Add string replacement",
- new AbstractAction() {
-
- public void actionPerformed(ActionEvent e) {
-
- int portNumber = 1;
- String name2 = "in" + portNumber++;
- boolean nameExists = true;
- while (nameExists == true) {
- nameExists = view.portNameExists(name2);
- if (nameExists) {
- name2 = "in" + portNumber++;
- }
- }
-
- ExternalToolStringReplacementViewer newViewer = new ExternalToolStringReplacementViewer(
- name2);
- synchronized (stringReplacementViewList) {
- stringReplacementViewList.add(newViewer);
- addStringReplacementViewer(StringReplacementPanel.this, inputEditPanel,
- newViewer, elementLabels);
- inputEditPanel.revalidate();
- inputEditPanel.repaint();
- }
-
- }
-
- });
-
- JPanel buttonPanel = new JPanel();
- buttonPanel.setLayout(new BorderLayout());
-
- buttonPanel.add(addInputPortButton, BorderLayout.EAST);
-
- this.add(buttonPanel, BorderLayout.SOUTH);
- }
-
- private void addStringReplacementViewer(final JPanel outerPanel,
- final JPanel innerPanel, final ExternalToolStringReplacementViewer viewer, String[] elementLabels) {
- Tools.addViewer(innerPanel,
- elementLabels,
- new JComponent[] {viewer.getNameField(), viewer.getValueFromField(), viewer.getValueField()},
- stringReplacementViewList,
- viewer,
- outerPanel);
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/e48c3199/src/main/java/net/sf/taverna/t2/activities/externaltool/views/ToolXMLPanel.java
----------------------------------------------------------------------
diff --git a/src/main/java/net/sf/taverna/t2/activities/externaltool/views/ToolXMLPanel.java b/src/main/java/net/sf/taverna/t2/activities/externaltool/views/ToolXMLPanel.java
deleted file mode 100644
index b49211f..0000000
--- a/src/main/java/net/sf/taverna/t2/activities/externaltool/views/ToolXMLPanel.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.activities.externaltool.views;
-
-import java.awt.BorderLayout;
-
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-
-import net.sf.taverna.t2.renderers.impl.XMLTree;
-
-import de.uni_luebeck.inb.knowarc.usecases.UseCaseDescription;
-
-/**
- * @author alanrw
- *
- */
-public class ToolXMLPanel extends JPanel {
-
- public ToolXMLPanel(UseCaseDescription useCaseDescription) {
- super(new BorderLayout());
- XMLTree xmlTree = new XMLTree(useCaseDescription.writeToXMLElement());
- this.add(new JScrollPane(xmlTree), BorderLayout.CENTER);
- }
-
- public void regenerateTree(UseCaseDescription useCaseDescription) {
- this.removeAll();
- XMLTree xmlTree = new XMLTree(useCaseDescription.writeToXMLElement());
- this.add(new JScrollPane(xmlTree), BorderLayout.CENTER);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/e48c3199/src/main/resources/META-INF/services/net.sf.taverna.t2.activities.externaltool.manager.InvocationMechanismEditor
----------------------------------------------------------------------
diff --git a/src/main/resources/META-INF/services/net.sf.taverna.t2.activities.externaltool.manager.InvocationMechanismEditor b/src/main/resources/META-INF/services/net.sf.taverna.t2.activities.externaltool.manager.InvocationMechanismEditor
deleted file mode 100644
index 9307977..0000000
--- a/src/main/resources/META-INF/services/net.sf.taverna.t2.activities.externaltool.manager.InvocationMechanismEditor
+++ /dev/null
@@ -1,2 +0,0 @@
-net.sf.taverna.t2.activities.externaltool.manager.local.LocalInvocationMechanismEditor
-net.sf.taverna.t2.activities.externaltool.manager.ssh.SshInvocationMechanismEditor
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/e48c3199/src/main/resources/META-INF/services/net.sf.taverna.t2.servicedescriptions.ServiceDescriptionProvider
----------------------------------------------------------------------
diff --git a/src/main/resources/META-INF/services/net.sf.taverna.t2.servicedescriptions.ServiceDescriptionProvider b/src/main/resources/META-INF/services/net.sf.taverna.t2.servicedescriptions.ServiceDescriptionProvider
deleted file mode 100644
index e94cf6e..0000000
--- a/src/main/resources/META-INF/services/net.sf.taverna.t2.servicedescriptions.ServiceDescriptionProvider
+++ /dev/null
@@ -1,2 +0,0 @@
-net.sf.taverna.t2.activities.externaltool.servicedescriptions.ExternalToolServiceProvider
-net.sf.taverna.t2.activities.externaltool.servicedescriptions.ExternalToolTemplateServiceDescription
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/e48c3199/src/main/resources/META-INF/services/net.sf.taverna.t2.ui.menu.MenuComponent
----------------------------------------------------------------------
diff --git a/src/main/resources/META-INF/services/net.sf.taverna.t2.ui.menu.MenuComponent b/src/main/resources/META-INF/services/net.sf.taverna.t2.ui.menu.MenuComponent
deleted file mode 100644
index db316f2..0000000
--- a/src/main/resources/META-INF/services/net.sf.taverna.t2.ui.menu.MenuComponent
+++ /dev/null
@@ -1,4 +0,0 @@
-net.sf.taverna.t2.activities.externaltool.menu.ConfigureExternalToolMenuAction
-# net.sf.taverna.t2.activities.externaltool.menu.FeedbackMenuAction
-net.sf.taverna.t2.activities.externaltool.menu.AddExternalToolContextualMenuAction
-net.sf.taverna.t2.activities.externaltool.menu.AddExternalToolMenuAction
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/e48c3199/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.ShutdownSPI
----------------------------------------------------------------------
diff --git a/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.ShutdownSPI b/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.ShutdownSPI
deleted file mode 100644
index e6686a0..0000000
--- a/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.ShutdownSPI
+++ /dev/null
@@ -1 +0,0 @@
-net.sf.taverna.t2.activities.externaltool.manager.InvocationGroupManagerShutdownHook
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/e48c3199/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.StartupSPI
----------------------------------------------------------------------
diff --git a/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.StartupSPI b/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.StartupSPI
deleted file mode 100644
index 0dd97e4..0000000
--- a/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.StartupSPI
+++ /dev/null
@@ -1 +0,0 @@
-net.sf.taverna.t2.activities.externaltool.manager.InvocationGroupManagerStartupHook
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/e48c3199/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.activityicons.ActivityIconSPI
----------------------------------------------------------------------
diff --git a/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.activityicons.ActivityIconSPI b/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.activityicons.ActivityIconSPI
deleted file mode 100644
index cdafd5d..0000000
--- a/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.activityicons.ActivityIconSPI
+++ /dev/null
@@ -1 +0,0 @@
-net.sf.taverna.t2.activities.externaltool.servicedescriptions.ExternalToolActivityIcon
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/e48c3199/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.configuration.ConfigurationUIFactory
----------------------------------------------------------------------
diff --git a/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.configuration.ConfigurationUIFactory b/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.configuration.ConfigurationUIFactory
deleted file mode 100644
index b3d1525..0000000
--- a/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.configuration.ConfigurationUIFactory
+++ /dev/null
@@ -1 +0,0 @@
-net.sf.taverna.t2.activities.externaltool.manager.ToolInvocationConfigurationUIFactory
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/e48c3199/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory
----------------------------------------------------------------------
diff --git a/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory b/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory
deleted file mode 100644
index ca0d30f..0000000
--- a/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory
+++ /dev/null
@@ -1 +0,0 @@
-net.sf.taverna.t2.activities.externaltool.views.ExternalToolActivityViewFactory
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/e48c3199/src/main/resources/META-INF/spring/external-tool-activity-ui-context-osgi.xml
----------------------------------------------------------------------
diff --git a/src/main/resources/META-INF/spring/external-tool-activity-ui-context-osgi.xml b/src/main/resources/META-INF/spring/external-tool-activity-ui-context-osgi.xml
deleted file mode 100644
index 3d7110c..0000000
--- a/src/main/resources/META-INF/spring/external-tool-activity-ui-context-osgi.xml
+++ /dev/null
@@ -1,39 +0,0 @@
-<?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="ToolInvocationConfigurationUIFactory" interface="uk.org.taverna.configuration.ConfigurationUIFactory" />
-
- <service ref="InvocationGroupManagerStartupHook" interface="net.sf.taverna.t2.workbench.StartupSPI" />
-
- <service ref="ExternalToolActivityIcon" interface="net.sf.taverna.t2.workbench.activityicons.ActivityIconSPI" />
-
- <service ref="LocalInvocationMechanismEditor" interface="net.sf.taverna.t2.activities.externaltool.manager.InvocationMechanismEditor" />
- <service ref="SshInvocationMechanismEditor" interface="net.sf.taverna.t2.activities.externaltool.manager.InvocationMechanismEditor" />
-
- <service ref="ExternalToolServiceProvider" interface="net.sf.taverna.t2.servicedescriptions.ServiceDescriptionProvider" />
- <service ref="ExternalToolTemplateServiceDescription" interface="net.sf.taverna.t2.servicedescriptions.ServiceDescriptionProvider" />
-
- <service ref="ConfigureExternalToolMenuAction" auto-export="interfaces" />
- <service ref="AddExternalToolContextualMenuAction" auto-export="interfaces" />
- <service ref="AddExternalToolMenuAction" auto-export="interfaces" />
-
- <service ref="InvocationGroupManagerShutdownHook" interface="net.sf.taverna.t2.workbench.ShutdownSPI" />
-
- <service ref="ExternalToolActivityViewFactory" interface="net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory" />
-
- <list id="mechanismCreators" interface="net.sf.taverna.t2.activities.externaltool.manager.MechanismCreator" cardinality="0..N" />
- <list id="invocationMechanismEditors" interface="net.sf.taverna.t2.activities.externaltool.manager.InvocationMechanismEditor" cardinality="0..N" />
-
- <reference id="editManager" interface="net.sf.taverna.t2.workbench.edits.EditManager" />
- <reference id="fileManager" interface="net.sf.taverna.t2.workbench.file.FileManager" />
- <reference id="menuManager" interface="net.sf.taverna.t2.ui.menu.MenuManager" />
- <reference id="selectionManager" interface="net.sf.taverna.t2.workbench.selection.SelectionManager" />
- <reference id="activityIconManager" interface="net.sf.taverna.t2.workbench.activityicons.ActivityIconManager" />
- <reference id="colourManager" interface="net.sf.taverna.t2.workbench.configuration.colour.ColourManager" />
-
-</beans:beans>
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/e48c3199/src/main/resources/META-INF/spring/external-tool-activity-ui-context.xml
----------------------------------------------------------------------
diff --git a/src/main/resources/META-INF/spring/external-tool-activity-ui-context.xml b/src/main/resources/META-INF/spring/external-tool-activity-ui-context.xml
deleted file mode 100644
index 7cf7f63..0000000
--- a/src/main/resources/META-INF/spring/external-tool-activity-ui-context.xml
+++ /dev/null
@@ -1,50 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans.xsd">
-
- <bean id="ToolInvocationConfigurationUIFactory" class="net.sf.taverna.t2.activities.externaltool.manager.ToolInvocationConfigurationUIFactory">
- <property name="mechanismCreators" ref="mechanismCreators" />
- <property name="invocationMechanismEditors" ref="invocationMechanismEditors" />
- </bean>
-
- <bean id="InvocationGroupManagerStartupHook" class="net.sf.taverna.t2.activities.externaltool.manager.InvocationGroupManagerStartupHook" />
-
- <bean id="ExternalToolActivityIcon" class="net.sf.taverna.t2.activities.externaltool.servicedescriptions.ExternalToolActivityIcon">
- <property name="colourManager" ref="colourManager" />
- </bean>
-
- <bean id="LocalInvocationMechanismEditor" class="net.sf.taverna.t2.activities.externaltool.manager.local.LocalInvocationMechanismEditor" />
- <bean id="SshInvocationMechanismEditor" class="net.sf.taverna.t2.activities.externaltool.manager.ssh.SshInvocationMechanismEditor" />
-
- <bean id="ExternalToolServiceProvider" class="net.sf.taverna.t2.activities.externaltool.servicedescriptions.ExternalToolServiceProvider" />
- <bean id="ExternalToolTemplateServiceDescription" class="net.sf.taverna.t2.activities.externaltool.servicedescriptions.ExternalToolTemplateServiceDescription" />
-
- <bean id="ConfigureExternalToolMenuAction" class="net.sf.taverna.t2.activities.externaltool.menu.ConfigureExternalToolMenuAction">
- <property name="editManager" ref="editManager" />
- <property name="fileManager" ref="fileManager" />
- <property name="activityIconManager" ref="activityIconManager" />
- </bean>
- <bean id="AddExternalToolContextualMenuAction" class="net.sf.taverna.t2.activities.externaltool.menu.AddExternalToolContextualMenuAction">
- <property name="editManager" ref="editManager" />
- <property name="menuManager" ref="menuManager" />
- <property name="selectionManager" ref="selectionManager" />
- <property name="activityIconManager" ref="activityIconManager" />
- </bean>
- <bean id="AddExternalToolMenuAction" class="net.sf.taverna.t2.activities.externaltool.menu.AddExternalToolMenuAction">
- <property name="editManager" ref="editManager" />
- <property name="menuManager" ref="menuManager" />
- <property name="selectionManager" ref="selectionManager" />
- <property name="activityIconManager" ref="activityIconManager" />
- </bean>
-
- <bean id="InvocationGroupManagerShutdownHook" class="net.sf.taverna.t2.activities.externaltool.manager.InvocationGroupManagerShutdownHook" />
-
- <bean id="ExternalToolActivityViewFactory" class="net.sf.taverna.t2.activities.externaltool.views.ExternalToolActivityViewFactory">
- <property name="editManager" ref="editManager" />
- <property name="fileManager" ref="fileManager" />
- <property name="activityIconManager" ref="activityIconManager" />
- <property name="colourManager" ref="colourManager" />
- </bean>
-
-</beans>
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/e48c3199/src/main/resources/externaltool.png
----------------------------------------------------------------------
diff --git a/src/main/resources/externaltool.png b/src/main/resources/externaltool.png
deleted file mode 100644
index a9e84e6..0000000
Binary files a/src/main/resources/externaltool.png and /dev/null differ
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/e48c3199/taverna-external-tool-activity-ui/pom.xml
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity-ui/pom.xml b/taverna-external-tool-activity-ui/pom.xml
new file mode 100644
index 0000000..376cd5c
--- /dev/null
+++ b/taverna-external-tool-activity-ui/pom.xml
@@ -0,0 +1,108 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>net.sf.taverna</groupId>
+ <artifactId>taverna-parent</artifactId>
+ <version>3.0.1-SNAPSHOT</version>
+ </parent>
+ <groupId>net.sf.taverna.t2.ui-activities</groupId>
+ <artifactId>external-tool-activity-ui</artifactId>
+ <name>Taverna 2 ExternalTool Activity UI</name>
+ <dependencies>
+ <dependency>
+ <groupId>net.sf.taverna.t2.ui-api</groupId>
+ <artifactId>menu-api</artifactId>
+ <version>${t2.ui.api.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>net.sf.taverna.t2.ui-components</groupId>
+ <artifactId>graph-view</artifactId>
+ <version>${t2.ui.components.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>net.sf.taverna.t2.ui-api</groupId>
+ <artifactId>activity-icons-api</artifactId>
+ <version>${t2.ui.api.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>net.sf.taverna.t2.ui-api</groupId>
+ <artifactId>activity-palette-api</artifactId>
+ <version>${t2.ui.api.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>net.sf.taverna.t2.activities</groupId>
+ <artifactId>wsdl-activity</artifactId>
+ <version>${t2.activities.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>net.sf.taverna.t2.ui-impl</groupId>
+ <artifactId>contextual-views-impl</artifactId>
+ <version>${t2.ui.impl.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>net.sf.taverna.t2.ui-api</groupId>
+ <artifactId>contextual-views-api</artifactId>
+ <version>${t2.ui.api.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>net.sf.taverna.t2.ui-components</groupId>
+ <artifactId>workflow-view</artifactId>
+ <version>${t2.ui.components.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>net.sf.taverna.t2.ui-api</groupId>
+ <artifactId>activity-tools</artifactId>
+ <version>${t2.ui.api.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>net.sf.taverna.t2.ui-impl</groupId>
+ <artifactId>renderers-impl</artifactId>
+ <version>${t2.ui.impl.version}</version>
+ </dependency>
+
+ <!-- testing dependencies -->
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>${junit.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>net.sf.taverna.t2.ui-impl</groupId>
+ <artifactId>activity-palette-impl</artifactId>
+ <version>${t2.ui.impl.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <!-- function dependencies for invocation -->
+ <dependency>
+ <groupId>net.sf.taverna.t2.activities</groupId>
+ <artifactId>external-tool-activity</artifactId>
+ <version>${t2.activities.version}</version>
+ </dependency>
+
+ </dependencies>
+ <repositories>
+ <repository>
+ <releases />
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ <id>mygrid-repository</id>
+ <name>myGrid Repository</name>
+ <url>http://www.mygrid.org.uk/maven/repository</url>
+ </repository>
+ <repository>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ <snapshots />
+ <id>mygrid-snapshot-repository</id>
+ <name>myGrid Snapshot Repository</name>
+ <url>http://www.mygrid.org.uk/maven/snapshot-repository</url>
+ </repository>
+ </repositories>
+</project>
+
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/e48c3199/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/actions/ExternalToolActivityConfigureAction.java
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/actions/ExternalToolActivityConfigureAction.java b/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/actions/ExternalToolActivityConfigureAction.java
new file mode 100644
index 0000000..398ee7c
--- /dev/null
+++ b/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/actions/ExternalToolActivityConfigureAction.java
@@ -0,0 +1,83 @@
+/*******************************************************************************
+ * Copyright (C) 2009 Hajo Nils Krabbenhoeft, INB, University of Luebeck
+ * modified 2010 Hajo Nils Krabbenhoeft, spratpix GmbH & Co. KG
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ ******************************************************************************/
+
+package net.sf.taverna.t2.activities.externaltool.actions;
+
+import java.awt.Frame;
+import java.awt.event.ActionEvent;
+
+import javax.swing.Action;
+
+import net.sf.taverna.t2.activities.externaltool.ExternalToolActivity;
+import net.sf.taverna.t2.activities.externaltool.ExternalToolActivityConfigurationBean;
+import net.sf.taverna.t2.activities.externaltool.views.ExternalToolConfigView;
+import net.sf.taverna.t2.workbench.activityicons.ActivityIconManager;
+import net.sf.taverna.t2.workbench.edits.EditManager;
+import net.sf.taverna.t2.workbench.file.FileManager;
+import net.sf.taverna.t2.workbench.ui.actions.activity.ActivityConfigurationAction;
+import net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ActivityConfigurationDialog;
+
+/**
+ * This class implements an ActivityConfigurationAction to configure the ExternalToolActivity
+ * plugin. The configuration action is called "Configure UseCase invocation" and is implemented in
+ * the KnowARCConfigurationDialog inside the knowarc-usecases maven artifact.
+ *
+ * @author Hajo Nils Krabbenhoeft
+ */
+@SuppressWarnings("serial")
+public class ExternalToolActivityConfigureAction extends
+ ActivityConfigurationAction<ExternalToolActivity, ExternalToolActivityConfigurationBean> {
+
+ private final Frame owner;
+ private final EditManager editManager;
+ private final FileManager fileManager;
+
+ public ExternalToolActivityConfigureAction(ExternalToolActivity activity, Frame owner,
+ EditManager editManager, FileManager fileManager, ActivityIconManager activityIconManager) {
+ super(activity, activityIconManager);
+ this.editManager = editManager;
+ this.fileManager = fileManager;
+ putValue(Action.NAME, "Configure tool invocation");
+ this.owner = owner;
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ /*
+ * if (getActivity().getConfiguration() instanceof
+ * RegisteredExternalToolActivityConfigurationBean) { new KnowARCConfigurationDialog(owner,
+ * false, KnowARCConfigurationFactory.getConfiguration()).setVisible(true); } else
+ */{
+ ActivityConfigurationDialog currentDialog = ActivityConfigurationAction
+ .getDialog(getActivity());
+ if (currentDialog != null) {
+ currentDialog.toFront();
+ return;
+ }
+ final ExternalToolConfigView externalToolConfigView = new ExternalToolConfigView(
+ (ExternalToolActivity) getActivity());
+ final ActivityConfigurationDialog<ExternalToolActivity, ExternalToolActivityConfigurationBean> dialog = new ActivityConfigurationDialog<ExternalToolActivity, ExternalToolActivityConfigurationBean>(
+ getActivity(), externalToolConfigView, editManager, fileManager);
+
+ ActivityConfigurationAction.setDialog(getActivity(), dialog, fileManager);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/e48c3199/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/configuration/ToolInvocationConfiguration.java
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/configuration/ToolInvocationConfiguration.java b/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/configuration/ToolInvocationConfiguration.java
new file mode 100644
index 0000000..0877045
--- /dev/null
+++ b/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/configuration/ToolInvocationConfiguration.java
@@ -0,0 +1,57 @@
+/**
+ *
+ */
+package net.sf.taverna.t2.activities.externaltool.configuration;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import uk.org.taverna.configuration.AbstractConfigurable;
+
+
+/**
+ * @author alanrw
+ *
+ */
+public class ToolInvocationConfiguration extends AbstractConfigurable {
+
+ private static ToolInvocationConfiguration instance;
+
+ private Map<String, String> defaultPropertyMap;
+
+ public static ToolInvocationConfiguration getInstance() {
+ if (instance == null) {
+ instance = new ToolInvocationConfiguration();
+ }
+ return instance;
+ }
+
+ @Override
+ public String getCategory() {
+ return "general";
+ }
+
+ @Override
+ public Map<String, String> getDefaultPropertyMap() {
+ if (defaultPropertyMap == null) {
+ defaultPropertyMap = new HashMap<String, String>();
+ }
+ return defaultPropertyMap;
+ }
+
+ @Override
+ public String getDisplayName() {
+ return "Tool invocation";
+ }
+
+ @Override
+ public String getFilePrefix() {
+ return "ToolInvocation";
+ }
+
+ @Override
+ public String getUUID() {
+ return "B611F5C2-EB49-479E-B01A-7F3F56E6918A";
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/e48c3199/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/manager/GroupPanel.java
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/manager/GroupPanel.java b/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/manager/GroupPanel.java
new file mode 100644
index 0000000..8f62787
--- /dev/null
+++ b/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/manager/GroupPanel.java
@@ -0,0 +1,113 @@
+/*******************************************************************************
+ * Copyright (C) 2007 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ ******************************************************************************/
+package net.sf.taverna.t2.activities.externaltool.manager;
+
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.Insets;
+
+import javax.swing.JComboBox;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JTextField;
+import javax.swing.border.EmptyBorder;
+
+import net.sf.taverna.t2.activities.externaltool.manager.impl.InvocationGroupManagerImpl;
+
+/**
+ * UI for creating/editing dataflow input ports.
+ *
+ * @author David Withers
+ */
+public class GroupPanel extends JPanel {
+
+ private static final long serialVersionUID = 1L;
+
+ private JTextField groupNameField;
+
+ private JComboBox mechanismComboBox;
+
+ private static InvocationGroupManager manager = InvocationGroupManagerImpl.getInstance();
+
+ public GroupPanel(Object[] mechanisms) {
+ super(new GridBagLayout());
+
+ groupNameField = new JTextField();
+
+
+ setBorder(new EmptyBorder(10, 10, 10, 10));
+
+ GridBagConstraints constraints = new GridBagConstraints();
+
+ constraints.anchor = GridBagConstraints.WEST;
+ constraints.gridx = 0;
+ constraints.gridy = 0;
+ constraints.ipadx = 10;
+ add(new JLabel("Name:"), constraints);
+
+ constraints.gridx = 1;
+ constraints.gridwidth = 2;
+ constraints.ipadx = 0;
+ constraints.weightx = 1d;
+ constraints.fill = GridBagConstraints.HORIZONTAL;
+ add(groupNameField, constraints);
+
+ constraints.gridx = 0;
+ constraints.gridy = 1;
+ constraints.gridwidth = 1;
+ constraints.weightx = 0d;
+ constraints.fill = GridBagConstraints.NONE;
+ constraints.ipadx = 10;
+ constraints.insets = new Insets(10, 0, 0, 0);
+ add(new JLabel("Explicit location:"), constraints);
+
+ mechanismComboBox = new JComboBox(mechanisms);
+ mechanismComboBox.setSelectedItem(manager.getDefaultMechanism());
+
+ constraints.gridx = 1;
+ constraints.gridwidth = 2;
+ constraints.ipadx = 0;
+ add(mechanismComboBox, constraints);
+ }
+
+ /**
+ * Returns the portNameField.
+ *
+ * @return the portNameField
+ */
+ public JTextField getGroupNameField() {
+ return groupNameField;
+ }
+
+ /**
+ * Returns the group name.
+ *
+ * @return the group name
+ */
+ public String getGroupName() {
+ return groupNameField.getText();
+ }
+
+ public InvocationMechanism getSelectedMechanism() {
+ return (InvocationMechanism) mechanismComboBox.getSelectedItem();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/e48c3199/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/manager/InvocationGroupManagerShutdownHook.java
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/manager/InvocationGroupManagerShutdownHook.java b/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/manager/InvocationGroupManagerShutdownHook.java
new file mode 100644
index 0000000..3d54b26
--- /dev/null
+++ b/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/manager/InvocationGroupManagerShutdownHook.java
@@ -0,0 +1,34 @@
+/**
+ *
+ */
+package net.sf.taverna.t2.activities.externaltool.manager;
+
+import net.sf.taverna.t2.activities.externaltool.manager.impl.InvocationGroupManagerImpl;
+import net.sf.taverna.t2.workbench.ShutdownSPI;
+
+/**
+ * @author alanrw
+ *
+ */
+public class InvocationGroupManagerShutdownHook implements ShutdownSPI {
+
+ /* (non-Javadoc)
+ * @see net.sf.taverna.t2.workbench.ShutdownSPI#positionHint()
+ */
+ @Override
+ public int positionHint() {
+ return 710;
+ }
+
+ /* (non-Javadoc)
+ * @see net.sf.taverna.t2.workbench.ShutdownSPI#shutdown()
+ */
+ @Override
+ public boolean shutdown() {
+ InvocationGroupManager manager = InvocationGroupManagerImpl.getInstance();
+ manager.saveConfiguration();
+ manager.persistInvocations();
+ return true;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/e48c3199/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/manager/InvocationGroupManagerStartupHook.java
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/manager/InvocationGroupManagerStartupHook.java b/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/manager/InvocationGroupManagerStartupHook.java
new file mode 100644
index 0000000..43cf4df
--- /dev/null
+++ b/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/manager/InvocationGroupManagerStartupHook.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (C) 2010 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ ******************************************************************************/
+package net.sf.taverna.t2.activities.externaltool.manager;
+
+import net.sf.taverna.t2.activities.externaltool.manager.impl.InvocationGroupManagerImpl;
+import net.sf.taverna.t2.workbench.StartupSPI;
+
+/**
+ * Load previously saved workflow ids that were scheduled to be deleted before
+ * previous Taverna shutdown, and initiate deletion of them now.
+ *
+ * @see StoreRunIdsToDeleteLaterShutdownHook
+ * @see DatabaseCleanup
+ *
+ * @author Stian Soiland-Reyes
+ *
+ */
+public class InvocationGroupManagerStartupHook implements StartupSPI {
+
+ public int positionHint() {
+ return 900;
+ }
+
+ public boolean startup() {
+ InvocationGroupManagerImpl.getInstance().loadInvocations();
+ return true;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/e48c3199/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/manager/InvocationMechanismEditor.java
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/manager/InvocationMechanismEditor.java b/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/manager/InvocationMechanismEditor.java
new file mode 100644
index 0000000..495d22b
--- /dev/null
+++ b/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/manager/InvocationMechanismEditor.java
@@ -0,0 +1,28 @@
+/**
+ *
+ */
+package net.sf.taverna.t2.activities.externaltool.manager;
+
+import javax.swing.JPanel;
+
+/**
+ * @author alanrw
+ *
+ */
+public abstract class InvocationMechanismEditor<T extends InvocationMechanism> extends JPanel {
+
+ public abstract String getName();
+
+ public abstract boolean canShow(Class<?> c);
+
+ public abstract void show(T invocationMechanism);
+
+ public abstract T updateInvocationMechanism();
+
+ public abstract InvocationMechanism createMechanism(String mechanismName);
+
+ public boolean isSingleton() {
+ return false;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/e48c3199/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/manager/MechanismPanel.java
----------------------------------------------------------------------
diff --git a/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/manager/MechanismPanel.java b/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/manager/MechanismPanel.java
new file mode 100644
index 0000000..c068d56
--- /dev/null
+++ b/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/manager/MechanismPanel.java
@@ -0,0 +1,121 @@
+/*******************************************************************************
+ * Copyright (C) 2007 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ ******************************************************************************/
+package net.sf.taverna.t2.activities.externaltool.manager;
+
+import java.awt.Component;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.Insets;
+import java.util.List;
+
+import javax.swing.JComboBox;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JTextField;
+import javax.swing.border.EmptyBorder;
+
+/**
+ * UI for creating/editing dataflow input ports.
+ *
+ * @author David Withers
+ */
+public class MechanismPanel extends JPanel {
+
+ private static final long serialVersionUID = 1L;
+
+ private JTextField mechanismNameField;
+
+ private JComboBox mechanismTypeSelector;
+
+ public MechanismPanel(List<InvocationMechanismEditor<?>> invocationMechanismEditors) {
+ super(new GridBagLayout());
+
+ mechanismNameField = new JTextField();
+
+
+ setBorder(new EmptyBorder(10, 10, 10, 10));
+
+ GridBagConstraints constraints = new GridBagConstraints();
+
+ constraints.anchor = GridBagConstraints.WEST;
+ constraints.gridx = 0;
+ constraints.gridy = 0;
+ constraints.ipadx = 10;
+ add(new JLabel("Name:"), constraints);
+
+ constraints.gridx = 1;
+ constraints.gridwidth = 2;
+ constraints.ipadx = 0;
+ constraints.weightx = 1d;
+ constraints.fill = GridBagConstraints.HORIZONTAL;
+ add(mechanismNameField, constraints);
+
+ constraints.gridx = 0;
+ constraints.gridy = 1;
+ constraints.gridwidth = 1;
+ constraints.weightx = 0d;
+ constraints.fill = GridBagConstraints.NONE;
+ constraints.ipadx = 10;
+ constraints.insets = new Insets(10, 0, 0, 0);
+ add(new JLabel("Type:"), constraints);
+
+ mechanismTypeSelector = new JComboBox();
+ for (InvocationMechanismEditor<?> ime : invocationMechanismEditors) {
+ if (!ime.isSingleton()) {
+ mechanismTypeSelector.addItem(ime.getName());
+ }
+ }
+ constraints.gridx = 1;
+ constraints.gridwidth = 2;
+ constraints.ipadx = 0;
+ add(mechanismTypeSelector, constraints);
+
+
+ }
+
+ /**
+ * Returns the portNameField.
+ *
+ * @return the portNameField
+ */
+ public JTextField getMechanismNameField() {
+ return mechanismNameField;
+ }
+
+ /**
+ * Returns the port name.
+ *
+ * @return the port name
+ */
+ public String getMechanismName() {
+ return mechanismNameField.getText();
+ }
+
+ public String getMechanismTypeName() {
+ return (String) mechanismTypeSelector.getSelectedItem();
+ }
+
+ public Component getMechanismTypeSelector() {
+ return mechanismTypeSelector;
+ }
+
+
+}