Adding a dynamic global button to the Notes toolbar

Last week I posted an update to the Mail Rule Utilities on OpenNTF.  The primary change, as I wrote about, was to move the icon to the global toolbar in Notes.  I not only did this but I also put a condition in the logic to only be visible when certain views have focus.  One can argue if this was or was not the right thing to do in this specific case but I figure I would play around a little.  You can get the source files right from the release download on the OpenNTF site for reference.  A big advantage to moving to an Eclipse based product is adding stuff like this to the product is easy and common across all Eclipse products.  The two extensions used are basic Eclipse extensions that Lotus Notes inherits for free.

You start by declaring your action set using the org.eclipse.ui.actionSets extension in the plugin.xml:

<extension
 point="org.eclipse.ui.actionSets">
     <actionSet
         id="com.ibm.notes.mail.utils.actionSet"
         label="Mail Tools">
     <menu
         id="RunMailRules"
         label="Run Mail Rules">
     </menu>
    <action

         icon="icons/mailrules.gif"
         id="com.ibm.notes.mail.utils.actions.RunMailRules"
         label="&amp;Run Mail Rules"
         toolbarPath="actions/additions"
         tooltip="Run Mail Rules"
         menubarpath="actions/additions"/>
     </actionSet>
 </extension>

You then need to associate it with a view part using the org.eclipse.ui.actionSetPartAssociations extension:

<extension point="org.eclipse.ui.actionSetPartAssociations">
     <actionSetPartAssociation targetID="com.ibm.notes.mail.utils.actionSet">
         <part id="com.ibm.rcp.csiviews.viewpart.CSIViewPart" />
         <part id="com.ibm.rcp.csiviews.viewpart.CSINavViewPart"/>
         <part id="com.ibm.workplace.noteswc.views.NotesViewData"/>

     </actionSetPartAssociation>
</extension>