Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » [Solved] View listen to combobox selection
[Solved] View listen to combobox selection [message #890235] Thu, 21 June 2012 14:39 Go to next message
Ted Mosby is currently offline Ted MosbyFriend
Messages: 9
Registered: April 2012
Junior Member
Hi

I wanted to know if a view can listen to a combobox selection of a comboxbox in another view?
In my RCP application i have two views. One view with a tree and a combobox, and a second view with a tabfolder. The second view inplements the org.eclipse.ui.ISelectionListener interface.
I used
getSite().getPage().addSelectionListener(View1.ID, (ISelectionListener) this);
to register the view as a selection listener to the workbenchpage.
I want to add a tabitem to the tabfolder when the selection of the combobox changes. How can i register the second view as a listener for the combobox? Is this even possible?

Greetings
Ted

[Updated on: Fri, 13 July 2012 07:32]

Report message to a moderator

Re: View listen to combobox selection [message #890524 is a reply to message #890235] Fri, 22 June 2012 13:46 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

One option is your view1 has a selection provider that fires selection changes when the combo changes. This is the most common pattern, and you can see a write-up at http://www.eclipse.org/articles/Article-WorkbenchSelections/article.html

If view1 already has a selection provider doing something else (like exposing the Tree selection) then you need to implement a different way yourself for view1 to expose its combo box selection changes. Maybe have view2 use org.eclipse.ui.IWorkbenchPage.findViewReference(String) to find a reference to view1. When the IViewPart is instantiated, you can use an instanceof check to make sure it's the right view, and then something like view1.addComboListener(view2);

PW


PW


Re: View listen to combobox selection [message #895467 is a reply to message #890235] Fri, 13 July 2012 07:31 Go to previous message
Ted Mosby is currently offline Ted MosbyFriend
Messages: 9
Registered: April 2012
Junior Member
Hi Paul

I solved the problem. When the selection in the combobox changes, a selection event is fired manually to notify the listeners. The combobox listeners were added in a way similar like yours. Thx for advise!
Previous Topic:Plugin unable to find class - ClassNotFoundException
Next Topic:IMenuService not works with eclipse 4.2 (seems bug?)
Goto Forum:
  


Current Time: Fri Mar 29 14:44:01 GMT 2024

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

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

Back to the top