boolean (final IComponent component, final ComponentVisitor visitor) { final boolean shouldContinue; try { shouldContinue = visitor.visit(component); } catch (ProcessCanceledException ex) { return false; } if (!shouldContinue) { return false; } if (!(component instanceof IContainer container)) { return true; } for (int i = 0; i < container.getComponentCount(); i++) { final IComponent c = container.getComponent(i); if (!iterateImpl(c, visitor)) { return false; } } return true; }