Home

 

Add context menu item

 

A context menu extension point is used to add context menu items to the WebSphere MQ Explorer.

The following code extract is taken from the file, plugin.xml, from the simple plug-in and shows a basic implementation of the context menu extension point:

<extension
   id="com.ibm.mq.explorer.sample.simple.object1"
   name="Object1"
   point="org.eclipse.ui.popupMenus">
 <objectContribution
    objectClass="com.ibm.mq.explorer.ui.extensions.MQExtObject"
    id="com.ibm.mq.explorer.sample.simple.obj1">
  <visibility>
   <and>
    <pluginState
      value="activated"
      id="com.ibm.mq.explorer.ui">
    </pluginState>
    <objectClass
      name="com.ibm.mq.explorer.ui.extensions.MQExtObject">
    </objectClass>
    <objectState
      name="PluginEnabled"
      value="com.ibm.mq.explorer.sample.simple">
    </objectState>
   </and>
  </visibility>
  <action
    label="Simple: Sample action on any MQExtObject"
    class="com.ibm.mq.explorer.sample.simple.MenuActions"
    menubarPath="additions"
    id="com.ibm.mq.explorer.sample.simple.obj.action1">
  </action>
 </objectContribution>
</extension>

Additional context menu items are added using the Eclipse extension point org.eclipse.ui.popupMenus. The <visibility> attribute in the above extract contains the elements that control the conditions under which the context menu item is displayed. These conditions include tests on the plug-in state, the type of object, and the state of the object. For example, a content menu item can be displayed for local queues only, or for remote queue managers only.

 

Parent topic:

Utilizing extension points


fa12400_


 

Home