More write action requirement remove
Workaround for exception: Refactorings should not be started inside write action because they start progress inside and any read action from the progress task would cause the deadlock
This commit is contained in:
committed by
Nikolay Krasko
parent
98060d28a8
commit
eee9431a6d
@@ -42,6 +42,8 @@ class DeprecatedFunctionConventionFix(
|
|||||||
FilteredRenameProcessor(project, element, newName, false, false).run()
|
FilteredRenameProcessor(project, element, newName, false, false).run()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun startInWriteAction(): Boolean = false
|
||||||
|
|
||||||
companion object : KotlinSingleIntentionActionFactory() {
|
companion object : KotlinSingleIntentionActionFactory() {
|
||||||
override fun createAction(diagnostic: Diagnostic): IntentionAction? {
|
override fun createAction(diagnostic: Diagnostic): IntentionAction? {
|
||||||
val (functionDescriptor, newName) = when (diagnostic) {
|
val (functionDescriptor, newName) = when (diagnostic) {
|
||||||
|
|||||||
@@ -70,6 +70,8 @@ object InitializePropertyQuickFixFactory : KotlinIntentionActionsFactory() {
|
|||||||
override fun getText() = "Move to constructor parameters"
|
override fun getText() = "Move to constructor parameters"
|
||||||
override fun getFamilyName() = text
|
override fun getFamilyName() = text
|
||||||
|
|
||||||
|
override fun startInWriteAction(): Boolean = false
|
||||||
|
|
||||||
private fun configureChangeSignature(propertyDescriptor: PropertyDescriptor): KotlinChangeSignatureConfiguration {
|
private fun configureChangeSignature(propertyDescriptor: PropertyDescriptor): KotlinChangeSignatureConfiguration {
|
||||||
return object : KotlinChangeSignatureConfiguration {
|
return object : KotlinChangeSignatureConfiguration {
|
||||||
override fun configure(originalDescriptor: KotlinMethodDescriptor): KotlinMethodDescriptor {
|
override fun configure(originalDescriptor: KotlinMethodDescriptor): KotlinMethodDescriptor {
|
||||||
@@ -124,6 +126,8 @@ object InitializePropertyQuickFixFactory : KotlinIntentionActionsFactory() {
|
|||||||
override fun getText() = "Initialize with constructor parameter"
|
override fun getText() = "Initialize with constructor parameter"
|
||||||
override fun getFamilyName() = text
|
override fun getFamilyName() = text
|
||||||
|
|
||||||
|
override fun startInWriteAction(): Boolean = false
|
||||||
|
|
||||||
private fun configureChangeSignature(propertyDescriptor: PropertyDescriptor): KotlinChangeSignatureConfiguration {
|
private fun configureChangeSignature(propertyDescriptor: PropertyDescriptor): KotlinChangeSignatureConfiguration {
|
||||||
return object : KotlinChangeSignatureConfiguration {
|
return object : KotlinChangeSignatureConfiguration {
|
||||||
override fun configure(originalDescriptor: KotlinMethodDescriptor): KotlinMethodDescriptor {
|
override fun configure(originalDescriptor: KotlinMethodDescriptor): KotlinMethodDescriptor {
|
||||||
|
|||||||
+2
@@ -35,6 +35,8 @@ class RenameParameterToMatchOverriddenMethodFix(
|
|||||||
|
|
||||||
override fun getText() = "Rename parameter to match overridden method"
|
override fun getText() = "Rename parameter to match overridden method"
|
||||||
|
|
||||||
|
override fun startInWriteAction(): Boolean = false
|
||||||
|
|
||||||
public override fun invoke(project: Project, editor: Editor?, file: KtFile) {
|
public override fun invoke(project: Project, editor: Editor?, file: KtFile) {
|
||||||
RenameProcessor(project, parameter, newName, false, false).run()
|
RenameProcessor(project, parameter, newName, false, false).run()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,6 +29,8 @@ import org.jetbrains.kotlin.psi.KtFile
|
|||||||
import org.jetbrains.kotlin.psi.psiUtil.getNonStrictParentOfType
|
import org.jetbrains.kotlin.psi.psiUtil.getNonStrictParentOfType
|
||||||
|
|
||||||
class RenameUnderscoreFix(declaration: KtDeclaration) : KotlinQuickFixAction<KtDeclaration>(declaration) {
|
class RenameUnderscoreFix(declaration: KtDeclaration) : KotlinQuickFixAction<KtDeclaration>(declaration) {
|
||||||
|
override fun startInWriteAction(): Boolean = false
|
||||||
|
|
||||||
override fun invoke(project: Project, editor: Editor?, file: KtFile) {
|
override fun invoke(project: Project, editor: Editor?, file: KtFile) {
|
||||||
if (editor == null) return
|
if (editor == null) return
|
||||||
val dataContext = DataManager.getInstance().getDataContext(editor.component)
|
val dataContext = DataManager.getInstance().getDataContext(editor.component)
|
||||||
|
|||||||
Reference in New Issue
Block a user