KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*******************************************************************************
2  * Copyright (c) 2004, 2007 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  * Chris Gross chris.gross@us.ibm.com Bug 107443
11  *******************************************************************************/

12 package org.eclipse.ui.presentations;
13
14 import org.eclipse.jface.action.IMenuManager;
15 import org.eclipse.swt.graphics.Point;
16
17 /**
18  * Represents the main interface between a StackPresentation and the workbench.
19  *
20  * Not intended to be implemented by clients.
21  *
22  * @since 3.0
23  */

24 public interface IStackPresentationSite {
25     public static int STATE_MINIMIZED = 0;
26
27     public static int STATE_MAXIMIZED = 1;
28
29     public static int STATE_RESTORED = 2;
30
31     /**
32      * Sets the state of the container. Called by the presentation when the
33      * user causes the the container to be minimized, maximized, etc.
34      *
35      * @param newState one of the STATE_* constants
36      */

37     public void setState(int newState);
38
39     /**
40      * Returns the current state of the site (one of the STATE_* constants)
41      *
42      * @return the current state of the site (one of the STATE_* constants)
43      */

44     public int getState();
45
46     /**
47      * Returns true iff the site supports the given state
48      *
49      * @param state one of the STATE_* constants, above
50      * @return true iff the site supports the given state
51      */

52     public boolean supportsState(int state);
53
54     /**
55      * Begins dragging the given part
56      *
57      * @param beingDragged the part to drag (not null)
58      * @param initialPosition the mouse position at the time of the initial mousedown
59      * (display coordinates, not null)
60      * @param keyboard true iff the drag was initiated via mouse dragging,
61      * and false if the drag may be using the keyboard
62      */

63     public void dragStart(IPresentablePart beingDragged, Point initialPosition,
64             boolean keyboard);
65
66     /**
67      * Closes the given set of parts.
68      *
69      * @param toClose the set of parts to close (Not null. All of the entries must be non-null)
70      */

71     public void close(IPresentablePart[] toClose);
72
73     /**
74      * Begins dragging the entire stack of parts
75      *
76      * @param initialPosition the mouse position at the time of the initial mousedown (display coordinates,
77      * not null)
78      * @param keyboard true iff the drag was initiated via mouse dragging,
79      * and false if the drag may be using the keyboard
80      */

81     public void dragStart(Point initialPosition, boolean keyboard);
82
83     /**
84      * Returns true iff this site will allow the given part to be closed
85      *
86      * @param toClose part to test (not null)
87      * @return true iff the part may be closed
88      */

89     public boolean isCloseable(IPresentablePart toClose);
90
91     /**
92      * Returns true iff the given part can be dragged. If this
93      * returns false, the given part should not trigger a drag.
94      *
95      * @param toMove part to test (not null)
96      * @return true iff this part is a valid drag source
97      */

98     public boolean isPartMoveable(IPresentablePart toMove);
99
100     /**
101      * Returns true iff this entire stack can be dragged
102      *
103      * @return tre iff the stack can be dragged
104      */

105     public boolean isStackMoveable();
106
107     /**
108      * Makes the given part active
109      *
110      * @param toSelect
111      */

112     public void selectPart(IPresentablePart toSelect);
113
114     /**
115      * Returns the currently selected part or null if the stack is empty
116      *
117      * @return the currently selected part or null if the stack is empty
118      */

119     public IPresentablePart getSelectedPart();
120
121     /**
122      * Adds system actions to the given menu manager. The site may
123      * make use of the following group ids:
124      * <ul>
125      * <li><code>close</code>, for close actions</li>
126      * <li><code>size</code>, for resize actions</li>
127      * <li><code>misc</code>, for miscellaneous actions</li>
128      * </ul>
129      * The presentation can control the insertion position by creating
130      * these group IDs where appropriate.
131      *
132      * @param menuManager the menu manager to populate
133      */

134     public void addSystemActions(IMenuManager menuManager);
135     
136     /**
137      * Notifies the workbench that the preferred size of the presentation has
138      * changed. Hints to the workbench that it should trigger a layout at the
139      * next opportunity.
140      *
141      * @since 3.1
142      */

143     public void flushLayout();
144     
145     /**
146      * Returns the list of presentable parts currently in this site
147      *
148      * @return the list of presentable parts currently in this site
149      * @since 3.1
150      */

151     public IPresentablePart[] getPartList();
152     
153     /**
154      * Returns the property with the given id or <code>null</code>. Folder
155      * properties are an extensible mechanism for perspective authors to
156      * customize the appearance of view stacks. The list of customizable
157      * properties is determined by the presentation factory, and set in the
158      * perspective factory.
159      *
160      * @param id
161      * Must not be <code>null</code>.
162      * @return property value, or <code>null</code> if the property is not
163      * set.
164      * @since 3.3
165      */

166     public String JavaDoc getProperty(String JavaDoc id);
167 }
168
Popular Tags