PsiClass (UExpression result) { PsiClass panelClass = null; if (result instanceof UObjectLiteralExpression) { panelClass = ((UObjectLiteralExpression)result).getDeclaration().getJavaPsi(); } else if (result instanceof UCallExpression call) { if (call.getKind() == UastCallKind.CONSTRUCTOR_CALL) { UReferenceExpression ref = call.getClassReference(); if (ref != null) { panelClass = ObjectUtils.tryCast(ref.resolve(), PsiClass.class); } } } return panelClass; }