Create extendable PopupMenu for an SWT Component via EMenuService [message #1220010] |
Mon, 09 December 2013 07:19 |
Ludwig Moser Messages: 476 Registered: July 2009 |
Senior Member |
|
|
Hello,
i'm trying to add a (Popup)Menu for an SWT component (NatTable).
it should be possible to add an menu item to it via extensions.
afaik i have to create a menu via EMenuService and register an SWT component with an given ID (then the service should create the menu and return it to me)
here is the code i use:
Quote:Create a menu for this control and hook it up with the MPopupMenu.
does it mean it creates the menu itself or must it already exist?
e4popupMenu = menuService.registerContextMenu(natTable, menuId);
i checked for nullpointers:
menuService is not null
natTable is not null
menuId is not null
but the resulting e4popupMenu is null
can anyone explain me why this happens?
before i switched to e4 i did it with MenuManager, and this worked fine :-/
i was even able to gain direct access to an Menu (no more possible as i get an MPopupMenu? or can i get from this one to my 'classic' Menu)
[Updated on: Mon, 09 December 2013 07:25] Report message to a moderator
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Re: Create extendable PopupMenu for an SWT Component via EMenuService [message #1220318 is a reply to message #1220209] |
Wed, 11 December 2013 06:22 |
Ludwig Moser Messages: 476 Registered: July 2009 |
Senior Member |
|
|
i am on the compatibility layer because i was not able to do everything needed in pure E4 (due bugs, which are already reported in bugzilla)
so some things are from e3 code.
i got a PojoListView
public class PojoListView extends E4TableViewPartTemplate<Site> {
public static final String ID = "xxx.views.site.listview".intern(); //$NON-NLS-1$
@Inject
public PojoListView(Composite parent, EMenuService menuService) {
// all needed swt code here...
}
}
and the E4-version of it:
public class E4ListView extends DIViewPart<PojoListView> {
public E4ListView() {
super(PojoListView.class);
}
}
so i need to do getSite() from the E4ListView and pass the site() to super.getcomponent() etc...?
[Updated on: Wed, 11 December 2013 06:44] Report message to a moderator
|
|
|
Powered by
FUDForum. Page generated in 0.05199 seconds