void (@NotNull final SdkType sdkType, @Nullable Component component, @NotNull final Consumer<? super String> consumer) { if (selectSdkHomeForTests(sdkType, consumer)) return; final FileChooserDescriptor descriptor = sdkType.getHomeChooserDescriptor(); Future<VirtualFile> sdkRootFuture = PooledThreadExecutor.INSTANCE.submit(() -> getSuggestedSdkRoot(sdkType)); VirtualFile suggestedSdkRoot = null; try { suggestedSdkRoot = sdkRootFuture.get(200, TimeUnit.MILLISECONDS); } catch (InterruptedException | ExecutionException | TimeoutException ignored) {} // passing project instance here seems to be the right idea, but it would make the dialog // selecting the last opened project path, instead of the suggested detected JDK home (one of many). // The behaviour may also depend on the FileChooser implementations which does not reuse that code FileChooser.chooseFiles(descriptor, null, component, suggestedSdkRoot, chosen -> { final String path = chosen.get(0).getPath(); consumer.consume(path); }); }