Execute action without writeActionPriority in tests
This commit is contained in:
@@ -41,16 +41,20 @@ fun <T : Any> runInReadActionWithWriteActionPriorityWithPCE(f: () -> T): T {
|
|||||||
|
|
||||||
fun <T : Any> runInReadActionWithWriteActionPriority(f: () -> T): T? {
|
fun <T : Any> runInReadActionWithWriteActionPriority(f: () -> T): T? {
|
||||||
var r: T? = null
|
var r: T? = null
|
||||||
val complete = ProgressIndicatorUtils.runInReadActionWithWriteActionPriority {
|
if (!with(ApplicationManager.getApplication()) { isDispatchThread && isUnitTestMode }) {
|
||||||
|
val complete = ProgressIndicatorUtils.runInReadActionWithWriteActionPriority {
|
||||||
|
r = f()
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!complete) return null
|
||||||
|
}
|
||||||
|
else {
|
||||||
r = f()
|
r = f()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!complete) return null
|
|
||||||
return r
|
return r
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
fun <T : Any> Project.runSynchronouslyWithProgress(progressTitle: String, canBeCanceled: Boolean, action: () -> T): T? {
|
fun <T : Any> Project.runSynchronouslyWithProgress(progressTitle: String, canBeCanceled: Boolean, action: () -> T): T? {
|
||||||
var result: T? = null
|
var result: T? = null
|
||||||
ProgressManager.getInstance().runProcessWithProgressSynchronously({ result = action() }, progressTitle, canBeCanceled, this)
|
ProgressManager.getInstance().runProcessWithProgressSynchronously({ result = action() }, progressTitle, canBeCanceled, this)
|
||||||
|
|||||||
Reference in New Issue
Block a user