mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
create class from usage: enable inside new expr args (IDEA-66193)
This commit is contained in:
+2
-1
@@ -52,7 +52,8 @@ public class DefaultQuickFixProvider extends UnresolvedReferenceQuickFixProvider
|
||||
registrar.register(new CreateClassFromUsageFix(ref, CreateClassKind.ENUM));
|
||||
}
|
||||
PsiElement parent = PsiTreeUtil.getParentOfType(ref, PsiNewExpression.class, PsiMethod.class);
|
||||
if (parent instanceof PsiNewExpression && !(ref.getParent() instanceof PsiTypeElement)) {
|
||||
final PsiExpressionList expressionList = PsiTreeUtil.getParentOfType(ref, PsiExpressionList.class);
|
||||
if (parent instanceof PsiNewExpression && !(ref.getParent() instanceof PsiTypeElement) && (expressionList == null || !PsiTreeUtil.isAncestor(parent, expressionList, false))) {
|
||||
registrar.register(new CreateClassFromNewFix((PsiNewExpression)parent));
|
||||
registrar.register(new CreateInnerClassFromNewFix((PsiNewExpression)parent));
|
||||
}
|
||||
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
// "Create Class 'Foo'" "true"
|
||||
public class Test {
|
||||
void foo() {
|
||||
new Test(Foo.FIELD);
|
||||
}
|
||||
}
|
||||
|
||||
public class Foo {
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
// "Create Class 'Foo'" "true"
|
||||
public class Test {
|
||||
void foo() {
|
||||
new Test(F<caret>oo.FIELD);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user