Sharing Object between Viewparts [message #328540] |
Tue, 27 May 2008 13:37 ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
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 #328559 is a reply to message #328544] |
Tue, 27 May 2008 16:38 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
Originally posted by: yagayoga.hotmail.com
Wayne Beaton wrote:
> You probably need to have an underlying UI model that the views provide
> a "view" on (basically an implementation of the MVC pattern).
> It might be enough to get the current selection from the selection
> service when the view is created. That is, go get the selection rather
> than just wait for one to be delivered.
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?
Jen
|
|
|
Re: Sharing Object between Viewparts [message #328570 is a reply to message #328559] |
Tue, 27 May 2008 17:30 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
Originally posted by: yagayoga.hotmail.com
> 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
|
|
|
Re: Sharing Object between Viewparts [message #328578 is a reply to message #328570] |
Tue, 27 May 2008 20:13 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) |
Boris Bokowski![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=bokowski%40google.com) Messages: 272 Registered: July 2009 |
Senior Member |
|
|
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.03688 seconds