Command Contribution to search results [message #605783] |
Fri, 14 May 2010 10:57 |
Praveen Joseph Messages: 2 Registered: July 2009 |
Junior Member |
|
|
Hello,
I have contributed a search result page in my RCP.
When the search results are displayed, i would like to have some commands available in the popup menu.
Within the search results page, in the createPartControl() , a menu manager is created :
Snippet :
MenuManager menuMgr = new MenuManager("#PopUp");
menuMgr.setRemoveAllWhenShown(true);
menuMgr.addMenuListener(new IMenuListener() {
public void menuAboutToShow(final IMenuManager mgr) {
fillContextMenu(mgr);
}
});
// Create menu.
Menu menu = menuMgr.createContextMenu(this.viewer.getControl());
this.viewer.getControl().setMenu(menu);
// Register menu for extension.
getSite().registerContextMenu(getID(), menuMgr, this.viewer);
The fillContextMenu() is as shown :
private void fillContextMenu(final IMenuManager mgr) {
ISelection selection = this.viewer.getSelection();
if (selection instanceof IStructuredSelection) {
Object firstElement = ((IStructuredSelection) selection).getFirstElement();
if (firstElement instanceof PLComponentFragment) {
mgr.add(...
...
mgr.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
}
}
}
Is it possible to now add commands to the search results page context menu from the plugin.xml.
Adding an object contribution action works, however there was no way to add a command to the same!!!!
Thanks a lot in advance
|
|
|
Powered by
FUDForum. Page generated in 0.02350 seconds