Extending DDE – creating custom context menus

Part of my new LotusScript.doc release is of course finding ways to make it even easier to use and use the API that’s now supplied as part of LotusScript.doc. Central to all this is extending DDE to make LotusScript.doc accessible in a variety of ways. Today I’ll show you how to add context, i.e. right-click, menus to the DDE navigator on the left as you can see below.

Doing this is actually very easy and only comprises of an IViewActionDelegate (the code; implement org.eclipse.ui.IViewActionDelegate) and a entry in plugin.xml to indicate where to stick the action. In this case it’s an objectContribution to org.eclipse.ui.popupMenus:

<extension point="org.eclipse.ui.popupMenus">
   <objectContribution adaptable="true"
      id="com.lekkimworld.dde.navctxmenu.objectContribution"
      objectClass="org.eclipse.core.resources.IFile">
      <action
         class="com.lekkimworld.dde.navctxmenu.MyContextAction"
         enablesFor="2+"
         id="com.lekkimworld.dde.navctxmenu.action"
         label="DDE context stuff (select min. 2 design elements)"
         menubarPath="additions"
         style="push">
      </action>
   </objectContribution>
</extension>

The above should be pretty much self-explanatory.

The example code is available for download as an Eclipse project: com.lekkimworld.dde.navctxmenu.zip

One thought on “Extending DDE – creating custom context menus”

Comments are closed.