KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ui > presentations > AbstractPresentationFactory


1 /*******************************************************************************
2  * Copyright (c) 2004, 2005 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.ui.presentations;
12
13 import org.eclipse.jface.action.IStatusLineManager;
14 import org.eclipse.jface.action.StatusLineManager;
15 import org.eclipse.swt.SWT;
16 import org.eclipse.swt.widgets.Composite;
17 import org.eclipse.swt.widgets.Control;
18
19 /**
20  * This is a factory for presentation objects that control the appearance of
21  * editors, views and other components in the workbench.
22  *
23  * @since 3.0
24  */

25 public abstract class AbstractPresentationFactory {
26
27     /**
28      * Creates an editor presentation for presenting editors.
29      * <p>
30      * The presentation creates its controls under the given parent composite.
31      * </p>
32      *
33      * @param parent
34      * the parent composite to use for the presentation's controls
35      * @param site
36      * the site used for communication between the presentation and
37      * the workbench
38      * @return a newly created part presentation
39      */

40     public abstract StackPresentation createEditorPresentation(
41             Composite parent, IStackPresentationSite site);
42
43     /**
44      * Creates a stack presentation for presenting regular docked views.
45      * <p>
46      * The presentation creates its controls under the given parent composite.
47      * </p>
48      *
49      * @param parent
50      * the parent composite to use for the presentation's controls
51      * @param site
52      * the site used for communication between the presentation and
53      * the workbench
54      * @return a newly created part presentation
55      */

56     public abstract StackPresentation createViewPresentation(Composite parent,
57             IStackPresentationSite site);
58
59     /**
60      * Creates a standalone stack presentation for presenting a standalone view.
61      * A standalone view cannot be docked together with other views. The title
62      * of a standalone view may be hidden.
63      * <p>
64      * The presentation creates its controls under the given parent composite.
65      * </p>
66      *
67      * @param parent
68      * the parent composite to use for the presentation's controls
69      * @param site
70      * the site used for communication between the presentation and
71      * the workbench
72      * @param showTitle
73      * <code>true</code> to show the title for the view,
74      * <code>false</code> to hide it
75      * @return a newly created part presentation
76      */

77     public abstract StackPresentation createStandaloneViewPresentation(
78             Composite parent, IStackPresentationSite site, boolean showTitle);
79
80     /**
81      * Creates the status line manager for the window.
82      * Subclasses may override.
83      *
84      * @return the window's status line manager
85      */

86     public IStatusLineManager createStatusLineManager() {
87         return new StatusLineManager();
88     }
89
90     /**
91      * Creates the control for the window's status line.
92      * Subclasses may override.
93      *
94      * @param statusLine the window's status line manager
95      * @param parent the parent composite
96      * @return the window's status line control
97      */

98     public Control createStatusLineControl(IStatusLineManager statusLine,
99             Composite parent) {
100         return ((StatusLineManager) statusLine).createControl(parent, SWT.NONE);
101     }
102     
103     /**
104      * Returns a globally unique identifier for this type of presentation factory. This is used
105      * to ensure that one presentation is not restored from mementos saved by a different
106      * presentation.
107      *
108      * @return a globally unique identifier for this type of presentation factory.
109      */

110     public String JavaDoc getId() {
111         return this.getClass().getName();
112     }
113 }
114
Popular Tags