void (@NotNull String path, @NotNull final Consumer<? super String> dirConsumer, final Project project, @Nullable final Component component) { FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor() .withTitle(message("dialog.title.select.configuration.directory")) .withDescription(message("dialog.description.select.configuration.directory")) .withShowFileSystemRoots(true) .withHideIgnored(false) .withShowHiddenFiles(true); path = "file://" + path.replace(File.separatorChar, '/'); VirtualFile root = VirtualFileManager.getInstance().findFileByUrl(path); VirtualFile file = FileChooser.chooseFile(descriptor, component, project, root); if (file == null) { return; } final String resultPath = file.getPath().replace('/', File.separatorChar); dirConsumer.consume(resultPath); }