mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[introduce parameter] IDEA-305980: revert all changes if refactoring is cancelled (including import)
GitOrigin-RevId: 2acb4c26809377fc307075fa23c008584b66de8b
This commit is contained in:
committed by
intellij-monorepo-bot
parent
788df0d982
commit
55fe01a84c
+6
-3
@@ -30,6 +30,7 @@ import com.intellij.psi.search.SearchScope;
|
||||
import com.intellij.psi.util.PsiUtil;
|
||||
import com.intellij.refactoring.JavaRefactoringSettings;
|
||||
import com.intellij.refactoring.RefactoringActionHandler;
|
||||
import com.intellij.refactoring.extractMethod.newImpl.inplace.EditorState;
|
||||
import com.intellij.refactoring.extractMethod.newImpl.inplace.InplaceExtractUtils;
|
||||
import com.intellij.refactoring.introduceVariable.IntroduceVariableBase;
|
||||
import com.intellij.refactoring.rename.inplace.TemplateInlayUtil;
|
||||
@@ -60,6 +61,7 @@ public final class InplaceIntroduceParameterPopup extends AbstractJavaInplaceInt
|
||||
|
||||
private final PsiMethod myOriginalMethod;
|
||||
private PsiMethod myCreatedDelegate;
|
||||
private final EditorState myEditorState;
|
||||
|
||||
private EditorCodePreview myEditorPreview;
|
||||
|
||||
@@ -82,6 +84,8 @@ public final class InplaceIntroduceParameterPopup extends AbstractJavaInplaceInt
|
||||
myMustBeFinal = mustBeFinal;
|
||||
myReplaceChoice = replaceChoice;
|
||||
|
||||
myEditorState = new EditorState(editor);
|
||||
|
||||
myPanel = new InplaceIntroduceParameterUI(project, localVar, expr, method, parametersToRemove, typeSelectorManager,
|
||||
myOccurrences) {
|
||||
@Override
|
||||
@@ -294,9 +298,8 @@ public final class InplaceIntroduceParameterPopup extends AbstractJavaInplaceInt
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void restoreState(@NotNull PsiVariable psiField) {
|
||||
super.restoreState(psiField);
|
||||
removeDelegate();
|
||||
protected void performCleanup() {
|
||||
myEditorState.revert();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
class Test {
|
||||
void simpleMethod() {
|
||||
boolean <caret>bb;
|
||||
boolean b<caret>b;
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
class Test {
|
||||
void simpleMethod() {
|
||||
System.out.println(<caret>"");
|
||||
System.out.println("<caret>");
|
||||
System.out.println("");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
class Test {
|
||||
void simpleMethod() {
|
||||
System.out.println("Collections.emptyList()".co<caret>dePoints());
|
||||
}
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
class Test {
|
||||
void simpleMethod() {
|
||||
System.out.println("Collections.emptyList()".codePoints());
|
||||
}
|
||||
}
|
||||
+4
@@ -122,6 +122,10 @@ public class InplaceIntroduceParameterTest extends AbstractJavaInplaceIntroduceT
|
||||
doTestEscape();
|
||||
}
|
||||
|
||||
public void testRevertImports(){
|
||||
doTestEscape();
|
||||
}
|
||||
|
||||
public void testExtractParamOverLocal() {
|
||||
doTest(null);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user