|
Re: Context Menu on my TreeViewer [message #671236 is a reply to message #668049] |
Tue, 17 May 2011 08:41 |
Chaitannya Messages: 14 Registered: May 2010 |
Junior Member |
|
|
// creating the Menu and registering it
MenuManager menuMgr = new MenuManager("#PopupMenu");
menuMgr.setRemoveAllWhenShown(false);
Menu menu = menuMgr.createContextMenu(treeViewer.getControl());
viewer.getControl().setMenu(menu);
getSite().registerContextMenu(menuMgr, treeViewer);
Action action1 = new Action() {
public void run() {
// Code for handling action goes here.
}
} ;
action1.setText("Action 1");
Try out this code.. Let me know if it works.
[Updated on: Tue, 17 May 2011 08:42] Report message to a moderator
|
|
|
Re: Context Menu on my TreeViewer [message #671420 is a reply to message #671236] |
Tue, 17 May 2011 19:46 |
|
Using the Plug-in Spy (ALT+SHIFT+F1) on the PackageExplorer I could see that the class where the menu is shown is PackageExplorerPart --> menuAboutToShow() method. After that you can check if that implementation could be used by you easily or not.
That class is from JDT internal package so probably asking on the JDT forum will give you back more answers.
Time is what you make of it.
|
|
|
Powered by
FUDForum. Page generated in 0.01601 seconds