Solved

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

Posted on 2012-03-15
2
460 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Enroll in June's Course of the Month

June's Course of the Month is now available! Every 10 seconds, a consumer gets hit with ransomware. Refresh your knowledge of ransomware best practices by enrolling in this month's complimentary course for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

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

This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
When we want to run, execute or repeat a statement multiple times, a loop is necessary. This article covers the two types of loops in Python: the while loop and the for loop.
The viewer will learn how to implement Singleton Design Pattern in Java.
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…

729 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