Perspective¶
Perspectives are used to gather together a screen layout (usually for a specific task).
In the previous section we saw that an application can list a default perspective to use when it starts up – this is only used the first time the user runs the application. On subsequent runs the application will maintain the arrangement as the user left them.
Return to the Extension editor.
It is the editor titled: net.refraction.udig.tutorials.customapp, make sure the editor is still on the Extensions tab.
Press Add... button and select org.eclipse.ui.perspectives
Press Finish
Select the name element.
id: org.locationtech.udig.tutorials.customapp.perspective
name: Custom Perspective
class: org.locationtech.udig.tutorials.customapp.CustomPerspectiveFactory
Click the Browse button after icon and select world_obj.gif
Save the file, click the class link to open the Java Class dialog.
Press Finish to create the class.
Add the following static constants:
private static final String BOOKMARKS = "org.locationtech.udig.bookmarks.internal.ui.BookmarksView"; private static final String PROJECTS = "org.locationtech.udig.project.ui.projectExplorer"; private static final String LAYERS = "org.locationtech.udig.project.ui.layerManager";
In the createInitialLayout method, add the following code:
layout.addFastView(PROJECTS); layout.addView(LAYERS, IPageLayout.LEFT, 0.3f, IPageLayout.ID_EDITOR_AREA); layout.addView(BOOKMARKS, IPageLayout.BOTTOM, 0.7f, LAYERS);