01: /*******************************************************************************
02: * Copyright (c) 2000, 2005 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.ui;
11:
12: /**
13: * A perspective factory generates the initial page layout and visible
14: * action set for a page.
15: * <p>
16: * When a new page is created in the workbench a perspective is used to define
17: * the initial page layout. If this is a predefined perspective (based on an extension to
18: * the workbench's perspective extension point) an <code>IPerspectiveFactory</code>
19: * is used to define the initial page layout.
20: * </p><p>
21: * The factory for the perspective is created and passed an <code>IPageLayout</code>
22: * where views can be added. The default layout consists of the editor area with no
23: * additional views. Additional views are added to the layout using
24: * the editor area as the initial point of reference. The factory is used only briefly
25: * while a new page is created; then discarded.
26: * </p><p>
27: * To define a perspective clients should implement this interface and
28: * include the name of their class in an extension to the workbench's perspective
29: * extension point (named <code>"org.eclipse.ui.perspectives"</code>). For example,
30: * the plug-in's XML markup might contain:
31: * <pre>
32: * <extension point="org.eclipse.ui.perspectives">
33: * <perspective
34: * id="com.example.javaplugin.perspective"
35: * name="Java"
36: * class="com.example.javaplugin.JavaPerspective">
37: * </perspective>
38: * </extension>
39: * </pre>
40: * </p><p>
41: * Example of populating a page with standard workbench views:
42: * <pre>
43: * public void createInitialLayout(IPageLayout layout) {
44: * // Get the editor area.
45: * String editorArea = layout.getEditorArea();
46: *
47: * // Top left: Resource Navigator view and Bookmarks view placeholder
48: * IFolderLayout topLeft = layout.createFolder("topLeft", IPageLayout.LEFT, 0.25f,
49: * editorArea);
50: * topLeft.addView(IPageLayout.ID_RES_NAV);
51: * topLeft.addPlaceholder(IPageLayout.ID_BOOKMARKS);
52: *
53: * // Bottom left: Outline view and Property Sheet view
54: * IFolderLayout bottomLeft = layout.createFolder("bottomLeft", IPageLayout.BOTTOM, 0.50f,
55: * "topLeft");
56: * bottomLeft.addView(IPageLayout.ID_OUTLINE);
57: * bottomLeft.addView(IPageLayout.ID_PROP_SHEET);
58: *
59: * // Bottom right: Task List view
60: * layout.addView(IPageLayout.ID_TASK_LIST, IPageLayout.BOTTOM, 0.66f, editorArea);
61: * }
62: * </pre>
63: * </p><p>
64: * Within the workbench a user may override the visible views, layout and
65: * action sets of a predefined perspective to create a custom perspective. In such cases
66: * the layout is persisted by the workbench and the factory is not used.
67: * </p>
68: */
69: public interface IPerspectiveFactory {
70: /**
71: * Creates the initial layout for a page.
72: * <p>
73: * Implementors of this method may add additional views to a
74: * perspective. The perspective already contains an editor folder
75: * identified by the result of <code>IPageLayout.getEditorArea()</code>.
76: * Additional views should be added to the layout using this value as
77: * the initial point of reference.
78: * </p>
79: *
80: * @param layout the page layout
81: */
82: public void createInitialLayout(IPageLayout layout);
83: }
|