Lifecycle events for views with allowMultiple [message #312249] |
Mon, 05 February 2007 11:48  |
Eclipse User |
|
|
|
Originally posted by: lars..removethis.ohlen.se
Hi,
We have a view that is opened in serveral instances (allowMultiple, with
secondaryId set).
It seems like the normal view lifecycle process is performed only on a class
level (e.g. only for the first instance).
Is this a correct observation? How to handle persistance in such a case?
BR
Lars
|
|
|
|
Re: Lifecycle events for views with allowMultiple [message #312257 is a reply to message #312253] |
Mon, 05 February 2007 13:22   |
Eclipse User |
|
|
|
Originally posted by: lars..removethis.ohlen.se
Hi and thanx for fast reply.
The problem we have encountered is when the views are left remaining open
when the user ends Eclipse (or closes the perspective)
When the perspective is restored the view init and createlPartControl seams
to be invoced just onces (not once for every view instance as expected),
which makes
it hard to restore the content for each instance of the view. The apperance
now is empty blank views with the view id as the name in the caption for all
views.
I saw something in your answer that gave me an additional question. In you
sample the first view is opened whitout the second id set:
page.showView("id");
page.showView("id", "1", IWorkbenchPage.VIEW_ACTIVATE);
page.showView("id", "2", IWorkbenchPage.VIEW_ACTIVATE);
But our solution does:
page.showView("id", "1", IWorkbenchPage.VIEW_ACTIVATE);
page.showView("id", "2", IWorkbenchPage.VIEW_ACTIVATE);
page.showView("id", "3", IWorkbenchPage.VIEW_ACTIVATE);
In this case there will be no instance of a view without any second instance
id set. Perhaps this can be problem?
BR
Lars
"Paul Webster" <pwebster@ca.ibm.com> skrev i meddelandet
news:eq7qlo$t7n$1@utils.eclipse.org...
> Which part do you think is missing?
>
> page.showView("id");
> page.showView("id", "1", IWorkbenchPage.VIEW_ACTIVATE);
> page.showView("id", "2", IWorkbenchPage.VIEW_ACTIVATE);
>
> That should call create part control and init on 3 different view part
> instances.
>
> PW
|
|
|
Re: Lifecycle events for views with allowMultiple [message #312259 is a reply to message #312257] |
Mon, 05 February 2007 13:38   |
Eclipse User |
|
|
|
Originally posted by: lars..removethis.ohlen.se
Hi again,
I just realized that the init and createPartControl is invoced only once
because there is only one view that has focus.
By clicking on the other views the init and createPartControl is invoced!!!!
Well that is good to know, but not sure how I can use this info. One could
of course fake a focus on each view, but
that seems to be work around not a solution.
BR
Lars
"Lars" <lars@.removethis.ohlen.se> skrev i meddelandet
news:eq7slk$cn1$1@utils.eclipse.org...
> Hi and thanx for fast reply.
>
> The problem we have encountered is when the views are left remaining open
> when the user ends Eclipse (or closes the perspective)
> When the perspective is restored the view init and createlPartControl
> seams to be invoced just onces (not once for every view instance as
> expected), which makes
> it hard to restore the content for each instance of the view. The
> apperance now is empty blank views with the view id as the name in the
> caption for all views.
>
> I saw something in your answer that gave me an additional question. In you
> sample the first view is opened whitout the second id set:
> page.showView("id");
> page.showView("id", "1", IWorkbenchPage.VIEW_ACTIVATE);
> page.showView("id", "2", IWorkbenchPage.VIEW_ACTIVATE);
>
> But our solution does:
> page.showView("id", "1", IWorkbenchPage.VIEW_ACTIVATE);
> page.showView("id", "2", IWorkbenchPage.VIEW_ACTIVATE);
> page.showView("id", "3", IWorkbenchPage.VIEW_ACTIVATE);
>
> In this case there will be no instance of a view without any second
> instance id set. Perhaps this can be problem?
>
> BR
>
> Lars
>
>
>
>
> "Paul Webster" <pwebster@ca.ibm.com> skrev i meddelandet
> news:eq7qlo$t7n$1@utils.eclipse.org...
>> Which part do you think is missing?
>>
>> page.showView("id");
>> page.showView("id", "1", IWorkbenchPage.VIEW_ACTIVATE);
>> page.showView("id", "2", IWorkbenchPage.VIEW_ACTIVATE);
>>
>> That should call create part control and init on 3 different view part
>> instances.
>>
>> PW
>
>
|
|
|
Re: Lifecycle events for views with allowMultiple [message #312359 is a reply to message #312259] |
Wed, 07 February 2007 12:50  |
Eclipse User |
|
|
|
Lars wrote:
> Hi again,
>
> I just realized that the init and createPartControl is invoced only once
> because there is only one view that has focus.
> By clicking on the other views the init and createPartControl is invoced!!!!
>
> Well that is good to know, but not sure how I can use this info. One could
> of course fake a focus on each view, but
> that seems to be work around not a solution.
Using secondary IDs for all of your views should be fine.
All parts (views and editors) are lazily restored after a session
restart. Why do the work to populate a view if the user never clicks on
it? That view saved-state will be propagated through session restarts
until the user finally clicks on the view.
Later,
PW
|
|
|
Powered by
FUDForum. Page generated in 0.20236 seconds