CommittableFieldPanel (final @NlsContexts.DialogTitle String title, final CommitPathRunnable commitPathRunnable) { final JTextField textField = new ExtendableTextField(); final FileChooserDescriptor outputPathsChooserDescriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor(); outputPathsChooserDescriptor.putUserData(LangDataKeys.MODULE_CONTEXT, getModel().getModule()); outputPathsChooserDescriptor.setHideIgnored(false); InsertPathAction.addTo(textField, outputPathsChooserDescriptor); FileChooserFactory.getInstance().installFileCompletion(textField, outputPathsChooserDescriptor, true, null); final Runnable commitRunnable = () -> { if (!getModel().isWritable()) { return; } final String path = textField.getText().trim(); if (path.length() == 0) { commitPathRunnable.saveUrl(null); } else { // should set only absolute paths String canonicalPath; try { canonicalPath = FileUtil.resolveShortWindowsName(path); } catch (IOException e) { canonicalPath = path; } commitPathRunnable.saveUrl(VfsUtilCore.pathToUrl(canonicalPath)); } }; final ActionListener listener = new ActionListener() { @Override public void actionPerformed(ActionEvent e) { commitRunnable.run(); } }; myPerModuleCompilerOutput.addActionListener(listener); textField.getDocument().addDocumentListener(new DocumentAdapter() { @Override protected void textChanged(@NotNull DocumentEvent e) { commitRunnable.run(); } }); return new CommittableFieldPanel(textField, new BrowseFilesListener(textField, title, "", outputPathsChooserDescriptor) { @Override public void actionPerformed(ActionEvent e) { super.actionPerformed(e); commitRunnable.run(); } }, null, commitRunnable); }