Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » JFace » TreeViewer Node Listener
TreeViewer Node Listener [message #1063303] Wed, 12 June 2013 23:01 Go to next message
AIT YAHIA Idir is currently offline AIT YAHIA IdirFriend
Messages: 39
Registered: April 2013
Member
Hello,

I'm starting with JFace,i have a treeView which is used as menu, i need to associate some part with each children node. When we doubleclick on the node it should open associated part

how could I, determine which part is associated with a given node, i dont have access to content model, to get the part Id

How should I proceed?

viewer.addDoubleClickListener(new IDoubleClickListener() {
		    	
  @Override
   public void doubleClick(DoubleClickEvent event) {
	TreeViewer viewer = (TreeViewer) event.getViewer();
	IStructuredSelection thisSelection = (IStructuredSelection) event
		            .getSelection();
		        
	 Object selectedNode = thisSelection.getFirstElement();
	  
           //TODO somthing with selectedNode 
		        
		        
		        
		       
		        
		      }
		    });



thank's

[Updated on: Wed, 12 June 2013 23:07]

Report message to a moderator

Re: TreeViewer Node Listener [message #1063453 is a reply to message #1063303] Thu, 13 June 2013 08:34 Go to previous message
AIT YAHIA Idir is currently offline AIT YAHIA IdirFriend
Messages: 39
Registered: April 2013
Member
I solved my problem, finally the node is an instance of my object model, it was enough to cast the Selected node to my model object, like this


if (selectedNode instanceof NavigatorMenuItem) {
      NavigatorMenuItem o = (NavigatorMenuItem) selectedNode;
		        
       System.out.println(o.getItemLibelle()) ;  	   
		        	   
		         
		        }
Previous Topic:TreeViewer expand one top level element at once
Next Topic:XML databinding in SWT help
Goto Forum:
  


Current Time: Fri Apr 26 12:15:36 GMT 2024

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

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

Back to the top