Sdk (Sdk sdk) { if (sdk == null) return null; ProjectJdkTable jdkTable = ProjectJdkTable.getInstance(); final Sdk foundJdk = jdkTable.findJdk(sdk.getName()); if (foundJdk != null) return sdk; ThrowableRunnable<RuntimeException> addSdk = () -> { jdkTable.addJdk(sdk, myFixture.getProjectDisposable()); }; if (ApplicationManager.getApplication().isWriteAccessAllowed()) { addSdk.run(); } else { WriteAction.run(addSdk); } return sdk; }