Extensible Context Menu Support
From KDevelop
Proposal for improving context menu support in KDevelop4
[edit] Current Situation
Context menu requests are handled by the individual view/editor widgets, however they shall only ask the plugin controller for actions and labels that are to be included in the context menu. Then each plugin may provide a list of actions and a label for the context menu. The list of actions varies on the type of Context object passed in. The label will be used to create a submenu in the context menu, which then contains all the entries from action list.
[edit] Drawbacks
- Context menu gets many possibly uneeded submenus
- plugin cannot properly divide its actions into different submenus
[edit] New Idea for Improvement
The requestContextMenuActions() function shall return a description of how various actions should be integrated into a context menu. That description uses well known identifiers to indicate which actions should be included in which place in the context menu. The view on which the context menu was requested by the user will still ask the plugin controller for contributed actions from all other plugins, including the plugin it was created by. Then it will create a context menu with (possibly only some) the various well known identifiers in apropriate places and submenu-structures. It then adds the list of actions that the plugincontroller provided as needed to the context menu according to the specified identifiers.