Sdk (@NotNull String name, @NotNull String type, @NotNull String home) { Ref<Sdk> sdkRef = new Ref<>(); ApplicationManager.getApplication().invokeAndWait(() -> { WriteAction.run(() -> { Sdk sdk = setup(name, type, home); sdkRef.set(sdk); }); }); return sdkRef.get(); }