Add a pop-up menu item
We can use a pop-up menu extension point to add pop-up menu items to the IBM MQ Explorer.
The following code extract is taken from the plugin.xml file, which we can find in the simple plugin, and shows a basic implementation of the pop-up 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>
We can add menu items by using the Eclipse Platform extension point org.eclipse.ui.popupMenus. The <visibility> attribute in the preceding extract contains the elements that control the conditions under which the pop-up 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.