use of com.intellij.openapi.projectRoots.impl.JavaAwareProjectJdkTableImpl in project intellij-community by JetBrains.
the class CompilerTestUtil method enableExternalCompiler.
@TestOnly
public static void enableExternalCompiler() {
final JavaAwareProjectJdkTableImpl table = JavaAwareProjectJdkTableImpl.getInstanceEx();
new WriteAction() {
@Override
protected void run(@NotNull final Result result) {
table.addJdk(table.getInternalJdk());
}
}.execute();
}
use of com.intellij.openapi.projectRoots.impl.JavaAwareProjectJdkTableImpl in project intellij-community by JetBrains.
the class CompilerTestUtil method disableExternalCompiler.
@TestOnly
public static void disableExternalCompiler(@NotNull final Project project) {
EdtTestUtil.runInEdtAndWait(() -> {
final JavaAwareProjectJdkTableImpl table = JavaAwareProjectJdkTableImpl.getInstanceEx();
ApplicationManager.getApplication().runWriteAction(() -> {
Sdk internalJdk = table.getInternalJdk();
List<Module> modulesToRestore = new SmartList<>();
for (Module module : ModuleManager.getInstance(project).getModules()) {
Sdk sdk = ModuleRootManager.getInstance(module).getSdk();
if (sdk != null && sdk.equals(internalJdk)) {
modulesToRestore.add(module);
}
}
table.removeJdk(internalJdk);
for (Module module : modulesToRestore) {
ModuleRootModificationUtil.setModuleSdk(module, internalJdk);
}
BuildManager.getInstance().clearState(project);
});
});
}
Aggregations