Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » Create a context Menu for a tree
Create a context Menu for a tree [message #1644870] Mon, 02 March 2015 07:59 Go to next message
Praveen Banthia is currently offline Praveen BanthiaFriend
Messages: 30
Registered: September 2014
Member
Hi,
I want to create a context menu when a user right clicks on a node in tree. The context menu should recognize which on which node the popup menu was opened and then act accordingly.

I have been able to detect right click on a node for a tree using this method

tree.addListener(SWT.MenuDetect, new Listener() {
		@Override
		public void handleEvent(Event event) {


however I have not been able to figure out how to create context menu and pass details of the node to it
Re: Create a context Menu for a tree [message #1644972 is a reply to message #1644870] Mon, 02 March 2015 09:08 Go to previous messageGo to next message
Christoph Keimel is currently offline Christoph KeimelFriend
Messages: 479
Registered: December 2010
Location: Germany
Senior Member
There is a lot of information available by searching for "javafx context menu example". For example this tutorial:
http://docs.oracle.com/javafx/2/ui_controls/tree-view.htm
Re: Create a context Menu for a tree [message #1644980 is a reply to message #1644972] Mon, 02 March 2015 09:11 Go to previous messageGo to next message
Christoph Keimel is currently offline Christoph KeimelFriend
Messages: 479
Registered: December 2010
Location: Germany
Senior Member
Sorry ... my last reply is BS of course ... thought I was in another forum. Of course you need to search for "swt context menu tree" (or such) and you will find things like this:
http://stackoverflow.com/questions/18403137/adding-right-click-menu-to-to-treeitem-in-swt-tree
and
http://stackoverflow.com/questions/6207772/context-menu-for-treeviewer-based-on-selected-node-swt
Re: Create a context Menu for a tree [message #1644982 is a reply to message #1644972] Mon, 02 March 2015 09:12 Go to previous message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6363
Registered: July 2009
Senior Member
He is not talking about JavaFX. To see how to create a context menu
based upon selection look at

http://git.eclipse.org/c/platform/eclipse.platform.ui.git/tree/examples/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet005TreeCustomMenu.java

Tom

On 02.03.15 10:08, Christoph Keimel wrote:
> There is a lot of information available by searching for "javafx context
> menu example". For example this tutorial:
> http://docs.oracle.com/javafx/2/ui_controls/tree-view.htm
>
Previous Topic:Target platform shows: Error reading manifest for ....\javax.servlet.source
Next Topic:How to add a second Terminate button to console view
Goto Forum:
  


Current Time: Mon Nov 20 11:49:22 GMT 2017

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

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