Solved

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

Posted on 2012-03-15
2
453 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
login form jsp example 2 50
String array comparison 4 46
Using jdbcTemplate.batchUpdate to improve INSERT performance 6 27
How to fix  socket closed error 11 28
The purpose of this article is to demonstrate how we can use conditional statements using Python.
Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

749 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