}
private static void setupSdkAndDartium(final Module module, final DartProjectWizardData data) {
// similar to DartConfigurable.apply()
final ModifiableModelsProvider modifiableModelsProvider = ModifiableModelsProvider.SERVICE.getInstance();
if (DartSdkUtil.isDartSdkHome(data.dartSdkPath)) {
final LibraryTable.ModifiableModel libraryTableModifiableModel = modifiableModelsProvider.getLibraryTableModifiableModel();
final DartSdk sdk = DartSdk.findDartSdkAmongGlobalLibs(libraryTableModifiableModel.getLibraries());
final String dartSdkLibName;
if (sdk == null) {
dartSdkLibName = DartSdkGlobalLibUtil.createDartSdkGlobalLib(libraryTableModifiableModel, data.dartSdkPath);
}
else {
dartSdkLibName = sdk.getGlobalLibName();
if (!data.dartSdkPath.equals(sdk.getHomePath())) {
DartSdkGlobalLibUtil.updateDartSdkGlobalLib(libraryTableModifiableModel, dartSdkLibName, data.dartSdkPath);
}
}
final Library dartSdkGlobalLib = libraryTableModifiableModel.getLibraryByName(dartSdkLibName);
assert dartSdkGlobalLib != null;
if (libraryTableModifiableModel.isChanged()) {
libraryTableModifiableModel.commit();
}
// similar to DartSdkGlobalLibUtil.configureDependencyOnGlobalLib
final ModifiableRootModel moduleModifiableModel = modifiableModelsProvider.getModuleModifiableModel(module);
moduleModifiableModel.addLibraryEntry(dartSdkGlobalLib);
modifiableModelsProvider.commitModuleModifiableModel(moduleModifiableModel);
}
DartiumUtil.applyDartiumSettings(FileUtilRt.toSystemIndependentName(data.dartiumPath), data.dartiumSettings);
}