inplace introducer: another case to restore expression (IDEA-113352)

This commit is contained in:
anna
2013-09-24 19:53:47 +02:00
parent 603e13885a
commit 27b76b477a
4 changed files with 36 additions and 0 deletions
@@ -158,6 +158,9 @@ public abstract class AbstractJavaInplaceIntroducer extends AbstractInplaceIntro
}
if (parent instanceof PsiExpression) {
expression = (PsiExpression)parent;
if (expression.getText().equals(exprText)) {
return expression;
}
} else {
return null;
}
@@ -0,0 +1,12 @@
class C {
static enum E {
A
}
void x(String s1, String s2) {}
private void y() {
x(E.A.toString(), E.<caret>A.toString());
}
}
@@ -0,0 +1,12 @@
class C {
static enum E {
A
}
void x(String s1, String s2) {}
private void y(E a) {
x(a.toString(), a.toString());
}
}
@@ -59,6 +59,15 @@ public class InplaceIntroduceParameterTest extends AbstractJavaInplaceIntroduceT
});
}
public void testReplaceAll3() throws Exception {
doTest(new Pass<AbstractInplaceIntroducer>() {
@Override
public void pass(AbstractInplaceIntroducer inplaceIntroduceFieldPopup) {
inplaceIntroduceFieldPopup.setReplaceAllOccurrences(true);
}
});
}
public void testReplaceAllMethodCalls() throws Exception {
doTest(new Pass<AbstractInplaceIntroducer>() {
@Override