Skip to main content



      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 10:39 Go to next message
Eclipse UserFriend
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 03:32] by Moderator

Re: View listen to combobox selection [message #890524 is a reply to message #890235] Fri, 22 June 2012 09:46 Go to previous messageGo to next message
Eclipse UserFriend
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 03:31 Go to previous message
Eclipse UserFriend
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: Thu Mar 13 14:05:54 EDT 2025

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

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

Back to the top