org.jlense.uiworks.popupMenusThe org.jlense.uiworks.popupMenus extension point allows a plug-in to contribute to the popup menus of other views. You can contribute an action to a specific popup menu by its id (viewerContribution), or by associating it with a particular object type (objectContribution).
For example, the org.jlense.uiworks plugin defines two object contributions that can contribute items to the popup menus (a.k.a. "context" menus) of all other contributed views. Let's take a look at those object contributions.
<extension point="org.jlense.uiworks.popupMenus">
<objectContribution objectClass="org.jlense.uiworks.action.IOpenable" >
<action
id="org.jlense.uiworks.open.selection"
menubarPath="new.ext"
definitionID="org.jlense.uiworks.open.selection"
label="&Open@Ctrl+O"
tooltip="Open the selected item(s)"
helpContextId="org.jlense.uiworks.open.selection"
icon="icons/full/ctool16/open.gif"
class="org.jlense.uiworks.action.OpenSelectedActionDelegate"
enablesFor="+">
</action>
</objectContribution>
<objectContribution objectClass="org.jlense.uiworks.action.IDeleteable" >
<action
id="org.jlense.uiworks.delete"
menubarPath="cut.ext"
definitionID="org.jlense.uiworks.delete.selection"
label="&Delete@Ctrl+D"
tooltip="Delete the selected item(s)"
helpContextId="org.jlense.uiworks.delete"
icon="icons/full/ctool16/deleteable.gif"
class="org.jlense.uiworks.action.DeleteActionDelegate"
enablesFor="+">
</action>
</objectContribution>
</extension>
Object contributionThe action "Open" is contributed for the object class IOpenable. This means that any view containing IOpenable objects will show the contribution to the popup menu if any IOpenable objects are selected. When the Open menu item on the popup menu is selected, the workbench will run the selected object, that is, it will call the IOpenable.open method on selected object. |