Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Views update from application (Views update)
Views update from application [message #494856] Mon, 02 November 2009 22:42 Go to next message
Franck Lepretre is currently offline Franck LepretreFriend
Messages: 7
Registered: November 2009
Junior Member
Hi,

I created a RCP application in which one view contains a Runnable application using a Dataprovider.

This DataProvider can modify information and this information would be displayed in other views.

When I run the application inside the view, I can see that the provider is setting the new selection but the other views are not updated.

I realised that clicking on the views would process the event by each listener. Therefore the only way for me to see the application updating my views is to click to perform some kind of UI process.

Is there another way that I can simulate this UI interation in the code?

In the extraction view, there would be
getSite().setSelectionProvider(provider);
and when an item is updated:
provider.setSelection(select);
In the other views there would be a listener:
getSite().getPage().addSelectionListener(myListener);

Thanks for any idea about how to solve this problem.
Franck
Re: Views update from application [message #494861 is a reply to message #494856] Mon, 02 November 2009 23:19 Go to previous messageGo to next message
Wim Jongman is currently offline Wim JongmanFriend
Messages: 423
Registered: July 2009
Senior Member
Hi Franck,

If Dataprovider implements ISelectionProvider it should notify the listeners
in the setSelection(ISelection) method?

Best regards,

Wim Jongman


> Hi,
>
> I created a RCP application in which one view contains a Runnable
application using a Dataprovider.
>
> This DataProvider can modify information and this information would be
displayed in other views.
>
> When I run the application inside the view, I can see that the provider is
setting the new selection but the other views are not updated.
>
> I realised that clicking on the views would process the event by each
listener. Therefore the only way for me to see the application updating my
views is to click to perform some kind of UI process.
>
> Is there another way that I can simulate this UI interation in the code?
>
> In the extraction view, there would be
> getSite().setSelectionProvider(provider);
> and when an item is updated:
> provider.setSelection(select);
> In the other views there would be a listener:
> getSite().getPage().addSelectionListener(myListener);
>
> Thanks for any idea about how to solve this problem.
> Franck
Re: Views update from application [message #494862 is a reply to message #494861] Mon, 02 November 2009 23:29 Go to previous messageGo to next message
Franck Lepretre is currently offline Franck LepretreFriend
Messages: 7
Registered: November 2009
Junior Member
Hi Wim,

Yes, the dataprovider implements the ISelection and should notify the listeners, but nothing happens my model is not updated.

I can see that the setSelection is processed but the event is not received by the listener without my action.

The only solution I have found to propagate the event is to click on views and simulate UI interations, then the model is updated.

Is it mandatory for View to be active (i.e using UI actions) to propagate events ?

If yes, how can I solve my problem ?

Thanks
Franck
Re: Re: Views update from application [message #494871 is a reply to message #494862] Tue, 03 November 2009 01:29 Go to previous messageGo to next message
Wim Jongman is currently offline Wim JongmanFriend
Messages: 423
Registered: July 2009
Senior Member
Hi Franck,

You say "_should_ notify the listeners". You must call the listeners yourself
in setSelection(ISelection). The activation of the view is probably the
effect of the setFocus() method in the view, no?

Best regards,

Wim



> Hi Wim,
>
> Yes, the dataprovider implements the ISelection and should notify the
listeners, but nothing happens my model is not updated.
>
> I can see that the setSelection is processed but the event is not received
by the listener without my action.
>
> The only solution I have found to propagate the event is to click on views
and simulate UI interations, then the model is updated.
>
> Is it mandatory for View to be active (i.e using UI actions) to propagate
events ?
>
> If yes, how can I solve my problem ?
>
> Thanks
> Franck
Re: Re: Views update from application [message #494872 is a reply to message #494871] Tue, 03 November 2009 01:44 Go to previous messageGo to next message
Franck Lepretre is currently offline Franck LepretreFriend
Messages: 7
Registered: November 2009
Junior Member
Hi Wim,

yes I have the instruction:
provider.setSelection(select);

I wrote 'should' because it is why I would expect. The listeners in the other views would receive the update event and the UI would be updated.

That is not the case. Unless as you said the views get and lose focus.

The event is not received otherwise.

Best regards
Franck
Re: Re: Views update from application [message #494971 is a reply to message #494872] Tue, 03 November 2009 12:29 Go to previous messageGo to next message
Wim Jongman is currently offline Wim JongmanFriend
Messages: 493
Registered: July 2009
Senior Member

> yes I have the instruction:
> provider.setSelection(select);

Do you notify the listeners _inside_ setSelection(select)?

--
Best Regards,

Wim Jongman
http://www.remainsoftware.com
http://www.industrial-tsi.com

<rlepretre@hotmail.com> wrote in message
news:hco1t9$dbb$1@build.eclipse.org...
> Hi Wim,
>
> yes I have the instruction:
> provider.setSelection(select);
> I wrote 'should' because it is why I would expect. The listeners in the
> other views would receive the update event and the UI would be updated.
>
> That is not the case. Unless as you said the views get and lose focus.
>
> The event is not received otherwise.
>
> Best regards
> Franck
>
Re: Views update from application [message #495142 is a reply to message #494856] Tue, 03 November 2009 21:59 Go to previous messageGo to next message
Franck Lepretre is currently offline Franck LepretreFriend
Messages: 7
Registered: November 2009
Junior Member
Thanks Wim for the idea.

I have tried the notify too, but I think to start a process in the createPartControl of a view is probably an error.

The view is not finalised and I get an exception (java.lang.IllegalMonitorStateException) in the Dataprovider.

Perhaps this kind of running application needs to be implemented in the ApplicationWorkbenchWindowAdvisor class.

It is possible to use the postWindowCreate() method and in this case, I would not have this kind of exception (I hope).

I just need to find out how to register the Dataprovider from there.

thanks again
Franck
Re: Views update from application [message #495171 is a reply to message #495142] Wed, 04 November 2009 00:59 Go to previous messageGo to next message
Wim Jongman is currently offline Wim JongmanFriend
Messages: 423
Registered: July 2009
Senior Member
mmm, this calls for a blog posting...


> Thanks Wim for the idea.
>
> I have tried the notify too, but I think to start a process in the
createPartControl of a view is probably an error.
>
> The view is not finalised and I get an exception
(java.lang.IllegalMonitorStateException) in the Dataprovider.
>
> Perhaps this kind of running application needs to be implemented in the
ApplicationWorkbenchWindowAdvisor class.
>
> It is possible to use the postWindowCreate() method and in this case, I
would not have this kind of exception (I hope).
>
> I just need to find out how to register the Dataprovider from there.
>
> thanks again
> Franck
Re: Views update from application [message #495497 is a reply to message #495171] Thu, 05 November 2009 06:17 Go to previous message
Franck Lepretre is currently offline Franck LepretreFriend
Messages: 7
Registered: November 2009
Junior Member
Could not solve this problem this way using the event system in Eclipse.

I implemented the singleton pattern with an updateManager sending my events.

Everything is now working the way it should.

Franck
Previous Topic:Initializing preferences when creating a new workspace
Next Topic:TableViewer scrollbar problem
Goto Forum:
  


Current Time: Wed Apr 24 23:47:10 GMT 2024

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

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

Back to the top