private JButton editLocationButton()

in taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/manager/ToolInvocationConfigurationPanel.java [329:367]


	private JButton editLocationButton() {
		final JButton result = new DeselectingButton("Edit", new AbstractAction() {

			@Override
			public void actionPerformed(ActionEvent e) {
				if (isShowingGroups()) {
					InvocationGroup toEdit = (InvocationGroup) locationList.getSelectedValue();
					if (toEdit != null) {
						InvocationMechanism chosenMechanism = (InvocationMechanism) JOptionPane
								.showInputDialog(ToolInvocationConfigurationPanel.this,
										"Select an explicit location", "Edit symbolic location",
										JOptionPane.PLAIN_MESSAGE, null,
										mechanismListModel.toArray(), toEdit.getMechanism());
						if (chosenMechanism != null) {
							toEdit.setMechanism(chosenMechanism);
							manager.groupChanged(toEdit);
						}
					}
				} else {
					InvocationMechanism toEdit = (InvocationMechanism) locationList
							.getSelectedValue();
					if (toEdit != null) {
						InvocationMechanismEditor ime = findEditor(toEdit.getClass());
						ime.show(toEdit);
						ime.setPreferredSize(new Dimension(550, 500));
						int answer = JOptionPane.showConfirmDialog(
								ToolInvocationConfigurationPanel.this, ime,
								"Edit explicit location", JOptionPane.OK_CANCEL_OPTION,
								JOptionPane.PLAIN_MESSAGE, null);
						if (answer == JOptionPane.OK_OPTION) {
							ime.updateInvocationMechanism();
							manager.mechanismChanged(toEdit);
						}
					}
				}
			}
		});
		return result;
	}