Solved

RCP: Tree Viewer- selecting a node and passing the underlying object

Posted on 2012-03-15
2
446 Views
Last Modified: 2012-04-02
I have a Treeviewer with 3 levels of nodes, main,branch,leaf. If I select the leaf, the underlying leaf object should be available to me to pass on to other UI elements.
I tried the listener, addSelectionChangedListener. The SelectionChangedEvent, brings only the text which is displayed - not the entire object.

Any insight is highly appreciated.
Thanks
0
Comment
Question by:kumarSaravanan
2 Comments
 
LVL 7

Accepted Solution

by:
gudii9 earned 500 total points
ID: 37730958
0
 
LVL 1

Author Comment

by:kumarSaravanan
ID: 37796803
public void selectionChanged(SelectionChangedEvent event) {
		
				
				IStructuredSelection sel = (IStructuredSelection) event.getSelection();
				
				TreeObject element = (TreeObject)sel.getFirstElement();

...

}

Open in new window


IStructuredSelection allows me to get to the underlying object.
The above code snippet illustrates that.
0

Featured Post

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question