How to extend Notes 8: using the other built in LiveText recognisers with Java actions

I get so many question on how to extend Notes 8 that I finally decided to create a series of blog posts on how to do it. All the posts in the series may be found under the extending_notes8 tag. In all of the examples I assume a working knowledge of Eclipse and Java programming and how to work with extension points.

This second post builds upon the “How to extend Notes 8: coupling LiveText to a Java action“-post posted earlier. Most of the post is the same but you’ll need to change the content type to act on. Read on.

My Notes 8.5 client comes with the follow built in recognizers:

Recognizer Content type
Phone number
Address content.address
Person content.person
Web site content.web

The trick is to couple our definitions in plugin.xml to the right content type. So to attach to a recognized web address you need to specify content.web as the content type as shown below:

<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
  <extension point="org.eclipse.ui.popupMenus">
             label="Do stuff with web address!">
             <objectState name="content.type" value="content.web" />
             <objectState name="contents" value="*" />

Now also change your action to extract the right property from the document. All the IBM recognizers stick the recognized text in the “contents” property so simply grab that. Some of the recognizers (person and address) also have some sub-parts you could extract but I find the recognizers so flaky that I haven’t invested much time in using them. I find the web and phone recognizers the only useful ones. Below is some sample code for the selectionChanged method.

public void selectionChanged(IAction action, ISelection selection) {
   IDocumentContent doc = null;

   // cast/adapt selection
   if (selection instanceof StructuredSelection) {
      Object sel = ((StructuredSelection)selection).getFirstElement();
      if (sel instanceof IDocumentContent) {
         doc = (IDocumentContent)sel;
   } else if (selection instanceof IDocumentContent) {
      doc = (IDocumentContent)selection;
   } else {
      // try and adapt
      IAdapterManager amgr = Platform.getAdapterManager();
      doc = (IDocumentContent)amgr.getAdapter(selection,
   if (null == doc) {
      this.selection = null;

   // get text from document property
   this.selection = doc.getProperties().getProperty("contents");