TreeJavaClassChooserDialog () { return new TreeJavaClassChooserDialog( KotlinBundle.message("title.choose.destination.object"), myProject, GlobalSearchScope.projectScope(myProject), aClass -> { if (!(aClass instanceof KtLightClassForSourceDeclaration)) return false; KtClassOrObject ktClassOrObject = ((KtLightClassForSourceDeclaration) aClass).getKotlinOrigin(); return ktClassOrObject instanceof KtObjectDeclaration && !((KtObjectDeclaration) ktClassOrObject).isObjectLiteral(); }, null, null, true ) { @Nullable @Override protected PsiClass getSelectedFromTreeUserObject(DefaultMutableTreeNode node) { PsiClass psiClass = super.getSelectedFromTreeUserObject(node); if (psiClass != null) return psiClass; Object userObject = node.getUserObject(); if (!(userObject instanceof KtClassOrObjectTreeNode)) return null; return LightClassUtilsKt.toLightClass(((KtClassOrObjectTreeNode) userObject).getValue()); } }; }