KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ui > IWorkbenchSite


1 /*******************************************************************************
2  * Copyright (c) 2000, 2006 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;
12
13 import org.eclipse.core.runtime.IAdaptable;
14 import org.eclipse.jface.viewers.ISelectionProvider;
15 import org.eclipse.jface.window.IShellProvider;
16 import org.eclipse.swt.widgets.Shell;
17 import org.eclipse.ui.commands.ICommandService;
18 import org.eclipse.ui.contexts.IContextService;
19 import org.eclipse.ui.handlers.IHandlerService;
20 import org.eclipse.ui.keys.IBindingService;
21 import org.eclipse.ui.services.IServiceLocator;
22
23 /**
24  * The common interface between the workbench and its parts, including pages
25  * within parts.
26  * <p>
27  * The workbench site supports a few {@link IServiceLocator services} by
28  * default. If these services are used to allocate resources, it is important to
29  * remember to clean up those resources after you are done with them. Otherwise,
30  * the resources will exist until the workbench site is disposed. The supported
31  * services are:
32  * </p>
33  * <ul>
34  * <li>{@link ICommandService}</li>
35  * <li>{@link IContextService}</li>
36  * <li>{@link IHandlerService}</li>
37  * <li>{@link IBindingService}. Resources allocated through this service will
38  * not be cleaned up until the workbench shuts down.</li>
39  * </ul>
40  * <p>
41  * This interface is not intended to be implemented or extended by clients.
42  * </p>
43  *
44  * @see org.eclipse.ui.IWorkbenchPartSite
45  * @see org.eclipse.ui.part.IPageSite
46  * @since 2.0
47  */

48 public interface IWorkbenchSite extends IAdaptable, IShellProvider,
49         IServiceLocator {
50
51     /**
52      * Returns the page containing this workbench site.
53      *
54      * @return the page containing this workbench site
55      */

56     public IWorkbenchPage getPage();
57
58     /**
59      * Returns the selection provider for this workbench site.
60      *
61      * @return the selection provider, or <code>null</code> if none
62      */

63     public ISelectionProvider getSelectionProvider();
64
65     /**
66      * Returns the shell for this workbench site. Not intended to be called from
67      * outside the UI thread. Clients should call IWorkbench.getDisplay() to
68      * gain access to the display rather than calling getShell().getDisplay().
69      *
70      * <p>
71      * For compatibility, this method will not throw an exception if called from
72      * outside the UI thread, but the returned Shell may be wrong.
73      * </p>
74      *
75      * @return the shell for this workbench site
76      */

77     public Shell getShell();
78
79     /**
80      * Returns the workbench window containing this workbench site.
81      *
82      * @return the workbench window containing this workbench site
83      */

84     public IWorkbenchWindow getWorkbenchWindow();
85
86     /**
87      * Sets the selection provider for this workbench site.
88      *
89      * @param provider
90      * the selection provider, or <code>null</code> to clear it
91      */

92     public void setSelectionProvider(ISelectionProvider provider);
93
94 }
95
Popular Tags