diff --git a/java/java-impl-refactorings/src/com/intellij/refactoring/introduceField/InplaceIntroduceConstantPopup.java b/java/java-impl-refactorings/src/com/intellij/refactoring/introduceField/InplaceIntroduceConstantPopup.java index dc1278e78b64..86e563cd2120 100644 --- a/java/java-impl-refactorings/src/com/intellij/refactoring/introduceField/InplaceIntroduceConstantPopup.java +++ b/java/java-impl-refactorings/src/com/intellij/refactoring/introduceField/InplaceIntroduceConstantPopup.java @@ -1,10 +1,11 @@ -// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. +// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.refactoring.introduceField; import com.intellij.codeInsight.TargetElementUtil; import com.intellij.java.refactoring.JavaRefactoringBundle; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.application.WriteAction; +import com.intellij.openapi.application.WriteIntentReadAction; import com.intellij.openapi.editor.Editor; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.Comparing; @@ -257,7 +258,9 @@ public class InplaceIntroduceConstantPopup extends AbstractInplaceIntroduceField myReplaceAllCb.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { - restartInplaceIntroduceTemplate(); + WriteIntentReadAction.run(() -> + restartInplaceIntroduceTemplate() + ); } });