|
|
Re: Adding a context menu in NatTable Eclipse 3 RCP Application [message #1693058 is a reply to message #1693034] |
Tue, 21 April 2015 13:24 |
Ines El Euch Messages: 35 Registered: March 2015 |
Member |
|
|
Hello,
First of all thanks for your reply . Second of all, I am using the latest version of nattable wich is 1.3.0. As for the debug configuration, I created a class extending the AbstractUiBindingConfiguration.
For further information here is my code
This is the class that extends AbstractUiBindingConfiguration
public class DebugMenuConfiguration extends AbstractUiBindingConfiguration {
private final Menu debugMenu;
private final NatTable natTable;
@Override
public void configureUiBindings(UiBindingRegistry uiBindingRegistry) {
uiBindingRegistry.registerMouseDownBinding(new MouseEventMatcher(SWT.NONE, GridRegion.BODY, MouseEventMatcher.RIGHT_BUTTON), new PopupMenuAction(this.debugMenu));
}
public DebugMenuConfiguration(NatTable natTable,MenuManager mgr) {
// extend the declarative menu provided by the MenuManager
this.natTable = natTable;
this.debugMenu = new PopupMenuBuilder(this.natTable,mgr)
.withInspectLabelsMenuItem()
.build();
}
}
Then I call it in the nattable.addConfiguration() like so :
nattable.addConfiguration(new DebugMenuConfiguration(nattable,mgr)); // nattable is the instance of NatTable that I am working with
Then in my view in I instanciate the MenuManager :
public void createPartControl(Composite parent) {
MenuManager mgr = new MenuManager();
getSite().registerContextMenu("nattableContextMenu",mgr,null);
Finally, nattableContextMenu is declared under org.eclipse.ui.menus like so :
popup:nattableContextMenu => the I created a command under it, I gave it a label, an id and a command.
I hope now my question si more clear.
Thanks for your help.
Inès
[Updated on: Tue, 21 April 2015 13:30] Report message to a moderator
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04310 seconds