2
using System.Collections.Generic;
5
using System.Windows.Forms;
6
using TextEditorSWF.ExtensionModel;
9
namespace TextEditorSWF
12
/// Manages commands, menus and toolbars
14
static class CommandManager
17
/// Returns the list of items for the main menu
19
public static IEnumerable<ToolStripItem> GetMainMenuItems ()
21
foreach (IUserInterfaceItem item in AddinManager.GetExtensionNodes ("/TextEditor/MainMenu"))
22
yield return item.CreateMenuItem ();
26
/// Returns the list of items for the main toolbar
28
public static IEnumerable<ToolStripItem> GetToolbarItems ()
30
foreach (IUserInterfaceItem item in AddinManager.GetExtensionNodes ("/TextEditor/Toolbar"))
31
yield return item.CreateButton ();
35
/// Returns the extension node for the provided command identifier.
37
internal static CommandExtensionNode GetCommand (string id)
39
foreach (CommandExtensionNode cmd in AddinManager.GetExtensionNodes (typeof (ICommand))) {
43
throw new InvalidOperationException ("Unknown command: " + id);