private void AddCommandsToMenu(GenericElementAdderMenu menu, IList <IElementAdderMenuCommand <TContext> > commands)
{
if (commands.Count == 0)
{
return;
}
if (!menu.IsEmpty)
{
menu.AddSeparator();
}
foreach (var command in commands)
{
if (_elementAdder != null && command.CanExecute(_elementAdder))
{
menu.AddItem(command.Content, () => command.Execute(_elementAdder));
}
else
{
menu.AddDisabledItem(command.Content);
}
}
}