eclipseeclipse-plugineclipse-rcpnattable

Open context when there is no rows in the body region


In my Nattable, I implemented context menu for body region and it is working fine. but if there is no row available in the body region context menu is not appearing.

How to make context menu appear even when there is no rows in the body region.

Code I used:

 uiBindingRegistry.registerMouseDownBinding(MouseEventMatcher.bodyRightClick(SWT.NONE), new PopupMenuAction(bodyMenu));

Thanks in Advance.


Solution

  • Well, if there are no rows in the body region, you actually do not have a body region. Therefore you can't use the NatTable context menu functionality to open a context menu on the empty area. Actually that empty area is not even a body in NatTable terms, it is the area of the Canvas. That said, the only way to get a context menu on the empty area below the header is to configure a popup menu the SWT way.