001: /*******************************************************************************
002: * Copyright (c) 2004, 2005 IBM Corporation and others.
003: * All rights reserved. This program and the accompanying materials
004: * are made available under the terms of the Eclipse Public License v1.0
005: * which accompanies this distribution, and is available at
006: * http://www.eclipse.org/legal/epl-v10.html
007: *
008: * Contributors:
009: * IBM Corporation - initial API and implementation
010: *******************************************************************************/package org.eclipse.ui.presentations;
011:
012: import org.eclipse.jface.action.IStatusLineManager;
013: import org.eclipse.jface.action.StatusLineManager;
014: import org.eclipse.swt.SWT;
015: import org.eclipse.swt.widgets.Composite;
016: import org.eclipse.swt.widgets.Control;
017:
018: /**
019: * This is a factory for presentation objects that control the appearance of
020: * editors, views and other components in the workbench.
021: *
022: * @since 3.0
023: */
024: public abstract class AbstractPresentationFactory {
025:
026: /**
027: * Creates an editor presentation for presenting editors.
028: * <p>
029: * The presentation creates its controls under the given parent composite.
030: * </p>
031: *
032: * @param parent
033: * the parent composite to use for the presentation's controls
034: * @param site
035: * the site used for communication between the presentation and
036: * the workbench
037: * @return a newly created part presentation
038: */
039: public abstract StackPresentation createEditorPresentation(
040: Composite parent, IStackPresentationSite site);
041:
042: /**
043: * Creates a stack presentation for presenting regular docked views.
044: * <p>
045: * The presentation creates its controls under the given parent composite.
046: * </p>
047: *
048: * @param parent
049: * the parent composite to use for the presentation's controls
050: * @param site
051: * the site used for communication between the presentation and
052: * the workbench
053: * @return a newly created part presentation
054: */
055: public abstract StackPresentation createViewPresentation(
056: Composite parent, IStackPresentationSite site);
057:
058: /**
059: * Creates a standalone stack presentation for presenting a standalone view.
060: * A standalone view cannot be docked together with other views. The title
061: * of a standalone view may be hidden.
062: * <p>
063: * The presentation creates its controls under the given parent composite.
064: * </p>
065: *
066: * @param parent
067: * the parent composite to use for the presentation's controls
068: * @param site
069: * the site used for communication between the presentation and
070: * the workbench
071: * @param showTitle
072: * <code>true</code> to show the title for the view,
073: * <code>false</code> to hide it
074: * @return a newly created part presentation
075: */
076: public abstract StackPresentation createStandaloneViewPresentation(
077: Composite parent, IStackPresentationSite site,
078: boolean showTitle);
079:
080: /**
081: * Creates the status line manager for the window.
082: * Subclasses may override.
083: *
084: * @return the window's status line manager
085: */
086: public IStatusLineManager createStatusLineManager() {
087: return new StatusLineManager();
088: }
089:
090: /**
091: * Creates the control for the window's status line.
092: * Subclasses may override.
093: *
094: * @param statusLine the window's status line manager
095: * @param parent the parent composite
096: * @return the window's status line control
097: */
098: public Control createStatusLineControl(
099: IStatusLineManager statusLine, Composite parent) {
100: return ((StatusLineManager) statusLine).createControl(parent,
101: SWT.NONE);
102: }
103:
104: /**
105: * Returns a globally unique identifier for this type of presentation factory. This is used
106: * to ensure that one presentation is not restored from mementos saved by a different
107: * presentation.
108: *
109: * @return a globally unique identifier for this type of presentation factory.
110: */
111: public String getId() {
112: return this.getClass().getName();
113: }
114: }
|