Sharing Object between Viewparts [message #328540] |
Tue, 27 May 2008 09:37  |
Eclipse User |
|
|
|
Originally posted by: yagayoga.hotmail.com
Hey!
I have three ViewParts which must access an object selected in a list in a
different Viewpart. What is the preferred method of sharing the object?
Presently all ViewParts implement ISelectionListener and discover the
selected object this way, in the selectionChanged method.
However, when the perspective is brought up initially, the views are not
updated until the user actually clicks the list. What is the solution to
this? Should I be using data binding or something? Thanks!
Jen
|
|
|
|
|
|
Re: Sharing Object between Viewparts [message #328578 is a reply to message #328570] |
Tue, 27 May 2008 16:13  |
Eclipse User |
|
|
|
You might be seeing a bug that was fixed for 3.4 but it is hard to tell
because I don't know which Eclipse version you were using, and if the views
were multi-instance views:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=193832
If using ISelectionService.addSelectionListener(partId, listener) does not
work for you (in 3.4), could you please file a bug?
Thanks
Boris
"Jennifer LLewelyn" <yagayoga@hotmail.com> wrote in message
news:f5188b4b0748156dc1e700730b466ed0$1@www.eclipse.org...
>
>> Thanks wayne, I've decided to try adding the three ViewParts as listeners
>> on an ObservableValue in the "main" ViewPart, so they will implement
>> IChangeListener and register as the user invokes them.
>
>> I need to set the order in which the views load when the perspective is
>> clicked, though. It's important that the "main" ViewPart gets loaded
>> first, so the others can add themselves as listeners on this, or not load
>> at all if it doesn't exist. Does anyone know what features Eclipse offers
>> for setting up the load order and configuring how the ViewParts
>> initialize?
>
> Think I've solved this - I setup every ViewPart as an IPartListener, then
> add them as listeners to the main ViewPart when I detect that it's opened
> and remove on close.
> Also, I add a check to the reliant ViewParts to see if the main ViewPart
> is already displaying when opening them. I use the IViewReferences to
> check for this. Thanks for your time.
>
> Jen
>
|
|
|
Powered by
FUDForum. Page generated in 0.03090 seconds