Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » How to have a Dialog be a ISelectionListener(How to have a Dialog be a ISelectionListener)
How to have a Dialog be a ISelectionListener [message #500330] Wed, 25 November 2009 16:31 Go to next message
Andy Coleman is currently offline Andy ColemanFriend
Messages: 33
Registered: September 2009
Member
Hi,

This question is a bit similar to one asked previously so apologies for the repeat.

I have a dialog which I would like to register as a selection listener with a selection service. Within the application we have a view containing a table and when a user selects a row in the table an update should be passed to the dialog. The view implements ISelectionProvider.

The dialog implements ISelectionListener but as it is a Dialog I am not able to directly access the selection service. What should I do to achieve the following

getSite().getPage().addSelectionListener(..);

Thanks
Andy
Re: How to have a Dialog be a ISelectionListener [message #500385 is a reply to message #500330] Wed, 25 November 2009 20:50 Go to previous messageGo to next message
Aaron L is currently offline Aaron LFriend
Messages: 18
Registered: November 2009
Junior Member
No sure if this will work, but might be worth a try:

ISelectionService iss = (ISelectionService) PlatformUi.getWorkbench().getService(ISelectionService.class );
iss.addSelectionListener(yourSelectionListener);

Also, your post says that your View implements ISelectionProvider, but I think the table needs to be set as the selection provider via:
viewPart.getSite().setSelectionProvider(yourTableviewer).
Re: How to have a Dialog be a ISelectionListener [message #500422 is a reply to message #500385] Thu, 26 November 2009 02:49 Go to previous messageGo to next message
J. Michael Dean, M.D. is currently offline J. Michael Dean, M.D.Friend
Messages: 218
Registered: July 2009
Senior Member
Isn't a wizard modal? That is, when it opens, the selection should already
be done? Can you record the selection somewhere for the wizard to access?


On 11/25/09 1:50 PM, in article hek5ac$lpv$1@build.eclipse.org,
"aaron.lfoot@gmail.com" <aaron.lfoot@gmail.com> wrote:

> No sure if this will work, but might be worth a try:
>
> ISelectionService iss = (ISelectionService)
> PlatformUi.getWorkbench().getService(ISelectionService.class );
> iss.addSelectionListener(yourSelectionListener);
>
> Also, your post says that your View implements ISelectionProvider, but I think
> the table needs to be set as the selection provider via:
> viewPart.getSite().setSelectionProvider(yourTableviewer).
Re: How to have a Dialog be a ISelectionListener [message #500436 is a reply to message #500422] Thu, 26 November 2009 08:08 Go to previous messageGo to next message
Andy Coleman is currently offline Andy ColemanFriend
Messages: 33
Registered: September 2009
Member
This is not a wizard dialog but just a modeless dialog so the user can still interact with the main part of the GUI while having the dialog open. Under normal circumstances the user will open a dialog perform an action and the close it. We have a use case from one user where they want to keep the dialog open and reuse it rather than close it down.

We may end up changing the dialog into a view but for our first versio of the app we just want to get something out there and get feedback.

Thanks for all comments.

Andy
Re: How to have a Dialog be a ISelectionListener [message #500460 is a reply to message #500422] Thu, 26 November 2009 09:25 Go to previous message
Andy Coleman is currently offline Andy ColemanFriend
Messages: 33
Registered: September 2009
Member
On 11/25/09 1:50 PM, in article hek5ac$lpv$1@build.eclipse.org,
"aaron.lfoot@gmail.com" <aaron.lfoot@gmail.com> wrote:

> No sure if this will work, but might be worth a try:
>
> ISelectionService iss = (ISelectionService)
> PlatformUi.getWorkbench().getService(ISelectionService.class );
> iss.addSelectionListener(yourSelectionListener);
>
> Also, your post says that your View implements ISelectionProvider, but I think
> the table needs to be set as the selection provider via:
> viewPart.getSite().setSelectionProvider(yourTableviewer).[/q uote]

That did not work for me but this did

PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActi vePage().addSelectionListener(mySelectionListener)

Thanks
Previous Topic:Dropins folder in exported products
Next Topic:How to locate and load an XML configuration file?
Goto Forum:
  


Current Time: Fri Apr 26 06:21:24 GMT 2024

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

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

Back to the top