mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
EA-47443 - assert: CreateLocalFromUsageFix.getAnchor
This commit is contained in:
+4
-1
@@ -54,8 +54,11 @@ public class CreateLocalFromUsageFix extends CreateVarFromUsageFix {
|
||||
if (!super.isAvailableImpl(offset)) return false;
|
||||
if(myReferenceExpression.isQualified()) return false;
|
||||
PsiElement scope = PsiTreeUtil.getParentOfType(myReferenceExpression, PsiModifierListOwner.class);
|
||||
if (scope instanceof PsiAnonymousClass) {
|
||||
scope = PsiTreeUtil.getParentOfType(scope, PsiModifierListOwner.class, true);
|
||||
}
|
||||
return scope instanceof PsiMethod || scope instanceof PsiClassInitializer ||
|
||||
scope instanceof PsiLocalVariable || scope instanceof PsiAnonymousClass;
|
||||
scope instanceof PsiLocalVariable;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// "Create Local Variable 'zeit'" "true"
|
||||
public class A {
|
||||
{
|
||||
Object zeit;
|
||||
Runnable r = new Runnable(zeit) {};
|
||||
}
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
// "Create Local Variable 'zeit'" "true"
|
||||
public class A {
|
||||
{
|
||||
Runnable r = new Runnable(ze<caret>it) {};
|
||||
}
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
// "Create Local Variable 'zeit'" "false"
|
||||
public class A {
|
||||
Runnable r = new Runnable(ze<caret>it) {};
|
||||
}
|
||||
Reference in New Issue
Block a user