boolean (final PsiElement element, final Project project, final DataContext dataContext, final PsiReference reference, final Editor editor) { if (element instanceof PsiAnonymousClass anonymousClass && element.getParent() instanceof PsiNewExpression) { new AnonymousToInnerHandler().invoke(project, editor, anonymousClass); return true; } if (element instanceof PsiClass localClass && PsiUtil.isLocalClass(localClass)) { new AnonymousToInnerHandler().invoke(project, editor, localClass); return true; } return false; }