mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-19 04:51:24 +07:00
IDEA-122392 intention: "Create Local Var from instanceof Usage" does not format generated code
This commit is contained in:
@@ -206,6 +206,7 @@ public class CreateLocalVarFromInstanceofAction extends BaseIntentionAction {
|
||||
final PsiStatement statementInside = isNegated(instanceOfExpression) ? null : getExpressionStatementInside(file, editor, instanceOfExpression.getOperand());
|
||||
PsiDeclarationStatement decl = createLocalVariableDeclaration(instanceOfExpression, statementInside);
|
||||
if (decl == null) return;
|
||||
decl = (PsiDeclarationStatement)CodeStyleManager.getInstance(project).reformat(decl);
|
||||
decl = CodeInsightUtilCore.forcePsiPostprocessAndRestoreElement(decl);
|
||||
|
||||
PsiLocalVariable localVariable = (PsiLocalVariable)decl.getDeclaredElements()[0];
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
// "Insert '(IOException)o' declaration" "true"
|
||||
import java.io.IOException;
|
||||
|
||||
class C {
|
||||
void f(Object o) {
|
||||
if (o instanceof IOException) {
|
||||
IOException ioException = (IOException) o;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
// "Insert '(IOException)o' declaration" "true"
|
||||
import java.io.IOException;
|
||||
|
||||
class C {
|
||||
void f(Object o) {
|
||||
if (o instanceof IOException) {
|
||||
<caret>
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user