in robot-server-core/src/main/kotlin/com/intellij/remoterobot/services/IdeRobot.kt [120:135]
fun findAll(containerId: String, lambdaContainer: ObjectContainer): Result<List<RemoteComponent>> {
val lambda = lambdaLoader.getFunction(lambdaContainer) as RobotContext.(c: Component) -> Boolean
val component = componentContextCache[containerId]?.component
?: throw IllegalStateException("Unknown component id $containerId")
if (component is Container) {
return getResult(RobotContext(robot)) { ctx ->
robot.finder()
.findAll(component) { ctx.lambda(it) }
.map { component ->
val id = addComponentToStorage(component)
RemoteComponent(id, component)
}
}
} else throw IllegalStateException("Component is not a container")
}