Best way to order menu items injected by an IoC/plugin Framework
- by Daver
One of the common things I've seen done in applications built on IoC/plugin frameworks is to add commands to menus or toolbars from the dynamically loaded plugins. For example, the application's default plugins supply actions like "New, Open, Save" that show up in the context menu for a certain item in the workspace. A new plugin may add "Mail, Post, Encrypt" commands, but where do those commands show up in relation to "New, Open, Save"?
How can the application that is loading components through IoC impose order on the items that get injected?
Does it require metadata from the plugins that give a hint on how to group or order the items?
Does it use a config file of previously known menu names (or ids) to define the order (seems a little weak to me)?
Or are "unknown" plugins treated as second class citizens and always get dumped into sub menus?
Something I've never even imagined (which I'm hoping to see in the answers)