@Override public void actionPerformed(ActionEvent e) { Set<String> usedOutputPorts = new HashSet<>(); for (OutputWorkflowPort usedOutputPort : dataflow.getOutputPorts()) if (!usedOutputPort.getName().equals(port.getName())) usedOutputPorts.add(usedOutputPort.getName()); DataflowOutputPortPanel inputPanel = new DataflowOutputPortPanel(); ValidatingUserInputDialog vuid = new ValidatingUserInputDialog("Edit Workflow Output Port", inputPanel); vuid.addTextComponentValidation( inputPanel.getPortNameField(), "Set the workflow output port name.", usedOutputPorts, "Duplicate workflow output port name.", "[\\p{L}\\p{Digit}_.]+", "Invalid workflow output port name."); vuid.setSize(new Dimension(400, 200)); inputPanel.setPortName(port.getName()); try { if (vuid.show(component)) changeOutputPort(inputPanel); } catch (EditException ex) { logger.debug("Rename workflow output port failed", ex); } }
private void changeOutputPort(DataflowOutputPortPanel inputPanel) throws EditException { editManager.doDataflowEdit( dataflow.getParent(), new RenameEdit<>(port, inputPanel.getPortName())); }