IDEA-86117 boolean expressions: intentions and Unwrap/Remove description added

This commit is contained in:
Danila Ponomarenko
2012-06-13 17:56:37 +04:00
parent 520d5b8da2
commit aab6d25d2d
4 changed files with 17 additions and 3 deletions
@@ -19,15 +19,12 @@ import com.intellij.codeInsight.CodeInsightBundle;
import com.intellij.codeInsight.intention.PsiElementBaseIntentionAction;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.util.TextRange;
import com.intellij.psi.*;
import com.intellij.psi.codeStyle.CodeStyleManager;
import com.intellij.psi.impl.JavaFactoryProvider;
import com.intellij.psi.tree.IElementType;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.util.IncorrectOperationException;
import com.intellij.util.ObjectUtils;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -0,0 +1,7 @@
if (b && c) {
x = 1;
} else if (a) {
x = 1;
} else {
x = 2;
}
@@ -0,0 +1,5 @@
if (a || <spot>b && c</spot>) {
x = 1;
} else {
x = 2;
}
@@ -0,0 +1,5 @@
<html>
<body>
This intention extracts operand expression from If condition and creates new If statement with this expression as a condition, keeping the original control flow.
</body>
</html>