/** * Returns the main commands from this {@link Iterable} (that is, the ones that are enabled and not a * {@link UIWizardStep} instance) */ public static Iterable<UICommand> getEnabledCommands(Iterable<UICommand> commands, UIContext context) { List<UICommand> result = new LinkedList<>(); for (UICommand uiCommand : commands) { try { if (isEnabled(uiCommand, context)) { result.add(uiCommand); } } catch (Exception e) { log.log(Level.SEVERE, "Could not call method " + UICommand.class.getName() + "`isEnabled(UIContext ctx)` of type [" + uiCommand + "] with Metadata [" + getMetadata(uiCommand, context) + "].", e); } } return result; }