Skip to main content



      Home
Home » Newcomers » Newcomers » adding context menu in tree viewer
adding context menu in tree viewer [message #202736] Mon, 02 April 2007 07:08 Go to next message
Eclipse UserFriend
Originally posted by: raushansharma2004.yahoo.com

hi,
i have created one treeViewer and now want to add context menu,which
would be opened on right clicking on any node of tree.kindly suggest
something

regards
raushan
Re: adding context menu in tree viewer [message #202752 is a reply to message #202736] Mon, 02 April 2007 08:07 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: nugaee.SPAMtlen.pl

raushan wrote:
> hi,
> i have created one treeViewer and now want to add context menu,which
> would be opened on right clicking on any node of tree.kindly suggest
> something

you can use popup menu extension point

please read this article

http://www.eclipse.org/articles/viewArticle/ViewArticle2.htm l

bartek michalik
Re: adding context menu in tree viewer [message #202925 is a reply to message #202736] Tue, 03 April 2007 01:33 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: raushansharma2004.yahoo.com

actually i started creating the context menu but it is coming for the
whole editor.i mean when i right click anywhere in editor i am getting the
context menu.but i am formulatin my problem again as follows::

"i have created one editor.then added one tree in the editor.now i want
that when i right click on the tree node then one context menu should be
opened.it should not be opened anywhere else in the editor."..........


kindly suggest something.........
raushan
Re: adding context menu in tree viewer [message #202948 is a reply to message #202925] Tue, 03 April 2007 02:29 Go to previous messageGo to next message
Eclipse UserFriend
Hi Raushan,

I think you need to use the extension of the popupmenu in the plugin.xml

and need to give the object contribution for the popup menu...

Object contribution in the sense...

your tree items will of some partiuclar class ... assume your top node of
the tree is of type A and other elements of the type B.

In the popupmenu contribution you need to specify which kind of object
contribution you wanted .. ie whether your popupmenu should be invoked
when you right click either on elements of type A or of Type B.

If you want to invoke your popup menu on all the tree items.. then
create one interface X and all the treeitems ie the classes corresponding
to tree items implement the interface X.

Now in your object contribution you give the interface name .. in the
plugin.xml .

Now on all your treeitems your popup menu can be invoked....

Regards,

Zakir
You can reach me if you have further doubts...
(Zakir.hussain@in.bosch.com)
Re: adding context menu in tree viewer [message #202977 is a reply to message #202948] Tue, 03 April 2007 06:29 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: raushansharma2004.yahoo.com

hi jakir,
thanks for reply.but i am new to the editor.using since 1 month
only.can you explain a bit how to get the context menu when right
clicking on the node of tree.

as i am doing it programatically .like creating menumanger and then using
the getContextMenu() of menuManager class.but it is not working.is there
any way to do it programatically.

as previously you advised me by using extension points.i tried.but it's
not coming.may be that i am not doing it right way.so i still trying with
your suggestion.

please give some way to do it in detail.i am really trapped in this.

thanks
raushan
Re: adding context menu in tree viewer [message #203195 is a reply to message #202977] Wed, 04 April 2007 01:45 Go to previous messageGo to next message
Eclipse UserFriend
Hi Raushan,

you just add this code in the view where you are creating the treeviewer
...
and try to add the extension point of the popupmenu as what i had
suggested in previous mail...
private void hookContextMenu() {
MenuManager menuMgr = new MenuManager("#PopupMenu");
menuMgr.setRemoveAllWhenShown(true);
menuMgr.addMenuListener(new IMenuListener() {
public void menuAboutToShow(IMenuManager manager) {
(YOURVIEW).this.fillContextMenu(manager);
}
});
Menu menu = menuMgr.createContextMenu(tv.getControl());
tv.getControl().setMenu(menu);
getSite().registerContextMenu(menuMgr, tv);
}

private void fillContextMenu(IMenuManager manager) {
// Other plug-ins can contribute there actions here
// manager.add(openClose);
manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
}


You contact me on my personal id.... zakir.hussain@in.bosch.com... we can
discuss it further...

And can you tell me some thing about u like where u r working .. ie in
which company.. and which place in the world
Re: adding context menu in tree viewer [message #204022 is a reply to message #203195] Mon, 09 April 2007 07:03 Go to previous message
Eclipse UserFriend
Originally posted by: raushansharma2004.yahoo.com

hi,
i am in bangalore and working in siemens bangalore.and what about
you.anyway thanks for your reply.you can not directly get id.because this
newsgroup application is changing the domain name by XXXXX....

id starts with raushansharma
and it is on g-m-a-i-l

i think u will get it now..
thanks
Previous Topic:File Navigator
Next Topic:CVSROOT of the website
Goto Forum:
  


Current Time: Wed May 07 21:27:58 EDT 2025

Powered by FUDForum. Page generated in 0.22008 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top