[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[news.eclipse.tools] Re: How to add Popup menu to a new view.

Trevor,

> Can
> I add the menu just be adding entries to plugin.xml and if so what entries
> do I need?  I have tried adding an object contribution but have not been
> able to get a popup menu to show.

If you mean the menu on the view toolbar, call
getViewSite().getActionBars().getMenuManager().

If you mean a context menu, the context menu for a view is created in
code.  XML is only used by other people who wish to extend your view. 
Note: To support extension register your menu with
getViewSite().registerContextMenu.  You should do this, as we want to make
the platform and all plugins as extensable as possible.  My work is no
exception.  Neither is yours.

> Are there any good examples of how to use the TreeViewer classes.  I have
> been looking at the navigator code,  but it is very complex and does much
> more thatn my farily simple task requires.

The simplest example is probably the BookmarkNavigator.  It demonstrates
TreeViewer creation, creation of a menu, and population of the menu.  Take
a good look at the addContributions method.

Dave