void (final JTextField textField, String title, String dimensionServiceKey, Function<? super String, ? extends List<String>> parser, final Function<? super List<String>, String> lineJoiner) { if (isApplicationInUnitTestOrHeadless()) { TestDialogManager.getTestImplementation().show(title); return; } final JTextArea textArea = new JTextArea(10, 50); SwingUndoUtil.addUndoRedoActions(textArea); textArea.setWrapStyleWord(true); textArea.setLineWrap(true); List<String> lines = parser.fun(textField.getText()); textArea.setText(StringUtil.join(lines, "\n")); InsertPathAction.copyFromTo(textField, textArea); final DialogBuilder builder = new DialogBuilder(textField); builder.setDimensionServiceKey(dimensionServiceKey); builder.setCenterPanel(ScrollPaneFactory.createScrollPane(textArea)); builder.setPreferredFocusComponent(textArea); String rawText = title; if (StringUtil.endsWithChar(rawText, ':')) { rawText = rawText.substring(0, rawText.length() - 1); } builder.setTitle(rawText); builder.addOkAction(); builder.addCancelAction(); builder.setOkOperation(() -> { textField.setText(lineJoiner.fun(Arrays.asList(StringUtil.splitByLines(textArea.getText())))); builder.getDialogWrapper().close(DialogWrapper.OK_EXIT_CODE); }); builder.show(); }