Can I register my context menu with a ViewPart?? [message #158911] |
Wed, 19 November 2003 09:58 |
Eclipse User |
|
|
|
Originally posted by: lilithal-jadiri.freenet.de
Hello,
all the examples that I've seen so far deal with registering a context
menu for a viewer instance. What I have is simply a concrete class of
ViewPart where I draw widgets and no Viewer. So when I come to the part
where I have to create a context menu and register it:
Menu menu = menuMgr.createContextMenu(getViewer().getControl());
getViewer().getControl().setMenu(menu);
getSite().registerContextMenu(menuMgr, viewer);
can I replace it with the following since I don't have a Viewer:
Menu menu = menuMgr.createContextMenu(getViewSite().getShell());
getViewSite().getShell().setMenu(menu);
And as far as registering it is concerned, the second parameter is
ISelectionProvider which a Viewer is normally. Should I then implement
ISelectionProvider interface and explicitly implement its interface??
would then the registering part have to look like this??
getSite().registerContextMenu(menuMgr, this );
I would appreciate any help or example.
thanks,
Lilith
|
|
|
Powered by
FUDForum. Page generated in 0.03002 seconds