org.jlense.uiworks.popupMenus

The 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).

  • An objectContribution will cause the menu item to appear in popup menus for views where objects of the specified type are selected.
  • A viewerContribution will cause the menu item to appear in the popup menu of a view specified by id in the markup.

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 contribution

The 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.