Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » How to make a view aware of selection in another view
How to make a view aware of selection in another view [message #291727] Thu, 22 September 2005 04:48 Go to next message
Eclipse UserFriend
Originally posted by: martin.umgeher.joanneum.at

Hi,

I have two views showing table viewers. The content of view #2 depends
on the selection in view #1. I'd like to use the
ISelectionProvider/ISelectionListener approach for notifying view #2
about selection changes.

View #2 registers itself via getSite().getPage().addSelectionListener.
My question is: how can I register view #1 as an ISelectionProvider? (I
don't want to use getSite().setSelectionProvider because I don't want
the view to be the _only_ selection provider available.)

TIA
Martin
Re: How to make a view aware of selection in another view [message #291737 is a reply to message #291727] Thu, 22 September 2005 07:50 Go to previous messageGo to next message
Eclipse UserFriend
Martin Umgeher wrote:
> Hi,
>
> I have two views showing table viewers. The content of view #2 depends
> on the selection in view #1. I'd like to use the
> ISelectionProvider/ISelectionListener approach for notifying view #2
> about selection changes.
>
> View #2 registers itself via getSite().getPage().addSelectionListener.
> My question is: how can I register view #1 as an ISelectionProvider? (I
> don't want to use getSite().setSelectionProvider because I don't want
> the view to be the _only_ selection provider available.)

It shouldn't be a problem. If your view should provide a selection
provider, set it with getSite().setSelectionProvider(...). That sets
the selection provider for the view only.

When a part becomes active, the page switches to that part's selection
provider, as stored in the site.

Then changes in view#1 selection should be fired to view#2.

Later,
PW
Re: How to make a view aware of selection in another view [message #292093 is a reply to message #291737] Thu, 29 September 2005 08:50 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: Lamont_Gilbert.rigidsoftware.com

Paul Webster wrote:
> Martin Umgeher wrote:
>
>> Hi,
>>
>> I have two views showing table viewers. The content of view #2 depends
>> on the selection in view #1. I'd like to use the
>> ISelectionProvider/ISelectionListener approach for notifying view #2
>> about selection changes.
>>
>> View #2 registers itself via getSite().getPage().addSelectionListener.
>> My question is: how can I register view #1 as an ISelectionProvider?
>> (I don't want to use getSite().setSelectionProvider because I don't
>> want the view to be the _only_ selection provider available.)
>
>
> It shouldn't be a problem. If your view should provide a selection
> provider, set it with getSite().setSelectionProvider(...). That sets
> the selection provider for the view only.
>
> When a part becomes active, the page switches to that part's selection
> provider, as stored in the site.
>
> Then changes in view#1 selection should be fired to view#2.
>
> Later,
> PW

Cant view #2 listen to selection events, and pay attention to only the
ones coming from view #1?


Cl
Re: How to make a view aware of selection in another view [message #292125 is a reply to message #292093] Thu, 29 September 2005 10:04 Go to previous message
Eclipse UserFriend
CL [dnoyeb] Gilbert wrote:
>
>> Martin Umgeher wrote:
>>> View #2 registers itself via
>>> getSite().getPage().addSelectionListener. My question is: how can I
>>> register view #1 as an ISelectionProvider? (I don't want to use
>>> getSite().setSelectionProvider because I don't want the view to be
>>> the _only_ selection provider available.)
>
> Cant view #2 listen to selection events, and pay attention to only the
> ones coming from view #1?

That's a good way to do it ... but I think Martin was concerned if he
used setSelectionProvider() that would be the only one for the page ...
but they're maintained per site.

Later,
PW
Previous Topic:getting the current active project
Next Topic:Problem to configure an Outline
Goto Forum:
  


Current Time: Sun Jul 27 13:58:44 EDT 2025

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

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

Back to the top