KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ui > application > IWorkbenchWindowConfigurer


1 /*******************************************************************************
2  * Copyright (c) 2003, 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.application;
12
13 import org.eclipse.core.runtime.IStatus;
14 import org.eclipse.swt.dnd.DropTargetListener;
15 import org.eclipse.swt.dnd.Transfer;
16 import org.eclipse.swt.graphics.Point;
17 import org.eclipse.swt.widgets.Composite;
18 import org.eclipse.swt.widgets.Control;
19 import org.eclipse.swt.widgets.Menu;
20 import org.eclipse.ui.IMemento;
21 import org.eclipse.ui.IWorkbenchWindow;
22 import org.eclipse.ui.presentations.AbstractPresentationFactory;
23
24 /**
25  * Interface providing special access for configuring workbench windows.
26  * <p>
27  * Window configurer objects are in 1-1 correspondence with the workbench
28  * windows they configure. Clients may use <code>get/setData</code> to
29  * associate arbitrary state with the window configurer object.
30  * </p>
31  * <p>
32  * Note that these objects are only available to the main application
33  * (the plug-in that creates and owns the workbench).
34  * </p>
35  * <p>
36  * This interface is not intended to be implemented by clients.
37  * </p>
38  *
39  * @see IWorkbenchConfigurer#getWindowConfigurer
40  * @see WorkbenchAdvisor#preWindowOpen
41  * @since 3.0
42  */

43 public interface IWorkbenchWindowConfigurer {
44     /**
45      * Returns the underlying workbench window.
46      *
47      * @return the workbench window
48      */

49     public IWorkbenchWindow getWindow();
50
51     /**
52      * Returns the workbench configurer.
53      *
54      * @return the workbench configurer
55      */

56     public IWorkbenchConfigurer getWorkbenchConfigurer();
57
58     /**
59      * Returns the action bar configurer for this workbench
60      * window.
61      *
62      * @return the action bar configurer
63      */

64     public IActionBarConfigurer getActionBarConfigurer();
65
66     /**
67      * Returns the title of the underlying workbench window.
68      *
69      * @return the window title
70      */

71     public String JavaDoc getTitle();
72
73     /**
74      * Sets the title of the underlying workbench window.
75      *
76      * @param title the window title
77      */

78     public void setTitle(String JavaDoc title);
79
80     /**
81      * Returns whether the underlying workbench window has a menu bar.
82      * <p>
83      * The initial value is <code>true</code>.
84      * </p>
85      *
86      * @return <code>true</code> for a menu bar, and <code>false</code>
87      * for no menu bar
88      */

89     public boolean getShowMenuBar();
90
91     /**
92      * Sets whether the underlying workbench window has a menu bar.
93      *
94      * @param show <code>true</code> for a menu bar, and <code>false</code>
95      * for no menu bar
96      */

97     public void setShowMenuBar(boolean show);
98
99     /**
100      * Returns whether the underlying workbench window has a cool bar.
101      * <p>
102      * The initial value is <code>true</code>.
103      * </p>
104      *
105      * @return <code>true</code> for a cool bar, and <code>false</code>
106      * for no cool bar
107      */

108     public boolean getShowCoolBar();
109
110     /**
111      * Sets whether the underlying workbench window has a cool bar.
112      *
113      * @param show <code>true</code> for a cool bar, and <code>false</code>
114      * for no cool bar
115      */

116     public void setShowCoolBar(boolean show);
117
118     /**
119      * Returns whether the underlying workbench window has a status line.
120      * <p>
121      * The initial value is <code>true</code>.
122      * </p>
123      *
124      * @return <code>true</code> for a status line, and <code>false</code>
125      * for no status line
126      */

127     public boolean getShowStatusLine();
128
129     /**
130      * Sets whether the underlying workbench window has a status line.
131      *
132      * @param show <code>true</code> for a status line, and <code>false</code>
133      * for no status line
134      */

135     public void setShowStatusLine(boolean show);
136
137     /**
138      * Returns whether the underlying workbench window has a perspective bar (the
139      * perspective bar provides buttons to quickly switch between perspectives).
140      * <p>
141      * The initial value is <code>false</code>.
142      * </p>
143      *
144      * @return <code>true</code> for a perspective bar, and <code>false</code>
145      * for no perspective bar
146      */

147     public boolean getShowPerspectiveBar();
148
149     /**
150      * Sets whether the underlying workbench window has a perspective bar (the
151      * perspective bar provides buttons to quickly switch between perspectives).
152      *
153      * @param show <code>true</code> for a perspective bar, and
154      * <code>false</code> for no perspective bar
155      */

156     public void setShowPerspectiveBar(boolean show);
157
158     /**
159      * Returns whether the underlying workbench window has fast view bars.
160      * <p>
161      * The initial value is <code>false</code>.
162      * </p>
163      *
164      * @return <code>true</code> for fast view bars, and
165      * <code>false</code> for no fast view bars
166      */

167     public boolean getShowFastViewBars();
168
169     /**
170      * Sets whether the underlying workbench window has fast view bars.
171      *
172      * @param enable <code>true</code> for fast view bars, and
173      * <code>false</code> for no fast view bars
174      */

175     public void setShowFastViewBars(boolean enable);
176
177     /**
178      * Returns whether the underlying workbench window has a progress indicator.
179      * <p>
180      * The initial value is <code>false</code>.
181      * </p>
182      *
183      * @return <code>true</code> for a progress indicator, and <code>false</code>
184      * for no progress indicator
185      */

186     public boolean getShowProgressIndicator();
187
188     /**
189      * Sets whether the underlying workbench window has a progress indicator.
190      *
191      * @param show <code>true</code> for a progress indicator, and <code>false</code>
192      * for no progress indicator
193      */

194     public void setShowProgressIndicator(boolean show);
195
196     /**
197      * Returns the style bits to use for the window's shell when it is created.
198      * The default is <code>SWT.SHELL_TRIM</code>.
199      *
200      * @return the shell style bits
201      */

202     public int getShellStyle();
203
204     /**
205      * Sets the style bits to use for the window's shell when it is created.
206      * This method has no effect after the shell is created.
207      * That is, it must be called within the <code>preWindowOpen</code>
208      * callback on <code>WorkbenchAdvisor</code>.
209      * <p>
210      * For more details on the applicable shell style bits, see the
211      * documentation for {@link org.eclipse.swt.widgets.Shell}.
212      * </p>
213      *
214      * @param shellStyle the shell style bits
215      */

216     public void setShellStyle(int shellStyle);
217
218     /**
219      * Returns the size to use for the window's shell when it is created.
220      *
221      * @return the initial size to use for the shell
222      */

223     public Point getInitialSize();
224
225     /**
226      * Sets the size to use for the window's shell when it is created.
227      * This method has no effect after the shell is created.
228      * That is, it must be called within the <code>preWindowOpen</code>
229      * callback on <code>WorkbenchAdvisor</code>.
230      *
231      * @param initialSize the initial size to use for the shell
232      */

233     public void setInitialSize(Point initialSize);
234
235     /**
236      * Returns the data associated with this workbench window at the given key.
237      *
238      * @param key the key
239      * @return the data, or <code>null</code> if there is no data at the given
240      * key
241      */

242     public Object JavaDoc getData(String JavaDoc key);
243
244     /**
245      * Sets the data associated with this workbench window at the given key.
246      *
247      * @param key the key
248      * @param data the data, or <code>null</code> to delete existing data
249      */

250     public void setData(String JavaDoc key, Object JavaDoc data);
251
252     /**
253      * Adds the given drag and drop <code>Transfer</code> type to the ones
254      * supported for drag and drop on the editor area of this workbench window.
255      * <p>
256      * The workbench advisor would ordinarily call this method from the
257      * <code>preWindowOpen</code> callback.
258      * A newly-created workbench window supports no drag and drop transfer
259      * types. Adding <code>EditorInputTransfer.getInstance()</code>
260      * enables <code>IEditorInput</code>s to be transferred.
261      * </p>
262      * <p>
263      * Note that drag and drop to the editor area requires adding one or more
264      * transfer types (using <code>addEditorAreaTransfer</code>) and
265      * configuring a drop target listener
266      * (with <code>configureEditorAreaDropListener</code>)
267      * capable of handling any of those transfer types.
268      * </p>
269      *
270      * @param transfer a drag and drop transfer object
271      * @see #configureEditorAreaDropListener
272      * @see org.eclipse.ui.part.EditorInputTransfer
273      */

274     public void addEditorAreaTransfer(Transfer transfer);
275
276     /**
277      * Configures the drop target listener for the editor area of this workbench window.
278      * <p>
279      * The workbench advisor ordinarily calls this method from the
280      * <code>preWindowOpen</code> callback.
281      * A newly-created workbench window has no configured drop target listener for its
282      * editor area.
283      * </p>
284      * <p>
285      * Note that drag and drop to the editor area requires adding one or more
286      * transfer types (using <code>addEditorAreaTransfer</code>) and
287      * configuring a drop target listener
288      * (with <code>configureEditorAreaDropListener</code>)
289      * capable of handling any of those transfer types.
290      * </p>
291      *
292      * @param dropTargetListener the drop target listener that will handle
293      * requests to drop an object on to the editor area of this window
294      *
295      * @see #addEditorAreaTransfer
296      */

297     public void configureEditorAreaDropListener(
298             DropTargetListener dropTargetListener);
299
300     /**
301      * Returns the presentation factory for this window. The window consults its presentation
302      * factory for the presentation aspects of views, editors, status lines, and other components
303      * of the window.
304      * <p>
305      * If no presentation factory has been set, a default one is returned.
306      * </p>
307      *
308      * @return the presentation factory used for this window
309      *
310      * @deprecated the presentation factory is now obtained via extension point
311      * and a preference on org.eclipse.ui specifying which one to use;
312      * see IWorkbenchPreferenceConstants.PRESENTATION_FACTORY_ID
313      */

314     public AbstractPresentationFactory getPresentationFactory();
315
316     /**
317      * Sets the presentation factory. The window consults its presentation
318      * factory for the presentation aspects of views, editors, status lines, and other components
319      * of the window.
320      * <p>
321      * This must be called before the window's controls are created, for example
322      * in <code>preWindowOpen</code>.
323      * </p>
324      *
325      * @param factory the presentation factory to use for this window
326      *
327      * @deprecated the presentation factory is now obtained via extension point
328      * and a preference on org.eclipse.ui specifying which one to use;
329      * see IWorkbenchPreferenceConstants.PRESENTATION_FACTORY_ID
330      */

331     public void setPresentationFactory(AbstractPresentationFactory factory);
332
333     /**
334      * Creates the menu bar for the window's shell.
335      * <p>
336      * This should only be called if the advisor is defining custom window contents
337      * in <code>createWindowContents</code>.
338      * The caller must set it in the shell using <code>Shell.setMenuBar(Menu)</code>
339      * but must not make add, remove or change items in the result.
340      * The menu bar is populated by the window's menu manager.
341      * The application can add to the menu manager in the advisor's
342      * <code>fillActionBars</code> method instead.
343      * </p>
344      *
345      * @return the menu bar, suitable for setting in the shell
346      */

347     public Menu createMenuBar();
348
349     /**
350      * Creates the cool bar control.
351      * <p>
352      * This should only be called if the advisor is defining custom window contents
353      * in <code>createWindowContents</code>.
354      * The caller must lay out the cool bar appropriately within the parent,
355      * but must not add, remove or change items in the result (hence the
356      * return type of <code>Control</code>).
357      * The cool bar is populated by the window's cool bar manager.
358      * The application can add to the cool bar manager in the advisor's
359      * <code>fillActionBars</code> method instead.
360      * </p>
361      *
362      * @param parent the parent composite
363      * @return the cool bar control, suitable for laying out in the parent
364      */

365     public Control createCoolBarControl(Composite parent);
366
367     /**
368      * Creates the status line control.
369      * <p>
370      * This should only be called if the advisor is defining custom window contents
371      * in <code>createWindowContents</code>.
372      * The caller must lay out the status line appropriately within the parent,
373      * but must not add, remove or change items in the result (hence the
374      * return type of <code>Control</code>).
375      * The status line is populated by the window's status line manager.
376      * The application can add to the status line manager in the advisor's
377      * <code>fillActionBars</code> method instead.
378      * </p>
379      *
380      * @param parent the parent composite
381      * @return the status line control, suitable for laying out in the parent
382      */

383     public Control createStatusLineControl(Composite parent);
384
385     /**
386      * Creates the page composite, in which the window's pages, and their
387      * views and editors, appear.
388      * <p>
389      * This should only be called if the advisor is defining custom window contents
390      * in <code>createWindowContents</code>.
391      * The caller must lay out the page composite appropriately within the parent,
392      * but must not add, remove or change items in the result (hence the
393      * return type of <code>Control</code>).
394      * The page composite is populated by the workbench.
395      * </p>
396      *
397      * @param parent the parent composite
398      * @return the page composite, suitable for laying out in the parent
399      */

400     public Control createPageComposite(Composite parent);
401     
402     /**
403      * Saves the current state of the window using the specified memento.
404      *
405      * @param memento the memento in which to save the window's state
406      * @return a status object indicating whether the save was successful
407      * @see IWorkbenchConfigurer#restoreWorkbenchWindow(IMemento)
408      * @since 3.1
409      */

410     public IStatus saveState(IMemento memento);
411 }
412
Popular Tags