01: /*******************************************************************************
02: * Copyright (c) 2000, 2006 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.ui;
11:
12: import org.eclipse.core.runtime.IAdaptable;
13: import org.eclipse.jface.viewers.ISelectionProvider;
14: import org.eclipse.jface.window.IShellProvider;
15: import org.eclipse.swt.widgets.Shell;
16: import org.eclipse.ui.commands.ICommandService;
17: import org.eclipse.ui.contexts.IContextService;
18: import org.eclipse.ui.handlers.IHandlerService;
19: import org.eclipse.ui.keys.IBindingService;
20: import org.eclipse.ui.services.IServiceLocator;
21:
22: /**
23: * The common interface between the workbench and its parts, including pages
24: * within parts.
25: * <p>
26: * The workbench site supports a few {@link IServiceLocator services} by
27: * default. If these services are used to allocate resources, it is important to
28: * remember to clean up those resources after you are done with them. Otherwise,
29: * the resources will exist until the workbench site is disposed. The supported
30: * services are:
31: * </p>
32: * <ul>
33: * <li>{@link ICommandService}</li>
34: * <li>{@link IContextService}</li>
35: * <li>{@link IHandlerService}</li>
36: * <li>{@link IBindingService}. Resources allocated through this service will
37: * not be cleaned up until the workbench shuts down.</li>
38: * </ul>
39: * <p>
40: * This interface is not intended to be implemented or extended by clients.
41: * </p>
42: *
43: * @see org.eclipse.ui.IWorkbenchPartSite
44: * @see org.eclipse.ui.part.IPageSite
45: * @since 2.0
46: */
47: public interface IWorkbenchSite extends IAdaptable, IShellProvider,
48: IServiceLocator {
49:
50: /**
51: * Returns the page containing this workbench site.
52: *
53: * @return the page containing this workbench site
54: */
55: public IWorkbenchPage getPage();
56:
57: /**
58: * Returns the selection provider for this workbench site.
59: *
60: * @return the selection provider, or <code>null</code> if none
61: */
62: public ISelectionProvider getSelectionProvider();
63:
64: /**
65: * Returns the shell for this workbench site. Not intended to be called from
66: * outside the UI thread. Clients should call IWorkbench.getDisplay() to
67: * gain access to the display rather than calling getShell().getDisplay().
68: *
69: * <p>
70: * For compatibility, this method will not throw an exception if called from
71: * outside the UI thread, but the returned Shell may be wrong.
72: * </p>
73: *
74: * @return the shell for this workbench site
75: */
76: public Shell getShell();
77:
78: /**
79: * Returns the workbench window containing this workbench site.
80: *
81: * @return the workbench window containing this workbench site
82: */
83: public IWorkbenchWindow getWorkbenchWindow();
84:
85: /**
86: * Sets the selection provider for this workbench site.
87: *
88: * @param provider
89: * the selection provider, or <code>null</code> to clear it
90: */
91: public void setSelectionProvider(ISelectionProvider provider);
92:
93: }
|