Fix PyCharm perf tests with "setSdk: sdk is not registered in ProjectJdkTable"

GitOrigin-RevId: 0e2cd067a6836d9b3f30760c5f6aa59ef04761b9
This commit is contained in:
Elena Shaverdova
2023-02-28 16:07:38 +00:00
committed by intellij-monorepo-bot
parent a4097f78f9
commit 2a399e98ca
@@ -63,21 +63,20 @@ public final class PySdkTools {
ref.set(sdk);
});
final Sdk sdk = ref.get();
if (sdk != null) {
ApplicationManager.getApplication().invokeAndWait(() -> SdkConfigurationUtil.addSdk(sdk));
if (parentDisposable != null) {
Disposer.register(parentDisposable, () -> WriteAction.runAndWait(() -> ProjectJdkTable.getInstance().removeJdk(sdk)));
}
}
if (sdkCreationType != SdkCreationType.EMPTY_SDK) {
try {
if (sdk != null && parentDisposable != null) {
Disposer.register(parentDisposable, () -> WriteAction.runAndWait(() -> ProjectJdkTable.getInstance().removeJdk(sdk)));
}
generateTempSkeletonsOrPackages(sdk, sdkCreationType == SdkCreationType.SDK_PACKAGES_AND_SKELETONS, module);
}
catch (ExecutionException e) {
throw new InvalidSdkException("Can't generate skeleton packages", e);
}
}
//do not register sdk twice
if (module == null || sdkCreationType == SdkCreationType.EMPTY_SDK) {
ApplicationManager.getApplication().invokeAndWait(() -> SdkConfigurationUtil.addSdk(sdk));
}
return sdk;
}