mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
inplace introducer: another case to restore expression (IDEA-113352)
This commit is contained in:
+3
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user