mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-08-26 03:13:40 +07:00
IDEA-105132 Swap adjoined if-statements intention. Invokes on "else" keyword
This commit is contained in:
+16
@@ -0,0 +1,16 @@
|
||||
// "Swap If Statements" "true"
|
||||
class A {
|
||||
|
||||
void m() {
|
||||
|
||||
if (otherCondition) {
|
||||
doAnotherAction();
|
||||
} else if (someCondition) {
|
||||
doSomeAction();
|
||||
} else {
|
||||
defaultAction();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
// "Swap If Statements" "true"
|
||||
class A {
|
||||
|
||||
void m() {
|
||||
|
||||
if (a) {
|
||||
System.out.println(1);
|
||||
} else if (c) {
|
||||
System.out.println(3);
|
||||
} else if (b) {
|
||||
System.out.println(2);
|
||||
} else if (d) {
|
||||
System.out.println(4);
|
||||
} else {
|
||||
System.out.println(5);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
// "Swap If Statements" "true"
|
||||
class A {
|
||||
|
||||
void m() {
|
||||
|
||||
if (cond2) m2();
|
||||
else if (cond1) m1();
|
||||
else if (cond3) m3();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
// "Swap If Statements" "true"
|
||||
class A {
|
||||
|
||||
void m() {
|
||||
|
||||
if (someCondition) {
|
||||
doSomeAction();
|
||||
} e<caret>lse if (otherCondition) {
|
||||
doAnotherAction();
|
||||
} else {
|
||||
defaultAction();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
// "Swap If Statements" "true"
|
||||
class A {
|
||||
|
||||
void m() {
|
||||
|
||||
if (a) {
|
||||
System.out.println(1);
|
||||
} else if (b) {
|
||||
System.out.println(2);
|
||||
} el<caret>se if (c) {
|
||||
System.out.println(3);
|
||||
} else if (d) {
|
||||
System.out.println(4);
|
||||
} else {
|
||||
System.out.println(5);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
// "Swap If Statements" "false"
|
||||
class A {
|
||||
void m() {
|
||||
if (someCondition) {
|
||||
doSomeAction();
|
||||
} e<caret>lse {
|
||||
defaultAction();
|
||||
}
|
||||
}
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
// "Swap If Statements" "true"
|
||||
class A {
|
||||
|
||||
void m() {
|
||||
|
||||
if (cond1) m1();
|
||||
el<caret>se if (cond2) m2();
|
||||
else if (cond3) m3();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user