@Nullable private static Sdk fixProjectSdk(@NotNull Project project) { final ProjectRootManagerEx projectRootMgr = ProjectRootManagerEx.getInstanceEx(project); Sdk selectedSdk = projectRootMgr.getProjectSdk(); if (selectedSdk == null || selectedSdk.getSdkType() != ErlangSdkType.getInstance()) { final Sdk moreSuitableSdk = ProjectJdkTable.getInstance().findMostRecentSdkOfType(ErlangSdkType.getInstance()); ApplicationManager.getApplication() .runWriteAction( new Runnable() { @Override public void run() { projectRootMgr.setProjectSdk(moreSuitableSdk); } }); return moreSuitableSdk; } return selectedSdk; }
private static void createMockSdk() { final Sdk mockSdk = ErlangSdkType.createMockSdk(MOCK_SDK_DIR); ApplicationManager.getApplication() .runWriteAction( new Runnable() { @Override public void run() { ProjectJdkTable.getInstance().addJdk(mockSdk); } }); }
@Override public ModuleWizardStep[] createWizardSteps( WizardContext wizardContext, final ErlangModuleBuilder moduleBuilder, ModulesProvider modulesProvider) { return new ModuleWizardStep[] { new ProjectJdkForModuleStep(wizardContext, ErlangSdkType.getInstance()) { public void updateDataModel() { super.updateDataModel(); moduleBuilder.setModuleJdk(getJdk()); } } }; }
@Override public boolean isSuitableSdkType(@NotNull SdkTypeId sdkType) { return sdkType == ErlangSdkType.getInstance(); }