entity.MapForms.MapForm.UpdatePluginsMenu C# (CSharp) Method

UpdatePluginsMenu() public method

Gets relevant plugins from plugin manager and loads them into the menu
public UpdatePluginsMenu ( ) : void
return void
        public void UpdatePluginsMenu()
        {
            // clear menu
            pluginsToolStripMenuItem.DropDownItems.Clear();

            // get selected tag type if there is a selected tag, so
            // we can show plugins for this type
            string curTagType = null;
            if (map.SelectedMeta != null)
            {
                curTagType = map.SelectedMeta.type;
            }

            // iterate plugins in plugin manager
            for (int i = 0; i < plugins.Plugin.Count; i++)
            {
                // if plugin is of type (any) or matches the selected tag, add it to the menu
                if (plugins.Plugin[i].tagtype == "*.*" || plugins.Plugin[i].tagtype == "!*.*" ||
                    plugins.Plugin[i].tagtype == curTagType)
                {
                    // create menu item and set text to plugin name
                    ToolStripMenuItem menuItem = new ToolStripMenuItem(plugins.Plugin[i].GetName());

                    // give item a click event method
                    menuItem.Click += pluginToolStripMenuItemdescription_Click;

                    // add
                    pluginsToolStripMenuItem.DropDownItems.Add(menuItem);
                }
            }
            if (pluginsToolStripMenuItem.DropDownItems.Count == 0)
                pluginsToolStripMenuItem.Enabled = false;
            else
                pluginsToolStripMenuItem.Enabled = false;
        }
MapForm