In part three of this tutorial we will be leveraging some APIs provided by Lotus Notes to change the behavior of our context menu.  We also take a quick look at how to debug your plugins for the Eclipse IDE.

If you are interested in learning more about the Notes Client Java UI APIs (com.ibm.notes.java.ui plugin from the video) please check out the API documentation on the wiki.  The Javadoc for the APIs are on the wiki, 8.5.1 and 8.5.2.

I also left the enablement/disablement of the context menu up to you.  You can find more information the org.eclipse.ui.menus extension point and the visiblewhen and enablement child elements here.  You will need to make sure the current element adapts to either a NotesUIDocument or NotesUIView.  Enablement can be tested in the visiblewhen and enablement child elements with the adapt element.

Lastley here is the updated code for our adapter class.

package com.acme.demo.helloworld;

import org.eclipse.core.commands.AbstractHandler;

import org.eclipse.core.commands.ExecutionEvent;

import org.eclipse.core.commands.ExecutionException;

import org.eclipse.swt.widgets.MessageBox;

import org.eclipse.ui.PlatformUI;

import com.ibm.notes.java.ui.NotesUIElement;

import com.ibm.notes.java.ui.NotesUIWorkspace;

public class HelloWorldHandler extends AbstractHandler {

private static final String MESSAGE = “Hello World “;

public Object execute(ExecutionEvent event) throws ExecutionException {

NotesUIWorkspace ws = new NotesUIWorkspace();

NotesUIElement element = ws.getCurrentElement();

if(element != null){

MessageBox messageBox = new MessageBox(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell());

messageBox.setMessage(“The title of the current element is: ” + element.getTitle());

messageBox.open();

}

return null;

}

}


Ryan J Baxter

Husband, Father, Software Engineer