Migration from obsolete ProgressIndicator
to coroutines and modern IntelliJ Platform API
#257
Labels
ProgressIndicator
to coroutines and modern IntelliJ Platform API
#257
Description
The current implementation of halting test generation involves checking the state of
ProgressIndicator
through the wrapping interfaceCustomProgressIndicator
. Such implementation is a bad practice since the API utilizingProgressIndicator
andProgressManager
's methods is considered obsolete.A better solution is to use Kotlin Coroutines within the IntelliJ Platform, which allows for a more manageable and robust cancellation implementation (via Coroutines cancellation).
The re-implementation will effectively allow us to reduce the interface
CustomProgressIndicator
to a mere view of the textual content of a UI indicator and avoid the use of the discouraged practice we have now. This task is addressed in another issue: #258.Some suggestions:
currentCoroutineContext().ensureActive()
will check that the coroutine is not cancelled and throw a CE is it is. Respectively, you can usecurrentCoroutineContext().isActive
to check whether it’s cancelled or not, but usually you just use the former function.runBlockingCancellable { ... }
to convert blocking code with progress indicators to coroutines.ProgressManager.run
you can just usewithBackgroundProgress
fuction.ProgressIndicator
’s javadoc please. It contains lots of links to various functions and knowledge base articles on how to work with progresses, coroutines, indicators, etc.Useful to read
ProgressManager.java
.Definition of Done
ProgressIndicator
andProgressManager
.ensureActive
and methods alike to halt the execution upon UI indicator cancellation.The text was updated successfully, but these errors were encountered: