Solved

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

Posted on 2012-03-15
2
433 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
Comment Utility
0
 
LVL 1

Author Comment

by:kumarSaravanan
Comment Utility
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
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 pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
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.

728 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now