001: /*******************************************************************************
002: * Copyright (c) 2000, 2006 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;
011:
012: /**
013: * The workbench's global registry of perspectives.
014: * <p>
015: * This registry contains a descriptor for each perspectives in the workbench.
016: * It is initially populated with stock perspectives from the workbench's
017: * perspective extension point (<code>"org.eclipse.ui.perspectives"</code>) and
018: * with custom perspectives defined by the user.
019: * </p><p>
020: * This interface is not intended to be implemented by clients.
021: * </p>
022: * @see IWorkbench#getPerspectiveRegistry
023: */
024: public interface IPerspectiveRegistry {
025: /**
026: * Clones an existing perspective.
027: *
028: * @param id the id for the cloned perspective, which must not already be used by
029: * any registered perspective
030: * @param label the label assigned to the cloned perspective
031: * @param desc the perspective to clone
032: * @return the cloned perspective descriptor
033: * @throws IllegalArgumentException if there is already a perspective with the given id
034: *
035: * @since 3.0
036: */
037: public IPerspectiveDescriptor clonePerspective(String id,
038: String label, IPerspectiveDescriptor desc)
039: throws IllegalArgumentException;
040:
041: /**
042: * Deletes a perspective. Has no effect if the perspective is defined in an
043: * extension.
044: *
045: * @param persp the perspective to delete
046: * @since 3.2
047: */
048: public void deletePerspective(IPerspectiveDescriptor persp);
049:
050: /**
051: * Finds and returns the registered perspective with the given perspective id.
052: *
053: * @param perspectiveId the perspective id
054: * @return the perspective, or <code>null</code> if none
055: * @see IPerspectiveDescriptor#getId
056: */
057: public IPerspectiveDescriptor findPerspectiveWithId(
058: String perspectiveId);
059:
060: /**
061: * Finds and returns the registered perspective with the given label.
062: *
063: * @param label the label
064: * @return the perspective, or <code>null</code> if none
065: * @see IPerspectiveDescriptor#getLabel
066: */
067: public IPerspectiveDescriptor findPerspectiveWithLabel(String label);
068:
069: /**
070: * Returns the id of the default perspective for the workbench. This identifies one
071: * perspective extension within the workbench's perspective registry.
072: * <p>
073: * Returns <code>null</code> if there is no default perspective.
074: * </p>
075: *
076: * @return the default perspective id, or <code>null</code>
077: */
078: public String getDefaultPerspective();
079:
080: /**
081: * Returns a list of the perspectives known to the workbench.
082: *
083: * @return a list of perspectives
084: */
085: public IPerspectiveDescriptor[] getPerspectives();
086:
087: /**
088: * Sets the default perspective for the workbench to the given perspective id.
089: * If non-<code>null</code>, the id must correspond to a perspective extension
090: * within the workbench's perspective registry.
091: * <p>
092: * A <code>null</code> id indicates no default perspective.
093: * </p>
094: *
095: * @param id a perspective id, or <code>null</code>
096: */
097: public void setDefaultPerspective(String id);
098:
099: /**
100: * Reverts a perspective back to its original definition
101: * as specified in the plug-in manifest.
102: *
103: * @param perspToRevert the perspective to revert
104: *
105: * @since 3.0
106: */
107: public void revertPerspective(IPerspectiveDescriptor perspToRevert);
108: }
|