mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
fix "getting service from write-action" warns in compiler tests
This commit is contained in:
@@ -79,23 +79,23 @@ public class CompilerTestUtil {
|
||||
}
|
||||
|
||||
public static void enableExternalCompiler() {
|
||||
ApplicationManagerEx.getApplicationEx().doNotSave(false);
|
||||
final JavaAwareProjectJdkTableImpl table = JavaAwareProjectJdkTableImpl.getInstanceEx();
|
||||
new WriteAction() {
|
||||
@Override
|
||||
protected void run(@NotNull final Result result) {
|
||||
ApplicationManagerEx.getApplicationEx().doNotSave(false);
|
||||
JavaAwareProjectJdkTableImpl table = JavaAwareProjectJdkTableImpl.getInstanceEx();
|
||||
table.addJdk(table.getInternalJdk());
|
||||
}
|
||||
}.execute();
|
||||
}
|
||||
|
||||
public static void disableExternalCompiler(final Project project) {
|
||||
ApplicationManagerEx.getApplicationEx().doNotSave(true);
|
||||
final JavaAwareProjectJdkTableImpl table = JavaAwareProjectJdkTableImpl.getInstanceEx();
|
||||
new WriteAction() {
|
||||
@Override
|
||||
protected void run(@NotNull final Result result) {
|
||||
ApplicationManagerEx.getApplicationEx().doNotSave(true);
|
||||
Module[] modules = ModuleManager.getInstance(project).getModules();
|
||||
JavaAwareProjectJdkTableImpl table = JavaAwareProjectJdkTableImpl.getInstanceEx();
|
||||
Sdk internalJdk = table.getInternalJdk();
|
||||
List<Module> modulesToRestore = new ArrayList<Module>();
|
||||
for (Module module : modules) {
|
||||
|
||||
@@ -69,12 +69,12 @@ public class CompilerTester {
|
||||
myMainOutput = new TempDirTestFixtureImpl();
|
||||
myMainOutput.setUp();
|
||||
|
||||
CompilerTestUtil.enableExternalCompiler();
|
||||
new WriteCommandAction(getProject()) {
|
||||
@Override
|
||||
protected void run(@NotNull Result result) throws Throwable {
|
||||
//noinspection ConstantConditions
|
||||
CompilerProjectExtension.getInstance(getProject()).setCompilerOutputUrl(myMainOutput.findOrCreateDir("out").getUrl());
|
||||
CompilerTestUtil.enableExternalCompiler();
|
||||
for (Module module : myModules) {
|
||||
ModuleRootModificationUtil.setModuleSdk(module, JavaAwareProjectJdkTableImpl.getInstanceEx().getInternalJdk());
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -299,10 +299,10 @@ public class PsiTestUtil {
|
||||
final String libName,
|
||||
final List<VirtualFile> classesRoots,
|
||||
final List<VirtualFile> sourceRoots) {
|
||||
final LibraryTable libraryTable = ProjectLibraryTable.getInstance(module.getProject());
|
||||
RunResult<Library> result = new WriteAction<Library>() {
|
||||
@Override
|
||||
protected void run(@NotNull Result<Library> result) throws Throwable {
|
||||
LibraryTable libraryTable = ProjectLibraryTable.getInstance(module.getProject());
|
||||
Library library = libraryTable.createLibrary(libName);
|
||||
Library.ModifiableModel libraryModel = library.getModifiableModel();
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user