Skip to main content



      Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Two selection providers on a same view
Two selection providers on a same view [message #448235] Wed, 19 April 2006 12:56 Go to next message
Eclipse UserFriend
Hello,

I have two components (list and tree) on a view and I need both to
distribute selection events (for the property sheet view).

But I can register only one.

How to solve this situation?

--
Best regards,
Lukas Zapletal
Re: Two selection providers on a same view [message #448282 is a reply to message #448235] Thu, 20 April 2006 09:41 Go to previous messageGo to next message
Eclipse UserFriend
Dne Wed, 19 Apr 2006 18:56:41 +0200
Lukas Zapletal <lukas.zapletal@linuxexpres.cz> napsal(a):

> I have two components (list and tree) on a view and I need both to
> distribute selection events (for the property sheet view).
>
> But I can register only one.
>
> How to solve this situation?

I have tried to implement a provider, that will distribute the events
from both views. The problem is getSelection/setSelection methods.
These are called often and I dont know which component`s selection to
provide. Not a solution :-(

--
Best regards,
Lukas Zapletal
Re: Two selection providers on a same view [message #448284 is a reply to message #448282] Thu, 20 April 2006 10:00 Go to previous messageGo to next message
Eclipse UserFriend
Lukas Zapletal wrote:
> Dne Wed, 19 Apr 2006 18:56:41 +0200
> Lukas Zapletal <lukas.zapletal@linuxexpres.cz> napsal(a):
>
>> I have two components (list and tree) on a view and I need both to
>> distribute selection events (for the property sheet view).
>>
>> But I can register only one.
>>
>> How to solve this situation?
>
> I have tried to implement a provider, that will distribute the events
> from both views. The problem is getSelection/setSelection methods.
> These are called often and I dont know which component`s selection to
> provide. Not a solution :-(
>


Just create a new SelectionProvider that wrapps both.

Ben
Re: Two selection providers on a same view [message #448293 is a reply to message #448284] Thu, 20 April 2006 12:16 Go to previous messageGo to next message
Eclipse UserFriend
Dne Thu, 20 Apr 2006 16:00:41 +0200
Benjamin Pasero <bpasero@rssowl.org> napsal(a):

> > I have tried to implement a provider, that will distribute the events
> > from both views. The problem is getSelection/setSelection methods.
> > These are called often and I dont know which component`s selection to
> > provide. Not a solution :-(
>
> Just create a new SelectionProvider that wrapps both.

Thats what am talking about - I cannot.

The SelectionProvider has these getSelection/setSelection methods. What
should getSelection method return when called? Selection of the first
component, or the second?

--
Best regards,
Lukas Zapletal
Re: Two selection providers on a same view [message #448295 is a reply to message #448293] Thu, 20 April 2006 12:18 Go to previous messageGo to next message
Eclipse UserFriend
> The SelectionProvider has these getSelection/setSelection methods. What
> should getSelection method return when called? Selection of the first
> component, or the second?

Both.
Re: Two selection providers on a same view [message #448298 is a reply to message #448295] Thu, 20 April 2006 13:12 Go to previous messageGo to next message
Eclipse UserFriend
Dne Thu, 20 Apr 2006 16:18:40 +0000 (UTC)
neil@integility.com (Neil Bartlett) napsal(a):

> > The SelectionProvider has these getSelection/setSelection methods. What
> > should getSelection method return when called? Selection of the first
> > component, or the second?
>
> Both.

As StructuredSelection?

public ISelection getSelection() {
ArrayList s = new ArrayList();
for (ISelectionProvider sp: providers)
s.add(sp.getSelection());
return new StructuredSelection(s);
}


--
Best regards,
Lukas Zapletal
Re: Two selection providers on a same view [message #448300 is a reply to message #448298] Thu, 20 April 2006 13:54 Go to previous messageGo to next message
Eclipse UserFriend
Seems this works, thanks.

Dne Thu, 20 Apr 2006 19:12:32 +0200
Lukas Zapletal <lukas.zapletal@linuxexpres.cz> napsal(a):

> Dne Thu, 20 Apr 2006 16:18:40 +0000 (UTC)
> neil@integility.com (Neil Bartlett) napsal(a):
>
> > > The SelectionProvider has these getSelection/setSelection methods. What
> > > should getSelection method return when called? Selection of the first
> > > component, or the second?
> >
> > Both.
>
> As StructuredSelection?
>
> public ISelection getSelection() {
> ArrayList s = new ArrayList();
> for (ISelectionProvider sp: providers)
> s.add(sp.getSelection());
> return new StructuredSelection(s);
> }
>
>
> --
> Best regards,
> Lukas Zapletal


--
Best regards,
Lukas Zapletal
Re: Two selection providers on a same view [message #448334 is a reply to message #448235] Thu, 20 April 2006 18:47 Go to previous message
Eclipse UserFriend
Lukas

Look at Eclipses home page. There is a very good article "Using the Selection Service" that explains your case. Look at the "Multiple Selection Providers Within a Part". It has a good example.

Good luck
Previous Topic:Status Line -
Next Topic:Problem with MultiLineRule
Goto Forum:
  


Current Time: Sat Nov 08 13:14:03 EST 2025

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

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

Back to the top