|
Eclipse eRCP Release 1.1 |
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
A workbench is the root object for the Eclipse Platform user interface.
A workbench has one or more main windows which present to the end user information based on some underlying model, typically on resources in an underlying workspace. A workbench usually starts with a single open org.eclipse.jface.window, and automatically closes when its last org.eclipse.jface.window closes.
Each workbench org.eclipse.jface.window has a collection of pages; the active page is the one that is being presented to the end user; at most one page is active in a org.eclipse.jface.window at a time.
Each workbench page has a collection of workbench parts, of which there are two kinds: views and editors. A page's parts are arranged (tiled or stacked) for presentation on the screen. The arrangement is not fixed; the user can arrange the parts as they see fit. A perspective is a template for a page, capturing a collection of parts and their arrangement.
The platform creates a workbench when the workbench plug-in is activated;
since this happens at most once during the life of the running platform,
there is only one workbench instance. Due to its singular nature, it is
commonly referred to as
This interface is not intended to be implemented by clients.
PlatformUI.getWorkbench()
Method Summary | |
---|---|
void |
addWindowListener(IWindowListener listener)
Adds a org.eclipse.jface.window listener. |
boolean |
close()
Closes this workbench and all its open windows. |
IWorkbenchWindow |
getActiveWorkbenchWindow()
Returns the currently active org.eclipse.jface.window for this workbench (if any). |
IWorkbenchCommandSupport |
getCommandSupport()
Deprecated. Please use getAdapter(ICommandService.class)
instead. |
Display |
getDisplay()
Returns the display for this workbench. |
IElementFactory |
getElementFactory(String factoryId)
Returns the element factory with the given id. |
IExtensionTracker |
getExtensionTracker()
Return the extension tracker for the workbench. |
IPerspectiveRegistry |
getPerspectiveRegistry()
Returns the perspective registry for the workbench. |
PreferenceManager |
getPreferenceManager()
Returns the org.eclipse.jface.preference manager for the workbench. |
IPreferenceStore |
getPreferenceStore()
Returns the org.eclipse.jface.preference store for the workbench. |
ISharedImages |
getSharedImages()
Returns the shared images for the workbench. |
IViewRegistry |
getViewRegistry()
Returns the editor registry for the workbench. |
int |
getWorkbenchWindowCount()
Returns the number of open main windows associated with this workbench. |
IWorkbenchWindow[] |
getWorkbenchWindows()
Returns a list of the open main windows associated with this workbench. |
boolean |
isClosing()
Returns a boolean indicating whether the workbench is in the process of closing. |
IWorkbenchWindow |
openWorkbenchWindow(IAdaptable input)
Creates and opens a new workbench org.eclipse.jface.window with one page. |
IWorkbenchWindow |
openWorkbenchWindow(String perspectiveId,
IAdaptable input)
Creates and opens a new workbench org.eclipse.jface.window with one page. |
void |
removeWindowListener(IWindowListener listener)
Removes a org.eclipse.jface.window listener. |
boolean |
restart()
Closes then restarts this workbench. |
IWorkbenchPage |
showPerspective(String perspectiveId,
IWorkbenchWindow window)
Shows the specified perspective to the user. |
IWorkbenchPage |
showPerspective(String perspectiveId,
IWorkbenchWindow window,
IAdaptable input)
Shows the specified perspective to the user. |
Method Detail |
public Display getDisplay()
Code should always ask the workbench for the display rather than rely on
Display.getDefault()
.
public void addWindowListener(IWindowListener listener)
listener
- the org.eclipse.jface.window listener to addpublic void removeWindowListener(IWindowListener listener)
listener
- the org.eclipse.jface.window listener to removepublic boolean close()
If the workbench has an open editor with unsaved content, the user will be given the opportunity to save it.
true
if the workbench was successfully closed,
and false
if it is still openpublic IWorkbenchWindow getActiveWorkbenchWindow()
null
if there is no active workbench org.eclipse.jface.window.
Returns null
if called from a non-UI thread.
null
if there
is no active workbench org.eclipse.jface.window or if called from a non-UI threadpublic IPerspectiveRegistry getPerspectiveRegistry()
public PreferenceManager getPreferenceManager()
public IPreferenceStore getPreferenceStore()
public ISharedImages getSharedImages()
public int getWorkbenchWindowCount()
public IWorkbenchWindow[] getWorkbenchWindows()
public IWorkbenchWindow openWorkbenchWindow(String perspectiveId, IAdaptable input) throws WorkbenchException
Note: The caller is responsible to ensure the action using this
method will explicitly inform the user a new org.eclipse.jface.window will be opened.
Otherwise, callers are strongly recommended to use the openPerspective
APIs to programmatically show a perspective to avoid confusing the user.
In most cases where this method is used the caller is tightly coupled to a particular perspective. They define it in the registry and contribute some user interface action to open or activate it. In situations like this a static variable is often used to identify the perspective ID.
perspectiveId
- the perspective id for the org.eclipse.jface.window's initial page, or null
for no initial pageinput
- the page input, or null
if there is no current
input. This is used to seed the input for the new page's
views.
WorkbenchException
- if a new org.eclipse.jface.window and page could not be openedshowPerspective(String, IWorkbenchWindow, IAdaptable)
public IWorkbenchWindow openWorkbenchWindow(IAdaptable input) throws WorkbenchException
Note: The caller is responsible to ensure the action using this
method will explicitly inform the user a new org.eclipse.jface.window will be opened.
Otherwise, callers are strongly recommended to use the openPerspective
APIs to programmatically show a perspective to avoid confusing the user.
input
- the page input, or null
if there is no current
input. This is used to seed the input for the new page's
views.
WorkbenchException
- if a new org.eclipse.jface.window and page could not be openedshowPerspective(String, IWorkbenchWindow, IAdaptable)
public boolean restart()
If the workbench has an open editor with unsaved content, the user will be given the opportunity to save it.
true
if the workbench was successfully closed,
and false
if it could not be closedpublic IWorkbenchPage showPerspective(String perspectiveId, IWorkbenchWindow window) throws WorkbenchException
The perspective may be shown in the specified org.eclipse.jface.window, in another existing org.eclipse.jface.window, or in a new org.eclipse.jface.window depending on user preferences. The exact policy is controlled by the workbench to ensure consistency to the user. The policy is subject to change. The current policy is as follows:
The workbench also defines a number of menu items to activate or open
each registered perspective. A complete list of these perspectives is
available from the perspective registry found on IWorkbench
.
perspectiveId
- the perspective ID to show
WorkbenchException
- if the perspective could not be shownpublic IWorkbenchPage showPerspective(String perspectiveId, IWorkbenchWindow window, IAdaptable input) throws WorkbenchException
The perspective may be shown in the specified org.eclipse.jface.window, in another existing org.eclipse.jface.window, or in a new org.eclipse.jface.window depending on user preferences. The exact policy is controlled by the workbench to ensure consistency to the user. The policy is subject to change. The current policy is as follows:
The workbench also defines a number of menu items to activate or open
each registered perspective. A complete list of these perspectives is
available from the perspective registry found on IWorkbench
.
perspectiveId
- the perspective ID to showinput
- the page input, or null
if there is no current
input. This is used to seed the input for the page's views
WorkbenchException
- if the perspective could not be shownpublic IElementFactory getElementFactory(String factoryId)
factoryId
- the id of the element factory
null
if noneIElementFactory
public IWorkbenchCommandSupport getCommandSupport()
getAdapter(ICommandService.class)
instead.
null
.ICommandService
public boolean isClosing()
true
if the workbench is in the process of
closing, false
otherwisepublic IExtensionTracker getExtensionTracker()
Return the extension tracker for the workbench. This tracker may be used by plug-ins to ensure responsiveness to changes to the plug-in registry.
The tracker at this level of the workbench is typically used to track
elements that persist for the life of the workbench. For example,
IEditorDescriptor
objects fall into this category.
This method is EXPERIMENTAL and may change prior to the 3.1 release.
IWorkbenchWindow.getExtensionTracker()
,
IWorkbenchPage.getExtensionTracker()
public IViewRegistry getViewRegistry()
|
Eclipse eRCP Release 1.1 |
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |