Drawing Hands by M.C. Escher (1948)

Jeff Mesnil


Hook when hovering on a menu item in Eclipse

On March 21st, 2006 in eclipse

I’m trying to display a message in Eclipse global status bar when hovering on a menu item.

I had the part to display the message (but I’m pretty sure it’s the ugliest way I could have found):

    if (window instanceof ApplicationWindow) {
        ApplicationWindow appWindow = (ApplicationWindow)window;
        appWindow.setStatus(message);
    }

But I can’t find how to run that code when hovering on a menu item. I’ve got the complete control on the menu and its items creation but I don’t see where I can plug my code so that it is executed when hovering on a item of my menu.

The reason I need that code is that I’d like to display a description of a Eclipse Monkey script when hovering on a menu item in the Monkey menu (see bug #132601 for a description of this enhancement).

If anyone has an idea, I’d appreciate.

2 Responses to “Hook when hovering on a menu item in Eclipse”

  1. Benjamin Says:

    Hi Jeff,

    did you try adding an ArmListener to the MenuItem?

    Ben

  2. jmesnil Says:

    Thanks Ben, I didn’t know about that ArmListener.

    However, it works on a SWT MenuItem and for now the code I deal with is only about JFace Action and IContributionItem.
    I just need to find now how I can get the SWT MenuItem widget corresponding to a JFace ActionContributionItem so that I can set an ArmListener on it and I should be done.