void (@Nullable final Project project, Sdk @NotNull [] existingSdks, @NotNull NullableConsumer<? super Sdk> onSdkCreatedCallBack, final boolean createIfExists, SdkType @NotNull ... sdkTypes) { if (sdkTypes.length == 0) { onSdkCreatedCallBack.consume(null); return; } FileChooserDescriptor descriptor = createCompositeDescriptor(sdkTypes); VirtualFile suggestedDir = getSuggestedSdkRoot(sdkTypes[0]); FileChooser.chooseFiles(descriptor, project, suggestedDir, new FileChooser.FileChooserConsumer() { @Override public void consume(List<VirtualFile> selectedFiles) { for (SdkType sdkType : sdkTypes) { final String path = selectedFiles.get(0).getPath(); if (sdkType.isValidSdkHome(path)) { Sdk newSdk = null; if (!createIfExists) { for (Sdk sdk : existingSdks) { if (path.equals(sdk.getHomePath())) { newSdk = sdk; break; } } } if (newSdk == null) { newSdk = setupSdk(existingSdks, selectedFiles.get(0), sdkType, false, null, null); } onSdkCreatedCallBack.consume(newSdk); return; } } onSdkCreatedCallBack.consume(null); } @Override public void cancelled() { onSdkCreatedCallBack.consume(null); } }); }