mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-05-06 05:10:22 +07:00
create var from instanceOf check: do not insert before previous line end-line comment
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -342,7 +342,11 @@ public class CreateLocalVarFromInstanceofAction extends BaseIntentionAction {
|
||||
anchorAfter = newBranch.getCodeBlock().getLBrace();
|
||||
}
|
||||
else {
|
||||
anchorAfter = ((PsiBlockStatement)thenBranch).getCodeBlock().getLBrace();
|
||||
final PsiJavaToken lBrace = ((PsiBlockStatement)thenBranch).getCodeBlock().getLBrace();
|
||||
if (lBrace != null) {
|
||||
final PsiElement nextSibling = PsiTreeUtil.skipSiblingsForward(lBrace, PsiWhiteSpace.class);
|
||||
anchorAfter = nextSibling instanceof PsiComment ? PsiTreeUtil.skipSiblingsForward(nextSibling, PsiComment.class) : lBrace;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
// "Insert '(String)o' declaration" "true"
|
||||
class C {
|
||||
void f(Object o, Object f) {
|
||||
if (o instanceof String) {//todo comment
|
||||
|
||||
String s = (String) o;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
// "Insert '(String)o' declaration" "true"
|
||||
class C {
|
||||
void f(Object o, Object f) {
|
||||
if (o instanceof String) {//todo comment
|
||||
<caret>
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user