001: /*******************************************************************************
002: * Copyright (c) 2004, 2007 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: * Chris Gross chris.gross@us.ibm.com Bug 107443
011: *******************************************************************************/package org.eclipse.ui.presentations;
012:
013: import org.eclipse.jface.action.IMenuManager;
014: import org.eclipse.swt.graphics.Point;
015:
016: /**
017: * Represents the main interface between a StackPresentation and the workbench.
018: *
019: * Not intended to be implemented by clients.
020: *
021: * @since 3.0
022: */
023: public interface IStackPresentationSite {
024: public static int STATE_MINIMIZED = 0;
025:
026: public static int STATE_MAXIMIZED = 1;
027:
028: public static int STATE_RESTORED = 2;
029:
030: /**
031: * Sets the state of the container. Called by the presentation when the
032: * user causes the the container to be minimized, maximized, etc.
033: *
034: * @param newState one of the STATE_* constants
035: */
036: public void setState(int newState);
037:
038: /**
039: * Returns the current state of the site (one of the STATE_* constants)
040: *
041: * @return the current state of the site (one of the STATE_* constants)
042: */
043: public int getState();
044:
045: /**
046: * Returns true iff the site supports the given state
047: *
048: * @param state one of the STATE_* constants, above
049: * @return true iff the site supports the given state
050: */
051: public boolean supportsState(int state);
052:
053: /**
054: * Begins dragging the given part
055: *
056: * @param beingDragged the part to drag (not null)
057: * @param initialPosition the mouse position at the time of the initial mousedown
058: * (display coordinates, not null)
059: * @param keyboard true iff the drag was initiated via mouse dragging,
060: * and false if the drag may be using the keyboard
061: */
062: public void dragStart(IPresentablePart beingDragged,
063: Point initialPosition, boolean keyboard);
064:
065: /**
066: * Closes the given set of parts.
067: *
068: * @param toClose the set of parts to close (Not null. All of the entries must be non-null)
069: */
070: public void close(IPresentablePart[] toClose);
071:
072: /**
073: * Begins dragging the entire stack of parts
074: *
075: * @param initialPosition the mouse position at the time of the initial mousedown (display coordinates,
076: * not null)
077: * @param keyboard true iff the drag was initiated via mouse dragging,
078: * and false if the drag may be using the keyboard
079: */
080: public void dragStart(Point initialPosition, boolean keyboard);
081:
082: /**
083: * Returns true iff this site will allow the given part to be closed
084: *
085: * @param toClose part to test (not null)
086: * @return true iff the part may be closed
087: */
088: public boolean isCloseable(IPresentablePart toClose);
089:
090: /**
091: * Returns true iff the given part can be dragged. If this
092: * returns false, the given part should not trigger a drag.
093: *
094: * @param toMove part to test (not null)
095: * @return true iff this part is a valid drag source
096: */
097: public boolean isPartMoveable(IPresentablePart toMove);
098:
099: /**
100: * Returns true iff this entire stack can be dragged
101: *
102: * @return tre iff the stack can be dragged
103: */
104: public boolean isStackMoveable();
105:
106: /**
107: * Makes the given part active
108: *
109: * @param toSelect
110: */
111: public void selectPart(IPresentablePart toSelect);
112:
113: /**
114: * Returns the currently selected part or null if the stack is empty
115: *
116: * @return the currently selected part or null if the stack is empty
117: */
118: public IPresentablePart getSelectedPart();
119:
120: /**
121: * Adds system actions to the given menu manager. The site may
122: * make use of the following group ids:
123: * <ul>
124: * <li><code>close</code>, for close actions</li>
125: * <li><code>size</code>, for resize actions</li>
126: * <li><code>misc</code>, for miscellaneous actions</li>
127: * </ul>
128: * The presentation can control the insertion position by creating
129: * these group IDs where appropriate.
130: *
131: * @param menuManager the menu manager to populate
132: */
133: public void addSystemActions(IMenuManager menuManager);
134:
135: /**
136: * Notifies the workbench that the preferred size of the presentation has
137: * changed. Hints to the workbench that it should trigger a layout at the
138: * next opportunity.
139: *
140: * @since 3.1
141: */
142: public void flushLayout();
143:
144: /**
145: * Returns the list of presentable parts currently in this site
146: *
147: * @return the list of presentable parts currently in this site
148: * @since 3.1
149: */
150: public IPresentablePart[] getPartList();
151:
152: /**
153: * Returns the property with the given id or <code>null</code>. Folder
154: * properties are an extensible mechanism for perspective authors to
155: * customize the appearance of view stacks. The list of customizable
156: * properties is determined by the presentation factory, and set in the
157: * perspective factory.
158: *
159: * @param id
160: * Must not be <code>null</code>.
161: * @return property value, or <code>null</code> if the property is not
162: * set.
163: * @since 3.3
164: */
165: public String getProperty(String id);
166: }
|