Best way to order menu items injected by an IoC/plugin Framework
Posted
by Daver
on Stack Overflow
See other posts from Stack Overflow
or by Daver
Published on 2010-01-14T14:31:15Z
Indexed on
2010/05/19
9:20 UTC
Read the original article
Hit count: 258
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)
© Stack Overflow or respective owner