ContextMenu in custom tree does not handle Action events

Hi all,

I am using a custom Tree component that is backed by a custom HierarchicalContainer. I’ve added an ActionHandler to the Tree using:

tree.addActionHandler(new CustomActionHandler());

Code for the CustomActionHandler class looks like:

       public Action[] getActions(Object target, Object sender) {
            log.debug("target = " + target);
            log.debug("sender = " + sender);
            return new Action[]{ACTION_DELETE, ACTION_TOGGLE};
        }

        public void handleAction(Action action, Object sender, Object target) {
            log.debug("target = " + target);
            log.debug("sender = " + sender);
            getWindow().showNotification("Action : "+action.getCaption());

            if(target != null)
            {

                if(action == ACTION_TOGGLE)
                {
                    log.debug("Toggled status");
                    // toggle status of target
                }
                else if(action == ACTION_DELETE)
                {
                    // get parent from tree and remove item
                    log.debug("Deleted expression");
                }
            }
        }

The tree displays the context menu when I click on its nodes, but clicking the Actions in the context menu does not seem to fire the action. So the ‘handleAction’ method is never called (log statements are not displayed). Note that in getActions method call, the target is not null, but the sender seems to be null. Not sure if this is could be the issue…

Can anyone here think of what I might be doing wrong?

Thanks,
J