Fix intention descriptions and templates

This commit is contained in:
Alexey Sedunov
2013-04-15 16:24:39 +04:00
parent 2f00097b2a
commit 9e441b0525
7 changed files with 28 additions and 46 deletions
@@ -1,11 +1,7 @@
public class MyClass {
public fun f(a: Int): String {
var res: String
res = if (a == 1) "one";
else if (a == 2) "two";
else "too many";
return res;
}
res = if (n == 1) {
println("***")
"one"
} else {
println("***")
"two"
}
@@ -1,11 +1,7 @@
public class MyClass {
public fun f(a: Int): String {
var res: String
if (a == 1) res = "one";
else if (a == 2) res = "two";
else res = "too many";
return res;
}
if (n == 1) {
println("***")
res = "one"
} else {
println("***")
res = "two"
}
@@ -1,6 +1,6 @@
<html>
<body>
This intention converts 'if' statement where each branch is terminated with assignment to the same variable
into single assignment with 'if' expression
This intention converts branched (if/when) expression where each branch is terminated with assignment/return/method call into single
assignment/return/method call with branched expression as argument
</body>
</html>
@@ -1,11 +1,7 @@
public class MyClass {
public fun f(a: Int): String {
var res: String
if (a == 1) res = "one";
else if (a == 2) res = "two";
else res = "too many";
return res;
}
if (n == 1) {
println("***")
res = "one"
} else {
println("***")
res = "two"
}
@@ -1,11 +1,7 @@
public class MyClass {
public fun f(a: Int): String {
var res: String
res = if (a == 1) "one";
else if (a == 2) "two";
else "too many";
return res;
}
res = if (n == 1) {
println("***")
"one"
} else {
println("***")
"two"
}
@@ -1,6 +1,6 @@
<html>
<body>
This intention converts assignment with 'if' expression as right-hand side
into 'if' statement where each branch is terminated with assignment to the original variable
This intention converts assignment/return/method call with branched (if/when) expression as argument
to branched expression where each branch is terminated with assignment/return/method call
</body>
</html>
@@ -21,13 +21,11 @@ import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.project.Project;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.util.IncorrectOperationException;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.jet.lang.psi.JetElement;
import org.jetbrains.jet.lang.psi.JetExpression;
import org.jetbrains.jet.lang.psi.JetIfExpression;
import org.jetbrains.jet.lang.psi.JetPsiUtil;
import org.jetbrains.jet.plugin.JetBundle;