How to switch off lazy loading of views in perspective folder [message #734134] |
Thu, 06 October 2011 19:58 |
Arjan Huijzer Messages: 9 Registered: October 2011 |
Junior Member |
|
|
Hi all,
I have a perspective containing a top view and a folder with four stacked views:
layout.addView(WorkitemView.ID, IPageLayout.LEFT, 1.0f, IPageLayout.ID_EDITOR_AREA);
IFolderLayout folder = layout.createFolder("folder", IPageLayout.BOTTOM, 0.7f, WorkitemView.ID);
folder.addView(VariablesView.ID);
folder.addView(PackagesView.ID);
folder.addView(AttachmentsView.ID);
folder.addView(ErrorView.ID);
The views in the folder all need to update when a selection is made in the top view. This is accomplished by adding a selection listener. However, only the view that is actually shown reacts on the selection. When I select another view, it is still empty.
The code that adds the selection listener is placed in the view's init() method and apparently this is only called for the first view in the folder when the perspective is loaded.
Is there a way to switch off this "lazy loading" so that all views are created (and their init() method called) when the perspective is created?
Thanks in advance for any help,
Arjan
|
|
|
Re: How to switch off lazy loading of views in perspective folder [message #734940 is a reply to message #734134] |
Mon, 10 October 2011 13:29 |
Dani Megert Messages: 3802 Registered: July 2009 |
Senior Member |
|
|
On 06.10.2011 21:58, huijzer wrote:
> Hi all,
>
> I have a perspective containing a top view and a folder with four
> stacked views:
>
> layout.addView(WorkitemView.ID, IPageLayout.LEFT, 1.0f,
> IPageLayout.ID_EDITOR_AREA);
>
> IFolderLayout folder = layout.createFolder("folder",
> IPageLayout.BOTTOM, 0.7f, WorkitemView.ID);
> folder.addView(VariablesView.ID);
> folder.addView(PackagesView.ID);
> folder.addView(AttachmentsView.ID);
> folder.addView(ErrorView.ID);
>
> The views in the folder all need to update when a selection is made in
> the top view. This is accomplished by adding a selection listener.
> However, only the view that is actually shown reacts on the selection.
> When I select another view, it is still empty.
> The code that adds the selection listener is placed in the view's
> init() method and apparently this is only called for the first view in
> the folder when the perspective is loaded.
> Is there a way to switch off this "lazy loading" so that all views are
> created (and their init() method called) when the perspective is created?
No.
Dani
>
> Thanks in advance for any help,
>
> Arjan
>
|
|
|
|
Re: How to switch off lazy loading of views in perspective folder [message #735005 is a reply to message #734134] |
Mon, 10 October 2011 15:54 |
Thomas Schindl Messages: 6651 Registered: July 2009 |
Senior Member |
|
|
Why don't you simply fetch the current selection once the other view is
initialized?
Tom
Am 06.10.11 21:58, schrieb huijzer:
> Hi all,
>
> I have a perspective containing a top view and a folder with four
> stacked views:
>
> layout.addView(WorkitemView.ID, IPageLayout.LEFT, 1.0f,
> IPageLayout.ID_EDITOR_AREA);
>
> IFolderLayout folder = layout.createFolder("folder", IPageLayout.BOTTOM,
> 0.7f, WorkitemView.ID);
> folder.addView(VariablesView.ID);
> folder.addView(PackagesView.ID);
> folder.addView(AttachmentsView.ID);
> folder.addView(ErrorView.ID);
>
> The views in the folder all need to update when a selection is made in
> the top view. This is accomplished by adding a selection listener.
> However, only the view that is actually shown reacts on the selection.
> When I select another view, it is still empty.
> The code that adds the selection listener is placed in the view's init()
> method and apparently this is only called for the first view in the
> folder when the perspective is loaded.
> Is there a way to switch off this "lazy loading" so that all views are
> created (and their init() method called) when the perspective is created?
>
> Thanks in advance for any help,
>
> Arjan
>
|
|
|
|
|
Re: How to switch off lazy loading of views in perspective folder [message #735055 is a reply to message #735035] |
Mon, 10 October 2011 19:38 |
Arjan Huijzer Messages: 9 Registered: October 2011 |
Junior Member |
|
|
Just a quick follow-up:
I have succeeded in getting the behavior I wanted. To accomplish this, I first had to add a perspective listener. This was done in the actual PerspectiveFactory class.
public class WorkflowPerspective implements IPerspectiveFactory {
public static final String ID = "lime.workflow.perspective";
@Override
public void createInitialLayout(IPageLayout layout) {
layout.setEditorAreaVisible(false);
layout.setFixed(false);
layout.addView(WorkitemView.ID, IPageLayout.LEFT, 1.0f, IPageLayout.ID_EDITOR_AREA);
IFolderLayout folder = layout.createFolder("folder", IPageLayout.BOTTOM, 0.7f, WorkitemView.ID);
folder.addView(VariablesView.ID);
folder.addView(PackagesView.ID);
folder.addView(AttachmentsView.ID);
folder.addView(ErrorView.ID);
IWorkbenchWindow workbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
workbenchWindow.addPerspectiveListener(new MyPerspectiveAdapter());
}
}
Next I implemented the listener by subclassing PerspectiveAdapter.
public class MyPerspectiveAdapter extends PerspectiveAdapter {
@Override
public void perspectiveActivated(IWorkbenchPage page, IPerspectiveDescriptor perspective) {
IViewReference[] references = page.getViewReferences();
for (IViewReference reference : references) {
try {
page.showView(reference.getId(), null, IWorkbenchPage.VIEW_CREATE);
} catch (PartInitException e) {
throw new LimeException(e);
}
}
}
}
Thanks for all the help!
Arjan
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03791 seconds